@marimo-team/frontend 0.14.12-dev0 → 0.14.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ConnectedDataExplorerComponent-B9BmPz9a.js → ConnectedDataExplorerComponent-CBKTnGIO.js} +1 -1
- package/dist/assets/{ImageComparisonComponent-CNTqLdnf.js → ImageComparisonComponent-D_1rLFqD.js} +1 -1
- package/dist/assets/{VegaLite-DLKRDJvl.js → VegaLite-B_dlvmS8.js} +1 -1
- package/dist/assets/_baseEach-BRg52hSf.js +1 -0
- package/dist/assets/_baseMap-C8GGmDJG.js +1 -0
- package/dist/assets/_baseUniq-DNyfrpcN.js +1 -0
- package/dist/assets/{_createAggregator-C_WhAECr.js → _createAggregator-Baj-S-w2.js} +1 -1
- package/dist/assets/{any-language-editor-DrZjy7mH.js → any-language-editor-DpXFI5QG.js} +1 -1
- package/dist/assets/{architectureDiagram-NQ2NVSRB-DqJfNlvg.js → architectureDiagram-SUXI7LT5-B47ODzlu.js} +3 -3
- package/dist/assets/{blockDiagram-PHRCVELO-BMyZ52bP.js → blockDiagram-6J76NXCF-DAEJc3eE.js} +6 -6
- package/dist/assets/{c4Diagram-6F6E4RAY-DveKwcb7.js → c4Diagram-6F6E4RAY-ttnVRT3Y.js} +1 -1
- package/dist/assets/channel-ukMKC8Ba.js +1 -0
- package/dist/assets/{chunk-353BL4L5-DBdJb07A.js → chunk-353BL4L5-D2cH1aM-.js} +1 -1
- package/dist/assets/{chunk-67H74DCK-DG8iWVJ-.js → chunk-67H74DCK-BhK3V2TP.js} +1 -1
- package/dist/assets/{chunk-AACKK3MU-CDOdA9eC.js → chunk-AACKK3MU-BGsWBcze.js} +1 -1
- package/dist/assets/{chunk-BFAMUDN2-Cf6198RO.js → chunk-BFAMUDN2-DbnMfH-q.js} +1 -1
- package/dist/assets/{chunk-E2GYISFI-fSvIEcyU.js → chunk-E2GYISFI-2-NOnWc3.js} +1 -1
- package/dist/assets/{chunk-6OLS64BW-Dmt4rYEQ.js → chunk-OW32GOEJ-Bz6eMZz9.js} +1 -1
- package/dist/assets/{chunk-SKB7J2MH-B7Z1FsaJ.js → chunk-SKB7J2MH-C9m7rnpG.js} +1 -1
- package/dist/assets/{chunk-QEP2MXWD-D6FP1cQC.js → chunk-SZ463SBG-9jmdZ7UB.js} +1 -1
- package/dist/assets/{circle-play-CBftacWk.js → circle-play-DjJ5u-05.js} +1 -1
- package/dist/assets/classDiagram-M3E45YP4-X_c0WAZt.js +1 -0
- package/dist/assets/classDiagram-v2-YAWTLIQI-X_c0WAZt.js +1 -0
- package/dist/assets/clone-Bk2-uU7a.js +1 -0
- package/dist/assets/{compile-mbjlQ5nn.js → compile-C1fgVjKt.js} +8 -8
- package/dist/assets/cytoscape.esm-CzSnbbKZ.js +325 -0
- package/dist/assets/{dagre-FFZHY6LT-DX9cGWLP.js → dagre-JOIXM2OF-CcaBCP5W.js} +1 -1
- package/dist/assets/{data-grid-overlay-editor-C4fyHnn1.js → data-grid-overlay-editor-BZwv-WhT.js} +1 -1
- package/dist/assets/{diagram-5UYTHUR4-BgOShMim.js → diagram-5UYTHUR4-D9BnbEeD.js} +1 -1
- package/dist/assets/diagram-VMROVX33-C_v4sUOK.js +24 -0
- package/dist/assets/{diagram-ZTM2IBQH-m55tqkSF.js → diagram-ZTM2IBQH-DkfH8XUB.js} +1 -1
- package/dist/assets/edit-page-TN4XAy2z.js +147 -0
- package/dist/assets/{erDiagram-R3QVA2FD-B8SQvwhp.js → erDiagram-3M52JZNH-BF32hHK0.js} +1 -1
- package/dist/assets/{flowDiagram-PKI6S5ZS-BTbZVZp0.js → flowDiagram-KYDEHFYC-C55z-Ujy.js} +1 -1
- package/dist/assets/{ganttDiagram-EK5VF46D-Dkuqvb7b.js → ganttDiagram-EK5VF46D-CPBRY9C7.js} +3 -3
- package/dist/assets/{gitGraphDiagram-GW3U2K7C-BMQ8L_am.js → gitGraphDiagram-GW3U2K7C-DcxuZq_j.js} +1 -1
- package/dist/assets/{glide-data-editor-BKZWFNVv.js → glide-data-editor-DEySJ-Uv.js} +11 -11
- package/dist/assets/{graph-CFDemIXQ.js → graph-Wnsqj3W7.js} +1 -1
- package/dist/assets/{home-page-DUbYTF9g.js → home-page-DcMrkDPE.js} +3 -3
- package/dist/assets/{index-CH2sakSJ.js → index-4EoOw_ED.js} +1 -1
- package/dist/assets/{index-CRY746sV.js → index-B1o5PWgw.js} +1 -1
- package/dist/assets/{index-B0-K_sX8.js → index-B2587e_p.js} +1 -1
- package/dist/assets/{index-ChVO1Vdj.js → index-BamjPWEC.js} +1 -1
- package/dist/assets/index-BlYahtg3.js +1 -0
- package/dist/assets/index-C-IG5Jr8.js +1 -0
- package/dist/assets/index-C4BBG11u.js +1 -0
- package/dist/assets/index-CF_KIi0p.js +1 -0
- package/dist/assets/index-D98B-7XN.js +1 -0
- package/dist/assets/index-DGjhFk6m.js +1 -0
- package/dist/assets/index-DYmhnlX1.js +507 -0
- package/dist/assets/index-Db00Ydia.js +1 -0
- package/dist/assets/index-Dqf23Hvm.js +1 -0
- package/dist/assets/{index-MUMVp22V.js → index-QfsoKVOY.js} +1 -1
- package/dist/assets/index-RoS9j4wO.js +1 -0
- package/dist/assets/index-S3mjG3Uz.css +1 -0
- package/dist/assets/index-Z1jc58tW.js +1 -0
- package/dist/assets/index-a8t0EFic.js +1 -0
- package/dist/assets/{index-C_e9XjpS.js → index-kzqyjt1O.js} +1 -1
- package/dist/assets/{index-d0CXXxee.js → index-wRtWpsgQ.js} +2 -2
- package/dist/assets/{infoDiagram-RLU2ROGC-DAW5X38W.js → infoDiagram-LHK5PUON-DiXY5W-u.js} +1 -1
- package/dist/assets/{journeyDiagram-EWQZEKCU--6lJjuiM.js → journeyDiagram-EWQZEKCU-Nm6fcEAi.js} +1 -1
- package/dist/assets/{kanban-definition-ILFWEQ3N-CXNPWHB8.js → kanban-definition-ZSS6B67P-CGqK-B6v.js} +1 -1
- package/dist/assets/{layout-Jgv95YSr.js → layout-DdtO6MuW.js} +1 -1
- package/dist/assets/{linear-DtgEMbrz.js → linear-CCLVHXdb.js} +1 -1
- package/dist/assets/links-BOSKRjH_.js +17 -0
- package/dist/assets/loro_wasm_bg-C3hKWL9L.js +2 -0
- package/dist/assets/mermaid-DonGMagM.js +207 -0
- package/dist/assets/min-DCdo07Qe.js +1 -0
- package/dist/assets/mindmap-definition-6CBA2TL7-DV80ltbO.js +95 -0
- package/dist/assets/{number-overlay-editor-C3hemckO.js → number-overlay-editor-DPd2PkyH.js} +1 -1
- package/dist/assets/{pieDiagram-NIOCPIFQ-B-zGF99A.js → pieDiagram-NIOCPIFQ-CLg8zuiX.js} +3 -3
- package/dist/assets/{quadrantDiagram-2OG54O6I-2tF9b_2b.js → quadrantDiagram-2OG54O6I-Q-Nbai62.js} +1 -1
- package/dist/assets/{react-plotly-CdJaKwaj.js → react-plotly-BUhpkTZA.js} +200 -200
- package/dist/assets/{requirementDiagram-SO3GGRV7-DEa34SeY.js → requirementDiagram-QOLK2EJ7-B9SoIsLP.js} +1 -1
- package/dist/assets/run-page-c4k7pMUk.js +1 -0
- package/dist/assets/sankeyDiagram-4UZDY2LN-Bgg2hsKs.js +10 -0
- package/dist/assets/sequenceDiagram-SKLFT4DO-BzFcDEng.js +122 -0
- package/dist/assets/{slides-component-C2uc6kmf.js → slides-component-BhqZju_R.js} +1 -1
- package/dist/assets/{sortBy-Bob7dKSt.js → sortBy-C43Pp6GY.js} +1 -1
- package/dist/assets/{stateDiagram-XX37X6EN-DUi_goR8.js → stateDiagram-MI5ZYTHO-CSucWgeR.js} +1 -1
- package/dist/assets/stateDiagram-v2-5AN5P6BG-BT7qyLYw.js +1 -0
- package/dist/assets/storage-DZZHoZaf.js +25 -0
- package/dist/assets/{terminal-BkOhnp-S.js → terminal-CknBNEbl.js} +1 -1
- package/dist/assets/{time-BXb9z1yv.js → time-bZ-arUoy.js} +1 -1
- package/dist/assets/{timeline-definition-RI47OAVP-CTWn3WQu.js → timeline-definition-MYPXXCX6-MZqqJbkt.js} +3 -3
- package/dist/assets/tracing-D77Keje5.js +2 -0
- package/dist/assets/{trash-BWRVB_br.js → trash-BZiJbQ0d.js} +1 -1
- package/dist/assets/treemap-75Q7IDZK-BAq6XOUv.js +126 -0
- package/dist/assets/{vega-component-CX_u3Hhp.js → vega-component-oHitp1cz.js} +1 -1
- package/dist/assets/{worker-BYA2ASe8.js → worker-Bma4sWEs.js} +1 -1
- package/dist/assets/{xychartDiagram-H2YORKM3-D0JoLNE8.js → xychartDiagram-H2YORKM3-D5zeDIcK.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +9 -19
- package/dist/assets/_baseEach-BjDLzUwG.js +0 -1
- package/dist/assets/_baseMap-CuZ-LBtv.js +0 -1
- package/dist/assets/_baseUniq-DqHaT24V.js +0 -1
- package/dist/assets/channel-LYGgdr1R.js +0 -1
- package/dist/assets/classDiagram-BGRH5UQR-BQbZmSV-.js +0 -1
- package/dist/assets/classDiagram-v2-O24JOBDK-BQbZmSV-.js +0 -1
- package/dist/assets/clone-DD3sG0_1.js +0 -1
- package/dist/assets/cytoscape.esm-UYyVlru8.js +0 -10
- package/dist/assets/diagram-3EMPZRKU-BwXQu6c-.js +0 -24
- package/dist/assets/edit-page-BMW2Fhcz.js +0 -148
- package/dist/assets/index-1az6nvpO.js +0 -1
- package/dist/assets/index-B9WlbtVk.js +0 -1
- package/dist/assets/index-BWEPJWCF.js +0 -1
- package/dist/assets/index-CE3mbf8H.js +0 -1
- package/dist/assets/index-CaHkXpUp.js +0 -1
- package/dist/assets/index-CfvA7bvb.js +0 -1
- package/dist/assets/index-CsdFJkJw.css +0 -1
- package/dist/assets/index-CylrdBnG.js +0 -1
- package/dist/assets/index-D3Er-byj.js +0 -1
- package/dist/assets/index-D_Dmmo5g.js +0 -1
- package/dist/assets/index-Drq4Lpl3.js +0 -1
- package/dist/assets/index-NLK5-sPO.js +0 -1
- package/dist/assets/index-_lj65MZR.js +0 -507
- package/dist/assets/links-Bjf-1I2i.js +0 -17
- package/dist/assets/mermaid-DCMac0Ai.js +0 -152
- package/dist/assets/min-VDyC-auF.js +0 -1
- package/dist/assets/mindmap-definition-CZNETY7S-BEd6cR16.js +0 -95
- package/dist/assets/run-page-Bg1x8WTa.js +0 -1
- package/dist/assets/sankeyDiagram-4UZDY2LN-DUIUN-K8.js +0 -10
- package/dist/assets/sequenceDiagram-ZIKVLSP4-BZGddaB9.js +0 -122
- package/dist/assets/stateDiagram-v2-GD6S3NHB-CdRNmgeb.js +0 -1
- package/dist/assets/storage-CTvz5ejZ.js +0 -25
- package/dist/assets/tracing-Z4QREdu3.js +0 -2
- package/dist/assets/treemap-FKARHQ26-AlpUch0p.js +0 -126
@@ -0,0 +1,325 @@
|
|
1
|
+
function va(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t,n){return t&&function(r,a){for(var i=0;i<a.length;i++){var o=a[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,io(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function it(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ya(e))||t){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){s=!0,i=l},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw i}}}}function ao(e,t,n){return(t=io(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fe(e,t){return function(n){if(Array.isArray(n))return n}(e)||function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var i,o,s,l,u=[],c=!0,d=!1;try{if(s=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;c=!1}else for(;!(c=(i=s.call(a)).done)&&(u.push(i.value),u.length!==r);c=!0);}catch(h){d=!0,o=h}finally{try{if(!c&&a.return!=null&&(l=a.return(),Object(l)!==l))return}finally{if(d)throw o}}return u}}(e,t)||ya(e,t)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function yr(e){return function(t){if(Array.isArray(t))return va(t)}(e)||function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}(e)||ya(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function io(e){var t=function(n,r){if(typeof n!="object"||!n)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var i=a.call(n,r);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(e,"string");return typeof t=="symbol"?t:t+""}function qe(e){return qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qe(e)}function ya(e,t){if(e){if(typeof e=="string")return va(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?va(e,t):void 0}}var Xe=typeof window>"u"?null:window,oo=Xe?Xe.navigator:null;Xe&&Xe.document;var so,lo,uo,co,ho,fo,po,go,ma,vo,ba,yo,mo,bo,xo,wo,Eo,ko,To,Co,Po,So,Bo,_o,Do,Ao,Mo,Io,cd=qe(""),No=qe({}),dd=qe(function(){}),hd=typeof HTMLElement>"u"?"undefined":qe(HTMLElement),qn=function(e){return e&&e.instanceString&&Me(e.instanceString)?e.instanceString():null},fe=function(e){return e!=null&&qe(e)==cd},Me=function(e){return e!=null&&qe(e)===dd},Ce=function(e){return!lt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},xe=function(e){return e!=null&&qe(e)===No&&!Ce(e)&&e.constructor===Object},ie=function(e){return e!=null&&qe(e)===qe(1)&&!isNaN(e)},mr=function(e){return hd==="undefined"?void 0:e!=null&&e instanceof HTMLElement},lt=function(e){return Xn(e)||Ro(e)},Xn=function(e){return qn(e)==="collection"&&e._private.single},Ro=function(e){return qn(e)==="collection"&&!e._private.single},xa=function(e){return qn(e)==="core"},Lo=function(e){return qn(e)==="stylesheet"},Lt=function(e){return e==null||!(e!==""&&!e.match(/^\s+$/))},fd=function(e){return function(t){return t!=null&&qe(t)===No}(e)&&Me(e.then)},pn=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],a=0;a<arguments.length;a++)r.push(arguments[a]);return r.join("$")});var n=function(){var r,a=arguments,i=t.apply(this,a),o=n.cache;return(r=o[i])||(r=o[i]=e.apply(this,a)),r};return n.cache={},n},wa=pn(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),br=pn(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),zo=pn(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),Oo=function(e){return Lt(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},zt=function(e,t){return e.slice(-1*t.length)===t},Ye="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",pd="rgb[a]?\\(("+Ye+"[%]?)\\s*,\\s*("+Ye+"[%]?)\\s*,\\s*("+Ye+"[%]?)(?:\\s*,\\s*("+Ye+"))?\\)",gd="rgb[a]?\\((?:"+Ye+"[%]?)\\s*,\\s*(?:"+Ye+"[%]?)\\s*,\\s*(?:"+Ye+"[%]?)(?:\\s*,\\s*(?:"+Ye+"))?\\)",vd="hsl[a]?\\(("+Ye+")\\s*,\\s*("+Ye+"[%])\\s*,\\s*("+Ye+"[%])(?:\\s*,\\s*("+Ye+"))?\\)",yd="hsl[a]?\\((?:"+Ye+")\\s*,\\s*(?:"+Ye+"[%])\\s*,\\s*(?:"+Ye+"[%])(?:\\s*,\\s*(?:"+Ye+"))?\\)",Vo=function(e,t){return e<t?-1:e>t?1:0},pe=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var a=Object.keys(r),i=0;i<a.length;i++){var o=a[i];e[o]=r[o]}}return e},Fo=function(e){return(Ce(e)?e:null)||function(t){return md[t.toLowerCase()]}(e)||function(t){if((t.length===4||t.length===7)&&t[0]==="#"){var n,r,a,i=16;return t.length===4?(n=parseInt(t[1]+t[1],i),r=parseInt(t[2]+t[2],i),a=parseInt(t[3]+t[3],i)):(n=parseInt(t[1]+t[2],i),r=parseInt(t[3]+t[4],i),a=parseInt(t[5]+t[6],i)),[n,r,a]}}(e)||function(t){var n,r=new RegExp("^"+pd+"$").exec(t);if(r){n=[];for(var a=[],i=1;i<=3;i++){var o=r[i];if(o[o.length-1]==="%"&&(a[i]=!0),o=parseFloat(o),a[i]&&(o=o/100*255),o<0||o>255)return;n.push(Math.floor(o))}var s=a[1]||a[2]||a[3],l=a[1]&&a[2]&&a[3];if(s&&!l)return;var u=r[4];if(u!==void 0){if((u=parseFloat(u))<0||u>1)return;n.push(u)}}return n}(e)||function(t){var n,r,a,i,o,s,l,u;function c(f,g,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?f+6*(g-f)*v:v<.5?g:v<2/3?f+(g-f)*(2/3-v)*6:f}var d=new RegExp("^"+vd+"$").exec(t);if(d){if((r=parseInt(d[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(a=parseFloat(d[2]))<0||a>100||(a/=100,(i=parseFloat(d[3]))<0||i>100)||(i/=100,(o=d[4])!==void 0&&((o=parseFloat(o))<0||o>1)))return;if(a===0)s=l=u=Math.round(255*i);else{var h=i<.5?i*(1+a):i+a-i*a,p=2*i-h;s=Math.round(255*c(p,h,r+1/3)),l=Math.round(255*c(p,h,r)),u=Math.round(255*c(p,h,r-1/3))}n=[s,l,u,o]}return n}(e)},md={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]},qo=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(xe(i))throw Error("Tried to set map with object key");a<n.length-1?(t[i]==null&&(t[i]={}),t=t[i]):t[i]=e.value}},Xo=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(xe(i))throw Error("Tried to get map with object key");if((t=t[i])==null)return t}return t},xr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function jn(){return lo?so:(lo=1,so=function(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")})}function wr(){if(fo)return ho;fo=1;var e=function(){if(co)return uo;co=1;var r=typeof xr=="object"&&xr&&xr.Object===Object&&xr;return uo=r}(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ho=n}function bd(){if(yo)return ba;yo=1;var e=function(){if(vo)return ma;vo=1;var n=/\s/;return ma=function(r){for(var a=r.length;a--&&n.test(r.charAt(a)););return a},ma}(),t=/^\s+/;return ba=function(n){return n&&n.slice(0,e(n)+1).replace(t,"")},ba}function Ea(){if(bo)return mo;bo=1;var e=wr().Symbol;return mo=e}function Yo(){if(Co)return To;Co=1;var e=Ea(),t=function(){if(wo)return xo;wo=1;var a=Ea(),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,l=a?a.toStringTag:void 0;return xo=function(u){var c=o.call(u,l),d=u[l];try{u[l]=void 0;var h=!0}catch{}var p=s.call(u);return h&&(c?u[l]=d:delete u[l]),p}}(),n=function(){if(ko)return Eo;ko=1;var a=Object.prototype.toString;return Eo=function(i){return a.call(i)}}(),r=e?e.toStringTag:void 0;return To=function(a){return a==null?a===void 0?"[object Undefined]":"[object Null]":r&&r in Object(a)?t(a):n(a)}}function Wn(){if(_o)return Bo;_o=1;var e=Yo(),t=So?Po:(So=1,Po=function(n){return n!=null&&typeof n=="object"});return Bo=function(n){return typeof n=="symbol"||t(n)&&e(n)=="[object Symbol]"}}var Hn=Yn(function(){if(Io)return Mo;Io=1;var e=jn(),t=function(){if(go)return po;go=1;var i=wr();return po=function(){return i.Date.now()}}(),n=function(){if(Ao)return Do;Ao=1;var i=bd(),o=jn(),s=Wn(),l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;return Do=function(h){if(typeof h=="number")return h;if(s(h))return NaN;if(o(h)){var p=typeof h.valueOf=="function"?h.valueOf():h;h=o(p)?p+"":p}if(typeof h!="string")return h===0?h:+h;h=i(h);var f=u.test(h);return f||c.test(h)?d(h.slice(2),f?2:8):l.test(h)?NaN:+h}}(),r=Math.max,a=Math.min;return Mo=function(i,o,s){var l,u,c,d,h,p,f=0,g=!1,v=!1,y=!0;if(typeof i!="function")throw new TypeError("Expected a function");function m(x){var C=l,S=u;return l=u=void 0,f=x,d=i.apply(S,C)}function b(x){var C=x-p;return p===void 0||C>=o||C<0||v&&x-f>=c}function w(){var x=t();if(b(x))return k(x);h=setTimeout(w,function(C){var S=o-(C-p);return v?a(S,c-(C-f)):S}(x))}function k(x){return h=void 0,y&&l?m(x):(l=u=void 0,d)}function E(){var x=t(),C=b(x);if(l=arguments,u=this,p=x,C){if(h===void 0)return function(S){return f=S,h=setTimeout(w,o),g?m(S):d}(p);if(v)return clearTimeout(h),h=setTimeout(w,o),m(p)}return h===void 0&&(h=setTimeout(w,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(){h!==void 0&&clearTimeout(h),f=0,l=p=u=h=void 0},E.flush=function(){return h===void 0?d:k(t())},E}}()),ka=Xe?Xe.performance:null,jo=ka&&ka.now?function(){return ka.now()}:function(){return Date.now()},xd=function(){if(Xe){if(Xe.requestAnimationFrame)return function(e){Xe.requestAnimationFrame(e)};if(Xe.mozRequestAnimationFrame)return function(e){Xe.mozRequestAnimationFrame(e)};if(Xe.webkitRequestAnimationFrame)return function(e){Xe.webkitRequestAnimationFrame(e)};if(Xe.msRequestAnimationFrame)return function(e){Xe.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(jo())},1e3/60)}}(),Er=function(e){return xd(e)},St=jo,Qt=9261,gn=5381,Wo=function(e){for(var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qt;!(t=e.next()).done;)n=65599*n+t.value|0;return n},Gn=function(e){return 65599*(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qt)+e|0},Kn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gn;return(t<<5)+t+e|0},Ot=function(e){return 2097152*e[0]+e[1]},kr=function(e,t){return[Gn(e[0],t[0]),Kn(e[1],t[1])]},Ho=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return Wo({next:function(){return r<a?n.value=e[r++]:n.done=!0,n}},t)},Jt=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return Wo({next:function(){return r<a?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},Go=function(){return wd(arguments)},wd=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=n===0?Jt(r):Jt(r,t)}return t},Ko=!0,Ed=console.warn!=null,kd=console.trace!=null,Ta=Number.MAX_SAFE_INTEGER||9007199254740991,Uo=function(){return!0},Tr=function(){return!1},Zo=function(){return 0},Ca=function(){},Ie=function(e){throw new Error(e)},$o=function(e){if(e===void 0)return Ko;Ko=!!e},ke=function(e){$o()&&(Ed?console.warn(e):(console.log(e),kd&&console.trace()))},Et=function(e){return e==null?e:Ce(e)?e.slice():xe(e)?function(t){return pe({},t)}(e):e},Qo=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},Td={},Jo=function(){return Td},Ke=function(e){var t=Object.keys(e);return function(n){for(var r={},a=0;a<t.length;a++){var i=t[a],o=n==null?void 0:n[i];r[i]=o===void 0?e[i]:o}return r}},Vt=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},Pa=function(e){e.splice(0,e.length)},ot=function(e,t,n){return n&&(t=zo(n,t)),e[t]},Bt=function(e,t,n,r){n&&(t=zo(n,t)),e[t]=r},_t=typeof Map<"u"?Map:function(){return Rt(function e(){Nt(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 this._obj[e]!==void 0}},{key:"get",value:function(e){return this._obj[e]}}])}(),Cd=function(){return Rt(function e(t){if(Nt(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}},[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;t[e]!==1&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;t[e]===1&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return this._obj[e]===1}},{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)}}])}(),vn=(typeof Set>"u"?"undefined":qe(Set))!=="undefined"?Set:Cd,Cr=function(e,t){var n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(e!==void 0&&t!==void 0&&xa(e)){var r=t.group;if(r==null&&(r=t.data&&t.data.source!=null&&t.data.target!=null?"edges":"nodes"),r==="nodes"||r==="edges"){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0||!!t.grabbable,pannable:t.pannable===void 0?r==="edges":!!t.pannable,active:!1,classes:new vn,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),s=e.zoom();a.position={x:(i.x-o.x)/s,y:(i.y-o.y)/s}}var l=[];Ce(t.classes)?l=t.classes:fe(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var d=l[u];d&&d!==""&&a.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var h=t.style||t.css;h&&(ke("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))}else Ie("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else Ie("An element must have a core reference and parameters set")},es=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var a;xe(t)&&!lt(t)&&(t=(a=t).roots||a.root,n=a.visit,r=a.directed),r=arguments.length!==2||Me(n)?r:n,n=Me(n)?n:function(){};for(var i,o=this._private.cy,s=t=fe(t)?this.filter(t):t,l=[],u=[],c={},d={},h={},p=0,f=this.byGroup(),g=f.nodes,v=f.edges,y=0;y<s.length;y++){var m=s[y],b=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(h[b]=!0,u.push(m)),d[b]=0)}for(var w,k=function(){var T=e.bfs?l.shift():l.pop(),D=T.id();if(e.dfs){if(h[D])return 0;h[D]=!0,u.push(T)}var A,B=d[D],M=c[D],L=M!=null?M.source():null,I=M!=null?M.target():null,_=M==null?void 0:T.same(L)?I[0]:L[0];if((A=n(T,M,_,p++,B))===!0)return i=T,1;if(A===!1)return 1;for(var R=T.connectedEdges().filter(function(Z){return(!r||Z.source().same(T))&&v.has(Z)}),F=0;F<R.length;F++){var z=R[F],Y=z.connectedNodes().filter(function(Z){return!Z.same(T)&&g.has(Z)}),W=Y.id();Y.length===0||h[W]||(Y=Y[0],l.push(Y),e.bfs&&(h[W]=!0,u.push(Y)),c[W]=z,d[W]=d[D]+1)}};l.length!==0&&((w=k())===0||w!==1););for(var E=o.collection(),x=0;x<u.length;x++){var C=u[x],S=c[C.id()];S!=null&&E.push(S),E.push(C)}return{path:o.collection(E),found:o.collection(i)}}},Un={breadthFirstSearch:es({bfs:!0}),depthFirstSearch:es({dfs:!0})};Un.bfs=Un.breadthFirstSearch,Un.dfs=Un.depthFirstSearch;var ts,ns,rs,Sa={exports:{}},Pd=Sa.exports;function Sd(){return ts||(ts=1,e=Sa,(function(){var t,n,r,a,i,o,s,l,u,c,d,h,p,f,g;r=Math.floor,c=Math.min,n=function(v,y){return v<y?-1:v>y?1:0},u=function(v,y,m,b,w){var k;if(m==null&&(m=0),w==null&&(w=n),m<0)throw new Error("lo must be non-negative");for(b==null&&(b=v.length);m<b;)w(y,v[k=r((m+b)/2)])<0?b=k:m=k+1;return[].splice.apply(v,[m,m-m].concat(y)),y},o=function(v,y,m){return m==null&&(m=n),v.push(y),f(v,0,v.length-1,m)},i=function(v,y){var m,b;return y==null&&(y=n),m=v.pop(),v.length?(b=v[0],v[0]=m,g(v,0,y)):b=m,b},l=function(v,y,m){var b;return m==null&&(m=n),b=v[0],v[0]=y,g(v,0,m),b},s=function(v,y,m){var b;return m==null&&(m=n),v.length&&m(v[0],y)<0&&(y=(b=[v[0],y])[0],v[0]=b[1],g(v,0,m)),y},a=function(v,y){var m,b,w,k,E,x;for(y==null&&(y=n),E=[],b=0,w=(k=(function(){x=[];for(var C=0,S=r(v.length/2);0<=S?C<S:C>S;0<=S?C++:C--)x.push(C);return x}).apply(this).reverse()).length;b<w;b++)m=k[b],E.push(g(v,m,y));return E},p=function(v,y,m){var b;if(m==null&&(m=n),(b=v.indexOf(y))!==-1)return f(v,0,b,m),g(v,b,m)},d=function(v,y,m){var b,w,k,E,x;if(m==null&&(m=n),!(w=v.slice(0,y)).length)return w;for(a(w,m),k=0,E=(x=v.slice(y)).length;k<E;k++)b=x[k],s(w,b,m);return w.sort(m).reverse()},h=function(v,y,m){var b,w,k,E,x,C,S,T,D;if(m==null&&(m=n),10*y<=v.length){if(!(k=v.slice(0,y).sort(m)).length)return k;for(w=k[k.length-1],E=0,C=(S=v.slice(y)).length;E<C;E++)m(b=S[E],w)<0&&(u(k,b,0,null,m),k.pop(),w=k[k.length-1]);return k}for(a(v,m),D=[],x=0,T=c(y,v.length);0<=T?x<T:x>T;0<=T?++x:--x)D.push(i(v,m));return D},f=function(v,y,m,b){var w,k,E;for(b==null&&(b=n),w=v[m];m>y&&b(w,k=v[E=m-1>>1])<0;)v[m]=k,m=E;return v[m]=w},g=function(v,y,m){var b,w,k,E,x;for(m==null&&(m=n),w=v.length,x=y,k=v[y],b=2*y+1;b<w;)(E=b+1)<w&&!(m(v[b],v[E])<0)&&(b=E),v[y]=v[b],b=2*(y=b)+1;return v[y]=k,f(v,x,y,m)},t=function(){function v(y){this.cmp=y??n,this.nodes=[]}return v.push=o,v.pop=i,v.replace=l,v.pushpop=s,v.heapify=a,v.updateItem=p,v.nlargest=d,v.nsmallest=h,v.prototype.push=function(y){return o(this.nodes,y,this.cmp)},v.prototype.pop=function(){return i(this.nodes,this.cmp)},v.prototype.peek=function(){return this.nodes[0]},v.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},v.prototype.replace=function(y){return l(this.nodes,y,this.cmp)},v.prototype.pushpop=function(y){return s(this.nodes,y,this.cmp)},v.prototype.heapify=function(){return a(this.nodes,this.cmp)},v.prototype.updateItem=function(y){return p(this.nodes,y,this.cmp)},v.prototype.clear=function(){return this.nodes=[]},v.prototype.empty=function(){return this.nodes.length===0},v.prototype.size=function(){return this.nodes.length},v.prototype.clone=function(){var y;return(y=new v).nodes=this.nodes.slice(0),y},v.prototype.toArray=function(){return this.nodes.slice(0)},v.prototype.insert=v.prototype.push,v.prototype.top=v.prototype.peek,v.prototype.front=v.prototype.peek,v.prototype.has=v.prototype.contains,v.prototype.copy=v.prototype.clone,v}(),e.exports=t}).call(Pd)),Sa.exports;var e}var Ba,Zn=Yn(rs?ns:(rs=1,ns=Sd())),Bd=Ke({root:null,weight:function(e){return 1},directed:!1}),_d={dijkstra:function(e){if(!xe(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Bd(e),r=n.root,a=n.weight,i=n.directed,o=this,s=a,l=fe(r)?this.filter(r)[0]:r[0],u={},c={},d={},h=this.byGroup(),p=h.nodes,f=h.edges;f.unmergeBy(function(M){return M.isLoop()});for(var g=function(M){return u[M.id()]},v=function(M,L){u[M.id()]=L,y.updateItem(M)},y=new Zn(function(M,L){return g(M)-g(L)}),m=0;m<p.length;m++){var b=p[m];u[b.id()]=b.same(l)?0:1/0,y.push(b)}for(var w=function(M,L){for(var I,_=(i?M.edgesTo(L):M.edgesWith(L)).intersect(f),R=1/0,F=0;F<_.length;F++){var z=_[F],Y=s(z);(Y<R||!I)&&(R=Y,I=z)}return{edge:I,dist:R}};y.size()>0;){var k=y.pop(),E=g(k),x=k.id();if(d[x]=E,E!==1/0)for(var C=k.neighborhood().intersect(p),S=0;S<C.length;S++){var T=C[S],D=T.id(),A=w(k,T),B=E+A.dist;B<g(T)&&(v(T,B),c[D]={node:k,edge:A.edge})}}return{distanceTo:function(M){var L=fe(M)?p.filter(M)[0]:M[0];return d[L.id()]},pathTo:function(M){var L=fe(M)?p.filter(M)[0]:M[0],I=[],_=L,R=_.id();if(L.length>0)for(I.unshift(L);c[R];){var F=c[R];I.unshift(F.edge),I.unshift(F.node),R=(_=F.node).id()}return o.spawn(I)}}}},Dd={kruskal:function(e){e=e||function(m){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,s=function(m){for(var b=0;b<i.length;b++)if(i[b].has(m))return b},l=0;l<a;l++)i[l]=this.spawn(n[l]);for(var u=r.sort(function(m,b){return e(m)-e(b)}),c=0;c<u.length;c++){var d=u[c],h=d.source()[0],p=d.target()[0],f=s(h),g=s(p),v=i[f],y=i[g];f!==g&&(o.merge(d),v.merge(y),i.splice(g,1))}return o}},Ad=Ke({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Md={aStar:function(e){var t=this.cy(),n=Ad(e),r=n.root,a=n.goal,i=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],a=t.collection(a)[0];var l,u,c=r.id(),d=a.id(),h={},p={},f={},g=new Zn(function(F,z){return p[F.id()]-p[z.id()]}),v=new vn,y={},m={},b=function(F,z){g.push(F),v.add(z)},w=function(){l=g.pop(),u=l.id(),v.delete(u)},k=function(F){return v.has(F)};b(r,c),h[c]=0,p[c]=i(r);for(var E=0;g.size()>0;){if(w(),E++,u===d){for(var x=[],C=a,S=d,T=m[S];x.unshift(C),T!=null&&x.unshift(T),(C=y[S])!=null;)T=m[S=C.id()];return{found:!0,distance:h[u],path:this.spawn(x),steps:E}}f[u]=!0;for(var D=l._private.edges,A=0;A<D.length;A++){var B=D[A];if(this.hasElementWithId(B.id())&&(!o||B.data("source")===u)){var M=B.source(),L=B.target(),I=M.id()!==u?M:L,_=I.id();if(this.hasElementWithId(_)&&!f[_]){var R=h[u]+s(B);k(_)?R<h[_]&&(h[_]=R,p[_]=R+i(I),y[_]=l,m[_]=B):(h[_]=R,p[_]=R+i(I),b(I,_),y[_]=l,m[_]=B)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},Id=Ke({weight:function(e){return 1},directed:!1}),Nd={floydWarshall:function(e){for(var t=this.cy(),n=Id(e),r=n.weight,a=n.directed,i=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,d=function(z){return s.indexOf(z)},h=function(z){return s[z]},p=new Array(c),f=0;f<c;f++){var g=f%u,v=(f-g)/u;p[f]=v===g?0:1/0}for(var y=new Array(c),m=new Array(c),b=0;b<l.length;b++){var w=l[b],k=w.source()[0],E=w.target()[0];if(k!==E){var x=d(k),C=d(E),S=x*u+C,T=i(w);if(p[S]>T&&(p[S]=T,y[S]=C,m[S]=w),!a){var D=C*u+x;!a&&p[D]>T&&(p[D]=T,y[D]=x,m[D]=w)}}}for(var A=0;A<u;A++)for(var B=0;B<u;B++)for(var M=B*u+A,L=0;L<u;L++){var I=B*u+L,_=A*u+L;p[M]+p[_]<p[I]&&(p[I]=p[M]+p[_],y[I]=y[M])}var R=function(z){return d(function(Y){return(fe(Y)?t.filter(Y):Y)[0]}(z))},F={distance:function(z,Y){var W=R(z),Z=R(Y);return p[W*u+Z]},path:function(z,Y){var W=R(z),Z=R(Y),G=h(W);if(W===Z)return G.collection();if(y[W*u+Z]==null)return t.collection();var $,V=t.collection(),O=W;for(V.merge(G);W!==Z;)O=W,W=y[W*u+Z],$=m[O*u+W],V.merge($),V.merge(h(W));return V}};return F}},Rd=Ke({weight:function(e){return 1},directed:!1,root:null}),Ld={bellmanFord:function(e){var t=this,n=Rd(e),r=n.weight,a=n.directed,i=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,d=u.nodes,h=d.length,p=new _t,f=!1,g=[];i=l.collection(i)[0],c.unmergeBy(function(he){return he.isLoop()});for(var v=c.length,y=function(he){var ne=p.get(he.id());return ne||(ne={},p.set(he.id(),ne)),ne},m=function(he){return(fe(he)?l.$(he):he)[0]},b=0;b<h;b++){var w=d[b],k=y(w);w.same(i)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var E=!1,x=function(he,ne,se,le,de,P){var N=le.dist+P;N<de.dist&&!se.same(le.edge)&&(de.dist=N,de.pred=he,de.edge=se,E=!0)},C=1;C<h;C++){E=!1;for(var S=0;S<v;S++){var T=c[S],D=T.source(),A=T.target(),B=o(T),M=y(D),L=y(A);x(D,0,T,M,L,B),a||x(A,0,T,L,M,B)}if(!E)break}if(E)for(var I=[],_=0;_<v;_++){var R=c[_],F=R.source(),z=R.target(),Y=o(R),W=y(F).dist,Z=y(z).dist;if(W+Y<Z||!a&&Z+Y<W){if(f||(ke("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),e.findNegativeWeightCycles===!1)break;var G=[];W+Y<Z&&G.push(F),!a&&Z+Y<W&&G.push(z);for(var $=G.length,V=0;V<$;V++){var O=G[V],q=[O];q.push(y(O).edge);for(var Q=y(O).pred;q.indexOf(Q)===-1;)q.push(Q),q.push(y(Q).edge),Q=y(Q).pred;for(var ee=(q=q.slice(q.indexOf(Q)))[0].id(),oe=0,ce=2;ce<q.length;ce+=2)q[ce].id()<ee&&(ee=q[ce].id(),oe=ce);(q=q.slice(oe).concat(q.slice(0,oe))).push(q[0]);var ve=q.map(function(he){return he.id()}).join(",");I.indexOf(ve)===-1&&(g.push(s.spawn(q)),I.push(ve))}}}return{distanceTo:function(he){return y(m(he)).dist},pathTo:function(he){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i,se=[],le=m(he);;){if(le==null)return t.spawn();var de=y(le),P=de.edge,N=de.pred;if(se.unshift(le[0]),le.same(ne)&&se.length>0)break;P!=null&&se.unshift(P),le=N}return s.spawn(se)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},zd=Math.sqrt(2),Od=function(e,t,n){n.length===0&&Ie("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],s=t[i],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;p<l.length;p++){var f=l[p];f[1]===s?(l[p]=f.slice(),l[p][1]=o):f[2]===s&&(l[p]=f.slice(),l[p][2]=o)}for(var g=0;g<t.length;g++)t[g]===s&&(t[g]=o);return l},_a=function(e,t,n,r){for(;n>r;){var a=Math.floor(Math.random()*t.length);t=Od(a,e,t),n--}return t},Vd={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(I){return I.isLoop()});var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/zd);if(!(a<2)){for(var l=[],u=0;u<i;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var d=1/0,h=[],p=new Array(a),f=new Array(a),g=new Array(a),v=function(I,_){for(var R=0;R<a;R++)_[R]=I[R]},y=0;y<=o;y++){for(var m=0;m<a;m++)f[m]=m;var b=_a(f,l.slice(),a,s),w=b.slice();v(f,g);var k=_a(f,b,s,2),E=_a(g,w,s,2);k.length<=E.length&&k.length<d?(d=k.length,h=k,v(f,p)):E.length<=k.length&&E.length<d&&(d=E.length,h=E,v(g,p))}for(var x=this.spawn(h.map(function(I){return r[I[0]]})),C=this.spawn(),S=this.spawn(),T=p[0],D=0;D<p.length;D++){var A=p[D],B=n[D];A===T?C.merge(B):S.merge(B)}var M=function(I){var _=e.spawn();return I.forEach(function(R){_.merge(R),R.connectedEdges().forEach(function(F){e.contains(F)&&!x.contains(F)&&_.merge(F)})}),_},L=[M(C),M(S)];return{cut:x,components:L,partition1:C,partition2:S}}Ie("At least 2 nodes are required for Karger-Stein algorithm")}},Pr=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},as=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},yn=function(e){return{x:e[0],y:e[1]}},Sr=function(e,t){return Math.atan2(t,e)-Math.PI/2},Da=Math.log2||function(e){return Math.log(e)/Math.log(2)},Aa=function(e){return e>0?1:e<0?-1:0},en=function(e,t){return Math.sqrt(tn(e,t))},tn=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Fd=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var a=0;a<t;a++)e[a]=e[a]/n;return e},We=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},mn=function(e,t,n,r){return{x:We(e.x,t.x,n.x,r),y:We(e.y,t.y,n.y,r)}},$n=function(e,t,n){return Math.max(e,Math.min(n,t))},nt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},qd=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},is=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},Br=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},_r=function(e){var t,n,r,a,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0];if(i.length===1)t=n=r=a=i[0];else if(i.length===2)t=r=i[0],a=n=i[1];else if(i.length===4){var o=Fe(i,4);t=o[0],n=o[1],r=o[2],a=o[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},os=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},Ma=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)},bn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Xd=function(e,t){return bn(e,t.x,t.y)},Yd=function(e,t){return bn(e,t.x1,t.y1)&&bn(e,t.x2,t.y2)},jd=(Ba=Math.hypot)!==null&&Ba!==void 0?Ba:function(e,t){return Math.sqrt(e*e+t*t)};function Wd(e,t,n,r,a,i){var o=function(l,u){if(l.length<3)throw new Error("Need at least 3 vertices");var c=function(M,L){return{x:M.x+L.x,y:M.y+L.y}},d=function(M,L){return{x:M.x-L.x,y:M.y-L.y}},h=function(M,L){return{x:M.x*L,y:M.y*L}},p=function(M,L){return M.x*L.y-M.y*L.x},f=function(M){var L=jd(M.x,M.y);return L===0?{x:0,y:0}:{x:M.x/L,y:M.y/L}},g=function(M,L,I,_){var R=d(L,M),F=d(_,I),z=p(R,F);if(Math.abs(z)<1e-9)return c(M,h(R,.5));var Y=p(d(I,M),F)/z;return c(M,h(R,Y))},v=l.map(function(M){return{x:M.x,y:M.y}});(function(M){for(var L=0,I=0;I<M.length;I++){var _=M[I],R=M[(I+1)%M.length];L+=_.x*R.y-R.x*_.y}return L/2})(v)<0&&v.reverse();for(var y=v.length,m=[],b=0;b<y;b++){var w=v[b],k=v[(b+1)%y],E=d(k,w),x=f({x:E.y,y:-E.x});m.push(x)}for(var C=m.map(function(M,L){return{p1:c(v[L],h(M,u)),p2:c(v[(L+1)%y],h(M,u))}}),S=[],T=0;T<y;T++){var D=C[(T-1+y)%y],A=C[T],B=g(D.p1,D.p2,A.p1,A.p2);S.push(B)}return S}(Zd(e,t,n,r,a),i),s=nt();return o.forEach(function(l){return is(s,l.x,l.y)}),s}var ss=function(e,t,n,r,a,i,o){var s,l,u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",c=u==="auto"?qt(a,i):u,d=a/2,h=i/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=r-h-o;if((s=Ft(e,t,n,r,n-d+c-o,g,n+d-c+o,g,!1)).length>0)return s}if(f){var v=n+d+o;if((s=Ft(e,t,n,r,v,r-h+c-o,v,r+h-c+o,!1)).length>0)return s}if(p){var y=r+h+o;if((s=Ft(e,t,n,r,n-d+c-o,y,n+d-c+o,y,!1)).length>0)return s}if(f){var m=n-d-o;if((s=Ft(e,t,n,r,m,r-h+c-o,m,r+h-c+o,!1)).length>0)return s}var b=n-d+c,w=r-h+c;if((l=Qn(e,t,n,r,b,w,c+o)).length>0&&l[0]<=b&&l[1]<=w)return[l[0],l[1]];var k=n+d-c,E=r-h+c;if((l=Qn(e,t,n,r,k,E,c+o)).length>0&&l[0]>=k&&l[1]<=E)return[l[0],l[1]];var x=n+d-c,C=r+h-c;if((l=Qn(e,t,n,r,x,C,c+o)).length>0&&l[0]>=x&&l[1]>=C)return[l[0],l[1]];var S=n-d+c,T=r+h-c;return(l=Qn(e,t,n,r,S,T,c+o)).length>0&&l[0]<=S&&l[1]>=T?[l[0],l[1]]:[]},Hd=function(e,t,n,r,a,i,o){var s=o,l=Math.min(n,a),u=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Gd=function(e,t,n,r,a,i,o,s,l){var u=Math.min(n,o,a)-l,c=Math.max(n,o,a)+l,d=Math.min(r,s,i)-l,h=Math.max(r,s,i)+l;return!(e<u||e>c||t<d||t>h)},Kd=function(e,t,n,r,a,i,o,s){var l=[];(function(v,y,m,b,w){var k,E,x,C,S,T,D,A;v===0&&(v=1e-5),x=-27*(b/=v)+(y/=v)*(9*(m/=v)-y*y*2),k=(E=(3*m-y*y)/9)*E*E+(x/=54)*x,w[1]=0,D=y/3,k>0?(S=(S=x+Math.sqrt(k))<0?-Math.pow(-S,1/3):Math.pow(S,1/3),T=(T=x-Math.sqrt(k))<0?-Math.pow(-T,1/3):Math.pow(T,1/3),w[0]=-D+S+T,D+=(S+T)/2,w[4]=w[2]=-D,D=Math.sqrt(3)*(-T+S)/2,w[3]=D,w[5]=-D):(w[5]=w[3]=0,k===0?(A=x<0?-Math.pow(-x,1/3):Math.pow(x,1/3),w[0]=2*A-D,w[4]=w[2]=-(A+D)):(C=(E=-E)*E*E,C=Math.acos(x/Math.sqrt(C)),A=2*Math.sqrt(E),w[0]=-D+A*Math.cos(C/3),w[2]=-D+A*Math.cos((C+2*Math.PI)/3),w[4]=-D+A*Math.cos((C+4*Math.PI)/3)))})(1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*s+4*i*i-4*i*s+s*s,9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*s-6*i*i+3*i*s,3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*s-r*t+2*i*i+2*i*t-s*t,1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g<u.length;g++)d=Math.pow(1-u[g],2)*n+2*(1-u[g])*u[g]*a+u[g]*u[g]*o,h=Math.pow(1-u[g],2)*r+2*(1-u[g])*u[g]*i+u[g]*u[g]*s,p=Math.pow(d-e,2)+Math.pow(h-t,2),f>=0?p<f&&(f=p):f=p;return f},Ud=function(e,t,n,r,a,i){var o=[e-n,t-r],s=[a-n,i-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],d=c*c/l;return c<0?u:d>l?(e-a)*(e-a)+(t-i)*(t-i):u-d},st=function(e,t,n){for(var r,a,i,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],a=n[2*l+1],l+1<n.length/2?(i=n[2*(l+1)],o=n[2*(l+1)+1]):(i=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),!(r==e&&i==e)){if(!(r>=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!=0},Dt=function(e,t,n,r,a,i,o,s,l){var u,c=new Array(n.length);s[0]!=null?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=i/2*(n[2*f]*h-n[2*f+1]*p),c[2*f+1]=o/2*(n[2*f+1]*h+n[2*f]*p),c[2*f]+=r,c[2*f+1]+=a;if(l>0){var g=Ar(c,-l);d=Dr(g)}else d=c;return st(e,t,d)},Dr=function(e){for(var t,n,r,a,i,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],a=e[4*c+3],c<e.length/4-1?(i=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(i=e[0],o=e[1],s=e[2],l=e[3]);var d=Ft(t,n,r,a,i,o,s,l,!0);u[2*c]=d[0],u[2*c+1]=d[1]}return u},Ar=function(e,t){for(var n,r,a,i,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(a=e[2*(s+1)],i=e[2*(s+1)+1]):(a=e[0],i=e[1]);var l=i-r,u=-(a-n),c=Math.sqrt(l*l+u*u),d=l/c,h=u/c;o[4*s]=n+d*t,o[4*s+1]=r+h*t,o[4*s+2]=a+d*t,o[4*s+3]=i+h*t}return o},nn=function(e,t,n,r,a,i,o){return e-=a,t-=i,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},Qn=function(e,t,n,r,a,i,o){var s=[n-e,r-t],l=[e-a,t-i],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),d=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(d<0)return[];var h=(-c+Math.sqrt(d))/(2*u),p=(-c-Math.sqrt(d))/(2*u),f=Math.min(h,p),g=Math.max(h,p),v=[];if(f>=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),v.length===0)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Ia=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Ft=function(e,t,n,r,a,i,o,s,l){var u=e-a,c=n-e,d=o-a,h=t-i,p=r-t,f=s-i,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(y!==0){var m=g/y,b=v/y,w=-.001;return w<=m&&m<=1.001&&w<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return g===0||v===0?Ia(e,n,o)===o?[o,s]:Ia(e,n,a)===a?[a,i]:Ia(a,o,n)===n?[n,r]:[]:[]},Zd=function(e,t,n,r,a){var i=[],o=r/2,s=a/2,l=t,u=n;i.push({x:l+o*e[0],y:u+s*e[1]});for(var c=1;c<e.length/2;c++)i.push({x:l+o*e[2*c],y:u+s*e[2*c+1]});return i},Jn=function(e,t,n,r,a,i,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(i==null&&(v=!1),v){for(var y=0;y<g.length/2;y++)g[2*y]=n[2*y]*i+r,g[2*y+1]=n[2*y+1]*o+a;if(s>0){var m=Ar(g,-s);u=Dr(m)}else u=g}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],d=u[2*b+1],b<u.length/2-1?(h=u[2*(b+1)],p=u[2*(b+1)+1]):(h=u[0],p=u[1]),(l=Ft(e,t,r,a,c,d,h,p)).length!==0&&f.push(l[0],l[1]);return f},Mr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),i=(a-n)/a;return i<0&&(i=1e-5),[t[0]+i*r[0],t[1]+i*r[1]]},rt=function(e,t){var n=Na(e,t);return n=ls(n)},ls=function(e){for(var t,n,r=e.length/2,a=1/0,i=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),s=Math.max(s,n);for(var u=2/(o-a),c=2/(s-i),d=0;d<r;d++)t=e[2*d]=e[2*d]*u,n=e[2*d+1]=e[2*d+1]*c,a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),s=Math.max(s,n);if(i<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-i);return e},Na=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var a,i=new Array(2*e),o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},qt=function(e,t){return Math.min(e/4,t/4,8)},us=function(e,t){return Math.min(e/10,t/10,8)},Ra=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function $d(e,t){function n(l){for(var u=[],c=0;c<l.length;c++){var d=l[c],h=l[(c+1)%l.length],p={x:h.x-d.x,y:h.y-d.y},f={x:-p.y,y:p.x},g=Math.sqrt(f.x*f.x+f.y*f.y);u.push({x:f.x/g,y:f.y/g})}return u}function r(l,u){var c,d=1/0,h=-1/0,p=it(l);try{for(p.s();!(c=p.n()).done;){var f=c.value,g=f.x*u.x+f.y*u.y;d=Math.min(d,g),h=Math.max(h,g)}}catch(v){p.e(v)}finally{p.f()}return{min:d,max:h}}function a(l,u){return!(l.max<u.min||u.max<l.min)}var i,o=it([].concat(yr(n(e)),yr(n(t))));try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!a(r(e,s),r(t,s)))return!1}}catch(l){o.e(l)}finally{o.f()}return!0}var Qd=Ke({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Jd={pageRank:function(e){for(var t=Qd(e),n=t.dampingFactor,r=t.precision,a=t.iterations,i=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,d=c*c,h=u.length,p=new Array(d),f=new Array(c),g=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++)p[v*c+y]=0;f[v]=0}for(var m=0;m<h;m++){var b=u[m],w=b.data("source"),k=b.data("target");if(w!==k){var E=l.indexOfId(w),x=l.indexOfId(k),C=i(b);p[x*c+E]+=C,f[E]+=C}}for(var S=1/c+g,T=0;T<c;T++)if(f[T]===0)for(var D=0;D<c;D++)p[D*c+T]=S;else for(var A=0;A<c;A++){var B=A*c+T;p[B]=p[B]/f[T]+g}for(var M,L=new Array(c),I=new Array(c),_=0;_<c;_++)L[_]=1;for(var R=0;R<a;R++){for(var F=0;F<c;F++)I[F]=0;for(var z=0;z<c;z++)for(var Y=0;Y<c;Y++){var W=z*c+Y;I[z]+=p[W]*L[Y]}Fd(I),M=L,L=I,I=M;for(var Z=0,G=0;G<c;G++){var $=M[G]-L[G];Z+=$*$}if(Z<r)break}return{rank:function(V){return V=o.collection(V)[0],L[l.indexOf(V)]}}}},cs=Ke({root:null,weight:function(e){return 1},directed:!1,alpha:0}),xn={degreeCentralityNormalized:function(e){e=cs(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var a={},i={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),a[c]=d.indegree,i[c]=d.outdegree}return{indegree:function(y){return o==0?0:(fe(y)&&(y=t.filter(y)),a[y.id()]/o)},outdegree:function(y){return s===0?0:(fe(y)&&(y=t.filter(y)),i[y.id()]/s)}}}for(var h={},p=0,f=0;f<r;f++){var g=n[f];e.root=g;var v=this.degreeCentrality(e);p<v.degree&&(p=v.degree),h[g.id()]=v.degree}return{degree:function(y){return p===0?0:(fe(y)&&(y=t.filter(y)),h[y.id()]/p)}}},degreeCentrality:function(e){e=cs(e);var t=this.cy(),n=this,r=e,a=r.root,i=r.weight,o=r.directed,s=r.alpha;if(a=t.collection(a)[0],o){for(var l=a.connectedEdges(),u=l.filter(function(k){return k.target().same(a)&&n.has(k)}),c=l.filter(function(k){return k.source().same(a)&&n.has(k)}),d=u.length,h=c.length,p=0,f=0,g=0;g<u.length;g++)p+=i(u[g]);for(var v=0;v<c.length;v++)f+=i(c[v]);return{indegree:Math.pow(d,1-s)*Math.pow(p,s),outdegree:Math.pow(h,1-s)*Math.pow(f,s)}}for(var y=a.connectedEdges().intersection(n),m=y.length,b=0,w=0;w<y.length;w++)b+=i(y[w]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};xn.dc=xn.degreeCentrality,xn.dcn=xn.degreeCentralityNormalised=xn.degreeCentralityNormalized;var ds=Ke({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),wn={closenessCentralityNormalized:function(e){for(var t=ds(e),n=t.harmonic,r=t.weight,a=t.directed,i=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:a}),c=0;c<l.length;c++){for(var d=0,h=l[c],p=0;p<l.length;p++)if(c!==p){var f=u.distance(h,l[p]);d+=n?1/f:f}n||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(g){return s==0?0:(g=fe(g)?i.filter(g)[0].id():g.id(),o[g]/s)}}},closenessCentrality:function(e){var t=ds(e),n=t.root,r=t.weight,a=t.directed,i=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:a}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var d=o.distanceTo(c);s+=i?1/d:d}}return i?s:1/s}};wn.cc=wn.closenessCentrality,wn.ccn=wn.closenessCentralityNormalised=wn.closenessCentralityNormalized;var eh=Ke({weight:null,directed:!1}),La={betweennessCentrality:function(e){for(var t=eh(e),n=t.directed,r=t.weight,a=r!=null,i=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(m,b){l[m]=b,b>u&&(u=b)},d=function(m){return l[m]},h=0;h<o.length;h++){var p=o[h],f=p.id();s[f]=n?p.outgoers().nodes():p.openNeighborhood().nodes(),c(f,0)}for(var g=function(){for(var m=o[v].id(),b=[],w={},k={},E={},x=new Zn(function(Z,G){return E[Z]-E[G]}),C=0;C<o.length;C++){var S=o[C].id();w[S]=[],k[S]=0,E[S]=1/0}for(k[m]=1,E[m]=0,x.push(m);!x.empty();){var T=x.pop();if(b.push(T),a)for(var D=0;D<s[T].length;D++){var A=s[T][D],B=i.getElementById(T),M=void 0;M=B.edgesTo(A).length>0?B.edgesTo(A)[0]:A.edgesTo(B)[0];var L=r(M);A=A.id(),E[A]>E[T]+L&&(E[A]=E[T]+L,x.nodes.indexOf(A)<0?x.push(A):x.updateItem(A),k[A]=0,w[A]=[]),E[A]==E[T]+L&&(k[A]=k[A]+k[T],w[A].push(T))}else for(var I=0;I<s[T].length;I++){var _=s[T][I].id();E[_]==1/0&&(x.push(_),E[_]=E[T]+1),E[_]==E[T]+1&&(k[_]=k[_]+k[T],w[_].push(T))}}for(var R={},F=0;F<o.length;F++)R[o[F].id()]=0;for(;b.length>0;){for(var z=b.pop(),Y=0;Y<w[z].length;Y++){var W=w[z][Y];R[W]=R[W]+k[W]/k[z]*(1+R[z])}z!=o[v].id()&&c(z,d(z)+R[z])}},v=0;v<o.length;v++)g();var y={betweenness:function(m){var b=i.collection(m).id();return d(b)},betweennessNormalized:function(m){if(u==0)return 0;var b=i.collection(m).id();return d(b)/u}};return y.betweennessNormalised=y.betweennessNormalized,y}};La.bc=La.betweennessCentrality;var th=Ke({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),nh=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},hs=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var a=0;a<t;a++)n+=e[a*t+r];for(var i=0;i<t;i++)e[i*t+r]=e[i*t+r]/n}},rh=function(e,t,n){for(var r=new Array(n*n),a=0;a<n;a++){for(var i=0;i<n;i++)r[a*n+i]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[a*n+s]+=e[a*n+o]*t[o*n+s]}return r},ah=function(e,t,n){for(var r=e.slice(0),a=1;a<n;a++)e=rh(e,r,t);return e},ih=function(e,t,n){for(var r=new Array(t*t),a=0;a<t*t;a++)r[a]=Math.pow(e[a],n);return hs(r,t),r},oh=function(e,t,n,r){for(var a=0;a<n;a++)if(Math.round(e[a]*Math.pow(10,r))/Math.pow(10,r)!==Math.round(t[a]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},sh=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},fs=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),a=function(w){return th(w)}(e),i={},o=0;o<t.length;o++)i[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=n[h],f=i[p.source().id()],g=i[p.target().id()],v=nh(p,a.attributes);c[f*l+g]+=v,c[g*l+f]+=v}(function(w,k,E){for(var x=0;x<k;x++)w[x*k+x]=E})(c,l,a.multFactor),hs(c,l);for(var y=!0,m=0;y&&m<a.maxIterations;)y=!1,s=ah(c,l,a.expandFactor),c=ih(s,l,a.inflateFactor),oh(c,s,u,4)||(y=!0),m++;var b=function(w,k,E,x){for(var C=[],S=0;S<k;S++){for(var T=[],D=0;D<k;D++)Math.round(1e3*w[S*k+D])/1e3>0&&T.push(E[D]);T.length!==0&&C.push(x.collection(T))}return C}(c,l,t,r);return b=function(w){for(var k=0;k<w.length;k++)for(var E=0;E<w.length;E++)k!=E&&sh(w[k],w[E])&&w.splice(E,1);return w}(b),b},lh={markovClustering:fs,mcl:fs},uh=function(e){return e},ps=function(e,t){return Math.abs(t-e)},gs=function(e,t,n){return e+ps(t,n)},vs=function(e,t,n){return e+Math.pow(n-t,2)},ch=function(e){return Math.sqrt(e)},dh=function(e,t,n){return Math.max(e,ps(t,n))},er=function(e,t,n,r,a){for(var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:uh,o=r,s=0;s<e;s++)o=a(o,t(s),n(s));return i(o)},En={euclidean:function(e,t,n){return e>=2?er(e,t,n,0,vs,ch):er(e,t,n,0,gs)},squaredEuclidean:function(e,t,n){return er(e,t,n,0,vs)},manhattan:function(e,t,n){return er(e,t,n,0,gs)},max:function(e,t,n){return er(e,t,n,-1/0,dh)}};function Ir(e,t,n,r,a,i){var o;return o=Me(e)?e:En[e]||En.euclidean,t===0&&Me(e)?o(a,i):o(t,n,r,a,i)}En["squared-euclidean"]=En.squaredEuclidean,En.squaredeuclidean=En.squaredEuclidean;var hh=Ke({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),za=function(e){return hh(e)},Nr=function(e,t,n,r,a){var i=a!=="kMedoids"?function(l){return n[l]}:function(l){return r[l](n)},o=n,s=t;return Ir(e,r.length,i,function(l){return r[l](t)},o,s)},Oa=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)a[l]=e.min(n[l]).value,i[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()*(i[c]-a[c])+a[c];o[u]=s}return o},ys=function(e,t,n,r,a){for(var i=1/0,o=0,s=0;s<t.length;s++){var l=Nr(n,e,t[s],r,a);l<i&&(i=l,o=s)}return o},ms=function(e,t,n){for(var r=[],a=null,i=0;i<t.length;i++)n[(a=t[i]).id()]===e&&r.push(a);return r},fh=function(e,t,n){return Math.abs(t-e)<=n},ph=function(e,t,n){for(var r=0;r<e.length;r++)for(var a=0;a<e[r].length;a++)if(Math.abs(e[r][a]-t[r][a])>n)return!1;return!0},gh=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},bs=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var a=e[Math.floor(Math.random()*e.length)];gh(a,n,r);)a=e[Math.floor(Math.random()*e.length)];n[r]=a}else for(var i=0;i<t;i++)n[i]=e[Math.floor(Math.random()*e.length)];return n},xs=function(e,t,n){for(var r=0,a=0;a<t.length;a++)r+=Nr("manhattan",t[a],e,n,"kMedoids");return r},vh=function(e,t,n,r,a){for(var i,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],a.m);for(var u=0;u<e.length;u++)for(var c=0;c<a.attributes.length;c++){i=0,o=0;for(var d=0;d<t.length;d++)i+=r[d][u]*a.attributes[c](t[d]),o+=r[d][u];e[u][c]=i/o}},yh=function(e,t,n,r,a){for(var i=0;i<e.length;i++)t[i]=e[i].slice();for(var o,s,l,u=2/(a.m-1),c=0;c<n.length;c++)for(var d=0;d<r.length;d++){o=0;for(var h=0;h<n.length;h++)s=Nr(a.distance,r[d],n[c],a.attributes,"cmeans"),l=Nr(a.distance,r[d],n[h],a.attributes,"cmeans"),o+=Math.pow(s/l,u);e[d][c]=1/o}},ws=function(e){var t,n,r,a,i,o=this.cy(),s=this.nodes(),l=za(e);a=new Array(s.length);for(var u=0;u<s.length;u++)a[u]=new Array(l.k);r=new Array(s.length);for(var c=0;c<s.length;c++)r[c]=new Array(l.k);for(var d=0;d<s.length;d++){for(var h=0,p=0;p<l.k;p++)r[d][p]=Math.random(),h+=r[d][p];for(var f=0;f<l.k;f++)r[d][f]=r[d][f]/h}n=new Array(l.k);for(var g=0;g<l.k;g++)n[g]=new Array(l.attributes.length);i=new Array(s.length);for(var v=0;v<s.length;v++)i[v]=new Array(l.k);for(var y=!0,m=0;y&&m<l.maxIterations;)y=!1,vh(n,s,r,i,l),yh(r,a,n,s,l),ph(r,a,l.sensitivityThreshold)||(y=!0),m++;return t=function(b,w,k,E){for(var x,C,S=new Array(k.k),T=0;T<S.length;T++)S[T]=[];for(var D=0;D<w.length;D++){x=-1/0,C=-1;for(var A=0;A<w[0].length;A++)w[D][A]>x&&(x=w[D][A],C=A);S[C].push(b[D])}for(var B=0;B<S.length;B++)S[B]=E.collection(S[B]);return S}(s,r,l,o),{clusters:t,degreeOfMembership:r}},mh={kMeans:function(e){var t,n=this.cy(),r=this.nodes(),a=null,i=za(e),o=new Array(i.k),s={};i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,t=Oa(r,i.k,i.attributes)):t=qe(i.testCentroids)==="object"?i.testCentroids:Oa(r,i.k,i.attributes):t=Oa(r,i.k,i.attributes);for(var l=!0,u=0;l&&u<i.maxIterations;){for(var c=0;c<r.length;c++)s[(a=r[c]).id()]=ys(a,t,i.distance,i.attributes,"kMeans");l=!1;for(var d=0;d<i.k;d++){var h=ms(d,r,s);if(h.length!==0){for(var p=i.attributes.length,f=t[d],g=new Array(p),v=new Array(p),y=0;y<p;y++){v[y]=0;for(var m=0;m<h.length;m++)a=h[m],v[y]+=i.attributes[y](a);g[y]=v[y]/h.length,fh(g[y],f[y],i.sensitivityThreshold)||(l=!0)}t[d]=g,o[d]=n.collection(h)}}u++}return o},kMedoids:function(e){var t,n,r=this.cy(),a=this.nodes(),i=null,o=za(e),s=new Array(o.k),l={},u=new Array(o.k);o.testMode?typeof o.testCentroids=="number"||(t=qe(o.testCentroids)==="object"?o.testCentroids:bs(a,o.k)):t=bs(a,o.k);for(var c=!0,d=0;c&&d<o.maxIterations;){for(var h=0;h<a.length;h++)l[(i=a[h]).id()]=ys(i,t,o.distance,o.attributes,"kMedoids");c=!1;for(var p=0;p<t.length;p++){var f=ms(p,a,l);if(f.length!==0){u[p]=xs(t[p],f,o.attributes);for(var g=0;g<f.length;g++)(n=xs(f[g],f,o.attributes))<u[p]&&(u[p]=n,t[p]=f[g],c=!0);s[p]=r.collection(f)}}d++}return s},fuzzyCMeans:ws,fcm:ws},bh=Ke({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),xh={single:"min",complete:"max"},Es=function(e,t,n,r,a){for(var i,o=0,s=1/0,l=a.attributes,u=function(x,C){return Ir(a.distance,l.length,function(S){return l[S](x)},function(S){return l[S](C)},x,C)},c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<s&&(o=d,s=h)}if(a.mode==="threshold"&&s>=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var p,f=t[o],g=t[r[o]];p=a.mode==="dendrogram"?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;v<e.length;v++){var y=e[v];f.key===y.key?i=1/0:a.linkage==="min"?(i=n[f.key][y.key],n[f.key][y.key]>n[g.key][y.key]&&(i=n[g.key][y.key])):a.linkage==="max"?(i=n[f.key][y.key],n[f.key][y.key]<n[g.key][y.key]&&(i=n[g.key][y.key])):i=a.linkage==="mean"?(n[f.key][y.key]*f.size+n[g.key][y.key]*g.size)/(f.size+g.size):a.mode==="dendrogram"?u(y.value,f.value):u(y.value[0],f.value[0]),n[f.key][y.key]=n[y.key][f.key]=i}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===f.key||r[b]===g.key){for(var w=b,k=0;k<e.length;k++){var E=e[k].key;n[b][E]<n[b][w]&&(w=E)}r[b]=w}e[m].index=m}return f.key=g.key=f.index=g.index=null,!0},kn=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&kn(e.left,t),e.right&&kn(e.right,t)))},Va=function(e,t){if(!e)return"";if(e.left&&e.right){var n=Va(e.left,t),r=Va(e.right,t),a=t.add({group:"nodes",data:{id:n+","+r}});return t.add({group:"edges",data:{source:n,target:a.id()}}),t.add({group:"edges",data:{source:r,target:a.id()}}),a.id()}return e.value?e.value.id():void 0},Fa=function(e,t,n){if(!e)return[];var r=[],a=[],i=[];return t===0?(e.left&&kn(e.left,r),e.right&&kn(e.right,a),i=r.concat(a),[n.collection(i)]):t===1?e.value?[n.collection(e.value)]:(e.left&&kn(e.left,r),e.right&&kn(e.right,a),[n.collection(r),n.collection(a)]):e.value?[n.collection(e.value)]:(e.left&&(r=Fa(e.left,t-1,n)),e.right&&(a=Fa(e.right,t-1,n)),r.concat(a))},ks=function(e){for(var t=this.cy(),n=this.nodes(),r=function(y){var m=bh(y),b=xh[m.linkage];return b!=null&&(m.linkage=b),m}(e),a=r.attributes,i=function(y,m){return Ir(r.distance,a.length,function(b){return a[b](y)},function(b){return a[b](m)},y,m)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var d={value:r.mode==="dendrogram"?n[c]:[n[c]],key:c,index:c};o[c]=d,u[c]=d,s[c]=[],l[c]=0}for(var h=0;h<o.length;h++)for(var p=0;p<=h;p++){var f=void 0;f=r.mode==="dendrogram"?h===p?1/0:i(o[h].value,o[p].value):h===p?1/0:i(o[h].value[0],o[p].value[0]),s[h][p]=f,s[p][h]=f,f<s[h][l[h]]&&(l[h]=p)}for(var g,v=Es(o,u,s,l,r);v;)v=Es(o,u,s,l,r);return r.mode==="dendrogram"?(g=Fa(o[0],r.dendrogramDepth,t),r.addDendrogram&&Va(o[0],t)):(g=new Array(o.length),o.forEach(function(y,m){y.key=y.index=null,g[m]=t.collection(y.value)})),g},wh={hierarchicalClustering:ks,hca:ks},Eh=Ke({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),kh=function(e,t,n,r){var a=function(i,o){return r[o](i)};return-Ir(e,r.length,function(i){return a(t,i)},function(i){return a(n,i)},t,n)},Th=function(e,t){var n=null;return n=t==="median"?function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,o=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],s=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5];arguments.length>3&&arguments[3]!==void 0&&!arguments[3]?(i<r.length&&r.splice(i,r.length-i),a>0&&r.splice(0,a)):r=r.slice(a,i);for(var l=0,u=r.length-1;u>=0;u--){var c=r[u];s?isFinite(c)||(r[u]=-1/0,l++):r.splice(u,1)}o&&r.sort(function(p,f){return p-f});var d=r.length,h=Math.floor(d/2);return d%2!=0?r[h+1+l]:(r[h-1+l]+r[h+l])/2}(e):t==="mean"?function(r){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,o=0,s=0,l=a;l<i;l++){var u=r[l];isFinite(u)&&(o+=u,s++)}return o/s}(e):t==="min"?function(r){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,o=1/0,s=a;s<i;s++){var l=r[s];isFinite(l)&&(o=Math.min(l,o))}return o}(e):t==="max"?function(r){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,o=-1/0,s=a;s<i;s++){var l=r[s];isFinite(l)&&(o=Math.max(l,o))}return o}(e):t,n},Ts=function(e,t,n){for(var r=[],a=0;a<e;a++){for(var i=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[a*e+l]>o&&(i=l,o=t[a*e+l])}i>0&&r.push(i)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},Cs=function(e){for(var t,n,r,a,i,o,s=this.cy(),l=this.nodes(),u=function(he){var ne=he.damping,se=he.preference;.5<=ne&&ne<1||Ie("Damping must range on [0.5, 1). Got: ".concat(ne));var le=["median","mean","min","max"];return le.some(function(de){return de===se})||ie(se)||Ie("Preference must be one of [".concat(le.map(function(de){return"'".concat(de,"'")}).join(", "),"] or a number. Got: ").concat(se)),Eh(he)}(e),c={},d=0;d<l.length;d++)c[l[d].id()]=d;n=(t=l.length)*t,r=new Array(n);for(var h=0;h<n;h++)r[h]=-1/0;for(var p=0;p<t;p++)for(var f=0;f<t;f++)p!==f&&(r[p*t+f]=kh(u.distance,l[p],l[f],u.attributes));a=Th(r,u.preference);for(var g=0;g<t;g++)r[g*t+g]=a;i=new Array(n);for(var v=0;v<n;v++)i[v]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),w=new Array(t),k=0;k<t;k++)m[k]=0,b[k]=0,w[k]=0;for(var E,x=new Array(t*u.minIterations),C=0;C<x.length;C++)x[C]=0;for(E=0;E<u.maxIterations;E++){for(var S=0;S<t;S++){for(var T=-1/0,D=-1/0,A=-1,B=0,M=0;M<t;M++)m[M]=i[S*t+M],(B=o[S*t+M]+r[S*t+M])>=T?(D=T,T=B,A=M):B>D&&(D=B);for(var L=0;L<t;L++)i[S*t+L]=(1-u.damping)*(r[S*t+L]-T)+u.damping*m[L];i[S*t+A]=(1-u.damping)*(r[S*t+A]-D)+u.damping*m[A]}for(var I=0;I<t;I++){for(var _=0,R=0;R<t;R++)m[R]=o[R*t+I],b[R]=Math.max(0,i[R*t+I]),_+=b[R];_-=b[I],b[I]=i[I*t+I],_+=b[I];for(var F=0;F<t;F++)o[F*t+I]=(1-u.damping)*Math.min(0,_-b[F])+u.damping*m[F];o[I*t+I]=(1-u.damping)*(_-b[I])+u.damping*m[I]}for(var z=0,Y=0;Y<t;Y++){var W=o[Y*t+Y]+i[Y*t+Y]>0?1:0;x[E%u.minIterations*t+Y]=W,z+=W}if(z>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var Z=0,G=0;G<t;G++){w[G]=0;for(var $=0;$<u.minIterations;$++)w[G]+=x[$*t+G];w[G]!==0&&w[G]!==u.minIterations||Z++}if(Z===t)break}}for(var V=function(he,ne,se){for(var le=[],de=0;de<he;de++)ne[de*he+de]+se[de*he+de]>0&&le.push(de);return le}(t,i,o),O=function(he,ne,se){for(var le=Ts(he,ne,se),de=0;de<se.length;de++){for(var P=[],N=0;N<le.length;N++)le[N]===se[de]&&P.push(N);for(var X=-1,H=-1/0,K=0;K<P.length;K++){for(var j=0,U=0;U<P.length;U++)j+=ne[P[U]*he+P[K]];j>H&&(X=K,H=j)}se[de]=P[X]}return Ts(he,ne,se)}(t,r,V),q={},Q=0;Q<V.length;Q++)q[V[Q]]=[];for(var ee=0;ee<l.length;ee++){var oe=O[c[l[ee].id()]];oe!=null&&q[oe].push(l[ee])}for(var ce=new Array(V.length),ve=0;ve<V.length;ve++)ce[ve]=s.collection(q[V[ve]]);return ce},Ch={affinityPropagation:Cs,ap:Cs},Ph=Ke({root:void 0,directed:!1}),Rr=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},s=function(u,c,d){u===d&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var h,p,f,g,v=e.getElementById(c).connectedEdges().intersection(e);v.size()===0?a.push(e.spawn(e.getElementById(c))):v.forEach(function(y){h=y.source().id(),p=y.target().id(),(f=h===c?p:h)!==d&&(g=y.id(),o[g]||(o[g]=!0,i.push({x:c,y:f,edge:y})),f in t?t[c].low=Math.min(t[c].low,t[f].id):(s(u,f,c),t[c].low=Math.min(t[c].low,t[f].low),t[c].id<=t[f].low&&(t[c].cutVertex=!0,function(m,b){for(var w=i.length-1,k=[],E=e.spawn();i[w].x!=m||i[w].y!=b;)k.push(i.pop().edge),w--;k.push(i.pop().edge),k.forEach(function(x){var C=x.connectedNodes().intersection(e);E.merge(x),C.forEach(function(S){var T=S.id(),D=S.connectedEdges().intersection(e);E.merge(S),t[T].cutVertex?E.merge(D.filter(function(A){return A.isLoop()})):E.merge(D)})}),a.push(E)}(c,f))))})};e.forEach(function(u){if(u.isNode()){var c=u.id();c in t||(r=0,s(c,c),t[c].cutVertex=r>1)}});var l=Object.keys(t).filter(function(u){return t[u].cutVertex}).map(function(u){return e.getElementById(u)});return{cut:e.spawn(l),components:a}},Lr=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(h){var p=h.target().id();p!==s&&(p in t||o(p),t[p].explored||(t[s].low=Math.min(t[s].low,t[p].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=a.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),d=l.merge(c);r.push(d),i=i.difference(d)}};return e.forEach(function(s){if(s.isNode()){var l=s.id();l in t||o(l)}}),{cut:i,components:r}},Ps={};[Un,_d,Dd,Md,Nd,Ld,Vd,Jd,xn,wn,La,lh,mh,wh,Ch,{hierholzer:function(e){if(!xe(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,a,i=Ph(e),o=i.root,s=i.directed,l=this,u=!1;o&&(a=fe(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach(function(y){var m=y.id();if(y.isNode()){var b=y.indegree(!0),w=y.outdegree(!0),k=b-w,E=w-b;k==1?n?u=!0:n=m:E==1?r?u=!0:r=m:(E>1||k>1)&&(u=!0),c[m]=[],y.outgoers().forEach(function(x){x.isEdge()&&c[m].push(x.id())})}else d[m]=[void 0,y.target().id()]}):l.forEach(function(y){var m=y.id();y.isNode()?(y.degree(!0)%2&&(n?r?u=!0:r=m:n=m),c[m]=[],y.connectedEdges().forEach(function(b){return c[m].push(b.id())})):d[m]=[y.source().id(),y.target().id()]});var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var p=function(y){for(var m,b,w,k=y,E=[y];c[k].length;)m=c[k].shift(),b=d[m][0],k!=(w=d[m][1])?(c[w]=c[w].filter(function(x){return x!=m}),k=w):s||k==b||(c[b]=c[b].filter(function(x){return x!=m}),k=b),E.unshift(m),E.unshift(k);return E},f=[],g=[];for(g=p(a);g.length!=1;)c[g[0]].length==0?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var v in f.unshift(l.getElementById(g.shift())),c)if(c[v].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:Rr,htbc:Rr,htb:Rr,hopcroftTarjanBiconnectedComponents:Rr},{tarjanStronglyConnected:Lr,tsc:Lr,tscc:Lr,tarjanStronglyConnectedComponents:Lr}].forEach(function(e){pe(Ps,e)});/*!
|
5
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
6
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
7
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
8
|
+
*/var mt=function(e){if(!(this instanceof mt))return new mt(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};mt.prototype={fulfill:function(e){return Ss(this,1,"fulfillValue",e)},reject:function(e){return Ss(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new mt;return n.onFulfilled.push(Ds(e,r,"fulfill")),n.onRejected.push(Ds(t,r,"reject")),Bs(n),r.proxy}};var Ss=function(e,t,n,r){return e.state===0&&(e.state=t,e[n]=r,Bs(e)),e},Bs=function(e){e.state===1?_s(e,"onFulfilled",e.fulfillValue):e.state===2&&_s(e,"onRejected",e.rejectReason)},_s=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var a=function(){for(var i=0;i<r.length;i++)r[i](n)};typeof setImmediate=="function"?setImmediate(a):setTimeout(a,0)}},Ds=function(e,t,n){return function(r){if(typeof e!="function")t[n].call(t,r);else{var a;try{a=e(r)}catch(i){return void t.reject(i)}As(t,a)}}},As=function(e,t){if(e!==t&&e.proxy!==t){var n;if(qe(t)==="object"&&t!==null||typeof t=="function")try{n=t.then}catch(a){return void e.reject(a)}if(typeof n!="function")e.fulfill(t);else{var r=!1;try{n.call(t,function(a){r||(r=!0,a===t?e.reject(new TypeError("circular thenable chain")):As(e,a))},function(a){r||(r=!0,e.reject(a))})}catch(a){r||e.reject(a)}}}else e.reject(new TypeError("cannot resolve promise with itself"))};mt.all=function(e){return new mt(function(t,n){for(var r=new Array(e.length),a=0,i=function(s,l){r[s]=l,++a===e.length&&t(r)},o=0;o<e.length;o++)(function(s){var l=e[s];l!=null&&l.then!=null?l.then(function(u){i(s,u)},function(u){n(u)}):i(s,l)})(o)})},mt.resolve=function(e){return new mt(function(t,n){t(e)})},mt.reject=function(e){return new mt(function(t,n){n(e)})};var Tn=typeof Promise<"u"?Promise:mt,qa=function(e,t,n){var r=xa(e),a=!r,i=this._private=pe({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&Me(i.complete)&&i.completes.push(i.complete),a){var o=e.position();i.startPosition=i.startPosition||{x:o.x,y:o.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var s=e.pan();i.startPan={x:s.x,y:s.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},rn=qa.prototype;pe(rn,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),lt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(s,l){var u=e[s];u!=null&&(e[s]=e[l],e[l]=u)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var a=e.style[r],i=a.name,o=e.startStyle[i];e.startStyle[i]=a,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return e==="frame"?t=n.frames:t=n.completes,new Tn(function(r,a){t.push(function(){r()})})}}),rn.complete=rn.completed,rn.run=rn.play,rn.running=rn.playing;var Ms,Is,Xa,Ns,Rs,Ls,zs,Os,Vs,Fs,qs,Xs,Ys,js,Ws,Hs,Ya,Gs,Ks,Us,Zs,$s,Qs,Js,ja,el,Wa,tl,Ha,nl,rl,al,il,ol,sl,ll,Ga,ul,Ka,cl,Ua,dl,hl,fl,Za,pl,gl,vl,yl,ml,bl,xl,wl,El,$a,kl,Tl,Cl,Pl,Sl,Bl,_l,Qa,Dl,Al,Ml,Il,Nl,Ja,Rl,Ll,zl,ei,Ol,ti,Vl,Fl,ql,ni,Xl,Yl,jl,ri,Wl,ai,Hl,Sh={animated:function(){return function(){var e=this,t=e.length!==void 0?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];return n?n._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++)t[n]._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=this,r=n.length!==void 0,a=r?n:[n],i=this._private.cy||this,o=!r,s=!o;if(!i.styleEnabled())return this;var l=i.style();if(e=pe({},e,t),Object.keys(e).length===0)return new qa(a[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var u=e.renderedPosition,c=i.pan(),d=i.zoom();e.position=as(u,d,c)}if(o&&e.panBy!=null){var h=e.panBy,p=i.pan();e.pan={x:p.x+h.x,y:p.y+h.y}}var f=e.center||e.centre;if(o&&f!=null){var g=i.getCenterPan(f.eles,e.zoom);g!=null&&(e.pan=g)}if(o&&e.fit!=null){var v=e.fit,y=i.getFitViewport(v.eles||v.boundingBox,v.padding);y!=null&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&xe(e.zoom)){var m=i.getZoomedViewport(e.zoom);m!=null?(m.zoomed&&(e.zoom=m.zoom),m.panned&&(e.pan=m.pan)):e.zoom=null}return new qa(a[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length!==void 0?n:[n];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=pe({},e,t));for(var a=0;a<r.length;a++){var i=r[a],o=i.animated()&&(e.queue===void 0||e.queue);i.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length!==void 0?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var i=0;i<r.length;i++){for(var o=r[i]._private,s=o.animation.current,l=0;l<s.length;l++){var u=s[l]._private;t&&(u.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return a.notify("draw"),this}}};function zr(){if(Is)return Ms;Is=1;var e=Array.isArray;return Ms=e}function Bh(){if(Fs)return Vs;Fs=1;var e,t=function(){if(Os)return zs;Os=1;var r=wr()["__core-js_shared__"];return zs=r}(),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Vs=function(r){return!!n&&n in r}}function _h(){if(js)return Ys;js=1;var e=function(){if(Ls)return Rs;Ls=1;var c=Yo(),d=jn();return Rs=function(h){if(!d(h))return!1;var p=c(h);return p=="[object Function]"||p=="[object GeneratorFunction]"||p=="[object AsyncFunction]"||p=="[object Proxy]"}}(),t=Bh(),n=jn(),r=function(){if(Xs)return qs;Xs=1;var c=Function.prototype.toString;return qs=function(d){if(d!=null){try{return c.call(d)}catch{}try{return d+""}catch{}}return""}}(),a=/^\[object .+?Constructor\]$/,i=Function.prototype,o=Object.prototype,s=i.toString,l=o.hasOwnProperty,u=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Ys=function(c){return!(!n(c)||t(c))&&(e(c)?u:a).test(r(c))}}function ii(){if(Gs)return Ya;Gs=1;var e=_h(),t=(Hs||(Hs=1,Ws=function(n,r){return n==null?void 0:n[r]}),Ws);return Ya=function(n,r){var a=t(n,r);return e(a)?a:void 0},Ya}function Or(){if(Us)return Ks;Us=1;var e=ii()(Object,"create");return Ks=e}function Dh(){if(al)return rl;al=1;var e=function(){if($s)return Zs;$s=1;var o=Or();return Zs=function(){this.__data__=o?o(null):{},this.size=0}}(),t=Js?Qs:(Js=1,Qs=function(o){var s=this.has(o)&&delete this.__data__[o];return this.size-=s?1:0,s}),n=function(){if(el)return ja;el=1;var o=Or(),s=Object.prototype.hasOwnProperty;return ja=function(l){var u=this.__data__;if(o){var c=u[l];return c==="__lodash_hash_undefined__"?void 0:c}return s.call(u,l)?u[l]:void 0},ja}(),r=function(){if(tl)return Wa;tl=1;var o=Or(),s=Object.prototype.hasOwnProperty;return Wa=function(l){var u=this.__data__;return o?u[l]!==void 0:s.call(u,l)},Wa}(),a=function(){if(nl)return Ha;nl=1;var o=Or();return Ha=function(s,l){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=o&&l===void 0?"__lodash_hash_undefined__":l,this},Ha}();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,rl=i}function Gl(){return ll?sl:(ll=1,sl=function(e,t){return e===t||e!=e&&t!=t})}function Vr(){if(ul)return Ga;ul=1;var e=Gl();return Ga=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1},Ga}function Ah(){if(vl)return gl;vl=1;var e=ol?il:(ol=1,il=function(){this.__data__=[],this.size=0}),t=function(){if(cl)return Ka;cl=1;var o=Vr(),s=Array.prototype.splice;return Ka=function(l){var u=this.__data__,c=o(u,l);return!(c<0||(c==u.length-1?u.pop():s.call(u,c,1),--this.size,0))},Ka}(),n=function(){if(dl)return Ua;dl=1;var o=Vr();return Ua=function(s){var l=this.__data__,u=o(l,s);return u<0?void 0:l[u][1]},Ua}(),r=function(){if(fl)return hl;fl=1;var o=Vr();return hl=function(s){return o(this.__data__,s)>-1}}(),a=function(){if(pl)return Za;pl=1;var o=Vr();return Za=function(s,l){var u=this.__data__,c=o(u,s);return c<0?(++this.size,u.push([s,l])):u[c][1]=l,this},Za}();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,gl=i}function Mh(){if(xl)return bl;xl=1;var e=Dh(),t=Ah(),n=function(){if(ml)return yl;ml=1;var r=ii()(wr(),"Map");return yl=r}();return bl=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}function Fr(){if(kl)return $a;kl=1;var e=El?wl:(El=1,wl=function(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null});return $a=function(t,n){var r=t.__data__;return e(n)?r[typeof n=="string"?"string":"hash"]:r.map},$a}function Ih(){if(Ml)return Al;Ml=1;var e=Mh(),t=function(){if(Cl)return Tl;Cl=1;var o=Fr();return Tl=function(s){var l=o(this,s).delete(s);return this.size-=l?1:0,l}}(),n=function(){if(Sl)return Pl;Sl=1;var o=Fr();return Pl=function(s){return o(this,s).get(s)}}(),r=function(){if(_l)return Bl;_l=1;var o=Fr();return Bl=function(s){return o(this,s).has(s)}}(),a=function(){if(Dl)return Qa;Dl=1;var o=Fr();return Qa=function(s,l){var u=o(this,s),c=u.size;return u.set(s,l),this.size+=u.size==c?0:1,this},Qa}();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Al=i}function Nh(){if(Rl)return Ja;Rl=1;var e=function(){if(Nl)return Il;Nl=1;var t=Ih();function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError("Expected a function");var i=function(){var o=arguments,s=a?a.apply(this,o):o[0],l=i.cache;if(l.has(s))return l.get(s);var u=r.apply(this,o);return i.cache=l.set(s,u)||l,u};return i.cache=new(n.Cache||t),i}return n.Cache=t,Il=n}();return Ja=function(t){var n=e(t,function(a){return r.size===500&&r.clear(),a}),r=n.cache;return n},Ja}function Kl(){if(zl)return Ll;zl=1;var e=Nh(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(o,s,l,u){i.push(l?u.replace(n,"$1"):s||o)}),i});return Ll=r}function Ul(){return Ol||(Ol=1,ei=function(e,t){for(var n=-1,r=e==null?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}),ei}function Zl(){if(ql)return Fl;ql=1;var e=function(){if(Vl)return ti;Vl=1;var t=Ea(),n=Ul(),r=zr(),a=Wn(),i=t?t.prototype:void 0,o=i?i.toString:void 0;return ti=function s(l){if(typeof l=="string")return l;if(r(l))return n(l,s)+"";if(a(l))return o?o.call(l):"";var u=l+"";return u=="0"&&1/l==-1/0?"-0":u},ti}();return Fl=function(t){return t==null?"":e(t)}}function $l(){if(Xl)return ni;Xl=1;var e=zr(),t=function(){if(Ns)return Xa;Ns=1;var a=zr(),i=Wn(),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;return Xa=function(l,u){if(a(l))return!1;var c=typeof l;return!(c!="number"&&c!="symbol"&&c!="boolean"&&l!=null&&!i(l))||s.test(l)||!o.test(l)||u!=null&&l in Object(u)},Xa}(),n=Kl(),r=Zl();return ni=function(a,i){return e(a)?a:t(a,i)?[a]:n(r(a))},ni}function oi(){if(jl)return Yl;jl=1;var e=Wn();return Yl=function(t){if(typeof t=="string"||e(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}}var Ql,Jl,si,eu,li,tu,nu,ru,ui,au,ci,iu,Rh=function(){if(Hl)return ai;Hl=1;var e=function(){if(Wl)return ri;Wl=1;var t=$l(),n=oi();return ri=function(r,a){for(var i=0,o=(a=t(a,r)).length;r!=null&&i<o;)r=r[n(a[i++])];return i&&i==o?r:void 0},ri}();return ai=function(t,n,r){var a=t==null?void 0:e(t,n);return a===void 0?r:a},ai}(),Lh=Yn(Rh);function zh(){if(eu)return si;eu=1;var e=function(){if(Jl)return Ql;Jl=1;var t=ii(),n=function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}}();return Ql=n}();return si=function(t,n,r){n=="__proto__"&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r},si}function Oh(){if(au)return ui;au=1;var e=function(){if(tu)return li;tu=1;var i=zh(),o=Gl(),s=Object.prototype.hasOwnProperty;return li=function(l,u,c){var d=l[u];s.call(l,u)&&o(d,c)&&(c!==void 0||u in l)||i(l,u,c)},li}(),t=$l(),n=function(){if(ru)return nu;ru=1;var i=/^(?:0|[1-9]\d*)$/;return nu=function(o,s){var l=typeof o;return!!(s=s??9007199254740991)&&(l=="number"||l!="symbol"&&i.test(o))&&o>-1&&o%1==0&&o<s}}(),r=jn(),a=oi();return ui=function(i,o,s,l){if(!r(i))return i;for(var u=-1,c=(o=t(o,i)).length,d=c-1,h=i;h!=null&&++u<c;){var p=a(o[u]),f=s;if(p==="__proto__"||p==="constructor"||p==="prototype")return i;if(u!=d){var g=h[p];(f=l?l(g,p,h):void 0)===void 0&&(f=r(g)?g:n(o[u+1])?[]:{})}e(h,p,f),h=h[p]}return i},ui}var ou,su,lu,uu,Vh=function(){if(iu)return ci;iu=1;var e=Oh();return ci=function(t,n,r){return t==null?t:e(t,n,r)},ci}(),Fh=Yn(Vh),qh=function(){if(uu)return lu;uu=1;var e=Ul(),t=(su||(su=1,ou=function(s,l){var u=-1,c=s.length;for(l||(l=Array(c));++u<c;)l[u]=s[u];return l}),ou),n=zr(),r=Wn(),a=Kl(),i=oi(),o=Zl();return lu=function(s){return n(s)?e(s,i):r(s)?[s]:t(a(o(s)))}}(),Xh=Yn(qh),Yh={data:function(e){return e=pe({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(t){},beforeSet:function(t,n){},onSet:function(t){},canSet:function(t){return!0}},e),function(t,n){var r=e,a=this,i=a.length!==void 0,o=i?a:[a],s=i?a[0]:a;if(fe(t)){var l,u=t.indexOf(".")!==-1&&Xh(t);if(r.allowGetting&&n===void 0)return s&&(r.beforeGet(s),l=u&&s._private[r.field][t]===void 0?Lh(s._private[r.field],u):s._private[r.field][t]),l;if(r.allowSetting&&n!==void 0&&!r.immutableKeys[t]){var c=ao({},t,n);r.beforeSet(a,c);for(var d=0,h=o.length;d<h;d++){var p=o[d];r.canSet(p)&&(u&&s._private[r.field][t]===void 0?Fh(p._private[r.field],u,n):p._private[r.field][t]=n)}r.updateStyle&&a.updateStyle(),r.onSet(a),r.settingTriggersEvent&&a[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&xe(t)){var f,g,v=t,y=Object.keys(v);r.beforeSet(a,v);for(var m=0;m<y.length;m++)if(g=v[f=y[m]],!r.immutableKeys[f])for(var b=0;b<o.length;b++){var w=o[b];r.canSet(w)&&(w._private[r.field][f]=g)}r.updateStyle&&a.updateStyle(),r.onSet(a),r.settingTriggersEvent&&a[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&Me(t)){var k=t;a.on(r.bindingEvent,k)}else if(r.allowGetting&&t===void 0){var E;return s&&(r.beforeGet(s),E=s._private[r.field]),E}return a}},removeData:function(e){return e=pe({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,a=r.length!==void 0?r:[r];if(fe(t)){for(var i=t.split(/\s+/),o=i.length,s=0;s<o;s++){var l=i[s];if(!Lt(l)&&!n.immutableKeys[l])for(var u=0,c=a.length;u<c;u++)a[u]._private[n.field][l]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(t===void 0){for(var d=0,h=a.length;d<h;d++)for(var p=a[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}}},jh={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(n,r){var a=this,i=Array.prototype.slice.call(arguments,0);return new Tn(function(o,s){var l=i.concat([function(c){a.off.apply(a,u),o(c)}]),u=l.concat([]);a.on.apply(a,l)})}}},Te={};[Sh,Yh,jh].forEach(function(e){pe(Te,e)});var Wh={animate:Te.animate(),animation:Te.animation(),animated:Te.animated(),clearQueue:Te.clearQueue(),delay:Te.delay(),delayAnimation:Te.delayAnimation(),stop:Te.stop()},qr={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(h){return n.push(h)}),n}Ce(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],a=new vn(e),i=0;i<t.length;i++){for(var o=t[i],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var d=e[c];if(!l.has(d)){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=a,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Ce(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,a=[],i=0,o=n.length;i<o;i++)for(var s=n[i],l=s._private.classes,u=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d),p=!1;t||r&&!h?(l.add(d),p=!0):(!t||r&&h)&&(l.delete(d),p=!0),!u&&p&&(a.push(s),u=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};qr.className=qr.classNames=qr.classes;var we={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Ye,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};we.variable="(?:[\\w-.]|(?:\\\\"+we.metaChar+"))+",we.className="(?:[\\w-]|(?:\\\\"+we.metaChar+"))+",we.value=we.string+"|"+we.number,we.id=we.variable,function(){var e,t,n;for(e=we.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],we.comparatorOp+="|@"+t;for(e=we.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||t!=="="&&(we.comparatorOp+="|\\!"+t)}();var di=0,cu=1,du=2,hi=3,fi=4,pi=5,gi=6,vi=7,Xr=8,yi=9,mi=10,bi=11,hu=12,fu=13,xi=14,wi=15,Ei=16,Yr=17,jr=18,Wr=19,Cn=20,ki=[{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(n,r){return-1*Vo(n,r)}(e.selector,t.selector)}),Hh=function(){for(var e,t={},n=0;n<ki.length;n++)t[(e=ki[n]).selector]=e.matches;return t}(),Gh="("+ki.map(function(e){return e.selector}).join("|")+")",Pn=function(e){return e.replace(new RegExp("\\\\("+we.metaChar+")","g"),function(t,n){return n})},Xt=function(e,t,n){e[e.length-1]=n},Ti=[{name:"group",query:!0,regex:"("+we.group+")",populate:function(e,t,n){var r=Fe(n,1)[0];t.checks.push({type:di,value:r==="*"?r:r+"s"})}},{name:"state",query:!0,regex:Gh,populate:function(e,t,n){var r=Fe(n,1)[0];t.checks.push({type:vi,value:r})}},{name:"id",query:!0,regex:"\\#("+we.id+")",populate:function(e,t,n){var r=Fe(n,1)[0];t.checks.push({type:Xr,value:Pn(r)})}},{name:"className",query:!0,regex:"\\.("+we.className+")",populate:function(e,t,n){var r=Fe(n,1)[0];t.checks.push({type:yi,value:Pn(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+we.variable+")\\s*\\]",populate:function(e,t,n){var r=Fe(n,1)[0];t.checks.push({type:fi,field:Pn(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+we.variable+")\\s*("+we.comparatorOp+")\\s*("+we.value+")\\s*\\]",populate:function(e,t,n){var r=Fe(n,3),a=r[0],i=r[1],o=r[2];o=new RegExp("^"+we.string+"$").exec(o)!=null?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:hi,field:Pn(a),operator:i,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+we.boolOp+")\\s*("+we.variable+")\\s*\\]",populate:function(e,t,n){var r=Fe(n,2),a=r[0],i=r[1];t.checks.push({type:pi,field:Pn(i),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+we.meta+")\\s*("+we.comparatorOp+")\\s*("+we.number+")\\s*\\]\\]",populate:function(e,t,n){var r=Fe(n,3),a=r[0],i=r[1],o=r[2];t.checks.push({type:gi,field:Pn(a),operator:i,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:we.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,a=e.compoundCount,i=e[e.length-1];return n!=null&&(i.subject=n,e.currentSubject=null),i.edgeCount=r,i.compoundCount=a,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:we.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n={checks:[]},r=t,a={checks:[]};return n.checks.push({type:bi,source:r,target:a}),Xt(e,0,n),e.edgeCount++,a}var i={checks:[]},o=t,s={checks:[]};return i.checks.push({type:hu,source:o,target:s}),Xt(e,0,i),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:we.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n={checks:[]},r=t,a={checks:[]};return n.checks.push({type:mi,nodes:[r,a]}),Xt(e,0,n),e.edgeCount++,a}var i={checks:[]},o=t,s={checks:[]};return i.checks.push({type:xi,node:o,neighbor:s}),Xt(e,0,i),s}},{name:"child",separator:!0,regex:we.child,populate:function(e,t){if(e.currentSubject==null){var n={checks:[]},r={checks:[]},a=e[e.length-1];return n.checks.push({type:wi,parent:a,child:r}),Xt(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var i={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return i.checks.push({type:Wr,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Cn}],c.checks.push({type:Cn}),s.checks.push({type:Yr,parent:c,child:u}),Xt(e,0,i),e.currentSubject=l,e.compoundCount++,u}var d={checks:[]},h={checks:[]},p=[{type:Yr,parent:d,child:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:we.descendant,populate:function(e,t){if(e.currentSubject==null){var n={checks:[]},r={checks:[]},a=e[e.length-1];return n.checks.push({type:Ei,ancestor:a,descendant:r}),Xt(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var i={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return i.checks.push({type:Wr,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Cn}],c.checks.push({type:Cn}),s.checks.push({type:jr,ancestor:c,descendant:u}),Xt(e,0,i),e.currentSubject=l,e.compoundCount++,u}var d={checks:[]},h={checks:[]},p=[{type:jr,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:we.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return ke("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=n==null?null:n.type;r===bi?n.type=fu:r===mi&&(n.type=xi,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Ti.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var Kh=function(e){for(var t,n,r,a=0;a<Ti.length;a++){var i=Ti[a],o=i.name,s=e.match(i.regexObj);if(s!=null){n=s,t=i,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},Uh={parse:function(e){var t=this,n=t.inputText=e,r=t[0]={checks:[]};for(t.length=1,n=function(c){var d=c.match(/^\s+/);if(d){var h=d[0];c=c.substring(h.length)}return c}(n);;){var a=Kh(n);if(a.expr==null)return ke("The selector `"+e+"`is invalid"),!1;var i=a.match.slice(1),o=a.expr.populate(t,r,i);if(o===!1)return!1;if(o!=null&&(r=o),(n=a.remaining).match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var u=t[l];if(u.compoundCount>0&&u.edgeCount>0)return ke("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return ke("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;u.edgeCount===1&&ke("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(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l??""},t=function(l){return fe(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,u){var c=l.type,d=l.value;switch(c){case di:var h=e(d);return h.substring(0,h.length-1);case hi:var p=l.field,f=l.operator;return"["+p+n(e(f))+t(d)+"]";case pi:var g=l.operator,v=l.field;return"["+e(g)+v+"]";case fi:return"["+l.field+"]";case gi:var y=l.operator;return"[["+l.field+n(e(y))+t(d)+"]]";case vi:return d;case Xr:return"#"+d;case yi:return"."+d;case Yr:case wi:return a(l.parent,u)+n(">")+a(l.child,u);case jr:case Ei:return a(l.ancestor,u)+" "+a(l.descendant,u);case Wr:var m=a(l.left,u),b=a(l.subject,u),w=a(l.right,u);return m+(m.length>0?" ":"")+b+w;case Cn:return""}},a=function(l,u){return l.checks.reduce(function(c,d,h){return c+(u===l&&h===0?"$":"")+r(d,u)},"")},i="",o=0;o<this.length;o++){var s=this[o];i+=a(s,s.subject),this.length>1&&o<this.length-1&&(i+=", ")}return this.toStringCache=i,i}},pu=function(e,t,n){var r,a,i,o=fe(e),s=ie(e),l=fe(n),u=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(a=o||s?""+e:"",i=""+n),u&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=a.indexOf(i)===0;break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return!c||e==null&&d||(r=!r),r},Ci=function(e,t){return e.data(t)},Ne=[],De=function(e,t){return e.checks.every(function(n){return Ne[n.type](n,t)})};Ne[di]=function(e,t){var n=e.value;return n==="*"||n===t.group()},Ne[vi]=function(e,t){return function(n,r){return Hh[n](r)}(e.value,t)},Ne[Xr]=function(e,t){var n=e.value;return t.id()===n},Ne[yi]=function(e,t){var n=e.value;return t.hasClass(n)},Ne[gi]=function(e,t){var n=e.field,r=e.operator,a=e.value;return pu(function(i,o){return i[o]()}(t,n),r,a)},Ne[hi]=function(e,t){var n=e.field,r=e.operator,a=e.value;return pu(Ci(t,n),r,a)},Ne[pi]=function(e,t){var n=e.field,r=e.operator;return function(a,i){switch(i){case"?":return!!a;case"!":return!a;case"^":return a===void 0}}(Ci(t,n),r)},Ne[fi]=function(e,t){var n=e.field;return e.operator,Ci(t,n)!==void 0},Ne[mi]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),i=t.target();return De(n,a)&&De(r,i)||De(r,a)&&De(n,i)},Ne[xi]=function(e,t){return De(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&De(e.neighbor,n)})},Ne[bi]=function(e,t){return De(e.source,t.source())&&De(e.target,t.target())},Ne[hu]=function(e,t){return De(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&De(e.target,n)})},Ne[fu]=function(e,t){return De(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&De(e.source,n)})},Ne[wi]=function(e,t){return De(e.child,t)&&De(e.parent,t.parent())},Ne[Yr]=function(e,t){return De(e.parent,t)&&t.children().some(function(n){return De(e.child,n)})},Ne[Ei]=function(e,t){return De(e.descendant,t)&&t.ancestors().some(function(n){return De(e.ancestor,n)})},Ne[jr]=function(e,t){return De(e.ancestor,t)&&t.descendants().some(function(n){return De(e.descendant,n)})},Ne[Wr]=function(e,t){return De(e.subject,t)&&De(e.left,t)&&De(e.right,t)},Ne[Cn]=function(){return!0},Ne[cu]=function(e,t){return e.value.has(t)},Ne[du]=function(e,t){return(0,e.value)(t)};var Zh={matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(De(n,e))return!0}return!1},filter:function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===Xr)return e.getElementById(t[0].checks[0].value).collection();var n=function(r){for(var a=0;a<t.length;a++){var i=t[a];if(De(i,r))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)}},Yt=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||fe(e)&&e.match(/^\s*$/)||(lt(e)?this.addQuery({checks:[{type:cu,value:e.collection()}]}):Me(e)?this.addQuery({checks:[{type:du,value:e}]}):fe(e)?this.parse(e)||(this.invalid=!0):Ie("A selector must be created from a string; found "))},jt=Yt.prototype;[Uh,Zh].forEach(function(e){return pe(jt,e)}),jt.text=function(){return this.inputText},jt.size=function(){return this.length},jt.eq=function(e){return this[e]},jt.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},jt.addQuery=function(e){this[this.length++]=e},jt.selector=jt.toString;var Wt={allAre:function(e){var t=new Yt(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new Yt(e);return this.some(function(n){return t.matches(n)})},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&&(t===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};Wt.allAreNeighbours=Wt.allAreNeighbors,Wt.has=Wt.contains,Wt.equal=Wt.equals=Wt.same;var Hr,gu,ht=function(e,t){return function(n,r,a,i){var o,s=n,l=this;if(s==null?o="":lt(s)&&s.length===1&&(o=s.id()),l.length===1&&o){var u=l[0]._private,c=u.traversalCache=u.traversalCache||{},d=c[t]=c[t]||[],h=Jt(o),p=d[h];return p||(d[h]=e.call(l,n,r,a,i))}return e.call(l,n,r,a,i)}},Sn={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var a=this[r]._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:ht(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,a=0;a<r.length;a++)t.push(r[a]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];return function n(r){for(var a=0;a<r.length;a++){var i=r[a];t.push(i),i.children().nonempty()&&n(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function Pi(e,t,n,r){for(var a=[],i=new vn,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?a.push(l):o&&r(a,i,l)}for(;a.length>0;){var u=a.shift();t(u),i.add(u.id()),o&&r(a,i,u)}return e}function vu(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];t.has(i.id())||e.push(i)}}function yu(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function $h(e,t,n){yu(e,t,n),vu(e,t,n)}Sn.forEachDown=function(e){return Pi(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],vu)},Sn.forEachUp=function(e){return Pi(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],yu)},Sn.forEachUpAndDown=function(e){return Pi(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],$h)},Sn.ancestors=Sn.parents,(Hr=gu={data:Te.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:Te.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Te.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Te.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Te.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Te.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Hr.data,Hr.removeAttr=Hr.removeData;var bt,mu,Qh=gu,Gr={};function Si(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;o<i.length;o++){var s=i[o];!t&&s.isLoop()||(r+=e(a,s))}return r}}}function Bn(e,t){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var o=a[i][e](n);o===void 0||r!==void 0&&!t(o,r)||(r=o)}return r}}pe(Gr,{degree:Si(function(e,t){return t.source().same(t.target())?2:1}),indegree:Si(function(e,t){return t.target().same(e)?1:0}),outdegree:Si(function(e,t){return t.source().same(e)?1:0})}),pe(Gr,{minDegree:Bn("degree",function(e,t){return e<t}),maxDegree:Bn("degree",function(e,t){return e>t}),minIndegree:Bn("indegree",function(e,t){return e<t}),maxIndegree:Bn("indegree",function(e,t){return e>t}),minOutdegree:Bn("outdegree",function(e,t){return e<t}),maxOutdegree:Bn("outdegree",function(e,t){return e>t})}),pe(Gr,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var bu=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(!a.locked()){var i=a._private.position,o={x:t.x!=null?t.x-i.x:0,y:t.y!=null?t.y-i.y:0};!a.isParent()||o.x===0&&o.y===0||a.children().shift(o,n),a.dirtyBoundingBoxCache()}}},xu={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){bu(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};bt=mu={position:Te.data(xu),silentPosition:Te.data(pe({},xu,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){bu(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(xe(e))t?this.silentPosition(e):this.position(e);else if(Me(e)){var n=e,r=this.cy();r.startBatch();for(var a=0;a<this.length;a++){var i,o=this[a];(i=n(o,a))&&(t?o.silentPosition(i):o.position(i))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(xe(e)?(r={x:ie(e.x)?e.x:0,y:ie(e.y)?e.y:0},n=t):fe(e)&&ie(t)&&((r={x:0,y:0})[e]=t),r!=null){var a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i];if(!(a.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}a.endBatch()}return this},silentShift:function(e,t){return xe(e)?this.shift(e,!0):fe(e)&&ie(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),a=r.zoom(),i=r.pan(),o=xe(e)?e:void 0,s=o!==void 0||t!==void 0&&fe(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=Pr(l,a,i),e===void 0?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];t!==void 0?c.position(e,(t-i[e])/a):o!==void 0&&c.position(as(o,a,i))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),a=xe(e)?e:void 0,i=a!==void 0||t!==void 0&&fe(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!i){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},e===void 0?a:a[e]}for(var h=0;h<this.length;h++){var p=this[h],f=o?p.parent():null,g=f&&f.length>0,v=g;g&&(f=f[0]);var y=v?f.position():{x:0,y:0};t!==void 0?p.position(e,t+y[e]):a!==void 0&&p.position({x:a.x+y.x,y:a.y+y.y})}}else if(!i)return;return this}},bt.modelPosition=bt.point=bt.position,bt.modelPositions=bt.points=bt.positions,bt.renderedPoint=bt.renderedPosition,bt.relativePoint=bt.relativePosition;var _n,Ht,Jh=mu;_n=Ht={},Ht.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}},Ht.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this):this},Ht.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(o){if(o.isParent()){var s=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),h=s.position;d.w!==0&&d.h!==0||((d={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue}).x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);var p=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(p=100*p/c.width.val);var f=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(f=100*f/c.width.val);var g=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(g=100*g/c.height.val);var v=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(v=100*v/c.height.val);var y=x(c.width.val-d.w,p,f),m=y.biasDiff,b=y.biasComplementDiff,w=x(c.height.val-d.h,g,v),k=w.biasDiff,E=w.biasComplementDiff;s.autoPadding=function(C,S,T,D){if(T.units!=="%")return T.units==="px"?T.pfValue:0;switch(D){case"width":return C>0?T.pfValue*C:0;case"height":return S>0?T.pfValue*S:0;case"average":return C>0&&S>0?T.pfValue*(C+S)/2:0;case"min":return C>0&&S>0?C>S?T.pfValue*S:T.pfValue*C:0;case"max":return C>0&&S>0?C>S?T.pfValue*C:T.pfValue*S:0;default:return 0}}(d.w,d.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(d.w,c.width.val),h.x=(-m+d.x1+d.x2+b)/2,s.autoHeight=Math.max(d.h,c.height.val),h.y=(-k+d.y1+d.y2+E)/2}function x(C,S,T){var D=0,A=0,B=S+T;return C>0&&B>0&&(D=S/B*C,A=T/B*C),{biasDiff:D,biasComplementDiff:A}}}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;i.compoundBoundsClean&&!e||(n(a),t.batching()||(i.compoundBoundsClean=!0))}return this};var ft=function(e){return e===1/0||e===-1/0?0:e},xt=function(e,t,n,r,a){r-t!==0&&a-n!==0&&t!=null&&n!=null&&r!=null&&a!=null&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Gt=function(e,t){return t==null?e:xt(e,t.x1,t.y1,t.x2,t.y2)},tr=function(e,t,n){return ot(e,t,n)},Kr=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if(t.pstyle(n+"-arrow-shape").value!=="none"){n==="source"?(r=o.srcX,a=o.srcY):n==="target"?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var l=i.arrowBounds=i.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Br(u,1),xt(e,u.x1,u.y1,u.x2,u.y2)}}},Bi=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=tr(i,"labelWidth",n),p=tr(i,"labelHeight",n),f=tr(i,"labelX",n),g=tr(i,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,k=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,x=p,C=h,S=C/2,T=x/2;if(m)o=f-S,s=f+S,l=g-T,u=g+T;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-x,u=g;break;case"center":l=g-T,u=g+T;break;case"bottom":l=g,u=g+x}}var D=v-Math.max(w,k)-E-2,A=v+Math.max(w,k)+E+2,B=y-Math.max(w,k)-E-2,M=y+Math.max(w,k)+E+2;o+=D,s+=A,l+=B,u+=M;var L=n||"main",I=a.labelBounds,_=I[L]=I[L]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l,_.leftPad=D,_.rightPad=A,_.topPad=B,_.botPad=M;var R=m&&b.strValue==="autorotate",F=b.pfValue!=null&&b.pfValue!==0;if(R||F){var z=R?tr(a.rstyle,"labelAngle",n):b.pfValue,Y=Math.cos(z),W=Math.sin(z),Z=(o+s)/2,G=(l+u)/2;if(!m){switch(c.value){case"left":Z=s;break;case"right":Z=o}switch(d.value){case"top":G=u;break;case"bottom":G=l}}var $=function(ce,ve){return{x:(ce-=Z)*Y-(ve-=G)*W+Z,y:ce*W+ve*Y+G}},V=$(o,l),O=$(o,u),q=$(s,l),Q=$(s,u);o=Math.min(V.x,O.x,q.x,Q.x),s=Math.max(V.x,O.x,q.x,Q.x),l=Math.min(V.y,O.y,q.y,Q.y),u=Math.max(V.y,O.y,q.y,Q.y)}var ee=L+"Rot",oe=I[ee]=I[ee]||{};oe.x1=o,oe.y1=l,oe.x2=s,oe.y2=u,oe.w=s-o,oe.h=u-l,xt(e,o,l,s,u),xt(a.labelBounds.all,o,l,s,u)}return e}},wu=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;Eu(e,t,n,r,"outside",r/2)}},Eu=function(e,t,n,r,a,i){if(!(n===0||r<=0||a==="inside")){var o=t.cy(),s=t.pstyle("shape").value,l=o.renderer().nodeShapes[s],u=t.position(),c=u.x,d=u.y,h=t.width(),p=t.height();if(l.hasMiterBounds){a==="center"&&(r/=2);var f=l.miterBounds(c,d,h,p,r);Gt(e,f)}else i!=null&&i>0&&_r(e,[i,i,i,i])}},ef=function(e,t){var n,r,a,i,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=nt(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(O){return O.pstyle("display").value!=="none"},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var w=0;c&&t.includeOverlays&&e.pstyle("overlay-opacity").value!==0&&(w=e.pstyle("overlay-padding").value);var k=0;c&&t.includeUnderlays&&e.pstyle("underlay-opacity").value!==0&&(k=e.pstyle("underlay-padding").value);var E=Math.max(w,k),x=0;if(c&&(x=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,T=e.outerHeight()/2;xt(h,n=o-S,a=s-T,r=o+S,i=s+T),c&&wu(h,e),c&&t.includeOutlines&&!d&&wu(h,e),c&&function(O,q){if(!q.cy().headless()){var Q=q.pstyle("border-opacity").value,ee=q.pstyle("border-width").pfValue,oe=q.pstyle("border-position").value;Eu(O,q,Q,ee,oe)}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),a=Math.min(v.srcY,v.midY,v.tgtY),i=Math.max(v.srcY,v.midY,v.tgtY),xt(h,n-=x,a-=x,r+=x,i+=x),D==="haystack"){var A=v.haystackPts;if(A&&A.length===2){if(n=A[0].x,a=A[0].y,n>(r=A[1].x)){var B=n;n=r,r=B}if(a>(i=A[1].y)){var M=a;a=i,i=M}xt(h,n-x,a-x,r+x,i+x)}}else if(D==="bezier"||D==="unbundled-bezier"||zt(D,"segments")||zt(D,"taxi")){var L;switch(D){case"bezier":case"unbundled-bezier":L=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":L=v.linePts}if(L!=null)for(var I=0;I<L.length;I++){var _=L[I];n=_.x-x,r=_.x+x,a=_.y-x,i=_.y+x,xt(h,n,a,r,i)}}}else{var R=e.source().position(),F=e.target().position();if((n=R.x)>(r=F.x)){var z=n;n=r,r=z}if((a=R.y)>(i=F.y)){var Y=a;a=i,i=Y}xt(h,n-=x,a-=x,r+=x,i+=x)}if(c&&t.includeEdges&&g&&(Kr(h,e,"mid-source"),Kr(h,e,"mid-target"),Kr(h,e,"source"),Kr(h,e,"target")),c&&e.pstyle("ghost").value==="yes"){var W=e.pstyle("ghost-offset-x").pfValue,Z=e.pstyle("ghost-offset-y").pfValue;xt(h,h.x1+W,h.y1+Z,h.x2+W,h.y2+Z)}var G=p.bodyBounds=p.bodyBounds||{};os(G,h),_r(G,y),Br(G,1),c&&(n=h.x1,r=h.x2,a=h.y1,i=h.y2,xt(h,n-E,a-E,r+E,i+E));var $=p.overlayBounds=p.overlayBounds||{};os($,h),_r($,y),Br($,1);var V=p.labelBounds=p.labelBounds||{};V.all!=null?((l=V.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):V.all=nt(),c&&t.includeLabels&&(t.includeMainLabels&&Bi(h,e,null),g&&(t.includeSourceLabels&&Bi(h,e,"source"),t.includeTargetLabels&&Bi(h,e,"target")))}return h.x1=ft(h.x1),h.y1=ft(h.y1),h.x2=ft(h.x2),h.y2=ft(h.y2),h.w=ft(h.x2-h.x1),h.h=ft(h.y2-h.y1),h.w>0&&h.h>0&&b&&(_r(h,y),Br(h,1)),h},ku=function(e){var t=0,n=function(a){return(a?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines)},Tu=function(e){var t=function(i){return Math.round(i)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return Ho([t(n.x),t(n.y),t(r.x),t(r.y)])}var a=e.position();return Ho([t(a.x),t(a.y)])},Cu=function(e,t){var n,r=e._private,a=e.isEdge(),i=(t==null?Pu:ku(t))===Pu;if(r.bbCache==null?(n=ef(e,nr),r.bbCache=n,r.bbCachePosKey=Tu(e)):n=r.bbCache,!i){var o=e.isNode();n=nt(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?Gt(n,r.overlayBounds):Gt(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?Gt(n,r.labelBounds.all):(t.includeMainLabels&&Gt(n,r.labelBounds.mainRot),t.includeSourceLabels&&Gt(n,r.labelBounds.sourceRot),t.includeTargetLabels&&Gt(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},nr={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Pu=ku(nr),Su=Ke(nr);Ht.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=pn(function(u){var c=u._private;return c.bbCache==null||c.styleDirty||c.bbCachePosKey!==Tu(u)},function(u){return u.id()});if(n&&this.length===1&&!r(this[0]))e=e===void 0?nr:Su(e),t=Cu(this[0],e);else{t=nt();var a=Su(e=e||nr),i=this,o=i.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<i.length;s++){var l=i[s];r(l)&&l.dirtyBoundingBoxCache(),Gt(t,Cu(l,a))}}return t.x1=ft(t.x1),t.y1=ft(t.y1),t.x2=ft(t.x2),t.y2=ft(t.y2),t.w=ft(t.x2-t.x1),t.h=ft(t.y2-t.y1),t},Ht.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},Ht.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter(function(s){return s.isParent()}),t=t.not(a)),xe(e)){var i=e;e=function(){return i}}n.startBatch(),t.forEach(function(s,l){return s._private.bbAtOldPos=e(s,l)}).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var o=function(s){return{x1:s.x1,x2:s.x2,w:s.w,y1:s.y1,y2:s.y2,h:s.h}}(this.boundingBox({useCache:!1}));return t.silentPositions(function(s){return s._private.bbAtOldPos}),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),o},_n.boundingbox=_n.bb=_n.boundingBox,_n.renderedBoundingbox=_n.renderedBoundingBox;var rr,ar,tf=Ht;rr=ar={};var Bu=function(e){e.uppercaseName=Oo(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Oo(e.outerName),rr[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var a=t.pstyle(e.name);return a.strValue==="label"?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):a.pfValue}return 1}},rr["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t){if(n){var r=t[e.name](),a=t.pstyle("border-position").value;return r+(a==="center"?t.pstyle("border-width").pfValue:a==="outside"?2*t.pstyle("border-width").pfValue:0)+2*t.padding()}return 1}},rr["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},rr["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};Bu({name:"width"}),Bu({name:"height"}),ar.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},ar.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},ar.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var nf=ar,_u={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)}}},rf=Object.keys(_u).reduce(function(e,t){var n=_u[t],r=function(a){return"rendered"+a[0].toUpperCase()+a.substr(1)}(t);return e[t]=function(){return function(a,i){if(a.isEdge()&&a.takesUpSpace())return i(a)}(this,n.get)},n.mult?e[r]=function(){return function(a,i){if(a.isEdge()&&a.takesUpSpace()){var o=a.cy(),s=o.pan(),l=o.zoom();return i(a).map(function(u){return Pr(u,l,s)})}}(this,n.get)}:e[r]=function(){return function(a,i){if(a.isEdge()&&a.takesUpSpace()){var o=a.cy();return Pr(i(a),o.zoom(),o.pan())}}(this,n.get)},e},{}),af=pe({},Jh,tf,nf,rf),Du=function(e,t){this.recycle(e,t)};function ir(){return!1}function Ur(){return!0}Du.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ir,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ur:ir):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*r+a.x,y:n.y*r+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Ur;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ur;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ur,this.stopPropagation()},isDefaultPrevented:ir,isPropagationStopped:ir,isImmediatePropagationStopped:ir};var Au=/^([^.]+)(\.(?:[^.]+))?$/,Mu={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},Iu=Object.keys(Mu),of={};function Zr(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:of,t=arguments.length>1?arguments[1]:void 0,n=0;n<Iu.length;n++){var r=Iu[n];this[r]=e[r]||Mu[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Kt=Zr.prototype,Nu=function(e,t,n,r,a,i,o){Me(r)&&(a=r,r=null),o&&(i=i==null?o:pe({},i,o));for(var s=Ce(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!Lt(u)){var c=u.match(Au);if(c&&t(e,u,c[1],c[2]?c[2]:null,r,a,i)===!1)break}}},Ru=function(e,t){return e.addEventFields(e.context,t),new Du(t.type,t)},sf=function(e,t,n){if(qn(n)!=="event")if(xe(n))t(e,Ru(e,n));else for(var r=Ce(n)?n:n.split(/\s+/),a=0;a<r.length;a++){var i=r[a];if(!Lt(i)){var o=i.match(Au);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,Ru(e,{type:s,namespace:l,target:e.context}))}}}else t(e,n)};Kt.on=Kt.addListener=function(e,t,n,r,a){return Nu(this,function(i,o,s,l,u,c,d){Me(c)&&i.listeners.push({event:o,callback:c,type:s,namespace:l,qualifier:u,conf:d})},e,t,n,r,a),this},Kt.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Kt.removeListener=Kt.off=function(e,t,n,r){var a=this;this.emitting!==0&&(this.listeners=this.listeners.slice());for(var i=this.listeners,o=function(l){var u=i[l];Nu(a,function(c,d,h,p,f,g){if((u.type===h||e==="*")&&(!p&&u.namespace!==".*"||u.namespace===p)&&(!f||c.qualifierCompare(u.qualifier,f))&&(!g||u.callback===g))return i.splice(l,1),!1},e,t,n,r)},s=i.length-1;s>=0;s--)o(s);return this},Kt.removeAllListeners=function(){return this.removeListener("*")},Kt.emit=Kt.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,Ce(t)||(t=[t]),sf(this,function(i,o){n!=null&&(r=[{event:o.event,type:o.type,namespace:o.namespace,callback:n}],a=r.length);for(var s=function(){var u=r[l];if(u.type===o.type&&(!u.namespace||u.namespace===o.namespace||u.namespace===".*")&&i.eventMatches(i.context,u,o)){var c=[o];t!=null&&function(p,f){for(var g=0;g<f.length;g++){var v=f[g];p.push(v)}}(c,t),i.beforeEmit(i.context,u,o),u.conf&&u.conf.one&&(i.listeners=i.listeners.filter(function(p){return p!==u}));var d=i.callbackContext(i.context,u,o),h=u.callback.apply(d,c);i.afterEmit(i.context,u,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l<a;l++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,t)},e),this.emitting--,this};var lf={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null||e!==n.target&&Xn(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},$r=function(e){return fe(e)?new Yt(e):e},Lu={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Zr(lf,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=$r(t),a=0;a<this.length;a++)this[a].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=$r(t),a=0;a<this.length;a++)this[a].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=$r(t),a=0;a<this.length;a++)this[a].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=$r(t),a=0;a<this.length;a++)this[a].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(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};Te.eventAliasesOn(Lu);var zu={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(fe(e)||lt(e))return new Yt(e).filter(this);if(Me(e)){for(var n=this.spawn(),r=this,a=0;a<r.length;a++){var i=r[a];(t?e.apply(t,[i,a,r]):e(i,a,r))&&n.push(i)}return n}return this.spawn()},not:function(e){if(e){fe(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(fe(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=e,a=this.length<e.length,i=a?this:r,o=a?r:this,s=0;s<i.length;s++){var l=i[s];o.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var n=this.spawn(),r=e,a=function(i,o){for(var s=0;s<i.length;s++){var l=i[s],u=l._private.data.id;o.hasElementWithId(u)||n.push(l)}};return a(this,r),a(r,this),n},diff:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),a=this.spawn(),i=e,o=function(s,l,u){for(var c=0;c<s.length;c++){var d=s[c],h=d._private.data.id;l.hasElementWithId(h)?a.merge(d):u.push(d)}};return o(this,i,n),o(i,this,r),{left:n,right:r,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(fe(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),a=0;a<e.length;a++){var i=e[a],o=!this.has(i);o&&r.push(i)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&fe(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=t.map,i=0;i<e.length;i++){var o=e[i],s=o._private.data.id;if(!a.has(s)){var l=this.length++;this[l]=o,a.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&fe(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;a<r.length;a++){var i=r[a],o=t?e.apply(t,[i,a,r]):e(i,a,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,a=0;a<r.length;a++)n=e(n,r[a],a,r);return n},max:function(e,t){for(var n,r=-1/0,a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s<r&&(r=s,n=o)}return{value:r,ele:n}}},Ee=zu;Ee.u=Ee["|"]=Ee["+"]=Ee.union=Ee.or=Ee.add,Ee["\\"]=Ee["!"]=Ee["-"]=Ee.difference=Ee.relativeComplement=Ee.subtract=Ee.not,Ee.n=Ee["&"]=Ee["."]=Ee.and=Ee.intersection=Ee.intersect,Ee["^"]=Ee["(+)"]=Ee["(-)"]=Ee.symmetricDifference=Ee.symdiff=Ee.xor,Ee.fnFilter=Ee.filterFn=Ee.stdFilter=Ee.filter,Ee.complement=Ee.abscomp=Ee.absoluteComplement;var Ou=function(e,t){var n=e.cy().hasCompoundNodes();function r(l){var u=l.pstyle("z-compound-depth");return u.value==="auto"?n?l.zDepth():0:u.value==="bottom"?-1:u.value==="top"?Ta:0}var a=r(e)-r(t);if(a!==0)return a;function i(l){return l.pstyle("z-index-compare").value==="auto"&&l.isNode()?1:0}var o=i(e)-i(t);if(o!==0)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return s!==0?s:e.poolIndex()-t.poolIndex()},Qr={forEach:function(e,t){if(Me(e))for(var n=this.length,r=0;r<n;r++){var a=this[r];if((t?e.apply(t,[a,r,this]):e(a,r,this))===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t==null&&(t=r),e==null&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var a=e;a>=0&&a<t&&a<r;a++)n.push(this[a]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Me(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Ou)},zDepth:function(){var e=this[0];if(e){var t=e._private;if(t.group==="nodes"){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:Ta-1}var r=t.source,a=t.target,i=r.zDepth(),o=a.zDepth();return Math.max(i,o,0)}}};Qr.each=Qr.forEach;var _i;_i="undefined",(typeof Symbol>"u"?"undefined":qe(Symbol))!=_i&&qe(Symbol.iterator)!=_i&&(Qr[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return ao({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var uf=Ke({nodeDimensionsIncludeLabels:!1}),Jr={layoutDimensions:function(e){var t;if(e=uf(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return t.w!==0&&t.h!==0||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(y){return!y.isParent()}),a=this.cy(),i=t.eles,o=function(y){return y.id()},s=pn(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=t.spacingFactor&&t.spacingFactor!==1,u=function(){if(!l)return null;for(var y=nt(),m=0;m<r.length;m++){var b=r[m],w=s(b,m);is(y,w.x,w.y)}return y}(),c=pn(function(y,m){var b=s(y,m);return l&&(b=function(w,k,E){var x=k.x1+k.w/2,C=k.y1+k.h/2;return{x:x+(E.x-x)*w,y:C+(E.y-C)*w}}(Math.abs(t.spacingFactor),u,b)),t.transform!=null&&(b=t.transform(y,b)),b},o);if(t.animate){for(var d=0;d<r.length;d++){var h=r[d],p=c(h,d);if(t.animateFilter==null||t.animateFilter(h,d)){var f=h.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(f)}else h.position(p)}if(t.fit){var g=a.animation({fit:{boundingBox:i.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(t.zoom!==void 0&&t.pan!==void 0){var v=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}e.animations.forEach(function(y){return y.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Tn.all(e.animations.map(function(y){return y.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(c),t.fit&&a.fit(t.eles,t.padding),t.zoom!=null&&a.zoom(t.zoom),t.pan&&a.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(pe({},e,{eles:this}))}};function Vu(e,t,n){var r,a=n._private,i=a.styleCache=a.styleCache||[];return(r=i[e])!=null?r:r=i[e]=t(n)}function ea(e,t){return e=Jt(e),function(n){return Vu(e,t,n)}}function ta(e,t){e=Jt(e);var n=function(r){return t.call(r)};return function(){var r=this[0];if(r)return Vu(e,n,r)}}Jr.createLayout=Jr.makeLayout=Jr.layout;var Ue={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(r){return r._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach(function(r){n(r),r.connectedEdges().forEach(n)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=this;e=!(!e&&e!==void 0),t.hasCompoundNodes()&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var r=n;return e?r.emitAndNotify("style"):r.emit("style"),n.forEach(function(a){return a._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(xe(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(fe(e)){if(t===void 0){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(e===void 0){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var i=0;i<a.length;i++){var o=a[i];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<a.length;s++){var l=a[s];r.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,a=n.pstyle("opacity").value;if(!t)return a;var i=r.data.parent?n.parents():null;if(i)for(var o=0;o<i.length;o++)a*=i[o].pstyle("opacity").value;return a}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();return e?t?e.effectiveOpacity()===0:e.pstyle("opacity").value===0:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function Di(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 Ai(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var i=this[0],o=a.hasCompoundNodes();if(i){var s=i._private;if(!t(i))return!1;if(i.isNode())return!o||Di(i,r);var l=s.source,u=s.target;return n(l)&&(!o||Di(l,n))&&(l===u||n(u)&&(!o||Di(u,n)))}}}var Dn=ea("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(!e.isNode()||e.height()!==0)});Ue.takesUpSpace=ta("takesUpSpace",Ai({ok:Dn}));var cf=ea("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&Dn(e)}),df=ea("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&Dn(e)});Ue.interactive=ta("interactive",Ai({ok:cf,parentOk:df,edgeOkViaNode:Dn})),Ue.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var hf=ea("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&Dn(e)}),ff=Dn;Ue.visible=ta("visible",Ai({ok:hf,edgeOkViaNode:ff})),Ue.hidden=function(){var e=this[0];if(e)return!e.visible()},Ue.isBundledBezier=ta("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace()}),Ue.bypass=Ue.css=Ue.style,Ue.renderedCss=Ue.renderedStyle,Ue.removeBypass=Ue.removeCss=Ue.removeStyle,Ue.pstyle=Ue.parsedStyle;var Ut={};function Fu(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(t.length===1&&Me(t[0])){var i=t[0];this.on(e.event,i)}else if(t.length===0||t.length===1&&Ce(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(d!==void 0&&(u=d,!d))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function An(e){Ut[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},Ut[e.on]=Fu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Ut[e.off]=Fu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}An({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),An({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),An({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),An({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),Ut.deselect=Ut.unselect,Ut.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},An({field:"active",on:"activate",off:"unactivate"}),An({field:"pannable",on:"panify",off:"unpanify"}),Ut.inactive=function(){var e=this[0];if(e)return!e._private.active};var Qe={},qu=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r];if(a.isNode()){for(var i=!1,o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===a&&u!==a||e.noOutgoingEdges&&u===a&&c!==a){i=!0;break}}i||n.push(a)}}return this.spawn(n,!0).filter(t)}},Xu=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r];if(a.isNode())for(var i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target();e.outgoing&&l===a?(n.push(s),n.push(u)):e.incoming&&u===a&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},Yu=function(e){return function(t){for(var n=this,r=[],a={};;){var i=e.outgoing?n.outgoers():n.incomers();if(i.length===0)break;for(var o=!1,s=0;s<i.length;s++){var l=i[s],u=l.id();a[u]||(a[u]=!0,r.push(l),o=!0)}if(!o)break;n=i}return this.spawn(r,!0).filter(t)}};function ju(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r]._private[e.attr];a&&n.push(a)}return this.spawn(n,!0).filter(t)}}function Wu(e){return function(t){var n=[],r=this._private.cy,a=e||{};fe(t)&&(t=r.$(t));for(var i=0;i<t.length;i++)for(var o=t[i]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),d=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||d){if((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!c||a.thisIsTgt&&!d))continue;n.push(l)}}return this.spawn(n,!0)}}function Hu(e){return e=pe({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),a=e,i=0;i<r.length;i++)for(var o=r[i]._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=h._private.data,f=p.target,g=p.source,v=f===u&&g===l,y=l===f&&u===g;(a.codirected&&v||!a.codirected&&(v||y))&&n.push(h)}return this.spawn(n,!0).filter(t)}}Qe.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},pe(Qe,{roots:qu({noIncomingEdges:!0}),leaves:qu({noOutgoingEdges:!0}),outgoers:ht(Xu({outgoing:!0}),"outgoers"),successors:Yu({outgoing:!0}),incomers:ht(Xu({incoming:!0}),"incomers"),predecessors:Yu({})}),pe(Qe,{neighborhood:ht(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target(),c=a===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Qe.neighbourhood=Qe.neighborhood,Qe.closedNeighbourhood=Qe.closedNeighborhood,Qe.openNeighbourhood=Qe.openNeighborhood,pe(Qe,{source:ht(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:ht(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:ju({attr:"source"}),targets:ju({attr:"target"})}),pe(Qe,{edgesWith:ht(Wu(),"edgesWith"),edgesTo:ht(Wu({thisIsSrc:!0}),"edgesTo")}),pe(Qe,{connectedEdges:ht(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var a=r._private.edges,i=0;i<a.length;i++){var o=a[i];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:ht(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:ht(Hu(),"parallelEdges"),codirectedEdges:ht(Hu({codirected:!0}),"codirectedEdges")}),pe(Qe,{components:function(e){var t=this,n=t.cy(),r=n.collection(),a=e==null?t.nodes():e.nodes(),i=[];e!=null&&a.empty()&&(a=e.sources());var o=function(l,u){r.merge(l),a.unmerge(l),u.merge(l)};if(a.empty())return t.spawn();var s=function(){var l=n.collection();i.push(l);var u=a[0];o(u,l),t.bfs({directed:!1,roots:u,visit:function(c){return o(c,l)}}),l.forEach(function(c){c.connectedEdges().forEach(function(d){t.has(d)&&l.has(d.source())&&l.has(d.target())&&l.merge(d)})})};do s();while(a.length>0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Qe.componentsOf=Qe.components;var Ze=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(e!==void 0){var a=new _t,i=!1;if(t){if(t.length>0&&xe(t[0])&&!Xn(t[0])){i=!0;for(var o=[],s=new vn,l=0,u=t.length;l<u;l++){var c=t[l];c.data==null&&(c.data={});var d=c.data;if(d.id==null)d.id=Qo();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var h=new Cr(e,c,!1);o.push(h),s.add(d.id)}t=o}}else t=[];this.length=0;for(var p=0,f=t.length;p<f;p++){var g=t[p][0];if(g!=null){var v=g._private.data.id;n&&a.has(v)||(n&&a.set(v,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var y=this.lazyMap=new _t,m=this.eles,b=0;b<m.length;b++){var w=m[b];y.set(w.id(),{index:b,ele:w})}}},n&&(this._private.map=a),i&&!r&&this.restore()}else Ie("A collection must have a reference to the core")},Se=Cr.prototype=Ze.prototype=Object.create(Array.prototype);Se.instanceString=function(){return"collection"},Se.spawn=function(e,t){return new Ze(this.cy(),e,t)},Se.spawnSelf=function(){return this.spawn(this)},Se.cy=function(){return this._private.cy},Se.renderer=function(){return this._private.cy.renderer()},Se.element=function(){return this[0]},Se.collection=function(){return Ro(this)?this:new Ze(this._private.cy,[this])},Se.unique=function(){return new Ze(this._private.cy,this,!0)},Se.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},Se.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Ze(t)},Se.$id=Se.getElementById,Se.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Se.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Se.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},Se.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(xe(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var i=!1,o={},s=e.data.source,l=e.data.target;s!=null&&s!=a.source&&(o.source=""+s,i=!0),l!=null&&l!=a.target&&(o.target=""+l,i=!0),i&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;!u||c==null&&a.parent==null||c==a.parent||(c===void 0&&(c=null),c!=null&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var d=function(f,g,v){var y=e[f];y!=null&&y!==r[f]&&(y?t[g]():t[v]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}if(e===void 0){var h={data:Et(r.data),position:Et(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var p=0;return r.classes.forEach(function(f){return h.classes+=p++===0?f:" "+f}),h}}},Se.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},Se.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),a=new Cr(e,r,!1);t.push(a)}return new Ze(e,t)},Se.copy=Se.clone,Se.restore=function(){for(var e,t,n=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],a=this,i=a.cy(),o=i._private,s=[],l=[],u=0,c=a.length;u<c;u++){var d=a[u];r&&!d.removed()||(d.isNode()?s.push(d):l.push(d))}e=s.concat(l);var h=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var p=e[t],f=p._private,g=f.data;if(p.clearTraversalCache(),r||f.removed)if(g.id===void 0)g.id=Qo();else if(ie(g.id))g.id=""+g.id;else{if(Lt(g.id)||!fe(g.id)){Ie("Can not create element with invalid string ID `"+g.id+"`"),h();continue}if(i.hasElementWithId(g.id)){Ie("Can not create second element with ID `"+g.id+"`"),h();continue}}var v=g.id;if(p.isNode()){var y=f.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(p.isEdge()){for(var m=p,b=["source","target"],w=b.length,k=!1,E=0;E<w;E++){var x=b[E],C=g[x];ie(C)&&(C=g[x]=""+g[x]),C==null||C===""?(Ie("Can not create edge `"+v+"` with unspecified "+x),k=!0):i.hasElementWithId(C)||(Ie("Can not create edge `"+v+"` with nonexistant "+x+" `"+C+"`"),k=!0)}if(k){h();continue}var S=i.getElementById(g.source),T=i.getElementById(g.target);S.same(T)?S._private.edges.push(m):(S._private.edges.push(m),T._private.edges.push(m)),m._private.source=S,m._private.target=T}f.map=new _t,f.map.set(v,{ele:p,index:0}),f.removed=!1,r&&i.addToPool(p)}for(var D=0;D<s.length;D++){var A=s[D],B=A._private.data;ie(B.parent)&&(B.parent=""+B.parent);var M=B.parent;if(M!=null||A._private.parent){var L=A._private.parent?i.collection().merge(A._private.parent):i.getElementById(M);if(L.empty())B.parent=void 0;else if(L[0].removed())ke("Node added with missing parent, reference to parent removed"),B.parent=void 0,A._private.parent=null;else{for(var I=!1,_=L;!_.empty();){if(A.same(_)){I=!0,B.parent=void 0;break}_=_.parent()}I||(L[0]._private.children.push(A),A._private.parent=L[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var R=e.length===a.length?a:new Ze(i,e),F=0;F<R.length;F++){var z=R[F];z.isNode()||(z.parallelEdges().clearTraversalCache(),z.source().clearTraversalCache(),z.target().clearTraversalCache())}(o.hasCompoundNodes?i.collection().merge(R).merge(R.connectedNodes()).merge(R.parent()):R).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?R.emitAndNotify("add"):r&&R.emit("add")}return a},Se.removed=function(){var e=this[0];return e&&e._private.removed},Se.inside=function(){var e=this[0];return e&&!e._private.removed},Se.remove=function(){var e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(T){var D=a[T.id()];t&&T.removed()||D||(a[T.id()]=!0,T.isNode()?(r.push(T),function(A){for(var B=A._private.edges,M=0;M<B.length;M++)o(B[M])}(T),function(A){for(var B=A._private.children,M=0;M<B.length;M++)o(B[M])}(T)):r.unshift(T))}for(var s=0,l=n.length;s<l;s++)o(n[s]);function u(T,D){var A=T._private.edges;Vt(A,D),T.clearTraversalCache()}function c(T){T.clearTraversalCache()}var d=[];function h(T,D){D=D[0];var A=(T=T[0])._private.children,B=T.id();Vt(A,D),D._private.parent=null,d.ids[B]||(d.ids[B]=!0,d.push(T))}d.ids={},n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var p=0;p<r.length;p++){var f=r[p];if(f.isEdge()){var g=f.source()[0],v=f.target()[0];u(g,f),u(v,f);for(var y=f.parallelEdges(),m=0;m<y.length;m++){var b=y[m];c(b),b.isBundledBezier()&&b.dirtyBoundingBoxCache()}}else{var w=f.parent();w.length!==0&&h(w,f)}t&&(f._private.removed=!0)}var k=i._private.elements;i._private.hasCompoundNodes=!1;for(var E=0;E<k.length;E++)if(k[E].isParent()){i._private.hasCompoundNodes=!0;break}var x=new Ze(this.cy(),r);x.size()>0&&(e?x.emitAndNotify("remove"):t&&x.emit("remove"));for(var C=0;C<d.length;C++){var S=d[C];t&&S.removed()||S.updateStyle()}return x},Se.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(h){return h==null?h:""+h};if(e.source!==void 0||e.target!==void 0){var o=i(e.source),s=i(e.target),l=o!=null&&t.hasElementWithId(o),u=s!=null&&t.hasElementWithId(s);(l||u)&&(t.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var h=0;h<n.length;h++){var p=n[h],f=p._private.data;p.isEdge()&&(l&&(f.source=o),u&&(f.target=s))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var c=i(e.parent);if(c===null||t.hasElementWithId(c)){var d=c===null?void 0:c;t.batch(function(){var h=n.remove(r,a);h.emitAndNotify("moveout");for(var p=0;p<n.length;p++){var f=n[p],g=f._private.data;f.isNode()&&(g.parent=d)}h.restore(r,a)}),n.emitAndNotify("move")}}return this},[Ps,Wh,qr,Wt,Sn,Qh,Gr,af,Lu,zu,{isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Qr,Jr,Ue,Ut,Qe].forEach(function(e){pe(Se,e)});var pf={add:function(e){var t,n=this;if(lt(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var a=[],i=0;i<r.length;i++){var o=r[i];a.push(o.json())}t=new Ze(n,a)}}else if(Ce(e))t=new Ze(n,e);else if(xe(e)&&(Ce(e.nodes)||Ce(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,d=u.length;c<d;c++){var h=u[c],p=s[h];if(Ce(p))for(var f=0,g=p.length;f<g;f++){var v=pe({group:h},p[f]);l.push(v)}}t=new Ze(n,l)}else t=new Cr(n,e).collection();return t},remove:function(e){if(!lt(e)){if(fe(e)){var t=e;e=this.$(t)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function gf(e,t,n,r){var a=.1,i=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var o=0;o<4;++o)if(typeof arguments[o]!="number"||isNaN(arguments[o])||!isFinite(arguments[o]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var s=i?new Float32Array(11):new Array(11);function l(m,b){return 1-3*b+3*m}function u(m,b){return 3*b-6*m}function c(m){return 3*m}function d(m,b,w){return((l(b,w)*m+u(b,w))*m+c(b))*m}function h(m,b,w){return 3*l(b,w)*m*m+2*u(b,w)*m+c(b)}function p(m){for(var b=0,w=1;w!==10&&s[w]<=m;++w)b+=a;--w;var k=b+(m-s[w])/(s[w+1]-s[w])*a,E=h(k,e,n);return E>=.001?function(x,C){for(var S=0;S<4;++S){var T=h(C,e,n);if(T===0)return C;C-=(d(C,e,n)-x)/T}return C}(m,k):E===0?k:function(x,C,S){var T,D,A=0;do(T=d(D=C+(S-C)/2,e,n)-x)>0?S=D:C=D;while(Math.abs(T)>1e-7&&++A<10);return D}(m,b,b+a)}var f=!1;function g(){f=!0,e===t&&n===r||function(){for(var m=0;m<11;++m)s[m]=d(m*a,e,n)}()}var v=function(m){return f||g(),e===t&&n===r?m:m===0?0:m===1?1:d(p(m),t,r)};v.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var y="generateBezier("+[e,t,n,r]+")";return v.toString=function(){return y},v}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var vf=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,i){var o={x:r.x+i.dx*a,v:r.v+i.dv*a,tension:r.tension,friction:r.friction};return{dx:o.v,dv:e(o)}}function n(r,a){var i={dx:r.v,dv:e(r)},o=t(r,.5*a,i),s=t(r,.5*a,o),l=t(r,a,s),u=1/6*(i.dx+2*(o.dx+s.dx)+l.dx),c=1/6*(i.dv+2*(o.dv+s.dv)+l.dv);return r.x=r.x+u*a,r.v=r.v+c*a,r}return function r(a,i,o){var s,l,u,c={x:-1,v:0,tension:null,friction:null},d=[0],h=0,p=1e-4;for(a=parseFloat(a)||500,i=parseFloat(i)||20,o=o||null,c.tension=a,c.friction=i,l=(s=o!==null)?(h=r(a,i))/o*.016:.016;u=n(u||c,l),d.push(1+u.x),h+=16,Math.abs(u.x)>p&&Math.abs(u.v)>p;);return s?function(f){return d[f*(d.length-1)|0]}:h}}(),Be=function(e,t,n,r){var a=gf(e,t,n,r);return function(i,o,s){return i+(o-i)*a(s)}},na={linear:function(e,t,n){return e+(t-e)*n},ease:Be(.25,.1,.25,1),"ease-in":Be(.42,0,1,1),"ease-out":Be(0,0,.58,1),"ease-in-out":Be(.42,0,.58,1),"ease-in-sine":Be(.47,0,.745,.715),"ease-out-sine":Be(.39,.575,.565,1),"ease-in-out-sine":Be(.445,.05,.55,.95),"ease-in-quad":Be(.55,.085,.68,.53),"ease-out-quad":Be(.25,.46,.45,.94),"ease-in-out-quad":Be(.455,.03,.515,.955),"ease-in-cubic":Be(.55,.055,.675,.19),"ease-out-cubic":Be(.215,.61,.355,1),"ease-in-out-cubic":Be(.645,.045,.355,1),"ease-in-quart":Be(.895,.03,.685,.22),"ease-out-quart":Be(.165,.84,.44,1),"ease-in-out-quart":Be(.77,0,.175,1),"ease-in-quint":Be(.755,.05,.855,.06),"ease-out-quint":Be(.23,1,.32,1),"ease-in-out-quint":Be(.86,0,.07,1),"ease-in-expo":Be(.95,.05,.795,.035),"ease-out-expo":Be(.19,1,.22,1),"ease-in-out-expo":Be(1,0,0,1),"ease-in-circ":Be(.6,.04,.98,.335),"ease-out-circ":Be(.075,.82,.165,1),"ease-in-out-circ":Be(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return na.linear;var r=vf(e,t,n);return function(a,i,o){return a+(i-a)*r(o)}},"cubic-bezier":Be};function Gu(e,t,n,r,a){if(r===1||t===n)return n;var i=a(t,n,r);return e==null||((e.roundValue||e.color)&&(i=Math.round(i)),e.min!==void 0&&(i=Math.max(i,e.min)),e.max!==void 0&&(i=Math.min(i,e.max))),i}function Ku(e,t){return e.pfValue!=null||e.value!=null?e.pfValue==null||t!=null&&t.type.units==="%"?e.value:e.pfValue:e}function Mn(e,t,n,r,a){var i=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var o=Ku(e,a),s=Ku(t,a);if(ie(o)&&ie(s))return Gu(i,o,s,n,r);if(Ce(o)&&Ce(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],d=s[u];if(c!=null&&d!=null){var h=Gu(i,c,d,n,r);l.push(h)}else l.push(d)}return l}}function yf(e,t,n,r){var a=!r,i=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(s==null)o.easingImpl=na.linear;else{var c,d,h;fe(s)?c=u.parse("transition-timing-function",s).value:c=s,fe(c)?(d=c,h=[]):(d=c[1],h=c.slice(2).map(function(I){return+I})),h.length>0?(d==="spring"&&h.push(o.duration),o.easingImpl=na[d].apply(null,h)):o.easingImpl=na[d]}var p,f=o.easingImpl;if(p=o.duration===0?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),o.delay==null){var g=o.startPosition,v=o.position;if(v&&a&&!e.locked()){var y={};or(g.x,v.x)&&(y.x=Mn(g.x,v.x,p,f)),or(g.y,v.y)&&(y.y=Mn(g.y,v.y,p,f)),e.position(y)}var m=o.startPan,b=o.pan,w=i.pan,k=b!=null&&r;k&&(or(m.x,b.x)&&(w.x=Mn(m.x,b.x,p,f)),or(m.y,b.y)&&(w.y=Mn(m.y,b.y,p,f)),e.emit("pan"));var E=o.startZoom,x=o.zoom,C=x!=null&&r;C&&(or(E,x)&&(i.zoom=$n(i.minZoom,Mn(E,x,p,f),i.maxZoom)),e.emit("zoom")),(k||C)&&e.emit("viewport");var S=o.style;if(S&&S.length>0&&a){for(var T=0;T<S.length;T++){var D=S[T],A=D.name,B=D,M=o.startStyle[A],L=Mn(M,B,p,f,u.properties[M.name]);u.overrideBypass(e,A,L)}e.emit("style")}}return o.progress=p,p}function or(e,t){return e!=null&&t!=null&&(!(!ie(e)||!ie(t))||!(!e||!t))}function mf(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function Uu(e,t){var n=t._private.aniEles,r=[];function a(u,c){var d=u._private,h=d.animation.current,p=d.animation.queue,f=!1;if(h.length===0){var g=p.shift();g&&h.push(g)}for(var v=function(w){for(var k=w.length-1;k>=0;k--)(0,w[k])();w.splice(0,w.length)},y=h.length-1;y>=0;y--){var m=h[y],b=m._private;b.stopped?(h.splice(y,1),b.hooked=!1,b.playing=!1,b.started=!1,v(b.frames)):(b.playing||b.applying)&&(b.playing&&b.applying&&(b.applying=!1),b.started||mf(0,m,e),yf(u,m,e,c),b.applying&&(b.applying=!1),v(b.frames),b.step!=null&&b.step(e),m.completed()&&(h.splice(y,1),b.hooked=!1,b.playing=!1,b.started=!1,v(b.completes)),f=!0)}return c||h.length!==0||p.length!==0||r.push(u),f}for(var i=!1,o=0;o<n.length;o++){var s=a(n[o]);i=i||s}var l=a(t,!0);(i||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var bf={animate:Te.animate(),animation:Te.animation(),animated:Te.animated(),clearQueue:Te.clearQueue(),delay:Te.delay(),delayAnimation:Te.delayAnimation(),stop:Te.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(n,r){Uu(r,e)},t.beforeRenderPriorities.animations):function n(){e._private.animationsRunning&&Er(function(r){Uu(r,e),n()})}()}}},xf={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null||e!==n.target&&Xn(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},ra=function(e){return fe(e)?new Yt(e):e},Zu={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Zr(xf,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,ra(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,ra(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,ra(t),n),this},once:function(e,t,n){return this.emitter().one(e,ra(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}};Te.eventAliasesOn(Zu);var Mi={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Mi.jpeg=Mi.jpg;var aa={layout:function(e){var t=this;if(e!=null)if(e.name!=null){var n=e.name,r=t.extension("layout",n);if(r!=null){var a;a=fe(e.eles)?t.$(e.eles):e.eles!=null?e.eles:t.$();var i=new r(pe({},e,{cy:t,eles:a}));return i}Ie("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ie("A `name` must be specified to make a layout");else Ie("Layout options must be specified to make a layout")}};aa.createLayout=aa.makeLayout=aa.layout;var wf={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var a=n[r],i=e[a];t.getElementById(a).data(i)}})}},Ef=Ke({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]}),Ii={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,n=t.extension("renderer",e.name);if(n!=null){e.wheelSensitivity!==void 0&&ke("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=Ef(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")}else Ie("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ii.invalidateDimensions=Ii.resize;var ia={collection:function(e,t){return fe(e)?this.$(e):lt(e)?e.collection():Ce(e)?(t||(t={}),new Ze(this,e,t.unique,t.removed)):new Ze(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ia.elements=ia.filter=ia.$;var He={},sr="t";He.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var a=e[r],i=t.getContextMeta(a);if(!i.empty){var o=t.getContextStyle(i),s=t.applyContextStyle(i,o,a);a._private.appliedInitStyle?t.updateTransitions(a,s.diffProps):a._private.appliedInitStyle=!0,t.updateStyleHints(a)&&n.push(a)}}return n},He.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var o=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===sr,d=t[l]===sr,h=c!==d,p=u.mappedProperties.length>0;if(h||d&&p){var f=void 0;h&&p||h?f=u.properties:p&&(f=u.mappedProperties);for(var g=0;g<f.length;g++){for(var v=f[g],y=v.name,m=!1,b=l+1;b<n.length;b++){var w=n[b];if(t[b]===sr&&(m=w.properties[v.name]!=null))break}s[y]||m||(s[y]=!0,o.push(y))}}}return r[a]=o,o},He.getContextMeta=function(e){for(var t,n=this,r="",a=e._private.styleCxtKey||"",i=0;i<n.length;i++){var o=n[i];r+=o.selector&&o.selector.matches(e)?sr:"f"}return t=n.getPropertiesDiff(a,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:t.length===0}},He.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},a=0;a<this.length;a++){var i=this[a];if(t[a]===sr)for(var o=0;o<i.properties.length;o++){var s=i.properties[o];r[s.name]=s}}return n[t]=r,r},He.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,a={},i=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===i.fn&&u!=null&&u.mapping!=null&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(n))===c.prevFnValue)continue}var d=a[s]={prev:u};this.applyParsedProperty(n,l),d.next=n.pstyle(s),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:a}},He.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(ee,oe,ce){return n.getPropertiesHash(ee,oe,ce)},o=t.styleKey;if(e.removed())return!1;var s=t.group==="nodes",l=e._private.style;r=Object.keys(l);for(var u=0;u<a.length;u++){var c=a[u];t.styleKeys[c]=[Qt,gn]}for(var d=function(ee,oe){return t.styleKeys[oe][0]=Gn(ee,t.styleKeys[oe][0])},h=function(ee,oe){return t.styleKeys[oe][1]=Kn(ee,t.styleKeys[oe][1])},p=function(ee,oe){d(ee,oe),h(ee,oe)},f=function(ee,oe){for(var ce=0;ce<ee.length;ce++){var ve=ee.charCodeAt(ce);d(ve,oe),h(ve,oe)}},g=function(ee){return-128<ee&&ee<128&&Math.floor(ee)!==ee?2e9-(1024*ee|0):ee},v=0;v<r.length;v++){var y=r[v],m=l[y];if(m!=null){var b=this.properties[y],w=b.type,k=b.groupKey,E=void 0;b.hashOverride!=null?E=b.hashOverride(e,m):m.pfValue!=null&&(E=m.pfValue);var x=b.enums==null?m.value:null,C=E!=null,S=C||x!=null,T=m.units;w.number&&S&&!w.multiple?(p(g(C?E:x),k),C||T==null||f(T,k)):f(m.strValue,k)}}for(var D,A,B=[Qt,gn],M=0;M<a.length;M++){var L=a[M],I=t.styleKeys[L];B[0]=Gn(I[0],B[0]),B[1]=Kn(I[1],B[1])}t.styleKey=(D=B[0],A=B[1],2097152*D+A);var _=t.styleKeys;t.labelDimsKey=Ot(_.labelDimensions);var R=i(e,["label"],_.labelDimensions);if(t.labelKey=Ot(R),t.labelStyleKey=Ot(kr(_.commonLabel,R)),!s){var F=i(e,["source-label"],_.labelDimensions);t.sourceLabelKey=Ot(F),t.sourceLabelStyleKey=Ot(kr(_.commonLabel,F));var z=i(e,["target-label"],_.labelDimensions);t.targetLabelKey=Ot(z),t.targetLabelStyleKey=Ot(kr(_.commonLabel,z))}if(s){var Y=t.styleKeys,W=Y.nodeBody,Z=Y.nodeBorder,G=Y.nodeOutline,$=Y.backgroundImage,V=Y.compound,O=Y.pie,q=Y.stripe,Q=[W,Z,G,$,V,O,q].filter(function(ee){return ee!=null}).reduce(kr,[Qt,gn]);t.nodeKey=Ot(Q),t.hasPie=O!=null&&O[0]!==Qt&&O[1]!==gn,t.hasStripe=q!=null&&q[0]!==Qt&&q[1]!==gn}return o!==t.styleKey},He.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},He.applyParsedProperty=function(e,t){var n,r=this,a=t,i=e._private.style,o=r.types,s=r.properties[a.name].type,l=a.bypass,u=i[a.name],c=u&&u.bypass,d=e._private,h="mapping",p=function(z){return z==null?null:z.pfValue!=null?z.pfValue:z.value},f=function(){var z=p(u),Y=p(a);r.checkTriggers(e,a.name,z,Y)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(a=t=this.parse(t.name,"bezier",l)),a.delete)return i[a.name]=void 0,f(),!0;if(a.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return u?!!u.bypass&&(i[a.name]=u.bypassed,f(),!0):(f(),!0);var g=function(){ke("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:for(var v,y=a.field.split("."),m=d.data,b=0;b<y.length&&m;b++)m=m[y[b]];if(m==null)return g(),!1;if(!ie(m))return ke("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var w=a.fieldMax-a.fieldMin;if((v=w===0?0:(m-a.fieldMin)/w)<0?v=0:v>1&&(v=1),s.color){var k=a.valueMin[0],E=a.valueMax[0],x=a.valueMin[1],C=a.valueMax[1],S=a.valueMin[2],T=a.valueMax[2],D=a.valueMin[3]==null?1:a.valueMin[3],A=a.valueMax[3]==null?1:a.valueMax[3],B=[Math.round(k+(E-k)*v),Math.round(x+(C-x)*v),Math.round(S+(T-S)*v),Math.round(D+(A-D)*v)];n={bypass:a.bypass,name:a.name,value:B,strValue:"rgb("+B[0]+", "+B[1]+", "+B[2]+")"}}else{if(!s.number)return!1;var M=a.valueMin+(a.valueMax-a.valueMin)*v;n=this.parse(a.name,M,a.bypass,h)}if(!n)return g(),!1;n.mapping=a,a=n;break;case o.data:for(var L=a.field.split("."),I=d.data,_=0;_<L.length&&I;_++)I=I[L[_]];if(I!=null&&(n=this.parse(a.name,I,a.bypass,h)),!n)return g(),!1;n.mapping=a,a=n;break;case o.fn:var R=a.value,F=a.fnValue!=null?a.fnValue:R(e);if(a.prevFnValue=F,F==null)return ke("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(a.name,F,a.bypass,h)))return ke("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=Et(a),a=n;break;case void 0:break;default:return!1}return l?(a.bypassed=c?u.bypassed:u,i[a.name]=a):c?u.bypassed=a:i[a.name]=a,f(),!0},He.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 a=r._private.style,i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],l=a[s];l!=null&&(l.bypass?l.bypassed=null:a[s]=null)}else r._private.style={}}},He.update=function(){this._private.cy.mutableElements().updateStyle()},He.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var s={},l=!1,u=0;u<a.length;u++){var c=a[u],d=e.pstyle(c),h=t[c];if(h){var p=h.prev,f=h.next!=null?h.next:d,g=!1,v=void 0,y=1e-6;p&&(ie(p.pfValue)&&ie(f.pfValue)?(g=f.pfValue-p.pfValue,v=p.pfValue+y*g):ie(p.value)&&ie(f.value)?(g=f.value-p.value,v=p.value+y*g):Ce(p.value)&&Ce(f.value)&&(g=p.value[0]!==f.value[0]||p.value[1]!==f.value[1]||p.value[2]!==f.value[2],v=p.strValue),g&&(s[c]=f.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;r.transitioning=!0,new Tn(function(m){o>0?e.delayAnimation(o).play().promise().then(m):m()}).then(function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},He.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);e.removed()||s!=null&&s(n,r,e)&&i(o)},He.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(i){return i.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},He.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},He.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfConnectedEdges},function(a){e.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},He.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBoundsOfParallelEdges},function(a){e.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},He.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var kf={applyBypass:function(e,t,n,r){var a=[];if(t==="*"||t==="**"){if(n!==void 0)for(var i=0;i<this.properties.length;i++){var o=this.properties[i].name,s=this.parse(o,n,!0);s&&a.push(s)}}else if(fe(t)){var l=this.parse(t,n,!0);l&&a.push(l)}else{if(!xe(t))return!1;var u=t;r=n;for(var c=Object.keys(u),d=0;d<c.length;d++){var h=c[d],p=u[h];if(p===void 0&&(p=u[br(h)]),p!==void 0){var f=this.parse(h,p,!0);f&&a.push(f)}}}if(a.length===0)return!1;for(var g=!1,v=0;v<e.length;v++){for(var y=e[v],m={},b=void 0,w=0;w<a.length;w++){var k=a[w];if(r){var E=y.pstyle(k.name);b=m[k.name]={prev:E}}g=this.applyParsedProperty(y,Et(k))||g,r&&(b.next=y.pstyle(k.name))}g&&this.updateStyleHints(y),r&&this.updateTransitions(y,m,!0)}return g},overrideBypass:function(e,t,n){t=wa(t);for(var r=0;r<e.length;r++){var a=e[r],i=a._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;i&&i.bypass?(i.value=n,i.pfValue!=null&&(i.pfValue=n),i.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(a)):this.applyBypass(a,t,n),this.checkTriggers(a,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=0;r<e.length;r++){for(var a=e[r],i={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=a.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),d=i[l.name]={prev:u};this.applyParsedProperty(a,c),d.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,i,!0)}}},Tf={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1},containerCss:function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)}},Ni={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){var n=this;if(e=e[0]){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],o=n.getStylePropertyValue(e,i.name,t);o!=null&&(r[i.name]=o,r[br(i.name)]=o)}return r}},getIndexedStyle:function(e,t,n,r){var a=e.pstyle(t)[n][r];return a??e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var a=r.type,i=e.pstyle(r.name);if(i){var o=i.value,s=i.units,l=i.strValue;if(n&&a.number&&o!=null&&ie(o)){var u=e.cy().zoom(),c=function(p){return p*u},d=function(p,f){return c(p)+f},h=Ce(o);return(h?s.every(function(p){return p!=null}):s!=null)?h?o.map(function(p,f){return d(p,s[f])}).join(" "):d(o,s):h?o.map(function(p){return fe(p)?p:""+c(p)}).join(" "):""+c(o)}if(l!=null)return l}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r].name,i=e.pstyle(a);i!==void 0&&(i=xe(i)?this.parse(a,i.strValue):this.parse(a,i)),i&&(n[a]=i)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],s=n[o],l=r[o]||r[wa(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,a,i,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],(a=e.pstyle(r,!1))!=null)if(a.pfValue!=null)u[0]=Gn(o,u[0]),u[1]=Kn(o,u[1]);else for(i=a.strValue,l=0;l<i.length;l++)o=i.charCodeAt(l),u[0]=Gn(o,u[0]),u[1]=Kn(o,u[1]);return u}};Ni.getPropertiesHash=Ni.getNonDefaultPropertiesHash;var Cf={appendFromJson:function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,o=Object.keys(i);t.selector(a);for(var s=0;s<o.length;s++){var l=o[s],u=i[l];t.css(l,u)}}return t},fromJson:function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:i})}return e}},Pf={appendFromString:function(e){var t,n,r,a=this,i=""+e;function o(){i=i.length>t.length?i.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var l=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){ke("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=l[0];var u=l[1];if(u!=="core"&&new Yt(u).invalid){ke("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),o();continue}var c=l[2],d=!1;n=c;for(var h=[];!n.match(/^\s*$/);){var p=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){ke("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=p[0];var f=p[1],g=p[2];this.properties[f]?a.parse(f,g)?(h.push({name:f,val:g}),s()):(ke("Skipping property: Invalid property definition in: "+r),s()):(ke("Skipping property: Invalid property name in: "+r),s())}if(d){o();break}a.selector(u);for(var v=0;v<h.length;v++){var y=h[v];a.css(y.name,y.val)}o()}return a},fromString:function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t}},Le={};(function(){var e=Ye,t=gd,n=yd,r=function(O){return"^"+O+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},a=function(O){var q=e+"|\\w+|"+t+"|"+n+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+O+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+q+")\\s*\\,\\s*("+q+")\\)$"},i=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Le.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},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"]},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:r("data")},layoutData:{mapping:!0,regex:r("layoutData")},scratch:{mapping:!0,regex:r("scratch")},mapData:{mapping:!0,regex:a("mapData")},mapLayoutData:{mapping:!0,regex:a("mapLayoutData")},mapScratch:{mapping:!0,regex:a("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:i,singleRegexMatchValue:!0},urls:{regexes:i,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(O,q){switch(O.length){case 2:return q[0]!=="deg"&&q[0]!=="rad"&&q[1]!=="deg"&&q[1]!=="rad";case 1:return fe(O[0])||q[0]==="deg"||q[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(O){var q=O.length;return q===1||q===2||q===4}}};var o={zeroNonZero:function(O,q){return(O==null||q==null)&&O!==q||O==0&&q!=0||O!=0&&q==0},any:function(O,q){return O!=q},emptyNonEmpty:function(O,q){var Q=Lt(O),ee=Lt(q);return Q&&!ee||!Q&&ee}},s=Le.types,l=[{name:"label",type:s.text,triggersBounds:o.any,triggersZOrder:o.emptyNonEmpty},{name:"text-rotation",type:s.textRotation,triggersBounds:o.any},{name:"text-margin-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"text-margin-y",type:s.bidirectionalSize,triggersBounds:o.any}],u=[{name:"source-label",type:s.text,triggersBounds:o.any},{name:"source-text-rotation",type:s.textRotation,triggersBounds:o.any},{name:"source-text-margin-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"source-text-margin-y",type:s.bidirectionalSize,triggersBounds:o.any},{name:"source-text-offset",type:s.size,triggersBounds:o.any}],c=[{name:"target-label",type:s.text,triggersBounds:o.any},{name:"target-text-rotation",type:s.textRotation,triggersBounds:o.any},{name:"target-text-margin-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"target-text-margin-y",type:s.bidirectionalSize,triggersBounds:o.any},{name:"target-text-offset",type:s.size,triggersBounds:o.any}],d=[{name:"font-family",type:s.fontFamily,triggersBounds:o.any},{name:"font-style",type:s.fontStyle,triggersBounds:o.any},{name:"font-weight",type:s.fontWeight,triggersBounds:o.any},{name:"font-size",type:s.size,triggersBounds:o.any},{name:"text-transform",type:s.textTransform,triggersBounds:o.any},{name:"text-wrap",type:s.textWrap,triggersBounds:o.any},{name:"text-overflow-wrap",type:s.textOverflowWrap,triggersBounds:o.any},{name:"text-max-width",type:s.size,triggersBounds:o.any},{name:"text-outline-width",type:s.size,triggersBounds:o.any},{name:"line-height",type:s.positiveNumber,triggersBounds:o.any}],h=[{name:"text-valign",type:s.valign,triggersBounds:o.any},{name:"text-halign",type:s.halign,triggersBounds:o.any},{name:"color",type:s.color},{name:"text-outline-color",type:s.color},{name:"text-outline-opacity",type:s.zeroOneNumber},{name:"text-background-color",type:s.color},{name:"text-background-opacity",type:s.zeroOneNumber},{name:"text-background-padding",type:s.size,triggersBounds:o.any},{name:"text-border-opacity",type:s.zeroOneNumber},{name:"text-border-color",type:s.color},{name:"text-border-width",type:s.size,triggersBounds:o.any},{name:"text-border-style",type:s.borderStyle,triggersBounds:o.any},{name:"text-background-shape",type:s.textBackgroundShape,triggersBounds:o.any},{name:"text-justification",type:s.justification},{name:"box-select-labels",type:s.bool,triggersBounds:o.any}],p=[{name:"events",type:s.bool,triggersZOrder:o.any},{name:"text-events",type:s.bool,triggersZOrder:o.any}],f=[{name:"display",type:s.display,triggersZOrder:o.any,triggersBounds:o.any,triggersBoundsOfConnectedEdges:o.any,triggersBoundsOfParallelEdges:function(O,q,Q){return O!==q&&Q.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:s.visibility,triggersZOrder:o.any},{name:"opacity",type:s.zeroOneNumber,triggersZOrder:o.zeroNonZero},{name:"text-opacity",type:s.zeroOneNumber},{name:"min-zoomed-font-size",type:s.size},{name:"z-compound-depth",type:s.zCompoundDepth,triggersZOrder:o.any},{name:"z-index-compare",type:s.zIndexCompare,triggersZOrder:o.any},{name:"z-index",type:s.number,triggersZOrder:o.any}],g=[{name:"overlay-padding",type:s.size,triggersBounds:o.any},{name:"overlay-color",type:s.color},{name:"overlay-opacity",type:s.zeroOneNumber,triggersBounds:o.zeroNonZero},{name:"overlay-shape",type:s.overlayShape,triggersBounds:o.any},{name:"overlay-corner-radius",type:s.cornerRadius}],v=[{name:"underlay-padding",type:s.size,triggersBounds:o.any},{name:"underlay-color",type:s.color},{name:"underlay-opacity",type:s.zeroOneNumber,triggersBounds:o.zeroNonZero},{name:"underlay-shape",type:s.overlayShape,triggersBounds:o.any},{name:"underlay-corner-radius",type:s.cornerRadius}],y=[{name:"transition-property",type:s.propList},{name:"transition-duration",type:s.time},{name:"transition-delay",type:s.time},{name:"transition-timing-function",type:s.easing}],m=function(O,q){return q.value==="label"?-O.poolIndex():q.pfValue},b=[{name:"height",type:s.nodeSize,triggersBounds:o.any,hashOverride:m},{name:"width",type:s.nodeSize,triggersBounds:o.any,hashOverride:m},{name:"shape",type:s.nodeShape,triggersBounds:o.any},{name:"shape-polygon-points",type:s.polygonPointList,triggersBounds:o.any},{name:"corner-radius",type:s.cornerRadius},{name:"background-color",type:s.color},{name:"background-fill",type:s.fill},{name:"background-opacity",type:s.zeroOneNumber},{name:"background-blacken",type:s.nOneOneNumber},{name:"background-gradient-stop-colors",type:s.colors},{name:"background-gradient-stop-positions",type:s.percentages},{name:"background-gradient-direction",type:s.gradientDirection},{name:"padding",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"padding-relative-to",type:s.paddingRelativeTo,triggersBounds:o.any},{name:"bounds-expansion",type:s.boundsExpansion,triggersBounds:o.any}],w=[{name:"border-color",type:s.color},{name:"border-opacity",type:s.zeroOneNumber},{name:"border-width",type:s.size,triggersBounds:o.any},{name:"border-style",type:s.borderStyle},{name:"border-cap",type:s.lineCap},{name:"border-join",type:s.lineJoin},{name:"border-dash-pattern",type:s.numbers},{name:"border-dash-offset",type:s.number},{name:"border-position",type:s.linePosition}],k=[{name:"outline-color",type:s.color},{name:"outline-opacity",type:s.zeroOneNumber},{name:"outline-width",type:s.size,triggersBounds:o.any},{name:"outline-style",type:s.borderStyle},{name:"outline-offset",type:s.size,triggersBounds:o.any}],E=[{name:"background-image",type:s.urls},{name:"background-image-crossorigin",type:s.bgCrossOrigin},{name:"background-image-opacity",type:s.zeroOneNumbers},{name:"background-image-containment",type:s.bgContainment},{name:"background-image-smoothing",type:s.bools},{name:"background-position-x",type:s.bgPos},{name:"background-position-y",type:s.bgPos},{name:"background-width-relative-to",type:s.bgRelativeTo},{name:"background-height-relative-to",type:s.bgRelativeTo},{name:"background-repeat",type:s.bgRepeat},{name:"background-fit",type:s.bgFit},{name:"background-clip",type:s.bgClip},{name:"background-width",type:s.bgWH},{name:"background-height",type:s.bgWH},{name:"background-offset-x",type:s.bgPos},{name:"background-offset-y",type:s.bgPos}],x=[{name:"position",type:s.position,triggersBounds:o.any},{name:"compound-sizing-wrt-labels",type:s.compoundIncludeLabels,triggersBounds:o.any},{name:"min-width",type:s.size,triggersBounds:o.any},{name:"min-width-bias-left",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"min-width-bias-right",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"min-height",type:s.size,triggersBounds:o.any},{name:"min-height-bias-top",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"min-height-bias-bottom",type:s.sizeMaybePercent,triggersBounds:o.any}],C=[{name:"line-style",type:s.lineStyle},{name:"line-color",type:s.color},{name:"line-fill",type:s.fill},{name:"line-cap",type:s.lineCap},{name:"line-opacity",type:s.zeroOneNumber},{name:"line-dash-pattern",type:s.numbers},{name:"line-dash-offset",type:s.number},{name:"line-outline-width",type:s.size},{name:"line-outline-color",type:s.color},{name:"line-gradient-stop-colors",type:s.colors},{name:"line-gradient-stop-positions",type:s.percentages},{name:"curve-style",type:s.curveStyle,triggersBounds:o.any,triggersBoundsOfParallelEdges:function(O,q){return O!==q&&(O==="bezier"||q==="bezier")}},{name:"haystack-radius",type:s.zeroOneNumber,triggersBounds:o.any},{name:"source-endpoint",type:s.edgeEndpoint,triggersBounds:o.any},{name:"target-endpoint",type:s.edgeEndpoint,triggersBounds:o.any},{name:"control-point-step-size",type:s.size,triggersBounds:o.any},{name:"control-point-distances",type:s.bidirectionalSizes,triggersBounds:o.any},{name:"control-point-weights",type:s.numbers,triggersBounds:o.any},{name:"segment-distances",type:s.bidirectionalSizes,triggersBounds:o.any},{name:"segment-weights",type:s.numbers,triggersBounds:o.any},{name:"segment-radii",type:s.numbers,triggersBounds:o.any},{name:"radius-type",type:s.radiusType,triggersBounds:o.any},{name:"taxi-turn",type:s.bidirectionalSizeMaybePercent,triggersBounds:o.any},{name:"taxi-turn-min-distance",type:s.size,triggersBounds:o.any},{name:"taxi-direction",type:s.axisDirection,triggersBounds:o.any},{name:"taxi-radius",type:s.number,triggersBounds:o.any},{name:"edge-distances",type:s.edgeDistances,triggersBounds:o.any},{name:"arrow-scale",type:s.positiveNumber,triggersBounds:o.any},{name:"loop-direction",type:s.angle,triggersBounds:o.any},{name:"loop-sweep",type:s.angle,triggersBounds:o.any},{name:"source-distance-from-node",type:s.size,triggersBounds:o.any},{name:"target-distance-from-node",type:s.size,triggersBounds:o.any}],S=[{name:"ghost",type:s.bool,triggersBounds:o.any},{name:"ghost-offset-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"ghost-offset-y",type:s.bidirectionalSize,triggersBounds:o.any},{name:"ghost-opacity",type:s.zeroOneNumber}],T=[{name:"selection-box-color",type:s.color},{name:"selection-box-opacity",type:s.zeroOneNumber},{name:"selection-box-border-color",type:s.color},{name:"selection-box-border-width",type:s.size},{name:"active-bg-color",type:s.color},{name:"active-bg-opacity",type:s.zeroOneNumber},{name:"active-bg-size",type:s.size},{name:"outside-texture-bg-color",type:s.color},{name:"outside-texture-bg-opacity",type:s.zeroOneNumber}],D=[];Le.pieBackgroundN=16,D.push({name:"pie-size",type:s.sizeMaybePercent}),D.push({name:"pie-hole",type:s.sizeMaybePercent}),D.push({name:"pie-start-angle",type:s.angle});for(var A=1;A<=Le.pieBackgroundN;A++)D.push({name:"pie-"+A+"-background-color",type:s.color}),D.push({name:"pie-"+A+"-background-size",type:s.percent}),D.push({name:"pie-"+A+"-background-opacity",type:s.zeroOneNumber});var B=[];Le.stripeBackgroundN=16,B.push({name:"stripe-size",type:s.sizeMaybePercent}),B.push({name:"stripe-direction",type:s.axisDirectionPrimary});for(var M=1;M<=Le.stripeBackgroundN;M++)B.push({name:"stripe-"+M+"-background-color",type:s.color}),B.push({name:"stripe-"+M+"-background-size",type:s.percent}),B.push({name:"stripe-"+M+"-background-opacity",type:s.zeroOneNumber});var L=[],I=Le.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:s.arrowShape,triggersBounds:o.any},{name:"arrow-color",type:s.color},{name:"arrow-fill",type:s.arrowFill},{name:"arrow-width",type:s.arrowWidth}].forEach(function(O){I.forEach(function(q){var Q=q+"-"+O.name,ee=O.type,oe=O.triggersBounds;L.push({name:Q,type:ee,triggersBounds:oe})})},{});var _=Le.properties=[].concat(p,y,f,g,v,S,h,d,l,u,c,b,w,k,E,D,B,x,C,L,T),R=Le.propertyGroups={behavior:p,transition:y,visibility:f,overlay:g,underlay:v,ghost:S,commonLabel:h,labelDimensions:d,mainLabel:l,sourceLabel:u,targetLabel:c,nodeBody:b,nodeBorder:w,nodeOutline:k,backgroundImage:E,pie:D,stripe:B,compound:x,edgeLine:C,edgeArrow:L,core:T},F=Le.propertyGroupNames={};(Le.propertyGroupKeys=Object.keys(R)).forEach(function(O){F[O]=R[O].map(function(q){return q.name}),R[O].forEach(function(q){return q.groupKey=O})});var z=Le.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"}];Le.propertyNames=_.map(function(O){return O.name});for(var Y=0;Y<_.length;Y++){var W=_[Y];_[W.name]=W}for(var Z=0;Z<z.length;Z++){var G=z[Z],$=_[G.pointsTo],V={name:G.name,alias:!0,pointsTo:$};_.push(V),_[G.name]=V}})(),Le.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Le.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=pe({"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","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=Le.pieBackgroundN;c++){var d=u.name.replace("{{i}}",c),h=u.value;l[d]=h}return l},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=Le.stripeBackgroundN;c++){var d=u.name.replace("{{i}}",c),h=u.value;l[d]=h}return l},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(l,u){return Le.arrowPrefixes.forEach(function(c){var d=c+"-"+u.name,h=u.value;l[d]=h}),l},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,o=t[i],s=this.parse(i,o);n[i]=s}}return e.defaultProperties=n,e.defaultProperties},Le.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var $u={parse:function(e,t,n,r){var a=this;if(Me(t))return a.parseImplWarn(e,t,n,r);var i,o=Go(e,""+t,n?"t":"f",r==="mapping"||r===!0||r===!1||r==null?"dontcare":r),s=a.propCache=a.propCache||[];return(i=s[o])||(i=s[o]=a.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(i=Et(i))&&(i.value=Et(i.value)),i},parseImplWarn:function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return a||t==null||ke("The style property `".concat(e,": ").concat(t,"` is invalid")),!a||a.name!=="width"&&a.name!=="height"||t!=="label"||ke("The style value of `label` is deprecated for `"+a.name+"`"),a}};$u.parseImpl=function(e,t,n,r){var a=this;e=wa(e);var i=a.properties[e],o=t,s=a.types;if(!i||t===void 0)return null;i.alias&&(i=i.pointsTo,e=i.name);var l=fe(t);l&&(t=t.trim());var u,c,d=i.type;if(!d)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(Me(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};if(!(!l||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&t[0]==="m"&&(c=new RegExp(s.mapData.regex).exec(t))){if(n||d.multiple)return!1;var p=s.mapData;if(!d.color&&!d.number)return!1;var f=this.parse(e,c[4]);if(!f||f.mapped)return!1;var g=this.parse(e,c[5]);if(!g||g.mapped)return!1;if(f.pfValue===g.pfValue||f.strValue===g.strValue)return ke("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(d.color){var v=f.value,y=g.value;if(!(v[0]!==y[0]||v[1]!==y[1]||v[2]!==y[2]||v[3]!==y[3]&&(v[3]!=null&&v[3]!==1||y[3]!=null&&y[3]!==1)))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:f.value,valueMax:g.value,bypass:n}}}if(d.multiple&&r!=="multiple"){var m;if(m=l?t.split(/\s+/):Ce(t)?t:[t],d.evenMultiple&&m.length%2!=0)return null;for(var b=[],w=[],k=[],E="",x=!1,C=0;C<m.length;C++){var S=a.parse(e,m[C],n,"multiple");x=x||fe(S.value),b.push(S.value),k.push(S.pfValue!=null?S.pfValue:S.value),w.push(S.units),E+=(C>0?" ":"")+S.strValue}return d.validate&&!d.validate(b,w)?null:d.singleEnum&&x?b.length===1&&fe(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:k,strValue:E,bypass:n,units:w}}var T,D,A=function(){for(var q=0;q<d.enums.length;q++)if(d.enums[q]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(d.number){var B,M="px";if(d.units&&(B=d.units),d.implicitUnits&&(M=d.implicitUnits),!d.unitless)if(l){var L="px|em"+(d.allowPercent?"|\\%":"");B&&(L=B);var I=t.match("^("+Ye+")("+L+")?$");I&&(t=I[1],B=I[2]||M)}else B&&!d.implicitUnits||(B=M);if(t=parseFloat(t),isNaN(t)&&d.enums===void 0)return null;if(isNaN(t)&&d.enums!==void 0)return t=o,A();if(d.integer&&(!ie(D=t)||Math.floor(D)!==D)||d.min!==void 0&&(t<d.min||d.strictMin&&t===d.min)||d.max!==void 0&&(t>d.max||d.strictMax&&t===d.max))return null;var _={name:e,value:t,strValue:""+t+(B||""),units:B,bypass:n};return d.unitless||B!=="px"&&B!=="em"?_.pfValue=t:_.pfValue=B!=="px"&&B?this.getEmSizeInPixels()*t:t,B!=="ms"&&B!=="s"||(_.pfValue=B==="ms"?t:1e3*t),B!=="deg"&&B!=="rad"||(_.pfValue=B==="rad"?t:(T=t,Math.PI*T/180)),B==="%"&&(_.pfValue=t/100),_}if(d.propList){var R=[],F=""+t;if(F!=="none"){for(var z=F.split(/\s*,\s*|\s+/),Y=0;Y<z.length;Y++){var W=z[Y].trim();a.properties[W]?R.push(W):ke("`"+W+"` is not a valid property name")}if(R.length===0)return null}return{name:e,value:R,strValue:R.length===0?"none":R.join(" "),bypass:n}}if(d.color){var Z=Fo(t);return Z?{name:e,value:Z,pfValue:Z,strValue:"rgb("+Z[0]+","+Z[1]+","+Z[2]+")",bypass:n}:null}if(d.regex||d.regexes){if(d.enums){var G=A();if(G)return G}for(var $=d.regexes?d.regexes:[d.regex],V=0;V<$.length;V++){var O=new RegExp($[V]).exec(t);if(O)return{name:e,value:d.singleRegexMatchValue?O[1]:O,strValue:""+t,bypass:n}}return null}return d.string?{name:e,value:""+t,strValue:""+t,bypass:n}:d.enums?A():null};var Ge=function(e){if(!(this instanceof Ge))return new Ge(e);xa(e)?(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):Ie("A style must have a core reference")},Je=Ge.prototype;Je.instanceString=function(){return"style"},Je.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(r){var a=r[0]._private;a.styleDirty=!0,a.appliedInitStyle=!1}),this},Je.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Je.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Je.selector=function(e){var t=e==="core"?null:new Yt(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Je.css=function(){var e=arguments;if(e.length===1)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],a=t[r.name];a===void 0&&(a=t[br(r.name)]),a!==void 0&&this.cssRule(r.name,a)}else e.length===2&&this.cssRule(e[0],e[1]);return this},Je.style=Je.css,Je.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},Je.append=function(e){return Lo(e)?e.appendToStyle(this):Ce(e)?this.appendFromJson(e):fe(e)&&this.appendFromString(e),this},Ge.fromJson=function(e,t){var n=new Ge(e);return n.fromJson(t),n},Ge.fromString=function(e,t){return new Ge(e).fromString(t)},[He,kf,Tf,Ni,Cf,Pf,Le,$u].forEach(function(e){pe(Je,e)}),Ge.types=Je.types,Ge.properties=Je.properties,Ge.propertyGroups=Je.propertyGroups,Ge.propertyGroupNames=Je.propertyGroupNames,Ge.propertyGroupKeys=Je.propertyGroupKeys;var Sf={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return Lo(e)?t.style=e.generateStyle(this):Ce(e)?t.style=Ge.fromJson(this,e):fe(e)?t.style=Ge.fromString(this,e):t.style=Ge(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},an={autolock:function(e){return e===void 0?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return e===void 0?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return e===void 0?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return t.selectionType==null&&(t.selectionType="single"),e===void 0?t.selectionType:(e!=="additive"&&e!=="single"||(t.selectionType=e),this)},panningEnabled:function(e){return e===void 0?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return e===void 0?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return e===void 0?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return e===void 0?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return e===void 0?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,a,i=arguments,o=this._private.pan;switch(i.length){case 0:return o;case 1:if(fe(i[0]))return o[e=i[0]];if(xe(i[0])){if(!this._private.panningEnabled)return this;r=(n=i[0]).x,a=n.y,ie(r)&&(o.x=r),ie(a)&&(o.y=a),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;t=i[1],(e=i[0])!=="x"&&e!=="y"||!ie(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,a,i,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:xe(e)&&(i=(a=s[0]).x,o=a.y,ie(i)&&(l.x+=i),ie(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,(n=e)!=="x"&&n!=="y"||!ie(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ie(e)&&t===void 0&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n,r;if(fe(e)){var a=e;e=this.$(a)}else if(xe(r=e)&&ie(r.x1)&&ie(r.x2)&&ie(r.y1)&&ie(r.y2)){var i=e;(n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else lt(e)||(e=this.mutableElements());if(!lt(e)||!e.empty()){n=n||e.boundingBox();var o,s=this.width(),l=this.height();if(t=ie(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)<this._private.minZoom?this._private.minZoom:o,pan:{x:(s-o*(n.x1+n.x2))/2,y:(l-o*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return ie(e)&&ie(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):ie(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:ie(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),ie(e)?n=e:xe(e)&&(n=e.level,e.position!=null?t=Pr(e.position,i,a):e.renderedPosition!=null&&(t=e.renderedPosition),t==null||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!ie(n)||n===i||t!=null&&(!ie(t.x)||!ie(t.y)))return null;if(t!=null){var s=a,l=i,u=n;return{zoomed:!0,panned:!0,zoom:u,pan:{x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t!=null&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,a=[],i=!1,o=!1;if(!e)return this;if(ie(e.zoom)||(n=!1),xe(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ie(l.x)&&(t.pan.x=l.x,o=!1),ie(l.y)&&(t.pan.y=l.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(fe(e)){var n=e;e=this.mutableElements().filter(n)}else lt(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=t===void 0?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,a=this;return n.sizeCache=n.sizeCache||(r?(e=a.window().getComputedStyle(r),t=function(i){return parseFloat(e.getPropertyValue(i))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};an.centre=an.center,an.autolockNodes=an.autolock,an.autoungrabifyNodes=an.autoungrabify;var lr={data:Te.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Te.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Te.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Te.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};lr.attr=lr.data,lr.removeAttr=lr.removeData;var ur=function(e){var t=this,n=(e=pe({},e)).container;n&&!mr(n)&&mr(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=Xe!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=pe({name:i?"grid":"null"},o.layout),o.renderer=pe({name:i?"canvas":"null"},o.renderer);var s=function(c,d,h){return d!==void 0?d:h!==void 0?h:c},l=this._private={container:n,ready:!1,options:o,elements:new Ze(this),listeners:[],aniEles:new Ze(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?i:o.styleEnabled,zoom:ie(o.zoom)?o.zoom:1,pan:{x:xe(o.pan)&&ie(o.pan.x)?o.pan.x:0,y:xe(o.pan)&&ie(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=pe({},o,o.renderer);t.initRenderer(u),function(c,d){if(c.some(fd))return Tn.all(c).then(d);d(c)}([o.style,o.elements],function(c){var d=c[0],h=c[1];l.styleEnabled&&t.style().append(d),function(p,f,g){t.notifications(!1);var v=t.mutableElements();v.length>0&&v.remove(),p!=null&&(xe(p)||Ce(p))&&t.add(p),t.one("layoutready",function(m){t.notifications(!0),t.emit(m),t.one("load",f),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var y=pe({},t._private.options.layout);y.eles=t.elements(),t.layout(y).run()}(h,function(){t.startAnimationLoop(),l.ready=!0,Me(o.ready)&&t.on("ready",o.ready);for(var p=0;p<a.length;p++){var f=a[p];t.on("ready",f)}r&&(r.readies=[]),t.emit("ready")},o.done)})},oa=ur.prototype;pe(oa,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(this._private.container==null)return Xe;var e=this._private.container.ownerDocument;return e===void 0||e==null?Xe:e.defaultView||Xe},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!mr(e)&&mr(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(pe({},r,r.renderer,{name:r.renderer.name==="null"?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Et(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(xe(e)){if(t.startBatch(),e.elements){var a={},i=function(v,y){for(var m=[],b=[],w=0;w<v.length;w++){var k=v[w];if(k.data.id){var E=""+k.data.id,x=t.getElementById(E);a[E]=!0,x.length!==0?b.push({ele:x,json:k}):(y&&(k.group=y),m.push(k))}else ke("cy.json() cannot handle elements without an ID attribute")}t.add(m);for(var C=0;C<b.length;C++){var S=b[C],T=S.ele,D=S.json;T.json(D)}};if(Ce(e.elements))i(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];Ce(u)&&i(u,l)}var c=t.collection();r.filter(function(v){return!a[v.id()]}).forEach(function(v){v.isParent()?c.merge(v):v.remove()}),c.forEach(function(v){return v.children().move({parent:null})}),c.forEach(function(v){return function(y){return t.getElementById(y.id())}(v).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var p=d[h];e[p]!=null&&t[p](e[p])}return t.endBatch(),this}var f={};e?f.elements=this.elements().map(function(v){return v.json()}):(f.elements={},r.forEach(function(v){var y=v.group();f.elements[y]||(f.elements[y]=[]),f.elements[y].push(v.json())})),this._private.styleEnabled&&(f.style=t.style().json()),f.data=Et(t.data());var g=n.options;return f.zoomingEnabled=n.zoomingEnabled,f.userZoomingEnabled=n.userZoomingEnabled,f.zoom=n.zoom,f.minZoom=n.minZoom,f.maxZoom=n.maxZoom,f.panningEnabled=n.panningEnabled,f.userPanningEnabled=n.userPanningEnabled,f.pan=Et(n.pan),f.boxSelectionEnabled=n.boxSelectionEnabled,f.renderer=Et(g.renderer),f.hideEdgesOnViewport=g.hideEdgesOnViewport,f.textureOnViewport=g.textureOnViewport,f.wheelSensitivity=g.wheelSensitivity,f.motionBlur=g.motionBlur,f.multiClickDebounceTime=g.multiClickDebounceTime,f}}),oa.$id=oa.getElementById,[pf,bf,Zu,Mi,aa,wf,Ii,ia,Sf,an,lr].forEach(function(e){pe(oa,e)});var Bf={fit:!0,directed:!1,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}},_f={maximal:!1,acyclic:!1},In=function(e){return e.scratch("breadthfirst")},Qu=function(e,t){return e.scratch("breadthfirst",t)};function Ju(e){this.options=pe({},Bf,_f,e)}Ju.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,a=r.nodes().filter(function(ne){return ne.isChildless()}),i=r,o=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=!!t.boundingBox,u=n.extent(),c=nt(l?t.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h});if(lt(t.roots))e=t.roots;else if(Ce(t.roots)){for(var d=[],h=0;h<t.roots.length;h++){var p=t.roots[h],f=n.getElementById(p);d.push(f)}e=n.collection(d)}else if(fe(t.roots))e=n.$(t.roots);else if(o)e=a.roots();else{var g=r.components();e=n.collection();for(var v=function(){var ne=g[y],se=ne.maxDegree(!1),le=ne.filter(function(de){return de.degree(!1)===se});e=e.add(le)},y=0;y<g.length;y++)v()}var m=[],b={},w=function(ne,se){m[se]==null&&(m[se]=[]);var le=m[se].length;m[se].push(ne),Qu(ne,{index:le,depth:se})};i.bfs({roots:e,directed:t.directed,visit:function(ne,se,le,de,P){var N=ne[0],X=N.id();N.isChildless()&&w(N,P),b[X]=!0}});for(var k=[],E=0;E<a.length;E++){var x=a[E];b[x.id()]||k.push(x)}var C=function(ne){for(var se=m[ne],le=0;le<se.length;le++){var de=se[le];de!=null?Qu(de,{depth:ne,index:le}):(se.splice(le,1),le--)}},S=function(ne,se){for(var le=In(ne),de=ne.incomers().filter(function(U){return U.isNode()&&r.has(U)}),P=-1,N=ne.id(),X=0;X<de.length;X++){var H=de[X],K=In(H);P=Math.max(P,K.depth)}if(le.depth<=P){if(!t.acyclic&&se[N])return null;var j=P+1;return function(U,J){var re=In(U),te=re.depth,ye=re.index;m[te][ye]=null,U.isChildless()&&w(U,J)}(ne,j),se[N]=j,!0}return!1};if(o&&s){var T=[],D={},A=function(ne){return T.push(ne)},B=function(){return T.shift()};for(a.forEach(function(ne){return T.push(ne)});T.length>0;){var M=B(),L=S(M,D);if(L)M.outgoers().filter(function(ne){return ne.isNode()&&r.has(ne)}).forEach(A);else if(L===null){ke("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var I=0;if(t.avoidOverlap)for(var _=0;_<a.length;_++){var R=a[_].layoutDimensions(t),F=R.w,z=R.h;I=Math.max(I,F,z)}var Y={},W=function(ne){if(Y[ne.id()])return Y[ne.id()];for(var se=In(ne).depth,le=ne.neighborhood(),de=0,P=0,N=0;N<le.length;N++){var X=le[N];if(!X.isEdge()&&!X.isParent()&&a.has(X)){var H=In(X);if(H!=null){var K=H.index,j=H.depth;if(K!=null&&j!=null){var U=m[j].length;j<se&&(de+=K/U,P++)}}}}return de/=P=Math.max(1,P),P===0&&(de=0),Y[ne.id()]=de,de},Z=function(ne,se){var le=W(ne)-W(se);return le===0?Vo(ne.id(),se.id()):le};t.depthSort!==void 0&&(Z=t.depthSort);for(var G=m.length,$=0;$<G;$++)m[$].sort(Z),C($);for(var V=[],O=0;O<k.length;O++)V.push(k[O]);V.length&&(m.unshift(V),G=m.length,function(){for(var ne=0;ne<G;ne++)C(ne)}());for(var q=0,Q=0;Q<G;Q++)q=Math.max(m[Q].length,q);var ee=c.x1+c.w/2,oe=c.y1+c.h/2,ce=a.reduce(function(ne,se){return le=se.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}),{w:ne.w===-1?le.w:(ne.w+le.w)/2,h:ne.h===-1?le.h:(ne.h+le.h)/2};var le},{w:-1,h:-1}),ve=Math.max(G===1?0:l?(c.h-2*t.padding-ce.h)/(G-1):(c.h-2*t.padding-ce.h)/(G+1),I),he=m.reduce(function(ne,se){return Math.max(ne,se.length)},0);return r.nodes().layoutPositions(this,t,function(ne){var se=In(ne),le=se.depth,de=se.index;if(t.circle){var P=Math.min(c.w/2/G,c.h/2/G),N=(P=Math.max(P,I))*le+P-(G>0&&m[0].length<=3?P/2:0),X=2*Math.PI/m[le].length*de;return le===0&&m[0].length===1&&(N=1),{x:ee+N*Math.cos(X),y:oe+N*Math.sin(X)}}var H=m[le].length,K=Math.max(H===1?0:l?(c.w-2*t.padding-ce.w)/((t.grid?he:H)-1):(c.w-2*t.padding-ce.w)/((t.grid?he:H)+1),I);return{x:ee+(de+1-(H+1)/2)*K,y:oe+(le+1-(G+1)/2)*ve}}),this};var Df={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,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 ec(e){this.options=pe({},Df,e)}ec.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=nt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(t.sweep===void 0?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),d=0,h=0;h<i.length;h++){var p=i[h].layoutDimensions(t),f=p.w,g=p.h;d=Math.max(d,f,g)}if(o=ie(t.radius)?t.radius:i.length<=1?0:Math.min(s.h,s.w)/2-d,i.length>1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,function(b,w){var k=t.startAngle+w*c*(a?1:-1),E=o*Math.cos(k),x=o*Math.sin(k);return{x:l+E,y:u+x}}),this};var tc,Af={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 nc(e){this.options=pe({},Af,e)}nc.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=nt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d<i.length;d++){var h,p=i[d];h=t.concentric(p),u.push({value:h,node:p}),p._private.scratch.concentric=h}i.updateStyle();for(var f=0;f<i.length;f++){var g=i[f].layoutDimensions(t);c=Math.max(c,g.w,g.h)}u.sort(function(oe,ce){return ce.value-oe.value});for(var v=t.levelWidth(i),y=[[]],m=y[0],b=0;b<u.length;b++){var w=u[b];m.length>0&&Math.abs(m[0].value-w.value)>=v&&(m=[],y.push(m)),m.push(w)}var k=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,x=(Math.min(o.w,o.h)/2-k)/(y.length+E?1:0);k=Math.min(k,x)}for(var C=0,S=0;S<y.length;S++){var T=y[S],D=t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep,A=T.dTheta=D/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var B=Math.cos(A)-Math.cos(0),M=Math.sin(A)-Math.sin(0),L=Math.sqrt(k*k/(B*B+M*M));C=Math.max(L,C)}T.r=C,C+=k}if(t.equidistant){for(var I=0,_=0,R=0;R<y.length;R++){var F=y[R].r-_;I=Math.max(I,F)}_=0;for(var z=0;z<y.length;z++){var Y=y[z];z===0&&(_=Y.r),Y.r=_,_+=I}}for(var W={},Z=0;Z<y.length;Z++)for(var G=y[Z],$=G.dTheta,V=G.r,O=0;O<G.length;O++){var q=G[O],Q=t.startAngle+(n?1:-1)*$*O,ee={x:s+V*Math.cos(Q),y:l+V*Math.sin(Q)};W[q.node.id()]=ee}return a.nodes().layoutPositions(this,t,function(oe){var ce=oe.id();return W[ce]}),this};var Mf={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function sa(e){this.options=pe({},Mf,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(r){var a=r.source().data("id"),i=r.target().data("id"),o=t.some(function(l){return l.data("id")===a}),s=t.some(function(l){return l.data("id")===i});return!o||!s});this.options.eles=this.options.eles.not(n)}sa.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,e.animate!==!0&&e.animate!==!1||n.emit({type:"layoutstart",layout:n}),tc=e.debug===!0;var r=If(t,n,e);tc&&(void 0)(r),e.randomize&&Rf(r);var a=St(),i=function(){Lf(r,t,e),e.fit===!0&&t.fit(e.padding)},o=function(d){return!(n.stopped||d>=e.numIter)&&(zf(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var d=e.eles.nodes(),h=ac(r,e,d);d.layoutPositions(n,e,h)}},l=0,u=!0;if(e.animate===!0){var c=function(){for(var d=0;u&&d<e.refresh;)u=o(l),l++,d++;u?(St()-a>=e.animationThreshold&&i(),Er(c)):(sc(r,e),s())};c()}else{for(;u;)u=o(l),l++;sc(r,e),s()}return this},sa.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},sa.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var If=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=nt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},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=a[u]).layoutDimensions(n);(_={}).isLocked=y.locked(),_.id=y.data("id"),_.parentId=y.data("parent"),_.cmptId=l[y.id()],_.children=[],_.positionX=y.position("x"),_.positionY=y.position("y"),_.offsetX=0,_.offsetY=0,_.height=h.w,_.width=h.h,_.maxX=_.positionX+_.width/2,_.minX=_.positionX-_.width/2,_.maxY=_.positionY+_.height/2,_.minY=_.positionY-_.height/2,_.padLeft=parseFloat(y.style("padding")),_.padRight=parseFloat(y.style("padding")),_.padTop=parseFloat(y.style("padding")),_.padBottom=parseFloat(y.style("padding")),_.nodeRepulsion=Me(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,o.layoutNodes.push(_),o.idToIndex[_.id]=u}var p=[],f=0,g=-1,v=[];for(u=0;u<o.nodeSize;u++){var y,m=(y=o.layoutNodes[u]).parentId;m!=null?o.layoutNodes[o.idToIndex[m]].children.push(y.id):(p[++g]=y.id,v.push(y.id))}for(o.graphSet.push(v);f<=g;){var b=p[f++],w=o.idToIndex[b],k=o.layoutNodes[w].children;if(k.length>0)for(o.graphSet.push(k),u=0;u<k.length;u++)p[++g]=k[u]}for(u=0;u<o.graphSet.length;u++){var E=o.graphSet[u];for(d=0;d<E.length;d++){var x=o.idToIndex[E[d]];o.indexToGraph[x]=u}}for(u=0;u<o.edgeSize;u++){var C=r[u],S={};S.id=C.data("id"),S.sourceId=C.data("source"),S.targetId=C.data("target");var T=Me(n.idealEdgeLength)?n.idealEdgeLength(C):n.idealEdgeLength,D=Me(n.edgeElasticity)?n.edgeElasticity(C):n.edgeElasticity,A=o.idToIndex[S.sourceId],B=o.idToIndex[S.targetId];if(o.indexToGraph[A]!=o.indexToGraph[B]){for(var M=Nf(S.sourceId,S.targetId,o),L=o.graphSet[M],I=0,_=o.layoutNodes[A];L.indexOf(_.id)===-1;)_=o.layoutNodes[o.idToIndex[_.parentId]],I++;for(_=o.layoutNodes[B];L.indexOf(_.id)===-1;)_=o.layoutNodes[o.idToIndex[_.parentId]],I++;T*=I*n.nestingFactor}S.idealLength=T,S.elasticity=D,o.layoutEdges.push(S)}return o},Nf=function(e,t,n){var r=rc(e,t,0,n);return 2>r.count?0:r.graph},rc=function(e,t,n,r){var a=r.graphSet[n];if(-1<a.indexOf(e)&&-1<a.indexOf(t))return{count:2,graph:n};for(var i=0,o=0;o<a.length;o++){var s=a[o],l=r.idToIndex[s],u=r.layoutNodes[l].children;if(u.length!==0){var c=r.indexToGraph[r.idToIndex[u[0]]],d=rc(e,t,c,r);if(d.count!==0){if(d.count!==1)return d;if(++i===2)break}}}return{count:i,graph:n}},Rf=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];i.children.length!==0||i.isLocked||(i.positionX=Math.random()*n,i.positionY=Math.random()*r)}},ac=function(e,t,n){var r=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(i){var o=e.layoutNodes[e.idToIndex[i.data("id")]];a.x1=Math.min(a.x1,o.positionX),a.x2=Math.max(a.x2,o.positionX),a.y1=Math.min(a.y1,o.positionY),a.y2=Math.max(a.y2,o.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(i,o){var s=e.layoutNodes[e.idToIndex[i.data("id")]];if(t.boundingBox){var l=(s.positionX-a.x1)/a.w,u=(s.positionY-a.y1)/a.h;return{x:r.x1+l*r.w,y:r.y1+u*r.h}}return{x:s.positionX,y:s.positionY}}},Lf=function(e,t,n){var r=n.layout,a=n.eles.nodes(),i=ac(e,n,a);a.positions(i),e.ready!==!0&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},zf=function(e,t,n){Of(e,t),qf(e),Xf(e,t),Yf(e),jf(e)},Of=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],a=r.length,i=0;i<a;i++)for(var o=e.layoutNodes[e.idToIndex[r[i]]],s=i+1;s<a;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];Vf(o,l,e,t)}},ic=function(e){return 2*e*Math.random()-1},Vf=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var a=t.positionX-e.positionX,i=t.positionY-e.positionY;a===0&&i===0&&(a=ic(1),i=ic(1));var o=Ff(e,t,a,i);if(o>0)var s=(u=r.nodeOverlap*o)*a/(g=Math.sqrt(a*a+i*i)),l=u*i/g;else{var u,c=la(e,a,i),d=la(t,-1*a,-1*i),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Ff=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},la=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,l=i/o,u={};return t===0&&0<n||t===0&&0>n?(u.x=r,u.y=a+i/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=a+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=a-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+i*t/2/n,u.y=a+i/2,u):(0>n&&(s<=-1*l||s>=l)&&(u.x=r-i*t/2/n,u.y=a-i/2),u)},qf=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],a=e.idToIndex[r.sourceId],i=e.layoutNodes[a],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-i.positionX,u=s.positionY-i.positionY;if(l!==0||u!==0){var c=la(i,l,u),d=la(s,-1*l,-1*u),h=d.x-c.x,p=d.y-c.y,f=Math.sqrt(h*h+p*p),g=Math.pow(r.idealLength-f,2)/r.elasticity;if(f!==0)var v=g*h/f,y=g*p/f;else v=0,y=0;i.isLocked||(i.offsetX+=v,i.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},Xf=function(e,t){if(t.gravity!==0)for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],a=r.length;if(n===0)var i=e.clientHeight/2,o=e.clientWidth/2;else{var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]];i=l.positionX,o=l.positionY}for(var u=0;u<a;u++){var c=e.layoutNodes[e.idToIndex[r[u]]];if(!c.isLocked){var d=i-c.positionX,h=o-c.positionY,p=Math.sqrt(d*d+h*h);if(p>1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},Yf=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=u,h.offsetY+=c,n[++a]=l[d]}s.offsetX=0,s.offsetY=0}}},jf=function(e,t){for(var n=0;n<e.nodeSize;n++)0<(a=e.layoutNodes[n]).children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0);for(n=0;n<e.nodeSize;n++)if(!(0<(a=e.layoutNodes[n]).children.length||a.isLocked)){var r=Wf(a.offsetX,a.offsetY,e.temperature);a.positionX+=r.x,a.positionY+=r.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,oc(a,e)}for(n=0;n<e.nodeSize;n++){var a;0<(a=e.layoutNodes[n]).children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},Wf=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},oc=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],a=!1;return(r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,a=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,a=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,a=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,a=!0),a?oc(r,t):void 0}},sc=function(e,t){for(var n=e.layoutNodes,r=[],a=0;a<n.length;a++){var i=n[a],o=i.cmptId;(r[o]=r[o]||[]).push(i)}var s=0;for(a=0;a<r.length;a++)if(g=r[a]){g.x1=1/0,g.x2=-1/0,g.y1=1/0,g.y2=-1/0;for(var l=0;l<g.length;l++){var u=g[l];g.x1=Math.min(g.x1,u.positionX-u.width/2),g.x2=Math.max(g.x2,u.positionX+u.width/2),g.y1=Math.min(g.y1,u.positionY-u.height/2),g.y2=Math.max(g.y2,u.positionY+u.height/2)}g.w=g.x2-g.x1,g.h=g.y2-g.y1,s+=g.w*g.h}r.sort(function(v,y){return y.w*y.h-v.w*v.h});var c=0,d=0,h=0,p=0,f=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(a=0;a<r.length;a++){var g;if(g=r[a]){for(l=0;l<g.length;l++)(u=g[l]).isLocked||(u.positionX+=c-g.x1,u.positionY+=d-g.y1);c+=g.w+t.componentSpacing,h+=g.w+t.componentSpacing,p=Math.max(p,g.h),h>f&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},Hf={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 lc(e){this.options=pe({},Hf,e)}lc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=nt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(i.h===0||i.w===0)r.nodes().layoutPositions(this,t,function(W){return{x:i.x1,y:i.y1}});else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),c=function(W){if(W==null)return Math.min(l,u);Math.min(l,u)==l?l=W:u=W},d=function(W){if(W==null)return Math.max(l,u);Math.max(l,u)==l?l=W:u=W},h=t.rows,p=t.cols!=null?t.cols:t.columns;if(h!=null&&p!=null)l=h,u=p;else if(h!=null&&p==null)l=h,u=Math.ceil(o/l);else if(h==null&&p!=null)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l<o;){var v=c(),y=d();(y+1)*v>=o?d(y+1):c(v+1)}var m=i.w/u,b=i.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var w=0;w<a.length;w++){var k=a[w],E=k._private.position;E.x!=null&&E.y!=null||(E.x=0,E.y=0);var x=k.layoutDimensions(t),C=t.avoidOverlapPadding,S=x.w+C,T=x.h+C;m=Math.max(m,S),b=Math.max(b,T)}for(var D={},A=function(W,Z){return!!D["c-"+W+"-"+Z]},B=function(W,Z){D["c-"+W+"-"+Z]=!0},M=0,L=0,I=function(){++L>=u&&(L=0,M++)},_={},R=0;R<a.length;R++){var F=a[R],z=t.position(F);if(z&&(z.row!==void 0||z.col!==void 0)){var Y={row:z.row,col:z.col};if(Y.col===void 0)for(Y.col=0;A(Y.row,Y.col);)Y.col++;else if(Y.row===void 0)for(Y.row=0;A(Y.row,Y.col);)Y.row++;_[F.id()]=Y,B(Y.row,Y.col)}}a.layoutPositions(this,t,function(W,Z){var G,$;if(W.locked()||W.isParent())return!1;var V=_[W.id()];if(V)G=V.col*m+m/2+i.x1,$=V.row*b+b/2+i.y1;else{for(;A(M,L);)I();G=L*m+m/2+i.x1,$=M*b+b/2+i.y1,B(M,L),I()}return{x:G,y:$}})}return this};var Gf={ready:function(){},stop:function(){}};function Ri(e){this.options=pe({},Gf,e)}Ri.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},Ri.prototype.stop=function(){return this};var Kf={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function uc(e){this.options=pe({},Kf,e)}uc.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=Me(e.positions);return t.layoutPositions(this,e,function(r,a){var i=function(o){if(e.positions==null)return function(l){return{x:l.x,y:l.y}}(o.position());if(n)return e.positions(o);var s=e.positions[o._private.data.id];return s??null}(r);return!r.locked()&&i!=null&&i}),this};var Uf={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function cc(e){this.options=pe({},Uf,e)}cc.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=nt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(a,i){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var Zf=[{name:"breadthfirst",impl:Ju},{name:"circle",impl:ec},{name:"concentric",impl:nc},{name:"cose",impl:sa},{name:"grid",impl:lc},{name:"null",impl:Ri},{name:"preset",impl:uc},{name:"random",impl:cc}];function dc(e){this.options=e,this.notifications=0}var hc=function(){},fc=function(){throw new Error("A headless instance can not render images")};dc.prototype={recalculateRenderedStyle:hc,notify:function(){this.notifications++},init:hc,isHeadless:function(){return!0},png:fc,jpg:fc};var $f={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(l,u,c,d,h,p,f){var g=h.x-c/2-f,v=h.x+c/2+f,y=h.y-c/2-f,m=h.y+c/2+f;return g<=l&&l<=v&&y<=u&&u<=m},r=function(l,u,c,d,h){var p=l*Math.cos(d)-u*Math.sin(d),f=(l*Math.sin(d)+u*Math.cos(d))*c;return{x:p*c+h.x,y:f+h.y}},a=function(l,u,c,d){for(var h=[],p=0;p<l.length;p+=2){var f=l[p],g=l[p+1];h.push(r(f,g,u,c,d))}return h},i=function(l){for(var u=[],c=0;c<l.length;c++){var d=l[c];u.push(d.x,d.y)}return u},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,u){fe(u)&&(u=e[u]),e[l]=pe({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,d,h,p,f,g){var v=i(a(this.points,h+2*g,p,f));return st(c,d,v)},roughCollide:n,draw:function(c,d,h,p){var f=a(this.points,d,h,p);t.arrowShapeImpl("polygon")(c,f)},spacing:function(c){return 0},gap:o},u)};s("none",{collide:Tr,roughCollide:Tr,draw:Ca,spacing:Zo,gap:Zo}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(l,u,c,d,h){var p=a(this.points,u,c,d),f=this.controlPoint,g=r(f[0],f[1],u,c,d);t.arrowShapeImpl(this.name)(l,p,g)},gap:function(l){return .8*o(l)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,u,c,d,h,p,f){var g=i(a(this.points,c+2*f,d,h)),v=i(a(this.pointsTee,c+2*f,d,h));return st(l,u,g)||st(l,u,v)},draw:function(l,u,c,d,h){var p=a(this.points,u,c,d),f=a(this.pointsTee,u,c,d);t.arrowShapeImpl(this.name)(l,p,f)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,u,c,d,h,p,f){var g=h,v=Math.pow(g.x-l,2)+Math.pow(g.y-u,2)<=Math.pow((c+2*f)*this.radius,2),y=i(a(this.points,c+2*f,d,h));return st(l,u,y)||v},draw:function(l,u,c,d,h){var p=a(this.pointsTr,u,c,d);t.arrowShapeImpl(this.name)(l,p,d.x,d.y,this.radius*u)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,u){var c=this.baseCrossLinePts.slice(),d=u/l;return c[3]=c[3]-d,c[5]=c[5]-d,c},collide:function(l,u,c,d,h,p,f){var g=i(a(this.points,c+2*f,d,h)),v=i(a(this.crossLinePts(c,p),c+2*f,d,h));return st(l,u,g)||st(l,u,v)},draw:function(l,u,c,d,h){var p=a(this.points,u,c,d),f=a(this.crossLinePts(u,h),u,c,d);t.arrowShapeImpl(this.name)(l,p,f)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return .525*o(l)}}),s("circle",{radius:.15,collide:function(l,u,c,d,h,p,f){var g=h;return Math.pow(g.x-l,2)+Math.pow(g.y-u,2)<=Math.pow((c+2*f)*this.radius,2)},draw:function(l,u,c,d,h){t.arrowShapeImpl(this.name)(l,d.x,d.y,this.radius*u)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})}},Qf={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-a)/o-s.x)/l,((t-i)/o-s.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(k){return parseFloat(n.getPropertyValue(k))},a=r("padding-left"),i=r("padding-right"),o=r("padding-top"),s=r("padding-bottom"),l=r("border-left-width"),u=r("border-right-width"),c=r("border-top-width"),d=(r("border-bottom-width"),e.clientWidth),h=e.clientHeight,p=a+i,f=o+s,g=l+u,v=t.width/(d+g),y=d-p,m=h-f,b=t.left+a+l,w=t.top+o+c;return this.containerBB=[b,w,y,m,v]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var a,i,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(x,C){if(x.isNode()){if(i)return;i=x,u.push(x)}if(x.isEdge()&&(C==null||C<g))if(a){if(a.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&a.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var S=0;S<u.length;S++)if(u[S].isEdge()){u[S]=x,a=x,g=C??g;break}}}else u.push(x),a=x,g=C??g}function y(x){var C=x.outerWidth()+2*p,S=x.outerHeight()+2*p,T=C/2,D=S/2,A=x.position(),B=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,M=x._private.rscratch;if(A.x-T<=e&&e<=A.x+T&&A.y-D<=t&&t<=A.y+D&&s.nodeShapes[o.getNodeShape(x)].checkPoint(e,t,0,C,S,A.x,A.y,B,M))return v(x,0),!0}function m(x){var C,S=x._private,T=S.rscratch,D=x.pstyle("width").pfValue,A=x.pstyle("arrow-scale").value,B=D/2+h,M=B*B,L=2*B,I=S.source,_=S.target;if(T.edgeType==="segments"||T.edgeType==="straight"||T.edgeType==="haystack"){for(var R=T.allpts,F=0;F+3<R.length;F+=2)if(Hd(e,t,R[F],R[F+1],R[F+2],R[F+3],L)&&M>(C=Ud(e,t,R[F],R[F+1],R[F+2],R[F+3])))return v(x,C),!0}else if(T.edgeType==="bezier"||T.edgeType==="multibezier"||T.edgeType==="self"||T.edgeType==="compound"){for(R=T.allpts,F=0;F+5<T.allpts.length;F+=4)if(Gd(e,t,R[F],R[F+1],R[F+2],R[F+3],R[F+4],R[F+5],L)&&M>(C=Kd(e,t,R[F],R[F+1],R[F+2],R[F+3],R[F+4],R[F+5])))return v(x,C),!0}I=I||S.source,_=_||S.target;var z=o.getArrowWidth(D,A),Y=[{name:"source",x:T.arrowStartX,y:T.arrowStartY,angle:T.srcArrowAngle},{name:"target",x:T.arrowEndX,y:T.arrowEndY,angle:T.tgtArrowAngle},{name:"mid-source",x:T.midX,y:T.midY,angle:T.midsrcArrowAngle},{name:"mid-target",x:T.midX,y:T.midY,angle:T.midtgtArrowAngle}];for(F=0;F<Y.length;F++){var W=Y[F],Z=s.arrowShapes[x.pstyle(W.name+"-arrow-shape").value],G=x.pstyle("width").pfValue;if(Z.roughCollide(e,t,z,W.angle,{x:W.x,y:W.y},G,h)&&Z.collide(e,t,z,W.angle,{x:W.x,y:W.y},G,h))return v(x),!0}d&&u.length>0&&(y(I),y(_))}function b(x,C,S){return ot(x,C,S)}function w(x,C){var S,T=x._private,D=f;S=C?C+"-":"",x.boundingBox();var A=T.labelBounds[C||"main"],B=x.pstyle(S+"label").value;if(x.pstyle("text-events").strValue==="yes"&&B){var M=b(T.rscratch,"labelX",C),L=b(T.rscratch,"labelY",C),I=b(T.rscratch,"labelAngle",C),_=x.pstyle(S+"text-margin-x").pfValue,R=x.pstyle(S+"text-margin-y").pfValue,F=A.x1-D-_,z=A.x2+D-_,Y=A.y1-D-R,W=A.y2+D-R;if(I){var Z=Math.cos(I),G=Math.sin(I),$=function(oe,ce){return{x:(oe-=M)*Z-(ce-=L)*G+M,y:oe*G+ce*Z+L}},V=$(F,Y),O=$(F,W),q=$(z,Y),Q=$(z,W),ee=[V.x+_,V.y+R,q.x+_,q.y+R,Q.x+_,Q.y+R,O.x+_,O.y+R];if(st(e,t,ee))return v(x),!0}else if(bn(A,e,t))return v(x),!0}}n&&(l=l.interactive);for(var k=l.length-1;k>=0;k--){var E=l[k];E.isNode()?y(E)||w(E):m(E)||w(E)||w(E,"source")||w(E,"target")}return u},getAllInBox:function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,i=2/this.cy.zoom(),o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r),d=nt({x1:e=s,y1:t=u,x2:n=l,y2:r=c});function h(A,B,M){return ot(A,B,M)}function p(A,B){var M=A._private,L=i;A.boundingBox();var I=M.labelBounds.main;if(!I)return null;var _=h(M.rscratch,"labelX",B),R=h(M.rscratch,"labelY",B),F=h(M.rscratch,"labelAngle",B),z=A.pstyle("text-margin-x").pfValue,Y=A.pstyle("text-margin-y").pfValue,W=I.x1-L-z,Z=I.x2+L-z,G=I.y1-L-Y,$=I.y2+L-Y;if(F){var V=Math.cos(F),O=Math.sin(F),q=function(Q,ee){return{x:(Q-=_)*V-(ee-=R)*O+_,y:Q*O+ee*V+R}};return[q(W,G),q(Z,G),q(Z,$),q(W,$)]}return[{x:W,y:G},{x:Z,y:G},{x:Z,y:$},{x:W,y:$}]}for(var f=0;f<a.length;f++){var g=a[f];if(g.isNode()){var v=g,y=v.pstyle("text-events").strValue==="yes",m=v.pstyle("box-select-labels").strValue==="yes",b=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:m&&y});if(Ma(d,b)){var w=p(v),k=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}];w&&!$d(w,k)||o.push(v)}}else{var E=g,x=E._private,C=x.rscratch;if(C.startX!=null&&C.startY!=null&&!bn(d,C.startX,C.startY)||C.endX!=null&&C.endY!=null&&!bn(d,C.endX,C.endY))continue;if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"||C.edgeType==="segments"||C.edgeType==="haystack"){for(var S=x.rstyle.bezierPts||x.rstyle.linePts||x.rstyle.haystackPts,T=!0,D=0;D<S.length;D++)if(!Xd(d,S[D])){T=!1;break}T&&o.push(E)}else C.edgeType!=="haystack"&&C.edgeType!=="straight"||o.push(E)}}return o}},Li={calculateArrowAngles:function(e){var t,n,r,a,i,o,s=e._private.rscratch,l=s.edgeType==="haystack",u=s.edgeType==="bezier",c=s.edgeType==="multibezier",d=s.edgeType==="segments",h=s.edgeType==="compound",p=s.edgeType==="self";if(l?(r=s.haystackPts[0],a=s.haystackPts[1],i=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,a=s.arrowStartY,i=s.arrowEndX,o=s.arrowEndY),g=s.midX,v=s.midY,d)t=r-s.segpts[0],n=a-s.segpts[1];else if(c||h||p||u){var f=s.allpts;t=r-We(f[0],f[2],f[4],.1),n=a-We(f[1],f[3],f[5],.1)}else t=r-g,n=a-v;s.srcArrowAngle=Sr(t,n);var g=s.midX,v=s.midY;if(l&&(g=(r+i)/2,v=(a+o)/2),t=i-r,n=o-a,d)if((f=s.allpts).length/2%2==0){var y=(S=f.length/2)-2;t=f[S]-f[y],n=f[S+1]-f[y+1]}else s.isRound?(t=s.midVector[1],n=-s.midVector[0]):(y=(S=f.length/2-1)-2,t=f[S]-f[y],n=f[S+1]-f[y+1]);else if(c||h||p){var m,b,w,k,f=s.allpts;if(s.ctrlpts.length/2%2==0){var E=(x=(C=f.length/2-1)+2)+2;m=We(f[C],f[x],f[E],0),b=We(f[C+1],f[x+1],f[E+1],0),w=We(f[C],f[x],f[E],1e-4),k=We(f[C+1],f[x+1],f[E+1],1e-4)}else{var x,C;E=(x=f.length/2-1)+2,m=We(f[C=x-2],f[x],f[E],.4999),b=We(f[C+1],f[x+1],f[E+1],.4999),w=We(f[C],f[x],f[E],.5),k=We(f[C+1],f[x+1],f[E+1],.5)}t=w-m,n=k-b}if(s.midtgtArrowAngle=Sr(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,d&&(f=s.allpts).length/2%2!=0){if(!s.isRound){var S,T=(S=f.length/2-1)+2;t=-(f[T]-f[S]),n=-(f[T+1]-f[S+1])}}if(s.midsrcArrowAngle=Sr(t,n),d)t=i-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||h||p||u){var D=(f=s.allpts).length;t=i-We(f[D-6],f[D-4],f[D-2],.9),n=o-We(f[D-5],f[D-3],f[D-1],.9)}else t=i-g,n=o-v;s.tgtArrowAngle=Sr(t,n)}};Li.getArrowWidth=Li.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 zi,Oi,pc,gc,on,ua,At,sn,ln,Mt,cr,ca,vc,yc,Vi,Fi,mc,kt={},pt={},bc=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)},Jf=function(e,t,n,r,a){var i,o;if(e!==mc?bc(t,e,kt):((o=kt).x=-1*(i=pt).x,o.y=-1*i.y,o.nx=-1*i.nx,o.ny=-1*i.ny,o.ang=i.ang>0?-(Math.PI-i.ang):Math.PI+i.ang),bc(t,n,pt),pc=kt.nx*pt.ny-kt.ny*pt.nx,gc=kt.nx*pt.nx-kt.ny*-pt.ny,At=Math.asin(Math.max(-1,Math.min(1,pc))),Math.abs(At)<1e-6)return zi=t.x,Oi=t.y,void(ln=cr=0);on=1,ua=!1,gc<0?At<0?At=Math.PI+At:(At=Math.PI-At,on=-1,ua=!0):At>0&&(on=-1,ua=!0),cr=t.radius!==void 0?t.radius:r,sn=At/2,ca=Math.min(kt.len/2,pt.len/2),a?(Mt=Math.abs(Math.cos(sn)*cr/Math.sin(sn)))>ca?(Mt=ca,ln=Math.abs(Mt*Math.sin(sn)/Math.cos(sn))):ln=cr:(Mt=Math.min(ca,cr),ln=Math.abs(Mt*Math.sin(sn)/Math.cos(sn))),Vi=t.x+pt.nx*Mt,Fi=t.y+pt.ny*Mt,zi=Vi-pt.ny*ln*on,Oi=Fi+pt.nx*ln*on,vc=t.x+kt.nx*Mt,yc=t.y+kt.ny*Mt,mc=t};function xc(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function qi(e,t,n,r){var a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Jf(e,t,n,r,a),{cx:zi,cy:Oi,radius:ln,startX:vc,startY:yc,stopX:Vi,stopY:Fi,startAngle:kt.ang+Math.PI/2*on,endAngle:pt.ang-Math.PI/2*on,counterClockwise:ua})}var da=.01,ep=Math.sqrt(.02),et={};function wc(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}et.findMidptPtsEtc=function(e,t){var n,r=t.posPts,a=t.intersectionPts,i=t.vectorNormInverse,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),l=o.units!=null&&s.units!=null;switch(e.pstyle("edge-distances").value){case"node-position":n=r;break;case"intersection":n=a;break;case"endpoints":if(l){var u=Fe(this.manualEndptToPx(e.source()[0],o),2),c=u[0],d=u[1],h=Fe(this.manualEndptToPx(e.target()[0],s),2),p=h[0],f=h[1],g={x1:c,y1:d,x2:p,y2:f};i=function(v,y,m,b){var w=b-y,k=m-v,E=Math.sqrt(k*k+w*w);return{x:-w/E,y:k/E}}(c,d,p,f),n=g}else ke("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).")),n=a}return{midptPts:n,vectorNormInverse:i}},et.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=2*Math.random()*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=2*Math.random()*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),d=s.width(),h=o.height(),p=s.height(),f=n.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*c*f+l.x,a.source.y*h*f+l.y,a.target.x*d*f+u.x,a.target.y*p*f+u.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},et.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,a.pfValue.length),l=i.pfValue[i.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=a.pfValue[c],p=1-d,f=d,g=this.findMidptPtsEtc(e,t),v=g.midptPts,y=g.vectorNormInverse,m={x:v.x1*p+v.x2*f,y:v.y1*p+v.y2*f};n.segpts.push(m.x+y.x*h,m.y+y.y*h),n.radii.push(i.pfValue[c]!==void 0?i.pfValue[c]:l),n.isArcRadius.push((o.pfValue[c]!==void 0?o.pfValue[c]:u)==="arc-radius")}},et.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,i=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=n,p=d;r&&(h=0,p=l);var f=u-Math.PI/2,g=f-c/2,v=f+c/2,y=u+"_"+c;h=i[y]===void 0?i[y]=0:++i[y],a.ctrlpts=[o.x+1.4*Math.cos(g)*p*(h/3+1),o.y+1.4*Math.sin(g)*p*(h/3+1),o.x+1.4*Math.cos(v)*p*(h/3+1),o.y+1.4*Math.sin(v)*p*(h/3+1)]},et.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),p=h?h.pfValue[0]:void 0,f=n,g=d;r&&(f=0,g=p);var v={x:i.x-s/2,y:i.y-l/2},y={x:o.x-u/2,y:o.y-c/2},m={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},b=Math.max(.5,Math.log(s*da)),w=Math.max(.5,Math.log(u*da));a.ctrlpts=[m.x,m.y-(1+Math.pow(50,1.12)/100)*g*(f/3+1)*b,m.x-(1+Math.pow(50,1.12)/100)*g*(f/3+1)*w,m.y]},et.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},et.findBezierPoints=function(e,t,n,r,a){var i=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;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var p=0;p<u;p++){var f=(.5-t.eles.length/2+n)*o*(a?-1:1),g=void 0,v=Aa(f);h&&(c=s?s.pfValue[p]:o,d=l.value[p]);var y=(g=r?c:c!==void 0?v*c:void 0)!==void 0?g:f,m=1-d,b=d,w=this.findMidptPtsEtc(e,t),k=w.midptPts,E=w.vectorNormInverse,x={x:k.x1*m+k.x2*b,y:k.y1*m+k.y2*b};i.ctrlpts.push(x.x+E.x*y,x.y+E.y*y)}},et.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",o="rightward",s="downward",l="upward",u=t.posPts,c=t.srcW,d=t.srcH,h=t.tgtW,p=t.tgtH,f=e.pstyle("edge-distances").value!=="node-position",g=e.pstyle("taxi-direction").value,v=g,y=e.pstyle("taxi-turn"),m=y.units==="%",b=y.pfValue,w=b<0,k=e.pstyle("taxi-turn-min-distance").pfValue,E=f?(c+h)/2:0,x=f?(d+p)/2:0,C=u.x2-u.x1,S=u.y2-u.y1,T=function(re,te){return re>0?Math.max(re-te,0):Math.min(re+te,0)},D=T(C,E),A=T(S,x),B=!1;v==="auto"?g=Math.abs(D)>Math.abs(A)?a:r:v===l||v===s?(g=r,B=!0):v!==i&&v!==o||(g=a,B=!0);var M,L=g===r,I=L?A:D,_=L?S:C,R=Aa(_),F=!1;B&&(m||w)||!(v===s&&_<0||v===l&&_>0||v===i&&_>0||v===o&&_<0)||(I=(R*=-1)*Math.abs(I),F=!0),m?M=(b<0?1+b:b)*I:M=(b<0?I:0)+b*R;var z=function(re){return Math.abs(re)<k||Math.abs(re)>=Math.abs(I)},Y=z(M),W=z(Math.abs(I)-Math.abs(M));if((Y||W)&&!F)if(L){var Z=Math.abs(_)<=d/2,G=Math.abs(C)<=h/2;if(Z){var $=(u.x1+u.x2)/2,V=u.y1,O=u.y2;n.segpts=[$,V,$,O]}else if(G){var q=(u.y1+u.y2)/2,Q=u.x1,ee=u.x2;n.segpts=[Q,q,ee,q]}else n.segpts=[u.x1,u.y2]}else{var oe=Math.abs(_)<=c/2,ce=Math.abs(S)<=p/2;if(oe){var ve=(u.y1+u.y2)/2,he=u.x1,ne=u.x2;n.segpts=[he,ve,ne,ve]}else if(ce){var se=(u.x1+u.x2)/2,le=u.y1,de=u.y2;n.segpts=[se,le,se,de]}else n.segpts=[u.x2,u.y1]}else if(L){var P=u.y1+M+(f?d/2*R:0),N=u.x1,X=u.x2;n.segpts=[N,P,X,P]}else{var H=u.x1+M+(f?c/2*R:0),K=u.y1,j=u.y2;n.segpts=[H,K,H,j]}if(n.isRound){var U=e.pstyle("taxi-radius").value,J=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(U),n.isArcRadius=new Array(n.segpts.length/2).fill(J)}},et.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!ie(n.startX)||!ie(n.startY),v=!ie(n.arrowStartX)||!ie(n.arrowStartY),y=!ie(n.endX)||!ie(n.endY),m=!ie(n.arrowEndX)||!ie(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=en({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),k=w<b,E=en({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),x=E<b,C=!1;if(g||v||k){C=!0;var S={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},T=Math.sqrt(S.x*S.x+S.y*S.y),D={x:S.x/T,y:S.y/T},A=Math.max(i,o),B={x:n.ctrlpts[0]+2*D.x*A,y:n.ctrlpts[1]+2*D.y*A},M=u.intersectLine(r.x,r.y,i,o,B.x,B.y,0,d,p);k?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(b-w),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(b-w)):(n.ctrlpts[0]=M[0]+D.x*b,n.ctrlpts[1]=M[1]+D.y*b)}if(y||m||x){C=!0;var L={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},I=Math.sqrt(L.x*L.x+L.y*L.y),_={x:L.x/I,y:L.y/I},R=Math.max(i,o),F={x:n.ctrlpts[0]+2*_.x*R,y:n.ctrlpts[1]+2*_.y*R},z=c.intersectLine(a.x,a.y,s,l,F.x,F.y,0,h,f);x?(n.ctrlpts[0]=n.ctrlpts[0]+_.x*(b-E),n.ctrlpts[1]=n.ctrlpts[1]+_.y*(b-E)):(n.ctrlpts[0]=z[0]+_.x*b,n.ctrlpts[1]=z[1]+_.y*b)}C&&this.findEndpoints(e)}},et.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,t.midX=We(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=We(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var i=t.radii[a/2-1],o=t.isArcRadius[a/2-1];t.roundCorners.push(qi({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:i},{x:t.allpts[a+2],y:t.allpts[a+3]},i,o))}}if(t.segpts.length%4==0){var s=t.segpts.length/2,l=s-2;t.midX=(t.segpts[l]+t.segpts[s])/2,t.midY=(t.segpts[l+1]+t.segpts[s+1])/2}else{var u=t.segpts.length/2-1;if(t.isRound){var c={x:t.segpts[u],y:t.segpts[u+1]},d=t.roundCorners[u/2];if(d.radius===0){var h={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=c.x,t.midY=c.y,t.midVector=[c.y-h.y,h.x-c.x]}else{var p=[c.x-d.cx,c.y-d.cy],f=d.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(g){return g*f}),t.midX=d.cx+p[0],t.midY=d.cy+p[1],t.midVector=p}}else t.midX=t.segpts[u],t.midY=t.segpts[u+1]}}},et.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||ie(t.startX)&&ie(t.startY)&&ie(t.endX)&&ie(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,ke("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."))},et.findEdgeControlPoints=function(e){var t=this;if(e&&e.length!==0){for(var n=this,r=n.cy.hasCompoundNodes(),a=new _t,i=function(k,E){return[].concat(yr(k),[E?1:0]).join("-")},o=[],s=[],l=0;l<e.length;l++){var u=e[l],c=u._private,d=u.pstyle("curve-style").value;if(!u.removed()&&u.takesUpSpace())if(d!=="haystack"){var h=d==="unbundled-bezier"||zt(d,"segments")||d==="straight"||d==="straight-triangle"||zt(d,"taxi"),p=d==="unbundled-bezier"||d==="bezier",f=c.source,g=c.target,v=[f.poolIndex(),g.poolIndex()].sort(),y=i(v,h),m=a.get(y);m==null&&(m={eles:[]},o.push({pairId:v,edgeIsUnbundled:h}),a.set(y,m)),m.eles.push(u),h&&(m.hasUnbundled=!0),p&&(m.hasBezier=!0)}else s.push(u)}for(var b=function(){var k,E=o[w],x=E.pairId,C=E.edgeIsUnbundled,S=i(x,C),T=a.get(S);if(!T.hasUnbundled){var D=T.eles[0].parallelEdges().filter(function(re){return re.isBundledBezier()});Pa(T.eles),D.forEach(function(re){return T.eles.push(re)}),T.eles.sort(function(re,te){return re.poolIndex()-te.poolIndex()})}var A=T.eles[0],B=A.source(),M=A.target();if(B.poolIndex()>M.poolIndex()){var L=B;B=M,M=L}var I=T.srcPos=B.position(),_=T.tgtPos=M.position(),R=T.srcW=B.outerWidth(),F=T.srcH=B.outerHeight(),z=T.tgtW=M.outerWidth(),Y=T.tgtH=M.outerHeight(),W=T.srcShape=n.nodeShapes[t.getNodeShape(B)],Z=T.tgtShape=n.nodeShapes[t.getNodeShape(M)],G=T.srcCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,$=T.tgtCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,V=T.tgtRs=M._private.rscratch,O=T.srcRs=B._private.rscratch;T.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var q=0;q<T.eles.length;q++){var Q=T.eles[q],ee=Q[0]._private.rscratch,oe=Q.pstyle("curve-style").value,ce=oe==="unbundled-bezier"||zt(oe,"segments")||zt(oe,"taxi"),ve=!B.same(Q.source());if(!T.calculatedIntersection&&B!==M&&(T.hasBezier||T.hasUnbundled)){T.calculatedIntersection=!0;var he=W.intersectLine(I.x,I.y,R,F,_.x,_.y,0,G,O),ne=T.srcIntn=he,se=Z.intersectLine(_.x,_.y,z,Y,I.x,I.y,0,$,V),le=T.tgtIntn=se,de=T.intersectionPts={x1:he[0],x2:se[0],y1:he[1],y2:se[1]},P=T.posPts={x1:I.x,x2:_.x,y1:I.y,y2:_.y},N=se[1]-he[1],X=se[0]-he[0],H=Math.sqrt(X*X+N*N);ie(H)&&H>=ep||(H=Math.sqrt(Math.max(X*X,da)+Math.max(N*N,da)));var K=T.vector={x:X,y:N},j=T.vectorNorm={x:K.x/H,y:K.y/H},U={x:-j.y,y:j.x};T.nodesOverlap=!ie(H)||Z.checkPoint(he[0],he[1],0,z,Y,_.x,_.y,$,V)||W.checkPoint(se[0],se[1],0,R,F,I.x,I.y,G,O),T.vectorNormInverse=U,k={nodesOverlap:T.nodesOverlap,dirCounts:T.dirCounts,calculatedIntersection:!0,hasBezier:T.hasBezier,hasUnbundled:T.hasUnbundled,eles:T.eles,srcPos:_,srcRs:V,tgtPos:I,tgtRs:O,srcW:z,srcH:Y,tgtW:R,tgtH:F,srcIntn:le,tgtIntn:ne,srcShape:Z,tgtShape:W,posPts:{x1:P.x2,y1:P.y2,x2:P.x1,y2:P.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-K.x,y:-K.y},vectorNorm:{x:-j.x,y:-j.y},vectorNormInverse:{x:-U.x,y:-U.y}}}var J=ve?k:T;ee.nodesOverlap=J.nodesOverlap,ee.srcIntn=J.srcIntn,ee.tgtIntn=J.tgtIntn,ee.isRound=oe.startsWith("round"),r&&(B.isParent()||B.isChild()||M.isParent()||M.isChild())&&(B.parents().anySame(M)||M.parents().anySame(B)||B.same(M)&&B.isParent())?t.findCompoundLoopPoints(Q,J,q,ce):B===M?t.findLoopPoints(Q,J,q,ce):oe.endsWith("segments")?t.findSegmentsPoints(Q,J):oe.endsWith("taxi")?t.findTaxiPoints(Q,J):oe==="straight"||!ce&&T.eles.length%2==1&&q===Math.floor(T.eles.length/2)?t.findStraightEdgePoints(Q):t.findBezierPoints(Q,J,q,ce,ve),t.findEndpoints(Q),t.tryToCorrectInvalidPoints(Q,J),t.checkForInvalidEdgeWarning(Q),t.storeAllpts(Q),t.storeEdgeProjections(Q),t.calculateArrowAngles(Q),t.recalculateEdgeLabelProjections(Q),t.calculateLabelAngles(Q)}},w=0;w<o.length;w++)b();this.findHaystackPoints(s)}},et.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),t.edgeType==="segments")return wc(t.segpts)},et.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return wc(t.ctrlpts)},et.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var tp={manualEndptToPx:function(e,t){var n=e.position(),r=e.outerWidth(),a=e.outerHeight(),i=e._private.rscratch;if(t.value.length===2){var o=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(o[0]=o[0]*r),t.units[1]==="%"&&(o[1]=o[1]*a),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(r,a),u=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,a,u[0],u[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,i)},findEndpoints:function(e){var t,n,r,a,i,o,s,l,u,c=this,d=e.source()[0],h=e.target()[0],p=d.position(),f=h.position(),g=e.pstyle("target-arrow-shape").value,v=e.pstyle("source-arrow-shape").value,y=e.pstyle("target-distance-from-node").pfValue,m=e.pstyle("source-distance-from-node").pfValue,b=d._private.rscratch,w=h._private.rscratch,k=e.pstyle("curve-style").value,E=e._private.rscratch,x=E.edgeType,C=zt(k,"taxi"),S=x==="self"||x==="compound",T=x==="bezier"||x==="multibezier"||S,D=x!=="bezier",A=x==="straight"||x==="segments",B=x==="segments",M=T||D||A,L=S||C,I=e.pstyle("source-endpoint"),_=L?"outside-to-node":I.value,R=d.pstyle("corner-radius").value==="auto"?"auto":d.pstyle("corner-radius").pfValue,F=e.pstyle("target-endpoint"),z=L?"outside-to-node":F.value,Y=h.pstyle("corner-radius").value==="auto"?"auto":h.pstyle("corner-radius").pfValue;E.srcManEndpt=I,E.tgtManEndpt=F;var W=(t=(F==null||(n=F.pfValue)===null||n===void 0?void 0:n.length)===2?F.pfValue:null)!==null&&t!==void 0?t:[0,0],Z=(r=(I==null||(a=I.pfValue)===null||a===void 0?void 0:a.length)===2?I.pfValue:null)!==null&&r!==void 0?r:[0,0];if(T){var G=[E.ctrlpts[0],E.ctrlpts[1]];o=D?[E.ctrlpts[E.ctrlpts.length-2],E.ctrlpts[E.ctrlpts.length-1]]:G,s=G}else if(A){var $=B?E.segpts.slice(0,2):[f.x+W[0],f.y+W[1]];o=B?E.segpts.slice(E.segpts.length-2):[p.x+Z[0],p.y+Z[1]],s=$}if(z==="inside-to-node")i=[f.x,f.y];else if(F.units)i=this.manualEndptToPx(h,F);else if(z==="outside-to-line")i=E.tgtIntn;else if(z==="outside-to-node"||z==="outside-to-node-or-label"?l=o:z!=="outside-to-line"&&z!=="outside-to-line-or-label"||(l=[p.x,p.y]),i=c.nodeShapes[this.getNodeShape(h)].intersectLine(f.x,f.y,h.outerWidth(),h.outerHeight(),l[0],l[1],0,Y,w),z==="outside-to-node-or-label"||z==="outside-to-line-or-label"){var V=h._private.rscratch,O=V.labelWidth,q=V.labelHeight,Q=V.labelX,ee=V.labelY,oe=O/2,ce=q/2,ve=h.pstyle("text-valign").value;ve==="top"?ee-=ce:ve==="bottom"&&(ee+=ce);var he=h.pstyle("text-halign").value;he==="left"?Q-=oe:he==="right"&&(Q+=oe);var ne=Jn(l[0],l[1],[Q-oe,ee-ce,Q+oe,ee-ce,Q+oe,ee+ce,Q-oe,ee+ce],f.x,f.y);if(ne.length>0){var se=p,le=tn(se,yn(i)),de=tn(se,yn(ne)),P=le;de<le&&(i=ne,P=de),ne.length>2&&tn(se,{x:ne[2],y:ne[3]})<P&&(i=[ne[2],ne[3]])}}var N=Mr(i,o,c.arrowShapes[g].spacing(e)+y),X=Mr(i,o,c.arrowShapes[g].gap(e)+y);if(E.endX=X[0],E.endY=X[1],E.arrowEndX=N[0],E.arrowEndY=N[1],_==="inside-to-node")i=[p.x,p.y];else if(I.units)i=this.manualEndptToPx(d,I);else if(_==="outside-to-line")i=E.srcIntn;else if(_==="outside-to-node"||_==="outside-to-node-or-label"?u=s:_!=="outside-to-line"&&_!=="outside-to-line-or-label"||(u=[f.x,f.y]),i=c.nodeShapes[this.getNodeShape(d)].intersectLine(p.x,p.y,d.outerWidth(),d.outerHeight(),u[0],u[1],0,R,b),_==="outside-to-node-or-label"||_==="outside-to-line-or-label"){var H=d._private.rscratch,K=H.labelWidth,j=H.labelHeight,U=H.labelX,J=H.labelY,re=K/2,te=j/2,ye=d.pstyle("text-valign").value;ye==="top"?J-=te:ye==="bottom"&&(J+=te);var ue=d.pstyle("text-halign").value;ue==="left"?U-=re:ue==="right"&&(U+=re);var ae=Jn(u[0],u[1],[U-re,J-te,U+re,J-te,U+re,J+te,U-re,J+te],p.x,p.y);if(ae.length>0){var ge=f,be=tn(ge,yn(i)),Pe=tn(ge,yn(ae)),Ae=be;Pe<be&&(i=[ae[0],ae[1]],Ae=Pe),ae.length>2&&tn(ge,{x:ae[2],y:ae[3]})<Ae&&(i=[ae[2],ae[3]])}}var ze=Mr(i,s,c.arrowShapes[v].spacing(e)+m),Re=Mr(i,s,c.arrowShapes[v].gap(e)+m);E.startX=Re[0],E.startY=Re[1],E.arrowStartX=ze[0],E.arrowStartY=ze[1],M&&(ie(E.startX)&&ie(E.startY)&&ie(E.endX)&&ie(E.endY)?E.badLine=!1:E.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),t.edgeType==="haystack"?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),t.edgeType==="haystack"?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}}},Xi={};function np(e,t,n){for(var r=function(s,l,u,c){return We(s,l,u,c)},a=t._private.rstyle.bezierPts,i=0;i<e.bezierProjPcts.length;i++){var o=e.bezierProjPcts[i];a.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Xi.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)np(this,e,n.allpts.slice(a,a+6))}else if(r==="segments"){var i=t.rstyle.linePts=[];for(a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]})}else if(r==="haystack"){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},Xi.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var It={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!Lt(t)){var n,r,a=e._private,i=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=a.rscratch,h=a.rstyle;switch(u){case"left":n=l.x-i/2-s;break;case"right":n=l.x+i/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}d.labelX=n,d.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},Ec=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n*=-1),n},kc=function(e,t){var n=t.x-e.x,r=t.y-e.y;return Ec(n,r)};It.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:r.midX,y:r.midY};var o=function(c,d,h){Bt(n.rscratch,c,d,h),Bt(n.rstyle,c,d,h)};o("labelX",null,t.x),o("labelY",null,t.y);var s=Ec(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function(){if(l.cache)return l.cache;for(var c=[],d=0;d+5<r.allpts.length;d+=4){var h={x:r.allpts[d],y:r.allpts[d+1]},p={x:r.allpts[d+2],y:r.allpts[d+3]},f={x:r.allpts[d+4],y:r.allpts[d+5]};c.push({p0:h,p1:p,p2:f,startDist:0,length:0,segments:[]})}var g=n.rstyle.bezierPts,v=a.bezierProjPcts.length;function y(E,x,C,S,T){var D=en(x,C),A=E.segments[E.segments.length-1],B={p0:x,p1:C,t0:S,t1:T,startDist:A?A.startDist+A.length:0,length:D};E.segments.push(B),E.length+=D}for(var m=0;m<c.length;m++){var b=c[m],w=c[m-1];w&&(b.startDist=w.startDist+w.length),y(b,b.p0,g[m*v],0,a.bezierProjPcts[0]);for(var k=0;k<v-1;k++)y(b,g[m*v+k],g[m*v+k+1],a.bezierProjPcts[k],a.bezierProjPcts[k+1]);y(b,g[m*v+v-1],b.p2,a.bezierProjPcts[v-1],1)}return l.cache=c},u=function(c){var d,h=c==="source";if(i[c]){var p=e.pstyle(c+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var f,g=l(),v=0,y=0,m=0;m<g.length;m++){for(var b=g[h?m:g.length-1-m],w=0;w<b.segments.length;w++){var k=b.segments[h?w:b.segments.length-1-w],E=m===g.length-1&&w===b.segments.length-1;if(v=y,(y+=k.length)>=p||E){f={cp:b,segment:k};break}}if(f)break}var x=f.cp,C=f.segment,S=(p-v)/C.length,T=C.t1-C.t0,D=h?C.t0+T*S:C.t1-T*S;D=$n(0,D,1),t=mn(x.p0,x.p1,x.p2,D),d=function(z,Y,W,Z){var G=$n(0,Z-.001,1),$=$n(0,Z+.001,1),V=mn(z,Y,W,G),O=mn(z,Y,W,$);return kc(V,O)}(x.p0,x.p1,x.p2,D);break;case"straight":case"segments":case"haystack":for(var A,B,M,L,I=0,_=r.allpts.length,R=0;R+3<_&&(h?(M={x:r.allpts[R],y:r.allpts[R+1]},L={x:r.allpts[R+2],y:r.allpts[R+3]}):(M={x:r.allpts[_-2-R],y:r.allpts[_-1-R]},L={x:r.allpts[_-4-R],y:r.allpts[_-3-R]}),B=I,!((I+=A=en(M,L))>=p));R+=2);var F=(p-B)/A;F=$n(0,F,1),t=function(z,Y,W,Z){var G=Y.x-z.x,$=Y.y-z.y,V=en(z,Y),O=G/V,q=$/V;return W=W??0,Z=Z??W*V,{x:z.x+O*Z,y:z.y+q*Z}}(M,L,F),d=kc(M,L)}o("labelX",c,t.x),o("labelY",c,t.y),o("labelAutoAngle",c,d)}};u("source"),u("target"),this.applyLabelDimensions(e)}},It.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},It.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=Jt(r,e._private.labelDimsKey);if(ot(n.rscratch,"prefixedLabelDimsKey",t)!==a){Bt(n.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=ot(n.rscratch,"labelWrapCachedLines",t)||[],u=s!=="wrap"?1:Math.max(l.length,1),c=i.height/u,d=c*o,h=i.width,p=i.height+(u-1)*(o-1)*c;Bt(n.rstyle,"labelWidth",t,h),Bt(n.rscratch,"labelWidth",t,h),Bt(n.rstyle,"labelHeight",t,p),Bt(n.rscratch,"labelHeight",t,p),Bt(n.rscratch,"labelLineHeight",t,d)}},It.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,o=function(M,L){return L?(Bt(n.rscratch,M,t,L),L):ot(n.rscratch,M,t)};if(!a)return"";i=="none"||(i=="uppercase"?a=a.toUpperCase():i=="lowercase"&&(a=a.toLowerCase()));var s=e.pstyle("text-wrap").value;if(s==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=a.split(`
|
9
|
+
`),c=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value==="anywhere",h=[],p=/[\s\u200b]+|$/g,f=0;f<u.length;f++){var g=u[f],v=this.calculateLabelDimensions(e,g).width;if(d){var y=g.split("").join("\u200B");g=y}if(v>c){var m,b="",w=0,k=it(g.matchAll(p));try{for(k.s();!(m=k.n()).done;){var E=m.value,x=E[0],C=g.substring(w,E.index);w=E.index+x.length;var S=b.length===0?C:b+C+x;this.calculateLabelDimensions(e,S).width<=c?b+=C+x:(b&&h.push(b),b=C+x)}}catch(M){k.e(M)}finally{k.f()}b.match(/^[\s\u200b]+$/)||h.push(b)}else h.push(g)}o("labelWrapCachedLines",h),a=o("labelWrapCachedText",h.join(`
|
10
|
+
`)),o("labelWrapKey",l)}else if(s==="ellipsis"){var T=e.pstyle("text-max-width").pfValue,D="",A=!1;if(this.calculateLabelDimensions(e,a).width<T)return a;for(var B=0;B<a.length&&!(this.calculateLabelDimensions(e,D+a[B]+"\u2026").width>T);B++)D+=a[B],B===a.length-1&&(A=!0);return A||(D+="\u2026"),D}return a},It.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t!=="auto")return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},It.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=n.createElement("canvas"),l=this.labelCalcCanvasContext=s.getContext("2d");var u=s.style;u.position="absolute",u.left="-9999px",u.top="-9999px",u.zIndex="-1",u.visibility="hidden",u.pointerEvents="none"}l.font="".concat(r," ").concat(o," ").concat(a,"px ").concat(i);for(var c=0,d=0,h=t.split(`
|
11
|
+
`),p=0;p<h.length;p++){var f=h[p],g=l.measureText(f),v=Math.ceil(g.width),y=a;c=Math.max(v,c),d+=y}return{width:c+=0,height:d+=0}},It.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),a=t?t+"-":"",i=e.pstyle(a+"text-rotation"),o=i.strValue;return o==="none"?0:r&&o==="autorotate"?n.labelAutoAngle:o==="autorotate"?0:i.pfValue},It.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var Tc={},Cc=!1;Tc.getNodeShape=function(e){var t=e.pstyle("shape").value;if(t==="cutrectangle"&&(e.width()<28||e.height()<28))return Cc||(ke("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Cc=!0),"rectangle";if(e.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var rp={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(i){var o=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];if(t.merge(i),o)for(var s=0;s<i.length;s++){var l=i[s]._private.rstyle;l.clean=!1,l.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(i){var o=i.target;r(o)}).on("style.* background.*",function(i){var o=i.target;r(o,!1)});var a=function(i){if(i){var o=n.onUpdateEleCalcsFns;t.cleanStyle();for(var s=0;s<t.length;s++){var l=t[s],u=l._private.rstyle;l.isNode()&&!u.cleanConnected&&(r(l.connectedEdges()),u.cleanConnected=!0)}if(o)for(var c=0;c<o.length;c++)(0,o[c])(i,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=function(y){return y._private.rstyle.cleanConnected};if(e.length!==0){var r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var i=0;i<e.length;i++){var o=e[i],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(y){return!y._private.rstyle.clean&&y.isBundledBezier()})&&(l.clean=!1),t&&l.clean||o.removed()||o.pstyle("display").value!=="none"&&(s.group==="nodes"?a.push(o):r.push(o),l.clean=!0)}for(var u=0;u<a.length;u++){var c=a[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=r[p]._private,g=f.rstyle,v=f.rscratch;g.srcX=v.arrowStartX,g.srcY=v.arrowStartY,g.tgtX=v.arrowEndX,g.tgtY=v.arrowEndY,g.midX=v.midX,g.midY=v.midY,g.labelAngle=v.labelAngle,g.sourceLabelAngle=v.sourceLabelAngle,g.targetLabelAngle=v.targetLabelAngle}}}}},ap={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(a=e[n])._private.rscratch;a.grabbed()&&!a.isParent()?t.push(a):r.inDragLayer?e.drag.push(a):e.nondrag.push(a)}for(n=0;n<t.length;n++){var a=t[n];e.drag.push(a)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Ou),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},Pc={};[Qf,Li,et,tp,Xi,It,Tc,rp,ap].forEach(function(e){pe(Pc,e)});var ip={getCachedImage:function(e,t,n){var r=this.imageCache=this.imageCache||{},a=r[e];if(a)return a.image.complete||a.image.addEventListener("load",n),a.image;var i=(a=r[e]=r[e]||{}).image=new Image;i.addEventListener("load",n),i.addEventListener("error",function(){i.error=!0});var o="data:";return e.substring(0,5).toLowerCase()===o||(t=t==="null"?null:t,i.crossOrigin=t),i.src=e,i}},dr={registerBinding:function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var i=[],o=0;o<e.length;o++){var s=e[o];if(s!==void 0){var l=this.binder(s);i.push(l.on.apply(l,a))}}return i}return(l=this.binder(e)).on.apply(l,a)}};dr.binder=function(e){var t,n=this,r=n.cy.window(),a=e===r||e===r.document||e===r.document.body||(t=e,typeof HTMLElement<"u"&&t instanceof HTMLElement);if(n.supportsPassiveEvents==null){var i=!1;try{var o=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});r.addEventListener("test",null,o)}catch{}n.supportsPassiveEvents=i}var s=function(l,u,c){var d=Array.prototype.slice.call(arguments);return a&&n.supportsPassiveEvents&&(d[2]={capture:c!=null&&c,passive:!1,once:!1}),n.bindings.push({target:e,args:d}),(e.addEventListener||e.on).apply(e,d),this};return{on:s,addEventListener:s,addListener:s,bind:s}},dr.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},dr.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},dr.load=function(){var e=this,t=e.cy.window(),n=function(P){return P.selected()},r=function(P,N,X,H){P==null&&(P=e.cy);for(var K=0;K<N.length;K++){var j=N[K];P.emit({originalEvent:X,type:j,position:H})}},a=function(P){return P.shiftKey||P.metaKey||P.ctrlKey},i=function(P,N){var X=!0;if(e.cy.hasCompoundNodes()&&P&&P.pannable()){for(var H=0;N&&H<N.length;H++)if((P=N[H]).isNode()&&P.isParent()&&!P.pannable()){X=!1;break}}else X=!0;return X},o=function(P){P[0]._private.rscratch.inDragLayer=!0},s=function(P){P[0]._private.rscratch.isGrabTarget=!0},l=function(P,N){var X=N.addToList;X.has(P)||!P.grabbable()||P.locked()||(X.merge(P),function(H){H[0]._private.grabbed=!0}(P))},u=function(P,N){N=N||{};var X=P.cy().hasCompoundNodes();N.inDragLayer&&(P.forEach(o),P.neighborhood().stdFilter(function(H){return!X||H.isEdge()}).forEach(o)),N.addToList&&P.forEach(function(H){l(H,N)}),function(H,K){if(H.cy().hasCompoundNodes()&&(K.inDragLayer!=null||K.addToList!=null)){var j=H.descendants();K.inDragLayer&&(j.forEach(o),j.connectedEdges().forEach(o)),K.addToList&&l(j,K)}}(P,N),h(P,{inDragLayer:N.inDragLayer}),e.updateCachedGrabbedEles()},c=u,d=function(P){P&&(e.getCachedZSortedEles().forEach(function(N){(function(X){X[0]._private.grabbed=!1})(N),function(X){X[0]._private.rscratch.inDragLayer=!1}(N),function(X){X[0]._private.rscratch.isGrabTarget=!1}(N)}),e.updateCachedGrabbedEles())},h=function(P,N){if((N.inDragLayer!=null||N.addToList!=null)&&P.cy().hasCompoundNodes()){var X=P.ancestors().orphans();if(!X.same(P)){var H=X.descendants().spawnSelf().merge(X).unmerge(P).unmerge(P.descendants()),K=H.connectedEdges();N.inDragLayer&&(K.forEach(o),H.forEach(o)),N.addToList&&H.forEach(function(j){l(j,N)})}}},p=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},f=typeof MutationObserver<"u",g=typeof ResizeObserver<"u";f?(e.removeObserver=new MutationObserver(function(P){for(var N=0;N<P.length;N++){var X=P[N].removedNodes;if(X){for(var H=0;H<X.length;H++)if(X[H]===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(P){e.destroy()});var v=Hn(function(){e.cy.resize()},100);f&&(e.styleObserver=new MutationObserver(v),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",v),g&&(e.resizeObserver=new ResizeObserver(v),e.resizeObserver.observe(e.container));var y=function(){e.invalidateContainerClientCoordsCache()};(function(P,N){for(;P!=null;)N(P),P=P.parentNode})(e.container,function(P){e.registerBinding(P,"transitionend",y),e.registerBinding(P,"animationend",y),e.registerBinding(P,"scroll",y)}),e.registerBinding(e.container,"contextmenu",function(P){P.preventDefault()});var m=function(P){for(var N=e.findContainerClientCoords(),X=N[0],H=N[1],K=N[2],j=N[3],U=P.touches?P.touches:[P],J=!1,re=0;re<U.length;re++){var te=U[re];if(X<=te.clientX&&te.clientX<=X+K&&H<=te.clientY&&te.clientY<=H+j){J=!0;break}}if(!J)return!1;for(var ye=e.container,ue=P.target.parentNode,ae=!1;ue;){if(ue===ye){ae=!0;break}ue=ue.parentNode}return!!ae};e.registerBinding(e.container,"mousedown",function(P){if(m(P)&&(e.hoverData.which!==1||P.which===1)){P.preventDefault(),p(),e.hoverData.capture=!0,e.hoverData.which=P.which;var N=e.cy,X=[P.clientX,P.clientY],H=e.projectIntoViewport(X[0],X[1]),K=e.selection,j=e.findNearestElements(H[0],H[1],!0,!1),U=j[0],J=e.dragData.possibleDragElements;e.hoverData.mdownPos=H,e.hoverData.mdownGPos=X;var re=function(ue){return{originalEvent:P,type:ue,position:{x:H[0],y:H[1]}}};if(P.which==3){e.hoverData.cxtStarted=!0;var te={originalEvent:P,type:"cxttapstart",position:{x:H[0],y:H[1]}};U?(U.activate(),U.emit(te),e.hoverData.down=U):N.emit(te),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(P.which==1){if(U&&U.activate(),U!=null&&e.nodeIsGrabbable(U)){if(s(U),U.selected()){J=e.dragData.possibleDragElements=N.collection();var ye=N.$(function(ue){return ue.isNode()&&ue.selected()&&e.nodeIsGrabbable(ue)});u(ye,{addToList:J}),U.emit(re("grabon")),ye.forEach(function(ue){ue.emit(re("grab"))})}else J=e.dragData.possibleDragElements=N.collection(),c(U,{addToList:J}),U.emit(re("grabon")).emit(re("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=U,e.hoverData.downs=j,e.hoverData.downTime=new Date().getTime(),r(U,["mousedown","tapstart","vmousedown"],P,{x:H[0],y:H[1]}),U==null?(K[4]=1,e.data.bgActivePosistion={x:H[0],y:H[1]},e.redrawHint("select",!0),e.redraw()):U.pannable()&&(K[4]=1),e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var ue=e.hoverData.down;ue?ue.emit(re("taphold")):N.emit(re("taphold"))}},e.tapholdDuration)}K[0]=K[2]=H[0],K[1]=K[3]=H[1]}},!1);var b,w,k,E=function(P){var N=P.getRootNode();if(N&&N.nodeType===11&&N.host!==void 0)return N}(e.container);e.registerBinding([t,E],"mousemove",function(P){if(e.hoverData.capture||m(P)){var N=!1,X=e.cy,H=X.zoom(),K=[P.clientX,P.clientY],j=e.projectIntoViewport(K[0],K[1]),U=e.hoverData.mdownPos,J=e.hoverData.mdownGPos,re=e.selection,te=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(te=e.findNearestElement(j[0],j[1],!0,!1));var ye,ue=e.hoverData.last,ae=e.hoverData.down,ge=[j[0]-re[2],j[1]-re[3]],be=e.dragData.possibleDragElements;if(J){var Pe=K[0]-J[0],Ae=Pe*Pe,ze=K[1]-J[1],Re=Ae+ze*ze;e.hoverData.isOverThresholdDrag=ye=Re>=e.desktopTapThreshold2}var tt=a(P);ye&&(e.hoverData.tapholdCancelled=!0),N=!0,r(te,["mousemove","vmousemove","tapdrag"],P,{x:j[0],y:j[1]});var _e=function(vt){return{originalEvent:P,type:vt,position:{x:j[0],y:j[1]}}},gt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||X.emit(_e("boxstart")),re[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(ye){var Oe=_e("cxtdrag");ae?ae.emit(Oe):X.emit(Oe),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&te===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(_e("cxtdragout")),e.hoverData.cxtOver=te,te&&te.emit(_e("cxtdragover")))}}else if(e.hoverData.dragging){if(N=!0,X.panningEnabled()&&X.userPanningEnabled()){var Ve;if(e.hoverData.justStartedPan){var Ct=e.hoverData.mdownPos;Ve={x:(j[0]-Ct[0])*H,y:(j[1]-Ct[1])*H},e.hoverData.justStartedPan=!1}else Ve={x:ge[0]*H,y:ge[1]*H};X.panBy(Ve),X.emit(_e("dragpan")),e.hoverData.dragged=!0}j=e.projectIntoViewport(P.clientX,P.clientY)}else if(re[4]!=1||ae!=null&&!ae.pannable()){if(ae&&ae.pannable()&&ae.active()&&ae.unactivate(),ae&&ae.grabbed()||te==ue||(ue&&r(ue,["mouseout","tapdragout"],P,{x:j[0],y:j[1]}),te&&r(te,["mouseover","tapdragover"],P,{x:j[0],y:j[1]}),e.hoverData.last=te),ae)if(ye){if(X.boxSelectionEnabled()&&tt)ae&&ae.grabbed()&&(d(be),ae.emit(_e("freeon")),be.emit(_e("free")),e.dragData.didDrag&&(ae.emit(_e("dragfreeon")),be.emit(_e("dragfree")))),gt();else if(ae&&ae.grabbed()&&e.nodeIsDraggable(ae)){var ut=!e.dragData.didDrag;ut&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(be,{inDragLayer:!0});var ct={x:0,y:0};if(ie(ge[0])&&ie(ge[1])&&(ct.x+=ge[0],ct.y+=ge[1],ut)){var dt=e.hoverData.dragDelta;dt&&ie(dt[0])&&ie(dt[1])&&(ct.x+=dt[0],ct.y+=dt[1])}e.hoverData.draggingEles=!0,be.silentShift(ct).emit(_e("position")).emit(_e("drag")),e.redrawHint("drag",!0),e.redraw()}}else(function(){var vt=e.hoverData.dragDelta=e.hoverData.dragDelta||[];vt.length===0?(vt.push(ge[0]),vt.push(ge[1])):(vt[0]+=ge[0],vt[1]+=ge[1])})();N=!0}else ye&&(e.hoverData.dragging||!X.boxSelectionEnabled()||!tt&&X.panningEnabled()&&X.userPanningEnabled()?!e.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()&&i(ae,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,re[4]=0,e.data.bgActivePosistion=yn(U),e.redrawHint("select",!0),e.redraw()):gt(),ae&&ae.pannable()&&ae.active()&&ae.unactivate());return re[2]=j[0],re[3]=j[1],N?(P.stopPropagation&&P.stopPropagation(),P.preventDefault&&P.preventDefault(),!1):void 0}},!1),e.registerBinding(t,"mouseup",function(P){if((e.hoverData.which!==1||P.which===1||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var N=e.cy,X=e.projectIntoViewport(P.clientX,P.clientY),H=e.selection,K=e.findNearestElement(X[0],X[1],!0,!1),j=e.dragData.possibleDragElements,U=e.hoverData.down,J=a(P);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,U&&U.unactivate();var re=function(be){return{originalEvent:P,type:be,position:{x:X[0],y:X[1]}}};if(e.hoverData.which===3){var te=re("cxttapend");if(U?U.emit(te):N.emit(te),!e.hoverData.cxtDragged){var ye=re("cxttap");U?U.emit(ye):N.emit(ye)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(K,["mouseup","tapend","vmouseup"],P,{x:X[0],y:X[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(U,["click","tap","vclick"],P,{x:X[0],y:X[1]}),w=!1,P.timeStamp-k<=N.multiClickDebounceTime()?(b&&clearTimeout(b),w=!0,k=null,r(U,["dblclick","dbltap","vdblclick"],P,{x:X[0],y:X[1]})):(b=setTimeout(function(){w||r(U,["oneclick","onetap","voneclick"],P,{x:X[0],y:X[1]})},N.multiClickDebounceTime()),k=P.timeStamp)),U!=null||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(P)||(N.$(n).unselect(["tapunselect"]),j.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=j=N.collection()),K!=U||e.dragData.didDrag||e.hoverData.selecting||K!=null&&K._private.selectable&&(e.hoverData.dragging||(N.selectionType()==="additive"||J?K.selected()?K.unselect(["tapunselect"]):K.select(["tapselect"]):J||(N.$(n).unmerge(K).unselect(["tapunselect"]),K.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var ue=N.collection(e.getAllInBox(H[0],H[1],H[2],H[3]));e.redrawHint("select",!0),ue.length>0&&e.redrawHint("eles",!0),N.emit(re("boxend"));var ae=function(be){return be.selectable()&&!be.selected()};N.selectionType()==="additive"||J||N.$(n).unmerge(ue).unselect(),ue.emit(re("box")).stdFilter(ae).select().emit(re("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!H[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ge=U&&U.grabbed();d(j),ge&&(U.emit(re("freeon")),j.emit(re("free")),e.dragData.didDrag&&(U.emit(re("dragfreeon")),j.emit(re("dragfree"))))}}H[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var x,C,S,T,D,A,B,M,L,I,_,R,F,z,Y=[],W=1e5,Z=function(P){var N=!1,X=P.deltaY;if(X==null&&(P.wheelDeltaY!=null?X=P.wheelDeltaY/4:P.wheelDelta!=null&&(X=P.wheelDelta/4)),x==null)if(Y.length>=4){var H=Y;if(x=function(ge,be){for(var Pe=0;Pe<ge.length;Pe++)if(ge[Pe]%be!==0)return!1;return!0}(H,5),!x){var K=Math.abs(H[0]);x=function(ge){for(var be=Math.abs(ge[0]),Pe=1;Pe<ge.length;Pe++)if(Math.abs(ge[Pe])!==be)return!1;return!0}(H)&&K>5}if(x)for(var j=0;j<H.length;j++)W=Math.min(Math.abs(H[j]),W)}else Y.push(X),N=!0;else x&&(W=Math.min(Math.abs(X),W));if(!e.scrollingPage){var U=e.cy,J=U.zoom(),re=U.pan(),te=e.projectIntoViewport(P.clientX,P.clientY),ye=[te[0]*J+re.x,te[1]*J+re.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||e.selection[4]!==0)P.preventDefault();else if(U.panningEnabled()&&U.userPanningEnabled()&&U.zoomingEnabled()&&U.userZoomingEnabled()){var ue;P.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150),N&&Math.abs(X)>5&&(X=5*Aa(X)),ue=X/-250,x&&(ue/=W,ue*=3),ue*=e.wheelSensitivity,P.deltaMode===1&&(ue*=33);var ae=U.zoom()*Math.pow(10,ue);P.type==="gesturechange"&&(ae=e.gestureStartZoom*P.scale),U.zoom({level:ae,renderedPosition:{x:ye[0],y:ye[1]}}),U.emit({type:P.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:P,position:{x:te[0],y:te[1]}})}}};e.registerBinding(e.container,"wheel",Z,!0),e.registerBinding(t,"scroll",function(P){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(P){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||P.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(P){e.hasTouchStarted||Z(P)},!0),e.registerBinding(e.container,"mouseout",function(P){var N=e.projectIntoViewport(P.clientX,P.clientY);e.cy.emit({originalEvent:P,type:"mouseout",position:{x:N[0],y:N[1]}})},!1),e.registerBinding(e.container,"mouseover",function(P){var N=e.projectIntoViewport(P.clientX,P.clientY);e.cy.emit({originalEvent:P,type:"mouseover",position:{x:N[0],y:N[1]}})},!1);var G,$,V,O,q,Q,ee,oe=function(P,N,X,H){return Math.sqrt((X-P)*(X-P)+(H-N)*(H-N))},ce=function(P,N,X,H){return(X-P)*(X-P)+(H-N)*(H-N)};if(e.registerBinding(e.container,"touchstart",G=function(P){if(e.hasTouchStarted=!0,m(P)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var N=e.cy,X=e.touchData.now,H=e.touchData.earlier;if(P.touches[0]){var K=e.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);X[0]=K[0],X[1]=K[1]}P.touches[1]&&(K=e.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY),X[2]=K[0],X[3]=K[1]),P.touches[2]&&(K=e.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY),X[4]=K[0],X[5]=K[1]);var j=function(Re){return{originalEvent:P,type:Re,position:{x:X[0],y:X[1]}}};if(P.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var U=e.findContainerClientCoords();I=U[0],_=U[1],R=U[2],F=U[3],C=P.touches[0].clientX-I,S=P.touches[0].clientY-_,T=P.touches[1].clientX-I,D=P.touches[1].clientY-_,z=0<=C&&C<=R&&0<=T&&T<=R&&0<=S&&S<=F&&0<=D&&D<=F;var J=N.pan(),re=N.zoom();if(A=oe(C,S,T,D),B=ce(C,S,T,D),L=[((M=[(C+T)/2,(S+D)/2])[0]-J.x)/re,(M[1]-J.y)/re],B<4e4&&!P.touches[2]){var te=e.findNearestElement(X[0],X[1],!0,!0),ye=e.findNearestElement(X[2],X[3],!0,!0);return te&&te.isNode()?(te.activate().emit(j("cxttapstart")),e.touchData.start=te):ye&&ye.isNode()?(ye.activate().emit(j("cxttapstart")),e.touchData.start=ye):N.emit(j("cxttapstart")),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(P.touches[2])N.boxSelectionEnabled()&&P.preventDefault();else if(!P.touches[1]){if(P.touches[0]){var ue=e.findNearestElements(X[0],X[1],!0,!0),ae=ue[0];if(ae!=null&&(ae.activate(),e.touchData.start=ae,e.touchData.starts=ue,e.nodeIsGrabbable(ae))){var ge=e.dragData.touchDragEles=N.collection(),be=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ae.selected()?(be=N.$(function(Re){return Re.selected()&&e.nodeIsGrabbable(Re)}),u(be,{addToList:ge})):c(ae,{addToList:ge}),s(ae),ae.emit(j("grabon")),be?be.forEach(function(Re){Re.emit(j("grab"))}):ae.emit(j("grab"))}r(ae,["touchstart","tapstart","vmousedown"],P,{x:X[0],y:X[1]}),ae==null&&(e.data.bgActivePosistion={x:K[0],y:K[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved!==!1||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],P,{x:X[0],y:X[1]})},e.tapholdDuration)}}if(P.touches.length>=1){for(var Pe=e.touchData.startPosition=[null,null,null,null,null,null],Ae=0;Ae<X.length;Ae++)Pe[Ae]=H[Ae]=X[Ae];var ze=P.touches[0];e.touchData.startGPosition=[ze.clientX,ze.clientY]}}},!1),e.registerBinding(t,"touchmove",$=function(P){var N=e.touchData.capture;if(N||m(P)){var X=e.selection,H=e.cy,K=e.touchData.now,j=e.touchData.earlier,U=H.zoom();if(P.touches[0]){var J=e.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);K[0]=J[0],K[1]=J[1]}P.touches[1]&&(J=e.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY),K[2]=J[0],K[3]=J[1]),P.touches[2]&&(J=e.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY),K[4]=J[0],K[5]=J[1]);var re,te=function(ud){return{originalEvent:P,type:ud,position:{x:K[0],y:K[1]}}},ye=e.touchData.startGPosition;if(N&&P.touches[0]&&ye){for(var ue=[],ae=0;ae<K.length;ae++)ue[ae]=K[ae]-j[ae];var ge=P.touches[0].clientX-ye[0],be=ge*ge,Pe=P.touches[0].clientY-ye[1];re=be+Pe*Pe>=e.touchTapThreshold2}if(N&&e.touchData.cxt){P.preventDefault();var Ae=P.touches[0].clientX-I,ze=P.touches[0].clientY-_,Re=P.touches[1].clientX-I,tt=P.touches[1].clientY-_,_e=ce(Ae,ze,Re,tt);if(_e/B>=2.25||_e>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var gt=te("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(gt),e.touchData.start=null):H.emit(gt)}}if(N&&e.touchData.cxt){gt=te("cxtdrag"),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(gt):H.emit(gt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Oe=e.findNearestElement(K[0],K[1],!0,!0);e.touchData.cxtOver&&Oe===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit(te("cxtdragout")),e.touchData.cxtOver=Oe,Oe&&Oe.emit(te("cxtdragover")))}else if(N&&P.touches[2]&&H.boxSelectionEnabled())P.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||H.emit(te("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,X[4]=1,X&&X.length!==0&&X[0]!==void 0?(X[2]=(K[0]+K[2]+K[4])/3,X[3]=(K[1]+K[3]+K[5])/3):(X[0]=(K[0]+K[2]+K[4])/3,X[1]=(K[1]+K[3]+K[5])/3,X[2]=(K[0]+K[2]+K[4])/3+1,X[3]=(K[1]+K[3]+K[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(N&&P.touches[1]&&!e.touchData.didSelect&&H.zoomingEnabled()&&H.panningEnabled()&&H.userZoomingEnabled()&&H.userPanningEnabled()){if(P.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),Pt=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var Ve=0;Ve<Pt.length;Ve++){var Ct=Pt[Ve]._private;Ct.grabbed=!1,Ct.rscratch.inDragLayer=!1}}var ut=e.touchData.start,ct=(Ae=P.touches[0].clientX-I,ze=P.touches[0].clientY-_,Re=P.touches[1].clientX-I,tt=P.touches[1].clientY-_,oe(Ae,ze,Re,tt)),dt=ct/A;if(z){var vt=(Ae-C+(Re-T))/2,sd=(ze-S+(tt-D))/2,Vn=H.zoom(),pa=Vn*dt,vr=H.pan(),to=L[0]*Vn+vr.x,no=L[1]*Vn+vr.y,ld={x:-pa/Vn*(to-vr.x-vt)+to,y:-pa/Vn*(no-vr.y-sd)+no};if(ut&&ut.active()){var Pt=e.dragData.touchDragEles;d(Pt),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ut.unactivate().emit(te("freeon")),Pt.emit(te("free")),e.dragData.didDrag&&(ut.emit(te("dragfreeon")),Pt.emit(te("dragfree")))}H.viewport({zoom:pa,pan:ld,cancelOnFailedZoom:!0}),H.emit(te("pinchzoom")),A=ct,C=Ae,S=ze,T=Re,D=tt,e.pinching=!0}P.touches[0]&&(J=e.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY),K[0]=J[0],K[1]=J[1]),P.touches[1]&&(J=e.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY),K[2]=J[0],K[3]=J[1]),P.touches[2]&&(J=e.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY),K[4]=J[0],K[5]=J[1])}else if(P.touches[0]&&!e.touchData.didSelect){var yt=e.touchData.start,ga=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(Oe=e.findNearestElement(K[0],K[1],!0,!0)),N&&yt!=null&&P.preventDefault(),N&&yt!=null&&e.nodeIsDraggable(yt))if(re){Pt=e.dragData.touchDragEles;var ro=!e.dragData.didDrag;ro&&u(Pt,{inDragLayer:!0}),e.dragData.didDrag=!0;var Fn={x:0,y:0};ie(ue[0])&&ie(ue[1])&&(Fn.x+=ue[0],Fn.y+=ue[1],ro&&(e.redrawHint("eles",!0),(wt=e.touchData.dragDelta)&&ie(wt[0])&&ie(wt[1])&&(Fn.x+=wt[0],Fn.y+=wt[1]))),e.hoverData.draggingEles=!0,Pt.silentShift(Fn).emit(te("position")).emit(te("drag")),e.redrawHint("drag",!0),e.touchData.startPosition[0]==j[0]&&e.touchData.startPosition[1]==j[1]&&e.redrawHint("eles",!0),e.redraw()}else{var wt;(wt=e.touchData.dragDelta=e.touchData.dragDelta||[]).length===0?(wt.push(ue[0]),wt.push(ue[1])):(wt[0]+=ue[0],wt[1]+=ue[1])}if(r(yt||Oe,["touchmove","tapdrag","vmousemove"],P,{x:K[0],y:K[1]}),yt&&yt.grabbed()||Oe==ga||(ga&&ga.emit(te("tapdragout")),Oe&&Oe.emit(te("tapdragover"))),e.touchData.last=Oe,N)for(Ve=0;Ve<K.length;Ve++)K[Ve]&&e.touchData.startPosition[Ve]&&re&&(e.touchData.singleTouchMoved=!0);N&&(yt==null||yt.pannable())&&H.panningEnabled()&&H.userPanningEnabled()&&(i(yt,e.touchData.starts)&&(P.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=yn(e.touchData.startPosition)),e.swipePanning?(H.panBy({x:ue[0]*U,y:ue[1]*U}),H.emit(te("dragpan"))):re&&(e.swipePanning=!0,H.panBy({x:ge*U,y:Pe*U}),H.emit(te("dragpan")),yt&&(yt.unactivate(),e.redrawHint("select",!0),e.touchData.start=null))),J=e.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY),K[0]=J[0],K[1]=J[1])}for(ae=0;ae<K.length;ae++)j[ae]=K[ae];N&&P.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(P){var N=e.touchData.start;e.touchData.capture=!1,N&&N.unactivate()}),e.registerBinding(t,"touchend",O=function(P){var N=e.touchData.start;if(e.touchData.capture){P.touches.length===0&&(e.touchData.capture=!1),P.preventDefault();var X=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var H=e.cy,K=H.zoom(),j=e.touchData.now,U=e.touchData.earlier;if(P.touches[0]){var J=e.projectIntoViewport(P.touches[0].clientX,P.touches[0].clientY);j[0]=J[0],j[1]=J[1]}P.touches[1]&&(J=e.projectIntoViewport(P.touches[1].clientX,P.touches[1].clientY),j[2]=J[0],j[3]=J[1]),P.touches[2]&&(J=e.projectIntoViewport(P.touches[2].clientX,P.touches[2].clientY),j[4]=J[0],j[5]=J[1]);var re,te=function(_e){return{originalEvent:P,type:_e,position:{x:j[0],y:j[1]}}};if(N&&N.unactivate(),e.touchData.cxt){if(re=te("cxttapend"),N?N.emit(re):H.emit(re),!e.touchData.cxtDragged){var ye=te("cxttap");N?N.emit(ye):H.emit(ye)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!P.touches[2]&&H.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var ue=H.collection(e.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,e.redrawHint("select",!0),H.emit(te("boxend")),ue.emit(te("box")).stdFilter(function(_e){return _e.selectable()&&!_e.selected()}).select().emit(te("boxselect")),ue.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(N!=null&&N.unactivate(),P.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!P.touches[1]){if(!P.touches[0]){if(!P.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ae=e.dragData.touchDragEles;if(N!=null){var ge=N._private.grabbed;d(ae),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ge&&(N.emit(te("freeon")),ae.emit(te("free")),e.dragData.didDrag&&(N.emit(te("dragfreeon")),ae.emit(te("dragfree")))),r(N,["touchend","tapend","vmouseup","tapdragout"],P,{x:j[0],y:j[1]}),N.unactivate(),e.touchData.start=null}else{var be=e.findNearestElement(j[0],j[1],!0,!0);r(be,["touchend","tapend","vmouseup","tapdragout"],P,{x:j[0],y:j[1]})}var Pe=e.touchData.startPosition[0]-j[0],Ae=Pe*Pe,ze=e.touchData.startPosition[1]-j[1],Re=(Ae+ze*ze)*K*K;e.touchData.singleTouchMoved||(N||H.$(":selected").unselect(["tapunselect"]),r(N,["tap","vclick"],P,{x:j[0],y:j[1]}),q=!1,P.timeStamp-ee<=H.multiClickDebounceTime()?(Q&&clearTimeout(Q),q=!0,ee=null,r(N,["dbltap","vdblclick"],P,{x:j[0],y:j[1]})):(Q=setTimeout(function(){q||r(N,["onetap","voneclick"],P,{x:j[0],y:j[1]})},H.multiClickDebounceTime()),ee=P.timeStamp)),N!=null&&!e.dragData.didDrag&&N._private.selectable&&Re<e.touchTapThreshold2&&!e.pinching&&(H.selectionType()==="single"?(H.$(n).unmerge(N).unselect(["tapunselect"]),N.select(["tapselect"])):N.selected()?N.unselect(["tapunselect"]):N.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}}}for(var tt=0;tt<j.length;tt++)U[tt]=j[tt];e.dragData.didDrag=!1,P.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),P.touches.length<2&&(P.touches.length===1&&(e.touchData.startGPosition=[P.touches[0].clientX,P.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),typeof TouchEvent>"u"){var ve=[],he=function(P){return{clientX:P.clientX,clientY:P.clientY,force:1,identifier:P.pointerId,pageX:P.pageX,pageY:P.pageY,radiusX:P.width/2,radiusY:P.height/2,screenX:P.screenX,screenY:P.screenY,target:P.target}},ne=function(P){ve.push(function(N){return{event:N,touch:he(N)}}(P))},se=function(P){for(var N=0;N<ve.length;N++)if(ve[N].event.pointerId===P.pointerId)return void ve.splice(N,1)},le=function(P){P.touches=ve.map(function(N){return N.touch})},de=function(P){return P.pointerType==="mouse"||P.pointerType===4};e.registerBinding(e.container,"pointerdown",function(P){de(P)||(P.preventDefault(),ne(P),le(P),G(P))}),e.registerBinding(e.container,"pointerup",function(P){de(P)||(se(P),le(P),O(P))}),e.registerBinding(e.container,"pointercancel",function(P){de(P)||(se(P),le(P),V())}),e.registerBinding(e.container,"pointermove",function(P){de(P)||(P.preventDefault(),function(N){var X=ve.filter(function(H){return H.event.pointerId===N.pointerId})[0];X.event=N,X.touch=he(N)}(P),le(P),$(P))})}};var Zt={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(n,r,a,i,o,s){this.renderer.nodeShapeImpl("polygon",n,r,a,i,o,this.points)},intersectLine:function(n,r,a,i,o,s,l,u){return Jn(o,s,this.points,n,r,a/2,i/2,l)},checkPoint:function(n,r,a,i,o,s,l,u){return Dt(n,r,this.points,s,l,i,o,[0,-1],a)},hasMiterBounds:e!=="rectangle",miterBounds:function(n,r,a,i,o,s){return Wd(this.points,n,r,a,i,o)}}}};Zt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o,s){return function(l,u,c,d,h,p){var f=c-l,g=d-u;f/=h,g/=p;var v=Math.sqrt(f*f+g*g),y=v-1;if(y<0)return[];var m=y/v;return[(c-l)*m+l,(d-u)*m+u]}(a,i,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,a,i,o,s){return nn(e,t,r,a,i,o,n)}}},Zt.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(n,r,a,i,o,s,l){if(s[l]!==void 0&&s[l+"-cx"]===n&&s[l+"-cy"]===r)return s[l];s[l]=new Array(t.length/2),s[l+"-cx"]=n,s[l+"-cy"]=r;var u=a/2,c=i/2;o=o==="auto"?us(a,i):o;for(var d=new Array(t.length/2),h=0;h<t.length/2;h++)d[h]={x:n+u*t[2*h],y:r+c*t[2*h+1]};var p,f,g,v,y=d.length;for(f=d[y-1],p=0;p<y;p++)g=d[p%y],v=d[(p+1)%y],s[l][p]=qi(f,g,v,o),f=g,g=v;return s[l]},draw:function(n,r,a,i,o,s,l){this.renderer.nodeShapeImpl("round-polygon",n,r,a,i,o,this.points,this.getOrCreateCorners(r,a,i,o,s,l,"drawCorners"))},intersectLine:function(n,r,a,i,o,s,l,u,c){return function(d,h,p,f,g,v,y,m,b){var w,k=[],E=new Array(2*p.length);b.forEach(function(A,B){B===0?(E[E.length-2]=A.startX,E[E.length-1]=A.startY):(E[4*B-2]=A.startX,E[4*B-1]=A.startY),E[4*B]=A.stopX,E[4*B+1]=A.stopY,(w=Qn(d,h,f,g,A.cx,A.cy,A.radius)).length!==0&&k.push(w[0],w[1])});for(var x=0;x<E.length/4;x++)(w=Ft(d,h,f,g,E[4*x],E[4*x+1],E[4*x+2],E[4*x+3],!1)).length!==0&&k.push(w[0],w[1]);if(k.length>2){for(var C=[k[0],k[1]],S=Math.pow(C[0]-d,2)+Math.pow(C[1]-h,2),T=1;T<k.length/2;T++){var D=Math.pow(k[2*T]-d,2)+Math.pow(k[2*T+1]-h,2);D<=S&&(C[0]=k[2*T],C[1]=k[2*T+1],S=D)}return C}return k}(o,s,this.points,n,r,0,0,0,this.getOrCreateCorners(n,r,a,i,u,c,"corners"))},checkPoint:function(n,r,a,i,o,s,l,u,c){return function(d,h,p,f,g,v,y,m){for(var b=new Array(2*p.length),w=0;w<m.length;w++){var k=m[w];if(b[4*w+0]=k.startX,b[4*w+1]=k.startY,b[4*w+2]=k.stopX,b[4*w+3]=k.stopY,Math.pow(k.cx-d,2)+Math.pow(k.cy-h,2)<=Math.pow(k.radius,2))return!0}return st(d,h,b)}(n,r,this.points,0,0,0,0,this.getOrCreateCorners(s,l,i,o,u,c,"corners"))}}},Zt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:rt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,o,s){return ss(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var l=r/2,u=a/2;s=s==="auto"?qt(r,a):s;var c=2*(s=Math.min(l,u,s));return!!Dt(e,t,this.points,i,o,r,a-c,[0,-1],n)||!!Dt(e,t,this.points,i,o,r-c,a,[0,-1],n)||!!nn(e,t,c,c,i-l+s,o-u+s,n)||!!nn(e,t,c,c,i+l-s,o-u+s,n)||!!nn(e,t,c,c,i+l-s,o+u-s,n)||!!nn(e,t,c,c,i-l+s,o+u-s,n)}}},Zt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:rt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,null,i)},generateCutTrianglePts:function(e,t,n,r,a){var i=a==="auto"?this.cornerLength:a,o=t/2,s=e/2,l=n-s,u=n+s,c=r-o,d=r+o;return{topLeft:[l,c+i,l+i,c,l+i,c+i],topRight:[u-i,c,u,c+i,u-i,c+i],bottomRight:[u,d-i,u-i,d,u-i,d-i],bottomLeft:[l+i,d,l,d-i,l+i,d-i]}},intersectLine:function(e,t,n,r,a,i,o,s){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s),u=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Jn(a,i,u,e,t)},checkPoint:function(e,t,n,r,a,i,o,s){var l=s==="auto"?this.cornerLength:s;if(Dt(e,t,this.points,i,o,r,a-2*l,[0,-1],n)||Dt(e,t,this.points,i,o,r-2*l,a,[0,-1],n))return!0;var u=this.generateCutTrianglePts(r,a,i,o);return st(e,t,u.topLeft)||st(e,t,u.topRight)||st(e,t,u.bottomRight)||st(e,t,u.bottomLeft)}}},Zt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:rt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o,s){var l=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),u=function(d){var h=mn({x:d[0],y:d[1]},{x:d[2],y:d[3]},{x:d[4],y:d[5]},.15),p=mn({x:d[0],y:d[1]},{x:d[2],y:d[3]},{x:d[4],y:d[5]},.5),f=mn({x:d[0],y:d[1]},{x:d[2],y:d[3]},{x:d[4],y:d[5]},.85);return[d[0],d[1],h.x,h.y,p.x,p.y,f.x,f.y,d[4],d[5]]},c=[].concat(u(l.topLeft),u(l.topRight),u(l.bottomRight),u(l.bottomLeft));return Jn(a,i,c,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,i=e/2,o=n-i,s=n+i,l=r-a,u=r+a,c=Ra(e,t),d=c.heightOffset,h=c.widthOffset,p=c.ctrlPtOffsetPct*e,f={topLeft:[o,l+d,o+p,l,o+h,l],topRight:[s-h,l,s-p,l,s,l+d],bottomRight:[s,u-d,s-p,u,s-h,u],bottomLeft:[o+h,u,o+p,u,o,u-d]};return f.topLeft.isTop=!0,f.topRight.isTop=!0,f.bottomLeft.isBottom=!0,f.bottomRight.isBottom=!0,f},checkPoint:function(e,t,n,r,a,i,o,s){var l=Ra(r,a),u=l.heightOffset,c=l.widthOffset;if(Dt(e,t,this.points,i,o,r,a-2*u,[0,-1],n)||Dt(e,t,this.points,i,o,r-2*c,a,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,a,i,o),h=function(k,E,x){var C,S,T=x[4],D=x[2],A=x[0],B=x[5],M=x[1],L=Math.min(T,A),I=Math.max(T,A),_=Math.min(B,M),R=Math.max(B,M);if(L<=k&&k<=I&&_<=E&&E<=R){var F=[(C=T)-2*(S=D)+A,2*(S-C),C],z=function(Y,W,Z,G){var $=W*W-4*Y*(Z-=G);if($<0)return[];var V=Math.sqrt($),O=2*Y;return[(-W+V)/O,(-W-V)/O]}(F[0],F[1],F[2],k).filter(function(Y){return 0<=Y&&Y<=1});if(z.length>0)return z[0]}return null},p=Object.keys(d),f=0;f<p.length;f++){var g=d[p[f]],v=h(e,t,g);if(v!=null){var y=g[5],m=g[3],b=g[1],w=We(y,m,b,v);if(g.isTop&&w<=t||g.isBottom&&t<=w)return!0}}return!1}}},Zt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:rt(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,o,s){var l=t-(r/2+o),u=Ft(a,i,e,t,e-(n/2+o),l,e+(n/2+o),l,!1);return u.length>0?u:ss(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var l=2*(s=s==="auto"?qt(r,a):s);if(Dt(e,t,this.points,i,o,r,a-l,[0,-1],n)||Dt(e,t,this.points,i,o,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!st(e,t,[i-u,o-c,i-u,o,i+u,o,i+u,o-c])||!!nn(e,t,l,l,i+r/2-s,o+a/2-s,n)||!!nn(e,t,l,l,i-r/2+s,o+a/2-s,n)}}},Zt.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",rt(3,0)),this.generateRoundPolygon("round-triangle",rt(3,0)),this.generatePolygon("rectangle",rt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",rt(5,0)),this.generateRoundPolygon("round-pentagon",rt(5,0)),this.generatePolygon("hexagon",rt(6,0)),this.generateRoundPolygon("round-hexagon",rt(6,0)),this.generatePolygon("heptagon",rt(7,0)),this.generateRoundPolygon("round-heptagon",rt(7,0)),this.generatePolygon("octagon",rt(8,0)),this.generateRoundPolygon("round-octagon",rt(8,0));var r=new Array(20),a=Na(5,0),i=Na(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[2*s]*=o,i[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=a[2*s],r[4*s+1]=a[2*s+1],r[4*s+2]=i[2*s],r[4*s+3]=i[2*s+1];r=ls(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(u){var c,d="polygon-"+u.join("$");return(c=this[d])?c:t.generatePolygon(d,u)}};var Sc={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||Jo();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){t==null&&Ie("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}}},Bc=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};Sc.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){Bc(e,!0,r);var a=St();e.render(e.renderOptions);var i=e.lastDrawTime=St();e.averageRedrawTime===void 0&&(e.averageRedrawTime=i-a),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=i-a;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Bc(e,!1,r);e.skipFrame=!1,Er(n)}};Er(n)}};var _c=function(e){this.init(e)},Nn=_c.prototype;Nn.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Nn.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=a.getElementById(o)!=null;if(n.className.indexOf(s)<0&&(n.className=(n.className||"")+" "+s),!l){var u=a.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",i.insertBefore(u,i.children[0])}r.getComputedStyle(n).getPropertyValue("position")==="static"&&ke("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ie(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Nn.notify=function(e,t){var n=this,r=n.cy;this.destroyed||(e!=="init"?e!=="destroy"?((e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),e==="gc"&&n.redrawHint("gc",!0),e!=="load"&&e!=="resize"&&e!=="mount"||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},Nn.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{}},Nn.isHeadless=function(){return!1},[$f,Pc,ip,dr,Zt,Sc].forEach(function(e){pe(Nn,e)});var Yi=1e3/60,Dc=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Hn(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),a=e.priority||Ca;n.beforeRender(function(i,o){var s=St(),l=n.averageRedrawTime,u=n.lastRedrawTime,c=[],d=n.cy.extent(),h=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var p=St(),f=p-s,g=p-o;if(u<Yi){var v=Yi-(i?l:0);if(g>=e.deqFastCost*v)break}else if(i){if(f>=e.deqCost*u||f>=e.deqAvgCost*l)break}else if(g>=e.deqNoDrawCost*Yi)break;var y=e.deq(t,h,d);if(!(y.length>0))break;for(var m=0;m<y.length;m++)c.push(y[m])}c.length>0&&(e.onDeqd(t,c),!i&&e.shouldRedraw(t,c,h,d)&&r())},a(t))}}},op=function(){return Rt(function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tr;Nt(this,e),this.idsByKey=new _t,this.keyForId=new _t,this.cachesByLvl=new _t,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){e==null&&Ie("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new vn,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){e!=null&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){e!=null&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return e==null?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{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 _t,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),r=this.getCache(n,t);return r!=null&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,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){var n=this.getKey(e);this.deleteCache(n,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(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||this.getNumberOfIdsForKey(n)===0}}])}(),sp=7.99,Rn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},lp=Ke({getKey:null,doesEleInvalidateKey:Tr,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Uo,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),hr=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=lp(t);pe(n,r),n.lookup=new op(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},je=hr.prototype;je.reasons=Rn,je.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},je.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},je.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Zn(function(e,t){return t.reqs-e.reqs})},je.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},je.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(Da(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=i.getTextureQueue(p),v=g[g.length-2],y=function(){return i.recycleTexture(p,d)||i.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidth<d&&(v=y());for(var m,b=function(L){return L&&L.scaledLabelShown===h},w=a&&a===Rn.dequeue,k=a&&a===Rn.highQuality,E=a&&a===Rn.downscale,x=r+1;x<=3;x++){var C=l.get(e,x);if(C){m=C;break}}var S=m&&m.level===r+1?m:null,T=function(){v.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,v.usedWidth,0,d,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,d,p),b(S))T();else if(b(m)){if(!k)return i.queueElement(e,m.level-1),m;for(var D=m.level;D>r;D--)S=i.getElement(e,t,n,D,Rn.downscale);T()}else{var A;if(!w&&!k&&!E)for(var B=r-1;B>=-4;B--){var M=l.get(e,B);if(M){A=M;break}}if(b(A))return i.queueElement(e,r),A;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),i.checkTextureFullness(v),f},je.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},je.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var a=-4;a<=3;a++){var i=n.getForCachedKey(e,a);i&&r.push(i)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],l=s.texture;l.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(l)}t.removeFromQueue(e)}},je.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},je.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Vt(t,e):e.fullnessChecks++},je.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Vt(n,e),e.retired=!0;for(var a=e.eleCaches,i=0;i<a.length;i++){var o=a[i];r.deleteCache(o.key,o.level)}Pa(a),this.getRetiredTextureQueue(t).push(e)},je.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},je.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),a=0;a<r.length;a++){var i=r[a];if(i.width>=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,Pa(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),Vt(r,i),n.push(i),i}},je.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),i=r[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,n.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),r[a]=o}},je.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=i.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Rn.dequeue)}}return a},je.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];a!=null&&(a.eles.length===1?(a.reqs=Ta,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},je.onDequeue=function(e){this.onDequeues.push(e)},je.offDequeue=function(e){Vt(this.onDequeues,e)},je.setupDequeueing=Dc({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 a=0;a<t.length;a++)for(var i=t[a].eles,o=0;o<i.length;o++){var s=i[o].boundingBox();if(Ma(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Ac=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=St()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Hn(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(a,i){i-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new Zn(function(a,i){return i.reqs-a.reqs}),t.setupDequeueing()},$e=Ac.prototype,Mc=0,up=Math.pow(2,53)-1;$e.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),o={id:Mc=++Mc%up,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(n,n),s.translate(l,u),o},$e.getLayers=function(e,t,n){var r=this,a=r.renderer.cy.zoom(),i=r.firstGet;if(r.firstGet=!1,n==null){if((n=Math.ceil(Da(a*t)))<-4)n=-4;else if(a>=3.99||n>2)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(){var w=function(C){if(r.validateLayersElesOrdering(C,e),r.levelIsComplete(C,e))return s=l[C],!0},k=function(C){if(!s)for(var S=n+C;-4<=S&&S<=2&&!w(S);S+=C);};k(1),k(-1);for(var E=c.length-1;E>=0;E--){var x=c[E];x.invalid&&Vt(c,x)}})();var d=function(w){var k=(w=w||{}).after;(function(){if(!o){o=nt();for(var T=0;T<e.length;T++)qd(o,e[T].boundingBox())}})();var E=Math.ceil(o.w*u),x=Math.ceil(o.h*u);if(E>32767||x>32767||E*x>16e6)return null;var C=r.makeLayer(o,n);if(k!=null){var S=c.indexOf(k)+1;c.splice(S,0,C)}else(w.insert===void 0||w.insert)&&c.unshift(C);return C};if(r.skipping&&!i)return null;for(var h=null,p=e.length/1,f=!i,g=0;g<e.length;g++){var v=e[g],y=v._private.rscratch,m=y.imgLayerCaches=y.imgLayerCaches||{},b=m[n];if(b)h=b;else{if((!h||h.eles.length>=p||!Yd(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},$e.getEleLevelForLayerLevel=function(e,t){return e},$e.drawEleInLayer=function(e,t,n,r){var a=this.renderer,i=e.context,o=t.boundingBox();o.w!==0&&o.h!==0&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,n,!0),a.setImgSmoothing(i,!0))},$e.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,a=0;a<n.length;a++){var i=n[a];if(i.reqs>0||i.invalid)return!1;r+=i.eles.length}return r===t.length},$e.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,o=0;o<t.length;o++)if(a.eles[0]===t[o]){i=o;break}if(i<0)this.invalidateLayer(a);else{var s=i;for(o=0;o<a.eles.length;o++)if(a.eles[o]!==t[s+o]){this.invalidateLayer(a);break}}}},$e.updateElementsInLayers=function(e,t){for(var n=Xn(e[0]),r=0;r<e.length;r++)for(var a=n?null:e[r],i=n?e[r]:e[r].ele,o=i._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(a&&this.getEleLevelForLayerLevel(u.level)!==a.level||t(u,i,a))}},$e.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},$e.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=St(),e.length!==0&&t.haveLayers()&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},$e.invalidateLayer=function(e){if(this.lastInvalidationTime=St(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Vt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},$e.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(n,r,a){var i=n.replacement;if(i||((i=n.replacement=t.makeLayer(n.bb,n.level)).replaces=n,i.eles=n.eles),!i.reqs)for(var o=0;o<i.eles.length;o++)t.queueLayer(i,i.eles[o])})},$e.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},$e.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,a=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;r.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},$e.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<1&&n.size()!==0;){var i=n.peek();if(i.replacement)n.pop();else if(i.replaces&&i!==i.replaces.replacement)n.pop();else if(i.invalid)n.pop();else{var o=i.elesQueue.shift();o&&(t.drawEleInLayer(i,o,i.level,e),a++),r.length===0&&r.push(!0),i.elesQueue.length===0&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}}return r},$e.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 a=0;a<e.eles.length;a++){var i=e.eles[a]._private,o=i.imgLayerCaches=i.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},$e.requestRedraw=Hn(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),$e.setupDequeueing=Dc({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:Ca,shouldRedraw:Uo,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Ic,Nc={};function cp(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function dp(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];a===0&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function Rc(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var o=n,s=n[0];for(e.moveTo(s.x,s.y),a=1;a<o.length;a++)i=o[a],e.lineTo(i.x,i.y);e.closePath&&e.closePath()}function hp(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,2*Math.PI,!1);var i=t,o=i[0];e.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var l=i[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function fp(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}Nc.arrowShapeImpl=function(e){return(Ic||(Ic={polygon:cp,"triangle-backcurve":dp,"triangle-tee":Rc,"circle-triangle":hp,"triangle-cross":Rc,circle:fp}))[e]};var Ln={drawElement:function(e,t,n,r,a,i){t.isNode()?this.drawNode(e,t,n,r,a,i):this.drawEdge(e,t,n,r,a,i)},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,a,i,o,s){var l=this,u=n.getBoundingBox(t);if(u.w!==0&&u.h!==0){var c=n.getElement(t,u,r,a,i);if(c!=null){var d=s(l,t);if(d===0)return;var h,p,f,g,v,y,m=o(l,t),b=u.x1,w=u.y1,k=u.w,E=u.h;if(m!==0){var x=n.getRotationPoint(t);f=x.x,g=x.y,e.translate(f,g),e.rotate(m),(v=l.getImgSmoothing(e))||l.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);h=C.x,p=C.y}else h=b,p=w;d!==1&&(y=e.globalAlpha,e.globalAlpha=y*d),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,h,p,k,E),d!==1&&(e.globalAlpha=y),m!==0&&(e.rotate(-m),e.translate(-f,-g),v||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},pp=function(){return 0},gp=function(e,t){return e.getTextAngle(t,null)},vp=function(e,t){return e.getTextAngle(t,"source")},yp=function(e,t){return e.getTextAngle(t,"target")},mp=function(e,t){return t.effectiveOpacity()},ji=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Ln.drawCachedElement=function(e,t,n,r,a,i){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,d=s.tlbTxrCache,h=t.boundingBox(),p=i===!0?l.reasons.highQuality:null;if(h.w!==0&&h.h!==0&&t.visible()&&(!r||Ma(h,r))){var f=t.isEdge(),g=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,a,p,pp,mp),f&&g||o.drawCachedElementPortion(e,t,u,n,a,p,gp,ji),f&&!g&&(o.drawCachedElementPortion(e,t,c,n,a,p,vp,ji),o.drawCachedElementPortion(e,t,d,n,a,p,yp,ji)),o.drawElementOverlay(e,t)}},Ln.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},Ln.drawCachedElements=function(e,t,n,r){for(var a=0;a<t.length;a++){var i=t[a];this.drawCachedElement(e,i,n,r)}},Ln.drawCachedNodes=function(e,t,n,r){for(var a=0;a<t.length;a++){var i=t[a];i.isNode()&&this.drawCachedElement(e,i,n,r)}},Ln.drawLayeredElements=function(e,t,n,r){var a=this.data.lyrTxrCache.getLayers(t,n);if(a)for(var i=0;i<a.length;i++){var o=a[i],s=o.bb;s.w!==0&&s.h!==0&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var $t={drawEdge:function(e,t,n){var r=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],i=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&s.allpts!=null&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;d==="straight-triangle"?(o.eleStrokeStyle(e,t,S),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,S),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},w=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(e,t,S)};if(e.lineJoin="round",t.pstyle("ghost").value==="yes"){var k=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,C=y*x;e.translate(k,E),b(C),w(C),e.translate(-k,-E)}else(function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],S),d==="straight-triangle"?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"})();a&&o.drawEdgeUnderlay(e,t),b(),w(),a&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},Lc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,o.edgeType!=="self"||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};$t.drawEdgeOverlay=Lc("overlay"),$t.drawEdgeUnderlay=Lc("underlay"),$t.drawEdgePath=function(e,t,n,r){var a,i=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");i.pathCacheKey&&i.pathCacheKey===d?(a=t=i.pathCache,s=!0):(a=t=new Path2D,i.pathCacheKey=d,i.pathCache=a)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.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(i.isRound){var f,g=it(i.roundCorners);try{for(g.s();!(f=g.n()).done;)xc(t,f.value)}catch(y){g.e(y)}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=o,l?t.stroke(a):t.stroke(),t.setLineDash&&t.setLineDash([])},$t.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[a]-l[0],n[a+1]-l[1]),t.lineTo(n[a]+l[0],n[a+1]+l[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},$t.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},$t.drawArrowhead=function(e,t,n,r,a,i,o){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)){var s=this,l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var u=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,d=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),p=h.value==="match-line"?d:h.pfValue;h.units==="%"&&(p*=d);var f=t.pstyle("opacity").value;o===void 0&&(o=f);var g=e.globalCompositeOperation;o===1&&c!=="hollow"||(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,u,d,l,p,r,a,i),e.globalCompositeOperation=g);var v=t.pstyle(n+"-arrow-color").value;s.colorFillStyle(e,v[0],v[1],v[2],o),s.colorStrokeStyle(e,v[0],v[1],v[2],o),s.drawArrowShape(t,e,c,d,l,p,r,a,i)}}},$t.drawArrowShape=function(e,t,n,r,a,i,o,s,l){var u,c=this,d=this.usePaths()&&a!=="triangle-cross",h=!1,p=t,f={x:o,y:s},g=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,g),y=c.arrowShapes[a];if(d){var m=c.arrowPathCache=c.arrowPathCache||[],b=Jt(a),w=m[b];w!=null?(u=t=w,h=!0):(u=t=new Path2D,m[b]=u)}h||(t.beginPath&&t.beginPath(),d?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,l,f,r),t.closePath&&t.closePath()),t=p,d&&(t.translate(o,s),t.rotate(l),t.scale(v,v)),n!=="filled"&&n!=="both"||(d?t.fill(u):t.fill()),n!=="hollow"&&n!=="both"||(t.lineWidth=i/(d?v:1),t.lineJoin="miter",d?t.stroke(u):t.stroke()),d&&(t.scale(1/v,1/v),t.rotate(-l),t.translate(-o,-s))};var bp={safeDrawImage:function(e,t,n,r,a,i,o,s,l,u){if(!(a<=0||i<=0||l<=0||u<=0))try{e.drawImage(t,n,r,a,i,o,s,l,u)}catch(c){ke(c)}},drawInscribedImage:function(e,t,n,r,a){var i=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),d=c(n,"background-fit","value",r),h=c(n,"background-repeat","value",r),p=n.width(),f=n.height(),g=2*n.padding(),v=p+(c(n,"background-width-relative-to","value",r)==="inner"?0:g),y=f+(c(n,"background-height-relative-to","value",r)==="inner"?0:g),m=n._private.rscratch,b=c(n,"background-clip","value",r)==="node",w=c(n,"background-image-opacity","value",r)*a,k=c(n,"background-image-smoothing","value",r),E=n.pstyle("corner-radius").value;E!=="auto"&&(E=n.pstyle("corner-radius").pfValue);var x=t.width||t.cachedW,C=t.height||t.cachedH;x!=null&&C!=null||(document.body.appendChild(t),x=t.cachedW=t.width||t.offsetWidth,C=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var S=x,T=C;if(c(n,"background-width","value",r)!=="auto"&&(S=c(n,"background-width","units",r)==="%"?c(n,"background-width","pfValue",r)*v:c(n,"background-width","pfValue",r)),c(n,"background-height","value",r)!=="auto"&&(T=c(n,"background-height","units",r)==="%"?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),S!==0&&T!==0){if(d==="contain")S*=D=Math.min(v/S,y/T),T*=D;else if(d==="cover"){var D;S*=D=Math.max(v/S,y/T),T*=D}var A=s-v/2,B=c(n,"background-position-x","units",r),M=c(n,"background-position-x","pfValue",r);A+=B==="%"?(v-S)*M:M;var L=c(n,"background-offset-x","units",r),I=c(n,"background-offset-x","pfValue",r);A+=L==="%"?(v-S)*I:I;var _=l-y/2,R=c(n,"background-position-y","units",r),F=c(n,"background-position-y","pfValue",r);_+=R==="%"?(y-T)*F:F;var z=c(n,"background-offset-y","units",r),Y=c(n,"background-offset-y","pfValue",r);_+=z==="%"?(y-T)*Y:Y,m.pathCache&&(A-=s,_-=l,s=0,l=0);var W=e.globalAlpha;e.globalAlpha=w;var Z=i.getImgSmoothing(e),G=!1;if(k==="no"&&Z?(i.setImgSmoothing(e,!1),G=!0):k!=="yes"||Z||(i.setImgSmoothing(e,!0),G=!0),h==="no-repeat")b&&(e.save(),m.pathCache?e.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,s,l,v,y,E,m),e.clip())),i.safeDrawImage(e,t,0,0,x,C,A,_,S,T),b&&e.restore();else{var $=e.createPattern(t,h);e.fillStyle=$,i.nodeShapes[i.getNodeShape(n)].draw(e,s,l,v,y,E,m),e.translate(A,_),e.fill(),e.translate(-A,-_)}e.globalAlpha=W,G&&i.setImgSmoothing(e,Z)}}},un={};function Wi(e,t,n,r,a){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+r-i,n),e.quadraticCurveTo(t+r,n,t+r,n+i),e.lineTo(t+r,n+a-i),e.quadraticCurveTo(t+r,n+a,t+r-i,n+a),e.lineTo(t+i,n+a),e.quadraticCurveTo(t,n+a,t,n+a-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath(),o?e.stroke():e.fill()}un.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(Da(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},un.drawElementText=function(e,t,n,r,a){var i=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],o=this;if(r==null){if(i&&!o.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),a==null?(o.drawText(e,t,null,f,i),t.isEdge()&&(o.drawText(e,t,"source",f,i),o.drawText(e,t,"target",f,i))):o.drawText(e,t,a,f,i),n&&e.translate(p.x1,p.y1)},un.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 t={context:e},this.fontCaches.push(t),t},un.setupTextStyle=function(e,t){var n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},un.getTextAngle=function(e,t){var n,r=e._private.rscratch,a=t?t+"-":"",i=e.pstyle(a+"text-rotation");if(i.strValue==="autorotate"){var o=ot(r,"labelAngle",t);n=e.isEdge()?o:0}else n=i.strValue==="none"?0:i.pfValue;return n},un.drawText=function(e,t,n){var r=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||o!==0&&t.pstyle("text-opacity").value!==0){n==="main"&&(n=null);var s,l,u=ot(i,"labelX",n),c=ot(i,"labelY",n),d=this.getLabelText(t,n);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,p=n?n+"-":"",f=ot(i,"labelWidth",n),g=ot(i,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(m&&(b="center",w="center"),u+=v,c+=y,(h=r?this.getTextAngle(t,n):0)!==0&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),w){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g}var k=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,x=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue,S=t.pstyle("text-background-shape").strValue.indexOf("round")===0;if(k>0||x>0&&E>0){var T=u-C;switch(b){case"left":T-=f;break;case"center":T-=f/2}var D=c-g-C,A=f+2*C,B=g+2*C;if(k>0){var M=e.fillStyle,L=t.pstyle("text-background-color").value;e.fillStyle="rgba("+L[0]+","+L[1]+","+L[2]+","+k*o+")",S?Wi(e,T,D,A,B,2):e.fillRect(T,D,A,B),e.fillStyle=M}if(x>0&&E>0){var I=e.strokeStyle,_=e.lineWidth,R=t.pstyle("text-border-color").value,F=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+R[0]+","+R[1]+","+R[2]+","+E*o+")",e.lineWidth=x,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=x/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(S?Wi(e,T,D,A,B,2,"stroke"):e.strokeRect(T,D,A,B),F==="double"){var z=x/2;S?Wi(e,T+z,D+z,A-2*z,B-2*z,2,"stroke"):e.strokeRect(T+z,D+z,A-2*z,B-2*z)}e.setLineDash&&e.setLineDash([]),e.lineWidth=_,e.strokeStyle=I}}var Y=2*t.pstyle("text-outline-width").pfValue;if(Y>0&&(e.lineWidth=Y),t.pstyle("text-wrap").value==="wrap"){var W=ot(i,"labelWrapCachedLines",n),Z=ot(i,"labelLineHeight",n),G=f/2,$=this.getLabelJustification(t);switch($==="auto"||(b==="left"?$==="left"?u+=-f:$==="center"&&(u+=-G):b==="center"?$==="left"?u+=-G:$==="right"&&(u+=G):b==="right"&&($==="center"?u+=G:$==="right"&&(u+=f))),w){case"top":case"center":case"bottom":c-=(W.length-1)*Z}for(var V=0;V<W.length;V++)Y>0&&e.strokeText(W[V],u,c),e.fillText(W[V],u,c),c+=Z}else Y>0&&e.strokeText(d,u,c),e.fillText(d,u,c);h!==0&&(e.rotate(-h),e.translate(-s,-l))}}};var cn={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],o=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],s=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(ie(d.x)&&ie(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),w=new Array(m.length),k=0,E=0;E<m.length;E++){var x=m[E];if(b[E]=x!=null&&x!=="none"){var C=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);k++,w[E]=l.getCachedImage(x,C,function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var S=t.pstyle("background-blacken").value,T=t.pstyle("border-width").pfValue,D=t.pstyle("background-opacity").value*f,A=t.pstyle("border-color").value,B=t.pstyle("border-style").value,M=t.pstyle("border-join").value,L=t.pstyle("border-cap").value,I=t.pstyle("border-position").value,_=t.pstyle("border-dash-pattern").pfValue,R=t.pstyle("border-dash-offset").pfValue,F=t.pstyle("border-opacity").value*f,z=t.pstyle("outline-width").pfValue,Y=t.pstyle("outline-color").value,W=t.pstyle("outline-style").value,Z=t.pstyle("outline-opacity").value*f,G=t.pstyle("outline-offset").value,$=t.pstyle("corner-radius").value;$!=="auto"&&($=t.pstyle("corner-radius").pfValue);var V=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D;l.eleFillStyle(e,t,j)},O=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;l.colorStrokeStyle(e,A[0],A[1],A[2],j)},q=function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Z;l.colorStrokeStyle(e,Y[0],Y[1],Y[2],j)},Q=function(j,U,J,re){var te,ye=l.nodePathCache=l.nodePathCache||[],ue=Go(J==="polygon"?J+","+re.join(","):J,""+U,""+j,""+$),ae=ye[ue],ge=!1;return ae!=null?(te=ae,ge=!0,c.pathCache=te):(te=new Path2D,ye[ue]=c.pathCache=te),{path:te,cacheHit:ge}},ee=t.pstyle("shape").strValue,oe=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var ce=Q(r,a,ee,oe);h=ce.path,v=ce.cacheHit}var ve=function(){if(!v){var j=d;g&&(j={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,j.x,j.y,r,a,$,c)}g?e.fill(h):e.fill()},he=function(){for(var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,U=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],J=u.backgrounding,re=0,te=0;te<w.length;te++){var ye=t.cy().style().getIndexedStyle(t,"background-image-containment","value",te);U&&ye==="over"||!U&&ye==="inside"?re++:b[te]&&w[te].complete&&!w[te].error&&(re++,l.drawInscribedImage(e,w[te],t,te,j))}u.backgrounding=re!==k,J!==u.backgrounding&&t.updateStyle(!1)},ne=function(){var j=arguments.length>0&&arguments[0]!==void 0&&arguments[0],U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,U),j&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,$,c)))},se=function(){var j=arguments.length>0&&arguments[0]!==void 0&&arguments[0],U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;l.hasStripe(t)&&(e.save(),g?e.clip(c.pathCache):(l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,$,c),e.clip()),l.drawStripe(e,t,U),e.restore(),j&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,$,c)))},le=function(){var j=(S>0?S:-S)*(arguments.length>0&&arguments[0]!==void 0?arguments[0]:f),U=S>0?0:255;S!==0&&(l.colorFillStyle(e,U,U,U,j),g?e.fill(h):e.fill())},de=function(){if(T>0){if(e.lineWidth=T,e.lineCap=L,e.lineJoin=M,e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(_),e.lineDashOffset=R;break;case"solid":case"double":e.setLineDash([])}if(I!=="center"){if(e.save(),e.lineWidth*=2,I==="inside")g?e.clip(h):e.clip();else{var j=new Path2D;j.rect(-r/2-T,-a/2-T,r+2*T,a+2*T),j.addPath(h),e.clip(j,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if(B==="double"){e.lineWidth=T/3;var U=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=U}e.setLineDash&&e.setLineDash([])}},P=function(){if(z>0){if(e.lineWidth=z,e.lineCap="butt",e.setLineDash)switch(W){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var j=d;g&&(j={x:0,y:0});var U=l.getNodeShape(t),J=T;I==="inside"&&(J=0),I==="outside"&&(J*=2);var re,te=(r+J+(z+G))/r,ye=(a+J+(z+G))/a,ue=r*te,ae=a*ye,ge=l.nodeShapes[U].points;if(g&&(re=Q(ue,ae,U,ge).path),U==="ellipse")l.drawEllipsePath(re||e,j.x,j.y,ue,ae);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(U)){var be=0,Pe=0,Ae=0;U==="round-diamond"?be=1.4*(J+G+z):U==="round-heptagon"?(be=1.075*(J+G+z),Ae=-(J/2+G+z)/35):U==="round-hexagon"?be=1.12*(J+G+z):U==="round-pentagon"?(be=1.13*(J+G+z),Ae=-(J/2+G+z)/15):U==="round-tag"?(be=1.12*(J+G+z),Pe=.07*(J/2+z+G)):U==="round-triangle"&&(be=(J+G+z)*(Math.PI/2),Ae=-(J+G/2+z)/Math.PI),be!==0&&(ue=r*(te=(r+be)/r),["round-hexagon","round-tag"].includes(U)||(ae=a*(ye=(a+be)/a)));for(var ze=ue/2,Re=ae/2,tt=($=$==="auto"?us(ue,ae):$)+(J+z+G)/2,_e=new Array(ge.length/2),gt=new Array(ge.length/2),Oe=0;Oe<ge.length/2;Oe++)_e[Oe]={x:j.x+Pe+ze*ge[2*Oe],y:j.y+Ae+Re*ge[2*Oe+1]};var Ve,Ct,ut,ct,dt=_e.length;for(Ct=_e[dt-1],Ve=0;Ve<dt;Ve++)ut=_e[Ve%dt],ct=_e[(Ve+1)%dt],gt[Ve]=qi(Ct,ut,ct,tt),Ct=ut,ut=ct;l.drawRoundPolygonPath(re||e,j.x+Pe,j.y+Ae,r*te,a*ye,ge,gt)}else["roundrectangle","round-rectangle"].includes(U)?($=$==="auto"?qt(ue,ae):$,l.drawRoundRectanglePath(re||e,j.x,j.y,ue,ae,$+(J+z+G)/2)):["cutrectangle","cut-rectangle"].includes(U)?($=$==="auto"?8:$,l.drawCutRectanglePath(re||e,j.x,j.y,ue,ae,null,$+(J+z+G)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(U)?($=$==="auto"?qt(ue,ae):$,l.drawBottomRoundRectanglePath(re||e,j.x,j.y,ue,ae,$+(J+z+G)/2)):U==="barrel"?l.drawBarrelPath(re||e,j.x,j.y,ue,ae):U.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(U)?(ge=Dr(Ar(ge,(J+z+G)/r)),l.drawPolygonPath(re||e,j.x,j.y,r,a,ge)):(ge=Dr(Ar(ge,-((J+z+G)/r))),l.drawPolygonPath(re||e,j.x,j.y,r,a,ge));if(g?e.stroke(re):e.stroke(),W==="double"){e.lineWidth=J/3;var vt=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(re):e.stroke(),e.globalCompositeOperation=vt}e.setLineDash&&e.setLineDash([])}};if(t.pstyle("ghost").value==="yes"){var N=t.pstyle("ghost-offset-x").pfValue,X=t.pstyle("ghost-offset-y").pfValue,H=t.pstyle("ghost-opacity").value,K=H*f;e.translate(N,X),q(),P(),V(H*D),ve(),he(K,!0),O(H*F),de(),ne(S!==0||T!==0),se(S!==0||T!==0),he(K,!1),le(K),e.translate(-N,-X)}g&&e.translate(-d.x,-d.y),o&&l.drawNodeUnderlay(e,t,d,r,a),g&&e.translate(d.x,d.y),q(),P(),V(),ve(),he(f,!0),O(),de(),ne(S!==0||T!==0),se(S!==0||T!==0),he(f,!1),le(),g&&e.translate(-d.x,-d.y),l.drawElementText(e,t,null,i),o&&l.drawNodeOverlay(e,t,d,r,a),n&&e.translate(p.x1,p.y1)}}},zc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,i){if(n.visible()){var 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;if(s>0){if(r=r||n.position(),a==null||i==null){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,a+2*o,i+2*o,c),t.fill()}}}};cn.drawNodeOverlay=zc("overlay"),cn.drawNodeUnderlay=zc("underlay"),cn.hasPie=function(e){return(e=e[0])._private.hasPie},cn.hasStripe=function(e){return(e=e[0])._private.hasStripe},cn.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a,i=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=t.width(),h=t.height(),p=Math.min(d,h)/2,f=0;if(this.usePaths()&&(u=0,c=0),o.units==="%"?p*=o.pfValue:o.pfValue!==void 0&&(p=o.pfValue/2),s.units==="%"?a=p*s.pfValue:s.pfValue!==void 0&&(a=s.pfValue/2),!(a>=p))for(var g=1;g<=i.pieBackgroundN;g++){var v=t.pstyle("pie-"+g+"-background-size").value,y=t.pstyle("pie-"+g+"-background-color").value,m=t.pstyle("pie-"+g+"-background-opacity").value*n,b=v/100;b+f>1&&(b=1-f);var w=1.5*Math.PI+2*Math.PI*f,k=(w+=l)+2*Math.PI*b;v===0||f>=1||f+b>1||(a===0?(e.beginPath(),e.moveTo(u,c),e.arc(u,c,p,w,k),e.closePath()):(e.beginPath(),e.arc(u,c,p,w,k),e.arc(u,c,a,k,w,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),f+=b)}},cn.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=r.x,o=r.y,s=t.width(),l=t.height(),u=0,c=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var p=s,f=l;h.units==="%"?(p*=h.pfValue,f*=h.pfValue):h.pfValue!==void 0&&(p=h.pfValue,f=h.pfValue),c&&(i=0,o=0),o-=p/2,i-=f/2;for(var g=1;g<=a.stripeBackgroundN;g++){var v=t.pstyle("stripe-"+g+"-background-size").value,y=t.pstyle("stripe-"+g+"-background-color").value,m=t.pstyle("stripe-"+g+"-background-opacity").value*n,b=v/100;b+u>1&&(b=1-u),v===0||u>=1||u+b>1||(e.beginPath(),e.rect(i,o+f*u,p,f*b),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),u+=b)}e.restore()};var fr,at={};function Oc(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function xp(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),a=r.context=r.getContext("2d");return r.clear=function(){return a.clearRect(0,0,r.width,r.height)},r.clear(),r}function Hi(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function wp(e){return e.pstyle("background-fill").value==="solid"&&e.pstyle("background-image").strValue==="none"&&(e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0||e.pstyle("border-style").value==="solid")}function Ep(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 dn(e,t,n){var r=e[0]/255,a=e[1]/255,i=e[2]/255,o=t,s=n||new Array(4);return s[0]=r*o,s[1]=a*o,s[2]=i*o,s[3]=o,s}function zn(e,t){var n=t||new Array(4);return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function kp(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Vc(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 Fc(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function Tp(e,t,n,r,a,i){switch(t){case e.FLOAT:return new Float32Array(n.buffer,i*r,a);case e.INT:return new Int32Array(n.buffer,i*r,a)}}function Tt(e,t,n,r){var a=Fe(Vc(e,n),3),i=a[0],o=a[1],s=a[2],l=Fc(e,o,t*i),u=i*s,c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,t*u,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,i,o,!1,u,0):o===e.INT&&e.vertexAttribIPointer(r,i,o,u,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=new Array(t),h=0;h<t;h++)d[h]=Tp(e,o,l,u,i,h);return c.dataArray=l,c.stride=u,c.size=i,c.getView=function(p){return d[p]},c.setPoint=function(p,f,g){var v=d[p];v[0]=f,v[1]=g},c.bufferSubData=function(p){e.bindBuffer(e.ARRAY_BUFFER,c),p?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,p*i):e.bufferSubData(e.ARRAY_BUFFER,0,l)},c}at.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},at.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,a=0;a<n.length;a++)if((t=n[a]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},at.createGradientStyleFor=function(e,t,n,r,a){var i,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),d=n.midpoint(),h=en(u,d),p=en(c,d);i=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,p))}else{var f=o?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();i=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(g,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();i=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),w=n.paddedWidth()/2,k=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":i=e.createLinearGradient(b.x,b.y-k,b.x,b.y+k);break;case"to-top":i=e.createLinearGradient(b.x,b.y+k,b.x,b.y-k);break;case"to-left":i=e.createLinearGradient(b.x+w,b.y,b.x-w,b.y);break;case"to-right":i=e.createLinearGradient(b.x-w,b.y,b.x+w,b.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(b.x-w,b.y-k,b.x+w,b.y+k);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(b.x-w,b.y+k,b.x+w,b.y-k);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(b.x+w,b.y-k,b.x-w,b.y+k);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(b.x+w,b.y+k,b.x-w,b.y-k)}}if(!i)return null;for(var E=l.length===s.length,x=s.length,C=0;C<x;C++)i.addColorStop(E?l[C]:C/(x-1),"rgba("+s[C][0]+","+s[C][1]+","+s[C][2]+","+a+")");return i},at.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a},at.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"},at.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},at.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a},at.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"},at.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},at.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=a*o,c=i*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var d=n.canvasContainer;d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)(l=n.canvases[h]).width=u,l.height=c,l.style.width=a+"px",l.style.height=i+"px";for(h=0;h<t.BUFFER_COUNT;h++)(l=n.bufferCanvases[h]).width=u,l.height=c,l.style.width=a+"px",l.style.height=i+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c,t.pixelRatio=o}},at.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},at.clearCanvas=function(){var e=this,t=e.data;function n(r){r.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},at.render=function(e){var t=this;e=e||Jo();var n=t.cy,r=e.forcedContext,a=e.drawAllLayers,i=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=e.forcedPxRatio===void 0?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=e.motionBlur!==void 0?e.motionBlur: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;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),h&&(t.mbFrames==null&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(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);var m=n.style(),b=n.zoom(),w=o!==void 0?o:b,k=n.pan(),E={x:k.x,y:k.y},x={zoom:b,pan:{x:k.x,y:k.y}},C=t.prevViewport;C===void 0||x.zoom!==C.zoom||x.pan.x!==C.pan.x||x.pan.y!==C.pan.y||g&&!f||(t.motionBlurPxRatio=1),s&&(E=s),w*=l,E.x*=l,E.y*=l;var S=t.getCachedZSortedEles();function T(O,q,Q,ee,oe){var ce=O.globalCompositeOperation;O.globalCompositeOperation="destination-out",t.colorFillStyle(O,255,255,255,t.motionBlurTransparency),O.fillRect(q,Q,ee,oe),O.globalCompositeOperation=ce}function D(O,q){var Q,ee,oe,ce;t.clearingMotionBlur||O!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&O!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(Q=E,ee=w,oe=t.canvasWidth,ce=t.canvasHeight):(Q={x:k.x*p,y:k.y*p},ee=b*p,oe=t.canvasWidth*p,ce=t.canvasHeight*p),O.setTransform(1,0,0,1,0,0),q==="motionBlur"?T(O,0,0,oe,ce):r||q!==void 0&&!q||O.clearRect(0,0,oe,ce),a||(O.translate(Q.x,Q.y),O.scale(ee,ee)),s&&O.translate(s.x,s.y),o&&O.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var A=t.data.bufferContexts[t.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult}),(x=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var B=u.contexts[t.NODE],M=t.textureCache.texture;x=t.textureCache.viewport,B.setTransform(1,0,0,1,0,0),h?T(B,0,0,x.width,x.height):B.clearRect(0,0,x.width,x.height);var L=m.core("outside-texture-bg-color").value,I=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(B,L[0],L[1],L[2],I),B.fillRect(0,0,x.width,x.height),b=n.zoom(),D(B,!1),B.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l),B.drawImage(M,x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var _=n.extent(),R=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&R,z=[];if(z[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,z[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),z[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,z[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||a||i||z[t.NODE]){var Y=h&&!z[t.NODE]&&p!==1;D(B=r||(Y?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),h&&!Y?"motionBlur":void 0),F?t.drawCachedNodes(B,S.nondrag,l,_):t.drawLayeredElements(B,S.nondrag,l,_),t.debug&&t.drawDebugPoints(B,S.nondrag),a||h||(c[t.NODE]=!1)}if(!i&&(c[t.DRAG]||a||z[t.DRAG])&&(Y=h&&!z[t.DRAG]&&p!==1,D(B=r||(Y?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]),h&&!Y?"motionBlur":void 0),F?t.drawCachedNodes(B,S.drag,l,_):t.drawCachedElements(B,S.drag,l,_),t.debug&&t.drawDebugPoints(B,S.drag),a||h||(c[t.DRAG]=!1)),this.drawSelectionRectangle(e,D),h&&p!==1){var W=u.contexts[t.NODE],Z=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],G=u.contexts[t.DRAG],$=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],V=function(O,q,Q){O.setTransform(1,0,0,1,0,0),Q||!y?O.clearRect(0,0,t.canvasWidth,t.canvasHeight):T(O,0,0,t.canvasWidth,t.canvasHeight);var ee=p;O.drawImage(q,0,0,t.canvasWidth*ee,t.canvasHeight*ee,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||z[t.NODE])&&(V(W,Z,z[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||z[t.DRAG])&&(V(G,$,z[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=x,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},at.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,a=n.data,i=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,l=a.canvasNeedsRedraw,u=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!s){var c=u||a.contexts[n.SELECT_BOX];if(t(c),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),h=i.core("selection-box-border-width").value/d;c.lineWidth=h,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),h>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(a.bgActivePosistion&&!n.hoverData.selecting){d=n.cy.zoom();var p=a.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(p.x,p.y,i.core("active-bg-size").pfValue/d,0,2*Math.PI),c.fill()}var f=n.lastRedrawTime;if(n.showFps&&f){f=Math.round(f);var g=Math.round(1e3/f),v="1 frame = "+f+" ms = "+g+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!fr){var y=c.measureText(v);fr=y.actualBoundingBoxAscent}c.fillText(v,0,fr),c.strokeRect(0,fr+10,250,20),c.fillRect(0,fr+10,250*Math.min(g/60,1),20)}s||(l[n.SELECT_BOX]=!1)}};var qc=typeof Float32Array<"u"?Float32Array:Array;function Gi(){var e=new qc(9);return qc!=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 Xc(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 ha(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=n[0],p=n[1];return e[0]=r,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e[6]=h*r+p*o+u,e[7]=h*a+p*s+c,e[8]=h*i+p*l+d,e}function Yc(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=Math.sin(n),p=Math.cos(n);return e[0]=p*r+h*o,e[1]=p*a+h*s,e[2]=p*i+h*l,e[3]=p*o-h*r,e[4]=p*s-h*a,e[5]=p*l-h*i,e[6]=u,e[7]=c,e[8]=d,e}function Ki(e,t,n){var r=n[0],a=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Cp=function(){return Rt(function e(t,n,r,a){Nt(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")},[{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.h,r=this.texHeight,a=this.texSize,i=r/n,o=t*i,s=n*i;return o>a&&(o=t*(i=a/t),s=n*i),{scale:i,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");var a=this.texSize,i=this.texRows,o=this.texHeight,s=this.getScale(t),l=s.scale,u=s.texW,c=s.texH,d=function(g,v){if(n&&v){var y=v.context,m=g.x,b=g.row,w=m,k=o*b;y.save(),y.translate(w,k),y.scale(l,l),n(y,t),y.restore()}},h=[null,null],p=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:u,h:c},h[1]={x:r.freePointer.x+u,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=u,r.freePointer.x==a&&(r.freePointer.x=0,r.freePointer.row++)},f=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+u<=a)p();else{if(this.freePointer.row>=i-1)return!1;this.freePointer.x===a?(f(),p()):this.enableWrapping?function(){var g=r.scratch,v=r.canvas;g.clear(),d({x:0,row:0},g);var y=a-r.freePointer.x,m=u-y,b=o,w=r.freePointer.x,k=r.freePointer.row*o,E=y;v.context.drawImage(g,0,0,E,b,w,k,E,b),h[0]={x:w,y:k,w:E,h:c};var x=y,C=(r.freePointer.row+1)*o,S=m;v&&v.context.drawImage(g,x,0,S,b,0,C,S,b),h[1]={x:0,y:C,w:S,h:c},r.freePointer.x=m,r.freePointer.row++}():(f(),p())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(e){this.texture||(this.texture=function(t){var n=t.createTexture();return n.buffer=function(r){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,r),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},n.deleteTexture=function(){t.deleteTexture(n)},n}(e,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),Pp=function(){return Rt(function e(t,n,r,a){Nt(this,e),this.r=t,this.texSize=n,this.texRows=r,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 Cp(e,t,n,r)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,a=Math.floor(t/n);this.scratch=r(e,t,a,"scratch")}return 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(t.size!==0){var n,r=[],a=new Map,i=null,o=it(this.atlases);try{var s=function(){var l,u,c=n.value,d=c.getKeys(),h=(u=d,(l=t).intersection?l.intersection(u):new Set(yr(l).filter(function(b){return u.has(b)})));if(h.size===0)return r.push(c),d.forEach(function(b){return a.set(b,c)}),1;i||(i=e._createAtlas(),r.push(i));var p,f=it(d);try{for(f.s();!(p=f.n()).done;){var g=p.value;if(!h.has(g)){var v=Fe(c.getOffsets(g),2),y=v[0],m=v[1];i.canFit({w:y.w+m.w,h:y.h})||(i.lock(),i=e._createAtlas(),r.push(i)),c.canvas&&(e._copyTextureToNewAtlas(g,c,i),a.set(g,i))}}}catch(b){f.e(b)}finally{f.f()}c.dispose()};for(o.s();!(n=o.n()).done;)s()}catch(l){o.e(l)}finally{o.f()}this.atlases=r,this.styleKeyToAtlas=a,this.markedKeys=new Set}else console.log("nothing to garbage collect")}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r=Fe(t.getOffsets(e),2),a=r[0],i=r[1];if(i.w===0)n.draw(e,a,function(u){u.drawImage(t.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,a.w,0,i.w,i.h);var s=a.w+i.w,l=a.h;n.draw(e,{w:s,h:l},function(u){u.drawImage(o,0,0,s,l,0,0,s,l)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}(),Sp=function(){return Rt(function e(t,n){Nt(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,a=n.createTextureCanvas,i=t.texRows,o=this._cacheScratchCanvas(a),s=new Pp(this.r,r,i,o);this.collections.set(e,s)}},{key:"addRenderType",value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var r=this.collections.get(n),a=pe({type:e,atlasCollection:r},t);this.renderTypes.set(e,a)}},{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(a,i,o,s){return s?(r&&i==t&&o==n||(t=i,n=o,r=e(a,i,o)),r):e(a,i,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,n=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.forceRedraw,i=a!==void 0&&a,o=r.filterEle,s=o===void 0?function(){return!0}:o,l=r.filterType,u=l===void 0?function(){return!0}:l,c=!1,d=!1,h=it(e);try{for(h.s();!(t=h.n()).done;){var p=t.value;if(s(p)){var f,g=it(this.renderTypes.values());try{var v=function(){var y=f.value,m=y.type;if(u(m)){var b=n.collections.get(y.collection),w=y.getKey(p),k=Array.isArray(w)?w:[w];if(i)k.forEach(function(S){return b.markKeyForGC(S)}),d=!0;else{var E=y.getID?y.getID(p):p.id(),x=n._key(m,E),C=n.typeAndIdToKey.get(x);C===void 0||Ep(k,C)||(c=!0,n.typeAndIdToKey.delete(x),C.forEach(function(S){return b.markKeyForGC(S)}))}}};for(g.s();!(f=g.n()).done;)v()}catch(y){g.e(y)}finally{g.f()}}}}catch(y){h.e(y)}finally{h.f()}return d&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var e,t=it(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(n){t.e(n)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var a=this.renderTypes.get(t),i=this.collections.get(a.collection),o=!1,s=i.draw(r,n,function(c){a.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),a.drawElement(c,e,n,!0,!0),c.restore()):a.drawElement(c,e,n,!0,!0),o=!0});if(o){var l=a.getID?a.getID(e):e.id(),u=this._key(t,l);this.typeAndIdToKey.has(u)?this.typeAndIdToKey.get(u).push(r):this.typeAndIdToKey.set(u,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),a=r.getKey(e);return(Array.isArray(a)?a:[a]).map(function(i){var o=r.getBoundingBox(e,i),s=n.getOrCreateAtlas(e,t,o,i),l=Fe(s.getOffsets(i),2),u=l[0];return{atlas:s,tex:u,tex1:u,tex2:l[1],bb:o}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=it(this.collections);try{for(n.s();!(e=n.n()).done;){var r=Fe(e.value,2),a=r[0],i=r[1].getCounts(),o=i.keyCount,s=i.atlasCount;t.push({type:a,keyCount:o,atlasCount:s})}}catch(l){n.e(l)}finally{n.f()}return t}}])}(),Bp=function(){return Rt(function e(t){Nt(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.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}}])}(),pr={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},jc=1,Wc=2,_p=function(){return Rt(function e(t,n,r){Nt(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=xp,this.atlasManager=new Sp(t,r),this.batchManager=new Bp(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(pr.SCREEN),this.pickingProgram=this._createShaderProgram(pr.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=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(r){return r===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
|
12
|
+
precision highp float;
|
13
|
+
|
14
|
+
uniform mat3 uPanZoomMatrix;
|
15
|
+
uniform int uAtlasSize;
|
16
|
+
|
17
|
+
// instanced
|
18
|
+
in vec2 aPosition; // a vertex from the unit square
|
19
|
+
|
20
|
+
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
21
|
+
in int aVertType; // the type of thing we are rendering
|
22
|
+
|
23
|
+
// the z-index that is output when using picking mode
|
24
|
+
in vec4 aIndex;
|
25
|
+
|
26
|
+
// For textures
|
27
|
+
in int aAtlasId; // which shader unit/atlas to use
|
28
|
+
in vec4 aTex; // x/y/w/h of texture in atlas
|
29
|
+
|
30
|
+
// for edges
|
31
|
+
in vec4 aPointAPointB;
|
32
|
+
in vec4 aPointCPointD;
|
33
|
+
in vec2 aLineWidth; // also used for node border width
|
34
|
+
|
35
|
+
// simple shapes
|
36
|
+
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
37
|
+
in vec4 aColor; // also used for edges
|
38
|
+
in vec4 aBorderColor; // aLineWidth is used for border width
|
39
|
+
|
40
|
+
// output values passed to the fragment shader
|
41
|
+
out vec2 vTexCoord;
|
42
|
+
out vec4 vColor;
|
43
|
+
out vec2 vPosition;
|
44
|
+
// flat values are not interpolated
|
45
|
+
flat out int vAtlasId;
|
46
|
+
flat out int vVertType;
|
47
|
+
flat out vec2 vTopRight;
|
48
|
+
flat out vec2 vBotLeft;
|
49
|
+
flat out vec4 vCornerRadius;
|
50
|
+
flat out vec4 vBorderColor;
|
51
|
+
flat out vec2 vBorderWidth;
|
52
|
+
flat out vec4 vIndex;
|
53
|
+
|
54
|
+
void main(void) {
|
55
|
+
int vid = gl_VertexID;
|
56
|
+
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
57
|
+
|
58
|
+
if(aVertType == `.concat(0,`) {
|
59
|
+
float texX = aTex.x; // texture coordinates
|
60
|
+
float texY = aTex.y;
|
61
|
+
float texW = aTex.z;
|
62
|
+
float texH = aTex.w;
|
63
|
+
|
64
|
+
if(vid == 1 || vid == 2 || vid == 4) {
|
65
|
+
texX += texW;
|
66
|
+
}
|
67
|
+
if(vid == 2 || vid == 4 || vid == 5) {
|
68
|
+
texY += texH;
|
69
|
+
}
|
70
|
+
|
71
|
+
float d = float(uAtlasSize);
|
72
|
+
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
73
|
+
|
74
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
75
|
+
}
|
76
|
+
else if(aVertType == `).concat(4," || aVertType == ").concat(7,`
|
77
|
+
|| aVertType == `).concat(5," || aVertType == ").concat(6,`) { // simple shapes
|
78
|
+
|
79
|
+
// the bounding box is needed by the fragment shader
|
80
|
+
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
81
|
+
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
82
|
+
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
83
|
+
|
84
|
+
// calculations are done in the fragment shader, just pass these along
|
85
|
+
vColor = aColor;
|
86
|
+
vCornerRadius = aCornerRadius;
|
87
|
+
vBorderColor = aBorderColor;
|
88
|
+
vBorderWidth = aLineWidth;
|
89
|
+
|
90
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
91
|
+
}
|
92
|
+
else if(aVertType == `).concat(1,`) {
|
93
|
+
vec2 source = aPointAPointB.xy;
|
94
|
+
vec2 target = aPointAPointB.zw;
|
95
|
+
|
96
|
+
// adjust the geometry so that the line is centered on the edge
|
97
|
+
position.y = position.y - 0.5;
|
98
|
+
|
99
|
+
// stretch the unit square into a long skinny rectangle
|
100
|
+
vec2 xBasis = target - source;
|
101
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
102
|
+
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
103
|
+
|
104
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
105
|
+
vColor = aColor;
|
106
|
+
}
|
107
|
+
else if(aVertType == `).concat(2,`) {
|
108
|
+
vec2 pointA = aPointAPointB.xy;
|
109
|
+
vec2 pointB = aPointAPointB.zw;
|
110
|
+
vec2 pointC = aPointCPointD.xy;
|
111
|
+
vec2 pointD = aPointCPointD.zw;
|
112
|
+
|
113
|
+
// adjust the geometry so that the line is centered on the edge
|
114
|
+
position.y = position.y - 0.5;
|
115
|
+
|
116
|
+
vec2 p0, p1, p2, pos;
|
117
|
+
if(position.x == 0.0) { // The left side of the unit square
|
118
|
+
p0 = pointA;
|
119
|
+
p1 = pointB;
|
120
|
+
p2 = pointC;
|
121
|
+
pos = position;
|
122
|
+
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
123
|
+
p0 = pointD;
|
124
|
+
p1 = pointC;
|
125
|
+
p2 = pointB;
|
126
|
+
pos = vec2(0.0, -position.y);
|
127
|
+
}
|
128
|
+
|
129
|
+
vec2 p01 = p1 - p0;
|
130
|
+
vec2 p12 = p2 - p1;
|
131
|
+
vec2 p21 = p1 - p2;
|
132
|
+
|
133
|
+
// Find the normal vector.
|
134
|
+
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
135
|
+
vec2 normal = vec2(-tangent.y, tangent.x);
|
136
|
+
|
137
|
+
// Find the vector perpendicular to p0 -> p1.
|
138
|
+
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
139
|
+
|
140
|
+
// Determine the bend direction.
|
141
|
+
float sigma = sign(dot(p01 + p21, normal));
|
142
|
+
float width = aLineWidth[0];
|
143
|
+
|
144
|
+
if(sign(pos.y) == -sigma) {
|
145
|
+
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
146
|
+
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
147
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
148
|
+
} else {
|
149
|
+
// This is a non-intersecting vertex. Treat it like a mitre join.
|
150
|
+
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
151
|
+
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
152
|
+
}
|
153
|
+
|
154
|
+
vColor = aColor;
|
155
|
+
}
|
156
|
+
else if(aVertType == `).concat(3,` && vid < 3) {
|
157
|
+
// massage the first triangle into an edge arrow
|
158
|
+
if(vid == 0)
|
159
|
+
position = vec2(-0.15, -0.3);
|
160
|
+
if(vid == 1)
|
161
|
+
position = vec2( 0.0, 0.0);
|
162
|
+
if(vid == 2)
|
163
|
+
position = vec2( 0.15, -0.3);
|
164
|
+
|
165
|
+
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
166
|
+
vColor = aColor;
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
170
|
+
}
|
171
|
+
|
172
|
+
vAtlasId = aAtlasId;
|
173
|
+
vVertType = aVertType;
|
174
|
+
vIndex = aIndex;
|
175
|
+
}
|
176
|
+
`),r=this.batchManager.getIndexArray(),a=`#version 300 es
|
177
|
+
precision highp float;
|
178
|
+
|
179
|
+
// declare texture unit for each texture atlas in the batch
|
180
|
+
`.concat(r.map(function(s){return"uniform sampler2D uTexture".concat(s,";")}).join(`
|
181
|
+
`),`
|
182
|
+
|
183
|
+
uniform vec4 uBGColor;
|
184
|
+
uniform float uZoom;
|
185
|
+
|
186
|
+
in vec2 vTexCoord;
|
187
|
+
in vec4 vColor;
|
188
|
+
in vec2 vPosition; // model coordinates
|
189
|
+
|
190
|
+
flat in int vAtlasId;
|
191
|
+
flat in vec4 vIndex;
|
192
|
+
flat in int vVertType;
|
193
|
+
flat in vec2 vTopRight;
|
194
|
+
flat in vec2 vBotLeft;
|
195
|
+
flat in vec4 vCornerRadius;
|
196
|
+
flat in vec4 vBorderColor;
|
197
|
+
flat in vec2 vBorderWidth;
|
198
|
+
|
199
|
+
out vec4 outColor;
|
200
|
+
|
201
|
+
`).concat(`
|
202
|
+
float circleSD(vec2 p, float r) {
|
203
|
+
return distance(vec2(0), p) - r; // signed distance
|
204
|
+
}
|
205
|
+
`,`
|
206
|
+
`).concat(`
|
207
|
+
float rectangleSD(vec2 p, vec2 b) {
|
208
|
+
vec2 d = abs(p)-b;
|
209
|
+
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
210
|
+
}
|
211
|
+
`,`
|
212
|
+
`).concat(`
|
213
|
+
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
214
|
+
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
215
|
+
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
216
|
+
vec2 q = abs(p) - b + cr.x;
|
217
|
+
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
218
|
+
}
|
219
|
+
`,`
|
220
|
+
`).concat(`
|
221
|
+
float ellipseSD(vec2 p, vec2 ab) {
|
222
|
+
p = abs( p ); // symmetry
|
223
|
+
|
224
|
+
// find root with Newton solver
|
225
|
+
vec2 q = ab*(p-ab);
|
226
|
+
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
227
|
+
for( int i=0; i<5; i++ ) {
|
228
|
+
vec2 cs = vec2(cos(w),sin(w));
|
229
|
+
vec2 u = ab*vec2( cs.x,cs.y);
|
230
|
+
vec2 v = ab*vec2(-cs.y,cs.x);
|
231
|
+
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
232
|
+
}
|
233
|
+
|
234
|
+
// compute final point and distance
|
235
|
+
float d = length(p-ab*vec2(cos(w),sin(w)));
|
236
|
+
|
237
|
+
// return signed distance
|
238
|
+
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
239
|
+
}
|
240
|
+
`,`
|
241
|
+
|
242
|
+
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
243
|
+
return vec4(
|
244
|
+
top.rgb + (bot.rgb * (1.0 - top.a)),
|
245
|
+
top.a + (bot.a * (1.0 - top.a))
|
246
|
+
);
|
247
|
+
}
|
248
|
+
|
249
|
+
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
250
|
+
// scale to the zoom level so that borders don't look blurry when zoomed in
|
251
|
+
// note 1.5 is an aribitrary value chosen because it looks good
|
252
|
+
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
253
|
+
}
|
254
|
+
|
255
|
+
void main(void) {
|
256
|
+
if(vVertType == `).concat(0,`) {
|
257
|
+
// look up the texel from the texture unit
|
258
|
+
`).concat(r.map(function(s){return"if(vAtlasId == ".concat(s,") outColor = texture(uTexture").concat(s,", vTexCoord);")}).join(`
|
259
|
+
else `),`
|
260
|
+
}
|
261
|
+
else if(vVertType == `).concat(3,`) {
|
262
|
+
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
263
|
+
outColor = blend(vColor, uBGColor);
|
264
|
+
outColor.a = 1.0; // make opaque, masks out line under arrow
|
265
|
+
}
|
266
|
+
else if(vVertType == `).concat(4,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
267
|
+
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
268
|
+
}
|
269
|
+
else if(vVertType == `).concat(4," || vVertType == ").concat(7,`
|
270
|
+
|| vVertType == `).concat(5," || vVertType == ").concat(6,`) { // use SDF
|
271
|
+
|
272
|
+
float outerBorder = vBorderWidth[0];
|
273
|
+
float innerBorder = vBorderWidth[1];
|
274
|
+
float borderPadding = outerBorder * 2.0;
|
275
|
+
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
276
|
+
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
277
|
+
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
278
|
+
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
279
|
+
|
280
|
+
float d; // signed distance
|
281
|
+
if(vVertType == `).concat(4,`) {
|
282
|
+
d = rectangleSD(p, b);
|
283
|
+
} else if(vVertType == `).concat(7,` && w == h) {
|
284
|
+
d = circleSD(p, b.x); // faster than ellipse
|
285
|
+
} else if(vVertType == `).concat(7,`) {
|
286
|
+
d = ellipseSD(p, b);
|
287
|
+
} else {
|
288
|
+
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
289
|
+
}
|
290
|
+
|
291
|
+
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
292
|
+
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
293
|
+
if(d > 0.0) {
|
294
|
+
if(d > outerBorder) {
|
295
|
+
discard;
|
296
|
+
} else {
|
297
|
+
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
298
|
+
}
|
299
|
+
} else {
|
300
|
+
if(d > innerBorder) {
|
301
|
+
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
302
|
+
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
303
|
+
outColor = distInterp(innerBorderColor, outerColor, d);
|
304
|
+
}
|
305
|
+
else {
|
306
|
+
vec4 outerColor;
|
307
|
+
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
308
|
+
outerColor = vec4(0);
|
309
|
+
} else if(innerBorder == 0.0) {
|
310
|
+
outerColor = vBorderColor;
|
311
|
+
} else {
|
312
|
+
outerColor = blend(vBorderColor, vColor);
|
313
|
+
}
|
314
|
+
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
else {
|
319
|
+
outColor = vColor;
|
320
|
+
}
|
321
|
+
|
322
|
+
`).concat(e.picking?`if(outColor.a == 0.0) discard;
|
323
|
+
else outColor = vIndex;`:"",`
|
324
|
+
}
|
325
|
+
`),i=function(s,l,u){var c=Oc(s,s.VERTEX_SHADER,l),d=Oc(s,s.FRAGMENT_SHADER,u),h=s.createProgram();if(s.attachShader(h,c),s.attachShader(h,d),s.linkProgram(h),!s.getProgramParameter(h,s.LINK_STATUS))throw new Error("Could not initialize shaders");return h}(t,n,a);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 o=0;o<this.batchManager.getMaxAtlasesPerBatch();o++)i.uTextures.push(t.getUniformLocation(i,"uTexture".concat(o)));return i}},{key:"_createVAO",value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,a=n.createVertexArray();return n.bindVertexArray(a),function(i,o,s,l){var u=Fe(Vc(i,o),2),c=u[0],d=u[1],h=Fc(i,d,l),p=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,p),i.bufferData(i.ARRAY_BUFFER,h,i.STATIC_DRAW),d===i.FLOAT?i.vertexAttribPointer(s,c,d,!1,0,0):d===i.INT&&i.vertexAttribIPointer(s,c,d,0,0),i.enableVertexAttribArray(s),i.bindBuffer(i.ARRAY_BUFFER,null)}(n,"vec2",r.aPosition,e),this.transformBuffer=function(i,o,s){for(var l=new Float32Array(9*o),u=new Array(o),c=0;c<o;c++){var d=9*c*4;u[c]=new Float32Array(l.buffer,d,9)}var h=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,h),i.bufferData(i.ARRAY_BUFFER,l.byteLength,i.DYNAMIC_DRAW);for(var p=0;p<3;p++){var f=s+p;i.enableVertexAttribArray(f),i.vertexAttribPointer(f,3,i.FLOAT,!1,36,12*p),i.vertexAttribDivisor(f,1)}return i.bindBuffer(i.ARRAY_BUFFER,null),h.getMatrixView=function(g){return u[g]},h.setData=function(g,v){u[v].set(g,0)},h.bufferSubData=function(){i.bindBuffer(i.ARRAY_BUFFER,h),i.bufferSubData(i.ARRAY_BUFFER,0,l)},h}(n,t,r.aTransform),this.indexBuffer=Tt(n,t,"vec4",r.aIndex),this.vertTypeBuffer=Tt(n,t,"int",r.aVertType),this.atlasIdBuffer=Tt(n,t,"int",r.aAtlasId),this.texBuffer=Tt(n,t,"vec4",r.aTex),this.pointAPointBBuffer=Tt(n,t,"vec4",r.aPointAPointB),this.pointCPointDBuffer=Tt(n,t,"vec4",r.aPointCPointD),this.lineWidthBuffer=Tt(n,t,"vec2",r.aLineWidth),this.colorBuffer=Tt(n,t,"vec4",r.aColor),this.cornerRadiusBuffer=Tt(n,t,"vec4",r.aCornerRadius),this.borderColorBuffer=Tt(n,t,"vec4",r.aBorderColor),n.bindVertexArray(null),a}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(t){return zt(t,"Buffer")}).map(function(t){return e[t]})),this._buffers}},{key:"startFrame",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pr.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 r=this.atlasManager,a=this.batchManager,i=r.getRenderTypeOpts(n);if(this._isVisible(e,i)){if(this.renderTarget.picking&&i.getTexPickingMode){var o=i.getTexPickingMode(e);if(o===jc)return;if(o==Wc)return void this.drawPickingRectangle(e,t,n)}var s,l=it(r.getAtlasInfo(e,n));try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.atlas,d=u.tex1,h=u.tex2;a.canAddToCurrentBatch(c)||this.endBatch();for(var p=a.getAtlasIndexForBatch(c),f=0,g=[[d,!0],[h,!1]];f<g.length;f++){var v=Fe(g[f],2),y=v[0],m=v[1];if(y.w!=0){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=0,zn(t,this.indexBuffer.getView(b)),this.atlasIdBuffer.getView(b)[0]=p;var w=this.texBuffer.getView(b);w[0]=y.x,w[1]=y.y,w[2]=y.w,w[3]=y.h;var k=this.transformBuffer.getMatrixView(b);this.setTransformMatrix(e,k,i,u,m),this.instanceCount++,m||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(E){l.e(E)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],i=0;if(n.shapeProps&&n.shapeProps.padding&&(i=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,l=r.tex2,u=s.w/(s.w+l.w);a||(u=1-u);var c=this._getAdjustedBB(o,i,a,u);this._applyTransformMatrix(t,c,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,i,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){var a,i;Xc(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r);ha(e,e,[s.x,s.y]),Yc(e,e,o);var l=n.getRotationOffset(r);a=l.x+(t.xOffset||0),i=l.y+(t.yOffset||0)}else a=t.x1,i=t.y1;ha(e,e,[a,i]),Ki(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var a=e.x1,i=e.y1,o=e.w,s=e.h;t&&(a-=t,i-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(a+=l=o-u,o=u),{x1:a,y1:i,w:o,h:s,xOffset:l,yOffset:e.yOffset}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),a=this.instanceCount;this.vertTypeBuffer.getView(a)[0]=4,zn(t,this.indexBuffer.getView(a)),dn([0,0,0],1,this.colorBuffer.getView(a));var i=this.transformBuffer.getMatrixView(a);this.setTransformMatrix(e,i,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var a=r.shapeProps,i=this._getVertTypeForShape(e,a.shape);if(i===void 0||r.isSimple&&!r.isSimple(e))this.drawTexture(e,t,n);else{var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=i,i===5||i===6){var s=r.getBoundingBox(e),l=this._getCornerRadius(e,a.radius,s),u=this.cornerRadiusBuffer.getView(o);u[0]=l,u[1]=l,u[2]=l,u[3]=l,i===6&&(u[0]=0,u[2]=0)}zn(t,this.indexBuffer.getView(o)),dn(e.pstyle(a.color).value,e.pstyle(a.opacity).value,this.colorBuffer.getView(o));var c=this.lineWidthBuffer.getView(o);if(c[0]=0,c[1]=0,a.border){var d=e.pstyle("border-width").value;if(d>0){dn(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var h=e.pstyle("border-position").value;if(h==="inside")c[0]=0,c[1]=-d;else if(h==="outside")c[0]=d,c[1]=0;else{var p=d/2;c[0]=p,c[1]=-p}}}var f=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,f,r),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,a=n.h;if(e.pstyle(t).value==="auto")return qt(r,a);var i=e.pstyle(t).pfValue,o=r/2,s=a/2;return Math.min(i,s,o)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,a,i,o=e._private.rscratch;if(n==="source"?(r=o.arrowStartX,a=o.arrowStartY,i=o.srcArrowAngle):(r=o.arrowEndX,a=o.arrowEndY,i=o.tgtArrowAngle),!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(i)||i==null)&&e.pstyle(n+"-arrow-shape").value!=="none"){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value*e.pstyle("line-opacity").value,u=e.pstyle("width").pfValue,c=e.pstyle("arrow-scale").value,d=this.r.getArrowWidth(u,c),h=this.instanceCount,p=this.transformBuffer.getMatrixView(h);Xc(p),ha(p,p,[r,a]),Ki(p,p,[d,d]),Yc(p,p,i),this.vertTypeBuffer.getView(h)[0]=3,zn(t,this.indexBuffer.getView(h)),dn(s,l,this.colorBuffer.getView(h)),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,a=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*a;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,zn(t,this.indexBuffer.getView(l)),dn(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=i;var u=this.pointAPointBBuffer.getView(l);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c<n.length-2;c+=2){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=2,zn(t,this.indexBuffer.getView(d)),dn(o,s,this.colorBuffer.getView(d)),this.lineWidthBuffer.getView(d)[0]=i;var h=n[c-2],p=n[c-1],f=n[c],g=n[c+1],v=n[c+2],y=n[c+3],m=n[c+4],b=n[c+5];c==0&&(h=2*f-v+.001,p=2*g-y+.001),c==n.length-4&&(m=2*v-f+.001,b=2*y-g+.001);var w=this.pointAPointBBuffer.getView(d);w[0]=h,w[1]=p,w[2]=f,w[3]=g;var k=this.pointCPointDBuffer.getView(d);k[0]=v,k[1]=y,k[2]=m,k[3]=b,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(!t.badLine&&t.allpts!=null&&!isNaN(t.allpts[0])){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(e.length==4)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var a=r/t;this._setCurvePoint(e,a,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var a=Array(e.length-2),i=0;i<a.length;i+=2){var o=(1-t)*e[i]+t*e[i+2],s=(1-t)*e[i+1]+t*e[i+3];a[i]=o,a[i+1]=s}return this._setCurvePoint(a,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,r=this.instanceCount;if(r!==0){var a=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(a),e.bindVertexArray(t);var i,o=it(this.buffers);try{for(o.s();!(i=o.n()).done;)i.value.bufferSubData(r)}catch(p){o.e(p)}finally{o.f()}for(var s,l,u=this.batchManager.getAtlases(),c=0;c<u.length;c++)u[c].bufferIfNeeded(e);for(var d=0;d<u.length;d++)e.activeTexture(e.TEXTURE0+d),e.bindTexture(e.TEXTURE_2D,u[d].texture),e.uniform1i(a.uTextures[d],d);e.uniform1f(a.uZoom,(s=this.r,l=s.pixelRatio,s.cy.zoom()*l)),e.uniformMatrix3fv(a.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(a.uAtlasSize,this.batchManager.getAtlasSize());var h=dn(this.bgColor,1);e.uniform4fv(a.uBGColor,h),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:u.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(a,i){return a+i.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(a,i){return a+i.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),Hc={};function Gc(e,t){var n=e._private.rscratch;return ot(n,"labelWrapCachedLines",t)||[]}Hc.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=function(c){var d=c.cy.container(),h=d&&d.style&&d.style.backgroundColor||"white";return Fo(h)}(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=function(c){var d=c.createFramebuffer();c.bindFramebuffer(c.FRAMEBUFFER,d);var h=c.createTexture();return c.bindTexture(c.TEXTURE_2D,h),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,h,0),c.bindFramebuffer(c.FRAMEBUFFER,null),d.setFramebufferAttachmentSizes=function(p,f){c.bindTexture(c.TEXTURE_2D,h),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,p,f,0,c.RGBA,c.UNSIGNED_BYTE,null)},d}(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new _p(n,r,e);var a=function(c){return function(d){return n.getTextAngle(d,c)}},i=function(c){return function(d){var h=d.pstyle(c);return h&&h.value}},o=function(c){return function(d){return d.pstyle("".concat(c,"-opacity")).value>0}},s=function(c){return c.pstyle("text-events").strValue==="yes"?Wc:jc},l=function(c){var d=c.position(),h=d.x,p=d.y,f=c.outerWidth(),g=c.outerHeight();return{w:f,h:g,x1:h-f/2,y1:p-g/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:wp,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Ui(t.getLabelKey,null),getBoundingBox:Zi(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:a(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:i("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Ui(t.getSourceLabelKey,"source"),getBoundingBox:Zi(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:a("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:i("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Ui(t.getTargetLabelKey,"target"),getBoundingBox:Zi(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:a("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:i("target-label")});var u=Hn(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(c,d){var h=!1;d&&d.length>0&&(h|=n.drawing.invalidate(d)),h&&u()}),function(c){var d=c.render;c.render=function(g){g=g||{};var v=c.cy;c.webgl&&(v.zoom()>sp?(function(y){var m=y.data.contexts[y.WEBGL];m.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT)}(c),d.call(c,g)):(function(y){var m=function(b){b.save(),b.setTransform(1,0,0,1,0,0),b.clearRect(0,0,y.canvasWidth,y.canvasHeight),b.restore()};m(y.data.contexts[y.NODE]),m(y.data.contexts[y.DRAG])}(c),Uc(c,g,pr.SCREEN)))};var h=c.matchCanvasSize;c.matchCanvasSize=function(g){h.call(c,g),c.pickingFrameBuffer.setFramebufferAttachmentSizes(c.canvasWidth,c.canvasHeight),c.pickingFrameBuffer.needsDraw=!0},c.findNearestElements=function(g,v,y,m){return function(b,w,k){var E,x,C,S=function(B,M,L){var I,_,R,F,z=Hi(B),Y=z.pan,W=z.zoom,Z=function(he,ne,se,le,de){var P=le*se+ne.x,N=de*se+ne.y;return[P,N=Math.round(he.canvasHeight-N)]}(B,Y,W,M,L),G=Fe(Z,2),$=G[0],V=G[1],O=6;if(I=$-O/2,_=V-O/2,F=O,(R=O)===0||F===0)return[];var q=B.data.contexts[B.WEBGL];q.bindFramebuffer(q.FRAMEBUFFER,B.pickingFrameBuffer),B.pickingFrameBuffer.needsDraw&&(q.viewport(0,0,q.canvas.width,q.canvas.height),Uc(B,null,pr.PICKING),B.pickingFrameBuffer.needsDraw=!1);var Q=R*F,ee=new Uint8Array(4*Q);q.readPixels(I,_,R,F,q.RGBA,q.UNSIGNED_BYTE,ee),q.bindFramebuffer(q.FRAMEBUFFER,null);for(var oe=new Set,ce=0;ce<Q;ce++){var ve=kp(ee.slice(4*ce,4*ce+4))-1;ve>=0&&oe.add(ve)}return oe}(b,w,k),T=b.getCachedZSortedEles(),D=it(S);try{for(D.s();!(C=D.n()).done;){var A=T[C.value];if(!E&&A.isNode()&&(E=A),!x&&A.isEdge()&&(x=A),E&&x)break}}catch(B){D.e(B)}finally{D.f()}return[E,x].filter(Boolean)}(c,g,v)};var p=c.invalidateCachedZSortedEles;c.invalidateCachedZSortedEles=function(){p.call(c),c.pickingFrameBuffer.needsDraw=!0};var f=c.notify;c.notify=function(g,v){f.call(c,g,v),g==="viewport"||g==="bounds"?c.pickingFrameBuffer.needsDraw=!0:g==="background"&&c.drawing.invalidate(v,{type:"node-body"})}}(n)};var Ui=function(e,t){return function(n){var r=e(n),a=Gc(n,t);return a.length>1?a.map(function(i,o){return"".concat(r,"_").concat(o)}):r}},Zi=function(e,t){return function(n,r){var a=e(n);if(typeof r=="string"){var i=r.indexOf("_");if(i>0){var o=Number(r.substring(i+1)),s=Gc(n,t),l=a.h/s.length,u=l*o,c=a.y1+u;return{x1:a.x1,w:a.w,y1:c,h:l,yOffset:u}}}return a}};function Kc(e,t){var n=e.canvasWidth,r=e.canvasHeight,a=Hi(e),i=a.pan,o=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(i.x,i.y),t.scale(o,o)}function $i(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function Uc(e,t,n){var r;e.webglDebug&&(r=performance.now());var a=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(b,w){b.drawSelectionRectangle(w,function(k){return Kc(b,k)})}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=function(b){var w=b.canvasWidth,k=b.canvasHeight,E=Hi(b),x=E.pan,C=E.zoom,S=Gi();ha(S,S,[x.x,x.y]),Ki(S,S,[C,C]);var T=Gi();(function(ve,he,ne){ve[0]=2/he,ve[1]=0,ve[2]=0,ve[3]=0,ve[4]=-2/ne,ve[5]=0,ve[6]=-1,ve[7]=1,ve[8]=1})(T,w,k);var D,A,B,M,L,I,_,R,F,z,Y,W,Z,G,$,V,O,q,Q,ee,oe,ce=Gi();return D=ce,B=S,M=(A=T)[0],L=A[1],I=A[2],_=A[3],R=A[4],F=A[5],z=A[6],Y=A[7],W=A[8],Z=B[0],G=B[1],$=B[2],V=B[3],O=B[4],q=B[5],Q=B[6],ee=B[7],oe=B[8],D[0]=Z*M+G*_+$*z,D[1]=Z*L+G*R+$*Y,D[2]=Z*I+G*F+$*W,D[3]=V*M+O*_+q*z,D[4]=V*L+O*R+q*Y,D[5]=V*I+O*F+q*W,D[6]=Q*M+ee*_+oe*z,D[7]=Q*L+ee*R+oe*Y,D[8]=Q*I+ee*F+oe*W,ce}(e),l=e.getCachedZSortedEles();if(i=l.length,a.startFrame(s,n),n.screen){for(var u=0;u<l.nondrag.length;u++)$i(e,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)$i(e,c,l.drag[c])}else if(n.picking)for(var d=0;d<l.length;d++)$i(e,d,l[d]);a.endFrame(),n.screen&&e.webglDebugShowAtlases&&(function(b){var w=b.data.contexts[b.NODE];w.save(),Kc(b,w),w.strokeStyle="rgba(0, 0, 0, 0.3)",w.beginPath(),w.moveTo(-1e3,0),w.lineTo(1e3,0),w.stroke(),w.beginPath(),w.moveTo(0,-1e3),w.lineTo(0,1e3),w.stroke(),w.restore()}(e),function(b){var w=function(E,x,C){for(var S=E.atlasManager.getAtlasCollection(x),T=b.data.contexts[b.NODE],D=S.atlases,A=0;A<D.length;A++){var B=D[A].canvas;if(B){var M=B.width,L=B.height,I=M*A,_=B.height*C;T.save(),T.scale(.4,.4),T.drawImage(B,I,_),T.strokeStyle="black",T.rect(I,_,M,L),T.stroke(),T.restore()}}},k=0;w(b.drawing,"node",k++),w(b.drawing,"label",k++)}(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var h=performance.now(),p=Math.ceil(h-r),f=a.getDebugInfo(),g=["".concat(i," elements"),"".concat(f.totalInstances," instances"),"".concat(f.batchCount," batches"),"".concat(f.totalAtlases," atlases"),"".concat(f.wrappedCount," wrapped textures"),"".concat(f.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(n.name,") - frame time ").concat(p,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var v,y=it(f.atlasInfo);try{for(y.s();!(v=y.n()).done;){var m=v.value;console.log(" ".concat(m.type,": ").concat(m.keyCount," keys, ").concat(m.atlasCount," atlases"))}}catch(b){y.e(b)}finally{y.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,a.gc())}for(var Zc={drawPolygonPath:function(e,t,n,r,a,i){var o=r/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*i[0],n+s*i[1]);for(var l=1;l<i.length/2;l++)e.lineTo(t+o*i[2*l],n+s*i[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,a,i,o){o.forEach(function(s){return xc(e,s)}),e.closePath()},drawRoundRectanglePath:function(e,t,n,r,a,i){var o=r/2,s=a/2,l=i==="auto"?qt(r,a):Math.min(i,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,a,i){var o=r/2,s=a/2,l=i==="auto"?qt(r,a):i;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,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},drawCutRectanglePath:function(e,t,n,r,a,i,o){var s=r/2,l=a/2,u=o==="auto"?8:o;e.beginPath&&e.beginPath(),e.moveTo(t-s+u,n-l),e.lineTo(t+s-u,n-l),e.lineTo(t+s,n-l+u),e.lineTo(t+s,n+l-u),e.lineTo(t+s-u,n+l),e.lineTo(t-s+u,n+l),e.lineTo(t-s,n+l-u),e.lineTo(t-s,n-l+u),e.closePath()},drawBarrelPath:function(e,t,n,r,a){var i=r/2,o=a/2,s=t-i,l=t+i,u=n-o,c=n+o,d=Ra(r,a),h=d.widthOffset,p=d.heightOffset,f=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,u+p),e.lineTo(s,c-p),e.quadraticCurveTo(s+f,c,s+h,c),e.lineTo(l-h,c),e.quadraticCurveTo(l-f,c,l,c-p),e.lineTo(l,u+p),e.quadraticCurveTo(l-f,u,l-h,u),e.lineTo(s+h,u),e.quadraticCurveTo(s+f,u,s,u+p),e.closePath()}},$c=Math.sin(0),Qc=Math.cos(0),Qi={},Ji={},Jc=Math.PI/40,On=0*Math.PI;On<2*Math.PI;On+=Jc)Qi[On]=Math.sin(On),Ji[On]=Math.cos(On);Zc.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,o,s=r/2,l=a/2,u=0*Math.PI;u<2*Math.PI;u+=Jc)i=t-s*Qi[u]*$c+s*Ji[u]*Qc,o=n+l*Ji[u]*$c+l*Qi[u]*Qc,u===0?e.moveTo(i,o):e.lineTo(i,o);e.closePath()};var gr={};function ed(e){var t=e.indexOf(",");return e.substr(t+1)}function td(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Tn(function(a,i){try{t.toBlob(function(o){o!=null?a(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(o){i(o)}});case"blob":return function(a,i){for(var o=atob(a),s=new ArrayBuffer(o.length),l=new Uint8Array(s),u=0;u<o.length;u++)l[u]=o.charCodeAt(u);return new Blob([s],{type:i})}(ed(r()),n);case"base64":return ed(r());default:return r()}}gr.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},gr.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),a=e.full?Math.ceil(n.w):r[2],i=e.full?Math.ceil(n.h):r[3],o=ie(e.maxWidth)||ie(e.maxHeight),s=this.getPixelRatio(),l=1;if(e.scale!==void 0)a*=e.scale,i*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;ie(e.maxWidth)&&(u=l*e.maxWidth/a),ie(e.maxHeight)&&(c=l*e.maxHeight/i),a*=l=Math.min(u,c),i*=l}o||(a*=s,i*=s,l*=s);var d=document.createElement("canvas");d.width=a,d.height=i,d.style.width=a+"px",d.style.height=i+"px";var h=d.getContext("2d");if(a>0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,i),h.fill())}return d},gr.png=function(e){return td(e,this.bufferCanvasImage(e),"image/png")},gr.jpg=function(e){return td(e,this.bufferCanvasImage(e),"image/jpeg")};var Dp={nodeShapeImpl:function(e,t,n,r,a,i,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,s);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}}},Ap=nd,me=nd.prototype;function nd(e){var t=this,n=t.cy.window().document;e.webgl&&(me.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(me.CANVAS_LAYERS),contexts:new Array(me.CANVAS_LAYERS),canvasNeedsRedraw:new Array(me.CANVAS_LAYERS),bufferCanvases:new Array(me.BUFFER_COUNT),bufferContexts:new Array(me.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};oo&&oo.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<me.CANVAS_LAYERS;l++){var u=t.data.canvases[l]=n.createElement("canvas"),c=me.CANVAS_TYPES[l];t.data.contexts[l]=u.getContext(c),t.data.contexts[l]||Ie("Could not create canvas of type "+c),Object.keys(s).forEach(function(V){u.style[V]=s[V]}),u.style.position="absolute",u.setAttribute("data-id","layer"+l),u.style.zIndex=String(me.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(u),t.data.canvasNeedsRedraw[l]=!1}for(t.data.topCanvas=t.data.canvases[0],t.data.canvases[me.NODE].setAttribute("data-id","layer"+me.NODE+"-node"),t.data.canvases[me.SELECT_BOX].setAttribute("data-id","layer"+me.SELECT_BOX+"-selectbox"),t.data.canvases[me.DRAG].setAttribute("data-id","layer"+me.DRAG+"-drag"),t.data.canvases[me.WEBGL]&&t.data.canvases[me.WEBGL].setAttribute("data-id","layer"+me.WEBGL+"-webgl"),l=0;l<me.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=n.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var d=nt(),h=function(V){return{x:-V.w/2,y:-V.h/2}},p=function(V){return V[0]._private.nodeKey},f=function(V){return V[0]._private.labelStyleKey},g=function(V){return V[0]._private.sourceLabelStyleKey},v=function(V){return V[0]._private.targetLabelStyleKey},y=function(V,O,q,Q,ee){return t.drawElement(V,O,q,!1,!1,ee)},m=function(V,O,q,Q,ee){return t.drawElementText(V,O,q,Q,"main",ee)},b=function(V,O,q,Q,ee){return t.drawElementText(V,O,q,Q,"source",ee)},w=function(V,O,q,Q,ee){return t.drawElementText(V,O,q,Q,"target",ee)},k=function(V){return V.boundingBox(),V[0]._private.bodyBounds},E=function(V){return V.boundingBox(),V[0]._private.labelBounds.main||d},x=function(V){return V.boundingBox(),V[0]._private.labelBounds.source||d},C=function(V){return V.boundingBox(),V[0]._private.labelBounds.target||d},S=function(V,O){return O},T=function(V){return{x:((O=k(V)).x1+O.x2)/2,y:(O.y1+O.y2)/2};var O},D=function(V,O,q){var Q=V?V+"-":"";return{x:O.x+q.pstyle(Q+"text-margin-x").pfValue,y:O.y+q.pstyle(Q+"text-margin-y").pfValue}},A=function(V,O,q){var Q=V[0]._private.rscratch;return{x:Q[O],y:Q[q]}},B=function(V){return D("",A(V,"labelX","labelY"),V)},M=function(V){return D("source",A(V,"sourceLabelX","sourceLabelY"),V)},L=function(V){return D("target",A(V,"targetLabelX","targetLabelY"),V)},I=function(V){return h(k(V))},_=function(V){return h(x(V))},R=function(V){return h(C(V))},F=function(V){var O=E(V),q=h(E(V));if(V.isNode()){switch(V.pstyle("text-halign").value){case"left":q.x=-O.w-(O.leftPad||0);break;case"right":q.x=-(O.rightPad||0)}switch(V.pstyle("text-valign").value){case"top":q.y=-O.h-(O.topPad||0);break;case"bottom":q.y=-(O.botPad||0)}}return q},z=t.data.eleTxrCache=new hr(t,{getKey:p,doesEleInvalidateKey:function(V){var O=V[0]._private;return O.oldBackgroundTimestamp!==O.backgroundTimestamp},drawElement:y,getBoundingBox:k,getRotationPoint:T,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),Y=t.data.lblTxrCache=new hr(t,{getKey:f,drawElement:m,getBoundingBox:E,getRotationPoint:B,getRotationOffset:F,isVisible:S}),W=t.data.slbTxrCache=new hr(t,{getKey:g,drawElement:b,getBoundingBox:x,getRotationPoint:M,getRotationOffset:_,isVisible:S}),Z=t.data.tlbTxrCache=new hr(t,{getKey:v,drawElement:w,getBoundingBox:C,getRotationPoint:L,getRotationOffset:R,isVisible:S}),G=t.data.lyrTxrCache=new Ac(t);t.onUpdateEleCalcs(function(V,O){z.invalidateElements(O),Y.invalidateElements(O),W.invalidateElements(O),Z.invalidateElements(O),G.invalidateElements(O);for(var q=0;q<O.length;q++){var Q=O[q]._private;Q.oldBackgroundTimestamp=Q.backgroundTimestamp}});var $=function(V){for(var O=0;O<V.length;O++)G.enqueueElementRefinement(V[O].ele)};z.onDequeue($),Y.onDequeue($),W.onDequeue($),Z.onDequeue($),e.webgl&&t.initWebgl(e,{getStyleKey:p,getLabelKey:f,getSourceLabelKey:g,getTargetLabelKey:v,drawElement:y,drawLabel:m,drawSourceLabel:b,drawTargetLabel:w,getElementBox:k,getLabelBox:E,getSourceLabelBox:x,getTargetLabelBox:C,getElementRotationPoint:T,getElementRotationOffset:I,getLabelRotationPoint:B,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:L,getLabelRotationOffset:F,getSourceLabelRotationOffset:_,getTargetLabelRotationOffset:R})}me.CANVAS_LAYERS=3,me.SELECT_BOX=0,me.DRAG=1,me.NODE=2,me.WEBGL=3,me.CANVAS_TYPES=["2d","2d","2d","webgl2"],me.BUFFER_COUNT=3,me.TEXTURE_BUFFER=0,me.MOTIONBLUR_BUFFER_NODE=1,me.MOTIONBLUR_BUFFER_DRAG=2,me.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[me.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[me.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[me.SELECT_BOX]=t;break;case"gc":n.data.gc=!0}};var Mp=typeof Path2D<"u";me.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},me.usePaths=function(){return Mp&&this.pathsEnabled},me.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},me.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},me.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>"u"?"undefined":qe(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[Nc,Ln,$t,bp,un,cn,at,Hc,Zc,gr,Dp].forEach(function(e){pe(me,e)});var Ip=[{type:"layout",extensions:Zf},{type:"renderer",extensions:[{name:"null",impl:dc},{name:"base",impl:_c},{name:"canvas",impl:Ap}]}],rd={},ad={};function id(e,t,n){var r=n,a=function(E){ke("Can not register `"+t+"` for `"+e+"` since `"+E+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(ur.prototype[t])return a(t);ur.prototype[t]=n}else if(e==="collection"){if(Ze.prototype[t])return a(t);Ze.prototype[t]=n}else if(e==="layout"){for(var i=function(E){this.options=E,n.call(this,E),xe(this._private)||(this._private={}),this._private.cy=E.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var E=this.options;if(E&&E.animate){var x=this.animations;if(x)for(var C=0;C<x.length;C++)x[C].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var d=function(E){return E._private.cy},h={addEventFields:function(E,x){x.layout=E,x.cy=d(E),x.target=E},bubble:function(){return!0},parent:function(E){return d(E)}};pe(o,{createEmitter:function(){return this._private.emitter=new Zr(h,this),this},emitter:function(){return this._private.emitter},on:function(E,x){return this.emitter().on(E,x),this},one:function(E,x){return this.emitter().one(E,x),this},once:function(E,x){return this.emitter().one(E,x),this},removeListener:function(E,x){return this.emitter().removeListener(E,x),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(E,x){return this.emitter().emit(E,x),this}}),Te.eventAliasesOn(o),r=i}else if(e==="renderer"&&t!=="null"&&t!=="base"){var p=od("renderer","base"),f=p.prototype,g=n,v=n.prototype,y=function(){p.apply(this,arguments),g.apply(this,arguments)},m=y.prototype;for(var b in f){var w=f[b];if(v[b]!=null)return a(b);m[b]=w}for(var k in v)m[k]=v[k];f.clientFunctions.forEach(function(E){m[E]=m[E]||function(){Ie("Renderer does not implement `renderer."+E+"()` on its prototype")}}),r=y}else if(e==="__proto__"||e==="constructor"||e==="prototype")return Ie(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return qo({map:rd,keys:[e,t],value:r})}function od(e,t){return Xo({map:rd,keys:[e,t]})}function Np(e,t,n,r,a){return qo({map:ad,keys:[e,t,n,r],value:a})}function Rp(e,t,n,r){return Xo({map:ad,keys:[e,t,n,r]})}var eo=function(){return arguments.length===2?od.apply(null,arguments):arguments.length===3?id.apply(null,arguments):arguments.length===4?Rp.apply(null,arguments):arguments.length===5?Np.apply(null,arguments):void Ie("Invalid extension access syntax")};ur.prototype.extension=eo,Ip.forEach(function(e){e.extensions.forEach(function(t){id(e.type,t.name,t.impl)})});var fa=function(){if(!(this instanceof fa))return new fa;this.length=0},hn=fa.prototype;hn.instanceString=function(){return"stylesheet"},hn.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},hn.css=function(e,t){var n=this.length-1;if(fe(e))this[n].properties.push({name:e,value:t});else if(xe(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var o=a[i],s=r[o];if(s!=null){var l=Ge.properties[o]||Ge.properties[br(o)];if(l!=null){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},hn.style=hn.css,hn.generateStyle=function(e){var t=new Ge(e);return this.appendToStyle(t)},hn.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var o=a[i];e.css(o.name,o.value)}}return e};var fn=function(e){return e===void 0&&(e={}),xe(e)?new ur(e):fe(e)?eo.apply(eo,arguments):void 0};fn.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(fn),e.apply(null,t),this},fn.warnings=function(e){return $o(e)},fn.version="3.32.1",fn.stylesheet=fn.Stylesheet=fa;export{fn as c};
|