cmcts-c-agent-embedding 1.0.65-vib → 1.0.66-vib
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/README.md +349 -349
- package/dist/_basePickBy-1057a1b4.js +1 -0
- package/dist/_basePickBy-cbf78fb3.js +1 -0
- package/dist/_baseUniq-38ea2195.js +1 -0
- package/dist/_baseUniq-52a47b7b.js +1 -0
- package/dist/arc-6b847bc0.js +1 -0
- package/dist/arc-8928af28.js +1 -0
- package/dist/architecture-O4VJ6CD3-42323263.js +1 -0
- package/dist/architecture-O4VJ6CD3-b506967f.js +1 -0
- package/dist/architectureDiagram-VXUJARFQ-1bd867b6.js +1 -0
- package/dist/architectureDiagram-VXUJARFQ-2b851c59.js +1 -0
- package/dist/blockDiagram-VD42YOAC-5cea96b0.js +1 -0
- package/dist/blockDiagram-VD42YOAC-a909b757.js +1 -0
- package/dist/c4Diagram-YG6GDRKO-24d24519.js +1 -0
- package/dist/c4Diagram-YG6GDRKO-54783ab3.js +1 -0
- package/dist/channel-2af69aa2.js +1 -0
- package/dist/channel-f240e622.js +1 -0
- package/dist/chunk-4BX2VUAB-7747ae72.js +1 -0
- package/dist/chunk-4BX2VUAB-d05d937e.js +1 -0
- package/dist/chunk-55IACEB6-5a7b1be3.js +1 -0
- package/dist/chunk-55IACEB6-78729976.js +1 -0
- package/dist/chunk-B4BG7PRW-a97e69ff.js +1 -0
- package/dist/chunk-B4BG7PRW-cbf800c4.js +1 -0
- package/dist/chunk-DI55MBZ5-5dc4f926.js +1 -0
- package/dist/chunk-DI55MBZ5-95d71f6f.js +1 -0
- package/dist/chunk-FMBD7UC4-2c653fda.js +1 -0
- package/dist/chunk-FMBD7UC4-d75ed695.js +1 -0
- package/dist/chunk-QN33PNHL-0bf10733.js +1 -0
- package/dist/chunk-QN33PNHL-b00655c9.js +1 -0
- package/dist/chunk-QZHKN3VN-a979a9fe.js +1 -0
- package/dist/chunk-QZHKN3VN-d57979be.js +1 -0
- package/dist/chunk-TZMSLE5B-6755c559.js +1 -0
- package/dist/chunk-TZMSLE5B-ed6d6d7e.js +1 -0
- package/dist/classDiagram-2ON5EDUG-8b5a2a93.js +1 -0
- package/dist/classDiagram-2ON5EDUG-fa9ecfbb.js +1 -0
- package/dist/classDiagram-v2-WZHVMYZB-8b5a2a93.js +1 -0
- package/dist/classDiagram-v2-WZHVMYZB-fa9ecfbb.js +1 -0
- package/dist/clone-6cd174cf.js +1 -0
- package/dist/clone-8494eb3f.js +1 -0
- package/dist/components/buttons/ConsultationButton.d.ts +1 -0
- package/dist/components/buttons/ConsultationButton.d.ts.map +1 -1
- package/dist/components/buttons/PopupToast.d.ts +1 -1
- package/dist/components/buttons/PopupToast.d.ts.map +1 -1
- package/dist/components/modals/ZaloQRModal.d.ts.map +1 -1
- package/dist/cose-bilkent-S5V4N54A-2f5eb275.js +1 -0
- package/dist/cose-bilkent-S5V4N54A-3cda82b5.js +1 -0
- package/dist/cytoscape.esm-9acb9bfe.js +1 -0
- package/dist/dagre-6UL2VRFP-9b648c54.js +1 -0
- package/dist/dagre-6UL2VRFP-e997588d.js +1 -0
- package/dist/defaultLocale-1fe70b7d.js +1 -0
- package/dist/diagram-PSM6KHXK-1234d08d.js +1 -0
- package/dist/diagram-PSM6KHXK-15013de5.js +1 -0
- package/dist/diagram-QEK2KX5R-489b9505.js +1 -0
- package/dist/diagram-QEK2KX5R-9e94df2a.js +1 -0
- package/dist/diagram-S2PKOQOG-6fef3823.js +1 -0
- package/dist/diagram-S2PKOQOG-c943ed25.js +1 -0
- package/dist/erDiagram-Q2GNP2WA-2b1823f2.js +1 -0
- package/dist/erDiagram-Q2GNP2WA-7e6c6a04.js +1 -0
- package/dist/features/bubble/components/BubbleButton.d.ts.map +1 -1
- package/dist/flowDiagram-NV44I4VS-709c6479.js +1 -0
- package/dist/flowDiagram-NV44I4VS-98a84da9.js +1 -0
- package/dist/ganttDiagram-LVOFAZNH-1d379d6a.js +1 -0
- package/dist/ganttDiagram-LVOFAZNH-d8342586.js +1 -0
- package/dist/gitGraph-ZV4HHKMB-788776f3.js +1 -0
- package/dist/gitGraph-ZV4HHKMB-ba420dcc.js +1 -0
- package/dist/gitGraphDiagram-NY62KEGX-804d1363.js +1 -0
- package/dist/gitGraphDiagram-NY62KEGX-919097ea.js +1 -0
- package/dist/graph-834f6046.js +1 -0
- package/dist/graph-db4953aa.js +1 -0
- package/dist/info-63CPKGFF-2dccc483.js +1 -0
- package/dist/info-63CPKGFF-ef40f1c4.js +1 -0
- package/dist/infoDiagram-F6ZHWCRC-579d50b4.js +1 -0
- package/dist/infoDiagram-F6ZHWCRC-c9877bad.js +1 -0
- package/dist/init-cf76ae07.js +1 -0
- package/dist/journeyDiagram-XKPGCS4Q-25d3c922.js +1 -0
- package/dist/journeyDiagram-XKPGCS4Q-2d2cda1c.js +1 -0
- package/dist/kanban-definition-3W4ZIXB7-c556bee0.js +1 -0
- package/dist/kanban-definition-3W4ZIXB7-cdb93ec0.js +1 -0
- package/dist/katex-0a18b0df.js +1 -0
- package/dist/layout-40652dba.js +1 -0
- package/dist/layout-54ffc604.js +1 -0
- package/dist/linear-2f639b72.js +1 -0
- package/dist/linear-ed2367ff.js +1 -0
- package/dist/mermaid-parser.core-0cfa7d2a.js +1 -0
- package/dist/mermaid-parser.core-10bed742.js +1 -0
- package/dist/mindmap-definition-VGOIOE7T-169f5fe5.js +1 -0
- package/dist/mindmap-definition-VGOIOE7T-dea1c792.js +1 -0
- package/dist/ordinal-221e41d7.js +1 -0
- package/dist/packet-HUATNLJX-6f2471ea.js +1 -0
- package/dist/packet-HUATNLJX-c69e28eb.js +1 -0
- package/dist/pie-WTHONI2E-4143e44b.js +1 -0
- package/dist/pie-WTHONI2E-82b1fe3f.js +1 -0
- package/dist/pieDiagram-ADFJNKIX-499eec78.js +1 -0
- package/dist/pieDiagram-ADFJNKIX-657effd5.js +1 -0
- package/dist/quadrantDiagram-AYHSOK5B-138a0c93.js +1 -0
- package/dist/quadrantDiagram-AYHSOK5B-91137c4d.js +1 -0
- package/dist/radar-NJJJXTRR-5e934a95.js +1 -0
- package/dist/radar-NJJJXTRR-94d77527.js +1 -0
- package/dist/requirementDiagram-UZGBJVZJ-a5d9fb39.js +1 -0
- package/dist/requirementDiagram-UZGBJVZJ-d7aeec99.js +1 -0
- package/dist/sankeyDiagram-TZEHDZUN-15053ae0.js +1 -0
- package/dist/sankeyDiagram-TZEHDZUN-aadd2125.js +1 -0
- package/dist/sequenceDiagram-WL72ISMW-12e778ef.js +1 -0
- package/dist/sequenceDiagram-WL72ISMW-9330a98a.js +1 -0
- package/dist/stateDiagram-FKZM4ZOC-01225f0f.js +1 -0
- package/dist/stateDiagram-FKZM4ZOC-af4836d7.js +1 -0
- package/dist/stateDiagram-v2-4FDKWEC3-4774cc10.js +1 -0
- package/dist/stateDiagram-v2-4FDKWEC3-5ef8e019.js +1 -0
- package/dist/timeline-definition-IT6M3QCI-9921f937.js +1 -0
- package/dist/timeline-definition-IT6M3QCI-a7a9bbec.js +1 -0
- package/dist/treemap-75Q7IDZK-100ddeb7.js +1 -0
- package/dist/treemap-75Q7IDZK-851117b4.js +1 -0
- package/dist/utils/redisAndQueue.d.ts +32 -0
- package/dist/utils/redisAndQueue.d.ts.map +1 -0
- package/dist/utils/transcriptApi.d.ts.map +1 -1
- package/dist/web-0016ac81.js +1 -0
- package/dist/web-4e6d8ea9.js +1 -0
- package/dist/web.js +1 -1
- package/dist/xychartDiagram-PRI3JC2R-003630a4.js +1 -0
- package/dist/xychartDiagram-PRI3JC2R-df869780.js +1 -0
- package/package.json +2 -2
- package/server.js +401 -401
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,n){return t&&function(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,s(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t){var n,r,i,a,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return i=!(r=!0),{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){i=!0,n=e},f:function(){try{r||null==o.return||o.return()}finally{if(i)throw n}}};if(Array.isArray(e)||(o=u(e))||t)return o&&(e=o),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||u(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return"symbol"==typeof(e=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return String(e);if("object"!=typeof(n=n.call(e,t)))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string"))?e:e+""}function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(t,n){var r;if(t)return"string"==typeof t?e(t,n):"Map"===(r="Object"===(r={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}var c,d,h,p,f,g,v,y,m,b,x,w,E,k,T,C,P,S,B,D,_,A,M,R,I,N,L,z,O="undefined"==typeof window?null:window,V=O?O.navigator:null,F=(O&&O.document,l("")),X=l({}),j=l((function(){})),Y="undefined"==typeof HTMLElement?"undefined":l(HTMLElement),q=function(e){return e&&e.instanceString&&U(e.instanceString)?e.instanceString():null},W=function(e){return null!=e&&l(e)==F},U=function(e){return null!=e&&l(e)===j},H=function(e){return!$(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},K=function(e){return null!=e&&l(e)===X&&!H(e)&&e.constructor===Object},G=function(e){return null!=e&&l(e)===l(1)&&!isNaN(e)},Z=function(e){if("undefined"!==Y)return null!=e&&e instanceof HTMLElement},$=function(e){return Q(e)||J(e)},Q=function(e){return"collection"===q(e)&&e._private.single},J=function(e){return"collection"===q(e)&&!e._private.single},ee=function(e){return"core"===q(e)},te=function(e){return"stylesheet"===q(e)},ne=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},re=function(e){return function(e){return null!=e&&l(e)===X}(e)&&U(e.then)},ie=function(e,t){function n(){var r=arguments,i=t.apply(this,r),a=n.cache;return a[i]||(a[i]=e.apply(this,r))}return t=t||function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")},n.cache={},n},ae=ie((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),oe=ie((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),se=ie((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),le=function(e){return ne(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},ue=function(e,t){return e.slice(-1*t.length)===t},ce="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",de="rgb[a]?\\(("+ce+"[%]?)\\s*,\\s*("+ce+"[%]?)\\s*,\\s*("+ce+"[%]?)(?:\\s*,\\s*("+ce+"))?\\)",he="rgb[a]?\\((?:"+ce+"[%]?)\\s*,\\s*(?:"+ce+"[%]?)\\s*,\\s*(?:"+ce+"[%]?)(?:\\s*,\\s*(?:"+ce+"))?\\)",pe="hsl[a]?\\(("+ce+")\\s*,\\s*("+ce+"[%])\\s*,\\s*("+ce+"[%])(?:\\s*,\\s*("+ce+"))?\\)",fe="hsl[a]?\\((?:"+ce+")\\s*,\\s*(?:"+ce+"[%])\\s*,\\s*(?:"+ce+"[%])(?:\\s*,\\s*(?:"+ce+"))?\\)",ge=function(e,t){return e<t?-1:t<e?1:0},ve=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},ye=function(e){return(H(e)?e:null)||function(e){return me[e.toLowerCase()]}(e)||function(e){var t,n;if((4===e.length||7===e.length)&&"#"===e[0])return e=4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),parseInt(e[5]+e[6],16)),[t,n,e]}(e)||function(e){var t=new RegExp("^"+de+"$").exec(e);if(t){for(var n=[],r=[],i=1;i<=3;i++){var a=t[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),(a=r[i]?a/100*255:a)<0||255<a)return;n.push(Math.floor(a))}if((r[1]||r[2]||r[3])&&!(r[1]&&r[2]&&r[3]))return;if(void 0!==(e=t[4])){if((e=parseFloat(e))<0||1<e)return;n.push(e)}}return n}(e)||function(e){var t,n,r,i,a,o;function s(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(e=new RegExp("^"+pe+"$").exec(e)){if((t=parseInt(e[1]))<0?t=(360- -1*t%360)%360:360<t&&(t%=360),t/=360,(r=parseFloat(e[2]))<0||100<r)return;if(r/=100,(n=parseFloat(e[3]))<0||100<n)return;if(n/=100,void 0!==(e=e[4])&&((e=parseFloat(e))<0||1<e))return;0==r?i=a=o=Math.round(255*n):(r=2*n-(n=n<.5?n*(1+r):n+r-n*r),i=Math.round(255*s(r,n,t+1/3)),a=Math.round(255*s(r,n,t)),o=Math.round(255*s(r,n,t-1/3))),r=[i,a,o,e]}return r}(e)},me={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]},be=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(K(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},xe=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(K(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))return t}return t},we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ee(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ke(){return d||(d=1,c=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}),c}function Te(){var e,t;return g||(g=1,t=function(){var e;return p||(p=1,e="object"==typeof we&&we&&we.Object===Object&&we,h=e),h}(),e="object"==typeof self&&self&&self.Object===Object&&self,t=t||e||Function("return this")(),f=t),f}function Ce(){var e,t;return w||(w=1,e=function(){var e;return b||(b=1,e=/\s/,m=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}),m}(),t=/^\s+/,x=function(n){return n&&n.slice(0,e(n)+1).replace(t,"")}),x}function Pe(){var e;return k||(k=1,e=Te().Symbol,E=e),E}function Se(){var e,t,n,r;return D||(D=1,e=Pe(),t=function(){var e,t,n,r,i;return C||(C=1,e=Pe(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0,T=function(e){var t=n.call(e,i),a=e[i];try{var o=!(e[i]=void 0)}catch(e){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}),T}(),n=function(){var e;return S||(S=1,e=Object.prototype.toString,P=function(t){return e.call(t)}),P}(),r=e?e.toStringTag:void 0,B=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(r&&r in Object(e)?t:n)(e)}),B}function Be(){var e,t;return R||(R=1,e=Se(),A||(A=1,_=function(e){return null!=e&&"object"==typeof e}),t=_,M=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}),M}var De=function(){var e,t,n,r,i,a;return z||(z=1,e=ke(),y||(y=1,a=Te(),v=function(){return a.Date.now()}),t=v,n=function(){var e,t,n,r,i,a,o;return N||(N=1,e=Ce(),t=ke(),n=Be(),r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,I=function(s){if("number"==typeof s)return s;if(n(s))return NaN;if(t(s)&&(l="function"==typeof s.valueOf?s.valueOf():s,s=t(l)?l+"":l),"string"!=typeof s)return 0===s?s:+s;s=e(s);var l=i.test(s);return l||a.test(s)?o(s.slice(2),l?2:8):r.test(s)?NaN:+s}),I}(),r=Math.max,i=Math.min,L=function(a,o,s){var l,u,c,d,h,p,f=0,g=!1,v=!1,y=!0;if("function"!=typeof a)throw new TypeError("Expected a function");function m(e){var t=l,n=u;return l=u=void 0,f=e,d=a.apply(n,t)}function b(e){var t=e-p;return void 0===p||o<=t||t<0||v&&c<=e-f}function x(){var e,n=t();if(b(n))return w(n);h=setTimeout(x,(e=o-(n-p),v?i(e,c-(n-f)):e))}function w(e){return h=void 0,y&&l?m(e):(l=u=void 0,d)}function E(){var e=t(),n=b(e);if(l=arguments,u=this,p=e,n){if(void 0===h)return f=e=p,h=setTimeout(x,o),g?m(e):d;if(v)return clearTimeout(h),h=setTimeout(x,o),m(p)}return void 0===h&&(h=setTimeout(x,o)),d}return o=n(o)||0,e(s)&&(g=!!s.leading,c=(v="maxWait"in s)?r(n(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==h&&clearTimeout(h),l=p=u=h=void(f=0)},E.flush=function(){return void 0===h?d:w(t())},E}),L}(),_e=Ee(De),Ae=O?O.performance:null,Me=Ae&&Ae.now?function(){return Ae.now()}:function(){return Date.now()},Re=function(){if(O){if(O.requestAnimationFrame)return function(e){O.requestAnimationFrame(e)};if(O.mozRequestAnimationFrame)return function(e){O.mozRequestAnimationFrame(e)};if(O.webkitRequestAnimationFrame)return function(e){O.webkitRequestAnimationFrame(e)};if(O.msRequestAnimationFrame)return function(e){O.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(Me())}),1e3/60)}}(),Ie=function(e){return Re(e)},Ne=Me,Le=9261,ze=5381,Oe=function(e){for(var t,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Le;!(t=e.next()).done;)n=65599*n+t.value|0;return n},Ve=function(e){return 65599*(1<arguments.length&&void 0!==arguments[1]?arguments[1]:Le)+e|0},Fe=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:ze;return(t<<5)+t+e|0},Xe=function(e){return 2097152*e[0]+e[1]},je=function(e,t){return[Ve(e[0],t[0]),Fe(e[1],t[1])]},Ye=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return Oe({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},qe=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return Oe({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},We=function(){return Ue(arguments)},Ue=function(e){for(var t=0;t<e.length;t++)var n=e[t],r=0===t?qe(n):qe(n,r);return r};var He=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}};function Ke(e,t,n){var r,i,a;return 0===n?e:(r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=1/(t=t.w/t.h),e=function(e,t,n,r,i){return i=i*Math.PI/180,{x:Math.cos(i)*(e-n)-Math.sin(i)*(t-r)+n,y:Math.sin(i)*(e-n)+Math.cos(i)*(t-r)+r}}(e.x,e.y,r,i,n),{x:(n=He(e.x,e.y,r,i,t,a)).x,y:n.y})}var Ge,Ze,$e,Qe=!0,Je=null!=console.warn,et=null!=console.trace,tt=Number.MAX_SAFE_INTEGER||9007199254740991,nt=function(){return!0},rt=function(){return!1},it=function(){return 0},at=function(){},ot=function(e){throw new Error(e)},st=function(e){if(void 0===e)return Qe;Qe=!!e},lt=function(e){st()&&(Je?console.warn(e):(console.log(e),et&&console.trace()))},ut=function(e){return null==e?e:H(e)?e.slice():K(e)?function(e){return ve({},e)}(e):e},ct=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},dt={},ht=function(){return dt},pt=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},ft=function(e,t,n){for(var r=e.length-1;0<=r;r--)e[r]===t&&e.splice(r,1)},gt=function(e){e.splice(0,e.length)},vt=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},yt=function(e,t,n){return e[t=n?se(n,t):t]},mt=function(e,t,n,r){e[t=n?se(n,t):t]=r},bt=n((function e(){t(this,e),this._obj={}}),[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),xt="undefined"!=typeof Map?Map:bt,wt=n((function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n)for(var r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n,i=0;i<r.length;i++)this.add(r[i])}),[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter((function(t){return e.has(t)}))}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),Et="undefined"!==("undefined"==typeof Set?"undefined":l(Set))?Set:wt,kt=function(e,t){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&ee(e)){var r=t.group;if("nodes"!==(r=null==r?t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes":r)&&"edges"!==r)ot("An element must be of type `nodes` or `edges`; you specified `"+r+"`");else{this.length=1;var i,a,o=(this[0]=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:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Et,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}},s=(null==o.position.x&&(o.position.x=0),null==o.position.y&&(o.position.y=0),t.renderedPosition&&(r=t.renderedPosition,i=e.pan(),a=e.zoom(),o.position={x:(r.x-i.x)/a,y:(r.y-i.y)/a}),[]);H(t.classes)?s=t.classes:W(t.classes)&&(s=t.classes.split(/\s+/));for(var l=0,u=s.length;l<u;l++){var c=s[l];c&&""!==c&&o.classes.add(c)}this.createEmitter(),void 0!==n&&!n||this.restore(),(r=t.style||t.css)&&(lt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(r))}}else ot("An element must have a core reference and parameters set")},Tt=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){K(t)&&!$(t)&&(t=(a=t).roots||a.root,n=a.visit,r=a.directed),r=2!==arguments.length||U(n)?r:n,n=U(n)?n:function(){};for(var i,a=this._private.cy,o=t=W(t)?this.filter(t):t,s=[],l=[],u={},c={},d={},h=0,p=this.byGroup(),f=p.nodes,g=p.edges,v=0;v<o.length;v++){var y=o[v],m=y.id();y.isNode()&&(s.unshift(y),e.bfs&&(d[m]=!0,l.push(y)),c[m]=0)}for(var b;0!==s.length&&(0===(b=function(){var t=e.bfs?s.shift():s.pop(),a=t.id();if(e.dfs){if(d[a])return 0;d[a]=!0,l.push(t)}var o=c[a],p=u[a],v=null!=p?p.source():null,y=null!=p?p.target():null;y=null==p?void 0:(t.same(v)?y:v)[0];if(!0===(v=n(t,p,y,h++,o)))return i=t,1;if(!1===v)return 1;for(var m=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&g.has(e)})),b=0;b<m.length;b++){var x=m[b],w=x.connectedNodes().filter((function(e){return!e.same(t)&&f.has(e)})),E=w.id();0===w.length||d[E]||(w=w[0],s.push(w),e.bfs&&(d[E]=!0,l.push(w)),u[E]=x,c[E]=c[a]+1)}}())||1!==b););for(var x=a.collection(),w=0;w<l.length;w++){var E=l[w],k=u[E.id()];null!=k&&x.push(k),x.push(E)}return{path:a.collection(x),found:a.collection(i)}}},Ct={breadthFirstSearch:Tt({bfs:!0}),depthFirstSearch:Tt({dfs:!0})},Pt=(Ct.bfs=Ct.breadthFirstSearch,Ct.dfs=Ct.depthFirstSearch,{exports:{}}),St=Pt.exports;var Bt,Dt,_t=($e||($e=1,Ge||(Ge=1,Dt=Pt,function(){var e,t,n,r,i,a,o,s,l,u,c,d,h,p;function f(t){this.cmp=null!=t?t:e,this.nodes=[]}t=Math.floor,l=Math.min,e=function(e,t){return e<t?-1:t<e?1:0},s=function(n,r,i,a,o){var s;if(null==o&&(o=e),(i=null==i?0:i)<0)throw new Error("lo must be non-negative");for(null==a&&(a=n.length);i<a;)o(r,n[s=t((i+a)/2)])<0?a=s:i=s+1;return[].splice.apply(n,[i,i-i].concat(r)),r},r=function(t,n){var r,i;return null==n&&(n=e),r=t.pop(),t.length?(i=t[0],t[0]=r,p(t,0,n)):i=r,i},o=function(t,n,r){var i;return null==r&&(r=e),i=t[0],t[0]=n,p(t,0,r),i},a=function(t,n,r){var i;return null==r&&(r=e),t.length&&r(t[0],n)<0&&(n=(i=[t[0],n])[0],t[0]=i[1],p(t,0,r)),n},n=function(n,r){var i,a,o,s,l,u;for(null==r&&(r=e),l=[],a=0,o=(s=function(){u=[];for(var e=0,r=t(n.length/2);0<=r?e<r:r<e;0<=r?e++:e--)u.push(e);return u}.apply(this).reverse()).length;a<o;a++)i=s[a],l.push(p(n,i,r));return l},d=function(t,n,r){if(null==r&&(r=e),-1!==(n=t.indexOf(n)))return h(t,0,n,r),p(t,n,r)},u=function(t,r,i){var o,s,l,u,c;if(null==i&&(i=e),!(s=t.slice(0,r)).length)return s;for(n(s,i),l=0,u=(c=t.slice(r)).length;l<u;l++)o=c[l],a(s,o,i);return s.sort(i).reverse()},c=function(t,i,a){var o,u,c,d,h,p,f,g,v;if(null==a&&(a=e),10*i<=t.length){if((c=t.slice(0,i).sort(a)).length)for(u=c[c.length-1],d=0,p=(f=t.slice(i)).length;d<p;d++)a(o=f[d],u)<0&&(s(c,o,0,null,a),c.pop(),u=c[c.length-1]);return c}for(n(t,a),v=[],h=0,g=l(i,t.length);0<=g?h<g:g<h;0<=g?++h:--h)v.push(r(t,a));return v},h=function(t,n,r,i){var a,o,s;for(null==i&&(i=e),a=t[r];n<r&&i(a,o=t[s=r-1>>1])<0;)t[r]=o,r=s;return t[r]=a},p=function(t,n,r){var i,a,o,s,l;for(null==r&&(r=e),a=t.length,o=t[l=n],i=2*n+1;i<a;)(s=i+1)<a&&!(r(t[i],t[s])<0)&&(i=s),t[n]=t[i],i=2*(n=i)+1;return t[n]=o,h(t,l,n,r)},f.push=i=function(t,n,r){return null==r&&(r=e),t.push(n),h(t,0,t.length-1,r)},f.pop=r,f.replace=o,f.pushpop=a,f.heapify=n,f.updateItem=d,f.nlargest=u,f.nsmallest=c,f.prototype.push=function(e){return i(this.nodes,e,this.cmp)},f.prototype.pop=function(){return r(this.nodes,this.cmp)},f.prototype.peek=function(){return this.nodes[0]},f.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},f.prototype.replace=function(e){return o(this.nodes,e,this.cmp)},f.prototype.pushpop=function(e){return a(this.nodes,e,this.cmp)},f.prototype.heapify=function(){return n(this.nodes,this.cmp)},f.prototype.updateItem=function(e){return d(this.nodes,e,this.cmp)},f.prototype.clear=function(){return this.nodes=[]},f.prototype.empty=function(){return 0===this.nodes.length},f.prototype.size=function(){return this.nodes.length},f.prototype.clone=function(){var e=new f;return e.nodes=this.nodes.slice(0),e},f.prototype.toArray=function(){return this.nodes.slice(0)},f.prototype.insert=f.prototype.push,f.prototype.top=f.prototype.peek,f.prototype.front=f.prototype.peek,f.prototype.has=f.prototype.contains,f.prototype.copy=f.prototype.clone,Dt.exports=f}.call(St)),Ze=Pt.exports),Ze),At=Ee(_t),Mt=pt({root:null,weight:function(e){return 1},directed:!1}),Rt={dijkstra:function(e){function t(e){return u[e.id()]}K(e)||(e={root:(n=arguments)[0],weight:n[1],directed:n[2]});for(var n,r=(n=Mt(e)).root,i=n.weight,a=n.directed,o=this,s=i,l=(W(r)?this.filter(r):r)[0],u={},c={},d={},h=(n=this.byGroup()).nodes,p=n.edges,f=(p.unmergeBy((function(e){return e.isLoop()})),new At((function(e,n){return t(e)-t(n)}))),g=0;g<h.length;g++){var v=h[g];u[v.id()]=v.same(l)?0:1/0,f.push(v)}for(;0<f.size();){var y=f.pop(),m=t(y),b=y.id();if((d[b]=m)!==1/0)for(var x=y.neighborhood().intersect(h),w=0;w<x.length;w++){var E=x[w],k=E.id(),T=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(p),i=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<i||!n)&&(i=u,n=l)}return{edge:n,dist:i}}(y,E),C=m+T.dist;C<t(E)&&(u[E.id()]=C,f.updateItem(E),c[k]={node:y,edge:T.edge})}}return{distanceTo:function(e){return e=(W(e)?h.filter(e):e)[0],d[e.id()]},pathTo:function(e){var t=[],n=e=(W(e)?h.filter(e):e)[0],r=n.id();if(0<e.length)for(t.unshift(e);c[r];){var i=c[r];t.unshift(i.edge),t.unshift(i.node),r=(n=i.node).id()}return o.spawn(t)}}}},It={kruskal:function(e){function t(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t}e=e||function(e){return 1};for(var n=(r=this.byGroup()).nodes,r=r.edges,i=n.length,a=new Array(i),o=n,s=0;s<i;s++)a[s]=this.spawn(n[s]);for(var l=r.sort((function(t,n){return e(t)-e(n)})),u=0;u<l.length;u++){var c=l[u],d=c.source()[0],h=c.target()[0],p=(d=t(d),h=t(h),a[d]),f=a[h];d!==h&&(o.merge(c),p.merge(f),a.splice(h,1))}return o}},Nt=pt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Lt={aStar:function(e){function t(e,t){f.push(e),g.add(t)}for(var n,r,i=this.cy(),a=(e=Nt(e)).root,o=e.goal,s=e.heuristic,l=e.directed,u=e.weight,c=(a=i.collection(a)[0],o=i.collection(o)[0],e=a.id(),o.id()),d={},h={},p={},f=new At((function(e,t){return h[e.id()]-h[t.id()]})),g=new Et,v={},y={},m=(t(a,e),d[e]=0,h[e]=s(a),0);0<f.size();){if(r=(n=f.pop()).id(),g.delete(r),m++,r===c){for(var b=[],x=o,w=c,E=y[w];b.unshift(x),null!=E&&b.unshift(E),null!=(x=v[w]);)E=y[w=x.id()];return{found:!0,distance:d[r],path:this.spawn(b),steps:m}}p[r]=!0;for(var k=n._private.edges,T=0;T<k.length;T++){var C,P,S,B=k[T];!this.hasElementWithId(B.id())||l&&B.data("source")!==r||(C=B.source(),P=B.target(),P=(C=C.id()!==r?C:P).id(),this.hasElementWithId(P)&&!p[P]&&(S=d[r]+u(B),g.has(P)?S<d[P]&&(h[P]=(d[P]=S)+s(C),v[P]=n,y[P]=B):(h[P]=(d[P]=S)+s(C),t(C,P),v[P]=n,y[P]=B)))}}return{found:!1,distance:void 0,path:void 0,steps:m}}},zt=pt({weight:function(e){return 1},directed:!1}),Ot={floydWarshall:function(e){function t(e){return o[e]}for(var n=this.cy(),r=(e=zt(e)).weight,i=e.directed,a=r,o=(e=this.byGroup()).nodes,s=e.edges,l=o.length,u=l*l,c=function(e){return o.indexOf(e)},d=new Array(u),h=0;h<u;h++){var p=h%l;d[h]=(h-p)/l==p?0:1/0}for(var f=new Array(u),g=new Array(u),v=0;v<s.length;v++){var y,m,b=s[v],x=b.source()[0],w=b.target()[0];x===w||(x=c(x),w=c(w),m=x*l+w,y=a(b),d[m]>y&&(d[m]=y,f[m]=w,g[m]=b),i)||(m=w*l+x,!i&&d[m]>y&&(d[m]=y,f[m]=x,g[m]=b))}for(var E=0;E<l;E++)for(var k=0;k<l;k++)for(var T=k*l+E,C=0;C<l;C++){var P=k*l+C,S=E*l+C;d[T]+d[S]<d[P]&&(d[P]=d[T]+d[S],f[P]=f[T])}function B(e){return c(D(e))}var D=function(e){return(W(e)?n.filter(e):e)[0]};return{distance:function(e,t){return e=B(e),t=B(t),d[e*l+t]},path:function(e,r){var i,a,o=B(e),s=B(r);e=t(o);if(o===s)return e.collection();if(null==f[o*l+s])return n.collection();for((i=n.collection()).merge(e);o!==s;)o=f[(a=o)*l+s],a=g[a*l+o],i.merge(a),i.merge(t(o));return i}}}},Vt=pt({weight:function(e){return 1},directed:!1,root:null}),Ft={bellmanFord:function(e){var t,n=this,r=(t=Vt(e)).weight,i=t.directed,a=t.root,o=r,s=this,l=this.cy(),u=(t=this.byGroup()).edges,c=t.nodes,d=c.length,h=new xt,p=!1,f=[];a=l.collection(a)[0];u.unmergeBy((function(e){return e.isLoop()}));for(var g=u.length,v=function(e){var t=h.get(e.id());return t||(t={},h.set(e.id(),t)),t},y=function(e){return(W(e)?l.$(e):e)[0]},m=0;m<d;m++){var b=c[m],x=v(b);b.same(a)?x.dist=0:x.dist=1/0,x.pred=null,x.edge=null}function w(e,t,n,r,i,a){(a=r.dist+a)<i.dist&&!n.same(r.edge)&&(i.dist=a,i.pred=e,i.edge=n,E=!0)}for(var E=!1,k=1;k<d;k++){E=!1;for(var T=0;T<g;T++){var C=u[T],P=C.source(),S=C.target(),B=o(C),D=v(P),_=v(S);w(P,0,C,D,_,B),i||w(S,0,C,_,D,B)}if(!E)break}if(E)for(var A=[],M=0;M<g;M++){var R=(N=u[M]).source(),I=N.target(),N=o(N),L=v(R).dist,z=v(I).dist;if(L+N<z||!i&&z+N<L){if(p||(lt("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),!1===e.findNegativeWeightCycles)break;for(var O=[],V=(L+N<z&&O.push(R),!i&&z+N<L&&O.push(I),O.length),F=0;F<V;F++){for(var X=O[F],j=[X],Y=(j.push(v(X).edge),v(X).pred);-1===j.indexOf(Y);)j.push(Y),j.push(v(Y).edge),Y=v(Y).pred;for(var q=(j=j.slice(j.indexOf(Y)))[0].id(),U=0,H=2;H<j.length;H+=2)j[H].id()<q&&(q=j[H].id(),U=H);(j=j.slice(U).concat(j.slice(0,U))).push(j[0]),X=j.map((function(e){return e.id()})).join(","),-1===A.indexOf(X)&&(f.push(s.spawn(j)),A.push(X))}}}return{distanceTo:function(e){return v(y(e)).dist},pathTo:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:a,r=[],i=y(e);;){if(null==i)return n.spawn();var o=(l=v(i)).edge,l=l.pred;if(r.unshift(i[0]),i.same(t)&&0<r.length)break;null!=o&&r.unshift(o),i=l}return s.spawn(r)},hasNegativeWeightCycle:p,negativeWeightCycles:f}}},Xt=Math.sqrt(2),jt=function(e,t,n){0===n.length&&ot("Karger-Stein must be run on a connected (sub)graph");for(var r=(e=n[e])[1],i=(e=e[2],t[r]),a=t[e],o=n,s=o.length-1;0<=s;s--){var l=(u=o[s])[1],u=u[2];(t[l]===i&&t[u]===a||t[l]===a&&t[u]===i)&&o.splice(s,1)}for(var c=0;c<o.length;c++){var d=o[c];d[1]===a?(o[c]=d.slice(),o[c][1]=i):d[2]===a&&(o[c]=d.slice(),o[c][2]=i)}for(var h=0;h<t.length;h++)t[h]===a&&(t[h]=i);return o},Yt=function(e,t,n,r){for(;r<n;){var i=Math.floor(Math.random()*t.length);t=jt(i,e,t),n--}return t},qt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges,i=(r.unmergeBy((function(e){return e.isLoop()})),n.length),a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/Xt);if(!(i<2)){for(var l=[],u=0;u<a;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}function d(e,t){for(var n=0;n<i;n++)t[n]=e[n]}for(var h=1/0,p=[],f=new Array(i),g=new Array(i),v=new Array(i),y=0;y<=o;y++){for(var m=0;m<i;m++)g[m]=m;var b=(x=Yt(g,l.slice(),i,s)).slice(),x=(d(g,v),Yt(g,x,s,2));b=Yt(v,b,s,2);x.length<=b.length&&x.length<h?(h=x.length,p=x,d(g,f)):b.length<=x.length&&b.length<h&&(h=b.length,p=b,d(v,f))}for(var w=this.spawn(p.map((function(e){return r[e[0]]}))),E=this.spawn(),k=this.spawn(),T=f[0],C=0;C<f.length;C++){var P=f[C],S=n[C];(P===T?E:k).merge(S)}function B(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!w.contains(t)&&n.merge(t)}))})),n}return t=[B(E),B(k)],{cut:w,components:t,partition1:E,partition2:k}}ot("At least 2 nodes are required for Karger-Stein algorithm")}},Wt=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Ut=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Ht=function(e){return{x:e[0],y:e[1]}},Kt=function(e,t){return Math.atan2(t,e)-Math.PI/2},Gt=Math.log2||function(e){return Math.log(e)/Math.log(2)},Zt=function(e){return 0<e?1:e<0?-1:0},$t=function(e,t){return Math.sqrt(Qt(e,t))},Qt=function(e,t){var n=t.x-e.x;return n*n+(t=t.y-e.y)*t},Jt=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},en=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},tn=function(e,t,n,r){return{x:en(e.x,t.x,n.x,r),y:en(e.y,t.y,n.y,r)}},nn=function(e,t,n){return Math.max(e,Math.min(n,t))},rn=function(e){return null==e?{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0}:null!=e.x1&&null!=e.y1?null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1?{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1}:null!=e.w&&null!=e.h&&0<=e.w&&0<=e.h?{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}:void 0:void 0},an=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},on=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},sn=function(e){var t=1<arguments.length&&void 0!==arguments[1]?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},ln=function(e){var t,n,r,i,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[0];return 1===o.length?t=n=r=i=o[0]:2===o.length?(t=r=o[0],i=n=o[1]):4===o.length&&(t=(o=a(o,4))[0],n=o[1],r=o[2],i=o[3]),e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},un=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},cn=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)},dn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},hn=function(e,t){return dn(e,t.x,t.y)},pn=function(e,t){return dn(e,t.x1,t.y1)&&dn(e,t.x2,t.y2)},fn=null!=(Bt=Math.hypot)?Bt:function(e,t){return Math.sqrt(e*e+t*t)};function gn(e,t,n,r,i,a){e=function(e,t){if(e.length<3)throw new Error("Need at least 3 vertices");function n(e,t){return{x:e.x+t.x,y:e.y+t.y}}function r(e,t){return{x:e.x-t.x,y:e.y-t.y}}function i(e,t){return{x:e.x*t,y:e.y*t}}function a(e,t){return e.x*t.y-e.y*t.x}for(var o=e.map((function(e){return{x:e.x,y:e.y}})),s=(function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2}(o)<0&&o.reverse(),o.length),l=[],u=0;u<s;u++){var c,d=o[u];d={x:(c=r(c=o[(u+1)%s],d)).y,y:-c.x},c=void 0,d=0===(c=fn(d.x,d.y))?{x:0,y:0}:{x:d.x/c,y:d.y/c},l.push(d)}for(var h,p,f,g=l.map((function(e,r){return{p1:n(o[r],i(e,t)),p2:n(o[(r+1)%s],i(e,t))}})),v=[],y=0;y<s;y++){var m=g[(y-1+s)%s],b=g[y];h=m.p1,m=m.p2,p=b.p1,b=b.p2,f=a(m=r(m,h),b=r(b,p)),b=Math.abs(f)<1e-9?n(h,i(m,.5)):n(h,i(m,p=a(r(p,h),b)/f)),v.push(b)}return v}(_n(e,t,n,r,i),a);var o=rn();return e.forEach((function(e){return on(o,e.x,e.y)})),o}var vn=function(e,t,n,r,i,a,o){var s,l="auto"===(l=7<arguments.length&&void 0!==arguments[7]?arguments[7]:"auto")?Ln(i,a):l,u=i/2,c=a/2,d=(l=Math.min(l,u,c))!==u,h=l!==c;if(d){var p=r-c-o;if(0<(p=Dn(e,t,n,r,n-u+l-o,p,n+u-l+o,p,!1)).length)return p}if(h&&0<(p=Dn(e,t,n,r,s=n+u+o,r-c+l-o,s,r+c-l+o,!1)).length)return p;return d&&0<(p=Dn(e,t,n,r,n-u+l-o,s=r+c+o,n+u-l+o,s,!1)).length||h&&0<(p=Dn(e,t,n,r,d=n-u-o,r-c+l-o,d,r+c-l+o,!1)).length?p:0<(d=Sn(e,t,n,r,s=n-u+l,h=r-c+l,l+o)).length&&d[0]<=s&&d[1]<=h||0<(d=Sn(e,t,n,r,p=n+u-l,s=r-c+l,l+o)).length&&d[0]>=p&&d[1]<=s||0<(d=Sn(e,t,n,r,h=n+u-l,p=r+c-l,l+o)).length&&d[0]>=h&&d[1]>=p||0<(d=Sn(e,t,n,r,s=n-u+l,h=r+c-l,l+o)).length&&d[0]<=s&&d[1]>=h?[d[0],d[1]]:[]},yn=function(e,t,n,r,i,a,o){var s=Math.min(n,i);n=Math.max(n,i),i=Math.min(r,a),r=Math.max(r,a);return s-o<=e&&e<=n+o&&i-o<=t&&t<=r+o},mn=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l;n=Math.max(n,o,i)+l,o=Math.min(r,s,a)-l,i=Math.max(r,s,a)+l;return!(e<u||n<e||t<o||i<t)},bn=function(e,t,n,r){return(r=t*t-4*e*(n-=r))<0?[]:[(-t+(n=Math.sqrt(r)))/(r=2*e),(-t-n)/r]},xn=function(e,t,n,r,i,a,o,s){for(var l=[],u=(function(e,t,n,r,i){var a,o,s;r=-27*(r/=e=0===e?1e-5:e)+(t/=e)*(9*(n/=e)-t*t*2),n=(e=(3*n-t*t)/9)*e*e+(r/=54)*r,t/=3,(i[1]=0)<n?(a=(a=r+Math.sqrt(n))<0?-Math.pow(-a,1/3):Math.pow(a,1/3),o=(o=r-Math.sqrt(n))<0?-Math.pow(-o,1/3):Math.pow(o,1/3),i[0]=-t+a+o,i[4]=i[2]=-(t+=(a+o)/2),t=Math.sqrt(3)*(-o+a)/2,i[3]=t,i[5]=-t):(i[5]=i[3]=0)==n?(s=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3),i[0]=2*s-t,i[4]=i[2]=-(s+t)):(e=-e,o=Math.acos(r/Math.sqrt(e*e*e)),s=2*Math.sqrt(e),i[0]=-t+s*Math.cos(o/3),i[2]=-t+s*Math.cos((o+2*Math.PI)/3),i[4]=-t+s*Math.cos((o+4*Math.PI)/3))}(+n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,+n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l),[]),c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&0<=l[c]&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p=-1,f=0;f<u.length;f++)h=Math.pow(1-u[f],2)*n+2*(1-u[f])*u[f]*i+u[f]*u[f]*o,d=Math.pow(1-u[f],2)*r+2*(1-u[f])*u[f]*a+u[f]*u[f]*s,h=Math.pow(h-e,2)+Math.pow(d-t,2),(!(0<=p)||h<p)&&(p=h);return p},wn=function(e,t,n,r,i,a){var o=[e-n,t-r],s=(r=(n=[i-n,a-r])[0]*n[0]+n[1]*n[1],o[0]*o[0]+o[1]*o[1]);n=(o=o[0]*n[0]+o[1]*n[1])*o/r;return o<0?s:r<n?(e-i)*(e-i)+(t-a)*(t-a):s-n},En=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)r=n[2*l],i=n[2*l+1],o=l+1<n.length/2?(a=n[2*(l+1)],n[2*(l+1)+1]):(a=n[2*(l+1-n.length/2)],n[2*(l+1-n.length/2)+1]),r==e&&a==e||(e<=r&&a<=e||r<=e&&e<=a)&&t<(e-r)/(a-r)*(o-i)+i&&s++;return s%2!=0},kn=function(e,t,n,r,i,a,o,s,l){for(var u,c=new Array(n.length),d=(null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s,Math.cos(-u)),h=Math.sin(-u),p=0;p<c.length/2;p++)c[2*p]=a/2*(n[2*p]*d-n[2*p+1]*h),c[2*p+1]=o/2*(n[2*p+1]*d+n[2*p]*h),c[2*p]+=r,c[2*p+1]+=i;return u=0<l?(s=Cn(c,-l),Tn(s)):c,En(e,t,u)},Tn=function(e){for(var t,n,r,i=new Array(e.length/2),a=0;a<e.length/4;a++){var o=e[4*a],s=e[4*a+1],l=e[4*a+2],u=e[4*a+3],c=a<e.length/4-1?(t=e[4*(a+1)],n=e[4*(a+1)+1],r=e[4*(a+1)+2],e[4*(a+1)+3]):(t=e[0],n=e[1],r=e[2],e[3]);o=Dn(o,s,l,u,t,n,r,c,!0);i[2*a]=o[0],i[2*a+1]=o[1]}return i},Cn=function(e,t){for(var n,r=new Array(2*e.length),i=0;i<e.length/2;i++){var a,o=e[2*i],s=e[2*i+1],l=(a=i<e.length/2-1?(n=e[2*(i+1)],e[2*(i+1)+1]):(n=e[0],e[1]))-s,u=-(n-o),c=Math.sqrt(l*l+u*u);l=l/c,u=u/c;r[4*i]=o+l*t,r[4*i+1]=s+u*t,r[4*i+2]=n+l*t,r[4*i+3]=a+u*t}return r},Pn=function(e,t,n,r,i,a,o){return(e=(e-i)/(n/2+o))*e+(t=(t-a)/(r/2+o))*t<=1},Sn=function(e,t,n,r,i,a,o){n=[n-e,r-t],r=[e-i,t-a],i=n[0]*n[0]+n[1]*n[1];return(r=(a=2*(r[0]*n[0]+r[1]*n[1]))*a-4*i*(r[0]*r[0]+r[1]*r[1]-o*o))<0||(o=(-a+Math.sqrt(r))/(2*i),a=(-a-Math.sqrt(r))/(2*i),r=Math.min(o,a),i=Math.max(o,a),o=[],0<=r&&r<=1&&o.push(r),0<=i&&i<=1&&o.push(i),0===o.length)?[]:(a=o[0]*n[0]+e,r=o[0]*n[1]+t,1<o.length&&o[0]!=o[1]?[a,r,o[1]*n[0]+e,o[1]*n[1]+t]:[a,r])},Bn=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Dn=function(e,t,n,r,i,a,o,s,l){var u,c=n-e,d=o-i,h=r-t,p=s-a,f=d*(g=t-a)-p*(u=e-i),g=c*g-h*u;return 0!=(u=p*c-d*h)?(p=g/u,-.001<=(d=f/u)&&d<=1.001&&-.001<=p&&p<=1.001||l?[e+d*c,t+d*h]:[]):0==f||0==g?Bn(e,n,o)===o?[o,s]:Bn(e,n,i)===i?[i,a]:Bn(i,o,n)===n?[n,r]:[]:[]},_n=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,l=t,u=n;a.push({x:l+o*e[0],y:u+s*e[1]});for(var c=1;c<e.length/2;c++)a.push({x:l+o*e[2*c],y:u+s*e[2*c+1]});return a},An=function(e,t,n,r,i,a,o,s){var l,u,c,d,h=[],p=new Array(n.length);if(null!=a){for(var f,g=0;g<p.length/2;g++)p[2*g]=n[2*g]*a+r,p[2*g+1]=n[2*g+1]*o+i;f=0<s?(s=Cn(p,-s),Tn(s)):p}else f=n;for(var v=0;v<f.length/2;v++)l=f[2*v],u=f[2*v+1],d=v<f.length/2-1?(c=f[2*(v+1)],f[2*(v+1)+1]):(c=f[0],f[1]),0!==(l=Dn(e,t,r,i,l,u,c,d)).length&&h.push(l[0],l[1]);return h},Mn=function(e,t,n){e=[e[0]-t[0],e[1]-t[1]];var r=Math.sqrt(e[0]*e[0]+e[1]*e[1]);n=(r-n)/r;return[t[0]+(n=n<0?1e-5:n)*e[0],t[1]+n*e[1]]},Rn=function(e,t){return e=Nn(e,t),In(e)},In=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*u,n=e[2*d+1]=e[2*d+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-a);return e},Nn=function(e,t){for(var n,r=1/e*2*Math.PI,i=e%2==0?Math.PI/2+r/2:Math.PI/2,a=(i+=t,new Array(2*e)),o=0;o<e;o++)n=o*r+i,a[2*o]=Math.cos(n),a[2*o+1]=Math.sin(-n);return a},Ln=function(e,t){return Math.min(e/4,t/4,8)},zn=function(e,t){return Math.min(e/10,t/10,8)},On=function(e,t,n){return[e-2*t+n,2*(t-e),e]},Vn=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Fn(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=(r=-(i={x:(i=e[(n+1)%e.length]).x-r.x,y:i.y-r.y}).y,i.x),a=Math.sqrt(r*r+i*i);t.push({x:r/a,y:i/a})}return t}function i(e,t){var n,i=1/0,a=-1/0,o=r(e);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=s.x*t.x+s.y*t.y;i=Math.min(i,l),a=Math.max(a,l)}}catch(e){o.e(e)}finally{o.f()}return{min:i,max:a}}var a,s,l,u=r([].concat(o(n(e)),o(n(t))));try{for(u.s();!(a=u.n()).done;){var c=a.value,d=i(e,c);if(l=i(t,c),(s=d).max<l.min||l.max<s.min)return!1}}catch(e){u.e(e)}finally{u.f()}return!0}var Xn=pt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),jn={pageRank:function(e){for(var t=(e=Xn(e)).dampingFactor,n=e.precision,r=e.iterations,i=e.weight,a=this._private.cy,o=(e=this.byGroup()).nodes,s=e.edges,l=o.length,u=s.length,c=new Array(l*l),d=new Array(l),h=(1-t)/l,p=0;p<l;p++){for(var f=0;f<l;f++)c[p*l+f]=0;d[p]=0}for(var g=0;g<u;g++){var v=s[g],y=v.data("source"),m=v.data("target");y!==m&&(y=o.indexOfId(y),m=o.indexOfId(m),v=i(v),c[m*l+y]+=v,d[y]+=v)}for(var b=1/l+h,x=0;x<l;x++)if(0===d[x])for(var w=0;w<l;w++)c[w*l+x]=b;else for(var E=0;E<l;E++){var k=E*l+x;c[k]=c[k]/d[x]+h}for(var T=new Array(l),C=new Array(l),P=0;P<l;P++)T[P]=1;for(var S=0;S<r;S++){for(var B=0;B<l;B++)C[B]=0;for(var D=0;D<l;D++)for(var _=0;_<l;_++)C[D]+=c[D*l+_]*T[_];Jt(C);for(var A=T,M=(T=C,C=A,0),R=0;R<l;R++){var I=A[R]-T[R];M+=I*I}if(M<n)break}return{rank:function(e){return e=a.collection(e)[0],T[o.indexOf(e)]}}}},Yn=pt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),qn={degreeCentralityNormalized:function(e){e=Yn(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=(c=n[l]).id(),c=(e.root=c,this.degreeCentrality(e));o<c.indegree&&(o=c.indegree),s<c.outdegree&&(s=c.outdegree),i[u]=c.indegree,a[u]=c.outdegree}return{indegree:function(e){return 0==o?0:(W(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(W(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},h=0,p=0;p<r;p++){var f=n[p],g=(e.root=f,this.degreeCentrality(e));h<g.degree&&(h=g.degree),d[f.id()]=g.degree}return{degree:function(e){return 0===h?0:(W(e)&&(e=t.filter(e)),d[e.id()]/h)}}},degreeCentrality:function(e){e=Yn(e);var t=this.cy(),n=this,r=e.root,i=e.weight,a=e.directed;e=e.alpha,r=t.collection(r)[0];if(a){for(var o=(t=r.connectedEdges()).filter((function(e){return e.target().same(r)&&n.has(e)})),s=t.filter((function(e){return e.source().same(r)&&n.has(e)})),l=(a=o.length,t=s.length,0),u=0,c=0;c<o.length;c++)l+=i(o[c]);for(var d=0;d<s.length;d++)u+=i(s[d]);return{indegree:Math.pow(a,1-e)*Math.pow(l,e),outdegree:Math.pow(t,1-e)*Math.pow(u,e)}}for(var h=r.connectedEdges().intersection(n),p=(a=h.length,0),f=0;f<h.length;f++)p+=i(h[f]);return{degree:Math.pow(a,1-e)*Math.pow(p,e)}}},Wn=(qn.dc=qn.degreeCentrality,qn.dcn=qn.degreeCentralityNormalised=qn.degreeCentralityNormalized,pt({harmonic:!0,weight:function(){return 1},directed:!1,root:null})),Un={closenessCentralityNormalized:function(e){for(var t=(e=Wn(e)).harmonic,n=e.weight,r=(e=e.directed,this.cy()),i={},a=0,o=this.nodes(),s=this.floydWarshall({weight:n,directed:e}),l=0;l<o.length;l++){for(var u,c=0,d=o[l],h=0;h<o.length;h++)l!==h&&(u=s.distance(d,o[h]),c+=t?1/u:u);a<(c=t?c:1/c)&&(a=c),i[d.id()]=c}return{closeness:function(e){return 0==a?0:(e=(W(e)?r.filter(e)[0]:e).id(),i[e]/a)}}},closenessCentrality:function(e){for(var t=(e=Wn(e)).root,n=e.weight,r=e.directed,i=e.harmonic,a=(t=this.filter(t)[0],this.dijkstra({root:t,weight:n,directed:r})),o=0,s=this.nodes(),l=0;l<s.length;l++){var u=s[l];u.same(t)||(u=a.distanceTo(u),o+=i?1/u:u)}return i?o:1/o}},Hn=(Un.cc=Un.closenessCentrality,Un.ccn=Un.closenessCentralityNormalised=Un.closenessCentralityNormalized,pt({weight:null,directed:!1})),Kn={betweennessCentrality:function(e){for(var t=(e=Hn(e)).directed,n=e.weight,r=null!=n,i=this.cy(),a=this.nodes(),o={},s={},l=0,u={set:function(e,t){l<(s[e]=t)&&(l=t)},get:function(e){return s[e]}},c=0;c<a.length;c++){var d=a[c],h=d.id();o[h]=(t?d.outgoers():d.openNeighborhood()).nodes(),u.set(h,0)}for(var p=0;p<a.length;p++)!function(){for(var e=a[p].id(),t=[],s={},l={},c={},d=new At((function(e,t){return c[e]-c[t]})),h=0;h<a.length;h++){var f=a[h].id();s[f]=[],c[f]=1/(l[f]=0)}for(l[e]=1,c[e]=0,d.push(e);!d.empty();){var g=d.pop();if(t.push(g),r)for(var v=0;v<o[g].length;v++){var y=o[g][v],m=(0<(b=i.getElementById(g)).edgesTo(y).length?b.edgesTo(y):y.edgesTo(b))[0],b=n(m);y=y.id();c[g]+b<c[y]&&(c[y]=c[g]+b,d.nodes.indexOf(y)<0?d.push(y):d.updateItem(y),l[y]=0,s[y]=[]),c[y]==c[g]+b&&(l[y]=l[y]+l[g],s[y].push(g))}else for(var x=0;x<o[g].length;x++){var w=o[g][x].id();c[w]==1/0&&(d.push(w),c[w]=c[g]+1),c[w]==c[g]+1&&(l[w]=l[w]+l[g],s[w].push(g))}}for(var E={},k=0;k<a.length;k++)E[a[k].id()]=0;for(;0<t.length;){for(var T=t.pop(),C=0;C<s[T].length;C++){var P=s[T][C];E[P]=E[P]+l[P]/l[T]*(1+E[T])}T!=a[p].id()&&u.set(T,u.get(T)+E[T])}}();return(e={betweenness:function(e){return e=i.collection(e).id(),u.get(e)},betweennessNormalized:function(e){return 0==l?0:(e=i.collection(e).id(),u.get(e)/l)}}).betweennessNormalised=e.betweennessNormalized,e}},Gn=(Kn.bc=Kn.betweennessCentrality,pt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]})),Zn=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},$n=function(e,t){for(var n=0;n<t;n++){for(var r=0,i=0;i<t;i++)r+=e[i*t+n];for(var a=0;a<t;a++)e[a*t+n]=e[a*t+n]/r}},Qn=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},Jn=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=Qn(e,r,t);return e},er=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return $n(r,t),r},tr=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},nr=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},rr=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=function(e){return Gn(e)}(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),d=0;d<u;d++)c[d]=0;for(var h=0;h<n.length;h++){var p=a[(g=n[h]).source().id()],f=a[g.target().id()],g=Zn(g,i.attributes);c[p*l+f]+=g,c[f*l+p]+=g}(function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n})(c,l,i.multFactor),$n(c,l);for(var v=!0,y=0;v&&y<i.maxIterations;)v=!1,s=Jn(c,l,i.expandFactor),c=er(s,l,i.inflateFactor),tr(c,s,u,4)||(v=!0),y++;return e=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)0<Math.round(1e3*e[a*t+s])/1e3&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r),function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&nr(e[t],e[n])&&e.splice(n,1);return e}(e)},ir={markovClustering:rr,mcl:rr},ar=function(e){return e},or=function(e,t){return Math.abs(t-e)},sr=function(e,t,n){return e+or(t,n)},lr=function(e,t,n){return e+Math.pow(n-t,2)},ur=function(e){return Math.sqrt(e)},cr=function(e,t,n){return Math.max(e,or(t,n))},dr=function(e,t,n,r,i){for(var a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:ar,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},hr={euclidean:function(e,t,n){return 2<=e?dr(e,t,n,0,lr,ur):dr(e,t,n,0,sr)},squaredEuclidean:function(e,t,n){return dr(e,t,n,0,lr)},manhattan:function(e,t,n){return dr(e,t,n,0,sr)},max:function(e,t,n){return dr(e,t,n,-1/0,cr)}};function pr(e,t,n,r,i,a){var o=U(e)?e:hr[e]||hr.euclidean;return 0===t&&U(e)?o(i,a):o(t,n,r,i,a)}hr["squared-euclidean"]=hr.squaredEuclidean,hr.squaredeuclidean=hr.squaredEuclidean;var fr,gr,vr,yr,mr,br,xr,wr,Er,kr,Tr,Cr,Pr,Sr,Br,Dr,_r,Ar,Mr,Rr,Ir,Nr,Lr,zr,Or,Vr,Fr,Xr,jr,Yr,qr,Wr,Ur,Hr,Kr,Gr,Zr,$r,Qr,Jr,ei,ti,ni,ri,ii,ai,oi,si,li,ui,ci,di,hi,pi,fi,gi,vi,yi,mi,bi,xi,wi,Ei,ki,Ti,Ci,Pi,Si,Bi,Di,_i,Ai,Mi,Ri,Ii,Ni,Li,zi,Oi,Vi,Fi,Xi,ji,Yi,qi,Wi,Ui=pt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Hi=function(e){return Ui(e)},Ki=function(e,t,n,r,i){return pr(e,r.length,"kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},(function(e){return r[e](t)}),n,t)},Gi=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},Zi=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=Ki(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},$i=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},Qi=function(e,t,n){return Math.abs(t-e)<=n},Ji=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(n<Math.abs(e[r][i]-t[r][i]))return!1;return!0},ea=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},ta=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];ea(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},na=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=Ki("manhattan",t[i],e,n,"kMedoids");return r},ra=function(e,t,n,r,i){for(var a=0;a<t.length;a++)for(var o=0;o<e.length;o++)r[a][o]=Math.pow(n[a][o],i.m);for(var s=0;s<e.length;s++)for(var l=0;l<i.attributes.length;l++){for(var u=0,c=0,d=0;d<t.length;d++)u+=r[d][s]*i.attributes[l](t[d]),c+=r[d][s];e[s][l]=u/c}},ia=function(e,t,n,r,i){for(var a,o,s=0;s<e.length;s++)t[s]=e[s].slice();for(var l=2/(i.m-1),u=0;u<n.length;u++)for(var c=0;c<r.length;c++){for(var d=0,h=0;h<n.length;h++)a=Ki(i.distance,r[c],n[u],i.attributes,"cmeans"),o=Ki(i.distance,r[c],n[h],i.attributes,"cmeans"),d+=Math.pow(a/o,l);e[c][u]=1/d}},aa=function(e,t,n,r){for(var i=new Array(n.k),a=0;a<i.length;a++)i[a]=[];for(var o=0;o<t.length;o++){for(var s=-1/0,l=-1,u=0;u<t[0].length;u++)t[o][u]>s&&(s=t[o][u],l=u);i[l].push(e[o])}for(var c=0;c<i.length;c++)i[c]=r.collection(i[c]);return i},oa=function(e){for(var t=this.cy(),n=this.nodes(),r=Hi(e),i=new Array(n.length),a=0;a<n.length;a++)i[a]=new Array(r.k);for(var o=new Array(n.length),s=0;s<n.length;s++)o[s]=new Array(r.k);for(var l=0;l<n.length;l++){for(var u=0,c=0;c<r.k;c++)o[l][c]=Math.random(),u+=o[l][c];for(var d=0;d<r.k;d++)o[l][d]=o[l][d]/u}for(var h=new Array(r.k),p=0;p<r.k;p++)h[p]=new Array(r.attributes.length);for(var f=new Array(n.length),g=0;g<n.length;g++)f[g]=new Array(r.k);for(var v=!0,y=0;v&&y<r.maxIterations;)v=!1,ra(h,n,o,f,r),ia(o,i,h,n,r),Ji(o,i,r.sensitivityThreshold)||(v=!0),y++;return{clusters:aa(n,o,r,t),degreeOfMembership:o}},sa={kMeans:function(e){for(var t=this.cy(),n=this.nodes(),r=null,i=Hi(e),a=new Array(i.k),o={},s=i.testMode?"number"==typeof i.testCentroids?(i.testCentroids,Gi(n,i.k,i.attributes)):"object"===l(i.testCentroids)?i.testCentroids:Gi(n,i.k,i.attributes):Gi(n,i.k,i.attributes),u=!0,c=0;u&&c<i.maxIterations;){for(var d=0;d<n.length;d++)o[(r=n[d]).id()]=Zi(r,s,i.distance,i.attributes,"kMeans");u=!1;for(var h=0;h<i.k;h++){var p=$i(h,n,o);if(0!==p.length){for(var f=i.attributes.length,g=s[h],v=new Array(f),y=new Array(f),m=0;m<f;m++){for(var b=y[m]=0;b<p.length;b++)r=p[b],y[m]+=i.attributes[m](r);v[m]=y[m]/p.length,Qi(v[m],g[m],i.sensitivityThreshold)||(u=!0)}s[h]=v,a[h]=t.collection(p)}}c++}return a},kMedoids:function(e){for(var t,n,r=this.cy(),i=this.nodes(),a=null,o=Hi(e),s=new Array(o.k),u={},c=new Array(o.k),d=(o.testMode?"number"!=typeof o.testCentroids&&(t="object"===l(o.testCentroids)?o.testCentroids:ta(i,o.k)):t=ta(i,o.k),!0),h=0;d&&h<o.maxIterations;){for(var p=0;p<i.length;p++)u[(a=i[p]).id()]=Zi(a,t,o.distance,o.attributes,"kMedoids");d=!1;for(var f=0;f<t.length;f++){var g=$i(f,i,u);if(0!==g.length){c[f]=na(t[f],g,o.attributes);for(var v=0;v<g.length;v++)(n=na(g[v],g,o.attributes))<c[f]&&(c[f]=n,t[f]=g[v],d=!0);s[f]=r.collection(g)}}h++}return s},fuzzyCMeans:oa,fcm:oa},la=pt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ua={single:"min",complete:"max"},ca=function(e,t,n,r,i){function a(e,t){return pr(i.distance,u.length,(function(t){return u[t](e)}),(function(e){return u[e](t)}),e,t)}for(var o,s=0,l=1/0,u=i.attributes,c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<l&&(s=d,l=h)}if("threshold"===i.mode&&l>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p=t[s],f=t[r[s]],g="dendrogram"===i.mode?{left:p,right:f,key:p.key}:{value:p.value.concat(f.value),key:p.key};e[p.index]=g,e.splice(f.index,1),t[p.key]=g;for(var v=0;v<e.length;v++){var y=e[v];p.key===y.key?o=1/0:"min"===i.linkage?(o=n[p.key][y.key],n[p.key][y.key]>n[f.key][y.key]&&(o=n[f.key][y.key])):"max"===i.linkage?(o=n[p.key][y.key],n[p.key][y.key]<n[f.key][y.key]&&(o=n[f.key][y.key])):o="mean"===i.linkage?(n[p.key][y.key]*p.size+n[f.key][y.key]*f.size)/(p.size+f.size):"dendrogram"===i.mode?a(y.value,p.value):a(y.value[0],p.value[0]),n[p.key][y.key]=n[y.key][p.key]=o}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===p.key||r[b]===f.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return!(p.key=f.key=p.index=f.index=null)},da=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&da(e.left,t),e.right&&da(e.right,t)))},ha=function(e,t){var n,r,i;return e?e.left&&e.right?(n=ha(e.left,t),r=ha(e.right,t),i=t.add({group:"nodes",data:{id:n+","+r}}),t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:r,target:i.id()}}),i.id()):e.value?e.value.id():void 0:""},pa=function(e,t,n){var r,i,a;return e?(r=[],i=[],a=[],0===t?(e.left&&da(e.left,r),e.right&&da(e.right,i),a=r.concat(i),[n.collection(a)]):1===t?e.value?[n.collection(e.value)]:(e.left&&da(e.left,r),e.right&&da(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=pa(e.left,t-1,n)),e.right&&(i=pa(e.right,t-1,n)),r.concat(i))):[]},fa=function(e){function t(e,t){return pr(i.distance,a.length,(function(t){return a[t](e)}),(function(e){return a[e](t)}),e,t)}for(var n=this.cy(),r=this.nodes(),i=function(e){e=la(e);var t=ua[e.linkage];return null!=t&&(e.linkage=t),e}(e),a=i.attributes,o=[],s=[],l=[],u=[],c=0;c<r.length;c++){var d={value:"dendrogram"===i.mode?r[c]:[r[c]],key:c,index:c};u[c]=o[c]=d,s[c]=[],l[c]=0}for(var h=0;h<o.length;h++)for(var p=0;p<=h;p++){var f="dendrogram"===i.mode?h===p?1/0:t(o[h].value,o[p].value):h===p?1/0:t(o[h].value[0],o[p].value[0]);s[h][p]=f,(s[p][h]=f)<s[h][l[h]]&&(l[h]=p)}for(var g,v=ca(o,u,s,l,i);v;)v=ca(o,u,s,l,i);return"dendrogram"===i.mode?(g=pa(o[0],i.dendrogramDepth,n),i.addDendrogram&&ha(o[0],n)):(g=new Array(o.length),o.forEach((function(e,t){e.key=e.index=null,g[t]=n.collection(e.value)}))),g},ga={hierarchicalClustering:fa,hca:fa},va=pt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),ya=function(e,t,n,r){function i(e,t){return r[t](e)}return-pr(e,r.length,(function(e){return i(t,e)}),(function(e){return i(n,e)}),t,n)},ma=function(e,t){return"median"===t?function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e.length,r=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],i=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],a=!(5<arguments.length&&void 0!==arguments[5])||arguments[5],o=(r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),0<t&&e.splice(0,t)),0),s=e.length-1;0<=s;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}return i&&e.sort((function(e,t){return e-t})),r=e.length,n=Math.floor(r/2),r%2!=0?e[n+1+o]:(e[n-1+o]+e[n+o])/2}(e):"mean"===t?function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i}(e):"min"===t?function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r}(e):"max"===t?function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r}(e):t},ba=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(o=t[i*e+(a=l)])}0<a&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},xa=function(e){for(var t=this.cy(),n=this.nodes(),r=function(e){var t=e.damping,n=e.preference;return(.5<=t&&t<1||ot("Damping must range on [0.5, 1). Got: ".concat(t)),t=["median","mean","min","max"]).some((function(e){return e===n}))||G(n)||ot("Preference must be one of [".concat(t.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number. Got: ").concat(n)),va(e)}(e),i={},a=0;a<n.length;a++)i[n[a].id()]=a;for(var o,s=(o=n.length)*o,l=new Array(s),u=0;u<s;u++)l[u]=-1/0;for(var c=0;c<o;c++)for(var d=0;d<o;d++)c!==d&&(l[c*o+d]=ya(r.distance,n[c],n[d],r.attributes));for(var h=ma(l,r.preference),p=0;p<o;p++)l[p*o+p]=h;for(var f=new Array(s),g=0;g<s;g++)f[g]=0;for(var v=new Array(s),y=0;y<s;y++)v[y]=0;for(var m=new Array(o),b=new Array(o),x=new Array(o),w=0;w<o;w++)m[w]=0,b[w]=0,x[w]=0;for(var E,k=new Array(o*r.minIterations),T=0;T<k.length;T++)k[T]=0;for(E=0;E<r.maxIterations;E++){for(var C=0;C<o;C++){for(var P,S=-1/0,B=-1/0,D=-1,_=0;_<o;_++)m[_]=f[C*o+_],S<=(P=v[C*o+_]+l[C*o+_])?(B=S,S=P,D=_):B<P&&(B=P);for(var A=0;A<o;A++)f[C*o+A]=(1-r.damping)*(l[C*o+A]-S)+r.damping*m[A];f[C*o+D]=(1-r.damping)*(l[C*o+D]-B)+r.damping*m[D]}for(var M=0;M<o;M++){for(var R=0,I=0;I<o;I++)m[I]=v[I*o+M],b[I]=Math.max(0,f[I*o+M]),R+=b[I];R-=b[M],b[M]=f[M*o+M],R+=b[M];for(var N=0;N<o;N++)v[N*o+M]=(1-r.damping)*Math.min(0,R-b[N])+r.damping*m[N];v[M*o+M]=(1-r.damping)*(R-b[M])+r.damping*m[M]}for(var L=0,z=0;z<o;z++){var O=0<v[z*o+z]+f[z*o+z]?1:0;L+=k[E%r.minIterations*o+z]=O}if(0<L&&(E>=r.minIterations-1||E==r.maxIterations-1)){for(var V=0,F=0;F<o;F++){for(var X=x[F]=0;X<r.minIterations;X++)x[F]+=k[X*o+F];0!==x[F]&&x[F]!==r.minIterations||V++}if(V===o)break}}for(var j=function(e,t,n){for(var r=[],i=0;i<e;i++)0<t[i*e+i]+n[i*e+i]&&r.push(i);return r}(o,f,v),Y=function(e,t,n){for(var r=ba(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,d=0;d<a.length;d++)c+=t[a[d]*e+a[u]];l<c&&(s=u,l=c)}n[i]=a[s]}return ba(e,t,n)}(o,l,j),q={},W=0;W<j.length;W++)q[j[W]]=[];for(var U=0;U<n.length;U++){var H=Y[i[n[U].id()]];null!=H&&q[H].push(n[U])}for(var K=new Array(j.length),Z=0;Z<j.length;Z++)K[Z]=t.collection(q[j[Z]]);return K},wa={affinityPropagation:xa,ap:xa},Ea=pt({root:void 0,directed:!1}),ka={hierholzer:function(e){K(e)||(e={root:(i=arguments)[0],directed:i[1]});var t,n,r,i=Ea(e),a=i.root,o=i.directed,s=this,l=!1,u=(a&&(r=(W(a)?this.filter(a):a)[0].id()),{}),c={},d=(o?s.forEach((function(e){var r,i,a,o=e.id();e.isNode()?(i=e.indegree(!0),a=(r=e.outdegree(!0))-i,1==(i-=r)?t?l=!0:t=o:1==a?n?l=!0:n=o:(1<a||1<i)&&(l=!0),u[o]=[],e.outgoers().forEach((function(e){e.isEdge()&&u[o].push(e.id())}))):c[o]=[void 0,e.target().id()]})):s.forEach((function(e){var r=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?l=!0:n=r:t=r),u[r]=[],e.connectedEdges().forEach((function(e){return u[r].push(e.id())}))):c[r]=[e.source().id(),e.target().id()]})),{found:!1,trail:void 0});if(!l){if(n&&t)if(o){if(r&&n!=r)return d;r=n}else{if(r&&n!=r&&t!=r)return d;r=r||n}else r=r||s[0].id();function h(e){for(var t,n,r,i=e,a=[e];u[i].length;)t=u[i].shift(),n=c[t][0],i!=(r=c[t][1])?(u[r]=u[r].filter((function(e){return e!=t})),i=r):o||i==n||(u[n]=u[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a}var p,f=[],g=[];for(g=h(r);1!=g.length;)0==u[g[0]].length?(f.unshift(s.getElementById(g.shift())),f.unshift(s.getElementById(g.shift()))):g=h(g.shift()).concat(g);for(p in f.unshift(s.getElementById(g.shift())),u)if(u[p].length)return d;d.found=!0,d.trail=this.spawn(f,!0)}return d}},Ta=function(){function e(l,u,c){l===c&&(i+=1),n[u]={id:r,low:r++,cutVertex:!1};var d,h,p=t.getElementById(u).connectedEdges().intersection(t);0===p.size()?a.push(t.spawn(t.getElementById(u))):p.forEach((function(r){if(h=r.source().id(),d=r.target().id(),(d=h===u?d:h)!==c)if(h=r.id(),s[h]||(s[h]=!0,o.push({x:u,y:d,edge:r})),d in n)n[u].low=Math.min(n[u].low,n[d].id);else if(e(l,d,u),n[u].low=Math.min(n[u].low,n[d].low),n[u].id<=n[d].low){n[u].cutVertex=!0;for(var i=u,p=d,f=o.length-1,g=[],v=t.spawn();o[f].x!=i||o[f].y!=p;)g.push(o.pop().edge),f--;g.push(o.pop().edge),g.forEach((function(e){var r=e.connectedNodes().intersection(t);v.merge(e),r.forEach((function(e){var r=e.id(),i=e.connectedEdges().intersection(t);v.merge(e),n[r].cutVertex?v.merge(i.filter((function(e){return e.isLoop()}))):v.merge(i)}))})),a.push(v)}}))}var t=this,n={},r=0,i=0,a=[],o=[],s={},l=(t.forEach((function(t){!t.isNode()||(t=t.id())in n||(i=0,e(t,t),n[t].cutVertex=1<i)})),Object.keys(n).filter((function(e){return n[e].cutVertex})).map((function(e){return t.getElementById(e)})));return{cut:t.spawn(l),components:a}},Ca=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){(e=e.target().id())!==s&&(e in t||o(e),t[e].explored||(t[s].low=Math.min(t[s].low,t[e].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l);c=l.merge(c);r.push(c),a=a.difference(c)}};return e.forEach((function(e){!e.isNode()||(e=e.id())in t||o(e)})),{cut:a,components:r}},Pa={},Sa=([Ct,Rt,It,Lt,Ot,Ft,qt,jn,qn,Un,Kn,ir,sa,ga,wa,ka,{hopcroftTarjanBiconnected:Ta,htbc:Ta,htb:Ta,hopcroftTarjanBiconnectedComponents:Ta},{tarjanStronglyConnected:Ca,tsc:Ca,tscc:Ca,tarjanStronglyConnectedComponents:Ca}].forEach((function(e){ve(Pa,e)})),0),Ba=function(e){if(!(this instanceof Ba))return new Ba(e);this.id="Thenable/1.0.7",this.state=Sa,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))},Da=(Ba.prototype={fulfill:function(e){return Da(this,1,"fulfillValue",e)},reject:function(e){return Da(this,2,"rejectReason",e)},then:function(e,t){var n=new Ba;return this.onFulfilled.push(Ma(e,n,"fulfill")),this.onRejected.push(Ma(t,n,"reject")),_a(this),n.proxy}},function(e,t,n,r){return e.state===Sa&&(e.state=t,e[n]=r,_a(e)),e}),_a=function(e){1===e.state?Aa(e,"onFulfilled",e.fulfillValue):2===e.state&&Aa(e,"onRejected",e.rejectReason)},Aa=function(e,t,n){var r;0!==e[t].length&&(r=e[t],e[t]=[],e=function(){for(var e=0;e<r.length;e++)r[e](n)},"function"==typeof setImmediate?setImmediate(e):setTimeout(e,0))},Ma=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(r){return void t.reject(r)}Ra(t,i)}}},Ra=function(e,t){if(e===t||e.proxy===t)e.reject(new TypeError("cannot resolve promise with itself"));else{var n;if("object"===l(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(n){return void e.reject(n)}if("function"==typeof n){var r=!1;try{n.call(t,(function(n){r||(r=!0,n===t?e.reject(new TypeError("circular thenable chain")):Ra(e,n))}),(function(t){r||(r=!0,e.reject(t))}))}catch(n){r||e.reject(n)}}else e.fulfill(t)}},Ia=(Ba.all=function(e){return new Ba((function(t,n){function r(n,r){i[n]=r,++a===e.length&&t(i)}for(var i=new Array(e.length),a=0,o=0;o<e.length;o++)!function(t){var i=e[t];null!=i&&null!=i.then?i.then((function(e){r(t,e)}),(function(e){n(e)})):r(t,i)}(o)}))},Ba.resolve=function(e){return new Ba((function(t,n){t(e)}))},Ba.reject=function(e){return new Ba((function(t,n){n(e)}))},"undefined"!=typeof Promise?Promise:Ba),Na=function(e,t,n){var r=ee(e),i=!r;(t=this._private=ve({duration:1e3},t,n)).target=e,t.style=t.style||t.css,t.started=!1,t.playing=!1,t.hooked=!1,t.applying=!1,t.progress=0,t.completes=[],t.frames=[],t.complete&&U(t.complete)&&t.completes.push(t.complete),i&&(n=e.position(),t.startPosition=t.startPosition||{x:n.x,y:n.y},t.startStyle=t.startStyle||e.cy().style().getAnimationStartStyle(e,t.style)),r&&(i=e.pan(),t.startPan={x:i.x,y:i.y},t.startZoom=e.zoom()),this.length=1,this[0]=this},La=Na.prototype,za=(ve(La,{instanceString:function(){return"animation"},hook:function(){var e,t=this._private;return t.hooked||(e=t.target._private.animation,(t.queue?e.queue:e.current).push(this),$(t.target)&&t.target.cy().addToAnimationPool(t.target),t.hooked=!0),this},play:function(){var e=this._private;return 1===e.progress&&(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 void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){function e(e,n){var r=t[e];null!=r&&(t[e]=t[n],t[n]=r)}var t=this._private,n=t.playing;if(n&&this.pause(),t.progress=1-t.progress,t.started=!1,e("zoom","startZoom"),e("pan","startPan"),e("position","startPosition"),t.style)for(var r=0;r<t.style.length;r++){var i=t.style[r],a=i.name,o=t.startStyle[a];t.startStyle[a]=i,t.style[r]=o}return n&&this.play(),this},promise:function(e){var t,n=this._private;if("frame"===e)t=n.frames;else t=n.completes;return new Ia((function(e,n){t.push((function(){e()}))}))}}),La.complete=La.completed,La.run=La.play,La.running=La.playing,{animated:function(){return function(){var e=void 0!==this.length?this:[this];return!!(this._private.cy||this).styleEnabled()&&((e=e[0])?0<e._private.animation.current.length:void 0)}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if((this._private.cy||this).styleEnabled())for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n,r=(n=void 0!==this.length)?this:[this],i=this._private.cy||this,a=!(n=!n);if(!i.styleEnabled())return this;var o=i.style();if(!(t=(e=ve({},e,t),0===Object.keys(e).length))){switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}a&&(e.style=o.getPropsList(e.style||e.css),e.css=void 0),a&&null!=e.renderedPosition&&(t=e.renderedPosition,o=i.pan(),a=i.zoom(),e.position=Ut(t,a,o)),n&&null!=e.panBy&&(t=e.panBy,a=i.pan(),e.pan={x:a.x+t.x,y:a.y+t.y});o=e.center||e.centre;n&&null!=o&&null!=(a=i.getCenterPan(o.eles,e.zoom))&&(e.pan=a),n&&null!=e.fit&&(t=e.fit,null!=(o=i.getFitViewport(t.eles||t.boundingBox,t.padding)))&&(e.pan=o.pan,e.zoom=o.zoom),n&&K(e.zoom)&&(null!=(a=i.getZoomedViewport(e.zoom))?(a.zoomed&&(e.zoom=a.zoom),a.panned&&(e.pan=a.pan)):e.zoom=null)}return new Na(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if((this._private.cy||this).styleEnabled()){t&&(e=ve({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(r.styleEnabled()){for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}r.notify("draw")}return this}}});function Oa(){var e;return gr||(gr=1,e=Array.isArray,fr=e),fr}function Va(){var e,t;return kr||(kr=1,t=function(){var e;return wr||(wr=1,e=Te()["__core-js_shared__"],xr=e),xr}(),e=(t=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"",Er=function(t){return!!e&&e in t}),Er}function Fa(){var e,t,n,r,i,a,o,s;return Sr||(Sr=1,e=function(){var e,t;return br||(br=1,e=Se(),t=ke(),mr=function(n){return!!t(n)&&("[object Function]"==(n=e(n))||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}),mr}(),t=Va(),n=ke(),r=function(){var e;return Cr||(Cr=1,e=Function.prototype.toString,Tr=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}),Tr}(),i=/^\[object .+?Constructor\]$/,a=Function.prototype,o=Object.prototype,a=a.toString,o=o.hasOwnProperty,s=RegExp("^"+a.call(o).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pr=function(a){return!(!n(a)||t(a))&&(e(a)?s:i).test(r(a))}),Pr}function Xa(){var e,t;return Ar||(Ar=1,e=Fa(),Dr||(Dr=1,Br=function(e,t){return null==e?void 0:e[t]}),t=Br,_r=function(n,r){return n=t(n,r),e(n)?n:void 0}),_r}function ja(){var e;return Rr||(Rr=1,e=Xa()(Object,"create"),Mr=e),Mr}function Ya(){var e,t,n,r,i;return Wr||(Wr=1,e=function(){var e;return Nr||(Nr=1,e=ja(),Ir=function(){this.__data__=e?e(null):{},this.size=0}),Ir}(),zr||(zr=1,Lr=function(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}),t=Lr,n=function(){var e,t;return Vr||(Vr=1,e=ja(),t=Object.prototype.hasOwnProperty,Or=function(n){var r,i=this.__data__;return e?"__lodash_hash_undefined__"===(r=i[n])?void 0:r:t.call(i,n)?i[n]:void 0}),Or}(),r=function(){var e,t;return Xr||(Xr=1,e=ja(),t=Object.prototype.hasOwnProperty,Fr=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}),Fr}(),i=function(){var e;return Yr||(Yr=1,e=ja(),jr=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}),jr}(),a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,qr=a),qr;function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}}function qa(){return Gr||(Gr=1,Kr=function(e,t){return e===t||e!=e&&t!=t}),Kr}function Wa(){var e;return $r||($r=1,e=qa(),Zr=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}),Zr}function Ua(){var e,t,n,r,i;return si||(si=1,Hr||(Hr=1,Ur=function(){this.__data__=[],this.size=0}),e=Ur,t=function(){var e,t;return Jr||(Jr=1,e=Wa(),t=Array.prototype.splice,Qr=function(n){var r=this.__data__;return!((n=e(r,n))<0||(n==r.length-1?r.pop():t.call(r,n,1),--this.size,0))}),Qr}(),n=function(){var e;return ti||(ti=1,e=Wa(),ei=function(t){var n=this.__data__;return(t=e(n,t))<0?void 0:n[t][1]}),ei}(),r=function(){var e;return ri||(ri=1,e=Wa(),ni=function(t){return-1<e(this.__data__,t)}),ni}(),i=function(){var e;return ai||(ai=1,e=Wa(),ii=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}),ii}(),a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,oi=a),oi;function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}}function Ha(){var e,t,n;return di||(di=1,e=Ya(),t=Ua(),n=function(){var e;return ui||(ui=1,e=Xa()(Te(),"Map"),li=e),li}(),ci=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}),ci}function Ka(){var e;return gi||(gi=1,pi||(pi=1,hi=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}),e=hi,fi=function(t,n){return t=t.__data__,e(n)?t["string"==typeof n?"string":"hash"]:t.map}),fi}function Ga(){var e,t,n,r,i;return Ci||(Ci=1,e=Ha(),t=function(){var e;return yi||(yi=1,e=Ka(),vi=function(t){return t=e(this,t).delete(t),this.size-=t?1:0,t}),vi}(),n=function(){var e;return bi||(bi=1,e=Ka(),mi=function(t){return e(this,t).get(t)}),mi}(),r=function(){var e;return wi||(wi=1,e=Ka(),xi=function(t){return e(this,t).has(t)}),xi}(),i=function(){var e;return ki||(ki=1,e=Ka(),Ei=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}),Ei}(),a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ti=a),Ti;function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}}function Za(){var e;return Di||(Di=1,e=function(){var e;return Si||(Si=1,e=Ga(),t.Cache=e,Pi=t),Pi;function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");function i(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;return a.has(t)?a.get(t):(e=n.apply(this,e),i.cache=a.set(t,e)||a,e)}return i.cache=new(t.Cache||e),i}}(),Bi=function(t){var n=(t=e(t,(function(e){return 500===n.size&&n.clear(),e}))).cache;return t}),Bi}function $a(){var e,t,n;return Ai||(Ai=1,n=Za(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=n((function(n){var r=[];return 46===n.charCodeAt(0)&&r.push(""),n.replace(e,(function(e,n,i,a){r.push(i?a.replace(t,"$1"):n||e)})),r})),_i=n),_i}function Qa(){return Ri||(Ri=1,Mi=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}),Mi}function Ja(){var e;return zi||(zi=1,e=function(){var e,t,n,r,i;return Ni||(Ni=1,r=Pe(),e=Qa(),t=Oa(),n=Be(),r=r?r.prototype:void 0,i=r?r.toString:void 0,Ii=function r(a){var o;return"string"==typeof a?a:t(a)?e(a,r)+"":n(a)?i?i.call(a):"":"0"==(o=a+"")&&1/a==-1/0?"-0":o}),Ii}(),Li=function(t){return null==t?"":e(t)}),Li}function eo(){var e,t,n,r;return Vi||(Vi=1,e=Oa(),t=function(){var e,t,n,r;return yr||(yr=1,e=Oa(),t=Be(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/,vr=function(i,a){var o;return!e(i)&&(!("number"!=(o=typeof i)&&"symbol"!=o&&"boolean"!=o&&null!=i&&!t(i))||r.test(i)||!n.test(i)||null!=a&&i in Object(a))}),vr}(),n=$a(),r=Ja(),Oi=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}),Oi}function to(){var e;return Xi||(Xi=1,e=Be(),Fi=function(t){var n;return"string"==typeof t||e(t)?t:"0"==(n=t+"")&&1/t==-1/0?"-0":n}),Fi}var no,ro,io,ao,oo,so,lo,uo,co,ho,po,fo,go,vo=(Wi||(Wi=1,go=function(){var e,t;return Yi||(Yi=1,e=eo(),t=to(),ji=function(n,r){for(var i=0,a=(r=e(r,n)).length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}),ji}(),qi=function(e,t,n){return void 0===(e=null==e?void 0:go(e,t))?n:e}),qi),yo=Ee(vo);function mo(){var e,t,n;return ao||(ao=1,ro||(ro=1,t=Xa(),n=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),no=n),e=no,io=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}),io}function bo(){var e,t,n,r,i;return ho||(ho=1,e=function(){var e,t,n;return so||(so=1,e=mo(),t=qa(),n=Object.prototype.hasOwnProperty,oo=function(r,i,a){var o=r[i];n.call(r,i)&&t(o,a)&&(void 0!==a||i in r)||e(r,i,a)}),oo}(),t=eo(),n=function(){var e;return uo||(uo=1,e=/^(?:0|[1-9]\d*)$/,lo=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&e.test(t))&&-1<t&&t%1==0&&t<n}),lo}(),r=ke(),i=to(),co=function(a,o,s,l){if(r(a))for(var u=-1,c=(o=t(o,a)).length,d=c-1,h=a;null!=h&&++u<c;){var p,f=i(o[u]),g=s;if("__proto__"===f||"constructor"===f||"prototype"===f)return a;u!=d&&(p=h[f],void 0===(g=l?l(p,f,h):void 0))&&(g=r(p)?p:n(o[u+1])?[]:{}),e(h,f,g),h=h[f]}return a}),co}var xo,wo,Eo,ko,To=function(){var e;return fo||(fo=1,e=bo(),po=function(t,n,r){return null==t?t:e(t,n,r)}),po}(),Co=Ee(To);var Po,So,Bo=function(){var e,t,n,r,i,a,o;return ko||(ko=1,e=Qa(),wo||(wo=1,xo=function(e,t){var n=-1,r=e.length;for(t=t||Array(r);++n<r;)t[n]=e[n];return t}),t=xo,n=Oa(),r=Be(),i=$a(),a=to(),o=Ja(),Eo=function(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}),Eo}(),Do=Ee(Bo),_o={data:function(e){return e=ve({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r,a=e,o=this,s=void 0!==o.length,l=s?o:[o],u=s?o[0]:o;if(W(t)){var c,d=-1!==t.indexOf(".")&&Do(t);if(a.allowGetting&&void 0===n)return u&&(a.beforeGet(u),c=d&&void 0===u._private[a.field][t]?yo(u._private[a.field],d):u._private[a.field][t]),c;if(a.allowSetting&&void 0!==n&&!a.immutableKeys[t]){s=i({},t,n),a.beforeSet(o,s);for(var h=0,p=l.length;h<p;h++){var f=l[h];a.canSet(f)&&(d&&void 0===u._private[a.field][t]?Co(f._private[a.field],d,n):f._private[a.field][t]=n)}a.updateStyle&&o.updateStyle(),a.onSet(o),a.settingTriggersEvent&&o[a.triggerFnName](a.settingEvent)}}else if(a.allowSetting&&K(t)){var g=t,v=Object.keys(g);a.beforeSet(o,g);for(var y=0;y<v.length;y++){var m,b=g[m=v[y]];if(!a.immutableKeys[m])for(var x=0;x<l.length;x++){var w=l[x];a.canSet(w)&&(w._private[a.field][m]=b)}}a.updateStyle&&o.updateStyle(),a.onSet(o),a.settingTriggersEvent&&o[a.triggerFnName](a.settingEvent)}else if(a.allowBinding&&U(t))o.on(a.bindingEvent,t);else if(a.allowGetting&&void 0===t)return u&&(a.beforeGet(u),r=u._private[a.field]),r;return o}},removeData:function(e){return e=ve({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=void 0!==r.length?r:[r];if(W(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var l=a[s];if(!ne(l)&&!n.immutableKeys[l])for(var u=0,c=i.length;u<c;u++)i[u]._private[n.field][l]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(void 0===t){for(var d=0,h=i.length;d<h;d++)for(var p=i[d]._private[n.field],f=Object.keys(p),g=0;g<f.length;g++){var v=f[g];!n.immutableKeys[v]&&(p[v]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},Ao={eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new Ia((function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)}))}}},Mo={},Ro=([za,_o,Ao].forEach((function(e){ve(Mo,e)})),{animate:Mo.animate(),animation:Mo.animation(),animated:Mo.animated(),clearQueue:Mo.clearQueue(),delay:Mo.delay(),delayAnimation:Mo.delayAnimation(),stop:Mo.stop()}),Io={classes:function(e){var t;if(void 0===e)return t=[],this[0]._private.classes.forEach((function(e){return t.push(e)})),t;H(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new Et(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}(l=l||s.size!==e.length)&&(o.classes=r,n.push(a))}return 0<n.length&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){H(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],d=s.has(c),h=!1;t||n&&!d?(s.add(c),h=!0):(!t||n&&d)&&(s.delete(c),h=!0),!l&&h&&(r.push(o),l=!0)}return 0<r.length&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}},No=(Io.className=Io.classNames=Io.classes,{metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:ce,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"}),Lo=(No.variable="(?:[\\w-.]|(?:\\\\"+No.metaChar+"))+",No.className="(?:[\\w-]|(?:\\\\"+No.metaChar+"))+",No.value=No.string+"|"+No.number,No.id=No.variable,function(){for(var e,t=No.comparatorOp.split("|"),n=0;n<t.length;n++)e=t[n],No.comparatorOp+="|@"+e;for(t=No.comparatorOp.split("|"),n=0;n<t.length;n++)0<=(e=t[n]).indexOf("!")||"="!==e&&(No.comparatorOp+="|\\!"+e)}(),function(){return{checks:[]}}),zo=0,Oo=1,Vo=2,Fo=3,Xo=4,jo=5,Yo=6,qo=7,Wo=8,Uo=9,Ho=10,Ko=11,Go=12,Zo=13,$o=14,Qo=15,Jo=16,es=17,ts=18,ns=19,rs=20,is=[{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 function(e,t){return-1*ge(e,t)}(e.selector,t.selector)})),as=function(){for(var e,t={},n=0;n<is.length;n++)t[(e=is[n]).selector]=e.matches;return t}(),os="("+is.map((function(e){return e.selector})).join("|")+")",ss=function(e){return e.replace(new RegExp("\\\\("+No.metaChar+")","g"),(function(e,t){return t}))},ls=function(e,t,n){e[e.length-1]=n},us=[{name:"group",query:!0,regex:"("+No.group+")",populate:function(e,t,n){n=a(n,1)[0],t.checks.push({type:zo,value:"*"===n?n:n+"s"})}},{name:"state",query:!0,regex:os,populate:function(e,t,n){n=a(n,1)[0],t.checks.push({type:qo,value:n})}},{name:"id",query:!0,regex:"\\#("+No.id+")",populate:function(e,t,n){n=a(n,1)[0],t.checks.push({type:Wo,value:ss(n)})}},{name:"className",query:!0,regex:"\\.("+No.className+")",populate:function(e,t,n){n=a(n,1)[0],t.checks.push({type:Uo,value:ss(n)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+No.variable+")\\s*\\]",populate:function(e,t,n){n=a(n,1)[0],t.checks.push({type:Xo,field:ss(n)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+No.variable+")\\s*("+No.comparatorOp+")\\s*("+No.value+")\\s*\\]",populate:function(e,t,n){var r=(n=a(n,3))[0],i=n[1];n=n[2],n=null!=new RegExp("^"+No.string+"$").exec(n)?n.substring(1,n.length-1):parseFloat(n);t.checks.push({type:Fo,field:ss(r),operator:i,value:n})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+No.boolOp+")\\s*("+No.variable+")\\s*\\]",populate:function(e,t,n){var r=(n=a(n,2))[0];n=n[1];t.checks.push({type:jo,field:ss(n),operator:r})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+No.meta+")\\s*("+No.comparatorOp+")\\s*("+No.number+")\\s*\\]\\]",populate:function(e,t,n){var r=(n=a(n,3))[0],i=n[1];n=n[2];t.checks.push({type:Yo,field:ss(r),operator:i,value:parseFloat(n)})}},{name:"nextQuery",separator:!0,regex:No.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=Lo()}},{name:"directedEdge",separator:!0,regex:No.directedEdge,populate:function(e,t){var n,r,i;return null==e.currentSubject?(r=Lo(),n=t,i=Lo(),r.checks.push({type:Ko,source:n,target:i}),ls(e,0,r),e.edgeCount++,i):(n=Lo(),r=t,i=Lo(),n.checks.push({type:Go,source:r,target:i}),ls(e,0,n),e.edgeCount++,i)}},{name:"undirectedEdge",separator:!0,regex:No.undirectedEdge,populate:function(e,t){var n,r,i;return null==e.currentSubject?(r=Lo(),n=t,i=Lo(),r.checks.push({type:Ho,nodes:[n,i]}),ls(e,0,r),e.edgeCount++,i):(n=Lo(),r=t,i=Lo(),n.checks.push({type:$o,node:r,neighbor:i}),ls(e,0,n),i)}},{name:"child",separator:!0,regex:No.child,populate:function(e,t){var n,r,i,a,o,s;return null==e.currentSubject?(s=Lo(),a=Lo(),n=e[e.length-1],s.checks.push({type:Qo,parent:n,child:a}),ls(e,0,s),e.compoundCount++,a):e.currentSubject===t?(n=Lo(),s=e[e.length-1],a=Lo(),r=Lo(),i=Lo(),o=Lo(),n.checks.push({type:ns,left:s,right:a,subject:r}),r.checks=t.checks,t.checks=[{type:rs}],o.checks.push({type:rs}),a.checks.push({type:es,parent:o,child:i}),ls(e,0,n),e.currentSubject=r,e.compoundCount++,i):(a=Lo(),o=Lo(),s=[{type:es,parent:a,child:o}],a.checks=t.checks,t.checks=s,e.compoundCount++,o)}},{name:"descendant",separator:!0,regex:No.descendant,populate:function(e,t){var n,r,i,a,o,s;return null==e.currentSubject?(s=Lo(),a=Lo(),n=e[e.length-1],s.checks.push({type:Jo,ancestor:n,descendant:a}),ls(e,0,s),e.compoundCount++,a):e.currentSubject===t?(n=Lo(),s=e[e.length-1],a=Lo(),r=Lo(),i=Lo(),o=Lo(),n.checks.push({type:ns,left:s,right:a,subject:r}),r.checks=t.checks,t.checks=[{type:rs}],o.checks.push({type:rs}),a.checks.push({type:ts,ancestor:o,descendant:i}),ls(e,0,n),e.currentSubject=r,e.compoundCount++,i):(a=Lo(),o=Lo(),s=[{type:ts,ancestor:a,descendant:o}],a.checks=t.checks,t.checks=s,e.compoundCount++,o)}},{name:"subject",modifier:!0,regex:No.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return lt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t,(e=null==(t=e[e.length-1].checks[0])?null:t.type)===Ko?t.type=Zo:e===Ho&&(t.type=$o,t.node=t.nodes[1],t.neighbor=t.nodes[0],t.nodes=null)}}],cs=(us.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)})),function(e){for(var t=0;t<us.length;t++){var n=(s=us[t]).name,r=e.match(s.regexObj);if(null!=r){var i=r,a=s,o=n,s=r[0];e=e.substring(s.length);break}}return{expr:a,match:i,name:o,remaining:e}}),ds={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=Lo();for(t.length=1,n=function(e){var t=e.match(/^\s+/);return t&&(t=t[0],e=e.substring(t.length)),e}(n);;){var i=cs(n);if(null==i.expr)return lt("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1);if(!1===(a=i.expr.populate(t,r,a)))return!1;if(null!=a&&(r=a),(n=i.remaining).match(/^\s*$/))break}var o=t[t.length-1];null!=t.currentSubject&&(o.subject=t.currentSubject),o.edgeCount=t.edgeCount,o.compoundCount=t.compoundCount;for(var s=0;s<t.length;s++){var l=t[s];if(0<l.compoundCount&&0<l.edgeCount)return lt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(1<l.edgeCount)return lt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&<("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},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return W(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(i,a){return i.checks.reduce((function(o,s,l){return o+(a===i&&0===l?"$":"")+function(i,a){var o=i.type,s=i.value;switch(o){case zo:return(l=e(s)).substring(0,l.length-1);case Fo:var l=i.field,u=i.operator;return"["+l+n(e(u))+t(s)+"]";case jo:return l=i.operator,u=i.field,"["+e(l)+u+"]";case Xo:return"["+i.field+"]";case Yo:return l=i.operator,"[["+i.field+n(e(l))+t(s)+"]]";case qo:return s;case Wo:return"#"+s;case Uo:return"."+s;case es:case Qo:return r(i.parent,a)+n(">")+r(i.child,a);case ts:case Jo:return r(i.ancestor,a)+" "+r(i.descendant,a);case ns:u=r(i.left,a),l=r(i.subject,a);var c=r(i.right,a);return u+(0<u.length?" ":"")+l+c;case rs:return""}}(s,a)}),"")},i="",a=0;a<this.length;a++){var o=this[a];i+=r(o,o.subject),1<this.length&&a<this.length-1&&(i+=", ")}return this.toStringCache=i}},hs=function(e,t,n){var r,i,a,o=W(e),s=G(e),l=W(n),u=!1,c=!1,d=!1;switch(0<=t.indexOf("!")&&(t=t.replace("!",""),c=!0),0<=t.indexOf("@")&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=0<=i.indexOf(a);break;case"$=":r=0<=i.indexOf(a,i.length-a.length);break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=n<e;break;case">=":d=!0,r=n<=e;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return!c||null==e&&d?r:!r},ps=function(e,t){return e.data(t)},fs=[],gs=function(e,t){return e.checks.every((function(e){return fs[e.type](e,t)}))},vs=(fs[zo]=function(e,t){return"*"===(e=e.value)||e===t.group()},fs[qo]=function(e,t){return function(e,t){return as[e](t)}(e=e.value,t)},fs[Wo]=function(e,t){return e=e.value,t.id()===e},fs[Uo]=function(e,t){return e=e.value,t.hasClass(e)},fs[Yo]=function(e,t){var n=e.field,r=e.operator;e=e.value;return hs(function(e,t){return e[t]()}(t,n),r,e)},fs[Fo]=function(e,t){var n=e.field,r=e.operator;e=e.value;return hs(ps(t,n),r,e)},fs[jo]=function(e,t){var n=e.field;e=e.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(ps(t,n),e)},fs[Xo]=function(e,t){var n=e.field;return e.operator,function(e){return void 0!==e}(ps(t,n))},fs[Ho]=function(e,t){var n=e.nodes[0],r=(e=e.nodes[1],t.source());t=t.target();return gs(n,r)&&gs(e,t)||gs(e,r)&&gs(n,t)},fs[$o]=function(e,t){return gs(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&gs(e.neighbor,t)}))},fs[Ko]=function(e,t){return gs(e.source,t.source())&&gs(e.target,t.target())},fs[Go]=function(e,t){return gs(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&gs(e.target,t)}))},fs[Zo]=function(e,t){return gs(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&gs(e.source,t)}))},fs[Qo]=function(e,t){return gs(e.child,t)&&gs(e.parent,t.parent())},fs[es]=function(e,t){return gs(e.parent,t)&&t.children().some((function(t){return gs(e.child,t)}))},fs[Jo]=function(e,t){return gs(e.descendant,t)&&t.ancestors().some((function(t){return gs(e.ancestor,t)}))},fs[ts]=function(e,t){return gs(e.ancestor,t)&&t.descendants().some((function(t){return gs(e.descendant,t)}))},fs[ns]=function(e,t){return gs(e.subject,t)&&gs(e.left,t)&&gs(e.right,t)},fs[rs]=function(){return!0},fs[Oo]=function(e,t){return e.value.has(t)},fs[Vo]=function(e,t){return(0,e.value)(t)},function(e){var t,n=this;return 1===n.length&&1===n[0].checks.length&&n[0].checks[0].type===Wo?e.getElementById(n[0].checks[0].value).collection():(t=function(e){for(var t=0;t<n.length;t++){var r=n[t];if(gs(r,e))return!0}return!1},null==n.text()&&(t=function(){return!0}),e.filter(t))}),ys=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||W(e)&&e.match(/^\s*$/)||($(e)?this.addQuery({checks:[{type:Oo,value:e.collection()}]}):U(e)?this.addQuery({checks:[{type:Vo,value:e}]}):W(e)?this.parse(e)||(this.invalid=!0):ot("A selector must be created from a string; found "))},ms=ys.prototype,bs=([ds,{matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(gs(n,e))return!0}return!1},filter:vs}].forEach((function(e){return ve(ms,e)})),ms.text=function(){return this.inputText},ms.size=function(){return this.length},ms.eq=function(e){return this[e]},ms.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},ms.addQuery=function(e){this[this.length++]=e},ms.selector=ms.toString,{allAre:function(e){var t=new ys(e);return this.every((function(e){return t.matches(e)}))},is:function(e){var t=new ys(e);return this.some((function(e){return t.matches(e)}))},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.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(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}}),xs=(bs.allAreNeighbours=bs.allAreNeighbors,bs.has=bs.contains,bs.equal=bs.equals=bs.same,function(e,t){return function(n,r,i,a){var o,s=n;return null==s?o="":$(s)&&1===s.length&&(o=s.id()),1===this.length&&o?(s=(s=(s=this[0]._private).traversalCache=s.traversalCache||{})[t]=s[t]||[])[o=qe(o)]||(s[o]=e.call(this,n,r,i,a)):e.call(this,n,r,i,a)}}),ws={parent:function(e){var t,n=[];if(1===this.length&&(t=this[0]._private.parent))return t;for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&n.push(i)}return this.spawn(n,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t=0;t<this.length;t++){var n,r=this[t].parents();n=(n=n||r).intersect(r)}return n.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:xs((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[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()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function Es(e,t,n,r){for(var i=[],a=new Et,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;0<i.length;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function ks(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function Ts(e,t,n){n.isChild()&&(n=n._private.parent,t.has(n.id())||e.push(n))}function Cs(e,t,n){Ts(e,t,n),ks(e,t,n)}ws.forEachDown=function(e){return Es(this,e,!(1<arguments.length&&void 0!==arguments[1])||arguments[1],ks)},ws.forEachUp=function(e){return Es(this,e,!(1<arguments.length&&void 0!==arguments[1])||arguments[1],Ts)},ws.forEachUpAndDown=function(e){return Es(this,e,!(1<arguments.length&&void 0!==arguments[1])||arguments[1],Cs)},ws.ancestors=ws.parents,(Po=So={data:Mo.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:Mo.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Mo.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Mo.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Mo.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Mo.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Po.data,Po.removeAttr=Po.removeData;var Ps,Ss=So,Bs={};function Ds(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function _s(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}ve(Bs,{degree:Ds((function(e,t){return t.source().same(t.target())?2:1})),indegree:Ds((function(e,t){return t.target().same(e)?1:0})),outdegree:Ds((function(e,t){return t.source().same(e)?1:0}))}),ve(Bs,{minDegree:_s("degree",(function(e,t){return e<t})),maxDegree:_s("degree",(function(e,t){return t<e})),minIndegree:_s("indegree",(function(e,t){return e<t})),maxIndegree:_s("indegree",(function(e,t){return t<e})),minOutdegree:_s("outdegree",(function(e,t){return e<t})),maxOutdegree:_s("outdegree",(function(e,t){return t<e}))}),ve(Bs,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var As,Ms,Rs,Is=function(e,t,n){for(var r=0;r<e.length;r++){var i,a=e[r];a.locked()||(i=a._private.position,i={x:null!=t.x?t.x-i.x:0,y:null!=t.y?t.y-i.y:0},!a.isParent()||0===i.x&&0===i.y||a.children().shift(i,n),a.dirtyBoundingBoxCache())}},Ns={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){Is(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}},Ls=((As=Ps={position:Mo.data(Ns),silentPosition:Mo.data(ve({},Ns,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Is(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(K(e))t?this.silentPosition(e):this.position(e);else if(U(e)){var n=e;(e=this.cy()).startBatch();for(var r=0;r<this.length;r++){var i,a=this[r];(i=n(a,r))&&(t?a.silentPosition(i):a.position(i))}e.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(K(e)?(r={x:G(e.x)?e.x:0,y:G(e.y)?e.y:0},n=t):W(e)&&G(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o,s=this[a];i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this)||(o={x:(o=s.position()).x+r.x,y:o.y+r.y},n?s.silentPosition(o):s.position(o))}i.endBatch()}return this},silentShift:function(e,t){return K(e)?this.shift(e,!0):W(e)&&G(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=(o=this.cy()).zoom(),i=o.pan(),a=K(e)?e:void 0,o=void 0!==a||void 0!==t&&W(e);if(n&&n.isNode()){if(!o)return n=n.position(),a=Wt(n,r,i),void 0===e?a:a[e];for(var s=0;s<this.length;s++){var l=this[s];void 0!==t?l.position(e,(t-i[e])/r):void 0!==a&&l.position(Ut(a,r,i))}}else if(!o)return;return this},relativePosition:function(e,t){var n,r=this[0],i=this.cy(),a=K(e)?e:void 0,o=void 0!==a||void 0!==t&&W(e),s=i.hasCompoundNodes();if(r&&r.isNode()){if(!o)return i=r.position(),(n=(r=s?r.parent():null)&&0<r.length)&&(r=r[0]),n=n?r.position():{x:0,y:0},a={x:i.x-n.x,y:i.y-n.y},void 0===e?a:a[e];for(var l=0;l<this.length;l++){var u=this[l],c=s?u.parent():null,d=((d=c&&0<c.length)&&(c=c[0]),d?c.position():{x:0,y:0});void 0!==t?u.position(e,t+d[e]):void 0!==a&&u.position({x:a.x+d.x,y:a.y+d.y})}}else if(!o)return;return this}}).modelPosition=As.point=As.position,As.modelPositions=As.points=As.positions,As.renderedPoint=As.renderedPosition,As.relativePoint=As.relativePosition,Ps),zs=Ms={renderedBoundingBox:function(e){e=this.boundingBox(e);var t=(n=this.cy()).zoom(),n=n.pan(),r=e.x1*t+n.x,i=e.x2*t+n.x,a=e.y1*t+n.y;return{x1:r,x2:i,y1:a,y2:e=e.y2*t+n.y,w:i-r,h:e-a}},dirtyCompoundBoundsCache:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp((function(t){var n;t.isParent()&&((n=t._private).compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds"))})),this}},Os=(Ms.updateCompoundBounds=function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(t.styleEnabled()&&t.hasCompoundNodes()&&(e||!t.batching()))for(var n=0;n<this.length;n++){var r=this[n],i=r._private;i.compoundBoundsClean&&!e||(a(r),t.batching())||(i.compoundBoundsClean=!0)}return this;function a(e){var t,n,r,i,a,o,s,l;function u(e,t,n){var r=0,i=0,a=t+n;return 0<e&&0<a&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}e.isParent()&&(t=e._private,r=e.children(),i="include"===e.pstyle("compound-sizing-wrt-labels").value,n={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},r=r.boundingBox({includeLabels:i,includeOverlays:!1,useCache:!1}),i=t.position,0!==r.w&&0!==r.h||((r={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=i.x-r.w/2,r.x2=i.x+r.w/2,r.y1=i.y-r.h/2,r.y2=i.y+r.h/2),o=n.width.left.value,"px"===n.width.left.units&&0<n.width.val&&(o=100*o/n.width.val),a=n.width.right.value,"px"===n.width.right.units&&0<n.width.val&&(a=100*a/n.width.val),l=n.height.top.value,"px"===n.height.top.units&&0<n.height.val&&(l=100*l/n.height.val),s=n.height.bottom.value,"px"===n.height.bottom.units&&0<n.height.val&&(s=100*s/n.height.val),a=(o=u(n.width.val-r.w,o,a)).biasDiff,o=o.biasComplementDiff,s=(l=u(n.height.val-r.h,l,s)).biasDiff,l=l.biasComplementDiff,t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return 0<e?n.pfValue*e:0;case"height":return 0<t?n.pfValue*t:0;case"average":return 0<e&&0<t?n.pfValue*(e+t)/2:0;case"min":return 0<e&&0<t?t<e?n.pfValue*t:n.pfValue*e:0;case"max":return 0<e&&0<t?t<e?n.pfValue*e:n.pfValue*t:0;default:return 0}}(r.w,r.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(r.w,n.width.val),i.x=(-a+r.x1+r.x2+o)/2,t.autoHeight=Math.max(r.h,n.height.val),i.y=(-s+r.y1+r.y2+l)/2)}},function(e){return e===1/0||e===-1/0?0:e}),Vs=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(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=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Fs=function(e,t){return null==t?e:Vs(e,t.x1,t.y1,t.x2,t.y2)},Xs=function(e,t,n){return yt(e,t,n)},js=function(e,t,n){var r,i,a,o;t.cy().headless()||(r=(a=(o=t._private).rstyle).arrowWidth/2,"none"!==t.pstyle(n+"-arrow-shape").value&&(t="source"===n?(i=a.srcX,a.srcY):"target"===n?(i=a.tgtX,a.tgtY):(i=a.midX,a.midY),(o=(a=o.arrowBounds=o.arrowBounds||{})[n]=a[n]||{}).x1=i-r,o.y1=t-r,o.x2=i+r,o.y2=t+r,o.w=o.x2-o.x1,o.h=o.y2-o.y1,sn(o,1),Vs(e,o.x1,o.y1,o.x2,o.y2)))},Ys=function(e,t,n){if(!t.cy().headless()){var r=n?n+"-":"",i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o=t.pstyle("text-halign"),s=t.pstyle("text-valign"),l=Xs(a,"labelWidth",n),u=Xs(a,"labelHeight",n),c=Xs(a,"labelX",n),d=Xs(a,"labelY",n),h=(a=t.pstyle(r+"text-margin-x").pfValue,t.pstyle(r+"text-margin-y").pfValue),p=t.isEdge(),f=(r=t.pstyle(r+"text-rotation"),t.pstyle("text-outline-width").pfValue),g=t.pstyle("text-border-width").pfValue/2,v=(t=t.pstyle("text-background-padding").pfValue,u),y=l,m=y/2,b=v/2;if(p)C=c-m,P=c+m,S=d-b,B=d+b;else{switch(o.value){case"left":C=c-y,P=c;break;case"center":C=c-m,P=c+m;break;case"right":P=(C=c)+y}switch(s.value){case"top":S=d-v,B=d;break;case"center":S=d-b,B=d+b;break;case"bottom":B=(S=d)+v}}if(C+=u=a-Math.max(f,g)-t-2,P+=l=a+Math.max(f,g)+t+2,S+=a=h-Math.max(f,g)-t-2,B+=h=h+Math.max(f,g)+t+2,f=n||"main",(t=(g=i.labelBounds)[f]=g[f]||{}).x1=C,t.y1=S,t.x2=P,t.y2=B,t.w=P-C,t.h=B-S,t.leftPad=u,t.rightPad=l,t.topPad=a,t.botPad=h,u=p&&"autorotate"===r.strValue,l=null!=r.pfValue&&0!==r.pfValue,u||l){a=u?Xs(i.rstyle,"labelAngle",n):r.pfValue;var x=Math.cos(a),w=Math.sin(a),E=(C+P)/2,k=(S+B)/2;if(!p){switch(o.value){case"left":E=P;break;case"right":E=C}switch(s.value){case"top":k=B;break;case"bottom":k=S}}function T(e,t){return{x:(e-=E)*x-(t-=k)*w+E,y:e*w+t*x+k}}t=T(C,S),h=T(C,B),l=T(P,S),u=T(P,B);var C=Math.min(t.x,h.x,l.x,u.x),P=Math.max(t.x,h.x,l.x,u.x),S=Math.min(t.y,h.y,l.y,u.y),B=Math.max(t.y,h.y,l.y,u.y)}(r=g[n=f+"Rot"]=g[n]||{}).x1=C,r.y1=S,r.x2=P,r.y2=B,r.w=P-C,r.h=B-S,Vs(e,C,S,P,B),Vs(i.labelBounds.all,C,S,P,B)}return e}},qs=function(e,t){var n,r;t.cy().headless()||(n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value,Ws(e,t,n,r,"outside",r/2))},Ws=function(e,t,n,r,i,a){var o,s,l;0===n||r<=0||"inside"===i||(n=t.cy(),s=t.pstyle("shape").value,n=n.renderer().nodeShapes[s],o=(s=t.position()).x,s=s.y,l=t.width(),t=t.height(),n.hasMiterBounds?("center"===i&&(r/=2),i=n.miterBounds(o,s,l,t,r),Fs(e,i)):null!=a&&0<a&&ln(e,[a,a,a,a]))},Us=function(e,t){function n(e){return"none"!==e.pstyle("display").value}var r=(i=e._private.cy).styleEnabled(),i=i.headless(),a=rn(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&r?e.pstyle("bounds-expansion").pfValue:[0],d=!r||n(e)&&(!l||n(e.source())&&n(e.target()));if(d){var h=0,p=(r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(h=e.pstyle("overlay-padding").value),0),f=(h=(r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(p=e.pstyle("underlay-padding").value),Math.max(h,p)),0);if(r&&(f=e.pstyle("width").pfValue/2),s&&t.includeNodes){s=(p=e.position()).x,p=p.y;var g,v,y,m,b=e.outerWidth()/2,x=e.outerHeight()/2;Vs(a,g=s-b,y=p-x,v=s+b,m=p+x),r&&qs(a,e),r&&t.includeOutlines&&!i&&qs(a,e),r&&function(e,t){var n,r,i;t.cy().headless()||(n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value,Ws(e,t,n,r,i))}(a,e)}else if(l&&t.includeEdges)if(r&&!i){var w;s=e.pstyle("curve-style").strValue;if(g=Math.min(u.srcX,u.midX,u.tgtX),v=Math.max(u.srcX,u.midX,u.tgtX),y=Math.min(u.srcY,u.midY,u.tgtY),m=Math.max(u.srcY,u.midY,u.tgtY),Vs(a,g-=f,y-=f,v+=f,m+=f),"haystack"===s)(b=u.haystackPts)&&2===b.length&&(g=b[0].x,y=b[0].y,(v=b[1].x)<g&&(p=g,g=v,v=p),(m=b[1].y)<y&&(x=y,y=m,m=x),Vs(a,g-f,y-f,v+f,m+f));else if("bezier"===s||"unbundled-bezier"===s||ue(s,"segments")||ue(s,"taxi")){switch(s){case"bezier":case"unbundled-bezier":w=u.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":w=u.linePts}if(null!=w)for(var E=0;E<w.length;E++){var k=w[E];g=k.x-f,v=k.x+f,y=k.y-f,m=k.y+f,Vs(a,g,y,v,m)}}}else i=e.source().position(),p=e.target().position(),g=i.x,v=p.x,y=i.y,v<g&&(b=g,g=v,v=b),(m=p.y)<y&&(x=y,y=m,m=x),Vs(a,g-=f,y-=f,v+=f,m+=f);r&&t.includeEdges&&l&&(js(a,e,"mid-source"),js(a,e,"mid-target"),js(a,e,"source"),js(a,e,"target")),r&&"yes"===e.pstyle("ghost").value&&(s=e.pstyle("ghost-offset-x").pfValue,i=e.pstyle("ghost-offset-y").pfValue,Vs(a,a.x1+s,a.y1+i,a.x2+s,a.y2+i)),b=o.bodyBounds=o.bodyBounds||{},un(b,a),ln(b,c),sn(b,1),r&&(g=a.x1,v=a.x2,y=a.y1,m=a.y2,Vs(a,g-h,y-h,v+h,m+h)),p=o.overlayBounds=o.overlayBounds||{},un(p,a),ln(p,c),sn(p,1),null!=(x=o.labelBounds=o.labelBounds||{}).all?function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0}(x.all):x.all=rn(),r&&t.includeLabels&&(t.includeMainLabels&&Ys(a,e,null),l)&&(t.includeSourceLabels&&Ys(a,e,"source"),t.includeTargetLabels)&&Ys(a,e,"target")}return a.x1=Os(a.x1),a.y1=Os(a.y1),a.x2=Os(a.x2),a.y2=Os(a.y2),a.w=Os(a.x2-a.x1),a.h=Os(a.y2-a.y1),0<a.w&&0<a.h&&d&&(ln(a,c),sn(a,1)),a},Hs=function(e){function t(e){return(e?1:0)<<n++}var n=0,r=0;return(r+=t(e.incudeNodes))+t(e.includeEdges)+t(e.includeLabels)+t(e.includeMainLabels)+t(e.includeSourceLabels)+t(e.includeTargetLabels)+t(e.includeOverlays)+t(e.includeOutlines)},Ks=function(e){function t(e){return Math.round(e)}var n,r;return e.isEdge()?(r=e.source().position(),n=e.target().position(),Ye([t(r.x),t(r.y),t(n.x),t(n.y)])):(r=e.position(),Ye([t(r.x),t(r.y)]))},Gs=function(e,t){var n,r=e._private,i=e.isEdge(),a=(null==t?$s:Hs(t))===$s;return null==r.bbCache?(n=Us(e,Zs),r.bbCache=n,r.bbCachePosKey=Ks(e)):n=r.bbCache,a||(a=e.isNode(),n=rn(),(t.includeNodes&&a||t.includeEdges&&!a)&&(t.includeOverlays?Fs(n,r.overlayBounds):Fs(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Fs(n,r.labelBounds.all):(t.includeMainLabels&&Fs(n,r.labelBounds.mainRot),t.includeSourceLabels&&Fs(n,r.labelBounds.sourceRot),t.includeTargetLabels&&Fs(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1),n},Zs={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},$s=Hs(Zs),Qs=pt(Zs),Js=(Ms.boundingBox=function(e){var t=void 0===e||void 0===e.useCache||!0===e.useCache,n=ie((function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==Ks(e)}),(function(e){return e.id()}));if(t&&1===this.length&&!n(this[0]))e=void 0===e?Zs:Qs(e),r=Gs(this[0],e);else{var r=rn(),i=Qs(e=e||Zs);e=this.cy().styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),e&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var a=0;a<this.length;a++){var o=this[a];n(o)&&o.dirtyBoundingBoxCache(),Fs(r,Gs(o,i))}}return r.x1=Os(r.x1),r.y1=Os(r.y1),r.x2=Os(r.x2),r.y2=Os(r.y2),r.w=Os(r.x2-r.x1),r.h=Os(r.y2-r.y1),r},Ms.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},Ms.boundingBoxAt=function(e){var t,n=this.nodes(),r=this.cy(),i=r.hasCompoundNodes(),a=r.collection(),o=(i&&(a=n.filter((function(e){return e.isParent()})),n=n.not(a)),K(e)&&(t=e,e=function(){return t}),r.startBatch(),n.forEach((function(t,n){return t._private.bbAtOldPos=e(t,n)})).silentPositions(e),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}}(this.boundingBox({useCache:!1})));return n.silentPositions((function(e){return e._private.bbAtOldPos})),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),r.endBatch(),o},zs.boundingbox=zs.bb=zs.boundingBox,zs.renderedBoundingbox=zs.renderedBoundingBox,Ms),el=Rs={},tl=function(e){e.uppercaseName=le(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=le(e.outerName),el[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)return r?t.isParent()?(t.updateCompoundBounds(),n[e.autoName]||0):"label"!==(r=t.pstyle(e.name)).strValue?r.pfValue:(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):1},el["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+("center"===(n=t.pstyle("border-position").value)?t.pstyle("border-width").pfValue:"outside"===n?2*t.pstyle("border-width").pfValue:0)+2*t.padding():1},el["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},el["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}},nl=(tl({name:"width"}),tl({name:"height"}),Rs.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},Rs.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},Rs.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()},Rs),rl={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},il=Object.keys(rl).reduce((function(e,t){var n=rl[t],r=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(t);return e[t]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)}(this,n.get)},n.mult?e[r]=function(){return function(e,t){var n,r,i;if(e.isEdge()&&e.takesUpSpace())return n=e.cy(),r=n.pan(),i=n.zoom(),t(e).map((function(e){return Wt(e,i,r)}))}(this,n.get)}:e[r]=function(){return function(e,t){var n;if(e.isEdge()&&e.takesUpSpace())return n=e.cy(),Wt(t(e),n.zoom(),n.pan())}(this,n.get)},e}),{}),al=ve({},Ls,Js,nl,il),ol=function(e,t){this.recycle(e,t)};function sl(){return!1}function ll(){return!0}ol.prototype={instanceString:function(){return"event"},recycle:function(e,t){var n,r;this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=sl,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?ll:sl):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=(null!=t.type?t: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),null!=this.cy&&null!=this.position&&null==this.renderedPosition&&(t=this.position,n=this.cy.zoom(),r=this.cy.pan(),this.renderedPosition={x:t.x*n+r.x,y:t.y*n+r.y}),this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=ll;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=ll;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ll,this.stopPropagation()},isDefaultPrevented:sl,isPropagationStopped:sl,isImmediatePropagationStopped:sl};var ul=/^([^.]+)(\.(?:[^.]+))?$/,cl={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},dl=Object.keys(cl),hl={};function pl(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:hl,t=1<arguments.length?arguments[1]:void 0,n=0;n<dl.length;n++){var r=dl[n];this[r]=e[r]||cl[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var fl=pl.prototype,gl=function(e,t,n,r,i,a,o){U(r)&&(i=r,r=null),o&&(a=null==a?o:ve({},a,o));for(var s=H(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!ne(u)){var c=u.match(ul);if(c&&!1===t(e,u,c[1],c[2]||null,r,i,a))break}}},vl=function(e,t){return e.addEventFields(e.context,t),new ol(t.type,t)},yl=function(e,t,n){if(function(e){return"event"===q(e)}(n))t(e,n);else if(K(n))t(e,vl(e,n));else for(var r=H(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a,o=r[i];ne(o)||(o=o.match(ul))&&(a=o[1],o=o[2]||null,t(e,vl(e,{type:a,namespace:o,target:e.context})))}},ml=(fl.on=fl.addListener=function(e,t,n,r,i){return gl(this,(function(e,t,n,r,i,a,o){U(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})}),e,t,n,r,i),this},fl.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},fl.removeListener=fl.off=function(e,t,n,r){for(var i=this,a=(0!==this.emitting&&(this.listeners=function(e){return e.slice()}(this.listeners)),this.listeners),o=a.length-1;0<=o;o--)!function(o){var s=a[o];gl(i,(function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1}),e,t,n,r)}(o);return this},fl.removeAllListeners=function(){return this.removeListener("*")},fl.emit=fl.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,H(t)||(t=[t]),yl(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=0;o<i;o++)!function(){var n,i,s=r[o];s.type!==a.type||s.namespace&&s.namespace!==a.namespace&&".*"!==s.namespace||!e.eventMatches(e.context,s,a)||(n=[a],null!=t&&vt(n,t),e.beforeEmit(e.context,s,a),s.conf&&s.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==s}))),i=e.callbackContext(e.context,s,a),i=s.callback.apply(i,n),e.afterEmit(e.context,s,a),!1===i&&(a.stopPropagation(),a.preventDefault()))}();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)}),e),this.emitting--,this},{qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){return null==(t=t.qualifier)||e!==n.target&&Q(n.target)&&t.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?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()}}),bl=function(e){return W(e)?new ys(e):e},xl={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new pl(ml,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=bl(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=bl(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=bl(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=bl(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}},wl=(Mo.eventAliasesOn(xl),{nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.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:t).push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(W(e)||$(e))return new ys(e).filter(this);if(U(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.push(i)}return n}return this.spawn()},not:function(e){if(e){W(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(W(e))return this.filter(e);for(var t=this.spawn(),n=this.length<e.length,r=n?this:e,i=n?e:this,a=0;a<r.length;a++){var o=r[a];i.has(o)&&t.push(o)}return t},xor:function(e){function t(e,t){for(var n=0;n<e.length;n++){var i=e[n],a=i._private.data.id;t.hasElementWithId(a)||r.push(i)}}var n=this._private.cy,r=(W(e)&&(e=n.$(e)),this.spawn());return t(this,n=e),t(n,this),r},diff:function(e){function t(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}}var n=this._private.cy,r=(n=(W(e)&&(e=n.$(e)),this.spawn()),this.spawn()),i=this.spawn();return t(this,e,n),t(e,this,r),{left:n,right:r,both:i}},add:function(e){var t,n=this._private.cy;if(!e)return this;W(e)&&(t=e,e=n.mutableElements().filter(t));for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];!this.has(a)&&r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(e){e&&W(e)&&(r=e,e=n.mutableElements().filter(r));for(var r,i=t.map,a=0;a<e.length;a++){var o,s=e[a],l=s._private.data.id;!i.has(l)&&(this[o=this.length++]=s,i.set(l,{ele:s,index:o}))}}return this},unmergeAt:function(e){var t,n,r=this[e].id(),i=this._private.map;this[e]=void 0,i.delete(r),r=e===this.length-1;return 1<this.length&&!r&&(n=(t=this[r=this.length-1])._private.data.id,this[r]=void 0,this[e]=t,i.set(n,{ele:t,index:e})),this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private;e=e._private.data.id;return(t=t.map.get(e))&&(e=t.index,this.unmergeAt(e)),this},unmerge:function(e){var t,n=this._private.cy;if(e){e&&W(e)&&(t=e,e=n.mutableElements().filter(t));for(var r=0;r<e.length;r++)this.unmergeOne(e[r])}return this},unmergeBy:function(e){for(var t=this.length-1;0<=t;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r];i=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(i)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);r<o&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}}),El=wl,kl=(El.u=El["|"]=El["+"]=El.union=El.or=El.add,El["\\"]=El["!"]=El["-"]=El.difference=El.relativeComplement=El.subtract=El.not,El.n=El["&"]=El["."]=El.and=El.intersection=El.intersect,El["^"]=El["(+)"]=El["(-)"]=El.symmetricDifference=El.symdiff=El.xor,El.fnFilter=El.filterFn=El.stdFilter=El.filter,El.complement=El.abscomp=El.absoluteComplement,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},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}}),Tl=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?tt:0}var i=r(e)-r(t);return 0!=i||0!=(i=a(e)-a(t))||0!=(i=e.pstyle("z-index").value-t.pstyle("z-index").value)?i:e.poolIndex()-t.poolIndex();function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}},Cl={forEach:function(e,t){if(U(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))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:t)<0&&(t=r+t);for(var i=e=(e=null==e?0:e)<0?r+e:e;0<=i&&i<t&&i<r;i++)n.push(this[i]);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 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){return U(e)?(e=this.toArray().sort(e),this.spawn(e)):this},sortByZIndex:function(){return this.sort(Tl)},zDepth:function(){var e,t,n=this[0];if(n)return"nodes"===(t=n._private).group?(e=t.data.parent?n.parents().size():0,n.isParent()?e:tt-1):(n=t.source,e=t.target,t=n.zDepth(),n=e.zDepth(),Math.max(t,n,0))}},Pl=(Cl.each=Cl.forEach,function(){"undefined"!=("undefined"==typeof Symbol?"undefined":l(Symbol))&&"undefined"!=l(Symbol.iterator)&&(Cl[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return i({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))})}),Sl=(Pl(),pt({nodeDimensionsIncludeLabels:!1})),Bl={layoutDimensions:function(e){return e=Sl(e),0!==(e=this.takesUpSpace()?e.nodeDimensionsIncludeLabels?{w:(e=this.boundingBox()).w,h:e.h}:{w:this.outerWidth(),h:this.outerHeight()}:{w:0,h:0}).w&&0!==e.h||(e.w=e.h=1),e},layoutPositions:function(e,t,n){function r(e){return e.id()}var i=this.nodes().filter((function(e){return!e.isParent()})),a=this.cy(),o=t.eles,s=ie(n,r),l=(e.emit({type:"layoutstart",layout:e}),e.animations=[],t.spacingFactor&&1!==t.spacingFactor),u=function(){if(!l)return null;for(var e=rn(),t=0;t<i.length;t++){var n=i[t];n=s(n,t);on(e,n.x,n.y)}return e}(),c=ie((function(e,n){var r,i,a,o;n=s(e,n);return l&&(r=Math.abs(t.spacingFactor),a=n,o=(i=u).x1+i.w/2,i=i.y1+i.h/2,n={x:o+(a.x-o)*r,y:i+(a.y-i)*r}),null!=t.transform?t.transform(e,n):n}),r);if(t.animate){for(var d=0;d<i.length;d++){var h,p=i[d],f=c(p,d);null==t.animateFilter||t.animateFilter(p,d)?(h=p.animation({position:f,duration:t.animationDuration,easing:t.animationEasing}),e.animations.push(h)):p.position(f)}t.fit?(n=a.animation({fit:{boundingBox:o.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing}),e.animations.push(n)):void 0!==t.zoom&&void 0!==t.pan&&(o=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing}),e.animations.push(o)),e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Ia.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else i.positions(c),t.fit&&a.fit(t.eles,t.padding),null!=t.zoom&&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){return this.cy().makeLayout(ve({},e,{eles:this}))}};function Dl(e,t,n){var r,i;return null!=(r=(i=(i=n._private).styleCache=i.styleCache||[])[e])?r:i[e]=t(n)}function _l(e,t){return e=qe(e),function(n){return Dl(e,t,n)}}function Al(e,t){function n(e){return t.call(e)}return e=qe(e),function(){var t=this[0];if(t)return Dl(e,n,t)}}Bl.createLayout=Bl.makeLayout=Bl.layout;var Ml={recalculateRenderedStyle:function(e){var t=(n=this.cy()).renderer(),n=n.styleEnabled();return t&&n&&t.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){function e(e){return e._private.styleCache=null}var t=this.cy();return t.hasCompoundNodes()?((t=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(t.connectedEdges()),t.forEach(e)):this.forEach((function(t){e(t),t.connectedEdges().forEach(e)})),this},updateStyle:function(e){var t,n=this._private.cy;return n.styleEnabled()&&(n.batching()?n._private.batchStyleEles.merge(this):(t=this,e=!(!e&&void 0!==e),n=t=n.hasCompoundNodes()?this.spawnSelf().merge(this.descendants()).merge(this.parents()):t,e?n.emitAndNotify("style"):n.emit("style"),t.forEach((function(e){return e._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=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();return r.styleEnabled()&&n?(n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n)),null!=(n=n._private.style[e])?n:t?r.style().getDefaultProperty(e):null):void 0},numericStyle:function(e){var t=this[0];return t.cy().styleEnabled()&&t?void 0!==(t=t.pstyle(e)).pfValue?t.pfValue:t.value:void 0},numericStyleUnits:function(e){var t=this[0];return t.cy().styleEnabled()&&t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t,n=this.cy();return n.styleEnabled()?(t=this[0])?n.style().getRenderedStyle(t,e):void 0:this},style:function(e,t){if((r=this.cy()).styleEnabled()){var n,r=r.style();if(K(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(W(e)){if(void 0===t)return(n=this[0])?r.getStylePropertyValue(n,e):void 0;r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e)return(n=this[0])?r.getRawStyle(n):void 0}return this},removeStyle:function(e){var t=this.cy();if(t.styleEnabled()){var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}this.emitAndNotify("style")}return this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){if(!(e=this.cy()).styleEnabled())return 1;var e=e.hasCompoundNodes(),t=this[0];if(t){var n=t._private,r=t.pstyle("opacity").value;if(e){var i=n.data.parent?t.parents():null;if(i)for(var a=0;a<i.length;a++)r*=i[a].pstyle("opacity").value}return r}},transparent:function(){var e,t;return!!this.cy().styleEnabled()&&(t=(e=this[0]).cy().hasCompoundNodes(),e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0)},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function Rl(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++)if(!t(n[r]))return!1;return!0}function Il(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e,i,a=this.cy();return!a.styleEnabled()||(e=this[0],a=a.hasCompoundNodes(),e?(i=e._private,!!t(e)&&(e.isNode()?!a||Rl(e,r):(e=i.source,i=i.target,n(e)&&(!a||Rl(e,n))&&(e===i||n(i)&&(!a||Rl(i,n)))))):void 0)}}var Nl=_l("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())})),Ll=(Ml.takesUpSpace=Al("takesUpSpace",Il({ok:Nl})),_l("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&Nl(e)}))),zl=_l("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&Nl(e)})),Ol=(Ml.interactive=Al("interactive",Il({ok:Ll,parentOk:zl,edgeOkViaNode:Nl})),Ml.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},_l("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&Nl(e)}))),Vl=Nl,Fl=(Ml.visible=Al("visible",Il({ok:Ol,edgeOkViaNode:Vl})),Ml.hidden=function(){var e=this[0];if(e)return!e.visible()},Ml.isBundledBezier=Al("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()})),Ml.bypass=Ml.css=Ml.style,Ml.renderedCss=Ml.renderedStyle,Ml.removeBypass=Ml.removeCss=Ml.removeStyle,Ml.pstyle=Ml.parsedStyle,{});function Xl(e){return function(){var t=[];if(2===(n=arguments).length)this.on(e.event,n[0],n[1]);else if(1===n.length&&U(n[0]))this.on(e.event,n[0]);else if(0===n.length||1===n.length&&H(n[0])){for(var n=1===n.length?n[0]:null,r=0;r<this.length;r++){var i=this[r],a=!e.ableField||i._private[e.ableField],o=i._private[e.field]!=e.value;if(e.overrideAble){var s=e.overrideAble(i);if(void 0!==s&&!(a=s))return this}a&&(i._private[e.field]=e.value,o)&&t.push(i)}var l=this.spawn(t);l.updateStyle(),l.emit(e.event),n&&l.emit(n)}return this}}function jl(e){Fl[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},Fl[e.on]=Xl({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Fl[e.off]=Xl({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}jl({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),jl({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),jl({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),jl({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),Fl.deselect=Fl.unselect,Fl.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},jl({field:"active",on:"activate",off:"unactivate"}),jl({field:"pannable",on:"panify",off:"unpanify"}),Fl.inactive=function(){var e=this[0];if(e)return!e._private.active};var Yl={},ql=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=(u=o[s]).source(),u=u.target();if(e.noIncomingEdges&&u===i&&l!==i||e.noOutgoingEdges&&l===i&&u!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,!0).filter(t)}},Wl=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(n.push(s),n.push(u)):e.incoming&&u===i&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},Ul=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function Hl(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}function Kl(e){return function(t){var n=[],r=this._private.cy,i=e||{};W(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target);u=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||u){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!u)continue}n.push(l)}}return this.spawn(n,!0)}}function Gl(e){return e=ve({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,d=0;d<c.length;d++){var h=c[d],p=(f=h._private.data).target,f=f.source,g=p===u&&f===l;(i.codirected&&g||!i.codirected&&(g||l===p&&u===f))&&n.push(h)}return this.spawn(n,!0).filter(t)}}Yl.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},ve(Yl,{roots:ql({noIncomingEdges:!0}),leaves:ql({noOutgoingEdges:!0}),outgoers:xs(Wl({outgoing:!0}),"outgoers"),successors:Ul({outgoing:!0}),incomers:xs(Wl({incoming:!0}),"incomers"),predecessors:Ul({})}),ve(Yl,{neighborhood:xs((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();0<(u=i===l?u:l).length&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Yl.neighbourhood=Yl.neighborhood,Yl.closedNeighbourhood=Yl.closedNeighborhood,Yl.openNeighbourhood=Yl.openNeighborhood,ve(Yl,{source:xs((function(e){var t,n=this[0];return(t=n?n._private.source||n.cy().collection():t)&&e?t.filter(e):t}),"source"),target:xs((function(e){var t,n=this[0];return(t=n?n._private.target||n.cy().collection():t)&&e?t.filter(e):t}),"target"),sources:Hl({attr:"source"}),targets:Hl({attr:"target"})}),ve(Yl,{edgesWith:xs(Kl(),"edgesWith"),edgesTo:xs(Kl({thisIsSrc:!0}),"edgesTo")}),ve(Yl,{connectedEdges:xs((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)}),"connectedEdges"),connectedNodes:xs((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,!0).filter(e)}),"connectedNodes"),parallelEdges:xs(Gl(),"parallelEdges"),codirectedEdges:xs(Gl({codirected:!0}),"codirectedEdges")}),ve(Yl,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=(null==e?t:e).nodes(),a=[],o=(null!=e&&i.empty()&&(i=e.sources()),function(e,t){r.merge(e),i.unmerge(e),t.merge(e)});if(i.empty())return t.spawn();for(;function(){var e=n.collection(),r=(a.push(e),i[0]);o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))}(),0<i.length;);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Yl.componentsOf=Yl.components;var Zl=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(void 0===e)ot("A collection must have a reference to the core");else{var i=new xt,a=!1;if(t){if(0<t.length&&K(t[0])&&!Q(t[0])){a=!0;for(var o=[],s=new Et,l=0,u=t.length;l<u;l++){var c=t[l],d=(null==c.data&&(c.data={}),c.data);if(null==d.id)d.id=ct();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;c=new kt(e,c,!1),o.push(c),s.add(d.id)}t=o}}else t=[];for(var h=this.length=0,p=t.length;h<p;h++){var f,g=t[h][0];null==g||(f=g._private.data.id,n&&i.has(f))||(n&&i.set(f,{index:this.length,ele:g}),this[this.length]=g,this.length++)}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new xt,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()}},$l=kt.prototype=Zl.prototype=Object.create(Array.prototype),Ql=($l.instanceString=function(){return"collection"},$l.spawn=function(e,t){return new Zl(this.cy(),e,t)},$l.spawnSelf=function(){return this.spawn(this)},$l.cy=function(){return this._private.cy},$l.renderer=function(){return this._private.cy.renderer()},$l.element=function(){return this[0]},$l.collection=function(){return J(this)?this:new Zl(this._private.cy,[this])},$l.unique=function(){return new Zl(this._private.cy,this,!0)},$l.hasElementWithId=function(e){return this._private.map.has(e=""+e)},$l.getElementById=function(e){var t=this._private.cy;return(e=this._private.map.get(e=""+e))?e.ele:new Zl(t)},$l.$id=$l.getElementById,$l.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},$l.indexOf=function(e){return e=e[0]._private.data.id,this._private.map.get(e).index},$l.indexOfId=function(e){return this._private.map.get(e=""+e).index},$l.json=function(e){var t,n,r,i,a,o,s,l,u=this.element(),c=this.cy();return null==u&&e?this:null!=u?(t=u._private,K(e)?(c.startBatch(),e.data&&(u.data(e.data),n=t.data,u.isEdge()?(o=!1,r={},i=e.data.source,a=e.data.target,null!=i&&i!=n.source&&(r.source=""+i,o=!0),null!=a&&a!=n.target&&(r.target=""+a,o=!0),o&&(u=u.move(r))):(i="parent"in e.data,a=e.data.parent,!i||null==a&&null==n.parent||a==n.parent||(u=u.move({parent:a=null!=(a=void 0===a?null:a)?""+a:a})))),e.position&&u.position(e.position),(o=function(n,r,i){var a=e[n];null!=a&&a!==t[n]&&(a?u[r]():u[i]())})("removed","remove","restore"),o("selected","select","unselect"),o("selectable","selectify","unselectify"),o("locked","lock","unlock"),o("grabbable","grabify","ungrabify"),o("pannable","panify","unpanify"),null!=e.classes&&u.classes(e.classes),c.endBatch(),this):void 0===e?(s={data:ut(t.data),position:ut(t.position),group:t.group,removed:t.removed,selected:t.selected,selectable:t.selectable,locked:t.locked,grabbable:t.grabbable,pannable:t.pannable,classes:null,classes:""},l=0,t.classes.forEach((function(e){return s.classes+=0==l++?e:" "+e})),s):void 0):void 0},$l.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},$l.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json();r=new kt(e,r,!1);t.push(r)}return new Zl(e,t)},$l.copy=$l.clone,$l.restore=function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.cy(),r=n._private,i=[],a=[],o=0,s=this.length;o<s;o++){var l=this[o];t&&!l.removed()||(l.isNode()?i:a).push(l)}function u(){c.splice(d,1),d--}for(var c=i.concat(a),d=0;d<c.length;d++){var h=c[d],p=h._private,f=p.data;if(h.clearTraversalCache(),t||p.removed)if(void 0===f.id)f.id=ct();else if(G(f.id))f.id=""+f.id;else{if(ne(f.id)||!W(f.id)){ot("Can not create element with invalid string ID `"+f.id+"`"),u();continue}if(n.hasElementWithId(f.id)){ot("Can not create second element with ID `"+f.id+"`"),u();continue}}var g=f.id;if(h.isNode()&&(null==(v=p.position).x&&(v.x=0),null==v.y)&&(v.y=0),h.isEdge()){for(var v=h,y=["source","target"],m=y.length,b=!1,x=0;x<m;x++){var w=y[x],E=f[w];null==(E=G(E)?f[w]=""+f[w]:E)||""===E?(ot("Can not create edge `"+g+"` with unspecified "+w),b=!0):n.hasElementWithId(E)||(ot("Can not create edge `"+g+"` with nonexistant "+w+" `"+E+"`"),b=!0)}if(b){u();continue}var k=n.getElementById(f.source),T=n.getElementById(f.target);(k.same(T)?k:(k._private.edges.push(v),T))._private.edges.push(v),v._private.source=k,v._private.target=T}p.map=new xt,p.map.set(g,{ele:h,index:0}),p.removed=!1,t&&n.addToPool(h)}for(var C=0;C<i.length;C++){var P=i[C],S=P._private.data,B=(G(S.parent)&&(S.parent=""+S.parent),S.parent);if(null!=B||P._private.parent)if((B=P._private.parent?n.collection().merge(P._private.parent):n.getElementById(B)).empty())S.parent=void 0;else if(B[0].removed())lt("Node added with missing parent, reference to parent removed"),S.parent=void 0,P._private.parent=null;else{for(var D=!1,_=B;!_.empty();){if(P.same(_)){D=!0,S.parent=void 0;break}_=_.parent()}D||(B[0]._private.children.push(P),P._private.parent=B[0],r.hasCompoundNodes=!0)}}if(0<c.length){for(var A=c.length===this.length?this:new Zl(n,c),M=0;M<A.length;M++){var R=A[M];R.isNode()||(R.parallelEdges().clearTraversalCache(),R.source().clearTraversalCache(),R.target().clearTraversalCache())}(r.hasCompoundNodes?n.collection().merge(A).merge(A.connectedNodes()).merge(A.parent()):A).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?A.emitAndNotify("add"):t&&A.emit("add")}return this},$l.removed=function(){var e=this[0];return e&&e._private.removed},$l.inside=function(){var e=this[0];return e&&!e._private.removed},$l.remove=function(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=[],r={},i=this._private.cy;function a(e){var i=r[e.id()];if(!(t&&e.removed()||i))if(r[e.id()]=!0,e.isNode()){n.push(e);for(var o=e._private.edges,s=0;s<o.length;s++)a(o[s]);for(var l=e._private.children,u=0;u<l.length;u++)a(l[u])}else n.unshift(e)}for(var o=0,s=this.length;o<s;o++)a(this[o]);function l(e,t){var n=e._private.edges;ft(n,t),e.clearTraversalCache()}var u=[];u.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(n);for(var c,d,h,p=0;p<n.length;p++){var f=n[p];if(f.isEdge())for(var g=f.source()[0],v=f.target()[0],y=(l(g,f),l(v,f),f.parallelEdges()),m=0;m<y.length;m++){var b=y[m];b.clearTraversalCache(),b.isBundledBezier()&&b.dirtyBoundingBoxCache()}else 0!==(g=f.parent()).length&&(v=g,void 0,c=(c=f)[0],d=(v=v[0])._private.children,h=v.id(),ft(d,c),c._private.parent=null,u.ids[h]||(u.ids[h]=!0,u.push(v)));t&&(f._private.removed=!0)}var x=i._private.elements;i._private.hasCompoundNodes=!1;for(var w=0;w<x.length;w++)if(x[w].isParent()){i._private.hasCompoundNodes=!0;break}var E=new Zl(this.cy(),n);0<E.size()&&(e?E.emitAndNotify("remove"):t&&E.emit("remove"));for(var k=0;k<u.length;k++){var T=u[k];t&&T.removed()||T.updateStyle()}return E},$l.move=function(e){function t(e){return null==e?e:""+e}var n,r,i,a,o,s=this._private.cy,l=this;return void 0!==e.source||void 0!==e.target?(n=t(e.source),r=t(e.target),i=null!=n&&s.hasElementWithId(n),a=null!=r&&s.hasElementWithId(r),(i||a)&&(s.batch((function(){l.remove(!1,!1),l.emitAndNotify("moveout");for(var e=0;e<l.length;e++){var t=l[e],o=t._private.data;t.isEdge()&&(i&&(o.source=n),a)&&(o.target=r)}l.restore(!1,!1)})),l.emitAndNotify("move"))):void 0===e.parent||null!==(e=t(e.parent))&&!s.hasElementWithId(e)||(o=null===e?void 0:e,s.batch((function(){var e=l.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<l.length;t++){var n=l[t],r=n._private.data;n.isNode()&&(r.parent=o)}e.restore(!1,!1)})),l.emitAndNotify("move")),this},[Pa,Ro,Io,bs,ws,Ss,Bs,al,xl,wl,kl,Cl,Bl,Ml,Fl,Yl].forEach((function(e){ve($l,e)})),{add:function(e){if($(e)){var t=e;if(t._private.cy===this)a=t.restore();else{for(var n=[],r=0;r<t.length;r++){var i=t[r];n.push(i.json())}a=new Zl(this,n)}}else if(H(e))var a=new Zl(this,e);else if(K(e)&&(H(e.nodes)||H(e.edges))){for(var o=e,s=[],l=["nodes","edges"],u=0,c=l.length;u<c;u++){var d=l[u],h=o[d];if(H(h))for(var p=0,f=h.length;p<f;p++){var g=ve({group:d},h[p]);s.push(g)}}a=new Zl(this,s)}else a=new kt(this,e).collection();return a},remove:function(e){var t;return $(e)||W(e)&&(t=e,e=this.$(t)),e.remove()}});function Jl(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||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=new(c?Float32Array:Array)(l);function p(e,t){return 1-3*t+3*e}function f(e,t,n){return((p(t,n)*e+(3*n-6*t))*e+3*t)*e}function g(e,t,n){return 3*p(t,n)*e*e+2*(3*n-6*t)*e+3*t}var v=!1;function y(c){return v||function(){if(v=!0,e!==t||n!==r)for(var i=0;i<l;++i)h[i]=f(i*u,e,n)}(),e===t&&n===r?c:0===c?0:1===c?1:f(function(t){for(var r=0,c=1,d=l-1;c!==d&&h[c]<=t;++c)r+=u;var p=r+(t-h[--c])/(h[c+1]-h[c])*u,v=g(p,e,n);if(a<=v){for(var y=t,m=p,b=0;b<i;++b){var x=g(m,e,n);if(0===x)return m;m-=(f(m,e,n)-y)/x}return m}if(0===v)return p;for(var w,E,k=t,T=r,C=r+u,P=0;0<(w=f(E=T+(C-T)/2,e,n)-k)?C=E:T=E,Math.abs(w)>o&&++P<s;);return E}(c),t,r)}y.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var m="generateBezier("+[e,t,n,r]+")";return y.toString=function(){return m},y}var eu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){return{dx:(r={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction}).v,dv:e(r)}}return function n(r,i,a){var o,s,l,u,c,d,h,p,f,g,v={x:-1,v:0,tension:null,friction:null},y=[0],m=0;for(r=parseFloat(r)||500,i=parseFloat(i)||20,a=a||null,v.tension=r,v.friction=i,s=(o=null!==a)?(m=n(r,i))/a*.016:.016;c=s,d=d=void 0,d={dx:(u=l||v).v,dv:e(u)},h=t(u,.5*c,d),p=t(u,.5*c,h),f=t(u,c,p),g=1/6*(d.dx+2*(h.dx+p.dx)+f.dx),d=1/6*(d.dv+2*(h.dv+p.dv)+f.dv),u.x=u.x+g*c,u.v=u.v+d*c,l=u,y.push(1+l.x),m+=16,1e-4<Math.abs(l.x)&&1e-4<Math.abs(l.v););return o?function(e){return y[e*(y.length-1)|0]}:m}}(),tu=function(e,t,n,r){var i=Jl(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},nu={linear:function(e,t,n){return e+(t-e)*n},ease:tu(.25,.1,.25,1),"ease-in":tu(.42,0,1,1),"ease-out":tu(0,0,.58,1),"ease-in-out":tu(.42,0,.58,1),"ease-in-sine":tu(.47,0,.745,.715),"ease-out-sine":tu(.39,.575,.565,1),"ease-in-out-sine":tu(.445,.05,.55,.95),"ease-in-quad":tu(.55,.085,.68,.53),"ease-out-quad":tu(.25,.46,.45,.94),"ease-in-out-quad":tu(.455,.03,.515,.955),"ease-in-cubic":tu(.55,.055,.675,.19),"ease-out-cubic":tu(.215,.61,.355,1),"ease-in-out-cubic":tu(.645,.045,.355,1),"ease-in-quart":tu(.895,.03,.685,.22),"ease-out-quart":tu(.165,.84,.44,1),"ease-in-out-quart":tu(.77,0,.175,1),"ease-in-quint":tu(.755,.05,.855,.06),"ease-out-quint":tu(.23,1,.32,1),"ease-in-out-quint":tu(.86,0,.07,1),"ease-in-expo":tu(.95,.05,.795,.035),"ease-out-expo":tu(.19,1,.22,1),"ease-in-out-expo":tu(1,0,0,1),"ease-in-circ":tu(.6,.04,.98,.335),"ease-out-circ":tu(.075,.82,.165,1),"ease-in-out-circ":tu(.785,.135,.15,.86),spring:function(e,t,n){var r;return 0===n?nu.linear:(r=eu(e,t,n),function(e,t,n){return e+(t-e)*r(n)})},"cubic-bezier":tu};function ru(e,t,n,r,i){return 1===r||t===n?n:(i=i(t,n,r),null!=e&&((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max)?Math.min(i,e.max):i)}function iu(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function au(e,t,n,r,i){var a=null!=i?i.type:null,o=(n<0?n=0:1<n&&(n=1),iu(e,i)),s=iu(t,i);if(G(o)&&G(s))return ru(a,o,s,n,r);if(H(o)&&H(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],d=s[u];null!=c&&null!=d?(c=ru(a,c,d,n,r),l.push(c)):l.push(d)}return l}}function ou(e,t,n,r){var i=!r,a=e._private,o=t._private,s=(t=o.easing,o.startTime),l=(r?e:e.cy()).style(),u=(o.easingImpl||(null==t?o.easingImpl=nu.linear:(t=W(t)?l.parse("transition-timing-function",t).value:t,0<(t=W(t)?(d=t,[]):(d=t[1],t.slice(2).map((function(e){return+e})))).length?("spring"===d&&t.push(o.duration),o.easingImpl=nu[d].apply(null,t)):o.easingImpl=nu[d])),o.easingImpl),c=0===o.duration?1:(n-s)/o.duration;if((c=o.applying?o.progress:c)<0?c=0:1<c&&(c=1),null==o.delay){t=o.startPosition,s=((d=o.position)&&i&&!e.locked()&&(n={},su(t.x,d.x)&&(n.x=au(t.x,d.x,c,u)),su(t.y,d.y)&&(n.y=au(t.y,d.y,c,u)),e.position(n)),o.startPan),t=o.pan;var d=a.pan,h=(d=((n=null!=t&&r)&&(su(s.x,t.x)&&(d.x=au(s.x,t.x,c,u)),su(s.y,t.y)&&(d.y=au(s.y,t.y,c,u)),e.emit("pan")),o.startZoom),(t=null!=(s=o.zoom)&&r)&&(su(d,s)&&(a.zoom=nn(a.minZoom,au(d,s,c,u),a.maxZoom)),e.emit("zoom")),(n||t)&&e.emit("viewport"),o.style);if(h&&0<h.length&&i){for(var p=0;p<h.length;p++){var f=(v=h[p]).name,g=o.startStyle[f],v=au(g,v,c,u,l.properties[g.name]);l.overrideBypass(e,f,v)}e.emit("style")}}return o.progress=c}function su(e,t){return!(null==e||null==t||!(G(e)&&G(t)||e&&t))}function lu(e,t,n,r){(t=t._private).started=!0,t.startTime=n-t.progress*t.duration}function uu(e,t){var n=t._private.aniEles,r=[];function i(t,n){function i(e){for(var t=e.length-1;0<=t;t--)(0,e[t])();e.splice(0,e.length)}for(var a,o=(s=t._private).animation.current,s=s.animation.queue,l=!1,u=(0===o.length&&(a=s.shift())&&o.push(a),o.length-1);0<=u;u--){var c=o[u],d=c._private;d.stopped?(o.splice(u,1),d.hooked=!1,d.playing=!1,d.started=!1,i(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||lu(0,c,e),ou(t,c,e,n),d.applying&&(d.applying=!1),i(d.frames),null!=d.step&&d.step(e),c.completed()&&(o.splice(u,1),d.hooked=!1,d.playing=!1,d.started=!1,i(d.completes)),l=!0)}return n||0!==o.length||0!==s.length||r.push(t),l}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(0<n.length?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var cu={animate:Mo.animate(),animation:Mo.animation(),animated:Mo.animated(),clearQueue:Mo.clearQueue(),delay:Mo.delay(),delayAnimation:Mo.delayAnimation(),stop:Mo.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e,t=this;t._private.animationsRunning=!0,t.styleEnabled()&&((e=t.renderer())&&e.beforeRender?e.beforeRender((function(e,n){uu(n,t)}),e.beforeRenderPriorities.animations):function e(){t._private.animationsRunning&&Ie((function(n){uu(n,t),e()}))}())}},du={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){return null==(t=t.qualifier)||e!==n.target&&Q(n.target)&&t.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},hu=function(e){return W(e)?new ys(e):e},pu={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new pl(du,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,hu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,hu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,hu(t),n),this},once:function(e,t,n){return this.emitter().one(e,hu(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}},fu=(Mo.eventAliasesOn(pu),{png:function(e){return this._private.renderer.png(e=e||{})},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}}),gu=(fu.jpeg=fu.jpg,{layout:function(e){if(null==e)ot("Layout options must be specified to make a layout");else if(null==e.name)ot("A `name` must be specified to make a layout");else{var t,n=e.name,r=this.extension("layout",n);if(null!=r)return t=W(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(ve({},e,{cy:this,eles:t}));ot("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}}}),vu=(gu.createLayout=gu.makeLayout=gu.layout,{notify:function(e,t){var n,r=this._private;this.batching()?(r.batchNotifications=r.batchNotifications||{},n=r.batchNotifications[e]=r.batchNotifications[e]||this.collection(),null!=t&&n.merge(t)):r.notificationsEnabled&&(n=this.renderer(),!this.destroyed())&&n&&n.notify(e,t)},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return 0<this._private.batchCount},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e,t=this._private;return 0!==t.batchCount&&(t.batchCount--,0===t.batchCount)&&(t.batchStyleEles.updateStyle(),e=this.renderer(),Object.keys(t.batchNotifications).forEach((function(n){var r=t.batchNotifications[n];r.empty()?e.notify(n):e.notify(n,r)}))),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 i=n[r],a=e[i];t.getElementById(i).data(a)}}))}}),yu=pt({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]}),mu={renderTo:function(e,t,n,r){return this._private.renderer.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.extension("renderer",e.name);null==t?ot("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?")):(void 0!==e.wheelSensitivity&<("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."),((e=yu(e)).cy=this)._private.renderer=new t(e),this.notify("init"))},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;0<e.childNodes.length;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){(e=e._private).rscratch={},e.rstyle={},e.animation.current=[],e.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}},bu=(mu.invalidateDimensions=mu.resize,{collection:function(e,t){return W(e)?this.$(e):$(e)?e.collection():H(e)?new Zl(this,e,(t=t||{}).unique,t.removed):new Zl(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.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}}),xu=(bu.elements=bu.filter=bu.$,{}),wu="t",Eu=(xu.apply=function(e){for(var t=this._private.cy.collection(),n=0;n<e.length;n++){var r,i=e[n],a=this.getContextMeta(i);a.empty||(r=this.getContextStyle(a),a=this.applyContextStyle(a,r,i),i._private.appliedInitStyle?this.updateTransitions(i,a.diffProps):i._private.appliedInitStyle=!0,this.updateStyleHints(i)&&t.push(i))}return t},xu.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],u=e[s]===wu,c=t[s]===wu,d=(u=u!=c,0<l.mappedProperties.length);if(u||c&&d){var h=void 0;u&&d||u?h=l.properties:d&&(h=l.mappedProperties);for(var p=0;p<h.length;p++){for(var f=h[p],g=f.name,v=!1,y=s+1;y<this.length;y++){var m=this[y];if(t[y]===wu&&(v=null!=m.properties[f.name]))break}o[g]||v||(o[g]=!0,a.push(g))}}}return n[r]=a},xu.getContextMeta=function(e){for(var t="",n=e._private.styleCxtKey||"",r=0;r<this.length;r++){var i=this[r];t+=i.selector&&i.selector.matches(e)?wu:"f"}return n=this.getPropertiesDiff(n,t),{key:e._private.styleCxtKey=t,diffPropNames:n,empty:0===n.length}},xu.getContextStyle=function(e){var t=e.key;if((e=this._private.contextStyles=this._private.contextStyles||{})[t])return e[t];for(var n={_private:{key:t}},r=0;r<this.length;r++){var i=this[r];if(t[r]===wu)for(var a=0;a<i.properties.length;a++){var o=i.properties[a];n[o.name]=o}}return e[t]=n},xu.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],u=n.pstyle(s);if(!l){if(!u)continue;l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0}}if(u!==l){if(l.mapped===a.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(n))===c.prevFnValue)continue}c=i[s]={prev:u},this.applyParsedProperty(n,l),c.next=n.pstyle(s),c.next&&c.next.bypass&&(c.next=c.next.bypassed)}}return{diffProps:i}},xu.updateStyleHints=function(e){function t(e,t,n){return r.getPropertiesHash(e,t,n)}var n=e._private,r=this,i=(r.propertyGroupNames,r.propertyGroupKeys),a=n.styleKey;if(e.removed())return!1;for(var o="nodes"===n.group,s=e._private.style,l=Object.keys(s),u=0;u<i.length;u++){var c=i[u];n.styleKeys[c]=[Le,ze]}function d(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);h(r,t),p(r,t)}}for(var h=function(e,t){return n.styleKeys[t][0]=Ve(e,n.styleKeys[t][0])},p=function(e,t){return n.styleKeys[t][1]=Fe(e,n.styleKeys[t][1])},f=0;f<l.length;f++){var g,v,y,m,b,x=l[f],w=s[x];null!=w&&(g=(x=this.properties[x]).type,v=x.groupKey,y=void 0,null!=x.hashOverride?y=x.hashOverride(e,w):null!=w.pfValue&&(y=w.pfValue),x=null==x.enums?w.value:null,m=null!=y,b=w.units,!g.number||!m&&null==x||g.multiple?d(w.strValue,v):(y=-128<(g=m?y:x)&&g<128&&Math.floor(g)!==g?2e9-(1024*g|0):g,h(y,x=v),p(y,x),m||null==b||d(b,v)))}for(var E=[Le,ze],k=0;k<i.length;k++){var T=i[k];T=n.styleKeys[T];E[0]=Ve(T[0],E[0]),E[1]=Fe(T[1],E[1])}n.styleKey=function(e,t){return 2097152*e+t}(E[0],E[1]);var C=n.styleKeys,P=(n.labelDimsKey=Xe(C.labelDimensions),t(e,["label"],C.labelDimensions));return n.labelKey=Xe(P),n.labelStyleKey=Xe(je(C.commonLabel,P)),o||(P=t(e,["source-label"],C.labelDimensions),n.sourceLabelKey=Xe(P),n.sourceLabelStyleKey=Xe(je(C.commonLabel,P)),P=t(e,["target-label"],C.labelDimensions),n.targetLabelKey=Xe(P),n.targetLabelStyleKey=Xe(je(C.commonLabel,P))),o&&(C=[(C=n.styleKeys).nodeBody,C.nodeBorder,C.nodeOutline,C.backgroundImage,C.compound,P=C.pie,o=C.stripe].filter((function(e){return null!=e})).reduce(je,[Le,ze]),n.nodeKey=Xe(C),n.hasPie=null!=P&&P[0]!==Le&&P[1]!==ze,n.hasStripe=null!=o&&o[0]!==Le&&o[1]!==ze),a!==n.styleKey},xu.clearStyleHints=function(e){(e=e._private).styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null},xu.applyParsedProperty=function(e,t){function n(){var t=p(u),n=p(i);r.checkTriggers(e,i.name,t,n)}var r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,d=e._private,h="mapping",p=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value};if((i="curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))?t=this.parse(t.name,"bezier",l):i).delete)a[i.name]=void 0;else{if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,n(),!0):(n(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,n(),!0):(n(),!0);function f(){lt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")}switch(i.mapped){case o.mapData:for(var g=i.field.split("."),v=d.data,y=0;y<g.length&&v;y++)v=v[g[y]];if(null==v)return f(),!1;if(!G(v))return lt("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+v+"` for `"+e.id()+"` is non-numeric)"),!1;var m=i.fieldMax-i.fieldMin;if((m=0==m?0:(v-i.fieldMin)/m)<0?m=0:1<m&&(m=1),s.color){var b=i.valueMin[0],x=i.valueMax[0],w=i.valueMin[1],E=i.valueMax[1],k=i.valueMin[2],T=i.valueMax[2],C=null==i.valueMin[3]?1:i.valueMin[3],P=null==i.valueMax[3]?1:i.valueMax[3];x=[Math.round(b+(x-b)*m),Math.round(w+(E-w)*m),Math.round(k+(T-k)*m),Math.round(C+(P-C)*m)],b={bypass:i.bypass,name:i.name,value:x,strValue:"rgb("+x[0]+", "+x[1]+", "+x[2]+")"}}else{if(!s.number)return!1;E=i.valueMin+(i.valueMax-i.valueMin)*m,b=this.parse(i.name,E,i.bypass,h)}if(!b)return f(),!1;b.mapping=i,i=b;break;case o.data:for(var S=i.field.split("."),B=d.data,D=0;D<S.length&&B;D++)B=B[S[D]];if(!(b=null!=B?this.parse(i.name,B,i.bypass,h):b))return f(),!1;b.mapping=i,i=b;break;case o.fn:if(w=i.value,T=null!=i.fnValue?i.fnValue:w(e),null==(i.prevFnValue=T))return lt("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(b=this.parse(i.name,T,i.bypass,h)))return lt("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;b.mapping=ut(i),i=b;break;case void 0:break;default:return!1}l?(i.bypassed=c?u.bypassed:u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i}return n(),!0},xu.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)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},xu.update=function(){this._private.cy.mutableElements().updateStyle()},xu.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(0<i.length&&0<a){for(var s={},l=!1,u=0;u<i.length;u++){var c,d,h=i[u],p=e.pstyle(h),f=t[h];f&&(c=f.prev,f=null!=f.next?f.next:p,p=!1,d=void 0,c)&&(G(c.pfValue)&&G(f.pfValue)?(p=f.pfValue-c.pfValue,d=c.pfValue+1e-6*p):G(c.value)&&G(f.value)?(p=f.value-c.value,d=c.value+1e-6*p):H(c.value)&&H(f.value)&&(p=c.value[0]!==f.value[0]||c.value[1]!==f.value[1]||c.value[2]!==f.value[2],d=c.strValue),p)&&(s[h]=f.strValue,this.applyBypass(e,h,d),l=!0)}l&&(r.transitioning=!0,new Ia((function(t){0<o?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},xu.checkTrigger=function(e,t,n,r,i,a){i=i(t=this.properties[t]),e.removed()||null!=i&&i(n,r,e)&&a(t)},xu.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},xu.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()}))},xu.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBoundsOfConnectedEdges}),(function(t){e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},xu.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBoundsOfParallelEdges}),(function(t){e.parallelEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},xu.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)},{}),ku=(Eu.applyBypass=function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name;(o=this.parse(o,n,!0))&&i.push(o)}}else if(W(t)){var s=this.parse(t,n,!0);s&&i.push(s)}else{if(!K(t))return!1;for(var l=t,u=(r=n,Object.keys(l)),c=0;c<u.length;c++){var d=u[c],h=l[d];void 0!==(h=void 0===h?l[oe(d)]:h)&&(d=this.parse(d,h,!0))&&i.push(d)}}if(0===i.length)return!1;for(var p=!1,f=0;f<e.length;f++){for(var g=e[f],v={},y=void 0,m=0;m<i.length;m++){var b,x=i[m];r&&(b=g.pstyle(x.name),y=v[x.name]={prev:b}),p=this.applyParsedProperty(g,ut(x))||p,r&&(y.next=g.pstyle(x.name))}p&&this.updateStyleHints(g),r&&this.updateTransitions(g,v,!0)}return p},Eu.overrideBypass=function(e,t,n){t=ae(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=(s=this.properties[t].type).color,s=s.mutiple,l=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=o?"rgb("+n.join(",")+")":s?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,l,n)}},Eu.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},Eu.removeBypasses=function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);u&&u.bypass&&(s=this.parse(s,"",!0),u=a[l.name]={prev:u},this.applyParsedProperty(i,s),u.next=i.pstyle(l.name))}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}},{}),Tu=(ku.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},ku.containerCss=function(e){var t,n=(t=this._private.cy).container();if((t=t.window())&&n&&t.getComputedStyle)return t.getComputedStyle(n).getPropertyValue(e)},{}),Cu=(Tu.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},Tu.getRawStyle=function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[oe(i.name)]=a)}return n}},Tu.getIndexedStyle=function(e,t,n,r){return null!=(r=e.pstyle(t)[n][r])?r:e.cy().style().getDefaultProperty(t)[n][0]},Tu.getStylePropertyValue=function(e,t,n){if(e=e[0]){var r=(t=(t=this.properties[t]).alias?t.pointsTo:t).type;if(t=e.pstyle(t.name)){var i,a,o,s=t.value,l=t.units;t=t.strValue;if(n&&r.number&&null!=s&&G(s))return i=e.cy().zoom(),a=function(e){return e*i},o=function(e,t){return a(e)+t},((n=H(s))?l.every((function(e){return null!=e})):null!=l)?n?s.map((function(e,t){return o(e,l[t])})).join(" "):o(s,l):n?s.map((function(e){return W(e)?e:""+a(e)})).join(" "):""+a(s);if(null!=t)return t}return null}},Tu.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);(a=void 0!==a?K(a)?this.parse(i,a.strValue):this.parse(i,a):a)&&(n[i]=a)}return n},Tu.getPropsList=function(e){var t=[],n=e,r=this.properties;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=n[s=i[a]],s=r[s]||r[ae(s)];(s=this.parse(s.name,o))&&t.push(s)}return t},Tu.getNonDefaultPropertiesHash=function(e,t,n){for(var r,i,a,o,s=n.slice(),l=0;l<t.length;l++)if(r=t[l],null!=(r=e.pstyle(r,!1)))if(null!=r.pfValue)s[0]=Ve(a,s[0]),s[1]=Fe(a,s[1]);else for(i=r.strValue,o=0;o<i.length;o++)a=i.charCodeAt(o),s[0]=Ve(a,s[0]),s[1]=Fe(a,s[1]);return s},Tu.getPropertiesHash=Tu.getNonDefaultPropertiesHash,{}),Pu=(Cu.appendFromJson=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},Cu.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},Cu.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e},{}),Su=(Pu.appendFromString=function(e){var t=""+e;function n(){t=t.length>a.length?t.substr(a.length):""}function r(){u=u.length>d.length?u.substr(d.length):""}for(t=t.replace(/[/][*](\s|.)+?[*][/]/g,"");!t.match(/^\s*$/);){var i=t.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!i){lt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+t);break}var a=i[0],o=i[1];if("core"!==o&&new ys(o).invalid)lt("Skipping parsing of block: Invalid selector found in string stylesheet: "+o),n();else{for(var s=i[2],l=!1,u=s,c=[];!u.match(/^\s*$/);){if(!(p=u.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/))){lt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+s),l=!0;break}var d=p[0],h=p[1],p=p[2];this.properties[h]?(this.parse(h,p)?c.push({name:h,val:p}):lt("Skipping property: Invalid property definition in: "+d),r()):(lt("Skipping property: Invalid property name in: "+d),r())}if(l){n();break}this.selector(o);for(var f=0;f<c.length;f++){var g=c[f];this.css(g.name,g.val)}n()}}return this},Pu.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this},{}),Bu=(function(){function e(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"}function t(e){var t=r+"|\\w+|"+i+"|"+a+"|"+o+"|"+s;return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"}function n(e,t){return"label"===t.value?-e.poolIndex():t.pfValue}var r=ce,i=he,a=fe,o="\\#[0-9a-fA-F]{3}",s="\\#[0-9a-fA-F]{6}",l=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"],u=(l=(Su.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:e("data")},layoutData:{mapping:!0,regex:e("layoutData")},scratch:{mapping:!0,regex:e("scratch")},mapData:{mapping:!0,regex:t("mapData")},mapLayoutData:{mapping:!0,regex:t("mapLayoutData")},mapScratch:{mapping:!0,regex:t("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:l,singleRegexMatchValue:!0},urls:{regexes:l,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(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return W(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\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(e){return 1===(e=e.length)||2===e||4===e}}},{zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){return e=ne(e),t=ne(t),e&&!t||!e&&t}}),Su.types),c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],d=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],p=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],f=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification},{name:"box-select-labels",type:u.bool,triggersBounds:l.any}],g=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any},{name:"box-selection",type:u.boxSelection,triggersZOrder:l.any}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(e,t,n){return e!==t&&"bezier"===n.pstyle("curve-style").value}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],y=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],x=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:n},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:n},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],w=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],E=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],k=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],T=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],C=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(e,t){return e!==t&&("bezier"===e||"bezier"===t)}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],P=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],S=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],B=[];Su.pieBackgroundN=16,B.push({name:"pie-size",type:u.sizeMaybePercent}),B.push({name:"pie-hole",type:u.sizeMaybePercent}),B.push({name:"pie-start-angle",type:u.angle});for(var D=1;D<=Su.pieBackgroundN;D++)B.push({name:"pie-"+D+"-background-color",type:u.color}),B.push({name:"pie-"+D+"-background-size",type:u.percent}),B.push({name:"pie-"+D+"-background-opacity",type:u.zeroOneNumber});var _=[];Su.stripeBackgroundN=16,_.push({name:"stripe-size",type:u.sizeMaybePercent}),_.push({name:"stripe-direction",type:u.axisDirectionPrimary});for(var A=1;A<=Su.stripeBackgroundN;A++)_.push({name:"stripe-"+A+"-background-color",type:u.color}),_.push({name:"stripe-"+A+"-background-size",type:u.percent}),_.push({name:"stripe-"+A+"-background-opacity",type:u.zeroOneNumber});var M=[],R=Su.arrowPrefixes=["source","mid-source","target","mid-target"],I=([{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach((function(e){R.forEach((function(t){t=t+"-"+e.name;var n=e.type,r=e.triggersBounds;M.push({name:t,type:n,triggersBounds:r})}))}),{}),Su.properties=[].concat(g,b,v,y,m,P,f,p,c,d,h,x,w,E,k,B,_,T,C,M,S)),N=Su.propertyGroups={behavior:g,transition:b,visibility:v,overlay:y,underlay:m,ghost:P,commonLabel:f,labelDimensions:p,mainLabel:c,sourceLabel:d,targetLabel:h,nodeBody:x,nodeBorder:w,nodeOutline:E,backgroundImage:k,pie:B,stripe:_,compound:T,edgeLine:C,edgeArrow:M,core:S},L=Su.propertyGroupNames={},z=((Su.propertyGroupKeys=Object.keys(N)).forEach((function(e){L[e]=N[e].map((function(e){return e.name})),N[e].forEach((function(t){return t.groupKey=e}))})),Su.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"}]);Su.propertyNames=I.map((function(e){return e.name}));for(var O=0;O<I.length;O++){var V=I[O];I[V.name]=V}for(var F=0;F<z.length;F++){var X=z[F],j=I[X.pointsTo];j={name:X.name,alias:!0,pointsTo:j};I.push(j),I[X.name]=j}}(),Su.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Su.getDefaultProperties=function(){var e=this._private;if(null==e.defaultProperties){for(var t=ve({"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(e,t){for(var n=1;n<=Su.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e}),{}),{"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(e,t){for(var n=1;n<=Su.stripeBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e}),{}),{"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(e,t){return Su.arrowPrefixes.forEach((function(n){n=n+"-"+t.name;var r=t.value;e[n]=r})),e}),{})),n={},r=0;r<this.properties.length;r++){var i,a=this.properties[r];a.pointsTo||(i=t[a=a.name],i=this.parse(a,i),n[a]=i)}e.defaultProperties=n}return e.defaultProperties},Su.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},{}),Du=(Bu.parse=function(e,t,n,r){var i,a,o;return U(t)?this.parseImplWarn(e,t,n,r):(i=We(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=(o=(a=this.propCache=this.propCache||[])[i])||(a[i]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(o=ut(o))&&(o.value=ut(o.value)),o)},Bu.parseImplWarn=function(e,t,n,r){return(n=this.parseImpl(e,t,n,r))||null==t||lt("The style property `".concat(e,": ").concat(t,"` is invalid")),!n||"width"!==n.name&&"height"!==n.name||"label"!==t||lt("The style value of `label` is deprecated for `"+n.name+"`"),n},Bu.parseImpl=function(e,t,n,r){e=ae(e);var i=this.properties[e],a=t,o=this.types;if(!i)return null;if(void 0===t)return null;i.alias&&(i=i.pointsTo,e=i.name);var s,l,u=W(t),c=(u&&(t=t.trim()),i.type);if(!c)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(U(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!(!u||r||t.length<7||"a"!==t[1])){if(7<=t.length&&"d"===t[0]&&(i=new RegExp(o.data.regex).exec(t)))return!n&&(l=o.data,{name:e,value:i,strValue:""+t,mapped:l,field:i[1],bypass:n});if(10<=t.length&&"m"===t[0]&&(l=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;if(i=o.mapData,!c.color&&!c.number)return!1;if(!(o=this.parse(e,l[4]))||o.mapped)return!1;var d=this.parse(e,l[5]);if(!d||d.mapped)return!1;if(o.pfValue===d.pfValue||o.strValue===d.strValue)return lt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+o.strValue+"`"),this.parse(e,o.strValue);if(c.color){var h=o.value,p=d.value;if(!(h[0]!==p[0]||h[1]!==p[1]||h[2]!==p[2]||h[3]!==p[3]&&(null!=h[3]&&1!==h[3]||null!=p[3]&&1!==p[3])))return!1}return{name:e,value:l,strValue:""+t,mapped:i,field:l[1],fieldMin:parseFloat(l[2]),fieldMax:parseFloat(l[3]),valueMin:o.value,valueMax:d.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var f=u?t.split(/\s+/):H(t)?t:[t];if(c.evenMultiple&&f.length%2!=0)return null;for(var g=[],v=[],y=[],m="",b=!1,x=0;x<f.length;x++){var w=this.parse(e,f[x],n,"multiple");b=b||W(w.value);g.push(w.value),y.push(null!=w.pfValue?w.pfValue:w.value),v.push(w.units),m+=(0<x?" ":"")+w.strValue}return c.validate&&!c.validate(g,v)?null:c.singleEnum&&b?1===g.length&&W(g[0])?{name:e,value:g[0],strValue:g[0],bypass:n}:null:{name:e,value:g,pfValue:y,strValue:m,bypass:n,units:v}}function E(){for(var r=0;r<c.enums.length;r++)if(c.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null}if(c.number)return h="px",c.units&&(s=c.units),c.implicitUnits&&(h=c.implicitUnits),c.unitless||(u?(p="px|em"+(c.allowPercent?"|\\%":""),s&&(p=s),(i=t.match("^("+ce+")("+p+")?$"))&&(t=i[1],s=i[2]||h)):s&&!c.implicitUnits||(s=h)),t=parseFloat(t),isNaN(t)&&void 0===c.enums?null:isNaN(t)&&void 0!==c.enums?(t=a,E()):c.integer&&!function(e){return G(e)&&Math.floor(e)===e}(t)||void 0!==c.min&&(t<c.min||c.strictMin&&t===c.min)||void 0!==c.max&&(t>c.max||c.strictMax&&t===c.max)?null:(l={name:e,value:t,strValue:""+t+(s||""),units:s,bypass:n},c.unitless||"px"!==s&&"em"!==s?l.pfValue=t:l.pfValue="px"!==s&&s?this.getEmSizeInPixels()*t:t,"ms"!==s&&"s"!==s||(l.pfValue="ms"===s?t:1e3*t),"deg"!==s&&"rad"!==s||(l.pfValue="rad"===s?t:function(e){return Math.PI*e/180}(t)),"%"===s&&(l.pfValue=t/100),l);if(c.propList){var k=[];if("none"!==(o=""+t)){for(var T=o.split(/\s*,\s*|\s+/),C=0;C<T.length;C++){var P=T[C].trim();this.properties[P]?k.push(P):lt("`"+P+"` is not a valid property name")}if(0===k.length)return null}return{name:e,value:k,strValue:0===k.length?"none":k.join(" "),bypass:n}}if(c.color)return(d=ye(t))?{name:e,value:d,pfValue:d,strValue:"rgb("+d[0]+","+d[1]+","+d[2]+")",bypass:n}:null;if(c.regex||c.regexes){if(c.enums&&(r=E()))return r;for(var S=c.regexes||[c.regex],B=0;B<S.length;B++){var D=new RegExp(S[B]).exec(t);if(D)return{name:e,value:c.singleRegexMatchValue?D[1]:D,strValue:""+t,bypass:n}}return null}return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?E():null},function(e){if(!(this instanceof Du))return new Du(e);ee(e)?(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):ot("A style must have a core reference")}),_u=Du.prototype,Au=(_u.instanceString=function(){return"style"},_u.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach((function(e){(e=e[0]._private).styleDirty=!0,e.appliedInitStyle=!1})),this},_u.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},_u.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},_u.selector=function(e){e="core"===e?null:new ys(e);var t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this},_u.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],i=t[r.name];void 0!==(i=void 0===i?t[oe(r.name)]:i)&&this.cssRule(r.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},_u.style=_u.css,_u.cssRule=function(e,t){return(e=this.parse(e,t))&&(this[t=this.length-1].properties.push(e),(this[t].properties[e.name]=e).name.match(/pie-(\d+)-background-size/)&&e.value&&(this._private.hasPie=!0),e.name.match(/stripe-(\d+)-background-size/)&&e.value&&(this._private.hasStripe=!0),e.mapped&&this[t].mappedProperties.push(e),!this[t].selector)&&(this._private.coreStyle[e.name]=e),this},_u.append=function(e){return te(e)?e.appendToStyle(this):H(e)?this.appendFromJson(e):W(e)&&this.appendFromString(e),this},Du.fromJson=function(e,t){return(e=new Du(e)).fromJson(t),e},Du.fromString=function(e,t){return new Du(e).fromString(t)},[xu,Eu,ku,Tu,Cu,Pu,Su,Bu].forEach((function(e){ve(_u,e)})),Du.types=_u.types,Du.properties=_u.properties,Du.propertyGroups=_u.propertyGroups,Du.propertyGroupNames=_u.propertyGroupNames,Du.propertyGroupKeys=_u.propertyGroupKeys,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return te(e)?t.style=e.generateStyle(this):H(e)?t.style=Du.fromJson(this,e):W(e)?t.style=Du.fromString(this,e):t.style=Du(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}}),Mu={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r=arguments,i=this._private.pan;switch(r.length){case 0:return i;case 1:if(W(r[0]))return i[e=r[0]];if(K(r[0])){if(!this._private.panningEnabled)return this;t=(n=r[0]).x,n=n.y,G(t)&&(i.x=t),G(n)&&(i.y=n),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;t=r[1],"x"!==(e=r[0])&&"y"!==e||!G(t)||(i[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i=arguments,a=this._private.pan;if(this._private.panningEnabled){switch(i.length){case 1:K(e)&&(n=(r=i[0]).x,r=r.y,G(n)&&(a.x+=n),G(r)&&(a.y+=r),this.emit("pan viewport"));break;case 2:n=t,"x"!==(r=e)&&"y"!==r||!G(n)||(a[r]+=n),this.emit("pan viewport")}this.notify("viewport")}return this},gc:function(){this.notify("gc")},fit:function(e,t){return(e=this.getFitViewport(e,t))&&((t=this._private).zoom=e.zoom,t.pan=e.pan,this.emit("pan zoom viewport"),this.notify("viewport")),this},getFitViewport:function(e,t){var n,r;if(G(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled&&(W(e)?(r=e,e=this.$(r)):function(e){return K(e)&&G(e.x1)&&G(e.x2)&&G(e.y1)&&G(e.y2)}(e)?((n={x1:(r=e).x1,y1:r.y1,x2:r.x2,y2:r.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1):$(e)||(e=this.mutableElements()),!$(e)||!e.empty()))return n=n||e.boundingBox(),r=this.width(),e=this.height(),t=G(t)?t:0,!isNaN(r)&&!isNaN(e)&&0<r&&0<e&&!isNaN(n.w)&&!isNaN(n.h)&&0<n.w&&0<n.h?{zoom:t=(t=(t=Math.min((r-2*t)/n.w,(e-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:t)<this._private.minZoom?this._private.minZoom:t,pan:{x:(r-t*(n.x1+n.x2))/2,y:(e-t*(n.y1+n.y2))/2}}:void 0},zoomRange:function(e,t){var n,r=this._private;return null==t&&(e=(n=e).min,t=n.max),G(e)&&G(t)&&e<=t?(r.minZoom=e,r.maxZoom=t):G(e)&&void 0===t&&e<=r.maxZoom?r.minZoom=e:G(t)&&void 0===e&&t>=r.minZoom&&(r.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;return r.zoomingEnabled||(o=!0),G(e)?n=e:K(e)&&(n=e.level,null!=e.position?t=Wt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,!o&&G(n)&&n!==a&&(null==t||G(t.x)&&G(t.y))?null!=t?{zoomed:!0,panned:!0,zoom:e=n,pan:{x:-e/a*(t.x-i.x)+t.x,y:-e/a*(t.y-i.y)+t.y}}:{zoomed:!0,panned:!1,zoom:n,pan:i}:null},zoom:function(e){var t;return void 0===e?this._private.zoom:(e=this.getZoomedViewport(e),t=this._private,null!=e&&e.zoomed&&(t.zoom=e.zoom,e.panned&&(t.pan.x=e.pan.x,t.pan.y=e.pan.y),this.emit("zoom"+(e.panned?" pan":"")+" viewport"),this.notify("viewport")),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;return e&&(G(e.zoom)||(n=!1),K(e.pan)||(r=!1),n||r)&&(n&&((n=e.zoom)<t.minZoom||n>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=n,i.push("zoom"))),!r||a&&e.cancelOnFailedZoom||!t.panningEnabled||(n=e.pan,G(n.x)&&(t.pan.x=n.x,o=!1),G(n.y)&&(t.pan.y=n.y,o=!1),o)||i.push("pan"),0<i.length)&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){return(e=this.getCenterPan(e))&&(this._private.pan=e,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){var n,r;if(this._private.panningEnabled&&(W(e)?(n=e,e=this.mutableElements().filter(n)):$(e)||(e=this.mutableElements()),0!==e.length))return n=e.boundingBox(),e=this.width(),r=this.height(),{x:(e-(t=void 0===t?this._private.zoom:t)*(n.x1+n.x2))/2,y:(r-t*(n.y1+n.y2))/2}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t=this._private,n=t.container;return t.sizeCache=t.sizeCache||(n?(e=this.window().getComputedStyle(n),{width:n.clientWidth-r("padding-left")-r("padding-right"),height:n.clientHeight-r("padding-top")-r("padding-bottom")}):{width:1,height:1});function r(t){return parseFloat(e.getPropertyValue(t))}},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e,t=this._private.pan,n=this._private.zoom;return(e={x1:((e=this.renderedExtent()).x1-t.x)/n,x2:(e.x2-t.x)/n,y1:(e.y1-t.y)/n,y2:(e.y2-t.y)/n}).w=e.x2-e.x1,e.h=e.y2-e.y1,e},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){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}},Ru=(Mu.centre=Mu.center,Mu.autolockNodes=Mu.autolock,Mu.autoungrabifyNodes=Mu.autoungrabify,{data:Mo.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Mo.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Mo.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Mo.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})}),Iu=(Ru.attr=Ru.data,Ru.removeAttr=Ru.removeData,function(e){function t(e,t,n){return void 0!==t?t:void 0!==n?n:e}var n,r=this,i=(n=(n=(e=ve({},e)).container)&&!Z(n)&&Z(n[0])?n[0]:n)?n._cyreg:null,a=((i=i||{})&&i.cy&&(i.cy.destroy(),i={}),i.readies=i.readies||[]),o=(n&&(n._cyreg=i),i.cy=r,void 0!==O&&void 0!==n&&!e.headless),s=e,l=(s.layout=ve({name:o?"grid":"null"},s.layout),s.renderer=ve({name:o?"canvas":"null"},s.renderer),this._private={container:n,ready:!1,options:s,elements:new Zl(this),listeners:[],aniEles:new Zl(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:t(!0,s.zoomingEnabled),userZoomingEnabled:t(!0,s.userZoomingEnabled),panningEnabled:t(!0,s.panningEnabled),userPanningEnabled:t(!0,s.userPanningEnabled),boxSelectionEnabled:t(!0,s.boxSelectionEnabled),autolock:t(!1,s.autolock,s.autolockNodes),autoungrabify:t(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:t(!1,s.autounselectify),styleEnabled:void 0===s.styleEnabled?o:s.styleEnabled,zoom:G(s.zoom)?s.zoom:1,pan:{x:K(s.pan)&&G(s.pan.x)?s.pan.x:0,y:K(s.pan)&&G(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:t(250,s.multiClickDebounceTime)});this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom}),l.styleEnabled&&r.setStyle([]),e=ve({},s,s.renderer),o=function(e){var t,n,o=e[0];e=e[1];l.styleEnabled&&r.style().append(o),o=e,t=function(){r.startAnimationLoop(),l.ready=!0,U(s.ready)&&r.on("ready",s.ready);for(var e=0;e<a.length;e++){var t=a[e];r.on("ready",t)}i&&(i.readies=[]),r.emit("ready")},n=s.done,r.notifications(!1),0<(e=r.mutableElements()).length&&e.remove(),null!=o&&(K(o)||H(o))&&r.add(o),r.one("layoutready",(function(e){r.notifications(!0),r.emit(e),r.one("load",t),r.emitAndNotify("load")})).one("layoutstop",(function(){r.one("done",n),r.emit("done")})),(e=ve({},r._private.options.layout)).eles=r.elements(),r.layout(e).run()};(n=(r.initRenderer(e),[s.style,s.elements])).some(re)?Ia.all(n).then(o):o(n)}),Nu=Iu.prototype,Lu=(ve(Nu,{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(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},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;return null!=this._private.container&&void 0!==(e=this._private.container.ownerDocument)&&null!=e&&e.defaultView||O},mount:function(e){var t,n;if(null!=e)return n=(t=this._private).options,!Z(e)&&Z(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(ve({},n,n.renderer,{name:"null"===n.renderer.name?"canvas":n.renderer.name})),this.startAnimationLoop(),this.style(n.style),this.emit("mount"),this},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return ut(this._private.options)},json:function(e){var t,n=this,r=n._private,i=n.mutableElements();if(K(e)){if(n.startBatch(),e.elements){function a(e,t){for(var r=[],i=[],a=0;a<e.length;a++){var s,l,u=e[a];u.data.id?(s=""+u.data.id,l=n.getElementById(s),o[s]=!0,0!==l.length?i.push({ele:l,json:u}):(t&&(u.group=t),r.push(u))):lt("cy.json() cannot handle elements without an ID attribute")}n.add(r);for(var c=0;c<i.length;c++){var d=(h=i[c]).ele,h=h.json;d.json(h)}}var o={};if(H(e.elements))a(e.elements);else for(var s=["nodes","edges"],l=0;l<s.length;l++){var u=s[l],c=e.elements[u];H(c)&&a(c,u)}var d=n.collection();i.filter((function(e){return!o[e.id()]})).forEach((function(e){e.isParent()?d.merge(e):e.remove()})),d.forEach((function(e){return e.children().move({parent:null})})),d.forEach((function(e){return n.getElementById(e.id()).remove()}))}e.style&&n.style(e.style),null!=e.zoom&&e.zoom!==r.zoom&&n.zoom(e.zoom),!e.pan||e.pan.x===r.pan.x&&e.pan.y===r.pan.y||n.pan(e.pan),e.data&&n.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<h.length;p++){var f=h[p];null!=e[f]&&n[f](e[f])}return n.endBatch(),this}return t={},e?t.elements=this.elements().map((function(e){return e.json()})):(t.elements={},i.forEach((function(e){var n=e.group();t.elements[n]||(t.elements[n]=[]),t.elements[n].push(e.json())}))),this._private.styleEnabled&&(t.style=n.style().json()),t.data=ut(n.data()),i=r.options,t.zoomingEnabled=r.zoomingEnabled,t.userZoomingEnabled=r.userZoomingEnabled,t.zoom=r.zoom,t.minZoom=r.minZoom,t.maxZoom=r.maxZoom,t.panningEnabled=r.panningEnabled,t.userPanningEnabled=r.userPanningEnabled,t.pan=ut(r.pan),t.boxSelectionEnabled=r.boxSelectionEnabled,t.renderer=ut(i.renderer),t.hideEdgesOnViewport=i.hideEdgesOnViewport,t.textureOnViewport=i.textureOnViewport,t.wheelSensitivity=i.wheelSensitivity,t.motionBlur=i.motionBlur,t.multiClickDebounceTime=i.multiClickDebounceTime,t}}),Nu.$id=Nu.getElementById,[Ql,cu,pu,fu,gu,vu,mu,bu,Au,Mu,Ru].forEach((function(e){ve(Nu,e)})),{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}}),zu={maximal:!1,acyclic:!1},Ou=function(e){return e.scratch("breadthfirst")},Vu=function(e,t){return e.scratch("breadthfirst",t)};function Fu(e){this.options=ve({},Lu,zu,e)}var Xu={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!(Fu.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter((function(e){return e.isChildless()})),i=n,a=e.directed,o=e.acyclic||e.maximal||0<e.maximalAdjustments,s=!!e.boundingBox,l=rn(s?e.boundingBox:structuredClone(t.extent()));if($(e.roots))p=e.roots;else if(H(e.roots)){for(var u=[],c=0;c<e.roots.length;c++){var d=e.roots[c];d=t.getElementById(d);u.push(d)}p=t.collection(u)}else if(W(e.roots))p=t.$(e.roots);else if(a)p=r.roots();else for(var h=n.components(),p=t.collection(),f=0;f<h.length;f++)!function(){var e=(t=h[f]).maxDegree(!1),t=t.filter((function(t){return t.degree(!1)===e}));p=p.add(t)}();for(var g=[],v={},y=function(e,t){null==g[t]&&(g[t]=[]);var n=g[t].length;g[t].push(e),Vu(e,{index:n,depth:t})},m=function(e,t){var n=(r=Ou(e)).depth,r=r.index;g[n][r]=null,e.isChildless()&&y(e,t)},b=(i.bfs({roots:p,directed:e.directed,visit:function(e,t,n,r,i){var a=(e=e[0]).id();e.isChildless()&&y(e,i),v[a]=!0}}),[]),x=0;x<r.length;x++){var w=r[x];v[w.id()]||b.push(w)}var E=function(e){for(var t=g[e],n=0;n<t.length;n++){var r=t[n];null==r?(t.splice(n,1),n--):Vu(r,{depth:e,index:n})}};if(a&&o){function k(e){return T.push(e)}var T=[],C={};for(r.forEach((function(e){return T.push(e)}));0<T.length;){var P=T.shift(),S=function(t,r){for(var i=Ou(t),a=t.incomers().filter((function(e){return e.isNode()&&n.has(e)})),o=-1,s=t.id(),l=0;l<a.length;l++){var u=a[l];u=Ou(u),o=Math.max(o,u.depth)}return i.depth<=o&&(!e.acyclic&&r[s]?null:(m(t,i=o+1),r[s]=i,!0))}(P,C);if(S)P.outgoers().filter((function(e){return e.isNode()&&n.has(e)})).forEach(k);else if(null===S){lt("Detected double maximal shift for node `"+P.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var B=0;if(e.avoidOverlap)for(var D=0;D<r.length;D++){var _=(A=r[D].layoutDimensions(e)).w,A=A.h;B=Math.max(B,_,A)}for(var M={},R=function(e){if(M[e.id()])return M[e.id()];for(var t=Ou(e).depth,n=e.neighborhood(),i=0,a=0,o=0;o<n.length;o++){var s,l,u=n[o];u.isEdge()||u.isParent()||!r.has(u)||null!=(u=Ou(u))&&(s=u.index,u=u.depth,null!=s)&&null!=u&&(l=g[u].length,u<t)&&(i+=s/l,a++)}return i/=a=Math.max(1,a),0===a&&(i=0),M[e.id()]=i},I=function(e,t){var n=R(e)-R(t);return 0==n?ge(e.id(),t.id()):n},N=(void 0!==e.depthSort&&(I=e.depthSort),g.length),L=0;L<N;L++)g[L].sort(I),E(L);for(var z=[],O=0;O<b.length;O++)z.push(b[O]);if(z.length){g.unshift(z);N=g.length;for(var V=0;V<N;V++)E(V)}for(var F=0,X=0;X<N;X++)F=Math.max(g[X].length,F);var j=l.x1+l.w/2,Y=l.y1+l.h/2,q=r.reduce((function(t,n){return n=n.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}),{w:-1===t.w?n.w:(t.w+n.w)/2,h:-1===t.h?n.h:(t.h+n.h)/2}}),{w:-1,h:-1}),U=Math.max(1===N?0:s?(l.h-2*e.padding-q.h)/(N-1):(l.h-2*e.padding-q.h)/(N+1),B),K=g.reduce((function(e,t){return Math.max(e,t.length)}),0),G={downward:0,leftward:90,upward:180,rightward:-90};return-1===Object.keys(G).indexOf(e.direction)&&ot("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(G).join(", "))),n.nodes().layoutPositions(this,e,(function(t){return Ke(function(t){var n,r,i=(t=Ou(t)).depth;return t=t.index,e.circle?(n=Math.min(l.w/2/N,l.h/2/N),n=(n=Math.max(n,B))*i+n-(0<N&&g[0].length<=3?n/2:0),r=2*Math.PI/g[i].length*t,0===i&&1===g[0].length&&(n=1),{x:j+n*Math.cos(r),y:Y+n*Math.sin(r)}):(n=g[i].length,r=Math.max(1===n?0:s?(l.w-2*e.padding-q.w)/((e.grid?K:n)-1):(l.w-2*e.padding-q.w)/((e.grid?K:n)+1),B),{x:j+(t+1-(n+1)/2)*r,y:Y+(i+1-(N+1)/2)*U})}(t),l,G[e.direction])})),this}),spacingFactor:void 0,radius:void 0,startAngle:1.5*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 ju(e){this.options=ve({},Xu,e)}ju.prototype.run=function(){for(var e,t,n=r=this.options,r=r.cy,i=n.eles,a=void 0!==n.counterclockwise?!n.counterclockwise:n.clockwise,o=i.nodes().not(":parent"),s={x:(r=(n.sort&&(o=o.sort(n.sort)),rn(n.boundingBox||{x1:0,y1:0,w:r.width(),h:r.height()}))).x1+r.w/2,y:r.y1+r.h/2},l=(void 0===n.sweep?2*Math.PI-2*Math.PI/o.length:n.sweep)/Math.max(1,o.length-1),u=0,c=0;c<o.length;c++){var d=(h=o[c].layoutDimensions(n)).w,h=h.h;u=Math.max(u,d,h)}return t=G(n.radius)?n.radius:o.length<=1?0:Math.min(r.h,r.w)/2-u,1<o.length&&n.avoidOverlap&&(u*=1.75,r=Math.cos(l)-Math.cos(0),e=Math.sin(l)-Math.sin(0),r=Math.sqrt(u*u/(r*r+e*e)),t=Math.max(r,t)),i.nodes().layoutPositions(this,n,(function(e,r){r=n.startAngle+r*l*(a?1:-1);var i=t*Math.cos(r);r=t*Math.sin(r);return{x:s.x+i,y:s.y+r}})),this};var Yu,qu={fit:!0,padding:30,startAngle:1.5*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 Wu(e){this.options=ve({},qu,e)}var Uu={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:!(Wu.prototype.run=function(){for(var e=n=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=n.cy,r=e.eles,i=r.nodes().not(":parent"),a=(n=rn(e.boundingBox||{x1:0,y1:0,w:n.width(),h:n.height()})).x1+n.w/2,o=n.y1+n.h/2,s=[],l=0,u=0;u<i.length;u++){var c=i[u],d=e.concentric(c);s.push({value:d,node:c}),c._private.scratch.concentric=d}i.updateStyle();for(var h=0;h<i.length;h++){var p=i[h].layoutDimensions(e);l=Math.max(l,p.w,p.h)}s.sort((function(e,t){return t.value-e.value}));for(var f=e.levelWidth(i),g=[[]],v=g[0],y=0;y<s.length;y++){var m=s[y];0<v.length&&f<=Math.abs(v[0].value-m.value)&&g.push(v=[]),v.push(m)}for(var b,x=l+e.minNodeSpacing,w=(e.avoidOverlap||(b=0<g.length&&1<g[0].length,n=Math.min(n.w,n.h)/2-x,x=Math.min(x,n/(g.length+b?1:0))),0),E=0;E<g.length;E++){var k,T=g[E],C=void 0===e.sweep?2*Math.PI-2*Math.PI/T.length:e.sweep;C=T.dTheta=C/Math.max(1,T.length-1);1<T.length&&e.avoidOverlap&&(k=Math.cos(C)-Math.cos(0),C=Math.sin(C)-Math.sin(0),k=Math.sqrt(x*x/(k*k+C*C)),w=Math.max(k,w)),T.r=w,w+=x}if(e.equidistant){for(var P=0,S=0,B=0;B<g.length;B++){var D=g[B].r-S;P=Math.max(P,D)}S=0;for(var _=0;_<g.length;_++){var A=g[_];0===_&&(S=A.r),A.r=S,S+=P}}for(var M={},R=0;R<g.length;R++)for(var I=g[R],N=I.dTheta,L=I.r,z=0;z<I.length;z++){var O=I[z],V=e.startAngle+(t?1:-1)*N*z;V={x:a+L*Math.cos(V),y:o+L*Math.sin(V)};M[O.node.id()]=V}return r.nodes().layoutPositions(this,e,(function(e){return e=e.id(),M[e]})),this}),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 Hu(e){this.options=ve({},Uu,e);var t=(this.options.layout=this).options.eles.nodes();e=this.options.eles.edges().filter((function(e){var n=e.source().data("id"),r=e.target().data("id"),i=(e=t.some((function(e){return e.data("id")===n})),t.some((function(e){return e.data("id")===r})));return!e||!i}));this.options.eles=this.options.eles.not(e)}Hu.prototype.run=function(){var e=this.options,t=e.cy,n=this,r=(!(n.stopped=!1)!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),Yu=!0===e.debug,Ku(t,n,e)),i=(Yu&&undefined(r),e.randomize&&$u(r),Ne()),a=function(){Ju(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(ec(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},s=function(){var t,i;!0===e.animate||!1===e.animate?(a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n})):(t=e.eles.nodes(),i=Qu(r,e,t),t.layoutPositions(n,e,i))},l=0,u=!0;if(!0===e.animate){var c=function(){for(var t=0;u&&t<e.refresh;)u=o(l),l++,t++;u?(Ne()-i>=e.animationThreshold&&a(),Ie(c)):(hc(r,e),s())};c()}else{for(;u;)u=o(l),l++;hc(r,e),s()}return this},Hu.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Hu.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Ku=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=rn(n.boundingBox||{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],d=0;d<c.length;d++)l[c[d].id()]=u;for(u=0;u<o.nodeSize;u++){var h=(y=i[u]).layoutDimensions(n);(A={}).isLocked=y.locked(),A.id=y.data("id"),A.parentId=y.data("parent"),A.cmptId=l[y.id()],A.children=[],A.positionX=y.position("x"),A.positionY=y.position("y"),A.offsetX=0,A.offsetY=0,A.height=h.w,A.width=h.h,A.maxX=A.positionX+A.width/2,A.minX=A.positionX-A.width/2,A.maxY=A.positionY+A.height/2,A.minY=A.positionY-A.height/2,A.padLeft=parseFloat(y.style("padding")),A.padRight=parseFloat(y.style("padding")),A.padTop=parseFloat(y.style("padding")),A.padBottom=parseFloat(y.style("padding")),A.nodeRepulsion=U(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,o.layoutNodes.push(A),o.idToIndex[A.id]=u}var p=[],f=0,g=-1,v=[];for(u=0;u<o.nodeSize;u++){var y,m=(y=o.layoutNodes[u]).parentId;(null!=m?o.layoutNodes[o.idToIndex[m]].children:(p[++g]=y.id,v)).push(y.id)}for(o.graphSet.push(v);f<=g;){var b=p[f++],x=(b=o.idToIndex[b],o.layoutNodes[b].children);if(0<x.length)for(o.graphSet.push(x),u=0;u<x.length;u++)p[++g]=x[u]}for(u=0;u<o.graphSet.length;u++){var w=o.graphSet[u];for(d=0;d<w.length;d++){var E=o.idToIndex[w[d]];o.indexToGraph[E]=u}}for(u=0;u<o.edgeSize;u++){var k=r[u],T={},C=(T.id=k.data("id"),T.sourceId=k.data("source"),T.targetId=k.data("target"),U(n.idealEdgeLength)?n.idealEdgeLength(k):n.idealEdgeLength),P=(k=U(n.edgeElasticity)?n.edgeElasticity(k):n.edgeElasticity,o.idToIndex[T.sourceId]),S=o.idToIndex[T.targetId];if(o.indexToGraph[P]!=o.indexToGraph[S]){for(var B=Gu(T.sourceId,T.targetId,o),D=o.graphSet[B],_=0,A=o.layoutNodes[P];-1===D.indexOf(A.id);)A=o.layoutNodes[o.idToIndex[A.parentId]],_++;for(A=o.layoutNodes[S];-1===D.indexOf(A.id);)A=o.layoutNodes[o.idToIndex[A.parentId]],_++;C*=_*n.nestingFactor}T.idealLength=C,T.elasticity=k,o.layoutEdges.push(T)}return o},Gu=function(e,t,n){return(e=Zu(e,t,0,n)).count<2?0:e.graph},Zu=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o];s=r.idToIndex[s];if(0!==(s=r.layoutNodes[s].children).length&&(s=r.indexToGraph[r.idToIndex[s[0]]],0!==(s=Zu(e,t,s,r)).count)){if(1!==s.count)return s;if(2==++a)break}}return{count:a,graph:n}},$u=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},Qu=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){t=e.layoutNodes[e.idToIndex[t.data("id")]],i.x1=Math.min(i.x1,t.positionX),i.x2=Math.max(i.x2,t.positionX),i.y1=Math.min(i.y1,t.positionY),i.y2=Math.max(i.y2,t.positionY)})),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o,s;n=e.layoutNodes[e.idToIndex[n.data("id")]];return t.boundingBox?(o=0===i.w?.5:(n.positionX-i.x1)/i.w,s=0===i.h?.5:(n.positionY-i.y1)/i.h,{x:r.x1+o*r.w,y:r.y1+s*r.h}):{x:n.positionX,y:n.positionY}}},Ju=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=Qu(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},ec=function(e,t,n){tc(e,t),oc(e),sc(e,t),lc(e),uc(e)},tc=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];rc(o,l,e,t)}},nc=function(e){return 2*e*Math.random()-1},rc=function(e,t,n,r){var i,a,o,s,l;e.cmptId!==t.cmptId&&!n.isCompound||(n=t.positionX-e.positionX,i=t.positionY-e.positionY,0===n&&0===i&&(n=nc(1),i=nc(1)),r=0<(a=ic(e,t,n,i))?(l=(s=r.nodeOverlap*a)*n/(o=Math.sqrt(n*n+i*i)),s*i/o):(r=ac(e,n,i),a=(n=(a=ac(t,-1*n,-1*i)).x-r.x)*n+(i=a.y-r.y)*i,o=Math.sqrt(a),l=(s=(e.nodeRepulsion+t.nodeRepulsion)/a)*n/o,s*i/o),e.isLocked||(e.offsetX-=l,e.offsetY-=r),t.isLocked)||(t.offsetX+=l,t.offsetY+=r)},ic=function(e,t,n,r){return n=0<n?e.maxX-t.minX:t.maxX-e.minX,r=0<r?e.maxY-t.minY:t.maxY-e.minY,0<=n&&0<=r?Math.sqrt(n*n+r*r):0},ac=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=n/t,s=a/(e=e.width||1),l={};return 0===t&&0<n||0===t&&n<0?(l.x=r,l.y=i+a/2):0<t&&-1*s<=o&&o<=s?(l.x=r+e/2,l.y=i+e*n/2/t):t<0&&-1*s<=o&&o<=s?(l.x=r-e/2,l.y=i-e*n/2/t):0<n&&(o<=-1*s||s<=o)?(l.x=r+a*t/2/n,l.y=i+a/2):n<0&&(o<=-1*s||s<=o)&&(l.x=r-a*t/2/n,l.y=i-a/2),l},oc=function(e,t){for(var n=0;n<e.edgeSize;n++){var r,i,a=e.layoutEdges[n],o=e.idToIndex[a.sourceId],s=(o=e.layoutNodes[o],e.idToIndex[a.targetId]),l=(s=e.layoutNodes[s]).positionX-o.positionX,u=s.positionY-o.positionY;0==l&&0==u||(r=ac(o,l,u),u=(l=ac(s,-1*l,-1*u)).x-r.x,l=l.y-r.y,r=Math.sqrt(u*u+l*l),a=Math.pow(a.idealLength-r,2)/a.elasticity,u=0!==r?(i=a*u/r,a*l/r):i=0,o.isLocked||(o.offsetX+=i,o.offsetY+=u),s.isLocked)||(s.offsetX-=i,s.offsetY-=u)}},sc=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var r,i,a,o=e.graphSet[n],s=o.length;a=0===n?(i=e.clientHeight/2,e.clientWidth/2):(r=e.layoutNodes[e.idToIndex[o[0]]],i=(r=e.layoutNodes[e.idToIndex[r.parentId]]).positionX,r.positionY);for(var l=0;l<s;l++){var u,c,d,h=e.layoutNodes[e.idToIndex[o[l]]];h.isLocked||(c=i-h.positionX,d=a-h.positionY,1<(u=Math.sqrt(c*c+d*d))&&(c=t.gravity*c/u,d=t.gravity*d/u,h.offsetX+=c,h.offsetY+=d))}}},lc=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=(a=e.idToIndex[a],(a=e.layoutNodes[a]).children);if(0<o.length&&!a.isLocked){for(var s=a.offsetX,l=a.offsetY,u=0;u<o.length;u++){var c=e.layoutNodes[e.idToIndex[o[u]]];c.offsetX+=s,c.offsetY+=l,n[++i]=o[u]}a.offsetX=0,a.offsetY=0}}},uc=function(e,t){for(var n=0;n<e.nodeSize;n++)0<(i=e.layoutNodes[n]).children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0);var r;for(n=0;n<e.nodeSize;n++)0<(i=e.layoutNodes[n]).children.length||i.isLocked||(r=cc(i.offsetX,i.offsetY,e.temperature),i.positionX+=r.x,i.positionY+=r.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,dc(i,e));var i;for(n=0;n<e.nodeSize;n++)0<(i=e.layoutNodes[n]).children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)},cc=function(e,t,n){var r=Math.sqrt(e*e+t*t);return n<r?{x:n*e/r,y:n*t/r}:{x:e,y:t}},dc=function(e,t){var n,r=e.parentId;if(null!=r)return n=!1,(null==(r=t.layoutNodes[t.idToIndex[r]]).maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,n=!0),(null==r.minX||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,n=!0),(null==r.maxY||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,n=!0),(null==r.minY||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,n=!0),n?dc(r,t):void 0},hc=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}var s=0;for(i=0;i<r.length;i++)if(c=r[i]){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var l=0;l<c.length;l++){var u=c[l];c.x1=Math.min(c.x1,u.positionX-u.width/2),c.x2=Math.max(c.x2,u.positionX+u.width/2),c.y1=Math.min(c.y1,u.positionY-u.height/2),c.y2=Math.max(c.y2,u.positionY+u.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,s+=c.w*c.h}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var c,d=0,h=0,p=0,f=0,g=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++)if(c=r[i]){for(l=0;l<c.length;l++)(u=c[l]).isLocked||(u.positionX+=d-c.x1,u.positionY+=h-c.y1);d+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,f=Math.max(f,c.h),g<p&&(h+=f+t.componentSpacing,f=p=d=0)}},pc={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 fc(e){this.options=ve({},pc,e)}fc.prototype.run=function(){var e=t=this.options,t=t.cy,n=(u=e.eles).nodes().not(":parent"),r=(e.sort&&(n=n.sort(e.sort)),rn(e.boundingBox||{x1:0,y1:0,w:t.width(),h:t.height()}));if(0===r.h||0===r.w)u.nodes().layoutPositions(this,e,(function(e){return{x:r.x1,y:r.y1}}));else{function i(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e}function a(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e}var o=n.size(),s=(t=Math.sqrt(o*r.h/r.w),Math.round(t)),l=Math.round(r.w/r.h*t),u=e.rows;t=null!=e.cols?e.cols:e.columns;if(null!=u&&null!=t)s=u,l=t;else if(null!=u&&null==t)s=u,l=Math.ceil(o/s);else if(null==u&&null!=t)l=t,s=Math.ceil(o/l);else if(o<l*s)o<=((u=i())-1)*(t=a())?i(u-1):o<=(t-1)*u&&a(t-1);else for(;l*s<o;){var c=i(),d=a();o<=(d+1)*c?a(d+1):i(c+1)}var h=r.w/l,p=r.h/s;if(e.condense&&(p=h=0),e.avoidOverlap)for(var f=0;f<n.length;f++){var g=(null!=(g=(v=n[f])._private.position).x&&null!=g.y||(g.x=0,g.y=0),v.layoutDimensions(e)),v=e.avoidOverlapPadding,y=g.w+v;g=g.h+v,h=Math.max(h,y),p=Math.max(p,g)}for(var m={},b=function(e,t){return!!m["c-"+e+"-"+t]},x=function(e,t){m["c-"+e+"-"+t]=!0},w=0,E=0,k=function(){l<=++E&&(E=0,w++)},T={},C=0;C<n.length;C++){var P=n[C],S=e.position(P);if(S&&(void 0!==S.row||void 0!==S.col)){var B={row:S.row,col:S.col};if(void 0===B.col)for(B.col=0;b(B.row,B.col);)B.col++;else if(void 0===B.row)for(B.row=0;b(B.row,B.col);)B.row++;T[P.id()]=B,x(B.row,B.col)}}n.layoutPositions(this,e,(function(e,t){var n,i;if(e.locked()||e.isParent())return!1;if(e=T[e.id()])n=e.col*h+h/2+r.x1,i=e.row*p+p/2+r.y1;else{for(;b(w,E);)k();n=E*h+h/2+r.x1,i=w*p+p/2+r.y1,x(w,E),k()}return{x:n,y:i}}))}return this};var gc={ready:function(){},stop:function(){}};function vc(e){this.options=ve({},gc,e)}vc.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this};var yc={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!(vc.prototype.stop=function(){return this}),animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function mc(e){this.options=ve({},yc,e)}var bc={fit:!0,padding:30,boundingBox:void 0,animate:!(mc.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=U(e.positions);return t.layoutPositions(this,e,(function(t,r){i=t;var i=null==e.positions?function(e){return{x:e.x,y:e.y}}(i.position()):n?e.positions(i):null==(i=e.positions[i._private.data.id])?null:i;return!t.locked()&&null!=i&&i})),this}),animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function xc(e){this.options=ve({},bc,e)}xc.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=rn(e.boundingBox||{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,(function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}})),this};var wc=[{name:"breadthfirst",impl:Fu},{name:"circle",impl:ju},{name:"concentric",impl:Wu},{name:"cose",impl:Hu},{name:"grid",impl:fc},{name:"null",impl:vc},{name:"preset",impl:mc},{name:"random",impl:xc}];function Ec(e){this.options=e,this.notifications=0}var kc=function(){},Tc=function(){throw new Error("A headless instance can not render images")},Cc=(Ec.prototype={recalculateRenderedStyle:kc,notify:function(){this.notifications++},init:kc,isHeadless:function(){return!0},png:Tc,jpg:Tc},{}),Pc=(Cc.arrowShapeWidth=.3,Cc.registerArrowShapes=function(){function e(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o;i=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=i}function t(e,t,n,r){for(var i=[],a=0;a<e.length;a+=2){var o=e[a],l=e[a+1];i.push(s(o,l,t,n,r))}return i}function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t}function r(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2}function i(i,s){W(s)&&(s=a[s]),a[i]=ve({name:i,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,r,i,a,o,s){return i=n(t(this.points,i+2*s,a,o)),En(e,r,i)},roughCollide:e,draw:function(e,n,r,i){n=t(this.points,n,r,i),o.arrowShapeImpl("polygon")(e,n)},spacing:function(e){return 0},gap:r},s)}var a=this.arrowShapes={},o=this,s=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r);e=e*Math.sin(r)+t*Math.cos(r);return{x:a*n+i.x,y:e*n+i.y}};i("none",{collide:rt,roughCollide:rt,draw:at,spacing:it,gap:it}),i("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),i("arrow","triangle"),i("triangle-backcurve",{points:a.triangle.points,controlPoint:[0,-.15],roughCollide:e,draw:function(e,n,r,i,a){var l=t(this.points,n,r,i),u=this.controlPoint;u=s(u[0],u[1],n,r,i);o.arrowShapeImpl(this.name)(e,l,u)},gap:function(e){return.8*r(e)}}),i("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,r,i,a,o,s,l){var u=n(t(this.points,i+2*l,a,o));i=n(t(this.pointsTee,i+2*l,a,o));return En(e,r,u)||En(e,r,i)},draw:function(e,n,r,i,a){var s=t(this.points,n,r,i);n=t(this.pointsTee,n,r,i);o.arrowShapeImpl(this.name)(e,s,n)}}),i("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,r,i,a,o,s,l){var u=o;u=Math.pow(u.x-e,2)+Math.pow(u.y-r,2)<=Math.pow((i+2*l)*this.radius,2),i=n(t(this.points,i+2*l,a,o));return En(e,r,i)||u},draw:function(e,n,r,i,a){r=t(this.pointsTr,n,r,i),o.arrowShapeImpl(this.name)(e,r,i.x,i.y,this.radius*n)},spacing:function(e){return o.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),i("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice();t/=e;return n[3]=n[3]-t,n[5]=n[5]-t,n},collide:function(e,r,i,a,o,s,l){var u=n(t(this.points,i+2*l,a,o));s=n(t(this.crossLinePts(i,s),i+2*l,a,o));return En(e,r,u)||En(e,r,s)},draw:function(e,n,r,i,a){var s=t(this.points,n,r,i);a=t(this.crossLinePts(n,a),n,r,i);o.arrowShapeImpl(this.name)(e,s,a)}}),i("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*r(e)}}),i("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){return Math.pow(i.x-e,2)+Math.pow(i.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,t,n,r,i){o.arrowShapeImpl(this.name)(e,r.x,r.y,this.radius*t)},spacing:function(e){return o.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),i("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),i("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),i("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),i("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})},{}),Sc=(Pc.projectIntoViewport=function(e,t){var n=this.cy,r=(a=this.findContainerClientCoords())[0],i=a[1],a=a[4],o=n.pan();n=n.zoom();return[((e-r)/a-o.x)/n,((t-i)/a-o.y)/n]},Pc.findContainerClientCoords=function(){var e,t,n,r,i,a,o,s,l,u,c;return this.containerBB||(c=(s=this.container).getBoundingClientRect(),e=this.cy.window().getComputedStyle(s),t=(o=function(t){return parseFloat(e.getPropertyValue(t))})("padding-left"),n=o("padding-right"),r=o("padding-top"),i=o("padding-bottom"),u=o("border-left-width"),l=o("border-right-width"),a=o("border-top-width"),o("border-bottom-width"),o=s.clientWidth,s=s.clientHeight,l=c.width/(o+(u+l)),u=c.left+t+u,c=c.top+r+a,this.containerBB=[u,c,o-(t+n),s-(r+i),l])},Pc.invalidateContainerClientCoordsCache=function(){this.containerBB=null},Pc.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},Pc.findNearestElements=function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(r?24:8)/c,p=(r?8:2)/c,f=(r?8:2)/c,g=1/0;function v(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<g))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,i=e,g=null!=t?t:g;break}}else u.push(e),i=e,g=null!=t?t:g}function y(n){var r=n.outerWidth()+2*p,i=n.outerHeight()+2*p,a=r/2,l=i/2,u=n.position(),c="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,d=n._private.rscratch;return u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,u.x,u.y,c,d)&&(v(n,0),1)}function m(e,t,n){return yt(e,t,n)}function b(n,r){var i,a,o,s,l,u,c,d=n._private,h=f,p=r?r+"-":"",g=(n.boundingBox(),d.labelBounds[r||"main"]),y=n.pstyle(p+"label").value;if("yes"===n.pstyle("text-events").strValue&&y)return i=m(d.rscratch,"labelX",r),a=m(d.rscratch,"labelY",r),y=m(d.rscratch,"labelAngle",r),d=n.pstyle(p+"text-margin-x").pfValue,r=n.pstyle(p+"text-margin-y").pfValue,p=g.x1-h-d,c=g.x2+h-d,u=g.y1-h-r,h=g.y2+h-r,y?(o=Math.cos(y),s=Math.sin(y),l=(y=function(e,t){return{x:(e-=i)*o-(t-=a)*s+i,y:e*s+t*o+a}})(p,u),p=y(p,h),u=y(c,u),y=y(c,h),c=[l.x+d,l.y+r,u.x+d,u.y+r,y.x+d,y.y+r,p.x+d,p.y+r],En(e,t,c)?(v(n),1):void 0):dn(g,e,t)&&(v(n),1)}for(var x=(l=n?l.interactive:l).length-1;0<=x;x--){var w=l[x];w.isNode()?y(w)||b(w):function(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=(g=l/2+h)*g,f=2*g,g=i.source,m=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var b=a.allpts,x=0;x+3<b.length;x+=2)if(yn(e,t,b[x],b[x+1],b[x+2],b[x+3],f)&&p>(r=wn(e,t,b[x],b[x+1],b[x+2],b[x+3])))return v(n,r),1}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(b=a.allpts,x=0;x+5<a.allpts.length;x+=4)if(mn(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5],f)&&p>(r=xn(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5])))return v(n,r),1;g=g||i.source,m=m||i.target;var w=o.getArrowWidth(l,c),E=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(x=0;x<E.length;x++){var k=E[x],T=s.arrowShapes[n.pstyle(k.name+"-arrow-shape").value],C=n.pstyle("width").pfValue;if(T.roughCollide(e,t,w,k.angle,{x:k.x,y:k.y},C,h)&&T.collide(e,t,w,k.angle,{x:k.x,y:k.y},C,h))return v(n),1}d&&0<u.length&&(y(g),y(m))}(w)||b(w)||b(w,"source")||b(w,"target")}return u},Pc.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,o=2/this.cy.zoom(),s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=rn({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],f=[[p[0],p[1]],[p[1],p[2]],[p[2],p[3]],[p[3],p[0]]];function g(e,t,n){return yt(e,t,n)}function v(e,t){var n,r,i,a,s,l,u=e._private,c=o,d=(e.boundingBox(),u.labelBounds.main);return d?(n=g(u.rscratch,"labelX",t),r=g(u.rscratch,"labelY",t),u=g(u.rscratch,"labelAngle",t),t=e.pstyle("text-margin-x").pfValue,e=e.pstyle("text-margin-y").pfValue,i=d.x1-c-t,t=d.x2+c-t,a=d.y1-c-e,d=d.y2+c-e,u?(s=Math.cos(u),l=Math.sin(u),[(c=function(e,t){return{x:(e-=n)*s-(t-=r)*l+n,y:e*l+t*s+r}})(i,a),c(t,a),c(t,d),c(i,d)]):[{x:i,y:a},{x:t,y:a},{x:t,y:d},{x:i,y:d}]):null}for(var y,m,b,x=0;x<i.length;x++){var w=i[x];if(w.isNode()){var E=w,k="yes"===E.pstyle("text-events").strValue,T=E.pstyle("box-selection").strValue,C="yes"===E.pstyle("box-select-labels").strValue;"none"!==T&&(B=E.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:("overlap"===T||C)&&k}),"contain"===T?(S=!1,C&&k&&(C=v(E))&&Fn(C,p)&&(s.push(E),S=!0),!S&&pn(h,B)&&s.push(E)):"overlap"===T&&cn(h,B)&&(Fn([{x:(k=E.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1})).x1,y:k.y1},{x:k.x2,y:k.y1},{x:k.x2,y:k.y2},{x:k.x1,y:k.y2}],p)||(C=v(E))&&Fn(C,p))&&s.push(E))}else{var P=w,S=P._private,B=(T=S.rscratch,P.pstyle("box-selection").strValue);if("none"!==B)if("contain"===B){if((null==T.startX||null==T.startY||dn(h,T.startX,T.startY))&&(null==T.endX||null==T.endY||dn(h,T.endX,T.endY)))if("bezier"===T.edgeType||"multibezier"===T.edgeType||"self"===T.edgeType||"compound"===T.edgeType||"segments"===T.edgeType||"haystack"===T.edgeType){for(var D=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts,_=!0,A=0;A<D.length;A++)if(!hn(h,D[A])){_=!1;break}_&&s.push(P)}else"straight"===T.edgeType&&s.push(P)}else if("overlap"===B){var M=!1;if(null!=T.startX&&null!=T.startY&&null!=T.endX&&null!=T.endY&&(dn(h,T.startX,T.startY)||dn(h,T.endX,T.endY)))s.push(P),M=!0;else if(!M&&"haystack"===T.edgeType)for(var R=S.rstyle.haystackPts,I=0;I<R.length;I++)if(hn(h,R[I])){s.push(P),M=!0;break}if(!M){var N=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts;if((N=(!N||N.length<2)&&"straight"===T.edgeType&&null!=T.startX&&null!=T.startY&&null!=T.endX&&null!=T.endY?[{x:T.startX,y:T.startY},{x:T.endX,y:T.endY}]:N)&&!(N.length<2))for(var L=0;L<N.length-1;L++){for(var z=N[L],O=N[L+1],V=0;V<f.length;V++){var F,X=(F=a(f[V],2))[0];if(m=O,(b=function(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)})(y=z,X,F=F[1])!==b(m,X,F)&&b(y,m,X)!==b(y,m,F)){s.push(P),M=!0;break}}if(M)break}}}}}return s},{});Sc.calculateArrowAngles=function(e){var t,n,r,i,a,o,s,l,u,c,d,h,p,f,g="haystack"===(e=e._private.rscratch).edgeType,v="bezier"===e.edgeType,y="multibezier"===e.edgeType,m="segments"===e.edgeType,b="compound"===e.edgeType,x="self"===e.edgeType,w=g?(h=e.haystackPts[0],f=e.haystackPts[1],t=e.haystackPts[2],e.haystackPts[3]):(h=e.arrowStartX,f=e.arrowStartY,t=e.arrowEndX,e.arrowEndY),E=(E=e.midX,k=e.midY,r=m?(n=h-e.segpts[0],f-e.segpts[1]):y||b||x||v?(p=e.allpts,n=h-en(p[0],p[2],p[4],.1),f-en(p[1],p[3],p[5],.1)):(n=h-E,f-k),e.srcArrowAngle=Kt(n,r),e.midX),k=e.midY;g&&(E=(h+t)/2,k=(f+w)/2),n=t-h,r=w-f,m?r=(p=e.allpts).length/2%2==0?(i=(d=p.length/2)-2,n=p[d]-p[i],p[d+1]-p[i+1]):e.isRound?(n=e.midVector[1],-e.midVector[0]):(i=(d=p.length/2-1)-2,n=p[d]-p[i],p[d+1]-p[i+1]):(y||b||x)&&(p=e.allpts,g=e.ctrlpts.length/2%2==0?(c=2+(l=2+(u=p.length/2-1)),a=en(p[u],p[l],p[c],0),o=en(p[u+1],p[l+1],p[c+1],0),s=en(p[u],p[l],p[c],1e-4),en(p[u+1],p[l+1],p[c+1],1e-4)):(c=2+(l=p.length/2-1),a=en(p[u=l-2],p[l],p[c],.4999),o=en(p[u+1],p[l+1],p[c+1],.4999),s=en(p[u],p[l],p[c],.5),en(p[u+1],p[l+1],p[c+1],.5)),n=s-a,r=g-o),e.midtgtArrowAngle=Kt(n,r),e.midDispX=n,e.midDispY=r,n*=-1,r*=-1,m&&(p=e.allpts).length/2%2!=0&&!e.isRound&&(n=-(p[h=2+(d=p.length/2-1)]-p[d]),r=-(p[h+1]-p[d+1])),e.midsrcArrowAngle=Kt(n,r),r=m?(n=t-e.segpts[e.segpts.length-2],w-e.segpts[e.segpts.length-1]):y||b||x||v?(f=(p=e.allpts).length,n=t-en(p[f-6],p[f-4],p[f-2],.9),w-en(p[f-5],p[f-3],p[f-1],.9)):(n=t-E,w-k),e.tgtArrowAngle=Kt(n,r)},Sc.getArrowWidth=Sc.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r),r};var Bc,Dc,_c,Ac,Mc,Rc,Ic,Nc,Lc,zc,Oc,Vc,Fc,Xc,jc,Yc,qc,Wc={},Uc={},Hc=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)},Kc=function(e,t,n,r,i){e!==qc?Hc(t,e,Wc):function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=0<e.ang?-(Math.PI-e.ang):Math.PI+e.ang}(Uc,Wc),Hc(t,n,Uc),_c=Wc.nx*Uc.ny-Wc.ny*Uc.nx,Ac=Wc.nx*Uc.nx-Wc.ny*-Uc.ny,Ic=Math.asin(Math.max(-1,Math.min(1,_c))),Math.abs(Ic)<1e-6?(Bc=t.x,Dc=t.y,Lc=Oc=0):(Rc=!(Mc=1),Ac<0?Ic<0?Ic=Math.PI+Ic:(Ic=Math.PI-Ic,Mc=-1,Rc=!0):0<Ic&&(Mc=-1,Rc=!0),Oc=void 0!==t.radius?t.radius:r,Nc=Ic/2,Vc=Math.min(Wc.len/2,Uc.len/2),Lc=i?(zc=Math.abs(Math.cos(Nc)*Oc/Math.sin(Nc)),Vc<zc?(zc=Vc,Math.abs(zc*Math.sin(Nc)/Math.cos(Nc))):Oc):(zc=Math.min(Vc,Oc),Math.abs(zc*Math.sin(Nc)/Math.cos(Nc))),jc=t.x+Uc.nx*zc,Yc=t.y+Uc.ny*zc,Bc=jc-Uc.ny*Lc*Mc,Dc=Yc+Uc.nx*Lc*Mc,Fc=t.x+Wc.nx*zc,Xc=t.y+Wc.ny*zc,qc=t)};function Gc(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Zc(e,t,n,r){return 0===r||0===t.radius?{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}:(Kc(e,t,n,r,!(4<arguments.length&&void 0!==arguments[4])||arguments[4]),{cx:Bc,cy:Dc,radius:Lc,startX:Fc,startY:Xc,stopX:jc,stopY:Yc,startAngle:Wc.ang+Math.PI/2*Mc,endAngle:Uc.ang-Math.PI/2*Mc,counterClockwise:Rc})}var $c=.01,Qc=Math.sqrt(.02),Jc={};function ed(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Jc.findMidptPtsEtc=function(e,t){var n,r,i,o,s,l,u=t.posPts,c=t.intersectionPts,d=t.vectorNormInverse,h=e.pstyle("source-endpoint"),p=e.pstyle("target-endpoint"),f=null!=h.units&&null!=p.units;switch(e.pstyle("edge-distances").value){case"node-position":l=u;break;case"intersection":l=c;break;case"endpoints":l=f?(s={x1:n=(r=a(this.manualEndptToPx(e.source()[0],h),2))[0],y1:r=r[1],x2:i=(o=a(this.manualEndptToPx(e.target()[0],p),2))[0],y2:o=o[1]},d=function(e,t,n,r){return r-=t,t=n-e,{x:-r/(n=Math.sqrt(t*t+r*r)),y:t/n}}(n,r,i,o),s):(lt("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).")),c)}return{midptPts:l,vectorNormInverse:d}},Jc.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=(a=n._private).rscratch,i=(r.haystack||(i=2*Math.random()*Math.PI,r.source={x:Math.cos(i),y:Math.sin(i)},i=2*Math.random()*Math.PI,r.target={x:Math.cos(i),y:Math.sin(i)}),a.source),a=a.target,o=i.position(),s=a.position(),l=i.width(),u=a.width(),c=i.height(),d=(a=a.height(),n.pstyle("haystack-radius").value/2);r.haystackPts=r.allpts=[r.source.x*l*d+o.x,r.source.y*c*d+o.y,r.target.x*u*d+s.x,r.target.y*a*d+s.y],r.midX=(r.allpts[0]+r.allpts[2])/2,r.midY=(r.allpts[1]+r.allpts[3])/2,r.edgeType="haystack",r.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Jc.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,i.pfValue.length),l=a.pfValue[a.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<s;c++){var d=r.pfValue[c],h=i.pfValue[c],p=1-d,f=(g=this.findMidptPtsEtc(e,t)).midptPts,g=g.vectorNormInverse,v=f.x1*p+f.x2*d;p=f.y1*p+f.y2*d;n.segpts.push(v+g.x*h,p+g.y*h),n.radii.push(void 0!==a.pfValue[c]?a.pfValue[c]:l),n.isArcRadius.push("arc-radius"===(void 0!==o.pfValue[c]?o.pfValue[c]:u))}},Jc.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=(t=t.srcPos,(o=e.pstyle("control-point-distances"))?o.pfValue[0]:void 0),s=e.pstyle("loop-direction").pfValue,l=e.pstyle("loop-sweep").pfValue;e=e.pstyle("control-point-step-size").pfValue,o=(r=(i.edgeType="self",r&&(n=0,e=o),s-Math.PI/2))-l/2,r+=l/2,n=void 0===a[s=String(s+"_"+l)]?a[s]=0:++a[s];i.ctrlpts=[t.x+1.4*Math.cos(o)*e*(n/3+1),t.y+1.4*Math.sin(o)*e*(n/3+1),t.x+1.4*Math.cos(r)*e*(n/3+1),t.y+1.4*Math.sin(r)*e*(n/3+1)]},Jc.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=(i.edgeType="compound",t.srcPos),o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=(t=t.tgtH,e.pstyle("control-point-step-size").pfValue);e=(e=e.pstyle("control-point-distances"))?e.pfValue[0]:void 0,r&&(n=0,c=e),r={x:a.x-s/2,y:a.y-l/2},e={x:o.x-u/2,y:o.y-t/2},a={x:Math.min(r.x,e.x),y:Math.min(r.y,e.y)},l=Math.max(.5,Math.log(s*$c)),o=Math.max(.5,Math.log(u*$c));i.ctrlpts=[a.x,a.y-(1+Math.pow(50,1.12)/100)*c*(n/3+1)*l,a.x-(1+Math.pow(50,1.12)/100)*c*(n/3+1)*o,a.y]},Jc.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},Jc.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,d=l.value[0],h=r;a.edgeType=h?"multibezier":"bezier",a.ctrlpts=[];for(var p=0;p<u;p++){var f=(.5-t.eles.length/2+n)*o*(i?-1:1),g=void 0,v=Zt(f),y=(v=(h&&(c=s?s.pfValue[p]:o,d=l.value[p]),void 0!==(g=r?c:void 0!==c?v*c:void 0)?g:f),g=1-d,f=d,(m=this.findMidptPtsEtc(e,t)).midptPts),m=m.vectorNormInverse,b=y.x1*g+y.x2*f;g=y.y1*g+y.y2*f;a.ctrlpts.push(b+m.x*v,g+m.y*v)}},Jc.findTaxiPoints=function(e,t){function n(e,t){return 0<e?Math.max(e-t,0):Math.min(e+t,0)}function r(e){return Math.abs(e)<y||Math.abs(e)>=Math.abs(k)}var i,a,o=e._private.rscratch,s=(o.edgeType="segments","vertical"),l="horizontal",u=t.posPts,c=t.srcW,d=t.srcH,h=t.tgtW,p=(t=t.tgtH,"node-position"!==e.pstyle("edge-distances").value),f=a=e.pstyle("taxi-direction").value,g="%"===(i=e.pstyle("taxi-turn")).units,v=(i=i.pfValue)<0,y=e.pstyle("taxi-turn-min-distance").pfValue,m=p?(d+t)/2:0,b=u.x2-u.x1,x=u.y2-u.y1,w=n(b,p?(c+h)/2:0),E=(m=n(x,m),!1),k=(l=("auto"===f?a=Math.abs(w)>Math.abs(m)?l:s:"upward"===f||"downward"===f?(a=s,E=!0):"leftward"!==f&&"rightward"!==f||(a=l,E=!0),a===s))?m:w;s=Zt(a=l?x:b),m=!1,E&&(g||v)||!("downward"===f&&a<0||"upward"===f&&0<a||"leftward"===f&&0<a||"rightward"===f&&a<0)||(k=(s*=-1)*Math.abs(k),m=!0),E=r(w=g?(i<0?1+i:i)*k:(i<0?k:0)+i*s),v=r(Math.abs(k)-Math.abs(w));!E&&!v||m?l?(a=u.y1+w+(p?d/2*s:0),x=u.x1,t=u.x2,o.segpts=[x,a,t,a]):(f=u.x1+w+(p?c/2*s:0),v=u.y1,g=u.y2,o.segpts=[f,v,f,g]):l?(f=Math.abs(a)<=d/2,g=Math.abs(b)<=h/2,f?(i=(u.x1+u.x2)/2,E=u.y1,v=u.y2,o.segpts=[i,E,i,v]):g?(m=(u.y1+u.y2)/2,b=u.x1,h=u.x2,o.segpts=[b,m,h,m]):o.segpts=[u.x1,u.y2]):(f=Math.abs(a)<=c/2,E=Math.abs(x)<=t/2,f?(i=(u.y1+u.y2)/2,v=u.x1,g=u.x2,o.segpts=[v,i,g,i]):E?(b=(u.x1+u.x2)/2,h=u.y1,m=u.y2,o.segpts=[b,h,b,m]):o.segpts=[u.x2,u.y1]),o.isRound&&(i=e.pstyle("taxi-radius").value,E="arc-radius"===e.pstyle("radius-type").value[0],o.radii=new Array(o.segpts.length/2).fill(i),o.isArcRadius=new Array(o.segpts.length/2).fill(E))},Jc.tryToCorrectInvalidPoints=function(e,t){var n,r,i,a,o,s,l,u,c,d,h,p,f,g,v,y,m,b,x,w,E,k,T=e._private.rscratch;"bezier"===T.edgeType&&(v=t.srcPos,n=t.tgtPos,r=t.srcW,i=t.srcH,a=t.tgtW,o=t.tgtH,k=t.srcShape,s=t.tgtShape,m=t.srcCornerRadius,l=t.tgtCornerRadius,b=t.srcRs,t=t.tgtRs,y=!G(T.startX)||!G(T.startY),g=!G(T.arrowStartX)||!G(T.arrowStartY),u=!G(T.endX)||!G(T.endY),c=!G(T.arrowEndX)||!G(T.arrowEndY),d=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,x=(w=$t({x:T.ctrlpts[0],y:T.ctrlpts[1]},{x:T.startX,y:T.startY}))<d,p=(h=$t({x:T.ctrlpts[0],y:T.ctrlpts[1]},{x:T.endX,y:T.endY}))<d,f=!1,(y||g||x)&&(f=!0,y=T.ctrlpts[0]-v.x,g=T.ctrlpts[1]-v.y,E=y/(y=Math.sqrt(y*y+g*g)),g/=y,y=Math.max(r,i),y={x:T.ctrlpts[0]+2*E*y,y:T.ctrlpts[1]+2*g*y},k=k.intersectLine(v.x,v.y,r,i,y.x,y.y,0,m,b),x?(T.ctrlpts[0]=T.ctrlpts[0]+E*(d-w),T.ctrlpts[1]=T.ctrlpts[1]+g*(d-w)):(T.ctrlpts[0]=k[0]+E*d,T.ctrlpts[1]=k[1]+g*d)),(u||c||p)&&(f=!0,v=T.ctrlpts[0]-n.x,y=T.ctrlpts[1]-n.y,b=v/(m=Math.sqrt(v*v+y*y)),x=y/m,w=Math.max(r,i),E={x:T.ctrlpts[0]+2*b*w,y:T.ctrlpts[1]+2*x*w},k=s.intersectLine(n.x,n.y,a,o,E.x,E.y,0,l,t),p?(T.ctrlpts[0]=T.ctrlpts[0]+b*(d-h),T.ctrlpts[1]=T.ctrlpts[1]+x*(d-h)):(T.ctrlpts[0]=k[0]+b*d,T.ctrlpts[1]=k[1]+x*d)),f)&&this.findEndpoints(e)},Jc.storeAllpts=function(e){var t,n,r,i,a=e._private.rscratch;if("multibezier"===a.edgeType||"bezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){a.allpts=[],a.allpts.push(a.startX,a.startY);for(var o,s=0;s+1<a.ctrlpts.length;s+=2)a.allpts.push(a.ctrlpts[s],a.ctrlpts[s+1]),s+3<a.ctrlpts.length&&a.allpts.push((a.ctrlpts[s]+a.ctrlpts[s+2])/2,(a.ctrlpts[s+1]+a.ctrlpts[s+3])/2);a.allpts.push(a.endX,a.endY),a.ctrlpts.length/2%2==0?(o=a.allpts.length/2-1,a.midX=a.allpts[o],a.midY=a.allpts[o+1]):(o=a.allpts.length/2-3,a.midX=en(a.allpts[o],a.allpts[o+2],a.allpts[o+4],.5),a.midY=en(a.allpts[o+1],a.allpts[o+3],a.allpts[o+5],.5))}else if("straight"===a.edgeType)a.allpts=[a.startX,a.startY,a.endX,a.endY],a.midX=(a.startX+a.endX+a.arrowStartX+a.arrowEndX)/4,a.midY=(a.startY+a.endY+a.arrowStartY+a.arrowEndY)/4;else if("segments"===a.edgeType){if(a.allpts=[],a.allpts.push(a.startX,a.startY),a.allpts.push.apply(a.allpts,a.segpts),a.allpts.push(a.endX,a.endY),a.isRound){a.roundCorners=[];for(var l=2;l+3<a.allpts.length;l+=2){var u=a.radii[l/2-1],c=a.isArcRadius[l/2-1];a.roundCorners.push(Zc({x:a.allpts[l-2],y:a.allpts[l-1]},{x:a.allpts[l],y:a.allpts[l+1],radius:u},{x:a.allpts[l+2],y:a.allpts[l+3]},u,c))}}a.segpts.length%4==0?(e=a.segpts.length/2,a.midX=(a.segpts[o=e-2]+a.segpts[e])/2,a.midY=(a.segpts[1+o]+a.segpts[1+e])/2):(o=a.segpts.length/2-1,a.isRound?(e={x:a.segpts[o],y:a.segpts[1+o]},0===(t=a.roundCorners[o/2]).radius?(n=a.segpts[2+o],i=a.segpts[3+o],a.midX=e.x,a.midY=e.y,a.midVector=[e.y-i,n-e.x]):(i=[e.x-t.cx,e.y-t.cy],r=t.radius/Math.sqrt(Math.pow(i[0],2)+Math.pow(i[1],2)),i=i.map((function(e){return e*r})),a.midX=t.cx+i[0],a.midY=t.cy+i[1],a.midVector=i)):(a.midX=a.segpts[o],a.midY=a.segpts[1+o]))}},Jc.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||G(t.startX)&&G(t.startY)&&G(t.endX)&&G(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,lt("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."))},Jc.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i=new xt,a=function(e,t){return[].concat(o(e),[t?1:0]).join("-")},s=[],l=[],u=0;u<e.length;u++){var c,d,h,p=e[u],f=p._private,g=p.pstyle("curve-style").value;!p.removed()&&p.takesUpSpace()&&("haystack"===g?l.push(p):(c="unbundled-bezier"===g||ue(g,"segments")||"straight"===g||"straight-triangle"===g||ue(g,"taxi"),g="unbundled-bezier"===g||"bezier"===g,d=f.source,f=f.target,d=[d.poolIndex(),f.poolIndex()].sort(),f=a(d,c),null==(h=i.get(f))&&(h={eles:[]},s.push({pairId:d,edgeIsUnbundled:c}),i.set(f,h)),h.eles.push(p),c&&(h.hasUnbundled=!0),g&&(h.hasBezier=!0)))}for(var v=0;v<s.length;v++)!function(){var e=(o=s[v]).pairId,o=o.edgeIsUnbundled,l=(e=a(e,o),i.get(e)),u=(e=(l.hasUnbundled||(o=l.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()})),gt(l.eles),o.forEach((function(e){return l.eles.push(e)})),l.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))),l.eles[0])).source(),c=e.target(),d=(u.poolIndex()>c.poolIndex()&&(o=u,u=c,c=o),l.srcPos=u.position()),h=l.tgtPos=c.position(),p=l.srcW=u.outerWidth(),f=l.srcH=u.outerHeight(),g=l.tgtW=c.outerWidth(),y=l.tgtH=c.outerHeight(),m=l.srcShape=n.nodeShapes[t.getNodeShape(u)],b=l.tgtShape=n.nodeShapes[t.getNodeShape(c)],x=l.srcCornerRadius="auto"===u.pstyle("corner-radius").value?"auto":u.pstyle("corner-radius").pfValue,w=l.tgtCornerRadius="auto"===c.pstyle("corner-radius").value?"auto":c.pstyle("corner-radius").pfValue,E=l.tgtRs=c._private.rscratch,k=l.srcRs=u._private.rscratch;l.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var T=0;T<l.eles.length;T++){var C,P,S,B,D,_,A,M,R,I=l.eles[T],N=I[0]._private.rscratch,L=I.pstyle("curve-style").value,z="unbundled-bezier"===L||ue(L,"segments")||ue(L,"taxi"),O=!u.same(I.source()),V=(l.calculatedIntersection||u===c||!l.hasBezier&&!l.hasUnbundled||(l.calculatedIntersection=!0,V=m.intersectLine(d.x,d.y,p,f,h.x,h.y,0,x,k),C=l.srcIntn=V,P=b.intersectLine(h.x,h.y,g,y,d.x,d.y,0,w,E),S=l.tgtIntn=P,B=l.intersectionPts={x1:V[0],x2:P[0],y1:V[1],y2:P[1]},D=l.posPts={x1:d.x,x2:h.x,y1:d.y,y2:h.y},M=P[1]-V[1],A=P[0]-V[0],_=Math.sqrt(A*A+M*M),G(_)&&Qc<=_||(_=Math.sqrt(Math.max(A*A,$c)+Math.max(M*M,$c))),A=l.vector={x:A,y:M},R={x:-(M=l.vectorNorm={x:A.x/_,y:A.y/_}).y,y:M.x},l.nodesOverlap=!G(_)||b.checkPoint(V[0],V[1],0,g,y,h.x,h.y,w,E)||m.checkPoint(P[0],P[1],0,p,f,d.x,d.y,x,k),l.vectorNormInverse=R,_={nodesOverlap:l.nodesOverlap,dirCounts:l.dirCounts,calculatedIntersection:!0,hasBezier:l.hasBezier,hasUnbundled:l.hasUnbundled,eles:l.eles,srcPos:h,srcRs:E,tgtPos:d,tgtRs:k,srcW:g,srcH:y,tgtW:p,tgtH:f,srcIntn:S,tgtIntn:C,srcShape:b,tgtShape:m,posPts:{x1:D.x2,y1:D.y2,x2:D.x1,y2:D.y1},intersectionPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},vector:{x:-A.x,y:-A.y},vectorNorm:{x:-M.x,y:-M.y},vectorNormInverse:{x:-R.x,y:-R.y}}),O?_:l);N.nodesOverlap=V.nodesOverlap,N.srcIntn=V.srcIntn,N.tgtIntn=V.tgtIntn,N.isRound=L.startsWith("round"),r&&(u.isParent()||u.isChild()||c.isParent()||c.isChild())&&(u.parents().anySame(c)||c.parents().anySame(u)||u.same(c)&&u.isParent())?t.findCompoundLoopPoints(I,V,T,z):u===c?t.findLoopPoints(I,V,T,z):L.endsWith("segments")?t.findSegmentsPoints(I,V):L.endsWith("taxi")?t.findTaxiPoints(I,V):"straight"===L||!z&&l.eles.length%2==1&&T===Math.floor(l.eles.length/2)?t.findStraightEdgePoints(I):t.findBezierPoints(I,V,T,z,O),t.findEndpoints(I),t.tryToCorrectInvalidPoints(I,V),t.checkForInvalidEdgeWarning(I),t.storeAllpts(I),t.storeEdgeProjections(I),t.calculateArrowAngles(I),t.recalculateEdgeLabelProjections(I),t.calculateLabelAngles(I)}}();this.findHaystackPoints(l)}},Jc.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return ed(t.segpts)},Jc.getControlPoints=function(e){var t=e[0]._private.rscratch;if("bezier"===(e=(this.recalculateRenderedStyle(e),t.edgeType))||"multibezier"===e||"self"===e||"compound"===e)return ed(t.ctrlpts)},Jc.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var td={manualEndptToPx:function(e,t){var n,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;return 2===t.value.length?(n=[t.pfValue[0],t.pfValue[1]],"%"===t.units[0]&&(n[0]=n[0]*i),"%"===t.units[1]&&(n[1]=n[1]*a),n[0]+=r.x,n[1]+=r.y,n):(n=t.pfValue[0],n=-Math.PI/2+n,t=2*Math.max(i,a),n=[r.x+Math.cos(n)*t,r.y+Math.sin(n)*t],this.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,n[0],n[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,o))},findEndpoints:function(e){var t,n,r,i,a,o=e.source()[0],s=e.target()[0],l=o.position(),u=s.position(),c=e.pstyle("target-arrow-shape").value,d=e.pstyle("source-arrow-shape").value,h=e.pstyle("target-distance-from-node").pfValue,p=e.pstyle("source-distance-from-node").pfValue,f=o._private.rscratch,g=s._private.rscratch,v=e.pstyle("curve-style").value,y=e._private.rscratch,m=y.edgeType,b=(v=ue(v,"taxi"),"self"===m||"compound"===m),x="bezier"===m||"multibezier"===m||b,w="bezier"!==m,E="straight"===m||"segments"===m,k=(m="segments"===m,x||w||E),T=(b=b||v,v=e.pstyle("source-endpoint"),b?"outside-to-node":v.value),C="auto"===o.pstyle("corner-radius").value?"auto":o.pstyle("corner-radius").pfValue,P=e.pstyle("target-endpoint"),S=(b=b?"outside-to-node":P.value,"auto"===s.pstyle("corner-radius").value?"auto":s.pstyle("corner-radius").pfValue),B=(y.srcManEndpt=v,null!=(B=2===(null==(y.tgtManEndpt=P)||null==(B=P.pfValue)?void 0:B.length)?P.pfValue:null)?B:[0,0]),D=null!=(D=2===(null==v||null==(D=v.pfValue)?void 0:D.length)?v.pfValue:null)?D:[0,0];x?(x=[y.ctrlpts[0],y.ctrlpts[1]],a=w?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:x,r=x):E&&(w=m?y.segpts.slice(0,2):[u.x+B[0],u.y+B[1]],a=m?y.segpts.slice(y.segpts.length-2):[l.x+D[0],l.y+D[1]],r=w),"inside-to-node"===b?t=[u.x,u.y]:P.units?t=this.manualEndptToPx(s,P):"outside-to-line"===b?t=y.tgtIntn:("outside-to-node"===b||"outside-to-node-or-label"===b?i=a:"outside-to-line"!==b&&"outside-to-line-or-label"!==b||(i=[l.x,l.y]),t=this.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),i[0],i[1],0,S,g),"outside-to-node-or-label"!==b&&"outside-to-line-or-label"!==b||(E=(x=s._private.rscratch).labelWidth,B=x.labelHeight,m=x.labelX,D=x.labelY,w=E/2,P=B/2,"top"===(S=s.pstyle("text-valign").value)?D-=P:"bottom"===S&&(D+=P),"left"===(g=s.pstyle("text-halign").value)?m-=w:"right"===g&&(m+=w),0<(b=An(i[0],i[1],[m-w,D-P,m+w,D-P,m+w,D+P,m-w,D+P],u.x,u.y)).length&&(E=Qt(x=l,Ht(t)),(B=Qt(x,Ht(b)))<(S=E)&&(t=b,S=B),2<b.length)&&Qt(x,{x:b[2],y:b[3]})<S&&(t=[b[2],b[3]]))),s=Mn(t,a,this.arrowShapes[c].spacing(e)+h),g=Mn(t,a,this.arrowShapes[c].gap(e)+h),y.endX=g[0],y.endY=g[1],y.arrowEndX=s[0],y.arrowEndY=s[1],"inside-to-node"===T?t=[l.x,l.y]:v.units?t=this.manualEndptToPx(o,v):"outside-to-line"===T?t=y.srcIntn:("outside-to-node"===T||"outside-to-node-or-label"===T?n=r:"outside-to-line"!==T&&"outside-to-line-or-label"!==T||(n=[u.x,u.y]),t=this.nodeShapes[this.getNodeShape(o)].intersectLine(l.x,l.y,o.outerWidth(),o.outerHeight(),n[0],n[1],0,C,f),"outside-to-node-or-label"!==T&&"outside-to-line-or-label"!==T||(m=(i=o._private.rscratch).labelWidth,w=i.labelHeight,D=i.labelX,P=i.labelY,E=m/2,B=w/2,"top"===(x=o.pstyle("text-valign").value)?P-=B:"bottom"===x&&(P+=B),"left"===(S=o.pstyle("text-halign").value)?D-=E:"right"===S&&(D+=E),0<(b=An(n[0],n[1],[D-E,P-B,D+E,P-B,D+E,P+B,D-E,P+B],l.x,l.y)).length&&(c=Qt(a=u,Ht(t)),(h=Qt(a,Ht(b)))<(g=c)&&(t=[b[0],b[1]],g=h),2<b.length)&&Qt(a,{x:b[2],y:b[3]})<g&&(t=[b[2],b[3]]))),s=Mn(t,r,this.arrowShapes[d].spacing(e)+p),v=Mn(t,r,this.arrowShapes[d].gap(e)+p);y.startX=v[0],y.startY=v[1],y.arrowStartX=s[0],y.arrowStartY=s[1],k&&(G(y.startX)&&G(y.startY)&&G(y.endX)&&G(y.endY)?y.badLine=!1:y.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),"haystack"!==t.edgeType?{x:t.arrowStartX,y:t.arrowStartY}:{x:t.haystackPts[0],y:t.haystackPts[1]}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),"haystack"!==t.edgeType?{x:t.arrowEndX,y:t.arrowEndY}:{x:t.haystackPts[2],y:t.haystackPts[3]}}},nd={};function rd(e,t,n){function r(e,t,n,r){return en(e,t,n,r)}for(var i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}nd.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,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)rd(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]})}else"haystack"===r&&(r=n.haystackPts,t.rstyle.haystackPts=[{x:r[0],y:r[1]},{x:r[2],y:r[3]}]);t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},nd.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var id,ad={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!ne(t)){t=e._private;var n,r,i=e.width(),a=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,u=e.pstyle("text-valign").strValue,c=t.rscratch;t=t.rstyle;switch(l){case"left":n=s.x-i/2-o;break;case"right":n=s.x+i/2+o;break;default:n=s.x}switch(u){case"top":r=s.y-a/2-o;break;case"bottom":r=s.y+a/2+o;break;default:r=s.y}c.labelX=n,c.labelY=r,t.labelX=n,t.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},od=function(e,t){return t=Math.atan(t/e),0===e&&t<0&&(t*=-1),t},sd=function(e,t){var n=t.x-e.x;t=t.y-e.y;return od(n,t)},ld=(ad.recalculateEdgeLabelProjections=function(e){var t,n,r,i,a=e._private,o=a.rscratch,s=this,l={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};(l.mid||l.source||l.target)&&(t={x:o.midX,y:o.midY},(n=function(e,t,n){mt(a.rscratch,e,t,n),mt(a.rstyle,e,t,n)})("labelX",null,t.x),n("labelY",null,t.y),i=od(o.midDispX,o.midDispY),n("labelAutoAngle",null,i),r=function(){if(r.cache)return r.cache;for(var e=[],t=0;t+5<o.allpts.length;t+=4){var n={x:o.allpts[t],y:o.allpts[t+1]},i={x:o.allpts[t+2],y:o.allpts[t+3]},l={x:o.allpts[t+4],y:o.allpts[t+5]};e.push({p0:n,p1:i,p2:l,startDist:0,length:0,segments:[]})}var u=a.rstyle.bezierPts,c=s.bezierProjPcts.length;function d(e,t,n,r,i){var a=$t(t,n),o=e.segments[e.segments.length-1];t={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(t),e.length+=a}for(var h=0;h<e.length;h++){var p=e[h],f=e[h-1];f&&(p.startDist=f.startDist+f.length),d(p,p.p0,u[h*c],0,s.bezierProjPcts[0]);for(var g=0;g<c-1;g++)d(p,u[h*c+g],u[h*c+g+1],s.bezierProjPcts[g],s.bezierProjPcts[g+1]);d(p,u[h*c+c-1],p.p2,s.bezierProjPcts[c-1],1)}return r.cache=e},(i=function(i){var a,s="source"===i;if(l[i]){var u=e.pstyle(i+"-text-offset").pfValue;switch(o.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,d=r(),h=0,p=0,f=0;f<d.length;f++){for(var g=d[s?f:d.length-1-f],v=0;v<g.segments.length;v++){var y=g.segments[s?v:g.segments.length-1-v],m=f===d.length-1&&v===g.segments.length-1;h=p;if(u<=(p+=y.length)||m){c={cp:g,segment:y};break}}if(c)break}var b=c.cp,x=(u-h)/(E=c.segment).length,w=E.t1-E.t0,E=s?E.t0+w*x:E.t1-w*x;E=nn(0,E,1);t=tn(b.p0,b.p1,b.p2,E),a=function(e,t,n,r){var i=nn(0,r-.001,1);return r=nn(0,r+.001,1),i=tn(e,t,n,i),e=tn(e,t,n,r),sd(i,e)}(b.p0,b.p1,b.p2,E);break;case"straight":case"segments":case"haystack":for(var k,T,C,P,S=0,B=o.allpts.length,D=0;D+3<B&&(P=s?(C={x:o.allpts[D],y:o.allpts[D+1]},{x:o.allpts[D+2],y:o.allpts[D+3]}):(C={x:o.allpts[B-2-D],y:o.allpts[B-1-D]},{x:o.allpts[B-4-D],y:o.allpts[B-3-D]}),T=S,!(u<=(S+=k=$t(C,P))));D+=2);w=nn(0,(u-T)/k,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y;return i/=t=$t(e,t),a/=t,n=null==n?0:n,{x:e.x+i*(r=null!=r?r:n*t),y:e.y+a*r}}(C,P,w),a=sd(C,P)}n("labelX",i,t.x),n("labelY",i,t.y),n("labelAutoAngle",i,a)}})("source"),i("target"),this.applyLabelDimensions(e))},ad.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},ad.applyPrefixedLabelDimensions=function(e,t){var n,r,i,a=e._private,o=this.getLabelText(e,t),s=qe(o,e._private.labelDimsKey);yt(a.rscratch,"prefixedLabelDimsKey",t)!==s&&(mt(a.rscratch,"prefixedLabelDimsKey",t,s),s=this.calculateLabelDimensions(e,o),o=e.pstyle("line-height").pfValue,e=e.pstyle("text-wrap").strValue,n=yt(a.rscratch,"labelWrapCachedLines",t)||[],e="wrap"!==e?1:Math.max(n.length,1),r=(n=s.height/e)*o,i=s.width,s=s.height+(e-1)*(o-1)*n,mt(a.rstyle,"labelWidth",t,i),mt(a.rscratch,"labelWidth",t,i),mt(a.rstyle,"labelHeight",t,s),mt(a.rscratch,"labelHeight",t,s),mt(a.rscratch,"labelLineHeight",t,r))},ad.getLabelText=function(e,t){function n(e,n){return n?(mt(i.rscratch,e,t,n),n):yt(i.rscratch,e,t)}var i=e._private,a=e.pstyle((t?t+"-":"")+"label").strValue,o=e.pstyle("text-transform").value;if(!a)return"";if("none"!=o&&("uppercase"==o?a=a.toUpperCase():"lowercase"==o&&(a=a.toLowerCase())),"wrap"===(o=e.pstyle("text-wrap").value)){var s=n("labelKey");if(null!=s&&n("labelWrapKey")===s)return n("labelWrapCachedText");for(var l=a.split("\n"),u=e.pstyle("text-max-width").pfValue,c="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],h=/[\s\u200b]+|$/g,p=0;p<l.length;p++){var f=l[p],g=this.calculateLabelDimensions(e,f).width;if(c&&(f=f.split("").join("")),u<g){var v,y="",m=0,b=r(f.matchAll(h));try{for(b.s();!(v=b.n()).done;){var x=v.value,w=x[0],E=f.substring(m,x.index),k=(m=x.index+w.length,0===y.length?E:y+E+w);this.calculateLabelDimensions(e,k).width<=u?y+=E+w:(y&&d.push(y),y=E+w)}}catch(e){b.e(e)}finally{b.f()}y.match(/^[\s\u200b]+$/)||d.push(y)}else d.push(f)}n("labelWrapCachedLines",d),a=n("labelWrapCachedText",d.join("\n")),n("labelWrapKey",s)}else if("ellipsis"===o){var T=e.pstyle("text-max-width").pfValue,C="",P=!1;if(this.calculateLabelDimensions(e,a).width<T)return a;for(var S=0;S<a.length&&!(T<this.calculateLabelDimensions(e,C+a[S]+"…").width);S++)C+=a[S],S===a.length-1&&(P=!0);return P||(C+="…"),C}return a},ad.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},ad.calculateLabelDimensions=function(e,t){for(var n=this.cy.window().document,r=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue,a=e.pstyle("font-family").strValue,o=(e=e.pstyle("font-weight").strValue,this.labelCalcCanvas),s=this.labelCalcCanvasContext,l=(o||(o=this.labelCalcCanvas=n.createElement("canvas"),s=this.labelCalcCanvasContext=o.getContext("2d"),(n=o.style).position="absolute",n.left="-9999px",n.top="-9999px",n.zIndex="-1",n.visibility="hidden",n.pointerEvents="none"),s.font="".concat(r," ").concat(e," ").concat(i,"px ").concat(a),0),u=0,c=t.split("\n"),d=0;d<c.length;d++){var h=c[d],p=(h=s.measureText(h),h=Math.ceil(h.width),i);l=Math.max(h,l);u+=p}return{width:l+=0,height:u+=0}},ad.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge();return"none"===(t=(e=e.pstyle((t?t+"-":"")+"text-rotation")).strValue)?0:r&&"autorotate"===t?n.labelAutoAngle:"autorotate"===t?0:e.pfValue},ad.calculateLabelAngles=function(e){var t=e.isEdge(),n=e._private.rscratch;n.labelAngle=this.calculateLabelAngle(e),t&&(n.sourceLabelAngle=this.calculateLabelAngle(e,"source"),n.targetLabelAngle=this.calculateLabelAngle(e,"target"))},{}),ud=!1,cd=(ld.getNodeShape=function(e){var t=e.pstyle("shape").value;return"cutrectangle"===t&&(e.width()<28||e.height()<28)?(ud||(lt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),ud=!0),"rectangle"):e.isParent()?"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle":"polygon"===t?(e=e.pstyle("shape-polygon-points").value,this.nodeShapes.makePolygon(e).name):t},{}),dd=(cd.registerCalculationListeners=function(){function e(e){if(e){var a=r.onUpdateEleCalcsFns;n.cleanStyle();for(var o=0;o<n.length;o++){var s=n[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(i(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++)(0,a[u])(e,n);r.recalculateRenderedStyle(n),n=t.collection()}}var t=this.cy,n=t.collection(),r=this,i=function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(n.merge(e),t)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",(function(e){e=e.target,i(e)})).on("style.* background.*",(function(e){e=e.target,i(e,!1)})),r.flushRenderedStyleQueue=function(){e(!0)},r.beforeRender(e,r.beforeRenderPriorities.eleCalcs)},cd.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},cd.recalculateRenderedStyle=function(e,t){function n(e){return e._private.rstyle.cleanConnected}if(0!==e.length){var r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some((function(e){return!e._private.rstyle.clean&&e.isBundledBezier()}))&&(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&(("nodes"===s.group?i:r).push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],d=c._private.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var f=(g=r[p]._private).rstyle,g=g.rscratch;f.srcX=g.arrowStartX,f.srcY=g.arrowStartY,f.tgtX=g.arrowEndX,f.tgtY=g.arrowEndY,f.midX=g.midX,f.midY=g.midY,f.labelAngle=g.labelAngle,f.sourceLabelAngle=g.sourceLabelAngle,f.targetLabelAngle=g.targetLabelAngle}}}},{}),hd=(dd.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(i=e[n])._private.rscratch;(i.grabbed()&&!i.isParent()?t:r.inDragLayer?e.drag:e.nondrag).push(i)}for(n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},dd.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},dd.getCachedZSortedEles=function(e){var t;return e||!this.cachedZSortedEles?((t=this.cy.mutableElements().toArray()).sort(Tl),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()):t=this.cachedZSortedEles,t},{}),pd=([Pc,Sc,Jc,td,nd,ad,ld,cd,dd].forEach((function(e){ve(hd,e)})),{}),fd=(pd.getCachedImage=function(e,t,n){var r,i=this.imageCache=this.imageCache||{},a=i[e];return a?(a.image.complete||a.image.addEventListener("load",n),a.image):((r=(a=i[e]=i[e]||{}).image=new Image).addEventListener("load",n),r.addEventListener("error",(function(){r.error=!0})),"data:"!==e.substring(0,5).toLowerCase()&&(r.crossOrigin=t="null"===t?null:t),r.src=e,r)},{}),gd=(fd.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s,l=e[o];void 0!==l&&(s=this.binder(l),a.push(s.on.apply(s,i)))}return a}return(s=this.binder(e)).on.apply(s,i)},fd.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}(e);if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0}});n.addEventListener("test",null,a)}catch(n){}t.supportsPassiveEvents=i}function o(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this}return{on:o,addEventListener:o,addListener:o,bind:o}},fd.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},fd.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},fd.load=function(){function e(e){return e.shiftKey||e.metaKey||e.ctrlKey}function t(){n.invalidateContainerClientCoordsCache()}for(var n=this,r=n.cy.window(),i=function(e){return e.selected()},a=function(e,t,r,i){null==e&&(e=n.cy);for(var a=0;a<t.length;a++){var o=t[a];e.emit({originalEvent:r,type:o,position:i})}},o=function(e,t){var r=!0;if(n.cy.hasCompoundNodes()&&e&&e.pannable()){for(var i=0;t&&i<t.length;i++)if((e=t[i]).isNode()&&e.isParent()&&!e.pannable()){r=!1;break}}else r=!0;return r},s=function(e){e[0]._private.rscratch.inDragLayer=!0},l=function(e){e[0]._private.rscratch.isGrabTarget=!0},u=function(e,t){(t=t.addToList).has(e)||!e.grabbable()||e.locked()||(t.merge(e),function(e){e[0]._private.grabbed=!0}(e))},c=function(e,t){t=t||{};var r=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(s),e.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(s)),t.addToList&&e.forEach((function(e){u(e,t)})),function(e,t){!e.cy().hasCompoundNodes()||null==t.inDragLayer&&null==t.addToList||(e=e.descendants(),t.inDragLayer&&(e.forEach(s),e.connectedEdges().forEach(s)),t.addToList&&u(e,t))}(e,t),p(e,{inDragLayer:t.inDragLayer}),n.updateCachedGrabbedEles()},d=c,h=function(e){e&&(n.getCachedZSortedEles().forEach((function(e){(function(e){e[0]._private.grabbed=!1})(e),function(e){e[0]._private.rscratch.inDragLayer=!1}(e),function(e){e[0]._private.rscratch.isGrabTarget=!1}(e)})),n.updateCachedGrabbedEles())},p=function(e,t){var n;null==t.inDragLayer&&null==t.addToList||!e.cy().hasCompoundNodes()||(n=e.ancestors().orphans()).same(e)||(e=(n=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants())).connectedEdges(),t.inDragLayer&&(e.forEach(s),n.forEach(s)),t.addToList&&n.forEach((function(e){u(e,t)})))},f=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},g="undefined"!=typeof MutationObserver,v="undefined"!=typeof ResizeObserver,y=(g?(n.removeObserver=new MutationObserver((function(e){for(var t=0;t<e.length;t++){var r=e[t].removedNodes;if(r)for(var i=0;i<r.length;i++)if(r[i]===n.container){n.destroy();break}}})),n.container.parentNode&&n.removeObserver.observe(n.container.parentNode,{childList:!0})):n.registerBinding(n.container,"DOMNodeRemoved",(function(e){n.destroy()})),_e((function(){n.cy.resize()}),100)),m=(g&&(n.styleObserver=new MutationObserver(y),n.styleObserver.observe(n.container,{attributes:!0})),n.registerBinding(r,"resize",y),v&&(n.resizeObserver=new ResizeObserver(y),n.resizeObserver.observe(n.container)),n.container),b=function(e){n.registerBinding(e,"transitionend",t),n.registerBinding(e,"animationend",t),n.registerBinding(e,"scroll",t)};null!=m;)b(m),m=m.parentNode;function x(e){var t,r,i,a=!1,o=e.deltaY;if(null==o&&(null!=e.wheelDeltaY?o=e.wheelDeltaY/4:null!=e.wheelDelta&&(o=e.wheelDelta/4)),0!==o){if(null==T)if(J.length>=ee){var s,l=J;if((T=ne(l,5))||(s=Math.abs(l[0]),T=re(l)&&5<s),T)for(var u=0;u<l.length;u++)te=Math.min(Math.abs(l[u]),te)}else J.push(o),a=!0;else T&&(te=Math.min(Math.abs(o),te));n.scrollingPage||(r=(s=n.cy).zoom(),i=s.pan(),r=[(t=n.projectIntoViewport(e.clientX,e.clientY))[0]*r+i.x,t[1]*r+i.y],n.hoverData.draggingEles||n.hoverData.dragging||n.hoverData.cxtStarted||$()?e.preventDefault():s.panningEnabled()&&s.userPanningEnabled()&&s.zoomingEnabled()&&s.userZoomingEnabled()&&(e.preventDefault(),n.data.wheelZooming=!0,clearTimeout(n.data.wheelTimeout),n.data.wheelTimeout=setTimeout((function(){n.data.wheelZooming=!1,n.redrawHint("eles",!0),n.redraw()}),150),i=(o=a&&5<Math.abs(o)?5*Zt(o):o)/-250,T&&(i=i/te*3),i*=n.wheelSensitivity,1===e.deltaMode&&(i*=33),a=s.zoom()*Math.pow(10,i),"gesturechange"===e.type&&(a=n.gestureStartZoom*e.scale),s.zoom({level:a,renderedPosition:{x:r[0],y:r[1]}}),s.emit({type:"gesturechange"===e.type?"pinchzoom":"scrollzoom",originalEvent:e,position:{x:t[0],y:t[1]}})))}}n.registerBinding(n.container,"contextmenu",(function(e){e.preventDefault()}));var w,E,k,T,C,P,S,B,D,_,A,M,R,I,N,L,z,O,V,F,X,j,Y,q,W,U,H,K,Z,$=function(){return 0!==n.selection[4]},Q=function(e){for(var t=n.findContainerClientCoords(),r=t[0],i=t[1],a=t[2],o=t[3],s=e.touches||[e],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;for(var d=n.container,h=e.target.parentNode,p=!1;h;){if(h===d){p=!0;break}h=h.parentNode}return!!p},J=(g=(n.registerBinding(n.container,"mousedown",(function(e){var t,r,i,o,s,u,h,p;!Q(e)||1===n.hoverData.which&&1!==e.which||(e.preventDefault(),f(),n.hoverData.capture=!0,n.hoverData.which=e.which,t=n.cy,p=[e.clientX,e.clientY],r=n.projectIntoViewport(p[0],p[1]),i=n.selection,s=(o=n.findNearestElements(r[0],r[1],!0,!1))[0],h=n.dragData.possibleDragElements,n.hoverData.mdownPos=r,n.hoverData.mdownGPos=p,u=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}},3==e.which?(n.hoverData.cxtStarted=!0,p={originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}},s?(s.activate(),s.emit(p),n.hoverData.down=s):t.emit(p),n.hoverData.downTime=(new Date).getTime(),n.hoverData.cxtDragged=!1):1==e.which&&(s&&s.activate(),null!=s&&n.nodeIsGrabbable(s)&&(l(s),s.selected()?(h=n.dragData.possibleDragElements=t.collection(),p=t.$((function(e){return e.isNode()&&e.selected()&&n.nodeIsGrabbable(e)})),c(p,{addToList:h}),s.emit(u("grabon")),p.forEach((function(e){e.emit(u("grab"))}))):(h=n.dragData.possibleDragElements=t.collection(),d(s,{addToList:h}),s.emit(u("grabon")).emit(u("grab"))),n.redrawHint("eles",!0),n.redrawHint("drag",!0)),n.hoverData.down=s,n.hoverData.downs=o,n.hoverData.downTime=(new Date).getTime(),a(s,["mousedown","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==s?(i[4]=1,n.data.bgActivePosistion={x:r[0],y:r[1]},n.redrawHint("select",!0),n.redraw()):s.pannable()&&(i[4]=1),n.hoverData.tapholdCancelled=!1,clearTimeout(n.hoverData.tapholdTimeout),n.hoverData.tapholdTimeout=setTimeout((function(){n.hoverData.tapholdCancelled||(n.hoverData.down||t).emit(u("taphold"))}),n.tapholdDuration)),i[0]=i[2]=r[0],i[1]=i[3]=r[1])}),!1),function(e){if((e=e.getRootNode())&&11===e.nodeType&&void 0!==e.host)return e}(n.container)),n.registerBinding([r,g],"mousemove",(function(t){var r,i,s,l,u,d,p,f,g,v,y,m,b,x,w,E,k;if(n.hoverData.capture||Q(t))return b=!1,w=(r=n.cy).zoom(),m=[t.clientX,t.clientY],i=n.projectIntoViewport(m[0],m[1]),s=n.hoverData.mdownPos,v=n.hoverData.mdownGPos,l=n.selection,u=null,n.hoverData.draggingEles||n.hoverData.dragging||n.hoverData.selecting||(u=n.findNearestElement(i[0],i[1],!0,!1)),k=n.hoverData.last,d=n.hoverData.down,p=[i[0]-l[2],i[1]-l[3]],f=n.dragData.possibleDragElements,v&&(g=m[0]-v[0],m=m[1]-v[1],n.hoverData.isOverThresholdDrag=g=g*g+m*m>=n.desktopTapThreshold2),v=e(t),g&&(n.hoverData.tapholdCancelled=!0),b=!0,a(u,["mousemove","vmousemove","tapdrag"],t,{x:i[0],y:i[1]}),y=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}},m=function(){n.data.bgActivePosistion=void 0,n.hoverData.selecting||r.emit(y("boxstart")),l[4]=1,n.hoverData.selecting=!0,n.redrawHint("select",!0),n.redraw()},3===n.hoverData.which?g&&(x=y("cxtdrag"),(d||r).emit(x),n.hoverData.cxtDragged=!0,n.hoverData.cxtOver&&u===n.hoverData.cxtOver||(n.hoverData.cxtOver&&n.hoverData.cxtOver.emit(y("cxtdragout")),(n.hoverData.cxtOver=u)&&u.emit(y("cxtdragover")))):n.hoverData.dragging?(b=!0,r.panningEnabled()&&r.userPanningEnabled()&&(n.hoverData.justStartedPan?(x=n.hoverData.mdownPos,E={x:(i[0]-x[0])*w,y:(i[1]-x[1])*w},n.hoverData.justStartedPan=!1):E={x:p[0]*w,y:p[1]*w},r.panBy(E),r.emit(y("dragpan")),n.hoverData.dragged=!0),i=n.projectIntoViewport(t.clientX,t.clientY)):1!=l[4]||null!=d&&!d.pannable()?(d&&d.pannable()&&d.active()&&d.unactivate(),d&&d.grabbed()||u==k||(k&&a(k,["mouseout","tapdragout"],t,{x:i[0],y:i[1]}),u&&a(u,["mouseover","tapdragover"],t,{x:i[0],y:i[1]}),n.hoverData.last=u),d&&(g?r.boxSelectionEnabled()&&v?(d&&d.grabbed()&&(h(f),d.emit(y("freeon")),f.emit(y("free")),n.dragData.didDrag)&&(d.emit(y("dragfreeon")),f.emit(y("dragfree"))),m()):d&&d.grabbed()&&n.nodeIsDraggable(d)&&((x=!n.dragData.didDrag)&&n.redrawHint("eles",!0),n.dragData.didDrag=!0,n.hoverData.draggingEles||c(f,{inDragLayer:!0}),w={x:0,y:0},G(p[0])&&G(p[1])&&(w.x+=p[0],w.y+=p[1],x)&&(E=n.hoverData.dragDelta)&&G(E[0])&&G(E[1])&&(w.x+=E[0],w.y+=E[1]),n.hoverData.draggingEles=!0,f.silentShift(w).emit(y("position")).emit(y("drag")),n.redrawHint("drag",!0),n.redraw()):0===(k=n.hoverData.dragDelta=n.hoverData.dragDelta||[]).length?(k.push(p[0]),k.push(p[1])):(k[0]+=p[0],k[1]+=p[1])),b=!0):g&&(n.hoverData.dragging||!r.boxSelectionEnabled()||!v&&r.panningEnabled()&&r.userPanningEnabled()?!n.hoverData.selecting&&r.panningEnabled()&&r.userPanningEnabled()&&o(d,n.hoverData.downs)&&(n.hoverData.dragging=!0,n.hoverData.justStartedPan=!0,l[4]=0,n.data.bgActivePosistion=Ht(s),n.redrawHint("select",!0),n.redraw()):m(),d)&&d.pannable()&&d.active()&&d.unactivate(),l[2]=i[0],l[3]=i[1],b?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}),!1),n.registerBinding(r,"mouseup",(function(t){var r,o,s,l,u,c,d,p,f;1===n.hoverData.which&&1!==t.which&&n.hoverData.capture||n.hoverData.capture&&(n.hoverData.capture=!1,r=n.cy,o=n.projectIntoViewport(t.clientX,t.clientY),s=n.selection,p=n.findNearestElement(o[0],o[1],!0,!1),l=n.dragData.possibleDragElements,u=n.hoverData.down,f=e(t),n.data.bgActivePosistion&&(n.redrawHint("select",!0),n.redraw()),n.hoverData.tapholdCancelled=!0,n.data.bgActivePosistion=void 0,u&&u.unactivate(),c=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}},3===n.hoverData.which?(d=c("cxttapend"),(u||r).emit(d),n.hoverData.cxtDragged||(d=c("cxttap"),(u||r).emit(d)),n.hoverData.cxtDragged=!1,n.hoverData.which=null):1===n.hoverData.which&&(a(p,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),n.dragData.didDrag||n.hoverData.dragged||n.hoverData.selecting||n.hoverData.isOverThresholdDrag||(a(u,["click","tap","vclick"],t,{x:o[0],y:o[1]}),E=!1,t.timeStamp-k<=r.multiClickDebounceTime()?(w&&clearTimeout(w),E=!0,k=null,a(u,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(w=setTimeout((function(){E||a(u,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),r.multiClickDebounceTime()),k=t.timeStamp)),null!=u||n.dragData.didDrag||n.hoverData.selecting||n.hoverData.dragged||e(t)||(r.$(i).unselect(["tapunselect"]),0<l.length&&n.redrawHint("eles",!0),n.dragData.possibleDragElements=l=r.collection()),p!=u||n.dragData.didDrag||n.hoverData.selecting||null!=p&&p._private.selectable&&(n.hoverData.dragging||("additive"===r.selectionType()||f?p.selected()?p.unselect(["tapunselect"]):p.select(["tapselect"]):f||(r.$(i).unmerge(p).unselect(["tapunselect"]),p.select(["tapselect"]))),n.redrawHint("eles",!0)),n.hoverData.selecting&&(d=r.collection(n.getAllInBox(s[0],s[1],s[2],s[3])),n.redrawHint("select",!0),0<d.length&&n.redrawHint("eles",!0),r.emit(c("boxend")),p=function(e){return e.selectable()&&!e.selected()},"additive"===r.selectionType()||f||r.$(i).unmerge(d).unselect(),d.emit(c("box")).stdFilter(p).select().emit(c("boxselect")),n.redraw()),n.hoverData.dragging&&(n.hoverData.dragging=!1,n.redrawHint("select",!0),n.redrawHint("eles",!0),n.redraw()),s[4]||(n.redrawHint("drag",!0),n.redrawHint("eles",!0),f=u&&u.grabbed(),h(l),f&&(u.emit(c("freeon")),l.emit(c("free")),n.dragData.didDrag)&&(u.emit(c("dragfreeon")),l.emit(c("dragfree"))))),s[4]=0,n.hoverData.down=null,n.hoverData.cxtStarted=!1,n.hoverData.draggingEles=!1,n.hoverData.selecting=!1,n.hoverData.isOverThresholdDrag=!1,n.dragData.didDrag=!1,n.hoverData.dragged=!1,n.hoverData.dragDelta=[],n.hoverData.mdownPos=null,n.hoverData.mdownGPos=null,n.hoverData.which=null)}),!1),[]),ee=4,te=1e5,ne=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!=0)return!1;return!0},re=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},ie=(n.registerBinding(n.container,"wheel",x,!0),n.registerBinding(r,"scroll",(function(e){n.scrollingPage=!0,clearTimeout(n.scrollingPageTimeout),n.scrollingPageTimeout=setTimeout((function(){n.scrollingPage=!1}),250)}),!0),n.registerBinding(n.container,"gesturestart",(function(e){n.gestureStartZoom=n.cy.zoom(),n.hasTouchStarted||e.preventDefault()}),!0),n.registerBinding(n.container,"gesturechange",(function(e){n.hasTouchStarted||x(e)}),!0),n.registerBinding(n.container,"mouseout",(function(e){var t=n.projectIntoViewport(e.clientX,e.clientY);n.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})}),!1),n.registerBinding(n.container,"mouseover",(function(e){var t=n.projectIntoViewport(e.clientX,e.clientY);n.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})}),!1),function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}),ae=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};n.registerBinding(n.container,"touchstart",z=function(e){if(n.hasTouchStarted=!0,Q(e)){function t(t){return{originalEvent:e,type:t,position:{x:s[0],y:s[1]}}}f(),n.touchData.capture=!0,n.data.bgActivePosistion=void 0;var r,i,o=n.cy,s=n.touchData.now,u=n.touchData.earlier;if(e.touches[0]&&(r=n.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY),s[0]=r[0],s[1]=r[1]),e.touches[1]&&(r=n.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY),s[2]=r[0],s[3]=r[1]),e.touches[2]&&(r=n.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY),s[4]=r[0],s[5]=r[1]),e.touches[1]){n.touchData.singleTouchMoved=!0,h(n.dragData.touchDragEles);var p=n.findContainerClientCoords(),g=(p=(M=p[0],R=p[1],I=p[2],N=p[3],C=e.touches[0].clientX-M,P=e.touches[0].clientY-R,S=e.touches[1].clientX-M,B=e.touches[1].clientY-R,L=0<=C&&C<=I&&0<=S&&S<=I&&0<=P&&P<=N&&0<=B&&B<=N,o.pan()),o.zoom());if(D=ie(C,P,S,B),_=ae(C,P,S,B),A=[((I=[(C+S)/2,(P+B)/2])[0]-p.x)/g,(I[1]-p.y)/g],_<4e4&&!e.touches[2])return p=n.findNearestElement(s[0],s[1],!0,!0),g=n.findNearestElement(s[2],s[3],!0,!0),p&&p.isNode()?(p.activate().emit(t("cxttapstart")),n.touchData.start=p):g&&g.isNode()?(g.activate().emit(t("cxttapstart")),n.touchData.start=g):o.emit(t("cxttapstart")),n.touchData.start&&(n.touchData.start._private.grabbed=!1),n.touchData.cxt=!0,n.touchData.cxtDragged=!1,n.data.bgActivePosistion=void 0,void n.redraw()}if(e.touches[2]?o.boxSelectionEnabled()&&e.preventDefault():e.touches[1]||e.touches[0]&&(null!=(g=(p=n.findNearestElements(s[0],s[1],!0,!0))[0])&&(g.activate(),n.touchData.start=g,n.touchData.starts=p,n.nodeIsGrabbable(g))&&(p=n.dragData.touchDragEles=o.collection(),n.redrawHint("eles",!(i=null)),n.redrawHint("drag",!0),g.selected()?(i=o.$((function(e){return e.selected()&&n.nodeIsGrabbable(e)})),c(i,{addToList:p})):d(g,{addToList:p}),l(g),g.emit(t("grabon")),i?i.forEach((function(e){e.emit(t("grab"))})):g.emit(t("grab"))),a(g,["touchstart","tapstart","vmousedown"],e,{x:s[0],y:s[1]}),null==g&&(n.data.bgActivePosistion={x:r[0],y:r[1]},n.redrawHint("select",!0),n.redraw()),n.touchData.singleTouchMoved=!1,n.touchData.singleTouchStartTime=+new Date,clearTimeout(n.touchData.tapholdTimeout),n.touchData.tapholdTimeout=setTimeout((function(){!1!==n.touchData.singleTouchMoved||n.pinching||n.touchData.selecting||a(n.touchData.start,["taphold"],e,{x:s[0],y:s[1]})}),n.tapholdDuration)),1<=e.touches.length){for(var v=n.touchData.startPosition=[null,null,null,null,null,null],y=0;y<s.length;y++)v[y]=u[y]=s[y];o=e.touches[0],n.touchData.startGPosition=[o.clientX,o.clientY]}}},!1),n.registerBinding(r,"touchmove",O=function(e){var t=n.touchData.capture;if(t||Q(e)){function r(t){return{originalEvent:e,type:t,position:{x:l[0],y:l[1]}}}var i=n.selection,s=n.cy,l=n.touchData.now,u=n.touchData.earlier,d=s.zoom(),p=(e.touches[0]&&(Y=n.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY),l[0]=Y[0],l[1]=Y[1]),e.touches[1]&&(Y=n.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY),l[2]=Y[0],l[3]=Y[1]),e.touches[2]&&(Y=n.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY),l[4]=Y[0],l[5]=Y[1]),n.touchData.startGPosition);if(t&&e.touches[0]&&p){for(var f=[],g=0;g<l.length;g++)f[g]=l[g]-u[g];var v=e.touches[0].clientX-p[0],y=e.touches[0].clientY-p[1],m=v*v+y*y>=n.touchTapThreshold2}if(t&&n.touchData.cxt&&(e.preventDefault(),I=e.touches[0].clientX-M,N=e.touches[0].clientY-R,z=e.touches[1].clientX-M,O=e.touches[1].clientY-R,2.25<=(p=ae(I,N,z,O))/_||22500<=p)&&(n.touchData.cxt=!1,n.data.bgActivePosistion=void 0,n.redrawHint("select",!0),b=r("cxttapend"),n.touchData.start?(n.touchData.start.unactivate().emit(b),n.touchData.start=null):s.emit(b)),t&&n.touchData.cxt){var b=r("cxtdrag"),x=(n.data.bgActivePosistion=void 0,n.redrawHint("select",!0),(n.touchData.start||s).emit(b),n.touchData.start&&(n.touchData.start._private.grabbed=!1),n.touchData.cxtDragged=!0,n.findNearestElement(l[0],l[1],!0,!0));n.touchData.cxtOver&&x===n.touchData.cxtOver||(n.touchData.cxtOver&&n.touchData.cxtOver.emit(r("cxtdragout")),(n.touchData.cxtOver=x)&&x.emit(r("cxtdragover")))}else if(t&&e.touches[2]&&s.boxSelectionEnabled())e.preventDefault(),n.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,n.touchData.selecting||s.emit(r("boxstart")),n.touchData.selecting=!0,n.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(l[0]+l[2]+l[4])/3,i[3]=(l[1]+l[3]+l[5])/3):(i[0]=(l[0]+l[2]+l[4])/3,i[1]=(l[1]+l[3]+l[5])/3,i[2]=(l[0]+l[2]+l[4])/3+1,i[3]=(l[1]+l[3]+l[5])/3+1),n.redrawHint("select",!0),n.redraw();else if(t&&e.touches[1]&&!n.touchData.didSelect&&s.zoomingEnabled()&&s.panningEnabled()&&s.userZoomingEnabled()&&s.userPanningEnabled()){if(e.preventDefault(),n.data.bgActivePosistion=void 0,n.redrawHint("select",!0),V=n.dragData.touchDragEles){n.redrawHint("drag",!0);for(var w=0;w<V.length;w++){var E=V[w]._private;E.grabbed=!1,E.rscratch.inDragLayer=!1}}p=n.touchData.start;var k,T,I=e.touches[0].clientX-M,N=e.touches[0].clientY-R,z=e.touches[1].clientX-M,O=e.touches[1].clientY-R;i=(b=ie(I,N,z,O))/D;L&&(T=(I-C+(z-S))/2,X=(N-P+(O-B))/2,i=(W=s.zoom())*i,F=s.pan(),q=A[0]*W+F.x,k=A[1]*W+F.y,T={x:-i/W*(q-F.x-T)+q,y:-i/W*(k-F.y-X)+k},p&&p.active()&&(V=n.dragData.touchDragEles,h(V),n.redrawHint("drag",!0),n.redrawHint("eles",!0),p.unactivate().emit(r("freeon")),V.emit(r("free")),n.dragData.didDrag)&&(p.emit(r("dragfreeon")),V.emit(r("dragfree"))),s.viewport({zoom:i,pan:T,cancelOnFailedZoom:!0}),s.emit(r("pinchzoom")),D=b,C=I,P=N,S=z,B=O,n.pinching=!0),e.touches[0]&&(Y=n.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY),l[0]=Y[0],l[1]=Y[1]),e.touches[1]&&(Y=n.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY),l[2]=Y[0],l[3]=Y[1]),e.touches[2]&&(Y=n.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY),l[4]=Y[0],l[5]=Y[1])}else if(e.touches[0]&&!n.touchData.didSelect){var V,F,X,j,Y,q=n.touchData.start,W=n.touchData.last;if(n.hoverData.draggingEles||n.swipePanning||(x=n.findNearestElement(l[0],l[1],!0,!0)),t&&null!=q&&e.preventDefault(),t&&null!=q&&n.nodeIsDraggable(q)&&(m?(V=n.dragData.touchDragEles,(F=!n.dragData.didDrag)&&c(V,{inDragLayer:!0}),n.dragData.didDrag=!0,X={x:0,y:0},G(f[0])&&G(f[1])&&(X.x+=f[0],X.y+=f[1],F)&&(n.redrawHint("eles",!0),j=n.touchData.dragDelta)&&G(j[0])&&G(j[1])&&(X.x+=j[0],X.y+=j[1]),n.hoverData.draggingEles=!0,V.silentShift(X).emit(r("position")).emit(r("drag")),n.redrawHint("drag",!0),n.touchData.startPosition[0]==u[0]&&n.touchData.startPosition[1]==u[1]&&n.redrawHint("eles",!0),n.redraw()):0===(j=n.touchData.dragDelta=n.touchData.dragDelta||[]).length?(j.push(f[0]),j.push(f[1])):(j[0]+=f[0],j[1]+=f[1])),a(q||x,["touchmove","tapdrag","vmousemove"],e,{x:l[0],y:l[1]}),q&&q.grabbed()||x==W||(W&&W.emit(r("tapdragout")),x&&x.emit(r("tapdragover"))),n.touchData.last=x,t)for(w=0;w<l.length;w++)l[w]&&n.touchData.startPosition[w]&&m&&(n.touchData.singleTouchMoved=!0);t&&(null==q||q.pannable())&&s.panningEnabled()&&s.userPanningEnabled()&&(o(q,n.touchData.starts)&&(e.preventDefault(),n.data.bgActivePosistion||(n.data.bgActivePosistion=Ht(n.touchData.startPosition)),n.swipePanning?(s.panBy({x:f[0]*d,y:f[1]*d}),s.emit(r("dragpan"))):m&&(n.swipePanning=!0,s.panBy({x:v*d,y:y*d}),s.emit(r("dragpan")),q)&&(q.unactivate(),n.redrawHint("select",!0),n.touchData.start=null)),Y=n.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY),l[0]=Y[0],l[1]=Y[1])}for(g=0;g<l.length;g++)u[g]=l[g];t&&0<e.touches.length&&!n.hoverData.draggingEles&&!n.swipePanning&&null!=n.data.bgActivePosistion&&(n.data.bgActivePosistion=void 0,n.redrawHint("select",!0),n.redraw())}},!1),n.registerBinding(r,"touchcancel",V=function(e){var t=n.touchData.start;n.touchData.capture=!1,t&&t.unactivate()}),n.registerBinding(r,"touchend",F=function(e){var t=n.touchData.start;if(n.touchData.capture){function r(t){return{originalEvent:e,type:t,position:{x:c[0],y:c[1]}}}0===e.touches.length&&(n.touchData.capture=!1),e.preventDefault();var o,s=n.selection,l=(n.swipePanning=!1,n.hoverData.draggingEles=!1,n.cy),u=l.zoom(),c=n.touchData.now,d=n.touchData.earlier;if(e.touches[0]&&(o=n.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY),c[0]=o[0],c[1]=o[1]),e.touches[1]&&(o=n.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY),c[2]=o[0],c[3]=o[1]),e.touches[2]&&(o=n.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY),c[4]=o[0],c[5]=o[1]),t&&t.unactivate(),n.touchData.cxt)o=r("cxttapend"),(t||l).emit(o),n.touchData.cxtDragged||(o=r("cxttap"),(t||l).emit(o)),n.touchData.start&&(n.touchData.start._private.grabbed=!1),n.touchData.cxt=!1,n.touchData.start=null,n.redraw();else{!e.touches[2]&&l.boxSelectionEnabled()&&n.touchData.selecting&&(n.touchData.selecting=!1,o=l.collection(n.getAllInBox(s[0],s[1],s[2],s[3])),s[0]=void 0,s[1]=void 0,s[2]=void 0,s[3]=void 0,s[4]=0,n.redrawHint("select",!0),l.emit(r("boxend")),o.emit(r("box")).stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit(r("boxselect")),o.nonempty()&&n.redrawHint("eles",!0),n.redraw()),null!=t&&t.unactivate(),e.touches[2]?(n.data.bgActivePosistion=void 0,n.redrawHint("select",!0)):e.touches[1]||e.touches[0]||e.touches[0]||(n.data.bgActivePosistion=void 0,n.redrawHint("select",!0),s=n.dragData.touchDragEles,null!=t?(o=t._private.grabbed,h(s),n.redrawHint("drag",!0),n.redrawHint("eles",!0),o&&(t.emit(r("freeon")),s.emit(r("free")),n.dragData.didDrag)&&(t.emit(r("dragfreeon")),s.emit(r("dragfree"))),a(t,["touchend","tapend","vmouseup","tapdragout"],e,{x:c[0],y:c[1]}),t.unactivate(),n.touchData.start=null):(o=n.findNearestElement(c[0],c[1],!0,!0),a(o,["touchend","tapend","vmouseup","tapdragout"],e,{x:c[0],y:c[1]})),s=((s=n.touchData.startPosition[0]-c[0])*s+(o=n.touchData.startPosition[1]-c[1])*o)*u*u,n.touchData.singleTouchMoved||(t||l.$(":selected").unselect(["tapunselect"]),a(t,["tap","vclick"],e,{x:c[0],y:c[1]}),X=!1,e.timeStamp-Y<=l.multiClickDebounceTime()?(j&&clearTimeout(j),X=!0,Y=null,a(t,["dbltap","vdblclick"],e,{x:c[0],y:c[1]})):(j=setTimeout((function(){X||a(t,["onetap","voneclick"],e,{x:c[0],y:c[1]})}),l.multiClickDebounceTime()),Y=e.timeStamp)),null!=t&&!n.dragData.didDrag&&t._private.selectable&&s<n.touchTapThreshold2&&!n.pinching&&("single"===l.selectionType()?(l.$(i).unmerge(t).unselect(["tapunselect"]),t.select(["tapselect"])):t.selected()?t.unselect(["tapunselect"]):t.select(["tapselect"]),n.redrawHint("eles",!0)),n.touchData.singleTouchMoved=!0);for(var p=0;p<c.length;p++)d[p]=c[p];n.dragData.didDrag=!1,0===e.touches.length&&(n.touchData.dragDelta=[],n.touchData.startPosition=[null,null,null,null,null,null],n.touchData.startGPosition=null,n.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(n.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),n.pinching=!1,n.redrawHint("eles",!0),n.redraw())}}},!1),"undefined"==typeof TouchEvent&&(q=[],W=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}},U=function(e){return{event:e,touch:W(e)}},H=function(e){for(var t=0;t<q.length;t++)if(q[t].event.pointerId===e.pointerId)return void q.splice(t,1)},K=function(e){e.touches=q.map((function(e){return e.touch}))},Z=function(e){return"mouse"===e.pointerType||4===e.pointerType},n.registerBinding(n.container,"pointerdown",(function(e){Z(e)||(e.preventDefault(),q.push(U(e)),K(e),z(e))})),n.registerBinding(n.container,"pointerup",(function(e){Z(e)||(H(e),K(e),F(e))})),n.registerBinding(n.container,"pointercancel",(function(e){Z(e)||(H(e),K(e),V())})),n.registerBinding(n.container,"pointermove",(function(e){var t,n;Z(e)||(e.preventDefault(),t=e,(n=q.filter((function(e){return e.event.pointerId===t.pointerId}))[0]).event=t,n.touch=W(t),K(e),O(e))})))},{}),vd=(gd.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return An(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return kn(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:"rectangle"!==e,miterBounds:function(e,t,n,r,i,a){return gn(this.points,e,t,n,r,i)}}},gd.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return function(e,t,n,r,i,a){var o=n-e,s=r-t;return o/=i,s/=a,(a=(i=Math.sqrt(o*o+s*s))-1)<0?[]:[(n-e)*(o=a/i)+e,(r-t)*o+t]}(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return Pn(e,t,r,i,a,o,n)}}},gd.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(void 0===o[s]||o[s+"-cx"]!==e||o[s+"-cy"]!==n){o[s]=new Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;for(var l=r/2,u=i/2,c=(a="auto"===a?zn(r,i):a,new Array(t.length/2)),d=0;d<t.length/2;d++)c[d]={x:e+l*t[2*d],y:n+u*t[2*d+1]};for(var h,p,f=c.length,g=c[f-1],v=0;v<f;v++)h=c[v%f],p=c[(v+1)%f],o[s][v]=Zc(g,h,p,a),g=h}return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,"drawCorners"))},intersectLine:function(e,t,n,r,i,a,o,s,l){return function(e,t,n,r,i,a,o,s,l){var u,c=[],d=new Array(2*n.length);l.forEach((function(n,a){0===a?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[4*a-2]=n.startX,d[4*a-1]=n.startY),d[4*a]=n.stopX,d[4*a+1]=n.stopY,0!==(u=Sn(e,t,r,i,n.cx,n.cy,n.radius)).length&&c.push(u[0],u[1])}));for(var h=0;h<d.length/4;h++)0!==(u=Dn(e,t,r,i,d[4*h],d[4*h+1],d[4*h+2],d[4*h+3],!1)).length&&c.push(u[0],u[1]);if(2<c.length){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g<c.length/2;g++){var v=Math.pow(c[2*g]-e,2)+Math.pow(c[2*g+1]-t,2);v<=f&&(p[0]=c[2*g],p[1]=c[2*g+1],f=v)}return p}return c}(i,a,this.points,e,t,0,0,0,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,i,a,o,s,l){return function(e,t,n,r,i,a,o,s){for(var l=new Array(2*n.length),u=0;u<s.length;u++){var c=s[u];if(l[4*u+0]=c.startX,l[4*u+1]=c.startY,l[4*u+2]=c.stopX,l[4*u+3]=c.stopY,Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2)<=Math.pow(c.radius,2))return!0}return En(e,t,l)}(e,t,this.points,0,0,0,0,this.getOrCreateCorners(a,o,r,i,s,l,"corners"))}}},gd.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Rn(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return vn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=r/2,u=i/2,c=(s="auto"===s?Ln(r,i):s,2*(s=Math.min(l,u,s)));return!!kn(e,t,this.points,a,o,r,i-c,[0,-1],n)||!!kn(e,t,this.points,a,o,r-c,i,[0,-1],n)||!!(Pn(e,t,c,c,a-l+s,o-u+s,n)||Pn(e,t,c,c,a+l-s,o-u+s,n)||Pn(e,t,c,c,a+l-s,o+u-s,n)||Pn(e,t,c,c,a-l+s,o+u-s,n))}}},gd.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:Rn(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a=n-(e=e/2);n+=e;return{topLeft:[a,(e=r-(t=t/2))+(i="auto"===i?this.cornerLength:i),a+i,e,a+i,e+i],topRight:[n-i,e,n,e+i,n-i,e+i],bottomRight:[n,(r=r+t)-i,n-i,r,n-i,r-i],bottomLeft:[a+i,r,a,r-i,a+i,r-i]}},intersectLine:function(e,t,n,r,i,a,o,s){return n=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s),r=[].concat.apply([],[n.topLeft.splice(0,4),n.topRight.splice(0,4),n.bottomRight.splice(0,4),n.bottomLeft.splice(0,4)]),An(i,a,r,e,t)},checkPoint:function(e,t,n,r,i,a,o,s){s="auto"===s?this.cornerLength:s;return!!kn(e,t,this.points,a,o,r,i-2*s,[0,-1],n)||!!kn(e,t,this.points,a,o,r-2*s,i,[0,-1],n)||(s=this.generateCutTrianglePts(r,i,a,o),En(e,t,s.topLeft))||En(e,t,s.topRight)||En(e,t,s.bottomRight)||En(e,t,s.bottomLeft)}}},gd.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Rn(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){function l(e){var t=tn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u),n=tn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},c),r=tn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},d);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]}var u=.15,c=.5,d=.85;n=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),r=[].concat(l(n.topLeft),l(n.topRight),l(n.bottomRight),l(n.bottomLeft));return An(i,a,r,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i,a=n-(o=e/2),o=(n=n+o,r-(i=t/2)),s=(r=r+i,t=(i=Vn(e,t)).heightOffset,i.widthOffset);return(e={topLeft:[a,o+t,a+(i=i.ctrlPtOffsetPct*e),o,a+s,o],topRight:[n-s,o,n-i,o,n,o+t],bottomRight:[n,r-t,n-i,r,n-s,r],bottomLeft:[a+s,r,a+i,r,a,r-t]}).topLeft.isTop=!0,e.topRight.isTop=!0,e.bottomLeft.isBottom=!0,e.bottomRight.isBottom=!0,e},checkPoint:function(e,t,n,r,i,a,o,s){var l=(u=Vn(r,i)).heightOffset,u=u.widthOffset;if(kn(e,t,this.points,a,o,r,i-2*l,[0,-1],n))return!0;if(kn(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,i,a,o),d=Object.keys(c),h=0;h<d.length;h++){var p=c[d[h]],f=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=(n=n[1],Math.min(r,a)),l=Math.max(r,a),u=Math.min(o,n);o=Math.max(o,n);return s<=e&&e<=l&&u<=t&&t<=o&&(n=On(r,i,a),0<(s=bn(n[0],n[1],n[2],e).filter((function(e){return 0<=e&&e<=1}))).length)?s[0]:null}(e,t,p);if(null!=f){var g=p[5],v=p[3],y=p[1];g=en(g,v,y,f);if(p.isTop&&g<=t)return!0;if(p.isBottom&&t<=g)return!0}}return!1}}},gd.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Rn(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l;return 0<(l=Dn(i,a,e,t,e-(n/2+o),l=t-(r/2+o),e+(n/2+o),l,!1)).length?l:vn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l,u,c=2*(s="auto"===s?Ln(r,i):s);return!!kn(e,t,this.points,a,o,r,i-c,[0,-1],n)||!!(kn(e,t,this.points,a,o,r-c,i,[0,-1],n)||En(e,t,[a-(l=r/2+2*n),o-(u=i/2+2*n),a-l,o,a+l,o,a+l,o-u])||Pn(e,t,c,c,a+r/2-s,o+i/2-s,n)||Pn(e,t,c,c,a-r/2+s,o+i/2-s,n))}}},gd.registerNodeShapes=function(){var e=this.nodeShapes={},t=this,n=(this.generateEllipse(),this.generatePolygon("triangle",Rn(3,0)),this.generateRoundPolygon("round-triangle",Rn(3,0)),this.generatePolygon("rectangle",Rn(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle(),[0,1,1,0,0,-1,-1,0]),r=(this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Rn(5,0)),this.generateRoundPolygon("round-pentagon",Rn(5,0)),this.generatePolygon("hexagon",Rn(6,0)),this.generateRoundPolygon("round-hexagon",Rn(6,0)),this.generatePolygon("heptagon",Rn(7,0)),this.generateRoundPolygon("round-heptagon",Rn(7,0)),this.generatePolygon("octagon",Rn(8,0)),this.generateRoundPolygon("round-octagon",Rn(8,0)),new Array(20)),i=Nn(5,0),a=Nn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=In(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]),n=[-1,-1,.25,-1,1,0,.25,1,-1,1],this.generatePolygon("tag",n),this.generateRoundPolygon("round-tag",n),e.makePolygon=function(e){var n="polygon-"+e.join("$");return this[n]||t.generatePolygon(n,e)}},{}),yd=(vd.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},vd.redraw=function(e){e=e||ht(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},vd.beforeRender=function(e,t){var n;this.destroyed||(null==t&&ot("Priority is not optional for beforeRender"),(n=this.beforeRenderCallbacks).push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority})))},function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)}),md=(vd.startRenderLoop=function(){var e,t=this,n=t.cy;t.renderLoopStarted||(t.renderLoopStarted=!0,Ie(e=function(r){var i,a;t.destroyed||(n.batching()||(t.requestedFrame&&!t.skipFrame?(yd(t,!0,r),i=Ne(),t.render(t.renderOptions),a=t.lastDrawTime=Ne(),void 0===t.averageRedrawTime&&(t.averageRedrawTime=a-i),void 0===t.redrawCount&&(t.redrawCount=0),t.redrawCount++,void 0===t.redrawTotalTime&&(t.redrawTotalTime=0),t.redrawTotalTime+=a-=i,t.lastRedrawTime=a,t.averageRedrawTime=t.averageRedrawTime/2+a/2,t.requestedFrame=!1):yd(t,!1,r)),t.skipFrame=!1,Ie(e))}))},function(e){this.init(e)}),bd=md,xd=bd.prototype,wd=(xd.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],xd.init=function(e){var t,n,r,i,a=this,o=(a.options=e,a.cy=e.cy,a.container=e.cy.container()),s=a.cy.window();s&&(n=(t=s.document).head,r="__________cytoscape_container",i=null!=t.getElementById("__________cytoscape_stylesheet"),o.className.indexOf(r)<0&&(o.className=(o.className||"")+" "+r),i||((i=t.createElement("style")).id="__________cytoscape_stylesheet",i.textContent="."+r+" { position: relative; }",n.insertBefore(i,n.children[0])),"static"===s.getComputedStyle(o).getPropertyValue("position"))&<("A Cytoscape container has style position:static and so can not use UI extensions properly"),a.selection=[void 0,void 0,void 0,void 0,0],a.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],a.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},a.dragData={possibleDragElements:[]},a.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]},a.redraws=0,a.showFps=e.showFps,a.debug=e.debug,a.webgl=e.webgl,a.hideEdgesOnViewport=e.hideEdgesOnViewport,a.textureOnViewport=e.textureOnViewport,a.wheelSensitivity=e.wheelSensitivity,a.motionBlurEnabled=e.motionBlur,a.forcedPixelRatio=G(e.pixelRatio)?e.pixelRatio:null,a.motionBlur=e.motionBlur,a.motionBlurOpacity=e.motionBlurOpacity,a.motionBlurTransparency=1-a.motionBlurOpacity,a.motionBlurPxRatio=1,a.mbPxRBlurry=1,a.minMbLowQualFrames=4,a.fullQualityMb=!1,a.clearedForMotionBlur=[],a.desktopTapThreshold=e.desktopTapThreshold,a.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,a.touchTapThreshold=e.touchTapThreshold,a.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,a.tapholdDuration=500,a.bindings=[],a.beforeRenderCallbacks=[],a.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},a.registerNodeShapes(),a.registerArrowShapes(),a.registerCalculationListeners()},xd.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"===e?n.load():"destroy"===e?n.destroy():(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"gc"===e&&n.redrawHint("gc",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()))},xd.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.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(e){}},xd.isHeadless=function(){return!1},[Cc,hd,pd,fd,gd,vd].forEach((function(e){ve(xd,e)})),1e3/60),Ed=function(e){return function(){var t,n,r=this,i=this.renderer;r.dequeueingSetup||(r.dequeueingSetup=!0,t=_e((function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()}),e.deqRedrawThreshold),n=e.priority||at,i.beforeRender((function(n,a){var o=Ne(),s=i.averageRedrawTime,l=i.lastRedrawTime,u=[],c=i.cy.extent(),d=i.getPixelRatio();for(n||i.flushRenderedStyleQueue();;){var h=(p=Ne())-o,p=p-a;if(l<wd){if(p>=e.deqFastCost*(wd-(n?s:0)))break}else if(n){if(h>=e.deqCost*l||h>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*wd)break;var f=e.deq(r,d,c);if(!(0<f.length))break;for(var g=0;g<f.length;g++)u.push(f[g])}0<u.length&&(e.onDeqd(r,u),!n)&&e.shouldRedraw(r,u,d,c)&&t()}),n(r)))}},kd=n((function e(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:rt;t(this,e),this.idsByKey=new xt,this.keyForId=new xt,this.cachesByLvl=new xt,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}),[{key:"getIdsFor",value:function(e){null==e&&ot("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Et,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);e=this.getKey(e),this.deleteIdForKey(n,t),this.addIdForKey(e,t),this.keyForId.set(t,e)}},{key:"deleteKeyMappingFor",value:function(e){e=e.id();var t=this.keyForId.get(e);this.deleteIdForKey(t,e),this.keyForId.delete(e)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new xt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e);return null!=(n=this.getCache(n,t))&&this.updateKeyMappingFor(e),n}},{key:"getForCachedKey",value:function(e,t){return e=this.keyForId.get(e.id()),this.getCache(e,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){return e=this.getKey(e),this.hasCache(e,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){e=this.getKey(e),this.deleteCache(e,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id();return t=this.keyForId.get(t),this.deleteKeyMappingFor(e),(e=this.doesEleInvalidateKey(e))&&this.invalidateKey(t),e||0===this.getNumberOfIdsForKey(t)}}]),Td=7.99,Cd={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Pd=pt({getKey:null,doesEleInvalidateKey:rt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:nt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Sd=function(e,t){this.renderer=e,this.onDequeues=[],e=Pd(t),ve(this,e),this.lookup=new kd(e.getKey,e.doesEleInvalidateKey),this.setupDequeueing()},Bd=Sd.prototype,Dd=(Bd.reasons=Cd,Bd.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Bd.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Bd.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new At((function(e,t){return t.reqs-e.reqs}))},Bd.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Bd.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if((r=null==r?Math.ceil(Gt(s*n)):r)<-4)r=-4;else if(7.99<=s||3<r)return null;s=Math.pow(2,r);var u=t.h*s,c=t.w*s,d=o.eleTextBiggerThanMin(e,s);if(!this.isVisible(e,d))return null;if((o=l.get(e,r))&&o.invalidated&&(o.invalidated=!1,o.texture.invalidatedWidth-=o.width),!o){var h=u<=25?25:u<=50?50:50*Math.ceil(u/50);if(1024<u||1024<c)return null;function p(){return a.recycleTexture(h,c)||a.addTexture(h,c)}var f=(y=a.getTextureQueue(h))[y.length-2];function g(e){return e&&e.scaledLabelShown===d}(f=(f=f||y[y.length-1])||p()).width-f.usedWidth<c&&(f=p());for(var v,y=i&&i===Cd.dequeue,m=i&&i===Cd.highQuality,b=(i=i&&i===Cd.downscale,r+1);b<=3;b++){var x=l.get(e,b);if(x){v=x;break}}function w(){f.context.drawImage(k.texture.canvas,k.x,0,k.width,k.height,f.usedWidth,0,c,u)}var E,k=v&&v.level===r+1?v:null;if(f.context.setTransform(1,0,0,1,0,0),f.context.clearRect(f.usedWidth,0,c,h),g(k))w();else if(g(v)){if(!m)return a.queueElement(e,v.level-1),v;for(var T=v.level;r<T;T--)k=a.getElement(e,t,n,T,Cd.downscale);w()}else{if(!y&&!m&&!i)for(var C=r-1;-4<=C;C--){var P=l.get(e,C);if(P){E=P;break}}if(g(E))return a.queueElement(e,r),E;f.context.translate(f.usedWidth,0),f.context.scale(s,s),this.drawElement(f.context,e,t,d,!1),f.context.scale(1/s,1/s),f.context.translate(-f.usedWidth,0)}o={x:f.usedWidth,texture:f,level:r,scale:s,width:c,height:u,scaledLabelShown:d},f.usedWidth+=Math.ceil(c+8),f.eleCaches.push(o),l.set(e,r,o),a.checkTextureFullness(f)}return o},Bd.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Bd.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},Bd.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},Bd.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?ft(t,e):e.fullnessChecks++},Bd.retireTexture=function(e){for(var t=e.height,n=this.getTextureQueue(t),r=this.lookup,i=(ft(n,e),e.retired=!0,e.eleCaches),a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}gt(i),this.getRetiredTextureQueue(t).push(e)},Bd.addTexture=function(e,t){var n={};return this.getTextureQueue(e).push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},Bd.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,gt(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),ft(r,a),n.push(a),a}},Bd.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];a?(a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a)):(a={eles:e.spawn().merge(e),level:t,reqs:1,key:i},n.push(a),r[i]=a)},Bd.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&0<t.size();a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);n[s]=null,u||(r.push(o),s=this.getBoundingBox(l),this.getElement(l,s,e,o.level,Cd.dequeue))}return r},Bd.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=tt,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Bd.onDequeue=function(e){this.onDequeues.push(e)},Bd.offDequeue=function(e){ft(this.onDequeues,e)},Bd.setupDequeueing=Ed({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(cn(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}}),1),_d=function(e){var t=this,n=(e=t.renderer=e).cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Ne()-500,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=_e((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),50),e.beforeRender((function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1}),e.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new At((function(e,t){return t.reqs-e.reqs})),t.setupDequeueing()},Ad=_d.prototype,Md=0,Rd=Math.pow(2,53)-1,Id=(Ad.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i);t=(e={id:Md=++Md%Rd,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0}).context,r=-e.bb.x1,i=-e.bb.y1;return t.scale(n,n),t.translate(r,i),e},Ad.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(Gt(i*t)))<-4)n=-4;else if(3.99<=i||2<n)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;function d(t){if(!s)for(var i=n+t;-4<=i&&i<=2&&!function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0}(i);i+=t);}d(1),d(-1);for(var h=c.length-1;0<=h;h--){var p=c[h];p.invalid&&ft(c,p)}var f=function(){if(!o){o=rn();for(var t=0;t<e.length;t++)an(o,e[t].boundingBox())}return o};if(r.skipping&&!a)return null;for(var g,v,y,m=null,b=e.length/Dd,x=!a,w=0;w<e.length;w++){var E,k=e[w],T=(E=(E=k._private.rscratch).imgLayerCaches=E.imgLayerCaches||{})[n];if(T)m=T;else{if(!(m&&!(m.eles.length>=b)&&pn(m.bb,k.boundingBox())||(y=v=T=void 0,T=(g=(g={insert:!0,after:m})||{}).after,f(),v=Math.ceil(o.w*u),y=Math.ceil(o.h*u),m=32767<v||32767<y||16e6<v*y?null:(v=r.makeLayer(o,n),null!=T?(y=c.indexOf(T)+1,c.splice(y,0,v)):void 0!==g.insert&&!g.insert||c.unshift(v),v))))return null;s||x?r.queueLayer(m,k):r.drawEleInLayer(m,k,n,t),m.eles.push(k),E[n]=m}}return s||(x?null:c)},Ad.getEleLevelForLayerLevel=function(e,t){return e},Ad.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=(e=e.context,t.boundingBox());0!==a.w&&0!==a.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(e,!1),i.drawCachedElement(e,t,null,null,n,true),i.setImgSmoothing(e,!0))},Ad.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(0<a.reqs)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Ad.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},Ad.updateElementsInLayers=function(e,t){for(var n=Q(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];!u||i&&this.getEleLevelForLayerLevel(u.level)!==i.level||t(u,a,i)}},Ad.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&0<n.length){e=!0;break}}return e},Ad.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Ne(),0!==e.length)&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)}))},Ad.invalidateLayer=function(e){if(this.lastInvalidationTime=Ne(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];ft(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},Ad.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])}))},Ad.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},Ad.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},Ad.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i,a=t.peek();a.replacement||a.replaces&&a!==a.replaces.replacement||a.invalid?t.pop():((i=a.elesQueue.shift())&&(this.drawEleInLayer(a,i,a.level,e),r++),0===n.length&&n.push(!0),0===a.elesQueue.length&&(t.pop(),a.reqs=0,a.replaces&&this.applyLayerReplacement(a),this.requestRedraw()))}return n},Ad.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0||n.invalid)){t[r]=e;for(var i=0;i<e.eles.length;i++){var a;(a=(a=e.eles[i]._private).imgLayerCaches=a.imgLayerCaches||{})&&(a[e.level]=e)}this.requestRedraw()}},Ad.requestRedraw=_e((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),Ad.setupDequeueing=Ed({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:at,shouldRedraw:nt,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}}),{});function Nd(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function Ld(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function zd(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n;t=n[0];for(e.moveTo(t.x,t.y),i=1;i<o.length;i++)a=o[i],e.lineTo(a.x,a.y);e.closePath&&e.closePath()}function Od(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t;n=a[0];e.moveTo(n.x,n.y);for(var o=0;o<a.length;o++){var s=a[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function Vd(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}Id.arrowShapeImpl=function(e){return(id=id||{polygon:Nd,"triangle-backcurve":Ld,"triangle-tee":zd,"circle-triangle":Od,"triangle-cross":zd,circle:Vd})[e]};var Fd={drawElement:function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},drawElementOverlay:function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},drawElementUnderlay:function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},drawCachedElementPortion:function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f,g=n.getBoundingBox(t);0!==g.w&&0!==g.h&&(null!=(r=n.getElement(t,g,r,i,a))?0!==(i=s(this,t))&&(a=o(this,t),s=g.x1,o=g.y1,l=g.w,g=g.h,p=0!==a?(c=(d=n.getRotationPoint(t)).x,d=d.y,e.translate(c,d),e.rotate(a),(u=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0),h=(p=n.getRotationOffset(t)).x,p.y):(h=s,o),1!==i&&(f=e.globalAlpha,e.globalAlpha=f*i),e.drawImage(r.texture.canvas,r.x,0,r.width,r.height,h,p,l,g),1!==i&&(e.globalAlpha=f),0!==a)&&(e.rotate(-a),e.translate(-c,-d),u||this.setImgSmoothing(e,!1)):n.drawElement(e,t))}},Xd=function(){return 0},jd=function(e,t){return e.getTextAngle(t,null)},Yd=function(e,t){return e.getTextAngle(t,"source")},qd=function(e,t){return e.getTextAngle(t,"target")},Wd=function(e,t){return t.effectiveOpacity()},Ud=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()},Hd=(Fd.drawCachedElement=function(e,t,n,r,i,a){var o=(u=this.data).eleTxrCache,s=u.lblTxrCache,l=u.slbTxrCache,u=u.tlbTxrCache,c=t.boundingBox();a=!0===a?o.reasons.highQuality:null;0===c.w||0===c.h||!t.visible()||r&&!cn(c,r)||(c=t.isEdge(),r=t.element()._private.rscratch.badLine,this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,o,n,i,a,Xd,Wd),c&&r||this.drawCachedElementPortion(e,t,s,n,i,a,jd,Ud),c&&!r&&(this.drawCachedElementPortion(e,t,l,n,i,a,Yd,Ud),this.drawCachedElementPortion(e,t,u,n,i,a,qd,Ud)),this.drawElementOverlay(e,t))},Fd.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},Fd.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},Fd.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},Fd.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)},{}),Kd=(Hd.drawEdge=function(e,t,n){var r,i,a,o,s,l,u,c,d,h,p,f,g,v=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],y=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],m=!(5<arguments.length&&void 0!==arguments[5])||arguments[5],b=this,x=t._private.rscratch;m&&!t.visible()||x.badLine||null==x.allpts||isNaN(x.allpts[0])||(n&&e.translate(-(r=n).x1,-r.y1),h=m?t.pstyle("opacity").value:1,m=m?t.pstyle("line-opacity").value:1,i=t.pstyle("curve-style").value,a=t.pstyle("line-style").value,o=t.pstyle("width").pfValue,s=t.pstyle("line-cap").value,l=t.pstyle("line-outline-width").value,u=t.pstyle("line-outline-color").value,d=c=h*m,h=function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:c;"straight-triangle"===i?(b.eleStrokeStyle(e,t,n),b.drawEdgeTrianglePath(t,e,x.allpts)):(e.lineWidth=o,e.lineCap=s,b.eleStrokeStyle(e,t,n),b.drawEdgePath(t,e,x.allpts,a),e.lineCap="butt")},m=function(){b.drawArrowheads(e,t,0<arguments.length&&void 0!==arguments[0]?arguments[0]:d)},e.lineJoin="round","yes"===t.pstyle("ghost").value?(p=t.pstyle("ghost-offset-x").pfValue,f=t.pstyle("ghost-offset-y").pfValue,g=t.pstyle("ghost-opacity").value,g*=c,e.translate(p,f),h(g),m(g),e.translate(-p,-f)):function(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:c;e.lineWidth=o+l,e.lineCap=s,0<l?(b.colorStrokeStyle(e,u[0],u[1],u[2],n),"straight-triangle"===i?b.drawEdgeTrianglePath(t,e,x.allpts):(b.drawEdgePath(t,e,x.allpts,a),e.lineCap="butt")):e.lineCap="butt"}(),y&&b.drawEdgeUnderlay(e,t),h(),m(),y&&b.drawEdgeOverlay(e,t),b.drawElementText(e,t,null,v),n&&e.translate(r.x1,r.y1))},function(e){if(["overlay","underlay"].includes(e))return function(t,n){var r,i,a,o,s;n.visible()&&0!==(r=n.pstyle("".concat(e,"-opacity")).value)&&(i=this.usePaths(),a=n._private.rscratch,o=2*n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-color")).value,t.lineWidth=o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],r),this.drawEdgePath(n,t,a.allpts,"solid"))};throw new Error("Invalid state")}),Gd=(Hd.drawEdgeOverlay=Kd("overlay"),Hd.drawEdgeUnderlay=Kd("underlay"),Hd.drawEdgePath=function(e,t,n,i){var a,o=e._private.rscratch,s=t,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u&&(e=n.join("$"),o.pathCacheKey&&o.pathCacheKey===e?(a=t=o.pathCache,l=!0):(a=t=new Path2D,o.pathCacheKey=e,o.pathCache=a)),s.setLineDash)switch(i){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(c),s.lineDashOffset=d;break;case"solid":s.setLineDash([])}if(!l&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<n.length;h+=4)t.quadraticCurveTo(n[h],n[h+1],n[h+2],n[h+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(o.isRound){var f,g=r(o.roundCorners);try{for(g.s();!(f=g.n()).done;)Gc(t,f.value)}catch(e){g.e(e)}finally{g.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var v=2;v+1<n.length;v+=2)t.lineTo(n[v],n[v+1])}t=s,u?t.stroke(a):t.stroke(),t.setLineDash&&t.setLineDash([])},Hd.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);o=[(a=[a[1]/o,-a[0]/o])[0]*r/2,a[1]*r/2];t.beginPath(),t.moveTo(n[i]-o[0],n[i+1]-o[1]),t.lineTo(n[i]+o[0],n[i+1]+o[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},Hd.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||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),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},Hd.drawArrowhead=function(e,t,n,r,i,a,o){var s,l,u,c,d,h,p;isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a||"none"!==(s=t.pstyle(n+"-arrow-shape").value)&&(l="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",u=t.pstyle(n+"-arrow-fill").value,c=t.pstyle("width").pfValue,d="match-line"===(p=t.pstyle(n+"-arrow-width")).value?c:p.pfValue,"%"===p.units&&(d*=c),p=t.pstyle("opacity").value,h=e.globalCompositeOperation,1===(o=void 0===o?p:o)&&"hollow"!==u||(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,d,r,i,a),e.globalCompositeOperation=h),p=t.pstyle(n+"-arrow-color").value,this.colorFillStyle(e,p[0],p[1],p[2],o),this.colorStrokeStyle(e,p[0],p[1],p[2],o),this.drawArrowShape(t,e,u,c,s,d,r,i,a))},Hd.drawArrowShape=function(e,t,n,r,i,a,o,s,l){var u,c,d,h=this.usePaths()&&"triangle-cross"!==i,p=!1,f=t,g={x:o,y:s},v=(e=e.pstyle("arrow-scale").value,e=this.getArrowWidth(r,e),this.arrowShapes[i]);h&&(null!=(d=(c=this.arrowPathCache=this.arrowPathCache||[])[i=qe(i)])?(u=t=d,p=!0):(u=t=new Path2D,c[i]=u)),p||(t.beginPath&&t.beginPath(),h?v.draw(t,1,0,{x:0,y:0},1):v.draw(t,e,l,g,r),t.closePath&&t.closePath()),t=f,h&&(t.translate(o,s),t.rotate(l),t.scale(e,e)),"filled"!==n&&"both"!==n||(h?t.fill(u):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=a/(h?e:1),t.lineJoin="miter",h?t.stroke(u):t.stroke()),h&&(t.scale(1/e,1/e),t.rotate(-l),t.translate(-o,-s))},{}),Zd=(Gd.safeDrawImage=function(e,t,n,r,i,a,o,s,l,u){if(!(i<=0||a<=0||l<=0||u<=0))try{e.drawImage(t,n,r,i,a,o,s,l,u)}catch(e){lt(e)}},Gd.drawInscribedImage=function(e,t,n,r,i){var a,o,s,l,u=(c=n.position()).x,c=c.y,d=(l=(l=n.cy().style()).getIndexedStyle.bind(l))(n,"background-fit","value",r),h=l(n,"background-repeat","value",r),p=n.width(),f=n.height(),g=2*n.padding(),v=(p=p+("inner"===l(n,"background-width-relative-to","value",r)?0:g),f=f+("inner"===l(n,"background-height-relative-to","value",r)?0:g),g=n._private.rscratch,"node"===l(n,"background-clip","value",r)),y=(i=l(n,"background-image-opacity","value",r)*i,l(n,"background-image-smoothing","value",r)),m=n.pstyle("corner-radius").value,b=("auto"!==m&&(m=n.pstyle("corner-radius").pfValue),t.width||t.cachedW),x=t.height||t.cachedH,w=(null!=b&&null!=x||(document.body.appendChild(t),b=t.cachedW=t.width||t.offsetWidth,x=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t)),b),E=x;"auto"!==l(n,"background-width","value",r)&&(w="%"===l(n,"background-width","units",r)?l(n,"background-width","pfValue",r)*p:l(n,"background-width","pfValue",r)),"auto"!==l(n,"background-height","value",r)&&(E="%"===l(n,"background-height","units",r)?l(n,"background-height","pfValue",r)*f:l(n,"background-height","pfValue",r)),0!==w&&0!==E&&("contain"===d?(w*=a=Math.min(p/w,f/E),E*=a):"cover"===d&&(w*=a=Math.max(p/w,f/E),E*=a),d=u-p/2,a=l(n,"background-position-x","units",r),o=l(n,"background-position-x","pfValue",r),d+="%"===a?(p-w)*o:o,a=l(n,"background-offset-x","units",r),o=l(n,"background-offset-x","pfValue",r),d+="%"===a?(p-w)*o:o,a=c-f/2,o=l(n,"background-position-y","units",r),s=l(n,"background-position-y","pfValue",r),a+="%"===o?(f-E)*s:s,o=l(n,"background-offset-y","units",r),s=l(n,"background-offset-y","pfValue",r),a+="%"===o?(f-E)*s:s,g.pathCache&&(d-=u,a-=c,c=u=0),l=e.globalAlpha,e.globalAlpha=i,r=this.getImgSmoothing(e),o=!1,"no"===y&&r?(this.setImgSmoothing(e,!1),o=!0):"yes"!==y||r||(this.setImgSmoothing(e,!0),o=!0),"no-repeat"===h?(v&&(e.save(),g.pathCache?e.clip(g.pathCache):(this.nodeShapes[this.getNodeShape(n)].draw(e,u,c,p,f,m,g),e.clip())),this.safeDrawImage(e,t,0,0,b,x,d,a,w,E),v&&e.restore()):(s=e.createPattern(t,h),e.fillStyle=s,this.nodeShapes[this.getNodeShape(n)].draw(e,u,c,p,f,m,g),e.translate(d,a),e.fill(),e.translate(-d,-a)),e.globalAlpha=l,o)&&this.setImgSmoothing(e,r)},{});function $d(e,t,n,r,i){var a=Math.min(5<arguments.length&&void 0!==arguments[5]?arguments[5]:5,r/2,i/2);e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}Zd.eleTextBiggerThanMin=function(e,t){var n,r;return t||(r=e.cy().zoom(),n=this.getPixelRatio(),r=Math.ceil(Gt(r*n)),t=Math.pow(2,r)),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},Zd.drawElementText=function(e,t,n,r,i){var a=!(5<arguments.length&&void 0!==arguments[5])||arguments[5];if(null==r){if(a&&!this.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){if(!(o=t.pstyle("label"))||!o.value)return;o=this.getLabelJustification(t),e.textAlign=o}else{var o=t.element()._private.rscratch.badLine,s=t.pstyle("label"),l=t.pstyle("source-label"),u=t.pstyle("target-label");if(o||(!s||!s.value)&&(!l||!l.value)&&(!u||!u.value))return;e.textAlign="center"}e.textBaseline="bottom";var c;o=!n;n&&e.translate(-(c=n).x1,-c.y1),null==i?(this.drawText(e,t,null,o,a),t.isEdge()&&(this.drawText(e,t,"source",o,a),this.drawText(e,t,"target",o,a))):this.drawText(e,t,i,o,a),n&&e.translate(c.x1,c.y1)},Zd.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return this.fontCaches.push(t={context:e}),t},Zd.setupTextStyle=function(e,t){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=(n=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,t.pstyle("text-outline-opacity").value*n),l=t.pstyle("color").value,u=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],n),this.colorStrokeStyle(e,u[0],u[1],u[2],s)},Zd.getTextAngle=function(e,t){var n=e._private.rscratch,r=e.pstyle((t?t+"-":"")+"text-rotation");return"autorotate"===r.strValue?(n=yt(n,"labelAngle",t),e.isEdge()?n:0):"none"===r.strValue?0:r.pfValue},Zd.drawText=function(e,t,n){var r=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],i=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){var s,l,u=yt(a,"labelX",n="main"===n?null:n),c=yt(a,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);i=n?n+"-":"";var h=yt(a,"labelWidth",n),p=yt(a,"labelHeight",n),f=t.pstyle(i+"text-margin-x").pfValue,g=(i=t.pstyle(i+"text-margin-y").pfValue,t.isEdge()),v=t.pstyle("text-halign").value,y=t.pstyle("text-valign").value;switch(g&&(y=v="center"),u+=f,c+=i,0!==(g=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(g),c=u=0),y){case"top":break;case"center":c+=p/2;break;case"bottom":c+=p}f=t.pstyle("text-background-opacity").value,i=t.pstyle("text-border-opacity").value;var m=t.pstyle("text-border-width").pfValue,b=(r=t.pstyle("text-background-padding").pfValue,"round-rectangle"===(x=t.pstyle("text-background-shape").strValue)||"roundrectangle"===x),x="circle"===x;if(0<f||0<m&&0<i){var w=e.fillStyle,E=e.strokeStyle,k=e.lineWidth,T=t.pstyle("text-background-color").value,C=t.pstyle("text-border-color").value,P=t.pstyle("text-border-style").value,S=0<f,B=0<m&&0<i,D=u-r;switch(v){case"left":D-=h;break;case"center":D-=h/2}var _=c-p-r,A=h+2*r;r=p+2*r;if(S&&(e.fillStyle="rgba(".concat(T[0],",").concat(T[1],",").concat(T[2],",").concat(f*o,")")),B&&(e.strokeStyle="rgba(".concat(C[0],",").concat(C[1],",").concat(C[2],",").concat(i*o,")"),e.lineWidth=m,e.setLineDash))switch(P){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=m/4,e.setLineDash([]);break;default:e.setLineDash([])}b?(e.beginPath(),$d(e,D,_,A,r,2)):x?(e.beginPath(),function(e,t,n,r,i){var a=Math.min(r,i)/2;t+=r/2,r=n+i/2,e.beginPath(),e.arc(t,r,a,0,2*Math.PI),e.closePath()}(e,D,_,A,r)):(e.beginPath(),e.rect(D,_,A,r)),S&&e.fill(),B&&e.stroke(),B&&"double"===P&&(T=m/2,e.beginPath(),b?$d(e,D+T,_+T,A-2*T,r-2*T,2):e.rect(D+T,_+T,A-2*T,r-2*T),e.stroke()),e.fillStyle=w,e.strokeStyle=E,e.lineWidth=k,e.setLineDash&&e.setLineDash([])}var M=2*t.pstyle("text-outline-width").pfValue;if(0<M&&(e.lineWidth=M),"wrap"===t.pstyle("text-wrap").value){var R=yt(a,"labelWrapCachedLines",n),I=yt(a,"labelLineHeight",n);f=h/2;switch("auto"!==(C=this.getLabelJustification(t))&&("left"===v?"left"===C?u+=-h:"center"===C&&(u+=-f):"center"===v?"left"===C?u+=-f:"right"===C&&(u+=f):"right"===v&&("center"===C?u+=f:"right"===C&&(u+=h))),y){case"top":case"center":case"bottom":c-=(R.length-1)*I}for(var N=0;N<R.length;N++)0<M&&e.strokeText(R[N],u,c),e.fillText(R[N],u,c),c+=I}else 0<M&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==g&&(e.rotate(-g),e.translate(-s,-l))}}};var Qd,Jd={},eh=(Jd.drawNode=function(e,t,n){var r=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],i=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],a=!(5<arguments.length&&void 0!==arguments[5])||arguments[5],o=this,s=t._private,l=s.rscratch,u=t.position();if(G(u.x)&&G(u.y)&&(!a||t.visible())){var c,d=a?t.effectiveOpacity():1,h=o.usePaths(),p=!1,f=(a=t.padding(),t.width()+2*a),g=t.height()+2*a;n&&e.translate(-(c=n).x1,-c.y1);for(var v=t.pstyle("background-image").value,y=new Array(v.length),m=new Array(v.length),b=0,x=0;x<v.length;x++){var w,E=v[x];(y[x]=null!=E&&"none"!==E)&&(w=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",x),b++,m[x]=o.getCachedImage(E,w,(function(){s.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})))}function k(){o.eleFillStyle(e,t,0<arguments.length&&void 0!==arguments[0]?arguments[0]:O)}function T(){o.colorStrokeStyle(e,V[0],V[1],V[2],0<arguments.length&&void 0!==arguments[0]?arguments[0]:U)}function C(){o.colorStrokeStyle(e,K[0],K[1],K[2],0<arguments.length&&void 0!==arguments[0]?arguments[0]:$)}function P(){var n;p||(n=h?{x:0,y:0}:u,o.nodeShapes[o.getNodeShape(t)].draw(R||e,n.x,n.y,f,g,J,l)),h?e.fill(R):e.fill()}function S(){for(var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:d,r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=s.backgrounding,a=0,l=0;l<m.length;l++){var u=t.cy().style().getIndexedStyle(t,"background-image-containment","value",l);r&&"over"===u||!r&&"inside"===u?a++:y[l]&&m[l].complete&&!m[l].error&&(a++,o.drawInscribedImage(e,m[l],t,l,n))}s.backgrounding=!(a===b),i!==s.backgrounding&&t.updateStyle(!1)}function B(){var n=0<arguments.length&&void 0!==arguments[0]&&arguments[0],r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:d;o.hasPie(t)&&(o.drawPie(e,t,r),n)&&!h&&o.nodeShapes[o.getNodeShape(t)].draw(e,u.x,u.y,f,g,J,l)}function D(){var n=0<arguments.length&&void 0!==arguments[0]&&arguments[0],r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:d;o.hasStripe(t)&&(e.save(),h?e.clip(l.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,u.x,u.y,f,g,J,l),e.clip()),o.drawStripe(e,t,r),e.restore(),n)&&!h&&o.nodeShapes[o.getNodeShape(t)].draw(e,u.x,u.y,f,g,J,l)}function _(){var t=0<L?0:255;0!==L&&(o.colorFillStyle(e,t,t,t,(0<L?L:-L)*(0<arguments.length&&void 0!==arguments[0]?arguments[0]:d)),h?e.fill(R):e.fill())}function A(){if(0<z){if(e.lineWidth=z,e.lineCap=j,e.lineJoin=X,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(q),e.lineDashOffset=W;break;case"solid":case"double":e.setLineDash([])}var t;"center"!==Y?(e.save(),e.lineWidth*=2,"inside"===Y?h?e.clip(R):e.clip():((t=new Path2D).rect(-f/2-z,-g/2-z,f+2*z,g+2*z),t.addPath(R),e.clip(t,"evenodd")),h?e.stroke(R):e.stroke(),e.restore()):h?e.stroke(R):e.stroke(),"double"===F&&(e.lineWidth=z/3,t=e.globalCompositeOperation,e.globalCompositeOperation="destination-out",h?e.stroke(R):e.stroke(),e.globalCompositeOperation=t),e.setLineDash&&e.setLineDash([])}}function M(){if(0<H){if(e.lineWidth=H,e.lineCap="butt",e.setLineDash)switch(Z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n,r=u,i=(h&&(r={x:0,y:0}),o.getNodeShape(t)),a="inside"===Y?0:z,s=("outside"===Y&&(a*=2),(f+a+(H+Q))/f),l=(g+a+(H+Q))/g,c=f*s,d=g*l,p=o.nodeShapes[i].points;if(h&&(n=ee(c,d,i,p).path),"ellipse"===i)o.drawEllipsePath(n||e,r.x,r.y,c,d);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){for(var v=0,y=0,m=0,b=("round-diamond"===i?v=1.4*(a+Q+H):"round-heptagon"===i?(v=1.075*(a+Q+H),m=-(a/2+Q+H)/35):"round-hexagon"===i?v=1.12*(a+Q+H):"round-pentagon"===i?(v=1.13*(a+Q+H),m=-(a/2+Q+H)/15):"round-tag"===i?(v=1.12*(a+Q+H),y=.07*(a/2+H+Q)):"round-triangle"===i&&(v=(a+Q+H)*(Math.PI/2),m=-(a+Q/2+H)/Math.PI),0!==v&&(c=f*(s=(f+v)/f),["round-hexagon","round-tag"].includes(i)||(d=g*(l=(g+v)/g))),c/2),x=d/2,w=(J="auto"===J?zn(c,d):J)+(a+H+Q)/2,E=new Array(p.length/2),k=new Array(p.length/2),T=0;T<p.length/2;T++)E[T]={x:r.x+y+b*p[2*T],y:r.y+m+x*p[2*T+1]};for(var C,P,S=E.length,B=E[S-1],D=0;D<S;D++)C=E[D%S],P=E[(D+1)%S],k[D]=Zc(B,C,P,w),B=C;o.drawRoundPolygonPath(n||e,r.x+y,r.y+m,f*s,g*l,p,k)}else["roundrectangle","round-rectangle"].includes(i)?(J="auto"===J?Ln(c,d):J,o.drawRoundRectanglePath(n||e,r.x,r.y,c,d,J+(a+H+Q)/2)):["cutrectangle","cut-rectangle"].includes(i)?(J="auto"===J?8:J,o.drawCutRectanglePath(n||e,r.x,r.y,c,d,null,J+(a+H+Q)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(i)?(J="auto"===J?Ln(c,d):J,o.drawBottomRoundRectanglePath(n||e,r.x,r.y,c,d,J+(a+H+Q)/2)):"barrel"===i?o.drawBarrelPath(n||e,r.x,r.y,c,d):(p=i.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(i)?Tn(Cn(p,(a+H+Q)/f)):Tn(Cn(p,-(a+H+Q)/f)),o.drawPolygonPath(n||e,r.x,r.y,f,g,p));h?e.stroke(n):e.stroke(),"double"===Z&&(e.lineWidth=a/3,v=e.globalCompositeOperation,e.globalCompositeOperation="destination-out",h?e.stroke(n):e.stroke(),e.globalCompositeOperation=v),e.setLineDash&&e.setLineDash([])}}var R,I,N,L=t.pstyle("background-blacken").value,z=t.pstyle("border-width").pfValue,O=t.pstyle("background-opacity").value*d,V=t.pstyle("border-color").value,F=t.pstyle("border-style").value,X=t.pstyle("border-join").value,j=t.pstyle("border-cap").value,Y=t.pstyle("border-position").value,q=t.pstyle("border-dash-pattern").pfValue,W=t.pstyle("border-dash-offset").pfValue,U=t.pstyle("border-opacity").value*d,H=t.pstyle("outline-width").pfValue,K=t.pstyle("outline-color").value,Z=t.pstyle("outline-style").value,$=t.pstyle("outline-opacity").value*d,Q=t.pstyle("outline-offset").value,J=t.pstyle("corner-radius").value,ee=("auto"!==J&&(J=t.pstyle("corner-radius").pfValue),function(e,t,n,r){var i,a=o.nodePathCache=o.nodePathCache||[];r=We("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+J),t=!1;return null!=(n=a[r])?(t=!0,l.pathCache=i=n):(i=new Path2D,a[r]=l.pathCache=i),{path:i,cacheHit:t}}),te=(a=t.pstyle("shape").strValue,t.pstyle("shape-polygon-points").pfValue);h&&(e.translate(u.x,u.y),a=ee(f,g,a,te),R=a.path,p=a.cacheHit),"yes"===t.pstyle("ghost").value&&(te=t.pstyle("ghost-offset-x").pfValue,a=t.pstyle("ghost-offset-y").pfValue,N=(I=t.pstyle("ghost-opacity").value)*d,e.translate(te,a),C(),M(),k(I*O),P(),S(N,!0),T(I*U),A(),B(0!==L||0!==z),D(0!==L||0!==z),S(N,!1),_(N),e.translate(-te,-a)),h&&e.translate(-u.x,-u.y),i&&o.drawNodeUnderlay(e,t,u,f,g),h&&e.translate(u.x,u.y),C(),M(),k(),P(),S(d,!0),T(),A(),B(0!==L||0!==z),D(0!==L||0!==z),S(d,!1),_(),h&&e.translate(-u.x,-u.y),o.drawElementText(e,t,null,r),i&&o.drawNodeOverlay(e,t,u,f,g),n&&e.translate(c.x1,c.y1)}},function(e){if(["overlay","underlay"].includes(e))return function(t,n,r,i,a){var o,s,l,u,c,d;n.visible()&&(o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value,c=n.pstyle("".concat(e,"-corner-radius")).value,0<s)&&(r=r||n.position(),null!=i&&null!=a||(d=n.padding(),i=n.width()+2*d,a=n.height()+2*d),this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill())};throw new Error("Invalid state")}),th=(Jd.drawNodeOverlay=eh("overlay"),Jd.drawNodeUnderlay=eh("underlay"),Jd.hasPie=function(e){return(e=e[0])._private.hasPie},Jd.hasStripe=function(e){return(e=e[0])._private.hasStripe},Jd.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i,a=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,u=r.x,c=r.y,d=(r=t.width(),t.height()),h=Math.min(r,d)/2,p=0;if((r=this.usePaths())&&(c=u=0),"%"===o.units?h*=o.pfValue:void 0!==o.pfValue&&(h=o.pfValue/2),"%"===s.units?i=h*s.pfValue:void 0!==s.pfValue&&(i=s.pfValue/2),!(h<=i))for(var f=1;f<=a.pieBackgroundN;f++){var g=t.pstyle("pie-"+f+"-background-size").value,v=t.pstyle("pie-"+f+"-background-color").value,y=t.pstyle("pie-"+f+"-background-opacity").value*n,m=g/100,b=(1<m+p&&(m=1-p),1.5*Math.PI+2*Math.PI*p),x=(b+=l,2*Math.PI*m);x=b+x;0===g||1<=p||1<p+m||(0===i?(e.beginPath(),e.moveTo(u,c),e.arc(u,c,h,b,x)):(e.beginPath(),e.arc(u,c,h,b,x),e.arc(u,c,i,x,b,!0)),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],y),e.fill(),p+=m)}},Jd.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=r.x,o=r.y,s=(r=t.width(),t.height()),l=0,u=this.usePaths(),c=(e.save(),t.pstyle("stripe-direction").value),d=t.pstyle("stripe-size");switch(c){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var h=r,p=s;"%"===d.units?(h*=d.pfValue,p*=d.pfValue):void 0!==d.pfValue&&(h=d.pfValue,p=d.pfValue),u&&(o=a=0),o-=h/2,a-=p/2;for(var f=1;f<=i.stripeBackgroundN;f++){var g=t.pstyle("stripe-"+f+"-background-size").value,v=t.pstyle("stripe-"+f+"-background-color").value,y=t.pstyle("stripe-"+f+"-background-opacity").value*n,m=g/100;1<m+l&&(m=1-l),0===g||1<=l||1<l+m||(e.beginPath(),e.rect(a,o+p*l,h,p*m),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],y),e.fill(),l+=m)}e.restore()},{});function nh(e,t,n){if(t=e.createShader(t),e.shaderSource(t,n),e.compileShader(t),e.getShaderParameter(t,e.COMPILE_STATUS))return t;throw new Error(e.getShaderInfoLog(t))}function rh(e,t,n){var r=e.makeOffscreenCanvas(t,n=void 0===n?t:n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function ih(e){var t=e.pixelRatio;return{zoom:e.cy.zoom()*t,pan:{x:(e=e.cy.pan()).x*t,y:e.y*t}}}function ah(e){return"solid"===e.pstyle("background-fill").value&&"none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)}function oh(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 sh(e,t,n){var r=e[0]/255,i=e[1]/255;e=e[2]/255;return(n=n||new Array(4))[0]=r*t,n[1]=i*t,n[2]=e*t,n[3]=t,n}function lh(e,t){return(t=t||new Array(4))[0]=(e>>0&255)/255,t[1]=(e>>8&255)/255,t[2]=(e>>16&255)/255,t[3]=(e>>24&255)/255,t}function uh(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function ch(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 dh(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function hh(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function ph(e,t,n,r){for(var i=(n=a(ch(e,n),3))[0],o=n[1],s=(n=n[2],dh(e,o,t*i)),l=i*n,u=e.createBuffer(),c=(e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*l,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,i,o,!1,l,0):o===e.INT&&e.vertexAttribIPointer(r,i,o,l,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null),new Array(t)),d=0;d<t;d++)c[d]=hh(e,o,s,l,i,d);return u.dataArray=s,u.stride=l,u.size=i,u.getView=function(e){return c[e]},u.setPoint=function(e,t,n){(e=c[e])[0]=t,e[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,s,0,t*i):e.bufferSubData(e.ARRAY_BUFFER,0,s)},u}th.getPixelRatio=function(){var e,t=this.data.contexts[0];return null!=this.forcedPixelRatio?this.forcedPixelRatio:(e=this.cy.window(),t=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,(e.devicePixelRatio||1)/t)},th.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&n.push(t={context:e}),t},th.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)a=n.isEdge()?(t=n.sourceEndpoint(),r=n.targetEndpoint(),u=n.midpoint(),t=$t(t,u),r=$t(r,u),e.createRadialGradient(u.x,u.y,0,u.x,u.y,Math.max(t,r))):(u=o?{x:0,y:0}:n.position(),t=n.paddedWidth(),r=n.paddedHeight(),e.createRadialGradient(u.x,u.y,0,u.x,u.y,Math.max(t,r)));else if(n.isEdge()){var u=n.sourceEndpoint();t=n.targetEndpoint();a=e.createLinearGradient(u.x,u.y,t.x,t.y)}else{var c=o?{x:0,y:0}:n.position(),d=n.paddedWidth()/2,h=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(c.x,c.y-h,c.x,c.y+h);break;case"to-top":a=e.createLinearGradient(c.x,c.y+h,c.x,c.y-h);break;case"to-left":a=e.createLinearGradient(c.x+d,c.y,c.x-d,c.y);break;case"to-right":a=e.createLinearGradient(c.x-d,c.y,c.x+d,c.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(c.x-d,c.y-h,c.x+d,c.y+h);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(c.x-d,c.y+h,c.x+d,c.y-h);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(c.x+d,c.y-h,c.x-d,c.y+h);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(c.x+d,c.y+h,c.x-d,c.y-h)}}if(!a)return null;for(var p=l.length===s.length,f=s.length,g=0;g<f;g++)a.addColorStop(p?l[g]:g/(f-1),"rgba("+s[g][0]+","+s[g][1]+","+s[g][2]+","+i+")");return a},th.gradientFillStyle=function(e,t,n,r){if(!(t=this.createGradientStyleFor(e,"background",t,n,r)))return null;e.fillStyle=t},th.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},th.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;"linear-gradient"===r||"radial-gradient"===r?this.gradientFillStyle(e,t,r,n):(r=t.pstyle("background-color").value,this.colorFillStyle(e,r[0],r[1],r[2],n))},th.gradientStrokeStyle=function(e,t,n,r){if(!(t=this.createGradientStyleFor(e,"line",t,n,r)))return null;e.strokeStyle=t},th.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},th.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;"linear-gradient"===r||"radial-gradient"===r?this.gradientStrokeStyle(e,t,r,n):(r=t.pstyle("line-color").value,this.colorStrokeStyle(e,r[0],r[1],r[2],n))},th.matchCanvasSize=function(e){var t,n=this,r=n.data,i=(o=n.findContainerClientCoords())[2],a=o[3],o=n.getPixelRatio(),s=n.motionBlurPxRatio,l=i*(o=e!==n.data.bufferCanvases[n.MOTIONBLUR_BUFFER_NODE]&&e!==n.data.bufferCanvases[n.MOTIONBLUR_BUFFER_DRAG]?o:s),u=a*o;if(l!==n.canvasWidth||u!==n.canvasHeight){n.fontCaches=null,(e=r.canvasContainer).style.width=i+"px",e.style.height=a+"px";for(var c=0;c<n.CANVAS_LAYERS;c++)(t=r.canvases[c]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";for(c=0;c<n.BUFFER_COUNT;c++)(t=r.bufferCanvases[c]).width=l,t.height=u,t.style.width=i+"px",t.style.height=a+"px";o<=(n.textureMult=1)&&(t=r.bufferCanvases[n.TEXTURE_BUFFER],n.textureMult=2,t.width=l*n.textureMult,t.height=u*n.textureMult),n.canvasWidth=l,n.canvasHeight=u,n.pixelRatio=o}},th.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},th.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},th.render=function(e){var t=this,n=(e=e||ht(),t.cy),r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=t.data,c=u.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),h=(void 0!==e.motionBlur?e:t).motionBlur,p=t.motionBlurPxRatio,f=n.hasCompoundNodes(),g=t.hoverData.draggingEles,v=!(!t.hoverData.selecting&&!t.touchData.selecting),y=h=h&&!r&&t.motionBlurEnabled&&!v,m=(v=(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&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(y=!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),n.style()),n.zoom()),b=void 0!==o?o:m,x=n.pan(),w={x:x.x,y:x.y},E={zoom:m,pan:{x:x.x,y:x.y}},k=(void 0===(k=t.prevViewport)||E.zoom!==k.zoom||E.pan.x!==k.pan.x||E.pan.y!==k.pan.y||g&&!f||(t.motionBlurPxRatio=1),b*=l,(w=s||w).x*=l,w.y*=l,t.getCachedZSortedEles());function T(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function C(e,n){var a,l,c,d=t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=w,l=b,c=t.canvasWidth,t.canvasHeight):(a={x:x.x*p,y:x.y*p},l=m*p,c=t.canvasWidth*p,t.canvasHeight*p);e.setTransform(1,0,0,1,0,0),"motionBlur"===n?T(e,0,0,c,d):r||void 0!==n&&!n||e.clearRect(0,0,c,d),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}d||(t.textureDrawLastFrame=!1),d?(t.textureDrawLastFrame=!0,t.textureCache||(t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER],(g=t.data.bufferContexts[t.TEXTURE_BUFFER]).setTransform(1,0,0,1,0,0),g.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:g,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult}),(E=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}),c[t.DRAG]=!1,c[t.NODE]=!1,P=u.contexts[t.NODE],f=t.textureCache.texture,E=t.textureCache.viewport,P.setTransform(1,0,0,1,0,0),h?T(P,0,0,E.width,E.height):P.clearRect(0,0,E.width,E.height),g=v.core("outside-texture-bg-color").value,v=v.core("outside-texture-bg-opacity").value,t.colorFillStyle(P,g[0],g[1],g[2],v),P.fillRect(0,0,E.width,E.height),m=n.zoom(),C(P,!1),P.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l),P.drawImage(f,E.mpan.x,E.mpan.y,E.width/E.zoom/l,E.height/E.zoom/l)):t.textureOnViewport&&!r&&(t.textureCache=null);var P,S;g=n.extent(),v=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),f=t.hideEdgesOnViewport&&v;(v=[])[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,v[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),v[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,v[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),(c[t.NODE]||i||a||v[t.NODE])&&(S=h&&!v[t.NODE]&&1!==p,C(P=r||(S?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),h&&!S?"motionBlur":void 0),f?t.drawCachedNodes(P,k.nondrag,l,g):t.drawLayeredElements(P,k.nondrag,l,g),t.debug&&t.drawDebugPoints(P,k.nondrag),i||h||(c[t.NODE]=!1)),!a&&(c[t.DRAG]||i||v[t.DRAG])&&(S=h&&!v[t.DRAG]&&1!==p,C(P=r||(S?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]),h&&!S?"motionBlur":void 0),f?t.drawCachedNodes(P,k.drag,l,g):t.drawCachedElements(P,k.drag,l,g),t.debug&&t.drawDebugPoints(P,k.drag),i||h||(c[t.DRAG]=!1)),this.drawSelectionRectangle(e,C),h&&1!==p&&(a=u.contexts[t.NODE],S=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],f=u.contexts[t.DRAG],l=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],g=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):T(e,0,0,t.canvasWidth,t.canvasHeight),e.drawImage(n,0,0,t.canvasWidth*p,t.canvasHeight*p,0,0,t.canvasWidth,t.canvasHeight)},(c[t.NODE]||v[t.NODE])&&(g(a,S,v[t.NODE]),c[t.NODE]=!1),c[t.DRAG]||v[t.DRAG])&&(g(f,l,v[t.DRAG]),c[t.DRAG]=!1),t.prevViewport=E,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()}),100)),r||n.emit("render")},th.drawSelectionRectangle=function(e,t){var n,r=this,i=r.cy,a=r.data,o=(i=i.style(),e.drawOnlyNodeLayer),s=e.drawAllLayers,l=a.canvasNeedsRedraw;e=e.forcedContext;(r.showFps||!o&&l[r.SELECT_BOX]&&!s)&&(t(o=e||a.contexts[r.SELECT_BOX]),1==r.selection[4]&&(r.hoverData.selecting||r.touchData.selecting)&&(n=r.cy.zoom(),t=i.core("selection-box-border-width").value/n,o.lineWidth=t,o.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+")",o.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),0<t)&&(o.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+")",o.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1])),a.bgActivePosistion&&!r.hoverData.selecting&&(n=r.cy.zoom(),e=a.bgActivePosistion,o.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+")",o.beginPath(),o.arc(e.x,e.y,i.core("active-bg-size").pfValue/n,0,2*Math.PI),o.fill()),t=r.lastRedrawTime,r.showFps&&t&&(e="1 frame = "+(t=Math.round(t))+" ms = "+(a=Math.round(1e3/t))+" fps",o.setTransform(1,0,0,1,0,0),o.fillStyle="rgba(255, 0, 0, 0.75)",o.strokeStyle="rgba(255, 0, 0, 0.75)",o.font="30px Arial",Qd||(i=o.measureText(e),Qd=i.actualBoundingBoxAscent),o.fillText(e,0,Qd),o.strokeRect(0,Qd+10,250,20),o.fillRect(0,Qd+10,250*Math.min(a/60,1),20)),s||(l[r.SELECT_BOX]=!1))};var fh="undefined"!=typeof Float32Array?Float32Array:Array;function gh(){var e=new fh(9);return fh!=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 vh(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 yh(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=(t=t[8],n[0]);n=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*r+n*o+u,e[7]=d*i+n*s+c,e[8]=d*a+n*l+t,e}function mh(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=(t=t[8],Math.sin(n));n=Math.cos(n);return e[0]=n*r+d*o,e[1]=n*i+d*s,e[2]=n*a+d*l,e[3]=n*o-d*r,e[4]=n*s-d*i,e[5]=n*l-d*a,e[6]=u,e[7]=c,e[8]=t,e}function bh(e,t,n){var r=n[0];n=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var xh=n((function e(n,r,i,a){t(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=n,this.texSize=r,this.texRows=i,this.texHeight=Math.floor(r/i),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(n,r,r),this.scratch=a(n,r,this.texHeight,"scratch")}),[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=(e=e.h,this.texHeight),r=this.texSize,i=t*(n/=e),a=e*n;return r<i&&(i=t*(n=r/t),a=e*n),{scale:n,texW:i,texH:a}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");function i(){m(r.freePointer,r.canvas),b[0]={x:r.freePointer.x,y:r.freePointer.row*p,w:v,h:y},b[1]={x:r.freePointer.x+v,y:r.freePointer.row*p,w:0,h:y},r.freePointer.x+=v,r.freePointer.x==d&&(r.freePointer.x=0,r.freePointer.row++)}var a,o,s,l,u,c,d=this.texSize,h=this.texRows,p=this.texHeight,f=this.getScale(t),g=f.scale,v=f.texW,y=f.texH,m=function(e,r){var i;n&&r&&(r=r.context,i=e.x,e=e.row,e*=p,r.save(),r.translate(i,e),r.scale(g,g),n(r,t),r.restore())},b=[null,null];if(this.freePointer.x+v<=d)i();else{if(this.freePointer.row>=h-1)return!1;this.freePointer.x!==d&&this.enableWrapping?(f=r.scratch,h=r.canvas,f.clear(),m({x:0,row:0},f),a=d-r.freePointer.x,o=v-a,s=p,l=r.freePointer.x,u=r.freePointer.row*p,c=a,h.context.drawImage(f,0,0,c,s,l,u,c,s),b[0]={x:l,y:u,w:c,h:y},l=(r.freePointer.row+1)*p,u=o,h&&h.context.drawImage(f,a,0,u,s,0,l,u,s),b[1]={x:0,y:l,w:u,h:y},r.freePointer.x=o,r.freePointer.row++):(r.freePointer.x=0,r.freePointer.row++,i())}return this.keyToLocation.set(e,b),this.needsBuffer=!0,b}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){var t,n;return!this.locked&&(t=this.texSize,n=this.texRows,e=this.getScale(e).texW,!(this.freePointer.x+e>t)||this.freePointer.row<n-1)}},{key:"bufferIfNeeded",value:function(e){var t,n;this.texture||(this.texture=(t=e,this.debugID,(n=t.createTexture()).buffer=function(e){t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},n.deleteTexture=function(){t.deleteTexture(n)},n)),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}}]),wh=n((function e(n,r,i,a){t(this,e),this.r=n,this.texSize=r,this.texRows=i,this.createTextureCanvas=a,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}),[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;return new xh(e,t,n,r)}},{key:"_getScratchCanvas",value:function(){var e,t,n,r;return this.scratch||(e=this.r,t=this.texSize,r=this.texRows,n=this.createTextureCanvas,r=Math.floor(t/r),this.scratch=n(e,t,r,"scratch")),this.scratch}},{key:"draw",value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||((r=this.atlases[this.atlases.length-1])&&r.canFit(t)||(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:"getAtlas",value:function(e){return this.styleKeyToAtlas.get(e)}},{key:"hasAtlas",value:function(e){return this.styleKeyToAtlas.has(e)}},{key:"markKeyForGC",value:function(e){this.markedKeys.add(e)}},{key:"gc",value:function(){var e=this,t=this.markedKeys;if(0===t.size)console.log("nothing to garbage collect");else{var n,i=[],o=new Map,s=null,l=r(this.atlases);try{for(l.s();!(n=l.n()).done;)!function(){var l=n.value,u=l.getKeys(),c=Eh(t,u);if(0===c.size)return i.push(l),u.forEach((function(e){return o.set(e,l)}));s||(s=e._createAtlas(),i.push(s));var d,h=r(u);try{for(h.s();!(d=h.n()).done;){var p,f,g,v=d.value;c.has(v)||(f=(p=a(l.getOffsets(v),2))[0],g=p[1],s.canFit({w:f.w+g.w,h:f.h})||(s.lock(),s=e._createAtlas(),i.push(s)),l.canvas&&(e._copyTextureToNewAtlas(v,l,s),o.set(v,s)))}}catch(u){h.e(u)}finally{h.f()}l.dispose()}()}catch(e){l.e(e)}finally{l.f()}this.atlases=i,this.styleKeyToAtlas=o,this.markedKeys=new Set}}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r,i,o,s,l=(s=a(t.getOffsets(e),2))[0];0===(s=s[1]).w?n.draw(e,l,(function(e){e.drawImage(t.canvas,l.x,l.y,l.w,l.h,0,0,l.w,l.h)})):((r=this._getScratchCanvas()).clear(),r.context.drawImage(t.canvas,l.x,l.y,l.w,l.h,0,0,l.w,l.h),r.context.drawImage(t.canvas,s.x,s.y,s.w,s.h,l.w,0,s.w,s.h),i=l.w+s.w,o=l.h,n.draw(e,{w:i,h:o},(function(e){e.drawImage(r,0,0,i,o,0,0,i,o)})))}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}]);function Eh(e,t){return e.intersection?e.intersection(t):new Set(o(e).filter((function(e){return t.has(e)})))}var kh=n((function e(n,r){t(this,e),this.r=n,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}),[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(e,t){var n=(r=this.globalOptions).webglTexSize,r=r.createTextureCanvas;t=t.texRows,r=this._cacheScratchCanvas(r),n=new wh(this.r,n,t,r),this.collections.set(e,n)}},{key:"addRenderType",value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));n=this.collections.get(n),n=ve({type:e,atlasCollection:n},t),this.renderTypes.set(e,n)}},{key:"getRenderTypeOpts",value:function(e){return this.renderTypes.get(e)}},{key:"getAtlasCollection",value:function(e){return this.collections.get(e)}},{key:"_cacheScratchCanvas",value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?r=r&&a==t&&o==n?r:e(i,t=a,n=o):e(i,a,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,n,i=this,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=void 0!==(n=a.forceRedraw)&&n,s=void 0===(n=a.filterEle)?function(){return!0}:n,l=void 0===(n=a.filterType)?function(){return!0}:n,u=!1,c=!1,d=r(e);try{for(d.s();!(t=d.n()).done;){var h=t.value;if(s(h)){var p,f=r(this.renderTypes.values());try{for(f.s();!(p=f.n()).done;)!function(){var e,t,n=p.value,r=n.type;l(r)&&(e=i.collections.get(n.collection),t=n.getKey(h),t=Array.isArray(t)?t:[t],o?(t.forEach((function(t){return e.markKeyForGC(t)})),c=!0):(n=n.getID?n.getID(h):h.id(),r=i._key(r,n),void 0===(n=i.typeAndIdToKey.get(r))||oh(t,n)||(u=!0,i.typeAndIdToKey.delete(r),n.forEach((function(t){return e.markKeyForGC(t)})))))}()}catch(e){f.e(e)}finally{f.f()}}}}catch(e){d.e(e)}finally{d.f()}return c&&(this.gc(),u=!1),u}},{key:"gc",value:function(){var e,t=r(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(e){t.e(e)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var i,a=this.renderTypes.get(t),o=this.collections.get(a.collection),s=!1;return o=o.draw(r,n,(function(t){a.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),a.drawElement(t,e,n,!0,!0),t.restore()):a.drawElement(t,e,n,!0,!0),s=!0})),s&&(i=a.getID?a.getID(e):e.id(),t=this._key(t,i),this.typeAndIdToKey.has(t)?this.typeAndIdToKey.get(t).push(r):this.typeAndIdToKey.set(t,[r])),o}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map((function(i){var o=r.getBoundingBox(e,i),s=n.getOrCreateAtlas(e,t,o,i),l=(i=a(s.getOffsets(i),2))[0];return{atlas:s,tex:l,tex1:l,tex2:i[1],bb:o}}))}},{key:"getDebugInfo",value:function(){var e,t=[],n=r(this.collections);try{for(n.s();!(e=n.n()).done;){var i=a(e.value,2),o=i[0],s=i[1].getCounts(),l=s.keyCount,u=s.atlasCount;t.push({type:o,keyCount:l,atlasCount:u})}}catch(e){n.e(e)}finally{n.f()}return t}}]),Th=n((function e(n){t(this,e),this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.batchAtlases=[]}),[{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(e,t){return t}))}},{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(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}]),Ch={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Ph=1,Sh=2,Bh=n((function e(n,r,i){t(this,e),this.r=n,this.gl=r,this.maxInstances=i.webglBatchSize,this.atlasSize=i.webglTexSize,this.bgColor=i.bgColor,this.debug=i.webglDebug,this.batchDebugInfo=[],i.enableWrapping=!0,i.createTextureCanvas=rh,this.atlasManager=new kh(n,i),this.batchManager=new Th(i),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ch.SCREEN),this.pickingProgram=this._createShaderProgram(Ch.PICKING),this.vao=this._createVAO()}),[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),i=function(e,t,n){t=nh(e,e.VERTEX_SHADER,t),n=nh(e,e.FRAGMENT_SHADER,n);var r=e.createProgram();if(e.attachShader(r,t),e.attachShader(r,n),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;throw new Error("Could not initialize shaders")}(t,n,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map((function(e){return"uniform sampler2D uTexture".concat(e,";")})).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x<q.y)? 1.570796327 : 0.0;\n for( int i=0; i<5; i++ ) {\n vec2 cs = vec2(cos(w),sin(w));\n vec2 u = ab*vec2( cs.x,cs.y);\n vec2 v = ab*vec2(-cs.y,cs.x);\n w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n }\n \n // compute final point and distance\n float d = length(p-ab*vec2(cos(w),sin(w)));\n \n // return signed distance\n return (dot(p/ab,p/ab)>1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map((function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")})).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,"uTexture".concat(a)));return i}},{key:"_createVAO",value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1],t=(this.vertexCount=e.length/2,this.maxInstances),n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),function(e,t,n,r){var i=(t=a(ch(e,t),2))[0],o=(r=dh(e,t=t[1],r),e.createBuffer());e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW),t===e.FLOAT?e.vertexAttribPointer(n,i,t,!1,0,0):t===e.INT&&e.vertexAttribIPointer(n,i,t,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null)}(n,"vec2",r.aPosition,e),this.transformBuffer=function(e,t,n){for(var r=new Float32Array(9*t),i=new Array(t),a=0;a<t;a++)i[a]=new Float32Array(r.buffer,9*a*4,9);var o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,r.byteLength,e.DYNAMIC_DRAW);for(var s=0;s<3;s++){var l=n+s;e.enableVertexAttribArray(l),e.vertexAttribPointer(l,3,e.FLOAT,!1,36,12*s),e.vertexAttribDivisor(l,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),o.getMatrixView=function(e){return i[e]},o.setData=function(e,t){i[t].set(e,0)},o.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferSubData(e.ARRAY_BUFFER,0,r)},o}(n,t,r.aTransform),this.indexBuffer=ph(n,t,"vec4",r.aIndex),this.vertTypeBuffer=ph(n,t,"int",r.aVertType),this.atlasIdBuffer=ph(n,t,"int",r.aAtlasId),this.texBuffer=ph(n,t,"vec4",r.aTex),this.pointAPointBBuffer=ph(n,t,"vec4",r.aPointAPointB),this.pointCPointDBuffer=ph(n,t,"vec4",r.aPointCPointD),this.lineWidthBuffer=ph(n,t,"vec2",r.aLineWidth),this.colorBuffer=ph(n,t,"vec4",r.aColor),this.cornerRadiusBuffer=ph(n,t,"vec4",r.aCornerRadius),this.borderColorBuffer=ph(n,t,"vec4",r.aBorderColor),n.bindVertexArray(null),i}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter((function(e){return ue(e,"Buffer")})).map((function(t){return e[t]}))),this._buffers}},{key:"startFrame",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Ch.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,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(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(e,s)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&s.getTexPickingMode){var l=s.getTexPickingMode(e);if(l===Ph)return;if(l==Sh)return void this.drawPickingRectangle(e,t,n)}var u,c=r(i.getAtlasInfo(e,n));try{for(c.s();!(u=c.n()).done;)for(var d=u.value,h=d.atlas,p=d.tex1,f=d.tex2,g=(o.canAddToCurrentBatch(h)||this.endBatch(),o.getAtlasIndexForBatch(h)),v=0,y=[[p,!0],[f,!1]];v<y.length;v++){var m,b,x,w=a(y[v],2),E=w[0],k=w[1];0!=E.w&&(m=this.instanceCount,this.vertTypeBuffer.getView(m)[0]=0,lh(t,this.indexBuffer.getView(m)),this.atlasIdBuffer.getView(m)[0]=g,(b=this.texBuffer.getView(m))[0]=E.x,b[1]=E.y,b[2]=E.w,b[3]=E.h,x=this.transformBuffer.getMatrixView(m),this.setTransformMatrix(e,x,s,d,k),this.instanceCount++,k||this.wrappedCount++,this.instanceCount>=this.maxInstances)&&this.endBatch()}}catch(e){c.e(e)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var i,a,o,s=!(4<arguments.length&&void 0!==arguments[4])||arguments[4],l=0;n.shapeProps&&n.shapeProps.padding&&(l=e.pstyle(n.shapeProps.padding).pfValue),r?(o=r.bb,i=r.tex1,a=r.tex2,i=i.w/(i.w+a.w),a=this._getAdjustedBB(o,l,s,i=s?i:1-i),this._applyTransformMatrix(t,a,n,e)):(o=n.getBoundingBox(e),s=this._getAdjustedBB(o,l,!0,1),this._applyTransformMatrix(t,s,n,e))}},{key:"_applyTransformMatrix",value:function(e,t,n,r){vh(e);var i,a,o=n.getRotation?n.getRotation(r):0;o=0!==o?(yh(e,e,[(i=n.getRotationPoint(r)).x,i.y]),mh(e,e,o),a=(i=n.getRotationOffset(r)).x+(t.xOffset||0),i.y+(t.yOffset||0)):(a=t.x1,t.y1),yh(e,e,[a,o]),bh(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,l=(t&&(i-=t,a-=t,o+=2*t,s+=2*t),t=0,o*r);return n&&r<1?o=l:!n&&r<1&&(i+=t=o-l,o=l),{x1:i,y1:a,w:o,h:s,xOffset:t,yOffset:e.yOffset}}},{key:"drawPickingRectangle",value:function(e,t,n){n=this.atlasManager.getRenderTypeOpts(n);var r=this.instanceCount;this.vertTypeBuffer.getView(r)[0]=4,lh(t,this.indexBuffer.getView(r)),sh([0,0,0],1,this.colorBuffer.getView(r)),t=this.transformBuffer.getMatrixView(r),this.setTransformMatrix(e,t,n),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r,i,a,o,s=this.simpleShapeOptions.get(n);this._isVisible(e,s)&&(o=s.shapeProps,void 0===(i=this._getVertTypeForShape(e,o.shape))||s.isSimple&&!s.isSimple(e)?this.drawTexture(e,t,n):(n=this.instanceCount,5!==(this.vertTypeBuffer.getView(n)[0]=i)&&6!==i||(r=s.getBoundingBox(e),r=this._getCornerRadius(e,o.radius,r),(a=this.cornerRadiusBuffer.getView(n))[0]=r,a[1]=r,a[2]=r,a[3]=r,6===i&&(a[0]=0,a[2]=0)),lh(t,this.indexBuffer.getView(n)),sh(e.pstyle(o.color).value,e.pstyle(o.opacity).value,this.colorBuffer.getView(n)),(r=this.lineWidthBuffer.getView(n))[0]=0,r[1]=0,o.border&&0<(i=e.pstyle("border-width").value)&&(sh(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(n)),"inside"===(a=e.pstyle("border-position").value)?(r[0]=0,r[1]=-i):"outside"===a?(r[0]=i,r[1]=0):(r[0]=t=i/2,r[1]=-t)),o=this.transformBuffer.getMatrixView(n),this.setTransformMatrix(e,o,s),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()))}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w;return n=n.h,"auto"===e.pstyle(t).value?Ln(r,n):(e=e.pstyle(t).pfValue,Math.min(e,n/2,r/2))}},{key:"drawEdgeArrow",value:function(e,t,n){var r,i,a,o,s,l;e.visible()&&(l=e._private.rscratch,l="source"===n?(r=l.arrowStartX,i=l.arrowStartY,l.srcArrowAngle):(r=l.arrowEndX,i=l.arrowEndY,l.tgtArrowAngle),isNaN(r)||null==r||isNaN(i)||null==i||isNaN(l)||null==l||"none"!==e.pstyle(n+"-arrow-shape").value&&(n=e.pstyle(n+"-arrow-color").value,a=e.pstyle("opacity").value*e.pstyle("line-opacity").value,o=e.pstyle("width").pfValue,e=e.pstyle("arrow-scale").value,o=this.r.getArrowWidth(o,e),e=this.instanceCount,vh(s=this.transformBuffer.getMatrixView(e)),yh(s,s,[r,i]),bh(s,s,[o,o]),mh(s,s,l),this.vertTypeBuffer.getView(e)[0]=3,lh(t,this.indexBuffer.getView(e)),sh(n,a,this.colorBuffer.getView(e)),this.instanceCount++,this.instanceCount>=this.maxInstances)&&this.endBatch())}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length)e=this.instanceCount,this.vertTypeBuffer.getView(e)[0]=1,lh(t,this.indexBuffer.getView(e)),sh(o,s,this.colorBuffer.getView(e)),this.lineWidthBuffer.getView(e)[0]=a,(r=this.pointAPointBBuffer.getView(e))[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch();else for(var l=0;l<n.length-2;l+=2){var u=this.instanceCount;this.vertTypeBuffer.getView(u)[0]=2,lh(t,this.indexBuffer.getView(u)),sh(o,s,this.colorBuffer.getView(u)),this.lineWidthBuffer.getView(u)[0]=a;var c=n[l-2],d=n[l-1],h=n[l],p=n[l+1],f=n[l+2],g=n[l+3],v=n[l+4],y=n[l+5],m=(0==l&&(c=2*h-f+.001,d=2*p-g+.001),l==n.length-4&&(v=2*f-h+.001,y=2*g-p+.001),this.pointAPointBBuffer.getView(u));(m[0]=c,m[1]=d,m[2]=h,m[3]=p,c=this.pointCPointDBuffer.getView(u))[0]=f,c[1]=g,c[2]=v,c[3]=y,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){return!(e=e._private.rscratch).badLine&&null!=e.allpts&&!isNaN(e.allpts[0])}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e))return 4==(t=t.allpts).length?t:(e=this._getNumSegments(e),this._getCurveSegmentPoints(t,e))}},{key:"_getNumSegments",value:function(e){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)0==r?(n[0]=e[0],n[1]=e[1]):r==t?(n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1]):this._setCurvePoint(e,r/t,n,2*r);return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}n[r]=e[0],n[r+1]=e[1]}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,i=this.instanceCount;if(0!==i){var a,o=this.renderTarget.picking?this.pickingProgram:this.program,s=(e.useProgram(o),e.bindVertexArray(t),r(this.buffers));try{for(s.s();!(a=s.n()).done;)a.value.bufferSubData(i)}catch(e){s.e(e)}finally{s.f()}for(var l=this.batchManager.getAtlases(),u=0;u<l.length;u++)l[u].bufferIfNeeded(e);for(var c=0;c<l.length;c++)e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,l[c].texture),e.uniform1i(o.uTextures[c],c);e.uniform1f(o.uZoom,function(e){var t=e.pixelRatio;return e.cy.zoom()*t}(this.r)),e.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize()),t=sh(this.bgColor,1),e.uniform4fv(o.uBGColor,t),e.drawArraysInstanced(e.TRIANGLES,0,n,i),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:l.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce((function(e,t){return e+t.atlasCount}),0),n=this.batchDebugInfo,r=n.reduce((function(e,t){return e+t.count}),0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}]),Dh={};function _h(e,t){return e=e._private.rscratch,yt(e,"labelWrapCachedLines",t)||[]}Dh.initWebgl=function(e,t){function n(e){return function(t){return u.getTextAngle(t,e)}}function i(e){return function(t){return(t=t.pstyle(e))&&t.value}}function o(e){return function(t){return 0<t.pstyle("".concat(e,"-opacity")).value}}function s(e){return"yes"===e.pstyle("text-events").strValue?Sh:Ph}function l(e){var t=(n=e.position()).x,n=n.y,r=e.outerWidth();return{w:r,h:e=e.outerHeight(),x1:t-r/2,y1:n-e/2}}var u=this,c=u.data.contexts[u.WEBGL],d=(e.bgColor=function(e){return e=(e=e.cy.container())&&e.style&&e.style.backgroundColor||"white",ye(e)}(u),e.webglTexSize=Math.min(e.webglTexSize,c.getParameter(c.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,c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS)),u.webglDebug=e.webglDebug,u.webglDebugShowAtlases=e.webglDebugShowAtlases,u.pickingFrameBuffer=function(e){var t=e.createFramebuffer(),n=(e.bindFramebuffer(e.FRAMEBUFFER,t),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(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}(c),u.pickingFrameBuffer.needsDraw=!0,u.drawing=new Bh(u,c,e),u.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),u.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),u.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),u.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:ah,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),u.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"}}),u.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"}}),u.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Ah(t.getLabelKey,null),getBoundingBox:Mh(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:n(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:i("label")}),u.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Ah(t.getSourceLabelKey,"source"),getBoundingBox:Mh(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:n("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:i("source-label")}),u.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Ah(t.getTargetLabelKey,"target"),getBoundingBox:Mh(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:n("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:i("target-label")}),_e((function(){console.log("garbage collect flag set"),u.data.gc=!0}),1e4));u.onUpdateEleCalcs((function(e,t){var n=!1;t&&0<t.length&&(n|=u.drawing.invalidate(t)),n&&d()})),function(e){var t=e.render,n=(e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>Td?(function(e){e=e.data.contexts[e.WEBGL],e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}(e),t.call(e,n)):(function(e){function t(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()}t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}(e),Nh(e,n,Ch.SCREEN)))},e.matchCanvasSize),i=(e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,i,o){return function(e,t,n){t=function(e,t,n,r,i){for(var o=ih(e),s=(t=(o=a(function(e,t,n,r,i){return r=r*n+t.x,i=i*n+t.y,[r,Math.round(e.canvasHeight-i)]}(e,o.pan,o.zoom,t,n),2))[0]-3,n=o[1]-3,(o=e.data.contexts[e.WEBGL]).bindFramebuffer(o.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(o.viewport(0,0,o.canvas.width,o.canvas.height),Nh(e,null,Ch.PICKING),e.pickingFrameBuffer.needsDraw=!1),new Uint8Array(144)),l=(o.readPixels(t,n,6,6,o.RGBA,o.UNSIGNED_BYTE,s),o.bindFramebuffer(o.FRAMEBUFFER,null),new Set),u=0;u<36;u++){var c=uh(s.slice(4*u,4*u+4))-1;0<=c&&l.add(c)}return l}(e,t,n);var i,o,s,l=e.getCachedZSortedEles(),u=r(t);try{for(u.s();!(s=u.n()).done;){var c=l[s.value];if(!i&&c.isNode()&&(i=c),!o&&c.isEdge()&&(o=c),i&&o)break}}catch(e){u.e(e)}finally{u.f()}return[i,o].filter(Boolean)}(e,t,n)},e.invalidateCachedZSortedEles),o=(e.invalidateCachedZSortedEles=function(){i.call(e),e.pickingFrameBuffer.needsDraw=!0},e.notify);e.notify=function(t,n){o.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.drawing.invalidate(n,{type:"node-body"})}}(u)};var Ah=function(e,t){return function(n){var r=e(n);return 1<(n=_h(n,t)).length?n.map((function(e,t){return"".concat(r,"_").concat(t)})):r}},Mh=function(e,t){return function(n,r){var i=e(n);if("string"==typeof r){var a=r.indexOf("_");if(0<a)return r=Number(r.substring(a+1)),a=_h(n,t),n=i.h/a.length,r=i.y1+(a=n*r),{x1:i.x1,w:i.w,y1:r,h:n,yOffset:a}}return i}};function Rh(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=(e=ih(e)).pan;e=e.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(e,e)}function Ih(e,t,n){e=e.drawing,t+=1,n.isNode()?(e.drawNode(n,t,"node-underlay"),e.drawNode(n,t,"node-body"),e.drawTexture(n,t,"label"),e.drawNode(n,t,"node-overlay")):(e.drawEdgeLine(n,t),e.drawEdgeArrow(n,t,"source"),e.drawEdgeArrow(n,t,"target"),e.drawTexture(n,t,"label"),e.drawTexture(n,t,"edge-source-label"),e.drawTexture(n,t,"edge-target-label"))}function Nh(e,t,n){e.webglDebug&&(c=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(e,t){e.drawSelectionRectangle(t,(function(t){return Rh(e,t)}))}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){t=e.data.contexts[e.WEBGL],t=(n.screen?(t.clearColor(0,0,0,0),t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)):t.disable(t.BLEND),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.viewport(0,0,t.canvas.width,t.canvas.height),function(e){var t=e.canvasWidth,n=e.canvasHeight,r=(e=ih(e)).pan,i=(e=e.zoom,gh());return function(e,t,n){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}((yh(i,i,[r.x,r.y]),bh(i,i,[e,e]),r=gh()),t,n),e=gh(),function(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=(t=t[8],n[0]),h=n[1],p=n[2],f=n[3],g=n[4],v=n[5],y=n[6],m=n[7];n=n[8],e[0]=d*r+h*o+p*u,e[1]=d*i+h*s+p*c,e[2]=d*a+h*l+p*t,e[3]=f*r+g*o+v*u,e[4]=f*i+g*s+v*c,e[5]=f*a+g*l+v*t,e[6]=y*r+m*o+n*u,e[7]=y*i+m*s+n*c,e[8]=y*a+m*l+n*t}(e,r,i),e}(e));var o=e.getCachedZSortedEles();a=o.length;if(i.startFrame(t,n),n.screen){for(var s=0;s<o.nondrag.length;s++)Ih(e,s,o.nondrag[s]);for(var l=0;l<o.drag.length;l++)Ih(e,l,o.drag[l])}else if(n.picking)for(var u=0;u<o.length;u++)Ih(e,u,o[u]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(function(e){var t=e.data.contexts[e.NODE];t.save(),Rh(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()}(e),function(e){function t(t,n,r){t=t.atlasManager.getAtlasCollection(n);for(var i=e.data.contexts[e.NODE],a=t.atlases,o=0;o<a.length;o++){var s,l,u,c,d=a[o].canvas;d&&(s=d.width,l=d.height,u=s*o,c=d.height*r,i.save(),i.scale(.4,.4),i.drawImage(d,u,c),i.strokeStyle="black",i.rect(u,c,s,l),i.stroke(),i.restore())}}t(e.drawing,"node",0),t(e.drawing,"label",1)}(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){t=performance.now(),t=Math.ceil(t-c);var c=i.getDebugInfo();a=["".concat(a," elements"),"".concat(c.totalInstances," instances"),"".concat(c.batchCount," batches"),"".concat(c.totalAtlases," atlases"),"".concat(c.wrappedCount," wrapped textures"),"".concat(c.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(n.name,") - frame time ").concat(t,"ms")),console.log("Totals:"),console.log(" ".concat(a)),console.log("Texture Atlases Used:");var d,h=r(c.atlasInfo);try{for(h.s();!(d=h.n()).done;){var p=d.value;console.log(" ".concat(p.type,": ").concat(p.keyCount," keys, ").concat(p.atlasCount," atlases"))}}catch(e){h.e(e)}finally{h.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,i.gc())}for(var Lh={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,i,a,o){o.forEach((function(t){return Gc(e,t)})),e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i,a){var o=r/2,s=i/2;r="auto"===a?Ln(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,r),e.arcTo(t+o,n+s,t,n+s,r),e.arcTo(t-o,n+s,t-o,n,r),e.arcTo(t-o,n-s,t,n-s,r),e.lineTo(t,n-s),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,i,a){var o=r/2,s=i/2;r="auto"===a?Ln(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,r),e.arcTo(t-o,n+s,t-o,n,r),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},drawCutRectanglePath:function(e,t,n,r,i,a,o){r/=2,i/=2,o="auto"===o?8:o,e.beginPath&&e.beginPath(),e.moveTo(t-r+o,n-i),e.lineTo(t+r-o,n-i),e.lineTo(t+r,n-i+o),e.lineTo(t+r,n+i-o),e.lineTo(t+r-o,n+i),e.lineTo(t-r+o,n+i),e.lineTo(t-r,n+i-o),e.lineTo(t-r,n-i+o),e.closePath()},drawBarrelPath:function(e,t,n,r,i){var a=t-(o=r/2),o=(t=t+o,n-(s=i/2)),s=(n=n+s,r=(s=Vn(r,i)).widthOffset,i=s.heightOffset,s.ctrlPtOffsetPct*r);e.beginPath&&e.beginPath(),e.moveTo(a,o+i),e.lineTo(a,n-i),e.quadraticCurveTo(a+s,n,a+r,n),e.lineTo(t-r,n),e.quadraticCurveTo(t-s,n,t,n-i),e.lineTo(t,o+i),e.quadraticCurveTo(t-s,o,t-r,o),e.lineTo(a+r,o),e.quadraticCurveTo(a+s,o,a,o+i),e.closePath()}},zh=Math.sin(0),Oh=Math.cos(0),Vh={},Fh={},Xh=Math.PI/40,jh=0*Math.PI;jh<2*Math.PI;jh+=Xh)Vh[jh]=Math.sin(jh),Fh[jh]=Math.cos(jh);Lh.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=Xh)a=t-s*Vh[u]*zh+s*Fh[u]*Oh,o=n+l*Fh[u]*zh+l*Vh[u]*Oh,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Yh={};function qh(e){var t=e.indexOf(",");return e.substr(t+1)}function Wh(e,t,n){function r(){return t.toDataURL(n,e.quality)}switch(e.output){case"blob-promise":return new Ia((function(r,i){try{t.toBlob((function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(e){i(e)}}));case"blob":return function(e,t){for(var n=atob(e),r=(e=new ArrayBuffer(n.length),new Uint8Array(e)),i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new Blob([e],{type:t})}(qh(r()),n);case"base64":return qh(r());default:return r()}}Yh.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Yh.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=(r=e.full?Math.ceil(n.h):r[3],G(e.maxWidth)||G(e.maxHeight)),o=this.getPixelRatio(),s=1,l=(void 0!==e.scale?(i*=e.scale,r*=e.scale,s=e.scale):a&&(u=l=1/0,G(e.maxWidth)&&(l=s*e.maxWidth/i),G(e.maxHeight)&&(u=s*e.maxHeight/r),i*=s=Math.min(l,u),r*=s),a||(i*=o,r*=o,s*=o),document.createElement("canvas")),u=(l.width=i,l.height=r,l.style.width=i+"px",l.style.height=r+"px",l.getContext("2d"));return 0<i&&0<r&&(u.clearRect(0,0,i,r),u.globalCompositeOperation="source-over",a=this.getCachedZSortedEles(),e.full?(u.translate(-n.x1*s,-n.y1*s),u.scale(s,s),this.drawElements(u,a),u.scale(1/s,1/s),u.translate(n.x1*s,n.y1*s)):(n={x:(o=t.pan()).x*s,y:o.y*s},s*=t.zoom(),u.translate(n.x,n.y),u.scale(s,s),this.drawElements(u,a),u.scale(1/s,1/s),u.translate(-n.x,-n.y)),e.bg)&&(u.globalCompositeOperation="destination-over",u.fillStyle=e.bg,u.rect(0,0,i,r),u.fill()),l},Yh.png=function(e){return Wh(e,this.bufferCanvasImage(e),"image/png")},Yh.jpg=function(e){return Wh(e,this.bufferCanvasImage(e),"image/jpeg")};var Uh=Kh,Hh=Kh.prototype;function Kh(e){var t=this,n=t.cy.window().document,r=(e.webgl&&(Hh.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Hh.CANVAS_LAYERS),contexts:new Array(Hh.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Hh.CANVAS_LAYERS),bufferCanvases:new Array(Hh.BUFFER_COUNT),bufferContexts:new Array(Hh.CANVAS_LAYERS)},"-webkit-tap-highlight-color"),i="rgba(0,0,0,0)",a=(t.data.canvasContainer=n.createElement("div"),t.data.canvasContainer.style),o=((a=(t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden",e.cy.container())).appendChild(t.data.canvasContainer),a.style[r]=i,{"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"});V&&V.userAgent.match(/msie|trident|edge/i)&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s<Hh.CANVAS_LAYERS;s++){var l=t.data.canvases[s]=n.createElement("canvas"),u=Hh.CANVAS_TYPES[s];t.data.contexts[s]=l.getContext(u),t.data.contexts[s]||ot("Could not create canvas of type "+u),Object.keys(o).forEach((function(e){l.style[e]=o[e]})),l.style.position="absolute",l.setAttribute("data-id","layer"+s),l.style.zIndex=String(Hh.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[s]=!1}for(t.data.topCanvas=t.data.canvases[0],t.data.canvases[Hh.NODE].setAttribute("data-id","layer"+Hh.NODE+"-node"),t.data.canvases[Hh.SELECT_BOX].setAttribute("data-id","layer"+Hh.SELECT_BOX+"-selectbox"),t.data.canvases[Hh.DRAG].setAttribute("data-id","layer"+Hh.DRAG+"-drag"),t.data.canvases[Hh.WEBGL]&&t.data.canvases[Hh.WEBGL].setAttribute("data-id","layer"+Hh.WEBGL+"-webgl"),s=0;s<Hh.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=n.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";function c(e){return e[0]._private.nodeKey}function d(e){return e[0]._private.labelStyleKey}function h(e){return e[0]._private.sourceLabelStyleKey}function p(e){return e[0]._private.targetLabelStyleKey}function f(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)}function g(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)}function v(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)}function y(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)}function m(e,t){return t}function b(e){return D(A(e))}function x(e){return N("",L(e,"labelX","labelY"),e)}function w(e){return N("source",L(e,"sourceLabelX","sourceLabelY"),e)}function E(e){return N("target",L(e,"targetLabelX","targetLabelY"),e)}function k(e){return _(A(e))}function T(e){return _(R(e))}function C(e){return _(I(e))}function P(e){var t=M(e),n=_(M(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0)}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0)}}return n}function S(e){for(var t=0;t<e.length;t++)j.enqueueElementRefinement(e[t].ele)}t.pathsEnabled=!0;var B=rn(),D=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},_=function(e){return{x:-e.w/2,y:-e.h/2}},A=function(e){return e.boundingBox(),e[0]._private.bodyBounds},M=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||B},R=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||B},I=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||B},N=function(e,t,n){return e=e?e+"-":"",{x:t.x+n.pstyle(e+"text-margin-x").pfValue,y:t.y+n.pstyle(e+"text-margin-y").pfValue}},L=function(e,t,n){return{x:(e=e[0]._private.rscratch)[t],y:e[n]}},z=t.data.eleTxrCache=new Sd(t,{getKey:c,doesEleInvalidateKey:function(e){return!((e=e[0]._private).oldBackgroundTimestamp===e.backgroundTimestamp)},drawElement:f,getBoundingBox:A,getRotationPoint:b,getRotationOffset:k,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),O=t.data.lblTxrCache=new Sd(t,{getKey:d,drawElement:g,getBoundingBox:M,getRotationPoint:x,getRotationOffset:P,isVisible:m}),F=t.data.slbTxrCache=new Sd(t,{getKey:h,drawElement:v,getBoundingBox:R,getRotationPoint:w,getRotationOffset:T,isVisible:m}),X=t.data.tlbTxrCache=new Sd(t,{getKey:p,drawElement:y,getBoundingBox:I,getRotationPoint:E,getRotationOffset:C,isVisible:m}),j=t.data.lyrTxrCache=new _d(t);t.onUpdateEleCalcs((function(e,t){z.invalidateElements(t),O.invalidateElements(t),F.invalidateElements(t),X.invalidateElements(t),j.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}})),z.onDequeue(S),O.onDequeue(S),F.onDequeue(S),X.onDequeue(S),e.webgl&&t.initWebgl(e,{getStyleKey:c,getLabelKey:d,getSourceLabelKey:h,getTargetLabelKey:p,drawElement:f,drawLabel:g,drawSourceLabel:v,drawTargetLabel:y,getElementBox:A,getLabelBox:M,getSourceLabelBox:R,getTargetLabelBox:I,getElementRotationPoint:b,getElementRotationOffset:k,getLabelRotationPoint:x,getSourceLabelRotationPoint:w,getTargetLabelRotationPoint:E,getLabelRotationOffset:P,getSourceLabelRotationOffset:T,getTargetLabelRotationOffset:C})}Hh.CANVAS_LAYERS=3,Hh.SELECT_BOX=0,Hh.DRAG=1,Hh.NODE=2,Hh.WEBGL=3,Hh.CANVAS_TYPES=["2d","2d","2d","webgl2"],Hh.BUFFER_COUNT=3,Hh.TEXTURE_BUFFER=0,Hh.MOTIONBLUR_BUFFER_NODE=1,Hh.MOTIONBLUR_BUFFER_DRAG=2,Hh.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[Hh.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[Hh.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[Hh.SELECT_BOX]=t;break;case"gc":this.data.gc=!0}};var Gh="undefined"!=typeof Path2D,Zh=(Hh.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},Hh.usePaths=function(){return Gh&&this.pathsEnabled},Hh.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Hh.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Hh.makeOffscreenCanvas=function(e,t){var n;return"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":l(OffscreenCanvas))?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[Id,Fd,Hd,Gd,Zd,Jd,th,Dh,Lh,Yh,{nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}}].forEach((function(e){ve(Hh,e)})),[{name:"null",impl:Ec},{name:"base",impl:bd},{name:"canvas",impl:Uh}]),$h=[{type:"layout",extensions:wc},{type:"renderer",extensions:Zh}],Qh={},Jh={};function ep(e,t,n){function r(n){lt("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")}var i=n;if("core"===e){if(Iu.prototype[t])return r(t);Iu.prototype[t]=n}else if("collection"===e){if(Zl.prototype[t])return r(t);Zl.prototype[t]=n}else if("layout"===e){function a(e){this.options=e,n.call(this,e),K(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()}for(var o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}function c(e){return e._private.cy}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var d=n.prototype.stop,h=(o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return d?d.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy},{addEventFields:function(e,t){t.layout=e,t.cy=c(e),t.target=e},bubble:function(){return!0},parent:c});ve(o,{createEmitter:function(){return this._private.emitter=new pl(h,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Mo.eventAliasesOn(o),i=a}else if("renderer"===e&&"null"!==t&&"base"!==t){function p(){v.apply(this,arguments),m.apply(this,arguments)}var f,g,v=tp("renderer","base"),y=v.prototype,m=n,b=n.prototype,x=p.prototype;for(f in y){var w=y[f];if(null!=b[f])return r(f);x[f]=w}for(g in b)x[g]=b[g];y.clientFunctions.forEach((function(e){x[e]=x[e]||function(){ot("Renderer does not implement `renderer."+e+"()` on its prototype")}})),i=p}else if("__proto__"===e||"constructor"===e||"prototype"===e)return ot(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return be({map:Qh,keys:[e,t],value:i})}function tp(e,t){return xe({map:Qh,keys:[e,t]})}function np(e,t,n,r,i){return be({map:Jh,keys:[e,t,n,r],value:i})}function rp(e,t,n,r){return xe({map:Jh,keys:[e,t,n,r]})}var ip=function(){return 2===arguments.length?tp.apply(null,arguments):3===arguments.length?ep.apply(null,arguments):4===arguments.length?rp.apply(null,arguments):5===arguments.length?np.apply(null,arguments):void ot("Invalid extension access syntax")},ap=(Iu.prototype.extension=ip,$h.forEach((function(e){e.extensions.forEach((function(t){ep(e.type,t.name,t.impl)}))})),function(){if(!(this instanceof ap))return new ap;this.length=0}),op=ap.prototype,sp=(op.instanceString=function(){return"stylesheet"},op.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},op.css=function(e,t){var n=this.length-1;if(W(e))this[n].properties.push({name:e,value:t});else if(K(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];null!=s&&null!=(o=Du.properties[o]||Du.properties[oe(o)])&&(o=o.name,this[n].properties.push({name:o,value:s}))}return this},op.style=op.css,op.generateStyle=function(e){return e=new Du(e),this.appendToStyle(e)},op.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e},"3.33.1"),lp=function(e){return K(e=void 0===e?{}:e)?new Iu(e):W(e)?ip.apply(ip,arguments):void 0};lp.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(lp),e.apply(null,t),this},lp.warnings=function(e){return st(e)},lp.version=sp,lp.stylesheet=lp.Stylesheet=ap;export{lp as c};
|