@bkm016/basalt 0.1.7 → 0.1.9
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-0039s4jt.js → chunk-02d3x4mj.js} +3 -3
- package/{chunk-sjjtxpg2.js → chunk-0xd9mnc2.js} +394 -341
- package/{chunk-npez1492.js → chunk-13gvs0ax.js} +2 -2
- package/{chunk-n981vx1t.js → chunk-1n7dat03.js} +6 -6
- package/{chunk-6ptv4g5e.js → chunk-1zj3zvw5.js} +3 -3
- package/{chunk-zxkq9m8e.js → chunk-29qrxygd.js} +2 -2
- package/{chunk-y8dkfpmj.js → chunk-30rjf7my.js} +4 -4
- package/{chunk-39vwrg8n.js → chunk-38g3gctw.js} +2 -2
- package/{chunk-benrzwea.js → chunk-4dw43syb.js} +1 -1
- package/{chunk-w67dvqtb.js → chunk-4gtgqcct.js} +2 -2
- package/chunk-66h5qpc6.js +479 -0
- package/{chunk-8wj32837.js → chunk-755sy11p.js} +1 -1
- package/chunk-7zkswxvk.js +2 -0
- package/{chunk-ebpyvs1d.js → chunk-82v8jh1h.js} +2 -2
- package/chunk-95964592.js +25 -0
- package/{chunk-gv7wqkey.js → chunk-9as0p561.js} +2 -2
- package/{chunk-fx7f4m3c.js → chunk-a1352w87.js} +1 -1
- package/{chunk-8wv5t0w6.js → chunk-a1rb1a48.js} +6 -6
- package/{chunk-bdy4jksd.js → chunk-a98wma9j.js} +1 -1
- package/{chunk-peja51xv.js → chunk-asyr3gnq.js} +2 -2
- package/{chunk-7hr6zw2m.js → chunk-ax04trym.js} +1 -1
- package/chunk-b2bxqeb4.js +2 -0
- package/{chunk-6kdgk70p.js → chunk-bdjr0kfr.js} +4 -4
- package/{chunk-dnx91jrd.js → chunk-bk4rpnm8.js} +2 -2
- package/{chunk-8x21n7y9.js → chunk-c0zfefq8.js} +1 -1
- package/{chunk-pg5nkf1y.js → chunk-c6q04xrd.js} +2 -2
- package/chunk-c71173py.js +25 -0
- package/{chunk-c7rcw9fb.js → chunk-cmwdjes8.js} +5 -5
- package/{chunk-j7yvh0ae.js → chunk-d0a1jxk5.js} +1 -1
- package/{chunk-0javrjcm.js → chunk-d5j74pcp.js} +22 -22
- package/{chunk-ca982n62.js → chunk-dfh9m9n7.js} +1 -1
- package/{chunk-s6dejhfj.js → chunk-dq01v5eq.js} +1 -1
- package/{chunk-ecf896fz.js → chunk-e1x629v0.js} +2 -2
- package/{chunk-053vb71h.js → chunk-en218k4y.js} +1 -1
- package/{chunk-ey15ye2h.js → chunk-fgwda4m0.js} +1 -1
- package/chunk-gbjn6d81.js +2 -0
- package/{chunk-n85qs7cs.js → chunk-gkf5jwvj.js} +1 -1
- package/{chunk-d48bfd2e.js → chunk-h1kb8b49.js} +2 -2
- package/{chunk-whj87h4r.js → chunk-hb4f2v34.js} +3 -3
- package/{chunk-10p3mb40.js → chunk-hbnmymaq.js} +1 -1
- package/{chunk-818nd6s1.js → chunk-jj4hqbrx.js} +2 -2
- package/{chunk-r8vvcp6c.js → chunk-jn5pqy5v.js} +1 -1
- package/{chunk-f544p9rh.js → chunk-jtsve11b.js} +10 -10
- package/chunk-m1eam0s5.js +2 -0
- package/{chunk-g0t9c3gv.js → chunk-mbpb5c7w.js} +1 -1
- package/{chunk-prgm07j4.js → chunk-msm9hmk9.js} +2 -2
- package/{chunk-dpz4hwqb.js → chunk-n0ybj4h9.js} +2 -2
- package/{chunk-z02sj1je.js → chunk-n2jcx65v.js} +2 -2
- package/{chunk-x4874m8e.js → chunk-nrsd810j.js} +2 -2
- package/chunk-pnspvnyd.js +2 -0
- package/chunk-pz2afna8.js +2 -0
- package/{chunk-f156y565.js → chunk-q9f4xb0w.js} +3 -3
- package/{chunk-arcqjt91.js → chunk-qaeyhe65.js} +1 -1
- package/chunk-qnkrrwmg.js +2 -0
- package/{chunk-063vbmtp.js → chunk-r4ttdkrz.js} +2 -2
- package/{chunk-r9aatvwm.js → chunk-stj493dn.js} +2 -2
- package/{chunk-q9dd6fhj.js → chunk-tevejprz.js} +4 -4
- package/{chunk-75434aay.js → chunk-v3ee9z3f.js} +1 -1
- package/chunk-vtqr7dm8.js +3 -0
- package/chunk-xh444pfn.js +16 -0
- package/{chunk-y69ewdn2.js → chunk-ypqjfv3a.js} +2 -2
- package/{chunk-d6p2hgxh.js → chunk-zc9ar0r4.js} +1 -1
- package/{chunk-s7skpgm2.js → chunk-zyyzk5ha.js} +1 -1
- package/compiled.js +9 -9
- package/package.json +1 -1
- package/ui-test-worker.js +19 -19
- package/web/chunk-08sq3cwm.js +1 -0
- package/web/chunk-0pghpg4y.js +2 -0
- package/web/{chunk-z1geewdf.js → chunk-0zwc2rvh.js} +2 -2
- package/web/chunk-12qf1r6m.js +1 -0
- package/web/chunk-24fjnnee.js +1 -0
- package/web/chunk-24jhbz82.js +24 -0
- package/web/{chunk-5wbnjjhg.js → chunk-2dvbeqt0.js} +1 -1
- package/web/chunk-2hrswh3d.js +2 -0
- package/web/chunk-2j2atyjw.js +1 -0
- package/web/{chunk-n754s8xd.js → chunk-2x4g9t37.js} +8 -8
- package/web/{chunk-tfn0rqg9.js → chunk-3ak5dg10.js} +25 -25
- package/web/chunk-3ecrkvr3.js +106 -0
- package/web/chunk-3h3g3ca3.js +1 -0
- package/web/chunk-3hr3ew9w.js +1 -0
- package/web/chunk-3pcrxg6m.js +1 -0
- package/web/{chunk-xckxtfp8.js → chunk-3pd0qt83.js} +72 -72
- package/web/chunk-3txxt0a7.js +1 -0
- package/web/chunk-43g4wd7a.js +1 -0
- package/web/chunk-4a6gdrbs.js +1 -0
- package/web/{chunk-twdy2f67.js → chunk-5a4mj3qz.js} +1 -1
- package/web/{chunk-q97hn4j5.js → chunk-5baeh8q7.js} +38 -38
- package/web/{chunk-4fm55fgb.js → chunk-5dr4tkem.js} +7 -7
- package/web/{chunk-wqsczy57.js → chunk-5jdrev9p.js} +9 -9
- package/web/{chunk-dg3p8db5.js → chunk-5v2c0aqk.js} +1 -1
- package/web/chunk-5z2n4z9x.css +1 -0
- package/web/{chunk-pjz30xcp.js → chunk-601k823s.js} +23 -23
- package/web/{chunk-2cem4sv7.js → chunk-60axh4sa.js} +25 -25
- package/web/chunk-66wb0p6e.js +62 -0
- package/web/{chunk-qcge7d6s.js → chunk-6e87m0nm.js} +2 -2
- package/web/chunk-6y55gk1n.js +1 -0
- package/web/chunk-79e08rk1.js +2 -0
- package/web/chunk-7qkav30b.js +2 -0
- package/web/chunk-7qq1ypvj.js +1 -0
- package/web/{chunk-h6k1x096.js → chunk-7tkgbbf9.js} +2 -2
- package/web/chunk-814kkkmq.js +8 -0
- package/web/chunk-8jcvdd5d.js +2 -0
- package/web/{chunk-gksf7cek.js → chunk-8w7fyb3v.js} +7 -7
- package/web/chunk-8w8atrdh.js +1 -0
- package/web/{chunk-czjk218p.js → chunk-8z0r0wtk.js} +62 -62
- package/web/chunk-935mjq1c.js +39 -0
- package/web/chunk-942g3eqn.js +1 -0
- package/web/{chunk-ht4mx2dt.js → chunk-98y92vmh.js} +9 -9
- package/web/chunk-9ctg0f30.js +3 -0
- package/web/chunk-9fnr00kv.js +4 -0
- package/web/{chunk-5nda24gv.js → chunk-9yfftz38.js} +1 -1
- package/web/chunk-a0ryzdnp.js +7 -0
- package/web/chunk-a61zrp66.js +1 -0
- package/web/{chunk-nfvqjzz5.js → chunk-af9evdza.js} +1 -1
- package/web/chunk-arnzrqnm.js +1 -0
- package/web/chunk-avxk6jpc.js +2 -0
- package/web/{chunk-c01176kn.js → chunk-awkdw9rw.js} +2 -2
- package/web/{chunk-sy7e4dmq.js → chunk-b5h52neg.js} +1 -1
- package/web/chunk-bwy3e58v.js +1 -0
- package/web/{chunk-ja7w629n.js → chunk-c57f714b.js} +2 -2
- package/web/chunk-c6yacwbc.js +30 -0
- package/web/chunk-ctzkqx2g.js +169 -0
- package/web/chunk-db3twjvk.js +21 -0
- package/web/{chunk-femhej5w.js → chunk-ddyyc20r.js} +57 -57
- package/web/chunk-dnv8dx72.js +1 -0
- package/web/chunk-dwjmr0zj.js +2 -0
- package/web/chunk-dz7g1gnv.js +2 -0
- package/web/chunk-eadfxfkw.js +1 -0
- package/web/{chunk-d9wdsjkk.js → chunk-eqndhs21.js} +2 -2
- package/web/chunk-ewx42c11.js +55 -0
- package/web/chunk-f7jpakwh.js +1 -0
- package/web/{chunk-4sve9xrj.js → chunk-ff1pmd3g.js} +1 -1
- package/web/chunk-fjb3ksfd.js +78 -0
- package/web/chunk-fpb2dd2d.js +2 -0
- package/web/{chunk-fv6vm14n.js → chunk-frnh4zqf.js} +2 -2
- package/web/chunk-gn8kyz76.js +7 -0
- package/web/chunk-gv99c8zv.js +1 -0
- package/web/chunk-h0767tjv.js +1 -0
- package/web/chunk-hqynf99g.js +1 -0
- package/web/{chunk-jam45rqg.js → chunk-jccz14ye.js} +2 -2
- package/web/chunk-kcjz03h5.js +2 -0
- package/web/chunk-ket6g0yd.js +1 -0
- package/web/chunk-m9q5nr8f.js +1 -0
- package/web/chunk-mbwwj216.js +1 -0
- package/web/chunk-mdfksj61.js +1 -0
- package/web/chunk-me7dza1c.js +1 -0
- package/web/{chunk-gyp6v7jd.js → chunk-myd6sc76.js} +2 -2
- package/web/{chunk-sf101c23.js → chunk-mykrm8ba.js} +2 -2
- package/web/chunk-mzzaet63.js +1 -0
- package/web/chunk-n0wazxgz.js +1 -0
- package/web/chunk-nnyc889n.js +292 -0
- package/web/{chunk-e8yj05t1.js → chunk-nvpp0ghj.js} +6 -6
- package/web/chunk-nvt9tkt4.js +1139 -0
- package/web/{chunk-sn3tkwme.js → chunk-p9hfcamx.js} +37 -37
- package/web/chunk-ph1dgffm.js +1 -0
- package/web/chunk-q34as3v6.js +1 -0
- package/web/{chunk-sd3cdqcm.js → chunk-qh62nkem.js} +2 -2
- package/web/{chunk-j1bw5v1g.js → chunk-qq6m2my8.js} +2 -2
- package/web/{chunk-tmndcktk.js → chunk-qsqtwf34.js} +15 -15
- package/web/chunk-qz6r9v1z.js +1 -0
- package/web/chunk-rad2s9ha.js +1 -0
- package/web/{chunk-y99ed8rd.js → chunk-rasjtvsb.js} +16 -16
- package/web/chunk-rayf24gy.js +370 -0
- package/web/chunk-rrpn5r5w.js +2 -0
- package/web/chunk-s37beysw.js +1 -0
- package/web/chunk-s60s09mb.js +1 -0
- package/web/chunk-sk1wkgjw.js +4 -0
- package/web/chunk-spbs56wz.js +34 -0
- package/web/chunk-t893141g.js +2 -0
- package/web/chunk-tftc5v89.js +24 -0
- package/web/chunk-tfvcs2xx.js +1 -0
- package/web/chunk-tj1fn8v2.js +1 -0
- package/web/chunk-ts6jsfdk.js +41 -0
- package/web/chunk-v1exk5wd.js +324 -0
- package/web/chunk-veam6vk4.js +303 -0
- package/web/chunk-vqmj6peg.js +1 -0
- package/web/{chunk-t6sq85s6.js → chunk-vsjpnwsr.js} +2 -2
- package/web/{chunk-0whceqes.js → chunk-vvvd3grf.js} +2 -2
- package/web/{chunk-svh4n157.js → chunk-w3w18stt.js} +5 -5
- package/web/chunk-wdq2tp9e.js +1 -0
- package/web/chunk-wkf5xfyr.js +1 -0
- package/web/{chunk-4q7wf0wd.js → chunk-wzd2a4k5.js} +9 -9
- package/web/chunk-xa43ndfj.js +2 -0
- package/web/chunk-xh4xn1az.js +1 -0
- package/web/chunk-xx11yv61.js +89 -0
- package/web/chunk-xzwxcxb4.js +1 -0
- package/web/chunk-y1qty77a.js +1 -0
- package/web/{chunk-da7m1kva.js → chunk-y2rzeb4v.js} +2 -2
- package/web/chunk-ys2tns0p.js +1 -0
- package/web/chunk-z05x9cbm.js +1 -0
- package/web/chunk-zb2bkr7f.js +2 -0
- package/web/{chunk-aangfjqc.js → chunk-zdyys4ar.js} +38 -38
- package/web/chunk-zgavhnt8.js +1 -0
- package/web/index.html +1 -1
- package/worker.js +1 -1
- package/chunk-654cny9a.js +0 -480
- package/chunk-8gw5bvh3.js +0 -25
- 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-1s53190z.js +0 -303
- package/web/chunk-2b63adsj.js +0 -89
- package/web/chunk-3baypnwn.js +0 -4
- package/web/chunk-4067nwjp.js +0 -19
- package/web/chunk-4vjnrz87.js +0 -34
- package/web/chunk-59678wmg.js +0 -1
- package/web/chunk-5k8sv4f5.js +0 -1
- package/web/chunk-5vjhvw1m.js +0 -2
- package/web/chunk-6bwgdvf6.js +0 -1
- 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-8r0s8tx7.js +0 -1
- package/web/chunk-989jq2h8.js +0 -2
- package/web/chunk-9w5tf22s.js +0 -1
- package/web/chunk-ahztazsg.js +0 -1
- package/web/chunk-bdydzbqk.js +0 -324
- package/web/chunk-c3nn0vvc.js +0 -1
- package/web/chunk-cpwtt6ny.js +0 -1
- package/web/chunk-d22wq71s.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-geh05ghh.js +0 -55
- package/web/chunk-hwsvhst3.js +0 -1
- package/web/chunk-jfvxxp5c.js +0 -1
- package/web/chunk-k02b36g1.js +0 -62
- package/web/chunk-kjacapzd.js +0 -7
- package/web/chunk-kkfrs7d1.js +0 -41
- package/web/chunk-kkyn8yhj.js +0 -106
- package/web/chunk-mh4rx5cf.js +0 -1
- package/web/chunk-mz9b5bsa.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-q3jevm51.js +0 -292
- 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-thbqwq6b.js +0 -1
- package/web/chunk-tqr80b5w.js +0 -2
- package/web/chunk-tz4twwmw.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-wvfmmw1v.js +0 -8
- package/web/chunk-x1jm4zsg.js +0 -1
- package/web/chunk-xbpc6x9m.js +0 -169
- package/web/chunk-xce8n339.js +0 -1
- package/web/chunk-xmsb2g71.js +0 -1
- package/web/chunk-xtss82z2.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o,i,r,vt,f,e,n,y,s,Z,rt,ie,tr,X}from"./chunk-nvt9tkt4.js";var pe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],A=s("at-sign",pe);var ue=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],te=s("file-code-2",ue);var xe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ne=s("maximize-2",xe);var fe=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],J=s("notebook-pen",fe);var be=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],se=s("user",be);var C={approve:{label:"通过",text:"text-success",ring:"ring-success/80",soft:"bg-success/12 text-success"},reject:{label:"反对",text:"text-danger",ring:"ring-danger/80",soft:"bg-danger/12 text-danger"},abstain:{label:"弃权",text:"text-dim",ring:"ring-line-strong",soft:"bg-raised text-dim"},pending:{label:"未表态",text:"text-faint",ring:"ring-line",soft:"bg-raised text-faint"}},ge={thinking:"思考中",reading:"查阅中",speaking:"发言中",idle:"等待中",error:"出错",aborted:"已中止"},U={success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-faint"},G={success:"bg-success",warning:"bg-warning",danger:"bg-danger",neutral:"bg-faint"};function q(t){return t==="thinking"||t==="reading"||t==="speaking"}function F(t){let d=q(t.status);return{busy:d,text:d&&t.activeTool?t.activeTool:ge[t.status]}}function Q(t){let d=t.members.filter((v)=>v.verdict==="approve").length,u=t.members.filter((v)=>v.verdict==="reject").length;if(t.state==="running"){if(t.phase==="research")return{tone:"warning",label:"调研中"};if(t.phase==="opening")return{tone:"warning",label:"开场表态"};return{tone:"warning",label:"群聊交流"}}if(t.state==="consensus"){if(d===t.members.length)return{tone:"success",label:"全票通过"};if(u===t.members.length)return{tone:"danger",label:"全票反对"};if(u>d)return{tone:"danger",label:"共识:反对"};return{tone:"success",label:"共识:通过"}}if(t.state==="diverged")return{tone:"warning",label:"存在分歧"};if(t.state==="error")return{tone:"danger",label:"失败"};return{tone:"neutral",label:"已中止"}}function V(t){let d=Math.max(1,Math.round(t/1000));if(d<60)return`${d}s`;return`${Math.floor(d/60)}m ${String(d%60).padStart(2,"0")}s`}var ve={research:"调研",opening:"开场表态",discussion:"群聊交流"};function K(t){let{cn:d}=y(),{room:u}=t,v=Q(u),x=u.state==="running",b=u.research?["research","opening","discussion"]:["opening","discussion"],a=x?b.indexOf(u.phase==="closed"?"discussion":u.phase??"discussion"):-1,c=[...b.map((p,m)=>({key:p,label:ve[p],done:!x||m<a,active:m===a})),{key:"closed",label:x?"结论":v.label,done:!x,active:!1}];return e("ol",{className:d("flex min-w-0 gap-1",t.className),children:c.map((p,m)=>{let N=m===c.length-1&&!x;return n("li",{className:"min-w-0 flex-1",children:[e("span",{className:d("block h-[3px] rounded-full transition-colors duration-300",N?G[v.tone]:p.active?"bg-accent animate-pulse":p.done?"bg-line-strong":"bg-line/60")}),e("span",{className:d("mt-1.5 block truncate text-[11px]",N?d("font-medium",U[v.tone]):p.active?"font-medium text-ink":p.done?"text-dim":"text-faint"),children:p.label})]},p.key)})})}function oe(t){let{Collapsible:d,CollapsibleContent:u,Composer:v,Markdown:x,cn:b,confirm:a}=y(),{room:c,onClose:p}=t,[m,N]=r(!1),[w,M]=r(""),[g,L]=r(!1),[I,O]=r(),[S,H]=r(!1),[E,D]=r(!0),[B,h]=r(),z=i(!1);z.current=B!==void 0;let R=i(null),T=i(null),P=c.state==="running",j=Q(c),re=new Map(c.members.map((l)=>[l.id,l]));o(()=>{let l=(ee)=>{if(ee.key==="Escape"&&!ee.defaultPrevented&&!z.current)N(!0)},k=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l),document.body.style.overflow=k}},[]);let Y=c.messages.length;o(()=>{let l=T.current;if(!l||!E||Y===0)return;l.scrollTo({top:l.scrollHeight,behavior:"smooth"})},[Y,E]);let le=async(l)=>{await t.onPost(l),D(!0)},ce=async()=>{if(g)return;if(!await a({title:"中止理事会?",description:"所有成员会立即停止,已有发言保留。",action:"中止",danger:!0}))return;L(!0),O(void 0);try{await t.onAbort()}catch(k){O(k instanceof Error?k.message:"中止理事会失败")}finally{L(!1)}},W=(l)=>{M((k)=>k.includes(`@${l}`)?k:`${k?`${k.trimEnd()} `:""}@${l} `),R.current?.focus()},me=c.members.filter((l)=>l.verdict==="approve").length,de=c.members.filter((l)=>l.verdict==="reject").length,_=c.members.find((l)=>l.id===B);return vt(n("div",{role:"dialog","aria-modal":"true","aria-label":`理事会:${c.topic}`,onAnimationEnd:(l)=>{if(m&&l.target===l.currentTarget)p()},className:b("fixed inset-0 z-50 flex flex-col bg-bg pt-[env(safe-area-inset-top)] text-ink",m?"pointer-events-none animate-dialog-out":"animate-dialog-in"),children:[n(d,{open:S,onOpenChange:H,className:"shrink-0 border-b border-line px-4 pt-3 pb-3 sm:px-6",children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-3 text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-[0.2em] text-dim",children:"COUNCIL"}),e("span",{className:"tabular-nums",children:V(t.elapsedMs)}),n("span",{className:"tabular-nums",children:[c.messages.length," 条发言"]})]}),n("button",{type:"button","aria-expanded":S,onClick:()=>H((l)=>!l),className:"mt-0.5 flex max-w-full cursor-pointer items-start gap-1.5 text-left md:items-center",children:[e("h2",{className:"line-clamp-2 text-[15px] leading-snug font-semibold md:truncate md:text-lg",children:c.topic}),e(ie,{className:b("mt-0.5 size-4 shrink-0 text-faint transition-transform duration-300 ease-out-quint md:mt-0",!S&&"-rotate-90")})]})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[n("span",{className:b("inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-1 text-xs font-medium",U[j.tone]),children:[e("span",{className:b("size-1.5 rounded-full",G[j.tone],P&&"animate-pulse")}),j.label]}),e("button",{type:"button","aria-label":"关闭理事会页面",title:"关闭(Esc)",onClick:()=>N(!0),className:"ml-1 inline-flex size-10 -mr-2 cursor-pointer items-center justify-center rounded-full text-faint transition-colors hover:bg-raised hover:text-ink md:size-8 md:mr-0",children:e(X,{className:"size-4"})})]})]}),e(u,{children:e("div",{className:"mt-2 max-h-[40dvh] overflow-y-auto overscroll-contain rounded-xl bg-panel px-3.5 py-2.5 text-[13px] leading-relaxed text-dim md:max-h-48",children:e(x,{text:c.brief})})}),e(K,{room:c,className:"mt-3"})]}),n("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[e("div",{className:"flex shrink-0 gap-2 overflow-x-auto overscroll-x-contain border-b border-line px-4 py-2.5 [scrollbar-width:none] md:hidden",children:c.members.map((l)=>e(he,{member:l,onSelect:()=>h(l.id)},l.id))}),n("aside",{className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line p-4 md:flex",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-wide",children:"席位"}),n("span",{className:"tabular-nums",children:[e("span",{className:"text-success",children:me})," / ",e("span",{className:"text-danger",children:de})," /"," ",c.members.length]})]}),c.members.map((l)=>e(ye,{member:l,onMention:()=>W(l.name),onOpen:()=>t.onOpenMember(l.childSessionID)},l.id))]}),n("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e("div",{ref:T,onScroll:(l)=>{let k=l.currentTarget;D(k.scrollHeight-k.scrollTop-k.clientHeight<80)},className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"mx-auto w-full max-w-3xl px-4 py-4 sm:px-6 md:py-5",children:[c.messages.length===0?n("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-center text-faint",children:[P?e(Z,{className:"size-5 animate-spin"}):null,e("p",{className:"text-sm",children:P?c.phase==="research"?"成员正在各自调研,笔记不会进入群聊":"成员正在独立准备开场观点,彼此不可见":"这场理事会没有产生发言"})]}):e("ol",{className:"space-y-5",children:c.messages.map((l)=>e(ke,{message:l,membersByID:re,onMention:()=>W(l.senderName)},l.floor))}),c.summary&&!P&&n("section",{className:"mt-8 rounded-2xl border border-line bg-panel px-4 py-3",children:[n("h3",{className:b("text-xs font-semibold",U[j.tone]),children:["结论:",j.label]}),e("div",{className:"mt-1.5 text-[13px] leading-relaxed text-dim",children:e(x,{text:c.summary})})]})]})}),e("div",{className:"shrink-0 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6 md:pb-4",children:n("div",{className:"mx-auto w-full max-w-3xl",children:[I&&e("p",{role:"status",className:"px-1 pb-2 text-[13px] text-danger",children:I}),e(v,{draftKey:`council:${c.roomID}`,placeholder:P?"插话,@ 某位成员会点名要求其回应":"理事会已结束,插话会重新唤醒成员",busy:P,allowAttachments:!1,text:w,onTextChange:M,inputRef:R,onSend:le,onAbort:()=>void ce()})]})})]})]}),_&&e(Ne,{member:_,onClose:()=>h(void 0),onMention:()=>{h(void 0),W(_.name)},onOpen:()=>t.onOpenMember(_.childSessionID)})]}),document.body)}function he(t){let{ModelIcon:d,cn:u}=y(),{member:v}=t,x=C[v.verdict]??C.pending,{busy:b}=F(v);return n("button",{type:"button",onClick:t.onSelect,"aria-label":`${v.name},${x.label},查看详情`,className:"flex h-11 max-w-[11rem] shrink-0 cursor-pointer items-center gap-2 rounded-full border border-line bg-panel/60 pr-3.5 pl-1.5 active:bg-raised",children:[n("span",{className:u("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",x.ring),children:[e(d,{modelID:v.model,className:"size-4",size:16}),b&&e(Z,{className:"absolute -right-1 -bottom-1 size-3.5 animate-spin rounded-full bg-bg text-accent"})]}),n("span",{className:"min-w-0 text-left leading-tight",children:[e("span",{className:"block truncate text-[13px] font-medium",children:v.name}),e("span",{className:u("block text-[11px]",x.text),children:x.label})]})]})}function Ne(t){let{Button:d,Dialog:u,Markdown:v,ModelIcon:x,cn:b}=y(),{member:a}=t,c=C[a.verdict]??C.pending,p=F(a);return e(u,{open:!0,onOpenChange:(m)=>!m&&t.onClose(),title:n("span",{className:"flex min-w-0 items-center gap-2.5",children:[e("span",{className:b("flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",c.ring),children:e(x,{modelID:a.model,className:"size-4",size:16})}),e("span",{className:"min-w-0 truncate",children:a.name}),e("span",{className:b("shrink-0 rounded px-1.5 py-px text-[11px] font-medium",c.soft),children:c.label})]}),description:a.model,footer:n(f,{children:[n(d,{variant:"secondary",onClick:t.onMention,children:[e(A,{className:"size-4"}),"点名"]}),n(d,{variant:"secondary",onClick:t.onOpen,children:[e(rt,{className:"size-4"}),"查看推理"]})]}),children:n("div",{className:"space-y-3 pb-1",children:[n("div",{className:"flex items-center gap-3 text-[13px]",children:[n("span",{className:b("flex min-w-0 flex-1 items-center gap-1.5",p.busy?"text-accent":"text-dim"),children:[p.busy&&e(Z,{className:"size-3.5 shrink-0 animate-spin"}),e("span",{className:"truncate",children:p.text})]}),n("span",{className:"shrink-0 text-faint tabular-nums",children:["发言 ",a.turns??0," 次"]})]}),a.notes?n("section",{children:[n("h3",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-faint",children:[e(J,{className:"size-3.5"}),"调研笔记"]}),e("div",{className:"rounded-xl bg-bg/60 px-3.5 py-2.5 text-[13px] leading-relaxed text-dim",children:e(v,{text:a.notes})})]}):e("p",{className:"text-[13px] text-faint",children:"没有调研笔记"})]})})}function ye(t){let{Collapsible:d,CollapsibleContent:u,Markdown:v,ModelIcon:x,cn:b}=y(),{member:a}=t,[c,p]=r(!1),m=C[a.verdict]??C.pending,{busy:N,text:w}=F(a);return n(d,{open:c,onOpenChange:p,className:"shrink-0 rounded-xl border border-line bg-panel/60 p-2.5",children:[n("div",{className:"flex items-center gap-2.5",children:[e("span",{className:b("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",m.ring),children:e(x,{modelID:a.model,className:"size-4",size:16})}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"truncate text-[13px] font-medium",title:a.model,children:a.name}),e("span",{className:b("shrink-0 rounded px-1 text-[10.5px] font-medium",m.soft),children:m.label})]}),n("div",{className:b("flex min-w-0 items-center gap-1 text-[11px]",N?"text-accent":"text-faint"),children:[N&&e(Z,{className:"size-3 shrink-0 animate-spin"}),e("span",{className:"truncate",children:w})]})]})]}),n("div",{className:"mt-2 flex items-center gap-1 text-[11px] text-faint",children:[n("span",{className:"tabular-nums",children:["发言 ",a.turns??0," 次"]}),e("span",{className:"ml-auto"}),a.notes&&n("button",{type:"button","aria-expanded":c,onClick:()=>p((M)=>!M),className:b("inline-flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 hover:bg-raised hover:text-ink",c&&"text-ink"),children:[e(J,{className:"size-3"}),"笔记"]}),e("button",{type:"button","aria-label":`@ ${a.name}`,title:`@ ${a.name}`,onClick:t.onMention,className:"inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(A,{className:"size-3"})}),e("button",{type:"button","aria-label":`查看 ${a.name} 的推理过程`,title:"查看推理与工具调用",onClick:t.onOpen,className:"inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(rt,{className:"size-3"})})]}),a.notes&&e(u,{children:e("div",{className:"mt-2 max-h-56 overflow-y-auto rounded-lg bg-bg/60 px-2.5 py-2 text-xs leading-relaxed text-dim",children:e(v,{text:a.notes})})})]})}function ke(t){let{Code:d,Collapsible:u,CollapsibleContent:v,Markdown:x,cn:b}=y(),{message:a}=t,[c,p]=r(!1),m=a.senderID==="user"||a.senderID==="host",N=a.verdict&&a.verdict!=="pending"?C[a.verdict]:void 0,w=a.evidences??[],M=(a.mentions??[]).map((g)=>t.membersByID.get(g)).filter((g)=>g!==void 0);return n("li",{id:`council-floor-${a.floor}`,className:"group flex gap-3 animate-fade",children:[e(ae,{message:a,isHuman:m,className:"mt-0.5 hidden size-8 md:flex"}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",children:[e(ae,{message:a,isHuman:m,className:"flex size-6 md:hidden"}),e("span",{className:"font-semibold text-ink",title:a.senderModel,children:a.senderName}),n("a",{href:`#council-floor-${a.floor}`,className:"font-mono text-[11px] text-faint hover:text-dim",onClick:(g)=>g.preventDefault(),children:["#",a.floor]}),N&&e("span",{className:b("rounded px-1.5 py-px text-[10.5px] font-medium",N.soft),children:N.label}),!m&&n("button",{type:"button",onClick:t.onMention,className:"ml-auto inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-[11px] text-faint transition-opacity hover:bg-raised hover:text-ink focus-visible:opacity-100 md:px-1.5 md:py-0.5 md:opacity-0 md:group-hover:opacity-100",children:[e(A,{className:"size-3"}),"回复"]})]}),(a.replyToFloor||M.length>0)&&n("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-faint",children:[a.replyToFloor&&n("button",{type:"button",onClick:()=>document.getElementById(`council-floor-${a.replyToFloor}`)?.scrollIntoView({block:"center",behavior:"smooth"}),className:"inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-md bg-raised/70 px-1.5 py-0.5 hover:text-ink",children:[e(tr,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0 text-dim",children:["#",a.replyToFloor," ",a.replyToName]}),a.replyToPreview&&e("span",{className:"truncate",children:a.replyToPreview})]}),M.map((g)=>n("span",{className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-accent",children:[e(A,{className:"size-3"}),g.name]},g.id))]}),e("div",{className:"mt-1.5 break-words text-[14px] leading-relaxed text-ink/90 md:text-[13.5px] [&_p]:my-1.5 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e(x,{text:a.text})}),w.length>0&&n(u,{open:c,onOpenChange:p,className:"mt-2",children:[n("button",{type:"button","aria-expanded":c,onClick:()=>p((g)=>!g),className:"inline-flex max-w-full cursor-pointer items-center gap-1 text-[11px] text-faint hover:text-ink",children:[e(te,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0",children:["查阅 ",w.length," 处"]}),!c&&e("span",{className:"truncate font-mono",children:w.map((g)=>g.label).join(",")}),e(ie,{className:b("size-3 shrink-0 transition-transform duration-300 ease-out-quint",!c&&"-rotate-90")})]}),e(v,{children:e("div",{className:"mt-1.5 space-y-1.5",children:w.map((g)=>n("div",{className:"overflow-hidden rounded-lg border border-line bg-panel text-xs",children:[e("div",{className:"truncate border-b border-line/70 px-2.5 py-1 font-mono text-[11px] text-dim",children:g.label}),g.snippet&&e(d,{code:g.snippet,lang:g.lang||"ts",className:"max-h-40 overflow-auto px-2.5 py-1.5 text-[11.5px]"})]},`${g.tool}:${g.label}:${g.snippet?.slice(0,32)??""}`))})})]})]})]})}function ae(t){let{ModelIcon:d,cn:u}=y();return e("span",{className:u("shrink-0 items-center justify-center rounded-full",t.isHuman?"bg-accent/12 text-accent":"bg-raised",t.className),children:t.message.senderModel?e(d,{modelID:t.message.senderModel,className:"size-4",size:16}):e(se,{className:"size-4"})})}function Je(t){let{ModelIcon:d,cn:u,useTheme:v}=y();v();let{connection:x,sessionID:b,payload:a,onOpen:c}=t,p=a,[m,N]=r(p),[w,M]=r(!1),[g,L]=r(Date.now);o(()=>{N(p)},[p]);let I=m.state==="running",O=`/api/sessions/${encodeURIComponent(b)}/council/${encodeURIComponent(m.roomID)}`;o(()=>{if(!I)return;let h=!1,R=setInterval(()=>{if(x.request(O).then((T)=>{if(!h&&T&&typeof T==="object"&&"roomID"in T)N(T)}).catch(()=>{}),!h)L(Date.now())},1200);return()=>{h=!0,clearInterval(R)}},[x,O,I]);let S=async(h)=>{let z=await x.request(`${O}/post`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:h})});N(z)},H=async()=>{let h=await x.request(`${O}/kill`,{method:"POST"});N(h)},E=(I?g:m.updatedAt)-m.createdAt,D=m.messages.at(-1),B=m.members.filter((h)=>q(h.status)).length;return n(f,{children:[n("button",{type:"button","aria-label":`进入理事会:${m.topic}`,onClick:()=>M(!0),className:"group relative my-2 block w-full cursor-pointer overflow-hidden rounded-2xl border border-line bg-panel text-left transition-colors hover:border-line-strong animate-fade",children:[n("div",{className:"px-4 pt-3.5",children:[n("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[e("span",{className:"font-medium text-dim",children:"理事会"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{className:"tabular-nums",children:V(E)}),n("span",{className:"ml-auto tabular-nums",children:[m.members.length," 位成员"]})]}),e("h4",{className:"mt-1 line-clamp-2 text-sm font-semibold text-ink md:truncate",title:m.topic,children:m.topic})]}),e(K,{room:m,className:"mt-3 px-4"}),e("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 px-4",children:m.members.map((h)=>{let z=C[h.verdict]??C.pending,R=q(h.status);return n("span",{className:"flex min-w-0 items-center gap-1.5 text-xs",title:h.model,children:[n("span",{className:u("relative flex size-6 shrink-0 items-center justify-center rounded-full bg-raised ring-2",z.ring),children:[e(d,{modelID:h.model,className:"size-3.5",size:14}),R&&e(Z,{className:"absolute -right-1 -bottom-1 size-3 animate-spin rounded-full bg-panel text-accent"})]}),e("span",{className:"truncate text-dim",children:h.name}),e("span",{className:u("shrink-0 text-[11px]",z.text),children:z.label})]},h.id)})}),n("div",{className:"mt-3 flex items-center gap-2 border-t border-line/70 px-4 py-2.5 text-xs",children:[D?n(f,{children:[e("span",{className:"shrink-0 font-medium text-dim",children:D.senderName}),e("span",{className:"min-w-0 flex-1 truncate text-faint",children:D.text.replace(/\s+/g," ")})]}):e("span",{className:"min-w-0 flex-1 truncate text-faint",children:I?`${B} 位成员正在${m.phase==="research"?"调研":"思考"}…`:"没有发言"}),n("span",{className:"inline-flex shrink-0 items-center gap-1 text-faint transition-colors group-hover:text-ink",children:[m.messages.length>0&&n("span",{className:"tabular-nums",children:[m.messages.length," 条"]}),e(ne,{className:"size-3.5"})]})]})]}),w&&e(oe,{room:m,elapsedMs:E,onClose:()=>M(!1),onOpenMember:c,onPost:S,onAbort:H})]})}export{Je as CouncilCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Di}from"./chunk-60axh4sa.js";export{Di as createTreeViewServices};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t,a,Re,b,C,S,E,T,A,L,R,l,p,Yi,M,pe,se,le,gt,ge,ye}from"./chunk-veam6vk4.js";import{Ft}from"./chunk-79e08rk1.js";import{he}from"./chunk-rrpn5r5w.js";import{ue}from"./chunk-7qkav30b.js";var Bt=function(){var e=t(function(Q,h,g,n){for(g=g||{},n=Q.length;n--;g[Q[n]]=h);return g},"o"),s=[1,2],c=[1,3],r=[1,4],u=[2,4],f=[1,9],m=[1,11],k=[1,16],o=[1,17],D=[1,18],x=[1,19],G=[1,33],Y=[1,20],j=[1,21],O=[1,22],y=[1,23],V=[1,24],F=[1,26],z=[1,27],W=[1,28],K=[1,29],N=[1,30],st=[1,31],pt=[1,32],St=[1,35],yt=[1,36],mt=[1,37],bt=[1,38],rt=[1,34],_=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],kt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Mt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],Lt={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:t(function(h,g,n,v,w,i,it){var d=i.length-1;switch(w){case 3:return v.setRootDoc(i[d]),i[d];break;case 4:this.$=[];break;case 5:if(i[d]!="nl")i[d-1].push(i[d]),this.$=i[d-1];break;case 6:case 7:this.$=i[d];break;case 8:this.$="nl";break;case 12:this.$=i[d];break;case 13:let Et=i[d-1];Et.description=v.trimColon(i[d]),this.$=Et;break;case 14:this.$={stmt:"relation",state1:i[d-2],state2:i[d]};break;case 15:let _t=v.trimColon(i[d]);this.$={stmt:"relation",state1:i[d-3],state2:i[d-1],description:_t};break;case 19:this.$={stmt:"state",id:i[d-3],type:"default",description:"",doc:i[d-1]};break;case 20:var X=i[d],J=i[d-2].trim();if(i[d].match(":")){var lt=i[d].split(":");X=lt[0],J=[J,lt[1]]}this.$={stmt:"state",id:X,type:"default",description:J};break;case 21:this.$={stmt:"state",id:i[d-3],type:"default",description:i[d-5],doc:i[d-1]};break;case 22:this.$={stmt:"state",id:i[d],type:"fork"};break;case 23:this.$={stmt:"state",id:i[d],type:"join"};break;case 24:this.$={stmt:"state",id:i[d],type:"choice"};break;case 25:this.$={stmt:"state",id:v.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[d-1].trim(),note:{position:i[d-2].trim(),text:i[d].trim()}};break;case 29:this.$=i[d].trim(),v.setAccTitle(this.$);break;case 30:case 31:this.$=i[d].trim(),v.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[d-3],url:i[d-2],tooltip:i[d-1]};break;case 33:this.$={stmt:"click",id:i[d-3],url:i[d-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[d-1].trim(),classes:i[d].trim()};break;case 36:this.$={stmt:"style",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 37:this.$={stmt:"applyClass",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 38:v.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:v.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:v.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:v.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[d].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:s,5:c,6:r},{1:[3]},{3:5,4:s,5:c,6:r},{3:6,4:s,5:c,6:r},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],u,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:f,5:m,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:o,19:D,22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:yt,53:mt,54:bt,57:rt},e(_,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:k,17:o,19:D,22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:yt,53:mt,54:bt,57:rt},e(_,[2,7]),e(_,[2,8]),e(_,[2,9]),e(_,[2,10]),e(_,[2,11]),e(_,[2,12],{14:[1,40],15:[1,41]}),e(_,[2,16]),{18:[1,42]},e(_,[2,18],{20:[1,43]}),{23:[1,44]},e(_,[2,22]),e(_,[2,23]),e(_,[2,24]),e(_,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(_,[2,28]),{34:[1,49]},{36:[1,50]},e(_,[2,31]),{13:51,24:G,57:rt},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(kt,[2,44],{58:[1,56]}),e(kt,[2,45],{58:[1,57]}),e(_,[2,38]),e(_,[2,39]),e(_,[2,40]),e(_,[2,41]),e(_,[2,6]),e(_,[2,13]),{13:58,24:G,57:rt},e(_,[2,17]),e(Mt,u,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(_,[2,29]),e(_,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(_,[2,14],{14:[1,71]}),{4:f,5:m,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:o,19:D,21:[1,72],22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:yt,53:mt,54:bt,57:rt},e(_,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(_,[2,34]),e(_,[2,35]),e(_,[2,36]),e(_,[2,37]),e(kt,[2,46]),e(kt,[2,47]),e(_,[2,15]),e(_,[2,19]),e(Mt,u,{7:78}),e(_,[2,26]),e(_,[2,27]),{5:[1,79]},{5:[1,80]},{4:f,5:m,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:o,19:D,21:[1,81],22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:yt,53:mt,54:bt,57:rt},e(_,[2,32]),e(_,[2,33]),e(_,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:t(function(h,g){if(g.recoverable)this.trace(h);else{var n=Error(h);throw n.hash=g,n}},"parseError"),parse:t(function(h){var g=this,n=[0],v=[],w=[null],i=[],it=this.table,d="",X=0,J=0,lt=0,Et=2,_t=1,be=i.slice.call(arguments,1),I=Object.create(this.lexer),tt={yy:{}};for(var wt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,wt))tt.yy[wt]=this.yy[wt];if(I.setInput(h,tt.yy),tt.yy.lexer=I,tt.yy.parser=this,typeof I.yylloc>"u")I.yylloc={};var It=I.yylloc;i.push(It);var ke=I.options&&I.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Te(H){n.length=n.length-2*H,w.length=w.length-H,i.length=i.length-H}t(Te,"popStack");function Wt(){var H=v.pop()||I.lex()||_t;if(typeof H!=="number"){if(H instanceof Array)v=H,H=v.pop();H=g.symbols_[H]||H}return H}t(Wt,"lex");var P,Nt,et,U,ts,Ot,at={},vt,q,jt,Dt;while(!0){if(et=n[n.length-1],this.defaultActions[et])U=this.defaultActions[et];else{if(P===null||typeof P>"u")P=Wt();U=it[et]&&it[et][P]}if(typeof U>"u"||!U.length||!U[0]){var Rt="";Dt=[];for(vt in it[et])if(this.terminals_[vt]&&vt>Et)Dt.push("'"+this.terminals_[vt]+"'");if(I.showPosition)Rt="Parse error on line "+(X+1)+`:
|
|
2
2
|
`+I.showPosition()+`
|
|
3
|
-
Expecting `+Dt.join(", ")+", got '"+(this.terminals_[P]||P)+"'";else Rt="Parse error on line "+(X+1)+": Unexpected "+(P==_t?"end of input":"'"+(this.terminals_[P]||P)+"'");this.parseError(Rt,{text:I.match,token:this.terminals_[P]||P,line:I.yylineno,loc:It,expected:Dt})}if(U[0]instanceof Array&&U.length>1)throw Error("Parse Error: multiple actions possible at state: "+et+", token: "+P);switch(U[0]){case 1:if(n.push(P),w.push(I.yytext),i.push(I.yylloc),n.push(U[1]),P=null,!Nt){if(J=I.yyleng,d=I.yytext,X=I.yylineno,It=I.yylloc,lt>0)lt--}else P=Nt,Nt=null;break;case 2:if(q=this.productions_[U[1]][1],at.$=w[w.length-q],at._$={first_line:i[i.length-(q||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(q||1)].first_column,last_column:i[i.length-1].last_column},ke)at._$.range=[i[i.length-(q||1)].range[0],i[i.length-1].range[1]];if(Ot=this.performAction.apply(at,[d,J,X,tt.yy,U[1],w,i].concat(be)),typeof Ot<"u")return Ot;if(q)n=n.slice(0,-1*q*2),w=w.slice(0,-1*q),i=i.slice(0,-1*q);n.push(this.productions_[U[1]][0]),w.push(at.$),i.push(at._$),jt=it[n[n.length-2]][n[n.length-1]],n.push(jt);break;case 3:return!0}}return!0},"parse")},me=function(){var Q={EOF:1,parseError:
|
|
4
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:
|
|
5
|
-
`+g+"^"},"showPosition"),test_match:
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:e(function(g){this.conditionStack.push(g)},"begin"),popState:e(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(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:e(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:e(function(g){this.begin(g)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(g,n,_,w){function i(){let d=n.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=n.yytext.slice(0,d),J=n.yytext.slice(d);if(J)g.lexer.unput(J);n.yytext=X}return!0}e(i,"processId");var it=w;switch(_){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!i())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw Error('Error: State name must be a single word. Found: "'+n.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!i())return;return this.popState(),"ID";break;case 66:if(!i())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),n.yytext=n.yytext.substr(2).trim(),31;break;case 68:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!i())return;return 24;case 74:return n.yytext=n.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return Q}();Lt.lexer=me;function Tt(){this.yy={}}return e(Tt,"Parser"),Tt.prototype=Lt,Lt.Parser=Tt,new Tt}();Bt.parser=Bt;var Ee=Bt,_e="TB",qt="TB",Ut="dir",ot="state",nt="root",Gt="relation",ve="classDef",De="style",Ce="applyClass",ut="default",Qt="divider",Zt="fill:none",te="fill: #333",ee="c",re="markdown",ie="normal",Ft="rect",Pt="rectWithTitle",Ae="stateStart",xe="stateEnd",Yt="divider",Ht="roundedWithTitle",Le="note",we="noteGroup",ft="statediagram",Ie="state",Ne=`${ft}-${Ie}`,ae="transition",Oe="note",$e="note-edge",Fe=`${ae} ${$e}`,Pe=`${ft}-${Oe}`,Be="cluster",Ge=`${ft}-${Be}`,Ye="cluster-alt",Ve=`${ft}-${Ye}`,ne="parent",ce="note",Me="state",Vt="----",We=`${Vt}${ce}`,zt=`${Vt}${ne}`,At=new Map,Z=0,de=0,ct=new Map,je=e((t,s,c,r)=>{if(t===Yt&&c?.id!==void 0&&ct.has(c.id)){let m=ct.get(c.id);return ct.set(s,m),m}let u=de++,f=r?void 0:u;return ct.set(s,f),f},"colorSlotFor");function xt(t="",s=0,c="",r=Vt){let u=c!==null&&c.length>0?`${r}${c}`:"";return`${Me}-${t}${u}-${s}`}e(xt,"stateDomId");var Ue=e((t,s,c,r,u,f,m,b)=>{a.trace("items",s),s.forEach((o)=>{switch(o.stmt){case ot:dt(t,o,c,r,u,f,m,b);break;case ut:dt(t,o,c,r,u,f,m,b);break;case Gt:{dt(t,o.state1,c,r,u,f,m,b),dt(t,o.state2,c,r,u,f,m,b);let D=m==="neo",x={id:"edge"+Z,start:o.state1.id,end:o.state2.id,arrowhead:"normal",arrowTypeEnd:D?"arrow_barb_neo":"arrow_barb",style:Zt,labelStyle:"",label:v.sanitizeText(o.description??"",l()),arrowheadStyle:te,labelpos:ee,labelType:re,thickness:ie,classes:ae,look:m};u.push(x),Z++}break}})},"setupDoc"),Kt=e((t,s=qt)=>{let c=s;if(t.doc){for(let r of t.doc)if(r.stmt==="dir")c=r.value}return c},"getDir");function ht(t,s,c){if(!s.id||s.id==="</join></fork>"||s.id==="</choice>")return;if(s.cssClasses){if(!Array.isArray(s.cssCompiledStyles))s.cssCompiledStyles=[];s.cssClasses.split(" ").forEach((u)=>{let f=c.get(u);if(f)s.cssCompiledStyles=[...s.cssCompiledStyles??[],...f.styles]})}let r=t.find((u)=>u.id===s.id);if(r)Object.assign(r,s);else t.push(s)}e(ht,"insertOrUpdateNode");function fe(t){return t?.classes?.join(" ")??""}e(fe,"getClassesFromDbInfo");function pe(t){return t?.styles??[]}e(pe,"getStylesFromDbInfo");var dt=e((t,s,c,r,u,f,m,b)=>{let o=s.id,D=c.get(o),x=fe(D),G=pe(D),Y=l(),j=x.trim()!==""||G.length>0;if(a.info("dataFetcher parsedItem",s,D,G),o!=="root"){let O=Ft;if(s.start===!0)O=Ae;else if(s.start===!1)O=xe;if(s.type!==ut)O=s.type;if(!At.get(o))At.set(o,{id:o,shape:O,description:v.sanitizeText(o,Y),cssClasses:`${x} ${Ne}`,cssStyles:G});let y=At.get(o);if(s.description){if(Array.isArray(y.description))y.shape=Pt,y.description.push(s.description);else if(y.description?.length&&y.description.length>0)if(y.shape=Pt,y.description===o)y.description=[s.description];else y.description=[y.description,s.description];else y.shape=Ft,y.description=s.description;y.description=v.sanitizeTextOrArray(y.description,Y)}if(y.description?.length===1&&y.shape===Pt)if(y.type==="group")y.shape=Ht;else y.shape=Ft;if(!y.type&&s.doc)a.info("Setting cluster for XCX",o,Kt(s)),y.type="group",y.isGroup=!0,y.dir=Kt(s),y.shape=s.type===Qt?Yt:Ht,y.colorIndex=je(y.shape,o,t,j),y.cssClasses=`${y.cssClasses} ${Ge} ${f?Ve:""}`;let V={labelStyle:"",shape:y.shape,label:y.description,cssClasses:y.cssClasses,cssCompiledStyles:[],cssStyles:y.cssStyles,id:o,dir:y.dir,domId:xt(o,Z),type:y.type,isGroup:y.type==="group",colorIndex:y.colorIndex,padding:8,rx:10,ry:10,look:m,labelType:"markdown"};if(V.shape===Yt)V.label="";if(t&&t.id!=="root")a.trace("Setting node ",o," to be child of its parent ",t.id),V.parentId=t.id;if(V.centerLabel=!0,s.note){let F={labelStyle:"",shape:Le,label:s.note.text,labelType:"markdown",cssClasses:Pe,cssStyles:[],cssCompiledStyles:[],id:o+We+"-"+Z,domId:xt(o,Z,ce),type:"node",isGroup:!1,padding:Y.flowchart?.padding,look:m,position:s.note.position},z=o+zt,W={labelStyle:"",shape:we,label:s.note.text,cssClasses:y.cssClasses,cssStyles:[],id:o+zt,domId:xt(o,Z,ne),type:"group",isGroup:!0,padding:16,look:m,position:s.note.position};Z++,W.id=z,F.parentId=z,ht(r,W,b),ht(r,F,b),ht(r,V,b);let K=o,N=F.id;if(s.note.position==="left of")K=F.id,N=o;u.push({id:K+"-"+N,start:K,end:N,arrowhead:"none",arrowTypeEnd:"",style:Zt,labelStyle:"",classes:Fe,pattern:"dashed",arrowheadStyle:te,labelpos:ee,labelType:re,thickness:ie,look:m})}else ht(r,V,b)}if(s.doc)a.trace("Adding nodes children "),Ue(s,s.doc,c,r,u,!f,m,b)},"dataFetcher"),He=e(()=>{At.clear(),Z=0,de=0,ct.clear()},"reset"),Se=e((t,s=qt)=>{if(!t.doc)return s;let c=s;for(let r of t.doc)if(r.stmt==="dir")c=r.value;return c},"getDir"),ze=e(function(t,s){return s.db.getClasses()},"getClasses"),Ke=e(async function(t,s,c,r){a.info("REF0:"),a.info("Drawing state diagram (v2)",s);let{securityLevel:u,state:f,layout:m}=l();r.db.extract(r.db.getRootDocV2());let b=r.db.getData(),o=he(s,u);if(b.type=r.type,b.layoutAlgorithm=ye(m),b.nodeSpacing=f?.nodeSpacing||50,b.rankSpacing=f?.rankSpacing||50,l().look==="neo")b.markers=["barbNeo"];else b.markers=["barb"];b.diagramId=s,await ge(b,o);let x=8;try{(typeof r.db.getLinks==="function"?r.db.getLinks():new Map).forEach((Y,j)=>{let O=typeof j==="string"?j:typeof j?.id==="string"?j.id:"",y=b.nodes.find((N)=>N.id===O);if(!O){a.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(j));return}let V=o.node()?.querySelectorAll("g.node, g.rough-node"),F;if(V?.forEach((N)=>{let st=N.textContent?.trim();if(N.id===y?.domId||st===O)F=N}),!F){a.warn("⚠️ Could not find node matching text:",O);return}let z=F.parentNode;if(!z){a.warn("⚠️ Node has no parent, cannot wrap:",O);return}let W=document.createElementNS("http://www.w3.org/2000/svg","a"),K=Y.url.replace(/^"+|"+$/g,"");if(W.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),W.setAttribute("target","_blank"),Y.tooltip){let N=Y.tooltip.replace(/^"+|"+$/g,"");W.setAttribute("title",N),F.setAttribute("title",N)}z.replaceChild(W,F),W.appendChild(F),a.info("\uD83D\uDD17 Wrapped node in <a> tag for:",O,Y.url)})}catch(G){a.error("❌ Error injecting clickable links:",G)}M.insertTitle(o,"statediagramTitleText",f?.titleTopMargin??25,r.db.getDiagramTitle()),le(o,x,ft,f?.useMaxWidth??!0)},"draw"),Xe={getClasses:ze,draw:Ke,getDir:Se},B={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Xt=e(()=>new Map,"newClassesList"),Jt=e(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),Ct=e((t)=>JSON.parse(JSON.stringify(t)),"clone"),Je=class{constructor(t){this.version=t,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Xt(),this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=E,this.setAccTitle=S,this.getAccDescription=A,this.setAccDescription=T,this.setDiagramTitle=R,this.getDiagramTitle=L,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{e(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(let r of Array.isArray(t)?t:t.doc)switch(r.stmt){case ot:this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case Gt:this.addRelation(r.state1,r.state2,r.description);break;case ve:this.addStyleClass(r.id.trim(),r.classes);break;case De:this.handleStyleDef(r);break;case Ce:this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(r.id,r.url,r.tooltip);break}let s=this.getStates(),c=l();He(),dt(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,c.look,this.classes);for(let r of this.nodes){if(!Array.isArray(r.label))continue;if(r.description=r.label.slice(1),r.isGroup&&r.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${r.id}]`);r.label=r.label[0]}}handleStyleDef(t){let s=t.id.trim().split(","),c=t.styleClass.split(",");for(let r of s){let u=this.getState(r);if(!u){let f=r.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=c.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(t){if(a.info("Setting root doc",t),this.rootDoc=t,this.version===1)this.extract(t);else this.extract(this.getRootDocV2())}docTranslator(t,s,c){if(s.stmt===Gt){this.docTranslator(t,s.state1,!0),this.docTranslator(t,s.state2,!1);return}if(s.stmt===ot)if(s.id===B.START_NODE)s.id=t.id+(c?"_start":"_end"),s.start=c;else s.id=s.id.trim();if(s.stmt!==nt&&s.stmt!==ot||!s.doc)return;let r=[],u=[];for(let f of s.doc)if(f.type===Qt){let m=Ct(f);m.doc=Ct(u),r.push(m),u=[]}else u.push(f);if(r.length>0&&u.length>0){let f={stmt:ot,id:Ui(),type:"divider",doc:Ct(u)};r.push(Ct(f)),s.doc=r}s.doc.forEach((f)=>this.docTranslator(s,f,!0))}getRootDocV2(){return this.docTranslator({id:nt,stmt:nt},{id:nt,stmt:nt,doc:this.rootDoc},!0),{id:nt,doc:this.rootDoc}}addState(t,s=ut,c=void 0,r=void 0,u=void 0,f=void 0,m=void 0,b=void 0){let o=t?.trim();if(!this.currentDocument.states.has(o))a.info("Adding state ",o,r),this.currentDocument.states.set(o,{stmt:ot,id:o,descriptions:[],type:s,doc:c,note:u,classes:[],styles:[],textStyles:[]});else{let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);if(!D.doc)D.doc=c;if(!D.type)D.type=s}if(r)a.info("Setting state description",o,r),(Array.isArray(r)?r:[r]).forEach((x)=>this.addDescription(o,x.trim()));if(u){let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);D.note=u,D.note.text=v.sanitizeText(D.note.text,l())}if(f)a.info("Setting state classes",o,f),(Array.isArray(f)?f:[f]).forEach((x)=>this.setCssClass(o,x.trim()));if(m)a.info("Setting state styles",o,m),(Array.isArray(m)?m:[m]).forEach((x)=>this.setStyle(o,x.trim()));if(b)a.info("Setting state styles",o,m),(Array.isArray(b)?b:[b]).forEach((x)=>this.setTextStyle(o,x.trim()))}clear(t){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Xt(),!t)this.links=new Map,C()}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){a.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,s,c){this.links.set(t,{url:s,tooltip:c}),a.warn("Adding link",t,s,c)}getLinks(){return this.links}startIdIfNeeded(t=""){if(t===B.START_NODE)return this.startEndCount++,`${B.START_TYPE}${this.startEndCount}`;return t}startTypeIfNeeded(t="",s=ut){return t===B.START_NODE?B.START_TYPE:s}endIdIfNeeded(t=""){if(t===B.END_NODE)return this.startEndCount++,`${B.END_TYPE}${this.startEndCount}`;return t}endTypeIfNeeded(t="",s=ut){return t===B.END_NODE?B.END_TYPE:s}addRelationObjs(t,s,c=""){let r=this.startIdIfNeeded(t.id.trim()),u=this.startTypeIfNeeded(t.id.trim(),t.type),f=this.startIdIfNeeded(s.id.trim()),m=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(r,u,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(f,m,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:v.sanitizeText(c,l())})}addRelation(t,s,c){if(typeof t==="object"&&typeof s==="object")this.addRelationObjs(t,s,c);else if(typeof t==="string"&&typeof s==="string"){let r=this.startIdIfNeeded(t.trim()),u=this.startTypeIfNeeded(t),f=this.endIdIfNeeded(s.trim()),m=this.endTypeIfNeeded(s);this.addState(r,u),this.addState(f,m),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:c?v.sanitizeText(c,l()):void 0})}}addDescription(t,s){let c=this.currentDocument.states.get(t),r=s.startsWith(":")?s.replace(":","").trim():s;c?.descriptions?.push(v.sanitizeText(r,l()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,s=""){if(!this.classes.has(t))this.classes.set(t,{id:t,styles:[],textStyles:[]});let c=this.classes.get(t);if(s&&c)s.split(B.STYLECLASS_SEP).forEach((r)=>{let u=r.replace(/([^;]*);/,"$1").trim();if(RegExp(B.COLOR_KEYWORD).exec(r)){let m=u.replace(B.FILL_KEYWORD,B.BG_FILL).replace(B.COLOR_KEYWORD,B.FILL_KEYWORD);c.textStyles.push(m)}c.styles.push(u)})}getClasses(){return this.classes}setupToolTips(t){let s=$t();p(t).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=p(u.currentTarget),m=f.attr("title");if(m===null)return;let b=u.currentTarget?.getBoundingClientRect();s.transition().duration(200).style("opacity",".9"),s.style("left",window.scrollX+b.left+(b.right-b.left)/2+"px").style("top",window.scrollY+b.bottom+"px"),s.html(Re.sanitize(m)),f.classed("hover",!0)}).on("mouseout",(u)=>{s.transition().duration(500).style("opacity",0),p(u.currentTarget).classed("hover",!1)})}setCssClass(t,s){t.split(",").forEach((c)=>{let r=this.getState(c);if(!r){let u=c.trim();this.addState(u),r=this.getState(u)}r?.classes?.push(s)})}setStyle(t,s){this.getState(t)?.styles?.push(s)}setTextStyle(t,s){this.getState(t)?.textStyles?.push(s)}bindFunctions(t){this.funs.forEach((s)=>{s(t)})}getDirectionStatement(){return this.rootDoc.find((t)=>t.stmt===Ut)}getDirection(){return this.getDirectionStatement()?.value??_e}setDirection(t){let s=this.getDirectionStatement();if(s)s.value=t;else this.rootDoc.unshift({stmt:Ut,value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){let t=l();for(let s of this.nodes)if(s.wrappingWidth??=t.state?.wrappingWidth,!s.isGroup)s.minWidth??=t.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:Se(this.getRootDocV2())}}getConfig(){return l().state}},qe=e((t)=>{let{theme:s,bkgColorArray:c,borderColorArray:r}=t;if(!oe(s,r))return"";let u=se(t.look),f=ue(c),m="";for(let b=0;b<gt(r);b++){let o=r[b],D=f?`fill: ${c[b%c.length]};`:"",x=`[data-look="${u}"][data-color-id="color-${b}"]`;m+=`
|
|
3
|
+
Expecting `+Dt.join(", ")+", got '"+(this.terminals_[P]||P)+"'";else Rt="Parse error on line "+(X+1)+": Unexpected "+(P==_t?"end of input":"'"+(this.terminals_[P]||P)+"'");this.parseError(Rt,{text:I.match,token:this.terminals_[P]||P,line:I.yylineno,loc:It,expected:Dt})}if(U[0]instanceof Array&&U.length>1)throw Error("Parse Error: multiple actions possible at state: "+et+", token: "+P);switch(U[0]){case 1:if(n.push(P),w.push(I.yytext),i.push(I.yylloc),n.push(U[1]),P=null,!Nt){if(J=I.yyleng,d=I.yytext,X=I.yylineno,It=I.yylloc,lt>0)lt--}else P=Nt,Nt=null;break;case 2:if(q=this.productions_[U[1]][1],at.$=w[w.length-q],at._$={first_line:i[i.length-(q||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(q||1)].first_column,last_column:i[i.length-1].last_column},ke)at._$.range=[i[i.length-(q||1)].range[0],i[i.length-1].range[1]];if(Ot=this.performAction.apply(at,[d,J,X,tt.yy,U[1],w,i].concat(be)),typeof Ot<"u")return Ot;if(q)n=n.slice(0,-1*q*2),w=w.slice(0,-1*q),i=i.slice(0,-1*q);n.push(this.productions_[U[1]][0]),w.push(at.$),i.push(at._$),jt=it[n[n.length-2]][n[n.length-1]],n.push(jt);break;case 3:return!0}}return!0},"parse")},me=function(){var Q={EOF:1,parseError:t(function(g,n){if(this.yy.parser)this.yy.parser.parseError(g,n);else throw Error(g)},"parseError"),setInput:t(function(h,g){if(this.yy=g||this.yy||{},this._input=h,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 h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var g=h.match(/(?:\r\n?|\n).*/g);if(g)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),h},"input"),unput:t(function(h){var g=h.length,n=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var v=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),n.length-1)this.yylineno-=n.length-1;var w=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:n?(n.length===v.length?this.yylloc.first_column:0)+v[v.length-n.length].length-n[0].length:this.yylloc.first_column-g},this.options.ranges)this.yylloc.range=[w[0],w[0]+this.yyleng-g];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(h){this.unput(this.match.slice(h))},"less"),pastInput:t(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var h=this.match;if(h.length<20)h+=this._input.substr(0,20-h.length);return(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var h=this.pastInput(),g=Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
5
|
+
`+g+"^"},"showPosition"),test_match:t(function(h,g){var n,v,w;if(this.options.backtrack_lexer){if(w={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)w.yylloc.range=this.yylloc.range.slice(0)}if(v=h[0].match(/(?:\r\n?|\n).*/g),v)this.yylineno+=v.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,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(h[0].length),this.matched+=h[0],n=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(n)return n;else if(this._backtrack){for(var i in w)this[i]=w[i];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var h,g,n,v;if(!this._more)this.yytext="",this.match="";var w=this._currentRules();for(var i=0;i<w.length;i++)if(n=this._input.match(this.rules[w[i]]),n&&(!g||n[0].length>g[0].length)){if(g=n,v=i,this.options.backtrack_lexer)if(h=this.test_match(n,w[i]),h!==!1)return h;else if(this._backtrack){g=!1;continue}else return!1;else if(!this.options.flex)break}if(g){if(h=this.test_match(g,w[v]),h!==!1)return h;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 g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>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(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,n,v,w){function i(){let d=n.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=n.yytext.slice(0,d),J=n.yytext.slice(d);if(J)g.lexer.unput(J);n.yytext=X}return!0}t(i,"processId");var it=w;switch(v){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!i())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw Error('Error: State name must be a single word. Found: "'+n.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!i())return;return this.popState(),"ID";break;case 66:if(!i())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),n.yytext=n.yytext.substr(2).trim(),31;break;case 68:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!i())return;return 24;case 74:return n.yytext=n.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return Q}();Lt.lexer=me;function Tt(){this.yy={}}return t(Tt,"Parser"),Tt.prototype=Lt,Lt.Parser=Tt,new Tt}();Bt.parser=Bt;var Ee=Bt,_e="TB",qt="TB",Ut="dir",ot="state",nt="root",Gt="relation",ve="classDef",De="style",Ce="applyClass",ut="default",Qt="divider",Zt="fill:none",te="fill: #333",ee="c",re="markdown",ie="normal",$t="rect",Pt="rectWithTitle",Ae="stateStart",xe="stateEnd",Yt="divider",Ht="roundedWithTitle",Le="note",we="noteGroup",ft="statediagram",Ie="state",Ne=`${ft}-${Ie}`,ae="transition",Oe="note",$e="note-edge",Fe=`${ae} ${$e}`,Pe=`${ft}-${Oe}`,Be="cluster",Ge=`${ft}-${Be}`,Ye="cluster-alt",Ve=`${ft}-${Ye}`,ne="parent",oe="note",Me="state",Vt="----",We=`${Vt}${oe}`,zt=`${Vt}${ne}`,At=new Map,Z=0,ce=0,ct=new Map,je=t((e,s,c,r)=>{if(e===Yt&&c?.id!==void 0&&ct.has(c.id)){let m=ct.get(c.id);return ct.set(s,m),m}let u=ce++,f=r?void 0:u;return ct.set(s,f),f},"colorSlotFor");function xt(e="",s=0,c="",r=Vt){let u=c!==null&&c.length>0?`${r}${c}`:"";return`${Me}-${e}${u}-${s}`}t(xt,"stateDomId");var Ue=t((e,s,c,r,u,f,m,k)=>{a.trace("items",s),s.forEach((o)=>{switch(o.stmt){case ot:dt(e,o,c,r,u,f,m,k);break;case ut:dt(e,o,c,r,u,f,m,k);break;case Gt:{dt(e,o.state1,c,r,u,f,m,k),dt(e,o.state2,c,r,u,f,m,k);let D=m==="neo",x={id:"edge"+Z,start:o.state1.id,end:o.state2.id,arrowhead:"normal",arrowTypeEnd:D?"arrow_barb_neo":"arrow_barb",style:Zt,labelStyle:"",label:b.sanitizeText(o.description??"",l()),arrowheadStyle:te,labelpos:ee,labelType:re,thickness:ie,classes:ae,look:m};u.push(x),Z++}break}})},"setupDoc"),Kt=t((e,s=qt)=>{let c=s;if(e.doc){for(let r of e.doc)if(r.stmt==="dir")c=r.value}return c},"getDir");function ht(e,s,c){if(!s.id||s.id==="</join></fork>"||s.id==="</choice>")return;if(s.cssClasses){if(!Array.isArray(s.cssCompiledStyles))s.cssCompiledStyles=[];s.cssClasses.split(" ").forEach((u)=>{let f=c.get(u);if(f)s.cssCompiledStyles=[...s.cssCompiledStyles??[],...f.styles]})}let r=e.find((u)=>u.id===s.id);if(r)Object.assign(r,s);else e.push(s)}t(ht,"insertOrUpdateNode");function de(e){return e?.classes?.join(" ")??""}t(de,"getClassesFromDbInfo");function fe(e){return e?.styles??[]}t(fe,"getStylesFromDbInfo");var dt=t((e,s,c,r,u,f,m,k)=>{let o=s.id,D=c.get(o),x=de(D),G=fe(D),Y=l(),j=x.trim()!==""||G.length>0;if(a.info("dataFetcher parsedItem",s,D,G),o!=="root"){let O=$t;if(s.start===!0)O=Ae;else if(s.start===!1)O=xe;if(s.type!==ut)O=s.type;if(!At.get(o))At.set(o,{id:o,shape:O,description:b.sanitizeText(o,Y),cssClasses:`${x} ${Ne}`,cssStyles:G});let y=At.get(o);if(s.description){if(Array.isArray(y.description))y.shape=Pt,y.description.push(s.description);else if(y.description?.length&&y.description.length>0)if(y.shape=Pt,y.description===o)y.description=[s.description];else y.description=[y.description,s.description];else y.shape=$t,y.description=s.description;y.description=b.sanitizeTextOrArray(y.description,Y)}if(y.description?.length===1&&y.shape===Pt)if(y.type==="group")y.shape=Ht;else y.shape=$t;if(!y.type&&s.doc)a.info("Setting cluster for XCX",o,Kt(s)),y.type="group",y.isGroup=!0,y.dir=Kt(s),y.shape=s.type===Qt?Yt:Ht,y.colorIndex=je(y.shape,o,e,j),y.cssClasses=`${y.cssClasses} ${Ge} ${f?Ve:""}`;let V={labelStyle:"",shape:y.shape,label:y.description,cssClasses:y.cssClasses,cssCompiledStyles:[],cssStyles:y.cssStyles,id:o,dir:y.dir,domId:xt(o,Z),type:y.type,isGroup:y.type==="group",colorIndex:y.colorIndex,padding:8,rx:10,ry:10,look:m,labelType:"markdown"};if(V.shape===Yt)V.label="";if(e&&e.id!=="root")a.trace("Setting node ",o," to be child of its parent ",e.id),V.parentId=e.id;if(V.centerLabel=!0,s.note){let F={labelStyle:"",shape:Le,label:s.note.text,labelType:"markdown",cssClasses:Pe,cssStyles:[],cssCompiledStyles:[],id:o+We+"-"+Z,domId:xt(o,Z,oe),type:"node",isGroup:!1,padding:Y.flowchart?.padding,look:m,position:s.note.position},z=o+zt,W={labelStyle:"",shape:we,label:s.note.text,cssClasses:y.cssClasses,cssStyles:[],id:o+zt,domId:xt(o,Z,ne),type:"group",isGroup:!0,padding:16,look:m,position:s.note.position};Z++,W.id=z,F.parentId=z,ht(r,W,k),ht(r,F,k),ht(r,V,k);let K=o,N=F.id;if(s.note.position==="left of")K=F.id,N=o;u.push({id:K+"-"+N,start:K,end:N,arrowhead:"none",arrowTypeEnd:"",style:Zt,labelStyle:"",classes:Fe,pattern:"dashed",arrowheadStyle:te,labelpos:ee,labelType:re,thickness:ie,look:m})}else ht(r,V,k)}if(s.doc)a.trace("Adding nodes children "),Ue(s,s.doc,c,r,u,!f,m,k)},"dataFetcher"),He=t(()=>{At.clear(),Z=0,ce=0,ct.clear()},"reset"),Se=t((e,s=qt)=>{if(!e.doc)return s;let c=s;for(let r of e.doc)if(r.stmt==="dir")c=r.value;return c},"getDir"),ze=t(function(e,s){return s.db.getClasses()},"getClasses"),Ke=t(async function(e,s,c,r){a.info("REF0:"),a.info("Drawing state diagram (v2)",s);let{securityLevel:u,state:f,layout:m}=l();r.db.extract(r.db.getRootDocV2());let k=r.db.getData(),o=he(s,u);if(k.type=r.type,k.layoutAlgorithm=ye(m),k.nodeSpacing=f?.nodeSpacing||50,k.rankSpacing=f?.rankSpacing||50,l().look==="neo")k.markers=["barbNeo"];else k.markers=["barb"];k.diagramId=s,await ge(k,o);let x=8;try{(typeof r.db.getLinks==="function"?r.db.getLinks():new Map).forEach((Y,j)=>{let O=typeof j==="string"?j:typeof j?.id==="string"?j.id:"",y=k.nodes.find((N)=>N.id===O);if(!O){a.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(j));return}let V=o.node()?.querySelectorAll("g.node, g.rough-node"),F;if(V?.forEach((N)=>{let st=N.textContent?.trim();if(N.id===y?.domId||st===O)F=N}),!F){a.warn("⚠️ Could not find node matching text:",O);return}let z=F.parentNode;if(!z){a.warn("⚠️ Node has no parent, cannot wrap:",O);return}let W=document.createElementNS("http://www.w3.org/2000/svg","a"),K=Y.url.replace(/^"+|"+$/g,"");if(W.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),W.setAttribute("target","_blank"),Y.tooltip){let N=Y.tooltip.replace(/^"+|"+$/g,"");W.setAttribute("title",N),F.setAttribute("title",N)}z.replaceChild(W,F),W.appendChild(F),a.info("\uD83D\uDD17 Wrapped node in <a> tag for:",O,Y.url)})}catch(G){a.error("❌ Error injecting clickable links:",G)}M.insertTitle(o,"statediagramTitleText",f?.titleTopMargin??25,r.db.getDiagramTitle()),ue(o,x,ft,f?.useMaxWidth??!0)},"draw"),Xe={getClasses:ze,draw:Ke,getDir:Se},B={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Xt=t(()=>new Map,"newClassesList"),Jt=t(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),Ct=t((e)=>JSON.parse(JSON.stringify(e)),"clone"),Je=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Xt(),this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=E,this.setAccTitle=S,this.getAccDescription=A,this.setAccDescription=T,this.setDiagramTitle=L,this.getDiagramTitle=R,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{t(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let r of Array.isArray(e)?e:e.doc)switch(r.stmt){case ot:this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case Gt:this.addRelation(r.state1,r.state2,r.description);break;case ve:this.addStyleClass(r.id.trim(),r.classes);break;case De:this.handleStyleDef(r);break;case Ce:this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(r.id,r.url,r.tooltip);break}let s=this.getStates(),c=l();He(),dt(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,c.look,this.classes);for(let r of this.nodes){if(!Array.isArray(r.label))continue;if(r.description=r.label.slice(1),r.isGroup&&r.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${r.id}]`);r.label=r.label[0]}}handleStyleDef(e){let s=e.id.trim().split(","),c=e.styleClass.split(",");for(let r of s){let u=this.getState(r);if(!u){let f=r.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=c.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(e){if(a.info("Setting root doc",e),this.rootDoc=e,this.version===1)this.extract(e);else this.extract(this.getRootDocV2())}docTranslator(e,s,c){if(s.stmt===Gt){this.docTranslator(e,s.state1,!0),this.docTranslator(e,s.state2,!1);return}if(s.stmt===ot)if(s.id===B.START_NODE)s.id=e.id+(c?"_start":"_end"),s.start=c;else s.id=s.id.trim();if(s.stmt!==nt&&s.stmt!==ot||!s.doc)return;let r=[],u=[];for(let f of s.doc)if(f.type===Qt){let m=Ct(f);m.doc=Ct(u),r.push(m),u=[]}else u.push(f);if(r.length>0&&u.length>0){let f={stmt:ot,id:Yi(),type:"divider",doc:Ct(u)};r.push(Ct(f)),s.doc=r}s.doc.forEach((f)=>this.docTranslator(s,f,!0))}getRootDocV2(){return this.docTranslator({id:nt,stmt:nt},{id:nt,stmt:nt,doc:this.rootDoc},!0),{id:nt,doc:this.rootDoc}}addState(e,s=ut,c=void 0,r=void 0,u=void 0,f=void 0,m=void 0,k=void 0){let o=e?.trim();if(!this.currentDocument.states.has(o))a.info("Adding state ",o,r),this.currentDocument.states.set(o,{stmt:ot,id:o,descriptions:[],type:s,doc:c,note:u,classes:[],styles:[],textStyles:[]});else{let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);if(!D.doc)D.doc=c;if(!D.type)D.type=s}if(r)a.info("Setting state description",o,r),(Array.isArray(r)?r:[r]).forEach((x)=>this.addDescription(o,x.trim()));if(u){let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);D.note=u,D.note.text=b.sanitizeText(D.note.text,l())}if(f)a.info("Setting state classes",o,f),(Array.isArray(f)?f:[f]).forEach((x)=>this.setCssClass(o,x.trim()));if(m)a.info("Setting state styles",o,m),(Array.isArray(m)?m:[m]).forEach((x)=>this.setStyle(o,x.trim()));if(k)a.info("Setting state styles",o,m),(Array.isArray(k)?k:[k]).forEach((x)=>this.setTextStyle(o,x.trim()))}clear(e){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Xt(),!e)this.links=new Map,C()}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){a.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,s,c){this.links.set(e,{url:s,tooltip:c}),a.warn("Adding link",e,s,c)}getLinks(){return this.links}startIdIfNeeded(e=""){if(e===B.START_NODE)return this.startEndCount++,`${B.START_TYPE}${this.startEndCount}`;return e}startTypeIfNeeded(e="",s=ut){return e===B.START_NODE?B.START_TYPE:s}endIdIfNeeded(e=""){if(e===B.END_NODE)return this.startEndCount++,`${B.END_TYPE}${this.startEndCount}`;return e}endTypeIfNeeded(e="",s=ut){return e===B.END_NODE?B.END_TYPE:s}addRelationObjs(e,s,c=""){let r=this.startIdIfNeeded(e.id.trim()),u=this.startTypeIfNeeded(e.id.trim(),e.type),f=this.startIdIfNeeded(s.id.trim()),m=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(r,u,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(f,m,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:b.sanitizeText(c,l())})}addRelation(e,s,c){if(typeof e==="object"&&typeof s==="object")this.addRelationObjs(e,s,c);else if(typeof e==="string"&&typeof s==="string"){let r=this.startIdIfNeeded(e.trim()),u=this.startTypeIfNeeded(e),f=this.endIdIfNeeded(s.trim()),m=this.endTypeIfNeeded(s);this.addState(r,u),this.addState(f,m),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:c?b.sanitizeText(c,l()):void 0})}}addDescription(e,s){let c=this.currentDocument.states.get(e),r=s.startsWith(":")?s.replace(":","").trim():s;c?.descriptions?.push(b.sanitizeText(r,l()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,s=""){if(!this.classes.has(e))this.classes.set(e,{id:e,styles:[],textStyles:[]});let c=this.classes.get(e);if(s&&c)s.split(B.STYLECLASS_SEP).forEach((r)=>{let u=r.replace(/([^;]*);/,"$1").trim();if(RegExp(B.COLOR_KEYWORD).exec(r)){let m=u.replace(B.FILL_KEYWORD,B.BG_FILL).replace(B.COLOR_KEYWORD,B.FILL_KEYWORD);c.textStyles.push(m)}c.styles.push(u)})}getClasses(){return this.classes}setupToolTips(e){let s=Ft();p(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=p(u.currentTarget),m=f.attr("title");if(m===null)return;let k=u.currentTarget?.getBoundingClientRect();s.transition().duration(200).style("opacity",".9"),s.style("left",window.scrollX+k.left+(k.right-k.left)/2+"px").style("top",window.scrollY+k.bottom+"px"),s.html(Re.sanitize(m)),f.classed("hover",!0)}).on("mouseout",(u)=>{s.transition().duration(500).style("opacity",0),p(u.currentTarget).classed("hover",!1)})}setCssClass(e,s){e.split(",").forEach((c)=>{let r=this.getState(c);if(!r){let u=c.trim();this.addState(u),r=this.getState(u)}r?.classes?.push(s)})}setStyle(e,s){this.getState(e)?.styles?.push(s)}setTextStyle(e,s){this.getState(e)?.textStyles?.push(s)}bindFunctions(e){this.funs.forEach((s)=>{s(e)})}getDirectionStatement(){return this.rootDoc.find((e)=>e.stmt===Ut)}getDirection(){return this.getDirectionStatement()?.value??_e}setDirection(e){let s=this.getDirectionStatement();if(s)s.value=e;else this.rootDoc.unshift({stmt:Ut,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=l();for(let s of this.nodes)if(s.wrappingWidth??=e.state?.wrappingWidth,!s.isGroup)s.minWidth??=e.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:Se(this.getRootDocV2())}}getConfig(){return l().state}},qe=t((e)=>{let{theme:s,bkgColorArray:c,borderColorArray:r}=e;if(!se(s,r))return"";let u=le(e.look),f=pe(c),m="";for(let k=0;k<gt(r);k++){let o=r[k],D=f?`fill: ${c[k%c.length]};`:"",x=`[data-look="${u}"][data-color-id="color-${k}"]`;m+=`
|
|
7
7
|
|
|
8
8
|
/* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
|
|
9
9
|
the body, so what stays visible of \`outer\` is the band behind the label. */
|
|
@@ -62,46 +62,46 @@ Expecting `+Dt.join(", ")+", got '"+(this.terminals_[P]||P)+"'";else Rt="Parse e
|
|
|
62
62
|
${x}.statediagram-cluster .divider path[fill='none'] {
|
|
63
63
|
stroke: ${o};
|
|
64
64
|
}
|
|
65
|
-
`}return m},"genColor"),Qe=
|
|
66
|
-
${qe(
|
|
65
|
+
`}return m},"genColor"),Qe=t((e)=>`
|
|
66
|
+
${qe(e)}
|
|
67
67
|
defs [id$="-barbEnd"] {
|
|
68
|
-
fill: ${
|
|
69
|
-
stroke: ${
|
|
68
|
+
fill: ${e.transitionColor};
|
|
69
|
+
stroke: ${e.transitionColor};
|
|
70
70
|
}
|
|
71
71
|
g.stateGroup text {
|
|
72
|
-
fill: ${
|
|
72
|
+
fill: ${e.nodeBorder};
|
|
73
73
|
stroke: none;
|
|
74
74
|
font-size: 10px;
|
|
75
75
|
}
|
|
76
76
|
g.stateGroup text {
|
|
77
|
-
fill: ${
|
|
77
|
+
fill: ${e.textColor};
|
|
78
78
|
stroke: none;
|
|
79
79
|
font-size: 10px;
|
|
80
80
|
|
|
81
81
|
}
|
|
82
82
|
g.stateGroup .state-title {
|
|
83
83
|
font-weight: bolder;
|
|
84
|
-
fill: ${
|
|
84
|
+
fill: ${e.stateLabelColor};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
g.stateGroup rect {
|
|
88
|
-
fill: ${
|
|
89
|
-
stroke: ${
|
|
88
|
+
fill: ${e.mainBkg};
|
|
89
|
+
stroke: ${e.nodeBorder};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
g.stateGroup line {
|
|
93
|
-
stroke: ${
|
|
94
|
-
stroke-width: ${
|
|
93
|
+
stroke: ${e.lineColor};
|
|
94
|
+
stroke-width: ${e.strokeWidth||1};
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.transition {
|
|
98
|
-
stroke: ${
|
|
99
|
-
stroke-width: ${
|
|
98
|
+
stroke: ${e.transitionColor};
|
|
99
|
+
stroke-width: ${e.strokeWidth||1};
|
|
100
100
|
fill: none;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
.stateGroup .composit {
|
|
104
|
-
fill: ${
|
|
104
|
+
fill: ${e.background};
|
|
105
105
|
border-bottom: 1px
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -111,11 +111,11 @@ g.stateGroup line {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
.state-note {
|
|
114
|
-
stroke: ${
|
|
115
|
-
fill: ${
|
|
114
|
+
stroke: ${e.noteBorderColor};
|
|
115
|
+
fill: ${e.noteBkgColor};
|
|
116
116
|
|
|
117
117
|
text {
|
|
118
|
-
fill: ${
|
|
118
|
+
fill: ${e.noteTextColor};
|
|
119
119
|
stroke: none;
|
|
120
120
|
font-size: 10px;
|
|
121
121
|
}
|
|
@@ -124,82 +124,82 @@ g.stateGroup line {
|
|
|
124
124
|
.stateLabel .box {
|
|
125
125
|
stroke: none;
|
|
126
126
|
stroke-width: 0;
|
|
127
|
-
fill: ${
|
|
127
|
+
fill: ${e.mainBkg};
|
|
128
128
|
opacity: 0.5;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
.edgeLabel .label rect {
|
|
132
|
-
fill: ${
|
|
132
|
+
fill: ${e.labelBackgroundColor};
|
|
133
133
|
opacity: 0.5;
|
|
134
134
|
}
|
|
135
135
|
.edgeLabel {
|
|
136
|
-
background-color: ${
|
|
136
|
+
background-color: ${e.edgeLabelBackground};
|
|
137
137
|
p {
|
|
138
|
-
background-color: ${
|
|
138
|
+
background-color: ${e.edgeLabelBackground};
|
|
139
139
|
}
|
|
140
140
|
rect {
|
|
141
141
|
opacity: 0.5;
|
|
142
|
-
background-color: ${
|
|
143
|
-
fill: ${
|
|
142
|
+
background-color: ${e.edgeLabelBackground};
|
|
143
|
+
fill: ${e.edgeLabelBackground};
|
|
144
144
|
}
|
|
145
145
|
text-align: center;
|
|
146
146
|
}
|
|
147
147
|
.edgeLabel .label text {
|
|
148
|
-
fill: ${
|
|
148
|
+
fill: ${e.transitionLabelColor||e.tertiaryTextColor};
|
|
149
149
|
}
|
|
150
150
|
.label div .edgeLabel {
|
|
151
|
-
color: ${
|
|
151
|
+
color: ${e.transitionLabelColor||e.tertiaryTextColor};
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
.stateLabel text {
|
|
155
|
-
fill: ${
|
|
155
|
+
fill: ${e.stateLabelColor};
|
|
156
156
|
font-size: 10px;
|
|
157
157
|
font-weight: bold;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
.node circle.state-start {
|
|
161
|
-
fill: ${
|
|
162
|
-
stroke: ${
|
|
161
|
+
fill: ${e.specialStateColor};
|
|
162
|
+
stroke: ${e.specialStateColor};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.node .fork-join {
|
|
166
|
-
fill: ${
|
|
167
|
-
stroke: ${
|
|
166
|
+
fill: ${e.specialStateColor};
|
|
167
|
+
stroke: ${e.specialStateColor};
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
.node circle.state-end {
|
|
171
|
-
fill: ${
|
|
172
|
-
stroke: ${
|
|
171
|
+
fill: ${e.innerEndBackground};
|
|
172
|
+
stroke: ${e.background};
|
|
173
173
|
stroke-width: 1.5
|
|
174
174
|
}
|
|
175
175
|
.end-state-inner {
|
|
176
|
-
fill: ${
|
|
177
|
-
// stroke: ${
|
|
176
|
+
fill: ${e.compositeBackground||e.background};
|
|
177
|
+
// stroke: ${e.background};
|
|
178
178
|
stroke-width: 1.5
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
.node rect {
|
|
182
|
-
fill: ${
|
|
183
|
-
stroke: ${
|
|
184
|
-
stroke-width: ${
|
|
182
|
+
fill: ${e.stateBkg||e.mainBkg};
|
|
183
|
+
stroke: ${e.stateBorder||e.nodeBorder};
|
|
184
|
+
stroke-width: ${e.strokeWidth||1}px;
|
|
185
185
|
}
|
|
186
186
|
.node polygon {
|
|
187
|
-
fill: ${
|
|
188
|
-
stroke: ${
|
|
189
|
-
stroke-width: ${
|
|
187
|
+
fill: ${e.mainBkg};
|
|
188
|
+
stroke: ${e.stateBorder||e.nodeBorder};;
|
|
189
|
+
stroke-width: ${e.strokeWidth||1}px;
|
|
190
190
|
}
|
|
191
191
|
[id$="-barbEnd"] {
|
|
192
|
-
fill: ${
|
|
192
|
+
fill: ${e.lineColor};
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
.statediagram-cluster rect {
|
|
196
|
-
fill: ${
|
|
197
|
-
stroke: ${
|
|
198
|
-
stroke-width: ${
|
|
196
|
+
fill: ${e.compositeTitleBackground};
|
|
197
|
+
stroke: ${e.stateBorder||e.nodeBorder};
|
|
198
|
+
stroke-width: ${e.strokeWidth||1}px;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
.cluster-label, .nodeLabel {
|
|
202
|
-
color: ${
|
|
202
|
+
color: ${e.stateLabelColor};
|
|
203
203
|
// line-height: 1;
|
|
204
204
|
}
|
|
205
205
|
|
|
@@ -208,7 +208,7 @@ g.stateGroup line {
|
|
|
208
208
|
ry: 5px;
|
|
209
209
|
}
|
|
210
210
|
.statediagram-state .divider {
|
|
211
|
-
stroke: ${
|
|
211
|
+
stroke: ${e.stateBorder||e.nodeBorder};
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
.statediagram-state .title-state {
|
|
@@ -216,10 +216,10 @@ g.stateGroup line {
|
|
|
216
216
|
ry: 5px;
|
|
217
217
|
}
|
|
218
218
|
.statediagram-cluster.statediagram-cluster .inner {
|
|
219
|
-
fill: ${
|
|
219
|
+
fill: ${e.compositeBackground||e.background};
|
|
220
220
|
}
|
|
221
221
|
.statediagram-cluster.statediagram-cluster-alt .inner {
|
|
222
|
-
fill: ${
|
|
222
|
+
fill: ${e.altBackground?e.altBackground:"#efefef"};
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
.statediagram-cluster .inner {
|
|
@@ -233,7 +233,7 @@ g.stateGroup line {
|
|
|
233
233
|
}
|
|
234
234
|
.statediagram-state rect.divider {
|
|
235
235
|
stroke-dasharray: 10,10;
|
|
236
|
-
fill: ${
|
|
236
|
+
fill: ${e.altBackground?e.altBackground:"#efefef"};
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
.note-edge {
|
|
@@ -241,51 +241,51 @@ g.stateGroup line {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
.statediagram-note rect {
|
|
244
|
-
fill: ${
|
|
245
|
-
stroke: ${
|
|
244
|
+
fill: ${e.noteBkgColor};
|
|
245
|
+
stroke: ${e.noteBorderColor};
|
|
246
246
|
stroke-width: 1px;
|
|
247
247
|
rx: 0;
|
|
248
248
|
ry: 0;
|
|
249
249
|
}
|
|
250
250
|
.statediagram-note rect {
|
|
251
|
-
fill: ${
|
|
252
|
-
stroke: ${
|
|
251
|
+
fill: ${e.noteBkgColor};
|
|
252
|
+
stroke: ${e.noteBorderColor};
|
|
253
253
|
stroke-width: 1px;
|
|
254
254
|
rx: 0;
|
|
255
255
|
ry: 0;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
.statediagram-note text {
|
|
259
|
-
fill: ${
|
|
259
|
+
fill: ${e.noteTextColor};
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
.statediagram-note .nodeLabel {
|
|
263
|
-
color: ${
|
|
263
|
+
color: ${e.noteTextColor};
|
|
264
264
|
}
|
|
265
265
|
.statediagram .edgeLabel {
|
|
266
|
-
color: red; // ${
|
|
266
|
+
color: red; // ${e.noteTextColor};
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
[id$="-dependencyStart"], [id$="-dependencyEnd"] {
|
|
270
|
-
fill: ${
|
|
271
|
-
stroke: ${
|
|
272
|
-
stroke-width: ${
|
|
270
|
+
fill: ${e.lineColor};
|
|
271
|
+
stroke: ${e.lineColor};
|
|
272
|
+
stroke-width: ${e.strokeWidth||1};
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
.statediagramTitleText {
|
|
276
276
|
text-anchor: middle;
|
|
277
277
|
font-size: 18px;
|
|
278
|
-
fill: ${
|
|
278
|
+
fill: ${e.textColor};
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
[data-look="neo"].statediagram-cluster rect {
|
|
282
|
-
fill: ${
|
|
283
|
-
stroke: ${
|
|
284
|
-
stroke-width: ${
|
|
282
|
+
fill: ${e.mainBkg};
|
|
283
|
+
stroke: ${e.useGradient?"url("+e.svgId+"-gradient)":e.stateBorder||e.nodeBorder};
|
|
284
|
+
stroke-width: ${e.strokeWidth??1};
|
|
285
285
|
}
|
|
286
286
|
[data-look="neo"].statediagram-cluster rect.outer {
|
|
287
|
-
rx: ${
|
|
288
|
-
ry: ${
|
|
289
|
-
filter: ${
|
|
287
|
+
rx: ${e.radius}px;
|
|
288
|
+
ry: ${e.radius}px;
|
|
289
|
+
filter: ${e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${e.svgId}-drop-shadow)`):"none"}
|
|
290
290
|
}
|
|
291
|
-
`,"getStyles"),Ze=Qe,ks={parser:Ee,get db(){return new Je(2)},renderer:Xe,styles:Ze,init:
|
|
291
|
+
`,"getStyles"),Ze=Qe,ks={parser:Ee,get db(){return new Je(2)},renderer:Xe,styles:Ze,init:t((e)=>{if(!e.state)e.state={};e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{ks as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g,o,i,r,f,e,n,y,s,ne,bt,at,Vt,ve,ce,Q,xt,lt,te,rn,X}from"./chunk-nvt9tkt4.js";import{Or,$r,Br}from"./chunk-fpb2dd2d.js";var je=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],xe=s("key-round",je);function he(a){let d=[],h="",N,C=!1;for(let u=0;u<a.length;u++){let c=a.charAt(u);if(N)if(c===N)N=void 0;else if(c==="\\"&&N==='"'&&u+1<a.length)h+=a[++u];else h+=c;else if(c==='"'||c==="'")N=c,C=!0;else if(c==="\\"&&u+1<a.length)h+=a[++u],C=!0;else if(/\s/.test(c)){if(C||h)d.push(h);h="",C=!1}else h+=c,C=!0}if(C||h)d.push(h);return d}function me(a){return a.map((d)=>d===""||/[\s"'\\]/.test(d)?`"${d.replace(/(["\\])/g,"\\$1")}"`:d).join(" ")}var be="size-4 cursor-pointer rounded border-line text-accent accent-accent focus-visible:outline-2 focus-visible:outline-accent",$e={connected:{label:"已连接",dot:"bg-success"},idle:{label:"待连接",dot:"bg-faint"},disabled:{label:"已停用",dot:"bg-faint"},failed:{label:"连接失败",dot:"bg-danger"},needs_auth:{label:"需要认证",dot:"bg-warning"}};function ae(a){return a.type==="local"?me(a.command):a.url}function ye({info:a,tools:d=!1}){let h=$e[a.status.status];return n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-dim",children:[e("span",{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full ${h.dot}`}),e("span",{className:d?void 0:"hidden @md/panel:inline",children:h.label}),d&&a.status.status==="connected"&&n("span",{className:"text-faint",children:["· ",a.toolCount," 个工具"]})]})}function Te(a){if(typeof a!=="object"||a===null||!("type"in a))return"any";let d=a.type;if(typeof d==="string")return d;if(Array.isArray(d))return d.filter((h)=>typeof h==="string").join(" | ")||"any";return"any"}function Ne(a){let{Button:d,CopyButton:h,Dialog:N,StatusChip:C,confirm:u,style:c,useTheme:S}=y();S();let{info:l,connection:E}=a,[m,P]=r(),[Z,A]=r(),[D,k]=r(!1),_=l.status.status==="connected",U=l.status.status==="needs_auth",W=l.status.status==="failed",V=l.config.type==="remote"&&Boolean(l.config.oauth);o(()=>{function p(x){if(x&&x!==l.name)return;let R=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"";E.request(`/api/mcp/${encodeURIComponent(l.name)}/connect${R}`,{method:"POST"}).then((K)=>a.onChanged(K)).catch(()=>{})}function t(x){if(x.data?.type==="mcp-oauth-success")p(x.data.name)}function b(x){if(x.key==="basalt-mcp-oauth-event"&&x.newValue)try{let R=JSON.parse(x.newValue);p(R.name)}catch(R){}}window.addEventListener("message",t),window.addEventListener("storage",b);let w;if("BroadcastChannel"in window)w=new BroadcastChannel("basalt-mcp-oauth"),w.onmessage=(x)=>{if(x.data?.type==="mcp-oauth-success")p(x.data.name)};return()=>{window.removeEventListener("message",t),window.removeEventListener("storage",b),w?.close()}},[E,l.name,l.projectID,a]),o(()=>{if(l.status.status!=="connected")return;let p=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"";E.request(`/api/mcp/${encodeURIComponent(l.name)}/tools${p}`).then((t)=>{if(Array.isArray(t))P(t),A(void 0)}).catch((t)=>{A(t instanceof Error?t.message:"获取工具失败")})},[E,l.name,l.projectID,l.status.status]);async function Y(p){k(!0);try{let t=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"",b=await E.request(`/api/mcp/${encodeURIComponent(l.name)}/${p}${t}`,{method:"POST"});a.onChanged(b)}catch{}finally{k(!1)}}async function H(){k(!0);try{let p=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"",t=l.status.status==="needs_auth"?l.status.authorizationUrl:void 0;if(!t)t=(await E.request(`/api/mcp/${encodeURIComponent(l.name)}/oauth/authorize${p}`,{method:"POST"})).authorizationUrl;if(t)window.open(t,"_blank","width=600,height=700")}catch(p){A(p instanceof Error?p.message:"获取授权链接失败")}finally{k(!1)}}async function G(){k(!0);try{let p=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"",t=await E.request(`/api/mcp/${encodeURIComponent(l.name)}/oauth/clear${p}`,{method:"POST"});a.onChanged(t)}finally{k(!1)}}async function j(){if(!await u({title:`删除 ${l.name}?`,description:"删除后将断开连接并不再向会话提供其工具。",action:"删除",danger:!0}))return;k(!0);try{let t=l.projectID?`?projectID=${encodeURIComponent(l.projectID)}`:"";await E.request(`/api/mcp/${encodeURIComponent(l.name)}${t}`,{method:"DELETE"}),a.onChanged(),a.onClose()}finally{k(!1)}}let T=l.config,M=ae(T),L="error"in l.status?l.status.error:void 0,ee=m?.length??l.toolCount??0;return e(N,{open:!0,className:"bg-panel shadow-float",onOpenChange:(p)=>{if(!p&&!D)a.onClose()},title:n("div",{className:"flex flex-wrap items-center gap-3",children:[e("div",{className:"flex size-8 items-center justify-center rounded-[10px] border border-accent/20 bg-accent-soft text-accent",children:T.type==="local"?e(lt,{className:"size-4"}):e(ve,{className:"size-4"})}),e("span",{className:"font-serif text-lg font-semibold tracking-tight text-ink",children:l.name}),_?e(C,{tone:"success",pulse:!0,children:"已连接"}):U?e(C,{tone:"warning",pulse:!0,children:"需要授权"}):W?e(C,{tone:"danger",children:"连接失败"}):l.status.status==="disabled"?e(C,{tone:"neutral",children:"已停用"}):e(C,{tone:"neutral",children:"未连接"})]}),description:n("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-1.5 text-xs",children:[n("span",{className:"flex min-w-0 max-w-full items-center gap-1 rounded-lg border border-line bg-raised/60 py-0.5 pr-1 pl-2.5 font-mono text-[11.5px] text-ink",children:[e("span",{className:"min-w-0 truncate",title:M,children:M}),e(h,{text:M,label:"复制地址",size:"icon-xs",className:"shrink-0 text-dim hover:text-ink"})]}),e("span",{className:"rounded-lg border border-line px-2 py-1 text-[11px] leading-none text-dim",children:T.type==="local"?"本地命令":"远程 HTTP"}),V&&n("span",{className:c("control.badgeAccent","gap-1 rounded-lg border border-accent/25 px-2 py-1"),children:[e(xt,{className:"size-3"}),"OAuth 2.0"]})]}),size:"lg",footer:n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:flex-col",children:[n("div",{className:"flex items-center gap-1 max-sm:w-full",children:[V&&e(d,{type:"button",variant:"ghost",onClick:G,disabled:D,title:"清除已保存的 OAuth 凭据",children:"清除凭据"}),e(d,{type:"button",variant:"danger-ghost",size:"icon-sm","aria-label":"删除服务器",onClick:j,disabled:D,title:"删除服务器",children:e(te,{className:"size-4"})})]}),n("div",{className:"flex items-center gap-2 max-sm:w-full max-sm:justify-end",children:[e(d,{type:"button",variant:"ghost",onClick:a.onEdit,disabled:D,children:"编辑配置"}),!U&&e(d,{type:"button",variant:"secondary",onClick:()=>Y(_?"disconnect":"connect"),disabled:D,children:D?"处理中...":_?"断开连接":"立即连接"}),e(d,{type:"button",variant:"primary",onClick:a.onClose,children:"完成"})]})]}),children:n("div",{className:"space-y-6 pt-1",children:[U&&e("div",{className:"relative overflow-hidden rounded-2xl border border-warning/30 bg-[radial-gradient(120%_140%_at_0%_0%,color-mix(in_oklch,var(--color-warning)_16%,transparent),transparent_65%)] p-5",children:n("div",{className:"flex items-start gap-4 max-sm:flex-col",children:[e("div",{className:"relative flex size-11 shrink-0 items-center justify-center rounded-xl border border-warning/30 bg-panel text-warning shadow-[0_0_28px_-4px_color-mix(in_oklch,var(--color-warning)_55%,transparent)]",children:e(xe,{className:"size-5"})}),n("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e("h4",{className:"text-sm font-semibold text-ink",children:"授权后即可使用此服务器"}),e("p",{className:"text-[13px] leading-relaxed text-dim",children:"该端点要求 OAuth 2.0 身份许可。在浏览器中完成授权后,令牌会自动保存并载入全部工具。"}),L&&e("p",{className:"line-clamp-2 break-words font-mono text-[11.5px] text-faint",title:L,children:L})]}),n(d,{type:"button",variant:"primary",onClick:H,disabled:D,className:"shrink-0",children:[e(Vt,{className:"mr-1.5 size-3.5"}),D?"正在拉起授权...":"前往授权"]})]})}),W&&n("div",{className:c("callout.base",c("callout.danger"),"gap-3 rounded-2xl p-4"),children:[e(bt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),n("div",{className:"min-w-0 space-y-1",children:[e("h4",{className:"text-sm font-medium text-ink",children:"连接失败"}),e("p",{className:"font-mono text-[11.5px] leading-relaxed break-words text-dim",children:L})]})]}),n("section",{className:"space-y-3",children:[n("div",{className:"flex items-baseline justify-between gap-3 px-0.5",children:[n("h4",{className:"flex items-center gap-2 text-[13px] font-medium text-ink",children:["可用工具",e("span",{className:"rounded-full bg-raised px-1.5 py-0.5 font-mono text-[11px] leading-none text-dim",children:ee})]}),e("span",{className:"text-[11.5px] text-faint",children:"对所有会话可用"})]}),Z?e("div",{className:c("callout.base",c("callout.danger"),"text-xs leading-relaxed break-words"),children:Z}):!_?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[e("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:e(rn,{className:"size-4.5"})}),e("p",{className:"text-[13px] font-medium text-dim",children:U?"等待授权":"尚未连接"}),e("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:U?"授权完成后会自动连接并列出工具。":"连接服务器后,这里会列出它提供的全部工具。"})]}):!m?e("div",{role:"status","aria-label":"正在获取工具列表",className:"grid gap-2",children:[0,1,2].map((p)=>n("div",{className:"animate-pulse space-y-2.5 rounded-xl border border-line p-3.5",children:[e("div",{className:"h-3.5 w-32 rounded bg-raised"}),e("div",{className:"h-3 w-4/5 rounded bg-raised/70"})]},p))}):m.length===0?n("div",{className:c("surface.emptyDashed","gap-2 py-10"),children:[e("div",{className:"flex size-10 items-center justify-center rounded-full bg-raised text-faint",children:e(rn,{className:"size-4.5"})}),e("p",{className:"text-[13px] font-medium text-dim",children:"没有可用工具"}),e("p",{className:"max-w-xs text-xs leading-relaxed text-faint",children:"已连接成功,但该服务器没有声明任何工具。"})]}):e("ul",{className:"grid gap-2",children:m.map((p)=>{let t=p.inputSchema?.properties??{},b=p.inputSchema?.required??[],w=Object.entries(t);return n("li",{className:c("surface.subtle","border-line bg-raised/30 p-3.5 transition-colors hover:border-line-strong hover:bg-raised/60"),children:[e("span",{className:"font-mono text-[13px] font-medium break-all text-accent",children:p.name}),p.description&&e("p",{className:"mt-1.5 text-[13px] leading-relaxed break-words text-dim",children:p.description}),w.length>0&&e("div",{className:"mt-3 flex flex-wrap gap-1.5",children:w.map(([x,R])=>n("span",{title:b.includes(x)?"必填参数":"可选参数",className:"inline-flex items-center gap-1 rounded-md border border-line bg-panel px-1.5 py-1 font-mono text-[11px] leading-none",children:[e("span",{className:"text-ink",children:x}),b.includes(x)&&e("span",{className:"text-warning",children:"*"}),e("span",{className:"text-faint",children:Te(R)})]},x))})]},p.name)})})]})]})})}var Pe=/^[A-Za-z0-9_-]{1,64}$/;function F(a){return e("span",{className:"truncate text-xs text-faint",children:a.children})}function Ce(a){let{pairs:d,onChange:h,InputComponent:N}=a,C=(u,c)=>h(d.map((S,l)=>l===u?{...S,...c}:S));return n("div",{className:"space-y-2",children:[n("div",{className:"flex min-h-7 items-center gap-2",children:[e("span",{className:"shrink-0 text-[13px] font-medium text-dim",children:a.label}),e(F,{children:a.tip}),n("button",{type:"button",className:"ml-auto inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-lg px-2 text-xs font-medium text-dim transition-colors hover:bg-raised hover:text-ink",onClick:()=>h([...d,{key:"",value:"",saved:!1}]),children:[e(ce,{className:"size-3.5"}),"添加"]})]}),d.map((u,c)=>n("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(N,{"aria-label":`${a.keyLabel} ${c+1}`,placeholder:a.keyLabel,value:u.key,readOnly:u.saved,onChange:(S)=>C(c,{key:S.target.value}),className:"min-w-0 flex-[2] font-mono text-xs"}),e(N,{"aria-label":`${a.keyLabel} ${u.key||c+1} 的值`,type:"password",autoComplete:"off",placeholder:u.saved?"已保存,留空保持不变":"值",value:u.value,onChange:(S)=>C(c,{value:S.target.value}),className:"min-w-0 flex-[3] font-mono text-xs"}),e("button",{type:"button","aria-label":`删除 ${u.key||"该项"}`,className:"flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-faint transition-colors hover:bg-danger/10 hover:text-danger",onClick:()=>h(d.filter((S,l)=>l!==c)),children:e(X,{className:"size-4"})})]},c))]})}function we(a){return Object.keys(a??{}).map((d)=>({key:d,value:"",saved:!0}))}function ke(a){let{Button:d,Segmented:h,Dialog:N,Form:C,Field:u,Input:c,Switch:S,style:l,useTheme:E}=y();E();let{existing:m}=a,[P,Z]=r(m?.config.type??"local"),[A,D]=r(m?.name??""),[k,_]=r(m?.config.type==="local"?me(m.config.command):""),[U,W]=r(m?.config.type==="remote"?m.config.url:""),[V,Y]=r(we(m?.config.type==="local"?m.config.environment:void 0)),[H,G]=r(we(m?.config.type==="remote"?m.config.headers:void 0)),j=m?.config.type==="remote"?m.config.oauth:void 0,[T,M]=r(Boolean(j)),[L,ee]=r(typeof j==="object"&&j.clientId?j.clientId:""),[p,t]=r(""),[b,w]=r(typeof j==="object"&&j.scope?j.scope:""),[x,R]=r(m?.config.defer??"default"),[K,se]=r(m?.config.timeout!==void 0?String(m.config.timeout):""),[le,Ie]=r(m?.config.defer!==void 0||m?.config.timeout!==void 0),[ue,J]=r(),[de,fe]=r(!1);async function Se(v){v.preventDefault(),J(void 0);let I=A.trim();if(!m&&!Pe.test(I)){J("名称只能包含英文字母、数字、下划线与中划线,长度 1-64");return}if(!m&&a.taken.includes(I)){J("同名服务器已存在");return}let oe=K.trim()?Number.parseInt(K.trim(),10):void 0;if(oe!==void 0&&(!Number.isFinite(oe)||oe<=0)){J("超时时间须为大于 0 的毫秒数");return}let pe;if(P==="local"){let B=he(k.trim());if(!B.length){J("请输入启动命令");return}let q={};for(let O of V){let z=O.key.trim();if(!z)continue;if(!O.saved||O.value)q[z]=O.value}pe={type:"local",command:B,environment:Object.keys(q).length?q:void 0,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:oe}}else{let B=U.trim();try{let z=new URL(B);if(z.protocol!=="http:"&&z.protocol!=="https:")throw Error("bad protocol")}catch{J("请输入合法的 HTTP 或 HTTPS 地址");return}let q={};for(let z of H){let ie=z.key.trim();if(!ie)continue;if(!z.saved||z.value)q[ie]=z.value}let O;if(T){let z=L.trim(),ie=p.trim(),ge=b.trim();if(z||ie||ge)O={clientId:z||void 0,clientSecret:ie||void 0,scope:ge||void 0};else O=!0}else O=!1;pe={type:"remote",url:B,headers:Object.keys(q).length?q:void 0,oauth:O,enabled:m?m.config.enabled:!0,defer:x==="default"?void 0:x,timeout:oe}}fe(!0);try{let B=m?.name??I,q=m?m.projectID:a.projectID,O=q?`?projectID=${encodeURIComponent(q)}`:"";await a.connection.request(`/api/mcp/${encodeURIComponent(B)}${O}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(pe)}),a.onSaved()}catch(B){J(B instanceof Error?B.message:"保存失败")}finally{fe(!1)}}return e(N,{open:!0,onOpenChange:(v)=>{if(!v&&!de)a.onClose()},title:m?`编辑 ${m.name}`:"添加 MCP 服务器",size:"lg",footer:n("div",{className:"flex w-full justify-end gap-2.5",children:[e(d,{type:"button",variant:"ghost",onClick:a.onClose,disabled:de,className:"min-w-20",children:"取消"}),e(d,{type:"submit",form:"mcp-server-form",variant:"primary",disabled:de,className:"min-w-24",children:de?"保存中...":"保存"})]}),children:n(C,{id:"mcp-server-form",onSubmit:Se,children:[e(h,{value:P,onChange:(v)=>Z(v),className:"w-full [&>button]:flex-1",options:[{value:"local",label:"本地(标准输入输出)"},{value:"remote",label:"远程(HTTP / SSE)"}]}),!m&&e(u,{label:"名称",aside:e(F,{children:"唯一标识,如 postgres"}),children:(v)=>e(c,{id:v,value:A,onChange:(I)=>D(I.target.value),placeholder:"postgres",className:"font-mono text-xs"})}),P==="local"?n(f,{children:[e(u,{label:"启动命令",aside:e(F,{children:"完整命令及参数"}),children:(v)=>e(c,{id:v,value:k,onChange:(I)=>_(I.target.value),placeholder:"npx -y @modelcontextprotocol/server-postgres ...",className:"font-mono text-xs"})}),e(Ce,{label:"环境变量",tip:"启动进程时注入",keyLabel:"变量名",pairs:V,onChange:Y,InputComponent:c})]}):n(f,{children:[e(u,{label:"服务地址",aside:e(F,{children:"HTTP / HTTPS 端点"}),children:(v)=>e(c,{id:v,value:U,onChange:(I)=>W(I.target.value),placeholder:"https://example.com/mcp",className:"font-mono text-xs"})}),e(Ce,{label:"请求头",tip:"随每次请求发送",keyLabel:"头字段",pairs:H,onChange:G,InputComponent:c}),n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"min-w-0",children:[e("span",{className:"block text-[13px] font-medium text-dim",children:"OAuth 2.0 认证"}),e("span",{className:"block truncate text-xs text-faint",children:"自动发现授权端点,使用 PKCE 并刷新令牌"})]}),e(S,{checked:T,onCheckedChange:M,label:"启用 OAuth 2.0"})]}),T&&n(f,{children:[e(u,{label:"Client ID",aside:e(F,{children:"留空自动动态注册(DCR)"}),children:(v)=>e(c,{id:v,value:L,onChange:(I)=>ee(I.target.value),placeholder:"留空自动动态注册",className:"font-mono text-xs"})}),e(u,{label:"Client Secret",aside:e(F,{children:"留空保持不变"}),children:(v)=>e(c,{id:v,type:"password",autoComplete:"off",value:p,onChange:(I)=>t(I.target.value),placeholder:"••••••••",className:"font-mono text-xs"})}),e(u,{label:"Scope",aside:e(F,{children:"选填授权范围"}),children:(v)=>e(c,{id:v,value:b,onChange:(I)=>w(I.target.value),placeholder:"repo read:org",className:"font-mono text-xs"})})]})]}),n("div",{className:"space-y-3 border-t border-line/60 pt-3",children:[n("button",{type:"button","aria-expanded":le,className:"flex w-full cursor-pointer items-center gap-1.5 text-[13px] font-medium text-dim transition-colors hover:text-ink",onClick:()=>Ie(!le),children:[e(at,{className:`size-3.5 transition-transform ${le?"rotate-90":""}`}),"高级设置",e("span",{className:"truncate text-xs font-normal text-faint",children:"加载时机、超时"})]}),le&&n("div",{className:"grid grid-cols-2 gap-3 max-sm:grid-cols-1",children:[e(u,{label:"加载时机",aside:e(F,{children:"延迟 = 按需加载"}),children:()=>e(h,{value:x,onChange:(v)=>R(v),className:"w-full [&>button]:flex-1",options:[{value:"default",label:"默认"},{value:"defer",label:"延迟"},{value:"always",label:"常驻"}]})}),e(u,{label:"超时(毫秒)",aside:e(F,{children:"留空用默认"}),children:(v)=>e(c,{id:v,value:K,onChange:(I)=>se(I.target.value),placeholder:"默认",className:"font-mono text-xs"})})]})]}),ue&&n("div",{role:"alert",className:l("callout.base",l("callout.danger"),"px-3 py-2.5 text-xs"),children:[e(ne,{className:"mt-0.5 size-3.5 shrink-0"}),e("span",{className:"min-w-0 break-words",children:ue})]})]})})}var re="global";function nt({connection:a}){let{Button:d,Select:h,style:N,useTheme:C}=y();C();let[u,c]=r(""),[S,l]=r(),[E,m]=r([]),[P,Z]=r(re),[A,D]=r(),[k,_]=r(!1),[U,W]=r(),[V,Y]=r(!1),H=i(!1),[G,j]=r(),T=i(0),M=g(async()=>{let t=++T.current;_(!0);try{let b=P===re?"":`?projectID=${encodeURIComponent(P)}`,[w,x]=await Promise.all([a.request(`/api/mcp${b}`),a.request("/api/projects")]);if(t!==T.current)return;l(w),m(x),D(void 0)}catch(b){if(t===T.current)D(b instanceof Error?b.message:"读取失败")}finally{if(t===T.current)_(!1)}},[a,P]);o(()=>(M(),()=>{T.current++}),[M]);async function L(t,b){if(H.current)return;H.current=!0,Y(!0);let w=T.current;try{let x=t.projectID?`?projectID=${encodeURIComponent(t.projectID)}`:"",R=await a.request(`/api/mcp/${encodeURIComponent(t.name)}${x}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({...t.config,enabled:b})});if(w===T.current)l((K)=>K?.map((se)=>se.name===R.name&&se.projectID===R.projectID?R:se))}finally{H.current=!1,Y(!1)}}let ee=S?.filter((t)=>`${t.name} ${ae(t.config)}`.toLowerCase().includes(u.trim().toLowerCase())),p=S?.find((t)=>t.name===U);return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[e("h2",{className:N("settings.groupTitle"),children:"MCP 服务器"}),e("p",{className:N("settings.groupDesc"),children:"外部工具与数据源管理"})]}),n("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e(h,{value:P,disabled:k,onValueChange:(t)=>{W(void 0),j(void 0),l(void 0),Z(t)},groups:[{options:[{value:re,label:"全局"}]},...Or(E)],className:"w-44"}),e(d,{variant:"ghost",disabled:k,onClick:M,className:"h-9 px-2.5 text-xs",children:e(Q,{className:`size-3.5 ${k?"animate-spin":""}`})}),n(d,{variant:"secondary",onClick:()=>j({}),className:"h-9 px-2.5 text-xs",children:[e(ce,{className:"size-3.5 mr-1"}),"添加服务器"]})]})]}),A&&n("div",{role:"alert",className:N("callout.base",N("callout.danger"),"mb-3 flex-wrap items-center justify-between"),children:[n("p",{className:"min-w-0 flex-1 break-words text-sm text-danger",children:["无法读取 MCP 服务器:",A]}),e(d,{disabled:k,onClick:M,children:"重试"})]}),e($r,{label:"搜索 MCP 服务器",placeholder:"搜索服务器",value:u,onChange:c}),e("div",{className:N("settings.groupBox"),children:!S?e(Br,{}):ee?.length===0?e("p",{className:"p-4 text-sm text-dim",children:"没有匹配的 MCP 服务器"}):e("ul",{className:"divide-y divide-line",children:ee?.map((t)=>{let b=t.config.enabled===!1,w=t.scope==="file";return n("li",{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5 transition-colors hover:bg-raised/40 ${b?"opacity-55":""}`,children:[n("button",{type:"button",className:"group flex min-h-12 min-w-0 flex-1 cursor-pointer items-center gap-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-accent","aria-label":`查看 ${t.name}`,disabled:w,title:w?"来自项目的 .mcp.json,只读":void 0,onClick:()=>W(t.name),children:[e("span",{"aria-hidden":!0,className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-raised text-dim",children:t.config.type==="local"?e(lt,{className:"size-4"}):e(ve,{className:"size-4"})}),n("span",{className:"min-w-0 flex-1",children:[e("span",{className:"block truncate text-sm font-medium text-ink",title:t.name,children:t.name}),e("span",{className:"mt-0.5 block truncate font-mono text-xs text-dim",title:ae(t.config),children:ae(t.config)})]}),e("span",{className:N("control.badge","shrink-0 text-[11px] text-dim"),children:t.scope==="project"?"项目":t.scope==="file"?".mcp.json":"全局"}),e(ye,{info:t})]}),e("span",{className:"relative flex size-10 shrink-0 items-center justify-center",children:!w&&e("input",{type:"checkbox","aria-label":`启用服务器 ${t.name}`,className:be,disabled:V||k,checked:!b,onChange:(x)=>L(t,x.target.checked)})})]},t.name)})})})]}),p&&!G&&e(Ne,{connection:a,info:p,onClose:()=>W(void 0),onEdit:()=>j({info:p}),onChanged:(t)=>t?l((b)=>b?.map((w)=>w.name===t.name?t:w)):M()},`${p.projectID}:${p.name}`),G&&e(ke,{connection:a,projectID:P===re?void 0:P,existing:G.info,taken:(S??[]).filter((t)=>t.scope===(P===re?"global":"project")).map((t)=>t.name),onClose:()=>j(void 0),onSaved:()=>{j(void 0),M()}})]})}export{nt as McpSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y,e,n,y,Q}from"./chunk-nvt9tkt4.js";import{Nn,ta}from"./chunk-dz7g1gnv.js";import"./chunk-2hrswh3d.js";function I({connection:d}){let{Button:p,ModelSelector:c,Select:g,SettingGroup:s,SettingRow:l,cn:u}=y(),m=Y(),i=ta({connection:d,endpoint:"/api/plugins/prompt-optimizer/settings",loadError:"读取优化插件设置失败",toBody:(o)=>({schemaVersion:1,revision:o.revision,primaryModel:o.primaryModel,maxClarificationRounds:o.maxClarificationRounds}),differs:(o,t)=>o.primaryModel?.providerID!==t.primaryModel?.providerID||o.primaryModel?.modelID!==t.primaryModel?.modelID||o.maxClarificationRounds!==t.maxClarificationRounds}),r=i.settings?.primaryModel??null,f=r?`${r.providerID}/${r.modelID}`:"";return n("form",{id:m,onSubmit:i.save,className:"min-w-0 space-y-5",children:[e(s,{title:"模型",children:n(l,{title:"优化模型",description:"未选择时拒绝改写,不会自动回退到其他模型",children:[e("div",{className:"w-56",children:e(c,{variant:"field",models:i.modelList,value:f,onChange:(o)=>{let t=o.indexOf("/"),a=t<0?"":o.slice(0,t),v=t<0?o:o.slice(t+1);i.edit((S)=>({...S,primaryModel:{providerID:a,modelID:v}}))}})}),e(p,{type:"button",size:"icon-sm",variant:"ghost",disabled:i.loading||i.refreshing||i.saving,"aria-label":"刷新模型列表",title:"刷新模型列表",onClick:()=>void i.load(!0),className:"text-dim",children:e(Q,{className:u("size-3.5",i.refreshing&&"animate-spin")})})]})}),e(s,{title:"交互",children:e(l,{title:"澄清提问轮数",description:"草稿有关键歧义时,模型最多可反问几轮",children:e("div",{className:"w-56",children:e(g,{value:String(i.settings?.maxClarificationRounds??1),disabled:i.loading||i.saving,onValueChange:(o)=>{let t=o==="2"?2:1;i.edit((a)=>({...a,maxClarificationRounds:t}))},groups:[{options:[{value:"1",label:"单轮澄清(推荐)",description:"提问一次后直接输出改写结果"},{value:"2",label:"最多两轮澄清",description:"首轮澄清后可针对残留疑问追问一次"}]}]})})})}),e(Nn,{formID:m,notice:i.notice,dirty:i.dirty,busy:i.loading||i.saving,saving:i.saving,onReset:i.reset})]})}export{I as PromptOptimizerSettingsSection};
|