@bkm016/basalt 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/{chunk-n981vx1t.js → chunk-0d51ggzj.js} +6 -6
- package/chunk-12trygzx.js +25 -0
- package/{chunk-s6dejhfj.js → chunk-26cz8et8.js} +1 -1
- package/{chunk-zxkq9m8e.js → chunk-2ek3wq4b.js} +2 -2
- package/chunk-2gcp3xdc.js +2 -0
- package/{chunk-x4874m8e.js → chunk-2ks2tnac.js} +2 -2
- package/{chunk-0javrjcm.js → chunk-2nrkqq45.js} +22 -22
- package/chunk-320174qe.js +2 -0
- package/{chunk-ey15ye2h.js → chunk-3hg7yn1t.js} +1 -1
- package/{chunk-benrzwea.js → chunk-3j2kkgsc.js} +1 -1
- package/{chunk-8x21n7y9.js → chunk-47vf66t6.js} +1 -1
- package/chunk-4n49ptbz.js +3 -0
- package/{chunk-7hr6zw2m.js → chunk-5gxj9560.js} +1 -1
- package/{chunk-g0t9c3gv.js → chunk-6vnjg5x9.js} +1 -1
- package/{chunk-dnx91jrd.js → chunk-7kjr9gdx.js} +2 -2
- package/{chunk-y8dkfpmj.js → chunk-7p6e2f5s.js} +3 -3
- package/{chunk-053vb71h.js → chunk-86xhmz7k.js} +1 -1
- package/{chunk-ebpyvs1d.js → chunk-91r5nvth.js} +2 -2
- package/{chunk-c7rcw9fb.js → chunk-adys4qq4.js} +4 -4
- package/{chunk-npez1492.js → chunk-ckjw3b61.js} +2 -2
- package/{chunk-f156y565.js → chunk-d37gemt2.js} +3 -3
- package/{chunk-j7yvh0ae.js → chunk-dcwdmpw2.js} +1 -1
- package/chunk-dvb5nd2x.js +2 -0
- package/{chunk-063vbmtp.js → chunk-e6c2mzxc.js} +2 -2
- package/{chunk-s7skpgm2.js → chunk-ef9yhnk3.js} +1 -1
- package/{chunk-ecf896fz.js → chunk-fpxc6qjr.js} +2 -2
- package/chunk-frt9k18g.js +480 -0
- package/{chunk-bdy4jksd.js → chunk-fzcmzbsq.js} +1 -1
- package/{chunk-q9dd6fhj.js → chunk-g3ed130w.js} +3 -3
- package/{chunk-d48bfd2e.js → chunk-h1kb8b49.js} +2 -2
- package/{chunk-arcqjt91.js → chunk-hd3x1w46.js} +1 -1
- package/{chunk-dpz4hwqb.js → chunk-j781n7ca.js} +2 -2
- package/{chunk-z02sj1je.js → chunk-jp5afrwm.js} +2 -2
- package/{chunk-r8vvcp6c.js → chunk-jyv9cae6.js} +1 -1
- package/{chunk-whj87h4r.js → chunk-k3q5jqjj.js} +3 -3
- package/{chunk-75434aay.js → chunk-k3rmjrf1.js} +1 -1
- package/{chunk-peja51xv.js → chunk-kgkrccr1.js} +2 -2
- package/{chunk-pg5nkf1y.js → chunk-kpvaqb7c.js} +2 -2
- package/{chunk-sjjtxpg2.js → chunk-ky55taar.js} +330 -288
- package/{chunk-10p3mb40.js → chunk-mr807v9n.js} +1 -1
- package/chunk-n015c8nx.js +2 -0
- package/chunk-ndt6rjt9.js +2 -0
- package/{chunk-gv7wqkey.js → chunk-nmtk9xra.js} +2 -2
- package/{chunk-d6p2hgxh.js → chunk-pehyqj8k.js} +1 -1
- package/{chunk-ca982n62.js → chunk-pkpj7s2k.js} +1 -1
- package/{chunk-fx7f4m3c.js → chunk-pn413hjw.js} +1 -1
- package/{chunk-6ptv4g5e.js → chunk-ppxv5q7y.js} +3 -3
- package/{chunk-8wj32837.js → chunk-qmdpgbg3.js} +1 -1
- package/{chunk-8wv5t0w6.js → chunk-rnt1ckk9.js} +6 -6
- package/{chunk-prgm07j4.js → chunk-t40fag3z.js} +2 -2
- package/{chunk-w67dvqtb.js → chunk-t66jqz12.js} +2 -2
- package/{chunk-39vwrg8n.js → chunk-v2srrqcv.js} +2 -2
- package/{chunk-n85qs7cs.js → chunk-x496kg3v.js} +1 -1
- package/{chunk-6kdgk70p.js → chunk-xjw78yey.js} +4 -4
- package/chunk-xy2bxwq8.js +2 -0
- package/{chunk-y69ewdn2.js → chunk-ypqjfv3a.js} +2 -2
- package/{chunk-f544p9rh.js → chunk-yyy2yp6f.js} +10 -10
- package/{chunk-8gw5bvh3.js → chunk-yzevjkms.js} +5 -5
- package/chunk-z3ch1wg6.js +16 -0
- package/chunk-zdyd8hbn.js +2 -0
- package/compiled.js +6 -6
- package/package.json +1 -1
- package/ui-test-worker.js +19 -19
- package/web/{chunk-kjacapzd.js → chunk-0j9a7811.js} +6 -6
- package/web/chunk-0jfda4jw.js +2 -0
- package/web/{chunk-z1geewdf.js → chunk-0zwc2rvh.js} +2 -2
- package/web/{chunk-ht4mx2dt.js → chunk-1gx0zpmp.js} +7 -7
- package/web/{chunk-q3jevm51.js → chunk-1s8zg6fb.js} +51 -51
- package/web/chunk-2axwda8c.js +89 -0
- package/web/chunk-2p3fkhy8.js +1 -0
- package/web/{chunk-tz4twwmw.js → chunk-33w36n91.js} +2 -2
- package/web/{chunk-1s53190z.js → chunk-3q0v8w45.js} +81 -81
- package/web/chunk-3sz5qcwj.js +1 -0
- package/web/chunk-433c80pc.js +1 -0
- package/web/chunk-48cnmhvd.js +106 -0
- package/web/{chunk-da7m1kva.js → chunk-4anjs6yp.js} +2 -2
- package/web/chunk-5r37rwq1.js +4 -0
- package/web/{chunk-pjz30xcp.js → chunk-6e38yf3a.js} +23 -23
- package/web/{chunk-xckxtfp8.js → chunk-7a4xk6j9.js} +72 -72
- package/web/chunk-7f1t7z72.js +2 -0
- package/web/chunk-7qq1ypvj.js +1 -0
- package/web/{chunk-h6k1x096.js → chunk-7tkgbbf9.js} +2 -2
- package/web/chunk-7x35g67d.js +78 -0
- package/web/{chunk-xbpc6x9m.js → chunk-823b7866.js} +15 -15
- package/web/chunk-85gdsmt4.js +1 -0
- package/web/{chunk-gyp6v7jd.js → chunk-8773nwdc.js} +2 -2
- package/web/{chunk-2cem4sv7.js → chunk-8dp7h6w8.js} +24 -24
- package/web/{chunk-y99ed8rd.js → chunk-8nv7q5ac.js} +9 -9
- package/web/chunk-8pzg8qw4.js +1 -0
- package/web/chunk-8wg44w91.js +2 -0
- package/web/chunk-9p5dfvav.js +1 -0
- package/web/chunk-9q9w9pay.js +1 -0
- package/web/chunk-a3teqvz2.js +39 -0
- package/web/chunk-bd8ftfxn.js +3 -0
- package/web/chunk-c03bt2pz.js +1 -0
- package/web/chunk-c1ha2xg6.js +8 -0
- package/web/chunk-cez1k71m.js +1 -0
- package/web/chunk-cgng31df.js +1 -0
- package/web/chunk-cn0tmwjs.js +2 -0
- package/web/{chunk-t6sq85s6.js → chunk-cn1xpg3q.js} +2 -2
- package/web/chunk-cvd4f51j.js +1 -0
- package/web/chunk-cybvxssy.js +1 -0
- package/web/{chunk-geh05ghh.js → chunk-cyjnert7.js} +19 -19
- package/web/{chunk-twdy2f67.js → chunk-d0m0h0eb.js} +1 -1
- package/web/{chunk-sn3tkwme.js → chunk-dgwkqcz6.js} +37 -37
- package/web/{chunk-nfvqjzz5.js → chunk-dtg5yhhs.js} +1 -1
- package/web/chunk-dynajx8x.js +2 -0
- package/web/{chunk-svh4n157.js → chunk-et8q775x.js} +4 -4
- package/web/chunk-f3vv7n52.js +1 -0
- package/web/{chunk-tmndcktk.js → chunk-f93pe4kb.js} +15 -15
- package/web/{chunk-5nda24gv.js → chunk-fe31sv6t.js} +1 -1
- package/web/chunk-fpa81dv7.js +62 -0
- package/web/{chunk-4q7wf0wd.js → chunk-fx4mackk.js} +9 -9
- package/web/chunk-g17n6asp.js +1 -0
- package/web/chunk-g9dzaw9e.js +30 -0
- package/web/chunk-gcwhx3av.js +1139 -0
- package/web/chunk-gf8vm6b5.js +1 -0
- package/web/chunk-gnmeyy4h.js +1 -0
- package/web/chunk-h5cfg3vv.js +2 -0
- package/web/{chunk-femhej5w.js → chunk-hbkasy6c.js} +46 -46
- package/web/chunk-hn7mhsbg.js +1 -0
- package/web/{chunk-tfn0rqg9.js → chunk-hstbgb83.js} +26 -26
- package/web/chunk-jjjtv2r1.js +2 -0
- package/web/chunk-jzte2phh.js +2 -0
- package/web/chunk-k8h8zx6r.js +24 -0
- package/web/chunk-m3ajw575.js +1 -0
- package/web/chunk-m5y2d4zv.js +1 -0
- package/web/chunk-mbwwj216.js +1 -0
- package/web/chunk-mf6xng5b.js +2 -0
- package/web/chunk-nky3bqfg.js +1 -0
- package/web/chunk-np33kmn4.js +1 -0
- package/web/chunk-nvk8mazs.js +1 -0
- package/web/chunk-nyw5ewgv.js +1 -0
- package/web/{chunk-dg3p8db5.js → chunk-p0cjvjdx.js} +1 -1
- package/web/chunk-p56dcqpr.js +1 -0
- package/web/chunk-pdn4r8x4.js +1 -0
- package/web/chunk-q1xxs319.js +41 -0
- package/web/chunk-qpt34d8d.js +1 -0
- package/web/{chunk-4fm55fgb.js → chunk-qq2v8h6d.js} +7 -7
- package/web/chunk-qskt3tqa.js +1 -0
- package/web/chunk-qt3n897m.js +4 -0
- package/web/chunk-r1rt48h9.js +1 -0
- package/web/{chunk-4sve9xrj.js → chunk-r4ffr96e.js} +1 -1
- package/web/chunk-r7tgd2fm.js +7 -0
- package/web/{chunk-gksf7cek.js → chunk-rbdvc8x7.js} +7 -7
- package/web/{chunk-q97hn4j5.js → chunk-rkjkynm3.js} +33 -33
- package/web/chunk-rznszqmy.js +1 -0
- package/web/chunk-s1pefd34.js +1 -0
- package/web/chunk-s38s9ff9.js +370 -0
- package/web/{chunk-n754s8xd.js → chunk-s7e93552.js} +8 -8
- package/web/chunk-sc29azev.js +1 -0
- package/web/{chunk-czjk218p.js → chunk-sda7cyrt.js} +52 -52
- package/web/chunk-svh2gkx8.js +2 -0
- package/web/chunk-t4jc4nac.js +1 -0
- package/web/chunk-t7g366a5.js +24 -0
- package/web/chunk-tj1fn8v2.js +1 -0
- package/web/{chunk-sy7e4dmq.js → chunk-tkp72r9b.js} +1 -1
- package/web/{chunk-5wbnjjhg.js → chunk-v14s4vgc.js} +1 -1
- package/web/chunk-v94v68xg.js +36 -0
- package/web/{chunk-0whceqes.js → chunk-vvvd3grf.js} +2 -2
- package/web/chunk-w37n09px.js +21 -0
- package/web/chunk-wcphswcx.js +2 -0
- package/web/{chunk-aangfjqc.js → chunk-wj3ymejj.js} +38 -38
- package/web/chunk-wwcnvyjh.css +1 -0
- package/web/{chunk-e8yj05t1.js → chunk-xabcx3ry.js} +6 -6
- package/web/chunk-xb9m0092.js +1 -0
- package/web/chunk-xfd3b01q.js +1 -0
- package/web/{chunk-4vjnrz87.js → chunk-xqyazzm7.js} +17 -17
- package/web/{chunk-bdydzbqk.js → chunk-xsz1dfm2.js} +23 -23
- package/web/chunk-z0zrp8n8.js +1 -0
- package/web/index.html +1 -1
- package/worker.js +1 -1
- package/chunk-654cny9a.js +0 -480
- package/chunk-8saewt61.js +0 -3
- package/chunk-a0c989ky.js +0 -2
- package/chunk-a5apjjcn.js +0 -16
- package/chunk-a81p46j7.js +0 -2
- package/chunk-agsfy9w7.js +0 -2
- package/chunk-d20p02ny.js +0 -2
- package/chunk-ejsneb6f.js +0 -2
- package/chunk-fmq3zwzk.js +0 -2
- package/chunk-rfb85nj7.js +0 -2
- package/chunk-rfdt992v.js +0 -25
- package/web/chunk-079091ar.js +0 -39
- package/web/chunk-083r4f80.js +0 -1
- package/web/chunk-0cng7r2x.js +0 -2
- package/web/chunk-0k0ande6.js +0 -1
- package/web/chunk-14deqqhr.js +0 -2
- package/web/chunk-2b63adsj.js +0 -89
- package/web/chunk-3baypnwn.js +0 -4
- package/web/chunk-4067nwjp.js +0 -19
- package/web/chunk-59678wmg.js +0 -1
- package/web/chunk-5k8sv4f5.js +0 -1
- package/web/chunk-5vjhvw1m.js +0 -2
- package/web/chunk-6ft5pz3c.js +0 -1
- package/web/chunk-7c8rwqtx.js +0 -1
- package/web/chunk-7qzz025k.js +0 -1
- package/web/chunk-7xbaqqd7.css +0 -1
- package/web/chunk-80eyv2mk.js +0 -1
- package/web/chunk-89paytbk.js +0 -4
- package/web/chunk-8ceej2g7.js +0 -1
- package/web/chunk-8nyhy122.js +0 -1
- package/web/chunk-989jq2h8.js +0 -2
- package/web/chunk-9w5tf22s.js +0 -1
- package/web/chunk-c3nn0vvc.js +0 -1
- package/web/chunk-cpwtt6ny.js +0 -1
- package/web/chunk-dsw5t58p.js +0 -1
- package/web/chunk-dv72fat3.js +0 -1
- package/web/chunk-dvvs1jjq.js +0 -3
- package/web/chunk-e131rg6p.js +0 -2
- package/web/chunk-ekw54h1q.js +0 -1
- package/web/chunk-hwsvhst3.js +0 -1
- package/web/chunk-k02b36g1.js +0 -62
- package/web/chunk-kkfrs7d1.js +0 -41
- package/web/chunk-kkyn8yhj.js +0 -106
- package/web/chunk-mh4rx5cf.js +0 -1
- package/web/chunk-n448vaba.js +0 -1
- package/web/chunk-n8j88qxy.js +0 -1
- package/web/chunk-nmpbsvwb.js +0 -2
- package/web/chunk-nws1s56b.js +0 -1
- package/web/chunk-p7126wwy.js +0 -7
- package/web/chunk-phnqnhj9.js +0 -1
- package/web/chunk-qg31p6cn.js +0 -1
- package/web/chunk-qhm3cfq9.js +0 -1
- package/web/chunk-qsd595b9.js +0 -1
- package/web/chunk-r7frwjqx.js +0 -2
- package/web/chunk-rddft5ce.js +0 -1139
- package/web/chunk-rgbdf2m9.js +0 -370
- package/web/chunk-rsbkbg6x.js +0 -78
- package/web/chunk-s2bs5vxh.js +0 -2
- package/web/chunk-sgwccs54.js +0 -1
- package/web/chunk-sjh8gtm9.js +0 -30
- package/web/chunk-t3658ehb.js +0 -2
- package/web/chunk-t81p4wqc.js +0 -24
- package/web/chunk-tewmsd7t.js +0 -1
- package/web/chunk-tf57s7ry.js +0 -1
- package/web/chunk-tqr80b5w.js +0 -2
- package/web/chunk-v282r683.js +0 -24
- package/web/chunk-v4vjjtn7.js +0 -1
- package/web/chunk-vbwdwcdp.js +0 -1
- package/web/chunk-vjngfh0q.js +0 -1
- package/web/chunk-vnt34mkb.js +0 -1
- package/web/chunk-wbgkwxrc.js +0 -1
- package/web/chunk-wjbk50hn.js +0 -2
- package/web/chunk-wjy848e2.js +0 -1
- package/web/chunk-wqsczy57.js +0 -36
- package/web/chunk-wvfmmw1v.js +0 -8
- package/web/chunk-x1jm4zsg.js +0 -1
- package/web/chunk-xmsb2g71.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t,v,ht,C,S,E,T,A,L,R,l,En,p,ae,qn,mo,Ia,Da,Wn}from"./chunk-3q0v8w45.js";import{$n,gn}from"./chunk-4anjs6yp.js";import{Xe}from"./chunk-07agqp8h.js";function nt(n,c){let y=0;if(c===void 0){for(let g of n)if(g=+g)y+=g}else{let g=-1;for(let _ of n)if(_=+c(_,++g,n))y+=_}return y}function dt(n){var c=n.length/6|0,y=Array(c),g=0;while(g<c)y[g]="#"+n.slice(g*6,++g*6);return y}var pt=dt("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");function Et(n){return n.source}function Pt(n){return n.target}function At(n){let c=Et,y=Pt,g=Ia,_=Da,P=null,m=null,G=qn(i);function i(){let o,f=mo.call(arguments),b=c.apply(this,f),x=y.apply(this,f);if(P==null)m=n(o=G());if(m.lineStart(),f[0]=b,m.point(+g.apply(this,f),+_.apply(this,f)),f[0]=x,m.point(+g.apply(this,f),+_.apply(this,f)),m.lineEnd(),o)return m=null,o+""||null}return i.source=function(o){return arguments.length?(c=o,i):c},i.target=function(o){return arguments.length?(y=o,i):y},i.x=function(o){return arguments.length?(g=typeof o==="function"?o:ae(+o),i):g},i.y=function(o){return arguments.length?(_=typeof o==="function"?o:ae(+o),i):_},i.context=function(o){return arguments.length?(o==null?P=m=null:m=n(P=o),i):P},i}function bt(){return At(Wn)}function Tt(n){return n.target.depth}function yt(n){return n.depth}function mt(n,c){return c-1-n.height}function rt(n,c){return n.sourceLinks.length?n.depth:c-1}function gt(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?gn(n.sourceLinks,Tt)-1:0}function tt(n){return function(){return n}}function vt(n,c){return st(n.source,c.source)||n.index-c.index}function _t(n,c){return st(n.target,c.target)||n.index-c.index}function st(n,c){return n.y0-c.y0}function xt(n){return n.value}function Ct(n){return n.index}function Bt(n){return n.nodes}function Ot(n){return n.links}function St(n,c){let y=n.get(c);if(!y)throw Error("missing: "+c);return y}function wt({nodes:n}){for(let c of n){let y=c.y0,g=y;for(let _ of c.sourceLinks)_.y0=y+_.width/2,y+=_.width;for(let _ of c.targetLinks)_.y1=g+_.width/2,g+=_.width}}function ot(){let n=0,c=0,y=1,g=1,_=24,P=8,m,G=Ct,i=rt,o,f,b=Bt,x=Ot,h=6;function w(){let e={nodes:b.apply(null,arguments),links:x.apply(null,arguments)};return I(e),M(e),W(e),U(e),z(e),wt(e),e}w.update=function(e){return wt(e),e},w.nodeId=function(e){return arguments.length?(G=typeof e==="function"?e:tt(e),w):G},w.nodeAlign=function(e){return arguments.length?(i=typeof e==="function"?e:tt(e),w):i},w.nodeSort=function(e){return arguments.length?(o=e,w):o},w.nodeWidth=function(e){return arguments.length?(_=+e,w):_},w.nodePadding=function(e){return arguments.length?(P=m=+e,w):P},w.nodes=function(e){return arguments.length?(b=typeof e==="function"?e:tt(e),w):b},w.links=function(e){return arguments.length?(x=typeof e==="function"?e:tt(e),w):x},w.linkSort=function(e){return arguments.length?(f=e,w):f},w.size=function(e){return arguments.length?(n=c=0,y=+e[0],g=+e[1],w):[y-n,g-c]},w.extent=function(e){return arguments.length?(n=+e[0][0],y=+e[1][0],c=+e[0][1],g=+e[1][1],w):[[n,c],[y,g]]},w.iterations=function(e){return arguments.length?(h=+e,w):h};function I({nodes:e,links:a}){for(let[r,s]of e.entries())s.index=r,s.sourceLinks=[],s.targetLinks=[];let u=new Map(e.map((r,s)=>[G(r,s,e),r]));for(let[r,s]of a.entries()){s.index=r;let{source:d,target:k}=s;if(typeof d!=="object")d=s.source=St(u,d);if(typeof k!=="object")k=s.target=St(u,k);d.sourceLinks.push(s),k.targetLinks.push(s)}if(f!=null)for(let{sourceLinks:r,targetLinks:s}of e)r.sort(f),s.sort(f)}function M({nodes:e}){for(let a of e)a.value=a.fixedValue===void 0?Math.max(nt(a.sourceLinks,xt),nt(a.targetLinks,xt)):a.fixedValue}function W({nodes:e}){let a=e.length,u=new Set(e),r=new Set,s=0;while(u.size){for(let d of u){d.depth=s;for(let{target:k}of d.sourceLinks)r.add(k)}if(++s>a)throw Error("circular link");u=r,r=new Set}}function U({nodes:e}){let a=e.length,u=new Set(e),r=new Set,s=0;while(u.size){for(let d of u){d.height=s;for(let{source:k}of d.targetLinks)r.add(k)}if(++s>a)throw Error("circular link");u=r,r=new Set}}function Q({nodes:e}){let a=$n(e,(s)=>s.depth)+1,u=(y-n-_)/(a-1),r=Array(a);for(let s of e){let d=Math.max(0,Math.min(a-1,Math.floor(i.call(null,s,a))));if(s.layer=d,s.x0=n+d*u,s.x1=s.x0+_,r[d])r[d].push(s);else r[d]=[s]}if(o)for(let s of r)s.sort(o);return r}function q(e){let a=gn(e,(u)=>(g-c-(u.length-1)*m)/nt(u,xt));for(let u of e){let r=c;for(let s of u){s.y0=r,s.y1=r+s.value*a,r=s.y1+m;for(let d of s.sourceLinks)d.width=d.value*a}r=(g-r+m)/(u.length+1);for(let s=0;s<u.length;++s){let d=u[s];d.y0+=r*(s+1),d.y1+=r*(s+1)}K(u)}}function z(e){let a=Q(e);m=Math.min(P,(g-c)/($n(a,(u)=>u.length)-1)),q(a);for(let u=0;u<h;++u){let r=Math.pow(0.99,u),s=Math.max(1-r,(u+1)/h);D(a,r,s),B(a,r,s)}}function B(e,a,u){for(let r=1,s=e.length;r<s;++r){let d=e[r];for(let k of d){let J=0,Y=0;for(let{source:N,value:ft}of k.targetLinks){let et=ft*(k.layer-N.layer);J+=O(N,k)*et,Y+=et}if(!(Y>0))continue;let F=(J/Y-k.y0)*a;k.y0+=F,k.y1+=F,Z(k)}if(o===void 0)d.sort(st);H(d,u)}}function D(e,a,u){for(let r=e.length,s=r-2;s>=0;--s){let d=e[s];for(let k of d){let J=0,Y=0;for(let{target:N,value:ft}of k.sourceLinks){let et=ft*(N.layer-k.layer);J+=V(k,N)*et,Y+=et}if(!(Y>0))continue;let F=(J/Y-k.y0)*a;k.y0+=F,k.y1+=F,Z(k)}if(o===void 0)d.sort(st);H(d,u)}}function H(e,a){let u=e.length>>1,r=e[u];j(e,r.y0-m,u-1,a),X(e,r.y1+m,u+1,a),j(e,g,e.length-1,a),X(e,c,0,a)}function X(e,a,u,r){for(;u<e.length;++u){let s=e[u],d=(a-s.y0)*r;if(d>0.000001)s.y0+=d,s.y1+=d;a=s.y1+m}}function j(e,a,u,r){for(;u>=0;--u){let s=e[u],d=(s.y1-a)*r;if(d>0.000001)s.y0-=d,s.y1-=d;a=s.y0-m}}function Z({sourceLinks:e,targetLinks:a}){if(f===void 0){for(let{source:{sourceLinks:u}}of a)u.sort(_t);for(let{target:{targetLinks:u}}of e)u.sort(vt)}}function K(e){if(f===void 0)for(let{sourceLinks:a,targetLinks:u}of e)a.sort(_t),u.sort(vt)}function O(e,a){let u=e.y0-(e.sourceLinks.length-1)*m/2;for(let{target:r,width:s}of e.sourceLinks){if(r===a)break;u+=s+m}for(let{source:r,width:s}of a.targetLinks){if(r===e)break;u-=s}return u}function V(e,a){let u=a.y0-(a.targetLinks.length-1)*m/2;for(let{source:r,width:s}of a.targetLinks){if(r===e)break;u+=s+m}for(let{target:r,width:s}of e.sourceLinks){if(r===a)break;u-=s}return u}return w}function Rt(n){return[n.source.x1,n.y0]}function Nt(n){return[n.target.x0,n.y1]}function it(){return bt().source(Rt).target(Nt)}var kt=function(){var n=t(function(G,i,o,f){for(o=o||{},f=G.length;f--;o[G[f]]=i);return o},"o"),c=[1,9],y=[1,10],g=[1,5,10,12],_={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:t(function(i,o,f,b,x,h,w){var I=h.length-1;switch(x){case 7:let M=b.findOrCreateNode(h[I-4].trim().replaceAll('""','"')),W=b.findOrCreateNode(h[I-2].trim().replaceAll('""','"')),U=parseFloat(h[I].trim());b.addLink(M,W,U);break;case 8:case 9:case 11:this.$=h[I];break;case 10:this.$=h[I-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:c,20:y},{1:[2,6],7:11,10:[1,12]},n(y,[2,4],{9:13,5:[1,14]}),{12:[1,15]},n(g,[2,8]),n(g,[2,9]),{19:[1,16]},n(g,[2,11]),{1:[2,1]},{1:[2,5]},n(y,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:c,20:y},{15:18,16:7,17:8,18:c,20:y},{18:[1,19]},n(y,[2,3]),{12:[1,20]},n(g,[2,10]),{15:21,16:7,17:8,18:c,20:y},n([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:t(function(i,o){if(o.recoverable)this.trace(i);else{var f=Error(i);throw f.hash=o,f}},"parseError"),parse:t(function(i){var o=this,f=[0],b=[],x=[null],h=[],w=this.table,I="",M=0,W=0,U=0,Q=2,q=1,z=h.slice.call(arguments,1),B=Object.create(this.lexer),D={yy:{}};for(var H in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,H))D.yy[H]=this.yy[H];if(B.setInput(i,D.yy),D.yy.lexer=B,D.yy.parser=this,typeof B.yylloc>"u")B.yylloc={};var X=B.yylloc;h.push(X);var j=B.options&&B.options.ranges;if(typeof D.yy.parseError==="function")this.parseError=D.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Z(N){f.length=f.length-2*N,x.length=x.length-N,h.length=h.length-N}t(Z,"popStack");function K(){var N=b.pop()||B.lex()||q;if(typeof N!=="number"){if(N instanceof Array)b=N,N=b.pop();N=o.symbols_[N]||N}return N}t(K,"lex");var O,V,e,a,u,r,s={},d,k,J,Y;while(!0){if(e=f[f.length-1],this.defaultActions[e])a=this.defaultActions[e];else{if(O===null||typeof O>"u")O=K();a=w[e]&&w[e][O]}if(typeof a>"u"||!a.length||!a[0]){var F="";Y=[];for(d in w[e])if(this.terminals_[d]&&d>Q)Y.push("'"+this.terminals_[d]+"'");if(B.showPosition)F="Parse error on line "+(M+1)+`:
|
|
2
2
|
`+B.showPosition()+`
|
|
3
|
-
Expecting `+Y.join(", ")+", got '"+(this.terminals_[O]||O)+"'";else F="Parse error on line "+(M+1)+": Unexpected "+(O==q?"end of input":"'"+(this.terminals_[O]||O)+"'");this.parseError(F,{text:B.match,token:this.terminals_[O]||O,line:B.yylineno,loc:X,expected:Y})}if(a[0]instanceof Array&&a.length>1)throw Error("Parse Error: multiple actions possible at state: "+
|
|
4
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:
|
|
5
|
-
`+o+"^"},"showPosition"),test_match:
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:
|
|
7
|
-
${w}${Math.round(s*100)/100}${I}`},"getText"),K=
|
|
8
|
-
`).trim(),"prepareTextForParsing"),Jt=
|
|
3
|
+
Expecting `+Y.join(", ")+", got '"+(this.terminals_[O]||O)+"'";else F="Parse error on line "+(M+1)+": Unexpected "+(O==q?"end of input":"'"+(this.terminals_[O]||O)+"'");this.parseError(F,{text:B.match,token:this.terminals_[O]||O,line:B.yylineno,loc:X,expected:Y})}if(a[0]instanceof Array&&a.length>1)throw Error("Parse Error: multiple actions possible at state: "+e+", token: "+O);switch(a[0]){case 1:if(f.push(O),x.push(B.yytext),h.push(B.yylloc),f.push(a[1]),O=null,!V){if(W=B.yyleng,I=B.yytext,M=B.yylineno,X=B.yylloc,U>0)U--}else O=V,V=null;break;case 2:if(k=this.productions_[a[1]][1],s.$=x[x.length-k],s._$={first_line:h[h.length-(k||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(k||1)].first_column,last_column:h[h.length-1].last_column},j)s._$.range=[h[h.length-(k||1)].range[0],h[h.length-1].range[1]];if(r=this.performAction.apply(s,[I,W,M,D.yy,a[1],x,h].concat(z)),typeof r<"u")return r;if(k)f=f.slice(0,-1*k*2),x=x.slice(0,-1*k),h=h.slice(0,-1*k);f.push(this.productions_[a[1]][0]),x.push(s.$),h.push(s._$),J=w[f[f.length-2]][f[f.length-1]],f.push(J);break;case 3:return!0}}return!0},"parse")},P=function(){var G={EOF:1,parseError:t(function(o,f){if(this.yy.parser)this.yy.parser.parseError(o,f);else throw Error(o)},"parseError"),setInput:t(function(i,o){if(this.yy=o||this.yy||{},this._input=i,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];return this.offset=0,this},"setInput"),input:t(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var o=i.match(/(?:\r\n?|\n).*/g);if(o)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),i},"input"),unput:t(function(i){var o=i.length,f=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var b=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1)this.yylineno-=f.length-1;var x=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===b.length?this.yylloc.first_column:0)+b[b.length-f.length].length-f[0].length:this.yylloc.first_column-o},this.options.ranges)this.yylloc.range=[x[0],x[0]+this.yyleng-o];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(i){this.unput(this.match.slice(i))},"less"),pastInput:t(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var i=this.match;if(i.length<20)i+=this._input.substr(0,20-i.length);return(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var i=this.pastInput(),o=Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
+
`+o+"^"},"showPosition"),test_match:t(function(i,o){var f,b,x;if(this.options.backtrack_lexer){if(x={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)x.yylloc.range=this.yylloc.range.slice(0)}if(b=i[0].match(/(?:\r\n?|\n).*/g),b)this.yylineno+=b.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],f=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(f)return f;else if(this._backtrack){for(var h in x)this[h]=x[h];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var i,o,f,b;if(!this._more)this.yytext="",this.match="";var x=this._currentRules();for(var h=0;h<x.length;h++)if(f=this._input.match(this.rules[x[h]]),f&&(!o||f[0].length>o[0].length)){if(o=f,b=h,this.options.backtrack_lexer)if(i=this.test_match(f,x[h]),i!==!1)return i;else if(this._backtrack){o=!1;continue}else return!1;else if(!this.options.flex)break}if(o){if(i=this.test_match(o,x[b]),i!==!1)return i;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var o=this.next();if(o)return o;else return this.lex()},"lex"),begin:t(function(o){this.conditionStack.push(o)},"begin"),popState:t(function(){var o=this.conditionStack.length-1;if(o>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(o){if(o=this.conditionStack.length-1-Math.abs(o||0),o>=0)return this.conditionStack[o];else return"INITIAL"},"topState"),pushState:t(function(o){this.begin(o)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(o,f,b,x){var h=x;switch(b){case 0:return this.pushState("csv"),4;break;case 1:return this.pushState("csv"),4;break;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;break;case 6:return 20;case 7:return this.popState("escaped_text"),18;break;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return G}();_.lexer=P;function m(){this.yy={}}return t(m,"Parser"),m.prototype=_,_.Parser=m,new m}();kt.parser=kt;var at=kt,ct=[],ut=[],lt=new Map,Gt=t(()=>{ct=[],ut=[],lt=new Map,C()},"clear"),It=class{constructor(n,c,y=0){this.source=n,this.target=c,this.value=y}static{t(this,"SankeyLink")}},Mt=t((n,c,y)=>{ct.push(new It(n,c,y))},"addLink"),Yt=class{constructor(n){this.ID=n}static{t(this,"SankeyNode")}},Dt=t((n)=>{n=v.sanitizeText(n,l());let c=lt.get(n);if(c===void 0)c=new Yt(n),lt.set(n,c),ut.push(c);return c},"findOrCreateNode"),jt=t(()=>ut,"getNodes"),$t=t(()=>ct,"getLinks"),zt=t(()=>({nodes:ut.map((n)=>({id:n.ID})),links:ct.map((n)=>({source:n.source.ID,target:n.target.ID,value:n.value}))}),"getGraph"),Vt={nodesMap:lt,getConfig:t(()=>l().sankey,"getConfig"),getNodes:jt,getLinks:$t,getGraph:zt,addLink:Mt,findOrCreateNode:Dt,getAccTitle:E,setAccTitle:S,getAccDescription:A,setAccDescription:T,getDiagramTitle:R,setDiagramTitle:L,clear:Gt},Lt=class n{static{t(this,"Uid")}static{this.count=0}static next(c){return new n(c+ ++n.count)}constructor(c){this.id=c,this.href=`#${c}`}toString(){return"url("+this.href+")"}},Ft={left:yt,right:mt,center:gt,justify:rt},Wt=t((n)=>{let c=0,y=0;for(let g of n){let _=g.value??0;if(_>c)c=_,y=g.layer??0}return y},"findCentralNodeLayer"),Ut=t(function(n,c,y,g){let{securityLevel:_,sankey:P}=l(),m=En.sankey,G;if(_==="sandbox")G=p("#i"+c);let i=_==="sandbox"?p(G.nodes()[0].contentDocument.body):p("body"),o=_==="sandbox"?i.select(`[id="${c}"]`):p(`[id="${c}"]`),f=P?.width??m.width,b=P?.height??m.width,x=P?.useMaxWidth??m.useMaxWidth,h=P?.nodeAlignment??m.nodeAlignment,w=P?.prefix??m.prefix,I=P?.suffix??m.suffix,M=P?.showValues??m.showValues,W=P?.nodeWidth??m.nodeWidth??10,U=P?.nodePadding??m.nodePadding??12,Q=P?.labelStyle??m.labelStyle??"legacy",q=P?.nodeColors??{},z=g.db.getGraph(),B=Ft[h];ot().nodeId((r)=>r.id).nodeWidth(W).nodePadding(U+(M?15:0)).nodeAlign(B).extent([[0,0],[f,b]])(z);let H=Wt(z.nodes),X=Xe(pt),j=t((r)=>q[r]??X(r),"getNodeColor");o.append("g").attr("class","nodes").selectAll(".node").data(z.nodes).join("g").attr("class","node").attr("id",(r)=>(r.uid=Lt.next("node-")).id).attr("transform",function(r){return"translate("+r.x0+","+r.y0+")"}).attr("x",(r)=>r.x0).attr("y",(r)=>r.y0).append("rect").attr("height",(r)=>r.y1-r.y0).attr("width",(r)=>r.x1-r.x0).attr("fill",(r)=>j(r.id));let Z=t(({id:r,value:s})=>{if(!M)return r;return`${r}
|
|
7
|
+
${w}${Math.round(s*100)/100}${I}`},"getText"),K=t((r)=>{if(Q==="outlined"){if((r.layer??0)<H)return{x:r.x0-6,anchor:"end"};return{x:r.x1+6,anchor:"start"}}if(r.x0<f/2)return{x:r.x1+6,anchor:"start"};return{x:r.x0-6,anchor:"end"}},"getLabelPosition"),O=o.append("g").attr("class","node-labels").attr("font-size",14),V=t((r)=>O.selectAll(r?`.${r}`:"text").data(z.nodes).join("text").attr("class",r??null).attr("x",(s)=>K(s).x).attr("y",(s)=>(s.y1+s.y0)/2).attr("dy",`${M?"0":"0.35"}em`).attr("text-anchor",(s)=>K(s).anchor).text(Z),"appendLabel");if(Q==="outlined")V("sankey-label-bg"),V("sankey-label-fg");else V();let e=o.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",0.5).selectAll(".link").data(z.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),a=P?.linkColor??"gradient";if(a==="gradient"){let r=e.append("linearGradient").attr("id",(s)=>(s.uid=Lt.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",(s)=>s.source.x1).attr("x2",(s)=>s.target.x0);r.append("stop").attr("offset","0%").attr("stop-color",(s)=>j(s.source.id)),r.append("stop").attr("offset","100%").attr("stop-color",(s)=>j(s.target.id))}let u;switch(a){case"gradient":u=t((r)=>r.uid,"coloring");break;case"source":u=t((r)=>j(r.source.id),"coloring");break;case"target":u=t((r)=>j(r.target.id),"coloring");break;default:u=a}e.append("path").attr("d",it()).attr("stroke",u).attr("stroke-width",(r)=>Math.max(1,r.width)),ht(void 0,o,0,x)},"draw"),Ht={draw:Ut},Xt=t((n)=>n.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,`
|
|
8
|
+
`).trim(),"prepareTextForParsing"),Jt=t((n)=>`.label {
|
|
9
9
|
font-family: ${n.fontFamily};
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ki}from"./chunk-8dp7h6w8.js";export{ki as createPacketServices};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{t,a,l,I,Tt,go,yt,tn,At,Yn,nn}from"./chunk-3q0v8w45.js";import{xe,Oe,Ke,Ee,ut,Gt,H,fe,at,Ht,it,cr,la,ca,ua,vn,Ct,da,bn,$e,xn,$t,St,_n,Yt,wn,pa,ma,ur,_e,fa,kn,Zt,Cn,dr,pr,Xt,ha,mr,ga,Fr,dt,fr,ya,va,ba,Ge,hr,gr,Sn,xa,yr,f,Qe,pt,we,Kt,re}from"./chunk-33w36n91.js";import{ia,oa,W,Bn,eo,sa,lr}from"./chunk-mf6xng5b.js";import{Lt}from"./chunk-gcwhx3av.js";var br={};Lt(br,{default:()=>rr});var uo=/\s/;function co(r){var e=r.length;while(e--&&uo.test(r.charAt(e)));return e}var te=co;var po=/^\s+/;function lo(r){return r?r.slice(0,te(r)+1).replace(po,""):r}var ne=lo;var oe=NaN,mo=/^[-+]0x[0-9a-f]+$/i,ho=/^0b[01]+$/i,vo=/^0o[0-7]+$/i,bo=parseInt;function yo(r){if(typeof r=="number")return r;if(ut(r))return oe;if(fe(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=fe(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=ne(r);var n=ho.test(r);return n||vo.test(r)?bo(r.slice(2),n?2:8):mo.test(r)?oe:+r}var ie=yo;var ae=1/0,wo=179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;function _o(r){if(!r)return r===0?r:0;if(r=ie(r),r===ae||r===-ae){var e=r<0?-1:1;return e*wo}return r===r?r:0}var V=_o;function Eo(r){var e=V(r),n=e%1;return e===e?n?e-n:e:0}var se=Eo;var ue=Object.create,xo=function(){function r(){}return function(e){if(!fe(e))return{};if(ue)return ue(e);r.prototype=e;var n=new r;return r.prototype=void 0,n}}(),de=xo;function Oo(r,e){var n=-1,o=r.length;e||(e=Array(o));while(++n<o)e[n]=r[n];return e}var sr=Oo;function Lo(r,e,n){if(e=="__proto__"&&cr)cr(r,e,{configurable:!0,enumerable:!0,value:n,writable:!0});else r[e]=n}var M=Lo;var Io=Object.prototype,No=Io.hasOwnProperty;function Po(r,e,n){var o=r[e];if(!(No.call(r,e)&&Ct(o,n))||n===void 0&&!(e in r))M(r,e,n)}var j=Po;function ko(r,e,n,o){var i=!n;n||(n={});var s=-1,u=e.length;while(++s<u){var d=e[s],c=o?o(n[d],r[d],d,n,r):void 0;if(c===void 0)c=r[d];if(i)M(n,d,c);else j(n,d,c)}return n}var k=ko;function Ao(r,e,n){if(!fe(n))return!1;var o=typeof e;if(o=="number"?$e(n)&&vn(e,n.length):o=="string"&&(e in n))return Ct(n[e],r);return!1}var C=Ao;function Ro(r){return bn(function(e,n){var o=-1,i=n.length,s=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;if(s=r.length>3&&typeof s=="function"?(i--,s):void 0,u&&C(n[0],n[1],u))s=i<3?void 0:s,i=1;e=Object(e);while(++o<i){var d=n[o];if(d)r(e,d,o,s)}return e})}var ce=Ro;function Mo(r){var e=[];if(r!=null)for(var n in Object(r))e.push(n);return e}var pe=Mo;var jo=Object.prototype,Bo=jo.hasOwnProperty;function Do(r){if(!fe(r))return pe(r);var e=xn(r),n=[];for(var o in r)if(!(o=="constructor"&&(e||!Bo.call(r,o))))n.push(o);return n}var le=Do;function Fo(r){return $e(r)?pa(r,!0):le(r)}var L=Fo;function Go(r){var e=r==null?0:r.length;return e?pr(r,1):[]}var N=Go;function Xo(r){return la(da(r,void 0,N),r+"")}var me=Xo;var Uo=ma(Object.getPrototypeOf,Object),Y=Uo;var Vo="[object Object]",Yo=Function.prototype,zo=Object.prototype,he=Yo.toString,Wo=zo.hasOwnProperty,qo=he.call(Object);function Ho(r){if(!Ee(r)||Ke(r)!=Vo)return!1;var e=Y(r);if(e===null)return!0;var n=Wo.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&he.call(n)==qo}var ge=Ho;var Ko="\\ud800-\\udfff",Jo="\\u0300-\\u036f",Zo="\\ufe20-\\ufe2f",$o="\\u20d0-\\u20ff",Qo=Jo+Zo+$o,ri="\\ufe0e\\ufe0f",ei="\\u200d",ti=RegExp("["+ei+Ko+Qo+ri+"]");function ni(r){return ti.test(r)}var ve=ni;function oi(r,e){return r&&k(e,_e(e),r)}var be=oi;function ii(r,e){return r&&k(e,L(e),r)}var ye=ii;var Ne=typeof br=="object"&&br&&!br.nodeType&&br,Le=Ne&&typeof vr=="object"&&vr&&!vr.nodeType&&vr,ai=Le&&Le.exports===Ne,Ie=ai?xe.Buffer:void 0,Se=Ie?Ie.allocUnsafe:void 0;function fi(r,e){if(e)return r.slice();var n=r.length,o=Se?Se(n):new r.constructor(n);return r.copy(o),o}var rr=fi;function si(r,e){return k(r,mr(r),e)}var Pe=si;var ui=Object.getOwnPropertySymbols,di=!ui?ha:function(r){var e=[];while(r)dr(e,mr(r)),r=Y(r);return e},wr=di;function ci(r,e){return k(r,wr(r),e)}var ke=ci;function pi(r){return ga(r,L,wr)}var Te=pi;var li=Object.prototype,mi=li.hasOwnProperty;function hi(r){var e=r.length,n=new r.constructor(e);if(e&&typeof r[0]=="string"&&mi.call(r,"index"))n.index=r.index,n.input=r.input;return n}var Ce=hi;function gi(r){var e=new r.constructor(r.byteLength);return new fr(e).set(new fr(r)),e}var z=gi;function vi(r,e){var n=e?z(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.byteLength)}var Ae=vi;var bi=/\w*$/;function yi(r){var e=new r.constructor(r.source,bi.exec(r));return e.lastIndex=r.lastIndex,e}var Re=yi;var Me=Oe?Oe.prototype:void 0,je=Me?Me.valueOf:void 0;function wi(r){return je?Object(je.call(r)):{}}var Be=wi;function _i(r,e){var n=e?z(r.buffer):r.buffer;return new r.constructor(n,r.byteOffset,r.length)}var _r=_i;var Ei="[object Boolean]",xi="[object Date]",Oi="[object Map]",Li="[object Number]",Ii="[object RegExp]",Si="[object Set]",Ni="[object String]",Pi="[object Symbol]",ki="[object ArrayBuffer]",Ti="[object DataView]",Ci="[object Float32Array]",Ai="[object Float64Array]",Ri="[object Int8Array]",Mi="[object Int16Array]",ji="[object Int32Array]",Bi="[object Uint8Array]",Di="[object Uint8ClampedArray]",Fi="[object Uint16Array]",Gi="[object Uint32Array]";function Xi(r,e,n){var o=r.constructor;switch(e){case ki:return z(r);case Ei:case xi:return new o(+r);case Ti:return Ae(r,n);case Ci:case Ai:case Ri:case Mi:case ji:case Bi:case Di:case Fi:case Gi:return _r(r,n);case Oi:return new o;case Li:case Ni:return new o(r);case Ii:return Re(r);case Si:return new o;case Pi:return Be(r)}}var De=Xi;function Ui(r){return typeof r.constructor=="function"&&!xn(r)?de(Y(r)):{}}var Er=Ui;var Vi="[object Map]";function Yi(r){return Ee(r)&&dt(r)==Vi}var Fe=Yi;var Xe=Yt&&Yt.isMap,zi=Xe?_n(Xe):Fe,Ue=zi;var Wi="[object Set]";function qi(r){return Ee(r)&&dt(r)==Wi}var Ve=qi;var Ye=Yt&&Yt.isSet,Hi=Ye?_n(Ye):Ve,ze=Hi;var Zi=1,$i=2,ra=4,We="[object Arguments]",ea="[object Array]",ta="[object Boolean]",na="[object Date]",aa="[object Error]",qe="[object Function]",wa="[object GeneratorFunction]",_a="[object Map]",Ea="[object Number]",He="[object Object]",Oa="[object RegExp]",La="[object Set]",Ia="[object String]",Sa="[object Symbol]",Na="[object WeakMap]",Pa="[object ArrayBuffer]",ka="[object DataView]",Ta="[object Float32Array]",Ca="[object Float64Array]",Aa="[object Int8Array]",Ra="[object Int16Array]",Ma="[object Int32Array]",ja="[object Uint8Array]",Ba="[object Uint8ClampedArray]",Da="[object Uint16Array]",Fa="[object Uint32Array]",x={};x[We]=x[ea]=x[Pa]=x[ka]=x[ta]=x[na]=x[Ta]=x[Ca]=x[Aa]=x[Ra]=x[Ma]=x[_a]=x[Ea]=x[He]=x[Oa]=x[La]=x[Ia]=x[Sa]=x[ja]=x[Ba]=x[Da]=x[Fa]=!0;x[aa]=x[qe]=x[Na]=!1;function xr(r,e,n,o,i,s){var u,d=e&Zi,c=e&$i,p=e&ra;if(n)u=i?n(r,o,i,s):n(r);if(u!==void 0)return u;if(!fe(r))return r;var m=H(r);if(m){if(u=Ce(r),!d)return sr(r,u)}else{var h=dt(r),g=h==qe||h==wa;if(St(r))return rr(r,d);if(h==He||h==We||g&&!i){if(u=c||g?{}:Er(r),!d)return c?ke(r,ye(u,r)):Pe(r,be(u,r))}else{if(!x[h])return i?r:{};u=De(r,h,d)}}s||(s=new Xt);var b=s.get(r);if(b)return b;if(s.set(r,u),ze(r))r.forEach(function(v){u.add(xr(v,e,n,v,r,s))});else if(Ue(r))r.forEach(function(v,_){u.set(_,xr(v,e,n,_,r,s))});var w=p?c?Te:Fr:c?L:_e,y=m?void 0:w(r);return ca(y||r,function(v,_){if(y)_=v,v=r[_];j(u,_,xr(v,e,n,_,r,s))}),u}var Je=xr;var Ga=1,Xa=4;function Ua(r){return Je(r,Ga|Xa)}var Ze=Ua;var Va=function(){return xe.Date.now()},kr=Va;var rt=Object.prototype,Ya=rt.hasOwnProperty,za=bn(function(r,e){r=Object(r);var n=-1,o=e.length,i=o>2?e[2]:void 0;if(i&&C(e[0],e[1],i))o=1;while(++n<o){var s=e[n],u=L(s),d=-1,c=u.length;while(++d<c){var p=u[d],m=r[p];if(m===void 0||Ct(m,rt[p])&&!Ya.call(r,p))r[p]=s[p]}}return r}),et=za;function Wa(r,e,n){if(n!==void 0&&!Ct(r[e],n)||n===void 0&&!(e in r))M(r,e,n)}var er=Wa;function qa(r,e){if(e==="constructor"&&typeof r[e]==="function")return;if(e=="__proto__")return;return r[e]}var tr=qa;function Ha(r){return k(r,L(r))}var tt=Ha;function Ka(r,e,n,o,i,s,u){var d=tr(r,n),c=tr(e,n),p=u.get(c);if(p){er(r,n,p);return}var m=s?s(d,c,n+"",r,e,u):void 0,h=m===void 0;if(h){var g=H(c),b=!g&&St(c),w=!g&&!b&&wn(c);if(m=c,g||b||w)if(H(d))m=d;else if(xa(d))m=sr(d);else if(b)h=!1,m=rr(c,!0);else if(w)h=!1,m=_r(c,!0);else m=[];else if(ge(c)||$t(c)){if(m=d,$t(d))m=tt(d);else if(!fe(d)||Ht(d))m=Er(c)}else h=!1}if(h)u.set(c,m),i(m,c,o,s,u),u.delete(c);er(r,n,m)}var nt=Ka;function ot(r,e,n,o,i){if(r===e)return;hr(e,function(s,u){if(i||(i=new Xt),fe(s))nt(r,e,u,n,ot,o,i);else{var d=o?o(tr(r,u),s,u+"",r,e,i):void 0;if(d===void 0)d=s;er(r,u,d)}},L)}var ft=ot;function Ja(r){var e=r==null?0:r.length;return e?r[e-1]:void 0}var X=Ja;function Za(r){return function(e,n,o){var i=Object(e);if(!$e(e)){var s=Ge(n,3);e=_e(e),n=function(d){return s(i[d],d,i)}}var u=r(e,n,o);return u>-1?i[s?e[u]:u]:void 0}}var st=Za;var $a=Math.max;function Qa(r,e,n){var o=r==null?0:r.length;if(!o)return-1;var i=n==null?0:se(n);if(i<0)i=$a(o+i,0);return ua(r,Ge(e,3),i)}var ct=Qa;var rf=st(ct),nr=rf;function ef(r,e){var n=-1,o=$e(r)?Array(r.length):[];return Sn(r,function(i,s,u){o[++n]=e(i,s,u)}),o}var Or=ef;function tf(r,e){var n=H(r)?Gt:Or;return n(r,Ge(e,3))}var E=tf;function nf(r,e){return r==null?r:hr(r,yr(e),L)}var lt=nf;function of(r,e){return r&&gr(r,yr(e))}var mt=of;function af(r,e){return r>e}var ht=af;var ff=Object.prototype,sf=ff.hasOwnProperty;function uf(r,e){return r!=null&&sf.call(r,e)}var gt=uf;function df(r,e){return r!=null&&ya(r,e,gt)}var Lr=df;var cf="[object String]";function pf(r){return typeof r=="string"||!H(r)&&Ee(r)&&Ke(r)==cf}var vt=pf;function lf(r,e){return r<e}var Ir=lf;function mf(r,e){var n={};return e=Ge(e,3),gr(r,function(o,i,s){M(n,i,e(o,i,s))}),n}var q=mf;function hf(r,e,n){var o=-1,i=r.length;while(++o<i){var s=r[o],u=e(s);if(u!=null&&(d===void 0?u===u&&!ut(u):n(u,d)))var d=u,c=s}return c}var K=hf;function gf(r){return r&&r.length?K(r,at,ht):void 0}var S=gf;var vf=ce(function(r,e,n){ft(r,e,n)}),or=vf;function bf(r){return r&&r.length?K(r,at,Ir):void 0}var B=bf;function yf(r,e){return r&&r.length?K(r,Ge(e,2),Ir):void 0}var J=yf;function wf(r,e,n,o){if(!fe(r))return r;e=kn(e,r);var i=-1,s=e.length,u=s-1,d=r;while(d!=null&&++i<s){var c=Zt(e[i]),p=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return r;if(i!=u){var m=d[c];if(p=o?o(m,c,d):void 0,p===void 0)p=fe(m)?m:vn(e[i+1])?[]:{}}j(d,c,p),d=d[c]}return r}var bt=wf;function _f(r,e,n){var o=-1,i=e.length,s={};while(++o<i){var u=e[o],d=Cn(r,u);if(n(d,u))bt(s,kn(u,r),d)}return s}var wt=_f;function Ef(r,e){var n=r.length;r.sort(e);while(n--)r[n]=r[n].value;return r}var _t=Ef;function xf(r,e){if(r!==e){var n=r!==void 0,o=r===null,i=r===r,s=ut(r),u=e!==void 0,d=e===null,c=e===e,p=ut(e);if(!d&&!p&&!s&&r>e||s&&u&&c&&!d&&!p||o&&u&&c||!n&&c||!i)return 1;if(!o&&!s&&!p&&r<e||p&&n&&i&&!o&&!s||d&&n&&i||!u&&i||!c)return-1}return 0}var Et=xf;function Of(r,e,n){var o=-1,i=r.criteria,s=e.criteria,u=i.length,d=n.length;while(++o<u){var c=Et(i[o],s[o]);if(c){if(o>=d)return c;var p=n[o];return c*(p=="desc"?-1:1)}}return r.index-e.index}var xt=Of;function Lf(r,e,n){if(e.length)e=Gt(e,function(s){if(H(s))return function(u){return Cn(u,s.length===1?s[0]:s)};return s});else e=[at];var o=-1;e=Gt(e,_n(Ge));var i=Or(r,function(s,u,d){var c=Gt(e,function(p){return p(s)});return{criteria:c,index:++o,value:s}});return _t(i,function(s,u){return xt(s,u,n)})}var Ot=Lf;var If=ba("length"),It=If;var Pt="\\ud800-\\udfff",Sf="\\u0300-\\u036f",Nf="\\ufe20-\\ufe2f",Pf="\\u20d0-\\u20ff",kf=Sf+Nf+Pf,Tf="\\ufe0e\\ufe0f",Cf="["+Pt+"]",Tr="["+kf+"]",Cr="\\ud83c[\\udffb-\\udfff]",Af="(?:"+Tr+"|"+Cr+")",kt="[^"+Pt+"]",Rt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Rf="\\u200d",jt=Af+"?",Bt="["+Tf+"]?",Mf="(?:"+Rf+"(?:"+[kt,Rt,Mt].join("|")+")"+Bt+jt+")*",jf=Bt+jt+Mf,Bf="(?:"+[kt+Tr+"?",Tr,Rt,Mt,Cf].join("|")+")",Nt=RegExp(Cr+"(?="+Cr+")|"+Bf+jf,"g");function Df(r){var e=Nt.lastIndex=0;while(Nt.test(r))++e;return e}var Dt=Df;function Ff(r){return ve(r)?Dt(r):It(r)}var Ft=Ff;function Gf(r,e){return wt(r,e,function(n,o){return va(r,o)})}var Ut=Gf;var Xf=me(function(r,e){return r==null?{}:Ut(r,e)}),Z=Xf;var{ceil:Uf,max:Vf}=Math;function Yf(r,e,n,o){var i=-1,s=Vf(Uf((e-r)/(n||1)),0),u=Array(s);while(s--)u[o?s:++i]=r,r+=n;return u}var Vt=Yf;function zf(r){return function(e,n,o){if(o&&typeof o!="number"&&C(e,n,o))n=o=void 0;if(e=V(e),n===void 0)n=e,e=0;else n=V(n);return o=o===void 0?e<n?1:-1:V(o),Vt(e,n,o,r)}}var zt=zf;var Wf=zt(),P=Wf;var qf="[object Map]",Hf="[object Set]";function Kf(r){if(r==null)return 0;if($e(r))return vt(r)?Ft(r):r.length;var e=dt(r);if(e==qf||e==Hf)return r.size;return ur(r).length}var Wt=Kf;var Jf=bn(function(r,e){if(r==null)return[];var n=e.length;if(n>1&&C(r,e[0],e[1]))e=[];else if(n>2&&C(e[0],e[1],e[2]))e=[e[0]];return Ot(r,pr(e,1),[])}),A=Jf;var Zf=0;function $f(r){var e=++Zf;return fa(r)+e}var Q=$f;function Qf(r,e,n){var o=-1,i=r.length,s=e.length,u={};while(++o<i){var d=o<s?e[o]:void 0;n(u,r[o],d)}return u}var qt=Qf;function rs(r,e){return qt(r||[],e||[],j)}var Ar=rs;class Rr{constructor(){var r={};r._next=r._prev=r,this._sentinel=r}dequeue(){var r=this._sentinel,e=r._prev;if(e!==r)return Jt(e),e}enqueue(r){var e=this._sentinel;if(r._prev&&r._next)Jt(r);r._next=e._next,e._next._prev=r,e._next=r,r._prev=e}toString(){var r=[],e=this._sentinel,n=e._prev;while(n!==e)r.push(JSON.stringify(n,es)),n=n._prev;return"["+r.join(", ")+"]"}}function Jt(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function es(r,e){if(r!=="_next"&&r!=="_prev")return e}var ts=it(1);function Qt(r,e){if(r.nodeCount()<=1)return[];var n=os(r,e||ts),o=ns(n.graph,n.buckets,n.zeroIdx);return N(E(o,function(i){return r.outEdges(i.v,i.w)}))}function ns(r,e,n){var o=[],i=e[e.length-1],s=e[0],u;while(r.nodeCount()){while(u=s.dequeue())Mr(r,e,n,u);while(u=i.dequeue())Mr(r,e,n,u);if(r.nodeCount()){for(var d=e.length-2;d>0;--d)if(u=e[d].dequeue(),u){o=o.concat(Mr(r,e,n,u,!0));break}}}return o}function Mr(r,e,n,o,i){var s=i?[]:void 0;return f(r.inEdges(o.v),function(u){var d=r.edge(u),c=r.node(u.v);if(i)s.push({v:u.v,w:u.w});c.out-=d,jr(e,n,c)}),f(r.outEdges(o.v),function(u){var d=r.edge(u),c=u.w,p=r.node(c);p.in-=d,jr(e,n,p)}),r.removeNode(o.v),s}function os(r,e){var n=new re,o=0,i=0;f(r.nodes(),function(d){n.setNode(d,{v:d,in:0,out:0})}),f(r.edges(),function(d){var c=n.edge(d.v,d.w)||0,p=e(d),m=c+p;n.setEdge(d.v,d.w,m),i=Math.max(i,n.node(d.v).out+=p),o=Math.max(o,n.node(d.w).in+=p)});var s=P(i+o+3).map(function(){return new Rr}),u=o+1;return f(n.nodes(),function(d){jr(s,u,n.node(d))}),{graph:n,buckets:s,zeroIdx:u}}function jr(r,e,n){if(!n.out)r[0].enqueue(n);else if(!n.in)r[r.length-1].enqueue(n);else r[n.out-n.in+e].enqueue(n)}function rn(r){var e=r.graph().acyclicer==="greedy"?Qt(r,n(r)):is(r);f(e,function(o){var i=r.edge(o);r.removeEdge(o),i.forwardName=o.name,i.reversed=!0,r.setEdge(o.w,o.v,i,Q("rev"))});function n(o){return function(i){return o.edge(i).weight}}}function is(r){var e=[],n={},o={};function i(s){if(Object.prototype.hasOwnProperty.call(o,s))return;o[s]=!0,n[s]=!0,f(r.outEdges(s),function(u){if(Object.prototype.hasOwnProperty.call(n,u.w))e.push(u);else i(u.w)}),delete n[s]}return f(r.nodes(),i),e}function en(r){f(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var o=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,o)}})}function T(r,e,n,o){var i;do i=Q(o);while(r.hasNode(i));return n.dummy=e,r.setNode(i,n),i}function an(r){var e=new re().setGraph(r.graph());return f(r.nodes(),function(n){e.setNode(n,r.node(n))}),f(r.edges(),function(n){var o=e.edge(n.v,n.w)||{weight:0,minlen:1},i=r.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+i.weight,minlen:Math.max(o.minlen,i.minlen)})}),e}function Sr(r){var e=new re({multigraph:r.isMultigraph()}).setGraph(r.graph());return f(r.nodes(),function(n){if(!r.children(n).length)e.setNode(n,r.node(n))}),f(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}function Br(r,e){var{x:n,y:o}=r,i=e.x-n,s=e.y-o,u=r.width/2,d=r.height/2;if(!i&&!s)throw Error("Not possible to find intersection inside of the rectangle");var c,p;if(Math.abs(s)*u>Math.abs(i)*d){if(s<0)d=-d;c=d*i/s,p=d}else{if(i<0)u=-u;c=u,p=u*s/i}return{x:n+c,y:o+p}}function D(r){var e=E(P(Gr(r)+1),function(){return[]});return f(r.nodes(),function(n){var o=r.node(n),i=o.rank;if(!we(i))e[i][o.order]=n}),e}function fn(r){var e=B(E(r.nodes(),function(n){return r.node(n).rank}));f(r.nodes(),function(n){var o=r.node(n);if(Lr(o,"rank"))o.rank-=e})}function sn(r){var e=B(E(r.nodes(),function(s){return r.node(s).rank})),n=[];f(r.nodes(),function(s){var u=r.node(s).rank-e;if(!n[u])n[u]=[];n[u].push(s)});var o=0,i=r.graph().nodeRankFactor;f(n,function(s,u){if(we(s)&&u%i!==0)--o;else if(o)f(s,function(d){r.node(d).rank+=o})})}function Dr(r,e,n,o){var i={width:0,height:0};if(arguments.length>=4)i.rank=n,i.order=o;return T(r,"border",i,e)}function Gr(r){return S(E(r.nodes(),function(e){var n=r.node(e).rank;if(!we(n))return n}))}function un(r,e){var n={lhs:[],rhs:[]};return f(r,function(o){if(e(o))n.lhs.push(o);else n.rhs.push(o)}),n}function dn(r,e){var n=kr();try{return e()}finally{console.log(r+" time: "+(kr()-n)+"ms")}}function cn(r,e){return e()}function ln(r){function e(n){var o=r.children(n),i=r.node(n);if(o.length)f(o,e);if(Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var s=i.minRank,u=i.maxRank+1;s<u;++s)pn(r,"borderLeft","_bl",n,i,s),pn(r,"borderRight","_br",n,i,s)}}f(r.children(),e)}function pn(r,e,n,o,i,s){var u={width:0,height:0,rank:s,borderType:e},d=i[e][s-1],c=T(r,"border",u,n);if(i[e][s]=c,r.setParent(c,o),d)r.setEdge(d,c,{weight:1})}function hn(r){var e=r.graph().rankdir.toLowerCase();if(e==="lr"||e==="rl")yn(r)}function gn(r){var e=r.graph().rankdir.toLowerCase();if(e==="bt"||e==="rl")as(r);if(e==="lr"||e==="rl")fs(r),yn(r)}function yn(r){f(r.nodes(),function(e){mn(r.node(e))}),f(r.edges(),function(e){mn(r.edge(e))})}function mn(r){var e=r.width;r.width=r.height,r.height=e}function as(r){f(r.nodes(),function(e){Xr(r.node(e))}),f(r.edges(),function(e){var n=r.edge(e);if(f(n.points,Xr),Object.prototype.hasOwnProperty.call(n,"y"))Xr(n)})}function Xr(r){r.y=-r.y}function fs(r){f(r.nodes(),function(e){Ur(r.node(e))}),f(r.edges(),function(e){var n=r.edge(e);if(f(n.points,Ur),Object.prototype.hasOwnProperty.call(n,"x"))Ur(n)})}function Ur(r){var e=r.x;r.x=r.y,r.y=e}function En(r){r.graph().dummyChains=[],f(r.edges(),function(e){us(r,e)})}function us(r,e){var n=e.v,o=r.node(n).rank,i=e.w,s=r.node(i).rank,u=e.name,d=r.edge(e),c=d.labelRank;if(s===o+1)return;r.removeEdge(e);var p=void 0,m,h;for(h=0,++o;o<s;++h,++o){if(d.points=[],p={width:0,height:0,edgeLabel:d,edgeObj:e,rank:o},m=T(r,"edge",p,"_d"),o===c)p.width=d.width,p.height=d.height,p.dummy="edge-label",p.labelpos=d.labelpos;if(r.setEdge(n,m,{weight:d.weight},u),h===0)r.graph().dummyChains.push(m);n=m}r.setEdge(n,i,{weight:d.weight},u)}function On(r){f(r.graph().dummyChains,function(e){var n=r.node(e),o=n.edgeLabel,i;r.setEdge(n.edgeObj,o);while(n.dummy){if(i=r.successors(e)[0],r.removeNode(e),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label")o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height;e=i,n=r.node(e)}})}function ir(r){var e={};function n(o){var i=r.node(o);if(Object.prototype.hasOwnProperty.call(e,o))return i.rank;e[o]=!0;var s=B(E(r.outEdges(o),function(u){return n(u.w)-r.edge(u).minlen}));if(s===Number.POSITIVE_INFINITY||s===void 0||s===null)s=0;return i.rank=s}f(r.sources(),n)}function U(r,e){return r.node(e.w).rank-r.node(e.v).rank-r.edge(e).minlen}function Nr(r){var e=new re({directed:!1}),n=r.nodes()[0],o=r.nodeCount();e.setNode(n,{});var i,s;while(ds(e,r)<o)i=cs(e,r),s=e.hasNode(i.v)?U(r,i):-U(r,i),ps(e,r,s);return e}function ds(r,e){function n(o){f(e.nodeEdges(o),function(i){var s=i.v,u=o===s?i.w:s;if(!r.hasNode(u)&&!U(e,i))r.setNode(u,{}),r.setEdge(o,u,{}),n(u)})}return f(r.nodes(),n),r.nodeCount()}function cs(r,e){return J(e.edges(),function(n){if(r.hasNode(n.v)!==r.hasNode(n.w))return U(e,n)})}function ps(r,e,n){f(r.nodes(),function(o){e.node(o).rank+=n})}var dh=it(1);var vh=it(1);Vr.CycleException=ar;function Vr(r){var e={},n={},o=[];function i(s){if(Object.prototype.hasOwnProperty.call(n,s))throw new ar;if(!Object.prototype.hasOwnProperty.call(e,s))n[s]=!0,e[s]=!0,f(r.predecessors(s),i),delete n[s],o.push(s)}if(f(r.sinks(),i),Wt(e)!==r.nodeCount())throw new ar;return o}function ar(){}ar.prototype=Error();function Pr(r,e,n){if(!H(e))e=[e];var o=(r.isDirected()?r.successors:r.neighbors).bind(r),i=[],s={};return f(e,function(u){if(!r.hasNode(u))throw Error("Graph does not have node: "+u);In(r,u,n==="post",s,o,i)}),i}function In(r,e,n,o,i,s){if(!Object.prototype.hasOwnProperty.call(o,e)){if(o[e]=!0,!n)s.push(e);if(f(i(e),function(u){In(r,u,n,o,i,s)}),n)s.push(e)}}function Yr(r,e){return Pr(r,e,"post")}function zr(r,e){return Pr(r,e,"pre")}G.initLowLimValues=qr;G.initCutValues=Wr;G.calcCutValue=Pn;G.leaveEdge=An;G.enterEdge=Rn;G.exchangeEdges=Mn;function G(r){r=an(r),ir(r);var e=Nr(r);qr(e),Wr(e,r);var n,o;while(n=An(e))o=Rn(e,r,n),Mn(e,r,n,o)}function Wr(r,e){var n=Yr(r,r.nodes());n=n.slice(0,n.length-1),f(n,function(o){vs(r,e,o)})}function vs(r,e,n){var o=r.node(n),i=o.parent;r.edge(n,i).cutvalue=Pn(r,e,n)}function Pn(r,e,n){var o=r.node(n),i=o.parent,s=!0,u=e.edge(n,i),d=0;if(!u)s=!1,u=e.edge(i,n);return d=u.weight,f(e.nodeEdges(n),function(c){var p=c.v===n,m=p?c.w:c.v;if(m!==i){var h=p===s,g=e.edge(c).weight;if(d+=h?g:-g,ys(r,n,m)){var b=r.edge(n,m).cutvalue;d+=h?-b:b}}}),d}function qr(r,e){if(arguments.length<2)e=r.nodes()[0];Tn(r,{},1,e)}function Tn(r,e,n,o,i){var s=n,u=r.node(o);if(e[o]=!0,f(r.neighbors(o),function(d){if(!Object.prototype.hasOwnProperty.call(e,d))n=Tn(r,e,n,d,o)}),u.low=s,u.lim=n++,i)u.parent=i;else delete u.parent;return n}function An(r){return nr(r.edges(),function(e){return r.edge(e).cutvalue<0})}function Rn(r,e,n){var{v:o,w:i}=n;if(!e.hasEdge(o,i))o=n.w,i=n.v;var s=r.node(o),u=r.node(i),d=s,c=!1;if(s.lim>u.lim)d=u,c=!0;var p=Qe(e.edges(),function(m){return c===Nn(r,r.node(m.v),d)&&c!==Nn(r,r.node(m.w),d)});return J(p,function(m){return U(e,m)})}function Mn(r,e,n,o){var{v:i,w:s}=n;r.removeEdge(i,s),r.setEdge(o.v,o.w,{}),qr(r),Wr(r,e),bs(r,e)}function bs(r,e){var n=nr(r.nodes(),function(i){return!e.node(i).parent}),o=zr(r,n);o=o.slice(1),f(o,function(i){var s=r.node(i).parent,u=e.edge(i,s),d=!1;if(!u)u=e.edge(s,i),d=!0;e.node(i).rank=e.node(s).rank+(d?u.minlen:-u.minlen)})}function ys(r,e,n){return r.hasEdge(e,n)}function Nn(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}function Hr(r){switch(r.graph().ranker){case"network-simplex":jn(r);break;case"tight-tree":_s(r);break;case"longest-path":ws(r);break;default:jn(r)}}var ws=ir;function _s(r){ir(r),Nr(r)}function jn(r){G(r)}function Dn(r){var e=T(r,"root",{},"_root"),n=Es(r),o=S(pt(n))-1,i=2*o+1;r.graph().nestingRoot=e,f(r.edges(),function(u){r.edge(u).minlen*=i});var s=xs(r)+1;f(r.children(),function(u){Fn(r,e,i,s,o,n,u)}),r.graph().nodeRankFactor=i}function Fn(r,e,n,o,i,s,u){var d=r.children(u);if(!d.length){if(u!==e)r.setEdge(e,u,{weight:0,minlen:n});return}var c=Dr(r,"_bt"),p=Dr(r,"_bb"),m=r.node(u);if(r.setParent(c,u),m.borderTop=c,r.setParent(p,u),m.borderBottom=p,f(d,function(h){Fn(r,e,n,o,i,s,h);var g=r.node(h),b=g.borderTop?g.borderTop:h,w=g.borderBottom?g.borderBottom:h,y=g.borderTop?o:2*o,v=b!==w?1:i-s[u]+1;r.setEdge(c,b,{weight:y,minlen:v,nestingEdge:!0}),r.setEdge(w,p,{weight:y,minlen:v,nestingEdge:!0})}),!r.parent(u))r.setEdge(e,c,{weight:0,minlen:i+s[u]})}function Es(r){var e={};function n(o,i){var s=r.children(o);if(s&&s.length)f(s,function(u){n(u,i+1)});e[o]=i}return f(r.children(),function(o){n(o,1)}),e}function xs(r){return Kt(r.edges(),function(e,n){return e+r.edge(n).weight},0)}function Gn(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,f(r.edges(),function(n){var o=r.edge(n);if(o.nestingEdge)r.removeEdge(n)})}function Xn(r,e,n){var o={},i;f(n,function(s){var u=r.parent(s),d,c;while(u){if(d=r.parent(u),d)c=o[d],o[d]=u;else c=i,i=u;if(c&&c!==u){e.setEdge(c,u);return}u=d}})}function Un(r,e,n){var o=Ls(r),i=new re({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(s){return r.node(s)});return f(r.nodes(),function(s){var u=r.node(s),d=r.parent(s);if(u.rank===e||u.minRank<=e&&e<=u.maxRank){if(i.setNode(s),i.setParent(s,d||o),f(r[n](s),function(c){var p=c.v===s?c.w:c.v,m=i.edge(p,s),h=!we(m)?m.weight:0;i.setEdge(p,s,{weight:r.edge(c).weight+h})}),Object.prototype.hasOwnProperty.call(u,"minRank"))i.setNode(s,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]})}}),i}function Ls(r){var e;while(r.hasNode(e=Q("_root")));return e}function Vn(r,e){var n=0;for(var o=1;o<e.length;++o)n+=Is(r,e[o-1],e[o]);return n}function Is(r,e,n){var o=Ar(n,E(n,function(p,m){return m})),i=N(E(e,function(p){return A(E(r.outEdges(p),function(m){return{pos:o[m.w],weight:r.edge(m).weight}}),"pos")})),s=1;while(s<n.length)s<<=1;var u=2*s-1;s-=1;var d=E(Array(u),function(){return 0}),c=0;return f(i.forEach(function(p){var m=p.pos+s;d[m]+=p.weight;var h=0;while(m>0){if(m%2)h+=d[m+1];m=m-1>>1,d[m]+=p.weight}c+=p.weight*h})),c}function zn(r){var e={},n=Qe(r.nodes(),function(d){return!r.children(d).length}),o=S(E(n,function(d){return r.node(d).rank})),i=E(P(o+1),function(){return[]});function s(d){if(Lr(e,d))return;e[d]=!0;var c=r.node(d);i[c.rank].push(d),f(r.successors(d),s)}var u=A(n,function(d){return r.node(d).rank});return f(u,s),i}function Wn(r,e){return E(e,function(n){var o=r.inEdges(n);if(!o.length)return{v:n};else{var i=Kt(o,function(s,u){var d=r.edge(u),c=r.node(u.v);return{sum:s.sum+d.weight*c.order,weight:s.weight+d.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function qn(r,e){var n={};f(r,function(i,s){var u=n[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:s};if(!we(i.barycenter))u.barycenter=i.barycenter,u.weight=i.weight}),f(e.edges(),function(i){var s=n[i.v],u=n[i.w];if(!we(s)&&!we(u))u.indegree++,s.out.push(n[i.w])});var o=Qe(n,function(i){return!i.indegree});return Ss(o)}function Ss(r){var e=[];function n(s){return function(u){if(u.merged)return;if(we(u.barycenter)||we(s.barycenter)||u.barycenter>=s.barycenter)Ns(s,u)}}function o(s){return function(u){if(u.in.push(s),--u.indegree===0)r.push(u)}}while(r.length){var i=r.pop();e.push(i),f(i.in.reverse(),n(i)),f(i.out,o(i))}return E(Qe(e,function(s){return!s.merged}),function(s){return Z(s,["vs","i","barycenter","weight"])})}function Ns(r,e){var n=0,o=0;if(r.weight)n+=r.barycenter*r.weight,o+=r.weight;if(e.weight)n+=e.barycenter*e.weight,o+=e.weight;r.vs=e.vs.concat(r.vs),r.barycenter=n/o,r.weight=o,r.i=Math.min(e.i,r.i),e.merged=!0}function Kn(r,e){var n=un(r,function(m){return Object.prototype.hasOwnProperty.call(m,"barycenter")}),o=n.lhs,i=A(n.rhs,function(m){return-m.i}),s=[],u=0,d=0,c=0;o.sort(Ps(!!e)),c=Hn(s,i,c),f(o,function(m){c+=m.vs.length,s.push(m.vs),u+=m.barycenter*m.weight,d+=m.weight,c=Hn(s,i,c)});var p={vs:N(s)};if(d)p.barycenter=u/d,p.weight=d;return p}function Hn(r,e,n){var o;while(e.length&&(o=X(e)).i<=n)e.pop(),r.push(o.vs),n++;return n}function Ps(r){return function(e,n){if(e.barycenter<n.barycenter)return-1;else if(e.barycenter>n.barycenter)return 1;return!r?e.i-n.i:n.i-e.i}}function Kr(r,e,n,o){var i=r.children(e),s=r.node(e),u=s?s.borderLeft:void 0,d=s?s.borderRight:void 0,c={};if(u)i=Qe(i,function(w){return w!==u&&w!==d});var p=Wn(r,i);f(p,function(w){if(r.children(w.v).length){var y=Kr(r,w.v,n,o);if(c[w.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter"))Ts(w,y)}});var m=qn(p,n);ks(m,c);var h=Kn(m,o);if(u){if(h.vs=N([u,h.vs,d]),r.predecessors(u).length){var g=r.node(r.predecessors(u)[0]),b=r.node(r.predecessors(d)[0]);if(!Object.prototype.hasOwnProperty.call(h,"barycenter"))h.barycenter=0,h.weight=0;h.barycenter=(h.barycenter*h.weight+g.order+b.order)/(h.weight+2),h.weight+=2}}return h}function ks(r,e){f(r,function(n){n.vs=N(n.vs.map(function(o){if(e[o])return e[o].vs;return o}))})}function Ts(r,e){if(!we(r.barycenter))r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight;else r.barycenter=e.barycenter,r.weight=e.weight}function $n(r){var e=Gr(r),n=Jn(r,P(1,e+1),"inEdges"),o=Jn(r,P(e-1,-1,-1),"outEdges"),i=zn(r);Zn(r,i);var s=Number.POSITIVE_INFINITY,u;for(var d=0,c=0;c<4;++d,++c){Cs(d%2?n:o,d%4>=2),i=D(r);var p=Vn(r,i);if(p<s)c=0,u=Ze(i),s=p}Zn(r,u)}function Jn(r,e,n){return E(e,function(o){return Un(r,o,n)})}function Cs(r,e){var n=new re;f(r,function(o){var i=o.graph().root,s=Kr(o,i,n,e);f(s.vs,function(u,d){o.node(u).order=d}),Xn(o,n,s.vs)})}function Zn(r,e){f(e,function(n){f(n,function(o,i){r.node(o).order=i})})}function Qn(r){var e=Rs(r);f(r.graph().dummyChains,function(n){var o=r.node(n),i=o.edgeObj,s=As(r,e,i.v,i.w),{path:u,lca:d}=s,c=0,p=u[c],m=!0;while(n!==i.w){if(o=r.node(n),m){while((p=u[c])!==d&&r.node(p).maxRank<o.rank)c++;if(p===d)m=!1}if(!m){while(c<u.length-1&&r.node(p=u[c+1]).minRank<=o.rank)c++;p=u[c]}r.setParent(n,p),n=r.successors(n)[0]}})}function As(r,e,n,o){var i=[],s=[],u=Math.min(e[n].low,e[o].low),d=Math.max(e[n].lim,e[o].lim),c,p;c=n;do c=r.parent(c),i.push(c);while(c&&(e[c].low>u||d>e[c].lim));p=c,c=o;while((c=r.parent(c))!==p)s.push(c);return{path:i.concat(s.reverse()),lca:p}}function Rs(r){var e={},n=0;function o(i){var s=n;f(r.children(i),o),e[i]={low:s,lim:n++}}return f(r.children(),o),e}function Ms(r,e){var n={};function o(i,s){var u=0,d=0,c=i.length,p=X(s);return f(s,function(m,h){var g=Bs(r,m),b=g?r.node(g).order:c;if(g||m===p)f(s.slice(d,h+1),function(w){f(r.predecessors(w),function(y){var v=r.node(y),_=v.order;if((_<u||b<_)&&!(v.dummy&&r.node(w).dummy))ro(n,y,w)})}),d=h+1,u=b}),s}return Kt(e,o),n}function js(r,e){var n={};function o(s,u,d,c,p){var m;f(P(u,d),function(h){if(m=s[h],r.node(m).dummy)f(r.predecessors(m),function(g){var b=r.node(g);if(b.dummy&&(b.order<c||b.order>p))ro(n,g,m)})})}function i(s,u){var d=-1,c,p=0;return f(u,function(m,h){if(r.node(m).dummy==="border"){var g=r.predecessors(m);if(g.length)c=r.node(g[0]).order,o(u,p,h,d,c),p=h,d=c}o(u,p,u.length,c,s.length)}),u}return Kt(e,i),n}function Bs(r,e){if(r.node(e).dummy)return nr(r.predecessors(e),function(n){return r.node(n).dummy})}function ro(r,e,n){if(e>n){var o=e;e=n,n=o}if(!Object.prototype.hasOwnProperty.call(r,e))Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=r[e];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ds(r,e,n){if(e>n){var o=e;e=n,n=o}return!!r[e]&&Object.prototype.hasOwnProperty.call(r[e],n)}function Fs(r,e,n,o){var i={},s={},u={};return f(e,function(d){f(d,function(c,p){i[c]=c,s[c]=c,u[c]=p})}),f(e,function(d){var c=-1;f(d,function(p){var m=o(p);if(m.length){m=A(m,function(y){return u[y]});var h=(m.length-1)/2;for(var g=Math.floor(h),b=Math.ceil(h);g<=b;++g){var w=m[g];if(s[p]===p&&c<u[w]&&!Ds(n,p,w))s[w]=p,s[p]=i[p]=i[w],c=u[w]}}})}),{root:i,align:s}}function Gs(r,e,n,o,i){var s={},u=Xs(r,e,n,i),d=i?"borderLeft":"borderRight";function c(h,g){var b=u.nodes(),w=b.pop(),y={};while(w){if(y[w])h(w);else y[w]=!0,b.push(w),b=b.concat(g(w));w=b.pop()}}function p(h){s[h]=u.inEdges(h).reduce(function(g,b){return Math.max(g,s[b.v]+u.edge(b))},0)}function m(h){var g=u.outEdges(h).reduce(function(w,y){return Math.min(w,s[y.w]-u.edge(y))},Number.POSITIVE_INFINITY),b=r.node(h);if(g!==Number.POSITIVE_INFINITY&&b.borderType!==d)s[h]=Math.max(s[h],g)}return c(p,u.predecessors.bind(u)),c(m,u.successors.bind(u)),f(o,function(h){s[h]=s[n[h]]}),s}function Xs(r,e,n,o){var i=new re,s=r.graph(),u=zs(s.nodesep,s.edgesep,o);return f(e,function(d){var c;f(d,function(p){var m=n[p];if(i.setNode(m),c){var h=n[c],g=i.edge(h,m);i.setEdge(h,m,Math.max(u(r,p,c),g||0))}c=p})}),i}function Us(r,e){return J(pt(e),function(n){var{NEGATIVE_INFINITY:o,POSITIVE_INFINITY:i}=Number;return lt(n,function(s,u){var d=Ws(r,u)/2;o=Math.max(s+d,o),i=Math.min(s-d,i)}),o-i})}function Vs(r,e){var n=pt(e),o=B(n),i=S(n);f(["u","d"],function(s){f(["l","r"],function(u){var d=s+u,c=r[d],p;if(c===e)return;var m=pt(c);if(p=u==="l"?o-B(m):i-S(m),p)r[d]=q(c,function(h){return h+p})})})}function Ys(r,e){return q(r.ul,function(n,o){if(e)return r[e.toLowerCase()][o];else{var i=A(E(r,o));return(i[1]+i[2])/2}})}function to(r){var e=D(r),n=or(Ms(r,e),js(r,e)),o={},i;f(["u","d"],function(u){i=u==="u"?e:pt(e).reverse(),f(["l","r"],function(d){if(d==="r")i=E(i,function(h){return pt(h).reverse()});var c=(u==="u"?r.predecessors:r.successors).bind(r),p=Fs(r,i,n,c),m=Gs(r,i,p.root,p.align,d==="r");if(d==="r")m=q(m,function(h){return-h});o[u+d]=m})});var s=Us(r,o);return Vs(o,s),Ys(o,r.graph().align)}function zs(r,e,n){return function(o,i,s){var u=o.node(i),d=o.node(s),c=0,p;if(c+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":p=-u.width/2;break;case"r":p=u.width/2;break}if(p)c+=n?p:-p;if(p=0,c+=(u.dummy?e:r)/2,c+=(d.dummy?e:r)/2,c+=d.width/2,Object.prototype.hasOwnProperty.call(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":p=d.width/2;break;case"r":p=-d.width/2;break}if(p)c+=n?p:-p;return p=0,c}}function Ws(r,e){return r.node(e).width}function no(r){r=Sr(r),qs(r),mt(to(r),function(e,n){r.node(n).x=e})}function qs(r){var e=D(r),n=r.graph().ranksep,o=0;f(e,function(i){var s=S(E(i,function(u){return r.node(u).height}));f(i,function(u){r.node(u).y=o+s/2}),o+=s+n})}function $r(r,e){var n=e&&e.debugTiming?dn:cn;n("layout",()=>{var o=n(" buildLayoutGraph",()=>ou(r));n(" runLayout",()=>Hs(o,n)),n(" updateInputGraph",()=>Ks(r,o))})}function Hs(r,e){e(" makeSpaceForEdgeLabels",()=>iu(r)),e(" removeSelfEdges",()=>mu(r)),e(" acyclic",()=>rn(r)),e(" nestingGraph.run",()=>Dn(r)),e(" rank",()=>Hr(Sr(r))),e(" injectEdgeLabelProxies",()=>au(r)),e(" removeEmptyRanks",()=>sn(r)),e(" nestingGraph.cleanup",()=>Gn(r)),e(" normalizeRanks",()=>fn(r)),e(" assignRankMinMax",()=>fu(r)),e(" removeEdgeLabelProxies",()=>su(r)),e(" normalize.run",()=>En(r)),e(" parentDummyChains",()=>Qn(r)),e(" addBorderSegments",()=>ln(r)),e(" order",()=>$n(r)),e(" insertSelfEdges",()=>hu(r)),e(" adjustCoordinateSystem",()=>hn(r)),e(" position",()=>no(r)),e(" positionSelfEdges",()=>gu(r)),e(" removeBorderNodes",()=>lu(r)),e(" normalize.undo",()=>On(r)),e(" fixupEdgeLabelCoords",()=>cu(r)),e(" undoCoordinateSystem",()=>gn(r)),e(" translateGraph",()=>uu(r)),e(" assignNodeIntersects",()=>du(r)),e(" reversePoints",()=>pu(r)),e(" acyclic.undo",()=>en(r))}function Ks(r,e){f(r.nodes(),function(n){var o=r.node(n),i=e.node(n);if(o){if(o.x=i.x,o.y=i.y,e.children(n).length)o.width=i.width,o.height=i.height}}),f(r.edges(),function(n){var o=r.edge(n),i=e.edge(n);if(o.points=i.points,Object.prototype.hasOwnProperty.call(i,"x"))o.x=i.x,o.y=i.y}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}var Js=["nodesep","edgesep","ranksep","marginx","marginy"],Zs={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},$s=["acyclicer","ranker","rankdir","align"],Qs=["width","height"],ru={width:0,height:0},eu=["minlen","weight","width","height","labeloffset"],tu={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},nu=["labelpos"];function ou(r){var e=new re({multigraph:!0,compound:!0}),n=Zr(r.graph());return e.setGraph(or({},Zs,Jr(n,Js),Z(n,$s))),f(r.nodes(),function(o){var i=Zr(r.node(o));e.setNode(o,et(Jr(i,Qs),ru)),e.setParent(o,r.parent(o))}),f(r.edges(),function(o){var i=Zr(r.edge(o));e.setEdge(o,or({},tu,Jr(i,eu),Z(i,nu)))}),e}function iu(r){var e=r.graph();e.ranksep/=2,f(r.edges(),function(n){var o=r.edge(n);if(o.minlen*=2,o.labelpos.toLowerCase()!=="c")if(e.rankdir==="TB"||e.rankdir==="BT")o.width+=o.labeloffset;else o.height+=o.labeloffset})}function au(r){f(r.edges(),function(e){var n=r.edge(e);if(n.width&&n.height){var o=r.node(e.v),i=r.node(e.w),s={rank:(i.rank-o.rank)/2+o.rank,e};T(r,"edge-proxy",s,"_ep")}})}function fu(r){var e=0;f(r.nodes(),function(n){var o=r.node(n);if(o.borderTop)o.minRank=r.node(o.borderTop).rank,o.maxRank=r.node(o.borderBottom).rank,e=S(e,o.maxRank)}),r.graph().maxRank=e}function su(r){f(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="edge-proxy")r.edge(n.e).labelRank=n.rank,r.removeNode(e)})}function uu(r){var e=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,s=r.graph(),u=s.marginx||0,d=s.marginy||0;function c(p){var{x:m,y:h,width:g,height:b}=p;e=Math.min(e,m-g/2),n=Math.max(n,m+g/2),o=Math.min(o,h-b/2),i=Math.max(i,h+b/2)}f(r.nodes(),function(p){c(r.node(p))}),f(r.edges(),function(p){var m=r.edge(p);if(Object.prototype.hasOwnProperty.call(m,"x"))c(m)}),e-=u,o-=d,f(r.nodes(),function(p){var m=r.node(p);m.x-=e,m.y-=o}),f(r.edges(),function(p){var m=r.edge(p);if(f(m.points,function(h){h.x-=e,h.y-=o}),Object.prototype.hasOwnProperty.call(m,"x"))m.x-=e;if(Object.prototype.hasOwnProperty.call(m,"y"))m.y-=o}),s.width=n-e+u,s.height=i-o+d}function du(r){f(r.edges(),function(e){var n=r.edge(e),o=r.node(e.v),i=r.node(e.w),s,u;if(!n.points)n.points=[],s=i,u=o;else s=n.points[0],u=n.points[n.points.length-1];n.points.unshift(Br(o,s)),n.points.push(Br(i,u))})}function cu(r){f(r.edges(),function(e){var n=r.edge(e);if(Object.prototype.hasOwnProperty.call(n,"x")){if(n.labelpos==="l"||n.labelpos==="r")n.width-=n.labeloffset;switch(n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}}})}function pu(r){f(r.edges(),function(e){var n=r.edge(e);if(n.reversed)n.points.reverse()})}function lu(r){f(r.nodes(),function(e){if(r.children(e).length){var n=r.node(e),o=r.node(n.borderTop),i=r.node(n.borderBottom),s=r.node(X(n.borderLeft)),u=r.node(X(n.borderRight));n.width=Math.abs(u.x-s.x),n.height=Math.abs(i.y-o.y),n.x=s.x+n.width/2,n.y=o.y+n.height/2}}),f(r.nodes(),function(e){if(r.node(e).dummy==="border")r.removeNode(e)})}function mu(r){f(r.edges(),function(e){if(e.v===e.w){var n=r.node(e.v);if(!n.selfEdges)n.selfEdges=[];n.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}function hu(r){var e=D(r);f(e,function(n){var o=0;f(n,function(i,s){var u=r.node(i);u.order=s+o,f(u.selfEdges,function(d){T(r,"selfedge",{width:d.label.width,height:d.label.height,rank:u.rank,order:s+ ++o,e:d.e,label:d.label},"_se")}),delete u.selfEdges})})}function gu(r){f(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="selfedge"){var o=r.node(n.e.v),i=o.x+o.width/2,s=o.y,u=n.x-i,d=o.height/2;r.setEdge(n.e,n.label),r.removeNode(e),n.label.points=[{x:i+2*u/3,y:s-d},{x:i+5*u/6,y:s-d},{x:i+u,y:s},{x:i+5*u/6,y:s+d},{x:i+2*u/3,y:s+d}],n.label.x=n.x,n.label.y=n.y}})}function Jr(r,e){return q(Z(r,e),Number)}function Zr(r){var e={};return f(r,function(n,o){e[o.toLowerCase()]=n}),e}var oo=t((r,e,n)=>Math.max(e,Math.min(n,r)),"clamp"),io=t((r="TB")=>{switch(r){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),vu=t((r)=>r==="flowchart"||r==="flowchart-v2"||r==="stateDiagram"||r==="er"||r==="classDiagram","shouldMergeSelfLoopSegments"),bu=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],yu=t((r,e,n,o,i)=>{let s=[],u=new Set;if(n.forEach(({start:m,end:h})=>{if(m!==o)u.add(m);if(h!==o)u.add(h)}),u.forEach((m)=>{let h=r.node(m);if(typeof h?.x==="number"&&typeof h?.y==="number")s.push(h)}),s.length===0)n.forEach(({edge:m})=>{(m.points??[]).forEach((h)=>{if(typeof h?.x==="number"&&typeof h?.y==="number")s.push(h)})});if(s.length===0)return io(i);let d=s.reduce((m,h)=>({x:m.x+h.x/s.length,y:m.y+h.y/s.length}),{x:0,y:0}),c=d.x-e.x,p=d.y-e.y;if(Math.abs(c)>Math.abs(p))return c>0?"right":"left";if(Math.abs(p)>0)return p>0?"bottom":"top";return io(i)},"getSelfLoopSide"),wu=t((r,e="top",n=0,o=0)=>{let i=r.x,s=r.y-n,u=r.width/2,d=r.height/2,c=Math.max(36,Math.min(100,r.width*0.8)),p=oo(Math.max(o,r.width*0.35),36,c),m=oo(Math.min(r.width,r.height)*0.45,24,48);switch(e){case"bottom":{let h=s+d;return[{x:i-p/2,y:h},{x:i-p/2,y:h+m},{x:i+p/2,y:h+m},{x:i+p/2,y:h}]}case"right":{let h=i+u;return[{x:h,y:s-p/2},{x:h+m,y:s-p/2},{x:h+m,y:s+p/2},{x:h,y:s+p/2}]}case"left":{let h=i-u;return[{x:h,y:s-p/2},{x:h-m,y:s-p/2},{x:h-m,y:s+p/2},{x:h,y:s+p/2}]}case"top":default:{let h=s-d;return[{x:i-p/2,y:h},{x:i-p/2,y:h-m},{x:i+p/2,y:h-m},{x:i+p/2,y:h}]}}},"getSelfLoopPoints"),_u=t((r,e,n="top",o=0,i={})=>{let u=r.x,d=r.y-o,c=i.width??0,p=i.height??0;switch(n){case"bottom":return{x:u,y:Math.max(...e.map((m)=>m.y))+p/2+4};case"right":return{x:Math.max(...e.map((m)=>m.x))+c/2+4,y:d};case"left":return{x:Math.min(...e.map((m)=>m.x))-c/2-4,y:d};case"top":default:return{x:u,y:Math.min(...e.map((m)=>m.y))-p/2-4}}},"getSelfLoopLabelPosition"),Ki=t((r,e=0,{mergeSelfLoops:n=!0}={})=>{let o=new Map,i=[],s=r.graph()?.rankdir;return r.edges().forEach((u)=>{let d=r.edge(u);if(n&&d.selfLoop){let c=d.selfLoop.id;if(!o.has(c))o.set(c,[]);o.get(c).push({edge:d,start:u.v,end:u.w})}else i.push({edge:d,start:u.v,end:u.w})}),o.forEach((u)=>{if(u.length!==3){u.forEach((_)=>i.push(_));return}u.sort((_,R)=>_.edge.selfLoop.order-R.edge.selfLoop.order);let[d,c,p]=u,m=d.edge.originalEdge??c.edge.originalEdge??p.edge.originalEdge??c.edge,h=r.node(m.start);if(!h){u.forEach((_)=>i.push(_));return}let g={width:c.edge.width,height:c.edge.height},b=yu(r,h,u,m.start,s),w=wu(h,b,e,g.width??0),y=_u(h,w,b,e,g),v={...c.edge,...m,id:m.id,points:w,start:m.start,end:m.end,x:y.x,y:y.y,width:g.width,height:g.height,labelStyle:c.edge.labelStyle,fromCluster:d.edge.fromCluster??c.edge.fromCluster??p.edge.fromCluster,toCluster:d.edge.toCluster??c.edge.toCluster??p.edge.toCluster};delete v.selfLoop,delete v.originalEdge,i.push({edge:v,start:v.start,end:v.end})}),i},"getEdgesToRender"),fo=t(async({element:r,graph:e,diagramType:n,id:o,parentCluster:i,siteConfig:s})=>{let u=e.graph().rankdir;a.trace("Dir in recursive render - dir:",u);let{clusters:d,edgePaths:c,edgeLabels:p,nodes:m,rootGroups:h}=ia(r,{edgePathsClass:"edgePaths"});if(!e.nodes())a.info("No nodes found for",e);else a.info("Recursive render XXX",e.nodes());if(e.edges().length>0)a.info("Recursive edges",e.edge(e.edges()[0]));let g=vu(n);await Promise.all(e.nodes().map(async function(y){let v=e.node(y);if(i!==void 0){let _=JSON.parse(JSON.stringify(i.clusterData));if(a.trace(`Setting data for parent cluster XXX
|
|
2
|
+
Node.id = `,y,`
|
|
3
|
+
data=`,_.height,`
|
|
4
|
+
Parent cluster`,i.height),e.setNode(i.id,_),!e.parent(y))a.trace("Setting parent",y,i.id),e.setParent(y,i.id,_)}if(a.info("(Insert) Node XXX"+y+": "+JSON.stringify(e.node(y))),v?.clusterNode){a.info("Cluster identified XBX",y,v.width,e.node(y));let{ranksep:_,nodesep:R}=e.graph();v.graph.setGraph({...v.graph.graph(),ranksep:_+25,nodesep:R});let Qr=await Lu({element:m,graph:v.graph,diagramType:n,id:o,parentCluster:e.node(y),siteConfig:s}),ee=Qr.elem;I(v,ee),v.diff=Qr.diff||0,a.info("New compound node after recursive render XAX",y,"width",v.width,"height",v.height),go(ee,v)}else if(e.children(y).length>0)a.trace("Cluster - the non recursive path XBX",y,v.id,v,v.width,"Graph:",e),a.trace(Bn(v.id,e)),W.set(v.id,{id:Bn(v.id,e),node:v});else a.trace("Node - the non recursive path XAX",y,m,e.node(y),u),await oa(m,e.node(y),{config:s,dir:u})})),await t(async()=>{let y=e.edges().map(async function(v){let _=e.edge(v.v,v.w,v.name);if(a.info("Edge "+v.v+" -> "+v.w+": "+JSON.stringify(v)),a.info("Edge "+v.v+" -> "+v.w+": ",v," ",JSON.stringify(e.edge(v))),a.info("Fix",W,"ids:",v.v,v.w,"Translating: ",W.get(v.v),W.get(v.w)),g&&_.selfLoop){if(_.selfLoop.order!==1)return;let R={..._.originalEdge,..._,id:_.selfLoop.id,startLabelLeft:_.originalEdge?.startLabelLeft??_.startLabelLeft,startLabelRight:_.originalEdge?.startLabelRight??_.startLabelRight,endLabelLeft:_.originalEdge?.endLabelLeft??_.endLabelLeft,endLabelRight:_.originalEdge?.endLabelRight??_.endLabelRight};await At(p,R),_.width=R.width,_.height=R.height,_.labelStyle=R.labelStyle;return}await At(p,_)});await Promise.all(y)},"processEdges")();let{subGraphTitleTotalMargin:w}=Tt(s);return{elem:h,graph:e,groups:{clusters:d,edgePaths:c,edgeLabels:p,nodes:m,rootGroups:h},diagramType:n,id:o,mergeSelfLoops:g,subGraphTitleTotalMargin:w}},"measureDagreGraph"),so=t((r)=>{a.info("############################################# XXX"),a.info("### Layout ### XXX"),a.info("############################################# XXX"),$r(r)},"runDagreGraphLayout"),Eu=t((r,e,n)=>{let o=r.node(e);if(!o)return;let i={...o};if(o?.clusterNode)i.y=(o.y??0)+n;else if(r.children(e).length>0)i.height=(o.height??0)+n;else i.y=(o.y??0)+n/2;return i},"normalizeDagreNode"),ao=t((r,e)=>{bu.forEach((n)=>{if(e[n]!==void 0)r[n]=e[n]})},"applyDagreNodeLayout"),xu=t((r,e,n,o)=>({...r,start:r.start??e,end:r.end??n,points:(r.points??[]).map((i)=>({...i,y:typeof i.y==="number"?i.y+o:i.y}))}),"normalizeDagreEdge"),Co=t((r,e)=>{let{graph:n,mergeSelfLoops:o,subGraphTitleTotalMargin:i=0}=e,s=new Map(r.nodes.map((d)=>[d.id,d]));sa(n).forEach((d)=>{let c=Eu(n,d,i);if(!c)return;ao(n.node(d),c);let p=s.get(d);if(p)ao(p,c)});let u=i/2;return r.edges=Ki(n,u,{mergeSelfLoops:o}).map(({edge:d,start:c,end:p})=>xu(d,c,p,u)),r},"applyDagreLayoutResult"),Ou=t(async({elem:r,graph:e,groups:{clusters:n,edgePaths:o},diagramType:i,id:s,mergeSelfLoops:u,subGraphTitleTotalMargin:d})=>{let c=0;await Promise.all(sa(e).map(async function(h){let g=e.node(h);if(a.info("Position XBX => "+h+": ("+g.x,","+g.y,") width: ",g.width," height: ",g.height),g?.clusterNode)g.y+=d,a.info("A tainted cluster node XBX1",h,g.id,g.width,g.height,g.x,g.y,e.parent(h)),W.get(g.id).node=g,yt(g);else if(e.children(h).length>0){a.info("A pure cluster node XBX1",h,g.id,g.x,g.y,g.width,g.height,e.parent(h)),g.height+=d,e.node(g.parentId);let b=g?.padding/2||0,w=g?.labelBBox?.height||0,y=w-b||0;a.debug("OffsetY",y,"labelHeight",w,"halfPadding",b),await tn(n,g),W.get(g.id).node=g}else{let b=e.node(g.parentId);g.y+=d/2,a.info("A regular node XBX1 - using the padding",g.id,"parent",g.parentId,g.width,g.height,g.x,g.y,"offsetY",g.offsetY,"parent",b,b?.offsetY,g),yt(g)}}));let p=d/2;return Ki(e,p,{mergeSelfLoops:u}).forEach(function({edge:h,start:g,end:b}){a.info("Edge "+g+" -> "+b+": "+JSON.stringify(h),h),h.points.forEach((_)=>_.y+=p);let w=e.node(g),y=e.node(b),v=nn(o,h,W,i,w,y,s);Yn(h,v)}),e.nodes().forEach(function(h){let g=e.node(h);if(a.info(h,g.type,g.diff),g.isGroup)c=g.diff}),a.warn("Returning from recursive render XAX",r,c),{elem:r,diff:c}},"paintDagreLayoutCore"),Lu=t(async(r)=>{let e=await fo(r);return so(e.graph),await Ou(e)},"renderDagreSubgraph"),Qi=t((r)=>{let e=new re({multigraph:!0,compound:!0}).setGraph({rankdir:r.direction,nodesep:r.config?.nodeSpacing||r.nodeSpacing||r.config?.flowchart?.nodeSpacing,ranksep:r.config?.rankSpacing||r.rankSpacing||r.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return r.nodes.forEach((n)=>{if(e.setNode(n.id,{...n}),n.parentId)e.setParent(n.id,n.parentId)}),a.debug("Edges:",r.edges),r.edges.forEach((n)=>{if(n.start===n.end){let o=n.start,i=o+"---"+o+"---1",s=o+"---"+o+"---2",u=e.node(o);e.setNode(i,{domId:i,id:i,parentId:u.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),e.setParent(i,u.parentId),e.setNode(s,{domId:s,id:s,parentId:u.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),e.setParent(s,u.parentId);let d=structuredClone(n),c=structuredClone(n),p=structuredClone(n),m=structuredClone(n);if(c.originalEdge=d,c.selfLoop={id:d.id,order:0},p.originalEdge=d,p.selfLoop={id:d.id,order:1},m.originalEdge=d,m.selfLoop={id:d.id,order:2},c.label="",c.arrowTypeEnd="none",c.endLabelLeft="",c.endLabelRight="",c.startLabelLeft="",c.id=o+"-cyclic-special-1",p.startLabelRight="",p.startLabelLeft="",p.endLabelLeft="",p.endLabelRight="",p.arrowTypeStart="none",p.arrowTypeEnd="none",p.id=o+"-cyclic-special-mid",m.label="",m.startLabelRight="",m.startLabelLeft="",m.arrowTypeStart="none",u.isGroup)c.fromCluster=o,m.toCluster=o;m.id=o+"-cyclic-special-2",m.arrowTypeStart="none",e.setEdge(o,i,c,o+"-cyclic-special-0"),e.setEdge(i,s,p,o+"-cyclic-special-1"),e.setEdge(s,o,m,o+"-cyclic-special-2")}else e.setEdge(n.start,n.end,{...n},n.id)}),eo(e),{graph:e}},"prepareLayoutForDagre"),So=t(async(r,{element:e,preparedLayout:n})=>{let o=n??Qi(r),i=l(),s=await fo({element:e,graph:o.graph,diagramType:r.type,id:r.diagramId,parentCluster:void 0,siteConfig:i});return o.measuredLayout=s,s},"measureDagreLayout"),To=t((r,e)=>{let n=e.preparedLayout?.measuredLayout;if(!n)throw Error("runDagreLayoutCore requires measureDagreLayout to run first");return so(n.graph),Co(r,n),n},"runDagreLayoutCore"),Iu=t((r,{measure:e})=>sa(e.graph).map((n)=>e.graph.node(n)).filter(Boolean),"getDagrePaintNodes"),Su=t((r,e,{measure:n})=>r?n.graph.node(r):void 0,"getDagreEdgeNode"),Ji=lr({prepareLayout:Qi,measureLayout:So,runLayoutCore:To,paintOptions:{clusterDb:W,getNodes:Iu,getEdgeNode:Su,skipNode:t((r,{measure:e})=>!e.graph.hasNode(r.id),"skipNode"),isCluster:t((r,{measure:e})=>e.graph.hasNode(r.id)&&(e.graph.children(r.id)??[]).length>0,"isCluster")}});export{Ki,Co,Qi,So,To,Ji};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-3q0v8w45.js";import"./chunk-33w36n91.js";import"./chunk-mf6xng5b.js";import{Ji}from"./chunk-qt3n897m.js";export{Ji as render};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e,a,p}from"./chunk-1s53190z.js";import{ut,lr}from"./chunk-gksf7cek.js";import{Se,Te}from"./chunk-rddft5ce.js";var k=Te(function(F,Y){(function(g,r){if(typeof F==="object"&&typeof Y==="object")Y.exports=r(lr());else if(typeof define==="function"&&define.amd)define(["cose-base"],r);else if(typeof F==="object")F.cytoscapeCoseBilkent=r(lr());else g.cytoscapeCoseBilkent=r(g.coseBase)})(F,function(u){return function(g){var r={};function n(o){if(r[o])return r[o].exports;var d=r[o]={i:o,l:!1,exports:{}};return g[o].call(d.exports,d,d.exports,n),d.l=!0,d.exports}return n.m=g,n.c=r,n.i=function(o){return o},n.d=function(o,d,l){if(!n.o(o,d))Object.defineProperty(o,d,{configurable:!1,enumerable:!0,get:l})},n.n=function(o){var d=o&&o.__esModule?function(){return o.default}:function(){return o};return n.d(d,"a",d),d},n.o=function(o,d){return Object.prototype.hasOwnProperty.call(o,d)},n.p="",n(n.s=1)}([function(g,r){g.exports=u},function(g,r,n){var o=n(0).layoutBase.LayoutConstants,d=n(0).layoutBase.FDLayoutConstants,l=n(0).CoSEConstants,L=n(0).CoSELayout,b=n(0).CoSENode,H=n(0).layoutBase.PointD,v=n(0).layoutBase.DimensionD,_={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:0.45,nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.5};function D(E,t){var f={};for(var s in E)f[s]=E[s];for(var s in t)f[s]=t[s];return f}function I(E){this.options=D(_,E),U(this.options)}var U=function(t){if(t.nodeRepulsion!=null)l.DEFAULT_REPULSION_STRENGTH=d.DEFAULT_REPULSION_STRENGTH=t.nodeRepulsion;if(t.idealEdgeLength!=null)l.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=t.idealEdgeLength;if(t.edgeElasticity!=null)l.DEFAULT_SPRING_STRENGTH=d.DEFAULT_SPRING_STRENGTH=t.edgeElasticity;if(t.nestingFactor!=null)l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor;if(t.gravity!=null)l.DEFAULT_GRAVITY_STRENGTH=d.DEFAULT_GRAVITY_STRENGTH=t.gravity;if(t.numIter!=null)l.MAX_ITERATIONS=d.MAX_ITERATIONS=t.numIter;if(t.gravityRange!=null)l.DEFAULT_GRAVITY_RANGE_FACTOR=d.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange;if(t.gravityCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound;if(t.gravityRangeCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound;if(t.initialEnergyOnIncremental!=null)l.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental;if(t.quality=="draft")o.QUALITY=0;else if(t.quality=="proof")o.QUALITY=2;else o.QUALITY=1;l.NODE_DIMENSIONS_INCLUDE_LABELS=d.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!t.randomize,l.ANIMATE=d.ANIMATE=o.ANIMATE=t.animate,l.TILE=t.tile,l.TILING_PADDING_VERTICAL=typeof t.tilingPaddingVertical==="function"?t.tilingPaddingVertical.call():t.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof t.tilingPaddingHorizontal==="function"?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal};I.prototype.run=function(){var E,t,f=this.options,s=this.idToLNode={},c=this.layout=new L,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var y=c.newGraphManager();this.gm=y;var T=this.options.eles.nodes(),m=this.options.eles.edges();this.root=y.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(T),c);for(var h=0;h<m.length;h++){var P=m[h],x=this.idToLNode[P.data("source")],O=this.idToLNode[P.data("target")];if(x!==O&&x.getEdgesBetween(O).length==0){var et=y.add(c.newEdge(),x,O);et.id=P.id()}}var V=function(R,B){if(typeof R==="number")R=B;var C=R.data("id"),G=i.idToLNode[C];return{x:G.getRect().getCenterX(),y:G.getRect().getCenterY()}},nt=function X(){var R=function(){if(f.fit)f.cy.fit(f.eles,f.padding);if(!E)E=!0,i.cy.one("layoutready",f.ready),i.cy.trigger({type:"layoutready",layout:i})},B=i.options.refresh,C;for(var G=0;G<B&&!C;G++)C=i.stopped||i.layout.tick();if(C){if(c.checkLayoutSuccess()&&!c.isSubLayout)c.doPostLayout();if(c.tilingPostLayout)c.tilingPostLayout();if(c.isLayoutFinished=!0,i.options.eles.nodes().positions(V),R(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t)cancelAnimationFrame(t);E=!1;return}var M=i.layout.getPositionsData();f.eles.nodes().positions(function(A,it){if(typeof A==="number")A=it;if(!A.isParent()){var j=A.id(),N=M[j],w=A;while(N==null)if(N=M[w.data("parent")]||M["DummyCompound_"+w.data("parent")],M[j]=N,w=w.parent()[0],w==null)break;if(N!=null)return{x:N.x,y:N.y};else return{x:A.position("x"),y:A.position("y")}}}),R(),t=requestAnimationFrame(X)};if(c.addListener("layoutstarted",function(){if(i.options.animate==="during")t=requestAnimationFrame(nt)}),c.runLayout(),this.options.animate!=="during")i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,V),E=!1;return this},I.prototype.getTopMostNodes=function(E){var t={};for(var f=0;f<E.length;f++)t[E[f].id()]=!0;var s=E.filter(function(c,i){if(typeof c==="number")c=i;var y=c.parent()[0];while(y!=null){if(t[y.id()])return!1;y=y.parent()[0]}return!0});return s},I.prototype.processChildrenList=function(E,t,f){var s=t.length;for(var c=0;c<s;c++){var i=t[c],y=i.children(),T,m=i.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(i.outerWidth()!=null&&i.outerHeight()!=null)T=E.add(new b(f.graphManager,new H(i.position("x")-m.w/2,i.position("y")-m.h/2),new v(parseFloat(m.w),parseFloat(m.h))));else T=E.add(new b(this.graphManager));if(T.id=i.data("id"),T.paddingLeft=parseInt(i.css("padding")),T.paddingTop=parseInt(i.css("padding")),T.paddingRight=parseInt(i.css("padding")),T.paddingBottom=parseInt(i.css("padding")),this.options.nodeDimensionsIncludeLabels){if(i.isParent()){var h=i.boundingBox({includeLabels:!0,includeNodes:!1}).w,P=i.boundingBox({includeLabels:!0,includeNodes:!1}).h,x=i.css("text-halign");T.labelWidth=h,T.labelHeight=P,T.labelPos=x}}if(this.idToLNode[i.data("id")]=T,isNaN(T.rect.x))T.rect.x=0;if(isNaN(T.rect.y))T.rect.y=0;if(y!=null&&y.length>0){var O=f.getGraphManager().add(f.newGraph(),T);this.processChildrenList(O,y,f)}}},I.prototype.stop=function(){return this.stopped=!0,this};var S=function(t){t("layout","cose-bilkent",I)};if(typeof cytoscape<"u")S(cytoscape);g.exports=S}])})});var z=Se(k(),1);ut.use(z.default);function q(u,g){u.forEach((r)=>{let n={id:r.id,labelText:r.label,height:r.height,width:r.width,padding:r.padding??0};Object.keys(r).forEach((o)=>{if(!["id","label","height","width","padding","x","y"].includes(o))n[o]=r[o]}),g.add({group:"nodes",data:n,position:{x:r.x??0,y:r.y??0}})})}e(q,"addNodes");function W(u,g){u.forEach((r)=>{let n={id:r.id,source:r.start,target:r.end};Object.keys(r).forEach((o)=>{if(!["id","start","end"].includes(o))n[o]=r[o]}),g.add({group:"edges",data:n})})}e(W,"addEdges");function Q(u){return new Promise((g)=>{let r=p("body").append("div").attr("id","cy").attr("style","display:none"),n=ut({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),q(u.nodes,n),W(u.edges,n),n.nodes().forEach(function(d){d.layoutDimensions=()=>{let l=d.data();return{w:l.width,h:l.height}}});let o={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(o).run(),n.ready((d)=>{a.info("Cytoscape ready",d),g(n)})})}e(Q,"createCytoscapeInstance");function Z(u){return u.nodes().map((g)=>{let r=g.data(),n=g.position(),o={id:r.id,x:n.x,y:n.y};return Object.keys(r).forEach((d)=>{if(d!=="id")o[d]=r[d]}),o})}e(Z,"extractPositionedNodes");function J(u){return u.edges().map((g)=>{let r=g.data(),n=g._private.rscratch,o={id:r.id,source:r.source,target:r.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(r).forEach((d)=>{if(!["id","source","target"].includes(d))o[d]=r[d]}),o})}e(J,"extractPositionedEdges");async function K(u,g){a.debug("Starting cose-bilkent layout algorithm");try{tt(u);let r=await Q(u),n=Z(r),o=J(r);return a.debug(`Layout completed: ${n.length} nodes, ${o.length} edges`),{nodes:n,edges:o}}catch(r){throw a.error("Error in cose-bilkent layout algorithm:",r),r}}e(K,"executeCoseBilkentLayout");function tt(u){if(!u)throw Error("Layout data is required");if(!u.config)throw Error("Configuration is required in layout data");if(!u.rootNode)throw Error("Root node is required");if(!u.nodes||!Array.isArray(u.nodes))throw Error("No nodes found in layout data");if(!Array.isArray(u.edges))throw Error("Edges array is required in layout data");return!0}e(tt,"validateLayoutData");var at=e(async(u,g,{insertCluster:r,insertEdge:n,insertEdgeLabel:o,insertMarkers:d,insertNode:l,log:L,positionEdgeLabel:b},{algorithm:H})=>{let v={},_={},D=g.select("g");d(D,u.markers,u.type,u.diagramId);let I=D.insert("g").attr("class","subgraphs"),U=D.insert("g").attr("class","edgePaths"),S=D.insert("g").attr("class","edgeLabels"),E=D.insert("g").attr("class","nodes");L.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(u.nodes.map(async(s)=>{if(s.isGroup){let c={...s};_[s.id]=c,v[s.id]=c,await r(I,s)}else{let c={...s};v[s.id]=c;let i=await l(E,s,{config:u.config,dir:u.direction||"TB"}),y=i.node().getBBox();c.width=y.width,c.height=y.height,c.domId=i,L.debug(`Node ${s.id} dimensions: ${y.width}x${y.height}`)}})),L.debug("Running cose-bilkent layout algorithm");let t={...u,nodes:u.nodes.map((s)=>{let c=v[s.id];return{...s,width:c.width,height:c.height}})},f=await K(t,u.config);L.debug("Positioning nodes based on layout results"),f.nodes.forEach((s)=>{let c=v[s.id];if(c?.domId)c.domId.attr("transform",`translate(${s.x}, ${s.y})`),c.x=s.x,c.y=s.y,L.debug(`Positioned node ${c.id} at center (${s.x}, ${s.y})`)}),f.edges.forEach((s)=>{let c=u.edges.find((i)=>i.id===s.id);if(c)c.points=[{x:s.startX,y:s.startY},{x:s.midX,y:s.midY},{x:s.endX,y:s.endY}]}),L.debug("Inserting and positioning edges"),await Promise.all(u.edges.map(async(s)=>{let c=await o(S,s),i=v[s.start??""],y=v[s.end??""];if(i&&y){let T=f.edges.find((m)=>m.id===s.id);if(T){L.debug("APA01 positionedEdge",T);let m={...s},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}else{let m={...s,points:[{x:i.x||0,y:i.y||0},{x:y.x||0,y:y.y||0}]},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}}})),L.debug("Cose-bilkent rendering completed")},"render"),ct=at;export{ct as render};
|
|
1
|
+
import{t,a,p}from"./chunk-3q0v8w45.js";import{mt,vr}from"./chunk-rbdvc8x7.js";import{Se,Te}from"./chunk-gcwhx3av.js";var k=Te(function(F,Y){(function(g,r){if(typeof F==="object"&&typeof Y==="object")Y.exports=r(vr());else if(typeof define==="function"&&define.amd)define(["cose-base"],r);else if(typeof F==="object")F.cytoscapeCoseBilkent=r(vr());else g.cytoscapeCoseBilkent=r(g.coseBase)})(F,function(u){return function(g){var r={};function n(o){if(r[o])return r[o].exports;var d=r[o]={i:o,l:!1,exports:{}};return g[o].call(d.exports,d,d.exports,n),d.l=!0,d.exports}return n.m=g,n.c=r,n.i=function(o){return o},n.d=function(o,d,l){if(!n.o(o,d))Object.defineProperty(o,d,{configurable:!1,enumerable:!0,get:l})},n.n=function(o){var d=o&&o.__esModule?function(){return o.default}:function(){return o};return n.d(d,"a",d),d},n.o=function(o,d){return Object.prototype.hasOwnProperty.call(o,d)},n.p="",n(n.s=1)}([function(g,r){g.exports=u},function(g,r,n){var o=n(0).layoutBase.LayoutConstants,d=n(0).layoutBase.FDLayoutConstants,l=n(0).CoSEConstants,L=n(0).CoSELayout,b=n(0).CoSENode,H=n(0).layoutBase.PointD,v=n(0).layoutBase.DimensionD,_={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:0.45,nestingFactor:0.1,gravity:0.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:0.5};function D(E,e){var f={};for(var s in E)f[s]=E[s];for(var s in e)f[s]=e[s];return f}function I(E){this.options=D(_,E),U(this.options)}var U=function(e){if(e.nodeRepulsion!=null)l.DEFAULT_REPULSION_STRENGTH=d.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion;if(e.idealEdgeLength!=null)l.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=e.idealEdgeLength;if(e.edgeElasticity!=null)l.DEFAULT_SPRING_STRENGTH=d.DEFAULT_SPRING_STRENGTH=e.edgeElasticity;if(e.nestingFactor!=null)l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor;if(e.gravity!=null)l.DEFAULT_GRAVITY_STRENGTH=d.DEFAULT_GRAVITY_STRENGTH=e.gravity;if(e.numIter!=null)l.MAX_ITERATIONS=d.MAX_ITERATIONS=e.numIter;if(e.gravityRange!=null)l.DEFAULT_GRAVITY_RANGE_FACTOR=d.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange;if(e.gravityCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound;if(e.gravityRangeCompound!=null)l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound;if(e.initialEnergyOnIncremental!=null)l.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental;if(e.quality=="draft")o.QUALITY=0;else if(e.quality=="proof")o.QUALITY=2;else o.QUALITY=1;l.NODE_DIMENSIONS_INCLUDE_LABELS=d.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!e.randomize,l.ANIMATE=d.ANIMATE=o.ANIMATE=e.animate,l.TILE=e.tile,l.TILING_PADDING_VERTICAL=typeof e.tilingPaddingVertical==="function"?e.tilingPaddingVertical.call():e.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof e.tilingPaddingHorizontal==="function"?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};I.prototype.run=function(){var E,e,f=this.options,s=this.idToLNode={},c=this.layout=new L,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var y=c.newGraphManager();this.gm=y;var T=this.options.eles.nodes(),m=this.options.eles.edges();this.root=y.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(T),c);for(var h=0;h<m.length;h++){var P=m[h],x=this.idToLNode[P.data("source")],O=this.idToLNode[P.data("target")];if(x!==O&&x.getEdgesBetween(O).length==0){var et=y.add(c.newEdge(),x,O);et.id=P.id()}}var V=function(R,B){if(typeof R==="number")R=B;var C=R.data("id"),G=i.idToLNode[C];return{x:G.getRect().getCenterX(),y:G.getRect().getCenterY()}},nt=function X(){var R=function(){if(f.fit)f.cy.fit(f.eles,f.padding);if(!E)E=!0,i.cy.one("layoutready",f.ready),i.cy.trigger({type:"layoutready",layout:i})},B=i.options.refresh,C;for(var G=0;G<B&&!C;G++)C=i.stopped||i.layout.tick();if(C){if(c.checkLayoutSuccess()&&!c.isSubLayout)c.doPostLayout();if(c.tilingPostLayout)c.tilingPostLayout();if(c.isLayoutFinished=!0,i.options.eles.nodes().positions(V),R(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),e)cancelAnimationFrame(e);E=!1;return}var M=i.layout.getPositionsData();f.eles.nodes().positions(function(A,it){if(typeof A==="number")A=it;if(!A.isParent()){var j=A.id(),N=M[j],w=A;while(N==null)if(N=M[w.data("parent")]||M["DummyCompound_"+w.data("parent")],M[j]=N,w=w.parent()[0],w==null)break;if(N!=null)return{x:N.x,y:N.y};else return{x:A.position("x"),y:A.position("y")}}}),R(),e=requestAnimationFrame(X)};if(c.addListener("layoutstarted",function(){if(i.options.animate==="during")e=requestAnimationFrame(nt)}),c.runLayout(),this.options.animate!=="during")i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,V),E=!1;return this},I.prototype.getTopMostNodes=function(E){var e={};for(var f=0;f<E.length;f++)e[E[f].id()]=!0;var s=E.filter(function(c,i){if(typeof c==="number")c=i;var y=c.parent()[0];while(y!=null){if(e[y.id()])return!1;y=y.parent()[0]}return!0});return s},I.prototype.processChildrenList=function(E,e,f){var s=e.length;for(var c=0;c<s;c++){var i=e[c],y=i.children(),T,m=i.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(i.outerWidth()!=null&&i.outerHeight()!=null)T=E.add(new b(f.graphManager,new H(i.position("x")-m.w/2,i.position("y")-m.h/2),new v(parseFloat(m.w),parseFloat(m.h))));else T=E.add(new b(this.graphManager));if(T.id=i.data("id"),T.paddingLeft=parseInt(i.css("padding")),T.paddingTop=parseInt(i.css("padding")),T.paddingRight=parseInt(i.css("padding")),T.paddingBottom=parseInt(i.css("padding")),this.options.nodeDimensionsIncludeLabels){if(i.isParent()){var h=i.boundingBox({includeLabels:!0,includeNodes:!1}).w,P=i.boundingBox({includeLabels:!0,includeNodes:!1}).h,x=i.css("text-halign");T.labelWidth=h,T.labelHeight=P,T.labelPos=x}}if(this.idToLNode[i.data("id")]=T,isNaN(T.rect.x))T.rect.x=0;if(isNaN(T.rect.y))T.rect.y=0;if(y!=null&&y.length>0){var O=f.getGraphManager().add(f.newGraph(),T);this.processChildrenList(O,y,f)}}},I.prototype.stop=function(){return this.stopped=!0,this};var S=function(e){e("layout","cose-bilkent",I)};if(typeof cytoscape<"u")S(cytoscape);g.exports=S}])})});var z=Se(k(),1);mt.use(z.default);function q(u,g){u.forEach((r)=>{let n={id:r.id,labelText:r.label,height:r.height,width:r.width,padding:r.padding??0};Object.keys(r).forEach((o)=>{if(!["id","label","height","width","padding","x","y"].includes(o))n[o]=r[o]}),g.add({group:"nodes",data:n,position:{x:r.x??0,y:r.y??0}})})}t(q,"addNodes");function W(u,g){u.forEach((r)=>{let n={id:r.id,source:r.start,target:r.end};Object.keys(r).forEach((o)=>{if(!["id","start","end"].includes(o))n[o]=r[o]}),g.add({group:"edges",data:n})})}t(W,"addEdges");function Q(u){return new Promise((g)=>{let r=p("body").append("div").attr("id","cy").attr("style","display:none"),n=mt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),q(u.nodes,n),W(u.edges,n),n.nodes().forEach(function(d){d.layoutDimensions=()=>{let l=d.data();return{w:l.width,h:l.height}}});let o={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};n.layout(o).run(),n.ready((d)=>{a.info("Cytoscape ready",d),g(n)})})}t(Q,"createCytoscapeInstance");function Z(u){return u.nodes().map((g)=>{let r=g.data(),n=g.position(),o={id:r.id,x:n.x,y:n.y};return Object.keys(r).forEach((d)=>{if(d!=="id")o[d]=r[d]}),o})}t(Z,"extractPositionedNodes");function J(u){return u.edges().map((g)=>{let r=g.data(),n=g._private.rscratch,o={id:r.id,source:r.source,target:r.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(r).forEach((d)=>{if(!["id","source","target"].includes(d))o[d]=r[d]}),o})}t(J,"extractPositionedEdges");async function K(u,g){a.debug("Starting cose-bilkent layout algorithm");try{tt(u);let r=await Q(u),n=Z(r),o=J(r);return a.debug(`Layout completed: ${n.length} nodes, ${o.length} edges`),{nodes:n,edges:o}}catch(r){throw a.error("Error in cose-bilkent layout algorithm:",r),r}}t(K,"executeCoseBilkentLayout");function tt(u){if(!u)throw Error("Layout data is required");if(!u.config)throw Error("Configuration is required in layout data");if(!u.rootNode)throw Error("Root node is required");if(!u.nodes||!Array.isArray(u.nodes))throw Error("No nodes found in layout data");if(!Array.isArray(u.edges))throw Error("Edges array is required in layout data");return!0}t(tt,"validateLayoutData");var at=t(async(u,g,{insertCluster:r,insertEdge:n,insertEdgeLabel:o,insertMarkers:d,insertNode:l,log:L,positionEdgeLabel:b},{algorithm:H})=>{let v={},_={},D=g.select("g");d(D,u.markers,u.type,u.diagramId);let I=D.insert("g").attr("class","subgraphs"),U=D.insert("g").attr("class","edgePaths"),S=D.insert("g").attr("class","edgeLabels"),E=D.insert("g").attr("class","nodes");L.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(u.nodes.map(async(s)=>{if(s.isGroup){let c={...s};_[s.id]=c,v[s.id]=c,await r(I,s)}else{let c={...s};v[s.id]=c;let i=await l(E,s,{config:u.config,dir:u.direction||"TB"}),y=i.node().getBBox();c.width=y.width,c.height=y.height,c.domId=i,L.debug(`Node ${s.id} dimensions: ${y.width}x${y.height}`)}})),L.debug("Running cose-bilkent layout algorithm");let e={...u,nodes:u.nodes.map((s)=>{let c=v[s.id];return{...s,width:c.width,height:c.height}})},f=await K(e,u.config);L.debug("Positioning nodes based on layout results"),f.nodes.forEach((s)=>{let c=v[s.id];if(c?.domId)c.domId.attr("transform",`translate(${s.x}, ${s.y})`),c.x=s.x,c.y=s.y,L.debug(`Positioned node ${c.id} at center (${s.x}, ${s.y})`)}),f.edges.forEach((s)=>{let c=u.edges.find((i)=>i.id===s.id);if(c)c.points=[{x:s.startX,y:s.startY},{x:s.midX,y:s.midY},{x:s.endX,y:s.endY}]}),L.debug("Inserting and positioning edges"),await Promise.all(u.edges.map(async(s)=>{let c=await o(S,s),i=v[s.start??""],y=v[s.end??""];if(i&&y){let T=f.edges.find((m)=>m.id===s.id);if(T){L.debug("APA01 positionedEdge",T);let m={...s},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}else{let m={...s,points:[{x:i.x||0,y:i.y||0},{x:y.x||0,y:y.y||0}]},h=n(U,m,_,u.type,i,y,u.diagramId);b(m,h)}}})),L.debug("Cose-bilkent rendering completed")},"render"),ct=at;export{ct as render};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{h,o,y,i,r,g,e,n,b,rt}from"./chunk-gcwhx3av.js";var U="__chat__";function T(a){if(!Number.isFinite(a)||a<=0)return"0";if(a<1000)return Math.round(a).toString();if(a<1e6)return`${(a/1000).toFixed(1)}K`;if(a<1e9)return`${(a/1e6).toFixed(2)}M`;return`${(a/1e9).toFixed(2)}B`}function B(a){let c=Number.isFinite(a)?Math.max(0,a):0;return Math.round(c).toLocaleString("en-US")}function _(a){if(!Number.isFinite(a)||a<=0)return"0s";if(a<1000)return"<1s";if(a<60000)return`${Math.floor(a/1000)}s`;if(a<3600000){let u=Math.floor(a/1000),t=Math.floor(u/60),d=u%60;return d>0?`${t}m ${d}s`:`${t}m`}if(a<259200000){let u=Math.floor(a/60000),t=Math.floor(u/60),d=u%60;return d>0?`${t}h ${d}m`:`${t}h`}let c=Math.floor(a/3600000),x=Math.floor(c/24),p=c%24;return p>0?`${x}d ${p}h`:`${x}d`}function X(a){if(!Number.isFinite(a)||a<=0)return"0s";if(a<1000)return"<1s";if(a<60000)return`${Math.round(a/1000)}s`;if(a<3600000)return`${Math.round(a/60000)}m`;if(a<86400000){let p=a/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let c=a/86400000;return`${c>=10?Math.round(c).toString():c.toFixed(1).replace(/\.0$/,"")}d`}function L(a,c=1){if(!Number.isFinite(a)||a<=0)return"0%";let x=10**-c/100;if(a<x)return`<${(x*100).toFixed(c)}%`;return`${(a*100).toFixed(c)}%`}function K(a){if(!Number.isFinite(a)||a<=0)return"0 B";if(a<1024)return`${Math.round(a)} B`;if(a<1048576)return`${(a/1024).toFixed(1)} KB`;if(a<1073741824)return`${(a/1048576).toFixed(2)} MB`;return`${(a/1073741824).toFixed(2)} GB`}function G(a){let c=a.split("-"),x=c[1],p=c[2];if(x!==void 0&&p!==void 0)return`${x}/${p}`;return a}function Y(a){let c=a.split("-"),x=c[0],p=c[1],u=c[2];if(x===void 0||p===void 0||u===void 0)return a;let t=Number(x),d=Number(p)-1,v=Number(u),M=new Date(Date.UTC(t,d,v)),R=["周日","周一","周二","周三","周四","周五","周六"],D=M.getUTCDay(),F=R[D]??"";return`${a} ${F}`}function ee(a,c=Date.now()){if(a===null||a===void 0||!Number.isFinite(a)||a<=0)return"从未";let x=Math.max(0,c-a);if(x<60000)return"刚刚";if(x<3600000)return`${Math.max(1,Math.floor(x/60000))} 分钟前`;if(x<86400000)return`${Math.max(1,Math.floor(x/3600000))} 小时前`;if(x<2592000000)return`${Math.max(1,Math.floor(x/86400000))} 天前`;let p=new Date(a),u=p.getFullYear(),t=String(p.getMonth()+1).padStart(2,"0"),d=String(p.getDate()).padStart(2,"0");return`${u}-${t}-${d}`}function te(a){let{projects:c,selectedProjectID:x,onSelectProject:p}=a,{style:u}=b();if(c.length===0)return e("div",{className:u("surface.empty"),children:"暂无项目统计数据"});return e("div",{className:"divide-y divide-line",children:c.map((t)=>{let d=t.projectID??U,v=x===d,M=Math.max(t.tokenShare>0?1:0,t.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate",children:t.name}),e("span",{className:u("control.badge","font-mono truncate max-w-[240px]"),title:t.directory||"未绑定项目目录",children:t.directory||"独立会话"}),e("button",{type:"button",onClick:()=>p(v?null:d),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:v?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:B(t.totalTokens),children:T(t.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",L(t.tokenShare),")"]})]})]}),e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${M}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:T(t.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:T(t.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:T(t.cacheReadTokens)}),n("span",{className:"text-faint",children:[" (",L(t.cacheHitRate),")"]})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["耗时 ",e("span",{className:"text-ink",children:_(t.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:t.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:t.toolCalls.toLocaleString()})," 次"]})]})]})]},d)})})}function ae(a){let{models:c}=a,{ModelIcon:x,style:p}=b();if(c.length===0)return e("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return e("div",{className:"divide-y divide-line",children:c.map((u)=>{let t=Math.max(u.share>0?1:0,u.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(x,{modelID:u.model,className:"size-4 shrink-0"}),e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:u.shortName}),e("span",{className:p("control.badge","font-mono shrink-0"),children:u.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[u.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[u.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:B(u.totalTokens),children:[T(u.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",L(u.share),")"]})]})]})]}),e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:T(u.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:T(u.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:T(u.cacheReadTokens)}),n("span",{className:"text-faint",children:[" (",L(u.cacheHitRate),")"]})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:[e("span",{className:"text-ink",children:u.turns.toLocaleString()})," 轮",u.errors>0?n("span",{className:"text-danger",children:[" (",u.errors," 错)"]}):null]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:u.toolCalls.toLocaleString()})," 次"]}),u.generationMs>0&&n("span",{children:["推理 ",e("span",{className:"text-ink",children:X(u.generationMs)})]})]})]})]},u.model)})})}function ne(a){let{tools:c}=a,{StatusChip:x,style:p}=b();if(c.length===0)return e("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return e("div",{className:"divide-y divide-line",children:c.map((u)=>{let t=Math.max(u.share>0?1:0,u.share*100),d=u.successRate>=0.95?"success":u.successRate>=0.8?"warning":"danger",v=Math.max(0,u.calls-u.errors),M=u.calls>0?Math.round(u.outputBytes/u.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:u.name}),n(x,{tone:d,children:["成功率 ",L(u.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[u.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",L(u.share),")"]})]})]}),e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["成功 ",e("span",{className:"text-ink",children:v.toLocaleString()})," 次"]}),n("span",{children:["失败 ",e("span",{className:u.errors>0?"text-danger":"text-ink",children:u.errors.toLocaleString()})," 次"]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["累计输出 ",e("span",{className:"text-ink",children:K(u.outputBytes)})]}),n("span",{children:["单次均值 ",e("span",{className:"text-ink",children:K(M)})]})]})]})]},u.name)})})}function se(a){let{sessions:c,onOpenSession:x}=a,{style:p}=b();if(c.length===0)return e("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let u=Math.max(1,...c.map((t)=>t.totalTokens));return e("div",{className:"divide-y divide-line",children:c.map((t)=>{let d=u>0?Math.max(1,t.totalTokens/u*100):0,v=t.model.split("/").pop()??t.model;return n("button",{type:"button",onClick:()=>x(t.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:t.title.trim()||"新会话"}),e("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:t.projectName,children:t.projectName}),t.kind==="sub"&&e("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),t.archivedAt!==null&&e("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:B(t.totalTokens),children:T(t.totalTokens)}),e(rt,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${d}%`}})}),n("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:T(t.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:T(t.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:T(t.cacheReadTokens)})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e("span",{className:"text-ink",children:v}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:_(t.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:t.assistantTurns})," 轮"]}),e("span",{className:"text-faint",children:ee(t.updated)})]})]})]},t.id)})})}var oe=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function re(a){let{cn:c,Segmented:x,SettingGroup:p,style:u}=b(),{daily:t}=a,[d,v]=r("tokens"),[M,R]=r(null),D=y(()=>t.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[t]),F=y(()=>{if(t.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(d==="tokens"){let w=t.reduce((C,I)=>C+I.totalTokens,0),P=t.filter((C)=>C.totalTokens>0).length,S=t[0];for(let C of t)if(!S||C.totalTokens>S.totalTokens)S=C;return{totalText:T(w),totalFullText:B(w),avgText:P>0?T(Math.round(w/P)):"0",peakDate:S&&S.totalTokens>0?G(S.date):"—",peakValueText:S&&S.totalTokens>0?T(S.totalTokens):"0"}}if(d==="duration"){let w=t.reduce((C,I)=>C+I.activeDurationMs,0),P=t.filter((C)=>C.activeDurationMs>0).length,S=t[0];for(let C of t)if(!S||C.activeDurationMs>S.activeDurationMs)S=C;return{totalText:_(w),totalFullText:_(w),avgText:P>0?_(Math.round(w/P)):"0s",peakDate:S&&S.activeDurationMs>0?G(S.date):"—",peakValueText:S&&S.activeDurationMs>0?_(S.activeDurationMs):"0s"}}let s=t.reduce((w,P)=>w+P.assistantTurns,0),l=t.reduce((w,P)=>w+P.userMessages,0),f=s+l,N=t.filter((w)=>w.assistantTurns>0||w.userMessages>0).length,k=t[0];for(let w of t){let P=k?k.assistantTurns+k.userMessages:0;if(!k||w.assistantTurns+w.userMessages>P)k=w}let A=k?k.assistantTurns+k.userMessages:0;return{totalText:`${f.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:N>0?`${(f/N).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&A>0?G(k.date):"—",peakValueText:k&&A>0?`${A.toLocaleString()} 轮`:"0 轮"}},[t,d]),j=y(()=>{if(M){let s=t.find((l)=>l.date===M);if(s)return s}for(let s=t.length-1;s>=0;s--){let l=t[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return t[t.length-1]},[t,M]),z=y(()=>{if(d==="tokens")return Math.max(1,...t.map((s)=>s.totalTokens));if(d==="duration")return Math.max(1000,...t.map((s)=>s.activeDurationMs));return Math.max(1,...t.map((s)=>s.assistantTurns+s.userMessages))},[t,d]),m=y(()=>{if(t.length<=7)return t.map((f)=>f.date);let s=6,l=[];for(let f=0;f<s;f++){let N=Math.round(f*(t.length-1)/(s-1)),k=t[N];if(k)l.push(k.date)}return l},[t]);if(!D)return e(p,{title:"每日趋势",action:e(x,{value:d,onChange:(s)=>v(s),options:oe}),children:e("div",{className:u("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return e(p,{title:"每日趋势",action:e(x,{value:d,onChange:(s)=>v(s),options:oe}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",e("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",e("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",e("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[d==="tokens"&&n(g,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),d==="duration"&&n(g,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),d==="activity"&&n(g,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[e("div",{className:"border-b border-line/40 w-full"}),e("div",{className:"border-b border-line/30 w-full"}),e("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>R(null),children:[e("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:t.map((s)=>{let l=s.totalTokens;if(d==="duration")l=s.activeDurationMs;else if(d==="activity")l=s.assistantTurns+s.userMessages;let f=l<=0,N=f?0:Math.max(3,Math.min(100,l/z*100)),k=j?.date===s.date;return n("button",{type:"button","aria-label":`${s.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>R(s.date),onFocus:()=>R(s.date),onClick:()=>R(s.date),children:[e("div",{className:c("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),f?e("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${N}%`},children:[d==="tokens"&&n(g,{children:[s.outputTokens>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&e("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&e("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),d==="duration"&&n(g,{children:[s.generationMs>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),d==="activity"&&n(g,{children:[s.userMessages>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&e("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),e("div",{className:c("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",t.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:m.map((s)=>e("div",{className:c("whitespace-nowrap",t.length<=7&&"flex-1 text-center"),children:G(s)},s))})]})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:j?n(g,{children:[e("span",{className:"text-ink",children:Y(j.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",e("span",{className:"text-ink",children:T(j.totalTokens)})]}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:_(j.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[j.assistantTurns+j.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[j.toolCalls," 次"]})]})]})]}):e("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function ie(a){let{cn:c,SettingGroup:x}=b(),{daily:p,hourly:u}=a,[t,d]=r(null),v=y(()=>{let l=new Map;for(let N of u)l.set(N.hour,N);let f=[];for(let N=0;N<24;N++){let k=l.get(N);if(k)f.push(k);else f.push({hour:N,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return f},[u]),M=y(()=>{let l=v[0];for(let f of v)if(!l||f.totalTokens>l.totalTokens)l=f;return l&&l.totalTokens>0?l:null},[v]),R=y(()=>v.reduce((l,f)=>l+f.totalTokens,0),[v]),D=y(()=>Math.max(1,...v.map((l)=>l.totalTokens)),[v]),F=y(()=>{if(R<=0)return 0;return v.filter((f)=>f.hour>=8&&f.hour<20).reduce((f,N)=>f+N.totalTokens,0)/R},[v,R]),j=y(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=y(()=>{let l=0,f=0;for(let N of p)if(N.totalTokens>0||N.activeDurationMs>0||N.runs>0){if(f++,f>l)l=f}else f=0;return l},[p]),m=y(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=t!==null?v[t]:M;return n(x,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",L(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",m,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"text-dim",children:"24 小时分布"}),s?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[t!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),e("span",{className:"text-ink",children:T(s.totalTokens)}),s.activeDurationMs>0&&e("span",{children:_(s.activeDurationMs)})]}):e("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>d(null),children:[e("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:v.map((l)=>{let f=M?.hour===l.hour,N=t===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/D*100):0,A=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
|
|
2
|
+
消耗: ${B(l.totalTokens)} Token
|
|
3
|
+
耗时: ${_(l.activeDurationMs)}
|
|
4
|
+
助手轮次: ${l.assistantTurns} 轮`;return e("button",{type:"button","aria-label":`${String(l.hour).padStart(2,"0")}:00 时段统计`,className:"flex-1 h-full flex flex-col justify-end items-center group relative cursor-pointer bg-transparent p-0 border-0 focus:outline-hidden",title:A,onMouseEnter:()=>d(l.hour),onFocus:()=>d(l.hour),onClick:()=>d(l.hour),children:k>0?e("div",{className:c("w-full max-w-[20px] rounded-t-xs transition-all duration-200",f||N?"bg-accent":"bg-accent/55 group-hover:bg-accent"),style:{height:`${k}%`}}):e("div",{className:"h-1 w-full max-w-[20px] rounded-full bg-raised group-hover:bg-dim/30"})},l.hour)})}),n("div",{className:"flex justify-between items-center text-[10px] text-faint font-mono pt-1.5 border-t border-line/40",children:[e("span",{children:"00:00"}),e("span",{children:"04:00"}),e("span",{children:"08:00"}),e("span",{children:"12:00"}),e("span",{children:"16:00"}),e("span",{children:"20:00"}),e("span",{children:"23:00"})]})]})]}),n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"text-xs text-dim",children:["自然日热力 (",p.length," 天)"]}),e("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map((l)=>{let f="bg-raised";if(l.totalTokens>0){let k=l.totalTokens/j;if(k<=0.33)f="bg-accent/30";else if(k<=0.66)f="bg-accent/60";else f="bg-accent"}let N=`${Y(l.date)}
|
|
5
|
+
消耗: ${B(l.totalTokens)} Token
|
|
6
|
+
耗时: ${_(l.activeDurationMs)}
|
|
7
|
+
助手轮次: ${l.assistantTurns} 轮`;return e("div",{className:c("size-3.5 rounded-xs transition-transform hover:scale-125 cursor-pointer",f),title:N},l.date)})})]})]})}var pe=[{value:"7d",label:"近 7 天"},{value:"30d",label:"近 30 天"},{value:"90d",label:"近 90 天"},{value:"all",label:"全部"}],V=new Map,le=[];function q(a,c){return`${a}:${c??"all"}`}function _e(a){let{connection:c,onOpen:x}=a,{Button:p,PageLayout:u,Segmented:t,SettingGroup:d,style:v}=b(),[M,R]=r("30d"),[D,F]=r(null),[j,z]=r("projects"),[m,s]=r(()=>V.get(q("30d",null))??null),[l,f]=r(()=>!V.has(q("30d",null))),[N,k]=r(null),[A,w]=r(()=>le),P=i(0),S=h(async()=>{let I=++P.current,O=q(M,D),Q=V.get(O);if(Q)s(Q);f(!0);try{let E=new URLSearchParams({range:M,tzOffset:String(new Date().getTimezoneOffset())});if(D)E.set("projectID",D);let W=await c.request(`/api/stats?${E.toString()}`);if(I!==P.current)return;if(V.set(O,W),s(W),k(null),W.projects)w((ue)=>{let Z=new Map(ue.map((H)=>[H.id,H.name]));for(let H of W.projects)if(H.projectID)Z.set(H.projectID,H.name);let J=Array.from(Z.entries()).map(([H,ce])=>({id:H,name:ce}));return le=J,J})}catch(E){if(I===P.current)k(E instanceof Error?E.message:"加载统计数据失败")}finally{if(I===P.current)f(!1)}},[c,M,D]);o(()=>(S(),()=>{P.current++}),[S]);let C=y(()=>{if(!D)return null;if(D===U)return"独立聊天";return(A.find((O)=>O.id===D)??m?.projects.find((O)=>O.projectID===D))?.name??"指定项目"},[D,A,m]);return n(u,{title:C?n(g,{children:["统计 ",n("span",{className:"text-dim",children:["· ",C]})]}):"统计",description:"按项目、模型与工具统计活跃耗时与 Token 消耗。",actions:n(g,{children:[D&&e(p,{size:"sm",variant:"ghost",onClick:()=>F(null),children:"返回全部"}),e(t,{value:M,onChange:R,options:pe})]}),children:[N&&n("div",{className:"mb-4 flex items-center justify-between rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:[e("span",{children:N}),e(p,{size:"sm",variant:"ghost",onClick:()=>{S()},className:"text-danger hover:text-danger",children:"重试"})]}),l&&!m?e("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载统计…"}):!m?e("div",{className:v("surface.card","p-12 text-center text-sm text-dim"),children:"暂无统计数据"}):n("div",{className:"space-y-8",children:[e(d,{title:"核心总览",unboxed:!0,children:n("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"总 Token 消耗"}),n("span",{className:"font-mono tabular-nums",children:["缓存命中 ",L(m.overview.cacheHitRate)]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",title:`${B(m.overview.totalTokens)} Token`,children:T(m.overview.totalTokens)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["输入 ",T(m.overview.inputTokens)]}),n("span",{children:["输出 ",T(m.overview.outputTokens)]}),n("span",{children:["缓存读 ",T(m.overview.cacheReadTokens)]})]})]}),n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"活跃工作耗时"}),n("span",{className:"font-mono tabular-nums",children:["日均"," ",m.overview.activeDays>0?_(m.overview.activeDurationMs/m.overview.activeDays):"0s"]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:_(m.overview.activeDurationMs)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["模型推理 ",_(m.overview.generationMs)]}),n("span",{children:["并发累计 ",_(m.overview.cumulativeRunDurationMs)]})]})]}),n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"会话与工作流"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.activeProjects,"/",m.overview.totalProjects," 活跃项目"]})]}),n("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:[m.overview.sessionCount.toLocaleString()," 个会话"]}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.mainSessionCount," 主会话 / ",m.overview.subSessionCount," 子代理"]}),n("span",{children:[m.overview.userMessages," 提问 / ",m.overview.assistantTurns," 回复"]})]})]}),n("div",{className:v("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"吞吐效率与调用"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.compactions," 次折叠"]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:m.overview.avgTps!==null?`${m.overview.avgTps.toFixed(1)} tok/s`:`${m.overview.toolCalls.toLocaleString()} 次调用`}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.toolCalls.toLocaleString()," 次工具调用"]}),n("span",{children:[m.overview.runCount.toLocaleString()," 次运行"]})]})]})]})}),e(re,{daily:m.daily}),e(ie,{daily:m.daily,hourly:m.hourly}),e(d,{title:"分类明细",action:e(t,{value:j,onChange:z,options:[{value:"projects",label:`项目消耗 (${m.projects.length})`},{value:"models",label:`模型分析 (${m.models.length})`},{value:"tools",label:`工具调用 (${m.tools.length})`},{value:"sessions",label:`高消耗会话 (${m.topSessions.length})`}]}),children:n("div",{className:"animate-fade",children:[j==="projects"&&e(te,{projects:m.projects,selectedProjectID:D,onSelectProject:F,onOpenSession:x}),j==="models"&&e(ae,{models:m.models}),j==="tools"&&e(ne,{tools:m.tools}),j==="sessions"&&e(se,{sessions:m.topSessions,onOpenSession:x})]},j)})]})]})}export{_e as StatsPage};
|