@layers-app/editor 0.1.12 → 0.1.13
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/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/{layers.kn67NfTr.js → layers.-8ozJFby.js} +1 -1
- package/dist/layers.0a8C9Zft.js +122 -0
- package/dist/{layers.Du654JPO.js → layers.19mmJqf_.js} +1 -1
- package/dist/{layers.JQi2e0Sn.js → layers.1JGGzMhf.js} +4 -4
- package/dist/{layers.EZ7vo-Fr.js → layers.2EYvILXt.js} +1 -1
- package/dist/{layers.B4CnR_QW.js → layers.3-u8XGDF.js} +1 -1
- package/dist/{layers.CvesdHOP.js → layers.6aHDNB7c.js} +3 -3
- package/dist/{layers.D3Pz_A_F.js → layers.7dxWyzAI.js} +1 -1
- package/dist/{layers.vl392NTk.js → layers.9qzXGVGI.js} +1 -1
- package/dist/{layers.CYO9fhOp.js → layers.A6CwFqax.js} +1 -1
- package/dist/{layers._OiP7IIU.js → layers.AiZCmV1t.js} +17 -19
- package/dist/{layers.LeuVgTD-.js → layers.B3-SuxGb.js} +1 -1
- package/dist/{layers.Dz3J5hzF.js → layers.B4-oO3lA.js} +1 -1
- package/dist/{layers.aNnytiDp.js → layers.B4Zi6bAp.js} +1 -1
- package/dist/{layers.pRnEgMyY.js → layers.B652NYpW.js} +1 -1
- package/dist/{layers.C7NWP0wD.js → layers.B8HLz9Gw.js} +1 -1
- package/dist/{layers.DqM2yzg7.js → layers.BAnqoHSH.js} +3 -3
- package/dist/{layers.hzw8K75g.js → layers.BBJgBv_q.js} +1 -1
- package/dist/{layers.KwUaUMcI.js → layers.BBPtcI0m.js} +1 -1
- package/dist/{layers.DUXwwMq0.js → layers.BCQ7o7Ii.js} +1 -1
- package/dist/{layers.sLeVri9t.js → layers.BCYP5AmP.js} +2 -2
- package/dist/{layers.DD04d8I3.js → layers.BDgZBQ-4.js} +1 -1
- package/dist/{layers.eU7STAP5.js → layers.BGY9VSLU.js} +1 -1
- package/dist/{layers.Bf4saA_r.js → layers.BHvavGY0.js} +1 -1
- package/dist/{layers.DJG_ZlHx.js → layers.BIiThTlS.js} +1 -1
- package/dist/{layers.Dz3LeR0p.js → layers.BJtdxspq.js} +1 -1
- package/dist/{layers.cPmNsT8F.js → layers.BM0tE40L.js} +1 -1
- package/dist/{layers.Iae6Qz-B.js → layers.BMeMRR_7.js} +1 -1
- package/dist/{layers.7bCZ86wN.js → layers.BNkn5eTg.js} +3 -3
- package/dist/{layers.BYzN4Zxz.js → layers.BODaZCcU.js} +1 -1
- package/dist/{layers.BNaOwJsO.js → layers.BPlAQzIG.js} +1 -1
- package/dist/{layers.DAnJoJqF.js → layers.BTBcJpds.js} +1 -1
- package/dist/{layers.DdlWqFWF.js → layers.BTCkEPVx.js} +3 -3
- package/dist/{layers.C9-kVrih.js → layers.BTZQp9oo.js} +1 -1
- package/dist/{layers.C5c_91gJ.js → layers.BU6JCK-A.js} +1 -1
- package/dist/{layers.DoBG7rdV.js → layers.BWGAXC9K.js} +2 -2
- package/dist/{layers.Da9w6_yz.js → layers.BXhHLv0m.js} +1 -1
- package/dist/{layers.Db6HDv4n.js → layers.BXxAZ6eZ.js} +5 -5
- package/dist/{layers.TT-kIfaa.js → layers.BY9STrtF.js} +43 -75
- package/dist/{layers.BzRwdPvh.js → layers.BYQv4PoF.js} +1 -1
- package/dist/{layers.DUbZmysc.js → layers.B_YjqyZM.js} +1 -1
- package/dist/{layers.CAZ7UyvV.js → layers.BbvUwQN-.js} +1 -1
- package/dist/{layers.Dgqz1o4e.js → layers.BcXRskzs.js} +1 -1
- package/dist/{layers.WrPlqard.js → layers.Bckxq5G5.js} +1 -1
- package/dist/{layers.IcgJ0zx2.js → layers.BdN3kctN.js} +2 -2
- package/dist/{layers.B1XGjt8P.js → layers.Bda5e9AQ.js} +1 -1
- package/dist/{layers.Cp7O-u4F.js → layers.Be2Ck524.js} +1 -1
- package/dist/{layers.9wTErTeV.js → layers.Bee-635c.js} +1 -1
- package/dist/{layers.DOPvMlyj.js → layers.Bg6r8fzJ.js} +7771 -7675
- package/dist/{layers.B7awqf1H.js → layers.Bg7nx_wm.js} +1 -1
- package/dist/{layers.CDfW27iI.js → layers.BgDUUozo.js} +1 -1
- package/dist/{layers.BKB3rTgB.js → layers.BgjIbjvn.js} +1 -1
- package/dist/{layers.DGzJNKo0.js → layers.BhnKRl71.js} +1 -1
- package/dist/{layers.NGecVmKn.js → layers.Birn4U_E.js} +2 -2
- package/dist/{layers.bdWGFjU0.js → layers.BnkLNnRS.js} +1 -1
- package/dist/{layers.Br5m0AIW.js → layers.BohLNJyh.js} +1 -1
- package/dist/{layers.tk4U7Wl-.js → layers.Boz0_eCV.js} +4 -4
- package/dist/{layers.DJ_jaz9t.js → layers.BqRC9FDT.js} +1 -1
- package/dist/{layers.CaDRKpkb.js → layers.BtJNMgdw.js} +1 -1
- package/dist/{layers.C4cjD21n.js → layers.BtzjCPBp.js} +1 -1
- package/dist/{layers.Dic9pGPA.js → layers.Bwnuq7nQ.js} +1 -1
- package/dist/{layers.DFDP3mZl.js → layers.BxaaoprN.js} +6 -6
- package/dist/{layers.Cp3XM5-U.js → layers.C-zpSFVR.js} +2681 -2668
- package/dist/{layers.C21uwaco.js → layers.C0ZNvKnw.js} +3 -3
- package/dist/{layers.FNpY0F1T.js → layers.C0z5XTe3.js} +2 -2
- package/dist/{layers.DyeRF_42.js → layers.C3Rw22vq.js} +1 -1
- package/dist/{layers.B2iryXmh.js → layers.C8aU0fuX.js} +5 -5
- package/dist/{layers.f8EALD8R.js → layers.C96P7ByS.js} +1 -1
- package/dist/{layers.Du3ZioZb.js → layers.CAlaIK4g.js} +5159 -4864
- package/dist/{layers.BbjW_pSS.js → layers.CBMxeBAj.js} +1 -1
- package/dist/{layers.Zh8r_asA.js → layers.CBsMBmYD.js} +1 -1
- package/dist/{layers.Dqt-xiXH.js → layers.CDMIJNp0.js} +4 -4
- package/dist/{layers.dxnA0WtS.js → layers.CDMuBa-_.js} +1 -1
- package/dist/{layers.C-S4ZGYk.js → layers.CE7BbMqo.js} +1 -1
- package/dist/{layers.CMQhgKMd.js → layers.CF8NS6oi.js} +1 -1
- package/dist/{layers.DwtJ4y_y.js → layers.CGJ5782E.js} +1 -1
- package/dist/{layers.DvJUcJIt.js → layers.CGt6y9i1.js} +1 -1
- package/dist/{layers.BgZMu6hT.js → layers.CIW-XUuZ.js} +1 -1
- package/dist/{layers.U2Iq8bQF.js → layers.CIa29KT0.js} +3 -3
- package/dist/{layers.DKYaXFCL.js → layers.CIjHEYBA.js} +1 -1
- package/dist/{layers.eInYScnA.js → layers.CJzMrG8C.js} +1 -1
- package/dist/{layers.BnhdX_Gr.js → layers.CN7IbcHS.js} +1 -1
- package/dist/{layers.CEXMiim9.js → layers.CND5HRfD.js} +1 -1
- package/dist/layers.CPCPMf-n.js +425 -0
- package/dist/{layers.BKFCt7JF.js → layers.CPPldYyg.js} +1 -1
- package/dist/{layers.B7ojLq6X.js → layers.CPpPlhrv.js} +1 -1
- package/dist/{layers.CK9jvvfs.js → layers.CR9P_Wab.js} +1 -1
- package/dist/{layers.BIoW2iNY.js → layers.C_esePfU.js} +1 -1
- package/dist/{layers.ih094nJV.js → layers.CbRH8a1j.js} +1 -1
- package/dist/{layers.CKXKiM4J.js → layers.Cc9_uswB.js} +1 -1
- package/dist/{layers.BNESMj3W.js → layers.CcbXL-g0.js} +1 -1
- package/dist/{layers.oN-8PMDY.js → layers.CeLePfgw.js} +1 -1
- package/dist/{layers.BTN9bj5-.js → layers.CeTac4CM.js} +1 -1
- package/dist/{layers.BPsBf3N1.js → layers.CfftxiYQ.js} +1 -1
- package/dist/{layers.RG5YAHea.js → layers.CghqCGMj.js} +3 -3
- package/dist/{layers._sCiRod3.js → layers.CnxecNk3.js} +1 -1
- package/dist/{layers.CApH31I7.js → layers.CoLyX3cX.js} +1 -1
- package/dist/{layers.i5MIbxTw.js → layers.CosyX26h.js} +4 -4
- package/dist/{layers.xbDJKMJa.js → layers.CqBNKg1S.js} +1 -1
- package/dist/{layers.BXj3OW-q.js → layers.CtL-9vEe.js} +2 -2
- package/dist/{layers.Cs7P01Uj.js → layers.CuRCmFlG.js} +1 -1
- package/dist/{layers.Dh80T4O1.js → layers.Cutc8HGZ.js} +1 -1
- package/dist/{layers.CYKhk0AF.js → layers.CvYZ3Ml3.js} +1 -1
- package/dist/{layers.BPVpukLj.js → layers.CwiZjTm-.js} +1 -1
- package/dist/{layers.BCZ_N83J.js → layers.CxEwXVOv.js} +2 -2
- package/dist/{layers.DA7paZC8.js → layers.CxnZi5RE.js} +1 -1
- package/dist/{layers.CgenFPuB.js → layers.CxtZWeuV.js} +1 -1
- package/dist/{layers.QeSB1vA6.js → layers.D0Rf3aJ-.js} +1 -1
- package/dist/{layers.BMRrvrE1.js → layers.D2Uo-C7N.js} +1 -1
- package/dist/{layers.BKlYBG9o.js → layers.D2zV6Hs3.js} +4 -4
- package/dist/{layers.C1aDn32T.js → layers.D3DLBgXE.js} +1 -1
- package/dist/{layers.CK3zI5wN.js → layers.D4-DXCNF.js} +1 -1
- package/dist/{layers.D3Ye17O-.js → layers.D4V3f7yA.js} +1 -1
- package/dist/{layers.BCnB6Y3Z.js → layers.DC6HU378.js} +1 -1
- package/dist/{layers.BgH4LCNP.js → layers.DCPUlpdn.js} +1 -1
- package/dist/{layers.CpFmgr19.js → layers.DD2krz5y.js} +1 -1
- package/dist/{layers.DWqEU9Pw.js → layers.DEKPybEs.js} +1 -1
- package/dist/{layers.DRLbLTQa.js → layers.DEj29MTi.js} +1 -1
- package/dist/{layers.C264v0LV.js → layers.DGdBr7uj.js} +1 -1
- package/dist/layers.DGuY7xbb.js +1 -0
- package/dist/{layers.DtlgBoJC.js → layers.DI1lAVVv.js} +1 -1
- package/dist/{layers.197alAI6.js → layers.DIe4Alc_.js} +1 -1
- package/dist/{layers.DE6MeapO.js → layers.DIo0xwQy.js} +1 -1
- package/dist/{layers.xJRhEJ9l.js → layers.DK6yd1-9.js} +1 -1
- package/dist/{layers.DWsBJ8ZT.js → layers.DKdWbzyN.js} +1 -1
- package/dist/{layers.e4fN_CoR.js → layers.DN5Stdkb.js} +1 -1
- package/dist/{layers.C6XwSpkg.js → layers.DNMLA5Sx.js} +1 -1
- package/dist/{layers.COoXvS-3.js → layers.DOjjOYR5.js} +1 -1
- package/dist/{layers.DrxiMlj-.js → layers.DOzqMf1G.js} +1 -1
- package/dist/{layers.DlanFkrr.js → layers.DPMYxiqL.js} +1 -1
- package/dist/{layers.B6IQvTW_.js → layers.DPuJvUib.js} +1 -1
- package/dist/layers.DQVuWa5Q.js +6 -0
- package/dist/{layers.C2MtkXTH.js → layers.DQnqyzR9.js} +1 -1
- package/dist/{layers.DkXgdSMl.js → layers.DTllXvuC.js} +1 -1
- package/dist/{layers.bfOfAYS4.js → layers.DTmYwjyy.js} +1 -1
- package/dist/{layers.CN_kKE5z.js → layers.DY_wJQVR.js} +1 -1
- package/dist/{layers.C2P8nxlh.js → layers.DZ4WCe8O.js} +3 -3
- package/dist/{layers.CLmgC3Un.js → layers.DZfI1rN4.js} +1 -1
- package/dist/layers.Da3yMH0i.js +8 -0
- package/dist/{layers.VA3vMgv8.js → layers.DaVXXzoo.js} +4 -4
- package/dist/{layers.BhRwOaKW.js → layers.DbaavSRn.js} +1 -1
- package/dist/{layers.ZRbLAD0j.js → layers.DgU9MEqO.js} +1 -1
- package/dist/layers.DgzTNF3O.js +1 -0
- package/dist/{layers.CCE6Ftvg.js → layers.Dhvfy7v8.js} +1 -1
- package/dist/{layers.CsIirSC8.js → layers.DiROAWaO.js} +1 -1
- package/dist/{layers.BNEQdrCL.js → layers.DlBMaMjv.js} +1 -1
- package/dist/{layers.ysBdu4Ft.js → layers.DlChl8Ap.js} +1 -1
- package/dist/{layers.BkigPg6q.js → layers.DmT8LYxt.js} +1 -1
- package/dist/{layers.C_koAla7.js → layers.DmWyJHQy.js} +1 -1
- package/dist/{layers.CZeXtbW9.js → layers.Dn0fqOqc.js} +10783 -10883
- package/dist/{layers.CRBfcMKc.js → layers.Dn8vNFNI.js} +1 -1
- package/dist/{layers.BZXVPEaN.js → layers.DqRbwQzq.js} +2 -2
- package/dist/{layers.3zVZltRF.js → layers.DqyNPRwZ.js} +1 -1
- package/dist/{layers.DtJQ9d7w.js → layers.DsFiy5Mq.js} +1 -1
- package/dist/{layers.BqPmDFz9.js → layers.Dskk8uhq.js} +1 -1
- package/dist/{layers.BiOkAykf.js → layers.DtSu_PeO.js} +1 -1
- package/dist/{layers.el0isiBs.js → layers.DuYmhH5M.js} +1 -1
- package/dist/{layers.CVt5xL4L.js → layers.Dv2kCAsV.js} +1 -1
- package/dist/{layers.X555Jd8l.js → layers.DvJhatBC.js} +1 -1
- package/dist/{layers.C_j9xfJx.js → layers.Dwyl9amn.js} +1 -1
- package/dist/{layers.BVNH9djK.js → layers.DxemEukt.js} +1 -1
- package/dist/{layers.OoBTPry5.js → layers.Dy8J3Ujf.js} +21 -23
- package/dist/{layers.x6Ic89sI.js → layers.Dz-m64Mp.js} +1 -1
- package/dist/{layers.DB2TqdoC.js → layers.DzE7WF3u.js} +1 -1
- package/dist/{layers.DOJ-bBTv.js → layers.GEGEzqF_.js} +1 -1
- package/dist/{layers.CGibuOu1.js → layers.Hfqhe0bh.js} +1 -1
- package/dist/{layers.D4HJ2im1.js → layers.In6Zis7V.js} +1 -1
- package/dist/{layers.cx9rUeHi.js → layers.InXGwJxF.js} +1 -1
- package/dist/{layers.BhZFBNiX.js → layers.LhUrSJE-.js} +1 -1
- package/dist/{layers.CXXeyS7B.js → layers.Lpr7GhOx.js} +1 -1
- package/dist/{layers.wf4VU0f0.js → layers.M1sws39F.js} +1 -1
- package/dist/{layers.De88sXC7.js → layers.OkwrDQA6.js} +2 -2
- package/dist/{layers.BIDnkNut.js → layers.OwyTRmnO.js} +1 -1
- package/dist/{layers.ClTg0VrU.js → layers.SIchF2O9.js} +1 -1
- package/dist/layers.V0hm-Byb.js +96 -0
- package/dist/{layers.4nvYTrtC.js → layers.V4CP7lwj.js} +1 -1
- package/dist/{layers.JrJLU8St.js → layers.VHlimcDq.js} +1 -1
- package/dist/{layers.BcfuznMe.js → layers.WQyoC9Vd.js} +1 -1
- package/dist/{layers.DGwJBWTE.js → layers.WvG1ZdSk.js} +1 -1
- package/dist/{layers.CZlsuoCH.js → layers.XTFl94zy.js} +1 -1
- package/dist/{layers.D3rTSZfp.js → layers.ZDUujT6N.js} +1 -1
- package/dist/{layers.DphdL73z.js → layers._f7UqGgM.js} +1 -1
- package/dist/{layers.DkxZkeYT.js → layers.a-bPoAhB.js} +4 -4
- package/dist/{layers.CLmN3_ZX.js → layers.aJXStXGb.js} +4 -4
- package/dist/{layers.DjliO2u2.js → layers.aScqxyRN.js} +1 -1
- package/dist/{layers.BWf8rUtM.js → layers.biHTnLuV.js} +1 -1
- package/dist/{layers.Sayl3Apc.js → layers.bpk5iC3D.js} +1 -1
- package/dist/{layers.3p_um1MY.js → layers.dhoRXoOW.js} +1 -1
- package/dist/{layers.6VVx8sHs.js → layers.dsTwBrI5.js} +4 -4
- package/dist/{layers.BTN9QAq_.js → layers.fO-Q1dHY.js} +1 -1
- package/dist/{layers.DGtA69cS.js → layers.gdQbR2q3.js} +1 -1
- package/dist/{layers.kRZbLakW.js → layers.hFNRNmpd.js} +1 -1
- package/dist/{layers.BXE4wxph.js → layers.i_Y8A9zA.js} +1 -1
- package/dist/{layers.D6lgbf5a.js → layers.jar3pxQU.js} +1 -1
- package/dist/{layers.DmJCPHmT.js → layers.lpLb-e0Q.js} +1 -1
- package/dist/{layers.BjIsWtty.js → layers.nPPBewJZ.js} +1 -1
- package/dist/{layers.B_V4JEWo.js → layers.o0uSpL2s.js} +1 -1
- package/dist/{layers.CIqC8aLN.js → layers.qz45Ugdq.js} +2 -2
- package/dist/{layers.oLTdz10g.js → layers.sav0hmWq.js} +1 -1
- package/dist/{layers.-qshpEz8.js → layers.shpZsYlJ.js} +3 -3
- package/dist/{layers.CtK_Moz1.js → layers.uYOSpoyV.js} +1 -1
- package/dist/{layers.C7G535jo.js → layers.v50r3PAk.js} +1 -1
- package/dist/{layers.cyX61Kdw.js → layers.x4J9FdT3.js} +72 -40
- package/dist/{layers.BVjUhCBI.js → layers.zZvuba7q.js} +1 -1
- package/package.json +18 -4
- package/dist/layers.BtwxaUEu.js +0 -1
- package/dist/layers.CuwyL41b.js +0 -1
- package/dist/layers.D-SZikYp.js +0 -8
- package/dist/layers.D6uy25MB.js +0 -122
- package/dist/layers.DPURQN4q.js +0 -96
- package/dist/layers.DxAe7GMj.js +0 -425
- package/dist/layers.s5pjTDTQ.js +0 -6
package/dist/layers.DxAe7GMj.js
DELETED
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ue=require("./layers.DPURQN4q.js"),iv=require("./layers.TT-kIfaa.js"),sv=require("./layers.eInYScnA.js");require("./layers.cyX61Kdw.js");function Ms(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function ov(r){if(Array.isArray(r))return r}function uv(r){if(Array.isArray(r))return Ms(r)}function dr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function lv(r,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,nf(a.key),a)}}function gr(r,e,t){return e&&lv(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function St(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Js(r))||e){t&&(r=t);var a=0,n=function(){};return{s:n,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(u){throw u},f:n}}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,s=!0,o=!1;return{s:function(){t=t.call(r)},n:function(){var u=t.next();return s=u.done,u},e:function(u){o=!0,i=u},f:function(){try{s||t.return==null||t.return()}finally{if(o)throw i}}}}function af(r,e,t){return(e=nf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fv(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function cv(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a,n,i,s,o=[],u=!0,l=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(a=i.call(t)).done)&&(o.push(a.value),o.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(l)throw n}}return o}}function vv(){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 hv(){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 et(r,e){return ov(r)||cv(r,e)||Js(r,e)||vv()}function xn(r){return uv(r)||fv(r)||Js(r)||hv()}function dv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function nf(r){var e=dv(r,"string");return typeof e=="symbol"?e:e+""}function at(r){"@babel/helpers - typeof";return at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(r)}function Js(r,e){if(r){if(typeof r=="string")return Ms(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ms(r,e):void 0}}var je=typeof window>"u"?null:window,Ro=je?je.navigator:null;je&&je.document;var gv=at(""),sf=at({}),pv=at(function(){}),yv=typeof HTMLElement>"u"?"undefined":at(HTMLElement),Pa=function(e){return e&&e.instanceString&&Ye(e.instanceString)?e.instanceString():null},ce=function(e){return e!=null&&at(e)==gv},Ye=function(e){return e!=null&&at(e)===pv},_e=function(e){return!Lt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Re=function(e){return e!=null&&at(e)===sf&&!_e(e)&&e.constructor===Object},mv=function(e){return e!=null&&at(e)===sf},ae=function(e){return e!=null&&at(e)===at(1)&&!isNaN(e)},bv=function(e){return ae(e)&&Math.floor(e)===e},Tn=function(e){if(yv!=="undefined")return e!=null&&e instanceof HTMLElement},Lt=function(e){return Na(e)||of(e)},Na=function(e){return Pa(e)==="collection"&&e._private.single},of=function(e){return Pa(e)==="collection"&&!e._private.single},js=function(e){return Pa(e)==="core"},uf=function(e){return Pa(e)==="stylesheet"},wv=function(e){return Pa(e)==="event"},or=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Ev=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},xv=function(e){return Re(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},Tv=function(e){return mv(e)&&Ye(e.then)},Cv=function(){return Ro&&Ro.userAgent.match(/msie|trident|edge/i)},Jr=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function(){var i=this,s=arguments,o,u=t.apply(i,s),l=a.cache;return(o=l[u])||(o=l[u]=e.apply(i,s)),o};return a.cache={},a},eo=Jr(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Bn=Jr(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),lf=Jr(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),Io=function(e){return or(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},rt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Dv="rgb[a]?\\(("+rt+"[%]?)\\s*,\\s*("+rt+"[%]?)\\s*,\\s*("+rt+"[%]?)(?:\\s*,\\s*("+rt+"))?\\)",Sv="rgb[a]?\\((?:"+rt+"[%]?)\\s*,\\s*(?:"+rt+"[%]?)\\s*,\\s*(?:"+rt+"[%]?)(?:\\s*,\\s*(?:"+rt+"))?\\)",Av="hsl[a]?\\(("+rt+")\\s*,\\s*("+rt+"[%])\\s*,\\s*("+rt+"[%])(?:\\s*,\\s*("+rt+"))?\\)",Lv="hsl[a]?\\((?:"+rt+")\\s*,\\s*(?:"+rt+"[%])\\s*,\\s*(?:"+rt+"[%])(?:\\s*,\\s*(?:"+rt+"))?\\)",Rv="\\#[0-9a-fA-F]{3}",Iv="\\#[0-9a-fA-F]{6}",ff=function(e,t){return e<t?-1:e>t?1:0},Mv=function(e,t){return-1*ff(e,t)},de=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var a=e[t];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];r[s]=a[s]}}return r},Ov=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,a,n,i,s=16;return t?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},Pv=function(e){var t,a,n,i,s,o,u,l;function f(d,p,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?d+(p-d)*6*g:g<1/2?p:g<2/3?d+(p-d)*(2/3-g)*6:d}var c=new RegExp("^"+Av+"$").exec(e);if(c){if(a=parseInt(c[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(c[2]),n<0||n>100||(n=n/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,s=c[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=u=l=Math.round(i*255);else{var v=i<.5?i*(1+n):i+n-i*n,h=2*i-v;o=Math.round(255*f(h,v,a+1/3)),u=Math.round(255*f(h,v,a)),l=Math.round(255*f(h,v,a-1/3))}t=[o,u,l,s]}return t},Nv=function(e){var t,a=new RegExp("^"+Dv+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}var o=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(o&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},kv=function(e){return Bv[e.toLowerCase()]},cf=function(e){return(_e(e)?e:null)||kv(e)||Ov(e)||Nv(e)||Pv(e)},Bv={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]},vf=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Re(s))throw Error("Tried to set map with object key");i<a.length-1?(t[s]==null&&(t[s]={}),t=t[s]):t[s]=e.value}},hf=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Re(s))throw Error("Tried to get map with object key");if(t=t[s],t==null)return t}return t},Wa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ka(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ri,Mo;function Ba(){if(Mo)return ri;Mo=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return ri=r,ri}var ai,Oo;function Fv(){if(Oo)return ai;Oo=1;var r=typeof Wa=="object"&&Wa&&Wa.Object===Object&&Wa;return ai=r,ai}var ni,Po;function Fn(){if(Po)return ni;Po=1;var r=Fv(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return ni=t,ni}var ii,No;function _v(){if(No)return ii;No=1;var r=Fn(),e=function(){return r.Date.now()};return ii=e,ii}var si,ko;function Gv(){if(ko)return si;ko=1;var r=/\s/;function e(t){for(var a=t.length;a--&&r.test(t.charAt(a)););return a}return si=e,si}var oi,Bo;function zv(){if(Bo)return oi;Bo=1;var r=Gv(),e=/^\s+/;function t(a){return a&&a.slice(0,r(a)+1).replace(e,"")}return oi=t,oi}var ui,Fo;function to(){if(Fo)return ui;Fo=1;var r=Fn(),e=r.Symbol;return ui=e,ui}var li,_o;function Vv(){if(_o)return li;_o=1;var r=to(),e=Object.prototype,t=e.hasOwnProperty,a=e.toString,n=r?r.toStringTag:void 0;function i(s){var o=t.call(s,n),u=s[n];try{s[n]=void 0;var l=!0}catch{}var f=a.call(s);return l&&(o?s[n]=u:delete s[n]),f}return li=i,li}var fi,Go;function Uv(){if(Go)return fi;Go=1;var r=Object.prototype,e=r.toString;function t(a){return e.call(a)}return fi=t,fi}var ci,zo;function df(){if(zo)return ci;zo=1;var r=to(),e=Vv(),t=Uv(),a="[object Null]",n="[object Undefined]",i=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?n:a:i&&i in Object(o)?e(o):t(o)}return ci=s,ci}var vi,Vo;function qv(){if(Vo)return vi;Vo=1;function r(e){return e!=null&&typeof e=="object"}return vi=r,vi}var hi,Uo;function Fa(){if(Uo)return hi;Uo=1;var r=df(),e=qv(),t="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&r(n)==t}return hi=a,hi}var di,qo;function Hv(){if(qo)return di;qo=1;var r=zv(),e=Ba(),t=Fa(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=r(l);var c=i.test(l);return c||s.test(l)?o(l.slice(2),c?2:8):n.test(l)?a:+l}return di=u,di}var gi,Ho;function Yv(){if(Ho)return gi;Ho=1;var r=Ba(),e=_v(),t=Hv(),a="Expected a function",n=Math.max,i=Math.min;function s(o,u,l){var f,c,v,h,d,p,g=0,y=!1,b=!1,m=!0;if(typeof o!="function")throw new TypeError(a);u=t(u)||0,r(l)&&(y=!!l.leading,b="maxWait"in l,v=b?n(t(l.maxWait)||0,u):v,m="trailing"in l?!!l.trailing:m);function E(R){var I=f,O=c;return f=c=void 0,g=R,h=o.apply(O,I),h}function x(R){return g=R,d=setTimeout(T,u),y?E(R):h}function S(R){var I=R-p,O=R-g,N=u-I;return b?i(N,v-O):N}function w(R){var I=R-p,O=R-g;return p===void 0||I>=u||I<0||b&&O>=v}function T(){var R=e();if(w(R))return C(R);d=setTimeout(T,S(R))}function C(R){return d=void 0,m&&f?E(R):(f=c=void 0,h)}function D(){d!==void 0&&clearTimeout(d),g=0,f=p=c=d=void 0}function A(){return d===void 0?h:C(e())}function L(){var R=e(),I=w(R);if(f=arguments,c=this,p=R,I){if(d===void 0)return x(p);if(b)return clearTimeout(d),d=setTimeout(T,u),E(p)}return d===void 0&&(d=setTimeout(T,u)),h}return L.cancel=D,L.flush=A,L}return gi=s,gi}var $v=Yv(),_a=ka($v),pi=je?je.performance:null,gf=pi&&pi.now?function(){return pi.now()}:function(){return Date.now()},Xv=function(){if(je){if(je.requestAnimationFrame)return function(r){je.requestAnimationFrame(r)};if(je.mozRequestAnimationFrame)return function(r){je.mozRequestAnimationFrame(r)};if(je.webkitRequestAnimationFrame)return function(r){je.webkitRequestAnimationFrame(r)};if(je.msRequestAnimationFrame)return function(r){je.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(gf())},1e3/60)}}(),Cn=function(e){return Xv(e)},Qt=gf,Dr=9261,pf=65599,Hr=5381,yf=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dr,a=t,n;n=e.next(),!n.done;)a=a*pf+n.value|0;return a},Ta=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dr;return t*pf+e|0},Ca=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hr;return(t<<5)+t+e|0},Wv=function(e,t){return e*2097152+t},rr=function(e){return e[0]*2097152+e[1]},Ka=function(e,t){return[Ta(e[0],t[0]),Ca(e[1],t[1])]},Yo=function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return yf(s,t)},Lr=function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return yf(s,t)},mf=function(){return Kv(arguments)},Kv=function(e){for(var t,a=0;a<e.length;a++){var n=e[a];a===0?t=Lr(n):t=Lr(n,t)}return t},$o=!0,Zv=console.warn!=null,Qv=console.trace!=null,ro=Number.MAX_SAFE_INTEGER||9007199254740991,bf=function(){return!0},Dn=function(){return!1},Xo=function(){return 0},ao=function(){},He=function(e){throw new Error(e)},wf=function(e){if(e!==void 0)$o=!!e;else return $o},Pe=function(e){wf()&&(Zv?console.warn(e):(console.log(e),Qv&&console.trace()))},Jv=function(e){return de({},e)},qt=function(e){return e==null?e:_e(e)?e.slice():Re(e)?Jv(e):e},jv=function(e){return e.slice()},Ef=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},eh={},xf=function(){return eh},ht=function(e){var t=Object.keys(e);return function(a){for(var n={},i=0;i<t.length;i++){var s=t[i],o=a==null?void 0:a[s];n[s]=o===void 0?e[s]:o}return n}},ur=function(e,t,a){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},no=function(e){e.splice(0,e.length)},th=function(e,t){for(var a=0;a<t.length;a++){var n=t[a];e.push(n)}},Ct=function(e,t,a){return a&&(t=lf(a,t)),e[t]},Kt=function(e,t,a,n){a&&(t=lf(a,t)),e[t]=n},rh=function(){function r(){dr(this,r),this._obj={}}return gr(r,[{key:"set",value:function(t,a){return this._obj[t]=a,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}])}(),Zt=typeof Map<"u"?Map:rh,ah="undefined",nh=function(){function r(e){if(dr(this,r),this._obj=Object.create(null),this.size=0,e!=null){var t;e.instanceString!=null&&e.instanceString()===this.instanceString()?t=e.toArray():t=e;for(var a=0;a<t.length;a++)this.add(t[a])}}return gr(r,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var a=this._obj;a[t]!==1&&(a[t]=1,this.size++)}},{key:"delete",value:function(t){var a=this._obj;a[t]===1&&(a[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(a){return t.has(a)})}},{key:"forEach",value:function(t,a){return this.toArray().forEach(t,a)}}])}(),ra=(typeof Set>"u"?"undefined":at(Set))!==ah?Set:nh,_n=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!js(e)){He("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){He("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new ra,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),u=e.zoom();i.position={x:(s.x-o.x)/u,y:(s.y-o.y)/u}}var l=[];_e(t.classes)?l=t.classes:ce(t.classes)&&(l=t.classes.split(/\s+/));for(var f=0,c=l.length;f<c;f++){var v=l[f];!v||v===""||i.classes.add(v)}this.createEmitter(),(a===void 0||a)&&this.restore();var h=t.style||t.css;h&&(Pe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},Wo=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;Re(a)&&!Lt(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!Ye(n)?n:i,n=Ye(n)?n:function(){};for(var o=this._private.cy,u=a=ce(a)?this.filter(a):a,l=[],f=[],c={},v={},h={},d=0,p,g=this.byGroup(),y=g.nodes,b=g.edges,m=0;m<u.length;m++){var E=u[m],x=E.id();E.isNode()&&(l.unshift(E),e.bfs&&(h[x]=!0,f.push(E)),v[x]=0)}for(var S=function(){var R=e.bfs?l.shift():l.pop(),I=R.id();if(e.dfs){if(h[I])return 0;h[I]=!0,f.push(R)}var O=v[I],N=c[I],k=N!=null?N.source():null,P=N!=null?N.target():null,B=N==null?void 0:R.same(k)?P[0]:k[0],_;if(_=n(R,N,B,d++,O),_===!0)return p=R,1;if(_===!1)return 1;for(var F=R.connectedEdges().filter(function($){return(!i||$.source().same(R))&&b.has($)}),G=0;G<F.length;G++){var U=F[G],H=U.connectedNodes().filter(function($){return!$.same(R)&&y.has($)}),X=H.id();H.length!==0&&!h[X]&&(H=H[0],l.push(H),e.bfs&&(h[X]=!0,f.push(H)),c[X]=U,v[X]=v[I]+1)}},w;l.length!==0&&(w=S(),!(w!==0&&w===1)););for(var T=o.collection(),C=0;C<f.length;C++){var D=f[C],A=c[D.id()];A!=null&&T.push(A),T.push(D)}return{path:o.collection(T),found:o.collection(p)}}},Da={breadthFirstSearch:Wo({bfs:!0}),depthFirstSearch:Wo({dfs:!0})};Da.bfs=Da.breadthFirstSearch;Da.dfs=Da.depthFirstSearch;var un={exports:{}},ih=un.exports,Ko;function sh(){return Ko||(Ko=1,function(r,e){(function(){var t,a,n,i,s,o,u,l,f,c,v,h,d,p,g;n=Math.floor,c=Math.min,a=function(y,b){return y<b?-1:y>b?1:0},f=function(y,b,m,E,x){var S;if(m==null&&(m=0),x==null&&(x=a),m<0)throw new Error("lo must be non-negative");for(E==null&&(E=y.length);m<E;)S=n((m+E)/2),x(b,y[S])<0?E=S:m=S+1;return[].splice.apply(y,[m,m-m].concat(b)),b},o=function(y,b,m){return m==null&&(m=a),y.push(b),p(y,0,y.length-1,m)},s=function(y,b){var m,E;return b==null&&(b=a),m=y.pop(),y.length?(E=y[0],y[0]=m,g(y,0,b)):E=m,E},l=function(y,b,m){var E;return m==null&&(m=a),E=y[0],y[0]=b,g(y,0,m),E},u=function(y,b,m){var E;return m==null&&(m=a),y.length&&m(y[0],b)<0&&(E=[y[0],b],b=E[0],y[0]=E[1],g(y,0,m)),b},i=function(y,b){var m,E,x,S,w,T;for(b==null&&(b=a),S=(function(){T=[];for(var C=0,D=n(y.length/2);0<=D?C<D:C>D;0<=D?C++:C--)T.push(C);return T}).apply(this).reverse(),w=[],E=0,x=S.length;E<x;E++)m=S[E],w.push(g(y,m,b));return w},d=function(y,b,m){var E;if(m==null&&(m=a),E=y.indexOf(b),E!==-1)return p(y,0,E,m),g(y,E,m)},v=function(y,b,m){var E,x,S,w,T;if(m==null&&(m=a),x=y.slice(0,b),!x.length)return x;for(i(x,m),T=y.slice(b),S=0,w=T.length;S<w;S++)E=T[S],u(x,E,m);return x.sort(m).reverse()},h=function(y,b,m){var E,x,S,w,T,C,D,A,L;if(m==null&&(m=a),b*10<=y.length){if(S=y.slice(0,b).sort(m),!S.length)return S;for(x=S[S.length-1],D=y.slice(b),w=0,C=D.length;w<C;w++)E=D[w],m(E,x)<0&&(f(S,E,0,null,m),S.pop(),x=S[S.length-1]);return S}for(i(y,m),L=[],T=0,A=c(b,y.length);0<=A?T<A:T>A;0<=A?++T:--T)L.push(s(y,m));return L},p=function(y,b,m,E){var x,S,w;for(E==null&&(E=a),x=y[m];m>b;){if(w=m-1>>1,S=y[w],E(x,S)<0){y[m]=S,m=w;continue}break}return y[m]=x},g=function(y,b,m){var E,x,S,w,T;for(m==null&&(m=a),x=y.length,T=b,S=y[b],E=2*b+1;E<x;)w=E+1,w<x&&!(m(y[E],y[w])<0)&&(E=w),y[b]=y[E],b=E,E=2*b+1;return y[b]=S,p(y,T,b,m)},t=function(){y.push=o,y.pop=s,y.replace=l,y.pushpop=u,y.heapify=i,y.updateItem=d,y.nlargest=v,y.nsmallest=h;function y(b){this.cmp=b??a,this.nodes=[]}return y.prototype.push=function(b){return o(this.nodes,b,this.cmp)},y.prototype.pop=function(){return s(this.nodes,this.cmp)},y.prototype.peek=function(){return this.nodes[0]},y.prototype.contains=function(b){return this.nodes.indexOf(b)!==-1},y.prototype.replace=function(b){return l(this.nodes,b,this.cmp)},y.prototype.pushpop=function(b){return u(this.nodes,b,this.cmp)},y.prototype.heapify=function(){return i(this.nodes,this.cmp)},y.prototype.updateItem=function(b){return d(this.nodes,b,this.cmp)},y.prototype.clear=function(){return this.nodes=[]},y.prototype.empty=function(){return this.nodes.length===0},y.prototype.size=function(){return this.nodes.length},y.prototype.clone=function(){var b;return b=new y,b.nodes=this.nodes.slice(0),b},y.prototype.toArray=function(){return this.nodes.slice(0)},y.prototype.insert=y.prototype.push,y.prototype.top=y.prototype.peek,y.prototype.front=y.prototype.peek,y.prototype.has=y.prototype.contains,y.prototype.copy=y.prototype.clone,y}(),function(y,b){return r.exports=b()}(this,function(){return t})}).call(ih)}(un)),un.exports}var yi,Zo;function oh(){return Zo||(Zo=1,yi=sh()),yi}var uh=oh(),Ga=ka(uh),lh=ht({root:null,weight:function(e){return 1},directed:!1}),fh={dijkstra:function(e){if(!Re(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var a=lh(e),n=a.root,i=a.weight,s=a.directed,o=this,u=i,l=ce(n)?this.filter(n)[0]:n[0],f={},c={},v={},h=this.byGroup(),d=h.nodes,p=h.edges;p.unmergeBy(function(O){return O.isLoop()});for(var g=function(N){return f[N.id()]},y=function(N,k){f[N.id()]=k,b.updateItem(N)},b=new Ga(function(O,N){return g(O)-g(N)}),m=0;m<d.length;m++){var E=d[m];f[E.id()]=E.same(l)?0:1/0,b.push(E)}for(var x=function(N,k){for(var P=(s?N.edgesTo(k):N.edgesWith(k)).intersect(p),B=1/0,_,F=0;F<P.length;F++){var G=P[F],U=u(G);(U<B||!_)&&(B=U,_=G)}return{edge:_,dist:B}};b.size()>0;){var S=b.pop(),w=g(S),T=S.id();if(v[T]=w,w!==1/0)for(var C=S.neighborhood().intersect(d),D=0;D<C.length;D++){var A=C[D],L=A.id(),R=x(S,A),I=w+R.dist;I<g(A)&&(y(A,I),c[L]={node:S,edge:R.edge})}}return{distanceTo:function(N){var k=ce(N)?d.filter(N)[0]:N[0];return v[k.id()]},pathTo:function(N){var k=ce(N)?d.filter(N)[0]:N[0],P=[],B=k,_=B.id();if(k.length>0)for(P.unshift(k);c[_];){var F=c[_];P.unshift(F.edge),P.unshift(F.node),B=F.node,_=B.id()}return o.spawn(P)}}}},ch={kruskal:function(e){e=e||function(m){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,u=function(E){for(var x=0;x<s.length;x++){var S=s[x];if(S.has(E))return x}},l=0;l<i;l++)s[l]=this.spawn(a[l]);for(var f=n.sort(function(m,E){return e(m)-e(E)}),c=0;c<f.length;c++){var v=f[c],h=v.source()[0],d=v.target()[0],p=u(h),g=u(d),y=s[p],b=s[g];p!==g&&(o.merge(v),y.merge(b),s.splice(g,1))}return o}},vh=ht({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),hh={aStar:function(e){var t=this.cy(),a=vh(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,u=a.weight;n=t.collection(n)[0],i=t.collection(i)[0];var l=n.id(),f=i.id(),c={},v={},h={},d=new Ga(function(_,F){return v[_.id()]-v[F.id()]}),p=new ra,g={},y={},b=function(F,G){d.push(F),p.add(G)},m,E,x=function(){m=d.pop(),E=m.id(),p.delete(E)},S=function(F){return p.has(F)};b(n,l),c[l]=0,v[l]=s(n);for(var w=0;d.size()>0;){if(x(),w++,E===f){for(var T=[],C=i,D=f,A=y[D];T.unshift(C),A!=null&&T.unshift(A),C=g[D],C!=null;)D=C.id(),A=y[D];return{found:!0,distance:c[E],path:this.spawn(T),steps:w}}h[E]=!0;for(var L=m._private.edges,R=0;R<L.length;R++){var I=L[R];if(this.hasElementWithId(I.id())&&!(o&&I.data("source")!==E)){var O=I.source(),N=I.target(),k=O.id()!==E?O:N,P=k.id();if(this.hasElementWithId(P)&&!h[P]){var B=c[E]+u(I);if(!S(P)){c[P]=B,v[P]=B+s(k),b(k,P),g[P]=m,y[P]=I;continue}B<c[P]&&(c[P]=B,v[P]=B+s(k),g[P]=m,y[P]=I)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},dh=ht({weight:function(e){return 1},directed:!1}),gh={floydWarshall:function(e){for(var t=this.cy(),a=dh(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),u=o.nodes,l=o.edges,f=u.length,c=f*f,v=function(U){return u.indexOf(U)},h=function(U){return u[U]},d=new Array(c),p=0;p<c;p++){var g=p%f,y=(p-g)/f;y===g?d[p]=0:d[p]=1/0}for(var b=new Array(c),m=new Array(c),E=0;E<l.length;E++){var x=l[E],S=x.source()[0],w=x.target()[0];if(S!==w){var T=v(S),C=v(w),D=T*f+C,A=s(x);if(d[D]>A&&(d[D]=A,b[D]=C,m[D]=x),!i){var L=C*f+T;!i&&d[L]>A&&(d[L]=A,b[L]=T,m[L]=x)}}}for(var R=0;R<f;R++)for(var I=0;I<f;I++)for(var O=I*f+R,N=0;N<f;N++){var k=I*f+N,P=R*f+N;d[O]+d[P]<d[k]&&(d[k]=d[O]+d[P],b[k]=b[O])}var B=function(U){return(ce(U)?t.filter(U):U)[0]},_=function(U){return v(B(U))},F={distance:function(U,H){var X=_(U),$=_(H);return d[X*f+$]},path:function(U,H){var X=_(U),$=_(H),Q=h(X);if(X===$)return Q.collection();if(b[X*f+$]==null)return t.collection();var re=t.collection(),J=X,z;for(re.merge(Q);X!==$;)J=X,X=b[X*f+$],z=m[J*f+X],re.merge(z),re.merge(h(X));return re}};return F}},ph=ht({weight:function(e){return 1},directed:!1,root:null}),yh={bellmanFord:function(e){var t=this,a=ph(e),n=a.weight,i=a.directed,s=a.root,o=n,u=this,l=this.cy(),f=this.byGroup(),c=f.edges,v=f.nodes,h=v.length,d=new Zt,p=!1,g=[];s=l.collection(s)[0],c.unmergeBy(function(Ne){return Ne.isLoop()});for(var y=c.length,b=function(se){var oe=d.get(se.id());return oe||(oe={},d.set(se.id(),oe)),oe},m=function(se){return(ce(se)?l.$(se):se)[0]},E=function(se){return b(m(se)).dist},x=function(se){for(var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,ve=m(se),ge=[],he=ve;;){if(he==null)return t.spawn();var ye=b(he),we=ye.edge,Se=ye.pred;if(ge.unshift(he[0]),he.same(oe)&&ge.length>0)break;we!=null&&ge.unshift(we),he=Se}return u.spawn(ge)},S=0;S<h;S++){var w=v[S],T=b(w);w.same(s)?T.dist=0:T.dist=1/0,T.pred=null,T.edge=null}for(var C=!1,D=function(se,oe,ve,ge,he,ye){var we=ge.dist+ye;we<he.dist&&!ve.same(ge.edge)&&(he.dist=we,he.pred=se,he.edge=ve,C=!0)},A=1;A<h;A++){C=!1;for(var L=0;L<y;L++){var R=c[L],I=R.source(),O=R.target(),N=o(R),k=b(I),P=b(O);D(I,O,R,k,P,N),i||D(O,I,R,P,k,N)}if(!C)break}if(C)for(var B=[],_=0;_<y;_++){var F=c[_],G=F.source(),U=F.target(),H=o(F),X=b(G).dist,$=b(U).dist;if(X+H<$||!i&&$+H<X)if(p||(Pe("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var Q=[];X+H<$&&Q.push(G),!i&&$+H<X&&Q.push(U);for(var re=Q.length,J=0;J<re;J++){var z=Q[J],V=[z];V.push(b(z).edge);for(var Y=b(z).pred;V.indexOf(Y)===-1;)V.push(Y),V.push(b(Y).edge),Y=b(Y).pred;V=V.slice(V.indexOf(Y));for(var ee=V[0].id(),ne=0,be=2;be<V.length;be+=2)V[be].id()<ee&&(ee=V[be].id(),ne=be);V=V.slice(ne).concat(V.slice(0,ne)),V.push(V[0]);var Ve=V.map(function(Ne){return Ne.id()}).join(",");B.indexOf(Ve)===-1&&(g.push(u.spawn(V)),B.push(Ve))}}else break}return{distanceTo:E,pathTo:x,hasNegativeWeightCycle:p,negativeWeightCycles:g}}},mh=Math.sqrt(2),bh=function(e,t,a){a.length===0&&He("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=t[i],u=t[s],l=a,f=l.length-1;f>=0;f--){var c=l[f],v=c[1],h=c[2];(t[v]===o&&t[h]===u||t[v]===u&&t[h]===o)&&l.splice(f,1)}for(var d=0;d<l.length;d++){var p=l[d];p[1]===u?(l[d]=p.slice(),l[d][1]=o):p[2]===u&&(l[d]=p.slice(),l[d][2]=o)}for(var g=0;g<t.length;g++)t[g]===u&&(t[g]=o);return l},mi=function(e,t,a,n){for(;a>n;){var i=Math.floor(Math.random()*t.length);t=bh(i,e,t),a--}return t},wh={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(P){return P.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/mh);if(i<2){He("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<s;f++){var c=n[f];l.push([f,a.indexOf(c.source()),a.indexOf(c.target())])}for(var v=1/0,h=[],d=new Array(i),p=new Array(i),g=new Array(i),y=function(B,_){for(var F=0;F<i;F++)_[F]=B[F]},b=0;b<=o;b++){for(var m=0;m<i;m++)p[m]=m;var E=mi(p,l.slice(),i,u),x=E.slice();y(p,g);var S=mi(p,E,u,2),w=mi(g,x,u,2);S.length<=w.length&&S.length<v?(v=S.length,h=S,y(p,d)):w.length<=S.length&&w.length<v&&(v=w.length,h=w,y(g,d))}for(var T=this.spawn(h.map(function(P){return n[P[0]]})),C=this.spawn(),D=this.spawn(),A=d[0],L=0;L<d.length;L++){var R=d[L],I=a[L];R===A?C.merge(I):D.merge(I)}var O=function(B){var _=e.spawn();return B.forEach(function(F){_.merge(F),F.connectedEdges().forEach(function(G){e.contains(G)&&!T.contains(G)&&_.merge(G)})}),_},N=[O(C),O(D)],k={cut:T,components:N,partition1:C,partition2:D};return k}},Eh=function(e){return{x:e.x,y:e.y}},Gn=function(e,t,a){return{x:e.x*t+a.x,y:e.y*t+a.y}},Tf=function(e,t,a){return{x:(e.x-a.x)/t,y:(e.y-a.y)/t}},Yr=function(e){return{x:e[0],y:e[1]}},xh=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},Th=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},Ch=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=t;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},Dh=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a<e.length&&e.splice(a,e.length-a),t>0&&e.splice(0,t));for(var o=0,u=e.length-1;u>=0;u--){var l=e[u];s?isFinite(l)||(e[u]=-1/0,o++):e.splice(u,1)}i&&e.sort(function(v,h){return v-h});var f=e.length,c=Math.floor(f/2);return f%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},Sh=function(e){return Math.PI*e/180},Za=function(e,t){return Math.atan2(t,e)-Math.PI/2},io=Math.log2||function(r){return Math.log(r)/Math.log(2)},so=function(e){return e>0?1:e<0?-1:0},Rr=function(e,t){return Math.sqrt(xr(e,t))},xr=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},Ah=function(e){for(var t=e.length,a=0,n=0;n<t;n++)a+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/a;return e},st=function(e,t,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*a},Wr=function(e,t,a,n){return{x:st(e.x,t.x,a.x,n),y:st(e.y,t.y,a.y,n)}},Lh=function(e,t,a,n){var i={x:t.x-e.x,y:t.y-e.y},s=Rr(e,t),o={x:i.x/s,y:i.y/s};return a=a??0,n=n??a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},Sa=function(e,t,a){return Math.max(e,Math.min(a,t))},At=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}}},Rh=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Ih=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Mh=function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},Cf=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},Oh=function(e,t,a){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,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},ln=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},fn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(t.length===1)a=n=i=s=t[0];else if(t.length===2)a=i=t[0],s=n=t[1];else if(t.length===4){var o=et(t,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Qo=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},oo=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)},jr=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},Ph=function(e,t){return jr(e,t.x,t.y)},Nh=function(e,t){return jr(e,t.x1,t.y1)&&jr(e,t.x2,t.y2)},Df=function(e,t,a,n,i,s,o){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?lr(i,s):u,f=i/2,c=s/2;l=Math.min(l,f,c);var v=l!==f,h=l!==c,d;if(v){var p=a-f+l-o,g=n-c-o,y=a+f-l+o,b=g;if(d=nr(e,t,a,n,p,g,y,b,!1),d.length>0)return d}if(h){var m=a+f+o,E=n-c+l-o,x=m,S=n+c-l+o;if(d=nr(e,t,a,n,m,E,x,S,!1),d.length>0)return d}if(v){var w=a-f+l-o,T=n+c+o,C=a+f-l+o,D=T;if(d=nr(e,t,a,n,w,T,C,D,!1),d.length>0)return d}if(h){var A=a-f-o,L=n-c+l-o,R=A,I=n+c-l+o;if(d=nr(e,t,a,n,A,L,R,I,!1),d.length>0)return d}var O;{var N=a-f+l,k=n-c+l;if(O=ya(e,t,a,n,N,k,l+o),O.length>0&&O[0]<=N&&O[1]<=k)return[O[0],O[1]]}{var P=a+f-l,B=n-c+l;if(O=ya(e,t,a,n,P,B,l+o),O.length>0&&O[0]>=P&&O[1]<=B)return[O[0],O[1]]}{var _=a+f-l,F=n+c-l;if(O=ya(e,t,a,n,_,F,l+o),O.length>0&&O[0]>=_&&O[1]>=F)return[O[0],O[1]]}{var G=a-f+l,U=n+c-l;if(O=ya(e,t,a,n,G,U,l+o),O.length>0&&O[0]<=G&&O[1]>=U)return[O[0],O[1]]}return[]},kh=function(e,t,a,n,i,s,o){var u=o,l=Math.min(a,i),f=Math.max(a,i),c=Math.min(n,s),v=Math.max(n,s);return l-u<=e&&e<=f+u&&c-u<=t&&t<=v+u},Bh=function(e,t,a,n,i,s,o,u,l){var f={x1:Math.min(a,o,i)-l,x2:Math.max(a,o,i)+l,y1:Math.min(n,u,s)-l,y2:Math.max(n,u,s)+l};return!(e<f.x1||e>f.x2||t<f.y1||t>f.y2)},Fh=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,u=(-t+s)/o,l=(-t-s)/o;return[u,l]},_h=function(e,t,a,n,i){var s=1e-5;e===0&&(e=s),t/=e,a/=e,n/=e;var o,u,l,f,c,v,h,d;if(u=(3*a-t*t)/9,l=-(27*n)+t*(9*a-2*(t*t)),l/=54,o=u*u*u+l*l,i[1]=0,h=t/3,o>0){c=l+Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),v=l-Math.sqrt(o),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),i[0]=-h+c+v,h+=(c+v)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-v+c)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,o===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-h+d*Math.cos(f/3),i[2]=-h+d*Math.cos((f+2*Math.PI)/3),i[4]=-h+d*Math.cos((f+4*Math.PI)/3)},Gh=function(e,t,a,n,i,s,o,u){var l=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*u+4*s*s-4*s*u+u*u,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*u-6*s*s+3*s*u,c=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*u-n*t+2*s*s+2*s*t-u*t,v=1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,h=[];_h(l,f,c,v,h);for(var d=1e-7,p=[],g=0;g<6;g+=2)Math.abs(h[g+1])<d&&h[g]>=0&&h[g]<=1&&p.push(h[g]);p.push(1),p.push(0);for(var y=-1,b,m,E,x=0;x<p.length;x++)b=Math.pow(1-p[x],2)*a+2*(1-p[x])*p[x]*i+p[x]*p[x]*o,m=Math.pow(1-p[x],2)*n+2*(1-p[x])*p[x]*s+p[x]*p[x]*u,E=Math.pow(b-e,2)+Math.pow(m-t,2),y>=0?E<y&&(y=E):y=E;return y},zh=function(e,t,a,n,i,s){var o=[e-a,t-n],u=[i-a,s-n],l=u[0]*u[0]+u[1]*u[1],f=o[0]*o[0]+o[1]*o[1],c=o[0]*u[0]+o[1]*u[1],v=c*c/l;return c<0?f:v>l?(e-i)*(e-i)+(t-s)*(t-s):f-v},Dt=function(e,t,a){for(var n,i,s,o,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)u=(e-n)/(s-n)*(o-i)+i,u>t&&l++;else continue;return l%2!==0},Jt=function(e,t,a,n,i,s,o,u,l){var f=new Array(a.length),c;u[0]!=null?(c=Math.atan(u[1]/u[0]),u[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=u;for(var v=Math.cos(-c),h=Math.sin(-c),d=0;d<f.length/2;d++)f[d*2]=s/2*(a[d*2]*v-a[d*2+1]*h),f[d*2+1]=o/2*(a[d*2+1]*v+a[d*2]*h),f[d*2]+=n,f[d*2+1]+=i;var p;if(l>0){var g=An(f,-l);p=Sn(g)}else p=f;return Dt(e,t,p)},Vh=function(e,t,a,n,i,s,o,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var c=u[f];l[f*4+0]=c.startX,l[f*4+1]=c.startY,l[f*4+2]=c.stopX,l[f*4+3]=c.stopY;var v=Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2);if(v<=Math.pow(c.radius,2))return!0}return Dt(e,t,l)},Sn=function(e){for(var t=new Array(e.length/2),a,n,i,s,o,u,l,f,c=0;c<e.length/4;c++){a=e[c*4],n=e[c*4+1],i=e[c*4+2],s=e[c*4+3],c<e.length/4-1?(o=e[(c+1)*4],u=e[(c+1)*4+1],l=e[(c+1)*4+2],f=e[(c+1)*4+3]):(o=e[0],u=e[1],l=e[2],f=e[3]);var v=nr(a,n,i,s,o,u,l,f,!0);t[c*2]=v[0],t[c*2+1]=v[1]}return t},An=function(e,t){for(var a=new Array(e.length*2),n,i,s,o,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(s=e[(u+1)*2],o=e[(u+1)*2+1]):(s=e[0],o=e[1]);var l=o-i,f=-(s-n),c=Math.sqrt(l*l+f*f),v=l/c,h=f/c;a[u*4]=n+v*t,a[u*4+1]=i+h*t,a[u*4+2]=s+v*t,a[u*4+3]=o+h*t}return a},Uh=function(e,t,a,n,i,s){var o=a-e,u=n-t;o/=i,u/=s;var l=Math.sqrt(o*o+u*u),f=l-1;if(f<0)return[];var c=f/l;return[(a-e)*c+e,(n-t)*c+t]},Ar=function(e,t,a,n,i,s,o){return e-=i,t-=s,e/=a/2+o,t/=n/2+o,e*e+t*t<=1},ya=function(e,t,a,n,i,s,o){var u=[a-e,n-t],l=[e-i,t-s],f=u[0]*u[0]+u[1]*u[1],c=2*(l[0]*u[0]+l[1]*u[1]),v=l[0]*l[0]+l[1]*l[1]-o*o,h=c*c-4*f*v;if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*f),p=(-c-Math.sqrt(h))/(2*f),g=Math.min(d,p),y=Math.max(d,p),b=[];if(g>=0&&g<=1&&b.push(g),y>=0&&y<=1&&b.push(y),b.length===0)return[];var m=b[0]*u[0]+e,E=b[0]*u[1]+t;if(b.length>1){if(b[0]==b[1])return[m,E];var x=b[1]*u[0]+e,S=b[1]*u[1]+t;return[m,E,x,S]}else return[m,E]},bi=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},nr=function(e,t,a,n,i,s,o,u,l){var f=e-i,c=a-e,v=o-i,h=t-s,d=n-t,p=u-s,g=v*h-p*f,y=c*h-d*f,b=p*c-v*d;if(b!==0){var m=g/b,E=y/b,x=.001,S=0-x,w=1+x;return S<=m&&m<=w&&S<=E&&E<=w?[e+m*c,t+m*d]:l?[e+m*c,t+m*d]:[]}else return g===0||y===0?bi(e,a,o)===o?[o,u]:bi(e,a,i)===i?[i,s]:bi(i,o,a)===a?[a,n]:[]:[]},Aa=function(e,t,a,n,i,s,o,u){var l=[],f,c=new Array(a.length),v=!0;s==null&&(v=!1);var h;if(v){for(var d=0;d<c.length/2;d++)c[d*2]=a[d*2]*s+n,c[d*2+1]=a[d*2+1]*o+i;if(u>0){var p=An(c,-u);h=Sn(p)}else h=c}else h=a;for(var g,y,b,m,E=0;E<h.length/2;E++)g=h[E*2],y=h[E*2+1],E<h.length/2-1?(b=h[(E+1)*2],m=h[(E+1)*2+1]):(b=h[0],m=h[1]),f=nr(e,t,n,i,g,y,b,m),f.length!==0&&l.push(f[0],f[1]);return l},qh=function(e,t,a,n,i,s,o,u,l){var f=[],c,v=new Array(a.length*2);l.forEach(function(b,m){m===0?(v[v.length-2]=b.startX,v[v.length-1]=b.startY):(v[m*4-2]=b.startX,v[m*4-1]=b.startY),v[m*4]=b.stopX,v[m*4+1]=b.stopY,c=ya(e,t,n,i,b.cx,b.cy,b.radius),c.length!==0&&f.push(c[0],c[1])});for(var h=0;h<v.length/4;h++)c=nr(e,t,n,i,v[h*4],v[h*4+1],v[h*4+2],v[h*4+3],!1),c.length!==0&&f.push(c[0],c[1]);if(f.length>2){for(var d=[f[0],f[1]],p=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),g=1;g<f.length/2;g++){var y=Math.pow(f[g*2]-e,2)+Math.pow(f[g*2+1]-t,2);y<=p&&(d[0]=f[g*2],d[1]=f[g*2+1],p=y)}return d}return f},Qa=function(e,t,a){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[t[0]+s*n[0],t[1]+s*n[1]]},bt=function(e,t){var a=Os(e,t);return a=Sf(a),a},Sf=function(e){for(var t,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,u=-1/0,l=0;l<n;l++)t=e[2*l],a=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,a),u=Math.max(u,a);for(var f=2/(o-i),c=2/(u-s),v=0;v<n;v++)t=e[2*v]=e[2*v]*f,a=e[2*v+1]=e[2*v+1]*c,i=Math.min(i,t),o=Math.max(o,t),s=Math.min(s,a),u=Math.max(u,a);if(s<-1)for(var h=0;h<n;h++)a=e[2*h+1]=e[2*h+1]+(-1-s);return e},Os=function(e,t){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=t;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},lr=function(e,t){return Math.min(e/4,t/4,8)},Af=function(e,t){return Math.min(e/10,t/10,8)},uo=function(){return 8},Hh=function(e,t,a){return[e-2*t+a,2*(t-e),e]},Ps=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Yh(r,e){function t(c){for(var v=[],h=0;h<c.length;h++){var d=c[h],p=c[(h+1)%c.length],g={x:p.x-d.x,y:p.y-d.y},y={x:-g.y,y:g.x},b=Math.sqrt(y.x*y.x+y.y*y.y);v.push({x:y.x/b,y:y.y/b})}return v}function a(c,v){var h=1/0,d=-1/0,p=St(c),g;try{for(p.s();!(g=p.n()).done;){var y=g.value,b=y.x*v.x+y.y*v.y;h=Math.min(h,b),d=Math.max(d,b)}}catch(m){p.e(m)}finally{p.f()}return{min:h,max:d}}function n(c,v){return!(c.max<v.min||v.max<c.min)}var i=[].concat(xn(t(r)),xn(t(e))),s=St(i),o;try{for(s.s();!(o=s.n()).done;){var u=o.value,l=a(r,u),f=a(e,u);if(!n(l,f))return!1}}catch(c){s.e(c)}finally{s.f()}return!0}var $h=ht({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Xh={pageRank:function(e){for(var t=$h(e),a=t.dampingFactor,n=t.precision,i=t.iterations,s=t.weight,o=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,c=l.length,v=c*c,h=f.length,d=new Array(v),p=new Array(c),g=(1-a)/c,y=0;y<c;y++){for(var b=0;b<c;b++){var m=y*c+b;d[m]=0}p[y]=0}for(var E=0;E<h;E++){var x=f[E],S=x.data("source"),w=x.data("target");if(S!==w){var T=l.indexOfId(S),C=l.indexOfId(w),D=s(x),A=C*c+T;d[A]+=D,p[T]+=D}}for(var L=1/c+g,R=0;R<c;R++)if(p[R]===0)for(var I=0;I<c;I++){var O=I*c+R;d[O]=L}else for(var N=0;N<c;N++){var k=N*c+R;d[k]=d[k]/p[R]+g}for(var P=new Array(c),B=new Array(c),_,F=0;F<c;F++)P[F]=1;for(var G=0;G<i;G++){for(var U=0;U<c;U++)B[U]=0;for(var H=0;H<c;H++)for(var X=0;X<c;X++){var $=H*c+X;B[H]+=d[$]*P[X]}Ah(B),_=P,P=B,B=_;for(var Q=0,re=0;re<c;re++){var J=_[re]-P[re];Q+=J*J}if(Q<n)break}var z={rank:function(Y){return Y=o.collection(Y)[0],P[l.indexOf(Y)]}};return z}},Jo=ht({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Kr={degreeCentralityNormalized:function(e){e=Jo(e);var t=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},c={},v=0,h=0,d=0;d<n;d++){var p=a[d],g=p.id();e.root=p;var y=this.degreeCentrality(e);v<y.indegree&&(v=y.indegree),h<y.outdegree&&(h=y.outdegree),f[g]=y.indegree,c[g]=y.outdegree}return{indegree:function(m){return v==0?0:(ce(m)&&(m=t.filter(m)),f[m.id()]/v)},outdegree:function(m){return h===0?0:(ce(m)&&(m=t.filter(m)),c[m.id()]/h)}}}else{for(var i={},s=0,o=0;o<n;o++){var u=a[o];e.root=u;var l=this.degreeCentrality(e);s<l.degree&&(s=l.degree),i[u.id()]=l.degree}return{degree:function(m){return s===0?0:(ce(m)&&(m=t.filter(m)),i[m.id()]/s)}}}},degreeCentrality:function(e){e=Jo(e);var t=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,u=n.alpha;if(i=t.collection(i)[0],o){for(var h=i.connectedEdges(),d=h.filter(function(S){return S.target().same(i)&&a.has(S)}),p=h.filter(function(S){return S.source().same(i)&&a.has(S)}),g=d.length,y=p.length,b=0,m=0,E=0;E<d.length;E++)b+=s(d[E]);for(var x=0;x<p.length;x++)m+=s(p[x]);return{indegree:Math.pow(g,1-u)*Math.pow(b,u),outdegree:Math.pow(y,1-u)*Math.pow(m,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,c=0,v=0;v<l.length;v++)c+=s(l[v]);return{degree:Math.pow(f,1-u)*Math.pow(c,u)}}}};Kr.dc=Kr.degreeCentrality;Kr.dcn=Kr.degreeCentralityNormalised=Kr.degreeCentralityNormalized;var jo=ht({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Zr={closenessCentralityNormalized:function(e){for(var t=jo(e),a=t.harmonic,n=t.weight,i=t.directed,s=this.cy(),o={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),c=0;c<l.length;c++){for(var v=0,h=l[c],d=0;d<l.length;d++)if(c!==d){var p=f.distance(h,l[d]);a?v+=1/p:v+=p}a||(v=1/v),u<v&&(u=v),o[h.id()]=v}return{closeness:function(y){return u==0?0:(ce(y)?y=s.filter(y)[0].id():y=y.id(),o[y]/u)}}},closenessCentrality:function(e){var t=jo(e),a=t.root,n=t.weight,i=t.directed,s=t.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var c=l[f];if(!c.same(a)){var v=o.distanceTo(c);s?u+=1/v:u+=v}}return s?u:1/u}};Zr.cc=Zr.closenessCentrality;Zr.ccn=Zr.closenessCentralityNormalised=Zr.closenessCentralityNormalized;var Wh=ht({weight:null,directed:!1}),Ns={betweennessCentrality:function(e){for(var t=Wh(e),a=t.directed,n=t.weight,i=n!=null,s=this.cy(),o=this.nodes(),u={},l={},f=0,c={set:function(m,E){l[m]=E,E>f&&(f=E)},get:function(m){return l[m]}},v=0;v<o.length;v++){var h=o[v],d=h.id();a?u[d]=h.outgoers().nodes():u[d]=h.openNeighborhood().nodes(),c.set(d,0)}for(var p=function(){for(var m=o[g].id(),E=[],x={},S={},w={},T=new Ga(function(H,X){return w[H]-w[X]}),C=0;C<o.length;C++){var D=o[C].id();x[D]=[],S[D]=0,w[D]=1/0}for(S[m]=1,w[m]=0,T.push(m);!T.empty();){var A=T.pop();if(E.push(A),i)for(var L=0;L<u[A].length;L++){var R=u[A][L],I=s.getElementById(A),O=void 0;I.edgesTo(R).length>0?O=I.edgesTo(R)[0]:O=R.edgesTo(I)[0];var N=n(O);R=R.id(),w[R]>w[A]+N&&(w[R]=w[A]+N,T.nodes.indexOf(R)<0?T.push(R):T.updateItem(R),S[R]=0,x[R]=[]),w[R]==w[A]+N&&(S[R]=S[R]+S[A],x[R].push(A))}else for(var k=0;k<u[A].length;k++){var P=u[A][k].id();w[P]==1/0&&(T.push(P),w[P]=w[A]+1),w[P]==w[A]+1&&(S[P]=S[P]+S[A],x[P].push(A))}}for(var B={},_=0;_<o.length;_++)B[o[_].id()]=0;for(;E.length>0;){for(var F=E.pop(),G=0;G<x[F].length;G++){var U=x[F][G];B[U]=B[U]+S[U]/S[F]*(1+B[F])}F!=o[g].id()&&c.set(F,c.get(F)+B[F])}},g=0;g<o.length;g++)p();var y={betweenness:function(m){var E=s.collection(m).id();return c.get(E)},betweennessNormalized:function(m){if(f==0)return 0;var E=s.collection(m).id();return c.get(E)/f}};return y.betweennessNormalised=y.betweennessNormalized,y}};Ns.bc=Ns.betweennessCentrality;var Kh=ht({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),Zh=function(e){return Kh(e)},Qh=function(e,t){for(var a=0,n=0;n<t.length;n++)a+=t[n](e);return a},Jh=function(e,t,a){for(var n=0;n<t;n++)e[n*t+n]=a},Lf=function(e,t){for(var a,n=0;n<t;n++){a=0;for(var i=0;i<t;i++)a+=e[i*t+n];for(var s=0;s<t;s++)e[s*t+n]=e[s*t+n]/a}},jh=function(e,t,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+o]*t[o*a+u]}return n},ed=function(e,t,a){for(var n=e.slice(0),i=1;i<a;i++)e=jh(e,n,t);return e},td=function(e,t,a){for(var n=new Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],a);return Lf(n,t),n},rd=function(e,t,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},ad=function(e,t,a,n){for(var i=[],s=0;s<t;s++){for(var o=[],u=0;u<t;u++)Math.round(e[s*t+u]*1e3)/1e3>0&&o.push(a[u]);o.length!==0&&i.push(n.collection(o))}return i},nd=function(e,t){for(var a=0;a<e.length;a++)if(!t[a]||e[a].id()!==t[a].id())return!1;return!0},id=function(e){for(var t=0;t<e.length;t++)for(var a=0;a<e.length;a++)t!=a&&nd(e[t],e[a])&&e.splice(a,1);return e},eu=function(e){for(var t=this.nodes(),a=this.edges(),n=this.cy(),i=Zh(e),s={},o=0;o<t.length;o++)s[t[o].id()]=o;for(var u=t.length,l=u*u,f=new Array(l),c,v=0;v<l;v++)f[v]=0;for(var h=0;h<a.length;h++){var d=a[h],p=s[d.source().id()],g=s[d.target().id()],y=Qh(d,i.attributes);f[p*u+g]+=y,f[g*u+p]+=y}Jh(f,u,i.multFactor),Lf(f,u);for(var b=!0,m=0;b&&m<i.maxIterations;)b=!1,c=ed(f,u,i.expandFactor),f=td(c,u,i.inflateFactor),rd(f,c,l,4)||(b=!0),m++;var E=ad(f,u,t,n);return E=id(E),E},sd={markovClustering:eu,mcl:eu},od=function(e){return e},Rf=function(e,t){return Math.abs(t-e)},tu=function(e,t,a){return e+Rf(t,a)},ru=function(e,t,a){return e+Math.pow(a-t,2)},ud=function(e){return Math.sqrt(e)},ld=function(e,t,a){return Math.max(e,Rf(t,a))},fa=function(e,t,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:od,o=n,u,l,f=0;f<e;f++)u=t(f),l=a(f),o=i(o,u,l);return s(o)},ea={euclidean:function(e,t,a){return e>=2?fa(e,t,a,0,ru,ud):fa(e,t,a,0,tu)},squaredEuclidean:function(e,t,a){return fa(e,t,a,0,ru)},manhattan:function(e,t,a){return fa(e,t,a,0,tu)},max:function(e,t,a){return fa(e,t,a,-1/0,ld)}};ea["squared-euclidean"]=ea.squaredEuclidean;ea.squaredeuclidean=ea.squaredEuclidean;function zn(r,e,t,a,n,i){var s;return Ye(r)?s=r:s=ea[r]||ea.euclidean,e===0&&Ye(r)?s(n,i):s(e,t,a,n,i)}var fd=ht({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),lo=function(e){return fd(e)},Ln=function(e,t,a,n,i){var s=i!=="kMedoids",o=s?function(c){return a[c]}:function(c){return n[c](a)},u=function(v){return n[v](t)},l=a,f=t;return zn(e,n.length,o,u,l,f)},wi=function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,s[l]=e.max(a[l]).value;for(var f=0;f<t;f++){u=[];for(var c=0;c<n;c++)u[c]=Math.random()*(s[c]-i[c])+i[c];o[f]=u}return o},If=function(e,t,a,n,i){for(var s=1/0,o=0,u=0;u<t.length;u++){var l=Ln(a,e,t[u],n,i);l<s&&(s=l,o=u)}return o},Mf=function(e,t,a){for(var n=[],i=null,s=0;s<t.length;s++)i=t[s],a[i.id()]===e&&n.push(i);return n},cd=function(e,t,a){return Math.abs(t-e)<=a},vd=function(e,t,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-t[n][i]);if(s>a)return!1}return!0},hd=function(e,t,a){for(var n=0;n<a;n++)if(e===t[n])return!0;return!1},au=function(e,t){var a=new Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];hd(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<t;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},nu=function(e,t,a){for(var n=0,i=0;i<t.length;i++)n+=Ln("manhattan",t[i],e,a,"kMedoids");return n},dd=function(e){var t=this.cy(),a=this.nodes(),n=null,i=lo(e),s=new Array(i.k),o={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=wi(a,i.k,i.attributes)):at(i.testCentroids)==="object"?u=i.testCentroids:u=wi(a,i.k,i.attributes):u=wi(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var c=0;c<a.length;c++)n=a[c],o[n.id()]=If(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var v=0;v<i.k;v++){var h=Mf(v,a,o);if(h.length!==0){for(var d=i.attributes.length,p=u[v],g=new Array(d),y=new Array(d),b=0;b<d;b++){y[b]=0;for(var m=0;m<h.length;m++)n=h[m],y[b]+=i.attributes[b](n);g[b]=y[b]/h.length,cd(g[b],p[b],i.sensitivityThreshold)||(l=!0)}u[v]=g,s[v]=t.collection(h)}}f++}return s},gd=function(e){var t=this.cy(),a=this.nodes(),n=null,i=lo(e),s=new Array(i.k),o,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(at(i.testCentroids)==="object"?o=i.testCentroids:o=au(a,i.k)):o=au(a,i.k);for(var c=!0,v=0;c&&v<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],u[n.id()]=If(n,o,i.distance,i.attributes,"kMedoids");c=!1;for(var d=0;d<o.length;d++){var p=Mf(d,a,u);if(p.length!==0){f[d]=nu(o[d],p,i.attributes);for(var g=0;g<p.length;g++)l=nu(p[g],p,i.attributes),l<f[d]&&(f[d]=l,o[d]=p[g],c=!0);s[d]=t.collection(p)}}v++}return s},pd=function(e,t,a,n,i){for(var s,o,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var c=0;c<i.attributes.length;c++){s=0,o=0;for(var v=0;v<t.length;v++)s+=n[v][f]*i.attributes[c](t[v]),o+=n[v][f];e[f][c]=s/o}},yd=function(e,t,a,n,i){for(var s=0;s<e.length;s++)t[s]=e[s].slice();for(var o,u,l,f=2/(i.m-1),c=0;c<a.length;c++)for(var v=0;v<n.length;v++){o=0;for(var h=0;h<a.length;h++)u=Ln(i.distance,n[v],a[c],i.attributes,"cmeans"),l=Ln(i.distance,n[v],a[h],i.attributes,"cmeans"),o+=Math.pow(u/l,f);e[v][c]=1/o}},md=function(e,t,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,u,l=0;l<t.length;l++){o=-1/0,u=-1;for(var f=0;f<t[0].length;f++)t[l][f]>o&&(o=t[l][f],u=f);i[u].push(e[l])}for(var c=0;c<i.length;c++)i[c]=n.collection(i[c]);return i},iu=function(e){var t=this.cy(),a=this.nodes(),n=lo(e),i,s,o,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);o=new Array(a.length);for(var c=0;c<a.length;c++)o[c]=new Array(n.k);for(var v=0;v<a.length;v++){for(var h=0,d=0;d<n.k;d++)o[v][d]=Math.random(),h+=o[v][d];for(var p=0;p<n.k;p++)o[v][p]=o[v][p]/h}s=new Array(n.k);for(var g=0;g<n.k;g++)s[g]=new Array(n.attributes.length);l=new Array(a.length);for(var y=0;y<a.length;y++)l[y]=new Array(n.k);for(var b=!0,m=0;b&&m<n.maxIterations;)b=!1,pd(s,a,o,l,n),yd(o,u,s,a,n),vd(o,u,n.sensitivityThreshold)||(b=!0),m++;return i=md(a,o,n,t),{clusters:i,degreeOfMembership:o}},bd={kMeans:dd,kMedoids:gd,fuzzyCMeans:iu,fcm:iu},wd=ht({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Ed={single:"min",complete:"max"},xd=function(e){var t=wd(e),a=Ed[t.linkage];return a!=null&&(t.linkage=a),t},su=function(e,t,a,n,i){for(var s=0,o=1/0,u,l=i.attributes,f=function(C,D){return zn(i.distance,l.length,function(A){return l[A](C)},function(A){return l[A](D)},C,D)},c=0;c<e.length;c++){var v=e[c].key,h=a[v][n[v]];h<o&&(s=v,o=h)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[s],p=t[n[s]],g;i.mode==="dendrogram"?g={left:d,right:p,key:d.key}:g={value:d.value.concat(p.value),key:d.key},e[d.index]=g,e.splice(p.index,1),t[d.key]=g;for(var y=0;y<e.length;y++){var b=e[y];d.key===b.key?u=1/0:i.linkage==="min"?(u=a[d.key][b.key],a[d.key][b.key]>a[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="max"?(u=a[d.key][b.key],a[d.key][b.key]<a[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="mean"?u=(a[d.key][b.key]*d.size+a[p.key][b.key]*p.size)/(d.size+p.size):i.mode==="dendrogram"?u=f(b.value,d.value):u=f(b.value[0],d.value[0]),a[d.key][b.key]=a[b.key][d.key]=u}for(var m=0;m<e.length;m++){var E=e[m].key;if(n[E]===d.key||n[E]===p.key){for(var x=E,S=0;S<e.length;S++){var w=e[S].key;a[E][w]<a[E][x]&&(x=w)}n[E]=x}e[m].index=m}return d.key=p.key=d.index=p.index=null,!0},$r=function(e,t,a){e&&(e.value?t.push(e.value):(e.left&&$r(e.left,t),e.right&&$r(e.right,t)))},ks=function(e,t){if(!e)return"";if(e.left&&e.right){var a=ks(e.left,t),n=ks(e.right,t),i=t.add({group:"nodes",data:{id:a+","+n}});return t.add({group:"edges",data:{source:a,target:i.id()}}),t.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Bs=function(e,t,a){if(!e)return[];var n=[],i=[],s=[];return t===0?(e.left&&$r(e.left,n),e.right&&$r(e.right,i),s=n.concat(i),[a.collection(s)]):t===1?e.value?[a.collection(e.value)]:(e.left&&$r(e.left,n),e.right&&$r(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Bs(e.left,t-1,a)),e.right&&(i=Bs(e.right,t-1,a)),n.concat(i))},ou=function(e){for(var t=this.cy(),a=this.nodes(),n=xd(e),i=n.attributes,s=function(m,E){return zn(n.distance,i.length,function(x){return i[x](m)},function(x){return i[x](E)},m,E)},o=[],u=[],l=[],f=[],c=0;c<a.length;c++){var v={value:n.mode==="dendrogram"?a[c]:[a[c]],key:c,index:c};o[c]=v,f[c]=v,u[c]=[],l[c]=0}for(var h=0;h<o.length;h++)for(var d=0;d<=h;d++){var p=void 0;n.mode==="dendrogram"?p=h===d?1/0:s(o[h].value,o[d].value):p=h===d?1/0:s(o[h].value[0],o[d].value[0]),u[h][d]=p,u[d][h]=p,p<u[h][l[h]]&&(l[h]=d)}for(var g=su(o,f,u,l,n);g;)g=su(o,f,u,l,n);var y;return n.mode==="dendrogram"?(y=Bs(o[0],n.dendrogramDepth,t),n.addDendrogram&&ks(o[0],t)):(y=new Array(o.length),o.forEach(function(b,m){b.key=b.index=null,y[m]=t.collection(b.value)})),y},Td={hierarchicalClustering:ou,hca:ou},Cd=ht({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Dd=function(e){var t=e.damping,a=e.preference;.5<=t&&t<1||He("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ae(a)||He("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Cd(e)},Sd=function(e,t,a,n){var i=function(o,u){return n[u](o)};return-zn(e,n.length,function(s){return i(t,s)},function(s){return i(a,s)},t,a)},Ad=function(e,t){var a=null;return t==="median"?a=Dh(e):t==="mean"?a=Ch(e):t==="min"?a=xh(e):t==="max"?a=Th(e):a=t,a},Ld=function(e,t,a){for(var n=[],i=0;i<e;i++)t[i*e+i]+a[i*e+i]>0&&n.push(i);return n},uu=function(e,t,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,u=0;u<a.length;u++){var l=a[u];t[i*e+l]>o&&(s=l,o=t[i*e+l])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Rd=function(e,t,a){for(var n=uu(e,t,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var u=-1,l=-1/0,f=0;f<s.length;f++){for(var c=0,v=0;v<s.length;v++)c+=t[s[v]*e+s[f]];c>l&&(u=f,l=c)}a[i]=s[u]}return n=uu(e,t,a),n},lu=function(e){for(var t=this.cy(),a=this.nodes(),n=Dd(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,u,l,f,c,v;o=a.length,u=o*o,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var d=0;d<o;d++)for(var p=0;p<o;p++)d!==p&&(l[d*o+p]=Sd(n.distance,a[d],a[p],n.attributes));f=Ad(l,n.preference);for(var g=0;g<o;g++)l[g*o+g]=f;c=new Array(u);for(var y=0;y<u;y++)c[y]=0;v=new Array(u);for(var b=0;b<u;b++)v[b]=0;for(var m=new Array(o),E=new Array(o),x=new Array(o),S=0;S<o;S++)m[S]=0,E[S]=0,x[S]=0;for(var w=new Array(o*n.minIterations),T=0;T<w.length;T++)w[T]=0;var C;for(C=0;C<n.maxIterations;C++){for(var D=0;D<o;D++){for(var A=-1/0,L=-1/0,R=-1,I=0,O=0;O<o;O++)m[O]=c[D*o+O],I=v[D*o+O]+l[D*o+O],I>=A?(L=A,A=I,R=O):I>L&&(L=I);for(var N=0;N<o;N++)c[D*o+N]=(1-n.damping)*(l[D*o+N]-A)+n.damping*m[N];c[D*o+R]=(1-n.damping)*(l[D*o+R]-L)+n.damping*m[R]}for(var k=0;k<o;k++){for(var P=0,B=0;B<o;B++)m[B]=v[B*o+k],E[B]=Math.max(0,c[B*o+k]),P+=E[B];P-=E[k],E[k]=c[k*o+k],P+=E[k];for(var _=0;_<o;_++)v[_*o+k]=(1-n.damping)*Math.min(0,P-E[_])+n.damping*m[_];v[k*o+k]=(1-n.damping)*(P-E[k])+n.damping*m[k]}for(var F=0,G=0;G<o;G++){var U=v[G*o+G]+c[G*o+G]>0?1:0;w[C%n.minIterations*o+G]=U,F+=U}if(F>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var H=0,X=0;X<o;X++){x[X]=0;for(var $=0;$<n.minIterations;$++)x[X]+=w[$*o+X];(x[X]===0||x[X]===n.minIterations)&&H++}if(H===o)break}}for(var Q=Ld(o,c,v),re=Rd(o,l,Q),J={},z=0;z<Q.length;z++)J[Q[z]]=[];for(var V=0;V<a.length;V++){var Y=i[a[V].id()],ee=re[Y];ee!=null&&J[ee].push(a[V])}for(var ne=new Array(Q.length),be=0;be<Q.length;be++)ne[be]=t.collection(J[Q[be]]);return ne},Id={affinityPropagation:lu,ap:lu},Md=ht({root:void 0,directed:!1}),Od={hierholzer:function(e){if(!Re(e)){var t=arguments;e={root:t[0],directed:t[1]}}var a=Md(e),n=a.root,i=a.directed,s=this,o=!1,u,l,f;n&&(f=ce(n)?this.filter(n)[0].id():n[0].id());var c={},v={};i?s.forEach(function(b){var m=b.id();if(b.isNode()){var E=b.indegree(!0),x=b.outdegree(!0),S=E-x,w=x-E;S==1?u?o=!0:u=m:w==1?l?o=!0:l=m:(w>1||S>1)&&(o=!0),c[m]=[],b.outgoers().forEach(function(T){T.isEdge()&&c[m].push(T.id())})}else v[m]=[void 0,b.target().id()]}):s.forEach(function(b){var m=b.id();if(b.isNode()){var E=b.degree(!0);E%2&&(u?l?o=!0:l=m:u=m),c[m]=[],b.connectedEdges().forEach(function(x){return c[m].push(x.id())})}else v[m]=[b.source().id(),b.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(l&&u)if(i){if(f&&l!=f)return h;f=l}else{if(f&&l!=f&&u!=f)return h;f||(f=l)}else f||(f=s[0].id());var d=function(m){for(var E=m,x=[m],S,w,T;c[E].length;)S=c[E].shift(),w=v[S][0],T=v[S][1],E!=T?(c[T]=c[T].filter(function(C){return C!=S}),E=T):!i&&E!=w&&(c[w]=c[w].filter(function(C){return C!=S}),E=w),x.unshift(S),x.unshift(E);return x},p=[],g=[];for(g=d(f);g.length!=1;)c[g[0]].length==0?(p.unshift(s.getElementById(g.shift())),p.unshift(s.getElementById(g.shift()))):g=d(g.shift()).concat(g);p.unshift(s.getElementById(g.shift()));for(var y in c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Ja=function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},u=function(v,h){for(var d=s.length-1,p=[],g=e.spawn();s[d].x!=v||s[d].y!=h;)p.push(s.pop().edge),d--;p.push(s.pop().edge),p.forEach(function(y){var b=y.connectedNodes().intersection(e);g.merge(y),b.forEach(function(m){var E=m.id(),x=m.connectedEdges().intersection(e);g.merge(m),t[E].cutVertex?g.merge(x.filter(function(S){return S.isLoop()})):g.merge(x)})}),i.push(g)},l=function(v,h,d){v===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(h).connectedEdges().intersection(e);if(p.size()===0)i.push(e.spawn(e.getElementById(h)));else{var g,y,b,m;p.forEach(function(E){g=E.source().id(),y=E.target().id(),b=g===h?y:g,b!==d&&(m=E.id(),o[m]||(o[m]=!0,s.push({x:h,y:b,edge:E})),b in t?t[h].low=Math.min(t[h].low,t[b].id):(l(v,b,h),t[h].low=Math.min(t[h].low,t[b].low),t[h].id<=t[b].low&&(t[h].cutVertex=!0,u(h,b))))})}};e.forEach(function(c){if(c.isNode()){var v=c.id();v in t||(n=0,l(v,v),t[v].cutVertex=n>1)}});var f=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(f),components:i}},Pd={hopcroftTarjanBiconnected:Ja,htbc:Ja,htb:Ja,hopcroftTarjanBiconnectedComponents:Ja},ja=function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=function(l){i.push(l),t[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(p){var g=p.target().id();g!==l&&(g in t||o(g),t[g].explored||(t[l].low=Math.min(t[l].low,t[g].low)))}),t[l].index===t[l].low){for(var c=e.spawn();;){var v=i.pop();if(c.merge(e.getElementById(v)),t[v].low=t[l].index,t[v].explored=!0,v===l)break}var h=c.edgesWith(c),d=c.merge(h);n.push(d),s=s.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||o(l)}}),{cut:s,components:n}},Nd={tarjanStronglyConnected:ja,tsc:ja,tscc:ja,tarjanStronglyConnectedComponents:ja},Of={};[Da,fh,ch,hh,gh,yh,wh,Xh,Kr,Zr,Ns,sd,bd,Td,Id,Od,Pd,Nd].forEach(function(r){de(Of,r)});/*!
|
|
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 Pf=0,Nf=1,kf=2,Ft=function(e){if(!(this instanceof Ft))return new Ft(e);this.id="Thenable/1.0.7",this.state=Pf,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))};Ft.prototype={fulfill:function(e){return fu(this,Nf,"fulfillValue",e)},reject:function(e){return fu(this,kf,"rejectReason",e)},then:function(e,t){var a=this,n=new Ft;return a.onFulfilled.push(vu(e,n,"fulfill")),a.onRejected.push(vu(t,n,"reject")),Bf(a),n.proxy}};var fu=function(e,t,a,n){return e.state===Pf&&(e.state=t,e[a]=n,Bf(e)),e},Bf=function(e){e.state===Nf?cu(e,"onFulfilled",e.fulfillValue):e.state===kf&&cu(e,"onRejected",e.rejectReason)},cu=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var o=0;o<n.length;o++)n[o](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},vu=function(e,t,a){return function(n){if(typeof e!="function")t[a].call(t,n);else{var i;try{i=e(n)}catch(s){t.reject(s);return}Ff(t,i)}}},Ff=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(at(t)==="object"&&t!==null||typeof t=="function")try{a=t.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(t,function(i){n||(n=!0,i===t?e.reject(new TypeError("circular thenable chain")):Ff(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(t)};Ft.all=function(r){return new Ft(function(e,t){for(var a=new Array(r.length),n=0,i=function(u,l){a[u]=l,n++,n===r.length&&e(a)},s=0;s<r.length;s++)(function(o){var u=r[o],l=u!=null&&u.then!=null;if(l)u.then(function(c){i(o,c)},function(c){t(c)});else{var f=u;i(o,f)}})(s)})};Ft.resolve=function(r){return new Ft(function(e,t){e(r)})};Ft.reject=function(r){return new Ft(function(e,t){t(r)})};var aa=typeof Promise<"u"?Promise:Ft,Fs=function(e,t,a){var n=js(e),i=!n,s=this._private=de({duration:1e3},t,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&Ye(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var u=e.pan();s.startPan={x:u.x,y:u.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},Ir=Fs.prototype;de(Ir,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,a=e.target._private.animation;e.queue?t=a.queue:t=a.current,t.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,a=t.playing;return e===void 0?t.progress:(a&&this.pause(),t.progress=e,t.started=!1,a&&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 a=function(l,f){var c=e[l];c!=null&&(e[l]=e[f],e[f]=c)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}return t&&this.play(),this},promise:function(e){var t=this._private,a;switch(e){case"frame":a=t.frames;break;default:case"complete":case"completed":a=t.completes}return new aa(function(n,i){a.push(function(){n()})})}});Ir.complete=Ir.completed;Ir.run=Ir.play;Ir.running=Ir.playing;var kd={animated:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=n[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<n.length;s++){var o=n[s];o._private.animation.queue=[]}return this}},delay:function(){return function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:t,duration:t,complete:a}):this}},delayAnimation:function(){return function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:t,duration:t,complete:a}):this}},animation:function(){return function(t,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this,u=!i,l=!u;if(!o.styleEnabled())return this;var f=o.style();t=de({},t,a);var c=Object.keys(t).length===0;if(c)return new Fs(s[0],t);switch(t.duration===void 0&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200;break}if(l&&(t.style=f.getPropsList(t.style||t.css),t.css=void 0),l&&t.renderedPosition!=null){var v=t.renderedPosition,h=o.pan(),d=o.zoom();t.position=Tf(v,d,h)}if(u&&t.panBy!=null){var p=t.panBy,g=o.pan();t.pan={x:g.x+p.x,y:g.y+p.y}}var y=t.center||t.centre;if(u&&y!=null){var b=o.getCenterPan(y.eles,t.zoom);b!=null&&(t.pan=b)}if(u&&t.fit!=null){var m=t.fit,E=o.getFitViewport(m.eles||m.boundingBox,m.padding);E!=null&&(t.pan=E.pan,t.zoom=E.zoom)}if(u&&Re(t.zoom)){var x=o.getZoomedViewport(t.zoom);x!=null?(x.zoomed&&(t.zoom=x.zoom),x.panned&&(t.pan=x.pan)):t.zoom=null}return new Fs(s[0],t)}},animate:function(){return function(t,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;a&&(t=de({},t,a));for(var u=0;u<s.length;u++){var l=s[u],f=l.animated()&&(t.queue===void 0||t.queue),c=l.animation(t,f?{queue:!0}:void 0);c.play()}return this}},stop:function(){return function(t,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var u=0;u<s.length;u++){for(var l=s[u],f=l._private,c=f.animation.current,v=0;v<c.length;v++){var h=c[v],d=h._private;a&&(d.duration=0)}t&&(f.animation.queue=[]),a||(f.animation.current=[])}return o.notify("draw"),this}}},Ei,hu;function Vn(){if(hu)return Ei;hu=1;var r=Array.isArray;return Ei=r,Ei}var xi,du;function Bd(){if(du)return xi;du=1;var r=Vn(),e=Fa(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,s){if(r(i))return!1;var o=typeof i;return o=="number"||o=="symbol"||o=="boolean"||i==null||e(i)?!0:a.test(i)||!t.test(i)||s!=null&&i in Object(s)}return xi=n,xi}var Ti,gu;function Fd(){if(gu)return Ti;gu=1;var r=df(),e=Ba(),t="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function s(o){if(!e(o))return!1;var u=r(o);return u==a||u==n||u==t||u==i}return Ti=s,Ti}var Ci,pu;function _d(){if(pu)return Ci;pu=1;var r=Fn(),e=r["__core-js_shared__"];return Ci=e,Ci}var Di,yu;function Gd(){if(yu)return Di;yu=1;var r=_d(),e=function(){var a=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}();function t(a){return!!e&&e in a}return Di=t,Di}var Si,mu;function zd(){if(mu)return Si;mu=1;var r=Function.prototype,e=r.toString;function t(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return Si=t,Si}var Ai,bu;function Vd(){if(bu)return Ai;bu=1;var r=Fd(),e=Gd(),t=Ba(),a=zd(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,u=s.toString,l=o.hasOwnProperty,f=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function c(v){if(!t(v)||e(v))return!1;var h=r(v)?f:i;return h.test(a(v))}return Ai=c,Ai}var Li,wu;function Ud(){if(wu)return Li;wu=1;function r(e,t){return e==null?void 0:e[t]}return Li=r,Li}var Ri,Eu;function fo(){if(Eu)return Ri;Eu=1;var r=Vd(),e=Ud();function t(a,n){var i=e(a,n);return r(i)?i:void 0}return Ri=t,Ri}var Ii,xu;function Un(){if(xu)return Ii;xu=1;var r=fo(),e=r(Object,"create");return Ii=e,Ii}var Mi,Tu;function qd(){if(Tu)return Mi;Tu=1;var r=Un();function e(){this.__data__=r?r(null):{},this.size=0}return Mi=e,Mi}var Oi,Cu;function Hd(){if(Cu)return Oi;Cu=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return Oi=r,Oi}var Pi,Du;function Yd(){if(Du)return Pi;Du=1;var r=Un(),e="__lodash_hash_undefined__",t=Object.prototype,a=t.hasOwnProperty;function n(i){var s=this.__data__;if(r){var o=s[i];return o===e?void 0:o}return a.call(s,i)?s[i]:void 0}return Pi=n,Pi}var Ni,Su;function $d(){if(Su)return Ni;Su=1;var r=Un(),e=Object.prototype,t=e.hasOwnProperty;function a(n){var i=this.__data__;return r?i[n]!==void 0:t.call(i,n)}return Ni=a,Ni}var ki,Au;function Xd(){if(Au)return ki;Au=1;var r=Un(),e="__lodash_hash_undefined__";function t(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=r&&n===void 0?e:n,this}return ki=t,ki}var Bi,Lu;function Wd(){if(Lu)return Bi;Lu=1;var r=qd(),e=Hd(),t=Yd(),a=$d(),n=Xd();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Bi=i,Bi}var Fi,Ru;function Kd(){if(Ru)return Fi;Ru=1;function r(){this.__data__=[],this.size=0}return Fi=r,Fi}var _i,Iu;function _f(){if(Iu)return _i;Iu=1;function r(e,t){return e===t||e!==e&&t!==t}return _i=r,_i}var Gi,Mu;function qn(){if(Mu)return Gi;Mu=1;var r=_f();function e(t,a){for(var n=t.length;n--;)if(r(t[n][0],a))return n;return-1}return Gi=e,Gi}var zi,Ou;function Zd(){if(Ou)return zi;Ou=1;var r=qn(),e=Array.prototype,t=e.splice;function a(n){var i=this.__data__,s=r(i,n);if(s<0)return!1;var o=i.length-1;return s==o?i.pop():t.call(i,s,1),--this.size,!0}return zi=a,zi}var Vi,Pu;function Qd(){if(Pu)return Vi;Pu=1;var r=qn();function e(t){var a=this.__data__,n=r(a,t);return n<0?void 0:a[n][1]}return Vi=e,Vi}var Ui,Nu;function Jd(){if(Nu)return Ui;Nu=1;var r=qn();function e(t){return r(this.__data__,t)>-1}return Ui=e,Ui}var qi,ku;function jd(){if(ku)return qi;ku=1;var r=qn();function e(t,a){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,a])):n[i][1]=a,this}return qi=e,qi}var Hi,Bu;function eg(){if(Bu)return Hi;Bu=1;var r=Kd(),e=Zd(),t=Qd(),a=Jd(),n=jd();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Hi=i,Hi}var Yi,Fu;function tg(){if(Fu)return Yi;Fu=1;var r=fo(),e=Fn(),t=r(e,"Map");return Yi=t,Yi}var $i,_u;function rg(){if(_u)return $i;_u=1;var r=Wd(),e=eg(),t=tg();function a(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return $i=a,$i}var Xi,Gu;function ag(){if(Gu)return Xi;Gu=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Xi=r,Xi}var Wi,zu;function Hn(){if(zu)return Wi;zu=1;var r=ag();function e(t,a){var n=t.__data__;return r(a)?n[typeof a=="string"?"string":"hash"]:n.map}return Wi=e,Wi}var Ki,Vu;function ng(){if(Vu)return Ki;Vu=1;var r=Hn();function e(t){var a=r(this,t).delete(t);return this.size-=a?1:0,a}return Ki=e,Ki}var Zi,Uu;function ig(){if(Uu)return Zi;Uu=1;var r=Hn();function e(t){return r(this,t).get(t)}return Zi=e,Zi}var Qi,qu;function sg(){if(qu)return Qi;qu=1;var r=Hn();function e(t){return r(this,t).has(t)}return Qi=e,Qi}var Ji,Hu;function og(){if(Hu)return Ji;Hu=1;var r=Hn();function e(t,a){var n=r(this,t),i=n.size;return n.set(t,a),this.size+=n.size==i?0:1,this}return Ji=e,Ji}var ji,Yu;function ug(){if(Yu)return ji;Yu=1;var r=rg(),e=ng(),t=ig(),a=sg(),n=og();function i(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,ji=i,ji}var es,$u;function lg(){if($u)return es;$u=1;var r=ug(),e="Expected a function";function t(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var s=arguments,o=n?n.apply(this,s):s[0],u=i.cache;if(u.has(o))return u.get(o);var l=a.apply(this,s);return i.cache=u.set(o,l)||u,l};return i.cache=new(t.Cache||r),i}return t.Cache=r,es=t,es}var ts,Xu;function fg(){if(Xu)return ts;Xu=1;var r=lg(),e=500;function t(a){var n=r(a,function(s){return i.size===e&&i.clear(),s}),i=n.cache;return n}return ts=t,ts}var rs,Wu;function Gf(){if(Wu)return rs;Wu=1;var r=fg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,a=r(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(s,o,u,l){i.push(u?l.replace(t,"$1"):o||s)}),i});return rs=a,rs}var as,Ku;function zf(){if(Ku)return as;Ku=1;function r(e,t){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}return as=r,as}var ns,Zu;function cg(){if(Zu)return ns;Zu=1;var r=to(),e=zf(),t=Vn(),a=Fa(),n=r?r.prototype:void 0,i=n?n.toString:void 0;function s(o){if(typeof o=="string")return o;if(t(o))return e(o,s)+"";if(a(o))return i?i.call(o):"";var u=o+"";return u=="0"&&1/o==-1/0?"-0":u}return ns=s,ns}var is,Qu;function Vf(){if(Qu)return is;Qu=1;var r=cg();function e(t){return t==null?"":r(t)}return is=e,is}var ss,Ju;function Uf(){if(Ju)return ss;Ju=1;var r=Vn(),e=Bd(),t=Gf(),a=Vf();function n(i,s){return r(i)?i:e(i,s)?[i]:t(a(i))}return ss=n,ss}var os,ju;function co(){if(ju)return os;ju=1;var r=Fa();function e(t){if(typeof t=="string"||r(t))return t;var a=t+"";return a=="0"&&1/t==-1/0?"-0":a}return os=e,os}var us,el;function vg(){if(el)return us;el=1;var r=Uf(),e=co();function t(a,n){n=r(n,a);for(var i=0,s=n.length;a!=null&&i<s;)a=a[e(n[i++])];return i&&i==s?a:void 0}return us=t,us}var ls,tl;function hg(){if(tl)return ls;tl=1;var r=vg();function e(t,a,n){var i=t==null?void 0:r(t,a);return i===void 0?n:i}return ls=e,ls}var dg=hg(),gg=ka(dg),fs,rl;function pg(){if(rl)return fs;rl=1;var r=fo(),e=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}}();return fs=e,fs}var cs,al;function yg(){if(al)return cs;al=1;var r=pg();function e(t,a,n){a=="__proto__"&&r?r(t,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[a]=n}return cs=e,cs}var vs,nl;function mg(){if(nl)return vs;nl=1;var r=yg(),e=_f(),t=Object.prototype,a=t.hasOwnProperty;function n(i,s,o){var u=i[s];(!(a.call(i,s)&&e(u,o))||o===void 0&&!(s in i))&&r(i,s,o)}return vs=n,vs}var hs,il;function bg(){if(il)return hs;il=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(a,n){var i=typeof a;return n=n??r,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return hs=t,hs}var ds,sl;function wg(){if(sl)return ds;sl=1;var r=mg(),e=Uf(),t=bg(),a=Ba(),n=co();function i(s,o,u,l){if(!a(s))return s;o=e(o,s);for(var f=-1,c=o.length,v=c-1,h=s;h!=null&&++f<c;){var d=n(o[f]),p=u;if(d==="__proto__"||d==="constructor"||d==="prototype")return s;if(f!=v){var g=h[d];p=l?l(g,d,h):void 0,p===void 0&&(p=a(g)?g:t(o[f+1])?[]:{})}r(h,d,p),h=h[d]}return s}return ds=i,ds}var gs,ol;function Eg(){if(ol)return gs;ol=1;var r=wg();function e(t,a,n){return t==null?t:r(t,a,n)}return gs=e,gs}var xg=Eg(),Tg=ka(xg),ps,ul;function Cg(){if(ul)return ps;ul=1;function r(e,t){var a=-1,n=e.length;for(t||(t=Array(n));++a<n;)t[a]=e[a];return t}return ps=r,ps}var ys,ll;function Dg(){if(ll)return ys;ll=1;var r=zf(),e=Cg(),t=Vn(),a=Fa(),n=Gf(),i=co(),s=Vf();function o(u){return t(u)?r(u,i):a(u)?[u]:e(n(s(u)))}return ys=o,ys}var Sg=Dg(),Ag=ka(Sg),Lg={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=de({},t,e),function(n,i){var s=e,o=this,u=o.length!==void 0,l=u?o:[o],f=u?o[0]:o;if(ce(n)){var c=n.indexOf(".")!==-1,v=c&&Ag(n);if(s.allowGetting&&i===void 0){var h;return f&&(s.beforeGet(f),v&&f._private[s.field][n]===void 0?h=gg(f._private[s.field],v):h=f._private[s.field][n]),h}else if(s.allowSetting&&i!==void 0){var d=!s.immutableKeys[n];if(d){var p=af({},n,i);s.beforeSet(o,p);for(var g=0,y=l.length;g<y;g++){var b=l[g];s.canSet(b)&&(v&&f._private[s.field][n]===void 0?Tg(b._private[s.field],v,i):b._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Re(n)){var m=n,E,x,S=Object.keys(m);s.beforeSet(o,m);for(var w=0;w<S.length;w++){E=S[w],x=m[E];var T=!s.immutableKeys[E];if(T)for(var C=0;C<l.length;C++){var D=l[C];s.canSet(D)&&(D._private[s.field][E]=x)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Ye(n)){var A=n;o.on(s.bindingEvent,A)}else if(s.allowGetting&&n===void 0){var L;return f&&(s.beforeGet(f),L=f._private[s.field]),L}return o}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=de({},t,e),function(n){var i=e,s=this,o=s.length!==void 0,u=o?s:[s];if(ce(n)){for(var l=n.split(/\s+/),f=l.length,c=0;c<f;c++){var v=l[c];if(!or(v)){var h=!i.immutableKeys[v];if(h)for(var d=0,p=u.length;d<p;d++)u[d]._private[i.field][v]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(n===void 0){for(var g=0,y=u.length;g<y;g++)for(var b=u[g]._private[i.field],m=Object.keys(b),E=0;E<m.length;E++){var x=m[E],S=!i.immutableKeys[x];S&&(b[x]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},Rg={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(a,n){var i=this,s=Array.prototype.slice.call(arguments,0);return new aa(function(o,u){var l=function(h){i.off.apply(i,c),o(h)},f=s.concat([l]),c=f.concat([]);i.on.apply(i,f)})}}},Oe={};[kd,Lg,Rg].forEach(function(r){de(Oe,r)});var Ig={animate:Oe.animate(),animation:Oe.animation(),animated:Oe.animated(),clearQueue:Oe.clearQueue(),delay:Oe.delay(),delayAnimation:Oe.delayAnimation(),stop:Oe.stop()},cn={classes:function(e){var t=this;if(e===void 0){var a=[];return t[0]._private.classes.forEach(function(d){return a.push(d)}),a}else _e(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new ra(e),s=0;s<t.length;s++){for(var o=t[s],u=o._private,l=u.classes,f=!1,c=0;c<e.length;c++){var v=e[c],h=l.has(v);if(!h){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){_e(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],s=0,o=a.length;s<o;s++)for(var u=a[s],l=u._private.classes,f=!1,c=0;c<e.length;c++){var v=e[c],h=l.has(v),d=!1;t||n&&!h?(l.add(v),d=!0):(!t||n&&h)&&(l.delete(v),d=!0),!f&&d&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};cn.className=cn.classNames=cn.classes;var Le={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:rt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Le.variable="(?:[\\w-.]|(?:\\\\"+Le.metaChar+"))+";Le.className="(?:[\\w-]|(?:\\\\"+Le.metaChar+"))+";Le.value=Le.string+"|"+Le.number;Le.id=Le.variable;(function(){var r,e,t;for(r=Le.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],Le.comparatorOp+="|@"+e;for(r=Le.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(Le.comparatorOp+="|\\!"+e)})();var Be=function(){return{checks:[]}},ie={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},_s=[{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(r,e){return Mv(r.selector,e.selector)}),Mg=function(){for(var r={},e,t=0;t<_s.length;t++)e=_s[t],r[e.selector]=e.matches;return r}(),Og=function(e,t){return Mg[e](t)},Pg="("+_s.map(function(r){return r.selector}).join("|")+")",Br=function(e){return e.replace(new RegExp("\\\\("+Le.metaChar+")","g"),function(t,a){return a})},ar=function(e,t,a){e[e.length-1]=a},Gs=[{name:"group",query:!0,regex:"("+Le.group+")",populate:function(e,t,a){var n=et(a,1),i=n[0];t.checks.push({type:ie.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Pg,populate:function(e,t,a){var n=et(a,1),i=n[0];t.checks.push({type:ie.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Le.id+")",populate:function(e,t,a){var n=et(a,1),i=n[0];t.checks.push({type:ie.ID,value:Br(i)})}},{name:"className",query:!0,regex:"\\.("+Le.className+")",populate:function(e,t,a){var n=et(a,1),i=n[0];t.checks.push({type:ie.CLASS,value:Br(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Le.variable+")\\s*\\]",populate:function(e,t,a){var n=et(a,1),i=n[0];t.checks.push({type:ie.DATA_EXIST,field:Br(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Le.variable+")\\s*("+Le.comparatorOp+")\\s*("+Le.value+")\\s*\\]",populate:function(e,t,a){var n=et(a,3),i=n[0],s=n[1],o=n[2],u=new RegExp("^"+Le.string+"$").exec(o)!=null;u?o=o.substring(1,o.length-1):o=parseFloat(o),t.checks.push({type:ie.DATA_COMPARE,field:Br(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Le.boolOp+")\\s*("+Le.variable+")\\s*\\]",populate:function(e,t,a){var n=et(a,2),i=n[0],s=n[1];t.checks.push({type:ie.DATA_BOOL,field:Br(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Le.meta+")\\s*("+Le.comparatorOp+")\\s*("+Le.number+")\\s*\\]\\]",populate:function(e,t,a){var n=et(a,3),i=n[0],s=n[1],o=n[2];t.checks.push({type:ie.META_COMPARE,field:Br(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Le.separator,populate:function(e,t){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];a!=null&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Be();return o}},{name:"directedEdge",separator:!0,regex:Le.directedEdge,populate:function(e,t){if(e.currentSubject==null){var a=Be(),n=t,i=Be();return a.checks.push({type:ie.DIRECTED_EDGE,source:n,target:i}),ar(e,t,a),e.edgeCount++,i}else{var s=Be(),o=t,u=Be();return s.checks.push({type:ie.NODE_SOURCE,source:o,target:u}),ar(e,t,s),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Le.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var a=Be(),n=t,i=Be();return a.checks.push({type:ie.UNDIRECTED_EDGE,nodes:[n,i]}),ar(e,t,a),e.edgeCount++,i}else{var s=Be(),o=t,u=Be();return s.checks.push({type:ie.NODE_NEIGHBOR,node:o,neighbor:u}),ar(e,t,s),u}}},{name:"child",separator:!0,regex:Le.child,populate:function(e,t){if(e.currentSubject==null){var a=Be(),n=Be(),i=e[e.length-1];return a.checks.push({type:ie.CHILD,parent:i,child:n}),ar(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var s=Be(),o=e[e.length-1],u=Be(),l=Be(),f=Be(),c=Be();return s.checks.push({type:ie.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:ie.TRUE}],c.checks.push({type:ie.TRUE}),u.checks.push({type:ie.PARENT,parent:c,child:f}),ar(e,o,s),e.currentSubject=l,e.compoundCount++,f}else{var v=Be(),h=Be(),d=[{type:ie.PARENT,parent:v,child:h}];return v.checks=t.checks,t.checks=d,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Le.descendant,populate:function(e,t){if(e.currentSubject==null){var a=Be(),n=Be(),i=e[e.length-1];return a.checks.push({type:ie.DESCENDANT,ancestor:i,descendant:n}),ar(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var s=Be(),o=e[e.length-1],u=Be(),l=Be(),f=Be(),c=Be();return s.checks.push({type:ie.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:ie.TRUE}],c.checks.push({type:ie.TRUE}),u.checks.push({type:ie.ANCESTOR,ancestor:c,descendant:f}),ar(e,o,s),e.currentSubject=l,e.compoundCount++,f}else{var v=Be(),h=Be(),d=[{type:ie.ANCESTOR,ancestor:v,descendant:h}];return v.checks=t.checks,t.checks=d,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Le.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Pe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===ie.DIRECTED_EDGE?n.type=ie.NODE_TARGET:i===ie.UNDIRECTED_EDGE&&(n.type=ie.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Gs.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var Ng=function(e){for(var t,a,n,i=0;i<Gs.length;i++){var s=Gs[i],o=s.name,u=e.match(s.regexObj);if(u!=null){a=u,t=s,n=o;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:a,name:n,remaining:e}},kg=function(e){var t=e.match(/^\s+/);if(t){var a=t[0];e=e.substring(a.length)}return e},Bg=function(e){var t=this,a=t.inputText=e,n=t[0]=Be();for(t.length=1,a=kg(a);;){var i=Ng(a);if(i.expr==null)return Pe("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(t,n,s);if(o===!1)return!1;if(o!=null&&(n=o),a=i.remaining,a.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var f=t[l];if(f.compoundCount>0&&f.edgeCount>0)return Pe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Pe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Pe("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Fg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},t=function(f){return ce(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,c){var v=f.type,h=f.value;switch(v){case ie.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case ie.DATA_COMPARE:{var p=f.field,g=f.operator;return"["+p+a(e(g))+t(h)+"]"}case ie.DATA_BOOL:{var y=f.operator,b=f.field;return"["+e(y)+b+"]"}case ie.DATA_EXIST:{var m=f.field;return"["+m+"]"}case ie.META_COMPARE:{var E=f.operator,x=f.field;return"[["+x+a(e(E))+t(h)+"]]"}case ie.STATE:return h;case ie.ID:return"#"+h;case ie.CLASS:return"."+h;case ie.PARENT:case ie.CHILD:return i(f.parent,c)+a(">")+i(f.child,c);case ie.ANCESTOR:case ie.DESCENDANT:return i(f.ancestor,c)+" "+i(f.descendant,c);case ie.COMPOUND_SPLIT:{var S=i(f.left,c),w=i(f.subject,c),T=i(f.right,c);return S+(S.length>0?" ":"")+w+T}case ie.TRUE:return""}},i=function(f,c){return f.checks.reduce(function(v,h,d){return v+(c===f&&d===0?"$":"")+n(h,c)},"")},s="",o=0;o<this.length;o++){var u=this[o];s+=i(u,u.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},_g={parse:Bg,toString:Fg},qf=function(e,t,a){var n,i=ce(e),s=ae(e),o=ce(a),u,l,f=!1,c=!1,v=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),f=!0),(i||o||f)&&(u=!i&&!s?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),t){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":v=!0,n=e>a;break;case">=":v=!0,n=e>=a;break;case"<":v=!0,n=e<a;break;case"<=":v=!0,n=e<=a;break;default:n=!1;break}return c&&(e!=null||!v)&&(n=!n),n},Gg=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},zg=function(e){return e!==void 0},vo=function(e,t){return e.data(t)},Vg=function(e,t){return e[t]()},Xe=[],qe=function(e,t){return e.checks.every(function(a){return Xe[a.type](a,t)})};Xe[ie.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};Xe[ie.STATE]=function(r,e){var t=r.value;return Og(t,e)};Xe[ie.ID]=function(r,e){var t=r.value;return e.id()===t};Xe[ie.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};Xe[ie.META_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return qf(Vg(e,t),a,n)};Xe[ie.DATA_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return qf(vo(e,t),a,n)};Xe[ie.DATA_BOOL]=function(r,e){var t=r.field,a=r.operator;return Gg(vo(e,t),a)};Xe[ie.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,zg(vo(e,t))};Xe[ie.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],a=r.nodes[1],n=e.source(),i=e.target();return qe(t,n)&&qe(a,i)||qe(a,n)&&qe(t,i)};Xe[ie.NODE_NEIGHBOR]=function(r,e){return qe(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&qe(r.neighbor,t)})};Xe[ie.DIRECTED_EDGE]=function(r,e){return qe(r.source,e.source())&&qe(r.target,e.target())};Xe[ie.NODE_SOURCE]=function(r,e){return qe(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&qe(r.target,t)})};Xe[ie.NODE_TARGET]=function(r,e){return qe(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&qe(r.source,t)})};Xe[ie.CHILD]=function(r,e){return qe(r.child,e)&&qe(r.parent,e.parent())};Xe[ie.PARENT]=function(r,e){return qe(r.parent,e)&&e.children().some(function(t){return qe(r.child,t)})};Xe[ie.DESCENDANT]=function(r,e){return qe(r.descendant,e)&&e.ancestors().some(function(t){return qe(r.ancestor,t)})};Xe[ie.ANCESTOR]=function(r,e){return qe(r.ancestor,e)&&e.descendants().some(function(t){return qe(r.descendant,t)})};Xe[ie.COMPOUND_SPLIT]=function(r,e){return qe(r.subject,e)&&qe(r.left,e)&&qe(r.right,e)};Xe[ie.TRUE]=function(){return!0};Xe[ie.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};Xe[ie.FILTER]=function(r,e){var t=r.value;return t(e)};var Ug=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===ie.ID)return e.getElementById(t[0].checks[0].value).collection();var a=function(i){for(var s=0;s<t.length;s++){var o=t[s];if(qe(o,i))return!0}return!1};return t.text()==null&&(a=function(){return!0}),e.filter(a)},qg=function(e){for(var t=this,a=0;a<t.length;a++){var n=t[a];if(qe(n,e))return!0}return!1},Hg={matches:qg,filter:Ug},fr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ce(e)&&e.match(/^\s*$/)||(Lt(e)?this.addQuery({checks:[{type:ie.COLLECTION,value:e.collection()}]}):Ye(e)?this.addQuery({checks:[{type:ie.FILTER,value:e}]}):ce(e)?this.parse(e)||(this.invalid=!0):He("A selector must be created from a string; found "))},cr=fr.prototype;[_g,Hg].forEach(function(r){return de(cr,r)});cr.text=function(){return this.inputText};cr.size=function(){return this.length};cr.eq=function(r){return this[r]};cr.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};cr.addQuery=function(r){this[this.length++]=r};cr.selector=cr.toString;var ir={allAre:function(e){var t=new fr(e);return this.every(function(a){return t.matches(a)})},is:function(e){var t=new fr(e);return this.some(function(a){return t.matches(a)})},some:function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,a=e.length;return t!==a?!1:t===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(a){return t.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(a){return t.hasElementWithId(a.id())})}};ir.allAreNeighbours=ir.allAreNeighbors;ir.has=ir.contains;ir.equal=ir.equals=ir.same;var Mt=function(e,t){return function(n,i,s,o){var u=n,l=this,f;if(u==null?f="":Lt(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var c=l[0]._private,v=c.traversalCache=c.traversalCache||{},h=v[t]=v[t]||[],d=Lr(f),p=h[d];return p||(h[d]=e.call(l,n,i,s,o))}else return e.call(l,n,i,s,o)}},ta={parent:function(e){var t=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],s=i._private.parent;s&&t.push(s)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];t.push(i)}a=a.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,a=0;a<this.length;a++){var n=this[a],i=n.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:Mt(function(r){for(var e=[],t=0;t<this.length;t++)for(var a=this[t],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function a(n){for(var i=0;i<n.length;i++){var s=n[i];t.push(s),s.children().nonempty()&&a(s.children())}}return a(this.children()),this.spawn(t,!0).filter(e)}};function ho(r,e,t,a){for(var n=[],i=new ra,s=r.cy(),o=s.hasCompoundNodes(),u=0;u<r.length;u++){var l=r[u];t?n.push(l):o&&a(n,i,l)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return r}function Hf(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||r.push(i)}}ta.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ho(this,r,e,Hf)};function Yf(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}ta.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ho(this,r,e,Yf)};function Yg(r,e,t){Yf(r,e,t),Hf(r,e,t)}ta.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ho(this,r,e,Yg)};ta.ancestors=ta.parents;var La,$f;La=$f={data:Oe.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:Oe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Oe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Oe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Oe.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Oe.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};La.attr=La.data;La.removeAttr=La.removeData;var $g=$f,Yn={};function ms(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=r(n,o))}return a}else return}}de(Yn,{degree:ms(function(r,e){return e.source().same(e.target())?2:1}),indegree:ms(function(r,e){return e.target().same(r)?1:0}),outdegree:ms(function(r,e){return e.source().same(r)?1:0})});function Fr(r,e){return function(t){for(var a,n=this.nodes(),i=0;i<n.length;i++){var s=n[i],o=s[r](t);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}de(Yn,{minDegree:Fr("degree",function(r,e){return r<e}),maxDegree:Fr("degree",function(r,e){return r>e}),minIndegree:Fr("indegree",function(r,e){return r<e}),maxIndegree:Fr("indegree",function(r,e){return r>e}),minOutdegree:Fr("outdegree",function(r,e){return r<e}),maxOutdegree:Fr("outdegree",function(r,e){return r>e})});de(Yn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n<a.length;n++)t+=a[n].degree(e);return t}});var kt,Xf,Wf=function(e,t,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:t.x!=null?t.x-s.x:0,y:t.y!=null?t.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},fl={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){Wf(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};kt=Xf={position:Oe.data(fl),silentPosition:Oe.data(de({},fl,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Wf(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(Re(e))t?this.silentPosition(e):this.position(e);else if(Ye(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=a(s,i))&&(t?s.silentPosition(o):s.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,a){var n;if(Re(e)?(n={x:ae(e.x)?e.x:0,y:ae(e.y)?e.y:0},a=t):ce(e)&&ae(t)&&(n={x:0,y:0},n[e]=t),n!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var u=o.position(),l={x:u.x+n.x,y:u.y+n.y};a?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return Re(e)?this.shift(e,!0):ce(e)&&ae(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=Re(e)?e:void 0,u=o!==void 0||t!==void 0&&ce(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];t!==void 0?f.position(e,(t-s[e])/i):o!==void 0&&f.position(Tf(o,i,s))}else{var c=a.position();return o=Gn(c,i,s),e===void 0?o:o[e]}else if(!u)return;return this},relativePosition:function(e,t){var a=this[0],n=this.cy(),i=Re(e)?e:void 0,s=i!==void 0||t!==void 0&&ce(e),o=n.hasCompoundNodes();if(a&&a.isNode())if(s)for(var u=0;u<this.length;u++){var l=this[u],f=o?l.parent():null,c=f&&f.length>0,v=c;c&&(f=f[0]);var h=v?f.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),p=o?a.parent():null,g=p&&p.length>0,y=g;g&&(p=p[0]);var b=y?p.position():{x:0,y:0};return i={x:d.x-b.x,y:d.y-b.y},e===void 0?i:i[e]}else if(!s)return;return this}};kt.modelPosition=kt.point=kt.position;kt.modelPositions=kt.points=kt.positions;kt.renderedPoint=kt.renderedPosition;kt.relativePoint=kt.relativePosition;var Xg=Xf,Qr,pr;Qr=pr={};pr.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:u,w:s-i,h:u-o}};pr.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};pr.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(s){if(!s.isParent())return;var o=s._private,u=s.children(),l=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},c=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),v=o.position;(c.w===0||c.h===0)&&(c={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},c.x1=v.x-c.w/2,c.x2=v.x+c.w/2,c.y1=v.y-c.h/2,c.y2=v.y+c.h/2);function h(C,D,A){var L=0,R=0,I=D+A;return C>0&&I>0&&(L=D/I*C,R=A/I*C),{biasDiff:L,biasComplementDiff:R}}function d(C,D,A,L){if(A.units==="%")switch(L){case"width":return C>0?A.pfValue*C:0;case"height":return D>0?A.pfValue*D:0;case"average":return C>0&&D>0?A.pfValue*(C+D)/2:0;case"min":return C>0&&D>0?C>D?A.pfValue*D:A.pfValue*C:0;case"max":return C>0&&D>0?C>D?A.pfValue*C:A.pfValue*D:0;default:return 0}else return A.units==="px"?A.pfValue:0}var p=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var g=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var y=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var m=h(f.width.val-c.w,p,g),E=m.biasDiff,x=m.biasComplementDiff,S=h(f.height.val-c.h,y,b),w=S.biasDiff,T=S.biasComplementDiff;o.autoPadding=d(c.w,c.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(c.w,f.width.val),v.x=(-E+c.x1+c.x2+x)/2,o.autoHeight=Math.max(c.h,f.height.val),v.y=(-w+c.y1+c.y2+T)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||r)&&(t(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var It=function(e){return e===1/0||e===-1/0?0:e},Nt=function(e,t,a,n,i){n-t===0||i-a===0||t==null||a==null||n==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Tr=function(e,t){return t==null?e:Nt(e,t.x1,t.y1,t.x2,t.y2)},ca=function(e,t,a){return Ct(e,t,a)},en=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,s=i.arrowWidth/2,o=t.pstyle(a+"-arrow-shape").value,u,l;if(o!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},c=f[a]=f[a]||{};c.x1=u-s,c.y1=l-s,c.x2=u+s,c.y2=l+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,ln(c,1),Nt(e,c.x1,c.y1,c.x2,c.y2)}}},bs=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,s=i.rstyle,o=t.pstyle(n+"label").strValue;if(o){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),f=ca(s,"labelWidth",a),c=ca(s,"labelHeight",a),v=ca(s,"labelX",a),h=ca(s,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,p=t.pstyle(n+"text-margin-y").pfValue,g=t.isEdge(),y=t.pstyle(n+"text-rotation"),b=t.pstyle("text-outline-width").pfValue,m=t.pstyle("text-border-width").pfValue,E=m/2,x=t.pstyle("text-background-padding").pfValue,S=2,w=c,T=f,C=T/2,D=w/2,A,L,R,I;if(g)A=v-C,L=v+C,R=h-D,I=h+D;else{switch(u.value){case"left":A=v-T,L=v;break;case"center":A=v-C,L=v+C;break;case"right":A=v,L=v+T;break}switch(l.value){case"top":R=h-w,I=h;break;case"center":R=h-D,I=h+D;break;case"bottom":R=h,I=h+w;break}}var O=d-Math.max(b,E)-x-S,N=d+Math.max(b,E)+x+S,k=p-Math.max(b,E)-x-S,P=p+Math.max(b,E)+x+S;A+=O,L+=N,R+=k,I+=P;var B=a||"main",_=i.labelBounds,F=_[B]=_[B]||{};F.x1=A,F.y1=R,F.x2=L,F.y2=I,F.w=L-A,F.h=I-R,F.leftPad=O,F.rightPad=N,F.topPad=k,F.botPad=P;var G=g&&y.strValue==="autorotate",U=y.pfValue!=null&&y.pfValue!==0;if(G||U){var H=G?ca(i.rstyle,"labelAngle",a):y.pfValue,X=Math.cos(H),$=Math.sin(H),Q=(A+L)/2,re=(R+I)/2;if(!g){switch(u.value){case"left":Q=L;break;case"right":Q=A;break}switch(l.value){case"top":re=I;break;case"bottom":re=R;break}}var J=function(Ne,se){return Ne=Ne-Q,se=se-re,{x:Ne*X-se*$+Q,y:Ne*$+se*X+re}},z=J(A,R),V=J(A,I),Y=J(L,R),ee=J(L,I);A=Math.min(z.x,V.x,Y.x,ee.x),L=Math.max(z.x,V.x,Y.x,ee.x),R=Math.min(z.y,V.y,Y.y,ee.y),I=Math.max(z.y,V.y,Y.y,ee.y)}var ne=B+"Rot",be=_[ne]=_[ne]||{};be.x1=A,be.y1=R,be.x2=L,be.y2=I,be.w=L-A,be.h=I-R,Nt(e,A,R,L,I),Nt(i.labelBounds.all,A,R,L,I)}return e}},Wg=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,s=t.pstyle("shape").value,o=n+i,u=(e.w+o*2)/e.w,l=(e.h+o*2)/e.h,f=0,c=0;["diamond","pentagon","round-triangle"].includes(s)?(u=(e.w+o*2.4)/e.w,c=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?u=(e.w+o*2.4)/e.w:s==="star"?(u=(e.w+o*2.8)/e.w,l=(e.h+o*2.6)/e.h,c=-o/3.8):s==="triangle"?(u=(e.w+o*2.8)/e.w,l=(e.h+o*2.4)/e.h,c=-o/1.4):s==="vee"&&(u=(e.w+o*4.4)/e.w,l=(e.h+o*3.8)/e.h,c=-o*.5);var v=e.h*l-e.h,h=e.w*u-e.w;if(fn(e,[Math.ceil(v/2),Math.ceil(h/2)]),f!=0||c!==0){var d=Mh(e,f,c);Cf(e,d)}}}},Kg=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=At(),o=e._private,u=e.isNode(),l=e.isEdge(),f,c,v,h,d,p,g=o.rstyle,y=u&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(Ve){return Ve.pstyle("display").value!=="none"},m=!n||b(e)&&(!l||b(e.source())&&b(e.target()));if(m){var E=0,x=0;n&&t.includeOverlays&&(E=e.pstyle("overlay-opacity").value,E!==0&&(x=e.pstyle("overlay-padding").value));var S=0,w=0;n&&t.includeUnderlays&&(S=e.pstyle("underlay-opacity").value,S!==0&&(w=e.pstyle("underlay-padding").value));var T=Math.max(x,w),C=0,D=0;if(n&&(C=e.pstyle("width").pfValue,D=C/2),u&&t.includeNodes){var A=e.position();d=A.x,p=A.y;var L=e.outerWidth(),R=L/2,I=e.outerHeight(),O=I/2;f=d-R,c=d+R,v=p-O,h=p+O,Nt(s,f,v,c,h),n&&t.includeOutlines&&Wg(s,e)}else if(l&&t.includeEdges)if(n&&!i){var N=e.pstyle("curve-style").strValue;if(f=Math.min(g.srcX,g.midX,g.tgtX),c=Math.max(g.srcX,g.midX,g.tgtX),v=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),f-=D,c+=D,v-=D,h+=D,Nt(s,f,v,c,h),N==="haystack"){var k=g.haystackPts;if(k&&k.length===2){if(f=k[0].x,v=k[0].y,c=k[1].x,h=k[1].y,f>c){var P=f;f=c,c=P}if(v>h){var B=v;v=h,h=B}Nt(s,f-D,v-D,c+D,h+D)}}else if(N==="bezier"||N==="unbundled-bezier"||N.endsWith("segments")||N.endsWith("taxi")){var _;switch(N){case"bezier":case"unbundled-bezier":_=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":_=g.linePts;break}if(_!=null)for(var F=0;F<_.length;F++){var G=_[F];f=G.x-D,c=G.x+D,v=G.y-D,h=G.y+D,Nt(s,f,v,c,h)}}}else{var U=e.source(),H=U.position(),X=e.target(),$=X.position();if(f=H.x,c=$.x,v=H.y,h=$.y,f>c){var Q=f;f=c,c=Q}if(v>h){var re=v;v=h,h=re}f-=D,c+=D,v-=D,h+=D,Nt(s,f,v,c,h)}if(n&&t.includeEdges&&l&&(en(s,e,"mid-source"),en(s,e,"mid-target"),en(s,e,"source"),en(s,e,"target")),n){var J=e.pstyle("ghost").value==="yes";if(J){var z=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;Nt(s,s.x1+z,s.y1+V,s.x2+z,s.y2+V)}}var Y=o.bodyBounds=o.bodyBounds||{};Qo(Y,s),fn(Y,y),ln(Y,1),n&&(f=s.x1,c=s.x2,v=s.y1,h=s.y2,Nt(s,f-T,v-T,c+T,h+T));var ee=o.overlayBounds=o.overlayBounds||{};Qo(ee,s),fn(ee,y),ln(ee,1);var ne=o.labelBounds=o.labelBounds||{};ne.all!=null?Ih(ne.all):ne.all=At(),n&&t.includeLabels&&(t.includeMainLabels&&bs(s,e,null),l&&(t.includeSourceLabels&&bs(s,e,"source"),t.includeTargetLabels&&bs(s,e,"target")))}return s.x1=It(s.x1),s.y1=It(s.y1),s.x2=It(s.x2),s.y2=It(s.y2),s.w=It(s.x2-s.x1),s.h=It(s.y2-s.y1),s.w>0&&s.h>0&&m&&(fn(s,y),ln(s,1)),s},Kf=function(e){var t=0,a=function(s){return(s?1:0)<<t++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},Zf=function(e){var t=function(o){return Math.round(o)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return Yo([t(a.x),t(a.y),t(n.x),t(n.y)])}else{var i=e.position();return Yo([t(i.x),t(i.y)])}},cl=function(e,t){var a=e._private,n,i=e.isEdge(),s=t==null?vl:Kf(t),o=s===vl;if(a.bbCache==null?(n=Kg(e,Ra),a.bbCache=n,a.bbCachePosKey=Zf(e)):n=a.bbCache,!o){var u=e.isNode();n=At(),(t.includeNodes&&u||t.includeEdges&&!u)&&(t.includeOverlays?Tr(n,a.overlayBounds):Tr(n,a.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Tr(n,a.labelBounds.all):(t.includeMainLabels&&Tr(n,a.labelBounds.mainRot),t.includeSourceLabels&&Tr(n,a.labelBounds.sourceRot),t.includeTargetLabels&&Tr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Ra={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},vl=Kf(Ra),hl=ht(Ra);pr.boundingBox=function(r){var e,t=r===void 0||r.useCache===void 0||r.useCache===!0,a=Jr(function(f){var c=f._private;return c.bbCache==null||c.styleDirty||c.bbCachePosKey!==Zf(f)},function(f){return f.id()});if(t&&this.length===1&&!a(this[0]))r===void 0?r=Ra:r=hl(r),e=cl(this[0],r);else{e=At(),r=r||Ra;var n=hl(r),i=this,s=i.cy(),o=s.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),o&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var u=0;u<i.length;u++){var l=i[u];a(l)&&l.dirtyBoundingBoxCache(),Tr(e,cl(l,n))}}return e.x1=It(e.x1),e.y1=It(e.y1),e.x2=It(e.x2),e.y2=It(e.y2),e.w=It(e.x2-e.x1),e.h=It(e.y2-e.y1),e};pr.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};pr.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),a=t.hasCompoundNodes(),n=t.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),Re(r)){var i=r;r=function(){return i}}var s=function(f,c){return f._private.bbAtOldPos=r(f,c)},o=function(f){return f._private.bbAtOldPos};t.startBatch(),e.forEach(s).silentPositions(r),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=Rh(this.boundingBox({useCache:!1}));return e.silentPositions(o),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),t.endBatch(),u};Qr.boundingbox=Qr.bb=Qr.boundingBox;Qr.renderedBoundingbox=Qr.renderedBoundingBox;var Zg=pr,ma,za;ma=za={};var Qf=function(e){e.uppercaseName=Io(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Io(e.outerName),ma[e.name]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);switch(o.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},ma["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){var o=a[e.name](),u=a.pstyle("border-position").value,l;u==="center"?l=a.pstyle("border-width").pfValue:u==="outside"?l=2*a.pstyle("border-width").pfValue:l=0;var f=2*a.padding();return o+l+f}else return 1},ma["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},ma["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};Qf({name:"width"});Qf({name:"height"});za.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue};za.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};za.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var Qg=za,Jg=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},jg=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return Gn(t(e),a.zoom(),a.pan())}},ep=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return t(e).map(function(s){return Gn(s,i,n)})}},tp=function(e){return e.renderer().getControlPoints(e)},rp=function(e){return e.renderer().getSegmentPoints(e)},ap=function(e){return e.renderer().getSourceEndpoint(e)},np=function(e){return e.renderer().getTargetEndpoint(e)},ip=function(e){return e.renderer().getEdgeMidpoint(e)},dl={controlPoints:{get:tp,mult:!0},segmentPoints:{get:rp,mult:!0},sourceEndpoint:{get:ap},targetEndpoint:{get:np},midpoint:{get:ip}},sp=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},op=Object.keys(dl).reduce(function(r,e){var t=dl[e],a=sp(e);return r[e]=function(){return Jg(this,t.get)},t.mult?r[a]=function(){return ep(this,t.get)}:r[a]=function(){return jg(this,t.get)},r},{}),up=de({},Xg,Zg,Qg,op);/*!
|
|
9
|
-
Event object based on jQuery events, MIT license
|
|
10
|
-
|
|
11
|
-
https://jquery.org/license/
|
|
12
|
-
https://tldrlegal.com/license/mit-license
|
|
13
|
-
https://github.com/jquery/jquery/blob/master/src/event.js
|
|
14
|
-
*/var Jf=function(e,t){this.recycle(e,t)};function va(){return!1}function tn(){return!0}Jf.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=va,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?tn:va):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 a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=tn;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=tn;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tn,this.stopPropagation()},isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va};var jf=/^([^.]+)(\.(?:[^.]+))?$/,lp=".*",ec={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},gl=Object.keys(ec),fp={};function $n(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fp,e=arguments.length>1?arguments[1]:void 0,t=0;t<gl.length;t++){var a=gl[t];this[a]=r[a]||ec[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var vr=$n.prototype,tc=function(e,t,a,n,i,s,o){Ye(n)&&(i=n,n=null),o&&(s==null?s=o:s=de({},s,o));for(var u=_e(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!or(f)){var c=f.match(jf);if(c){var v=c[1],h=c[2]?c[2]:null,d=t(e,f,v,h,n,i,s);if(d===!1)break}}}},pl=function(e,t){return e.addEventFields(e.context,t),new Jf(t.type,t)},cp=function(e,t,a){if(wv(a)){t(e,a);return}else if(Re(a)){t(e,pl(e,a));return}for(var n=_e(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!or(s)){var o=s.match(jf);if(o){var u=o[1],l=o[2]?o[2]:null,f=pl(e,{type:u,namespace:l,target:e.context});t(e,f)}}}};vr.on=vr.addListener=function(r,e,t,a,n){return tc(this,function(i,s,o,u,l,f,c){Ye(f)&&i.listeners.push({event:s,callback:f,type:o,namespace:u,qualifier:l,conf:c})},r,e,t,a,n),this};vr.one=function(r,e,t,a){return this.on(r,e,t,a,{one:!0})};vr.removeListener=vr.off=function(r,e,t,a){var n=this;this.emitting!==0&&(this.listeners=jv(this.listeners));for(var i=this.listeners,s=function(l){var f=i[l];tc(n,function(c,v,h,d,p,g){if((f.type===h||r==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!p||c.qualifierCompare(f.qualifier,p))&&(!g||f.callback===g))return i.splice(l,1),!1},r,e,t,a)},o=i.length-1;o>=0;o--)s(o);return this};vr.removeAllListeners=function(){return this.removeListener("*")};vr.emit=vr.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,_e(e)||(e=[e]),cp(this,function(i,s){t!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=function(){var f=a[u];if(f.type===s.type&&(!f.namespace||f.namespace===s.namespace||f.namespace===lp)&&i.eventMatches(i.context,f,s)){var c=[s];e!=null&&th(c,e),i.beforeEmit(i.context,f,s),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==f}));var v=i.callbackContext(i.context,f,s),h=f.callback.apply(v,c);i.afterEmit(i.context,f,s),h===!1&&(s.stopPropagation(),s.preventDefault())}},u=0;u<n;u++)o();i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},r),this.emitting--,this};var vp={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&Na(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.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()}},rn=function(e){return ce(e)?new fr(e):e},rc={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],a=t._private;a.emitter||(a.emitter=new $n(vp,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,a){for(var n=rn(t),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a)}return this},removeListener:function(e,t,a){for(var n=rn(t),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,a){for(var n=rn(t),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,n,a)}return this},once:function(e,t,a){for(var n=rn(t),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,t){for(var a=0;a<this.length;a++){var n=this[a];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}};Oe.eventAliasesOn(rc);var ac={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(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(ce(e)||Lt(e))return new fr(e).filter(this);if(Ye(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i],o=t?e.apply(t,[s,i,n]):e(s,i,n);o&&a.push(s)}return a}return this.spawn()},not:function(e){if(e){ce(e)&&(e=this.filter(e));for(var t=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||t.push(n)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ce(e)){var t=e;return this.filter(t)}for(var a=this.spawn(),n=this,i=e,s=this.length<e.length,o=s?n:i,u=s?i:n,l=0;l<o.length;l++){var f=o[l];u.has(f)&&a.push(f)}return a},xor:function(e){var t=this._private.cy;ce(e)&&(e=t.$(e));var a=this.spawn(),n=this,i=e,s=function(u,l){for(var f=0;f<u.length;f++){var c=u[f],v=c._private.data.id,h=l.hasElementWithId(v);h||a.push(c)}};return s(n,i),s(i,n),a},diff:function(e){var t=this._private.cy;ce(e)&&(e=t.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),s=this,o=e,u=function(f,c,v){for(var h=0;h<f.length;h++){var d=f[h],p=d._private.data.id,g=c.hasElementWithId(p);g?i.merge(d):v.push(d)}};return u(s,o,a),u(o,s,n),{left:a,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(ce(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&n.push(s)}return n},merge:function(e){var t=this._private,a=t.cy;if(!e)return this;if(e&&ce(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=t.map,s=0;s<e.length;s++){var o=e[s],u=o._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=o,i.set(u,{ele:o,index:f})}}return this},unmergeAt:function(e){var t=this[e],a=t.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ce(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;i<n.length;i++){var s=n[i],o=t?e.apply(t,[s,i,n]):e(s,i,n);a.push(o)}return a},reduce:function(e,t){for(var a=t,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,t){for(var a=-1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],u=t?e.apply(t,[o,s,i]):e(o,s,i);u>a&&(a=u,n=o)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],u=t?e.apply(t,[o,s,i]):e(o,s,i);u<a&&(a=u,n=o)}return{value:a,ele:n}}},Me=ac;Me.u=Me["|"]=Me["+"]=Me.union=Me.or=Me.add;Me["\\"]=Me["!"]=Me["-"]=Me.difference=Me.relativeComplement=Me.subtract=Me.not;Me.n=Me["&"]=Me["."]=Me.and=Me.intersection=Me.intersect;Me["^"]=Me["(+)"]=Me["(-)"]=Me.symmetricDifference=Me.symdiff=Me.xor;Me.fnFilter=Me.filterFn=Me.stdFilter=Me.filter;Me.complement=Me.abscomp=Me.absoluteComplement;var hp={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}},nc=function(e,t){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var c=f.pstyle("z-compound-depth");return c.value==="auto"?n?f.zDepth():0:c.value==="bottom"?-1:c.value==="top"?ro:0}var s=i(e)-i(t);if(s!==0)return s;function o(f){var c=f.pstyle("z-index-compare");return c.value==="auto"&&f.isNode()?1:0}var u=o(e)-o(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},Rn={forEach:function(e,t){if(Ye(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],s=t?e.apply(t,[i,n,this]):e(i,n,this);if(s===!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 a=[],n=this.length;t==null&&(t=n),e==null&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)a.push(this[i]);return this.spawn(a)},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(!Ye(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(nc)},zDepth:function(){var e=this[0];if(e){var t=e._private,a=t.group;if(a==="nodes"){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:ro-1}else{var i=t.source,s=t.target,o=i.zDepth(),u=s.zDepth();return Math.max(o,u,0)}}}};Rn.each=Rn.forEach;var dp=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":at(Symbol))!=e&&at(Symbol.iterator)!=e;t&&(Rn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return af({next:function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};dp();var gp=ht({nodeDimensionsIncludeLabels:!1}),vn={layoutDimensions:function(e){e=gp(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();t={w:a.w,h:a.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,a){var n=this.nodes().filter(function(x){return!x.isParent()}),i=this.cy(),s=t.eles,o=function(S){return S.id()},u=Jr(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(S,w,T){var C={x:w.x1+w.w/2,y:w.y1+w.h/2},D={x:(T.x-C.x)*S,y:(T.y-C.y)*S};return{x:C.x+D.x,y:C.y+D.y}},f=t.spacingFactor&&t.spacingFactor!==1,c=function(){if(!f)return null;for(var S=At(),w=0;w<n.length;w++){var T=n[w],C=u(T,w);Oh(S,C.x,C.y)}return S},v=c(),h=Jr(function(x,S){var w=u(x,S);if(f){var T=Math.abs(t.spacingFactor);w=l(T,v,w)}return t.transform!=null&&(w=t.transform(x,w)),w},o);if(t.animate){for(var d=0;d<n.length;d++){var p=n[d],g=h(p,d),y=t.animateFilter==null||t.animateFilter(p,d);if(y){var b=p.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else p.position(g)}if(t.fit){var m=i.animation({fit:{boundingBox:s.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}else if(t.zoom!==void 0&&t.pan!==void 0){var E=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(E)}e.animations.forEach(function(x){return x.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),aa.all(e.animations.map(function(x){return x.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(de({},e,{eles:this}))}};vn.createLayout=vn.makeLayout=vn.layout;function ic(r,e,t){var a=t._private,n=a.styleCache=a.styleCache||[],i;return(i=n[r])!=null||(i=n[r]=e(t)),i}function Xn(r,e){return r=Lr(r),function(a){return ic(r,e,a)}}function Wn(r,e){r=Lr(r);var t=function(n){return e.call(n)};return function(){var n=this[0];if(n)return ic(r,t,n)}}var ct={recalculateRenderedStyle:function(e){var t=this.cy(),a=t.renderer(),n=t.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(t)}else this.forEach(function(n){t(n),n.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var a=t._private.batchStyleEles;return a.merge(this),this}var n=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var a=this[t];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Re(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ce(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}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(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!t)return i;var s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){var u=s[o],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],a=t.cy().hasCompoundNodes();if(t)return a?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function ws(r,e){var t=r._private,a=t.data.parent?r.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function go(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,a=r.parentOk||r.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||ws(i,a);var u=o.source,l=o.target;return t(u)&&(!s||ws(u,t))&&(u===l||t(l)&&(!s||ws(l,t)))}}}var na=Xn("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});ct.takesUpSpace=Wn("takesUpSpace",go({ok:na}));var pp=Xn("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&na(r)}),yp=Xn("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&na(r)});ct.interactive=Wn("interactive",go({ok:pp,parentOk:yp,edgeOkViaNode:na}));ct.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var mp=Xn("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&na(r)}),bp=na;ct.visible=Wn("visible",go({ok:mp,edgeOkViaNode:bp}));ct.hidden=function(){var r=this[0];if(r)return!r.visible()};ct.isBundledBezier=Wn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ct.bypass=ct.css=ct.style;ct.renderedCss=ct.renderedStyle;ct.removeBypass=ct.removeCss=ct.removeStyle;ct.pstyle=ct.parsedStyle;var sr={};function yl(r){return function(){var e=arguments,t=[];if(e.length===2){var a=e[0],n=e[1];this.on(r.event,a,n)}else if(e.length===1&&Ye(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&_e(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var u=this[o],l=!r.ableField||u._private[r.ableField],f=u._private[r.field]!=r.value;if(r.overrideAble){var c=r.overrideAble(u);if(c!==void 0&&(l=c,!c))return this}l&&(u._private[r.field]=r.value,f&&t.push(u))}var v=this.spawn(t);v.updateStyle(),v.emit(r.event),s&&v.emit(s)}return this}}function ia(r){sr[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(t!==void 0)return t}return e._private[r.field]}},sr[r.on]=yl({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),sr[r.off]=yl({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}ia({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});ia({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});ia({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});ia({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});sr.deselect=sr.unselect;sr.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};ia({field:"active",on:"activate",off:"unactivate"});ia({field:"pannable",on:"panify",off:"unpanify"});sr.inactive=function(){var r=this[0];if(r)return!r._private.active};var pt={},ml=function(e){return function(a){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode()){for(var u=!1,l=o.connectedEdges(),f=0;f<l.length;f++){var c=l[f],v=c.source(),h=c.target();if(e.noIncomingEdges&&h===o&&v!==o||e.noOutgoingEdges&&v===o&&h!==o){u=!0;break}}u||i.push(o)}}return this.spawn(i,!0).filter(a)}},bl=function(e){return function(t){for(var a=this,n=[],i=0;i<a.length;i++){var s=a[i];if(s.isNode())for(var o=s.connectedEdges(),u=0;u<o.length;u++){var l=o[u],f=l.source(),c=l.target();e.outgoing&&f===s?(n.push(l),n.push(c)):e.incoming&&c===s&&(n.push(l),n.push(f))}}return this.spawn(n,!0).filter(t)}},wl=function(e){return function(t){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(s.length===0)break;for(var o=!1,u=0;u<s.length;u++){var l=s[u],f=l.id();i[f]||(i[f]=!0,n.push(l),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(t)}};pt.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};de(pt,{roots:ml({noIncomingEdges:!0}),leaves:ml({noOutgoingEdges:!0}),outgoers:Mt(bl({outgoing:!0}),"outgoers"),successors:wl({outgoing:!0}),incomers:Mt(bl({incoming:!0}),"incomers"),predecessors:wl({})});de(pt,{neighborhood:Mt(function(r){for(var e=[],t=this.nodes(),a=0;a<t.length;a++)for(var n=t[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],u=o.source(),l=o.target(),f=n===u?l:u;f.length>0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});pt.neighbourhood=pt.neighborhood;pt.closedNeighbourhood=pt.closedNeighborhood;pt.openNeighbourhood=pt.openNeighborhood;de(pt,{source:Mt(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:Mt(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:El({attr:"source"}),targets:El({attr:"target"})});function El(r){return function(t){for(var a=[],n=0;n<this.length;n++){var i=this[n],s=i._private[r.attr];s&&a.push(s)}return this.spawn(a,!0).filter(t)}}de(pt,{edgesWith:Mt(xl(),"edgesWith"),edgesTo:Mt(xl({thisIsSrc:!0}),"edgesTo")});function xl(r){return function(t){var a=[],n=this._private.cy,i=r||{};ce(t)&&(t=n.$(t));for(var s=0;s<t.length;s++)for(var o=t[s]._private.edges,u=0;u<o.length;u++){var l=o[u],f=l._private.data,c=this.hasElementWithId(f.source)&&t.hasElementWithId(f.target),v=t.hasElementWithId(f.source)&&this.hasElementWithId(f.target),h=c||v;h&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!v)||a.push(l))}return this.spawn(a,!0)}}de(pt,{connectedEdges:Mt(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];if(n.isNode())for(var i=n._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:Mt(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:Mt(Tl(),"parallelEdges"),codirectedEdges:Mt(Tl({codirected:!0}),"codirectedEdges")});function Tl(r){var e={codirected:!1};return r=de({},e,r),function(a){for(var n=[],i=this.edges(),s=r,o=0;o<i.length;o++)for(var u=i[o],l=u._private,f=l.source,c=f._private.data.id,v=l.data.target,h=f._private.edges,d=0;d<h.length;d++){var p=h[d],g=p._private.data,y=g.target,b=g.source,m=y===v&&b===c,E=c===y&&v===b;(s.codirected&&m||!s.codirected&&(m||E))&&n.push(p)}return this.spawn(n,!0).filter(a)}}de(pt,{components:function(e){var t=this,a=t.cy(),n=a.collection(),i=e==null?t.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=function(f,c){n.merge(f),i.unmerge(f),c.merge(f)};if(i.empty())return t.spawn();var u=function(){var f=a.collection();s.push(f);var c=i[0];o(c,f),t.bfs({directed:!1,roots:c,visit:function(h){return o(h,f)}}),f.forEach(function(v){v.connectedEdges().forEach(function(h){t.has(h)&&f.has(h.source())&&f.has(h.target())&&f.merge(h)})})};do u();while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});pt.componentsOf=pt.components;var vt=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){He("A collection must have a reference to the core");return}var i=new Zt,s=!1;if(!t)t=[];else if(t.length>0&&Re(t[0])&&!Na(t[0])){s=!0;for(var o=[],u=new ra,l=0,f=t.length;l<f;l++){var c=t[l];c.data==null&&(c.data={});var v=c.data;if(v.id==null)v.id=Ef();else if(e.hasElementWithId(v.id)||u.has(v.id))continue;var h=new _n(e,c,!1);o.push(h),u.add(v.id)}t=o}this.length=0;for(var d=0,p=t.length;d<p;d++){var g=t[d][0];if(g!=null){var y=g._private.data.id;(!a||!i.has(y))&&(a&&i.set(y,{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(b){this.lazyMap=b},rebuildMap:function(){for(var m=this.lazyMap=new Zt,E=this.eles,x=0;x<E.length;x++){var S=E[x];m.set(S.id(),{index:x,ele:S})}}},a&&(this._private.map=i),s&&!n&&this.restore()},ze=_n.prototype=vt.prototype=Object.create(Array.prototype);ze.instanceString=function(){return"collection"};ze.spawn=function(r,e){return new vt(this.cy(),r,e)};ze.spawnSelf=function(){return this.spawn(this)};ze.cy=function(){return this._private.cy};ze.renderer=function(){return this._private.cy.renderer()};ze.element=function(){return this[0]};ze.collection=function(){return of(this)?this:new vt(this._private.cy,[this])};ze.unique=function(){return new vt(this._private.cy,this,!0)};ze.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};ze.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new vt(e)};ze.$id=ze.getElementById;ze.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};ze.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};ze.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};ze.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var a=e._private;if(Re(r)){if(t.startBatch(),r.data){e.data(r.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=r.data.source,u=r.data.target;o!=null&&o!=n.source&&(s.source=""+o,i=!0),u!=null&&u!=n.target&&(s.target=""+u,i=!0),i&&(e=e.move(s))}else{var l="parent"in r.data,f=r.data.parent;l&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}r.position&&e.position(r.position);var c=function(p,g,y){var b=r[p];b!=null&&b!==a[p]&&(b?e[g]():e[y]())};return c("removed","remove","restore"),c("selected","select","unselect"),c("selectable","selectify","unselectify"),c("locked","lock","unlock"),c("grabbable","grabify","ungrabify"),c("pannable","panify","unpanify"),r.classes!=null&&e.classes(r.classes),t.endBatch(),this}else if(r===void 0){var v={data:qt(a.data),position:qt(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};v.classes="";var h=0;return a.classes.forEach(function(d){return v.classes+=h++===0?d:" "+d}),v}}};ze.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],a=t.json();r.push(a)}return r};ze.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var a=this[t],n=a.json(),i=new _n(r,n,!1);e.push(i)}return new vt(r,e)};ze.copy=ze.clone;ze.restore=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],s=[],o,u=0,l=t.length;u<l;u++){var f=t[u];e&&!f.removed()||(f.isNode()?i.push(f):s.push(f))}o=i.concat(s);var c,v=function(){o.splice(c,1),c--};for(c=0;c<o.length;c++){var h=o[c],d=h._private,p=d.data;if(h.clearTraversalCache(),!(!e&&!d.removed)){if(p.id===void 0)p.id=Ef();else if(ae(p.id))p.id=""+p.id;else if(or(p.id)||!ce(p.id)){He("Can not create element with invalid string ID `"+p.id+"`"),v();continue}else if(a.hasElementWithId(p.id)){He("Can not create second element with ID `"+p.id+"`"),v();continue}}var g=p.id;if(h.isNode()){var y=d.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(h.isEdge()){for(var b=h,m=["source","target"],E=m.length,x=!1,S=0;S<E;S++){var w=m[S],T=p[w];ae(T)&&(T=p[w]=""+p[w]),T==null||T===""?(He("Can not create edge `"+g+"` with unspecified "+w),x=!0):a.hasElementWithId(T)||(He("Can not create edge `"+g+"` with nonexistant "+w+" `"+T+"`"),x=!0)}if(x){v();continue}var C=a.getElementById(p.source),D=a.getElementById(p.target);C.same(D)?C._private.edges.push(b):(C._private.edges.push(b),D._private.edges.push(b)),b._private.source=C,b._private.target=D}d.map=new Zt,d.map.set(g,{ele:h,index:0}),d.removed=!1,e&&a.addToPool(h)}for(var A=0;A<i.length;A++){var L=i[A],R=L._private.data;ae(R.parent)&&(R.parent=""+R.parent);var I=R.parent,O=I!=null;if(O||L._private.parent){var N=L._private.parent?a.collection().merge(L._private.parent):a.getElementById(I);if(N.empty())R.parent=void 0;else if(N[0].removed())Pe("Node added with missing parent, reference to parent removed"),R.parent=void 0,L._private.parent=null;else{for(var k=!1,P=N;!P.empty();){if(L.same(P)){k=!0,R.parent=void 0;break}P=P.parent()}k||(N[0]._private.children.push(L),L._private.parent=N[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var B=o.length===t.length?t:new vt(a,o),_=0;_<B.length;_++){var F=B[_];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var G;n.hasCompoundNodes?G=a.collection().merge(B).merge(B.connectedNodes()).merge(B.parent()):G=B,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?B.emitAndNotify("add"):e&&B.emit("add")}return t};ze.removed=function(){var r=this[0];return r&&r._private.removed};ze.inside=function(){var r=this[0];return r&&!r._private.removed};ze.remove=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function s(I){for(var O=I._private.edges,N=0;N<O.length;N++)u(O[N])}function o(I){for(var O=I._private.children,N=0;N<O.length;N++)u(O[N])}function u(I){var O=n[I.id()];e&&I.removed()||O||(n[I.id()]=!0,I.isNode()?(a.push(I),s(I),o(I)):a.unshift(I))}for(var l=0,f=t.length;l<f;l++){var c=t[l];u(c)}function v(I,O){var N=I._private.edges;ur(N,O),I.clearTraversalCache()}function h(I){I.clearTraversalCache()}var d=[];d.ids={};function p(I,O){O=O[0],I=I[0];var N=I._private.children,k=I.id();ur(N,O),O._private.parent=null,d.ids[k]||(d.ids[k]=!0,d.push(I))}t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var g=0;g<a.length;g++){var y=a[g];if(y.isEdge()){var b=y.source()[0],m=y.target()[0];v(b,y),v(m,y);for(var E=y.parallelEdges(),x=0;x<E.length;x++){var S=E[x];h(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var w=y.parent();w.length!==0&&p(w,y)}e&&(y._private.removed=!0)}var T=i._private.elements;i._private.hasCompoundNodes=!1;for(var C=0;C<T.length;C++){var D=T[C];if(D.isParent()){i._private.hasCompoundNodes=!0;break}}var A=new vt(this.cy(),a);A.size()>0&&(r?A.emitAndNotify("remove"):e&&A.emit("remove"));for(var L=0;L<d.length;L++){var R=d[L];(!e||!R.removed())&&R.updateStyle()}return A};ze.move=function(r){var e=this._private.cy,t=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(r.source!==void 0||r.target!==void 0){var s=i(r.source),o=i(r.target),u=s!=null&&e.hasElementWithId(s),l=o!=null&&e.hasElementWithId(o);(u||l)&&(e.batch(function(){t.remove(a,n),t.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var d=t[h],p=d._private.data;d.isEdge()&&(u&&(p.source=s),l&&(p.target=o))}t.restore(a,n)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var f=i(r.parent),c=f===null||e.hasElementWithId(f);if(c){var v=f===null?void 0:f;e.batch(function(){var h=t.remove(a,n);h.emitAndNotify("moveout");for(var d=0;d<t.length;d++){var p=t[d],g=p._private.data;p.isNode()&&(g.parent=v)}h.restore(a,n)}),t.emitAndNotify("move")}}return this};[Of,Ig,cn,ir,ta,$g,Yn,up,rc,ac,hp,Rn,vn,ct,sr,pt].forEach(function(r){de(ze,r)});var wp={add:function(e){var t,a=this;if(Lt(e)){var n=e;if(n._private.cy===a)t=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}t=new vt(a,i)}}else if(_e(e)){var u=e;t=new vt(a,u)}else if(Re(e)&&(_e(e.nodes)||_e(e.edges))){for(var l=e,f=[],c=["nodes","edges"],v=0,h=c.length;v<h;v++){var d=c[v],p=l[d];if(_e(p))for(var g=0,y=p.length;g<y;g++){var b=de({group:d},p[g]);f.push(b)}}t=new vt(a,f)}else{var m=e;t=new _n(a,m).collection()}return t},remove:function(e){if(!Lt(e)){if(ce(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 Ep(r,e,t,a){var n=4,i=.001,s=1e-7,o=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var c=0;c<4;++c)if(typeof arguments[c]!="number"||isNaN(arguments[c])||!isFinite(arguments[c]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var v=f?new Float32Array(u):new Array(u);function h(D,A){return 1-3*A+3*D}function d(D,A){return 3*A-6*D}function p(D){return 3*D}function g(D,A,L){return((h(A,L)*D+d(A,L))*D+p(A))*D}function y(D,A,L){return 3*h(A,L)*D*D+2*d(A,L)*D+p(A)}function b(D,A){for(var L=0;L<n;++L){var R=y(A,r,t);if(R===0)return A;var I=g(A,r,t)-D;A-=I/R}return A}function m(){for(var D=0;D<u;++D)v[D]=g(D*l,r,t)}function E(D,A,L){var R,I,O=0;do I=A+(L-A)/2,R=g(I,r,t)-D,R>0?L=I:A=I;while(Math.abs(R)>s&&++O<o);return I}function x(D){for(var A=0,L=1,R=u-1;L!==R&&v[L]<=D;++L)A+=l;--L;var I=(D-v[L])/(v[L+1]-v[L]),O=A+I*l,N=y(O,r,t);return N>=i?b(D,O):N===0?O:E(D,A,A+l)}var S=!1;function w(){S=!0,(r!==e||t!==a)&&m()}var T=function(A){return S||w(),r===e&&t===a?A:A===0?0:A===1?1:g(x(A),e,a)};T.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var C="generateBezier("+[r,e,t,a]+")";return T.toString=function(){return C},T}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var xp=function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:r(s)}}function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),u=e(a,n,o),l=1/6*(i.dx+2*(s.dx+o.dx)+u.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,c=16/1e3,v,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,v=s!==null,v?(l=a(n,i),h=l/s*c):h=c;d=t(d||o,h),u.push(1+d.x),l+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return v?function(p){return u[p*(u.length-1)|0]}:l}}(),Ge=function(e,t,a,n){var i=Ep(e,t,a,n);return function(s,o,u){return s+(o-s)*i(u)}},hn={linear:function(e,t,a){return e+(t-e)*a},ease:Ge(.25,.1,.25,1),"ease-in":Ge(.42,0,1,1),"ease-out":Ge(0,0,.58,1),"ease-in-out":Ge(.42,0,.58,1),"ease-in-sine":Ge(.47,0,.745,.715),"ease-out-sine":Ge(.39,.575,.565,1),"ease-in-out-sine":Ge(.445,.05,.55,.95),"ease-in-quad":Ge(.55,.085,.68,.53),"ease-out-quad":Ge(.25,.46,.45,.94),"ease-in-out-quad":Ge(.455,.03,.515,.955),"ease-in-cubic":Ge(.55,.055,.675,.19),"ease-out-cubic":Ge(.215,.61,.355,1),"ease-in-out-cubic":Ge(.645,.045,.355,1),"ease-in-quart":Ge(.895,.03,.685,.22),"ease-out-quart":Ge(.165,.84,.44,1),"ease-in-out-quart":Ge(.77,0,.175,1),"ease-in-quint":Ge(.755,.05,.855,.06),"ease-out-quint":Ge(.23,1,.32,1),"ease-in-out-quint":Ge(.86,0,.07,1),"ease-in-expo":Ge(.95,.05,.795,.035),"ease-out-expo":Ge(.19,1,.22,1),"ease-in-out-expo":Ge(1,0,0,1),"ease-in-circ":Ge(.6,.04,.98,.335),"ease-out-circ":Ge(.075,.82,.165,1),"ease-in-out-circ":Ge(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return hn.linear;var n=xp(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":Ge};function Cl(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function Dl(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function _r(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var s=Dl(r,n),o=Dl(e,n);if(ae(s)&&ae(o))return Cl(i,s,o,t,a);if(_e(s)&&_e(o)){for(var u=[],l=0;l<o.length;l++){var f=s[l],c=o[l];if(f!=null&&c!=null){var v=Cl(i,f,c,t,a);u.push(v)}else u.push(c)}return u}}function Tp(r,e,t,a){var n=!a,i=r._private,s=e._private,o=s.easing,u=s.startTime,l=a?r:r.cy(),f=l.style();if(!s.easingImpl)if(o==null)s.easingImpl=hn.linear;else{var c;if(ce(o)){var v=f.parse("transition-timing-function",o);c=v.value}else c=o;var h,d;ce(c)?(h=c,d=[]):(h=c[1],d=c.slice(2).map(function(B){return+B})),d.length>0?(h==="spring"&&d.push(s.duration),s.easingImpl=hn[h].apply(null,d)):s.easingImpl=hn[h]}var p=s.easingImpl,g;if(s.duration===0?g=1:g=(t-u)/s.duration,s.applying&&(g=s.progress),g<0?g=0:g>1&&(g=1),s.delay==null){var y=s.startPosition,b=s.position;if(b&&n&&!r.locked()){var m={};ha(y.x,b.x)&&(m.x=_r(y.x,b.x,g,p)),ha(y.y,b.y)&&(m.y=_r(y.y,b.y,g,p)),r.position(m)}var E=s.startPan,x=s.pan,S=i.pan,w=x!=null&&a;w&&(ha(E.x,x.x)&&(S.x=_r(E.x,x.x,g,p)),ha(E.y,x.y)&&(S.y=_r(E.y,x.y,g,p)),r.emit("pan"));var T=s.startZoom,C=s.zoom,D=C!=null&&a;D&&(ha(T,C)&&(i.zoom=Sa(i.minZoom,_r(T,C,g,p),i.maxZoom)),r.emit("zoom")),(w||D)&&r.emit("viewport");var A=s.style;if(A&&A.length>0&&n){for(var L=0;L<A.length;L++){var R=A[L],I=R.name,O=R,N=s.startStyle[I],k=f.properties[N.name],P=_r(N,O,g,p,k);f.overrideBypass(r,I,P)}r.emit("style")}}return s.progress=g,g}function ha(r,e){return r==null||e==null?!1:ae(r)&&ae(e)?!0:!!(r&&e)}function Cp(r,e,t,a){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}function Sl(r,e){var t=e._private.aniEles,a=[];function n(f,c){var v=f._private,h=v.animation.current,d=v.animation.queue,p=!1;if(h.length===0){var g=d.shift();g&&h.push(g)}for(var y=function(S){for(var w=S.length-1;w>=0;w--){var T=S[w];T()}S.splice(0,S.length)},b=h.length-1;b>=0;b--){var m=h[b],E=m._private;if(E.stopped){h.splice(b,1),E.hooked=!1,E.playing=!1,E.started=!1,y(E.frames);continue}!E.playing&&!E.applying||(E.playing&&E.applying&&(E.applying=!1),E.started||Cp(f,m,r),Tp(f,m,r,c),E.applying&&(E.applying=!1),y(E.frames),E.step!=null&&E.step(r),m.completed()&&(h.splice(b,1),E.hooked=!1,E.playing=!1,E.started=!1,y(E.completes)),p=!0)}return!c&&h.length===0&&d.length===0&&a.push(f),p}for(var i=!1,s=0;s<t.length;s++){var o=t[s],u=n(o);i=i||u}var l=n(e,!0);(i||l)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var Dp={animate:Oe.animate(),animation:Oe.animation(),animated:Oe.animated(),clearQueue:Oe.clearQueue(),delay:Oe.delay(),delayAnimation:Oe.delayAnimation(),stop:Oe.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&Cn(function(i){Sl(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Sl(s,e)},a.beforeRenderPriorities.animations):t()}},Sp={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&Na(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},an=function(e){return ce(e)?new fr(e):e},sc={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new $n(Sp,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,an(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,an(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,an(t),a),this},once:function(e,t,a){return this.emitter().one(e,an(t),a),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}};Oe.eventAliasesOn(sc);var zs={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};zs.jpeg=zs.jpg;var dn={layout:function(e){var t=this;if(e==null){He("Layout options must be specified to make a layout");return}if(e.name==null){He("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){He("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ce(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var s=new n(de({},e,{cy:t,eles:i}));return s}};dn.createLayout=dn.makeLayout=dn.layout;var Ap={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],s=e[i],o=t.getElementById(i);o.data(s)}})}},Lp=ht({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Vs={renderTo:function(e,t,a,n){var i=this._private.renderer;return i.renderTo(e,t,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,a=t.extension("renderer",e.name);if(a==null){He("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Pe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=Lp(e);n.cy=t,t._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Vs.invalidateDimensions=Vs.resize;var gn={collection:function(e,t){return ce(e)?this.$(e):Lt(e)?e.collection():_e(e)?(t||(t={}),new vt(this,e,t.unique,t.removed)):new vt(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.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}};gn.elements=gn.filter=gn.$;var ut={},wa="t",Rp="f";ut.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i<r.length;i++){var s=r[i],o=e.getContextMeta(s);if(!o.empty){var u=e.getContextStyle(o),l=e.applyContextStyle(o,u,s);s._private.appliedInitStyle?e.updateTransitions(s,l.diffProps):s._private.appliedInitStyle=!0;var f=e.updateStyleHints(s);f&&n.push(s)}}return n};ut.getPropertiesDiff=function(r,e){var t=this,a=t._private.propDiffs=t._private.propDiffs||{},n=r+"-"+e,i=a[n];if(i)return i;for(var s=[],o={},u=0;u<t.length;u++){var l=t[u],f=r[u]===wa,c=e[u]===wa,v=f!==c,h=l.mappedProperties.length>0;if(v||c&&h){var d=void 0;v&&h||v?d=l.properties:h&&(d=l.mappedProperties);for(var p=0;p<d.length;p++){for(var g=d[p],y=g.name,b=!1,m=u+1;m<t.length;m++){var E=t[m],x=e[m]===wa;if(x&&(b=E.properties[g.name]!=null,b))break}!o[y]&&!b&&(o[y]=!0,s.push(y))}}}return a[n]=s,s};ut.getContextMeta=function(r){for(var e=this,t="",a,n=r._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(r);o?t+=wa:t+=Rp}return a=e.getPropertiesDiff(n,t),r._private.styleCxtKey=t,{key:t,diffPropNames:a,empty:a.length===0}};ut.getContextStyle=function(r){var e=r.key,t=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<t.length;i++){var s=t[i],o=e[i]===wa;if(o)for(var u=0;u<s.properties.length;u++){var l=s.properties[u];n[l.name]=l}}return a[e]=n,n};ut.applyContextStyle=function(r,e,t){for(var a=this,n=r.diffPropNames,i={},s=a.types,o=0;o<n.length;o++){var u=n[o],l=e[u],f=t.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===s.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var c=f.mapping,v=c.fnValue=l.value(t);if(v===c.prevFnValue)continue}var h=i[u]={prev:f};a.applyParsedProperty(t,l),h.next=t.pstyle(u),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}};ut.updateStyleHints=function(r){var e=r._private,t=this,a=t.propertyGroupNames,n=t.propertyGroupKeys,i=function(Y,ee,ne){return t.getPropertiesHash(Y,ee,ne)},s=e.styleKey;if(r.removed())return!1;var o=e.group==="nodes",u=r._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var f=n[l];e.styleKeys[f]=[Dr,Hr]}for(var c=function(Y,ee){return e.styleKeys[ee][0]=Ta(Y,e.styleKeys[ee][0])},v=function(Y,ee){return e.styleKeys[ee][1]=Ca(Y,e.styleKeys[ee][1])},h=function(Y,ee){c(Y,ee),v(Y,ee)},d=function(Y,ee){for(var ne=0;ne<Y.length;ne++){var be=Y.charCodeAt(ne);c(be,ee),v(be,ee)}},p=2e9,g=function(Y){return-128<Y&&Y<128&&Math.floor(Y)!==Y?p-(Y*1024|0):Y},y=0;y<a.length;y++){var b=a[y],m=u[b];if(m!=null){var E=this.properties[b],x=E.type,S=E.groupKey,w=void 0;E.hashOverride!=null?w=E.hashOverride(r,m):m.pfValue!=null&&(w=m.pfValue);var T=E.enums==null?m.value:null,C=w!=null,D=T!=null,A=C||D,L=m.units;if(x.number&&A&&!x.multiple){var R=C?w:T;h(g(R),S),!C&&L!=null&&d(L,S)}else d(m.strValue,S)}}for(var I=[Dr,Hr],O=0;O<n.length;O++){var N=n[O],k=e.styleKeys[N];I[0]=Ta(k[0],I[0]),I[1]=Ca(k[1],I[1])}e.styleKey=Wv(I[0],I[1]);var P=e.styleKeys;e.labelDimsKey=rr(P.labelDimensions);var B=i(r,["label"],P.labelDimensions);if(e.labelKey=rr(B),e.labelStyleKey=rr(Ka(P.commonLabel,B)),!o){var _=i(r,["source-label"],P.labelDimensions);e.sourceLabelKey=rr(_),e.sourceLabelStyleKey=rr(Ka(P.commonLabel,_));var F=i(r,["target-label"],P.labelDimensions);e.targetLabelKey=rr(F),e.targetLabelStyleKey=rr(Ka(P.commonLabel,F))}if(o){var G=e.styleKeys,U=G.nodeBody,H=G.nodeBorder,X=G.nodeOutline,$=G.backgroundImage,Q=G.compound,re=G.pie,J=G.stripe,z=[U,H,X,$,Q,re,J].filter(function(V){return V!=null}).reduce(Ka,[Dr,Hr]);e.nodeKey=rr(z),e.hasPie=re!=null&&re[0]!==Dr&&re[1]!==Hr,e.hasStripe=J!=null&&J[0]!==Dr&&J[1]!==Hr}return s!==e.styleKey};ut.clearStyleHints=function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};ut.applyParsedProperty=function(r,e){var t=this,a=e,n=r._private.style,i,s=t.types,o=t.properties[a.name].type,u=a.bypass,l=n[a.name],f=l&&l.bypass,c=r._private,v="mapping",h=function(U){return U==null?null:U.pfValue!=null?U.pfValue:U.value},d=function(){var U=h(l),H=h(a);t.checkTriggers(r,a.name,U,H)};if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,d(),!0):!1:(d(),!0);var p=function(){Pe("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.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 s.mapData:{for(var g=a.field.split("."),y=c.data,b=0;b<g.length&&y;b++){var m=g[b];y=y[m]}if(y==null)return p(),!1;var E;if(ae(y)){var x=a.fieldMax-a.fieldMin;x===0?E=0:E=(y-a.fieldMin)/x}else return Pe("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+y+"` for `"+r.id()+"` is non-numeric)"),!1;if(E<0?E=0:E>1&&(E=1),o.color){var S=a.valueMin[0],w=a.valueMax[0],T=a.valueMin[1],C=a.valueMax[1],D=a.valueMin[2],A=a.valueMax[2],L=a.valueMin[3]==null?1:a.valueMin[3],R=a.valueMax[3]==null?1:a.valueMax[3],I=[Math.round(S+(w-S)*E),Math.round(T+(C-T)*E),Math.round(D+(A-D)*E),Math.round(L+(R-L)*E)];i={bypass:a.bypass,name:a.name,value:I,strValue:"rgb("+I[0]+", "+I[1]+", "+I[2]+")"}}else if(o.number){var O=a.valueMin+(a.valueMax-a.valueMin)*E;i=this.parse(a.name,O,a.bypass,v)}else return!1;if(!i)return p(),!1;i.mapping=a,a=i;break}case s.data:{for(var N=a.field.split("."),k=c.data,P=0;P<N.length&&k;P++){var B=N[P];k=k[B]}if(k!=null&&(i=this.parse(a.name,k,a.bypass,v)),!i)return p(),!1;i.mapping=a,a=i;break}case s.fn:{var _=a.value,F=a.fnValue!=null?a.fnValue:_(r);if(a.prevFnValue=F,F==null)return Pe("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(a.name,F,a.bypass,v),!i)return Pe("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=qt(a),a=i;break}case void 0:break;default:return!1}return u?(f?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):f?l.bypassed=a:n[a.name]=a,d(),!0};ut.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var a=r[t];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],u=n[o];u!=null&&(u.bypass?u.bypassed=null:n[o]=null)}}};ut.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};ut.updateTransitions=function(r,e){var t=this,a=r._private,n=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,s=r.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},u=!1,l=0;l<n.length;l++){var f=n[l],c=r.pstyle(f),v=e[f];if(v){var h=v.prev,d=h,p=v.next!=null?v.next:c,g=!1,y=void 0,b=1e-6;d&&(ae(d.pfValue)&&ae(p.pfValue)?(g=p.pfValue-d.pfValue,y=d.pfValue+b*g):ae(d.value)&&ae(p.value)?(g=p.value-d.value,y=d.value+b*g):_e(d.value)&&_e(p.value)&&(g=d.value[0]!==p.value[0]||d.value[1]!==p.value[1]||d.value[2]!==p.value[2],y=d.strValue),g&&(o[f]=p.strValue,this.applyBypass(r,f,y),u=!0))}}if(!u)return;a.transitioning=!0,new aa(function(m){s>0?r.delayAnimation(s).play().promise().then(m):m()}).then(function(){return r.animation({style:o,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};ut.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);r.removed()||o!=null&&o(t,a,r)&&i(s)};ut.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};ut.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};ut.checkConnectedEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ut.checkParallelEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ut.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a),this.checkConnectedEdgesBoundsTrigger(r,e,t,a),this.checkParallelEdgesBoundsTrigger(r,e,t,a)};var Va={};Va.applyBypass=function(r,e,t,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var o=0;o<n.properties.length;o++){var u=n.properties[o],l=u.name,f=this.parse(l,t,!0);f&&i.push(f)}}else if(ce(e)){var c=this.parse(e,t,!0);c&&i.push(c)}else if(Re(e)){var v=e;a=t;for(var h=Object.keys(v),d=0;d<h.length;d++){var p=h[d],g=v[p];if(g===void 0&&(g=v[Bn(p)]),g!==void 0){var y=this.parse(p,g,!0);y&&i.push(y)}}}else return!1;if(i.length===0)return!1;for(var b=!1,m=0;m<r.length;m++){for(var E=r[m],x={},S=void 0,w=0;w<i.length;w++){var T=i[w];if(a){var C=E.pstyle(T.name);S=x[T.name]={prev:C}}b=this.applyParsedProperty(E,qt(T))||b,a&&(S.next=E.pstyle(T.name))}b&&this.updateStyleHints(E),a&&this.updateTransitions(E,x,s)}return b};Va.overrideBypass=function(r,e,t){e=eo(e);for(var a=0;a<r.length;a++){var n=r[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,u=s.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),o?i.strValue="rgb("+t.join(",")+")":u?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(n)),this.checkTriggers(n,e,l,t)}};Va.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};Va.removeBypasses=function(r,e,t){for(var a=!0,n=0;n<r.length;n++){for(var i=r[n],s={},o=0;o<e.length;o++){var u=e[o],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var c="",v=this.parse(u,c,!0),h=s[l.name]={prev:f};this.applyParsedProperty(i,v),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,s,a)}};var po={};po.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};po.containerCss=function(r){var e=this._private.cy,t=e.container(),a=e.window();if(a&&t&&a.getComputedStyle)return a.getComputedStyle(t).getPropertyValue(r)};var Ht={};Ht.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};Ht.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var a={},n=0;n<t.properties.length;n++){var i=t.properties[n],s=t.getStylePropertyValue(r,i.name,e);s!=null&&(a[i.name]=s,a[Bn(i.name)]=s)}return a}};Ht.getIndexedStyle=function(r,e,t,a){var n=r.pstyle(e)[t][a];return n??r.cy().style().getDefaultProperty(e)[t][0]};Ht.getStylePropertyValue=function(r,e,t){var a=this;if(r=r[0],r){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,s=r.pstyle(n.name);if(s){var o=s.value,u=s.units,l=s.strValue;if(t&&i.number&&o!=null&&ae(o)){var f=r.cy().zoom(),c=function(g){return g*f},v=function(g,y){return c(g)+y},h=_e(o),d=h?u.every(function(p){return p!=null}):u!=null;return d?h?o.map(function(p,g){return v(p,u[g])}).join(" "):v(o,u):h?o.map(function(p){return ce(p)?p:""+c(p)}).join(" "):""+c(o)}else if(l!=null)return l}return null}};Ht.getAnimationStartStyle=function(r,e){for(var t={},a=0;a<e.length;a++){var n=e[a],i=n.name,s=r.pstyle(i);s!==void 0&&(Re(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(t[i]=s)}return t};Ht.getPropsList=function(r){var e=this,t=[],a=r,n=e.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],u=a[o],l=n[o]||n[eo(o)],f=this.parse(l.name,u);f&&t.push(f)}return t};Ht.getNonDefaultPropertiesHash=function(r,e,t){var a=t.slice(),n,i,s,o,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=r.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Ta(o,a[0]),a[1]=Ca(o,a[1]);else for(s=i.strValue,l=0;l<s.length;l++)o=s.charCodeAt(l),a[0]=Ta(o,a[0]),a[1]=Ca(o,a[1]);return a};Ht.getPropertiesHash=Ht.getNonDefaultPropertiesHash;var Kn={};Kn.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var a=r[t],n=a.selector,i=a.style||a.css,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var u=s[o],l=i[u];e.css(u,l)}}return e};Kn.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};Kn.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],a=t.selector,n=t.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}r.push({selector:a?a.toString():"core",style:i})}return r};var yo={};yo.appendFromString=function(r){var e=this,t=this,a=""+r,n,i,s;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){a.length>n.length?a=a.substr(n.length):a=""}function u(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Pe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var c=f[1];if(c!=="core"){var v=new fr(c);if(v.invalid){Pe("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),o();continue}}var h=f[2],d=!1;i=h;for(var p=[];;){var g=i.match(/^\s*$/);if(g)break;var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Pe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}s=y[0];var b=y[1],m=y[2],E=e.properties[b];if(!E){Pe("Skipping property: Invalid property name in: "+s),u();continue}var x=t.parse(b,m);if(!x){Pe("Skipping property: Invalid property definition in: "+s),u();continue}p.push({name:b,val:m}),u()}if(d){o();break}t.selector(c);for(var S=0;S<p.length;S++){var w=p[S];t.css(w.name,w.val)}o()}return t};yo.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var Qe={};(function(){var r=rt,e=Sv,t=Lv,a=Rv,n=Iv,i=function(V){return"^"+V+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(V){var Y=r+"|\\w+|"+e+"|"+t+"|"+a+"|"+n;return"^"+V+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+Y+")\\s*\\,\\s*("+Y+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Qe.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},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:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,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(V,Y){switch(V.length){case 2:return Y[0]!=="deg"&&Y[0]!=="rad"&&Y[1]!=="deg"&&Y[1]!=="rad";case 1:return ce(V[0])||Y[0]==="deg"||Y[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(V){var Y=V.length;return Y===1||Y===2||Y===4}}};var u={zeroNonZero:function(V,Y){return(V==null||Y==null)&&V!==Y||V==0&&Y!=0?!0:V!=0&&Y==0},any:function(V,Y){return V!=Y},emptyNonEmpty:function(V,Y){var ee=or(V),ne=or(Y);return ee&&!ne||!ee&&ne}},l=Qe.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],c=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],v=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],d=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],p=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any}],g=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(V,Y,ee){return V===Y?!1:ee.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],y=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],b=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],m=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],E=function(V,Y){return Y.value==="label"?-V.poolIndex():Y.pfValue},x=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:E},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:E},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],S=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],w=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],T=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],C=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],D=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(V,Y){return V===Y?!1:V==="bezier"||Y==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],A=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],L=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],R=[];Qe.pieBackgroundN=16,R.push({name:"pie-size",type:l.sizeMaybePercent}),R.push({name:"pie-hole",type:l.sizeMaybePercent}),R.push({name:"pie-start-angle",type:l.angle});for(var I=1;I<=Qe.pieBackgroundN;I++)R.push({name:"pie-"+I+"-background-color",type:l.color}),R.push({name:"pie-"+I+"-background-size",type:l.percent}),R.push({name:"pie-"+I+"-background-opacity",type:l.zeroOneNumber});var O=[];Qe.stripeBackgroundN=16,O.push({name:"stripe-size",type:l.sizeMaybePercent}),O.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var N=1;N<=Qe.stripeBackgroundN;N++)O.push({name:"stripe-"+N+"-background-color",type:l.color}),O.push({name:"stripe-"+N+"-background-size",type:l.percent}),O.push({name:"stripe-"+N+"-background-opacity",type:l.zeroOneNumber});var k=[],P=Qe.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(z){P.forEach(function(V){var Y=V+"-"+z.name,ee=z.type,ne=z.triggersBounds;k.push({name:Y,type:ee,triggersBounds:ne})})},{});var B=Qe.properties=[].concat(p,m,g,y,b,A,d,h,f,c,v,x,S,w,T,R,O,C,D,k,L),_=Qe.propertyGroups={behavior:p,transition:m,visibility:g,overlay:y,underlay:b,ghost:A,commonLabel:d,labelDimensions:h,mainLabel:f,sourceLabel:c,targetLabel:v,nodeBody:x,nodeBorder:S,nodeOutline:w,backgroundImage:T,pie:R,stripe:O,compound:C,edgeLine:D,edgeArrow:k,core:L},F=Qe.propertyGroupNames={},G=Qe.propertyGroupKeys=Object.keys(_);G.forEach(function(z){F[z]=_[z].map(function(V){return V.name}),_[z].forEach(function(V){return V.groupKey=z})});var U=Qe.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Qe.propertyNames=B.map(function(z){return z.name});for(var H=0;H<B.length;H++){var X=B[H];B[X.name]=X}for(var $=0;$<U.length;$++){var Q=U[$],re=B[Q.pointsTo],J={name:Q.name,alias:!0,pointsTo:re};B.push(J),B[Q.name]=J}})();Qe.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};Qe.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=de({"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(u,l){for(var f=1;f<=Qe.pieBackgroundN;f++){var c=l.name.replace("{{i}}",f),v=l.value;u[c]=v}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=Qe.stripeBackgroundN;f++){var c=l.name.replace("{{i}}",f),v=l.value;u[c]=v}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return Qe.arrowPrefixes.forEach(function(f){var c=f+"-"+l.name,v=l.value;u[c]=v}),u},{})),t={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);t[i]=o}}return r.defaultProperties=t,r.defaultProperties};Qe.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Zn={};Zn.parse=function(r,e,t,a){var n=this;if(Ye(e))return n.parseImplWarn(r,e,t,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,s=t?"t":"f",o=""+e,u=mf(r,o,s,i),l=n.propCache=n.propCache||[],f;return(f=l[u])||(f=l[u]=n.parseImplWarn(r,e,t,a)),(t||a==="mapping")&&(f=qt(f),f&&(f.value=qt(f.value))),f};Zn.parseImplWarn=function(r,e,t,a){var n=this.parseImpl(r,e,t,a);return!n&&e!=null&&Pe("The style property `".concat(r,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Pe("The style value of `label` is deprecated for `"+n.name+"`"),n};Zn.parseImpl=function(r,e,t,a){var n=this;r=eo(r);var i=n.properties[r],s=e,o=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var u=ce(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(Ye(e))return{name:r,value:e,strValue:"fn",mapped:o.fn,bypass:t};var f,c;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(t)return!1;var v=o.data;return{name:r,value:f,strValue:""+e,mapped:v,field:f[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(c=new RegExp(o.mapData.regex).exec(e))){if(t||l.multiple)return!1;var h=o.mapData;if(!(l.color||l.number))return!1;var d=this.parse(r,c[4]);if(!d||d.mapped)return!1;var p=this.parse(r,c[5]);if(!p||p.mapped)return!1;if(d.pfValue===p.pfValue||d.strValue===p.strValue)return Pe("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(l.color){var g=d.value,y=p.value,b=g[0]===y[0]&&g[1]===y[1]&&g[2]===y[2]&&(g[3]===y[3]||(g[3]==null||g[3]===1)&&(y[3]==null||y[3]===1));if(b)return!1}return{name:r,value:c,strValue:""+e,mapped:h,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:d.value,valueMax:p.value,bypass:t}}}if(l.multiple&&a!=="multiple"){var m;if(u?m=e.split(/\s+/):_e(e)?m=e:m=[e],l.evenMultiple&&m.length%2!==0)return null;for(var E=[],x=[],S=[],w="",T=!1,C=0;C<m.length;C++){var D=n.parse(r,m[C],t,"multiple");T=T||ce(D.value),E.push(D.value),S.push(D.pfValue!=null?D.pfValue:D.value),x.push(D.units),w+=(C>0?" ":"")+D.strValue}return l.validate&&!l.validate(E,x)?null:l.singleEnum&&T?E.length===1&&ce(E[0])?{name:r,value:E[0],strValue:E[0],bypass:t}:null:{name:r,value:E,pfValue:S,strValue:w,bypass:t,units:x}}var A=function(){for(var J=0;J<l.enums.length;J++){var z=l.enums[J];if(z===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(l.number){var L,R="px";if(l.units&&(L=l.units),l.implicitUnits&&(R=l.implicitUnits),!l.unitless)if(u){var I="px|em"+(l.allowPercent?"|\\%":"");L&&(I=L);var O=e.match("^("+rt+")("+I+")?$");O&&(e=O[1],L=O[2]||R)}else(!L||l.implicitUnits)&&(L=R);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=s,A();if(l.integer&&!bv(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var N={name:r,value:e,strValue:""+e+(L||""),units:L,bypass:t};return l.unitless||L!=="px"&&L!=="em"?N.pfValue=e:N.pfValue=L==="px"||!L?e:this.getEmSizeInPixels()*e,(L==="ms"||L==="s")&&(N.pfValue=L==="ms"?e:1e3*e),(L==="deg"||L==="rad")&&(N.pfValue=L==="rad"?e:Sh(e)),L==="%"&&(N.pfValue=e/100),N}else if(l.propList){var k=[],P=""+e;if(P!=="none"){for(var B=P.split(/\s*,\s*|\s+/),_=0;_<B.length;_++){var F=B[_].trim();n.properties[F]?k.push(F):Pe("`"+F+"` is not a valid property name")}if(k.length===0)return null}return{name:r,value:k,strValue:k.length===0?"none":k.join(" "),bypass:t}}else if(l.color){var G=cf(e);return G?{name:r,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:t}:null}else if(l.regex||l.regexes){if(l.enums){var U=A();if(U)return U}for(var H=l.regexes?l.regexes:[l.regex],X=0;X<H.length;X++){var $=new RegExp(H[X]),Q=$.exec(e);if(Q)return{name:r,value:l.singleRegexMatchValue?Q[1]:Q,strValue:""+e,bypass:t}}return null}else return l.string?{name:r,value:""+e,strValue:""+e,bypass:t}:l.enums?A():null};var ot=function(e){if(!(this instanceof ot))return new ot(e);if(!js(e)){He("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},yt=ot.prototype;yt.instanceString=function(){return"style"};yt.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};yt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};yt.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};yt.selector=function(r){var e=r==="core"?null:new fr(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};yt.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],a=0;a<r.properties.length;a++){var n=r.properties[a],i=t[n.name];i===void 0&&(i=t[Bn(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};yt.style=yt.css;yt.cssRule=function(r,e){var t=this.parse(r,e);if(t){var a=this.length-1;this[a].properties.push(t),this[a].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.name.match(/stripe-(\d+)-background-size/)&&t.value&&(this._private.hasStripe=!0),t.mapped&&this[a].mappedProperties.push(t);var n=!this[a].selector;n&&(this._private.coreStyle[t.name]=t)}return this};yt.append=function(r){return uf(r)?r.appendToStyle(this):_e(r)?this.appendFromJson(r):ce(r)&&this.appendFromString(r),this};ot.fromJson=function(r,e){var t=new ot(r);return t.fromJson(e),t};ot.fromString=function(r,e){return new ot(r).fromString(e)};[ut,Va,po,Ht,Kn,yo,Qe,Zn].forEach(function(r){de(yt,r)});ot.types=yt.types;ot.properties=yt.properties;ot.propertyGroups=yt.propertyGroups;ot.propertyGroupNames=yt.propertyGroupNames;ot.propertyGroupKeys=yt.propertyGroupKeys;var Ip={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return uf(e)?t.style=e.generateStyle(this):_e(e)?t.style=ot.fromJson(this,e):ce(e)?t.style=ot.fromString(this,e):t.style=ot(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Mp="single",Mr={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=Mp),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,a,n,i,s,o;switch(e.length){case 0:return t;case 1:if(ce(e[0]))return a=e[0],t[a];if(Re(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,ae(s)&&(t.x=s),ae(o)&&(t.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ae(n)&&(t[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var a=arguments,n=this._private.pan,i,s,o,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Re(e)&&(o=a[0],u=o.x,l=o.y,ae(u)&&(n.x+=u),ae(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,s=t,(i==="x"||i==="y")&&ae(s)&&(n[i]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var a=this.getFitViewport(e,t);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ae(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(ce(e)){var n=e;e=this.$(n)}else if(xv(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Lt(e)||(e=this.mutableElements());if(!(Lt(e)&&e.empty())){a=a||e.boundingBox();var s=this.width(),o=this.height(),u;if(t=ae(t)?t:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((s-2*t)/a.w,(o-2*t)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(s-u*(a.x1+a.x2))/2,y:(o-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,t){var a=this._private;if(t==null){var n=e;e=n.min,t=n.max}return ae(e)&&ae(t)&&e<=t?(a.minZoom=e,a.maxZoom=t):ae(e)&&t===void 0&&e<=a.maxZoom?a.minZoom=e:ae(t)&&e===void 0&&t>=a.minZoom&&(a.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,a=t.pan,n=t.zoom,i,s,o=!1;if(t.zoomingEnabled||(o=!0),ae(e)?s=e:Re(e)&&(s=e.level,e.position!=null?i=Gn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(o=!0)),s=s>t.maxZoom?t.maxZoom:s,s=s<t.minZoom?t.minZoom:s,o||!ae(s)||s===n||i!=null&&(!ae(i.x)||!ae(i.y)))return null;if(i!=null){var u=a,l=n,f=s,c={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:c}}else return{zoomed:!0,panned:!1,zoom:s,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),a=this._private;return t==null||!t.zoomed?this:(a.zoom=t.zoom,t.panned&&(a.pan.x=t.pan.x,a.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,a=!0,n=!0,i=[],s=!1,o=!1;if(!e)return this;if(ae(e.zoom)||(a=!1),Re(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=u,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ae(l.x)&&(t.pan.x=l.x,o=!1),ae(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ce(e)){var a=e;e=this.mutableElements().filter(a)}else Lt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();t=t===void 0?this._private.zoom:t;var o={x:(i-t*(n.x1+n.x2))/2,y:(s-t*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?function(){var n=a.window().getComputedStyle(t),i=function(o){return parseFloat(n.getPropertyValue(o))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Mr.centre=Mr.center;Mr.autolockNodes=Mr.autolock;Mr.autoungrabifyNodes=Mr.autoungrabify;var Ia={data:Oe.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Oe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Oe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Oe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ia.attr=Ia.data;Ia.removeAttr=Ia.removeData;var Ma=function(e){var t=this;e=de({},e);var a=e.container;a&&!Tn(a)&&Tn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var s=je!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=de({name:s?"grid":"null"},o.layout),o.renderer=de({name:s?"canvas":"null"},o.renderer);var u=function(d,p,g){return p!==void 0?p:g!==void 0?g:d},l=this._private={container:a,ready:!1,options:o,elements:new vt(this),listeners:[],aniEles:new vt(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ae(o.zoom)?o.zoom:1,pan:{x:Re(o.pan)&&ae(o.pan.x)?o.pan.x:0,y:Re(o.pan)&&ae(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,p){var g=d.some(Tv);if(g)return aa.all(d).then(p);p(d)};l.styleEnabled&&t.setStyle([]);var c=de({},o,o.renderer);t.initRenderer(c);var v=function(d,p,g){t.notifications(!1);var y=t.mutableElements();y.length>0&&y.remove(),d!=null&&(Re(d)||_e(d))&&t.add(d),t.one("layoutready",function(m){t.notifications(!0),t.emit(m),t.one("load",p),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var b=de({},t._private.options.layout);b.eles=t.elements(),t.layout(b).run()};f([o.style,o.elements],function(h){var d=h[0],p=h[1];l.styleEnabled&&t.style().append(d),v(p,function(){t.startAnimationLoop(),l.ready=!0,Ye(o.ready)&&t.on("ready",o.ready);for(var g=0;g<i.length;g++){var y=i[g];t.on("ready",y)}n&&(n.readies=[]),t.emit("ready")},o.done)})},In=Ma.prototype;de(In,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return je;var t=this._private.container.ownerDocument;return t===void 0||t==null?je:t.defaultView||je},mount:function(e){if(e!=null){var t=this,a=t._private,n=a.options;return!Tn(e)&&Tn(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),a.container=e,a.styleEnabled=!0,t.invalidateSize(),t.initRenderer(de({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),t.startAnimationLoop(),t.style(n.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return qt(this._private.options)},json:function(e){var t=this,a=t._private,n=t.mutableElements(),i=function(E){return t.getElementById(E.id())};if(Re(e)){if(t.startBatch(),e.elements){var s={},o=function(E,x){for(var S=[],w=[],T=0;T<E.length;T++){var C=E[T];if(!C.data.id){Pe("cy.json() cannot handle elements without an ID attribute");continue}var D=""+C.data.id,A=t.getElementById(D);s[D]=!0,A.length!==0?w.push({ele:A,json:C}):(x&&(C.group=x),S.push(C))}t.add(S);for(var L=0;L<w.length;L++){var R=w[L],I=R.ele,O=R.json;I.json(O)}};if(_e(e.elements))o(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],c=e.elements[f];_e(c)&&o(c,f)}var v=t.collection();n.filter(function(m){return!s[m.id()]}).forEach(function(m){m.isParent()?v.merge(m):m.remove()}),v.forEach(function(m){return m.children().move({parent:null})}),v.forEach(function(m){return i(m).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var p=h[d];e[p]!=null&&t[p](e[p])}return t.endBatch(),this}else{var g=!!e,y={};g?y.elements=this.elements().map(function(m){return m.json()}):(y.elements={},n.forEach(function(m){var E=m.group();y.elements[E]||(y.elements[E]=[]),y.elements[E].push(m.json())})),this._private.styleEnabled&&(y.style=t.style().json()),y.data=qt(t.data());var b=a.options;return y.zoomingEnabled=a.zoomingEnabled,y.userZoomingEnabled=a.userZoomingEnabled,y.zoom=a.zoom,y.minZoom=a.minZoom,y.maxZoom=a.maxZoom,y.panningEnabled=a.panningEnabled,y.userPanningEnabled=a.userPanningEnabled,y.pan=qt(a.pan),y.boxSelectionEnabled=a.boxSelectionEnabled,y.renderer=qt(b.renderer),y.hideEdgesOnViewport=b.hideEdgesOnViewport,y.textureOnViewport=b.textureOnViewport,y.wheelSensitivity=b.wheelSensitivity,y.motionBlur=b.motionBlur,y.multiClickDebounceTime=b.multiClickDebounceTime,y}}});In.$id=In.getElementById;[wp,Dp,sc,zs,dn,Ap,Vs,gn,Ip,Mr,Ia].forEach(function(r){de(In,r)});var Op={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}},Pp={maximal:!1,acyclic:!1},Gr=function(e){return e.scratch("breadthfirst")},Al=function(e,t){return e.scratch("breadthfirst",t)};function oc(r){this.options=de({},Op,Pp,r)}oc.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=t.nodes().filter(function(se){return se.isChildless()}),n=t,i=r.directed,s=r.acyclic||r.maximal||r.maximalAdjustments>0,o=!!r.boundingBox,u=e.extent(),l=At(o?r.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h}),f;if(Lt(r.roots))f=r.roots;else if(_e(r.roots)){for(var c=[],v=0;v<r.roots.length;v++){var h=r.roots[v],d=e.getElementById(h);c.push(d)}f=e.collection(c)}else if(ce(r.roots))f=e.$(r.roots);else if(i)f=a.roots();else{var p=t.components();f=e.collection();for(var g=function(){var oe=p[y],ve=oe.maxDegree(!1),ge=oe.filter(function(he){return he.degree(!1)===ve});f=f.add(ge)},y=0;y<p.length;y++)g()}var b=[],m={},E=function(oe,ve){b[ve]==null&&(b[ve]=[]);var ge=b[ve].length;b[ve].push(oe),Al(oe,{index:ge,depth:ve})},x=function(oe,ve){var ge=Gr(oe),he=ge.depth,ye=ge.index;b[he][ye]=null,oe.isChildless()&&E(oe,ve)};n.bfs({roots:f,directed:r.directed,visit:function(oe,ve,ge,he,ye){var we=oe[0],Se=we.id();we.isChildless()&&E(we,ye),m[Se]=!0}});for(var S=[],w=0;w<a.length;w++){var T=a[w];m[T.id()]||S.push(T)}var C=function(oe){for(var ve=b[oe],ge=0;ge<ve.length;ge++){var he=ve[ge];if(he==null){ve.splice(ge,1),ge--;continue}Al(he,{depth:oe,index:ge})}},D=function(oe,ve){for(var ge=Gr(oe),he=oe.incomers().filter(function(Ke){return Ke.isNode()&&t.has(Ke)}),ye=-1,we=oe.id(),Se=0;Se<he.length;Se++){var Fe=he[Se],$e=Gr(Fe);ye=Math.max(ye,$e.depth)}if(ge.depth<=ye){if(!r.acyclic&&ve[we])return null;var Ie=ye+1;return x(oe,Ie),ve[we]=Ie,!0}return!1};if(i&&s){var A=[],L={},R=function(oe){return A.push(oe)},I=function(){return A.shift()};for(a.forEach(function(se){return A.push(se)});A.length>0;){var O=I(),N=D(O,L);if(N)O.outgoers().filter(function(se){return se.isNode()&&t.has(se)}).forEach(R);else if(N===null){Pe("Detected double maximal shift for node `"+O.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var k=0;if(r.avoidOverlap)for(var P=0;P<a.length;P++){var B=a[P],_=B.layoutDimensions(r),F=_.w,G=_.h;k=Math.max(k,F,G)}var U={},H=function(oe){if(U[oe.id()])return U[oe.id()];for(var ve=Gr(oe).depth,ge=oe.neighborhood(),he=0,ye=0,we=0;we<ge.length;we++){var Se=ge[we];if(!(Se.isEdge()||Se.isParent()||!a.has(Se))){var Fe=Gr(Se);if(Fe!=null){var $e=Fe.index,Ie=Fe.depth;if(!($e==null||Ie==null)){var Ke=b[Ie].length;Ie<ve&&(he+=$e/Ke,ye++)}}}}return ye=Math.max(1,ye),he=he/ye,ye===0&&(he=0),U[oe.id()]=he,he},X=function(oe,ve){var ge=H(oe),he=H(ve),ye=ge-he;return ye===0?ff(oe.id(),ve.id()):ye};r.depthSort!==void 0&&(X=r.depthSort);for(var $=b.length,Q=0;Q<$;Q++)b[Q].sort(X),C(Q);for(var re=[],J=0;J<S.length;J++)re.push(S[J]);var z=function(){for(var oe=0;oe<$;oe++)C(oe)};re.length&&(b.unshift(re),$=b.length,z());for(var V=0,Y=0;Y<$;Y++)V=Math.max(b[Y].length,V);var ee={x:l.x1+l.w/2,y:l.y1+l.h/2},ne=a.reduce(function(se,oe){return function(ve){return{w:se.w===-1?ve.w:(se.w+ve.w)/2,h:se.h===-1?ve.h:(se.h+ve.h)/2}}(oe.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),be=Math.max($===1?0:o?(l.h-r.padding*2-ne.h)/($-1):(l.h-r.padding*2-ne.h)/($+1),k),Ve=b.reduce(function(se,oe){return Math.max(se,oe.length)},0),Ne=function(oe){var ve=Gr(oe),ge=ve.depth,he=ve.index;if(r.circle){var ye=Math.min(l.w/2/$,l.h/2/$);ye=Math.max(ye,k);var we=ye*ge+ye-($>0&&b[0].length<=3?ye/2:0),Se=2*Math.PI/b[ge].length*he;return ge===0&&b[0].length===1&&(we=1),{x:ee.x+we*Math.cos(Se),y:ee.y+we*Math.sin(Se)}}else{var Fe=b[ge].length,$e=Math.max(Fe===1?0:o?(l.w-r.padding*2-ne.w)/((r.grid?Ve:Fe)-1):(l.w-r.padding*2-ne.w)/((r.grid?Ve:Fe)+1),k),Ie={x:ee.x+(he+1-(Fe+1)/2)*$e,y:ee.y+(ge+1-($+1)/2)*be};return Ie}};return t.nodes().layoutPositions(this,r,Ne),this};var Np={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function uc(r){this.options=de({},Np,r)}uc.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=At(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,c=0,v=0;v<i.length;v++){var h=i[v],d=h.layoutDimensions(e),p=d.w,g=d.h;c=Math.max(c,p,g)}if(ae(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(s.h,s.w)/2-c,i.length>1&&e.avoidOverlap){c*=1.75;var y=Math.cos(l)-Math.cos(0),b=Math.sin(l)-Math.sin(0),m=Math.sqrt(c*c/(y*y+b*b));f=Math.max(m,f)}var E=function(S,w){var T=e.startAngle+w*l*(n?1:-1),C=f*Math.cos(T),D=f*Math.sin(T),A={x:o.x+C,y:o.y+D};return A};return a.nodes().layoutPositions(this,e,E),this};var kp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lc(r){this.options=de({},kp,r)}lc.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),s=At(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],l=0,f=0;f<i.length;f++){var c=i[f],v=void 0;v=e.concentric(c),u.push({value:v,node:c}),c._private.scratch.concentric=v}i.updateStyle();for(var h=0;h<i.length;h++){var d=i[h],p=d.layoutDimensions(e);l=Math.max(l,p.w,p.h)}u.sort(function(ne,be){return be.value-ne.value});for(var g=e.levelWidth(i),y=[[]],b=y[0],m=0;m<u.length;m++){var E=u[m];if(b.length>0){var x=Math.abs(b[0].value-E.value);x>=g&&(b=[],y.push(b))}b.push(E)}var S=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=y.length>0&&y[0].length>1,T=Math.min(s.w,s.h)/2-S,C=T/(y.length+w?1:0);S=Math.min(S,C)}for(var D=0,A=0;A<y.length;A++){var L=y[A],R=e.sweep===void 0?2*Math.PI-2*Math.PI/L.length:e.sweep,I=L.dTheta=R/Math.max(1,L.length-1);if(L.length>1&&e.avoidOverlap){var O=Math.cos(I)-Math.cos(0),N=Math.sin(I)-Math.sin(0),k=Math.sqrt(S*S/(O*O+N*N));D=Math.max(k,D)}L.r=D,D+=S}if(e.equidistant){for(var P=0,B=0,_=0;_<y.length;_++){var F=y[_],G=F.r-B;P=Math.max(P,G)}B=0;for(var U=0;U<y.length;U++){var H=y[U];U===0&&(B=H.r),H.r=B,B+=P}}for(var X={},$=0;$<y.length;$++)for(var Q=y[$],re=Q.dTheta,J=Q.r,z=0;z<Q.length;z++){var V=Q[z],Y=e.startAngle+(t?1:-1)*re*z,ee={x:o.x+J*Math.cos(Y),y:o.y+J*Math.sin(Y)};X[V.node.id()]=ee}return n.nodes().layoutPositions(this,e,function(ne){var be=ne.id();return X[be]}),this};var Es,Bp={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 Qn(r){this.options=de({},Bp,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),a=t.filter(function(n){var i=n.source().data("id"),s=n.target().data("id"),o=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===s});return!o||!u});this.options.eles=this.options.eles.not(a)}Qn.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(r.animate===!0||r.animate===!1)&&t.emit({type:"layoutstart",layout:t}),r.debug===!0?Es=!0:Es=!1;var a=Fp(e,t,r);Es&&Gp(a),r.randomize&&zp(a);var n=Qt(),i=function(){Vp(a,e,r),r.fit===!0&&e.fit(r.padding)},s=function(v){return!(t.stopped||v>=r.numIter||(Up(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature<r.minTemp))},o=function(){if(r.animate===!0||r.animate===!1)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var v=r.eles.nodes(),h=cc(a,r,v);v.layoutPositions(t,r,h)}},u=0,l=!0;if(r.animate===!0){var f=function(){for(var v=0;l&&v<r.refresh;)l=s(u),u++,v++;if(!l)Rl(a,r),o();else{var h=Qt();h-n>=r.animationThreshold&&i(),Cn(f)}};f()}else{for(;l;)l=s(u),u++;Rl(a,r),o()}return this};Qn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Qn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Fp=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=At(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},u=a.eles.components(),l={},f=0;f<u.length;f++)for(var c=u[f],v=0;v<c.length;v++){var h=c[v];l[h.id()]=f}for(var f=0;f<o.nodeSize;f++){var d=i[f],p=d.layoutDimensions(a),g={};g.isLocked=d.locked(),g.id=d.data("id"),g.parentId=d.data("parent"),g.cmptId=l[d.id()],g.children=[],g.positionX=d.position("x"),g.positionY=d.position("y"),g.offsetX=0,g.offsetY=0,g.height=p.w,g.width=p.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(d.style("padding")),g.padRight=parseFloat(d.style("padding")),g.padTop=parseFloat(d.style("padding")),g.padBottom=parseFloat(d.style("padding")),g.nodeRepulsion=Ye(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,o.layoutNodes.push(g),o.idToIndex[g.id]=f}for(var y=[],b=0,m=-1,E=[],f=0;f<o.nodeSize;f++){var d=o.layoutNodes[f],x=d.parentId;x!=null?o.layoutNodes[o.idToIndex[x]].children.push(d.id):(y[++m]=d.id,E.push(d.id))}for(o.graphSet.push(E);b<=m;){var S=y[b++],w=o.idToIndex[S],h=o.layoutNodes[w],T=h.children;if(T.length>0){o.graphSet.push(T);for(var f=0;f<T.length;f++)y[++m]=T[f]}}for(var f=0;f<o.graphSet.length;f++)for(var C=o.graphSet[f],v=0;v<C.length;v++){var D=o.idToIndex[C[v]];o.indexToGraph[D]=f}for(var f=0;f<o.edgeSize;f++){var A=n[f],L={};L.id=A.data("id"),L.sourceId=A.data("source"),L.targetId=A.data("target");var R=Ye(a.idealEdgeLength)?a.idealEdgeLength(A):a.idealEdgeLength,I=Ye(a.edgeElasticity)?a.edgeElasticity(A):a.edgeElasticity,O=o.idToIndex[L.sourceId],N=o.idToIndex[L.targetId],k=o.indexToGraph[O],P=o.indexToGraph[N];if(k!=P){for(var B=_p(L.sourceId,L.targetId,o),_=o.graphSet[B],F=0,g=o.layoutNodes[O];_.indexOf(g.id)===-1;)g=o.layoutNodes[o.idToIndex[g.parentId]],F++;for(g=o.layoutNodes[N];_.indexOf(g.id)===-1;)g=o.layoutNodes[o.idToIndex[g.parentId]],F++;R*=F*a.nestingFactor}L.idealLength=R,L.elasticity=I,o.layoutEdges.push(L)}return o},_p=function(e,t,a){var n=fc(e,t,0,a);return 2>n.count?0:n.graph},fc=function(e,t,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:a};for(var s=0,o=0;o<i.length;o++){var u=i[o],l=n.idToIndex[u],f=n.layoutNodes[l].children;if(f.length!==0){var c=n.indexToGraph[n.idToIndex[f[0]]],v=fc(e,t,c,n);if(v.count!==0)if(v.count===1){if(s++,s===2)break}else return v}}return{count:s,graph:a}},Gp,zp=function(e,t){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},cc=function(e,t,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(a.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var u=e.layoutNodes[e.idToIndex[s.data("id")]];if(t.boundingBox){var l=(u.positionX-i.x1)/i.w,f=(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+f*n.h}}else return{x:u.positionX,y:u.positionY}}},Vp=function(e,t,a){var n=a.layout,i=a.eles.nodes(),s=cc(e,a,i);i.positions(s),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},Up=function(e,t,a){qp(e,t),$p(e),Xp(e,t),Wp(e),Kp(e)},qp=function(e,t){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],u=s+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];Hp(o,l,e,t)}},Ll=function(e){return-1+2*e*Math.random()},Hp=function(e,t,a,n){var i=e.cmptId,s=t.cmptId;if(!(i!==s&&!a.isCompound)){var o=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;o===0&&u===0&&(o=Ll(l),u=Ll(l));var f=Yp(e,t,o,u);if(f>0)var c=n.nodeOverlap*f,v=Math.sqrt(o*o+u*u),h=c*o/v,d=c*u/v;else var p=Mn(e,o,u),g=Mn(t,-1*o,-1*u),y=g.x-p.x,b=g.y-p.y,m=y*y+b*b,v=Math.sqrt(m),c=(e.nodeRepulsion+t.nodeRepulsion)/m,h=c*y/v,d=c*b/v;e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},Yp=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var s=e.maxY-t.minY;else var s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Mn=function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,u=a/t,l=s/o,f={};return t===0&&0<a||t===0&&0>a?(f.x=n,f.y=i+s/2,f):0<t&&-1*l<=u&&u<=l?(f.x=n+o/2,f.y=i+o*a/2/t,f):0>t&&-1*l<=u&&u<=l?(f.x=n-o/2,f.y=i-o*a/2/t,f):0<a&&(u<=-1*l||u>=l)?(f.x=n+s*t/2/a,f.y=i+s/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-s*t/2/a,f.y=i-s/2),f)},$p=function(e,t){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],u=e.layoutNodes[o],l=u.positionX-s.positionX,f=u.positionY-s.positionY;if(!(l===0&&f===0)){var c=Mn(s,l,f),v=Mn(u,-1*l,-1*f),h=v.x-c.x,d=v.y-c.y,p=Math.sqrt(h*h+d*d),g=Math.pow(n.idealLength-p,2)/n.elasticity;if(p!==0)var y=g*h/p,b=g*d/p;else var y=0,b=0;s.isLocked||(s.offsetX+=y,s.offsetY+=b),u.isLocked||(u.offsetX-=y,u.offsetY-=b)}}},Xp=function(e,t){if(t.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(n===0)var o=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],o=f.positionX,u=f.positionY;for(var c=0;c<s;c++){var v=e.layoutNodes[e.idToIndex[i[c]]];if(!v.isLocked){var h=o-v.positionX,d=u-v.positionY,p=Math.sqrt(h*h+d*d);if(p>a){var g=t.gravity*h/p,y=t.gravity*d/p;v.offsetX+=g,v.offsetY+=y}}}}},Wp=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],u=e.layoutNodes[o],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,c=u.offsetY,v=0;v<l.length;v++){var h=e.layoutNodes[e.idToIndex[l[v]]];h.offsetX+=f,h.offsetY+=c,a[++i]=l[v]}u.offsetX=0,u.offsetY=0}}},Kp=function(e,t){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=Zp(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,vc(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},Zp=function(e,t,a){var n=Math.sqrt(e*e+t*t);if(n>a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},vc=function(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return vc(n,t)}},Rl=function(e,t){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId,u=n[o]=n[o]||[];u.push(s)}for(var l=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var c=0;c<f.length;c++){var v=f[c];f.x1=Math.min(f.x1,v.positionX-v.width/2),f.x2=Math.max(f.x2,v.positionX+v.width/2),f.y1=Math.min(f.y1,v.positionY-v.height/2),f.y2=Math.max(f.y2,v.positionY+v.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}n.sort(function(b,m){return m.w*m.h-b.w*b.h});for(var h=0,d=0,p=0,g=0,y=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var c=0;c<f.length;c++){var v=f[c];v.isLocked||(v.positionX+=h-f.x1,v.positionY+=d-f.y1)}h+=f.w+t.componentSpacing,p+=f.w+t.componentSpacing,g=Math.max(g,f.h),p>y&&(d+=g+t.componentSpacing,h=0,p=0,g=0)}}},Qp={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 hc(r){this.options=de({},Qp,r)}hc.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=At(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(U){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),u=Math.round(o),l=Math.round(i.w/i.h*o),f=function(H){if(H==null)return Math.min(u,l);var X=Math.min(u,l);X==u?u=H:l=H},c=function(H){if(H==null)return Math.max(u,l);var X=Math.max(u,l);X==u?u=H:l=H},v=e.rows,h=e.cols!=null?e.cols:e.columns;if(v!=null&&h!=null)u=v,l=h;else if(v!=null&&h==null)u=v,l=Math.ceil(s/u);else if(v==null&&h!=null)l=h,u=Math.ceil(s/l);else if(l*u>s){var d=f(),p=c();(d-1)*p>=s?f(d-1):(p-1)*d>=s&&c(p-1)}else for(;l*u<s;){var g=f(),y=c();(y+1)*g>=s?c(y+1):f(g+1)}var b=i.w/l,m=i.h/u;if(e.condense&&(b=0,m=0),e.avoidOverlap)for(var E=0;E<n.length;E++){var x=n[E],S=x._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var w=x.layoutDimensions(e),T=e.avoidOverlapPadding,C=w.w+T,D=w.h+T;b=Math.max(b,C),m=Math.max(m,D)}for(var A={},L=function(H,X){return!!A["c-"+H+"-"+X]},R=function(H,X){A["c-"+H+"-"+X]=!0},I=0,O=0,N=function(){O++,O>=l&&(O=0,I++)},k={},P=0;P<n.length;P++){var B=n[P],_=e.position(B);if(_&&(_.row!==void 0||_.col!==void 0)){var F={row:_.row,col:_.col};if(F.col===void 0)for(F.col=0;L(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;L(F.row,F.col);)F.row++;k[B.id()]=F,R(F.row,F.col)}}var G=function(H,X){var $,Q;if(H.locked()||H.isParent())return!1;var re=k[H.id()];if(re)$=re.col*b+b/2+i.x1,Q=re.row*m+m/2+i.y1;else{for(;L(I,O);)N();$=O*b+b/2+i.x1,Q=I*m+m/2+i.y1,R(I,O),N()}return{x:$,y:Q}};n.layoutPositions(this,e,G)}return this};var Jp={ready:function(){},stop:function(){}};function mo(r){this.options=de({},Jp,r)}mo.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this};mo.prototype.stop=function(){return this};var jp={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 dc(r){this.options=de({},jp,r)}dc.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),a=Ye(r.positions);function n(i){if(r.positions==null)return Eh(i.position());if(a)return r.positions(i);var s=r.positions[i._private.data.id];return s??null}return t.layoutPositions(this,r,function(i,s){var o=n(i);return i.locked()||o==null?!1:o}),this};var ey={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 gc(r){this.options=de({},ey,r)}gc.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=At(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return t.nodes().layoutPositions(this,r,n),this};var ty=[{name:"breadthfirst",impl:oc},{name:"circle",impl:uc},{name:"concentric",impl:lc},{name:"cose",impl:Qn},{name:"grid",impl:hc},{name:"null",impl:mo},{name:"preset",impl:dc},{name:"random",impl:gc}];function pc(r){this.options=r,this.notifications=0}var Il=function(){},Ml=function(){throw new Error("A headless instance can not render images")};pc.prototype={recalculateRenderedStyle:Il,notify:function(){this.notifications++},init:Il,isHeadless:function(){return!0},png:Ml,jpg:Ml};var bo={};bo.arrowShapeWidth=.3;bo.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=function(l,f,c,v,h,d,p){var g=h.x-c/2-p,y=h.x+c/2+p,b=h.y-c/2-p,m=h.y+c/2+p,E=g<=l&&l<=y&&b<=f&&f<=m;return E},a=function(l,f,c,v,h){var d=l*Math.cos(v)-f*Math.sin(v),p=l*Math.sin(v)+f*Math.cos(v),g=d*c,y=p*c,b=g+h.x,m=y+h.y;return{x:b,y:m}},n=function(l,f,c,v){for(var h=[],d=0;d<l.length;d+=2){var p=l[d],g=l[d+1];h.push(a(p,g,f,c,v))}return h},i=function(l){for(var f=[],c=0;c<l.length;c++){var v=l[c];f.push(v.x,v.y)}return f},s=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},o=function(l,f){ce(f)&&(f=r[f]),r[l]=de({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(v,h,d,p,g,y){var b=i(n(this.points,d+2*y,p,g)),m=Dt(v,h,b);return m},roughCollide:t,draw:function(v,h,d,p){var g=n(this.points,h,d,p);e.arrowShapeImpl("polygon")(v,g)},spacing:function(v){return 0},gap:s},f)};o("none",{collide:Dn,roughCollide:Dn,draw:ao,spacing:Xo,gap:Xo}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(l,f,c,v,h){var d=n(this.points,f,c,v),p=this.controlPoint,g=a(p[0],p[1],f,c,v);e.arrowShapeImpl(this.name)(l,d,g)},gap:function(l){return s(l)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,f,c,v,h,d,p){var g=i(n(this.points,c+2*p,v,h)),y=i(n(this.pointsTee,c+2*p,v,h)),b=Dt(l,f,g)||Dt(l,f,y);return b},draw:function(l,f,c,v,h){var d=n(this.points,f,c,v),p=n(this.pointsTee,f,c,v);e.arrowShapeImpl(this.name)(l,d,p)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,f,c,v,h,d,p){var g=h,y=Math.pow(g.x-l,2)+Math.pow(g.y-f,2)<=Math.pow((c+2*p)*this.radius,2),b=i(n(this.points,c+2*p,v,h));return Dt(l,f,b)||y},draw:function(l,f,c,v,h){var d=n(this.pointsTr,f,c,v);e.arrowShapeImpl(this.name)(l,d,v.x,v.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,f){var c=this.baseCrossLinePts.slice(),v=f/l,h=3,d=5;return c[h]=c[h]-v,c[d]=c[d]-v,c},collide:function(l,f,c,v,h,d,p){var g=i(n(this.points,c+2*p,v,h)),y=i(n(this.crossLinePts(c,d),c+2*p,v,h)),b=Dt(l,f,g)||Dt(l,f,y);return b},draw:function(l,f,c,v,h){var d=n(this.points,f,c,v),p=n(this.crossLinePts(f,h),f,c,v);e.arrowShapeImpl(this.name)(l,d,p)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return s(l)*.525}}),o("circle",{radius:.15,collide:function(l,f,c,v,h,d,p){var g=h,y=Math.pow(g.x-l,2)+Math.pow(g.y-f,2)<=Math.pow((c+2*p)*this.radius,2);return y},draw:function(l,f,c,v,h){e.arrowShapeImpl(this.name)(l,v.x,v.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Pr={};Pr.projectIntoViewport=function(r,e){var t=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=t.pan(),u=t.zoom(),l=((r-n)/s-o.x)/u,f=((e-i)/s-o.y)/u;return[l,f]};Pr.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),a=function(y){return parseFloat(t.getPropertyValue(y))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},s=r.clientWidth,o=r.clientHeight,u=n.left+n.right,l=n.top+n.bottom,f=i.left+i.right,c=e.width/(s+f),v=s-u,h=o-l,d=e.left+n.left+i.left,p=e.top+n.top+i.top;return this.containerBB=[d,p,v,h,c]};Pr.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Pr.findNearestElement=function(r,e,t,a){return this.findNearestElements(r,e,t,a)[0]};Pr.findNearestElements=function(r,e,t,a){var n=this,i=this,s=i.getCachedZSortedEles(),o=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(a?24:8)/u,c=(a?8:2)/u,v=(a?8:2)/u,h=1/0,d,p;t&&(s=s.interactive);function g(w,T){if(w.isNode()){if(p)return;p=w,o.push(w)}if(w.isEdge()&&(T==null||T<h))if(d){if(d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value){for(var C=0;C<o.length;C++)if(o[C].isEdge()){o[C]=w,d=w,h=T??h;break}}}else o.push(w),d=w,h=T??h}function y(w){var T=w.outerWidth()+2*c,C=w.outerHeight()+2*c,D=T/2,A=C/2,L=w.position(),R=w.pstyle("corner-radius").value==="auto"?"auto":w.pstyle("corner-radius").pfValue,I=w._private.rscratch;if(L.x-D<=r&&r<=L.x+D&&L.y-A<=e&&e<=L.y+A){var O=i.nodeShapes[n.getNodeShape(w)];if(O.checkPoint(r,e,0,T,C,L.x,L.y,R,I))return g(w,0),!0}}function b(w){var T=w._private,C=T.rscratch,D=w.pstyle("width").pfValue,A=w.pstyle("arrow-scale").value,L=D/2+f,R=L*L,I=L*2,P=T.source,B=T.target,O;if(C.edgeType==="segments"||C.edgeType==="straight"||C.edgeType==="haystack"){for(var N=C.allpts,k=0;k+3<N.length;k+=2)if(kh(r,e,N[k],N[k+1],N[k+2],N[k+3],I)&&R>(O=zh(r,e,N[k],N[k+1],N[k+2],N[k+3])))return g(w,O),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var N=C.allpts,k=0;k+5<C.allpts.length;k+=4)if(Bh(r,e,N[k],N[k+1],N[k+2],N[k+3],N[k+4],N[k+5],I)&&R>(O=Gh(r,e,N[k],N[k+1],N[k+2],N[k+3],N[k+4],N[k+5])))return g(w,O),!0}for(var P=P||T.source,B=B||T.target,_=n.getArrowWidth(D,A),F=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],k=0;k<F.length;k++){var G=F[k],U=i.arrowShapes[w.pstyle(G.name+"-arrow-shape").value],H=w.pstyle("width").pfValue;if(U.roughCollide(r,e,_,G.angle,{x:G.x,y:G.y},H,f)&&U.collide(r,e,_,G.angle,{x:G.x,y:G.y},H,f))return g(w),!0}l&&o.length>0&&(y(P),y(B))}function m(w,T,C){return Ct(w,T,C)}function E(w,T){var C=w._private,D=v,A;T?A=T+"-":A="",w.boundingBox();var L=C.labelBounds[T||"main"],R=w.pstyle(A+"label").value,I=w.pstyle("text-events").strValue==="yes";if(!(!I||!R)){var O=m(C.rscratch,"labelX",T),N=m(C.rscratch,"labelY",T),k=m(C.rscratch,"labelAngle",T),P=w.pstyle(A+"text-margin-x").pfValue,B=w.pstyle(A+"text-margin-y").pfValue,_=L.x1-D-P,F=L.x2+D-P,G=L.y1-D-B,U=L.y2+D-B;if(k){var H=Math.cos(k),X=Math.sin(k),$=function(ee,ne){return ee=ee-O,ne=ne-N,{x:ee*H-ne*X+O,y:ee*X+ne*H+N}},Q=$(_,G),re=$(_,U),J=$(F,G),z=$(F,U),V=[Q.x+P,Q.y+B,J.x+P,J.y+B,z.x+P,z.y+B,re.x+P,re.y+B];if(Dt(r,e,V))return g(w),!0}else if(jr(L,r,e))return g(w),!0}}for(var x=s.length-1;x>=0;x--){var S=s[x];S.isNode()?y(S)||E(S):b(S)||E(S)||E(S,"source")||E(S,"target")}return o};Pr.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),s=2/i,o=[],u=Math.min(r,t),l=Math.max(r,t),f=Math.min(e,a),c=Math.max(e,a);r=u,t=l,e=f,a=c;var v=At({x1:r,y1:e,x2:t,y2:a});function h(R,I,O){return Ct(R,I,O)}function d(R,I){var O=R._private,N=s,k="";R.boundingBox();var P=O.labelBounds.main,B=h(O.rscratch,"labelX",I),_=h(O.rscratch,"labelY",I),F=h(O.rscratch,"labelAngle",I),G=R.pstyle(k+"text-margin-x").pfValue,U=R.pstyle(k+"text-margin-y").pfValue,H=P.x1-N-G,X=P.x2+N-G,$=P.y1-N-U,Q=P.y2+N-U;if(F){var re=Math.cos(F),J=Math.sin(F),z=function(Y,ee){return Y=Y-B,ee=ee-_,{x:Y*re-ee*J+B,y:Y*J+ee*re+_}};return[z(H,$),z(X,$),z(X,Q),z(H,Q)]}else return[{x:H,y:$},{x:X,y:$},{x:X,y:Q},{x:H,y:Q}]}for(var p=0;p<n.length;p++){var g=n[p];if(g.isNode()){var y=g,b=y.pstyle("text-events").strValue==="yes",m=y.pstyle("box-select-labels").strValue==="yes",E=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:m&&b});if(oo(v,E)){var x=d(y),S=[{x:v.x1,y:v.y1},{x:v.x2,y:v.y1},{x:v.x2,y:v.y2},{x:v.x1,y:v.y2}];Yh(x,S)&&o.push(y)}}else{var w=g,T=w._private,C=T.rscratch;if(C.startX!=null&&C.startY!=null&&!jr(v,C.startX,C.startY)||C.endX!=null&&C.endY!=null&&!jr(v,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 D=T.rstyle.bezierPts||T.rstyle.linePts||T.rstyle.haystackPts,A=!0,L=0;L<D.length;L++)if(!Ph(v,D[L])){A=!1;break}A&&o.push(w)}else(C.edgeType==="haystack"||C.edgeType==="straight")&&o.push(w)}}return o};var On={};On.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",u,l,f,c,v,h,y,b;if(t?(f=e.haystackPts[0],c=e.haystackPts[1],v=e.haystackPts[2],h=e.haystackPts[3]):(f=e.arrowStartX,c=e.arrowStartY,v=e.arrowEndX,h=e.arrowEndY),y=e.midX,b=e.midY,i)u=f-e.segpts[0],l=c-e.segpts[1];else if(n||s||o||a){var d=e.allpts,p=st(d[0],d[2],d[4],.1),g=st(d[1],d[3],d[5],.1);u=f-p,l=c-g}else u=f-y,l=c-b;e.srcArrowAngle=Za(u,l);var y=e.midX,b=e.midY;if(t&&(y=(f+v)/2,b=(c+h)/2),u=v-f,l=h-c,i){var d=e.allpts;if(d.length/2%2===0){var m=d.length/2,E=m-2;u=d[m]-d[E],l=d[m+1]-d[E+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var m=d.length/2-1,E=m-2;u=d[m]-d[E],l=d[m+1]-d[E+1]}}else if(n||s||o){var d=e.allpts,x=e.ctrlpts,S,w,T,C;if(x.length/2%2===0){var D=d.length/2-1,A=D+2,L=A+2;S=st(d[D],d[A],d[L],0),w=st(d[D+1],d[A+1],d[L+1],0),T=st(d[D],d[A],d[L],1e-4),C=st(d[D+1],d[A+1],d[L+1],1e-4)}else{var A=d.length/2-1,D=A-2,L=A+2;S=st(d[D],d[A],d[L],.4999),w=st(d[D+1],d[A+1],d[L+1],.4999),T=st(d[D],d[A],d[L],.5),C=st(d[D+1],d[A+1],d[L+1],.5)}u=T-S,l=C-w}if(e.midtgtArrowAngle=Za(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var m=d.length/2-1,R=m+2;u=-(d[R]-d[m]),l=-(d[R+1]-d[m+1])}}}if(e.midsrcArrowAngle=Za(u,l),i)u=v-e.segpts[e.segpts.length-2],l=h-e.segpts[e.segpts.length-1];else if(n||s||o||a){var d=e.allpts,I=d.length,p=st(d[I-6],d[I-4],d[I-2],.9),g=st(d[I-5],d[I-3],d[I-1],.9);u=v-p,l=h-g}else u=v-y,l=h-b;e.tgtArrowAngle=Za(u,l)};On.getArrowWidth=On.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},a=t[r+", "+e];return a||(a=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=a,a)};var Us,qs,Ut={},Rt={},Ol,Pl,Sr,pn,Wt,wr,Cr,zt,zr,nn,yc,mc,Hs,Ys,Nl,kl=function(e,t,a){a.x=t.x-e.x,a.y=t.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},ry=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},ay=function(e,t,a,n,i){if(e!==Nl?kl(t,e,Ut):ry(Rt,Ut),kl(t,a,Rt),Ol=Ut.nx*Rt.ny-Ut.ny*Rt.nx,Pl=Ut.nx*Rt.nx-Ut.ny*-Rt.ny,Wt=Math.asin(Math.max(-1,Math.min(1,Ol))),Math.abs(Wt)<1e-6){Us=t.x,qs=t.y,Cr=zr=0;return}Sr=1,pn=!1,Pl<0?Wt<0?Wt=Math.PI+Wt:(Wt=Math.PI-Wt,Sr=-1,pn=!0):Wt>0&&(Sr=-1,pn=!0),t.radius!==void 0?zr=t.radius:zr=n,wr=Wt/2,nn=Math.min(Ut.len/2,Rt.len/2),i?(zt=Math.abs(Math.cos(wr)*zr/Math.sin(wr)),zt>nn?(zt=nn,Cr=Math.abs(zt*Math.sin(wr)/Math.cos(wr))):Cr=zr):(zt=Math.min(nn,zr),Cr=Math.abs(zt*Math.sin(wr)/Math.cos(wr))),Hs=t.x+Rt.nx*zt,Ys=t.y+Rt.ny*zt,Us=Hs-Rt.ny*Cr*Sr,qs=Ys+Rt.nx*Cr*Sr,yc=t.x+Ut.nx*zt,mc=t.y+Ut.ny*zt,Nl=t};function bc(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function wo(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(ay(r,e,t,a,n),{cx:Us,cy:qs,radius:Cr,startX:yc,startY:mc,stopX:Hs,stopY:Ys,startAngle:Ut.ang+Math.PI/2*Sr,endAngle:Rt.ang-Math.PI/2*Sr,counterClockwise:pn})}var Oa=.01,ny=Math.sqrt(2*Oa),mt={};mt.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),u=s.units!=null&&o.units!=null,l=function(x,S,w,T){var C=T-S,D=w-x,A=Math.sqrt(D*D+C*C);return{x:-C/A,y:D/A}},f=r.pstyle("edge-distances").value;switch(f){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(u){var c=this.manualEndptToPx(r.source()[0],s),v=et(c,2),h=v[0],d=v[1],p=this.manualEndptToPx(r.target()[0],o),g=et(p,2),y=g[0],b=g[1],m={x1:h,y1:d,x2:y,y2:b};n=l(h,d,y,b),i=m}else Pe("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};mt.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],a=t._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var s=a.source,o=a.target,u=s.position(),l=o.position(),f=s.width(),c=o.width(),v=s.height(),h=o.height(),d=t.pstyle("haystack-radius").value,p=d/2;n.haystackPts=n.allpts=[n.source.x*f*p+u.x,n.source.y*v*p+u.y,n.target.x*c*p+l.x,n.target.y*h*p+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};mt.findSegmentsPoints=function(r,e){var t=r._private.rscratch,a=r.pstyle("segment-weights"),n=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),s=r.pstyle("radius-type"),o=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=s.pfValue[s.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var f=0;f<o;f++){var c=a.pfValue[f],v=n.pfValue[f],h=1-c,d=c,p=this.findMidptPtsEtc(r,e),g=p.midptPts,y=p.vectorNormInverse,b={x:g.x1*h+g.x2*d,y:g.y1*h+g.y2*d};t.segpts.push(b.x+y.x*v,b.y+y.y*v),t.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),t.isArcRadius.push((s.pfValue[f]!==void 0?s.pfValue[f]:l)==="arc-radius")}};mt.findLoopPoints=function(r,e,t,a){var n=r._private.rscratch,i=e.dirCounts,s=e.srcPos,o=r.pstyle("control-point-distances"),u=o?o.pfValue[0]:void 0,l=r.pstyle("loop-direction").pfValue,f=r.pstyle("loop-sweep").pfValue,c=r.pstyle("control-point-step-size").pfValue;n.edgeType="self";var v=t,h=c;a&&(v=0,h=u);var d=l-Math.PI/2,p=d-f/2,g=d+f/2,y=l+"_"+f;v=i[y]===void 0?i[y]=0:++i[y],n.ctrlpts=[s.x+Math.cos(p)*1.4*h*(v/3+1),s.y+Math.sin(p)*1.4*h*(v/3+1),s.x+Math.cos(g)*1.4*h*(v/3+1),s.y+Math.sin(g)*1.4*h*(v/3+1)]};mt.findCompoundLoopPoints=function(r,e,t,a){var n=r._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,c=r.pstyle("control-point-step-size").pfValue,v=r.pstyle("control-point-distances"),h=v?v.pfValue[0]:void 0,d=t,p=c;a&&(d=0,p=h);var g=50,y={x:i.x-o/2,y:i.y-u/2},b={x:s.x-l/2,y:s.y-f/2},m={x:Math.min(y.x,b.x),y:Math.min(y.y,b.y)},E=.5,x=Math.max(E,Math.log(o*Oa)),S=Math.max(E,Math.log(l*Oa));n.ctrlpts=[m.x,m.y-(1+Math.pow(g,1.12)/100)*p*(d/3+1)*x,m.x-(1+Math.pow(g,1.12)/100)*p*(d/3+1)*S,m.y]};mt.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};mt.findBezierPoints=function(r,e,t,a,n){var i=r._private.rscratch,s=r.pstyle("control-point-step-size").pfValue,o=r.pstyle("control-point-distances"),u=r.pstyle("control-point-weights"),l=o&&u?Math.min(o.value.length,u.value.length):1,f=o?o.pfValue[0]:void 0,c=u.value[0],v=a;i.edgeType=v?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<l;h++){var d=(.5-e.eles.length/2+t)*s*(n?-1:1),p=void 0,g=so(d);v&&(f=o?o.pfValue[h]:s,c=u.value[h]),a?p=f:p=f!==void 0?g*f:void 0;var y=p!==void 0?p:d,b=1-c,m=c,E=this.findMidptPtsEtc(r,e),x=E.midptPts,S=E.vectorNormInverse,w={x:x.x1*b+x.x2*m,y:x.y1*b+x.y2*m};i.ctrlpts.push(w.x+S.x*y,w.y+S.y*y)}};mt.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",u="upward",l="auto",f=e.posPts,c=e.srcW,v=e.srcH,h=e.tgtW,d=e.tgtH,p=r.pstyle("edge-distances").value,g=p!=="node-position",y=r.pstyle("taxi-direction").value,b=y,m=r.pstyle("taxi-turn"),E=m.units==="%",x=m.pfValue,S=x<0,w=r.pstyle("taxi-turn-min-distance").pfValue,T=g?(c+h)/2:0,C=g?(v+d)/2:0,D=f.x2-f.x1,A=f.y2-f.y1,L=function(M,q){return M>0?Math.max(M-q,0):Math.min(M+q,0)},R=L(D,T),I=L(A,C),O=!1;b===l?y=Math.abs(R)>Math.abs(I)?n:a:b===u||b===o?(y=a,O=!0):(b===i||b===s)&&(y=n,O=!0);var N=y===a,k=N?I:R,P=N?A:D,B=so(P),_=!1;!(O&&(E||S))&&(b===o&&P<0||b===u&&P>0||b===i&&P>0||b===s&&P<0)&&(B*=-1,k=B*Math.abs(k),_=!0);var F;if(E){var G=x<0?1+x:x;F=G*k}else{var U=x<0?k:0;F=U+x*B}var H=function(M){return Math.abs(M)<w||Math.abs(M)>=Math.abs(k)},X=H(F),$=H(Math.abs(k)-Math.abs(F)),Q=X||$;if(Q&&!_)if(N){var re=Math.abs(P)<=v/2,J=Math.abs(D)<=h/2;if(re){var z=(f.x1+f.x2)/2,V=f.y1,Y=f.y2;t.segpts=[z,V,z,Y]}else if(J){var ee=(f.y1+f.y2)/2,ne=f.x1,be=f.x2;t.segpts=[ne,ee,be,ee]}else t.segpts=[f.x1,f.y2]}else{var Ve=Math.abs(P)<=c/2,Ne=Math.abs(A)<=d/2;if(Ve){var se=(f.y1+f.y2)/2,oe=f.x1,ve=f.x2;t.segpts=[oe,se,ve,se]}else if(Ne){var ge=(f.x1+f.x2)/2,he=f.y1,ye=f.y2;t.segpts=[ge,he,ge,ye]}else t.segpts=[f.x2,f.y1]}else if(N){var we=f.y1+F+(g?v/2*B:0),Se=f.x1,Fe=f.x2;t.segpts=[Se,we,Fe,we]}else{var $e=f.x1+F+(g?c/2*B:0),Ie=f.y1,Ke=f.y2;t.segpts=[$e,Ie,$e,Ke]}if(t.isRound){var Ae=r.pstyle("taxi-radius").value,le=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(Ae),t.isArcRadius=new Array(t.segpts.length/2).fill(le)}};mt.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,c=e.srcCornerRadius,v=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,p=!ae(t.startX)||!ae(t.startY),g=!ae(t.arrowStartX)||!ae(t.arrowStartY),y=!ae(t.endX)||!ae(t.endY),b=!ae(t.arrowEndX)||!ae(t.arrowEndY),m=3,E=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,x=m*E,S=Rr({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),w=S<x,T=Rr({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),C=T<x,D=!1;if(p||g||w){D=!0;var A={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},L=Math.sqrt(A.x*A.x+A.y*A.y),R={x:A.x/L,y:A.y/L},I=Math.max(i,s),O={x:t.ctrlpts[0]+R.x*2*I,y:t.ctrlpts[1]+R.y*2*I},N=l.intersectLine(a.x,a.y,i,s,O.x,O.y,0,c,h);w?(t.ctrlpts[0]=t.ctrlpts[0]+R.x*(x-S),t.ctrlpts[1]=t.ctrlpts[1]+R.y*(x-S)):(t.ctrlpts[0]=N[0]+R.x*x,t.ctrlpts[1]=N[1]+R.y*x)}if(y||b||C){D=!0;var k={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},P=Math.sqrt(k.x*k.x+k.y*k.y),B={x:k.x/P,y:k.y/P},_=Math.max(i,s),F={x:t.ctrlpts[0]+B.x*2*_,y:t.ctrlpts[1]+B.y*2*_},G=f.intersectLine(n.x,n.y,o,u,F.x,F.y,0,v,d);C?(t.ctrlpts[0]=t.ctrlpts[0]+B.x*(x-T),t.ctrlpts[1]=t.ctrlpts[1]+B.y*(x-T)):(t.ctrlpts[0]=G[0]+B.x*x,t.ctrlpts[1]=G[1]+B.y*x)}D&&this.findEndpoints(r)}};mt.storeAllpts=function(r){var e=r._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=st(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=st(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var s=e.radii[i/2-1],o=e.isArcRadius[i/2-1];e.roundCorners.push(wo({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,o))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var c={x:e.segpts[f],y:e.segpts[f+1]},v=e.roundCorners[f/2];if(v.radius===0){var h={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=c.x,e.midY=c.y,e.midVector=[c.y-h.y,h.x-c.x]}else{var d=[c.x-v.cx,c.y-v.cy],p=v.radius/Math.sqrt(Math.pow(d[0],2)+Math.pow(d[1],2));d=d.map(function(g){return g*p}),e.midX=v.cx+d[0],e.midY=v.cy+d[1],e.midVector=d}}}}};mt.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||ae(e.startX)&&ae(e.startY)&&ae(e.endX)&&ae(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Pe("Edge `"+r.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."))};mt.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,a=t.cy,n=a.hasCompoundNodes(),i=new Zt,s=function(C,D){return[].concat(xn(C),[D?1:0]).join("-")},o=[],u=[],l=0;l<r.length;l++){var f=r[l],c=f._private,v=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(v==="haystack"){u.push(f);continue}var h=v==="unbundled-bezier"||v.endsWith("segments")||v==="straight"||v==="straight-triangle"||v.endsWith("taxi"),d=v==="unbundled-bezier"||v==="bezier",p=c.source,g=c.target,y=p.poolIndex(),b=g.poolIndex(),m=[y,b].sort(),E=s(m,h),x=i.get(E);x==null&&(x={eles:[]},o.push({pairId:m,edgeIsUnbundled:h}),i.set(E,x)),x.eles.push(f),h&&(x.hasUnbundled=!0),d&&(x.hasBezier=!0)}}for(var S=function(){var C=o[w],D=C.pairId,A=C.edgeIsUnbundled,L=s(D,A),R=i.get(L),I;if(!R.hasUnbundled){var O=R.eles[0].parallelEdges().filter(function(le){return le.isBundledBezier()});no(R.eles),O.forEach(function(le){return R.eles.push(le)}),R.eles.sort(function(le,j){return le.poolIndex()-j.poolIndex()})}var N=R.eles[0],k=N.source(),P=N.target();if(k.poolIndex()>P.poolIndex()){var B=k;k=P,P=B}var _=R.srcPos=k.position(),F=R.tgtPos=P.position(),G=R.srcW=k.outerWidth(),U=R.srcH=k.outerHeight(),H=R.tgtW=P.outerWidth(),X=R.tgtH=P.outerHeight(),$=R.srcShape=t.nodeShapes[e.getNodeShape(k)],Q=R.tgtShape=t.nodeShapes[e.getNodeShape(P)],re=R.srcCornerRadius=k.pstyle("corner-radius").value==="auto"?"auto":k.pstyle("corner-radius").pfValue,J=R.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,z=R.tgtRs=P._private.rscratch,V=R.srcRs=k._private.rscratch;R.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Y=0;Y<R.eles.length;Y++){var ee=R.eles[Y],ne=ee[0]._private.rscratch,be=ee.pstyle("curve-style").value,Ve=be==="unbundled-bezier"||be.endsWith("segments")||be.endsWith("taxi"),Ne=!k.same(ee.source());if(!R.calculatedIntersection&&k!==P&&(R.hasBezier||R.hasUnbundled)){R.calculatedIntersection=!0;var se=$.intersectLine(_.x,_.y,G,U,F.x,F.y,0,re,V),oe=R.srcIntn=se,ve=Q.intersectLine(F.x,F.y,H,X,_.x,_.y,0,J,z),ge=R.tgtIntn=ve,he=R.intersectionPts={x1:se[0],x2:ve[0],y1:se[1],y2:ve[1]},ye=R.posPts={x1:_.x,x2:F.x,y1:_.y,y2:F.y},we=ve[1]-se[1],Se=ve[0]-se[0],Fe=Math.sqrt(Se*Se+we*we);ae(Fe)&&Fe>=ny||(Fe=Math.sqrt(Math.max(Se*Se,Oa)+Math.max(we*we,Oa)));var $e=R.vector={x:Se,y:we},Ie=R.vectorNorm={x:$e.x/Fe,y:$e.y/Fe},Ke={x:-Ie.y,y:Ie.x};R.nodesOverlap=!ae(Fe)||Q.checkPoint(se[0],se[1],0,H,X,F.x,F.y,J,z)||$.checkPoint(ve[0],ve[1],0,G,U,_.x,_.y,re,V),R.vectorNormInverse=Ke,I={nodesOverlap:R.nodesOverlap,dirCounts:R.dirCounts,calculatedIntersection:!0,hasBezier:R.hasBezier,hasUnbundled:R.hasUnbundled,eles:R.eles,srcPos:F,srcRs:z,tgtPos:_,tgtRs:V,srcW:H,srcH:X,tgtW:G,tgtH:U,srcIntn:ge,tgtIntn:oe,srcShape:Q,tgtShape:$,posPts:{x1:ye.x2,y1:ye.y2,x2:ye.x1,y2:ye.y1},intersectionPts:{x1:he.x2,y1:he.y2,x2:he.x1,y2:he.y1},vector:{x:-$e.x,y:-$e.y},vectorNorm:{x:-Ie.x,y:-Ie.y},vectorNormInverse:{x:-Ke.x,y:-Ke.y}}}var Ae=Ne?I:R;ne.nodesOverlap=Ae.nodesOverlap,ne.srcIntn=Ae.srcIntn,ne.tgtIntn=Ae.tgtIntn,ne.isRound=be.startsWith("round"),n&&(k.isParent()||k.isChild()||P.isParent()||P.isChild())&&(k.parents().anySame(P)||P.parents().anySame(k)||k.same(P)&&k.isParent())?e.findCompoundLoopPoints(ee,Ae,Y,Ve):k===P?e.findLoopPoints(ee,Ae,Y,Ve):be.endsWith("segments")?e.findSegmentsPoints(ee,Ae):be.endsWith("taxi")?e.findTaxiPoints(ee,Ae):be==="straight"||!Ve&&R.eles.length%2===1&&Y===Math.floor(R.eles.length/2)?e.findStraightEdgePoints(ee):e.findBezierPoints(ee,Ae,Y,Ve,Ne),e.findEndpoints(ee),e.tryToCorrectInvalidPoints(ee,Ae),e.checkForInvalidEdgeWarning(ee),e.storeAllpts(ee),e.storeEdgeProjections(ee),e.calculateArrowAngles(ee),e.recalculateEdgeLabelProjections(ee),e.calculateLabelAngles(ee)}},w=0;w<o.length;w++)S();this.findHaystackPoints(u)}};function wc(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var a=r[t],n=r[t+1];e.push({x:a,y:n})}return e}}mt.getSegmentPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="segments")return wc(e.segpts)};mt.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="bezier"||t==="multibezier"||t==="self"||t==="compound")return wc(e.ctrlpts)};mt.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ua={};Ua.manualEndptToPx=function(r,e){var t=this,a=r.position(),n=r.outerWidth(),i=r.outerHeight(),s=r._private.rscratch;if(e.value.length===2){var o=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(o[0]=o[0]*n),e.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=a.x,o[1]+=a.y,o}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),f=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,s)}};Ua.findEndpoints=function(r){var e=this,t,a=r.source()[0],n=r.target()[0],i=a.position(),s=n.position(),o=r.pstyle("target-arrow-shape").value,u=r.pstyle("source-arrow-shape").value,l=r.pstyle("target-distance-from-node").pfValue,f=r.pstyle("source-distance-from-node").pfValue,c=a._private.rscratch,v=n._private.rscratch,h=r.pstyle("curve-style").value,d=r._private.rscratch,p=d.edgeType,g=h==="taxi",y=p==="self"||p==="compound",b=p==="bezier"||p==="multibezier"||y,m=p!=="bezier",E=p==="straight"||p==="segments",x=p==="segments",S=b||m||E,w=y||g,T=r.pstyle("source-endpoint"),C=w?"outside-to-node":T.value,D=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,A=r.pstyle("target-endpoint"),L=w?"outside-to-node":A.value,R=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue;d.srcManEndpt=T,d.tgtManEndpt=A;var I,O,N,k;if(b){var P=[d.ctrlpts[0],d.ctrlpts[1]],B=m?[d.ctrlpts[d.ctrlpts.length-2],d.ctrlpts[d.ctrlpts.length-1]]:P;I=B,O=P}else if(E){var _=x?d.segpts.slice(0,2):[s.x,s.y],F=x?d.segpts.slice(d.segpts.length-2):[i.x,i.y];I=F,O=_}if(L==="inside-to-node")t=[s.x,s.y];else if(A.units)t=this.manualEndptToPx(n,A);else if(L==="outside-to-line")t=d.tgtIntn;else if(L==="outside-to-node"||L==="outside-to-node-or-label"?N=I:(L==="outside-to-line"||L==="outside-to-line-or-label")&&(N=[i.x,i.y]),t=e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x,s.y,n.outerWidth(),n.outerHeight(),N[0],N[1],0,R,v),L==="outside-to-node-or-label"||L==="outside-to-line-or-label"){var G=n._private.rscratch,U=G.labelWidth,H=G.labelHeight,X=G.labelX,$=G.labelY,Q=U/2,re=H/2,J=n.pstyle("text-valign").value;J==="top"?$-=re:J==="bottom"&&($+=re);var z=n.pstyle("text-halign").value;z==="left"?X-=Q:z==="right"&&(X+=Q);var V=Aa(N[0],N[1],[X-Q,$-re,X+Q,$-re,X+Q,$+re,X-Q,$+re],s.x,s.y);if(V.length>0){var Y=i,ee=xr(Y,Yr(t)),ne=xr(Y,Yr(V)),be=ee;if(ne<ee&&(t=V,be=ne),V.length>2){var Ve=xr(Y,{x:V[2],y:V[3]});Ve<be&&(t=[V[2],V[3]])}}}var Ne=Qa(t,I,e.arrowShapes[o].spacing(r)+l),se=Qa(t,I,e.arrowShapes[o].gap(r)+l);if(d.endX=se[0],d.endY=se[1],d.arrowEndX=Ne[0],d.arrowEndY=Ne[1],C==="inside-to-node")t=[i.x,i.y];else if(T.units)t=this.manualEndptToPx(a,T);else if(C==="outside-to-line")t=d.srcIntn;else if(C==="outside-to-node"||C==="outside-to-node-or-label"?k=O:(C==="outside-to-line"||C==="outside-to-line-or-label")&&(k=[s.x,s.y]),t=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),k[0],k[1],0,D,c),C==="outside-to-node-or-label"||C==="outside-to-line-or-label"){var oe=a._private.rscratch,ve=oe.labelWidth,ge=oe.labelHeight,he=oe.labelX,ye=oe.labelY,we=ve/2,Se=ge/2,Fe=a.pstyle("text-valign").value;Fe==="top"?ye-=Se:Fe==="bottom"&&(ye+=Se);var $e=a.pstyle("text-halign").value;$e==="left"?he-=we:$e==="right"&&(he+=we);var Ie=Aa(k[0],k[1],[he-we,ye-Se,he+we,ye-Se,he+we,ye+Se,he-we,ye+Se],i.x,i.y);if(Ie.length>0){var Ke=s,Ae=xr(Ke,Yr(t)),le=xr(Ke,Yr(Ie)),j=Ae;if(le<Ae&&(t=[Ie[0],Ie[1]],j=le),Ie.length>2){var M=xr(Ke,{x:Ie[2],y:Ie[3]});M<j&&(t=[Ie[2],Ie[3]])}}}var q=Qa(t,O,e.arrowShapes[u].spacing(r)+f),W=Qa(t,O,e.arrowShapes[u].gap(r)+f);d.startX=W[0],d.startY=W[1],d.arrowStartX=q[0],d.arrowStartY=q[1],S&&(!ae(d.startX)||!ae(d.startY)||!ae(d.endX)||!ae(d.endY)?d.badLine=!0:d.badLine=!1)};Ua.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ua.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Eo={};function iy(r,e,t){for(var a=function(l,f,c,v){return st(l,f,c,v)},n=e._private,i=n.rstyle.bezierPts,s=0;s<r.bezierProjPcts.length;s++){var o=r.bezierProjPcts[s];i.push({x:a(t[0],t[2],t[4],o),y:a(t[1],t[3],t[5],o)})}}Eo.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,a=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<t.allpts.length;n+=4)iy(this,r,t.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<t.allpts.length;n+=2)i.push({x:t.allpts[n],y:t.allpts[n+1]});else if(a==="haystack"){var s=t.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth};Eo.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Yt={};Yt.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!or(e)){var t,a,n=r._private,i=r.width(),s=r.height(),o=r.padding(),u=r.position(),l=r.pstyle("text-halign").strValue,f=r.pstyle("text-valign").strValue,c=n.rscratch,v=n.rstyle;switch(l){case"left":t=u.x-i/2-o;break;case"right":t=u.x+i/2+o;break;default:t=u.x}switch(f){case"top":a=u.y-s/2-o;break;case"bottom":a=u.y+s/2+o;break;default:a=u.y}c.labelX=t,c.labelY=a,v.labelX=t,v.labelY=a,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var Ec=function(e,t){var a=Math.atan(t/e);return e===0&&a<0&&(a=a*-1),a},xc=function(e,t){var a=t.x-e.x,n=t.y-e.y;return Ec(a,n)},sy=function(e,t,a,n){var i=Sa(0,n-.001,1),s=Sa(0,n+.001,1),o=Wr(e,t,a,i),u=Wr(e,t,a,s);return xc(o,u)};Yt.recalculateEdgeLabelProjections=function(r){var e,t=r._private,a=t.rscratch,n=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var s=function(c,v,h){Kt(t.rscratch,c,v,h),Kt(t.rstyle,c,v,h)};s("labelX",null,e.x),s("labelY",null,e.y);var o=Ec(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var u=function(){if(u.cache)return u.cache;for(var c=[],v=0;v+5<a.allpts.length;v+=4){var h={x:a.allpts[v],y:a.allpts[v+1]},d={x:a.allpts[v+2],y:a.allpts[v+3]},p={x:a.allpts[v+4],y:a.allpts[v+5]};c.push({p0:h,p1:d,p2:p,startDist:0,length:0,segments:[]})}var g=t.rstyle.bezierPts,y=n.bezierProjPcts.length;function b(w,T,C,D,A){var L=Rr(T,C),R=w.segments[w.segments.length-1],I={p0:T,p1:C,t0:D,t1:A,startDist:R?R.startDist+R.length:0,length:L};w.segments.push(I),w.length+=L}for(var m=0;m<c.length;m++){var E=c[m],x=c[m-1];x&&(E.startDist=x.startDist+x.length),b(E,E.p0,g[m*y],0,n.bezierProjPcts[0]);for(var S=0;S<y-1;S++)b(E,g[m*y+S],g[m*y+S+1],n.bezierProjPcts[S],n.bezierProjPcts[S+1]);b(E,g[m*y+y-1],E.p2,n.bezierProjPcts[y-1],1)}return u.cache=c},l=function(c){var v,h=c==="source";if(i[c]){var d=r.pstyle(c+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=u(),g,y=0,b=0,m=0;m<p.length;m++){for(var E=p[h?m:p.length-1-m],x=0;x<E.segments.length;x++){var S=E.segments[h?x:E.segments.length-1-x],w=m===p.length-1&&x===E.segments.length-1;if(y=b,b+=S.length,b>=d||w){g={cp:E,segment:S};break}}if(g)break}var T=g.cp,C=g.segment,D=(d-y)/C.length,A=C.t1-C.t0,L=h?C.t0+A*D:C.t1-A*D;L=Sa(0,L,1),e=Wr(T.p0,T.p1,T.p2,L),v=sy(T.p0,T.p1,T.p2,L);break}case"straight":case"segments":case"haystack":{for(var R=0,I,O,N,k,P=a.allpts.length,B=0;B+3<P&&(h?(N={x:a.allpts[B],y:a.allpts[B+1]},k={x:a.allpts[B+2],y:a.allpts[B+3]}):(N={x:a.allpts[P-2-B],y:a.allpts[P-1-B]},k={x:a.allpts[P-4-B],y:a.allpts[P-3-B]}),I=Rr(N,k),O=R,R+=I,!(R>=d));B+=2);var _=d-O,F=_/I;F=Sa(0,F,1),e=Lh(N,k,F),v=xc(N,k);break}}s("labelX",c,e.x),s("labelY",c,e.y),s("labelAutoAngle",c,v)}};l("source"),l("target"),this.applyLabelDimensions(r)}};Yt.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Yt.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=Lr(a,r._private.labelDimsKey);if(Ct(t.rscratch,"prefixedLabelDimsKey",e)!==n){Kt(t.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(r,a),s=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,u=Ct(t.rscratch,"labelWrapCachedLines",e)||[],l=o!=="wrap"?1:Math.max(u.length,1),f=i.height/l,c=f*s,v=i.width,h=i.height+(l-1)*(s-1)*f;Kt(t.rstyle,"labelWidth",e,v),Kt(t.rscratch,"labelWidth",e,v),Kt(t.rstyle,"labelHeight",e,h),Kt(t.rscratch,"labelHeight",e,h),Kt(t.rscratch,"labelLineHeight",e,c)}};Yt.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=function(U,H){return H?(Kt(t.rscratch,U,e,H),H):Ct(t.rscratch,U,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=r.pstyle("text-wrap").value;if(o==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var l="",f=n.split(`
|
|
15
|
-
`),c=r.pstyle("text-max-width").pfValue,v=r.pstyle("text-overflow-wrap").value,h=v==="anywhere",d=[],p=/[\s\u200b]+|$/g,g=0;g<f.length;g++){var y=f[g],b=this.calculateLabelDimensions(r,y),m=b.width;if(h){var E=y.split("").join(l);y=E}if(m>c){var x=y.matchAll(p),S="",w=0,T=St(x),C;try{for(T.s();!(C=T.n()).done;){var D=C.value,A=D[0],L=y.substring(w,D.index);w=D.index+A.length;var R=S.length===0?L:S+L+A,I=this.calculateLabelDimensions(r,R),O=I.width;O<=c?S+=L+A:(S&&d.push(S),S=L+A)}}catch(G){T.e(G)}finally{T.f()}S.match(/^[\s\u200b]+$/)||d.push(S)}else d.push(y)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(`
|
|
16
|
-
`)),s("labelWrapKey",u)}else if(o==="ellipsis"){var N=r.pstyle("text-max-width").pfValue,k="",P="…",B=!1;if(this.calculateLabelDimensions(r,n).width<N)return n;for(var _=0;_<n.length;_++){var F=this.calculateLabelDimensions(r,k+n[_]+P).width;if(F>N)break;k+=n[_],_===n.length-1&&(B=!0)}return B||(k+=P),k}return n};Yt.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Yt.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=0,s=r.pstyle("font-style").strValue,o=r.pstyle("font-size").pfValue,u=r.pstyle("font-family").strValue,l=r.pstyle("font-weight").strValue,f=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!f){f=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=f.getContext("2d");var v=f.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(s," ").concat(l," ").concat(o,"px ").concat(u);for(var h=0,d=0,p=e.split(`
|
|
17
|
-
`),g=0;g<p.length;g++){var y=p[g],b=c.measureText(y),m=Math.ceil(b.width),E=o;h=Math.max(m,h),d+=E}return h+=i,d+=i,{width:h,height:d}};Yt.calculateLabelAngle=function(r,e){var t=r._private,a=t.rscratch,n=r.isEdge(),i=e?e+"-":"",s=r.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?a.labelAutoAngle:o==="autorotate"?0:s.pfValue};Yt.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),a=r._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(r),t&&(n.sourceLabelAngle=e.calculateLabelAngle(r,"source"),n.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var Tc={},Bl=28,Fl=!1;Tc.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<Bl||r.height()<Bl))return Fl||(Pe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Fl=!0),"rectangle";if(r.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var a=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return t};var Jn={};Jn.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,a=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var u=0;u<s.length;u++){var l=s[u],f=l._private,c=f.rstyle;c.clean=!1,c.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(s){var o=s.target;a(o)}).on("style.* background.*",function(s){var o=s.target;a(o,!1)});var n=function(s){if(s){var o=t.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(a(l.connectedEdges()),f.cleanConnected=!0)}if(o)for(var c=0;c<o.length;c++){var v=o[c];v(s,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){n(!0)},t.beforeRender(n,t.beforeRenderPriorities.eleCalcs)};Jn.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};Jn.recalculateRenderedStyle=function(r,e){var t=function(E){return E._private.rstyle.cleanConnected};if(r.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var s=r[i],o=s._private,u=o.rstyle;s.isEdge()&&(!t(s.source())||!t(s.target()))&&(u.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(m){return!m._private.rstyle.clean&&m.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):a.push(s),u.clean=!0)}for(var l=0;l<n.length;l++){var f=n[l],c=f._private,v=c.rstyle,h=f.position();this.recalculateNodeLabelProjection(f),v.nodeX=h.x,v.nodeY=h.y,v.nodeW=f.pstyle("width").pfValue,v.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var p=a[d],g=p._private,y=g.rstyle,b=g.rscratch;y.srcX=b.arrowStartX,y.srcY=b.arrowStartY,y.tgtX=b.arrowEndX,y.tgtY=b.arrowEndY,y.midX=b.midX,y.midY=b.midY,y.labelAngle=b.labelAngle,y.sourceLabelAngle=b.sourceLabelAngle,y.targetLabelAngle=b.targetLabelAngle}}}};var jn={};jn.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var a=r[t],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?r.drag.push(a):r.nondrag.push(a)}for(var t=0;t<e.length;t++){var a=e[t];r.drag.push(a)}}};jn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};jn.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(nc),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var Cc={};[Pr,On,mt,Ua,Eo,Yt,Tc,Jn,jn].forEach(function(r){de(Cc,r)});var Dc={};Dc.getCachedImage=function(r,e,t){var a=this,n=a.imageCache=a.imageCache||{},i=n[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=n[r]=n[r]||{};var s=i.image=new Image;s.addEventListener("load",t),s.addEventListener("error",function(){s.error=!0});var o="data:",u=r.substring(0,o.length).toLowerCase()===o;return u||(e=e==="null"?null:e,s.crossOrigin=e),s.src=r,s};var sa={};sa.registerBinding=function(r,e,t,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],s=0;s<r.length;s++){var o=r[s];if(o!==void 0){var u=this.binder(o);i.push(u.on.apply(u,n))}}return i}var u=this.binder(r);return u.on.apply(u,n)};sa.binder=function(r){var e=this,t=e.cy.window(),a=r===t||r===t.document||r===t.document.body||Ev(r);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var s=function(u,l,f){var c=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(c[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:c}),(r.addEventListener||r.on).apply(r,c),this};return{on:s,addEventListener:s,addListener:s,bind:s}};sa.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};sa.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};sa.load=function(){var r=this,e=r.cy.window(),t=function(M){return M.selected()},a=function(M){var q=M.getRootNode();if(q&&q.nodeType===11&&q.host!==void 0)return q},n=function(M,q,W,K){M==null&&(M=r.cy);for(var Z=0;Z<q.length;Z++){var ue=q[Z];M.emit({originalEvent:W,type:ue,position:K})}},i=function(M){return M.shiftKey||M.metaKey||M.ctrlKey},s=function(M,q){var W=!0;if(r.cy.hasCompoundNodes()&&M&&M.pannable())for(var K=0;q&&K<q.length;K++){var M=q[K];if(M.isNode()&&M.isParent()&&!M.pannable()){W=!1;break}}else W=!0;return W},o=function(M){M[0]._private.grabbed=!0},u=function(M){M[0]._private.grabbed=!1},l=function(M){M[0]._private.rscratch.inDragLayer=!0},f=function(M){M[0]._private.rscratch.inDragLayer=!1},c=function(M){M[0]._private.rscratch.isGrabTarget=!0},v=function(M){M[0]._private.rscratch.isGrabTarget=!1},h=function(M,q){var W=q.addToList,K=W.has(M);!K&&M.grabbable()&&!M.locked()&&(W.merge(M),o(M))},d=function(M,q){if(M.cy().hasCompoundNodes()&&!(q.inDragLayer==null&&q.addToList==null)){var W=M.descendants();q.inDragLayer&&(W.forEach(l),W.connectedEdges().forEach(l)),q.addToList&&h(W,q)}},p=function(M,q){q=q||{};var W=M.cy().hasCompoundNodes();q.inDragLayer&&(M.forEach(l),M.neighborhood().stdFilter(function(K){return!W||K.isEdge()}).forEach(l)),q.addToList&&M.forEach(function(K){h(K,q)}),d(M,q),b(M,{inDragLayer:q.inDragLayer}),r.updateCachedGrabbedEles()},g=p,y=function(M){M&&(r.getCachedZSortedEles().forEach(function(q){u(q),f(q),v(q)}),r.updateCachedGrabbedEles())},b=function(M,q){if(!(q.inDragLayer==null&&q.addToList==null)&&M.cy().hasCompoundNodes()){var W=M.ancestors().orphans();if(!W.same(M)){var K=W.descendants().spawnSelf().merge(W).unmerge(M).unmerge(M.descendants()),Z=K.connectedEdges();q.inDragLayer&&(Z.forEach(l),K.forEach(l)),q.addToList&&K.forEach(function(ue){h(ue,q)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},E=typeof MutationObserver<"u",x=typeof ResizeObserver<"u";E?(r.removeObserver=new MutationObserver(function(j){for(var M=0;M<j.length;M++){var q=j[M],W=q.removedNodes;if(W)for(var K=0;K<W.length;K++){var Z=W[K];if(Z===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(j){r.destroy()});var S=_a(function(){r.cy.resize()},100);E&&(r.styleObserver=new MutationObserver(S),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",S),x&&(r.resizeObserver=new ResizeObserver(S),r.resizeObserver.observe(r.container));var w=function(M,q){for(;M!=null;)q(M),M=M.parentNode},T=function(){r.invalidateContainerClientCoordsCache()};w(r.container,function(j){r.registerBinding(j,"transitionend",T),r.registerBinding(j,"animationend",T),r.registerBinding(j,"scroll",T)}),r.registerBinding(r.container,"contextmenu",function(j){j.preventDefault()});var C=function(){return r.selection[4]!==0},D=function(M){for(var q=r.findContainerClientCoords(),W=q[0],K=q[1],Z=q[2],ue=q[3],te=M.touches?M.touches:[M],fe=!1,xe=0;xe<te.length;xe++){var De=te[xe];if(W<=De.clientX&&De.clientX<=W+Z&&K<=De.clientY&&De.clientY<=K+ue){fe=!0;break}}if(!fe)return!1;for(var pe=r.container,Te=M.target,me=Te.parentNode,Ee=!1;me;){if(me===pe){Ee=!0;break}me=me.parentNode}return!!Ee};r.registerBinding(r.container,"mousedown",function(M){if(D(M)&&!(r.hoverData.which===1&&M.which!==1)){M.preventDefault(),m(),r.hoverData.capture=!0,r.hoverData.which=M.which;var q=r.cy,W=[M.clientX,M.clientY],K=r.projectIntoViewport(W[0],W[1]),Z=r.selection,ue=r.findNearestElements(K[0],K[1],!0,!1),te=ue[0],fe=r.dragData.possibleDragElements;r.hoverData.mdownPos=K,r.hoverData.mdownGPos=W;var xe=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var ke=r.hoverData.down;ke?ke.emit({originalEvent:M,type:"taphold",position:{x:K[0],y:K[1]}}):q.emit({originalEvent:M,type:"taphold",position:{x:K[0],y:K[1]}})}},r.tapholdDuration)};if(M.which==3){r.hoverData.cxtStarted=!0;var De={originalEvent:M,type:"cxttapstart",position:{x:K[0],y:K[1]}};te?(te.activate(),te.emit(De),r.hoverData.down=te):q.emit(De),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(M.which==1){te&&te.activate();{if(te!=null&&r.nodeIsGrabbable(te)){var pe=function(ke){return{originalEvent:M,type:ke,position:{x:K[0],y:K[1]}}},Te=function(ke){ke.emit(pe("grab"))};if(c(te),!te.selected())fe=r.dragData.possibleDragElements=q.collection(),g(te,{addToList:fe}),te.emit(pe("grabon")).emit(pe("grab"));else{fe=r.dragData.possibleDragElements=q.collection();var me=q.$(function(Ee){return Ee.isNode()&&Ee.selected()&&r.nodeIsGrabbable(Ee)});p(me,{addToList:fe}),te.emit(pe("grabon")),me.forEach(Te)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=te,r.hoverData.downs=ue,r.hoverData.downTime=new Date().getTime()}n(te,["mousedown","tapstart","vmousedown"],M,{x:K[0],y:K[1]}),te==null?(Z[4]=1,r.data.bgActivePosistion={x:K[0],y:K[1]},r.redrawHint("select",!0),r.redraw()):te.pannable()&&(Z[4]=1),xe()}Z[0]=Z[2]=K[0],Z[1]=Z[3]=K[1]}},!1);var A=a(r.container);r.registerBinding([e,A],"mousemove",function(M){var q=r.hoverData.capture;if(!(!q&&!D(M))){var W=!1,K=r.cy,Z=K.zoom(),ue=[M.clientX,M.clientY],te=r.projectIntoViewport(ue[0],ue[1]),fe=r.hoverData.mdownPos,xe=r.hoverData.mdownGPos,De=r.selection,pe=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(pe=r.findNearestElement(te[0],te[1],!0,!1));var Te=r.hoverData.last,me=r.hoverData.down,Ee=[te[0]-De[2],te[1]-De[3]],ke=r.dragData.possibleDragElements,Ze;if(xe){var lt=ue[0]-xe[0],it=lt*lt,We=ue[1]-xe[1],ft=We*We,Je=it+ft;r.hoverData.isOverThresholdDrag=Ze=Je>=r.desktopTapThreshold2}var Et=i(M);Ze&&(r.hoverData.tapholdCancelled=!0);var _t=function(){var Gt=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Gt.length===0?(Gt.push(Ee[0]),Gt.push(Ee[1])):(Gt[0]+=Ee[0],Gt[1]+=Ee[1])};W=!0,n(pe,["mousemove","vmousemove","tapdrag"],M,{x:te[0],y:te[1]});var tr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||K.emit({originalEvent:M,type:"boxstart",position:{x:te[0],y:te[1]}}),De[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Ze){var Xt={originalEvent:M,type:"cxtdrag",position:{x:te[0],y:te[1]}};me?me.emit(Xt):K.emit(Xt),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||pe!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:te[0],y:te[1]}}),r.hoverData.cxtOver=pe,pe&&pe.emit({originalEvent:M,type:"cxtdragover",position:{x:te[0],y:te[1]}}))}}else if(r.hoverData.dragging){if(W=!0,K.panningEnabled()&&K.userPanningEnabled()){var kr;if(r.hoverData.justStartedPan){var Ya=r.hoverData.mdownPos;kr={x:(te[0]-Ya[0])*Z,y:(te[1]-Ya[1])*Z},r.hoverData.justStartedPan=!1}else kr={x:Ee[0]*Z,y:Ee[1]*Z};K.panBy(kr),K.emit("dragpan"),r.hoverData.dragged=!0}te=r.projectIntoViewport(M.clientX,M.clientY)}else if(De[4]==1&&(me==null||me.pannable())){if(Ze){if(!r.hoverData.dragging&&K.boxSelectionEnabled()&&(Et||!K.panningEnabled()||!K.userPanningEnabled()))tr();else if(!r.hoverData.selecting&&K.panningEnabled()&&K.userPanningEnabled()){var br=s(me,r.hoverData.downs);br&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,De[4]=0,r.data.bgActivePosistion=Yr(fe),r.redrawHint("select",!0),r.redraw())}me&&me.pannable()&&me.active()&&me.unactivate()}}else{if(me&&me.pannable()&&me.active()&&me.unactivate(),(!me||!me.grabbed())&&pe!=Te&&(Te&&n(Te,["mouseout","tapdragout"],M,{x:te[0],y:te[1]}),pe&&n(pe,["mouseover","tapdragover"],M,{x:te[0],y:te[1]}),r.hoverData.last=pe),me)if(Ze){if(K.boxSelectionEnabled()&&Et)me&&me.grabbed()&&(y(ke),me.emit("freeon"),ke.emit("free"),r.dragData.didDrag&&(me.emit("dragfreeon"),ke.emit("dragfree"))),tr();else if(me&&me.grabbed()&&r.nodeIsDraggable(me)){var xt=!r.dragData.didDrag;xt&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||p(ke,{inDragLayer:!0});var gt={x:0,y:0};if(ae(Ee[0])&&ae(Ee[1])&&(gt.x+=Ee[0],gt.y+=Ee[1],xt)){var Tt=r.hoverData.dragDelta;Tt&&ae(Tt[0])&&ae(Tt[1])&&(gt.x+=Tt[0],gt.y+=Tt[1])}r.hoverData.draggingEles=!0,ke.silentShift(gt).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else _t();W=!0}if(De[2]=te[0],De[3]=te[1],W)return M.stopPropagation&&M.stopPropagation(),M.preventDefault&&M.preventDefault(),!1}},!1);var L,R,I;r.registerBinding(e,"mouseup",function(M){if(!(r.hoverData.which===1&&M.which!==1&&r.hoverData.capture)){var q=r.hoverData.capture;if(q){r.hoverData.capture=!1;var W=r.cy,K=r.projectIntoViewport(M.clientX,M.clientY),Z=r.selection,ue=r.findNearestElement(K[0],K[1],!0,!1),te=r.dragData.possibleDragElements,fe=r.hoverData.down,xe=i(M);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,fe&&fe.unactivate(),r.hoverData.which===3){var De={originalEvent:M,type:"cxttapend",position:{x:K[0],y:K[1]}};if(fe?fe.emit(De):W.emit(De),!r.hoverData.cxtDragged){var pe={originalEvent:M,type:"cxttap",position:{x:K[0],y:K[1]}};fe?fe.emit(pe):W.emit(pe)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(n(ue,["mouseup","tapend","vmouseup"],M,{x:K[0],y:K[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(fe,["click","tap","vclick"],M,{x:K[0],y:K[1]}),R=!1,M.timeStamp-I<=W.multiClickDebounceTime()?(L&&clearTimeout(L),R=!0,I=null,n(fe,["dblclick","dbltap","vdblclick"],M,{x:K[0],y:K[1]})):(L=setTimeout(function(){R||n(fe,["oneclick","onetap","voneclick"],M,{x:K[0],y:K[1]})},W.multiClickDebounceTime()),I=M.timeStamp)),fe==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(M)&&(W.$(t).unselect(["tapunselect"]),te.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=te=W.collection()),ue==fe&&!r.dragData.didDrag&&!r.hoverData.selecting&&ue!=null&&ue._private.selectable&&(r.hoverData.dragging||(W.selectionType()==="additive"||xe?ue.selected()?ue.unselect(["tapunselect"]):ue.select(["tapselect"]):xe||(W.$(t).unmerge(ue).unselect(["tapunselect"]),ue.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var Te=W.collection(r.getAllInBox(Z[0],Z[1],Z[2],Z[3]));r.redrawHint("select",!0),Te.length>0&&r.redrawHint("eles",!0),W.emit({type:"boxend",originalEvent:M,position:{x:K[0],y:K[1]}});var me=function(Ze){return Ze.selectable()&&!Ze.selected()};W.selectionType()==="additive"||xe||W.$(t).unmerge(Te).unselect(),Te.emit("box").stdFilter(me).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!Z[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var Ee=fe&&fe.grabbed();y(te),Ee&&(fe.emit("freeon"),te.emit("free"),r.dragData.didDrag&&(fe.emit("dragfreeon"),te.emit("dragfree")))}}Z[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var O=[],N=4,k,P=1e5,B=function(M,q){for(var W=0;W<M.length;W++)if(M[W]%q!==0)return!1;return!0},_=function(M){for(var q=Math.abs(M[0]),W=1;W<M.length;W++)if(Math.abs(M[W])!==q)return!1;return!0},F=function(M){var q=!1,W=M.deltaY;if(W==null&&(M.wheelDeltaY!=null?W=M.wheelDeltaY/4:M.wheelDelta!=null&&(W=M.wheelDelta/4)),k==null)if(O.length>=N){var K=O;if(k=B(K,5),!k){var Z=Math.abs(K[0]);k=_(K)&&Z>5}if(k)for(var ue=0;ue<K.length;ue++)P=Math.min(Math.abs(K[ue]),P)}else O.push(W),q=!0;else k&&(P=Math.min(Math.abs(W),P));if(!r.scrollingPage){var te=r.cy,fe=te.zoom(),xe=te.pan(),De=r.projectIntoViewport(M.clientX,M.clientY),pe=[De[0]*fe+xe.x,De[1]*fe+xe.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||C()){M.preventDefault();return}if(te.panningEnabled()&&te.userPanningEnabled()&&te.zoomingEnabled()&&te.userZoomingEnabled()){M.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var Te;q&&Math.abs(W)>5&&(W=so(W)*5),Te=W/-250,k&&(Te/=P,Te*=3),Te=Te*r.wheelSensitivity;var me=M.deltaMode===1;me&&(Te*=33);var Ee=te.zoom()*Math.pow(10,Te);M.type==="gesturechange"&&(Ee=r.gestureStartZoom*M.scale),te.zoom({level:Ee,renderedPosition:{x:pe[0],y:pe[1]}}),te.emit(M.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",F,!0),r.registerBinding(e,"scroll",function(M){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(M){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||M.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(j){r.hasTouchStarted||F(j)},!0),r.registerBinding(r.container,"mouseout",function(M){var q=r.projectIntoViewport(M.clientX,M.clientY);r.cy.emit({originalEvent:M,type:"mouseout",position:{x:q[0],y:q[1]}})},!1),r.registerBinding(r.container,"mouseover",function(M){var q=r.projectIntoViewport(M.clientX,M.clientY);r.cy.emit({originalEvent:M,type:"mouseover",position:{x:q[0],y:q[1]}})},!1);var G,U,H,X,$,Q,re,J,z,V,Y,ee,ne,be=function(M,q,W,K){return Math.sqrt((W-M)*(W-M)+(K-q)*(K-q))},Ve=function(M,q,W,K){return(W-M)*(W-M)+(K-q)*(K-q)},Ne;r.registerBinding(r.container,"touchstart",Ne=function(M){if(r.hasTouchStarted=!0,!!D(M)){m(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var q=r.cy,W=r.touchData.now,K=r.touchData.earlier;if(M.touches[0]){var Z=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);W[0]=Z[0],W[1]=Z[1]}if(M.touches[1]){var Z=r.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);W[2]=Z[0],W[3]=Z[1]}if(M.touches[2]){var Z=r.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);W[4]=Z[0],W[5]=Z[1]}if(M.touches[1]){r.touchData.singleTouchMoved=!0,y(r.dragData.touchDragEles);var ue=r.findContainerClientCoords();z=ue[0],V=ue[1],Y=ue[2],ee=ue[3],G=M.touches[0].clientX-z,U=M.touches[0].clientY-V,H=M.touches[1].clientX-z,X=M.touches[1].clientY-V,ne=0<=G&&G<=Y&&0<=H&&H<=Y&&0<=U&&U<=ee&&0<=X&&X<=ee;var te=q.pan(),fe=q.zoom();$=be(G,U,H,X),Q=Ve(G,U,H,X),re=[(G+H)/2,(U+X)/2],J=[(re[0]-te.x)/fe,(re[1]-te.y)/fe];var xe=200,De=xe*xe;if(Q<De&&!M.touches[2]){var pe=r.findNearestElement(W[0],W[1],!0,!0),Te=r.findNearestElement(W[2],W[3],!0,!0);pe&&pe.isNode()?(pe.activate().emit({originalEvent:M,type:"cxttapstart",position:{x:W[0],y:W[1]}}),r.touchData.start=pe):Te&&Te.isNode()?(Te.activate().emit({originalEvent:M,type:"cxttapstart",position:{x:W[0],y:W[1]}}),r.touchData.start=Te):q.emit({originalEvent:M,type:"cxttapstart",position:{x:W[0],y:W[1]}}),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,r.redraw();return}}if(M.touches[2])q.boxSelectionEnabled()&&M.preventDefault();else if(!M.touches[1]){if(M.touches[0]){var me=r.findNearestElements(W[0],W[1],!0,!0),Ee=me[0];if(Ee!=null&&(Ee.activate(),r.touchData.start=Ee,r.touchData.starts=me,r.nodeIsGrabbable(Ee))){var ke=r.dragData.touchDragEles=q.collection(),Ze=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),Ee.selected()?(Ze=q.$(function(Je){return Je.selected()&&r.nodeIsGrabbable(Je)}),p(Ze,{addToList:ke})):g(Ee,{addToList:ke}),c(Ee);var lt=function(Et){return{originalEvent:M,type:Et,position:{x:W[0],y:W[1]}}};Ee.emit(lt("grabon")),Ze?Ze.forEach(function(Je){Je.emit(lt("grab"))}):Ee.emit(lt("grab"))}n(Ee,["touchstart","tapstart","vmousedown"],M,{x:W[0],y:W[1]}),Ee==null&&(r.data.bgActivePosistion={x:Z[0],y:Z[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&n(r.touchData.start,["taphold"],M,{x:W[0],y:W[1]})},r.tapholdDuration)}}if(M.touches.length>=1){for(var it=r.touchData.startPosition=[null,null,null,null,null,null],We=0;We<W.length;We++)it[We]=K[We]=W[We];var ft=M.touches[0];r.touchData.startGPosition=[ft.clientX,ft.clientY]}}},!1);var se;r.registerBinding(e,"touchmove",se=function(M){var q=r.touchData.capture;if(!(!q&&!D(M))){var W=r.selection,K=r.cy,Z=r.touchData.now,ue=r.touchData.earlier,te=K.zoom();if(M.touches[0]){var fe=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Z[0]=fe[0],Z[1]=fe[1]}if(M.touches[1]){var fe=r.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Z[2]=fe[0],Z[3]=fe[1]}if(M.touches[2]){var fe=r.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Z[4]=fe[0],Z[5]=fe[1]}var xe=r.touchData.startGPosition,De;if(q&&M.touches[0]&&xe){for(var pe=[],Te=0;Te<Z.length;Te++)pe[Te]=Z[Te]-ue[Te];var me=M.touches[0].clientX-xe[0],Ee=me*me,ke=M.touches[0].clientY-xe[1],Ze=ke*ke,lt=Ee+Ze;De=lt>=r.touchTapThreshold2}if(q&&r.touchData.cxt){M.preventDefault();var it=M.touches[0].clientX-z,We=M.touches[0].clientY-V,ft=M.touches[1].clientX-z,Je=M.touches[1].clientY-V,Et=Ve(it,We,ft,Je),_t=Et/Q,tr=150,Xt=tr*tr,kr=1.5,Ya=kr*kr;if(_t>=Ya||Et>=Xt){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var br={originalEvent:M,type:"cxttapend",position:{x:Z[0],y:Z[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(br),r.touchData.start=null):K.emit(br)}}if(q&&r.touchData.cxt){var br={originalEvent:M,type:"cxtdrag",position:{x:Z[0],y:Z[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(br):K.emit(br),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var xt=r.findNearestElement(Z[0],Z[1],!0,!0);(!r.touchData.cxtOver||xt!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:Z[0],y:Z[1]}}),r.touchData.cxtOver=xt,xt&&xt.emit({originalEvent:M,type:"cxtdragover",position:{x:Z[0],y:Z[1]}}))}else if(q&&M.touches[2]&&K.boxSelectionEnabled())M.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||K.emit({originalEvent:M,type:"boxstart",position:{x:Z[0],y:Z[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,W[4]=1,!W||W.length===0||W[0]===void 0?(W[0]=(Z[0]+Z[2]+Z[4])/3,W[1]=(Z[1]+Z[3]+Z[5])/3,W[2]=(Z[0]+Z[2]+Z[4])/3+1,W[3]=(Z[1]+Z[3]+Z[5])/3+1):(W[2]=(Z[0]+Z[2]+Z[4])/3,W[3]=(Z[1]+Z[3]+Z[5])/3),r.redrawHint("select",!0),r.redraw();else if(q&&M.touches[1]&&!r.touchData.didSelect&&K.zoomingEnabled()&&K.panningEnabled()&&K.userZoomingEnabled()&&K.userPanningEnabled()){M.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var gt=r.dragData.touchDragEles;if(gt){r.redrawHint("drag",!0);for(var Tt=0;Tt<gt.length;Tt++){var $a=gt[Tt]._private;$a.grabbed=!1,$a.rscratch.inDragLayer=!1}}var Gt=r.touchData.start,it=M.touches[0].clientX-z,We=M.touches[0].clientY-V,ft=M.touches[1].clientX-z,Je=M.touches[1].clientY-V,Do=be(it,We,ft,Je),Zc=Do/$;if(ne){var Qc=it-G,Jc=We-U,jc=ft-H,ev=Je-X,tv=(Qc+jc)/2,rv=(Jc+ev)/2,ua=K.zoom(),ei=ua*Zc,Xa=K.pan(),So=J[0]*ua+Xa.x,Ao=J[1]*ua+Xa.y,av={x:-ei/ua*(So-Xa.x-tv)+So,y:-ei/ua*(Ao-Xa.y-rv)+Ao};if(Gt&&Gt.active()){var gt=r.dragData.touchDragEles;y(gt),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Gt.unactivate().emit("freeon"),gt.emit("free"),r.dragData.didDrag&&(Gt.emit("dragfreeon"),gt.emit("dragfree"))}K.viewport({zoom:ei,pan:av,cancelOnFailedZoom:!0}),K.emit("pinchzoom"),$=Do,G=it,U=We,H=ft,X=Je,r.pinching=!0}if(M.touches[0]){var fe=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Z[0]=fe[0],Z[1]=fe[1]}if(M.touches[1]){var fe=r.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Z[2]=fe[0],Z[3]=fe[1]}if(M.touches[2]){var fe=r.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Z[4]=fe[0],Z[5]=fe[1]}}else if(M.touches[0]&&!r.touchData.didSelect){var Ot=r.touchData.start,ti=r.touchData.last,xt;if(!r.hoverData.draggingEles&&!r.swipePanning&&(xt=r.findNearestElement(Z[0],Z[1],!0,!0)),q&&Ot!=null&&M.preventDefault(),q&&Ot!=null&&r.nodeIsDraggable(Ot))if(De){var gt=r.dragData.touchDragEles,Lo=!r.dragData.didDrag;Lo&&p(gt,{inDragLayer:!0}),r.dragData.didDrag=!0;var la={x:0,y:0};if(ae(pe[0])&&ae(pe[1])&&(la.x+=pe[0],la.y+=pe[1],Lo)){r.redrawHint("eles",!0);var Pt=r.touchData.dragDelta;Pt&&ae(Pt[0])&&ae(Pt[1])&&(la.x+=Pt[0],la.y+=Pt[1])}r.hoverData.draggingEles=!0,gt.silentShift(la).emit("position drag"),r.redrawHint("drag",!0),r.touchData.startPosition[0]==ue[0]&&r.touchData.startPosition[1]==ue[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Pt=r.touchData.dragDelta=r.touchData.dragDelta||[];Pt.length===0?(Pt.push(pe[0]),Pt.push(pe[1])):(Pt[0]+=pe[0],Pt[1]+=pe[1])}if(n(Ot||xt,["touchmove","tapdrag","vmousemove"],M,{x:Z[0],y:Z[1]}),(!Ot||!Ot.grabbed())&&xt!=ti&&(ti&&ti.emit({originalEvent:M,type:"tapdragout",position:{x:Z[0],y:Z[1]}}),xt&&xt.emit({originalEvent:M,type:"tapdragover",position:{x:Z[0],y:Z[1]}})),r.touchData.last=xt,q)for(var Tt=0;Tt<Z.length;Tt++)Z[Tt]&&r.touchData.startPosition[Tt]&&De&&(r.touchData.singleTouchMoved=!0);if(q&&(Ot==null||Ot.pannable())&&K.panningEnabled()&&K.userPanningEnabled()){var nv=s(Ot,r.touchData.starts);nv&&(M.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Yr(r.touchData.startPosition)),r.swipePanning?(K.panBy({x:pe[0]*te,y:pe[1]*te}),K.emit("dragpan")):De&&(r.swipePanning=!0,K.panBy({x:me*te,y:ke*te}),K.emit("dragpan"),Ot&&(Ot.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var fe=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Z[0]=fe[0],Z[1]=fe[1]}}for(var Te=0;Te<Z.length;Te++)ue[Te]=Z[Te];q&&M.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var oe;r.registerBinding(e,"touchcancel",oe=function(M){var q=r.touchData.start;r.touchData.capture=!1,q&&q.unactivate()});var ve,ge,he,ye;if(r.registerBinding(e,"touchend",ve=function(M){var q=r.touchData.start,W=r.touchData.capture;if(W)M.touches.length===0&&(r.touchData.capture=!1),M.preventDefault();else return;var K=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var Z=r.cy,ue=Z.zoom(),te=r.touchData.now,fe=r.touchData.earlier;if(M.touches[0]){var xe=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);te[0]=xe[0],te[1]=xe[1]}if(M.touches[1]){var xe=r.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);te[2]=xe[0],te[3]=xe[1]}if(M.touches[2]){var xe=r.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);te[4]=xe[0],te[5]=xe[1]}q&&q.unactivate();var De;if(r.touchData.cxt){if(De={originalEvent:M,type:"cxttapend",position:{x:te[0],y:te[1]}},q?q.emit(De):Z.emit(De),!r.touchData.cxtDragged){var pe={originalEvent:M,type:"cxttap",position:{x:te[0],y:te[1]}};q?q.emit(pe):Z.emit(pe)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!M.touches[2]&&Z.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var Te=Z.collection(r.getAllInBox(K[0],K[1],K[2],K[3]));K[0]=void 0,K[1]=void 0,K[2]=void 0,K[3]=void 0,K[4]=0,r.redrawHint("select",!0),Z.emit({type:"boxend",originalEvent:M,position:{x:te[0],y:te[1]}});var me=function(Xt){return Xt.selectable()&&!Xt.selected()};Te.emit("box").stdFilter(me).select().emit("boxselect"),Te.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(q!=null&&q.unactivate(),M.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!M.touches[1]){if(!M.touches[0]){if(!M.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Ee=r.dragData.touchDragEles;if(q!=null){var ke=q._private.grabbed;y(Ee),r.redrawHint("drag",!0),r.redrawHint("eles",!0),ke&&(q.emit("freeon"),Ee.emit("free"),r.dragData.didDrag&&(q.emit("dragfreeon"),Ee.emit("dragfree"))),n(q,["touchend","tapend","vmouseup","tapdragout"],M,{x:te[0],y:te[1]}),q.unactivate(),r.touchData.start=null}else{var Ze=r.findNearestElement(te[0],te[1],!0,!0);n(Ze,["touchend","tapend","vmouseup","tapdragout"],M,{x:te[0],y:te[1]})}var lt=r.touchData.startPosition[0]-te[0],it=lt*lt,We=r.touchData.startPosition[1]-te[1],ft=We*We,Je=it+ft,Et=Je*ue*ue;r.touchData.singleTouchMoved||(q||Z.$(":selected").unselect(["tapunselect"]),n(q,["tap","vclick"],M,{x:te[0],y:te[1]}),ge=!1,M.timeStamp-ye<=Z.multiClickDebounceTime()?(he&&clearTimeout(he),ge=!0,ye=null,n(q,["dbltap","vdblclick"],M,{x:te[0],y:te[1]})):(he=setTimeout(function(){ge||n(q,["onetap","voneclick"],M,{x:te[0],y:te[1]})},Z.multiClickDebounceTime()),ye=M.timeStamp)),q!=null&&!r.dragData.didDrag&&q._private.selectable&&Et<r.touchTapThreshold2&&!r.pinching&&(Z.selectionType()==="single"?(Z.$(t).unmerge(q).unselect(["tapunselect"]),q.select(["tapselect"])):q.selected()?q.unselect(["tapunselect"]):q.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var _t=0;_t<te.length;_t++)fe[_t]=te[_t];r.dragData.didDrag=!1,M.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),M.touches.length<2&&(M.touches.length===1&&(r.touchData.startGPosition=[M.touches[0].clientX,M.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var we=[],Se=function(M){return{clientX:M.clientX,clientY:M.clientY,force:1,identifier:M.pointerId,pageX:M.pageX,pageY:M.pageY,radiusX:M.width/2,radiusY:M.height/2,screenX:M.screenX,screenY:M.screenY,target:M.target}},Fe=function(M){return{event:M,touch:Se(M)}},$e=function(M){we.push(Fe(M))},Ie=function(M){for(var q=0;q<we.length;q++){var W=we[q];if(W.event.pointerId===M.pointerId){we.splice(q,1);return}}},Ke=function(M){var q=we.filter(function(W){return W.event.pointerId===M.pointerId})[0];q.event=M,q.touch=Se(M)},Ae=function(M){M.touches=we.map(function(q){return q.touch})},le=function(M){return M.pointerType==="mouse"||M.pointerType===4};r.registerBinding(r.container,"pointerdown",function(j){le(j)||(j.preventDefault(),$e(j),Ae(j),Ne(j))}),r.registerBinding(r.container,"pointerup",function(j){le(j)||(Ie(j),Ae(j),ve(j))}),r.registerBinding(r.container,"pointercancel",function(j){le(j)||(Ie(j),Ae(j),oe(j))}),r.registerBinding(r.container,"pointermove",function(j){le(j)||(j.preventDefault(),Ke(j),Ae(j),se(j))})}};var jt={};jt.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(a,n,i,s,o,u){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,u,l,f){return Aa(o,u,this.points,a,n,i/2,s/2,l)},checkPoint:function(a,n,i,s,o,u,l,f){return Jt(a,n,this.points,u,l,s,o,[0,-1],i)}}};jt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,s,o,u){return Uh(i,s,e,t,a/2+o,n/2+o)},checkPoint:function(e,t,a,n,i,s,o,u){return Ar(e,t,n,i,s,o,a)}}};jt.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(a,n,i,s,o,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n;var f=i/2,c=s/2;o=o==="auto"?Af(i,s):o;for(var v=new Array(e.length/2),h=0;h<e.length/2;h++)v[h]={x:a+f*e[h*2],y:n+c*e[h*2+1]};var d,p,g,y,b=v.length;for(p=v[b-1],d=0;d<b;d++)g=v[d%b],y=v[(d+1)%b],u[l][d]=wo(p,g,y,o),p=g,g=y;return u[l]},draw:function(a,n,i,s,o,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,s,o,this.points,this.getOrCreateCorners(n,i,s,o,u,l,"drawCorners"))},intersectLine:function(a,n,i,s,o,u,l,f,c){return qh(o,u,this.points,a,n,i,s,l,this.getOrCreateCorners(a,n,i,s,f,c,"corners"))},checkPoint:function(a,n,i,s,o,u,l,f,c){return Vh(a,n,this.points,u,l,s,o,this.getOrCreateCorners(u,l,s,o,f,c,"corners"))}}};jt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:bt(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,s)},intersectLine:function(e,t,a,n,i,s,o,u){return Df(i,s,e,t,a,n,o,u)},checkPoint:function(e,t,a,n,i,s,o,u){var l=n/2,f=i/2;u=u==="auto"?lr(n,i):u,u=Math.min(l,f,u);var c=u*2;return!!(Jt(e,t,this.points,s,o,n,i-c,[0,-1],a)||Jt(e,t,this.points,s,o,n-c,i,[0,-1],a)||Ar(e,t,c,c,s-l+u,o-f+u,a)||Ar(e,t,c,c,s+l-u,o-f+u,a)||Ar(e,t,c,c,s+l-u,o+f-u,a)||Ar(e,t,c,c,s-l+u,o+f-u,a))}}};jt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:uo(),points:bt(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,null,s)},generateCutTrianglePts:function(e,t,a,n,i){var s=i==="auto"?this.cornerLength:i,o=t/2,u=e/2,l=a-u,f=a+u,c=n-o,v=n+o;return{topLeft:[l,c+s,l+s,c,l+s,c+s],topRight:[f-s,c,f,c+s,f-s,c+s],bottomRight:[f,v-s,f-s,v,f-s,v-s],bottomLeft:[l+s,v,l,v-s,l+s,v-s]}},intersectLine:function(e,t,a,n,i,s,o,u){var l=this.generateCutTrianglePts(a+2*o,n+2*o,e,t,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Aa(i,s,f,e,t)},checkPoint:function(e,t,a,n,i,s,o,u){var l=u==="auto"?this.cornerLength:u;if(Jt(e,t,this.points,s,o,n,i-2*l,[0,-1],a)||Jt(e,t,this.points,s,o,n-2*l,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,s,o);return Dt(e,t,f.topLeft)||Dt(e,t,f.topRight)||Dt(e,t,f.bottomRight)||Dt(e,t,f.bottomLeft)}}};jt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:bt(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,s,o,u){var l=.15,f=.5,c=.85,v=this.generateBarrelBezierPts(a+2*o,n+2*o,e,t),h=function(g){var y=Wr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),b=Wr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f),m=Wr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},c);return[g[0],g[1],y.x,y.y,b.x,b.y,m.x,m.y,g[4],g[5]]},d=[].concat(h(v.topLeft),h(v.topRight),h(v.bottomRight),h(v.bottomLeft));return Aa(i,s,d,e,t)},generateBarrelBezierPts:function(e,t,a,n){var i=t/2,s=e/2,o=a-s,u=a+s,l=n-i,f=n+i,c=Ps(e,t),v=c.heightOffset,h=c.widthOffset,d=c.ctrlPtOffsetPct*e,p={topLeft:[o,l+v,o+d,l,o+h,l],topRight:[u-h,l,u-d,l,u,l+v],bottomRight:[u,f-v,u-d,f,u-h,f],bottomLeft:[o+h,f,o+d,f,o,f-v]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,a,n,i,s,o,u){var l=Ps(n,i),f=l.heightOffset,c=l.widthOffset;if(Jt(e,t,this.points,s,o,n,i-2*f,[0,-1],a)||Jt(e,t,this.points,s,o,n-2*c,i,[0,-1],a))return!0;for(var v=this.generateBarrelBezierPts(n,i,s,o),h=function(T,C,D){var A=D[4],L=D[2],R=D[0],I=D[5],O=D[1],N=Math.min(A,R),k=Math.max(A,R),P=Math.min(I,O),B=Math.max(I,O);if(N<=T&&T<=k&&P<=C&&C<=B){var _=Hh(A,L,R),F=Fh(_[0],_[1],_[2],T),G=F.filter(function(U){return 0<=U&&U<=1});if(G.length>0)return G[0]}return null},d=Object.keys(v),p=0;p<d.length;p++){var g=d[p],y=v[g],b=h(e,t,y);if(b!=null){var m=y[5],E=y[3],x=y[1],S=st(m,E,x,b);if(y.isTop&&S<=t||y.isBottom&&t<=S)return!0}}return!1}}};jt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:bt(4,0),draw:function(e,t,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,s)},intersectLine:function(e,t,a,n,i,s,o,u){var l=e-(a/2+o),f=t-(n/2+o),c=f,v=e+(a/2+o),h=nr(i,s,e,t,l,f,v,c,!1);return h.length>0?h:Df(i,s,e,t,a,n,o,u)},checkPoint:function(e,t,a,n,i,s,o,u){u=u==="auto"?lr(n,i):u;var l=2*u;if(Jt(e,t,this.points,s,o,n,i-l,[0,-1],a)||Jt(e,t,this.points,s,o,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,c=i/2+2*a,v=[s-f,o-c,s-f,o,s+f,o,s+f,o-c];return!!(Dt(e,t,v)||Ar(e,t,l,l,s+n/2-u,o+i/2-u,a)||Ar(e,t,l,l,s-n/2+u,o+i/2-u,a))}}};jt.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",bt(3,0)),this.generateRoundPolygon("round-triangle",bt(3,0)),this.generatePolygon("rectangle",bt(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",bt(5,0)),this.generateRoundPolygon("round-pentagon",bt(5,0)),this.generatePolygon("hexagon",bt(6,0)),this.generateRoundPolygon("round-hexagon",bt(6,0)),this.generatePolygon("heptagon",bt(7,0)),this.generateRoundPolygon("round-heptagon",bt(7,0)),this.generatePolygon("octagon",bt(8,0)),this.generateRoundPolygon("round-octagon",bt(8,0));var a=new Array(20);{var n=Os(5,0),i=Os(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)a[o*4]=n[o*2],a[o*4+1]=n[o*2+1],a[o*4+2]=i[o*2],a[o*4+3]=i[o*2+1]}a=Sf(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}r.makePolygon=function(l){var f=l.join("$"),c="polygon-"+f,v;return(v=this[c])?v:e.generatePolygon(c,l)}};var qa={};qa.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};qa.redraw=function(r){r=r||xf();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r};qa.beforeRender=function(r,e){if(!this.destroyed){e==null&&He("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(a,n){return n.priority-a.priority})}};var _l=function(e,t,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,a)};qa.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(n){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){_l(r,!0,n);var i=Qt();r.render(r.renderOptions);var s=r.lastDrawTime=Qt();r.averageRedrawTime===void 0&&(r.averageRedrawTime=s-i),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var o=s-i;r.redrawTotalTime+=o,r.lastRedrawTime=o,r.averageRedrawTime=r.averageRedrawTime/2+o/2,r.requestedFrame=!1}else _l(r,!1,n);r.skipFrame=!1,Cn(t)}};Cn(t)}};var oy=function(e){this.init(e)},Sc=oy,oa=Sc.prototype;oa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];oa.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",u=n.getElementById(s)!=null;if(t.className.indexOf(o)<0&&(t.className=(t.className||"")+" "+o),!u){var l=n.createElement("style");l.id=s,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=a.getComputedStyle(t),c=f.getPropertyValue("position");c==="static"&&Pe("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.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]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=ae(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};oa.notify=function(r,e){var t=this,a=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&a.hasCompoundNodes()||r==="load"||r==="zorder"||r==="mount")&&t.invalidateCachedZSortedEles(),r==="viewport"&&t.redrawHint("select",!0),r==="gc"&&t.redrawHint("gc",!0),(r==="load"||r==="resize"||r==="mount")&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};oa.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],a=t,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}};oa.isHeadless=function(){return!1};[bo,Cc,Dc,sa,jt,qa].forEach(function(r){de(oa,r)});var xs=1e3/60,Ac={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=_a(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),s=function(l,f){var c=Qt(),v=n.averageRedrawTime,h=n.lastRedrawTime,d=[],p=n.cy.extent(),g=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var y=Qt(),b=y-c,m=y-f;if(h<xs){var E=xs-(l?v:0);if(m>=e.deqFastCost*E)break}else if(l){if(b>=e.deqCost*h||b>=e.deqAvgCost*v)break}else if(m>=e.deqNoDrawCost*xs)break;var x=e.deq(a,g,p);if(x.length>0)for(var S=0;S<x.length;S++)d.push(x[S]);else break}d.length>0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,g,p)&&i())},o=e.priority||ao;n.beforeRender(s,o(a))}}}},uy=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dn;dr(this,r),this.idsByKey=new Zt,this.keyForId=new Zt,this.cachesByLvl=new Zt,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return gr(r,[{key:"getIdsFor",value:function(t){t==null&&He("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new ra,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Zt,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])}(),Gl=25,sn=50,yn=-4,$s=3,Lc=7.99,ly=8,fy=1024,cy=1024,vy=1024,hy=.2,dy=.8,gy=10,py=.15,yy=.1,my=.9,by=.9,wy=100,Ey=1,Xr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},xy=ht({getKey:null,doesEleInvalidateKey:Dn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:bf,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ba=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=xy(t);de(a,n),a.lookup=new uy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},nt=ba.prototype;nt.reasons=Xr;nt.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};nt.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};nt.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Ga(function(t,a){return a.reqs-t.reqs});return e};nt.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};nt.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(io(o*t))),a<yn)a=yn;else if(o>=Lc||a>$s)return null;var l=Math.pow(2,a),f=e.h*l,c=e.w*l,v=s.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,v))return null;var h=u.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(f<=Gl?d=Gl:f<=sn?d=sn:d=Math.ceil(f/sn)*sn,f>vy||c>cy)return null;var p=i.getTextureQueue(d),g=p[p.length-2],y=function(){return i.recycleTexture(d,c)||i.addTexture(d,c)};g||(g=p[p.length-1]),g||(g=y()),g.width-g.usedWidth<c&&(g=y());for(var b=function(N){return N&&N.scaledLabelShown===v},m=n&&n===Xr.dequeue,E=n&&n===Xr.highQuality,x=n&&n===Xr.downscale,S,w=a+1;w<=$s;w++){var T=u.get(r,w);if(T){S=T;break}}var C=S&&S.level===a+1?S:null,D=function(){g.context.drawImage(C.texture.canvas,C.x,0,C.width,C.height,g.usedWidth,0,c,f)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,c,d),b(C))D();else if(b(S))if(E){for(var A=S.level;A>a;A--)C=i.getElement(r,e,t,A,Xr.downscale);D()}else return i.queueElement(r,S.level-1),S;else{var L;if(!m&&!E&&!x)for(var R=a-1;R>=yn;R--){var I=u.get(r,R);if(I){L=I;break}}if(b(L))return i.queueElement(r,a),L;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,r,e,v,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:a,scale:l,width:c,height:f,scaledLabelShown:v},g.usedWidth+=Math.ceil(c+ly),g.eleCaches.push(h),u.set(r,a,h),i.checkTextureFullness(g),h};nt.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};nt.invalidateElement=function(r){var e=this,t=e.lookup,a=[],n=t.isInvalid(r);if(n){for(var i=yn;i<=$s;i++){var s=t.getForCachedKey(r,i);s&&a.push(s)}var o=t.invalidate(r);if(o)for(var u=0;u<a.length;u++){var l=a[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(r)}};nt.checkTextureUtility=function(r){r.invalidatedWidth>=hy*r.width&&this.retireTexture(r)};nt.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>dy&&r.fullnessChecks>=gy?ur(t,r):r.fullnessChecks++};nt.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;ur(a,r),r.retired=!0;for(var i=r.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}no(i);var u=e.getRetiredTextureQueue(t);u.push(r)};nt.addTexture=function(r,e){var t=this,a=t.getTextureQueue(r),n={};return a.push(n),n.eleCaches=[],n.height=r,n.width=Math.max(fy,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=t.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};nt.recycleTexture=function(r,e){for(var t=this,a=t.getTextureQueue(r),n=t.getRetiredTextureQueue(r),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,no(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),ur(n,s),a.push(s),s}};nt.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,a.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(o),n[i]=o}};nt.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<Ey&&t.size()>0;s++){var o=t.pop(),u=o.key,l=o.eles[0],f=i.hasCache(l,o.level);if(a[u]=null,f)continue;n.push(o);var c=e.getBoundingBox(l);e.getElement(l,c,r,o.level,Xr.dequeue)}return n};nt.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=ro,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};nt.onDequeue=function(r){this.onDequeues.push(r)};nt.offDequeue=function(r){ur(this.onDequeues,r)};nt.setupDequeueing=Ac.setupDequeueing({deqRedrawThreshold:wy,deqCost:py,deqAvgCost:yy,deqNoDrawCost:my,deqFastCost:by,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(t)}},shouldRedraw:function(e,t,a,n){for(var i=0;i<t.length;i++)for(var s=t[i].eles,o=0;o<s.length;o++){var u=s[o].boundingBox();if(oo(u,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Ty=1,Ea=-4,Pn=2,Cy=3.99,Dy=50,Sy=50,Ay=.15,Ly=.1,Ry=.9,Iy=.9,My=1,zl=250,Oy=4e3*4e3,Vl=32767,Py=!0,Rc=function(e){var t=this,a=t.renderer=e,n=a.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Qt()-2*zl,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=_a(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Sy),a.beforeRender(function(s,o){o-t.lastInvalidationTime<=zl?t.skipping=!0:t.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(o,u){return u.reqs-o.reqs};t.layersQueue=new Ga(i),t.setupDequeueing()},dt=Rc.prototype,Ul=0,Ny=Math.pow(2,53)-1;dt.makeLayer=function(r,e){var t=Math.pow(2,e),a=Math.ceil(r.w*t),n=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(a,n),s={id:Ul=++Ul%Ny,bb:r,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,u=-s.bb.x1,l=-s.bb.y1;return o.scale(t,t),o.translate(u,l),s};dt.getLayers=function(r,e,t){var a=this,n=a.renderer,i=n.cy,s=i.zoom(),o=a.firstGet;if(a.firstGet=!1,t==null){if(t=Math.ceil(io(s*e)),t<Ea)t=Ea;else if(s>=Cy||t>Pn)return null}a.validateLayersElesOrdering(t,r);var u=a.layersByLevel,l=Math.pow(2,t),f=u[t]=u[t]||[],c,v=a.levelIsComplete(t,r),h,d=function(){var D=function(O){if(a.validateLayersElesOrdering(O,r),a.levelIsComplete(O,r))return h=u[O],!0},A=function(O){if(!h)for(var N=t+O;Ea<=N&&N<=Pn&&!D(N);N+=O);};A(1),A(-1);for(var L=f.length-1;L>=0;L--){var R=f[L];R.invalid&&ur(f,R)}};if(!v)d();else return f;var p=function(){if(!c){c=At();for(var D=0;D<r.length;D++)Cf(c,r[D].boundingBox())}return c},g=function(D){D=D||{};var A=D.after;p();var L=Math.ceil(c.w*l),R=Math.ceil(c.h*l);if(L>Vl||R>Vl)return null;var I=L*R;if(I>Oy)return null;var O=a.makeLayer(c,t);if(A!=null){var N=f.indexOf(A)+1;f.splice(N,0,O)}else(D.insert===void 0||D.insert)&&f.unshift(O);return O};if(a.skipping&&!o)return null;for(var y=null,b=r.length/Ty,m=!o,E=0;E<r.length;E++){var x=r[E],S=x._private.rscratch,w=S.imgLayerCaches=S.imgLayerCaches||{},T=w[t];if(T){y=T;continue}if((!y||y.eles.length>=b||!Nh(y.bb,x.boundingBox()))&&(y=g({insert:!0,after:y}),!y))return null;h||m?a.queueLayer(y,x):a.drawEleInLayer(y,x,t,e),y.eles.push(x),w[t]=y}return h||(m?null:f)};dt.getEleLevelForLayerLevel=function(r,e){return r};dt.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,s=r.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,Py),i.setImgSmoothing(s,!0))};dt.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length};dt.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a<t.length;a++){for(var n=t[a],i=-1,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(n);continue}for(var o=i,s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}};dt.updateElementsInLayers=function(r,e){for(var t=this,a=Na(r[0]),n=0;n<r.length;n++)for(var i=a?null:r[n],s=a?r[n]:r[n].ele,o=s._private.rscratch,u=o.imgLayerCaches=o.imgLayerCaches||{},l=Ea;l<=Pn;l++){var f=u[l];f&&(i&&t.getEleLevelForLayerLevel(f.level)!==i.level||e(f,s,i))}};dt.haveLayers=function(){for(var r=this,e=!1,t=Ea;t<=Pn;t++){var a=r.layersByLevel[t];if(a&&a.length>0){e=!0;break}}return e};dt.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Qt(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};dt.invalidateLayer=function(r){if(this.lastInvalidationTime=Qt(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];ur(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n<t.length;n++){var i=t[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};dt.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(a,n,i){var s=a.replacement;if(s||(s=a.replacement=e.makeLayer(a.bb,a.level),s.replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})};dt.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};dt.queueLayer=function(r,e){var t=this,a=t.layersQueue,n=r.elesQueue,i=n.hasId=n.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,a.updateItem(r)):(r.reqs=1,a.push(r))}};dt.dequeue=function(r){for(var e=this,t=e.layersQueue,a=[],n=0;n<My&&t.size()!==0;){var i=t.peek();if(i.replacement){t.pop();continue}if(i.replaces&&i!==i.replaces.replacement){t.pop();continue}if(i.invalid){t.pop();continue}var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,r),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};dt.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],a=r.replaces,n=t.indexOf(a);if(!(n<0||a.invalid)){t[n]=r;for(var i=0;i<r.eles.length;i++){var s=r.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[r.level]=r)}e.requestRedraw()}};dt.requestRedraw=_a(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);dt.setupDequeueing=Ac.setupDequeueing({deqRedrawThreshold:Dy,deqCost:Ay,deqAvgCost:Ly,deqNoDrawCost:Ry,deqFastCost:Iy,deq:function(e,t){return e.dequeue(t)},onDeqd:ao,shouldRedraw:bf,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Ic={},ql;function ky(r,e){for(var t=0;t<e.length;t++){var a=e[t];r.lineTo(a.x,a.y)}}function By(r,e,t){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,a.x,a.y)}function Hl(r,e,t){r.beginPath&&r.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];r.lineTo(i.x,i.y)}var s=t,o=t[0];r.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var i=s[n];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function Fy(r,e,t,a,n){r.beginPath&&r.beginPath(),r.arc(t,a,n,0,Math.PI*2,!1);var i=e,s=i[0];r.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var u=i[o];r.lineTo(u.x,u.y)}r.closePath&&r.closePath()}function _y(r,e,t,a){r.arc(e,t,a,0,Math.PI*2,!1)}Ic.arrowShapeImpl=function(r){return(ql||(ql={polygon:ky,"triangle-backcurve":By,"triangle-tee":Hl,"circle-triangle":Fy,"triangle-cross":Hl,circle:_y}))[r]};var $t={};$t.drawElement=function(r,e,t,a,n,i){var s=this;e.isNode()?s.drawNode(r,e,t,a,n,i):s.drawEdge(r,e,t,a,n,i)};$t.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};$t.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};$t.drawCachedElementPortion=function(r,e,t,a,n,i,s,o){var u=this,l=t.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=t.getElement(e,l,a,n,i);if(f!=null){var c=o(u,e);if(c===0)return;var v=s(u,e),h=l.x1,d=l.y1,p=l.w,g=l.h,y,b,m,E,x;if(v!==0){var S=t.getRotationPoint(e);m=S.x,E=S.y,r.translate(m,E),r.rotate(v),x=u.getImgSmoothing(r),x||u.setImgSmoothing(r,!0);var w=t.getRotationOffset(e);y=w.x,b=w.y}else y=h,b=d;var T;c!==1&&(T=r.globalAlpha,r.globalAlpha=T*c),r.drawImage(f.texture.canvas,f.x,0,f.width,f.height,y,b,p,g),c!==1&&(r.globalAlpha=T),v!==0&&(r.rotate(-v),r.translate(-m,-E),x||u.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var Gy=function(){return 0},zy=function(e,t){return e.getTextAngle(t,null)},Vy=function(e,t){return e.getTextAngle(t,"source")},Uy=function(e,t){return e.getTextAngle(t,"target")},qy=function(e,t){return t.effectiveOpacity()},Ts=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};$t.drawCachedElement=function(r,e,t,a,n,i){var s=this,o=s.data,u=o.eleTxrCache,l=o.lblTxrCache,f=o.slbTxrCache,c=o.tlbTxrCache,v=e.boundingBox(),h=i===!0?u.reasons.highQuality:null;if(!(v.w===0||v.h===0||!e.visible())&&(!a||oo(v,a))){var d=e.isEdge(),p=e.element()._private.rscratch.badLine;s.drawElementUnderlay(r,e),s.drawCachedElementPortion(r,e,u,t,n,h,Gy,qy),(!d||!p)&&s.drawCachedElementPortion(r,e,l,t,n,h,zy,Ts),d&&!p&&(s.drawCachedElementPortion(r,e,f,t,n,h,Vy,Ts),s.drawCachedElementPortion(r,e,c,t,n,h,Uy,Ts)),s.drawElementOverlay(r,e)}};$t.drawElements=function(r,e){for(var t=this,a=0;a<e.length;a++){var n=e[a];t.drawElement(r,n)}};$t.drawCachedElements=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];n.drawCachedElement(r,s,t,a)}};$t.drawCachedNodes=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&n.drawCachedElement(r,s,t,a)}};$t.drawLayeredElements=function(r,e,t,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,t);if(i)for(var s=0;s<i.length;s++){var o=i[s],u=o.bb;u.w===0||u.h===0||r.drawImage(o.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(r,e,t,a)};var er={};er.drawEdge=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,v=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,p=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,y=l*f,b=l*f,m=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;c==="straight-triangle"?(s.eleStrokeStyle(r,e,O),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=h,r.lineCap=d,s.eleStrokeStyle(r,e,O),s.drawEdgePath(e,r,o.allpts,v),r.lineCap="butt")},E=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(r.lineWidth=h+p,r.lineCap=d,p>0)s.colorStrokeStyle(r,g[0],g[1],g[2],O);else{r.lineCap="butt";return}c==="straight-triangle"?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,v),r.lineCap="butt")},x=function(){n&&s.drawEdgeOverlay(r,e)},S=function(){n&&s.drawEdgeUnderlay(r,e)},w=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(r,e,O)},T=function(){s.drawElementText(r,e,null,a)};r.lineJoin="round";var C=e.pstyle("ghost").value==="yes";if(C){var D=e.pstyle("ghost-offset-x").pfValue,A=e.pstyle("ghost-offset-y").pfValue,L=e.pstyle("ghost-opacity").value,R=y*L;r.translate(D,A),m(R),w(R),r.translate(-D,-A)}else E();S(),m(),w(),x(),T(),t&&r.translate(u.x1,u.y1)}};var Mc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;t.lineWidth=l,o.edgeType==="self"&&!s?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,f[0],f[1],f[2],n),i.drawEdgePath(a,t,o.allpts,"solid")}}}};er.drawEdgeOverlay=Mc("overlay");er.drawEdgeUnderlay=Mc("underlay");er.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,s,o=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,f=r.pstyle("line-dash-offset").pfValue;if(u){var c=t.join("$"),v=n.pathCacheKey&&n.pathCacheKey===c;v?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=c,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<t.length;h+=4)e.quadraticCurveTo(t[h],t[h+1],t[h+2],t[h+3]);break;case"straight":case"haystack":for(var d=2;d+1<t.length;d+=2)e.lineTo(t[d],t[d+1]);break;case"segments":if(n.isRound){var p=St(n.roundCorners),g;try{for(p.s();!(g=p.n()).done;){var y=g.value;bc(e,y)}}catch(m){p.e(m)}finally{p.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var b=2;b+1<t.length;b+=2)e.lineTo(t[b],t[b+1]);break}e=i,u?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};er.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var a=r.pstyle("width").pfValue,n=0;n+1<t.length;n+=2){var i=[t[n+2]-t[n],t[n+3]-t[n+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],u=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(t[n]-u[0],t[n+1]-u[1]),e.lineTo(t[n]+u[0],t[n+1]+u[1]),e.lineTo(t[n+2],t[n+3]),e.closePath(),e.fill()}};er.drawArrowheads=function(r,e,t){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(r,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,t),n||this.drawArrowhead(r,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,t)};er.drawArrowhead=function(r,e,t,a,n,i,s){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var o=this,u=e.pstyle(t+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(t+"-arrow-fill").value,c=e.pstyle("width").pfValue,v=e.pstyle(t+"-arrow-width"),h=v.value==="match-line"?c:v.pfValue;v.units==="%"&&(h*=c);var d=e.pstyle("opacity").value;s===void 0&&(s=d);var p=r.globalCompositeOperation;(s!==1||f==="hollow")&&(r.globalCompositeOperation="destination-out",o.colorFillStyle(r,255,255,255,1),o.colorStrokeStyle(r,255,255,255,1),o.drawArrowShape(e,r,l,c,u,h,a,n,i),r.globalCompositeOperation=p);var g=e.pstyle(t+"-arrow-color").value;o.colorFillStyle(r,g[0],g[1],g[2],s),o.colorStrokeStyle(r,g[0],g[1],g[2],s),o.drawArrowShape(e,r,f,c,u,h,a,n,i)}}};er.drawArrowShape=function(r,e,t,a,n,i,s,o,u){var l=this,f=this.usePaths()&&n!=="triangle-cross",c=!1,v,h=e,d={x:s,y:o},p=r.pstyle("arrow-scale").value,g=this.getArrowWidth(a,p),y=l.arrowShapes[n];if(f){var b=l.arrowPathCache=l.arrowPathCache||[],m=Lr(n),E=b[m];E!=null?(v=e=E,c=!0):(v=e=new Path2D,b[m]=v)}c||(e.beginPath&&e.beginPath(),f?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,g,u,d,a),e.closePath&&e.closePath()),e=h,f&&(e.translate(s,o),e.rotate(u),e.scale(g,g)),(t==="filled"||t==="both")&&(f?e.fill(v):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(f?g:1),e.lineJoin="miter",f?e.stroke(v):e.stroke()),f&&(e.scale(1/g,1/g),e.rotate(-u),e.translate(-s,-o))};var xo={};xo.safeDrawImage=function(r,e,t,a,n,i,s,o,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{r.drawImage(e,t,a,n,i,s,o,u,l)}catch(f){Pe(f)}};xo.drawInscribedImage=function(r,e,t,a,n){var i=this,s=t.position(),o=s.x,u=s.y,l=t.cy().style(),f=l.getIndexedStyle.bind(l),c=f(t,"background-fit","value",a),v=f(t,"background-repeat","value",a),h=t.width(),d=t.height(),p=t.padding()*2,g=h+(f(t,"background-width-relative-to","value",a)==="inner"?0:p),y=d+(f(t,"background-height-relative-to","value",a)==="inner"?0:p),b=t._private.rscratch,m=f(t,"background-clip","value",a),E=m==="node",x=f(t,"background-image-opacity","value",a)*n,S=f(t,"background-image-smoothing","value",a),w=t.pstyle("corner-radius").value;w!=="auto"&&(w=t.pstyle("corner-radius").pfValue);var T=e.width||e.cachedW,C=e.height||e.cachedH;(T==null||C==null)&&(document.body.appendChild(e),T=e.cachedW=e.width||e.offsetWidth,C=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var D=T,A=C;if(f(t,"background-width","value",a)!=="auto"&&(f(t,"background-width","units",a)==="%"?D=f(t,"background-width","pfValue",a)*g:D=f(t,"background-width","pfValue",a)),f(t,"background-height","value",a)!=="auto"&&(f(t,"background-height","units",a)==="%"?A=f(t,"background-height","pfValue",a)*y:A=f(t,"background-height","pfValue",a)),!(D===0||A===0)){if(c==="contain"){var L=Math.min(g/D,y/A);D*=L,A*=L}else if(c==="cover"){var L=Math.max(g/D,y/A);D*=L,A*=L}var R=o-g/2,I=f(t,"background-position-x","units",a),O=f(t,"background-position-x","pfValue",a);I==="%"?R+=(g-D)*O:R+=O;var N=f(t,"background-offset-x","units",a),k=f(t,"background-offset-x","pfValue",a);N==="%"?R+=(g-D)*k:R+=k;var P=u-y/2,B=f(t,"background-position-y","units",a),_=f(t,"background-position-y","pfValue",a);B==="%"?P+=(y-A)*_:P+=_;var F=f(t,"background-offset-y","units",a),G=f(t,"background-offset-y","pfValue",a);F==="%"?P+=(y-A)*G:P+=G,b.pathCache&&(R-=o,P-=u,o=0,u=0);var U=r.globalAlpha;r.globalAlpha=x;var H=i.getImgSmoothing(r),X=!1;if(S==="no"&&H?(i.setImgSmoothing(r,!1),X=!0):S==="yes"&&!H&&(i.setImgSmoothing(r,!0),X=!0),v==="no-repeat")E&&(r.save(),b.pathCache?r.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,o,u,g,y,w,b),r.clip())),i.safeDrawImage(r,e,0,0,T,C,R,P,D,A),E&&r.restore();else{var $=r.createPattern(e,v);r.fillStyle=$,i.nodeShapes[i.getNodeShape(t)].draw(r,o,u,g,y,w,b),r.translate(R,P),r.fill(),r.translate(-R,-P)}r.globalAlpha=U,X&&i.setImgSmoothing(r,H)}};var Nr={};Nr.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(io(t*a));e=Math.pow(2,n)}var i=r.pstyle("font-size").pfValue*e,s=r.pstyle("min-zoomed-font-size").pfValue;return!(i<s)};Nr.drawElementText=function(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),v=e.pstyle("target-label");if(l||(!f||!f.value)&&(!c||!c.value)&&(!v||!v.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(s.drawText(r,e,null,h,i),e.isEdge()&&(s.drawText(r,e,"source",h,i),s.drawText(r,e,"target",h,i))):s.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)};Nr.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if(e=this.fontCaches[t],e.context===r)return e;return e={context:r},this.fontCaches.push(e),e};Nr.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*o,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],o),this.colorStrokeStyle(r,f[0],f[1],f[2],u)};function Cs(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),s?r.stroke():r.fill()}Nr.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation");if(s.strValue==="autorotate"){var o=Ct(n,"labelAngle",e);t=r.isEdge()?o:0}else s.strValue==="none"?t=0:t=s.pfValue;return t};Nr.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=Ct(s,"labelX",t),l=Ct(s,"labelY",t),f,c,v=this.getLabelText(e,t);if(v!=null&&v!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,n);var h=t?t+"-":"",d=Ct(s,"labelWidth",t),p=Ct(s,"labelHeight",t),g=e.pstyle(h+"text-margin-x").pfValue,y=e.pstyle(h+"text-margin-y").pfValue,b=e.isEdge(),m=e.pstyle("text-halign").value,E=e.pstyle("text-valign").value;b&&(m="center",E="center"),u+=g,l+=y;var x;switch(a?x=this.getTextAngle(e,t):x=0,x!==0&&(f=u,c=l,r.translate(f,c),r.rotate(x),u=0,l=0),E){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p;break}var S=e.pstyle("text-background-opacity").value,w=e.pstyle("text-border-opacity").value,T=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,A=D.indexOf("round")===0,L=2;if(S>0||T>0&&w>0){var R=u-C;switch(m){case"left":R-=d;break;case"center":R-=d/2;break}var I=l-p-C,O=d+2*C,N=p+2*C;if(S>0){var k=r.fillStyle,P=e.pstyle("text-background-color").value;r.fillStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+S*o+")",A?Cs(r,R,I,O,N,L):r.fillRect(R,I,O,N),r.fillStyle=k}if(T>0&&w>0){var B=r.strokeStyle,_=r.lineWidth,F=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+w*o+")",r.lineWidth=T,r.setLineDash)switch(G){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=T/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(A?Cs(r,R,I,O,N,L,"stroke"):r.strokeRect(R,I,O,N),G==="double"){var U=T/2;A?Cs(r,R+U,I+U,O-U*2,N-U*2,L,"stroke"):r.strokeRect(R+U,I+U,O-U*2,N-U*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=_,r.strokeStyle=B}}var H=2*e.pstyle("text-outline-width").pfValue;if(H>0&&(r.lineWidth=H),e.pstyle("text-wrap").value==="wrap"){var X=Ct(s,"labelWrapCachedLines",t),$=Ct(s,"labelLineHeight",t),Q=d/2,re=this.getLabelJustification(e);switch(re==="auto"||(m==="left"?re==="left"?u+=-d:re==="center"&&(u+=-Q):m==="center"?re==="left"?u+=-Q:re==="right"&&(u+=Q):m==="right"&&(re==="center"?u+=Q:re==="right"&&(u+=d))),E){case"top":l-=(X.length-1)*$;break;case"center":case"bottom":l-=(X.length-1)*$;break}for(var J=0;J<X.length;J++)H>0&&r.strokeText(X[J],u,l),r.fillText(X[J],u,l),l+=$}else H>0&&r.strokeText(v,u,l),r.fillText(v,u,l);x!==0&&(r.rotate(-x),r.translate(-f,-c))}}};var yr={};yr.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,u,l=e._private,f=l.rscratch,c=e.position();if(!(!ae(c.x)||!ae(c.y))&&!(i&&!e.visible())){var v=i?e.effectiveOpacity():1,h=s.usePaths(),d,p=!1,g=e.padding();o=e.width()+2*g,u=e.height()+2*g;var y;t&&(y=t,r.translate(-y.x1,-y.y1));for(var b=e.pstyle("background-image"),m=b.value,E=new Array(m.length),x=new Array(m.length),S=0,w=0;w<m.length;w++){var T=m[w],C=E[w]=T!=null&&T!=="none";if(C){var D=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",w);S++,x[w]=s.getCachedImage(T,D,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var A=e.pstyle("background-blacken").value,L=e.pstyle("border-width").pfValue,R=e.pstyle("background-opacity").value*v,I=e.pstyle("border-color").value,O=e.pstyle("border-style").value,N=e.pstyle("border-join").value,k=e.pstyle("border-cap").value,P=e.pstyle("border-position").value,B=e.pstyle("border-dash-pattern").pfValue,_=e.pstyle("border-dash-offset").pfValue,F=e.pstyle("border-opacity").value*v,G=e.pstyle("outline-width").pfValue,U=e.pstyle("outline-color").value,H=e.pstyle("outline-style").value,X=e.pstyle("outline-opacity").value*v,$=e.pstyle("outline-offset").value,Q=e.pstyle("corner-radius").value;Q!=="auto"&&(Q=e.pstyle("corner-radius").pfValue);var re=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R;s.eleFillStyle(r,e,le)},J=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;s.colorStrokeStyle(r,I[0],I[1],I[2],le)},z=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;s.colorStrokeStyle(r,U[0],U[1],U[2],le)},V=function(le,j,M,q){var W=s.nodePathCache=s.nodePathCache||[],K=mf(M==="polygon"?M+","+q.join(","):M,""+j,""+le,""+Q),Z=W[K],ue,te=!1;return Z!=null?(ue=Z,te=!0,f.pathCache=ue):(ue=new Path2D,W[K]=f.pathCache=ue),{path:ue,cacheHit:te}},Y=e.pstyle("shape").strValue,ee=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(c.x,c.y);var ne=V(o,u,Y,ee);d=ne.path,p=ne.cacheHit}var be=function(){if(!p){var le=c;h&&(le={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||r,le.x,le.y,o,u,Q,f)}h?r.fill(d):r.fill()},Ve=function(){for(var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,M=l.backgrounding,q=0,W=0;W<x.length;W++){var K=e.cy().style().getIndexedStyle(e,"background-image-containment","value",W);if(j&&K==="over"||!j&&K==="inside"){q++;continue}E[W]&&x[W].complete&&!x[W].error&&(q++,s.drawInscribedImage(r,x[W],e,W,le))}l.backgrounding=q!==S,M!==l.backgrounding&&e.updateStyle(!1)},Ne=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;s.hasPie(e)&&(s.drawPie(r,e,j),le&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,u,Q,f)))},se=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;s.hasStripe(e)&&(r.save(),h?r.clip(f.pathCache):(s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,u,Q,f),r.clip()),s.drawStripe(r,e,j),r.restore(),le&&(h||s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,u,Q,f)))},oe=function(){var le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,j=(A>0?A:-A)*le,M=A>0?0:255;A!==0&&(s.colorFillStyle(r,M,M,M,j),h?r.fill(d):r.fill())},ve=function(){if(L>0){if(r.lineWidth=L,r.lineCap=k,r.lineJoin=N,r.setLineDash)switch(O){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(B),r.lineDashOffset=_;break;case"solid":case"double":r.setLineDash([]);break}if(P!=="center"){if(r.save(),r.lineWidth*=2,P==="inside")h?r.clip(d):r.clip();else{var le=new Path2D;le.rect(-o/2-L,-u/2-L,o+2*L,u+2*L),le.addPath(d),r.clip(le,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if(O==="double"){r.lineWidth=L/3;var j=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=j}r.setLineDash&&r.setLineDash([])}},ge=function(){if(G>0){if(r.lineWidth=G,r.lineCap="butt",r.setLineDash)switch(H){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var le=c;h&&(le={x:0,y:0});var j=s.getNodeShape(e),M=L;P==="inside"&&(M=0),P==="outside"&&(M*=2);var q=(o+M+(G+$))/o,W=(u+M+(G+$))/u,K=o*q,Z=u*W,ue=s.nodeShapes[j].points,te;if(h){var fe=V(K,Z,j,ue);te=fe.path}if(j==="ellipse")s.drawEllipsePath(te||r,le.x,le.y,K,Z);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(j)){var xe=0,De=0,pe=0;j==="round-diamond"?xe=(M+$+G)*1.4:j==="round-heptagon"?(xe=(M+$+G)*1.075,pe=-(M/2+$+G)/35):j==="round-hexagon"?xe=(M+$+G)*1.12:j==="round-pentagon"?(xe=(M+$+G)*1.13,pe=-(M/2+$+G)/15):j==="round-tag"?(xe=(M+$+G)*1.12,De=(M/2+G+$)*.07):j==="round-triangle"&&(xe=(M+$+G)*(Math.PI/2),pe=-(M+$/2+G)/Math.PI),xe!==0&&(q=(o+xe)/o,K=o*q,["round-hexagon","round-tag"].includes(j)||(W=(u+xe)/u,Z=u*W)),Q=Q==="auto"?Af(K,Z):Q;for(var Te=K/2,me=Z/2,Ee=Q+(M+G+$)/2,ke=new Array(ue.length/2),Ze=new Array(ue.length/2),lt=0;lt<ue.length/2;lt++)ke[lt]={x:le.x+De+Te*ue[lt*2],y:le.y+pe+me*ue[lt*2+1]};var it,We,ft,Je,Et=ke.length;for(We=ke[Et-1],it=0;it<Et;it++)ft=ke[it%Et],Je=ke[(it+1)%Et],Ze[it]=wo(We,ft,Je,Ee),We=ft,ft=Je;s.drawRoundPolygonPath(te||r,le.x+De,le.y+pe,o*q,u*W,ue,Ze)}else if(["roundrectangle","round-rectangle"].includes(j))Q=Q==="auto"?lr(K,Z):Q,s.drawRoundRectanglePath(te||r,le.x,le.y,K,Z,Q+(M+G+$)/2);else if(["cutrectangle","cut-rectangle"].includes(j))Q=Q==="auto"?uo():Q,s.drawCutRectanglePath(te||r,le.x,le.y,K,Z,null,Q+(M+G+$)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(j))Q=Q==="auto"?lr(K,Z):Q,s.drawBottomRoundRectanglePath(te||r,le.x,le.y,K,Z,Q+(M+G+$)/2);else if(j==="barrel")s.drawBarrelPath(te||r,le.x,le.y,K,Z);else if(j.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(j)){var _t=(M+G+$)/o;ue=Sn(An(ue,_t)),s.drawPolygonPath(te||r,le.x,le.y,o,u,ue)}else{var tr=(M+G+$)/o;ue=Sn(An(ue,-tr)),s.drawPolygonPath(te||r,le.x,le.y,o,u,ue)}if(h?r.stroke(te):r.stroke(),H==="double"){r.lineWidth=M/3;var Xt=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(te):r.stroke(),r.globalCompositeOperation=Xt}r.setLineDash&&r.setLineDash([])}},he=function(){n&&s.drawNodeOverlay(r,e,c,o,u)},ye=function(){n&&s.drawNodeUnderlay(r,e,c,o,u)},we=function(){s.drawElementText(r,e,null,a)},Se=e.pstyle("ghost").value==="yes";if(Se){var Fe=e.pstyle("ghost-offset-x").pfValue,$e=e.pstyle("ghost-offset-y").pfValue,Ie=e.pstyle("ghost-opacity").value,Ke=Ie*v;r.translate(Fe,$e),z(),ge(),re(Ie*R),be(),Ve(Ke,!0),J(Ie*F),ve(),Ne(A!==0||L!==0),se(A!==0||L!==0),Ve(Ke,!1),oe(Ke),r.translate(-Fe,-$e)}h&&r.translate(-c.x,-c.y),ye(),h&&r.translate(c.x,c.y),z(),ge(),re(),be(),Ve(v,!0),J(),ve(),Ne(A!==0||L!==0),se(A!==0||L!==0),Ve(v,!1),oe(),h&&r.translate(-c.x,-c.y),we(),he(),t&&r.translate(y.x1,y.y1)}};var Oc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a,n,i,s){var o=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,c=a.pstyle("".concat(e,"-shape")).value,v=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||s==null){var h=a.padding();i=a.width()+2*h,s=a.height()+2*h}o.colorFillStyle(t,f[0],f[1],f[2],l),o.nodeShapes[c].draw(t,n.x,n.y,i+u*2,s+u*2,v),t.fill()}}}};yr.drawNodeOverlay=Oc("overlay");yr.drawNodeUnderlay=Oc("underlay");yr.hasPie=function(r){return r=r[0],r._private.hasPie};yr.hasStripe=function(r){return r=r[0],r._private.hasStripe};yr.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=e.pstyle("pie-hole"),o=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),c=e.height(),v=Math.min(f,c)/2,h,d=0,p=this.usePaths();if(p&&(u=0,l=0),i.units==="%"?v=v*i.pfValue:i.pfValue!==void 0&&(v=i.pfValue/2),s.units==="%"?h=v*s.pfValue:s.pfValue!==void 0&&(h=s.pfValue/2),!(h>=v))for(var g=1;g<=n.pieBackgroundN;g++){var y=e.pstyle("pie-"+g+"-background-size").value,b=e.pstyle("pie-"+g+"-background-color").value,m=e.pstyle("pie-"+g+"-background-opacity").value*t,E=y/100;E+d>1&&(E=1-d);var x=1.5*Math.PI+2*Math.PI*d;x+=o;var S=2*Math.PI*E,w=x+S;y===0||d>=1||d+E>1||(h===0?(r.beginPath(),r.moveTo(u,l),r.arc(u,l,v,x,w),r.closePath()):(r.beginPath(),r.arc(u,l,v,x,w),r.arc(u,l,h,w,x,!0),r.closePath()),this.colorFillStyle(r,b[0],b[1],b[2],m),r.fill(),d+=E)}};yr.drawStripe=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,s=a.y,o=e.width(),u=e.height(),l=0,f=this.usePaths();r.save();var c=e.pstyle("stripe-direction").value,v=e.pstyle("stripe-size");switch(c){case"vertical":break;case"righward":r.rotate(-Math.PI/2);break}var h=o,d=u;v.units==="%"?(h=h*v.pfValue,d=d*v.pfValue):v.pfValue!==void 0&&(h=v.pfValue,d=v.pfValue),f&&(i=0,s=0),s-=h/2,i-=d/2;for(var p=1;p<=n.stripeBackgroundN;p++){var g=e.pstyle("stripe-"+p+"-background-size").value,y=e.pstyle("stripe-"+p+"-background-color").value,b=e.pstyle("stripe-"+p+"-background-opacity").value*t,m=g/100;m+l>1&&(m=1-l),!(g===0||l>=1||l+m>1)&&(r.beginPath(),r.rect(i,s+d*l,h,d*m),r.closePath(),this.colorFillStyle(r,y[0],y[1],y[2],b),r.fill(),l+=m)}r.restore()};var wt={},Hy=100;wt.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};wt.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===r){t=!1;break}return t&&(a={context:r},e.push(a)),a};wt.createGradientStyleFor=function(r,e,t,a,n){var i,s=this.usePaths(),o=t.pstyle(e+"-gradient-stop-colors").value,u=t.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(t.isEdge()){var l=t.sourceEndpoint(),f=t.targetEndpoint(),c=t.midpoint(),v=Rr(l,c),h=Rr(f,c);i=r.createRadialGradient(c.x,c.y,0,c.x,c.y,Math.max(v,h))}else{var d=s?{x:0,y:0}:t.position(),p=t.paddedWidth(),g=t.paddedHeight();i=r.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(p,g))}else if(t.isEdge()){var y=t.sourceEndpoint(),b=t.targetEndpoint();i=r.createLinearGradient(y.x,y.y,b.x,b.y)}else{var m=s?{x:0,y:0}:t.position(),E=t.paddedWidth(),x=t.paddedHeight(),S=E/2,w=x/2,T=t.pstyle("background-gradient-direction").value;switch(T){case"to-bottom":i=r.createLinearGradient(m.x,m.y-w,m.x,m.y+w);break;case"to-top":i=r.createLinearGradient(m.x,m.y+w,m.x,m.y-w);break;case"to-left":i=r.createLinearGradient(m.x+S,m.y,m.x-S,m.y);break;case"to-right":i=r.createLinearGradient(m.x-S,m.y,m.x+S,m.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(m.x-S,m.y-w,m.x+S,m.y+w);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(m.x-S,m.y+w,m.x+S,m.y-w);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(m.x+S,m.y-w,m.x-S,m.y+w);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(m.x+S,m.y+w,m.x-S,m.y-w);break}}if(!i)return null;for(var C=u.length===o.length,D=o.length,A=0;A<D;A++)i.addColorStop(C?u[A]:A/(D-1),"rgba("+o[A][0]+","+o[A][1]+","+o[A][2]+","+n+")");return i};wt.gradientFillStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"background",e,t,a);if(!n)return null;r.fillStyle=n};wt.colorFillStyle=function(r,e,t,a,n){r.fillStyle="rgba("+e+","+t+","+a+","+n+")"};wt.eleFillStyle=function(r,e,t){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(r,e,a,t);else{var n=e.pstyle("background-color").value;this.colorFillStyle(r,n[0],n[1],n[2],t)}};wt.gradientStrokeStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"line",e,t,a);if(!n)return null;r.strokeStyle=n};wt.colorStrokeStyle=function(r,e,t,a,n){r.strokeStyle="rgba("+e+","+t+","+a+","+n+")"};wt.eleStrokeStyle=function(r,e,t){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(r,e,a,t);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(r,n[0],n[1],n[2],t)}};wt.matchCanvasSize=function(r){var e=this,t=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var u=n*s,l=i*s,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var c=t.canvasContainer;c.style.width=n+"px",c.style.height=i+"px";for(var v=0;v<e.CANVAS_LAYERS;v++)f=t.canvases[v],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";for(var v=0;v<e.BUFFER_COUNT;v++)f=t.bufferCanvases[v],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,s<=1&&(f=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=s}};wt.renderTo=function(r,e,t,a){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:a})};wt.clearCanvas=function(){var r=this,e=r.data;function t(a){a.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])};wt.render=function(r){var e=this;r=r||xf();var t=e.cy,a=r.forcedContext,n=r.drawAllLayers,i=r.drawOnlyNodeLayer,s=r.forcedZoom,o=r.forcedPan,u=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,c=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),v=r.motionBlur!==void 0?r.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,d=t.hasCompoundNodes(),p=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);v=v&&!a&&e.motionBlurEnabled&&!g;var y=v;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),v&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(y=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!c&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var b=t.style(),m=t.zoom(),E=s!==void 0?s:m,x=t.pan(),S={x:x.x,y:x.y},w={zoom:m,pan:{x:x.x,y:x.y}},T=e.prevViewport,C=T===void 0||w.zoom!==T.zoom||w.pan.x!==T.pan.x||w.pan.y!==T.pan.y;!C&&!(p&&!d)&&(e.motionBlurPxRatio=1),o&&(S=o),E*=u,S.x*=u,S.y*=u;var D=e.getCachedZSortedEles();function A(J,z,V,Y,ee){var ne=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",e.colorFillStyle(J,255,255,255,e.motionBlurTransparency),J.fillRect(z,V,Y,ee),J.globalCompositeOperation=ne}function L(J,z){var V,Y,ee,ne;!e.clearingMotionBlur&&(J===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||J===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(V={x:x.x*h,y:x.y*h},Y=m*h,ee=e.canvasWidth*h,ne=e.canvasHeight*h):(V=S,Y=E,ee=e.canvasWidth,ne=e.canvasHeight),J.setTransform(1,0,0,1,0,0),z==="motionBlur"?A(J,0,0,ee,ne):!a&&(z===void 0||z)&&J.clearRect(0,0,ee,ne),n||(J.translate(V.x,V.y),J.scale(Y,Y)),o&&J.translate(o.x,o.y),s&&J.scale(s,s)}if(c||(e.textureDrawLastFrame=!1),c){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var R=e.data.bufferContexts[e.TEXTURE_BUFFER];R.setTransform(1,0,0,1,0,0),R.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:R,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var w=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};w.mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var I=l.contexts[e.NODE],O=e.textureCache.texture,w=e.textureCache.viewport;I.setTransform(1,0,0,1,0,0),v?A(I,0,0,w.width,w.height):I.clearRect(0,0,w.width,w.height);var N=b.core("outside-texture-bg-color").value,k=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(I,N[0],N[1],N[2],k),I.fillRect(0,0,w.width,w.height);var m=t.zoom();L(I,!1),I.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/u,w.height/w.zoom/u),I.drawImage(O,w.mpan.x,w.mpan.y,w.width/w.zoom/u,w.height/w.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var P=t.extent(),B=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),_=e.hideEdgesOnViewport&&B,F=[];if(F[e.NODE]=!f[e.NODE]&&v&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,F[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),F[e.DRAG]=!f[e.DRAG]&&v&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,F[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||F[e.NODE]){var G=v&&!F[e.NODE]&&h!==1,I=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),U=v&&!G?"motionBlur":void 0;L(I,U),_?e.drawCachedNodes(I,D.nondrag,u,P):e.drawLayeredElements(I,D.nondrag,u,P),e.debug&&e.drawDebugPoints(I,D.nondrag),!n&&!v&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||F[e.DRAG])){var G=v&&!F[e.DRAG]&&h!==1,I=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);L(I,v&&!G?"motionBlur":void 0),_?e.drawCachedNodes(I,D.drag,u,P):e.drawCachedElements(I,D.drag,u,P),e.debug&&e.drawDebugPoints(I,D.drag),!n&&!v&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,L),v&&h!==1){var H=l.contexts[e.NODE],X=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],$=l.contexts[e.DRAG],Q=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],re=function(z,V,Y){z.setTransform(1,0,0,1,0,0),Y||!y?z.clearRect(0,0,e.canvasWidth,e.canvasHeight):A(z,0,0,e.canvasWidth,e.canvasHeight);var ee=h;z.drawImage(V,0,0,e.canvasWidth*ee,e.canvasHeight*ee,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||F[e.NODE])&&(re(H,X,F[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||F[e.DRAG])&&(re($,Q,F[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=w,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),v&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!c,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},Hy)),a||t.emit("render")};var da;wt.drawSelectionRectangle=function(r,e){var t=this,a=t.cy,n=t.data,i=a.style(),s=r.drawOnlyNodeLayer,o=r.drawAllLayers,u=n.canvasNeedsRedraw,l=r.forcedContext;if(t.showFps||!s&&u[t.SELECT_BOX]&&!o){var f=l||n.contexts[t.SELECT_BOX];if(e(f),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var c=t.cy.zoom(),v=i.core("selection-box-border-width").value/c;f.lineWidth=v,f.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+")",f.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),v>0&&(f.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+")",f.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(n.bgActivePosistion&&!t.hoverData.selecting){var c=t.cy.zoom(),h=n.bgActivePosistion;f.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+")",f.beginPath(),f.arc(h.x,h.y,i.core("active-bg-size").pfValue/c,0,2*Math.PI),f.fill()}var d=t.lastRedrawTime;if(t.showFps&&d){d=Math.round(d);var p=Math.round(1e3/d),g="1 frame = "+d+" ms = "+p+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!da){var y=f.measureText(g);da=y.actualBoundingBoxAscent}f.fillText(g,0,da);var b=60;f.strokeRect(0,da+10,250,20),f.fillRect(0,da+10,250*Math.min(p/b,1),20)}o||(u[t.SELECT_BOX]=!1)}};function Yl(r,e,t){var a=r.createShader(e);if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(a));return a}function Yy(r,e,t){var a=Yl(r,r.VERTEX_SHADER,e),n=Yl(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,a),r.attachShader(i,n),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function $y(r,e,t){t===void 0&&(t=e);var a=r.makeOffscreenCanvas(e,t),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function To(r){var e=r.pixelRatio,t=r.cy.zoom(),a=r.cy.pan();return{zoom:t*e,pan:{x:a.x*e,y:a.y*e}}}function Xy(r){var e=r.pixelRatio,t=r.cy.zoom();return t*e}function Wy(r,e,t,a,n){var i=a*t+e.x,s=n*t+e.y;return s=Math.round(r.canvasHeight-s),[i,s]}function Ky(r){return r.pstyle("background-fill").value!=="solid"||r.pstyle("background-image").strValue!=="none"?!1:r.pstyle("border-width").value===0||r.pstyle("border-opacity").value===0?!0:r.pstyle("border-style").value==="solid"}function Zy(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function Er(r,e,t){var a=r[0]/255,n=r[1]/255,i=r[2]/255,s=e,o=t||new Array(4);return o[0]=a*s,o[1]=n*s,o[2]=i*s,o[3]=s,o}function Vr(r,e){var t=e||new Array(4);return t[0]=(r>>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function Qy(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function Jy(r,e){var t=r.createTexture();return t.buffer=function(a){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,a),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function Pc(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function Nc(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function jy(r,e,t,a,n,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*a,n);case r.INT:return new Int32Array(t.buffer,i*a,n)}}function em(r,e,t,a){var n=Pc(r,e),i=et(n,2),s=i[0],o=i[1],u=Nc(r,o,a),l=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),o===r.FLOAT?r.vertexAttribPointer(t,s,o,!1,0,0):o===r.INT&&r.vertexAttribIPointer(t,s,o,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),l}function Vt(r,e,t,a){var n=Pc(r,t),i=et(n,3),s=i[0],o=i[1],u=i[2],l=Nc(r,o,e*s),f=s*u,c=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,c),r.bufferData(r.ARRAY_BUFFER,e*f,r.DYNAMIC_DRAW),r.enableVertexAttribArray(a),o===r.FLOAT?r.vertexAttribPointer(a,s,o,!1,f,0):o===r.INT&&r.vertexAttribIPointer(a,s,o,f,0),r.vertexAttribDivisor(a,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var v=new Array(e),h=0;h<e;h++)v[h]=jy(r,o,l,f,s,h);return c.dataArray=l,c.stride=f,c.size=s,c.getView=function(d){return v[d]},c.setPoint=function(d,p,g){var y=v[d];y[0]=p,y[1]=g},c.bufferSubData=function(d){r.bindBuffer(r.ARRAY_BUFFER,c),d?r.bufferSubData(r.ARRAY_BUFFER,0,l,0,d*s):r.bufferSubData(r.ARRAY_BUFFER,0,l)},c}function tm(r,e,t){for(var a=9,n=new Float32Array(e*a),i=new Array(e),s=0;s<e;s++){var o=s*a*4;i[s]=new Float32Array(n.buffer,o,a)}var u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,n.byteLength,r.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=t+l;r.enableVertexAttribArray(f),r.vertexAttribPointer(f,3,r.FLOAT,!1,3*12,l*12),r.vertexAttribDivisor(f,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),u.getMatrixView=function(c){return i[c]},u.setData=function(c,v){i[v].set(c,0)},u.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferSubData(r.ARRAY_BUFFER,0,n)},u}function rm(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a,n,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}var $l=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function Ds(){var r=new $l(9);return $l!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Xl(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function am(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],u=e[5],l=e[6],f=e[7],c=e[8],v=t[0],h=t[1],d=t[2],p=t[3],g=t[4],y=t[5],b=t[6],m=t[7],E=t[8];return r[0]=v*a+h*s+d*l,r[1]=v*n+h*o+d*f,r[2]=v*i+h*u+d*c,r[3]=p*a+g*s+y*l,r[4]=p*n+g*o+y*f,r[5]=p*i+g*u+y*c,r[6]=b*a+m*s+E*l,r[7]=b*n+m*o+E*f,r[8]=b*i+m*u+E*c,r}function mn(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],u=e[5],l=e[6],f=e[7],c=e[8],v=t[0],h=t[1];return r[0]=a,r[1]=n,r[2]=i,r[3]=s,r[4]=o,r[5]=u,r[6]=v*a+h*s+l,r[7]=v*n+h*o+f,r[8]=v*i+h*u+c,r}function Wl(r,e,t){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],u=e[5],l=e[6],f=e[7],c=e[8],v=Math.sin(t),h=Math.cos(t);return r[0]=h*a+v*s,r[1]=h*n+v*o,r[2]=h*i+v*u,r[3]=h*s-v*a,r[4]=h*o-v*n,r[5]=h*u-v*i,r[6]=l,r[7]=f,r[8]=c,r}function Xs(r,e,t){var a=t[0],n=t[1];return r[0]=a*e[0],r[1]=a*e[1],r[2]=a*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function nm(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}var im=function(){function r(e,t,a,n){dr(this,r),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=t,this.texRows=a,this.texHeight=Math.floor(t/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,t,t),this.scratch=n(e,t,this.texHeight,"scratch")}return gr(r,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var a=t.w,n=t.h,i=this.texHeight,s=this.texSize,o=i/n,u=a*o,l=n*o;return u>s&&(o=s/a,u=a*o,l=n*o),{scale:o,texW:u,texH:l}}},{key:"draw",value:function(t,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,c=l.texW,v=l.texH,h=function(m,E){if(n&&E){var x=E.context,S=m.x,w=m.row,T=S,C=u*w;x.save(),x.translate(T,C),x.scale(f,f),n(x,a),x.restore()}},d=[null,null],p=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:c,h:v},d[1]={x:i.freePointer.x+c,y:i.freePointer.row*u,w:0,h:v},i.freePointer.x+=c,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var m=i.scratch,E=i.canvas;m.clear(),h({x:0,row:0},m);var x=s-i.freePointer.x,S=c-x,w=u;{var T=i.freePointer.x,C=i.freePointer.row*u,D=x;E.context.drawImage(m,0,0,D,w,T,C,D,w),d[0]={x:T,y:C,w:D,h:v}}{var A=x,L=(i.freePointer.row+1)*u,R=S;E&&E.context.drawImage(m,A,0,R,w,0,L,R,w),d[1]={x:0,y:L,w:R,h:v}}i.freePointer.x=S,i.freePointer.row++},y=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+c<=s)p();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(y(),p()):this.enableWrapping?g():(y(),p())}return this.keyToLocation.set(t,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(t),s=i.texW;return this.freePointer.x+s>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=Jy(t,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),sm=function(){function r(e,t,a,n){dr(this,r),this.r=e,this.texSize=t,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return gr(r,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new im(t,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,s=Math.floor(a/n);this.scratch=i(t,a,s,"scratch")}return this.scratch}},{key:"draw",value:function(t,a,n){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,a,n),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,s=null,o=St(this.atlases),u;try{var l=function(){var c=u.value,v=c.getKeys(),h=om(a,v);if(h.size===0)return n.push(c),v.forEach(function(x){return i.set(x,c)}),1;s||(s=t._createAtlas(),n.push(s));var d=St(v),p;try{for(d.s();!(p=d.n()).done;){var g=p.value;if(!h.has(g)){var y=c.getOffsets(g),b=et(y,2),m=b[0],E=b[1];s.canFit({w:m.w+E.w,h:m.h})||(s.lock(),s=t._createAtlas(),n.push(s)),c.canvas&&(t._copyTextureToNewAtlas(g,c,s),i.set(g,s))}}}catch(x){d.e(x)}finally{d.f()}c.dispose()};for(o.s();!(u=o.n()).done;)l()}catch(f){o.e(f)}finally{o.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,a,n){var i=a.getOffsets(t),s=et(i,2),o=s[0],u=s[1];if(u.w===0)n.draw(t,o,function(v){v.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),l.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,o.w,0,u.w,u.h);var f=o.w+u.w,c=o.h;n.draw(t,{w:f,h:c},function(v){v.drawImage(l,0,0,f,c,0,0,f,c)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function om(r,e){return r.intersection?r.intersection(e):new Set(xn(r).filter(function(t){return e.has(t)}))}var um=function(){function r(e,t){dr(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return gr(r,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(t,a){var n=this.globalOptions,i=n.webglTexSize,s=n.createTextureCanvas,o=a.texRows,u=this._cacheScratchCanvas(s),l=new sm(this.r,i,o,u);this.collections.set(t,l)}},{key:"addRenderType",value:function(t,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),s=de({type:t,atlasCollection:i},a);this.renderTypes.set(t,s)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var a=-1,n=-1,i=null;return function(s,o,u,l){return l?((!i||o!=a||u!=n)&&(a=o,n=u,i=t(s,o,u)),i):t(s,o,u)}}},{key:"_key",value:function(t,a){return"".concat(t,"-").concat(a)}},{key:"invalidate",value:function(t){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,s=i===void 0?!1:i,o=n.filterEle,u=o===void 0?function(){return!0}:o,l=n.filterType,f=l===void 0?function(){return!0}:l,c=!1,v=!1,h=St(t),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(u(p)){var g=St(this.renderTypes.values()),y;try{var b=function(){var E=y.value,x=E.type;if(f(x)){var S=a.collections.get(E.collection),w=E.getKey(p),T=Array.isArray(w)?w:[w];if(s)T.forEach(function(L){return S.markKeyForGC(L)}),v=!0;else{var C=E.getID?E.getID(p):p.id(),D=a._key(x,C),A=a.typeAndIdToKey.get(D);A!==void 0&&!Zy(T,A)&&(c=!0,a.typeAndIdToKey.delete(D),A.forEach(function(L){return S.markKeyForGC(L)}))}}};for(g.s();!(y=g.n()).done;)b()}catch(m){g.e(m)}finally{g.f()}}}}catch(m){h.e(m)}finally{h.f()}return v&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var t=St(this.collections.values()),a;try{for(t.s();!(a=t.n()).done;){var n=a.value;n.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,a,n,i){var s=this.renderTypes.get(a),o=this.collections.get(s.collection),u=!1,l=o.draw(i,n,function(v){s.drawClipped?(v.save(),v.beginPath(),v.rect(0,0,n.w,n.h),v.clip(),s.drawElement(v,t,n,!0,!0),v.restore()):s.drawElement(v,t,n,!0,!0),u=!0});if(u){var f=s.getID?s.getID(t):t.id(),c=this._key(a,f);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(i):this.typeAndIdToKey.set(c,[i])}return l}},{key:"getAtlasInfo",value:function(t,a){var n=this,i=this.renderTypes.get(a),s=i.getKey(t),o=Array.isArray(s)?s:[s];return o.map(function(u){var l=i.getBoundingBox(t,u),f=n.getOrCreateAtlas(t,a,l,u),c=f.getOffsets(u),v=et(c,2),h=v[0],d=v[1];return{atlas:f,tex:h,tex1:h,tex2:d,bb:l}})}},{key:"getDebugInfo",value:function(){var t=[],a=St(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=et(n.value,2),s=i[0],o=i[1],u=o.getCounts(),l=u.keyCount,f=u.atlasCount;t.push({type:s,keyCount:l,atlasCount:f})}}catch(c){a.e(c)}finally{a.f()}return t}}])}(),lm=function(){function r(e){dr(this,r),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return gr(r,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(t){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(t):!0}},{key:"getAtlasIndexForBatch",value:function(t){var a=this.batchAtlases.indexOf(t);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(t),a=this.batchAtlases.length-1}return a}}])}(),fm=`
|
|
18
|
-
float circleSD(vec2 p, float r) {
|
|
19
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
20
|
-
}
|
|
21
|
-
`,cm=`
|
|
22
|
-
float rectangleSD(vec2 p, vec2 b) {
|
|
23
|
-
vec2 d = abs(p)-b;
|
|
24
|
-
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
25
|
-
}
|
|
26
|
-
`,vm=`
|
|
27
|
-
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
28
|
-
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
29
|
-
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
30
|
-
vec2 q = abs(p) - b + cr.x;
|
|
31
|
-
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
32
|
-
}
|
|
33
|
-
`,hm=`
|
|
34
|
-
float ellipseSD(vec2 p, vec2 ab) {
|
|
35
|
-
p = abs( p ); // symmetry
|
|
36
|
-
|
|
37
|
-
// find root with Newton solver
|
|
38
|
-
vec2 q = ab*(p-ab);
|
|
39
|
-
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
40
|
-
for( int i=0; i<5; i++ ) {
|
|
41
|
-
vec2 cs = vec2(cos(w),sin(w));
|
|
42
|
-
vec2 u = ab*vec2( cs.x,cs.y);
|
|
43
|
-
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
44
|
-
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// compute final point and distance
|
|
48
|
-
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
49
|
-
|
|
50
|
-
// return signed distance
|
|
51
|
-
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
52
|
-
}
|
|
53
|
-
`,xa={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Nn={IGNORE:1,USE_BB:2},Ss=0,Kl=1,Zl=2,As=3,Ur=4,on=5,ga=6,pa=7,dm=function(){function r(e,t,a){dr(this,r),this.r=e,this.gl=t,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=$y,this.atlasManager=new um(e,a),this.batchManager=new lm(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(xa.SCREEN),this.pickingProgram=this._createShaderProgram(xa.PICKING),this.vao=this._createVAO()}return gr(r,[{key:"addAtlasCollection",value:function(t,a){this.atlasManager.addAtlasCollection(t,a)}},{key:"addTextureAtlasRenderType",value:function(t,a){this.atlasManager.addRenderType(t,a)}},{key:"addSimpleShapeRenderType",value:function(t,a){this.simpleShapeOptions.set(t,a)}},{key:"invalidate",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:function(o){return o===n},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(t){var a=this.gl,n=`#version 300 es
|
|
54
|
-
precision highp float;
|
|
55
|
-
|
|
56
|
-
uniform mat3 uPanZoomMatrix;
|
|
57
|
-
uniform int uAtlasSize;
|
|
58
|
-
|
|
59
|
-
// instanced
|
|
60
|
-
in vec2 aPosition; // a vertex from the unit square
|
|
61
|
-
|
|
62
|
-
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
63
|
-
in int aVertType; // the type of thing we are rendering
|
|
64
|
-
|
|
65
|
-
// the z-index that is output when using picking mode
|
|
66
|
-
in vec4 aIndex;
|
|
67
|
-
|
|
68
|
-
// For textures
|
|
69
|
-
in int aAtlasId; // which shader unit/atlas to use
|
|
70
|
-
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
71
|
-
|
|
72
|
-
// for edges
|
|
73
|
-
in vec4 aPointAPointB;
|
|
74
|
-
in vec4 aPointCPointD;
|
|
75
|
-
in vec2 aLineWidth; // also used for node border width
|
|
76
|
-
|
|
77
|
-
// simple shapes
|
|
78
|
-
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
79
|
-
in vec4 aColor; // also used for edges
|
|
80
|
-
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
81
|
-
|
|
82
|
-
// output values passed to the fragment shader
|
|
83
|
-
out vec2 vTexCoord;
|
|
84
|
-
out vec4 vColor;
|
|
85
|
-
out vec2 vPosition;
|
|
86
|
-
// flat values are not interpolated
|
|
87
|
-
flat out int vAtlasId;
|
|
88
|
-
flat out int vVertType;
|
|
89
|
-
flat out vec2 vTopRight;
|
|
90
|
-
flat out vec2 vBotLeft;
|
|
91
|
-
flat out vec4 vCornerRadius;
|
|
92
|
-
flat out vec4 vBorderColor;
|
|
93
|
-
flat out vec2 vBorderWidth;
|
|
94
|
-
flat out vec4 vIndex;
|
|
95
|
-
|
|
96
|
-
void main(void) {
|
|
97
|
-
int vid = gl_VertexID;
|
|
98
|
-
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
99
|
-
|
|
100
|
-
if(aVertType == `.concat(Ss,`) {
|
|
101
|
-
float texX = aTex.x; // texture coordinates
|
|
102
|
-
float texY = aTex.y;
|
|
103
|
-
float texW = aTex.z;
|
|
104
|
-
float texH = aTex.w;
|
|
105
|
-
|
|
106
|
-
if(vid == 1 || vid == 2 || vid == 4) {
|
|
107
|
-
texX += texW;
|
|
108
|
-
}
|
|
109
|
-
if(vid == 2 || vid == 4 || vid == 5) {
|
|
110
|
-
texY += texH;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
float d = float(uAtlasSize);
|
|
114
|
-
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
115
|
-
|
|
116
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
117
|
-
}
|
|
118
|
-
else if(aVertType == `).concat(Ur," || aVertType == ").concat(pa,`
|
|
119
|
-
|| aVertType == `).concat(on," || aVertType == ").concat(ga,`) { // simple shapes
|
|
120
|
-
|
|
121
|
-
// the bounding box is needed by the fragment shader
|
|
122
|
-
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
123
|
-
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
124
|
-
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
125
|
-
|
|
126
|
-
// calculations are done in the fragment shader, just pass these along
|
|
127
|
-
vColor = aColor;
|
|
128
|
-
vCornerRadius = aCornerRadius;
|
|
129
|
-
vBorderColor = aBorderColor;
|
|
130
|
-
vBorderWidth = aLineWidth;
|
|
131
|
-
|
|
132
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
133
|
-
}
|
|
134
|
-
else if(aVertType == `).concat(Kl,`) {
|
|
135
|
-
vec2 source = aPointAPointB.xy;
|
|
136
|
-
vec2 target = aPointAPointB.zw;
|
|
137
|
-
|
|
138
|
-
// adjust the geometry so that the line is centered on the edge
|
|
139
|
-
position.y = position.y - 0.5;
|
|
140
|
-
|
|
141
|
-
// stretch the unit square into a long skinny rectangle
|
|
142
|
-
vec2 xBasis = target - source;
|
|
143
|
-
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
144
|
-
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
145
|
-
|
|
146
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
147
|
-
vColor = aColor;
|
|
148
|
-
}
|
|
149
|
-
else if(aVertType == `).concat(Zl,`) {
|
|
150
|
-
vec2 pointA = aPointAPointB.xy;
|
|
151
|
-
vec2 pointB = aPointAPointB.zw;
|
|
152
|
-
vec2 pointC = aPointCPointD.xy;
|
|
153
|
-
vec2 pointD = aPointCPointD.zw;
|
|
154
|
-
|
|
155
|
-
// adjust the geometry so that the line is centered on the edge
|
|
156
|
-
position.y = position.y - 0.5;
|
|
157
|
-
|
|
158
|
-
vec2 p0, p1, p2, pos;
|
|
159
|
-
if(position.x == 0.0) { // The left side of the unit square
|
|
160
|
-
p0 = pointA;
|
|
161
|
-
p1 = pointB;
|
|
162
|
-
p2 = pointC;
|
|
163
|
-
pos = position;
|
|
164
|
-
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
165
|
-
p0 = pointD;
|
|
166
|
-
p1 = pointC;
|
|
167
|
-
p2 = pointB;
|
|
168
|
-
pos = vec2(0.0, -position.y);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
vec2 p01 = p1 - p0;
|
|
172
|
-
vec2 p12 = p2 - p1;
|
|
173
|
-
vec2 p21 = p1 - p2;
|
|
174
|
-
|
|
175
|
-
// Find the normal vector.
|
|
176
|
-
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
177
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
178
|
-
|
|
179
|
-
// Find the vector perpendicular to p0 -> p1.
|
|
180
|
-
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
181
|
-
|
|
182
|
-
// Determine the bend direction.
|
|
183
|
-
float sigma = sign(dot(p01 + p21, normal));
|
|
184
|
-
float width = aLineWidth[0];
|
|
185
|
-
|
|
186
|
-
if(sign(pos.y) == -sigma) {
|
|
187
|
-
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
188
|
-
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
189
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
190
|
-
} else {
|
|
191
|
-
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
192
|
-
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
193
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
vColor = aColor;
|
|
197
|
-
}
|
|
198
|
-
else if(aVertType == `).concat(As,` && vid < 3) {
|
|
199
|
-
// massage the first triangle into an edge arrow
|
|
200
|
-
if(vid == 0)
|
|
201
|
-
position = vec2(-0.15, -0.3);
|
|
202
|
-
if(vid == 1)
|
|
203
|
-
position = vec2( 0.0, 0.0);
|
|
204
|
-
if(vid == 2)
|
|
205
|
-
position = vec2( 0.15, -0.3);
|
|
206
|
-
|
|
207
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
208
|
-
vColor = aColor;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
vAtlasId = aAtlasId;
|
|
215
|
-
vVertType = aVertType;
|
|
216
|
-
vIndex = aIndex;
|
|
217
|
-
}
|
|
218
|
-
`),i=this.batchManager.getIndexArray(),s=`#version 300 es
|
|
219
|
-
precision highp float;
|
|
220
|
-
|
|
221
|
-
// declare texture unit for each texture atlas in the batch
|
|
222
|
-
`.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
|
|
223
|
-
`),`
|
|
224
|
-
|
|
225
|
-
uniform vec4 uBGColor;
|
|
226
|
-
uniform float uZoom;
|
|
227
|
-
|
|
228
|
-
in vec2 vTexCoord;
|
|
229
|
-
in vec4 vColor;
|
|
230
|
-
in vec2 vPosition; // model coordinates
|
|
231
|
-
|
|
232
|
-
flat in int vAtlasId;
|
|
233
|
-
flat in vec4 vIndex;
|
|
234
|
-
flat in int vVertType;
|
|
235
|
-
flat in vec2 vTopRight;
|
|
236
|
-
flat in vec2 vBotLeft;
|
|
237
|
-
flat in vec4 vCornerRadius;
|
|
238
|
-
flat in vec4 vBorderColor;
|
|
239
|
-
flat in vec2 vBorderWidth;
|
|
240
|
-
|
|
241
|
-
out vec4 outColor;
|
|
242
|
-
|
|
243
|
-
`).concat(fm,`
|
|
244
|
-
`).concat(cm,`
|
|
245
|
-
`).concat(vm,`
|
|
246
|
-
`).concat(hm,`
|
|
247
|
-
|
|
248
|
-
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
249
|
-
return vec4(
|
|
250
|
-
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
251
|
-
top.a + (bot.a * (1.0 - top.a))
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
256
|
-
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
257
|
-
// note 1.5 is an aribitrary value chosen because it looks good
|
|
258
|
-
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
void main(void) {
|
|
262
|
-
if(vVertType == `).concat(Ss,`) {
|
|
263
|
-
// look up the texel from the texture unit
|
|
264
|
-
`).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
|
|
265
|
-
else `),`
|
|
266
|
-
}
|
|
267
|
-
else if(vVertType == `).concat(As,`) {
|
|
268
|
-
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
269
|
-
outColor = blend(vColor, uBGColor);
|
|
270
|
-
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
271
|
-
}
|
|
272
|
-
else if(vVertType == `).concat(Ur,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
273
|
-
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
274
|
-
}
|
|
275
|
-
else if(vVertType == `).concat(Ur," || vVertType == ").concat(pa,`
|
|
276
|
-
|| vVertType == `).concat(on," || vVertType == ").concat(ga,`) { // use SDF
|
|
277
|
-
|
|
278
|
-
float outerBorder = vBorderWidth[0];
|
|
279
|
-
float innerBorder = vBorderWidth[1];
|
|
280
|
-
float borderPadding = outerBorder * 2.0;
|
|
281
|
-
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
282
|
-
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
283
|
-
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
284
|
-
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
285
|
-
|
|
286
|
-
float d; // signed distance
|
|
287
|
-
if(vVertType == `).concat(Ur,`) {
|
|
288
|
-
d = rectangleSD(p, b);
|
|
289
|
-
} else if(vVertType == `).concat(pa,` && w == h) {
|
|
290
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
291
|
-
} else if(vVertType == `).concat(pa,`) {
|
|
292
|
-
d = ellipseSD(p, b);
|
|
293
|
-
} else {
|
|
294
|
-
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
298
|
-
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
299
|
-
if(d > 0.0) {
|
|
300
|
-
if(d > outerBorder) {
|
|
301
|
-
discard;
|
|
302
|
-
} else {
|
|
303
|
-
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
if(d > innerBorder) {
|
|
307
|
-
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
308
|
-
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
309
|
-
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
vec4 outerColor;
|
|
313
|
-
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
314
|
-
outerColor = vec4(0);
|
|
315
|
-
} else if(innerBorder == 0.0) {
|
|
316
|
-
outerColor = vBorderColor;
|
|
317
|
-
} else {
|
|
318
|
-
outerColor = blend(vBorderColor, vColor);
|
|
319
|
-
}
|
|
320
|
-
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
outColor = vColor;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
`).concat(t.picking?`if(outColor.a == 0.0) discard;
|
|
329
|
-
else outColor = vIndex;`:"",`
|
|
330
|
-
}
|
|
331
|
-
`),o=Yy(a,n,s);o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)o.uTextures.push(a.getUniformLocation(o,"uTexture".concat(u)));return o}},{key:"_createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var a=this.maxInstances,n=this.gl,i=this.program,s=n.createVertexArray();return n.bindVertexArray(s),em(n,"vec2",i.aPosition,t),this.transformBuffer=tm(n,a,i.aTransform),this.indexBuffer=Vt(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Vt(n,a,"int",i.aVertType),this.atlasIdBuffer=Vt(n,a,"int",i.aAtlasId),this.texBuffer=Vt(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Vt(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Vt(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Vt(n,a,"vec2",i.aLineWidth),this.colorBuffer=Vt(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Vt(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Vt(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),s}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return a.endsWith("Buffer")}).map(function(a){return t[a]})),this._buffers}},{key:"startFrame",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xa.SCREEN;this.panZoomMatrix=t,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(t,a){return t.visible()?a&&a.isVisible?a.isVisible(t):!0:!1}},{key:"drawTexture",value:function(t,a,n){var i=this.atlasManager,s=this.batchManager,o=i.getRenderTypeOpts(n);if(this._isVisible(t,o)){if(this.renderTarget.picking&&o.getTexPickingMode){var u=o.getTexPickingMode(t);if(u===Nn.IGNORE)return;if(u==Nn.USE_BB){this.drawPickingRectangle(t,a,n);return}}var l=i.getAtlasInfo(t,n),f=St(l),c;try{for(f.s();!(c=f.n()).done;){var v=c.value,h=v.atlas,d=v.tex1,p=v.tex2;s.canAddToCurrentBatch(h)||this.endBatch();for(var g=s.getAtlasIndexForBatch(h),y=0,b=[[d,!0],[p,!1]];y<b.length;y++){var m=et(b[y],2),E=m[0],x=m[1];if(E.w!=0){var S=this.instanceCount;this.vertTypeBuffer.getView(S)[0]=Ss;var w=this.indexBuffer.getView(S);Vr(a,w);var T=this.atlasIdBuffer.getView(S);T[0]=g;var C=this.texBuffer.getView(S);C[0]=E.x,C[1]=E.y,C[2]=E.w,C[3]=E.h;var D=this.transformBuffer.getMatrixView(S);this.setTransformMatrix(t,D,o,v,x),this.instanceCount++,x||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(A){f.e(A)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(t,a,n,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;if(n.shapeProps&&n.shapeProps.padding&&(o=t.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,c=l.w/(l.w+f.w);s||(c=1-c);var v=this._getAdjustedBB(u,o,s,c);this._applyTransformMatrix(a,v,n,t)}else{var h=n.getBoundingBox(t),d=this._getAdjustedBB(h,o,!0,1);this._applyTransformMatrix(a,d,n,t)}}},{key:"_applyTransformMatrix",value:function(t,a,n,i){var s,o;Xl(t);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,c=l.y;mn(t,t,[f,c]),Wl(t,t,u);var v=n.getRotationOffset(i);s=v.x+(a.xOffset||0),o=v.y+(a.yOffset||0)}else s=a.x1,o=a.y1;mn(t,t,[s,o]),Xs(t,t,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(t,a,n,i){var s=t.x1,o=t.y1,u=t.w,l=t.h,f=t.yOffset;a&&(s-=a,o-=a,u+=2*a,l+=2*a);var c=0,v=u*i;return n&&i<1?u=v:!n&&i<1&&(c=u-v,s+=c,u=v),{x1:s,y1:o,w:u,h:l,xOffset:c,yOffset:f}}},{key:"drawPickingRectangle",value:function(t,a,n){var i=this.atlasManager.getRenderTypeOpts(n),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=Ur;var o=this.indexBuffer.getView(s);Vr(a,o);var u=this.colorBuffer.getView(s);Er([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(t,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(t,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(t,i)){var s=i.shapeProps,o=this._getVertTypeForShape(t,s.shape);if(o===void 0||i.isSimple&&!i.isSimple(t)){this.drawTexture(t,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=o,o===on||o===ga){var l=i.getBoundingBox(t),f=this._getCornerRadius(t,s.radius,l),c=this.cornerRadiusBuffer.getView(u);c[0]=f,c[1]=f,c[2]=f,c[3]=f,o===ga&&(c[0]=0,c[2]=0)}var v=this.indexBuffer.getView(u);Vr(a,v);var h=t.pstyle(s.color).value,d=t.pstyle(s.opacity).value,p=this.colorBuffer.getView(u);Er(h,d,p);var g=this.lineWidthBuffer.getView(u);if(g[0]=0,g[1]=0,s.border){var y=t.pstyle("border-width").value;if(y>0){var b=t.pstyle("border-color").value,m=t.pstyle("border-opacity").value,E=this.borderColorBuffer.getView(u);Er(b,m,E);var x=t.pstyle("border-position").value;if(x==="inside")g[0]=0,g[1]=-y;else if(x==="outside")g[0]=y,g[1]=0;else{var S=y/2;g[0]=S,g[1]=-S}}}var w=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(t,w,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(t,a){var n=t.pstyle(a).value;switch(n){case"rectangle":return Ur;case"ellipse":return pa;case"roundrectangle":case"round-rectangle":return on;case"bottom-round-rectangle":return ga;default:return}}},{key:"_getCornerRadius",value:function(t,a,n){var i=n.w,s=n.h;if(t.pstyle(a).value==="auto")return lr(i,s);var o=t.pstyle(a).pfValue,u=i/2,l=s/2;return Math.min(o,l,u)}},{key:"drawEdgeArrow",value:function(t,a,n){if(t.visible()){var i=t._private.rscratch,s,o,u;if(n==="source"?(s=i.arrowStartX,o=i.arrowStartY,u=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(u)||u==null)){var l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=t.pstyle(n+"-arrow-color").value,c=t.pstyle("opacity").value,v=t.pstyle("line-opacity").value,h=c*v,d=t.pstyle("width").pfValue,p=t.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,p),y=this.instanceCount,b=this.transformBuffer.getMatrixView(y);Xl(b),mn(b,b,[s,o]),Xs(b,b,[g,g]),Wl(b,b,u),this.vertTypeBuffer.getView(y)[0]=As;var m=this.indexBuffer.getView(y);Vr(a,m);var E=this.colorBuffer.getView(y);Er(f,h,E),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,a){if(t.visible()){var n=this._getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,s=t.pstyle("line-opacity").value,o=t.pstyle("width").pfValue,u=t.pstyle("line-color").value,l=i*s;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=Kl;var c=this.indexBuffer.getView(f);Vr(a,c);var v=this.colorBuffer.getView(f);Er(u,l,v);var h=this.lineWidthBuffer.getView(f);h[0]=o;var d=this.pointAPointBBuffer.getView(f);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<n.length-2;p+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=Zl;var y=this.indexBuffer.getView(g);Vr(a,y);var b=this.colorBuffer.getView(g);Er(u,l,b);var m=this.lineWidthBuffer.getView(g);m[0]=o;var E=n[p-2],x=n[p-1],S=n[p],w=n[p+1],T=n[p+2],C=n[p+3],D=n[p+4],A=n[p+5];p==0&&(E=2*S-T+.001,x=2*w-C+.001),p==n.length-4&&(D=2*T-S+.001,A=2*C-w+.001);var L=this.pointAPointBBuffer.getView(g);L[0]=E,L[1]=x,L[2]=S,L[3]=w;var R=this.pointCPointDBuffer.getView(g);R[0]=T,R[1]=C,R[2]=D,R[3]=A,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_getEdgePoints",value:function(t){var a=t._private.rscratch;if(!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(t);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(t){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(t,a){if(t.length==4)return t;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=t[0],n[1]=t[1];else if(i==a)n[i*2]=t[t.length-2],n[i*2+1]=t[t.length-1];else{var s=i/a;this._setCurvePoint(t,s,n,i*2)}return n}},{key:"_setCurvePoint",value:function(t,a,n,i){if(t.length<=2)n[i]=t[0],n[i+1]=t[1];else{for(var s=Array(t.length-2),o=0;o<s.length;o+=2){var u=(1-a)*t[o]+a*t[o+2],l=(1-a)*t[o+1]+a*t[o+3];s[o]=u,s[o+1]=l}return this._setCurvePoint(s,a,n,i)}}},{key:"endBatch",value:function(){var t=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(s),t.bindVertexArray(a);var o=St(this.buffers),u;try{for(o.s();!(u=o.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(d){o.e(d)}finally{o.f()}for(var f=this.batchManager.getAtlases(),c=0;c<f.length;c++)f[c].bufferIfNeeded(t);for(var v=0;v<f.length;v++)t.activeTexture(t.TEXTURE0+v),t.bindTexture(t.TEXTURE_2D,f[v].texture),t.uniform1i(s.uTextures[v],v);t.uniform1f(s.uZoom,Xy(this.r)),t.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(s.uAtlasSize,this.batchManager.getAtlasSize());var h=Er(this.bgColor,1);t.uniform4fv(s.uBGColor,h),t.drawArraysInstanced(t.TRIANGLES,0,n,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),a=t.reduce(function(s,o){return s+o.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(s,o){return s+o.count},0);return{atlasInfo:t,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])}(),kc={};kc.initWebgl=function(r,e){var t=this,a=t.data.contexts[t.WEBGL];r.bgColor=gm(t),r.webglTexSize=Math.min(r.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=rm(a),t.pickingFrameBuffer.needsDraw=!0,t.drawing=new dm(t,a,r);var n=function(c){return function(v){return t.getTextAngle(v,c)}},i=function(c){return function(v){var h=v.pstyle(c);return h&&h.value}},s=function(c){return function(v){return v.pstyle("".concat(c,"-opacity")).value>0}},o=function(c){var v=c.pstyle("text-events").strValue==="yes";return v?Nn.USE_BB:Nn.IGNORE},u=function(c){var v=c.position(),h=v.x,d=v.y,p=c.outerWidth(),g=c.outerHeight();return{w:p,h:g,x1:h-p/2,y1:d-g/2}};t.drawing.addAtlasCollection("node",{texRows:r.webglTexRowsNodes}),t.drawing.addAtlasCollection("label",{texRows:r.webglTexRows}),t.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),t.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:Ky,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),t.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),t.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),t.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:o,getKey:Ls(e.getLabelKey,null),getBoundingBox:Rs(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),t.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:o,getKey:Ls(e.getSourceLabelKey,"source"),getBoundingBox:Rs(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),t.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:o,getKey:Ls(e.getTargetLabelKey,"target"),getBoundingBox:Rs(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=_a(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(f,c){var v=!1;c&&c.length>0&&(v|=t.drawing.invalidate(c)),v&&l()}),pm(t)};function gm(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return cf(t)}function Bc(r,e){var t=r._private.rscratch;return Ct(t,"labelWrapCachedLines",e)||[]}var Ls=function(e,t){return function(a){var n=e(a),i=Bc(a,t);return i.length>1?i.map(function(s,o){return"".concat(n,"_").concat(o)}):n}},Rs=function(e,t){return function(a,n){var i=e(a);if(typeof n=="string"){var s=n.indexOf("_");if(s>0){var o=Number(n.substring(s+1)),u=Bc(a,t),l=i.h/u.length,f=l*o,c=i.y1+f;return{x1:i.x1,w:i.w,y1:c,h:l,yOffset:f}}}return i}};function pm(r){{var e=r.render;r.render=function(i){i=i||{};var s=r.cy;r.webgl&&(s.zoom()>Lc?(ym(r),e.call(r,i)):(mm(r),_c(r,i,xa.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,s,o,u){return Cm(r,i,s)};{var a=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){a.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var n=r.notify;r.notify=function(i,s){n.call(r,i,s),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(s,{type:"node-body"})}}}function ym(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function mm(r){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.canvasWidth,r.canvasHeight),a.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function bm(r){var e=r.canvasWidth,t=r.canvasHeight,a=To(r),n=a.pan,i=a.zoom,s=Ds();mn(s,s,[n.x,n.y]),Xs(s,s,[i,i]);var o=Ds();nm(o,e,t);var u=Ds();return am(u,o,s),u}function Fc(r,e){var t=r.canvasWidth,a=r.canvasHeight,n=To(r),i=n.pan,s=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,a),e.translate(i.x,i.y),e.scale(s,s)}function wm(r,e){r.drawSelectionRectangle(e,function(t){return Fc(r,t)})}function Em(r){var e=r.data.contexts[r.NODE];e.save(),Fc(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function xm(r){var e=function(n,i,s){for(var o=n.atlasManager.getAtlasCollection(i),u=r.data.contexts[r.NODE],l=o.atlases,f=0;f<l.length;f++){var c=l[f],v=c.canvas;if(v){var h=v.width,d=v.height,p=h*f,g=v.height*s,y=.4;u.save(),u.scale(y,y),u.drawImage(v,p,g),u.strokeStyle="black",u.rect(p,g,h,d),u.stroke(),u.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}function Tm(r,e,t,a,n){var i,s,o,u,l=To(r),f=l.pan,c=l.zoom;{var v=Wy(r,f,c,e,t),h=et(v,2),d=h[0],p=h[1],g=6;i=d-g/2,s=p-g/2,o=g,u=g}if(o===0||u===0)return[];var y=r.data.contexts[r.WEBGL];y.bindFramebuffer(y.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(y.viewport(0,0,y.canvas.width,y.canvas.height),_c(r,null,xa.PICKING),r.pickingFrameBuffer.needsDraw=!1);var b=o*u,m=new Uint8Array(b*4);y.readPixels(i,s,o,u,y.RGBA,y.UNSIGNED_BYTE,m),y.bindFramebuffer(y.FRAMEBUFFER,null);for(var E=new Set,x=0;x<b;x++){var S=m.slice(x*4,x*4+4),w=Qy(S)-1;w>=0&&E.add(w)}return E}function Cm(r,e,t){var a=Tm(r,e,t),n=r.getCachedZSortedEles(),i,s,o=St(a),u;try{for(o.s();!(u=o.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!s&&f.isEdge()&&(s=f),i&&s)break}}catch(c){o.e(c)}finally{o.f()}return[i,s].filter(Boolean)}function Is(r,e,t){var a=r.drawing;e+=1,t.isNode()?(a.drawNode(t,e,"node-underlay"),a.drawNode(t,e,"node-body"),a.drawTexture(t,e,"label"),a.drawNode(t,e,"node-overlay")):(a.drawEdgeLine(t,e),a.drawEdgeArrow(t,e,"source"),a.drawEdgeArrow(t,e,"target"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"edge-source-label"),a.drawTexture(t,e,"edge-target-label"))}function _c(r,e,t){var a;r.webglDebug&&(a=performance.now());var n=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&wm(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var s=r.data.contexts[r.WEBGL];t.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=bm(r),u=r.getCachedZSortedEles();if(i=u.length,n.startFrame(o,t),t.screen){for(var l=0;l<u.nondrag.length;l++)Is(r,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)Is(r,f,u.drag[f])}else if(t.picking)for(var c=0;c<u.length;c++)Is(r,c,u[c]);n.endFrame(),t.screen&&r.webglDebugShowAtlases&&(Em(r),xm(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var v=performance.now(),h=!1,d=Math.ceil(v-a),p=n.getDebugInfo(),g=["".concat(i," elements"),"".concat(p.totalInstances," instances"),"".concat(p.batchCount," batches"),"".concat(p.totalAtlases," atlases"),"".concat(p.wrappedCount," wrapped textures"),"".concat(p.simpleCount," simple shapes")].join(", ");if(h)console.log("WebGL (".concat(t.name,") - time ").concat(d,"ms, ").concat(g));else{console.log("WebGL (".concat(t.name,") - frame time ").concat(d,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var y=p.atlasInfo,b=St(y),m;try{for(b.s();!(m=b.n()).done;){var E=m.value;console.log(" ".concat(E.type,": ").concat(E.keyCount," keys, ").concat(E.atlasCount," atlases"))}}catch(x){b.e(x)}finally{b.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,n.gc())}var mr={};mr.drawPolygonPath=function(r,e,t,a,n,i){var s=a/2,o=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+s*i[0],t+o*i[1]);for(var u=1;u<i.length/2;u++)r.lineTo(e+s*i[u*2],t+o*i[u*2+1]);r.closePath()};mr.drawRoundPolygonPath=function(r,e,t,a,n,i,s){s.forEach(function(o){return bc(r,o)}),r.closePath()};mr.drawRoundRectanglePath=function(r,e,t,a,n,i){var s=a/2,o=n/2,u=i==="auto"?lr(a,n):Math.min(i,o,s);r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.arcTo(e+s,t-o,e+s,t,u),r.arcTo(e+s,t+o,e,t+o,u),r.arcTo(e-s,t+o,e-s,t,u),r.arcTo(e-s,t-o,e,t-o,u),r.lineTo(e,t-o),r.closePath()};mr.drawBottomRoundRectanglePath=function(r,e,t,a,n,i){var s=a/2,o=n/2,u=i==="auto"?lr(a,n):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-o),r.lineTo(e+s,t-o),r.lineTo(e+s,t),r.arcTo(e+s,t+o,e,t+o,u),r.arcTo(e-s,t+o,e-s,t,u),r.lineTo(e-s,t-o),r.lineTo(e,t-o),r.closePath()};mr.drawCutRectanglePath=function(r,e,t,a,n,i,s){var o=a/2,u=n/2,l=s==="auto"?uo():s;r.beginPath&&r.beginPath(),r.moveTo(e-o+l,t-u),r.lineTo(e+o-l,t-u),r.lineTo(e+o,t-u+l),r.lineTo(e+o,t+u-l),r.lineTo(e+o-l,t+u),r.lineTo(e-o+l,t+u),r.lineTo(e-o,t+u-l),r.lineTo(e-o,t-u+l),r.closePath()};mr.drawBarrelPath=function(r,e,t,a,n){var i=a/2,s=n/2,o=e-i,u=e+i,l=t-s,f=t+s,c=Ps(a,n),v=c.widthOffset,h=c.heightOffset,d=c.ctrlPtOffsetPct*v;r.beginPath&&r.beginPath(),r.moveTo(o,l+h),r.lineTo(o,f-h),r.quadraticCurveTo(o+d,f,o+v,f),r.lineTo(u-v,f),r.quadraticCurveTo(u-d,f,u,f-h),r.lineTo(u,l+h),r.quadraticCurveTo(u-d,l,u-v,l),r.lineTo(o+v,l),r.quadraticCurveTo(o+d,l,o,l+h),r.closePath()};var Ql=Math.sin(0),Jl=Math.cos(0),Ws={},Ks={},Gc=Math.PI/40;for(var qr=0*Math.PI;qr<2*Math.PI;qr+=Gc)Ws[qr]=Math.sin(qr),Ks[qr]=Math.cos(qr);mr.drawEllipsePath=function(r,e,t,a,n){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,a/2,n/2,0,0,2*Math.PI);else for(var i,s,o=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=Gc)i=e-o*Ws[l]*Ql+o*Ks[l]*Jl,s=t+u*Ks[l]*Ql+u*Ws[l]*Jl,l===0?r.moveTo(i,s):r.lineTo(i,s);r.closePath()};var Ha={};Ha.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};Ha.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),a=t.boundingBox(),n=this.findContainerClientCoords(),i=r.full?Math.ceil(a.w):n[2],s=r.full?Math.ceil(a.h):n[3],o=ae(r.maxWidth)||ae(r.maxHeight),u=this.getPixelRatio(),l=1;if(r.scale!==void 0)i*=r.scale,s*=r.scale,l=r.scale;else if(o){var f=1/0,c=1/0;ae(r.maxWidth)&&(f=l*r.maxWidth/i),ae(r.maxHeight)&&(c=l*r.maxHeight/s),l=Math.min(f,c),i*=l,s*=l}o||(i*=u,s*=u,l*=u);var v=document.createElement("canvas");v.width=i,v.height=s,v.style.width=i+"px",v.style.height=s+"px";var h=v.getContext("2d");if(i>0&&s>0){h.clearRect(0,0,i,s),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*l,-a.y1*l),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(a.x1*l,a.y1*l);else{var p=e.pan(),g={x:p.x*l,y:p.y*l};l*=e.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,s),h.fill())}return v};function Dm(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new Blob([a],{type:e})}function jl(r){var e=r.indexOf(",");return r.substr(e+1)}function zc(r,e,t){var a=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new aa(function(n,i){try{e.toBlob(function(s){s!=null?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(s){i(s)}});case"blob":return Dm(jl(a()),t);case"base64":return jl(a());case"base64uri":default:return a()}}Ha.png=function(r){return zc(r,this.bufferCanvasImage(r),"image/png")};Ha.jpg=function(r){return zc(r,this.bufferCanvasImage(r),"image/jpeg")};var Vc={};Vc.nodeShapeImpl=function(r,e,t,a,n,i,s,o){switch(r){case"ellipse":return this.drawEllipsePath(e,t,a,n,i);case"polygon":return this.drawPolygonPath(e,t,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,t,a,n,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,a,n,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,a,n,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,a,n,i,o);case"barrel":return this.drawBarrelPath(e,t,a,n,i)}};var Sm=Uc,Ce=Uc.prototype;Ce.CANVAS_LAYERS=3;Ce.SELECT_BOX=0;Ce.DRAG=1;Ce.NODE=2;Ce.WEBGL=3;Ce.CANVAS_TYPES=["2d","2d","2d","webgl2"];Ce.BUFFER_COUNT=3;Ce.TEXTURE_BUFFER=0;Ce.MOTIONBLUR_BUFFER_NODE=1;Ce.MOTIONBLUR_BUFFER_DRAG=2;function Uc(r){var e=this,t=e.cy.window(),a=t.document;r.webgl&&(Ce.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Ce.CANVAS_LAYERS),contexts:new Array(Ce.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Ce.CANVAS_LAYERS),bufferCanvases:new Array(Ce.BUFFER_COUNT),bufferContexts:new Array(Ce.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=r.cy.container();o.appendChild(e.data.canvasContainer),o.style[n]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Cv()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Ce.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=a.createElement("canvas"),c=Ce.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(c),e.data.contexts[l]||He("Could not create canvas of type "+c),Object.keys(u).forEach(function(J){f.style[J]=u[J]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(Ce.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Ce.NODE].setAttribute("data-id","layer"+Ce.NODE+"-node"),e.data.canvases[Ce.SELECT_BOX].setAttribute("data-id","layer"+Ce.SELECT_BOX+"-selectbox"),e.data.canvases[Ce.DRAG].setAttribute("data-id","layer"+Ce.DRAG+"-drag"),e.data.canvases[Ce.WEBGL]&&e.data.canvases[Ce.WEBGL].setAttribute("data-id","layer"+Ce.WEBGL+"-webgl");for(var l=0;l<Ce.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=a.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var v=At(),h=function(z){return{x:(z.x1+z.x2)/2,y:(z.y1+z.y2)/2}},d=function(z){return{x:-z.w/2,y:-z.h/2}},p=function(z){var V=z[0]._private,Y=V.oldBackgroundTimestamp===V.backgroundTimestamp;return!Y},g=function(z){return z[0]._private.nodeKey},y=function(z){return z[0]._private.labelStyleKey},b=function(z){return z[0]._private.sourceLabelStyleKey},m=function(z){return z[0]._private.targetLabelStyleKey},E=function(z,V,Y,ee,ne){return e.drawElement(z,V,Y,!1,!1,ne)},x=function(z,V,Y,ee,ne){return e.drawElementText(z,V,Y,ee,"main",ne)},S=function(z,V,Y,ee,ne){return e.drawElementText(z,V,Y,ee,"source",ne)},w=function(z,V,Y,ee,ne){return e.drawElementText(z,V,Y,ee,"target",ne)},T=function(z){return z.boundingBox(),z[0]._private.bodyBounds},C=function(z){return z.boundingBox(),z[0]._private.labelBounds.main||v},D=function(z){return z.boundingBox(),z[0]._private.labelBounds.source||v},A=function(z){return z.boundingBox(),z[0]._private.labelBounds.target||v},L=function(z,V){return V},R=function(z){return h(T(z))},I=function(z,V,Y){var ee=z?z+"-":"";return{x:V.x+Y.pstyle(ee+"text-margin-x").pfValue,y:V.y+Y.pstyle(ee+"text-margin-y").pfValue}},O=function(z,V,Y){var ee=z[0]._private.rscratch;return{x:ee[V],y:ee[Y]}},N=function(z){return I("",O(z,"labelX","labelY"),z)},k=function(z){return I("source",O(z,"sourceLabelX","sourceLabelY"),z)},P=function(z){return I("target",O(z,"targetLabelX","targetLabelY"),z)},B=function(z){return d(T(z))},_=function(z){return d(D(z))},F=function(z){return d(A(z))},G=function(z){var V=C(z),Y=d(C(z));if(z.isNode()){switch(z.pstyle("text-halign").value){case"left":Y.x=-V.w-(V.leftPad||0);break;case"right":Y.x=-(V.rightPad||0);break}switch(z.pstyle("text-valign").value){case"top":Y.y=-V.h-(V.topPad||0);break;case"bottom":Y.y=-(V.botPad||0);break}}return Y},U=e.data.eleTxrCache=new ba(e,{getKey:g,doesEleInvalidateKey:p,drawElement:E,getBoundingBox:T,getRotationPoint:R,getRotationOffset:B,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),H=e.data.lblTxrCache=new ba(e,{getKey:y,drawElement:x,getBoundingBox:C,getRotationPoint:N,getRotationOffset:G,isVisible:L}),X=e.data.slbTxrCache=new ba(e,{getKey:b,drawElement:S,getBoundingBox:D,getRotationPoint:k,getRotationOffset:_,isVisible:L}),$=e.data.tlbTxrCache=new ba(e,{getKey:m,drawElement:w,getBoundingBox:A,getRotationPoint:P,getRotationOffset:F,isVisible:L}),Q=e.data.lyrTxrCache=new Rc(e);e.onUpdateEleCalcs(function(z,V){U.invalidateElements(V),H.invalidateElements(V),X.invalidateElements(V),$.invalidateElements(V),Q.invalidateElements(V);for(var Y=0;Y<V.length;Y++){var ee=V[Y]._private;ee.oldBackgroundTimestamp=ee.backgroundTimestamp}});var re=function(z){for(var V=0;V<z.length;V++)Q.enqueueElementRefinement(z[V].ele)};U.onDequeue(re),H.onDequeue(re),X.onDequeue(re),$.onDequeue(re),r.webgl&&e.initWebgl(r,{getStyleKey:g,getLabelKey:y,getSourceLabelKey:b,getTargetLabelKey:m,drawElement:E,drawLabel:x,drawSourceLabel:S,drawTargetLabel:w,getElementBox:T,getLabelBox:C,getSourceLabelBox:D,getTargetLabelBox:A,getElementRotationPoint:R,getElementRotationOffset:B,getLabelRotationPoint:N,getSourceLabelRotationPoint:k,getTargetLabelRotationPoint:P,getLabelRotationOffset:G,getSourceLabelRotationOffset:_,getTargetLabelRotationOffset:F})}Ce.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[Ce.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[Ce.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[Ce.SELECT_BOX]=e;break;case"gc":t.data.gc=!0;break}};var Am=typeof Path2D<"u";Ce.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};Ce.usePaths=function(){return Am&&this.pathsEnabled};Ce.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};Ce.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};Ce.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":at(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[Ic,$t,er,xo,Nr,yr,wt,kc,mr,Ha,Vc].forEach(function(r){de(Ce,r)});var Lm=[{name:"null",impl:pc},{name:"base",impl:Sc},{name:"canvas",impl:Sm}],Rm=[{type:"layout",extensions:ty},{type:"renderer",extensions:Lm}],qc={},Hc={};function Yc(r,e,t){var a=t,n=function(T){Pe("Can not register `"+e+"` for `"+r+"` since `"+T+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(Ma.prototype[e])return n(e);Ma.prototype[e]=t}else if(r==="collection"){if(vt.prototype[e])return n(e);vt.prototype[e]=t}else if(r==="layout"){for(var i=function(T){this.options=T,t.call(this,T),Re(this._private)||(this._private={}),this._private.cy=T.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(t.prototype),o=[],u=0;u<o.length;u++){var l=o[u];s[l]=s[l]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=t.prototype.stop;s.stop=function(){var w=this.options;if(w&&w.animate){var T=this.animations;if(T)for(var C=0;C<T.length;C++)T[C].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var c=function(T){return T._private.cy},v={addEventFields:function(T,C){C.layout=T,C.cy=c(T),C.target=T},bubble:function(){return!0},parent:function(T){return c(T)}};de(s,{createEmitter:function(){return this._private.emitter=new $n(v,this),this},emitter:function(){return this._private.emitter},on:function(T,C){return this.emitter().on(T,C),this},one:function(T,C){return this.emitter().one(T,C),this},once:function(T,C){return this.emitter().one(T,C),this},removeListener:function(T,C){return this.emitter().removeListener(T,C),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(T,C){return this.emitter().emit(T,C),this}}),Oe.eventAliasesOn(s),a=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var h=$c("renderer","base"),d=h.prototype,p=t,g=t.prototype,y=function(){h.apply(this,arguments),p.apply(this,arguments)},b=y.prototype;for(var m in d){var E=d[m],x=g[m]!=null;if(x)return n(m);b[m]=E}for(var S in g)b[S]=g[S];d.clientFunctions.forEach(function(w){b[w]=b[w]||function(){He("Renderer does not implement `renderer."+w+"()` on its prototype")}}),a=y}else if(r==="__proto__"||r==="constructor"||r==="prototype")return He(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return vf({map:qc,keys:[r,e],value:a})}function $c(r,e){return hf({map:qc,keys:[r,e]})}function Im(r,e,t,a,n){return vf({map:Hc,keys:[r,e,t,a],value:n})}function Mm(r,e,t,a){return hf({map:Hc,keys:[r,e,t,a]})}var Zs=function(){if(arguments.length===2)return $c.apply(null,arguments);if(arguments.length===3)return Yc.apply(null,arguments);if(arguments.length===4)return Mm.apply(null,arguments);if(arguments.length===5)return Im.apply(null,arguments);He("Invalid extension access syntax")};Ma.prototype.extension=Zs;Rm.forEach(function(r){r.extensions.forEach(function(e){Yc(r.type,e.name,e.impl)})});var kn=function(){if(!(this instanceof kn))return new kn;this.length=0},Or=kn.prototype;Or.instanceString=function(){return"stylesheet"};Or.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};Or.css=function(r,e){var t=this.length-1;if(ce(r))this[t].properties.push({name:r,value:e});else if(Re(r))for(var a=r,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(o!=null){var u=ot.properties[s]||ot.properties[Bn(s)];if(u!=null){var l=u.name,f=o;this[t].properties.push({name:l,value:f})}}}return this};Or.style=Or.css;Or.generateStyle=function(r){var e=new ot(r);return this.appendToStyle(e)};Or.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],a=t.selector,n=t.properties;r.selector(a);for(var i=0;i<n.length;i++){var s=n[i];r.css(s.name,s.value)}}return r};var Om="3.32.0",hr=function(e){if(e===void 0&&(e={}),Re(e))return new Ma(e);if(ce(e))return Zs.apply(Zs,arguments)};hr.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(hr),r.apply(null,e),this};hr.warnings=function(r){return wf(r)};hr.version=Om;hr.stylesheet=hr.Stylesheet=kn;var bn={exports:{}},wn={exports:{}},En={exports:{}},Pm=En.exports,ef;function Nm(){return ef||(ef=1,function(r,e){(function(a,n){r.exports=n()})(Pm,function(){return function(t){var a={};function n(i){if(a[i])return a[i].exports;var s=a[i]={i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=a,n.i=function(i){return i},n.d=function(i,s,o){n.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:o})},n.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(s,"a",s),s},n.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},n.p="",n(n.s=26)}([function(t,a,n){function i(){}i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,t.exports=i},function(t,a,n){var i=n(2),s=n(8),o=n(9);function u(f,c,v){i.call(this,v),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=v,this.bendpoints=[],this.source=f,this.target=c}u.prototype=Object.create(i.prototype);for(var l in i)u[l]=i[l];u.prototype.getSource=function(){return this.source},u.prototype.getTarget=function(){return this.target},u.prototype.isInterGraph=function(){return this.isInterGraph},u.prototype.getLength=function(){return this.length},u.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},u.prototype.getBendpoints=function(){return this.bendpoints},u.prototype.getLca=function(){return this.lca},u.prototype.getSourceInLca=function(){return this.sourceInLca},u.prototype.getTargetInLca=function(){return this.targetInLca},u.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},u.prototype.getOtherEndInGraph=function(f,c){for(var v=this.getOtherEnd(f),h=c.getGraphManager().getRoot();;){if(v.getOwner()==c)return v;if(v.getOwner()==h)break;v=v.getOwner().getParent()}return null},u.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=s.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},u.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=u},function(t,a,n){function i(s){this.vGraphObject=s}t.exports=i},function(t,a,n){var i=n(2),s=n(10),o=n(13),u=n(0),l=n(16),f=n(4);function c(h,d,p,g){p==null&&g==null&&(g=d),i.call(this,g),h.graphManager!=null&&(h=h.graphManager),this.estimatedSize=s.MIN_VALUE,this.inclusionTreeDepth=s.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=h,p!=null&&d!=null?this.rect=new o(d.x,d.y,p.width,p.height):this.rect=new o}c.prototype=Object.create(i.prototype);for(var v in i)c[v]=i[v];c.prototype.getEdges=function(){return this.edges},c.prototype.getChild=function(){return this.child},c.prototype.getOwner=function(){return this.owner},c.prototype.getWidth=function(){return this.rect.width},c.prototype.setWidth=function(h){this.rect.width=h},c.prototype.getHeight=function(){return this.rect.height},c.prototype.setHeight=function(h){this.rect.height=h},c.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},c.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},c.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},c.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},c.prototype.getRect=function(){return this.rect},c.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},c.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},c.prototype.setRect=function(h,d){this.rect.x=h.x,this.rect.y=h.y,this.rect.width=d.width,this.rect.height=d.height},c.prototype.setCenter=function(h,d){this.rect.x=h-this.rect.width/2,this.rect.y=d-this.rect.height/2},c.prototype.setLocation=function(h,d){this.rect.x=h,this.rect.y=d},c.prototype.moveBy=function(h,d){this.rect.x+=h,this.rect.y+=d},c.prototype.getEdgeListToNode=function(h){var d=[],p=this;return p.edges.forEach(function(g){if(g.target==h){if(g.source!=p)throw"Incorrect edge source!";d.push(g)}}),d},c.prototype.getEdgesBetween=function(h){var d=[],p=this;return p.edges.forEach(function(g){if(!(g.source==p||g.target==p))throw"Incorrect edge source and/or target";(g.target==h||g.source==h)&&d.push(g)}),d},c.prototype.getNeighborsList=function(){var h=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)h.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";h.add(p.source)}}),h},c.prototype.withChildren=function(){var h=new Set,d,p;if(h.add(this),this.child!=null)for(var g=this.child.getNodes(),y=0;y<g.length;y++)d=g[y],p=d.withChildren(),p.forEach(function(b){h.add(b)});return h},c.prototype.getNoOfChildren=function(){var h=0,d;if(this.child==null)h=1;else for(var p=this.child.getNodes(),g=0;g<p.length;g++)d=p[g],h+=d.getNoOfChildren();return h==0&&(h=1),h},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},c.prototype.scatter=function(){var h,d,p=-u.INITIAL_WORLD_BOUNDARY,g=u.INITIAL_WORLD_BOUNDARY;h=u.WORLD_CENTER_X+l.nextDouble()*(g-p)+p;var y=-u.INITIAL_WORLD_BOUNDARY,b=u.INITIAL_WORLD_BOUNDARY;d=u.WORLD_CENTER_Y+l.nextDouble()*(b-y)+y,this.rect.x=h,this.rect.y=d},c.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var h=this.getChild();if(h.updateBounds(!0),this.rect.x=h.getLeft(),this.rect.y=h.getTop(),this.setWidth(h.getRight()-h.getLeft()),this.setHeight(h.getBottom()-h.getTop()),u.NODE_DIMENSIONS_INCLUDE_LABELS){var d=h.getRight()-h.getLeft(),p=h.getBottom()-h.getTop();this.labelWidth>d&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>p&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-p)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-p),this.setHeight(this.labelHeight))}}},c.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==s.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},c.prototype.transform=function(h){var d=this.rect.x;d>u.WORLD_BOUNDARY?d=u.WORLD_BOUNDARY:d<-u.WORLD_BOUNDARY&&(d=-u.WORLD_BOUNDARY);var p=this.rect.y;p>u.WORLD_BOUNDARY?p=u.WORLD_BOUNDARY:p<-u.WORLD_BOUNDARY&&(p=-u.WORLD_BOUNDARY);var g=new f(d,p),y=h.inverseTransformPoint(g);this.setLocation(y.x,y.y)},c.prototype.getLeft=function(){return this.rect.x},c.prototype.getRight=function(){return this.rect.x+this.rect.width},c.prototype.getTop=function(){return this.rect.y},c.prototype.getBottom=function(){return this.rect.y+this.rect.height},c.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},t.exports=c},function(t,a,n){function i(s,o){s==null&&o==null?(this.x=0,this.y=0):(this.x=s,this.y=o)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(s){this.x=s},i.prototype.setY=function(s){this.y=s},i.prototype.getDifference=function(s){return new DimensionD(this.x-s.x,this.y-s.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(s){return this.x+=s.width,this.y+=s.height,this},t.exports=i},function(t,a,n){var i=n(2),s=n(10),o=n(0),u=n(6),l=n(3),f=n(1),c=n(13),v=n(12),h=n(11);function d(g,y,b){i.call(this,b),this.estimatedSize=s.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,y!=null&&y instanceof u?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}d.prototype=Object.create(i.prototype);for(var p in i)d[p]=i[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(g,y,b){if(y==null&&b==null){var m=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(m)>-1)throw"Node already in graph!";return m.owner=this,this.getNodes().push(m),m}else{var E=g;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(b)>-1))throw"Source or target not in graph!";if(!(y.owner==b.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=b.owner?null:(E.source=y,E.target=b,E.isInterGraph=!1,this.getEdges().push(E),y.edges.push(E),b!=y&&b.edges.push(E),E)}},d.prototype.remove=function(g){var y=g;if(g instanceof l){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var b=y.edges.slice(),m,E=b.length,x=0;x<E;x++)m=b[x],m.isInterGraph?this.graphManager.remove(m):m.source.owner.remove(m);var S=this.nodes.indexOf(y);if(S==-1)throw"Node not in owner node list!";this.nodes.splice(S,1)}else if(g instanceof f){var m=g;if(m==null)throw"Edge is null!";if(!(m.source!=null&&m.target!=null))throw"Source and/or target is null!";if(!(m.source.owner!=null&&m.target.owner!=null&&m.source.owner==this&&m.target.owner==this))throw"Source and/or target owner is invalid!";var w=m.source.edges.indexOf(m),T=m.target.edges.indexOf(m);if(!(w>-1&&T>-1))throw"Source and/or target doesn't know this edge!";m.source.edges.splice(w,1),m.target!=m.source&&m.target.edges.splice(T,1);var S=m.source.owner.getEdges().indexOf(m);if(S==-1)throw"Not in owner's edge list!";m.source.owner.getEdges().splice(S,1)}},d.prototype.updateLeftTop=function(){for(var g=s.MAX_VALUE,y=s.MAX_VALUE,b,m,E,x=this.getNodes(),S=x.length,w=0;w<S;w++){var T=x[w];b=T.getTop(),m=T.getLeft(),g>b&&(g=b),y>m&&(y=m)}return g==s.MAX_VALUE?null:(x[0].getParent().paddingLeft!=null?E=x[0].getParent().paddingLeft:E=this.margin,this.left=y-E,this.top=g-E,new v(this.left,this.top))},d.prototype.updateBounds=function(g){for(var y=s.MAX_VALUE,b=-s.MAX_VALUE,m=s.MAX_VALUE,E=-s.MAX_VALUE,x,S,w,T,C,D=this.nodes,A=D.length,L=0;L<A;L++){var R=D[L];g&&R.child!=null&&R.updateBounds(),x=R.getLeft(),S=R.getRight(),w=R.getTop(),T=R.getBottom(),y>x&&(y=x),b<S&&(b=S),m>w&&(m=w),E<T&&(E=T)}var I=new c(y,m,b-y,E-m);y==s.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),D[0].getParent().paddingLeft!=null?C=D[0].getParent().paddingLeft:C=this.margin,this.left=I.x-C,this.right=I.x+I.width+C,this.top=I.y-C,this.bottom=I.y+I.height+C},d.calculateBounds=function(g){for(var y=s.MAX_VALUE,b=-s.MAX_VALUE,m=s.MAX_VALUE,E=-s.MAX_VALUE,x,S,w,T,C=g.length,D=0;D<C;D++){var A=g[D];x=A.getLeft(),S=A.getRight(),w=A.getTop(),T=A.getBottom(),y>x&&(y=x),b<S&&(b=S),m>w&&(m=w),E<T&&(E=T)}var L=new c(y,m,b-y,E-m);return L},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var g=0,y=this.nodes,b=y.length,m=0;m<b;m++){var E=y[m];g+=E.calcEstimatedSize()}return g==0?this.estimatedSize=o.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=g/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var g=this;if(this.nodes.length==0){this.isConnected=!0;return}var y=new h,b=new Set,m=this.nodes[0],E,x,S=m.withChildren();for(S.forEach(function(L){y.push(L),b.add(L)});y.length!==0;){m=y.shift(),E=m.getEdges();for(var w=E.length,T=0;T<w;T++){var C=E[T];if(x=C.getOtherEndInGraph(m,this),x!=null&&!b.has(x)){var D=x.withChildren();D.forEach(function(L){y.push(L),b.add(L)})}}}if(this.isConnected=!1,b.size>=this.nodes.length){var A=0;b.forEach(function(L){L.owner==g&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},t.exports=d},function(t,a,n){var i,s=n(1);function o(u){i=n(5),this.layout=u,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var u=this.layout.newGraph(),l=this.layout.newNode(null),f=this.add(u,l);return this.setRootGraph(f),this.rootGraph},o.prototype.add=function(u,l,f,c,v){if(f==null&&c==null&&v==null){if(u==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(u)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(u),u.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return u.parent=l,l.child=u,u}else{v=f,c=l,f=u;var h=c.getOwner(),d=v.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==d)return f.isInterGraph=!1,h.add(f,c,v);if(f.isInterGraph=!0,f.source=c,f.target=v,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},o.prototype.remove=function(u){if(u instanceof i){var l=u;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(l.getEdges());for(var c,v=f.length,h=0;h<v;h++)c=f[h],l.remove(c);var d=[];d=d.concat(l.getNodes());var p;v=d.length;for(var h=0;h<v;h++)p=d[h],l.remove(p);l==this.rootGraph&&this.setRootGraph(null);var g=this.graphs.indexOf(l);this.graphs.splice(g,1),l.parent=null}else if(u instanceof s){if(c=u,c==null)throw"Edge is null!";if(!c.isInterGraph)throw"Not an inter-graph edge!";if(!(c.source!=null&&c.target!=null))throw"Source and/or target is null!";if(!(c.source.edges.indexOf(c)!=-1&&c.target.edges.indexOf(c)!=-1))throw"Source and/or target doesn't know this edge!";var g=c.source.edges.indexOf(c);if(c.source.edges.splice(g,1),g=c.target.edges.indexOf(c),c.target.edges.splice(g,1),!(c.source.owner!=null&&c.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(c.source.owner.getGraphManager().edges.indexOf(c)==-1)throw"Not in owner graph manager's edge list!";var g=c.source.owner.getGraphManager().edges.indexOf(c);c.source.owner.getGraphManager().edges.splice(g,1)}},o.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},o.prototype.getGraphs=function(){return this.graphs},o.prototype.getAllNodes=function(){if(this.allNodes==null){for(var u=[],l=this.getGraphs(),f=l.length,c=0;c<f;c++)u=u.concat(l[c].getNodes());this.allNodes=u}return this.allNodes},o.prototype.resetAllNodes=function(){this.allNodes=null},o.prototype.resetAllEdges=function(){this.allEdges=null},o.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},o.prototype.getAllEdges=function(){if(this.allEdges==null){var u=[],l=this.getGraphs();l.length;for(var f=0;f<l.length;f++)u=u.concat(l[f].getEdges());u=u.concat(this.edges),this.allEdges=u}return this.allEdges},o.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},o.prototype.setAllNodesToApplyGravitation=function(u){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=u},o.prototype.getRoot=function(){return this.rootGraph},o.prototype.setRootGraph=function(u){if(u.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=u,u.parent==null&&(u.parent=this.layout.newNode("Root node"))},o.prototype.getLayout=function(){return this.layout},o.prototype.isOneAncestorOfOther=function(u,l){if(!(u!=null&&l!=null))throw"assert failed";if(u==l)return!0;var f=u.getOwner(),c;do{if(c=f.getParent(),c==null)break;if(c==l)return!0;if(f=c.getOwner(),f==null)break}while(!0);f=l.getOwner();do{if(c=f.getParent(),c==null)break;if(c==u)return!0;if(f=c.getOwner(),f==null)break}while(!0);return!1},o.prototype.calcLowestCommonAncestors=function(){for(var u,l,f,c,v,h=this.getAllEdges(),d=h.length,p=0;p<d;p++){if(u=h[p],l=u.source,f=u.target,u.lca=null,u.sourceInLca=l,u.targetInLca=f,l==f){u.lca=l.getOwner();continue}for(c=l.getOwner();u.lca==null;){for(u.targetInLca=f,v=f.getOwner();u.lca==null;){if(v==c){u.lca=v;break}if(v==this.rootGraph)break;if(u.lca!=null)throw"assert failed";u.targetInLca=v.getParent(),v=u.targetInLca.getOwner()}if(c==this.rootGraph)break;u.lca==null&&(u.sourceInLca=c.getParent(),c=u.sourceInLca.getOwner())}if(u.lca==null)throw"assert failed"}},o.prototype.calcLowestCommonAncestor=function(u,l){if(u==l)return u.getOwner();var f=u.getOwner();do{if(f==null)break;var c=l.getOwner();do{if(c==null)break;if(c==f)return c;c=c.getParent().getOwner()}while(!0);f=f.getParent().getOwner()}while(!0);return f},o.prototype.calcInclusionTreeDepths=function(u,l){u==null&&l==null&&(u=this.rootGraph,l=1);for(var f,c=u.getNodes(),v=c.length,h=0;h<v;h++)f=c[h],f.inclusionTreeDepth=l,f.child!=null&&this.calcInclusionTreeDepths(f.child,l+1)},o.prototype.includesInvalidEdge=function(){for(var u,l=this.edges.length,f=0;f<l;f++)if(u=this.edges[f],this.isOneAncestorOfOther(u.source,u.target))return!0;return!1},t.exports=o},function(t,a,n){var i=n(0);function s(){}for(var o in i)s[o]=i[o];s.MAX_ITERATIONS=2500,s.DEFAULT_EDGE_LENGTH=50,s.DEFAULT_SPRING_STRENGTH=.45,s.DEFAULT_REPULSION_STRENGTH=4500,s.DEFAULT_GRAVITY_STRENGTH=.4,s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,s.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,s.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,s.COOLING_ADAPTATION_FACTOR=.33,s.ADAPTATION_LOWER_NODE_LIMIT=1e3,s.ADAPTATION_UPPER_NODE_LIMIT=5e3,s.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,s.MAX_NODE_DISPLACEMENT=s.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,s.MIN_REPULSION_DIST=s.DEFAULT_EDGE_LENGTH/10,s.CONVERGENCE_CHECK_PERIOD=100,s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,s.MIN_EDGE_LENGTH=1,s.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=s},function(t,a,n){var i=n(12);function s(){}s.calcSeparationAmount=function(o,u,l,f){if(!o.intersects(u))throw"assert failed";var c=new Array(2);this.decideDirectionsForOverlappingNodes(o,u,c),l[0]=Math.min(o.getRight(),u.getRight())-Math.max(o.x,u.x),l[1]=Math.min(o.getBottom(),u.getBottom())-Math.max(o.y,u.y),o.getX()<=u.getX()&&o.getRight()>=u.getRight()?l[0]+=Math.min(u.getX()-o.getX(),o.getRight()-u.getRight()):u.getX()<=o.getX()&&u.getRight()>=o.getRight()&&(l[0]+=Math.min(o.getX()-u.getX(),u.getRight()-o.getRight())),o.getY()<=u.getY()&&o.getBottom()>=u.getBottom()?l[1]+=Math.min(u.getY()-o.getY(),o.getBottom()-u.getBottom()):u.getY()<=o.getY()&&u.getBottom()>=o.getBottom()&&(l[1]+=Math.min(o.getY()-u.getY(),u.getBottom()-o.getBottom()));var v=Math.abs((u.getCenterY()-o.getCenterY())/(u.getCenterX()-o.getCenterX()));u.getCenterY()===o.getCenterY()&&u.getCenterX()===o.getCenterX()&&(v=1);var h=v*l[0],d=l[1]/v;l[0]<d?d=l[0]:h=l[1],l[0]=-1*c[0]*(d/2+f),l[1]=-1*c[1]*(h/2+f)},s.decideDirectionsForOverlappingNodes=function(o,u,l){o.getCenterX()<u.getCenterX()?l[0]=-1:l[0]=1,o.getCenterY()<u.getCenterY()?l[1]=-1:l[1]=1},s.getIntersection2=function(o,u,l){var f=o.getCenterX(),c=o.getCenterY(),v=u.getCenterX(),h=u.getCenterY();if(o.intersects(u))return l[0]=f,l[1]=c,l[2]=v,l[3]=h,!0;var d=o.getX(),p=o.getY(),g=o.getRight(),y=o.getX(),b=o.getBottom(),m=o.getRight(),E=o.getWidthHalf(),x=o.getHeightHalf(),S=u.getX(),w=u.getY(),T=u.getRight(),C=u.getX(),D=u.getBottom(),A=u.getRight(),L=u.getWidthHalf(),R=u.getHeightHalf(),I=!1,O=!1;if(f===v){if(c>h)return l[0]=f,l[1]=p,l[2]=v,l[3]=D,!1;if(c<h)return l[0]=f,l[1]=b,l[2]=v,l[3]=w,!1}else if(c===h){if(f>v)return l[0]=d,l[1]=c,l[2]=T,l[3]=h,!1;if(f<v)return l[0]=g,l[1]=c,l[2]=S,l[3]=h,!1}else{var N=o.height/o.width,k=u.height/u.width,P=(h-c)/(v-f),B=void 0,_=void 0,F=void 0,G=void 0,U=void 0,H=void 0;if(-N===P?f>v?(l[0]=y,l[1]=b,I=!0):(l[0]=g,l[1]=p,I=!0):N===P&&(f>v?(l[0]=d,l[1]=p,I=!0):(l[0]=m,l[1]=b,I=!0)),-k===P?v>f?(l[2]=C,l[3]=D,O=!0):(l[2]=T,l[3]=w,O=!0):k===P&&(v>f?(l[2]=S,l[3]=w,O=!0):(l[2]=A,l[3]=D,O=!0)),I&&O)return!1;if(f>v?c>h?(B=this.getCardinalDirection(N,P,4),_=this.getCardinalDirection(k,P,2)):(B=this.getCardinalDirection(-N,P,3),_=this.getCardinalDirection(-k,P,1)):c>h?(B=this.getCardinalDirection(-N,P,1),_=this.getCardinalDirection(-k,P,3)):(B=this.getCardinalDirection(N,P,2),_=this.getCardinalDirection(k,P,4)),!I)switch(B){case 1:G=p,F=f+-x/P,l[0]=F,l[1]=G;break;case 2:F=m,G=c+E*P,l[0]=F,l[1]=G;break;case 3:G=b,F=f+x/P,l[0]=F,l[1]=G;break;case 4:F=y,G=c+-E*P,l[0]=F,l[1]=G;break}if(!O)switch(_){case 1:H=w,U=v+-R/P,l[2]=U,l[3]=H;break;case 2:U=A,H=h+L*P,l[2]=U,l[3]=H;break;case 3:H=D,U=v+R/P,l[2]=U,l[3]=H;break;case 4:U=C,H=h+-L*P,l[2]=U,l[3]=H;break}}return!1},s.getCardinalDirection=function(o,u,l){return o>u?l:1+l%4},s.getIntersection=function(o,u,l,f){if(f==null)return this.getIntersection2(o,u,l);var c=o.x,v=o.y,h=u.x,d=u.y,p=l.x,g=l.y,y=f.x,b=f.y,m=void 0,E=void 0,x=void 0,S=void 0,w=void 0,T=void 0,C=void 0,D=void 0,A=void 0;return x=d-v,w=c-h,C=h*v-c*d,S=b-g,T=p-y,D=y*g-p*b,A=x*T-S*w,A===0?null:(m=(w*D-T*C)/A,E=(S*C-x*D)/A,new i(m,E))},s.angleOfVector=function(o,u,l,f){var c=void 0;return o!==l?(c=Math.atan((f-u)/(l-o)),l<o?c+=Math.PI:f<u&&(c+=this.TWO_PI)):f<u?c=this.ONE_AND_HALF_PI:c=this.HALF_PI,c},s.doIntersect=function(o,u,l,f){var c=o.x,v=o.y,h=u.x,d=u.y,p=l.x,g=l.y,y=f.x,b=f.y,m=(h-c)*(b-g)-(y-p)*(d-v);if(m===0)return!1;var E=((b-g)*(y-c)+(p-y)*(b-v))/m,x=((v-d)*(y-c)+(h-c)*(b-v))/m;return 0<E&&E<1&&0<x&&x<1},s.HALF_PI=.5*Math.PI,s.ONE_AND_HALF_PI=1.5*Math.PI,s.TWO_PI=2*Math.PI,s.THREE_PI=3*Math.PI,t.exports=s},function(t,a,n){function i(){}i.sign=function(s){return s>0?1:s<0?-1:0},i.floor=function(s){return s<0?Math.ceil(s):Math.floor(s)},i.ceil=function(s){return s<0?Math.floor(s):Math.ceil(s)},t.exports=i},function(t,a,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,t.exports=i},function(t,a,n){var i=function(){function c(v,h){for(var d=0;d<h.length;d++){var p=h[d];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(v,p.key,p)}}return function(v,h,d){return h&&c(v.prototype,h),d&&c(v,d),v}}();function s(c,v){if(!(c instanceof v))throw new TypeError("Cannot call a class as a function")}var o=function(v){return{value:v,next:null,prev:null}},u=function(v,h,d,p){return v!==null?v.next=h:p.head=h,d!==null?d.prev=h:p.tail=h,h.prev=v,h.next=d,p.length++,h},l=function(v,h){var d=v.prev,p=v.next;return d!==null?d.next=p:h.head=p,p!==null?p.prev=d:h.tail=d,v.prev=v.next=null,h.length--,v},f=function(){function c(v){var h=this;s(this,c),this.length=0,this.head=null,this.tail=null,v!=null&&v.forEach(function(d){return h.push(d)})}return i(c,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(h,d){return u(d.prev,o(h),d,this)}},{key:"insertAfter",value:function(h,d){return u(d,o(h),d.next,this)}},{key:"insertNodeBefore",value:function(h,d){return u(d.prev,h,d,this)}},{key:"insertNodeAfter",value:function(h,d){return u(d,h,d.next,this)}},{key:"push",value:function(h){return u(this.tail,o(h),null,this)}},{key:"unshift",value:function(h){return u(null,o(h),this.head,this)}},{key:"remove",value:function(h){return l(h,this)}},{key:"pop",value:function(){return l(this.tail,this).value}},{key:"popNode",value:function(){return l(this.tail,this)}},{key:"shift",value:function(){return l(this.head,this).value}},{key:"shiftNode",value:function(){return l(this.head,this)}},{key:"get_object_at",value:function(h){if(h<=this.length()){for(var d=1,p=this.head;d<h;)p=p.next,d++;return p.value}}},{key:"set_object_at",value:function(h,d){if(h<=this.length()){for(var p=1,g=this.head;p<h;)g=g.next,p++;g.value=d}}}]),c}();t.exports=f},function(t,a,n){function i(s,o,u){this.x=null,this.y=null,s==null&&o==null&&u==null?(this.x=0,this.y=0):typeof s=="number"&&typeof o=="number"&&u==null?(this.x=s,this.y=o):s.constructor.name=="Point"&&o==null&&u==null&&(u=s,this.x=u.x,this.y=u.y)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.getLocation=function(){return new i(this.x,this.y)},i.prototype.setLocation=function(s,o,u){s.constructor.name=="Point"&&o==null&&u==null?(u=s,this.setLocation(u.x,u.y)):typeof s=="number"&&typeof o=="number"&&u==null&&(parseInt(s)==s&&parseInt(o)==o?this.move(s,o):(this.x=Math.floor(s+.5),this.y=Math.floor(o+.5)))},i.prototype.move=function(s,o){this.x=s,this.y=o},i.prototype.translate=function(s,o){this.x+=s,this.y+=o},i.prototype.equals=function(s){if(s.constructor.name=="Point"){var o=s;return this.x==o.x&&this.y==o.y}return this==s},i.prototype.toString=function(){return new i().constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=i},function(t,a,n){function i(s,o,u,l){this.x=0,this.y=0,this.width=0,this.height=0,s!=null&&o!=null&&u!=null&&l!=null&&(this.x=s,this.y=o,this.width=u,this.height=l)}i.prototype.getX=function(){return this.x},i.prototype.setX=function(s){this.x=s},i.prototype.getY=function(){return this.y},i.prototype.setY=function(s){this.y=s},i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(s){this.width=s},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(s){this.height=s},i.prototype.getRight=function(){return this.x+this.width},i.prototype.getBottom=function(){return this.y+this.height},i.prototype.intersects=function(s){return!(this.getRight()<s.x||this.getBottom()<s.y||s.getRight()<this.x||s.getBottom()<this.y)},i.prototype.getCenterX=function(){return this.x+this.width/2},i.prototype.getMinX=function(){return this.getX()},i.prototype.getMaxX=function(){return this.getX()+this.width},i.prototype.getCenterY=function(){return this.y+this.height/2},i.prototype.getMinY=function(){return this.getY()},i.prototype.getMaxY=function(){return this.getY()+this.height},i.prototype.getWidthHalf=function(){return this.width/2},i.prototype.getHeightHalf=function(){return this.height/2},t.exports=i},function(t,a,n){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function s(){}s.lastID=0,s.createID=function(o){return s.isPrimitive(o)?o:(o.uniqueID!=null||(o.uniqueID=s.getString(),s.lastID++),o.uniqueID)},s.getString=function(o){return o==null&&(o=s.lastID),"Object#"+o},s.isPrimitive=function(o){var u=typeof o>"u"?"undefined":i(o);return o==null||u!="object"&&u!="function"},t.exports=s},function(t,a,n){function i(p){if(Array.isArray(p)){for(var g=0,y=Array(p.length);g<p.length;g++)y[g]=p[g];return y}else return Array.from(p)}var s=n(0),o=n(6),u=n(3),l=n(1),f=n(5),c=n(4),v=n(17),h=n(27);function d(p){h.call(this),this.layoutQuality=s.QUALITY,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=s.DEFAULT_INCREMENTAL,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new o(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,p!=null&&(this.isRemoteUse=p)}d.RANDOM_SEED=1,d.prototype=Object.create(h.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var p=new o(this);return this.graphManager=p,p},d.prototype.newGraph=function(p){return new f(null,this.graphManager,p)},d.prototype.newNode=function(p){return new u(this.graphManager,p)},d.prototype.newEdge=function(p){return new l(null,null,p)},d.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var p;return this.checkLayoutSuccess()?p=!1:p=this.layout(),s.ANIMATE==="during"?!1:(p&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,p)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var p=this.graphManager.getAllEdges(),g=0;g<p.length;g++)p[g];for(var y=this.graphManager.getRoot().getNodes(),g=0;g<y.length;g++)y[g];this.update(this.graphManager.getRoot())}},d.prototype.update=function(p){if(p==null)this.update2();else if(p instanceof u){var g=p;if(g.getChild()!=null)for(var y=g.getChild().getNodes(),b=0;b<y.length;b++)update(y[b]);if(g.vGraphObject!=null){var m=g.vGraphObject;m.update(g)}}else if(p instanceof l){var E=p;if(E.vGraphObject!=null){var x=E.vGraphObject;x.update(E)}}else if(p instanceof f){var S=p;if(S.vGraphObject!=null){var w=S.vGraphObject;w.update(S)}}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=s.QUALITY,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=s.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(p){if(p==null)this.transform(new c(0,0));else{var g=new v,y=this.graphManager.getRoot().updateLeftTop();if(y!=null){g.setWorldOrgX(p.x),g.setWorldOrgY(p.y),g.setDeviceOrgX(y.x),g.setDeviceOrgY(y.y);for(var b=this.getAllNodes(),m,E=0;E<b.length;E++)m=b[E],m.transform(g)}}},d.prototype.positionNodesRandomly=function(p){if(p==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var g,y,b=p.getNodes(),m=0;m<b.length;m++)g=b[m],y=g.getChild(),y==null||y.getNodes().length==0?g.scatter():(this.positionNodesRandomly(y),g.updateBounds())},d.prototype.getFlatForest=function(){for(var p=[],g=!0,y=this.graphManager.getRoot().getNodes(),b=!0,m=0;m<y.length;m++)y[m].getChild()!=null&&(b=!1);if(!b)return p;var E=new Set,x=[],S=new Map,w=[];for(w=w.concat(y);w.length>0&&g;){for(x.push(w[0]);x.length>0&&g;){var T=x[0];x.splice(0,1),E.add(T);for(var C=T.getEdges(),m=0;m<C.length;m++){var D=C[m].getOtherEnd(T);if(S.get(T)!=D)if(!E.has(D))x.push(D),S.set(D,T);else{g=!1;break}}}if(!g)p=[];else{var A=[].concat(i(E));p.push(A);for(var m=0;m<A.length;m++){var L=A[m],R=w.indexOf(L);R>-1&&w.splice(R,1)}E=new Set,S=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var g=[],y=p.source,b=this.graphManager.calcLowestCommonAncestor(p.source,p.target),m=0;m<p.bendpoints.length;m++){var E=this.newNode(null);E.setRect(new Point(0,0),new Dimension(1,1)),b.add(E);var x=this.newEdge(null);this.graphManager.add(x,y,E),g.add(E),y=E}var x=this.newEdge(null);return this.graphManager.add(x,y,p.target),this.edgeToDummyNodes.set(p,g),p.isInterGraph()?this.graphManager.remove(p):b.remove(p),g},d.prototype.createBendpointsFromDummyNodes=function(){var p=[];p=p.concat(this.graphManager.getAllEdges()),p=[].concat(i(this.edgeToDummyNodes.keys())).concat(p);for(var g=0;g<p.length;g++){var y=p[g];if(y.bendpoints.length>0){for(var b=this.edgeToDummyNodes.get(y),m=0;m<b.length;m++){var E=b[m],x=new c(E.getCenterX(),E.getCenterY()),S=y.bendpoints.get(m);S.x=x.x,S.y=x.y,E.getOwner().remove(E)}this.graphManager.add(y,y.source,y.target)}}},d.transform=function(p,g,y,b){if(y!=null&&b!=null){var m=g;if(p<=50){var E=g/y;m-=(g-E)/50*(50-p)}else{var x=g*b;m+=(x-g)/50*(p-50)}return m}else{var S,w;return p<=50?(S=9*g/500,w=g/10):(S=9*g/50,w=-8*g),S*p+w}},d.findCenterOfTree=function(p){var g=[];g=g.concat(p);var y=[],b=new Map,m=!1,E=null;(g.length==1||g.length==2)&&(m=!0,E=g[0]);for(var x=0;x<g.length;x++){var S=g[x],w=S.getNeighborsList().size;b.set(S,S.getNeighborsList().size),w==1&&y.push(S)}var T=[];for(T=T.concat(y);!m;){var C=[];C=C.concat(T),T=[];for(var x=0;x<g.length;x++){var S=g[x],D=g.indexOf(S);D>=0&&g.splice(D,1);var A=S.getNeighborsList();A.forEach(function(I){if(y.indexOf(I)<0){var O=b.get(I),N=O-1;N==1&&T.push(I),b.set(I,N)}})}y=y.concat(T),(g.length==1||g.length==2)&&(m=!0,E=g[0])}return E},d.prototype.setGraphManager=function(p){this.graphManager=p},t.exports=d},function(t,a,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},t.exports=i},function(t,a,n){var i=n(4);function s(o,u){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}s.prototype.getWorldOrgX=function(){return this.lworldOrgX},s.prototype.setWorldOrgX=function(o){this.lworldOrgX=o},s.prototype.getWorldOrgY=function(){return this.lworldOrgY},s.prototype.setWorldOrgY=function(o){this.lworldOrgY=o},s.prototype.getWorldExtX=function(){return this.lworldExtX},s.prototype.setWorldExtX=function(o){this.lworldExtX=o},s.prototype.getWorldExtY=function(){return this.lworldExtY},s.prototype.setWorldExtY=function(o){this.lworldExtY=o},s.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},s.prototype.setDeviceOrgX=function(o){this.ldeviceOrgX=o},s.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},s.prototype.setDeviceOrgY=function(o){this.ldeviceOrgY=o},s.prototype.getDeviceExtX=function(){return this.ldeviceExtX},s.prototype.setDeviceExtX=function(o){this.ldeviceExtX=o},s.prototype.getDeviceExtY=function(){return this.ldeviceExtY},s.prototype.setDeviceExtY=function(o){this.ldeviceExtY=o},s.prototype.transformX=function(o){var u=0,l=this.lworldExtX;return l!=0&&(u=this.ldeviceOrgX+(o-this.lworldOrgX)*this.ldeviceExtX/l),u},s.prototype.transformY=function(o){var u=0,l=this.lworldExtY;return l!=0&&(u=this.ldeviceOrgY+(o-this.lworldOrgY)*this.ldeviceExtY/l),u},s.prototype.inverseTransformX=function(o){var u=0,l=this.ldeviceExtX;return l!=0&&(u=this.lworldOrgX+(o-this.ldeviceOrgX)*this.lworldExtX/l),u},s.prototype.inverseTransformY=function(o){var u=0,l=this.ldeviceExtY;return l!=0&&(u=this.lworldOrgY+(o-this.ldeviceOrgY)*this.lworldExtY/l),u},s.prototype.inverseTransformPoint=function(o){var u=new i(this.inverseTransformX(o.x),this.inverseTransformY(o.y));return u},t.exports=s},function(t,a,n){function i(h){if(Array.isArray(h)){for(var d=0,p=Array(h.length);d<h.length;d++)p[d]=h[d];return p}else return Array.from(h)}var s=n(15),o=n(7),u=n(0),l=n(8),f=n(9);function c(){s.call(this),this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.springConstant=o.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=o.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=o.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=o.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=o.MAX_ITERATIONS}c.prototype=Object.create(s.prototype);for(var v in s)c[v]=s[v];c.prototype.initParameters=function(){s.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},c.prototype.calcIdealEdgeLengths=function(){for(var h,d,p,g,y,b,m=this.getGraphManager().getAllEdges(),E=0;E<m.length;E++)h=m[E],h.idealLength=this.idealEdgeLength,h.isInterGraph&&(p=h.getSource(),g=h.getTarget(),y=h.getSourceInLca().getEstimatedSize(),b=h.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(h.idealLength+=y+b-2*u.SIMPLE_NODE_SIZE),d=h.getLca().getInclusionTreeDepth(),h.idealLength+=o.DEFAULT_EDGE_LENGTH*o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(p.getInclusionTreeDepth()+g.getInclusionTreeDepth()-2*d))},c.prototype.initSpringEmbedder=function(){var h=this.getAllNodes().length;this.incremental?(h>o.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*o.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-o.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT_INCREMENTAL):(h>o.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(o.COOLING_ADAPTATION_FACTOR,1-(h-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*(1-o.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},c.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),d,p=0;p<h.length;p++)d=h[p],this.calcSpringForce(d,d.idealLength)},c.prototype.calcRepulsionForces=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,g,y,b,m=this.getAllNodes(),E;if(this.useFRGridVariant)for(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),E=new Set,p=0;p<m.length;p++)y=m[p],this.calculateRepulsionForceOfANode(y,E,h,d),E.add(y);else for(p=0;p<m.length;p++)for(y=m[p],g=p+1;g<m.length;g++)b=m[g],y.getOwner()==b.getOwner()&&this.calcRepulsionForce(y,b)},c.prototype.calcGravitationalForces=function(){for(var h,d=this.getAllNodesToApplyGravitation(),p=0;p<d.length;p++)h=d[p],this.calcGravitationalForce(h)},c.prototype.moveNodes=function(){for(var h=this.getAllNodes(),d,p=0;p<h.length;p++)d=h[p],d.move()},c.prototype.calcSpringForce=function(h,d){var p=h.getSource(),g=h.getTarget(),y,b,m,E;if(this.uniformLeafNodeSizes&&p.getChild()==null&&g.getChild()==null)h.updateLengthSimple();else if(h.updateLength(),h.isOverlapingSourceAndTarget)return;y=h.getLength(),y!=0&&(b=this.springConstant*(y-d),m=b*(h.lengthX/y),E=b*(h.lengthY/y),p.springForceX+=m,p.springForceY+=E,g.springForceX-=m,g.springForceY-=E)},c.prototype.calcRepulsionForce=function(h,d){var p=h.getRect(),g=d.getRect(),y=new Array(2),b=new Array(4),m,E,x,S,w,T,C;if(p.intersects(g)){l.calcSeparationAmount(p,g,y,o.DEFAULT_EDGE_LENGTH/2),T=2*y[0],C=2*y[1];var D=h.noOfChildren*d.noOfChildren/(h.noOfChildren+d.noOfChildren);h.repulsionForceX-=D*T,h.repulsionForceY-=D*C,d.repulsionForceX+=D*T,d.repulsionForceY+=D*C}else this.uniformLeafNodeSizes&&h.getChild()==null&&d.getChild()==null?(m=g.getCenterX()-p.getCenterX(),E=g.getCenterY()-p.getCenterY()):(l.getIntersection(p,g,b),m=b[2]-b[0],E=b[3]-b[1]),Math.abs(m)<o.MIN_REPULSION_DIST&&(m=f.sign(m)*o.MIN_REPULSION_DIST),Math.abs(E)<o.MIN_REPULSION_DIST&&(E=f.sign(E)*o.MIN_REPULSION_DIST),x=m*m+E*E,S=Math.sqrt(x),w=this.repulsionConstant*h.noOfChildren*d.noOfChildren/x,T=w*m/S,C=w*E/S,h.repulsionForceX-=T,h.repulsionForceY-=C,d.repulsionForceX+=T,d.repulsionForceY+=C},c.prototype.calcGravitationalForce=function(h){var d,p,g,y,b,m,E,x;d=h.getOwner(),p=(d.getRight()+d.getLeft())/2,g=(d.getTop()+d.getBottom())/2,y=h.getCenterX()-p,b=h.getCenterY()-g,m=Math.abs(y)+h.getWidth()/2,E=Math.abs(b)+h.getHeight()/2,h.getOwner()==this.graphManager.getRoot()?(x=d.getEstimatedSize()*this.gravityRangeFactor,(m>x||E>x)&&(h.gravitationForceX=-this.gravityConstant*y,h.gravitationForceY=-this.gravityConstant*b)):(x=d.getEstimatedSize()*this.compoundGravityRangeFactor,(m>x||E>x)&&(h.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*b*this.compoundGravityConstant))},c.prototype.isConverged=function(){var h,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,h||d},c.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},c.prototype.calcNoOfChildrenForAllNodes=function(){for(var h,d=this.graphManager.getAllNodes(),p=0;p<d.length;p++)h=d[p],h.noOfChildren=h.getNoOfChildren()},c.prototype.calcGrid=function(h){var d=0,p=0;d=parseInt(Math.ceil((h.getRight()-h.getLeft())/this.repulsionRange)),p=parseInt(Math.ceil((h.getBottom()-h.getTop())/this.repulsionRange));for(var g=new Array(d),y=0;y<d;y++)g[y]=new Array(p);for(var y=0;y<d;y++)for(var b=0;b<p;b++)g[y][b]=new Array;return g},c.prototype.addNodeToGrid=function(h,d,p){var g=0,y=0,b=0,m=0;g=parseInt(Math.floor((h.getRect().x-d)/this.repulsionRange)),y=parseInt(Math.floor((h.getRect().width+h.getRect().x-d)/this.repulsionRange)),b=parseInt(Math.floor((h.getRect().y-p)/this.repulsionRange)),m=parseInt(Math.floor((h.getRect().height+h.getRect().y-p)/this.repulsionRange));for(var E=g;E<=y;E++)for(var x=b;x<=m;x++)this.grid[E][x].push(h),h.setGridCoordinates(g,y,b,m)},c.prototype.updateGrid=function(){var h,d,p=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),h=0;h<p.length;h++)d=p[h],this.addNodeToGrid(d,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},c.prototype.calculateRepulsionForceOfANode=function(h,d,p,g){if(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&p||g){var y=new Set;h.surrounding=new Array;for(var b,m=this.grid,E=h.startX-1;E<h.finishX+2;E++)for(var x=h.startY-1;x<h.finishY+2;x++)if(!(E<0||x<0||E>=m.length||x>=m[0].length)){for(var S=0;S<m[E][x].length;S++)if(b=m[E][x][S],!(h.getOwner()!=b.getOwner()||h==b)&&!d.has(b)&&!y.has(b)){var w=Math.abs(h.getCenterX()-b.getCenterX())-(h.getWidth()/2+b.getWidth()/2),T=Math.abs(h.getCenterY()-b.getCenterY())-(h.getHeight()/2+b.getHeight()/2);w<=this.repulsionRange&&T<=this.repulsionRange&&y.add(b)}}h.surrounding=[].concat(i(y))}for(E=0;E<h.surrounding.length;E++)this.calcRepulsionForce(h,h.surrounding[E])},c.prototype.calcRepulsionRange=function(){return 0},t.exports=c},function(t,a,n){var i=n(1),s=n(7);function o(l,f,c){i.call(this,l,f,c),this.idealLength=s.DEFAULT_EDGE_LENGTH}o.prototype=Object.create(i.prototype);for(var u in i)o[u]=i[u];t.exports=o},function(t,a,n){var i=n(3);function s(u,l,f,c){i.call(this,u,l,f,c),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}s.prototype=Object.create(i.prototype);for(var o in i)s[o]=i[o];s.prototype.setGridCoordinates=function(u,l,f,c){this.startX=u,this.finishX=l,this.startY=f,this.finishY=c},t.exports=s},function(t,a,n){function i(s,o){this.width=0,this.height=0,s!==null&&o!==null&&(this.height=o,this.width=s)}i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(s){this.width=s},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(s){this.height=s},t.exports=i},function(t,a,n){var i=n(14);function s(){this.map={},this.keys=[]}s.prototype.put=function(o,u){var l=i.createID(o);this.contains(l)||(this.map[l]=u,this.keys.push(o))},s.prototype.contains=function(o){return i.createID(o),this.map[o]!=null},s.prototype.get=function(o){var u=i.createID(o);return this.map[u]},s.prototype.keySet=function(){return this.keys},t.exports=s},function(t,a,n){var i=n(14);function s(){this.set={}}s.prototype.add=function(o){var u=i.createID(o);this.contains(u)||(this.set[u]=o)},s.prototype.remove=function(o){delete this.set[i.createID(o)]},s.prototype.clear=function(){this.set={}},s.prototype.contains=function(o){return this.set[i.createID(o)]==o},s.prototype.isEmpty=function(){return this.size()===0},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAllTo=function(o){for(var u=Object.keys(this.set),l=u.length,f=0;f<l;f++)o.push(this.set[u[f]])},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAll=function(o){for(var u=o.length,l=0;l<u;l++){var f=o[l];this.add(f)}},t.exports=s},function(t,a,n){var i=function(){function l(f,c){for(var v=0;v<c.length;v++){var h=c[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}return function(f,c,v){return c&&l(f.prototype,c),v&&l(f,v),f}}();function s(l,f){if(!(l instanceof f))throw new TypeError("Cannot call a class as a function")}var o=n(11),u=function(){function l(f,c){s(this,l),(c!==null||c!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var v=void 0;f instanceof o?v=f.size():v=f.length,this._quicksort(f,0,v-1)}return i(l,[{key:"_quicksort",value:function(c,v,h){if(v<h){var d=this._partition(c,v,h);this._quicksort(c,v,d),this._quicksort(c,d+1,h)}}},{key:"_partition",value:function(c,v,h){for(var d=this._get(c,v),p=v,g=h;;){for(;this.compareFunction(d,this._get(c,g));)g--;for(;this.compareFunction(this._get(c,p),d);)p++;if(p<g)this._swap(c,p,g),p++,g--;else return g}}},{key:"_get",value:function(c,v){return c instanceof o?c.get_object_at(v):c[v]}},{key:"_set",value:function(c,v,h){c instanceof o?c.set_object_at(v,h):c[v]=h}},{key:"_swap",value:function(c,v,h){var d=this._get(c,v);this._set(c,v,this._get(c,h)),this._set(c,h,d)}},{key:"_defaultCompareFunction",value:function(c,v){return v>c}}]),l}();t.exports=u},function(t,a,n){var i=function(){function u(l,f){for(var c=0;c<f.length;c++){var v=f[c];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(l,v.key,v)}}return function(l,f,c){return f&&u(l.prototype,f),c&&u(l,c),l}}();function s(u,l){if(!(u instanceof l))throw new TypeError("Cannot call a class as a function")}var o=function(){function u(l,f){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;s(this,u),this.sequence1=l,this.sequence2=f,this.match_score=c,this.mismatch_penalty=v,this.gap_penalty=h,this.iMax=l.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.grid[d]=new Array(this.jMax);for(var p=0;p<this.jMax;p++)this.grid[d][p]=0}this.tracebackGrid=new Array(this.iMax);for(var g=0;g<this.iMax;g++){this.tracebackGrid[g]=new Array(this.jMax);for(var y=0;y<this.jMax;y++)this.tracebackGrid[g][y]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return i(u,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var f=1;f<this.jMax;f++)this.grid[0][f]=this.grid[0][f-1]+this.gap_penalty,this.tracebackGrid[0][f]=[!1,!1,!0];for(var c=1;c<this.iMax;c++)this.grid[c][0]=this.grid[c-1][0]+this.gap_penalty,this.tracebackGrid[c][0]=[!1,!0,!1];for(var v=1;v<this.iMax;v++)for(var h=1;h<this.jMax;h++){var d=void 0;this.sequence1[v-1]===this.sequence2[h-1]?d=this.grid[v-1][h-1]+this.match_score:d=this.grid[v-1][h-1]+this.mismatch_penalty;var p=this.grid[v-1][h]+this.gap_penalty,g=this.grid[v][h-1]+this.gap_penalty,y=[d,p,g],b=this.arrayAllMaxIndexes(y);this.grid[v][h]=y[b[0]],this.tracebackGrid[v][h]=[b.includes(0),b.includes(1),b.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var f=[];for(f.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});f[0];){var c=f[0],v=this.tracebackGrid[c.pos[0]][c.pos[1]];v[0]&&f.push({pos:[c.pos[0]-1,c.pos[1]-1],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),v[1]&&f.push({pos:[c.pos[0]-1,c.pos[1]],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:"-"+c.seq2}),v[2]&&f.push({pos:[c.pos[0],c.pos[1]-1],seq1:"-"+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),c.pos[0]===0&&c.pos[1]===0&&this.alignments.push({sequence1:c.seq1,sequence2:c.seq2}),f.shift()}return this.alignments}},{key:"getAllIndexes",value:function(f,c){for(var v=[],h=-1;(h=f.indexOf(c,h+1))!==-1;)v.push(h);return v}},{key:"arrayAllMaxIndexes",value:function(f){return this.getAllIndexes(f,Math.max.apply(null,f))}}]),u}();t.exports=o},function(t,a,n){var i=function(){};i.FDLayout=n(18),i.FDLayoutConstants=n(7),i.FDLayoutEdge=n(19),i.FDLayoutNode=n(20),i.DimensionD=n(21),i.HashMap=n(22),i.HashSet=n(23),i.IGeometry=n(8),i.IMath=n(9),i.Integer=n(10),i.Point=n(12),i.PointD=n(4),i.RandomSeed=n(16),i.RectangleD=n(13),i.Transform=n(17),i.UniqueIDGeneretor=n(14),i.Quicksort=n(24),i.LinkedList=n(11),i.LGraphObject=n(2),i.LGraph=n(5),i.LEdge=n(1),i.LGraphManager=n(6),i.LNode=n(3),i.Layout=n(15),i.LayoutConstants=n(0),i.NeedlemanWunsch=n(25),t.exports=i},function(t,a,n){function i(){this.listeners=[]}var s=i.prototype;s.addListener=function(o,u){this.listeners.push({event:o,callback:u})},s.removeListener=function(o,u){for(var l=this.listeners.length;l>=0;l--){var f=this.listeners[l];f.event===o&&f.callback===u&&this.listeners.splice(l,1)}},s.emit=function(o,u){for(var l=0;l<this.listeners.length;l++){var f=this.listeners[l];o===f.event&&f.callback(u)}},t.exports=i}])})}(En)),En.exports}var km=wn.exports,tf;function Bm(){return tf||(tf=1,function(r,e){(function(a,n){r.exports=n(Nm())})(km,function(t){return function(a){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return a[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=a,i.c=n,i.i=function(s){return s},i.d=function(s,o,u){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:u})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=7)}([function(a,n){a.exports=t},function(a,n,i){var s=i(0).FDLayoutConstants;function o(){}for(var u in s)o[u]=s[u];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=s.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TREE_REDUCTION_ON_INCREMENTAL=!1,a.exports=o},function(a,n,i){var s=i(0).FDLayoutEdge;function o(l,f,c){s.call(this,l,f,c)}o.prototype=Object.create(s.prototype);for(var u in s)o[u]=s[u];a.exports=o},function(a,n,i){var s=i(0).LGraph;function o(l,f,c){s.call(this,l,f,c)}o.prototype=Object.create(s.prototype);for(var u in s)o[u]=s[u];a.exports=o},function(a,n,i){var s=i(0).LGraphManager;function o(l){s.call(this,l)}o.prototype=Object.create(s.prototype);for(var u in s)o[u]=s[u];a.exports=o},function(a,n,i){var s=i(0).FDLayoutNode,o=i(0).IMath;function u(f,c,v,h){s.call(this,f,c,v,h)}u.prototype=Object.create(s.prototype);for(var l in s)u[l]=s[l];u.prototype.move=function(){var f=this.graphManager.getLayout();this.displacementX=f.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=f.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementX=f.coolingFactor*f.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementY=f.coolingFactor*f.maxNodeDisplacement*o.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),f.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},u.prototype.propogateDisplacementToChildren=function(f,c){for(var v=this.getChild().getNodes(),h,d=0;d<v.length;d++)h=v[d],h.getChild()==null?(h.moveBy(f,c),h.displacementX+=f,h.displacementY+=c):h.propogateDisplacementToChildren(f,c)},u.prototype.setPred1=function(f){this.pred1=f},u.prototype.getPred1=function(){return pred1},u.prototype.getPred2=function(){return pred2},u.prototype.setNext=function(f){this.next=f},u.prototype.getNext=function(){return next},u.prototype.setProcessed=function(f){this.processed=f},u.prototype.isProcessed=function(){return processed},a.exports=u},function(a,n,i){var s=i(0).FDLayout,o=i(4),u=i(3),l=i(5),f=i(2),c=i(1),v=i(0).FDLayoutConstants,h=i(0).LayoutConstants,d=i(0).Point,p=i(0).PointD,g=i(0).Layout,y=i(0).Integer,b=i(0).IGeometry,m=i(0).LGraph,E=i(0).Transform;function x(){s.call(this),this.toBeTiled={}}x.prototype=Object.create(s.prototype);for(var S in s)x[S]=s[S];x.prototype.newGraphManager=function(){var w=new o(this);return this.graphManager=w,w},x.prototype.newGraph=function(w){return new u(null,this.graphManager,w)},x.prototype.newNode=function(w){return new l(this.graphManager,w)},x.prototype.newEdge=function(w){return new f(null,null,w)},x.prototype.initParameters=function(){s.prototype.initParameters.call(this,arguments),this.isSubLayout||(c.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=c.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=c.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=v.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=v.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=v.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=v.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=v.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=v.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/v.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=v.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},x.prototype.layout=function(){var w=h.DEFAULT_CREATE_BENDS_AS_NEEDED;return w&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},x.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(c.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var T=new Set(this.getAllNodes()),C=this.nodesWithGravity.filter(function(L){return T.has(L)});this.graphManager.setAllNodesToApplyGravitation(C)}}else{var w=this.getFlatForest();if(w.length>0)this.positionNodesRadially(w);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var T=new Set(this.getAllNodes()),C=this.nodesWithGravity.filter(function(D){return T.has(D)});this.graphManager.setAllNodesToApplyGravitation(C),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},x.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%v.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var w=new Set(this.getAllNodes()),T=this.nodesWithGravity.filter(function(A){return w.has(A)});this.graphManager.setAllNodesToApplyGravitation(T),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=v.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=v.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var C=!this.isTreeGrowing&&!this.isGrowthFinished,D=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(C,D),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},x.prototype.getPositionsData=function(){for(var w=this.graphManager.getAllNodes(),T={},C=0;C<w.length;C++){var D=w[C].rect,A=w[C].id;T[A]={id:A,x:D.getCenterX(),y:D.getCenterY(),w:D.width,h:D.height}}return T},x.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var w=!1;if(v.ANIMATE==="during")this.emit("layoutstarted");else{for(;!w;)w=this.tick();this.graphManager.updateBounds()}},x.prototype.calculateNodesToApplyGravitationTo=function(){var w=[],T,C=this.graphManager.getGraphs(),D=C.length,A;for(A=0;A<D;A++)T=C[A],T.updateConnected(),T.isConnected||(w=w.concat(T.getNodes()));return w},x.prototype.createBendpoints=function(){var w=[];w=w.concat(this.graphManager.getAllEdges());var T=new Set,C;for(C=0;C<w.length;C++){var D=w[C];if(!T.has(D)){var A=D.getSource(),L=D.getTarget();if(A==L)D.getBendpoints().push(new p),D.getBendpoints().push(new p),this.createDummyNodesForBendpoints(D),T.add(D);else{var R=[];if(R=R.concat(A.getEdgeListToNode(L)),R=R.concat(L.getEdgeListToNode(A)),!T.has(R[0])){if(R.length>1){var I;for(I=0;I<R.length;I++){var O=R[I];O.getBendpoints().push(new p),this.createDummyNodesForBendpoints(O)}}R.forEach(function(N){T.add(N)})}}}if(T.size==w.length)break}},x.prototype.positionNodesRadially=function(w){for(var T=new d(0,0),C=Math.ceil(Math.sqrt(w.length)),D=0,A=0,L=0,R=new p(0,0),I=0;I<w.length;I++){I%C==0&&(L=0,A=D,I!=0&&(A+=c.DEFAULT_COMPONENT_SEPERATION),D=0);var O=w[I],N=g.findCenterOfTree(O);T.x=L,T.y=A,R=x.radialLayout(O,N,T),R.y>D&&(D=Math.floor(R.y)),L=Math.floor(R.x+c.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(h.WORLD_CENTER_X-R.x/2,h.WORLD_CENTER_Y-R.y/2))},x.radialLayout=function(w,T,C){var D=Math.max(this.maxDiagonalInTree(w),c.DEFAULT_RADIAL_SEPARATION);x.branchRadialLayout(T,null,0,359,0,D);var A=m.calculateBounds(w),L=new E;L.setDeviceOrgX(A.getMinX()),L.setDeviceOrgY(A.getMinY()),L.setWorldOrgX(C.x),L.setWorldOrgY(C.y);for(var R=0;R<w.length;R++){var I=w[R];I.transform(L)}var O=new p(A.getMaxX(),A.getMaxY());return L.inverseTransformPoint(O)},x.branchRadialLayout=function(w,T,C,D,A,L){var R=(D-C+1)/2;R<0&&(R+=180);var I=(R+C)%360,O=I*b.TWO_PI/360,N=A*Math.cos(O),k=A*Math.sin(O);w.setCenter(N,k);var P=[];P=P.concat(w.getEdges());var B=P.length;T!=null&&B--;for(var _=0,F=P.length,G,U=w.getEdgesBetween(T);U.length>1;){var H=U[0];U.splice(0,1);var X=P.indexOf(H);X>=0&&P.splice(X,1),F--,B--}T!=null?G=(P.indexOf(U[0])+1)%F:G=0;for(var $=Math.abs(D-C)/B,Q=G;_!=B;Q=++Q%F){var re=P[Q].getOtherEnd(w);if(re!=T){var J=(C+_*$)%360,z=(J+$)%360;x.branchRadialLayout(re,w,J,z,A+L,L),_++}}},x.maxDiagonalInTree=function(w){for(var T=y.MIN_VALUE,C=0;C<w.length;C++){var D=w[C],A=D.getDiagonal();A>T&&(T=A)}return T},x.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},x.prototype.groupZeroDegreeMembers=function(){var w=this,T={};this.memberGroups={},this.idToDummyNode={};for(var C=[],D=this.graphManager.getAllNodes(),A=0;A<D.length;A++){var L=D[A],R=L.getParent();this.getNodeDegreeWithChildren(L)===0&&(R.id==null||!this.getToBeTiled(R))&&C.push(L)}for(var A=0;A<C.length;A++){var L=C[A],I=L.getParent().id;typeof T[I]>"u"&&(T[I]=[]),T[I]=T[I].concat(L)}Object.keys(T).forEach(function(O){if(T[O].length>1){var N="DummyCompound_"+O;w.memberGroups[N]=T[O];var k=T[O][0].getParent(),P=new l(w.graphManager);P.id=N,P.paddingLeft=k.paddingLeft||0,P.paddingRight=k.paddingRight||0,P.paddingBottom=k.paddingBottom||0,P.paddingTop=k.paddingTop||0,w.idToDummyNode[N]=P;var B=w.getGraphManager().add(w.newGraph(),P),_=k.getChild();_.add(P);for(var F=0;F<T[O].length;F++){var G=T[O][F];_.remove(G),B.add(G)}}})},x.prototype.clearCompounds=function(){var w={},T={};this.performDFSOnCompounds();for(var C=0;C<this.compoundOrder.length;C++)T[this.compoundOrder[C].id]=this.compoundOrder[C],w[this.compoundOrder[C].id]=[].concat(this.compoundOrder[C].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[C].getChild()),this.compoundOrder[C].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(w,T)},x.prototype.clearZeroDegreeMembers=function(){var w=this,T=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(C){var D=w.idToDummyNode[C];T[C]=w.tileNodes(w.memberGroups[C],D.paddingLeft+D.paddingRight),D.rect.width=T[C].width,D.rect.height=T[C].height})},x.prototype.repopulateCompounds=function(){for(var w=this.compoundOrder.length-1;w>=0;w--){var T=this.compoundOrder[w],C=T.id,D=T.paddingLeft,A=T.paddingTop;this.adjustLocations(this.tiledMemberPack[C],T.rect.x,T.rect.y,D,A)}},x.prototype.repopulateZeroDegreeMembers=function(){var w=this,T=this.tiledZeroDegreePack;Object.keys(T).forEach(function(C){var D=w.idToDummyNode[C],A=D.paddingLeft,L=D.paddingTop;w.adjustLocations(T[C],D.rect.x,D.rect.y,A,L)})},x.prototype.getToBeTiled=function(w){var T=w.id;if(this.toBeTiled[T]!=null)return this.toBeTiled[T];var C=w.getChild();if(C==null)return this.toBeTiled[T]=!1,!1;for(var D=C.getNodes(),A=0;A<D.length;A++){var L=D[A];if(this.getNodeDegree(L)>0)return this.toBeTiled[T]=!1,!1;if(L.getChild()==null){this.toBeTiled[L.id]=!1;continue}if(!this.getToBeTiled(L))return this.toBeTiled[T]=!1,!1}return this.toBeTiled[T]=!0,!0},x.prototype.getNodeDegree=function(w){w.id;for(var T=w.getEdges(),C=0,D=0;D<T.length;D++){var A=T[D];A.getSource().id!==A.getTarget().id&&(C=C+1)}return C},x.prototype.getNodeDegreeWithChildren=function(w){var T=this.getNodeDegree(w);if(w.getChild()==null)return T;for(var C=w.getChild().getNodes(),D=0;D<C.length;D++){var A=C[D];T+=this.getNodeDegreeWithChildren(A)}return T},x.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},x.prototype.fillCompexOrderByDFS=function(w){for(var T=0;T<w.length;T++){var C=w[T];C.getChild()!=null&&this.fillCompexOrderByDFS(C.getChild().getNodes()),this.getToBeTiled(C)&&this.compoundOrder.push(C)}},x.prototype.adjustLocations=function(w,T,C,D,A){T+=D,C+=A;for(var L=T,R=0;R<w.rows.length;R++){var I=w.rows[R];T=L;for(var O=0,N=0;N<I.length;N++){var k=I[N];k.rect.x=T,k.rect.y=C,T+=k.rect.width+w.horizontalPadding,k.rect.height>O&&(O=k.rect.height)}C+=O+w.verticalPadding}},x.prototype.tileCompoundMembers=function(w,T){var C=this;this.tiledMemberPack=[],Object.keys(w).forEach(function(D){var A=T[D];C.tiledMemberPack[D]=C.tileNodes(w[D],A.paddingLeft+A.paddingRight),A.rect.width=C.tiledMemberPack[D].width,A.rect.height=C.tiledMemberPack[D].height})},x.prototype.tileNodes=function(w,T){var C=c.TILING_PADDING_VERTICAL,D=c.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:T,verticalPadding:C,horizontalPadding:D};w.sort(function(I,O){return I.rect.width*I.rect.height>O.rect.width*O.rect.height?-1:I.rect.width*I.rect.height<O.rect.width*O.rect.height?1:0});for(var L=0;L<w.length;L++){var R=w[L];A.rows.length==0?this.insertNodeToRow(A,R,0,T):this.canAddHorizontal(A,R.rect.width,R.rect.height)?this.insertNodeToRow(A,R,this.getShortestRowIndex(A),T):this.insertNodeToRow(A,R,A.rows.length,T),this.shiftToLastRow(A)}return A},x.prototype.insertNodeToRow=function(w,T,C,D){var A=D;if(C==w.rows.length){var L=[];w.rows.push(L),w.rowWidth.push(A),w.rowHeight.push(0)}var R=w.rowWidth[C]+T.rect.width;w.rows[C].length>0&&(R+=w.horizontalPadding),w.rowWidth[C]=R,w.width<R&&(w.width=R);var I=T.rect.height;C>0&&(I+=w.verticalPadding);var O=0;I>w.rowHeight[C]&&(O=w.rowHeight[C],w.rowHeight[C]=I,O=w.rowHeight[C]-O),w.height+=O,w.rows[C].push(T)},x.prototype.getShortestRowIndex=function(w){for(var T=-1,C=Number.MAX_VALUE,D=0;D<w.rows.length;D++)w.rowWidth[D]<C&&(T=D,C=w.rowWidth[D]);return T},x.prototype.getLongestRowIndex=function(w){for(var T=-1,C=Number.MIN_VALUE,D=0;D<w.rows.length;D++)w.rowWidth[D]>C&&(T=D,C=w.rowWidth[D]);return T},x.prototype.canAddHorizontal=function(w,T,C){var D=this.getShortestRowIndex(w);if(D<0)return!0;var A=w.rowWidth[D];if(A+w.horizontalPadding+T<=w.width)return!0;var L=0;w.rowHeight[D]<C&&D>0&&(L=C+w.verticalPadding-w.rowHeight[D]);var R;w.width-A>=T+w.horizontalPadding?R=(w.height+L)/(A+T+w.horizontalPadding):R=(w.height+L)/w.width,L=C+w.verticalPadding;var I;return w.width<T?I=(w.height+L)/T:I=(w.height+L)/w.width,I<1&&(I=1/I),R<1&&(R=1/R),R<I},x.prototype.shiftToLastRow=function(w){var T=this.getLongestRowIndex(w),C=w.rowWidth.length-1,D=w.rows[T],A=D[D.length-1],L=A.width+w.horizontalPadding;if(w.width-w.rowWidth[C]>L&&T!=C){D.splice(-1,1),w.rows[C].push(A),w.rowWidth[T]=w.rowWidth[T]-L,w.rowWidth[C]=w.rowWidth[C]+L,w.width=w.rowWidth[instance.getLongestRowIndex(w)];for(var R=Number.MIN_VALUE,I=0;I<D.length;I++)D[I].height>R&&(R=D[I].height);T>0&&(R+=w.verticalPadding);var O=w.rowHeight[T]+w.rowHeight[C];w.rowHeight[T]=R,w.rowHeight[C]<A.height+w.verticalPadding&&(w.rowHeight[C]=A.height+w.verticalPadding);var N=w.rowHeight[T]+w.rowHeight[C];w.height+=N-O,this.shiftToLastRow(w)}},x.prototype.tilingPreLayout=function(){c.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},x.prototype.tilingPostLayout=function(){c.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},x.prototype.reduceTrees=function(){for(var w=[],T=!0,C;T;){var D=this.graphManager.getAllNodes(),A=[];T=!1;for(var L=0;L<D.length;L++)C=D[L],C.getEdges().length==1&&!C.getEdges()[0].isInterGraph&&C.getChild()==null&&(A.push([C,C.getEdges()[0],C.getOwner()]),T=!0);if(T==!0){for(var R=[],I=0;I<A.length;I++)A[I][0].getEdges().length==1&&(R.push(A[I]),A[I][0].getOwner().remove(A[I][0]));w.push(R),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=w},x.prototype.growTree=function(w){for(var T=w.length,C=w[T-1],D,A=0;A<C.length;A++)D=C[A],this.findPlaceforPrunedNode(D),D[2].add(D[0]),D[2].add(D[1],D[1].source,D[1].target);w.splice(w.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},x.prototype.findPlaceforPrunedNode=function(w){var T,C,D=w[0];D==w[1].source?C=w[1].target:C=w[1].source;var A=C.startX,L=C.finishX,R=C.startY,I=C.finishY,O=0,N=0,k=0,P=0,B=[O,k,N,P];if(R>0)for(var _=A;_<=L;_++)B[0]+=this.grid[_][R-1].length+this.grid[_][R].length-1;if(L<this.grid.length-1)for(var _=R;_<=I;_++)B[1]+=this.grid[L+1][_].length+this.grid[L][_].length-1;if(I<this.grid[0].length-1)for(var _=A;_<=L;_++)B[2]+=this.grid[_][I+1].length+this.grid[_][I].length-1;if(A>0)for(var _=R;_<=I;_++)B[3]+=this.grid[A-1][_].length+this.grid[A][_].length-1;for(var F=y.MAX_VALUE,G,U,H=0;H<B.length;H++)B[H]<F?(F=B[H],G=1,U=H):B[H]==F&&G++;if(G==3&&F==0)B[0]==0&&B[1]==0&&B[2]==0?T=1:B[0]==0&&B[1]==0&&B[3]==0?T=0:B[0]==0&&B[2]==0&&B[3]==0?T=3:B[1]==0&&B[2]==0&&B[3]==0&&(T=2);else if(G==2&&F==0){var X=Math.floor(Math.random()*2);B[0]==0&&B[1]==0?X==0?T=0:T=1:B[0]==0&&B[2]==0?X==0?T=0:T=2:B[0]==0&&B[3]==0?X==0?T=0:T=3:B[1]==0&&B[2]==0?X==0?T=1:T=2:B[1]==0&&B[3]==0?X==0?T=1:T=3:X==0?T=2:T=3}else if(G==4&&F==0){var X=Math.floor(Math.random()*4);T=X}else T=U;T==0?D.setCenter(C.getCenterX(),C.getCenterY()-C.getHeight()/2-v.DEFAULT_EDGE_LENGTH-D.getHeight()/2):T==1?D.setCenter(C.getCenterX()+C.getWidth()/2+v.DEFAULT_EDGE_LENGTH+D.getWidth()/2,C.getCenterY()):T==2?D.setCenter(C.getCenterX(),C.getCenterY()+C.getHeight()/2+v.DEFAULT_EDGE_LENGTH+D.getHeight()/2):D.setCenter(C.getCenterX()-C.getWidth()/2-v.DEFAULT_EDGE_LENGTH-D.getWidth()/2,C.getCenterY())},a.exports=x},function(a,n,i){var s={};s.layoutBase=i(0),s.CoSEConstants=i(1),s.CoSEEdge=i(2),s.CoSEGraph=i(3),s.CoSEGraphManager=i(4),s.CoSELayout=i(6),s.CoSENode=i(5),a.exports=s}])})}(wn)),wn.exports}var Fm=bn.exports,rf;function _m(){return rf||(rf=1,function(r,e){(function(a,n){r.exports=n(Bm())})(Fm,function(t){return function(a){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return a[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=a,i.c=n,i.i=function(s){return s},i.d=function(s,o,u){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:u})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=1)}([function(a,n){a.exports=t},function(a,n,i){var s=i(0).layoutBase.LayoutConstants,o=i(0).layoutBase.FDLayoutConstants,u=i(0).CoSEConstants,l=i(0).CoSELayout,f=i(0).CoSENode,c=i(0).layoutBase.PointD,v=i(0).layoutBase.DimensionD,h={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(b,m){var E={};for(var x in b)E[x]=b[x];for(var x in m)E[x]=m[x];return E}function p(b){this.options=d(h,b),g(this.options)}var g=function(m){m.nodeRepulsion!=null&&(u.DEFAULT_REPULSION_STRENGTH=o.DEFAULT_REPULSION_STRENGTH=m.nodeRepulsion),m.idealEdgeLength!=null&&(u.DEFAULT_EDGE_LENGTH=o.DEFAULT_EDGE_LENGTH=m.idealEdgeLength),m.edgeElasticity!=null&&(u.DEFAULT_SPRING_STRENGTH=o.DEFAULT_SPRING_STRENGTH=m.edgeElasticity),m.nestingFactor!=null&&(u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=m.nestingFactor),m.gravity!=null&&(u.DEFAULT_GRAVITY_STRENGTH=o.DEFAULT_GRAVITY_STRENGTH=m.gravity),m.numIter!=null&&(u.MAX_ITERATIONS=o.MAX_ITERATIONS=m.numIter),m.gravityRange!=null&&(u.DEFAULT_GRAVITY_RANGE_FACTOR=o.DEFAULT_GRAVITY_RANGE_FACTOR=m.gravityRange),m.gravityCompound!=null&&(u.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=m.gravityCompound),m.gravityRangeCompound!=null&&(u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=m.gravityRangeCompound),m.initialEnergyOnIncremental!=null&&(u.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.DEFAULT_COOLING_FACTOR_INCREMENTAL=m.initialEnergyOnIncremental),m.quality=="draft"?s.QUALITY=0:m.quality=="proof"?s.QUALITY=2:s.QUALITY=1,u.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=s.NODE_DIMENSIONS_INCLUDE_LABELS=m.nodeDimensionsIncludeLabels,u.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=!m.randomize,u.ANIMATE=o.ANIMATE=s.ANIMATE=m.animate,u.TILE=m.tile,u.TILING_PADDING_VERTICAL=typeof m.tilingPaddingVertical=="function"?m.tilingPaddingVertical.call():m.tilingPaddingVertical,u.TILING_PADDING_HORIZONTAL=typeof m.tilingPaddingHorizontal=="function"?m.tilingPaddingHorizontal.call():m.tilingPaddingHorizontal};p.prototype.run=function(){var b,m,E=this.options;this.idToLNode={};var x=this.layout=new l,S=this;S.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var w=x.newGraphManager();this.gm=w;var T=this.options.eles.nodes(),C=this.options.eles.edges();this.root=w.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(T),x);for(var D=0;D<C.length;D++){var A=C[D],L=this.idToLNode[A.data("source")],R=this.idToLNode[A.data("target")];if(L!==R&&L.getEdgesBetween(R).length==0){var I=w.add(x.newEdge(),L,R);I.id=A.id()}}var O=function(P,B){typeof P=="number"&&(P=B);var _=P.data("id"),F=S.idToLNode[_];return{x:F.getRect().getCenterX(),y:F.getRect().getCenterY()}},N=function k(){for(var P=function(){E.fit&&E.cy.fit(E.eles,E.padding),b||(b=!0,S.cy.one("layoutready",E.ready),S.cy.trigger({type:"layoutready",layout:S}))},B=S.options.refresh,_,F=0;F<B&&!_;F++)_=S.stopped||S.layout.tick();if(_){x.checkLayoutSuccess()&&!x.isSubLayout&&x.doPostLayout(),x.tilingPostLayout&&x.tilingPostLayout(),x.isLayoutFinished=!0,S.options.eles.nodes().positions(O),P(),S.cy.one("layoutstop",S.options.stop),S.cy.trigger({type:"layoutstop",layout:S}),m&&cancelAnimationFrame(m),b=!1;return}var G=S.layout.getPositionsData();E.eles.nodes().positions(function(U,H){if(typeof U=="number"&&(U=H),!U.isParent()){for(var X=U.id(),$=G[X],Q=U;$==null&&($=G[Q.data("parent")]||G["DummyCompound_"+Q.data("parent")],G[X]=$,Q=Q.parent()[0],Q!=null););return $!=null?{x:$.x,y:$.y}:{x:U.position("x"),y:U.position("y")}}}),P(),m=requestAnimationFrame(k)};return x.addListener("layoutstarted",function(){S.options.animate==="during"&&(m=requestAnimationFrame(N))}),x.runLayout(),this.options.animate!=="during"&&(S.options.eles.nodes().not(":parent").layoutPositions(S,S.options,O),b=!1),this},p.prototype.getTopMostNodes=function(b){for(var m={},E=0;E<b.length;E++)m[b[E].id()]=!0;var x=b.filter(function(S,w){typeof S=="number"&&(S=w);for(var T=S.parent()[0];T!=null;){if(m[T.id()])return!1;T=T.parent()[0]}return!0});return x},p.prototype.processChildrenList=function(b,m,E){for(var x=m.length,S=0;S<x;S++){var w=m[S],T=w.children(),C,D=w.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(w.outerWidth()!=null&&w.outerHeight()!=null?C=b.add(new f(E.graphManager,new c(w.position("x")-D.w/2,w.position("y")-D.h/2),new v(parseFloat(D.w),parseFloat(D.h)))):C=b.add(new f(this.graphManager)),C.id=w.data("id"),C.paddingLeft=parseInt(w.css("padding")),C.paddingTop=parseInt(w.css("padding")),C.paddingRight=parseInt(w.css("padding")),C.paddingBottom=parseInt(w.css("padding")),this.options.nodeDimensionsIncludeLabels&&w.isParent()){var A=w.boundingBox({includeLabels:!0,includeNodes:!1}).w,L=w.boundingBox({includeLabels:!0,includeNodes:!1}).h,R=w.css("text-halign");C.labelWidth=A,C.labelHeight=L,C.labelPos=R}if(this.idToLNode[w.data("id")]=C,isNaN(C.rect.x)&&(C.rect.x=0),isNaN(C.rect.y)&&(C.rect.y=0),T!=null&&T.length>0){var I;I=E.getGraphManager().add(E.newGraph(),C),this.processChildrenList(I,T,E)}}},p.prototype.stop=function(){return this.stopped=!0,this};var y=function(m){m("layout","cose-bilkent",p)};typeof cytoscape<"u"&&y(cytoscape),a.exports=y}])})}(bn)),bn.exports}var Gm=_m();const zm=iv.getDefaultExportFromCjs(Gm);var Qs=function(){var r=function(E,x,S,w){for(S=S||{},w=E.length;w--;S[E[w]]=x);return S},e=[1,4],t=[1,13],a=[1,12],n=[1,15],i=[1,16],s=[1,20],o=[1,19],u=[6,7,8],l=[1,26],f=[1,24],c=[1,25],v=[6,7,11],h=[1,6,13,15,16,19,22],d=[1,33],p=[1,34],g=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(x,S,w,T,C,D,A){var L=D.length-1;switch(C){case 6:case 7:return T;case 8:T.getLogger().trace("Stop NL ");break;case 9:T.getLogger().trace("Stop EOF ");break;case 11:T.getLogger().trace("Stop NL2 ");break;case 12:T.getLogger().trace("Stop EOF2 ");break;case 15:T.getLogger().info("Node: ",D[L].id),T.addNode(D[L-1].length,D[L].id,D[L].descr,D[L].type);break;case 16:T.getLogger().trace("Icon: ",D[L]),T.decorateNode({icon:D[L]});break;case 17:case 21:T.decorateNode({class:D[L]});break;case 18:T.getLogger().trace("SPACELIST");break;case 19:T.getLogger().trace("Node: ",D[L].id),T.addNode(0,D[L].id,D[L].descr,D[L].type);break;case 20:T.decorateNode({icon:D[L]});break;case 25:T.getLogger().trace("node found ..",D[L-2]),this.$={id:D[L-1],descr:D[L-1],type:T.getType(D[L-2],D[L])};break;case 26:this.$={id:D[L],descr:D[L],type:T.nodeType.DEFAULT};break;case 27:T.getLogger().trace("node found ..",D[L-3]),this.$={id:D[L-3],descr:D[L-1],type:T.getType(D[L-2],D[L])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:t,7:[1,10],9:9,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},r(u,[2,3]),{1:[2,2]},r(u,[2,4]),r(u,[2,5]),{1:[2,6],6:t,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:t,9:22,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:l,7:f,10:23,11:c},r(v,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),r(v,[2,18]),r(v,[2,19]),r(v,[2,20]),r(v,[2,21]),r(v,[2,23]),r(v,[2,24]),r(v,[2,26],{19:[1,30]}),{20:[1,31]},{6:l,7:f,10:32,11:c},{1:[2,7],6:t,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},r(h,[2,14],{7:d,11:p}),r(g,[2,8]),r(g,[2,9]),r(g,[2,10]),r(v,[2,15]),r(v,[2,16]),r(v,[2,17]),{20:[1,35]},{21:[1,36]},r(h,[2,13],{7:d,11:p}),r(g,[2,11]),r(g,[2,12]),{21:[1,37]},r(v,[2,25]),r(v,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(x,S){if(S.recoverable)this.trace(x);else{var w=new Error(x);throw w.hash=S,w}},parse:function(x){var S=this,w=[0],T=[],C=[null],D=[],A=this.table,L="",R=0,I=0,O=2,N=1,k=D.slice.call(arguments,1),P=Object.create(this.lexer),B={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(B.yy[_]=this.yy[_]);P.setInput(x,B.yy),B.yy.lexer=P,B.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var F=P.yylloc;D.push(F);var G=P.options&&P.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(){var ne;return ne=T.pop()||P.lex()||N,typeof ne!="number"&&(ne instanceof Array&&(T=ne,ne=T.pop()),ne=S.symbols_[ne]||ne),ne}for(var H,X,$,Q,re={},J,z,V,Y;;){if(X=w[w.length-1],this.defaultActions[X]?$=this.defaultActions[X]:((H===null||typeof H>"u")&&(H=U()),$=A[X]&&A[X][H]),typeof $>"u"||!$.length||!$[0]){var ee="";Y=[];for(J in A[X])this.terminals_[J]&&J>O&&Y.push("'"+this.terminals_[J]+"'");P.showPosition?ee="Parse error on line "+(R+1)+`:
|
|
332
|
-
`+P.showPosition()+`
|
|
333
|
-
Expecting `+Y.join(", ")+", got '"+(this.terminals_[H]||H)+"'":ee="Parse error on line "+(R+1)+": Unexpected "+(H==N?"end of input":"'"+(this.terminals_[H]||H)+"'"),this.parseError(ee,{text:P.match,token:this.terminals_[H]||H,line:P.yylineno,loc:F,expected:Y})}if($[0]instanceof Array&&$.length>1)throw new Error("Parse Error: multiple actions possible at state: "+X+", token: "+H);switch($[0]){case 1:w.push(H),C.push(P.yytext),D.push(P.yylloc),w.push($[1]),H=null,I=P.yyleng,L=P.yytext,R=P.yylineno,F=P.yylloc;break;case 2:if(z=this.productions_[$[1]][1],re.$=C[C.length-z],re._$={first_line:D[D.length-(z||1)].first_line,last_line:D[D.length-1].last_line,first_column:D[D.length-(z||1)].first_column,last_column:D[D.length-1].last_column},G&&(re._$.range=[D[D.length-(z||1)].range[0],D[D.length-1].range[1]]),Q=this.performAction.apply(re,[L,I,R,B.yy,$[1],C,D].concat(k)),typeof Q<"u")return Q;z&&(w=w.slice(0,-1*z*2),C=C.slice(0,-1*z),D=D.slice(0,-1*z)),w.push(this.productions_[$[1]][0]),C.push(re.$),D.push(re._$),V=A[w[w.length-2]][w[w.length-1]],w.push(V);break;case 3:return!0}}return!0}},b=function(){var E={EOF:1,parseError:function(S,w){if(this.yy.parser)this.yy.parser.parseError(S,w);else throw new Error(S)},setInput:function(x,S){return this.yy=S||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var S=x.match(/(?:\r\n?|\n).*/g);return S?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},unput:function(x){var S=x.length,w=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-S),this.offset-=S;var T=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),w.length-1&&(this.yylineno-=w.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:w?(w.length===T.length?this.yylloc.first_column:0)+T[T.length-w.length].length-w[0].length:this.yylloc.first_column-S},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-S]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
334
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(x){this.unput(this.match.slice(x))},pastInput:function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var x=this.pastInput(),S=new Array(x.length+1).join("-");return x+this.upcomingInput()+`
|
|
335
|
-
`+S+"^"},test_match:function(x,S){var w,T,C;if(this.options.backtrack_lexer&&(C={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(C.yylloc.range=this.yylloc.range.slice(0))),T=x[0].match(/(?:\r\n?|\n).*/g),T&&(this.yylineno+=T.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:T?T[T.length-1].length-T[T.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(x[0].length),this.matched+=x[0],w=this.performAction.call(this,this.yy,this,S,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),w)return w;if(this._backtrack){for(var D in C)this[D]=C[D];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,S,w,T;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),D=0;D<C.length;D++)if(w=this._input.match(this.rules[C[D]]),w&&(!S||w[0].length>S[0].length)){if(S=w,T=D,this.options.backtrack_lexer){if(x=this.test_match(w,C[D]),x!==!1)return x;if(this._backtrack){S=!1;continue}else return!1}else if(!this.options.flex)break}return S?(x=this.test_match(S,C[T]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
336
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var S=this.next();return S||this.lex()},begin:function(S){this.conditionStack.push(S)},popState:function(){var S=this.conditionStack.length-1;return S>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(S){return S=this.conditionStack.length-1-Math.abs(S||0),S>=0?this.conditionStack[S]:"INITIAL"},pushState:function(S){this.begin(S)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(S,w,T,C){switch(T){case 0:return S.getLogger().trace("Found comment",w.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:S.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return S.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:S.getLogger().trace("end icon"),this.popState();break;case 10:return S.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return S.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return S.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return S.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:S.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return S.getLogger().trace("description:",w.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),S.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),S.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),S.getLogger().trace("node end ...",w.yytext),"NODE_DEND";case 30:return this.popState(),S.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),S.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),S.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),S.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),S.getLogger().trace("node end (("),"NODE_DEND";case 35:return S.getLogger().trace("Long description:",w.yytext),20;case 36:return S.getLogger().trace("Long description:",w.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return E}();y.lexer=b;function m(){this.yy={}}return m.prototype=y,y.Parser=m,new m}();Qs.parser=Qs;const Vm=Qs;let Bt=[],Xc=0,Co={};const Um=()=>{Bt=[],Xc=0,Co={}},qm=function(r){for(let e=Bt.length-1;e>=0;e--)if(Bt[e].level<r)return Bt[e];return null},Hm=()=>Bt.length>0?Bt[0]:null,Ym=(r,e,t,a)=>{var n,i;Ue.log$1.info("addNode",r,e,t,a);const s=Ue.getConfig();let o=((n=s.mindmap)==null?void 0:n.padding)??Ue.defaultConfig$2.mindmap.padding;switch(a){case tt.ROUNDED_RECT:case tt.RECT:case tt.HEXAGON:o*=2}const u={id:Xc++,nodeId:Ue.sanitizeText$2(e,s),level:r,descr:Ue.sanitizeText$2(t,s),type:a,children:[],width:((i=s.mindmap)==null?void 0:i.maxNodeWidth)??Ue.defaultConfig$2.mindmap.maxNodeWidth,padding:o},l=qm(r);if(l)l.children.push(u),Bt.push(u);else if(Bt.length===0)Bt.push(u);else throw new Error('There can be only one root. No parent could be found for ("'+u.descr+'")')},tt={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},$m=(r,e)=>{switch(Ue.log$1.debug("In get type",r,e),r){case"[":return tt.RECT;case"(":return e===")"?tt.ROUNDED_RECT:tt.CLOUD;case"((":return tt.CIRCLE;case")":return tt.CLOUD;case"))":return tt.BANG;case"{{":return tt.HEXAGON;default:return tt.DEFAULT}},Xm=(r,e)=>{Co[r]=e},Wm=r=>{if(!r)return;const e=Ue.getConfig(),t=Bt[Bt.length-1];r.icon&&(t.icon=Ue.sanitizeText$2(r.icon,e)),r.class&&(t.class=Ue.sanitizeText$2(r.class,e))},Km=r=>{switch(r){case tt.DEFAULT:return"no-border";case tt.RECT:return"rect";case tt.ROUNDED_RECT:return"rounded-rect";case tt.CIRCLE:return"circle";case tt.CLOUD:return"cloud";case tt.BANG:return"bang";case tt.HEXAGON:return"hexgon";default:return"no-border"}},Zm=()=>Ue.log$1,Qm=r=>Co[r],Jm={clear:Um,addNode:Ym,getMindmap:Hm,nodeType:tt,getType:$m,setElementForId:Xm,decorateNode:Wm,type2Str:Km,getLogger:Zm,getElementById:Qm},jm=Jm,e0=12,t0=function(r,e,t,a){e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+r.type2Str(t.type)).attr("d",`M0 ${t.height-5} v${-t.height+2*5} q0,-5 5,-5 h${t.width-2*5} q5,0 5,5 v${t.height-5} H0 Z`),e.append("line").attr("class","node-line-"+a).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},r0=function(r,e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+r.type2Str(t.type)).attr("height",t.height).attr("width",t.width)},a0=function(r,e,t){const a=t.width,n=t.height,i=.15*a,s=.25*a,o=.35*a,u=.2*a;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+r.type2Str(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${a*.25},${-1*a*.1}
|
|
337
|
-
a${o},${o} 1 0,1 ${a*.4},${-1*a*.1}
|
|
338
|
-
a${s},${s} 1 0,1 ${a*.35},${1*a*.2}
|
|
339
|
-
|
|
340
|
-
a${i},${i} 1 0,1 ${a*.15},${1*n*.35}
|
|
341
|
-
a${u},${u} 1 0,1 ${-1*a*.15},${1*n*.65}
|
|
342
|
-
|
|
343
|
-
a${s},${i} 1 0,1 ${-1*a*.25},${a*.15}
|
|
344
|
-
a${o},${o} 1 0,1 ${-1*a*.5},0
|
|
345
|
-
a${i},${i} 1 0,1 ${-1*a*.25},${-1*a*.15}
|
|
346
|
-
|
|
347
|
-
a${i},${i} 1 0,1 ${-1*a*.1},${-1*n*.35}
|
|
348
|
-
a${u},${u} 1 0,1 ${a*.1},${-1*n*.65}
|
|
349
|
-
|
|
350
|
-
H0 V0 Z`)},n0=function(r,e,t){const a=t.width,n=t.height,i=.15*a;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+r.type2Str(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${a*.25},${-1*n*.1}
|
|
351
|
-
a${i},${i} 1 0,0 ${a*.25},0
|
|
352
|
-
a${i},${i} 1 0,0 ${a*.25},0
|
|
353
|
-
a${i},${i} 1 0,0 ${a*.25},${1*n*.1}
|
|
354
|
-
|
|
355
|
-
a${i},${i} 1 0,0 ${a*.15},${1*n*.33}
|
|
356
|
-
a${i*.8},${i*.8} 1 0,0 0,${1*n*.34}
|
|
357
|
-
a${i},${i} 1 0,0 ${-1*a*.15},${1*n*.33}
|
|
358
|
-
|
|
359
|
-
a${i},${i} 1 0,0 ${-1*a*.25},${n*.15}
|
|
360
|
-
a${i},${i} 1 0,0 ${-1*a*.25},0
|
|
361
|
-
a${i},${i} 1 0,0 ${-1*a*.25},0
|
|
362
|
-
a${i},${i} 1 0,0 ${-1*a*.25},${-1*n*.15}
|
|
363
|
-
|
|
364
|
-
a${i},${i} 1 0,0 ${-1*a*.1},${-1*n*.33}
|
|
365
|
-
a${i*.8},${i*.8} 1 0,0 0,${-1*n*.34}
|
|
366
|
-
a${i},${i} 1 0,0 ${a*.1},${-1*n*.33}
|
|
367
|
-
|
|
368
|
-
H0 V0 Z`)},i0=function(r,e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+r.type2Str(t.type)).attr("r",t.width/2)};function s0(r,e,t,a,n){return r.insert("polygon",":first-child").attr("points",a.map(function(i){return i.x+","+i.y}).join(" ")).attr("transform","translate("+(n.width-e)/2+", "+t+")")}const o0=function(r,e,t){const a=t.height,i=a/4,s=t.width-t.padding+2*i,o=[{x:i,y:0},{x:s-i,y:0},{x:s,y:-a/2},{x:s-i,y:-a},{x:i,y:-a},{x:0,y:-a/2}];s0(e,s,a,o,t)},u0=function(r,e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+r.type2Str(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)},l0=function(r,e,t,a,n){const i=n.htmlLabels,s=a%(e0-1),o=e.append("g");t.section=s;let u="section-"+s;s<0&&(u+=" section-root"),o.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+u);const l=o.append("g"),f=o.append("g"),c=t.descr.replace(/(<br\/*>)/g,`
|
|
369
|
-
`);sv.createText(f,c,{useHtmlLabels:i,width:t.width,classes:"mindmap-node-label"}),i||f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const v=f.node().getBBox(),[h]=Ue.parseFontSize(n.fontSize);if(t.height=v.height+h*1.1*.5+t.padding,t.width=v.width+2*t.padding,t.icon)if(t.type===r.nodeType.CIRCLE)t.height+=50,t.width+=50,o.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+t.icon),f.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")");else{t.width+=50;const d=t.height;t.height=Math.max(d,60);const p=Math.abs(t.height-d);o.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+p/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+t.icon),f.attr("transform","translate("+(25+t.width/2)+", "+(p/2+t.padding/2)+")")}else if(i){const d=(t.width-v.width)/2,p=(t.height-v.height)/2;f.attr("transform","translate("+d+", "+p+")")}else{const d=t.width/2,p=t.padding/2;f.attr("transform","translate("+d+", "+p+")")}switch(t.type){case r.nodeType.DEFAULT:t0(r,l,t,s);break;case r.nodeType.ROUNDED_RECT:u0(r,l,t);break;case r.nodeType.RECT:r0(r,l,t);break;case r.nodeType.CIRCLE:l.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),i0(r,l,t);break;case r.nodeType.CLOUD:a0(r,l,t);break;case r.nodeType.BANG:n0(r,l,t);break;case r.nodeType.HEXAGON:o0(r,l,t);break}return r.setElementForId(t.id,o),t.height},f0=function(r,e){const t=r.getElementById(e.id),a=e.x||0,n=e.y||0;t.attr("transform","translate("+a+","+n+")")};hr.use(zm);function Wc(r,e,t,a,n){l0(r,e,t,a,n),t.children&&t.children.forEach((i,s)=>{Wc(r,e,i,a<0?s:a,n)})}function c0(r,e){e.edges().map((t,a)=>{const n=t.data();if(t[0]._private.bodyBounds){const i=t[0]._private.rscratch;Ue.log$1.trace("Edge: ",a,n),r.insert("path").attr("d",`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr("class","edge section-edge-"+n.section+" edge-depth-"+n.depth)}})}function Kc(r,e,t,a){e.add({group:"nodes",data:{id:r.id.toString(),labelText:r.descr,height:r.height,width:r.width,level:a,nodeId:r.id,padding:r.padding,type:r.type},position:{x:r.x,y:r.y}}),r.children&&r.children.forEach(n=>{Kc(n,e,t,a+1),e.add({group:"edges",data:{id:`${r.id}_${n.id}`,source:r.id,target:n.id,depth:a,section:n.section}})})}function v0(r,e){return new Promise(t=>{const a=Ue.select("body").append("div").attr("id","cy").attr("style","display:none"),n=hr({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),Kc(r,n,e,0),n.nodes().forEach(function(i){i.layoutDimensions=()=>{const s=i.data();return{w:s.width,h:s.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(i=>{Ue.log$1.info("Ready",i),t(n)})})}function h0(r,e){e.nodes().map((t,a)=>{const n=t.data();n.x=t.position().x,n.y=t.position().y,f0(r,n);const i=r.getElementById(n.nodeId);Ue.log$1.info("Id:",a,"Position: (",t.position().x,", ",t.position().y,")",n),i.attr("transform",`translate(${t.position().x-n.width/2}, ${t.position().y-n.height/2})`),i.attr("attr",`apa-${a})`)})}const d0=async(r,e,t,a)=>{var n,i;Ue.log$1.debug(`Rendering mindmap diagram
|
|
370
|
-
`+r);const s=a.db,o=s.getMindmap();if(!o)return;const u=Ue.getConfig();u.htmlLabels=!1;const l=Ue.selectSvgElement(e),f=l.append("g");f.attr("class","mindmap-edges");const c=l.append("g");c.attr("class","mindmap-nodes"),Wc(s,c,o,-1,u);const v=await v0(o,u);c0(f,v),h0(s,v),Ue.setupGraphViewbox$1(void 0,l,((n=u.mindmap)==null?void 0:n.padding)??Ue.defaultConfig$2.mindmap.padding,((i=u.mindmap)==null?void 0:i.useMaxWidth)??Ue.defaultConfig$2.mindmap.useMaxWidth)},g0={draw:d0},p0=r=>{let e="";for(let t=0;t<r.THEME_COLOR_LIMIT;t++)r["lineColor"+t]=r["lineColor"+t]||r["cScaleInv"+t],Ue.isDark(r["lineColor"+t])?r["lineColor"+t]=Ue.lighten(r["lineColor"+t],20):r["lineColor"+t]=Ue.darken(r["lineColor"+t],20);for(let t=0;t<r.THEME_COLOR_LIMIT;t++){const a=""+(17-3*t);e+=`
|
|
371
|
-
.section-${t-1} rect, .section-${t-1} path, .section-${t-1} circle, .section-${t-1} polygon, .section-${t-1} path {
|
|
372
|
-
fill: ${r["cScale"+t]};
|
|
373
|
-
}
|
|
374
|
-
.section-${t-1} text {
|
|
375
|
-
fill: ${r["cScaleLabel"+t]};
|
|
376
|
-
}
|
|
377
|
-
.node-icon-${t-1} {
|
|
378
|
-
font-size: 40px;
|
|
379
|
-
color: ${r["cScaleLabel"+t]};
|
|
380
|
-
}
|
|
381
|
-
.section-edge-${t-1}{
|
|
382
|
-
stroke: ${r["cScale"+t]};
|
|
383
|
-
}
|
|
384
|
-
.edge-depth-${t-1}{
|
|
385
|
-
stroke-width: ${a};
|
|
386
|
-
}
|
|
387
|
-
.section-${t-1} line {
|
|
388
|
-
stroke: ${r["cScaleInv"+t]} ;
|
|
389
|
-
stroke-width: 3;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.disabled, .disabled circle, .disabled text {
|
|
393
|
-
fill: lightgray;
|
|
394
|
-
}
|
|
395
|
-
.disabled text {
|
|
396
|
-
fill: #efefef;
|
|
397
|
-
}
|
|
398
|
-
`}return e},y0=r=>`
|
|
399
|
-
.edge {
|
|
400
|
-
stroke-width: 3;
|
|
401
|
-
}
|
|
402
|
-
${p0(r)}
|
|
403
|
-
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
404
|
-
fill: ${r.git0};
|
|
405
|
-
}
|
|
406
|
-
.section-root text {
|
|
407
|
-
fill: ${r.gitBranchLabel0};
|
|
408
|
-
}
|
|
409
|
-
.icon-container {
|
|
410
|
-
height:100%;
|
|
411
|
-
display: flex;
|
|
412
|
-
justify-content: center;
|
|
413
|
-
align-items: center;
|
|
414
|
-
}
|
|
415
|
-
.edge {
|
|
416
|
-
fill: none;
|
|
417
|
-
}
|
|
418
|
-
.mindmap-node-label {
|
|
419
|
-
dy: 1em;
|
|
420
|
-
alignment-baseline: middle;
|
|
421
|
-
text-anchor: middle;
|
|
422
|
-
dominant-baseline: middle;
|
|
423
|
-
text-align: center;
|
|
424
|
-
}
|
|
425
|
-
`,m0=y0,b0={db:jm,renderer:g0,parser:Vm,styles:m0};exports.diagram=b0;
|