zen-code 4.8.0 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +175 -99
- package/dist/chunk-00jvgph3.js +1 -0
- package/dist/chunk-01tsa9cq.js +1 -0
- package/dist/chunk-04mq56m4.js +1 -0
- package/dist/chunk-07em03a3.js +1 -0
- package/dist/chunk-07fnyy77.js +1 -0
- package/dist/chunk-0b5e8zpy.js +1 -0
- package/dist/chunk-0c25y7k9.js +1 -0
- package/dist/chunk-0dvy62vd.js +1 -0
- package/dist/chunk-0qys39ww.js +1 -0
- package/dist/chunk-0teh8cbt.js +2 -0
- package/dist/chunk-0y6jq0a0.js +1 -0
- package/dist/chunk-10qr9jk1.js +1 -0
- package/dist/chunk-10stn7rc.js +1 -0
- package/dist/chunk-11ctp51v.js +2 -0
- package/dist/chunk-131cad67.js +1 -0
- package/dist/{chunk-bjywwcgn.js → chunk-15zc0x9q.js} +2 -2
- package/dist/chunk-16jx4h98.js +1 -0
- package/dist/chunk-18k4wz02.js +1 -0
- package/dist/chunk-1a34fyjt.js +1 -0
- package/dist/chunk-1ek0xjkr.js +1 -0
- package/dist/chunk-1ja6becj.js +1 -0
- package/dist/{chunk-c9q11tk2.js → chunk-1mrzmr8f.js} +1 -1
- package/dist/chunk-1r67ngsh.js +1 -0
- package/dist/chunk-1w5vehgm.js +1 -0
- package/dist/chunk-1yq51mb3.js +1 -0
- package/dist/chunk-2215g4qb.js +2 -0
- package/dist/chunk-29tmghhd.js +1 -0
- package/dist/chunk-2cj25dc6.js +1 -0
- package/dist/chunk-2evyqqz7.js +2 -0
- package/dist/chunk-2f9mf6mw.js +2 -0
- package/dist/chunk-2kqs0amy.js +1 -0
- package/dist/{chunk-yvhq458c.js → chunk-2kw6zxt8.js} +1 -1
- package/dist/chunk-2mb0trr0.js +1 -0
- package/dist/{chunk-rrkzfahh.js → chunk-2mesyv20.js} +1 -1
- package/dist/chunk-2p664mgv.js +1 -0
- package/dist/chunk-2tg0fzzw.js +2 -0
- package/dist/chunk-2xr9jk3t.js +1 -0
- package/dist/chunk-2xrccbwa.js +1 -0
- package/dist/chunk-2yrz4qdk.js +1 -0
- package/dist/chunk-2zqq58q6.js +2 -0
- package/dist/{chunk-czz2fs2w.js → chunk-30hxw04w.js} +1 -1
- package/dist/{chunk-5fqt5yg1.js → chunk-33j3j89j.js} +1 -1
- package/dist/chunk-33xp86w3.js +1 -0
- package/dist/chunk-35bvsa6m.js +1 -0
- package/dist/chunk-35ncgr15.js +1 -0
- package/dist/chunk-3b63e6mc.js +1 -0
- package/dist/chunk-3f6xf4mm.js +1 -0
- package/dist/chunk-3k4101h5.js +1 -0
- package/dist/chunk-3mjwhvpy.js +1 -0
- package/dist/chunk-3pzth5e2.js +1 -0
- package/dist/chunk-3st09pbw.js +1 -0
- package/dist/{chunk-dh3jz71n.js → chunk-3tfjvh53.js} +1 -1
- package/dist/chunk-3x564va6.js +2 -0
- package/dist/chunk-3xfw5w0d.js +1 -0
- package/dist/chunk-3zf20ctr.js +1 -0
- package/dist/chunk-46ac6010.js +1 -0
- package/dist/chunk-46bmfch2.js +1 -0
- package/dist/chunk-4cg3jh38.js +1 -0
- package/dist/chunk-4g2gfvyd.js +1 -0
- package/dist/chunk-4h4fdqy9.js +1 -0
- package/dist/chunk-4k9xgsq4.js +1 -0
- package/dist/chunk-4mj1r6nd.js +1 -0
- package/dist/chunk-4w4ezegn.js +1 -0
- package/dist/chunk-51rhc5g1.js +1 -0
- package/dist/chunk-54j5njdj.js +1 -0
- package/dist/chunk-54ya969p.js +1 -0
- package/dist/chunk-55pfd4pp.js +1 -0
- package/dist/chunk-583jqck6.js +1 -0
- package/dist/chunk-5c13nrde.js +1 -0
- package/dist/chunk-5eg3bn3m.js +1 -0
- package/dist/chunk-5em7s1at.js +1 -0
- package/dist/chunk-5gjt4v98.js +1 -0
- package/dist/{chunk-0fhpz98a.js → chunk-5gp7nsdp.js} +2 -2
- package/dist/chunk-5hcvm27y.js +1 -0
- package/dist/chunk-5kns073z.js +1 -0
- package/dist/chunk-5pt6e5bh.js +1 -0
- package/dist/chunk-5q1qtbx4.js +1 -0
- package/dist/chunk-5xhjmcrr.js +1 -0
- package/dist/chunk-5yv6fsvn.js +1 -0
- package/dist/chunk-6180vb4q.js +2 -0
- package/dist/chunk-645r8yk7.js +1 -0
- package/dist/chunk-665a7fke.js +1 -0
- package/dist/chunk-667brfhx.js +1 -0
- package/dist/chunk-66s9chr5.js +1 -0
- package/dist/chunk-6dat5vvb.js +1 -0
- package/dist/chunk-6fzgq7sb.js +1 -0
- package/dist/chunk-6jdfap4a.js +1 -0
- package/dist/chunk-6qce4a2z.js +1 -0
- package/dist/chunk-6r8jhnde.js +1 -0
- package/dist/chunk-6tf8wacp.js +1 -0
- package/dist/chunk-6wbgc1xz.js +1 -0
- package/dist/chunk-6yk2jj1m.js +1 -0
- package/dist/chunk-74j5prfv.js +1 -0
- package/dist/chunk-7cenjy4r.js +2 -0
- package/dist/chunk-7jy1478y.js +1 -0
- package/dist/{chunk-j1n8jp1w.js → chunk-7kb8ygdr.js} +2 -2
- package/dist/chunk-7wnxdt11.js +1 -0
- package/dist/chunk-7wqcxfc4.js +1 -0
- package/dist/chunk-84nqfeqh.js +1 -0
- package/dist/chunk-87s313qe.js +1 -0
- package/dist/chunk-87w588zd.js +1 -0
- package/dist/chunk-8fzw4gqz.js +1 -0
- package/dist/chunk-8kk9kv6s.js +1 -0
- package/dist/chunk-8kt765dh.js +1 -0
- package/dist/chunk-8n9e3wbs.js +1 -0
- package/dist/chunk-8p1ebpny.js +1 -0
- package/dist/chunk-8vsqygpz.js +1 -0
- package/dist/chunk-8w10sa5e.js +1 -0
- package/dist/chunk-8ynj83n2.js +1 -0
- package/dist/chunk-92pjraxh.js +2 -0
- package/dist/chunk-95963acy.js +1 -0
- package/dist/chunk-962ms02t.js +1 -0
- package/dist/{chunk-3ep2tag7.js → chunk-98x8wkt6.js} +1 -1
- package/dist/chunk-9a6kwz9e.js +1 -0
- package/dist/chunk-9as23fmk.js +1 -0
- package/dist/chunk-9b45fe34.js +1 -0
- package/dist/chunk-9dhex1sf.js +1 -0
- package/dist/chunk-9dse3mh2.js +1 -0
- package/dist/chunk-9frwhzz8.js +1 -0
- package/dist/chunk-9ft87v6s.js +2 -0
- package/dist/chunk-9h0v5e0k.js +2 -0
- package/dist/chunk-9n2ge60j.js +1 -0
- package/dist/chunk-9nb6v3q0.js +2 -0
- package/dist/chunk-9phx46cq.js +2 -0
- package/dist/chunk-9qtsjepd.js +1 -0
- package/dist/chunk-9rks3bc7.js +1 -0
- package/dist/chunk-9skn642s.js +1 -0
- package/dist/chunk-9xaygaay.js +2 -0
- package/dist/chunk-9xcz69sj.js +1 -0
- package/dist/chunk-9xp471ze.js +1 -0
- package/dist/chunk-9xtq15gy.js +1 -0
- package/dist/chunk-a07p1cfs.js +1 -0
- package/dist/chunk-a0jc9gfw.js +1 -0
- package/dist/chunk-a1s72wx6.js +1 -0
- package/dist/chunk-a22ebaj5.js +1 -0
- package/dist/chunk-a4ah9wgn.js +1 -0
- package/dist/chunk-a5k1t6aj.js +1 -0
- package/dist/chunk-ajxzbnbp.js +1 -0
- package/dist/{chunk-bgpcx3bm.js → chunk-axn0n4dh.js} +2 -2
- package/dist/chunk-b3s0bcp6.js +1 -0
- package/dist/chunk-b6xdt5xb.js +1 -0
- package/dist/chunk-b79d73fy.js +1 -0
- package/dist/chunk-b7h6wk4v.js +1 -0
- package/dist/chunk-b9s35wb6.js +1 -0
- package/dist/chunk-bc95nfbs.js +1 -0
- package/dist/chunk-bcwnznke.js +1 -0
- package/dist/chunk-bh05aqrf.js +2 -0
- package/dist/chunk-bj4851d8.js +1 -0
- package/dist/chunk-bkan2fr3.js +1 -0
- package/dist/chunk-bmb36b05.js +1 -0
- package/dist/chunk-bnma63xz.js +1 -0
- package/dist/chunk-bnrv5f66.js +2 -0
- package/dist/chunk-brcvpmwp.js +1 -0
- package/dist/chunk-bwcdkk1e.js +2 -0
- package/dist/chunk-bwvxp5dp.js +1 -0
- package/dist/chunk-by1h1fy3.js +1 -0
- package/dist/chunk-c04rr3mc.js +1 -0
- package/dist/chunk-c2gqabg2.js +1 -0
- package/dist/{chunk-vkng13p1.js → chunk-cd3rdhh1.js} +3 -3
- package/dist/chunk-cdp5c1vf.js +1 -0
- package/dist/chunk-cfsnygh0.js +1 -0
- package/dist/chunk-cmfrm6a7.js +2 -0
- package/dist/chunk-cypczp4s.js +1 -0
- package/dist/chunk-czkt4sv0.js +1 -0
- package/dist/chunk-d20g16c2.js +1 -0
- package/dist/chunk-d7b0m60j.js +1 -0
- package/dist/chunk-d9hpz80s.js +2 -0
- package/dist/chunk-daahmb61.js +1 -0
- package/dist/{chunk-yaa4eesd.js → chunk-dchaphvw.js} +2 -2
- package/dist/chunk-dee62n5c.js +1 -0
- package/dist/chunk-dj82prdc.js +1 -0
- package/dist/chunk-dn2fe6a4.js +1 -0
- package/dist/chunk-dne3hqde.js +1 -0
- package/dist/chunk-dpa9tgf6.js +2 -0
- package/dist/chunk-dtha8g8n.js +1 -0
- package/dist/chunk-dxg8cctv.js +2 -0
- package/dist/chunk-dxyv2b1c.js +1 -0
- package/dist/chunk-e07gx0kg.js +1 -0
- package/dist/{chunk-wwn7gw8g.js → chunk-e3narvkn.js} +3 -3
- package/dist/chunk-e43hpgc8.js +1 -0
- package/dist/chunk-eceb8jjd.js +1 -0
- package/dist/chunk-en2d49a7.js +1 -0
- package/dist/chunk-en6q3h2k.js +1 -0
- package/dist/chunk-er06b5kx.js +2 -0
- package/dist/chunk-ewgpt1pm.js +1 -0
- package/dist/chunk-exj3mryv.js +1 -0
- package/dist/chunk-f4cn2y4x.js +1 -0
- package/dist/chunk-f6rsbhs6.js +1 -0
- package/dist/chunk-f7rxszbz.js +1 -0
- package/dist/chunk-fdvezfdb.js +1 -0
- package/dist/chunk-fesyrdnx.js +1 -0
- package/dist/chunk-ffyj4q4f.js +1 -0
- package/dist/chunk-fg2zmrdg.js +1 -0
- package/dist/chunk-fj71pv2k.js +1 -0
- package/dist/chunk-fm4a6pgp.js +1 -0
- package/dist/chunk-fsh8c4gw.js +1 -0
- package/dist/chunk-fsqndb8n.js +1 -0
- package/dist/chunk-ft4z3z88.js +2 -0
- package/dist/chunk-ftc3mh9t.js +1 -0
- package/dist/chunk-fwmc6hwy.js +1 -0
- package/dist/chunk-fyay9ztg.js +1 -0
- package/dist/chunk-g0c5mmdz.js +1 -0
- package/dist/{chunk-15smn69q.js → chunk-g0fa5dyc.js} +2 -2
- package/dist/chunk-g1r86637.js +1 -0
- package/dist/chunk-g1z6k96z.js +1 -0
- package/dist/chunk-g3p0vcay.js +2 -0
- package/dist/chunk-gc0daqhj.js +1 -0
- package/dist/chunk-ggwb349q.js +1 -0
- package/dist/chunk-gt6xd3pb.js +1 -0
- package/dist/chunk-gz0bg0j5.js +1 -0
- package/dist/chunk-h1j74efh.js +1 -0
- package/dist/chunk-h77takma.js +1 -0
- package/dist/chunk-hd39y2wf.js +1 -0
- package/dist/chunk-hqhqqe9q.js +1 -0
- package/dist/chunk-hsq3vxna.js +2 -0
- package/dist/chunk-httqsv3p.js +1 -0
- package/dist/{chunk-9k57afdm.js → chunk-j07r3an3.js} +1 -1
- package/dist/chunk-j2vek58t.js +1 -0
- package/dist/chunk-j3c65h0m.js +1 -0
- package/dist/chunk-j4c847h3.js +1 -0
- package/dist/chunk-j7dazkh4.js +1 -0
- package/dist/chunk-j9bkjc22.js +1 -0
- package/dist/chunk-jeavnd8g.js +1 -0
- package/dist/chunk-jk42e7d2.js +1 -0
- package/dist/chunk-jmp4rprf.js +1 -0
- package/dist/chunk-jn4wgzaz.js +1 -0
- package/dist/chunk-jpkm78je.js +1 -0
- package/dist/{chunk-9kc9cea3.js → chunk-jrmcscsp.js} +2 -2
- package/dist/chunk-jv8shhgk.js +1 -0
- package/dist/chunk-jva13pdt.js +1 -0
- package/dist/chunk-jw043xpz.js +1 -0
- package/dist/chunk-jwtpf45z.js +1 -0
- package/dist/chunk-k06v7jh2.js +1 -0
- package/dist/chunk-k45jk0ge.js +1 -0
- package/dist/chunk-kbaz8s34.js +1 -0
- package/dist/chunk-kephawnc.js +1 -0
- package/dist/chunk-khd8ds90.js +1 -0
- package/dist/chunk-kkk1k414.js +1 -0
- package/dist/{chunk-cze71w02.js → chunk-kn8f91na.js} +1 -1
- package/dist/chunk-kny33kyv.js +2 -0
- package/dist/{chunk-j204fejq.js → chunk-ksx0ymk7.js} +1 -1
- package/dist/chunk-kvb035wf.js +2 -0
- package/dist/chunk-kwhma00c.js +1 -0
- package/dist/chunk-ky2zgpqq.js +1 -0
- package/dist/chunk-kz78gsrq.js +1 -0
- package/dist/chunk-kz9rfhe3.js +1 -0
- package/dist/chunk-kzafnaxn.js +1 -0
- package/dist/chunk-m0czpwvf.js +1 -0
- package/dist/chunk-m0k36mwn.js +1 -0
- package/dist/chunk-m5rj1w7e.js +1 -0
- package/dist/chunk-mgkmr3xy.js +1 -0
- package/dist/chunk-mkzpj7ht.js +1 -0
- package/dist/chunk-mnxav3bw.js +1 -0
- package/dist/chunk-mp159559.js +2 -0
- package/dist/chunk-mttnv195.js +1 -0
- package/dist/chunk-mwqg224k.js +1 -0
- package/dist/chunk-mx8stxha.js +1 -0
- package/dist/chunk-mxwqk6ht.js +1 -0
- package/dist/chunk-my5y2p5a.js +1 -0
- package/dist/{chunk-jkbtx9va.js → chunk-myx87v1y.js} +1 -1
- package/dist/chunk-n3e766aj.js +1 -0
- package/dist/chunk-n4s96jdz.js +1 -0
- package/dist/chunk-n9yfs19q.js +1 -0
- package/dist/chunk-na5z94zg.js +2 -0
- package/dist/chunk-nay5m04y.js +1 -0
- package/dist/chunk-nq1k5tw4.js +1 -0
- package/dist/chunk-ntc51kg0.js +1 -0
- package/dist/{chunk-h5nnz4dy.js → chunk-ntcxtgqe.js} +1 -1
- package/dist/chunk-nvynvczn.js +1 -0
- package/dist/chunk-ny0zjscg.js +1 -0
- package/dist/chunk-nzfjhsr7.js +1 -0
- package/dist/chunk-p0ys44e5.js +1 -0
- package/dist/chunk-p1e4d1an.js +1 -0
- package/dist/chunk-p3yymm16.js +1 -0
- package/dist/chunk-p57dfnmm.js +1 -0
- package/dist/chunk-p8pfkf84.js +1 -0
- package/dist/chunk-pdfvchxr.js +1 -0
- package/dist/chunk-pht0yvya.js +1 -0
- package/dist/chunk-pr8jrhq9.js +1 -0
- package/dist/{chunk-q8arjxg1.js → chunk-pz1y3zyg.js} +1 -1
- package/dist/chunk-q2qcexv0.js +1 -0
- package/dist/{chunk-5wn1nfqy.js → chunk-q37swcyw.js} +2 -2
- package/dist/chunk-q9w8vj93.js +2 -0
- package/dist/chunk-q9wkyq6a.js +1 -0
- package/dist/chunk-qcyfn6sh.js +1 -0
- package/dist/chunk-qddn1sea.js +1 -0
- package/dist/chunk-qhs3hh67.js +1 -0
- package/dist/chunk-qrr2ytkg.js +2 -0
- package/dist/{chunk-s3fyfrka.js → chunk-r038t2rw.js} +2 -2
- package/dist/chunk-r53nsqbh.js +1 -0
- package/dist/chunk-rgc9k4rf.js +2 -0
- package/dist/chunk-rnpfchb9.js +1 -0
- package/dist/chunk-s237yqg5.js +1 -0
- package/dist/chunk-s4ksgmax.js +1 -0
- package/dist/chunk-s6qt552a.js +1 -0
- package/dist/chunk-s7qqrnzh.js +1 -0
- package/dist/chunk-satxmrvx.js +1 -0
- package/dist/chunk-sbcw8d8z.js +1 -0
- package/dist/chunk-sch9d3fe.js +1 -0
- package/dist/chunk-sd9rvjt6.js +1 -0
- package/dist/chunk-sdr9ywjt.js +1 -0
- package/dist/chunk-sexnhyqf.js +1 -0
- package/dist/chunk-sjkk13dd.js +1 -0
- package/dist/chunk-skh4rx0s.js +1 -0
- package/dist/chunk-srtwf73c.js +1 -0
- package/dist/chunk-svcy27ht.js +1 -0
- package/dist/chunk-sw4h382q.js +1 -0
- package/dist/chunk-sy7vf5c5.js +1 -0
- package/dist/chunk-sz3tq28n.js +2 -0
- package/dist/chunk-t1pybn6p.js +1 -0
- package/dist/chunk-t3q0fpe0.js +1 -0
- package/dist/chunk-t49vbac9.js +1 -0
- package/dist/chunk-t6bb31dn.js +1 -0
- package/dist/chunk-t7qx43hg.js +1 -0
- package/dist/{chunk-6ty22kkt.js → chunk-t7zrr341.js} +1 -1
- package/dist/chunk-tfqwrnhz.js +1 -0
- package/dist/chunk-tjj6zd94.js +2 -0
- package/dist/chunk-tr01bt0h.js +1 -0
- package/dist/chunk-tv25zrtk.js +1 -0
- package/dist/chunk-txdyy4ya.js +1 -0
- package/dist/chunk-v02wftj8.js +1 -0
- package/dist/chunk-v667b8k4.js +1 -0
- package/dist/chunk-v6faz3vj.js +1 -0
- package/dist/chunk-v6nssgv7.js +1 -0
- package/dist/chunk-vbwkgvhq.js +1 -0
- package/dist/chunk-vcbgawge.js +1 -0
- package/dist/chunk-vd8byz1r.js +2 -0
- package/dist/chunk-vdd1xyrt.js +1 -0
- package/dist/chunk-vfwh7m86.js +1 -0
- package/dist/chunk-vg1dem7m.js +1 -0
- package/dist/chunk-vkfgx6sa.js +2 -0
- package/dist/{chunk-vjj00e3e.js → chunk-vpah11mp.js} +2 -2
- package/dist/chunk-vpbyhd1b.js +1 -0
- package/dist/chunk-vrjcy7h1.js +1 -0
- package/dist/chunk-vs72fgve.js +1 -0
- package/dist/chunk-vsedmhna.js +1 -0
- package/dist/chunk-vtxyeepe.js +2 -0
- package/dist/{chunk-kbs4px1b.js → chunk-vxdkfxtq.js} +1 -1
- package/dist/{chunk-7dp8kq2f.js → chunk-vxggg3ea.js} +2 -2
- package/dist/chunk-vxzy50p0.js +1 -0
- package/dist/chunk-w3y3sdmt.js +1 -0
- package/dist/chunk-w4kh5s54.js +1 -0
- package/dist/{chunk-vc384abg.js → chunk-wbcfbyft.js} +1 -1
- package/dist/chunk-we3jwpsb.js +2 -0
- package/dist/chunk-wgwaq8q1.js +1 -0
- package/dist/chunk-wkvnhk36.js +1 -0
- package/dist/chunk-wp436n3r.js +1 -0
- package/dist/{chunk-3n2b4eb4.js → chunk-wxm0c8ec.js} +2 -2
- package/dist/chunk-wy3eznsy.js +2 -0
- package/dist/chunk-x0gm6db7.js +1 -0
- package/dist/chunk-x0xaw21f.js +1 -0
- package/dist/chunk-x6je1qsq.js +1 -0
- package/dist/chunk-x866vcqf.js +1 -0
- package/dist/{chunk-sft6ep0c.js → chunk-xc8efvab.js} +1 -1
- package/dist/chunk-xcea0hn5.js +2 -0
- package/dist/chunk-xg586hyh.js +1 -0
- package/dist/{chunk-kxk71nn0.js → chunk-xh3gtpfd.js} +1 -1
- package/dist/chunk-xkfzt78k.js +1 -0
- package/dist/chunk-xkvnfywa.js +1 -0
- package/dist/chunk-xqhnnbfr.js +1 -0
- package/dist/chunk-xtrkc4bn.js +1 -0
- package/dist/chunk-xxwnet5y.js +1 -0
- package/dist/chunk-y62ja3na.js +1 -0
- package/dist/chunk-y7qk76sv.js +1 -0
- package/dist/chunk-yd3vzgxs.js +1 -0
- package/dist/chunk-yd6e0k1x.js +1 -0
- package/dist/chunk-yhpg01ds.js +1 -0
- package/dist/chunk-yj3fncjn.js +1 -0
- package/dist/chunk-yk20e377.js +1 -0
- package/dist/chunk-ynjy01zm.js +1 -0
- package/dist/chunk-yynk0bam.js +1 -0
- package/dist/chunk-yyr27vj3.js +1 -0
- package/dist/chunk-yzgwn422.js +1 -0
- package/dist/chunk-z578v7vz.js +1 -0
- package/dist/chunk-zag96nyc.js +2 -0
- package/dist/chunk-zcg0fy8h.js +1 -0
- package/dist/chunk-zed64rf0.js +1 -0
- package/dist/chunk-zf96st2f.js +1 -0
- package/dist/chunk-zgnjqvkp.js +1 -0
- package/dist/chunk-zgyww0w8.js +1 -0
- package/dist/chunk-zj03ksjd.js +1 -0
- package/dist/chunk-zq5ncapf.js +1 -0
- package/dist/chunk-zqg7xzex.js +1 -0
- package/dist/{chunk-n1d8xx5k.js → chunk-zqx4fcfe.js} +1 -1
- package/dist/chunk-zt78xjtr.js +2 -0
- package/dist/chunk-zv0nefnm.js +1 -0
- package/dist/chunk-zv3jegxm.js +1 -0
- package/dist/chunk-zv9ac3c0.js +2 -0
- package/dist/chunk-zwhbdwnt.js +1 -0
- package/dist/chunk-zx19re81.js +2 -0
- package/dist/chunk-zxqs1xns.js +1 -0
- package/dist/cli.js +1 -1
- package/dist/nonInteractive.js +1 -1
- package/dist/zen-keyboard.js +1 -1
- package/package.json +8 -7
- package/dist/chunk-3jek9sxm.js +0 -2
- package/dist/chunk-3znrwnd8.js +0 -1
- package/dist/chunk-4b8yaknt.js +0 -1
- package/dist/chunk-5nzs0q25.js +0 -1
- package/dist/chunk-70a0e941.js +0 -1
- package/dist/chunk-8nhayyat.js +0 -1
- package/dist/chunk-cga0m5sy.js +0 -1
- package/dist/chunk-e0sqjq2h.js +0 -1
- package/dist/chunk-efhkdw2z.js +0 -1
- package/dist/chunk-ew7249h9.js +0 -1
- package/dist/chunk-hww94vjn.js +0 -1
- package/dist/chunk-k67epfhc.js +0 -1
- package/dist/chunk-keqk70wm.js +0 -2
- package/dist/chunk-mg8zpgaz.js +0 -1
- package/dist/chunk-ndtwq2zx.js +0 -2
- package/dist/chunk-pdkbrds7.js +0 -1
- package/dist/chunk-rdc9pxf6.js +0 -1
- package/dist/chunk-wbn1hbxf.js +0 -1
package/dist/app.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import{e as g1,f as KY,g as BZ,i as PZ,j as WY,k as cZ}from"./chunk-ndtwq2zx.js";import{l as zY,m as u,n as d,o as e,p as s0,q as o,r as Y$}from"./chunk-vjj00e3e.js";import"./chunk-s3fyfrka.js";import{A as ZY,B as MZ,C as m1,t as M0,u as B0,v as X2,w as zZ,x as o1,y as $$,z as V2}from"./chunk-5nzs0q25.js";import{D as p0,E as m0}from"./chunk-3jek9sxm.js";import{F as _0,G as SY,H as A0,J as E2,K as y2,L as FZ}from"./chunk-3n2b4eb4.js";import{M as n,N as X$}from"./chunk-keqk70wm.js";import{O as jY,Q as EY,R as t1,T as e1}from"./chunk-9kc9cea3.js";import"./chunk-bgpcx3bm.js";import{aa as dZ,ba as EZ}from"./chunk-kxk71nn0.js";import{ca as T,da as _,ea as K,fa as yY,ga as s1,ia as z0,ja as jZ,ka as qZ,la as M,ma as CZ,oa as K1,qa as e2,ra as n0}from"./chunk-wwn7gw8g.js";import{ya as iY}from"./chunk-j1n8jp1w.js";import{Aa as k0,Ba as lY,Ca as S0,Da as b0,Ea as C0,za as RY}from"./chunk-vkng13p1.js";import"./chunk-bjywwcgn.js";import"./chunk-sft6ep0c.js";import"./chunk-dh3jz71n.js";import"./chunk-yaa4eesd.js";import"./chunk-jkbtx9va.js";import"./chunk-kbs4px1b.js";import"./chunk-9k57afdm.js";import{nb as H,qb as P3,rb as Y1}from"./chunk-cze71w02.js";class W0{renderers=new Map;register(Z,$){this.renderers.set(Z,$)}get(Z){return this.renderers.get(Z)}has(Z){return this.renderers.has(Z)}list(){return Array.from(this.renderers.keys())}unregister(Z){this.renderers.delete(Z)}clear(){this.renderers.clear()}}var eZ;var d1=P3(()=>{eZ=new W0});var gY=H(M(),1),J$=new jY({defaultOptions:{queries:{retry:(Z,$)=>{if($ instanceof TypeError&&$.message.includes("fetch"))return Z<2;return!1},refetchOnWindowFocus:!1,refetchOnMount:!0,refetchOnReconnect:!1,staleTime:300000,gcTime:600000,networkMode:"online"},mutations:{retry:1,networkMode:"online"}}});function VY({children:Z}){return gY.jsxDEV(EY,{client:J$,children:Z},void 0,!1,void 0,this)}var pY={async search(Z){let $=Object.entries(g1).map(([Q,W])=>({assistant_id:Q,graph_id:Q,config:{},metadata:{},version:1,name:Q,description:"",created_at:new Date().toISOString(),updated_at:new Date().toISOString()}));if(Z?.graphId)$=$.filter((Q)=>Q.graph_id===Z.graphId);if(Z?.metadata&&Object.keys(Z.metadata).length>0)$=$.filter((Q)=>{return Object.entries(Z.metadata).every(([W,O])=>{return Q.metadata&&Q.metadata[W]===O})});if(Z?.sortBy)$.sort((Q,W)=>{let O=Q[Z.sortBy],N=W[Z.sortBy],G=O<N?-1:O>N?1:0;return Z.sortOrder==="desc"?-G:G});let Y=Z?.offset??0,X=Z?.limit;return X?$.slice(Y,Y+X):$.slice(Y)},async count(Z){return(await this.search(Z)).length},async get(Z){if(!Object.entries(g1).find(([Y,X])=>Y===Z))throw Error(`Assistant not found: ${Z}`);return{assistant_id:Z,graph_id:Z,config:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),metadata:{},version:1,name:Z,description:""}},async delete(Z){throw Error("Deleting assistants is not supported. Assistants are generated from registered graphs.")},async update(Z,$){throw Error("Updating assistants is not supported. Assistants are generated from registered graphs.")},async getGraph(Z,$){let Y={};return(await(await BZ(Z,Y)).getGraphAsync({...Y,xray:$?.xray??void 0})).toJSON()},async getSchemas(Z){let Y=(await BZ(Z,{})).builder;return console.log(Y),{graph_id:Z,state_schema:Y._inputDefinition,input_schema:Y._inputDefinition,output_schema:Y._outputDefinition,config_schema:Y._configSchema,context_schema:Y._configSchema}},async getVersions(Z,$){let Y=await this.get(Z),X=$?.offset??0,J=$?.limit;return J?[Y].slice(X,X+J):[Y].slice(X)},async setLatest(Z,$){let Y=await this.get(Z);return Y.version=$,Y},async create(Z){if(console.warn("⚠️ Creating assistants is not supported. Assistants are generated from registered graphs. Returning mock data."),!Object.keys(g1).includes(Z.graphId)){if(Z.ifExists==="raise")throw Error(`Graph not found: ${Z.graphId}`)}return{assistant_id:Z.assistantId||Z.graphId,graph_id:Z.graphId,name:Z.name||Z.graphId,description:Z.description||"",metadata:Z.metadata||{},config:Z.config||{},version:1,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}}},QY=()=>{let Z=()=>{return PZ.globalThreadsManager};return{assistants:pY,get threads(){return PZ.globalThreadsManager},runs:{list($,Y){return Z().listRuns($,Y)},async cancel($,Y,X,J){return await PZ.globalMessageQueue.cancelQueue(Y)},async*stream($,Y,X){X.config={...X.config??{},configurable:{...X.config?.configurable??{},graph_id:Y,thread_id:$}};let J=Z();for await(let Q of cZ(J,J.createRun($,Y,X),X,{attempt:0,getGraph:BZ}))yield Q},async*joinStream($,Y,X){let J=X&&typeof X==="object"&&"signal"in X?X:{},Q=(X instanceof AbortSignal?X:J.signal)||new AbortController().signal,W=null,O=null;try{W=await PZ.globalMessageQueue.getQueue(Y);let N=await W.getAll();for(let G of N){if(Q.aborted)return;if(yield{id:G.id,event:G.event,data:G.data},G.event==="__stream_end__"||G.event==="__stream_error__"||G.event==="__stream_cancel__")return}O=W.onDataReceive();for await(let G of O){if(Q.aborted)break;let{event:F,data:U}=G;if(yield{id:G.id,event:F,data:U},G.event==="__stream_end__"||G.event==="__stream_error__"||G.event==="__stream_cancel__")break}}catch(N){if(!(N instanceof Error)||!N.message.includes("does not exist"))console.warn("Join stream failed:",N)}finally{if(O)try{await O.return(void 0)}catch(N){}}}}}};import{entrypoint as NX,getPreviousState as zX,getConfig as UX,Command as FX}from"@langchain/langgraph";import{schemaMetaRegistry as AX}from"@langchain/langgraph/zod";import{z as l}from"zod";var J1=(Z,$)=>Z.constructor.name===$.name,KZ=new Map;KZ.set(l.ZodBoolean.name,()=>!1),KZ.set(l.ZodNumber.name,()=>0),KZ.set(l.ZodString.name,()=>""),KZ.set(l.ZodArray.name,()=>[]),KZ.set(l.ZodRecord.name,()=>({})),KZ.set(l.ZodDefault.name,(Z)=>Z.def.defaultValue),KZ.set(l.ZodPipe.name,(Z)=>k1(Z.def.in)),KZ.set(l.ZodOptional.name,(Z)=>J1(Z.def.innerType,l.ZodDefault)?Z.def.innerType.def.defaultValue:void 0),KZ.set(l.ZodTuple.name,(Z)=>{let $=[];for(let Y of Z.def.items)$.push(k1(Y));return $}),KZ.set(l.ZodPipe.name,(Z)=>k1(Z.def.in)),KZ.set(l.ZodUnion.name,(Z)=>k1(Z.def.options[0])),KZ.set(l.ZodObject.name,(Z)=>Q1(Z)),KZ.set(l.ZodRecord.name,(Z)=>Q1(Z)),KZ.set(l.ZodIntersection.name,(Z)=>Q1(Z));function k1(Z){let $=Z.constructor.name;if(!KZ.has($)){console.warn("getSchemaDefaultForField: Unhandled type",Z.constructor.name);return}return KZ.get($)(Z)}function Q1(Z){if(J1(Z,l.ZodRecord))return{};if(J1(Z,l.ZodPipe))return Q1(Z.def.in);if(J1(Z,l.ZodIntersection))return{...Q1(Z.def.left),...Q1(Z.def.right)};if(J1(Z,l.ZodUnion)){for(let $ of Z.def.options)if(J1($,l.ZodObject))return Q1($);return console.warn("getSchemaDefaultObject: No object found in union, returning empty object"),{}}return J1(Z,l.ZodObject)?Object.fromEntries(Object.entries(Z.shape).map(([$,Y])=>[$,k1(Y)]).filter(($)=>$[1]!==void 0)):(console.warn(`getSchemaDefaultObject: Expected object schema, got ${Z.constructor.name}`),{})}import{tool as MX,HumanMessage as qX}from"langchain";import{z as xZ}from"zod";var PX=xZ.object({task_store:xZ.record(xZ.string(),xZ.any()).default({})}),BX=xZ.object({task_id:xZ.string().optional().describe("The task id to ask the subagent, if not provided, will use the tool call id"),subagent_id:xZ.string(),task_description:xZ.string().describe("Describe the user state and what you want the subagent to do."),data_transfer:xZ.any().optional().describe("Data to transfer to the subagent.")});import z from"zod";var f=QY(),Q$=z.object({thread_id:z.string().optional(),thread_ts:z.string().optional()}).catchall(z.unknown()),w1=z.object({tags:z.array(z.string()).optional(),recursion_limit:z.number().int().optional(),configurable:Q$.optional()}).catchall(z.unknown()).describe("The configuration of an assistant.");z.object({assistant_id:z.string(),graph_id:z.string(),config:w1,created_at:z.string(),updated_at:z.string(),metadata:z.object({}).catchall(z.any())});var hZ=z.object({source:z.union([z.literal("input"),z.literal("loop"),z.literal("update"),z.string()]).optional(),step:z.number().optional(),writes:z.any().nullable().optional(),parents:z.any().optional()}).catchall(z.unknown()),mY=z.object({node:z.string(),input:z.unknown().optional()}),_Y=z.object({update:z.union([z.any(),z.array(z.tuple([z.string(),z.any()]))]).nullable().optional(),resume:z.unknown().optional(),goto:z.union([mY,z.array(mY),z.string(),z.array(z.string())]).optional()});z.object({limit:z.number().int().optional(),offset:z.number().int().optional()});var GZ=z.object({thread_id:z.string()}),T1=z.object({thread_id:z.string(),run_id:z.string()}),K$=z.object({graph_id:z.string().optional(),metadata:hZ.optional(),limit:z.number().int().optional(),offset:z.number().int().optional(),sort_by:z.enum(["assistant_id","graph_id","name","created_at","updated_at"]).optional(),sort_order:z.enum(["asc","desc"]).optional()}),W$=z.object({graph_id:z.string().optional(),metadata:hZ.optional()}),_$=z.object({xray:z.union([z.string(),z.boolean(),z.number()]).optional()}),uY=z.object({name:z.string().optional(),description:z.string().optional(),metadata:hZ.optional(),config:w1.optional()}).optional(),O$=z.object({assistant_id:z.string().optional(),graph_id:z.string().describe("The ID of graph to create an assistant from."),name:z.string().optional(),description:z.string().optional(),metadata:hZ.optional(),config:w1.optional(),if_exists:z.enum(["raise","do_nothing"]).optional()}),G$=z.object({assistant_id:z.union([z.string(),z.string()]),checkpoint_id:z.string().optional(),input:z.any().optional(),command:_Y.optional(),metadata:hZ.optional(),config:w1.optional(),webhook:z.string().optional(),interrupt_before:z.union([z.literal("*"),z.array(z.string())]).optional(),interrupt_after:z.union([z.literal("*"),z.array(z.string())]).optional(),on_disconnect:z.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:z.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:z.array(z.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:z.boolean().optional(),stream_resumable:z.boolean().optional(),after_seconds:z.number().optional(),if_not_exists:z.enum(["create","reject"]).optional(),on_completion:z.enum(["complete","continue"]).optional(),feedback_keys:z.array(z.string()).optional(),langsmith_tracer:z.unknown().optional()}).describe("Payload for creating a stateful run."),N$=z.object({limit:z.coerce.number().int().optional().default(10),offset:z.coerce.number().int().optional().default(0),status:z.enum(["pending","running","error","success","timeout","interrupted"]).optional()}),z$=z.object({wait:z.coerce.boolean().optional().default(!1),action:z.enum(["interrupt","rollback"]).optional().default("interrupt")}),U$=z.object({cancel_on_disconnect:z.coerce.boolean().optional().default(!1),last_event_id:z.string().optional(),stream_mode:z.enum(["values","messages","messages-tuple","updates","events","debug","custom"]).optional()}),F$=z.object({thread_id:z.string().describe("The ID of thread. If not provided, an ID is generated.").optional(),metadata:hZ.optional(),if_exists:z.union([z.literal("raise"),z.literal("do_nothing")]).optional()}).describe("Payload for creating a thread."),cY=z.object({ids:z.array(z.string()).describe("List of thread IDs to include. Others are excluded.").optional(),metadata:hZ.describe("Metadata to search for.").optional(),status:z.enum(["idle","busy","interrupted","error"]).describe("Filter by thread status.").optional(),values:z.any().describe("Filter by thread values.").optional(),limit:z.number().int().gte(1).lte(1000).describe("Maximum number to return.").optional(),offset:z.number().int().gte(0).describe("Offset to start from.").optional(),sort_by:z.enum(["thread_id","status","created_at","updated_at"]).describe("Sort by field.").optional(),sort_order:z.enum(["asc","desc"]).describe("Sort order.").optional(),select:z.array(z.enum(["thread_id","created_at","updated_at","metadata","config","context","status","values","interrupts"])).describe("Specify which fields to return. If not provided, all fields are returned.").optional(),without_details:z.boolean().describe("Whether to return values.").optional()}).describe("Payload for listing threads.");z.object({values:z.union([z.record(z.string(),z.unknown()),z.array(z.record(z.string(),z.unknown()))]).nullish()}).describe("Payload for adding state to a thread.");var H$=z.object({metadata:hZ.optional(),status:z.enum(["idle","busy","interrupted","error"]).optional(),values:z.any().optional()}).describe("Payload for patching a thread."),xY=z.object({assistant_id:z.string(),input:z.any().optional(),command:_Y.optional(),metadata:hZ.optional(),config:w1.optional(),webhook:z.string().optional(),interrupt_before:z.union([z.literal("*"),z.array(z.string())]).optional(),interrupt_after:z.union([z.literal("*"),z.array(z.string())]).optional(),on_disconnect:z.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:z.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:z.array(z.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:z.boolean().optional(),stream_resumable:z.boolean().optional(),after_seconds:z.number().optional(),if_not_exists:z.enum(["create","reject"]).optional(),on_completion:z.enum(["complete","continue"]).optional(),feedback_keys:z.array(z.string()).optional(),langsmith_tracer:z.unknown().optional()}).describe("Payload for creating a run (background/wait)."),A$=z.object({cancel_on_disconnect:z.coerce.boolean().optional().default(!1)}),L$=z.object({cancel_on_disconnect:z.coerce.boolean().optional().default(!1)}),p1=z.object({assistant_id:z.string().describe("The assistant ID or graph name to run."),input:z.any().optional().describe("The input to the graph."),command:_Y.optional(),metadata:hZ.optional().describe("Metadata to assign to the run."),config:w1.optional(),context:z.object({}).catchall(z.any()).optional().describe("Static context added to the assistant."),webhook:z.string().optional(),interrupt_before:z.union([z.literal("*"),z.array(z.string())]).optional(),interrupt_after:z.union([z.literal("*"),z.array(z.string())]).optional(),stream_mode:z.union([z.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]),z.array(z.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]))]).optional().default(["values"]),feedback_keys:z.array(z.string()).optional(),stream_subgraphs:z.boolean().optional().default(!1),stream_resumable:z.boolean().optional().default(!1)}).describe("Payload for creating a stateless run."),w$=z.array(p1).min(1).describe("Payload for creating a batch of stateless runs."),M$=z.object({action:z.enum(["interrupt","rollback"]).optional().default("interrupt").describe("Action to take when cancelling the run."),wait:z.coerce.boolean().optional().default(!1)}),q$=z.union([z.object({status:z.enum(["pending","running","all"]).describe("Filter runs by status to cancel.")}),z.object({thread_id:z.string().describe("The ID of the thread containing runs to cancel.")}),z.object({run_ids:z.array(z.string()).min(1).describe("List of run IDs to cancel.")})]);function i(Z,$){let Y=$.split("/").filter((Q)=>Q),X=new URL(Z).pathname.split("/").filter((Q)=>Q),J={};return Y.forEach((Q,W)=>{if(Q.startsWith(":")){let O=Q.slice(1);J[O]=X[W]}}),J}function bZ(Z){let $=new URL(Z).searchParams,Y={};return $.forEach((X,J)=>{if(!isNaN(Number(X))&&X!=="")Y[J]=Number(X);else if(X==="true"||X==="false")Y[J]=X==="true";else Y[J]=X}),Y}function C(Z,$){let Y=Z.safeParse($);if(!Y.success)throw new OY(Y.error.issues);return Y.data}class OY extends Error{errors;constructor(Z){super("Validation failed");this.name="ValidationError",this.errors=Z}}function h(Z,$=200,Y){return new Response(JSON.stringify(Z),{status:$,headers:{"Content-Type":"application/json",...Y}})}function I(Z,$=500){if(Z instanceof OY)return h({error:"Validation Error",details:Z.errors},400);return h({error:Z instanceof Error?Z.message:"Unknown error"},$)}function GY(Z){let $,Y=!1,X=new AbortController,J=new ReadableStream({async start(Q){$=Q;let W=new TextEncoder,O={signal:X.signal,writeSSE:async({data:N,event:G,id:F})=>{if(Y||X.signal.aborted)return;try{let U="";if(F)U+=`id: ${F}
|
|
2
|
-
`;if(G
|
|
3
|
-
`;
|
|
1
|
+
import{Y as z5,Z as H5}from"./chunk-ft4z3z88.js";import{$ as t,_ as o0,aa as ZZ,ba as FZ,ca as N1,da as KZ,ea as wJ}from"./chunk-vpah11mp.js";import{fa as dX,ga as rX,ha as L1,ia as bZ,ja as a4,ka as BJ,la as YJ,ma as h0,na as gZ,oa as d4}from"./chunk-ny0zjscg.js";import{pa as fX,qa as e8,ra as uX,ta as ZJ,ua as a1,va as oZ}from"./chunk-wxm0c8ec.js";import{wa as WZ,xa as LJ}from"./chunk-kny33kyv.js";import{Ba as KX,Ca as y0,Ea as k0,ya as $X,za as r9}from"./chunk-jrmcscsp.js";import{Ga as m4,Ha as p0,Ia as cZ,Ka as dZ,La as d0,Ma as NY}from"./chunk-cmfrm6a7.js";import"./chunk-r038t2rw.js";import"./chunk-axn0n4dh.js";import{Wa as _Y,Xa as WY}from"./chunk-xh3gtpfd.js";import{$a as JX,Ya as x,Za as N,_a as O,ab as j0,cb as kX,db as KY,eb as uZ,fb as v,gb as rZ,ib as mY,kb as AJ,lb as F1}from"./chunk-e3narvkn.js";import{sb as NX}from"./chunk-7kb8ygdr.js";import{tb as J8,ub as Z5,vb as MX,wb as tX,xb as oX,yb as aX}from"./chunk-cd3rdhh1.js";import"./chunk-15zc0x9q.js";import"./chunk-xc8efvab.js";import"./chunk-3tfjvh53.js";import"./chunk-dchaphvw.js";import"./chunk-myx87v1y.js";import"./chunk-vxdkfxtq.js";import"./chunk-j07r3an3.js";import{hc as L,jc as cK,kc as uQ,lc as q}from"./chunk-kn8f91na.js";class TX{renderers=new Map;register(Z,Y){this.renderers.set(Z,Y)}get(Z){return this.renderers.get(Z)}has(Z){return this.renderers.has(Z)}list(){return Array.from(this.renderers.keys())}unregister(Z){this.renderers.delete(Z)}clear(){this.renderers.clear()}}var bY;var r4=uQ(()=>{bY=new TX});var UX=L(v(),1),PJ=new $X({defaultOptions:{queries:{retry:(Z,Y)=>{if(Y instanceof TypeError&&Y.message.includes("fetch"))return Z<2;return!1},refetchOnWindowFocus:!1,refetchOnMount:!0,refetchOnReconnect:!1,staleTime:300000,gcTime:600000,networkMode:"online"},mutations:{retry:1,networkMode:"online"}}});function WX({children:Z}){return UX.jsxDEV(KX,{client:PJ,children:Z},void 0,!1,void 0,this)}var zX={async search(Z){let Y=Object.entries(m4).map(([$,K])=>({assistant_id:$,graph_id:$,config:{},metadata:{},version:1,name:$,description:"",created_at:new Date().toISOString(),updated_at:new Date().toISOString()}));if(Z?.graphId)Y=Y.filter(($)=>$.graph_id===Z.graphId);if(Z?.metadata&&Object.keys(Z.metadata).length>0)Y=Y.filter(($)=>{return Object.entries(Z.metadata).every(([K,U])=>{return $.metadata&&$.metadata[K]===U})});if(Z?.sortBy)Y.sort(($,K)=>{let U=$[Z.sortBy],W=K[Z.sortBy],z=U<W?-1:U>W?1:0;return Z.sortOrder==="desc"?-z:z});let X=Z?.offset??0,J=Z?.limit;return J?Y.slice(X,X+J):Y.slice(X)},async count(Z){return(await this.search(Z)).length},async get(Z){if(!Object.entries(m4).find(([X,J])=>X===Z))throw Error(`Assistant not found: ${Z}`);return{assistant_id:Z,graph_id:Z,config:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),metadata:{},version:1,name:Z,description:""}},async delete(Z){throw Error("Deleting assistants is not supported. Assistants are generated from registered graphs.")},async update(Z,Y){throw Error("Updating assistants is not supported. Assistants are generated from registered graphs.")},async getGraph(Z,Y){let X={};return(await(await cZ(Z,X)).getGraphAsync({...X,xray:Y?.xray??void 0})).toJSON()},async getSchemas(Z){let X=(await cZ(Z,{})).builder;return console.log(X),{graph_id:Z,state_schema:X._inputDefinition,input_schema:X._inputDefinition,output_schema:X._outputDefinition,config_schema:X._configSchema,context_schema:X._configSchema}},async getVersions(Z,Y){let X=await this.get(Z),J=Y?.offset??0,Q=Y?.limit;return Q?[X].slice(J,J+Q):[X].slice(J)},async setLatest(Z,Y){let X=await this.get(Z);return X.version=Y,X},async create(Z){if(console.warn("⚠️ Creating assistants is not supported. Assistants are generated from registered graphs. Returning mock data."),!Object.keys(m4).includes(Z.graphId)){if(Z.ifExists==="raise")throw Error(`Graph not found: ${Z.graphId}`)}return{assistant_id:Z.assistantId||Z.graphId,graph_id:Z.graphId,name:Z.name||Z.graphId,description:Z.description||"",metadata:Z.metadata||{},config:Z.config||{},version:1,created_at:new Date().toISOString(),updated_at:new Date().toISOString()}}},m0=()=>{let Z=()=>{return dZ.globalThreadsManager};return{assistants:zX,get threads(){return dZ.globalThreadsManager},runs:{list(Y,X){return Z().listRuns(Y,X)},async cancel(Y,X,J,Q){return await dZ.globalMessageQueue.cancelQueue(X)},async*stream(Y,X,J){J.config={...J.config??{},configurable:{...J.config?.configurable??{},graph_id:X,thread_id:Y}};let Q=Z();for await(let $ of NY(Q,Q.createRun(Y,X,J),J,{attempt:0,getGraph:cZ}))yield $},async*joinStream(Y,X,J){let Q=J&&typeof J==="object"&&"signal"in J?J:{},$=(J instanceof AbortSignal?J:Q.signal)||new AbortController().signal,K=null,U=null;try{K=await dZ.globalMessageQueue.getQueue(X);let W=await K.getAll();for(let z of W){if($.aborted)return;if(yield{id:z.id,event:z.event,data:z.data},z.event==="__stream_end__"||z.event==="__stream_error__"||z.event==="__stream_cancel__")return}U=K.onDataReceive();for await(let z of U){if($.aborted)break;let{event:H,data:G}=z;if(yield{id:z.id,event:H,data:G},z.event==="__stream_end__"||z.event==="__stream_error__"||z.event==="__stream_cancel__")break}}catch(W){if(!(W instanceof Error)||!W.message.includes("does not exist"))console.warn("Join stream failed:",W)}finally{if(U)try{await U.return(void 0)}catch(W){}}}}}};import{entrypoint as H2,getPreviousState as G2,getConfig as O2,Command as q2}from"@langchain/langgraph";import{schemaMetaRegistry as M2}from"@langchain/langgraph/zod";import{z as JZ}from"zod";var gY=(Z,Y)=>Z.constructor.name===Y.name,LZ=new Map;LZ.set(JZ.ZodBoolean.name,()=>!1),LZ.set(JZ.ZodNumber.name,()=>0),LZ.set(JZ.ZodString.name,()=>""),LZ.set(JZ.ZodArray.name,()=>[]),LZ.set(JZ.ZodRecord.name,()=>({})),LZ.set(JZ.ZodDefault.name,(Z)=>Z.def.defaultValue),LZ.set(JZ.ZodPipe.name,(Z)=>A4(Z.def.in)),LZ.set(JZ.ZodOptional.name,(Z)=>gY(Z.def.innerType,JZ.ZodDefault)?Z.def.innerType.def.defaultValue:void 0),LZ.set(JZ.ZodTuple.name,(Z)=>{let Y=[];for(let X of Z.def.items)Y.push(A4(X));return Y}),LZ.set(JZ.ZodPipe.name,(Z)=>A4(Z.def.in)),LZ.set(JZ.ZodUnion.name,(Z)=>A4(Z.def.options[0])),LZ.set(JZ.ZodObject.name,(Z)=>uY(Z)),LZ.set(JZ.ZodRecord.name,(Z)=>uY(Z)),LZ.set(JZ.ZodIntersection.name,(Z)=>uY(Z));function A4(Z){let Y=Z.constructor.name;if(!LZ.has(Y)){console.warn("getSchemaDefaultForField: Unhandled type",Z.constructor.name);return}return LZ.get(Y)(Z)}function uY(Z){if(gY(Z,JZ.ZodRecord))return{};if(gY(Z,JZ.ZodPipe))return uY(Z.def.in);if(gY(Z,JZ.ZodIntersection))return{...uY(Z.def.left),...uY(Z.def.right)};if(gY(Z,JZ.ZodUnion)){for(let Y of Z.def.options)if(gY(Y,JZ.ZodObject))return uY(Y);return console.warn("getSchemaDefaultObject: No object found in union, returning empty object"),{}}return gY(Z,JZ.ZodObject)?Object.fromEntries(Object.entries(Z.shape).map(([Y,X])=>[Y,A4(X)]).filter((Y)=>Y[1]!==void 0)):(console.warn(`getSchemaDefaultObject: Expected object schema, got ${Z.constructor.name}`),{})}import{tool as _2,HumanMessage as w2}from"langchain";import{z as AY}from"zod";var L2=AY.object({task_store:AY.record(AY.string(),AY.any()).default({})}),P2=AY.object({task_id:AY.string().optional().describe("The task id to ask the subagent, if not provided, will use the tool call id"),subagent_id:AY.string(),task_description:AY.string().describe("Describe the user state and what you want the subagent to do."),data_transfer:AY.any().optional().describe("Data to transfer to the subagent.")});import _ from"zod";var h=m0(),CJ=_.object({thread_id:_.string().optional(),thread_ts:_.string().optional()}).catchall(_.unknown()),J4=_.object({tags:_.array(_.string()).optional(),recursion_limit:_.number().int().optional(),configurable:CJ.optional()}).catchall(_.unknown()).describe("The configuration of an assistant.");_.object({assistant_id:_.string(),graph_id:_.string(),config:J4,created_at:_.string(),updated_at:_.string(),metadata:_.object({}).catchall(_.any())});var $Y=_.object({source:_.union([_.literal("input"),_.literal("loop"),_.literal("update"),_.string()]).optional(),step:_.number().optional(),writes:_.any().nullable().optional(),parents:_.any().optional()}).catchall(_.unknown()),HX=_.object({node:_.string(),input:_.unknown().optional()}),c0=_.object({update:_.union([_.any(),_.array(_.tuple([_.string(),_.any()]))]).nullable().optional(),resume:_.unknown().optional(),goto:_.union([HX,_.array(HX),_.string(),_.array(_.string())]).optional()});_.object({limit:_.number().int().optional(),offset:_.number().int().optional()});var VZ=_.object({thread_id:_.string()}),_4=_.object({thread_id:_.string(),run_id:_.string()}),RJ=_.object({graph_id:_.string().optional(),metadata:$Y.optional(),limit:_.number().int().optional(),offset:_.number().int().optional(),sort_by:_.enum(["assistant_id","graph_id","name","created_at","updated_at"]).optional(),sort_order:_.enum(["asc","desc"]).optional()}),vJ=_.object({graph_id:_.string().optional(),metadata:$Y.optional()}),IJ=_.object({xray:_.union([_.string(),_.boolean(),_.number()]).optional()}),GX=_.object({name:_.string().optional(),description:_.string().optional(),metadata:$Y.optional(),config:J4.optional()}).optional(),DJ=_.object({assistant_id:_.string().optional(),graph_id:_.string().describe("The ID of graph to create an assistant from."),name:_.string().optional(),description:_.string().optional(),metadata:$Y.optional(),config:J4.optional(),if_exists:_.enum(["raise","do_nothing"]).optional()}),VJ=_.object({assistant_id:_.union([_.string(),_.string()]),checkpoint_id:_.string().optional(),input:_.any().optional(),command:c0.optional(),metadata:$Y.optional(),config:J4.optional(),webhook:_.string().optional(),interrupt_before:_.union([_.literal("*"),_.array(_.string())]).optional(),interrupt_after:_.union([_.literal("*"),_.array(_.string())]).optional(),on_disconnect:_.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:_.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:_.array(_.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:_.boolean().optional(),stream_resumable:_.boolean().optional(),after_seconds:_.number().optional(),if_not_exists:_.enum(["create","reject"]).optional(),on_completion:_.enum(["complete","continue"]).optional(),feedback_keys:_.array(_.string()).optional(),langsmith_tracer:_.unknown().optional()}).describe("Payload for creating a stateful run."),EJ=_.object({limit:_.coerce.number().int().optional().default(10),offset:_.coerce.number().int().optional().default(0),status:_.enum(["pending","running","error","success","timeout","interrupted"]).optional()}),bJ=_.object({wait:_.coerce.boolean().optional().default(!1),action:_.enum(["interrupt","rollback"]).optional().default("interrupt")}),TJ=_.object({cancel_on_disconnect:_.coerce.boolean().optional().default(!1),last_event_id:_.string().optional(),stream_mode:_.enum(["values","messages","messages-tuple","updates","events","debug","custom"]).optional()}),fJ=_.object({thread_id:_.string().describe("The ID of thread. If not provided, an ID is generated.").optional(),metadata:$Y.optional(),if_exists:_.union([_.literal("raise"),_.literal("do_nothing")]).optional()}).describe("Payload for creating a thread."),OX=_.object({ids:_.array(_.string()).describe("List of thread IDs to include. Others are excluded.").optional(),metadata:$Y.describe("Metadata to search for.").optional(),status:_.enum(["idle","busy","interrupted","error"]).describe("Filter by thread status.").optional(),values:_.any().describe("Filter by thread values.").optional(),limit:_.number().int().gte(1).lte(1000).describe("Maximum number to return.").optional(),offset:_.number().int().gte(0).describe("Offset to start from.").optional(),sort_by:_.enum(["thread_id","status","created_at","updated_at"]).describe("Sort by field.").optional(),sort_order:_.enum(["asc","desc"]).describe("Sort order.").optional(),select:_.array(_.enum(["thread_id","created_at","updated_at","metadata","config","context","status","values","interrupts"])).describe("Specify which fields to return. If not provided, all fields are returned.").optional(),without_details:_.boolean().describe("Whether to return values.").optional()}).describe("Payload for listing threads.");_.object({values:_.union([_.record(_.string(),_.unknown()),_.array(_.record(_.string(),_.unknown()))]).nullish()}).describe("Payload for adding state to a thread.");var jJ=_.object({metadata:$Y.optional(),status:_.enum(["idle","busy","interrupted","error"]).optional(),values:_.any().optional()}).describe("Payload for patching a thread."),qX=_.object({assistant_id:_.string(),input:_.any().optional(),command:c0.optional(),metadata:$Y.optional(),config:J4.optional(),webhook:_.string().optional(),interrupt_before:_.union([_.literal("*"),_.array(_.string())]).optional(),interrupt_after:_.union([_.literal("*"),_.array(_.string())]).optional(),on_disconnect:_.enum(["cancel","continue"]).optional().default("continue"),multitask_strategy:_.enum(["reject","rollback","interrupt","enqueue"]).optional(),stream_mode:_.array(_.enum(["values","messages","messages-tuple","updates","events","debug","custom"])).optional(),stream_subgraphs:_.boolean().optional(),stream_resumable:_.boolean().optional(),after_seconds:_.number().optional(),if_not_exists:_.enum(["create","reject"]).optional(),on_completion:_.enum(["complete","continue"]).optional(),feedback_keys:_.array(_.string()).optional(),langsmith_tracer:_.unknown().optional()}).describe("Payload for creating a run (background/wait)."),SJ=_.object({cancel_on_disconnect:_.coerce.boolean().optional().default(!1)}),yJ=_.object({cancel_on_disconnect:_.coerce.boolean().optional().default(!1)}),p4=_.object({assistant_id:_.string().describe("The assistant ID or graph name to run."),input:_.any().optional().describe("The input to the graph."),command:c0.optional(),metadata:$Y.optional().describe("Metadata to assign to the run."),config:J4.optional(),context:_.object({}).catchall(_.any()).optional().describe("Static context added to the assistant."),webhook:_.string().optional(),interrupt_before:_.union([_.literal("*"),_.array(_.string())]).optional(),interrupt_after:_.union([_.literal("*"),_.array(_.string())]).optional(),stream_mode:_.union([_.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]),_.array(_.enum(["values","messages","messages-tuple","tasks","checkpoints","updates","events","debug","custom"]))]).optional().default(["values"]),feedback_keys:_.array(_.string()).optional(),stream_subgraphs:_.boolean().optional().default(!1),stream_resumable:_.boolean().optional().default(!1)}).describe("Payload for creating a stateless run."),kJ=_.array(p4).min(1).describe("Payload for creating a batch of stateless runs."),hJ=_.object({action:_.enum(["interrupt","rollback"]).optional().default("interrupt").describe("Action to take when cancelling the run."),wait:_.coerce.boolean().optional().default(!1)}),xJ=_.union([_.object({status:_.enum(["pending","running","all"]).describe("Filter runs by status to cancel.")}),_.object({thread_id:_.string().describe("The ID of the thread containing runs to cancel.")}),_.object({run_ids:_.array(_.string()).min(1).describe("List of run IDs to cancel.")})]);function $Z(Z,Y){let X=Y.split("/").filter(($)=>$),J=new URL(Z).pathname.split("/").filter(($)=>$),Q={};return X.forEach(($,K)=>{if($.startsWith(":")){let U=$.slice(1);Q[U]=J[K]}}),Q}function lZ(Z){let Y=new URL(Z).searchParams,X={};return Y.forEach((J,Q)=>{if(!isNaN(Number(J))&&J!=="")X[Q]=Number(J);else if(J==="true"||J==="false")X[Q]=J==="true";else X[Q]=J}),X}function S(Z,Y){let X=Z.safeParse(Y);if(!X.success)throw new l0(X.error.issues);return X.data}class l0 extends Error{errors;constructor(Z){super("Validation failed");this.name="ValidationError",this.errors=Z}}function m(Z,Y=200,X){return new Response(JSON.stringify(Z),{status:Y,headers:{"Content-Type":"application/json",...X}})}function k(Z,Y=500){if(Z instanceof l0)return m({error:"Validation Error",details:Z.errors},400);return m({error:Z instanceof Error?Z.message:"Unknown error"},Y)}function i0(Z){let Y,X=!1,J=new AbortController,Q=new ReadableStream({async start($){Y=$;let K=new TextEncoder,U={signal:J.signal,writeSSE:async({data:W,event:z,id:H})=>{if(X||J.signal.aborted)return;try{let G="";if(H)G+=`id: ${H}
|
|
2
|
+
`;if(z)G+=`event: ${z}
|
|
3
|
+
`;G+=`data: ${W}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`,Y.enqueue(K.encode(G))}catch(G){if(!X&&!J.signal.aborted)throw G}},close:()=>{if(!X){X=!0;try{Y.close()}catch(W){}}}};try{await Z(U)}catch(W){if(!J.signal.aborted)console.error("SSE stream error:",W)}finally{if(!X){X=!0;try{Y.close()}catch(W){}}}},cancel(){if(X=!0,!J.signal.aborted)J.abort("Client disconnected")}});return new Response(Q,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}function r0(Z,Y=process.env.HEARTBEAT_INTERVAL?parseInt(process.env.HEARTBEAT_INTERVAL):1500){return async(X)=>{let J=null,Q=!1,$=()=>{if(J)clearInterval(J),J=null},K=()=>{$(),J=setInterval(async()=>{if(X.signal.aborted||Q){$();return}try{await X.writeSSE({event:"ping",data:"{}"})}catch(z){$()}},Y)},U=()=>{$()};X.signal.addEventListener("abort",U);let W={signal:X.signal,writeSSE:async(z)=>{if(X.signal.aborted)return;if($(),await X.writeSSE(z),!X.signal.aborted)K()},close:()=>{$(),X.close()}};K();try{await Z(W)}finally{Q=!0,$(),X.signal.removeEventListener("abort",U)}}}async function gJ(Z,Y){try{let X=await Z.json(),J=S(RJ,X),Q=await h.assistants.search(FZ(J));return m(Q,200,{"X-Pagination-Total":"0"})}catch(X){return k(X)}}async function uJ(Z,Y){try{let X=await Z.json(),J=S(vJ,X),Q=await h.assistants.count(FZ(J));return m(Q)}catch(X){return k(X)}}async function mJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((K)=>K)[1],$=await h.assistants.get(Q);return m($)}catch(X){return k(X)}}async function pJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter(($)=>$)[1];return await h.assistants.delete(Q),m({})}catch(X){return k(X)}}async function dJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=await Z.json(),K=S(GX,$),U=await h.assistants.update(Q,FZ(K));return m(U)}catch(X){return k(X)}}async function cJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=lZ(Z.url),{xray:K}=S(IJ,$),U=await h.assistants.getGraph(Q,{xray:K!==void 0?K==="true":void 0});return m(U)}catch(X){return k(X)}}async function lJ(Z,Y){return k({},501)}async function iJ(Z,Y){return k({},501)}async function rJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((K)=>K)[1],$=await h.assistants.getSchemas(Q);return m($)}catch(X){return k(X)}}async function oJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=await Z.json(),K=S(GX,$),U=await h.assistants.getVersions(Q,FZ(K));return m(U)}catch(X){return k(X)}}async function nJ(Z,Y){try{let Q=new URL(Z.url).pathname.split("/").filter((W)=>W)[1],$=lZ(Z.url),K=$.version?parseInt($.version):1,U=await h.assistants.setLatest(Q,K);return m(U)}catch(X){return k(X)}}async function aJ(Z,Y){try{let X=await Z.json(),J=S(DJ,X),Q=await h.assistants.create(FZ(J));return m(Q)}catch(X){return k(X)}}async function sJ(Z,Y){try{let X=await Z.json(),J=S(fJ,X),Q=await h.threads.create(FZ(J));return m(Q)}catch(X){return k(X)}}async function tJ(Z,Y){try{let X=await Z.json(),J=S(OX,X),Q=await h.threads.search(FZ(J));return m(Q,200,{"X-Pagination-Total":Q.length.toString()})}catch(X){return k(X)}}async function eJ(Z,Y){try{let X=await Z.json(),J=S(OX.partial(),X),Q=await h.threads.count(FZ(J));return m(Q)}catch(X){return k(X)}}async function ZQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id"),{thread_id:J}=S(VZ,X),Q=await h.threads.get(J);return m(Q)}catch(X){return k(X)}}async function YQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$=S(jJ,Q),K=await h.threads.patch(J,FZ($));return m(K)}catch(X){return k(X)}}async function XQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id"),{thread_id:J}=S(VZ,X);return await h.threads.delete(J),new Response(null,{status:204})}catch(X){return k(X)}}async function JQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/state"),{thread_id:J}=S(VZ,X),Q=lZ(Z.url),$={subgraphs:Q.subgraphs==="true"||Q.subgraphs===!0},K=await h.threads.getState(J,$);return m(K)}catch(X){return k(X)}}async function QQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/state"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$=await h.threads.updateState(J,FZ(Q));return m($)}catch(X){return k(X)}}async function $Q(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/state/checkpoint"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$=lZ(Z.url),K={subgraphs:$.subgraphs==="true"||$.subgraphs===!0,...Q},U=await h.threads.getState(J,K);return m(U)}catch(X){return k(X)}}async function KQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/history"),{thread_id:J}=S(VZ,X),Q=lZ(Z.url),$={limit:Q.limit?parseInt(Q.limit,10):void 0,before:Q.before},K=await h.threads.getStateHistory(J,$);return m(K)}catch(X){return k(X)}}async function WQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/history"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$={limit:Q.limit,before:Q.before},K=await h.threads.getStateHistory(J,$);return m(K)}catch(X){return k(X)}}async function UQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/copy"),{thread_id:J}=S(VZ,X),Q=await h.threads.copy(J);return m(Q)}catch(X){return k(X)}}async function zQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/stream"),{thread_id:J}=S(VZ,X),Q=lZ(Z.url),$={lastEventId:Z.headers.get("Last-Event-ID")||Q.last_event_id,streamModes:Q.stream_modes?Array.isArray(Q.stream_modes)?Q.stream_modes:[Q.stream_modes]:void 0};return new Response(`data: {"status": "stream_ready"}
|
|
6
6
|
|
|
7
|
-
`,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(Y){return I(Y)}}async function i$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/stream"),{thread_id:X}=C(GZ,Y),J=await Z.json(),Q=C(G$,J);return GY(NY(async(W)=>{Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let O=$?.langgraph_context;if(O)Object.assign(Q.config.configurable,O);let N=null,G=!1,F=()=>{G=!0};W.signal.addEventListener("abort",F);try{N=f.runs.stream(X,Q.assistant_id,e(Q));for await(let{event:U,data:L}of N){if(G||W.signal.aborted)break;await W.writeSSE({data:WY(L)??"",event:U})}}catch(U){if(!W.signal.aborted&&!G)throw U}finally{if(W.signal.removeEventListener("abort",F),N){try{await N.return(void 0)}catch(U){}N=null}}}))}catch(Y){return I(Y)}}async function o$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/:run_id/stream"),{thread_id:X,run_id:J}=C(T1,Y),Q=bZ(Z.url),{cancel_on_disconnect:W,last_event_id:O,stream_mode:N}=C(U$,Q);return GY(NY(async(G)=>{let F=new AbortController,U=null,L=!1,A=[],w=()=>{F.abort("Client disconnected")};if(Z.signal)Z.signal.addEventListener("abort",w),A.push({signal:Z.signal,handler:w});let q=()=>{L=!0,F.abort("SSE stream closed")};G.signal.addEventListener("abort",q),A.push({signal:G.signal,handler:q});try{U=f.runs.joinStream(X,J,{signal:F.signal,cancelOnDisconnect:W,lastEventId:O,streamMode:N?[N]:void 0});for await(let{event:R,data:b,id:D}of U){if(L||G.signal.aborted||F.signal.aborted)break;await G.writeSSE({data:WY(b)??"",event:R,id:D})}}catch(R){if(!(F.signal.aborted||G.signal.aborted)&&!(R instanceof Error&&R.message.includes("user cancel")))console.error("Join stream error:",R),await G.writeSSE({event:"error",data:JSON.stringify({error:R instanceof Error?R.message:"Unknown error"})})}finally{for(let{signal:R,handler:b}of A)try{R.removeEventListener("abort",b)}catch(D){}if(U){try{await U.return(void 0)}catch(R){}U=null}}}))}catch(Y){return I(Y)}}async function n$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs"),{thread_id:X}=C(GZ,Y),J=bZ(Z.url),{limit:Q,offset:W,status:O}=C(N$,J),N=await f.runs.list(X,{limit:Q,offset:W,status:O});return h(N)}catch(Y){return I(Y)}}async function r$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/:run_id/cancel"),{thread_id:X,run_id:J}=C(T1,Y),Q=bZ(Z.url),{wait:W,action:O}=C(z$,Q),N=f.runs.cancel(X,J,W,O);if(W)await N;return new Response(null,{status:W?204:202})}catch(Y){return I(Y)}}async function s$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs"),{thread_id:X}=C(GZ,Y),J=await Z.json(),Q=C(xY,J),W=e(Q);W.config=W.config||{},W.config.configurable=W.config.configurable||{};let O=$?.langgraph_context;if(O)Object.assign(W.config.configurable,O);W.config.configurable.graph_id=Q.assistant_id,W.config.configurable.thread_id=X;let N=f.threads,G=await N.createRun(X,Q.assistant_id,W);return(async()=>{let F=!1;try{for await(let U of cZ(N,G,W,{attempt:0,getGraph:BZ}));}catch(U){console.error("Background run error:",U)}finally{if(!F){F=!0;try{await PZ.globalMessageQueue.removeQueue(G.run_id)}catch(U){}}}})(),h(G,200,{"Content-Location":`/threads/${X}/runs/${G.run_id}`})}catch(Y){return I(Y)}}async function a$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/wait"),{thread_id:X}=C(GZ,Y),J=await Z.json(),Q=C(xY,J),W=bZ(Z.url),{cancel_on_disconnect:O}=C(A$,W),N=e(Q);N.config=N.config||{},N.config.configurable=N.config.configurable||{};let G=$?.langgraph_context;if(G)Object.assign(N.config.configurable,G);N.config.configurable.graph_id=Q.assistant_id,N.config.configurable.thread_id=X;let F=f.threads,U=await F.createRun(X,Q.assistant_id,N),L={};for await(let{event:A,data:w}of cZ(F,U,N,{attempt:0,getGraph:BZ}))if(A==="end"||A==="writes/value"){if(w&&typeof w==="object")Object.assign(L,w)}return h(L,200,{"Content-Location":`/threads/${X}/runs/${U.run_id}`})}catch(Y){return I(Y)}}async function t$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/:run_id"),{thread_id:X,run_id:J}=C(T1,Y),W=(await f.runs.list(X,{limit:1000})).find((O)=>O.run_id===J);if(!W)return I(Error("Run not found"),404);return h(W)}catch(Y){return I(Y)}}async function e$(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/:run_id"),{thread_id:X,run_id:J}=C(T1,Y);return await f.threads.updateRun(J,{status:"deleted"}),new Response(null,{status:204})}catch(Y){return I(Y)}}async function Z3(Z,$){try{let Y=i(Z.url,"/threads/:thread_id/runs/:run_id/join"),{thread_id:X,run_id:J}=C(T1,Y),Q=bZ(Z.url),{cancel_on_disconnect:W}=C(L$,Q),N=(await f.runs.list(X,{limit:1000})).find((U)=>U.run_id===J);if(!N)return I(Error("Run not found"),404);if(N.status==="success"||N.status==="error")return h({});let G=new AbortController;if(W){let U=()=>{G.abort("Client disconnected")};Z.signal?.addEventListener("abort",U)}let F={};for await(let{event:U,data:L}of f.runs.joinStream(X,J,{signal:G.signal,cancelOnDisconnect:W}))if(U.event==="end"||U.event==="writes/value"){if(L&&typeof L==="object")Object.assign(F,L)}return h(F)}catch(Y){return I(Y)}}async function Y3(Z,$){try{let Y=await Z.json(),X=C(p1,Y),J=e(X);J.config=J.config||{},J.config.configurable=J.config.configurable||{};let Q=$?.langgraph_context;if(Q)Object.assign(J.config.configurable,Q);let W=f.threads,O=await W.create({metadata:{...J.metadata,temporary:!0}});J.config.configurable.graph_id=X.assistant_id,J.config.configurable.thread_id=O.thread_id,J.temporary=!0;let N=await W.createRun(O.thread_id,X.assistant_id,J);return(async()=>{let G=!1;try{for await(let F of cZ(W,N,J,{attempt:0,getGraph:BZ}));}catch(F){console.error("Stateless run error:",F)}finally{try{await W.delete(O.thread_id)}catch(F){console.error("Error cleaning up temporary thread:",F)}if(!G){G=!0;try{await PZ.globalMessageQueue.removeQueue(N.run_id)}catch(F){}}}})(),h(N,200,{"Content-Location":`/threads/${O.thread_id}/runs/${N.run_id}`})}catch(Y){return I(Y)}}async function $3(Z,$){try{let Y=await Z.json(),X=C(p1,Y),J=e(X);J.config=J.config||{},J.config.configurable=J.config.configurable||{};let Q=$?.langgraph_context;if(Q)Object.assign(J.config.configurable,Q);let W=f.threads,O=await W.create({metadata:{...J.metadata,temporary:!0}});J.config.configurable.graph_id=X.assistant_id,J.config.configurable.thread_id=O.thread_id,J.temporary=!0;let N=await W.createRun(O.thread_id,X.assistant_id,J);return GY(NY(async(G)=>{try{for await(let F of cZ(W,N,J,{attempt:0,getGraph:BZ}))await G.writeSSE({data:JSON.stringify(F),event:"data"})}catch(F){if(F instanceof Error&&F.name!=="AbortError")throw console.error("Stream error:",F),F}finally{try{await W.delete(O.thread_id)}catch(F){console.error("Error cleaning up temporary thread:",F)}}}))}catch(Y){return I(Y)}}async function X3(Z,$){try{let Y=await Z.json(),X=C(p1,Y),J=e(X);J.config=J.config||{},J.config.configurable=J.config.configurable||{};let Q=$?.langgraph_context;if(Q)Object.assign(J.config.configurable,Q);let W=f.threads,O=await W.create({metadata:{...J.metadata,temporary:!0}});J.config.configurable.graph_id=X.assistant_id,J.config.configurable.thread_id=O.thread_id,J.temporary=!0;let N=await W.createRun(O.thread_id,X.assistant_id,J),G={};try{for await(let{event:F,data:U}of cZ(W,N,J,{attempt:0,getGraph:BZ}))if(F==="end"||F==="writes/value"){if(U&&typeof U==="object")Object.assign(G,U)}}finally{try{await W.delete(O.thread_id)}catch(F){console.error("Error cleaning up temporary thread:",F)}}return h(G,200,{"Content-Location":`/threads/${O.thread_id}/runs/${N.run_id}`})}catch(Y){return I(Y)}}async function J3(Z,$){try{let Y=await Z.json(),X=C(w$,Y),J=f.threads,Q=[],W=X.map(async(N)=>{try{let G=e(N);G.config=G.config||{},G.config.configurable=G.config.configurable||{};let F=$?.langgraph_context;if(F)Object.assign(G.config.configurable,F);let U=await J.create({metadata:{...G.metadata,temporary:!0}});G.config.configurable.graph_id=N.assistant_id,G.config.configurable.thread_id=U.thread_id,G.temporary=!0;let L=await J.createRun(U.thread_id,N.assistant_id,G);return(async()=>{let A=!1;try{for await(let w of cZ(J,L,G,{attempt:0,getGraph:BZ}));}catch(w){console.error("Batch run error:",w)}finally{try{await J.delete(U.thread_id)}catch(w){console.error("Error cleaning up temporary thread:",w)}if(!A){A=!0;try{await PZ.globalMessageQueue.removeQueue(L.run_id)}catch(w){}}}})(),{thread_id:U.thread_id,run_id:L.run_id}}catch(G){return console.error("Batch run creation error:",G),{error:(G instanceof Error?G.message:"Unknown error")||"Unknown error"}}}),O=await Promise.all(W);return Q.push(...O),h(Q,200)}catch(Y){return I(Y)}}async function Q3(Z,$){try{let Y=await Z.json(),X=C(q$,Y),J=new URL(Z.url),Q=C(M$,{action:J.searchParams.get("action")||"interrupt"}),W=f.threads,O=[];if("run_ids"in X&&X.run_ids)for(let N of X.run_ids)try{console.warn(`Cancel by run_id ${N} not fully implemented yet`)}catch(G){console.error(`Error cancelling run ${N}:`,G)}else if("thread_id"in X&&X.thread_id){let N=X.thread_id;try{let G=await W.listRuns(N,{limit:1000,offset:0});for(let F of G)try{f.runs.cancel(N,F.run_id,Q.wait,Q.action),O.push(F.run_id)}catch(U){console.error(`Error cancelling run ${F.run_id}:`,U)}}catch(G){console.error(`Error listing runs for thread ${N}:`,G)}}else if("status"in X&&X.status)console.warn(`Cancel by status ${X.status} not fully implemented yet`);return new Response(null,{status:204})}catch(Y){return I(Y)}}var K3=[{method:"POST",pattern:/^\/assistants\/search$/,handler:R$},{method:"POST",pattern:/^\/assistants\/count$/,handler:P$},{method:"GET",pattern:/^\/assistants\/[^/]+$/,handler:B$},{method:"DELETE",pattern:/^\/assistants\/[^/]+$/,handler:b$},{method:"PATCH",pattern:/^\/assistants\/[^/]+$/,handler:v$},{method:"GET",pattern:/^\/assistants\/[^/]+\/graph$/,handler:C$},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs$/,handler:I$},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs\/[^/]+$/,handler:S$},{method:"GET",pattern:/^\/assistants\/[^/]+\/schemas$/,handler:f$},{method:"POST",pattern:/^\/assistants\/[^/]+\/versions$/,handler:k$},{method:"POST",pattern:/^\/assistants\/[^/]+\/latest$/,handler:T$},{method:"POST",pattern:/^\/assistants$/,handler:y$},{method:"POST",pattern:/^\/threads$/,handler:D$},{method:"POST",pattern:/^\/threads\/search$/,handler:h$},{method:"POST",pattern:/^\/threads\/count$/,handler:j$},{method:"GET",pattern:/^\/threads\/[^/]+$/,handler:E$},{method:"PATCH",pattern:/^\/threads\/[^/]+$/,handler:V$},{method:"DELETE",pattern:/^\/threads\/[^/]+$/,handler:g$},{method:"GET",pattern:/^\/threads\/[^/]+\/state$/,handler:p$},{method:"POST",pattern:/^\/threads\/[^/]+\/state$/,handler:m$},{method:"POST",pattern:/^\/threads\/[^/]+\/state\/checkpoint$/,handler:u$},{method:"GET",pattern:/^\/threads\/[^/]+\/history$/,handler:c$},{method:"POST",pattern:/^\/threads\/[^/]+\/history$/,handler:x$},{method:"POST",pattern:/^\/threads\/[^/]+\/copy$/,handler:d$},{method:"GET",pattern:/^\/threads\/[^/]+\/stream$/,handler:l$},{method:"POST",pattern:/^\/threads\/[^/]+\/runs$/,handler:s$},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/stream$/,handler:i$},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/wait$/,handler:a$},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/cancel$/,handler:r$},{method:"GET",pattern:/^\/threads\/[^/]+\/runs$/,handler:n$},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:t$},{method:"DELETE",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:e$},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/join$/,handler:Z3},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/stream$/,handler:o$},{method:"POST",pattern:/^\/runs$/,handler:Y3},{method:"POST",pattern:/^\/runs\/stream$/,handler:$3},{method:"POST",pattern:/^\/runs\/wait$/,handler:X3},{method:"POST",pattern:/^\/runs\/batch$/,handler:J3},{method:"POST",pattern:/^\/runs\/cancel$/,handler:Q3}],W3=(Z)=>{let $=new URL(Z.url).pathname.toString(),Y="";if($.includes("/threads"))Y=$.split("/threads")[0];else if($.includes("/assistants"))Y=$.split("/assistants")[0];return new Request(Z.url.replace(Y,""),{method:Z.method,headers:Z.headers,body:Z.body,duplex:Z.duplex})};async function dY(Z,$={}){Z=W3(Z);try{await PZ.initGlobal();let X=new URL(Z.url).pathname,J=Z.method;for(let Q of K3)if(Q.method===J&&Q.pattern.test(X))return await Q.handler(Z,$);return new Response("Not Found",{status:404})}catch(Y){return console.error("Request error:",Y),I(Y)}}await lY();KY("code",iY);var oY=(Z,$={})=>{return dY(new Request(Z,$),{})};import _3 from"openai";import O3 from"@anthropic-ai/sdk";import{GoogleGenerativeAI as G3}from"@google/generative-ai";var N3=async()=>{if(!process.env.ANTHROPIC_API_KEY)return[];let Z=[];try{for await(let $ of new O3().beta.models.list())Z.push({id:$.id,name:$.display_name,provider:"anthropic"})}catch($){console.error("Failed to fetch Anthropic models:",$)}return Z},z3=async()=>{if(!process.env.OPENAI_API_KEY)return[];try{return await new _3().models.list().then((Z)=>Z.data.map(($)=>{return{id:$.id,name:$.id,provider:"openai"}}).sort(($,Y)=>$.id.localeCompare(Y.id)))}catch(Z){return console.error("Failed to fetch OpenAI models:",Z),[]}},U3=async()=>{let Z=process.env.GEMINI_API_KEY;if(!Z)return[];let $=[{id:"gemini-2.5-flash-preview-06-17",name:"Gemini 2.5 Flash Preview (06-17)",provider:"gemini"},{id:"gemini-2.5-pro-preview-06-05",name:"Gemini 2.5 Pro Preview (06-05)",provider:"gemini"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",provider:"gemini"},{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",provider:"gemini"},{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",provider:"gemini"},{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash 8B",provider:"gemini"},{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",provider:"gemini"},{id:"gemini-1.0-pro",name:"Gemini 1.0 Pro",provider:"gemini"},{id:"gemini-2.0-flash-exp",name:"Gemini 2.0 Flash Experimental",provider:"gemini"},{id:"gemini-exp-1206",name:"Gemini Experimental 1206",provider:"gemini"},{id:"gemini-2.5-pro-exp-03-25",name:"Gemini 2.5 Pro Experimental (03-25)",provider:"gemini"},{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash Preview (05-20)",provider:"gemini"}];try{return await new G3(Z).getGenerativeModel({model:"gemini-1.5-flash"}),$}catch(Y){return console.error("Failed to verify Gemini API key:",Y),[]}},nY=async()=>{return(await Promise.all([N3().catch(()=>[]),z3().catch(()=>[]),U3().catch(()=>[])])).flat()};var u1=H(T(),1);function rY({tools:Z,setTools:$}){let Y=u1.useRef(!1);u1.useEffect(()=>{if(!Y.current)$(Z),Y.current=!0},[Z,$])}var aY=H(T(),1);function sY(Z){if(!Z)return{isValid:!1,needsSetup:!0,reason:"未找到配置文件"};if(!Z.providers||Z.providers.length===0)return{isValid:!1,needsSetup:!0,reason:"未配置任何 Provider"};let $=Z.providers.find((Y)=>Y.id===Z.provider_id);if(!$)return{isValid:!1,needsSetup:!0,reason:`Provider "${Z.provider_id}" 不存在`,invalidProviderRef:!0};if(!$.apiKey||$.apiKey.trim()==="")return{isValid:!1,needsSetup:!0,reason:`Provider "${Z.provider_id}" 未配置 API Key`,missingApiKey:!0};return{isValid:!0,needsSetup:!1}}function tY({config:Z}){return aY.useMemo(()=>{if(!Z)return{validation:null,needsSetup:!0,isValid:!1};let $=sY(Z);return{validation:$,needsSetup:$.needsSetup,isValid:!$.needsSetup}},[Z])}var eY=H(T(),1);function Z0({shouldFocus:Z}){let $=jZ();eY.useEffect(()=>{if(Z)$.focus("global-input")},[Z,$])}var vZ=H(T(),1);function Y0(){let[Z,$]=vZ.useState("chat"),Y=jZ(),X=vZ.useCallback(()=>{$("history")},[]),J=vZ.useCallback(()=>{$("knowledge")},[]),Q=vZ.useCallback(()=>{$("settings")},[]),W=vZ.useCallback(()=>{$("model-provider")},[]),O=vZ.useCallback(()=>{$("agent")},[]),N=vZ.useCallback(()=>{$("task")},[]),G=vZ.useCallback(()=>{$("mcp")},[]),F=vZ.useCallback(()=>{console.clear(),$("chat"),Y.focus("global-input")},[Y]);return{activeView:Z,isChatView:Z==="chat",switchToHistory:X,switchToKnowledge:J,switchToSettings:Q,switchToModelProvider:W,switchToAgent:O,switchToTask:N,switchToMcp:G,closePanel:F}}var c1=H(T(),1);function F3(Z){let $=`# 任务:${Z.title}
|
|
7
|
+
`,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}})}catch(X){return k(X)}}async function HQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/stream"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$=S(VJ,Q);return i0(r0(async(K)=>{$.config=$.config||{},$.config.configurable=$.config.configurable||{};let U=Y?.langgraph_context;if(U)Object.assign($.config.configurable,U);let W=null,z=!1,H=()=>{z=!0};K.signal.addEventListener("abort",H);try{W=h.runs.stream(J,$.assistant_id,FZ($));for await(let{event:G,data:F}of W){if(z||K.signal.aborted)break;await K.writeSSE({data:d0(F)??"",event:G})}}catch(G){if(!K.signal.aborted&&!z)throw G}finally{if(K.signal.removeEventListener("abort",H),W){try{await W.return(void 0)}catch(G){}W=null}}}))}catch(X){return k(X)}}async function GQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/:run_id/stream"),{thread_id:J,run_id:Q}=S(_4,X),$=lZ(Z.url),{cancel_on_disconnect:K,last_event_id:U,stream_mode:W}=S(TJ,$);return i0(r0(async(z)=>{let H=new AbortController,G=null,F=!1,M=[],A=()=>{H.abort("Client disconnected")};if(Z.signal)Z.signal.addEventListener("abort",A),M.push({signal:Z.signal,handler:A});let w=()=>{F=!0,H.abort("SSE stream closed")};z.signal.addEventListener("abort",w),M.push({signal:z.signal,handler:w});try{G=h.runs.joinStream(J,Q,{signal:H.signal,cancelOnDisconnect:K,lastEventId:U,streamMode:W?[W]:void 0});for await(let{event:P,data:B,id:R}of G){if(F||z.signal.aborted||H.signal.aborted)break;await z.writeSSE({data:d0(B)??"",event:P,id:R})}}catch(P){if(!(H.signal.aborted||z.signal.aborted)&&!(P instanceof Error&&P.message.includes("user cancel")))console.error("Join stream error:",P),await z.writeSSE({event:"error",data:JSON.stringify({error:P instanceof Error?P.message:"Unknown error"})})}finally{for(let{signal:P,handler:B}of M)try{P.removeEventListener("abort",B)}catch(R){}if(G){try{await G.return(void 0)}catch(P){}G=null}}}))}catch(X){return k(X)}}async function OQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs"),{thread_id:J}=S(VZ,X),Q=lZ(Z.url),{limit:$,offset:K,status:U}=S(EJ,Q),W=await h.runs.list(J,{limit:$,offset:K,status:U});return m(W)}catch(X){return k(X)}}async function qQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/:run_id/cancel"),{thread_id:J,run_id:Q}=S(_4,X),$=lZ(Z.url),{wait:K,action:U}=S(bJ,$),W=h.runs.cancel(J,Q,K,U);if(K)await W;return new Response(null,{status:K?204:202})}catch(X){return k(X)}}async function FQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$=S(qX,Q),K=FZ($);K.config=K.config||{},K.config.configurable=K.config.configurable||{};let U=Y?.langgraph_context;if(U)Object.assign(K.config.configurable,U);K.config.configurable.graph_id=$.assistant_id,K.config.configurable.thread_id=J;let W=h.threads,z=await W.createRun(J,$.assistant_id,K);return(async()=>{let H=!1;try{for await(let G of NY(W,z,K,{attempt:0,getGraph:cZ}));}catch(G){console.error("Background run error:",G)}finally{if(!H){H=!0;try{await dZ.globalMessageQueue.removeQueue(z.run_id)}catch(G){}}}})(),m(z,200,{"Content-Location":`/threads/${J}/runs/${z.run_id}`})}catch(X){return k(X)}}async function MQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/wait"),{thread_id:J}=S(VZ,X),Q=await Z.json(),$=S(qX,Q),K=lZ(Z.url),{cancel_on_disconnect:U}=S(SJ,K),W=FZ($);W.config=W.config||{},W.config.configurable=W.config.configurable||{};let z=Y?.langgraph_context;if(z)Object.assign(W.config.configurable,z);W.config.configurable.graph_id=$.assistant_id,W.config.configurable.thread_id=J;let H=h.threads,G=await H.createRun(J,$.assistant_id,W),F={};for await(let{event:M,data:A}of NY(H,G,W,{attempt:0,getGraph:cZ}))if(M==="end"||M==="writes/value"){if(A&&typeof A==="object")Object.assign(F,A)}return m(F,200,{"Content-Location":`/threads/${J}/runs/${G.run_id}`})}catch(X){return k(X)}}async function NQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/:run_id"),{thread_id:J,run_id:Q}=S(_4,X),K=(await h.runs.list(J,{limit:1000})).find((U)=>U.run_id===Q);if(!K)return k(Error("Run not found"),404);return m(K)}catch(X){return k(X)}}async function AQ(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/:run_id"),{thread_id:J,run_id:Q}=S(_4,X);return await h.threads.updateRun(Q,{status:"deleted"}),new Response(null,{status:204})}catch(X){return k(X)}}async function _Q(Z,Y){try{let X=$Z(Z.url,"/threads/:thread_id/runs/:run_id/join"),{thread_id:J,run_id:Q}=S(_4,X),$=lZ(Z.url),{cancel_on_disconnect:K}=S(yJ,$),W=(await h.runs.list(J,{limit:1000})).find((G)=>G.run_id===Q);if(!W)return k(Error("Run not found"),404);if(W.status==="success"||W.status==="error")return m({});let z=new AbortController;if(K){let G=()=>{z.abort("Client disconnected")};Z.signal?.addEventListener("abort",G)}let H={};for await(let{event:G,data:F}of h.runs.joinStream(J,Q,{signal:z.signal,cancelOnDisconnect:K}))if(G.event==="end"||G.event==="writes/value"){if(F&&typeof F==="object")Object.assign(H,F)}return m(H)}catch(X){return k(X)}}async function wQ(Z,Y){try{let X=await Z.json(),J=S(p4,X),Q=FZ(J);Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let $=Y?.langgraph_context;if($)Object.assign(Q.config.configurable,$);let K=h.threads,U=await K.create({metadata:{...Q.metadata,temporary:!0}});Q.config.configurable.graph_id=J.assistant_id,Q.config.configurable.thread_id=U.thread_id,Q.temporary=!0;let W=await K.createRun(U.thread_id,J.assistant_id,Q);return(async()=>{let z=!1;try{for await(let H of NY(K,W,Q,{attempt:0,getGraph:cZ}));}catch(H){console.error("Stateless run error:",H)}finally{try{await K.delete(U.thread_id)}catch(H){console.error("Error cleaning up temporary thread:",H)}if(!z){z=!0;try{await dZ.globalMessageQueue.removeQueue(W.run_id)}catch(H){}}}})(),m(W,200,{"Content-Location":`/threads/${U.thread_id}/runs/${W.run_id}`})}catch(X){return k(X)}}async function BQ(Z,Y){try{let X=await Z.json(),J=S(p4,X),Q=FZ(J);Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let $=Y?.langgraph_context;if($)Object.assign(Q.config.configurable,$);let K=h.threads,U=await K.create({metadata:{...Q.metadata,temporary:!0}});Q.config.configurable.graph_id=J.assistant_id,Q.config.configurable.thread_id=U.thread_id,Q.temporary=!0;let W=await K.createRun(U.thread_id,J.assistant_id,Q);return i0(r0(async(z)=>{try{for await(let H of NY(K,W,Q,{attempt:0,getGraph:cZ}))await z.writeSSE({data:JSON.stringify(H),event:"data"})}catch(H){if(H instanceof Error&&H.name!=="AbortError")throw console.error("Stream error:",H),H}finally{try{await K.delete(U.thread_id)}catch(H){console.error("Error cleaning up temporary thread:",H)}}}))}catch(X){return k(X)}}async function LQ(Z,Y){try{let X=await Z.json(),J=S(p4,X),Q=FZ(J);Q.config=Q.config||{},Q.config.configurable=Q.config.configurable||{};let $=Y?.langgraph_context;if($)Object.assign(Q.config.configurable,$);let K=h.threads,U=await K.create({metadata:{...Q.metadata,temporary:!0}});Q.config.configurable.graph_id=J.assistant_id,Q.config.configurable.thread_id=U.thread_id,Q.temporary=!0;let W=await K.createRun(U.thread_id,J.assistant_id,Q),z={};try{for await(let{event:H,data:G}of NY(K,W,Q,{attempt:0,getGraph:cZ}))if(H==="end"||H==="writes/value"){if(G&&typeof G==="object")Object.assign(z,G)}}finally{try{await K.delete(U.thread_id)}catch(H){console.error("Error cleaning up temporary thread:",H)}}return m(z,200,{"Content-Location":`/threads/${U.thread_id}/runs/${W.run_id}`})}catch(X){return k(X)}}async function PQ(Z,Y){try{let X=await Z.json(),J=S(kJ,X),Q=h.threads,$=[],K=J.map(async(W)=>{try{let z=FZ(W);z.config=z.config||{},z.config.configurable=z.config.configurable||{};let H=Y?.langgraph_context;if(H)Object.assign(z.config.configurable,H);let G=await Q.create({metadata:{...z.metadata,temporary:!0}});z.config.configurable.graph_id=W.assistant_id,z.config.configurable.thread_id=G.thread_id,z.temporary=!0;let F=await Q.createRun(G.thread_id,W.assistant_id,z);return(async()=>{let M=!1;try{for await(let A of NY(Q,F,z,{attempt:0,getGraph:cZ}));}catch(A){console.error("Batch run error:",A)}finally{try{await Q.delete(G.thread_id)}catch(A){console.error("Error cleaning up temporary thread:",A)}if(!M){M=!0;try{await dZ.globalMessageQueue.removeQueue(F.run_id)}catch(A){}}}})(),{thread_id:G.thread_id,run_id:F.run_id}}catch(z){return console.error("Batch run creation error:",z),{error:(z instanceof Error?z.message:"Unknown error")||"Unknown error"}}}),U=await Promise.all(K);return $.push(...U),m($,200)}catch(X){return k(X)}}async function CQ(Z,Y){try{let X=await Z.json(),J=S(xJ,X),Q=new URL(Z.url),$=S(hJ,{action:Q.searchParams.get("action")||"interrupt"}),K=h.threads,U=[];if("run_ids"in J&&J.run_ids)for(let W of J.run_ids)try{console.warn(`Cancel by run_id ${W} not fully implemented yet`)}catch(z){console.error(`Error cancelling run ${W}:`,z)}else if("thread_id"in J&&J.thread_id){let W=J.thread_id;try{let z=await K.listRuns(W,{limit:1000,offset:0});for(let H of z)try{h.runs.cancel(W,H.run_id,$.wait,$.action),U.push(H.run_id)}catch(G){console.error(`Error cancelling run ${H.run_id}:`,G)}}catch(z){console.error(`Error listing runs for thread ${W}:`,z)}}else if("status"in J&&J.status)console.warn(`Cancel by status ${J.status} not fully implemented yet`);return new Response(null,{status:204})}catch(X){return k(X)}}var RQ=[{method:"POST",pattern:/^\/assistants\/search$/,handler:gJ},{method:"POST",pattern:/^\/assistants\/count$/,handler:uJ},{method:"GET",pattern:/^\/assistants\/[^/]+$/,handler:mJ},{method:"DELETE",pattern:/^\/assistants\/[^/]+$/,handler:pJ},{method:"PATCH",pattern:/^\/assistants\/[^/]+$/,handler:dJ},{method:"GET",pattern:/^\/assistants\/[^/]+\/graph$/,handler:cJ},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs$/,handler:lJ},{method:"GET",pattern:/^\/assistants\/[^/]+\/subgraphs\/[^/]+$/,handler:iJ},{method:"GET",pattern:/^\/assistants\/[^/]+\/schemas$/,handler:rJ},{method:"POST",pattern:/^\/assistants\/[^/]+\/versions$/,handler:oJ},{method:"POST",pattern:/^\/assistants\/[^/]+\/latest$/,handler:nJ},{method:"POST",pattern:/^\/assistants$/,handler:aJ},{method:"POST",pattern:/^\/threads$/,handler:sJ},{method:"POST",pattern:/^\/threads\/search$/,handler:tJ},{method:"POST",pattern:/^\/threads\/count$/,handler:eJ},{method:"GET",pattern:/^\/threads\/[^/]+$/,handler:ZQ},{method:"PATCH",pattern:/^\/threads\/[^/]+$/,handler:YQ},{method:"DELETE",pattern:/^\/threads\/[^/]+$/,handler:XQ},{method:"GET",pattern:/^\/threads\/[^/]+\/state$/,handler:JQ},{method:"POST",pattern:/^\/threads\/[^/]+\/state$/,handler:QQ},{method:"POST",pattern:/^\/threads\/[^/]+\/state\/checkpoint$/,handler:$Q},{method:"GET",pattern:/^\/threads\/[^/]+\/history$/,handler:KQ},{method:"POST",pattern:/^\/threads\/[^/]+\/history$/,handler:WQ},{method:"POST",pattern:/^\/threads\/[^/]+\/copy$/,handler:UQ},{method:"GET",pattern:/^\/threads\/[^/]+\/stream$/,handler:zQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs$/,handler:FQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/stream$/,handler:HQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/wait$/,handler:MQ},{method:"POST",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/cancel$/,handler:qQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs$/,handler:OQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:NQ},{method:"DELETE",pattern:/^\/threads\/[^/]+\/runs\/[^/]+$/,handler:AQ},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/join$/,handler:_Q},{method:"GET",pattern:/^\/threads\/[^/]+\/runs\/[^/]+\/stream$/,handler:GQ},{method:"POST",pattern:/^\/runs$/,handler:wQ},{method:"POST",pattern:/^\/runs\/stream$/,handler:BQ},{method:"POST",pattern:/^\/runs\/wait$/,handler:LQ},{method:"POST",pattern:/^\/runs\/batch$/,handler:PQ},{method:"POST",pattern:/^\/runs\/cancel$/,handler:CQ}],vQ=(Z)=>{let Y=new URL(Z.url).pathname.toString(),X="";if(Y.includes("/threads"))X=Y.split("/threads")[0];else if(Y.includes("/assistants"))X=Y.split("/assistants")[0];return new Request(Z.url.replace(X,""),{method:Z.method,headers:Z.headers,body:Z.body,duplex:Z.duplex})};async function FX(Z,Y={}){Z=vQ(Z);try{await dZ.initGlobal();let J=new URL(Z.url).pathname,Q=Z.method;for(let $ of RQ)if($.method===Q&&$.pattern.test(J))return await $.handler(Z,Y);return new Response("Not Found",{status:404})}catch(X){return console.error("Request error:",X),k(X)}}await MX();p0("code",NX);var AX=(Z,Y={})=>{return FX(new Request(Z,Y),{})};import IQ from"openai";import DQ from"@anthropic-ai/sdk";import{GoogleGenerativeAI as VQ}from"@google/generative-ai";var EQ=async()=>{if(!process.env.ANTHROPIC_API_KEY)return[];let Z=[];try{for await(let Y of new DQ().beta.models.list())Z.push({id:Y.id,name:Y.display_name,provider:"anthropic"})}catch(Y){console.error("Failed to fetch Anthropic models:",Y)}return Z},bQ=async()=>{if(!process.env.OPENAI_API_KEY)return[];try{return await new IQ().models.list().then((Z)=>Z.data.map((Y)=>{return{id:Y.id,name:Y.id,provider:"openai"}}).sort((Y,X)=>Y.id.localeCompare(X.id)))}catch(Z){return console.error("Failed to fetch OpenAI models:",Z),[]}},TQ=async()=>{let Z=process.env.GEMINI_API_KEY;if(!Z)return[];let Y=[{id:"gemini-2.5-flash-preview-06-17",name:"Gemini 2.5 Flash Preview (06-17)",provider:"gemini"},{id:"gemini-2.5-pro-preview-06-05",name:"Gemini 2.5 Pro Preview (06-05)",provider:"gemini"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",provider:"gemini"},{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite",provider:"gemini"},{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash",provider:"gemini"},{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash 8B",provider:"gemini"},{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro",provider:"gemini"},{id:"gemini-1.0-pro",name:"Gemini 1.0 Pro",provider:"gemini"},{id:"gemini-2.0-flash-exp",name:"Gemini 2.0 Flash Experimental",provider:"gemini"},{id:"gemini-exp-1206",name:"Gemini Experimental 1206",provider:"gemini"},{id:"gemini-2.5-pro-exp-03-25",name:"Gemini 2.5 Pro Experimental (03-25)",provider:"gemini"},{id:"gemini-2.5-flash-preview-05-20",name:"Gemini 2.5 Flash Preview (05-20)",provider:"gemini"}];try{return await new VQ(Z).getGenerativeModel({model:"gemini-1.5-flash"}),Y}catch(X){return console.error("Failed to verify Gemini API key:",X),[]}},_X=async()=>{return(await Promise.all([EQ().catch(()=>[]),bQ().catch(()=>[]),TQ().catch(()=>[])])).flat()};var c4=L(x(),1);function wX({tools:Z,setTools:Y}){let X=c4.useRef(!1);c4.useEffect(()=>{if(!X.current)Y(Z),X.current=!0},[Z,Y])}var LX=L(x(),1);function BX(Z){if(!Z)return{isValid:!1,needsSetup:!0,reason:"未找到配置文件"};if(!Z.providers||Z.providers.length===0)return{isValid:!1,needsSetup:!0,reason:"未配置任何 Provider"};let Y=Z.providers.find((X)=>X.id===Z.provider_id);if(!Y)return{isValid:!1,needsSetup:!0,reason:`Provider "${Z.provider_id}" 不存在`,invalidProviderRef:!0};if(!Y.apiKey||Y.apiKey.trim()==="")return{isValid:!1,needsSetup:!0,reason:`Provider "${Z.provider_id}" 未配置 API Key`,missingApiKey:!0};return{isValid:!0,needsSetup:!1}}function PX({config:Z}){return LX.useMemo(()=>{if(!Z)return{validation:null,needsSetup:!0,isValid:!1};let Y=BX(Z);return{validation:Y,needsSetup:Y.needsSetup,isValid:!Y.needsSetup}},[Z])}var CX=L(x(),1);function RX({shouldFocus:Z}){let Y=KY();CX.useEffect(()=>{if(Z)Y.focus("global-input")},[Z,Y])}var iZ=L(x(),1);function vX(){let[Z,Y]=iZ.useState("chat"),X=KY(),J=iZ.useCallback(()=>{Y("history")},[]),Q=iZ.useCallback(()=>{Y("knowledge")},[]),$=iZ.useCallback(()=>{Y("settings")},[]),K=iZ.useCallback(()=>{Y("model-provider")},[]),U=iZ.useCallback(()=>{Y("agent")},[]),W=iZ.useCallback(()=>{Y("task")},[]),z=iZ.useCallback(()=>{Y("mcp")},[]),H=iZ.useCallback(()=>{console.clear(),Y("chat"),X.focus("global-input")},[X]);return{activeView:Z,isChatView:Z==="chat",switchToHistory:J,switchToKnowledge:Q,switchToSettings:$,switchToModelProvider:K,switchToAgent:U,switchToTask:W,switchToMcp:z,closePanel:H}}var l4=L(x(),1);function fQ(Z){let Y=`# 任务:${Z.title}
|
|
8
8
|
|
|
9
|
-
`;if(
|
|
9
|
+
`;if(Y+=`**描述:**
|
|
10
10
|
${Z.description}
|
|
11
11
|
|
|
12
|
-
`,Z.agentType)
|
|
12
|
+
`,Z.agentType)Y+=`**建议 Agent 类型:** ${Z.agentType}
|
|
13
13
|
|
|
14
|
-
`;if(Z.estimatedTime)
|
|
14
|
+
`;if(Z.estimatedTime)Y+=`**预估时间:** ${Z.estimatedTime}
|
|
15
15
|
|
|
16
|
-
`;if(Z.complexity)
|
|
16
|
+
`;if(Z.complexity)Y+=`**复杂度:** ${Z.complexity}
|
|
17
17
|
|
|
18
|
-
`;if(Z.dependencies&&Z.dependencies.length>0)
|
|
19
|
-
${Z.dependencies.map((
|
|
18
|
+
`;if(Z.dependencies&&Z.dependencies.length>0)Y+=`**依赖任务:**
|
|
19
|
+
${Z.dependencies.map((X)=>`- ${X}`).join(`
|
|
20
20
|
`)}
|
|
21
21
|
|
|
22
|
-
`;if(Z.acceptanceCriteria&&Z.acceptanceCriteria.length>0)
|
|
23
|
-
${Z.acceptanceCriteria.map((
|
|
22
|
+
`;if(Z.acceptanceCriteria&&Z.acceptanceCriteria.length>0)Y+=`**验收标准:**
|
|
23
|
+
${Z.acceptanceCriteria.map((X,J)=>`${J+1}. ${X}`).join(`
|
|
24
24
|
`)}
|
|
25
25
|
|
|
26
|
-
`;if(Z.children&&Z.children.length>0)
|
|
27
|
-
`,Z.children.forEach((
|
|
28
|
-
### 子任务 ${
|
|
29
|
-
|
|
30
|
-
`,
|
|
31
|
-
${
|
|
26
|
+
`;if(Z.children&&Z.children.length>0)Y+=`**子任务:**
|
|
27
|
+
`,Z.children.forEach((X,J)=>{if(Y+=`
|
|
28
|
+
### 子任务 ${J+1}: ${X.title}
|
|
29
|
+
`,Y+=`${X.description}
|
|
30
|
+
`,X.acceptanceCriteria&&X.acceptanceCriteria.length>0)Y+=`验收标准:
|
|
31
|
+
${X.acceptanceCriteria.map((Q)=>`- ${Q}`).join(`
|
|
32
32
|
`)}
|
|
33
|
-
`})
|
|
34
|
-
`;return
|
|
35
|
-
|
|
36
|
-
请你先写一个 TODO LIST 然后开始这个任务,最后完成任务的时候,使用 commit_task`}];Y(EZ).then(()=>{return $(G,{extraParams:Q,metadata:EZ})}).then(()=>{dZ("任务已发送给 Agent"),J()}).catch((F)=>{console.error("Task execution failed:",F),dZ("任务执行失败")})},[$,Y,Q,J])}}var x1=H(T(),1),Q0=H(M(),1),X0=x1.createContext(void 0),M1=()=>{let Z=x1.useContext(X0);if(Z===void 0)throw Error("useChatPanel must be used within ChatPanelProvider. Make sure your component is a child of ChatController.");return Z},J0=({children:Z,value:$})=>{return Q0.jsxDEV(X0.Provider,{value:$,children:Z},void 0,!1,void 0,this)};var _1=H(T(),1);var K0=(Z)=>{return Z.additional_kwargs?.reasoning_content||Array.isArray(Z.content)&&Z.content.find(($)=>$.type==="thinking")?.thinking},q1=(Z)=>{return typeof Z.content==="string"?Z.content:Z.content?.filter(($)=>{return $.type==="text"}).map(($)=>$.text).join("")};d1();var UY=H(T(),1),p=H(M(),1),B3={approve:"green",reject:"red",edit:"yellow",modify:"cyan"},b3=(Z)=>{return B3[Z.toLowerCase()]||"white"},O0=({request:Z,allowedDecisions:$=["approve","edit","reject"],onApprove:Y,onEdit:X,onReject:J,autoFocus:Q=!0})=>{let[W,O]=UY.useState("approve"),{value:N,setTrue:G,setFalse:F}=_0(!1),[U,L]=UY.useState(""),A=jZ(),w=Z.messageIndex,q=Z.description;qZ((S,OZ)=>{if(N&&OZ.escape)b()},{isActive:N});let R=()=>{if(!U.trim())return;if(W==="edit")try{let S=JSON.parse(U);X(S)}catch(S){console.error("Invalid JSON:",S);return}else{let S=`User rejected to run this tool, reason: ${U}`;J(S)}F(),L("")},b=()=>{F(),L("")},D=([S])=>{if(S==="approve"){Y(),A.focus("global-input");return}if(O(S),G(),S==="edit")L(JSON.stringify(Z.toolCall.args,null,2));else L("")},$Z=$.map((S)=>({label:S,value:S}));return N?(()=>{let S=b3(W),OZ=W==="edit";return p.jsxDEV(_,{flexDirection:"column",paddingX:1,marginTop:0,children:[p.jsxDEV(_,{flexDirection:"column",marginBottom:1,children:[p.jsxDEV(K,{color:S,bold:!0,children:[W.toUpperCase()," MODE - ",Z.toolCall.name]},void 0,!0,void 0,this),w!==void 0&&p.jsxDEV(K,{color:"gray",dimColor:!0,children:["Message Index: ",w]},void 0,!0,void 0,this),q&&p.jsxDEV(K,{color:"gray",dimColor:!0,children:["Description: ",q]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),OZ?p.jsxDEV(_,{flexDirection:"column",marginTop:0,children:[p.jsxDEV(K,{color:"yellow",dimColor:!0,children:"Editing action arguments (JSON format):"},void 0,!1,void 0,this),p.jsxDEV(_,{paddingX:1,children:p.jsxDEV(CZ,{value:U,onChange:L,onSubmit:R,placeholder:"Enter JSON...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):p.jsxDEV(_,{flexDirection:"column",marginTop:0,children:[p.jsxDEV(K,{color:"cyan",dimColor:!0,children:"Enter additional message for this action:"},void 0,!1,void 0,this),p.jsxDEV(_,{padding:1,children:p.jsxDEV(CZ,{value:U,onChange:L,onSubmit:R,placeholder:"Enter message...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),p.jsxDEV(_,{marginTop:0,children:p.jsxDEV(K,{color:"gray",children:[p.jsxDEV(K,{color:S,bold:!0,children:"↵"},void 0,!1,void 0,this)," ","Submit |",p.jsxDEV(K,{color:"red",bold:!0,children:[" ","Esc"]},void 0,!0,void 0,this)," ","Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})():(()=>p.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[p.jsxDEV(_,{flexDirection:"column",marginBottom:1,children:[p.jsxDEV(K,{color:"cyan",bold:!0,children:Z.toolCall.name},void 0,!1,void 0,this),w!==void 0&&p.jsxDEV(K,{color:"gray",dimColor:!0,children:["Message Index: ",w]},void 0,!0,void 0,this),q&&p.jsxDEV(K,{color:"gray",dimColor:!0,children:["Description: ",q]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),p.jsxDEV(_,{children:p.jsxDEV(K1,{singleSelect:!0,options:$Z,onSubmit:D,autoFocus:Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this))()};var l1=H(T(),1),G0=H(M(),1),FY={type:"approval",render(Z,$){let{content:Y,metadata:X}=Z,J=jZ(),Q=l1.useCallback(()=>{$({state:"submitted",result:{status:"approved"}}),J.focus("global-input")},[$,J]),W=l1.useCallback((G)=>{$({state:"edited",result:{status:"edited",editedArgs:G}}),J.focus("global-input")},[$,J]),O=l1.useCallback((G)=>{$({state:"cancelled",result:{status:"rejected",message:G}}),J.focus("global-input")},[$,J]),N={id:Z.id,toolCall:Y.toolCall,status:Z.state==="submitted"?"approved":Z.state==="edited"?"edited":Z.state==="cancelled"?"rejected":"pending",createdAt:Z.createdAt,messageIndex:X.messageIndex,description:X.description};return G0.jsxDEV(O0,{request:N,allowedDecisions:["approve","edit","reject"],onApprove:Q,onEdit:W,onReject:O,autoFocus:!0},Z.id,!1,void 0,this)},defaultConfig:{layout:{border:!1,padding:0},interaction:{autoSubmit:!1,allowSkip:!1}}};var HY=H(T(),1);var v3={title:{maxWidth:60,ellipsis:"…"},description:{maxWidth:80,ellipsis:"…"},optionLabel:{maxWidth:50,ellipsis:"…"},tabLabel:{maxWidth:30,ellipsis:"…"},fullTitle:{maxWidth:80,ellipsis:"…"}},C3=(Z,$=20,Y="…")=>{if(!Z)return"";if(Z.length<=$)return Z;return Z.substring(0,$-Y.length)+Y},R1=(Z,$)=>{let Y=v3[$];return C3(Z,Y.maxWidth,Y.ellipsis)};var lZ=H(M(),1),I3=(Z)=>{return R1(Z,"optionLabel")},AY={type:"selection",render(Z,$){let{content:Y,metadata:X,result:J}=Z,[Q,W]=HY.useState(J?.selected||[]),[O,N]=HY.useState(J?.customInput||""),G=Y.options.map((R)=>({label:I3(R.label),value:R.value})),F=(R,b)=>{$({result:{selected:R??Q,customInput:b??O}})},U=(R)=>{W(R),F(R,void 0)},L=(R)=>{N(R),F(void 0,R)},A=()=>{$({state:"submitted",result:{selected:Q,customInput:O}})},w=X?.title?R1(X.title,"title"):null,q=X?.description?R1(X.description,"description"):null;return lZ.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[w&&lZ.jsxDEV(_,{marginBottom:1,children:lZ.jsxDEV(K,{color:"cyan",bold:!0,children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),q&&lZ.jsxDEV(_,{marginBottom:1,children:lZ.jsxDEV(K,{dimColor:!0,children:q},void 0,!1,void 0,this)},void 0,!1,void 0,this),lZ.jsxDEV(K1,{options:G,singleSelect:Y.singleSelect,values:Q,onChange:U,onSubmit:A,autoFocus:!0},void 0,!1,void 0,this),Y.allowCustomInput&&lZ.jsxDEV(_,{marginTop:1,flexDirection:"column",children:lZ.jsxDEV(CZ,{value:O,onChange:L,onSubmit:A,placeholder:Y.placeholder||"Type custom option...",autoFocus:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate(Z){if(Z.options.length===0)return"At least one option is required";if(Z.singleSelect&&Z.maxSelections&&Z.maxSelections>1)return"Single select cannot have maxSelections > 1";return},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var N0=H(T(),1);var VZ=H(M(),1),LY={type:"input",render(Z,$){let{content:Y,metadata:X}=Z,[J,Q]=N0.useState(Y.defaultValue||""),W=()=>{$({state:"submitted",result:{value:J}})};return VZ.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[X?.title&&VZ.jsxDEV(_,{marginBottom:1,children:VZ.jsxDEV(K,{color:"cyan",bold:!0,children:X.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),X?.description&&VZ.jsxDEV(_,{marginBottom:1,children:VZ.jsxDEV(K,{dimColor:!0,children:X.description},void 0,!1,void 0,this)},void 0,!1,void 0,this),VZ.jsxDEV(_,{children:[VZ.jsxDEV(CZ,{value:J,onChange:Q,onSubmit:W,placeholder:Y.placeholder,autoFocus:!0},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),Y.maxLength&&VZ.jsxDEV(_,{marginTop:1,children:VZ.jsxDEV(K,{dimColor:!0,children:["Max length: ",Y.maxLength]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate(Z){if(Z.validation?.pattern&&Z.defaultValue){if(!Z.validation.pattern.test(Z.defaultValue))return"Input does not match required pattern"}if(Z.validation?.minLength&&Z.defaultValue&&Z.defaultValue.length<Z.validation.minLength)return`Input must be at least ${Z.validation.minLength} characters`;return},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var W1=H(M(),1),wY={type:"confirm",render(Z,$){let{content:Y,metadata:X}=Z,J=()=>{$({state:"submitted",result:{confirmed:!0}})},Q=()=>{$({state:"cancelled",result:{confirmed:!1}})},W=[{label:Y.confirmLabel||"Confirm",value:"confirm"},{label:Y.cancelLabel||"Cancel",value:"cancel"}],O=([N])=>{if(N==="confirm")J();else Q()};return W1.jsxDEV(_,{flexDirection:"column",paddingX:1,children:[X?.title&&W1.jsxDEV(_,{marginBottom:1,children:W1.jsxDEV(K,{color:Y.danger?"red":"cyan",bold:!0,children:X.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),W1.jsxDEV(_,{marginBottom:1,children:W1.jsxDEV(K,{children:Y.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),W1.jsxDEV(K1,{options:W,singleSelect:!0,onSubmit:O,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var S3=H(T(),1);var f3=H(M(),1);var gZ=H(T(),1);var P1=H(T(),1);var r=H(M(),1),U0=({items:Z,defaultIndex:$=0,onChange:Y,disabled:X=!1,autoFocus:J=!0,variant:Q="line"})=>{let{isFocused:W}=z0({autoFocus:J}),[O,N]=P1.useState($),G=P1.default.useMemo(()=>`tabs-${Math.random().toString(36).substring(2,9)}`,[]),F=P1.useCallback((A)=>{if(A<0||A>=Z.length||Z[A].disabled)return;N(A),Y?.(A,Z[A])},[Z,Y]);qZ((A,w)=>{if(X)return;if(w.leftArrow)F(O-1);else if(w.rightArrow)F(O+1)},{isActive:!X});let U=()=>{return Z.map((A,w)=>{let q=w===O,R=W&&!X,b;if(Q==="line")b=r.jsxDEV(_,{marginRight:1,children:[r.jsxDEV(K,{color:A.disabled?"gray":q?R?"green":"cyan":"gray",bold:q&&R,children:A.label},void 0,!1,void 0,this),q&&r.jsxDEV(K,{color:R?"green":"cyan",children:"_"},void 0,!1,void 0,this)]},`${G}-${A.id}`,!0,void 0,this);else if(Q==="enclosed"){let D=w===0||q?"┌":"─",$Z=w===Z.length-1||q?"┐":"─",m=w===0||q?"│":" ",XZ=w===Z.length-1||q?"│":" ",S=q?"─":" ",OZ=q?" ":"",g=A.disabled?"gray":q?R?"green":"cyan":"gray";b=r.jsxDEV(_,{children:r.jsxDEV(_,{flexDirection:"column",children:[r.jsxDEV(_,{children:[r.jsxDEV(K,{color:g,children:D},void 0,!1,void 0,this),r.jsxDEV(K,{color:g,bold:q&&R,children:[OZ,A.label,OZ]},void 0,!0,void 0,this),r.jsxDEV(K,{color:g,children:$Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q&&r.jsxDEV(_,{children:[r.jsxDEV(K,{color:g,children:m},void 0,!1,void 0,this),r.jsxDEV(K,{color:g,children:S.repeat(A.label.length+2)},void 0,!1,void 0,this),r.jsxDEV(K,{color:g,children:XZ},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},`${G}-${A.id}`,!1,void 0,this)}else{let D=q?"●":"○";b=r.jsxDEV(_,{marginRight:2,children:r.jsxDEV(K,{color:A.disabled?"gray":q?R?"green":"cyan":"gray",bold:q&&R,children:[D," ",A.label]},void 0,!0,void 0,this)},`${G}-${A.id}`,!1,void 0,this)}return b})},L=()=>{let A=Z[O];if(!A?.content)return null;return r.jsxDEV(_,{marginTop:1,paddingX:2,paddingY:1,flexDirection:"column",children:A.content},void 0,!1,void 0,this)};return r.jsxDEV(_,{flexDirection:"column",flexGrow:1,children:[r.jsxDEV(_,{children:U()},void 0,!1,void 0,this),Z.some((A)=>A.content)&&L()]},void 0,!0,void 0,this)};var F0=H(T(),1);var H0=H(M(),1),MY=({interaction:Z,renderer:$,onChange:Y})=>{let X=F0.useMemo(()=>{return{layout:{border:!1,padding:0,...$.defaultConfig?.layout,...Z.config.layout},interaction:{autoSubmit:!1,allowSkip:!1,showPreview:!0,...$.defaultConfig?.interaction,...Z.config.interaction},style:{...$.defaultConfig?.style,...Z.config.style}}},[Z.config,$.defaultConfig]),J=X.style.backgroundColor;return H0.jsxDEV(_,{backgroundColor:J,paddingX:X.layout.padding,marginBottom:1,flexDirection:"column",children:$.render({...Z,config:X},Y)},void 0,!1,void 0,this)};d1();var iZ=H(M(),1),k3=(Z)=>{return R1(Z,"fullTitle")},qY=()=>{let Z=MZ(),[$,Y]=gZ.useState(null),{focusNext:X,focus:J}=jZ(),Q=gZ.useMemo(()=>{return Z.getInteractions()},[Z.getInteractions()]);gZ.useEffect(()=>{if(Q.length>0&&!$)Y(Q[0].id)},[Q,$]);let W=gZ.useMemo(()=>{return Q.map((U)=>{let L={idle:"\uD83D\uDD04",active:"\uD83D\uDD04",submitted:"✅",edited:"⛔",cancelled:"\uD83D\uDEAB"}[U.state]||"",A=k3(U.metadata.title||U.content.type);return{id:U.id,label:`${L} ${A}`,content:null}})},[Q]),O=gZ.useCallback((U,L)=>{Y(L.id)},[]),N=gZ.useCallback((U)=>{if(Q.every((q)=>q.state==="submitted"||q.state==="edited"||q.state==="cancelled")){J("global-input");return}let w=(Q.findIndex((q)=>q.id===U)+1)%Q.length;Y(Q[w].id)},[Q,J]),G=A0(()=>{X()});FZ(G,$?100:null);let F=()=>{if(!$)return null;let U=Q.find((A)=>A.id===$);if(!U)return null;let L=eZ.get(U.content.type);if(!L)return iZ.jsxDEV(_,{paddingX:1,children:iZ.jsxDEV(K,{color:"red",children:["Unknown renderer: ",U.content.type]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return iZ.jsxDEV(MY,{interaction:U,renderer:L,onChange:(A)=>{if(Z.updateInteraction(U.id,A),A.state==="submitted"||A.state==="edited"||A.state==="cancelled")N(U.id)}},U.id,!1,void 0,this)};if(Q.length===0)return null;return iZ.jsxDEV(_,{flexDirection:"column",borderColor:"cyan",borderStyle:"single",width:"100%",children:[iZ.jsxDEV(_,{justifyContent:"space-between",paddingX:1,marginBottom:1,children:iZ.jsxDEV(K,{color:"cyan",bold:!0,children:["Interactions (",Q.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),iZ.jsxDEV(_,{paddingX:1,marginBottom:1,children:iZ.jsxDEV(U0,{items:W,defaultIndex:W.findIndex((U)=>U.id===$),onChange:O,autoFocus:!0,variant:"line"},$,!1,void 0,this)},void 0,!1,void 0,this),F()]},void 0,!0,void 0,this)};d1();function L0(){eZ.register("approval",FY),eZ.register("selection",AY),eZ.register("input",LY),eZ.register("confirm",wY)}L0();var B1=H(M(),1);import{z as Z1}from"zod";var T3=Z1.object({label:Z1.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),y3=Z1.object({description:Z1.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:Z1.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:Z1.array(T3).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:Z1.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:Z1.string().optional().describe("自定义输入框的占位符文本")}),D3=({tool:Z})=>{let{addInteraction:$,getInteractions:Y,updateInteraction:X}=MZ(),[J,Q]=_1.useState(null),W=_1.useRef(!1),O=Z.getInputRepaired();if(_1.useEffect(()=>{if(Z.state==="interrupted"&&!J&&!W.current){let G={type:"selection",options:O.options?.map((U,L)=>({label:U.label,value:U.label}))||[],singleSelect:O.type==="single_select",allowCustomInput:O.allow_custom_input??!0,placeholder:O.placeholder},F=$(G,{tool:Z,metadata:{title:O.description||"请选择一个选项",groupKey:"user-input"}});Q(F.id)}},[Z,J,$,O]),_1.useEffect(()=>{if(!J||W.current)return;let N=()=>{let U=Y().find((L)=>L.id===J);if(U&&(U.state==="submitted"||U.state==="edited"||U.state==="cancelled")&&!U.resultSent){W.current=!0;let L=U.result,A="";if(L){if(L.selected&&L.selected.length>0)A+=`User selected:
|
|
37
|
-
${
|
|
38
|
-
- `)}`;if(
|
|
39
|
-
`:"")+`User Custom Input: ${
|
|
40
|
-
`).map((
|
|
41
|
-
`);return
|
|
42
|
-
`)
|
|
43
|
-
`);for(let
|
|
44
|
-
`).length>50}function
|
|
45
|
-
`).length;return
|
|
46
|
-
`).filter(Boolean).length;return
|
|
47
|
-
`).filter(Boolean).length
|
|
48
|
-
`)?.length;return
|
|
49
|
-
`).map((
|
|
33
|
+
`}),Y+=`
|
|
34
|
+
`;return Y.trim()}function IX(Z){let{sendMessage:Y,createNewChat:X}=KZ(),{extraParams:J}=WZ(),{closePanel:Q}=Z,$=l4.useMemo(()=>{return{...J,is_in_task:!0}},[J]);return{handleExecuteTask:l4.useCallback((U)=>{let z=[{type:"human",content:`${fQ(U)}
|
|
35
|
+
|
|
36
|
+
请你先写一个 TODO LIST 然后开始这个任务,最后完成任务的时候,使用 commit_task`}];X(WY).then(()=>{return Y(z,{extraParams:$,metadata:WY})}).then(()=>{_Y("任务已发送给 Agent"),Q()}).catch((H)=>{console.error("Task execution failed:",H),_Y("任务执行失败")})},[Y,X,$,Q])}}var i4=L(x(),1),EX=L(v(),1),DX=i4.createContext(void 0),Q4=()=>{let Z=i4.useContext(DX);if(Z===void 0)throw Error("useChatPanel must be used within ChatPanelProvider. Make sure your component is a child of ChatController.");return Z},VX=({children:Z,value:Y})=>{return EX.jsxDEV(DX.Provider,{value:Y,children:Z},void 0,!1,void 0,this)};var dY=L(x(),1);var bX=(Z)=>{return Z.additional_kwargs?.reasoning_content||Array.isArray(Z.content)&&Z.content.find((Y)=>Y.type==="thinking")?.thinking},$4=(Z)=>{return typeof Z.content==="string"?Z.content:Z.content?.filter((Y)=>{return Y.type==="text"}).map((Y)=>Y.text).join("")};r4();var n0=L(x(),1),s=L(v(),1),mQ={approve:"green",reject:"red",edit:"yellow",modify:"cyan"},pQ=(Z)=>{return mQ[Z.toLowerCase()]||"white"},jX=({request:Z,allowedDecisions:Y=["approve","edit","reject"],onApprove:X,onEdit:J,onReject:Q,autoFocus:$=!0})=>{let[K,U]=n0.useState("approve"),{value:W,setTrue:z,setFalse:H}=fX(!1),[G,F]=n0.useState(""),M=KY(),A=Z.messageIndex,w=Z.description;uZ((E,d)=>{if(W&&d.escape)B()},{isActive:W});let P=()=>{if(!G.trim())return;if(K==="edit")try{let E=JSON.parse(G);J(E)}catch(E){console.error("Invalid JSON:",E);return}else{let E=`User rejected to run this tool, reason: ${G}`;Q(E)}H(),F("")},B=()=>{H(),F("")},R=([E])=>{if(E==="approve"){X(),M.focus("global-input");return}if(U(E),z(),E==="edit")F(JSON.stringify(Z.toolCall.args,null,2));else F("")},C=Y.map((E)=>({label:E,value:E}));return W?(()=>{let E=pQ(K),d=K==="edit";return s.jsxDEV(N,{flexDirection:"column",paddingX:1,marginTop:0,children:[s.jsxDEV(N,{flexDirection:"column",marginBottom:1,children:[s.jsxDEV(O,{color:E,bold:!0,children:[K.toUpperCase()," MODE - ",Z.toolCall.name]},void 0,!0,void 0,this),A!==void 0&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Message Index: ",A]},void 0,!0,void 0,this),w&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Description: ",w]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),d?s.jsxDEV(N,{flexDirection:"column",marginTop:0,children:[s.jsxDEV(O,{color:"yellow",dimColor:!0,children:"Editing action arguments (JSON format):"},void 0,!1,void 0,this),s.jsxDEV(N,{paddingX:1,children:s.jsxDEV(rZ,{value:G,onChange:F,onSubmit:P,placeholder:"Enter JSON...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):s.jsxDEV(N,{flexDirection:"column",marginTop:0,children:[s.jsxDEV(O,{color:"cyan",dimColor:!0,children:"Enter additional message for this action:"},void 0,!1,void 0,this),s.jsxDEV(N,{padding:1,children:s.jsxDEV(rZ,{value:G,onChange:F,onSubmit:P,placeholder:"Enter message...",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),s.jsxDEV(N,{marginTop:0,children:s.jsxDEV(O,{color:"gray",children:[s.jsxDEV(O,{color:E,bold:!0,children:"↵"},void 0,!1,void 0,this)," ","Submit |",s.jsxDEV(O,{color:"red",bold:!0,children:[" ","Esc"]},void 0,!0,void 0,this)," ","Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})():(()=>s.jsxDEV(N,{flexDirection:"column",paddingX:1,children:[s.jsxDEV(N,{flexDirection:"column",marginBottom:1,children:[s.jsxDEV(O,{color:"cyan",bold:!0,children:Z.toolCall.name},void 0,!1,void 0,this),A!==void 0&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Message Index: ",A]},void 0,!0,void 0,this),w&&s.jsxDEV(O,{color:"gray",dimColor:!0,children:["Description: ",w]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s.jsxDEV(N,{children:s.jsxDEV(mY,{singleSelect:!0,options:C,onSubmit:R,autoFocus:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this))()};var o4=L(x(),1),SX=L(v(),1),a0={type:"approval",render(Z,Y){let{content:X,metadata:J}=Z,Q=KY(),$=o4.useCallback(()=>{Y({state:"submitted",result:{status:"approved"}}),Q.focus("global-input")},[Y,Q]),K=o4.useCallback((z)=>{Y({state:"edited",result:{status:"edited",editedArgs:z}}),Q.focus("global-input")},[Y,Q]),U=o4.useCallback((z)=>{Y({state:"cancelled",result:{status:"rejected",message:z}}),Q.focus("global-input")},[Y,Q]),W={id:Z.id,toolCall:X.toolCall,status:Z.state==="submitted"?"approved":Z.state==="edited"?"edited":Z.state==="cancelled"?"rejected":"pending",createdAt:Z.createdAt,messageIndex:J.messageIndex,description:J.description};return SX.jsxDEV(jX,{request:W,allowedDecisions:["approve","edit","reject"],onApprove:$,onEdit:K,onReject:U,autoFocus:!0},Z.id,!1,void 0,this)},defaultConfig:{layout:{border:!1,padding:0},interaction:{autoSubmit:!1,allowSkip:!1}}};var s0=L(x(),1);var dQ={title:{maxWidth:60,ellipsis:"…"},description:{maxWidth:80,ellipsis:"…"},optionLabel:{maxWidth:50,ellipsis:"…"},tabLabel:{maxWidth:30,ellipsis:"…"},fullTitle:{maxWidth:80,ellipsis:"…"}},cQ=(Z,Y=20,X="…")=>{if(!Z)return"";if(Z.length<=Y)return Z;return Z.substring(0,Y-X.length)+X},K4=(Z,Y)=>{let X=dQ[Y];return cQ(Z,X.maxWidth,X.ellipsis)};var wY=L(v(),1),lQ=(Z)=>{return K4(Z,"optionLabel")},t0={type:"selection",render(Z,Y){let{content:X,metadata:J,result:Q}=Z,[$,K]=s0.useState(Q?.selected||[]),[U,W]=s0.useState(Q?.customInput||""),z=X.options.map((P)=>({label:lQ(P.label),value:P.value})),H=(P,B)=>{Y({result:{selected:P??$,customInput:B??U}})},G=(P)=>{K(P),H(P,void 0)},F=(P)=>{W(P),H(void 0,P)},M=()=>{Y({state:"submitted",result:{selected:$,customInput:U}})},A=J?.title?K4(J.title,"title"):null,w=J?.description?K4(J.description,"description"):null;return wY.jsxDEV(N,{flexDirection:"column",paddingX:1,children:[A&&wY.jsxDEV(N,{marginBottom:1,children:wY.jsxDEV(O,{color:"cyan",bold:!0,children:A},void 0,!1,void 0,this)},void 0,!1,void 0,this),w&&wY.jsxDEV(N,{marginBottom:1,children:wY.jsxDEV(O,{dimColor:!0,children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),wY.jsxDEV(mY,{options:z,singleSelect:X.singleSelect,values:$,onChange:G,onSubmit:M,autoFocus:!0},void 0,!1,void 0,this),X.allowCustomInput&&wY.jsxDEV(N,{marginTop:1,flexDirection:"column",children:wY.jsxDEV(rZ,{value:U,onChange:F,onSubmit:M,placeholder:X.placeholder||"Type custom option...",autoFocus:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate(Z){if(Z.options.length===0)return"At least one option is required";if(Z.singleSelect&&Z.maxSelections&&Z.maxSelections>1)return"Single select cannot have maxSelections > 1";return},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var yX=L(x(),1);var UY=L(v(),1),e0={type:"input",render(Z,Y){let{content:X,metadata:J}=Z,[Q,$]=yX.useState(X.defaultValue||""),K=()=>{Y({state:"submitted",result:{value:Q}})};return UY.jsxDEV(N,{flexDirection:"column",paddingX:1,children:[J?.title&&UY.jsxDEV(N,{marginBottom:1,children:UY.jsxDEV(O,{color:"cyan",bold:!0,children:J.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),J?.description&&UY.jsxDEV(N,{marginBottom:1,children:UY.jsxDEV(O,{dimColor:!0,children:J.description},void 0,!1,void 0,this)},void 0,!1,void 0,this),UY.jsxDEV(N,{children:[UY.jsxDEV(rZ,{value:Q,onChange:$,onSubmit:K,placeholder:X.placeholder,autoFocus:!0},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),X.maxLength&&UY.jsxDEV(N,{marginTop:1,children:UY.jsxDEV(O,{dimColor:!0,children:["Max length: ",X.maxLength]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},validate(Z){if(Z.validation?.pattern&&Z.defaultValue){if(!Z.validation.pattern.test(Z.defaultValue))return"Input does not match required pattern"}if(Z.validation?.minLength&&Z.defaultValue&&Z.defaultValue.length<Z.validation.minLength)return`Input must be at least ${Z.validation.minLength} characters`;return},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var pY=L(v(),1),Z8={type:"confirm",render(Z,Y){let{content:X,metadata:J}=Z,Q=()=>{Y({state:"submitted",result:{confirmed:!0}})},$=()=>{Y({state:"cancelled",result:{confirmed:!1}})},K=[{label:X.confirmLabel||"Confirm",value:"confirm"},{label:X.cancelLabel||"Cancel",value:"cancel"}],U=([W])=>{if(W==="confirm")Q();else $()};return pY.jsxDEV(N,{flexDirection:"column",paddingX:1,children:[J?.title&&pY.jsxDEV(N,{marginBottom:1,children:pY.jsxDEV(O,{color:X.danger?"red":"cyan",bold:!0,children:J.title},void 0,!1,void 0,this)},void 0,!1,void 0,this),pY.jsxDEV(N,{marginBottom:1,children:pY.jsxDEV(O,{children:X.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),pY.jsxDEV(mY,{options:K,singleSelect:!0,onSubmit:U,autoFocus:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},defaultConfig:{layout:{border:!0,padding:1},interaction:{autoSubmit:!1}}};var iQ=L(x(),1);var rQ=L(v(),1);var zY=L(x(),1);var W4=L(x(),1);var UZ=L(v(),1),hX=({items:Z,defaultIndex:Y=0,onChange:X,disabled:J=!1,autoFocus:Q=!0,variant:$="line"})=>{let{isFocused:K}=kX({autoFocus:Q}),[U,W]=W4.useState(Y),z=W4.default.useMemo(()=>`tabs-${Math.random().toString(36).substring(2,9)}`,[]),H=W4.useCallback((M)=>{if(M<0||M>=Z.length||Z[M].disabled)return;W(M),X?.(M,Z[M])},[Z,X]);uZ((M,A)=>{if(J)return;if(A.leftArrow)H(U-1);else if(A.rightArrow)H(U+1)},{isActive:!J});let G=()=>{return Z.map((M,A)=>{let w=A===U,P=K&&!J,B;if($==="line")B=UZ.jsxDEV(N,{marginRight:1,children:[UZ.jsxDEV(O,{color:M.disabled?"gray":w?P?"green":"cyan":"gray",bold:w&&P,children:M.label},void 0,!1,void 0,this),w&&UZ.jsxDEV(O,{color:P?"green":"cyan",children:"_"},void 0,!1,void 0,this)]},`${z}-${M.id}`,!0,void 0,this);else if($==="enclosed"){let R=A===0||w?"┌":"─",C=A===Z.length-1||w?"┐":"─",D=A===0||w?"│":" ",j=A===Z.length-1||w?"│":" ",E=w?"─":" ",d=w?" ":"",i=M.disabled?"gray":w?P?"green":"cyan":"gray";B=UZ.jsxDEV(N,{children:UZ.jsxDEV(N,{flexDirection:"column",children:[UZ.jsxDEV(N,{children:[UZ.jsxDEV(O,{color:i,children:R},void 0,!1,void 0,this),UZ.jsxDEV(O,{color:i,bold:w&&P,children:[d,M.label,d]},void 0,!0,void 0,this),UZ.jsxDEV(O,{color:i,children:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w&&UZ.jsxDEV(N,{children:[UZ.jsxDEV(O,{color:i,children:D},void 0,!1,void 0,this),UZ.jsxDEV(O,{color:i,children:E.repeat(M.label.length+2)},void 0,!1,void 0,this),UZ.jsxDEV(O,{color:i,children:j},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},`${z}-${M.id}`,!1,void 0,this)}else{let R=w?"●":"○";B=UZ.jsxDEV(N,{marginRight:2,children:UZ.jsxDEV(O,{color:M.disabled?"gray":w?P?"green":"cyan":"gray",bold:w&&P,children:[R," ",M.label]},void 0,!0,void 0,this)},`${z}-${M.id}`,!1,void 0,this)}return B})},F=()=>{let M=Z[U];if(!M?.content)return null;return UZ.jsxDEV(N,{marginTop:1,paddingX:2,paddingY:1,flexDirection:"column",children:M.content},void 0,!1,void 0,this)};return UZ.jsxDEV(N,{flexDirection:"column",flexGrow:1,children:[UZ.jsxDEV(N,{children:G()},void 0,!1,void 0,this),Z.some((M)=>M.content)&&F()]},void 0,!0,void 0,this)};var xX=L(x(),1);var gX=L(v(),1),Y8=({interaction:Z,renderer:Y,onChange:X})=>{let J=xX.useMemo(()=>{return{layout:{border:!1,padding:0,...Y.defaultConfig?.layout,...Z.config.layout},interaction:{autoSubmit:!1,allowSkip:!1,showPreview:!0,...Y.defaultConfig?.interaction,...Z.config.interaction},style:{...Y.defaultConfig?.style,...Z.config.style}}},[Z.config,Y.defaultConfig]),Q=J.style.backgroundColor;return gX.jsxDEV(N,{backgroundColor:Q,paddingX:J.layout.padding,marginBottom:1,flexDirection:"column",children:Y.render({...Z,config:J},X)},void 0,!1,void 0,this)};r4();var BY=L(v(),1),oQ=(Z)=>{return K4(Z,"fullTitle")},X8=()=>{let Z=gZ(),[Y,X]=zY.useState(null),{focusNext:J,focus:Q}=KY(),$=zY.useMemo(()=>{return Z.getInteractions()},[Z.getInteractions()]);zY.useEffect(()=>{if($.length>0&&!Y)X($[0].id)},[$,Y]);let K=zY.useMemo(()=>{return $.map((G)=>{let F={idle:"\uD83D\uDD04",active:"\uD83D\uDD04",submitted:"✅",edited:"⛔",cancelled:"\uD83D\uDEAB"}[G.state]||"",M=oQ(G.metadata.title||G.content.type);return{id:G.id,label:`${F} ${M}`,content:null}})},[$]),U=zY.useCallback((G,F)=>{X(F.id)},[]),W=zY.useCallback((G)=>{if($.every((w)=>w.state==="submitted"||w.state==="edited"||w.state==="cancelled")){Q("global-input");return}let A=($.findIndex((w)=>w.id===G)+1)%$.length;X($[A].id)},[$,Q]),z=uX(()=>{J()});oZ(z,Y?100:null);let H=()=>{if(!Y)return null;let G=$.find((M)=>M.id===Y);if(!G)return null;let F=bY.get(G.content.type);if(!F)return BY.jsxDEV(N,{paddingX:1,children:BY.jsxDEV(O,{color:"red",children:["Unknown renderer: ",G.content.type]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return BY.jsxDEV(Y8,{interaction:G,renderer:F,onChange:(M)=>{if(Z.updateInteraction(G.id,M),M.state==="submitted"||M.state==="edited"||M.state==="cancelled")W(G.id)}},G.id,!1,void 0,this)};if($.length===0)return null;return BY.jsxDEV(N,{flexDirection:"column",borderColor:"cyan",borderStyle:"single",width:"100%",children:[BY.jsxDEV(N,{justifyContent:"space-between",paddingX:1,marginBottom:1,children:BY.jsxDEV(O,{color:"cyan",bold:!0,children:["Interactions (",$.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),BY.jsxDEV(N,{paddingX:1,marginBottom:1,children:BY.jsxDEV(hX,{items:K,defaultIndex:K.findIndex((G)=>G.id===Y),onChange:U,autoFocus:!0,variant:"line"},Y,!1,void 0,this)},void 0,!1,void 0,this),H()]},void 0,!0,void 0,this)};r4();function mX(){bY.register("approval",a0),bY.register("selection",t0),bY.register("input",e0),bY.register("confirm",Z8)}mX();var U4=L(v(),1);import{z as TY}from"zod";var nQ=TY.object({label:TY.string().min(1).max(50).describe("选项显示文本,简洁明了(1-50 字符)")}),aQ=TY.object({description:TY.string().min(1).describe("向用户提出的问题,清晰具体,包含必要的上下文"),type:TY.enum(["single_select","multi_select"]).describe("选择类型:single_select(单选)或 multi_select(多选)"),options:TY.array(nQ).min(2).max(6).describe("选项列表,至少 2 个,最多 6 个"),allow_custom_input:TY.boolean().default(!0).describe("是否允许用户输入自定义文本,默认 true"),placeholder:TY.string().optional().describe("自定义输入框的占位符文本")}),sQ=({tool:Z})=>{let{addInteraction:Y,getInteractions:X,updateInteraction:J}=gZ(),[Q,$]=dY.useState(null),K=dY.useRef(!1),U=Z.getInputRepaired();if(dY.useEffect(()=>{if(Z.state==="interrupted"&&!Q&&!K.current){let z={type:"selection",options:U.options?.map((G,F)=>({label:G.label,value:G.label}))||[],singleSelect:U.type==="single_select",allowCustomInput:U.allow_custom_input??!0,placeholder:U.placeholder},H=Y(z,{tool:Z,metadata:{title:U.description||"请选择一个选项",groupKey:"user-input"}});$(H.id)}},[Z,Q,Y,U]),dY.useEffect(()=>{if(!Q||K.current)return;let W=()=>{let G=X().find((F)=>F.id===Q);if(G&&(G.state==="submitted"||G.state==="edited"||G.state==="cancelled")&&!G.resultSent){K.current=!0;let F=G.result,M="";if(F){if(F.selected&&F.selected.length>0)M+=`User selected:
|
|
37
|
+
${F.selected.join(`
|
|
38
|
+
- `)}`;if(F.customInput&&F.customInput.trim())M+=(M?`
|
|
39
|
+
`:"")+`User Custom Input: ${F.customInput}`}Z.sendResumeData({type:"respond",message:M||"User made a selection"}),J(Q,{resultSent:!0})}};W();let z=setInterval(W,100);return()=>clearInterval(z)},[Q,X,J,Z]),Z.state==="interrupted"&&!Z.output)return U4.jsxDEV(N,{flexDirection:"column",children:U4.jsxDEV(N,{paddingX:1,children:U4.jsxDEV(O,{color:"yellow",children:"⏳ 等待用户选择..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(Z.output)return U4.jsxDEV(O,{color:"yellow",children:Z.output},void 0,!1,void 0,this);return null},pX=t({name:"ask_user_questions",description:"Ask the user a question with selectable options",parameters:aQ,handler:ZZ.waitForUIDone,render(Z){return U4.jsxDEV(sQ,{tool:Z},void 0,!1,void 0,this)}});var cY=L(x(),1);var w4=L(v(),1),z4=({content:Z,maxLines:Y=10,borderColor:X="cyan",borderStyle:J="single",marginTop:Q=0,paddingX:$=0,showOmittedInfo:K=!0})=>{if(!Z)return null;let{width:U}=dX(),W=Z.split(`
|
|
40
|
+
`).map((G)=>G.slice(0,U-10)),z=Math.max(0,W.length-Y),H=W.slice(-Y).join(`
|
|
41
|
+
`);return w4.jsxDEV(N,{flexDirection:"column",width:U-5,children:w4.jsxDEV(N,{borderStyle:J,borderColor:X,borderLeft:!1,borderRight:!1,flexDirection:"column",paddingX:$,marginTop:Q,children:[K&&z>0&&w4.jsxDEV(O,{color:"gray",dimColor:!0,children:["... ",z," lines omitted ..."]},void 0,!0,void 0,this),w4.jsxDEV(O,{dimColor:!0,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)};var EZ=L(v(),1),tQ=({tool:Z})=>{let{addInteraction:Y,getInteractions:X,updateInteraction:J}=gZ(),[Q,$]=cY.useState(null),K=cY.useRef(!1),U=Z.getHumanInTheLoopData();if(cY.useEffect(()=>{if(U?.reviewConfig&&Z.state==="interrupted"&&!Q&&!K.current){let z=Z.getInputRepaired()?.description,H={type:"approval",toolCall:{name:Z.message.name,args:Z.getInputRepaired()},editableFields:["args"]},G=Y(H,{tool:Z,metadata:{title:`Approve ${Z.message.name}`,description:z,groupKey:"approvals"}});$(G.id)}},[U,Z,Q,Y]),cY.useEffect(()=>{if(!Q||K.current)return;let z=()=>{let F=X().find((M)=>M.id===Q);if(F&&(F.state==="submitted"||F.state==="edited"||F.state==="cancelled")&&!F.resultSent){K.current=!0;let M=F.result;if(M){if(M.status==="approved")Z.sendResumeData({type:"approve"});else if(M.status==="edited"){let A={name:Z.message.name,args:M.editedArgs};Z.sendResumeData({type:"edit",edited_action:A})}else if(M.status==="rejected"){let A=M.message||"User rejected to run this tool";Z.sendResumeData({type:"reject",message:A})}}J(Q,{resultSent:!0})}};z();let H=setInterval(z,100);return()=>clearInterval(H)},[Q,X,J,Z]),U?.reviewConfig&&Q&&!Z.output)return EZ.jsxDEV(N,{flexDirection:"column",children:EZ.jsxDEV(N,{paddingX:1,paddingY:1,children:EZ.jsxDEV(O,{color:"yellow",children:"⏳ Wait for Approval"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return EZ.jsxDEV(N,{flexDirection:"column",children:(()=>{if(!Z.output)return null;return EZ.jsxDEV(z4,{content:Z.output,maxLines:5,borderColor:"cyan"},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)},eQ=({tool:Z})=>{let X=Z.getInputRepaired()?.command||"",J=X.length>50?X.substring(0,50)+"...":X;return EZ.jsxDEV(N,{paddingX:1,children:[EZ.jsxDEV(O,{color:"magenta",children:"Run "},void 0,!1,void 0,this),EZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),EZ.jsxDEV(O,{color:"magenta",children:J},void 0,!1,void 0,this),EZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},cX=t({name:"terminal",description:"",parameters:{},handler:ZZ.waitForUIDone,render(Z){return EZ.jsxDEV(N,{flexDirection:"column",children:[EZ.jsxDEV(eQ,{tool:Z},void 0,!1,void 0,this),EZ.jsxDEV(tQ,{tool:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});import{diff_match_patch as Z$}from"diff-match-patch";function Y$(Z,Y,X){if(Z===Y)return[{type:"unchanged",content:Z,lineNumbers:{old:1,new:1}}];let J=new Z$,Q=J.diff_main(Z,Y);J.diff_cleanupSemantic(Q);let $=[],K=1,U=1,W=[];for(let[P,B]of Q){if(B==="")continue;let R=B.split(`
|
|
42
|
+
`),C=B.endsWith(`
|
|
43
|
+
`);for(let D=0;D<R.length;D++){let j=R[D];if(j===""&&(D<R.length-1||!C))continue;let E={type:P===0?"unchanged":P===-1?"added":"removed",content:j};if(P===0)E.lineNumbers={old:K,new:U},K++,U++;else if(P===-1)E.lineNumbers={new:U},U++;else if(P===1)E.lineNumbers={old:K},K++;W.push(E)}}if(!X?.maxLines)return W;let z=X.maxLines,H=X.contextLines||3,G=W.map((P,B)=>P.type!=="unchanged"?B:-1).filter((P)=>P!==-1);if(G.length===0||W.length<=z)return W;let F=[],M=0,A=[],w=[];for(let P=0;P<G.length;P++)if(w.length===0)w.push(G[P]);else{let B=w[w.length-1];if(G[P]-B<=1)w.push(G[P]);else A.push([...w]),w=[G[P]]}if(w.length>0)A.push(w);for(let P of A){if(M>=z)break;let B=P[0],R=P[P.length-1],C=Math.max(0,B-H),D=Math.min(W.length-1,R+H),j=D-C+1;if(M+j>z&&M>0){F.push({type:"unchanged",content:"..."});break}for(let E=C;E<=D;E++){if(M>=z){if(E<D)F.push({type:"unchanged",content:"..."});break}F.push(W[E]),M++}if(P===A[A.length-1]&&M<W.length){let E=W.length-D-1;if(E>0)F.push({type:"unchanged",content:`... (${E} more lines)`})}}return F}function lX(Z,Y=1000){return Z=Z||"",Z.length>Y||Z.split(`
|
|
44
|
+
`).length>50}function iX(Z,Y,X){let J=lX(Z)||lX(Y),$=X!==void 0&&"maxLines"in X?X.maxLines:J?10:20,K=X?.contextLines??(J?1:3);return Y$(Z,Y,{maxLines:$,contextLines:K})}var H4=L(v(),1),X$=["sky","primary"];function J$(Z){let Y=Z%2;return bZ(X$[Y])}function Q$(Z){let Y=[];if(Z.startsWith("/"))Y.push({type:"separator",value:"/"}),Z=Z.slice(1);let X=Z.split("/");return X.forEach((J,Q)=>{if(J)Y.push({type:"segment",value:J});if(Q<X.length-1)Y.push({type:"separator",value:"/"})}),Y}var $$=({path:Z,color:Y="cyan",line:X,rainbow:J=!1})=>{let Q=rX(Z)??"",$=X!==void 0?`:${X}`:"";if(!J)return H4.jsxDEV(O,{color:bZ(Y),children:[Q,$]},void 0,!0,void 0,this);let K=Q$(Q),U=-1;for(let z=K.length-1;z>=0;z--)if(K[z].type==="segment"){U=z;break}let W=0;return H4.jsxDEV(O,{children:[K.map((z,H)=>{if(z.type==="separator")return H4.jsxDEV(O,{dimColor:!0,color:"gray",children:z.value},`sep-${H}`,!1,void 0,this);let G=H===U,F=J$(W);return W++,H4.jsxDEV(O,{color:F,dimColor:!G,children:z.value},`seg-${H}`,!1,void 0,this)}),$&&H4.jsxDEV(O,{color:"gray",children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},jZ=$$;var zZ=L(v(),1),nX=t({name:"edit_file",description:"Performs exact string replacements in files with diff visualization",parameters:oX.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output,J=Y.old_string&&Y.new_string&&Y.old_string!==Y.new_string,Q=0,$=0;if(J){let K=iX(Y.old_string,Y.new_string,{maxLines:void 0});for(let U of K){if(U.type==="removed")Q++;if(U.type==="added")$++}}return zZ.jsxDEV(N,{flexDirection:"column",paddingX:1,children:[zZ.jsxDEV(N,{children:[zZ.jsxDEV(O,{color:"yellow",children:"Edit "},void 0,!1,void 0,this),zZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),zZ.jsxDEV(jZ,{path:Y.file_path,rainbow:!0},void 0,!1,void 0,this),zZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),J&&zZ.jsxDEV(zZ.Fragment,{children:[zZ.jsxDEV(O,{color:"gray",children:" ("},void 0,!1,void 0,this),zZ.jsxDEV(O,{color:"red",children:["-",Q]},void 0,!0,void 0,this),zZ.jsxDEV(O,{color:"gray",children:"/"},void 0,!1,void 0,this),zZ.jsxDEV(O,{color:"green",children:["+",$]},void 0,!0,void 0,this),zZ.jsxDEV(O,{color:"gray",children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X&&X.startsWith("Error:")&&zZ.jsxDEV(N,{marginTop:0,marginLeft:1,marginBottom:1,children:zZ.jsxDEV(O,{color:"red",children:X},void 0,!1,void 0,this)},void 0,!1,void 0,this),!X&&zZ.jsxDEV(N,{marginTop:0,children:zZ.jsxDEV(O,{color:"gray",children:"Press Enter to confirm, Ctrl+C to cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var nZ=L(v(),1),K$={pending:"gray",in_progress:"yellow",completed:"green"},W$={pending:"○",in_progress:"◐",completed:"✓"},sX=t({name:"todo_write",description:"Use this tool to create and manage a structured task list",parameters:aX.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired();if(!Y||!Y.todos||!Array.isArray(Y.todos))return nZ.jsxDEV(N,{flexDirection:"column",borderStyle:"round",borderColor:"red",children:nZ.jsxDEV(O,{color:"red",children:"Error: Invalid todo data structure"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let X=Y.todos;return nZ.jsxDEV(N,{flexDirection:"column",paddingY:1,children:nZ.jsxDEV(N,{flexDirection:"column",marginTop:0,children:(()=>{if(X.length===0)return nZ.jsxDEV(N,{paddingX:1,children:nZ.jsxDEV(O,{color:"gray",children:"No tasks in todo list"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return nZ.jsxDEV(N,{flexDirection:"column",marginTop:0,children:X.map((Q,$)=>nZ.jsxDEV(N,{paddingX:1,paddingY:0,children:[nZ.jsxDEV(O,{color:K$[Q.status],bold:!0,children:[W$[Q.status]," "]},void 0,!0,void 0,this),nZ.jsxDEV(O,{color:Q.status==="in_progress"?"white":"gray",children:[$+1,". ",Q.content]},void 0,!0,void 0,this)]},Q.id,!0,void 0,this))},void 0,!1,void 0,this)})()},void 0,!1,void 0,this)},void 0,!1,void 0,this)}});var aZ=L(v(),1),eX=t({name:"read_file",description:"Reads a file from the local filesystem",parameters:tX.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return aZ.jsxDEV(aZ.Fragment,{},void 0,!1,void 0,this);let Q=X.split(`
|
|
45
|
+
`).length;return aZ.jsxDEV(N,{flexDirection:"column",paddingX:1,children:aZ.jsxDEV(N,{children:[aZ.jsxDEV(O,{color:"blue",children:"Read "},void 0,!1,void 0,this),aZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),aZ.jsxDEV(jZ,{path:Y.file_path,rainbow:!0},void 0,!1,void 0,this),aZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),aZ.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","(",Q," lines)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});var sZ=L(v(),1),Y5=t({name:"glob_files",description:"Find files by name patterns",parameters:Z5.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return sZ.jsxDEV(sZ.Fragment,{},void 0,!1,void 0,this);let Q=X.split(`
|
|
46
|
+
`).filter(Boolean).length;return sZ.jsxDEV(N,{flexDirection:"column",paddingX:1,children:sZ.jsxDEV(O,{children:[sZ.jsxDEV(O,{color:"cyan",children:"Glob "},void 0,!1,void 0,this),sZ.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),sZ.jsxDEV(jZ,{path:Y.pattern,rainbow:!0},void 0,!1,void 0,this),sZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),sZ.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","(",Q," files)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});var _Z=L(v(),1),X5=t({name:"search_files_rg",description:"Ripgrep - fast text search tool",parameters:{},handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return _Z.jsxDEV(_Z.Fragment,{},void 0,!1,void 0,this);let Q=X.split(`
|
|
47
|
+
`).filter(Boolean).length,$=Y.pattern,K=Y.path;if(!$){let W=(Y.args||[]).filter((z)=>!z.startsWith("-"));if(W.length>0){if(K=W[W.length-1],W.length>1)$=W[W.length-2]}}return _Z.jsxDEV(N,{flexDirection:"column",paddingX:1,children:_Z.jsxDEV(O,{children:[_Z.jsxDEV(O,{color:"magenta",children:"Ripgrep "},void 0,!1,void 0,this),$&&_Z.jsxDEV(_Z.Fragment,{children:[_Z.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),_Z.jsxDEV(jZ,{path:$,color:"magenta"},void 0,!1,void 0,this),_Z.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K&&K!=="./"&&_Z.jsxDEV(_Z.Fragment,{children:[_Z.jsxDEV(O,{dimColor:!0,children:" in "},void 0,!1,void 0,this),_Z.jsxDEV(jZ,{path:K,rainbow:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_Z.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","(",Q," matches)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});import{z as n4}from"zod";var HY=L(v(),1),U$=n4.object({description:n4.string().optional(),file_path:n4.string(),content:n4.string()}),J5=t({name:"write_file",description:"Writes a file to the local filesystem",parameters:U$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output,J=Y.content?.split(`
|
|
48
|
+
`)?.length;return HY.jsxDEV(N,{flexDirection:"column",paddingX:1,children:[HY.jsxDEV(N,{children:[HY.jsxDEV(O,{color:"green",children:"Write "},void 0,!1,void 0,this),HY.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),HY.jsxDEV(jZ,{path:Y.file_path,rainbow:!0},void 0,!1,void 0,this),HY.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this),HY.jsxDEV(O,{dimColor:!0,children:[" (",J," lines)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X&&X.startsWith("Error:")&&HY.jsxDEV(N,{marginTop:0,marginLeft:1,marginBottom:1,children:HY.jsxDEV(O,{color:"red",children:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var CZ=L(v(),1),z$=J8.schema,Q5=t({name:"folder_operations",description:"Unified folder operations tool supporting create, list, delete, and existence check",parameters:z$.shape,handler:async(Z)=>{return await J8.invoke(Z)},render(Z){let Y=Z.getInputRepaired(),X=Z.output;if(!X)return CZ.jsxDEV(CZ.Fragment,{},void 0,!1,void 0,this);let Q={create:"green",list:"blue",exists:"yellow",delete:"red"}[Y?.operation]||"cyan",K=X.split(`
|
|
49
|
+
`).map((U,W)=>{if(U.match(/\d+ \w+|[\d-]+ [\d:]+/))return CZ.jsxDEV(O,{dimColor:!0,children:U},W,!1,void 0,this);if(U.includes("✓")||U.includes("successfully")||U.includes("created")||U.includes("deleted"))return CZ.jsxDEV(O,{color:"green",children:U},W,!1,void 0,this);if(U.includes("✗")||U.includes("Error")||U.includes("not found")||U.includes("failed"))return CZ.jsxDEV(O,{color:"red",children:U},W,!1,void 0,this);if(U.startsWith("/")||U.includes("/:"))return CZ.jsxDEV(O,{color:"cyan",children:U},W,!1,void 0,this);return CZ.jsxDEV(O,{children:U},W,!1,void 0,this)});return CZ.jsxDEV(N,{flexDirection:"column",paddingX:1,children:CZ.jsxDEV(N,{children:[CZ.jsxDEV(O,{bold:!0,color:Q,children:[Y.operation,"Folder"]},void 0,!0,void 0,this),CZ.jsxDEV(O,{dimColor:!0,children:" ("},void 0,!1,void 0,this),CZ.jsxDEV(jZ,{path:Y.folder_path,rainbow:!0},void 0,!1,void 0,this),CZ.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}});import{z as H$}from"zod";var MZ=L(v(),1),G$=H$.object({}),$5=t({name:"load_mcp_tools",description:`加载并查询所有可用的 MCP 工具列表。
|
|
50
50
|
|
|
51
51
|
返回:
|
|
52
52
|
- tools: MCP 工具列表,每个工具包含 name, description, schema
|
|
@@ -57,7 +57,7 @@ ${L.selected.join(`
|
|
|
57
57
|
- 获取工具的参数格式
|
|
58
58
|
- 检查 MCP 连接状态
|
|
59
59
|
|
|
60
|
-
重要:工具列表是动态的,建议在需要时调用此命令获取最新信息。`,parameters:
|
|
60
|
+
重要:工具列表是动态的,建议在需要时调用此命令获取最新信息。`,parameters:G$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.output,X=null;try{X=JSON.parse(Y)}catch(J){}return MZ.jsxDEV(N,{flexDirection:"column",children:[MZ.jsxDEV(N,{children:MZ.jsxDEV(O,{color:"blue",bold:!0,children:"load_mcp_tools"},void 0,!1,void 0,this)},void 0,!1,void 0,this),X?.status&&MZ.jsxDEV(N,{flexDirection:"column",marginTop:1,children:[MZ.jsxDEV(O,{color:"green",children:"✓ MCP 已连接"},void 0,!1,void 0,this),X.status.servers&&X.status.servers.length>0&&MZ.jsxDEV(N,{marginLeft:2,children:MZ.jsxDEV(O,{color:"gray",children:["服务器: ",X.status.servers.join(", ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),X.status.toolCount!==void 0&&MZ.jsxDEV(N,{marginLeft:2,children:MZ.jsxDEV(O,{color:"gray",children:["工具数量: ",X.status.toolCount]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X?.tools&&X.tools.length>0&&MZ.jsxDEV(N,{flexDirection:"column",marginTop:1,children:[MZ.jsxDEV(O,{color:"gray",dimColor:!0,children:["可用工具 (",X.tools.length,"):"]},void 0,!0,void 0,this),X.tools.slice(0,5).map((J,Q)=>MZ.jsxDEV(N,{marginLeft:2,children:[MZ.jsxDEV(O,{color:"cyan",children:J.name},void 0,!1,void 0,this),J.description&&MZ.jsxDEV(O,{color:"gray",dimColor:!0,children:[" ","- ",J.description.slice(0,50),J.description.length>50?"...":""]},void 0,!0,void 0,this)]},Q,!0,void 0,this)),X.tools.length>5&&MZ.jsxDEV(N,{marginLeft:2,children:MZ.jsxDEV(O,{color:"gray",dimColor:!0,children:["... 还有 ",X.tools.length-5," 个工具"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&MZ.jsxDEV(z4,{content:Y,maxLines:10,borderColor:"gray"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});import{z as lY}from"zod";var TZ=L(v(),1),O$=lY.object({commands:lY.array(lY.object({name:lY.string().describe("MCP 工具名称"),args:lY.record(lY.string(),lY.any()).describe("工具参数,JSON 对象格式")})).describe("要执行的 MCP 工具列表")}),K5=t({name:"execute_mcp_tool",description:`执行一个或多个 MCP 工具。
|
|
61
61
|
|
|
62
62
|
使用格式:
|
|
63
63
|
- commands: MCP 工具数组,每个工具包含 name 和 args
|
|
@@ -69,54 +69,130 @@ ${L.selected.join(`
|
|
|
69
69
|
重要:
|
|
70
70
|
- 所有工具独立执行,失败不影响其他工具
|
|
71
71
|
- 返回结果按命令顺序排列
|
|
72
|
-
- 适合批量执行 MCP 相关操作`,parameters:
|
|
73
|
-
========================================`),console.error(`[${
|
|
74
|
-
`),this.setState({errorInfo
|
|
72
|
+
- 适合批量执行 MCP 相关操作`,parameters:O$.shape,handler:ZZ.waitForUIDone,render(Z){let Y=Z.getInputRepaired(),X=Z.output,J=null;try{J=JSON.parse(X)}catch(Q){}return TZ.jsxDEV(N,{flexDirection:"column",children:[TZ.jsxDEV(N,{children:TZ.jsxDEV(O,{color:"blue",bold:!0,children:"execute_mcp_tool"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y?.commands&&Y.commands.length>0&&TZ.jsxDEV(N,{flexDirection:"column",marginTop:1,children:[TZ.jsxDEV(O,{color:"gray",dimColor:!0,children:["执行 ",Y.commands.length," 个 MCP 工具:"]},void 0,!0,void 0,this),Y.commands.map((Q,$)=>TZ.jsxDEV(N,{marginLeft:2,children:[TZ.jsxDEV(O,{color:"yellow",children:[$+1,"."]},void 0,!0,void 0,this),TZ.jsxDEV(O,{color:"cyan",children:Q.name},void 0,!1,void 0,this)]},$,!0,void 0,this))]},void 0,!0,void 0,this),J?.results&&TZ.jsxDEV(N,{flexDirection:"column",marginTop:1,children:J.results.map((Q,$)=>TZ.jsxDEV(N,{marginLeft:2,children:Q.error?TZ.jsxDEV(O,{color:"red",children:["✗ ",Q.tool]},void 0,!0,void 0,this):TZ.jsxDEV(O,{color:"green",children:["✓ ",Q.tool]},void 0,!0,void 0,this)},$,!1,void 0,this))},void 0,!1,void 0,this),X&&TZ.jsxDEV(z4,{content:X,maxLines:10,borderColor:"gray"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}});var GY=L(v(),1);import{z as G4}from"zod";var q$=G4.object({task_id:G4.string().optional().describe("The task id to ask the subagent"),subagent_id:G4.string().describe("The id of subagent to use"),subagent_type:G4.string().describe("The type of subagent to use (general-purpose, statusline-setup, output-style-setup)"),task_description:G4.string().describe("Describe what you want the subagent to do"),data_transfer:G4.any().optional().describe("Data to transfer to the subagent")}),F$=({tool:Z})=>{let Y=Z.getInputRepaired();return GY.jsxDEV(N,{paddingX:1,flexDirection:"column",children:GY.jsxDEV(N,{children:[GY.jsxDEV(O,{color:"yellow",children:"Task "},void 0,!1,void 0,this),GY.jsxDEV(O,{dimColor:!0,children:"("},void 0,!1,void 0,this),GY.jsxDEV(O,{color:"cyan",children:Y.subagent_id},void 0,!1,void 0,this),GY.jsxDEV(O,{dimColor:!0,children:")"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},M$=({tool:Z})=>{let Y=Z.getInputRepaired(),X=Z.output;return GY.jsxDEV(N,{flexDirection:"column",children:GY.jsxDEV(F$,{tool:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},W5=t({name:"task",description:"Launch a subagent to handle complex tasks autonomously",parameters:q$.shape,handler:ZZ.waitForUIDone,render(Z){return GY.jsxDEV(M$,{tool:Z},void 0,!1,void 0,this)}});var U5=[cX,pX,nX,sX,eX,Y5,X5,J5,Q5,$5,K5,W5];var e=L(x(),1);var b=L(v(),1),N$=({validation:Z,onComplete:Y})=>{let{config:X,updateConfig:J}=WZ(),[Q,$]=e.useState("welcome"),[K,U]=e.useState(!1),[W,z]=e.useState(null),[H,G]=e.useState(0),[F,M]=e.useState(null),A=e.useRef(!0),w=e.useRef([]),P=e.useRef(H),B=X?.providers||[];e.useEffect(()=>{w.current=B},[B]),e.useEffect(()=>{P.current=H},[H]);let R=B[H],C=e.useCallback(()=>M(null),[]);oZ(C,F?3000:null);let D=e.useCallback(()=>{A.current=!0,z(null),U(!0),M(null)},[]),j=e.useCallback(()=>{let g=w.current,r=P.current,o=g[r];if(!o)return;A.current=!1,z(o),U(!0),M(null)},[]),E=e.useCallback(()=>{U(!1),z(null),M(null)},[]),d=e.useCallback(async(g)=>{let r=w.current,o=A.current,FY=o?[...r,g]:r.map((MY)=>MY.id===g.id?g:MY);if(await J({providers:FY}),M(o?`已添加 Provider: ${g.id}`:`已更新 Provider: ${g.id}`),o){let MY=FY.findIndex((xZ)=>xZ.id===g.id);G(MY>=0?MY:0)}E()},[J,E]),i=e.useCallback(()=>{if(!R||!R.apiKey){M("请先配置 Provider 的 API Key");return}J({provider_id:R.id,provider_type:R.type}).then(()=>{$("model")})},[R,J]);if(uZ((g,r)=>{if(r.return||g===" ")$("provider")},{isActive:Q==="welcome"}),uZ((g,r)=>{if(K)return;if(r.upArrow)G((o)=>o>0?o-1:B.length-1);else if(r.downArrow)G((o)=>o<B.length-1?o+1:0);else if(g==="n"||g==="N")D();else if((g==="e"||g==="E"||r.return)&&R)j();else if(g==="s"||g==="S")i()},{isActive:Q==="provider"}),Q==="welcome")return b.jsxDEV(N,{flexDirection:"column",paddingX:2,paddingY:1,width:"100%",children:[b.jsxDEV(N,{marginBottom:1,children:b.jsxDEV(O,{bold:!0,color:"cyan",children:"欢迎使用 Zen Code"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b.jsxDEV(N,{marginBottom:1,children:b.jsxDEV(O,{color:"yellow",children:Z.reason||"需要进行初始配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b.jsxDEV(N,{flexDirection:"column",marginBottom:1,children:[b.jsxDEV(O,{dimColor:!0,children:"接下来将引导你完成:"},void 0,!1,void 0,this),b.jsxDEV(O,{dimColor:!0,children:" 1. 配置 Provider(API 服务提供商)"},void 0,!1,void 0,this),b.jsxDEV(O,{dimColor:!0,children:" 2. 选择 Model(AI 模型)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b.jsxDEV(N,{children:b.jsxDEV(O,{color:"green",bold:!0,children:"按 Enter 开始配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="provider")return b.jsxDEV(N,{flexDirection:"column",width:"100%",children:[b.jsxDEV(N,{paddingX:2,paddingY:1,children:b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 1/2: Provider 配置"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K?b.jsxDEV(H5,{provider:W||void 0,onCancel:E,onSave:d},void 0,!1,void 0,this):b.jsxDEV(b.Fragment,{children:b.jsxDEV(N,{flexDirection:"column",paddingX:2,gap:1,children:[B.length===0?b.jsxDEV(N,{paddingY:1,children:b.jsxDEV(O,{color:"yellow",children:"未配置任何 Provider,请按 'n' 新增"},void 0,!1,void 0,this)},void 0,!1,void 0,this):B.map((g,r)=>{let o=!!g.apiKey,FY=o?"green":"yellow";return b.jsxDEV(N,{marginBottom:0,gap:1,children:[b.jsxDEV(O,{color:r===H?"cyan":"gray",bold:r===H,children:r===H?">":" "},void 0,!1,void 0,this),b.jsxDEV(O,{bold:r===H,color:r===H?"cyan":void 0,children:g.id},void 0,!1,void 0,this),b.jsxDEV(O,{color:"gray",dimColor:r!==H,children:[" ",g.type]},void 0,!0,void 0,this),b.jsxDEV(O,{color:FY,dimColor:r!==H,children:[" ","[",o?"已配置":"未配置","]"]},void 0,!0,void 0,this)]},g.id,!0,void 0,this)}),b.jsxDEV(N,{marginTop:1,children:[b.jsxDEV(O,{color:"gray",dimColor:!0,children:[b.jsxDEV(O,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",b.jsxDEV(O,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增"," ",b.jsxDEV(O,{color:"cyan",children:"e/Enter"},void 0,!1,void 0,this)," 编辑"," "]},void 0,!0,void 0,this),B.some((g)=>g.apiKey)&&b.jsxDEV(O,{children:[b.jsxDEV(O,{color:"green",children:"s"},void 0,!1,void 0,this)," 下一步"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),F&&b.jsxDEV(N,{paddingX:2,paddingY:0,children:b.jsxDEV(O,{color:"green",children:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(Q==="model")return b.jsxDEV(A$,{onComplete:Y,onBack:()=>$("provider")},void 0,!1,void 0,this);return null},A$=({onComplete:Z,onBack:Y})=>{let{config:X,updateConfig:J}=WZ(),[Q,$]=e.useState(0),K=e.useMemo(()=>{return X?.providers.find((G)=>G.id===X.provider_id)||null},[X?.providers,X?.provider_id]),{data:U=[],isLoading:W,error:z}=z5({provider:K,enabled:!!K?.apiKey}),H=U[Q];if(uZ((G,F)=>{if(F.upArrow)$((M)=>M>0?M-1:U.length-1);else if(F.downArrow)$((M)=>M<U.length-1?M+1:0);else if(F.escape||G==="b"||G==="B")Y();else if((F.return||G===" ")&&H)J({model_id:H.id}).then(()=>{Z()})},{isActive:!W&&!z&&X!==null}),W)return b.jsxDEV(N,{flexDirection:"column",paddingX:2,paddingY:1,children:[b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),b.jsxDEV(N,{marginTop:1,children:b.jsxDEV(O,{color:"gray",children:"加载模型列表中..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(z)return b.jsxDEV(N,{flexDirection:"column",paddingX:2,paddingY:1,children:[b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),b.jsxDEV(N,{marginTop:1,children:b.jsxDEV(O,{color:"red",children:["加载失败: ",z.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b.jsxDEV(N,{marginTop:1,children:b.jsxDEV(O,{color:"gray",dimColor:!0,children:["按 ",b.jsxDEV(O,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 返回上一步"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return b.jsxDEV(N,{flexDirection:"column",width:"100%",children:[b.jsxDEV(N,{paddingX:2,paddingY:1,children:[b.jsxDEV(O,{bold:!0,color:"cyan",children:"步骤 2/2: Model 选择"},void 0,!1,void 0,this),K&&b.jsxDEV(O,{dimColor:!0,children:[" ","- ",K.id," (",K.type,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b.jsxDEV(N,{flexDirection:"column",paddingX:2,gap:0,children:U.map((G,F)=>b.jsxDEV(N,{marginBottom:0,gap:1,children:[b.jsxDEV(O,{color:F===Q?"cyan":"gray",bold:F===Q,children:F===Q?">":" "},void 0,!1,void 0,this),b.jsxDEV(O,{bold:F===Q,color:F===Q?"cyan":void 0,children:G.id},void 0,!1,void 0,this),G.name!==G.id&&b.jsxDEV(O,{dimColor:F!==Q,children:["(",G.name,")"]},void 0,!0,void 0,this)]},G.id,!0,void 0,this))},void 0,!1,void 0,this),b.jsxDEV(N,{marginTop:1,paddingX:2,children:b.jsxDEV(O,{color:"gray",dimColor:!0,children:[b.jsxDEV(O,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",b.jsxDEV(O,{color:"cyan",children:"Enter/Space"},void 0,!1,void 0,this)," 确认"," ",b.jsxDEV(O,{color:"cyan",children:"Esc/B"},void 0,!1,void 0,this)," 返回"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},G5=N$;var O5=L(x(),1);var HZ=L(v(),1);class q5 extends O5.Component{state={hasError:!1,error:null,errorInfo:null};static getDerivedStateFromError(Z){return{hasError:!0,error:Z}}componentDidCatch(Z,Y){let{name:X="ErrorBoundary"}=this.props;console.error(`
|
|
73
|
+
========================================`),console.error(`[${X}] React Error Caught`),console.error("========================================"),console.error("Error:",Z.message),console.error("Stack:",Z.stack),console.error("Component Stack:",Y.componentStack),console.error(`========================================
|
|
74
|
+
`),this.setState({errorInfo:Y})}render(){let{hasError:Z,error:Y,errorInfo:X}=this.state,{name:J="ErrorBoundary",fallback:Q,children:$}=this.props;if(Z){if(Q)return HZ.jsxDEV(HZ.Fragment,{children:Q},void 0,!1,void 0,this);return HZ.jsxDEV(N,{flexDirection:"column",padding:1,borderStyle:"double",borderColor:"red",children:[HZ.jsxDEV(N,{marginBottom:1,children:HZ.jsxDEV(O,{color:"red",bold:!0,children:["✗ [",J,"] Render Error"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),HZ.jsxDEV(N,{marginBottom:1,children:HZ.jsxDEV(O,{color:"red",children:["Message: ",Y?.message||"Unknown error"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Y?.stack&&HZ.jsxDEV(N,{flexDirection:"column",marginBottom:1,children:[HZ.jsxDEV(O,{color:"yellow",bold:!0,children:"Stack Trace:"},void 0,!1,void 0,this),HZ.jsxDEV(O,{color:"gray",children:Y.stack.split(`
|
|
75
75
|
`).slice(0,5).join(`
|
|
76
|
-
`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),
|
|
76
|
+
`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X?.componentStack&&HZ.jsxDEV(N,{flexDirection:"column",children:[HZ.jsxDEV(O,{color:"yellow",bold:!0,children:"Component Stack:"},void 0,!1,void 0,this),HZ.jsxDEV(O,{color:"gray",dimColor:!0,children:X.componentStack.split(`
|
|
77
77
|
`).slice(0,5).join(`
|
|
78
|
-
`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),
|
|
79
|
-
`).
|
|
80
|
-
|
|
81
|
-
`)
|
|
82
|
-
`)
|
|
83
|
-
`)
|
|
84
|
-
`)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
`:
|
|
89
|
-
|
|
78
|
+
`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),HZ.jsxDEV(N,{marginTop:1,children:HZ.jsxDEV(O,{color:"blue",dimColor:!0,children:"Press Ctrl+C to exit"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}return HZ.jsxDEV(HZ.Fragment,{children:$},void 0,!1,void 0,this)}}var n=q5;var O4=L(v(),1),_$=({children:Z})=>{let{extraParams:Y,toggleCompactMode:X,config:J}=WZ(),{setTools:Q,loading:$}=KZ(),{hasPendingInteractions:K}=gZ();wX({tools:U5,setTools:Q});let{needsSetup:U,validation:W}=PX({config:J});RX({shouldFocus:!$});let z=vX(),{isChatView:H}=z,{handleExecuteTask:G}=IX({closePanel:z.closePanel});if(uZ((M,A)=>{if(A.ctrl&&M==="o"&&H&&!$)X();else if(A.ctrl&&M==="z"&&globalThis.Bun)import("v8").then((w)=>{w.writeHeapSnapshot("my-application.heapsnapshot")})},{isActive:H}),U&&W)return O4.jsxDEV(n,{name:"SetupWizard",fallback:null,children:O4.jsxDEV(G5,{validation:W,onComplete:z.closePanel},void 0,!1,void 0,this)},void 0,!1,void 0,this);let F={activeView:z.activeView,isChatView:z.isChatView,switchToHistory:z.switchToHistory,switchToKnowledge:z.switchToKnowledge,switchToSettings:z.switchToSettings,switchToModelProvider:z.switchToModelProvider,switchToAgent:z.switchToAgent,switchToTask:z.switchToTask,switchToMcp:z.switchToMcp,closePanel:z.closePanel,handleExecuteTask:G,hasPendingInteractions:K};return O4.jsxDEV(n,{name:"ChatPanelContext",fallback:null,children:O4.jsxDEV(VX,{value:F,children:Z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},F5=({children:Z})=>{return O4.jsxDEV(_$,{children:Z},void 0,!1,void 0,this)};var IY=L(x(),1);var S0=L(x(),1);var LY=L(v(),1),w$=({content:Z,messageNumber:Y})=>{let X=a4(),J=()=>{if(typeof Z==="string")return LY.jsxDEV(O,{color:"white",children:Z},void 0,!1,void 0,this);if(Array.isArray(Z))return Z.filter((Q)=>Q.type==="text").map((Q,$)=>LY.jsxDEV(O,{color:"white",children:Q.text},void 0,!1,void 0,this));return LY.jsxDEV(O,{color:"white",children:JSON.stringify(Z)},void 0,!1,void 0,this)};return LY.jsxDEV(N,{flexDirection:"column",children:[LY.jsxDEV(N,{children:LY.jsxDEV(O,{color:bZ("amber"),children:[Y," ",X]},void 0,!0,void 0,this)},void 0,!1,void 0,this),LY.jsxDEV(N,{children:LY.jsxDEV(O,{color:"gray",children:["└─ ",J()]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},s4=w$;var V=L(r9(),1);function $8(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rY=$8();function L5(Z){rY=Z}var C4={exec:()=>null};function p(Z,Y=""){let X=typeof Z=="string"?Z:Z.source,J={replace:(Q,$)=>{let K=typeof $=="string"?$:$.source;return K=K.replace(RZ.caret,"$1"),X=X.replace(Q,K),J},getRegex:()=>new RegExp(X,Y)};return J}var B$=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),RZ={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:(Z)=>new RegExp(`^( {0,3}${Z})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}#`),htmlBeginRegex:(Z)=>new RegExp(`^ {0,${Math.min(3,Z-1)}}<(?:[a-z].*>|!--)`,"i")},L$=/^(?:[ \t]*(?:\n|$))+/,P$=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,C$=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,R4=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,R$=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,K8=/(?:[*+-]|\d{1,9}[.)])/,P5=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,C5=p(P5).replace(/bull/g,K8).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),v$=p(P5).replace(/bull/g,K8).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),W8=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,I$=/^[^\n]+/,U8=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,D$=p(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",U8).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),V$=p(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,K8).getRegex(),X0="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",z8=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,E$=p("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",z8).replace("tag",X0).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),R5=p(W8).replace("hr",R4).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",X0).getRegex(),b$=p(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",R5).getRegex(),H8={blockquote:b$,code:P$,def:D$,fences:C$,heading:R$,hr:R4,html:E$,lheading:C5,list:V$,newline:L$,paragraph:R5,table:C4,text:I$},M5=p("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",R4).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",X0).getRegex(),T$={...H8,lheading:v$,table:M5,paragraph:p(W8).replace("hr",R4).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",M5).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",X0).getRegex()},f$={...H8,html:p(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",z8).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:C4,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(W8).replace("hr",R4).replace("heading",` *#{1,6} *[^
|
|
79
|
+
]`).replace("lheading",C5).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},j$=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,S$=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,v5=/^( {2,}|\\)\n(?!\s*$)/,y$=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,J0=/[\p{P}\p{S}]/u,G8=/[\s\p{P}\p{S}]/u,I5=/[^\s\p{P}\p{S}]/u,k$=p(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,G8).getRegex(),D5=/(?!~)[\p{P}\p{S}]/u,h$=/(?!~)[\s\p{P}\p{S}]/u,x$=/(?:[^\s\p{P}\p{S}]|~)/u,g$=p(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",B$?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),V5=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,u$=p(V5,"u").replace(/punct/g,J0).getRegex(),m$=p(V5,"u").replace(/punct/g,D5).getRegex(),E5="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",p$=p(E5,"gu").replace(/notPunctSpace/g,I5).replace(/punctSpace/g,G8).replace(/punct/g,J0).getRegex(),d$=p(E5,"gu").replace(/notPunctSpace/g,x$).replace(/punctSpace/g,h$).replace(/punct/g,D5).getRegex(),c$=p("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,I5).replace(/punctSpace/g,G8).replace(/punct/g,J0).getRegex(),l$=p(/\\(punct)/,"gu").replace(/punct/g,J0).getRegex(),i$=p(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),r$=p(z8).replace("(?:-->|$)","-->").getRegex(),o$=p("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",r$).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),e4=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,n$=p(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",e4).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),b5=p(/^!?\[(label)\]\[(ref)\]/).replace("label",e4).replace("ref",U8).getRegex(),T5=p(/^!?\[(ref)\](?:\[\])?/).replace("ref",U8).getRegex(),a$=p("reflink|nolink(?!\\()","g").replace("reflink",b5).replace("nolink",T5).getRegex(),N5=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,O8={_backpedal:C4,anyPunctuation:l$,autolink:i$,blockSkip:g$,br:v5,code:S$,del:C4,emStrongLDelim:u$,emStrongRDelimAst:p$,emStrongRDelimUnd:c$,escape:j$,link:n$,nolink:T5,punctuation:k$,reflink:b5,reflinkSearch:a$,tag:o$,text:y$,url:C4},s$={...O8,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",e4).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",e4).getRegex()},Q8={...O8,emStrongRDelimAst:d$,emStrongLDelim:m$,url:p(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",N5).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:p(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",N5).getRegex()},t$={...Q8,br:p(v5).replace("{2,}","*").getRegex(),text:p(Q8.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},t4={normal:H8,gfm:T$,pedantic:f$},B4={normal:O8,gfm:Q8,breaks:t$,pedantic:s$},e$={"&":"&","<":"<",">":">",'"':""","'":"'"},A5=(Z)=>e$[Z];function OY(Z,Y){if(Y){if(RZ.escapeTest.test(Z))return Z.replace(RZ.escapeReplace,A5)}else if(RZ.escapeTestNoEncode.test(Z))return Z.replace(RZ.escapeReplaceNoEncode,A5);return Z}function _5(Z){try{Z=encodeURI(Z).replace(RZ.percentDecode,"%")}catch{return null}return Z}function w5(Z,Y){let X=Z.replace(RZ.findPipe,($,K,U)=>{let W=!1,z=K;for(;--z>=0&&U[z]==="\\";)W=!W;return W?"|":" |"}),J=X.split(RZ.splitPipe),Q=0;if(J[0].trim()||J.shift(),J.length>0&&!J.at(-1)?.trim()&&J.pop(),Y)if(J.length>Y)J.splice(Y);else for(;J.length<Y;)J.push("");for(;Q<J.length;Q++)J[Q]=J[Q].trim().replace(RZ.slashPipe,"|");return J}function L4(Z,Y,X){let J=Z.length;if(J===0)return"";let Q=0;for(;Q<J;){let $=Z.charAt(J-Q-1);if($===Y&&!X)Q++;else if($!==Y&&X)Q++;else break}return Z.slice(0,J-Q)}function ZK(Z,Y){if(Z.indexOf(Y[1])===-1)return-1;let X=0;for(let J=0;J<Z.length;J++)if(Z[J]==="\\")J++;else if(Z[J]===Y[0])X++;else if(Z[J]===Y[1]&&(X--,X<0))return J;return X>0?-2:-1}function B5(Z,Y,X,J,Q){let $=Y.href,K=Y.title||null,U=Z[1].replace(Q.other.outputLinkReplace,"$1");J.state.inLink=!0;let W={type:Z[0].charAt(0)==="!"?"image":"link",raw:X,href:$,title:K,text:U,tokens:J.inlineTokens(U)};return J.state.inLink=!1,W}function YK(Z,Y,X){let J=Z.match(X.other.indentCodeCompensation);if(J===null)return Y;let Q=J[1];return Y.split(`
|
|
80
|
+
`).map(($)=>{let K=$.match(X.other.beginningSpace);if(K===null)return $;let[U]=K;return U.length>=Q.length?$.slice(Q.length):$}).join(`
|
|
81
|
+
`)}var Z0=class{options;rules;lexer;constructor(Z){this.options=Z||rY}space(Z){let Y=this.rules.block.newline.exec(Z);if(Y&&Y[0].length>0)return{type:"space",raw:Y[0]}}code(Z){let Y=this.rules.block.code.exec(Z);if(Y){let X=Y[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:Y[0],codeBlockStyle:"indented",text:this.options.pedantic?X:L4(X,`
|
|
82
|
+
`)}}}fences(Z){let Y=this.rules.block.fences.exec(Z);if(Y){let X=Y[0],J=YK(X,Y[3]||"",this.rules);return{type:"code",raw:X,lang:Y[2]?Y[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):Y[2],text:J}}}heading(Z){let Y=this.rules.block.heading.exec(Z);if(Y){let X=Y[2].trim();if(this.rules.other.endingHash.test(X)){let J=L4(X,"#");(this.options.pedantic||!J||this.rules.other.endingSpaceChar.test(J))&&(X=J.trim())}return{type:"heading",raw:Y[0],depth:Y[1].length,text:X,tokens:this.lexer.inline(X)}}}hr(Z){let Y=this.rules.block.hr.exec(Z);if(Y)return{type:"hr",raw:L4(Y[0],`
|
|
83
|
+
`)}}blockquote(Z){let Y=this.rules.block.blockquote.exec(Z);if(Y){let X=L4(Y[0],`
|
|
84
|
+
`).split(`
|
|
85
|
+
`),J="",Q="",$=[];for(;X.length>0;){let K=!1,U=[],W;for(W=0;W<X.length;W++)if(this.rules.other.blockquoteStart.test(X[W]))U.push(X[W]),K=!0;else if(!K)U.push(X[W]);else break;X=X.slice(W);let z=U.join(`
|
|
86
|
+
`),H=z.replace(this.rules.other.blockquoteSetextReplace,`
|
|
87
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");J=J?`${J}
|
|
88
|
+
${z}`:z,Q=Q?`${Q}
|
|
89
|
+
${H}`:H;let G=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(H,$,!0),this.lexer.state.top=G,X.length===0)break;let F=$.at(-1);if(F?.type==="code")break;if(F?.type==="blockquote"){let M=F,A=M.raw+`
|
|
90
|
+
`+X.join(`
|
|
91
|
+
`),w=this.blockquote(A);$[$.length-1]=w,J=J.substring(0,J.length-M.raw.length)+w.raw,Q=Q.substring(0,Q.length-M.text.length)+w.text;break}else if(F?.type==="list"){let M=F,A=M.raw+`
|
|
92
|
+
`+X.join(`
|
|
93
|
+
`),w=this.list(A);$[$.length-1]=w,J=J.substring(0,J.length-F.raw.length)+w.raw,Q=Q.substring(0,Q.length-M.raw.length)+w.raw,X=A.substring($.at(-1).raw.length).split(`
|
|
94
|
+
`);continue}}return{type:"blockquote",raw:J,tokens:$,text:Q}}}list(Z){let Y=this.rules.block.list.exec(Z);if(Y){let X=Y[1].trim(),J=X.length>1,Q={type:"list",raw:"",ordered:J,start:J?+X.slice(0,-1):"",loose:!1,items:[]};X=J?`\\d{1,9}\\${X.slice(-1)}`:`\\${X}`,this.options.pedantic&&(X=J?X:"[*+-]");let $=this.rules.other.listItemRegex(X),K=!1;for(;Z;){let W=!1,z="",H="";if(!(Y=$.exec(Z))||this.rules.block.hr.test(Z))break;z=Y[0],Z=Z.substring(z.length);let G=Y[2].split(`
|
|
95
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,(B)=>" ".repeat(3*B.length)),F=Z.split(`
|
|
96
|
+
`,1)[0],M=!G.trim(),A=0;if(this.options.pedantic?(A=2,H=G.trimStart()):M?A=Y[1].length+1:(A=Y[2].search(this.rules.other.nonSpaceChar),A=A>4?1:A,H=G.slice(A),A+=Y[1].length),M&&this.rules.other.blankLine.test(F)&&(z+=F+`
|
|
97
|
+
`,Z=Z.substring(F.length+1),W=!0),!W){let B=this.rules.other.nextBulletRegex(A),R=this.rules.other.hrRegex(A),C=this.rules.other.fencesBeginRegex(A),D=this.rules.other.headingBeginRegex(A),j=this.rules.other.htmlBeginRegex(A);for(;Z;){let E=Z.split(`
|
|
98
|
+
`,1)[0],d;if(F=E,this.options.pedantic?(F=F.replace(this.rules.other.listReplaceNesting," "),d=F):d=F.replace(this.rules.other.tabCharGlobal," "),C.test(F)||D.test(F)||j.test(F)||B.test(F)||R.test(F))break;if(d.search(this.rules.other.nonSpaceChar)>=A||!F.trim())H+=`
|
|
99
|
+
`+d.slice(A);else{if(M||G.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||C.test(G)||D.test(G)||R.test(G))break;H+=`
|
|
100
|
+
`+F}!M&&!F.trim()&&(M=!0),z+=E+`
|
|
101
|
+
`,Z=Z.substring(E.length+1),G=d.slice(A)}}Q.loose||(K?Q.loose=!0:this.rules.other.doubleBlankLine.test(z)&&(K=!0));let w=null,P;this.options.gfm&&(w=this.rules.other.listIsTask.exec(H),w&&(P=w[0]!=="[ ] ",H=H.replace(this.rules.other.listReplaceTask,""))),Q.items.push({type:"list_item",raw:z,task:!!w,checked:P,loose:!1,text:H,tokens:[]}),Q.raw+=z}let U=Q.items.at(-1);if(U)U.raw=U.raw.trimEnd(),U.text=U.text.trimEnd();else return;Q.raw=Q.raw.trimEnd();for(let W=0;W<Q.items.length;W++)if(this.lexer.state.top=!1,Q.items[W].tokens=this.lexer.blockTokens(Q.items[W].text,[]),!Q.loose){let z=Q.items[W].tokens.filter((G)=>G.type==="space"),H=z.length>0&&z.some((G)=>this.rules.other.anyLine.test(G.raw));Q.loose=H}if(Q.loose)for(let W=0;W<Q.items.length;W++)Q.items[W].loose=!0;return Q}}html(Z){let Y=this.rules.block.html.exec(Z);if(Y)return{type:"html",block:!0,raw:Y[0],pre:Y[1]==="pre"||Y[1]==="script"||Y[1]==="style",text:Y[0]}}def(Z){let Y=this.rules.block.def.exec(Z);if(Y){let X=Y[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),J=Y[2]?Y[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",Q=Y[3]?Y[3].substring(1,Y[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):Y[3];return{type:"def",tag:X,raw:Y[0],href:J,title:Q}}}table(Z){let Y=this.rules.block.table.exec(Z);if(!Y||!this.rules.other.tableDelimiter.test(Y[2]))return;let X=w5(Y[1]),J=Y[2].replace(this.rules.other.tableAlignChars,"").split("|"),Q=Y[3]?.trim()?Y[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
102
|
+
`):[],$={type:"table",raw:Y[0],header:[],align:[],rows:[]};if(X.length===J.length){for(let K of J)this.rules.other.tableAlignRight.test(K)?$.align.push("right"):this.rules.other.tableAlignCenter.test(K)?$.align.push("center"):this.rules.other.tableAlignLeft.test(K)?$.align.push("left"):$.align.push(null);for(let K=0;K<X.length;K++)$.header.push({text:X[K],tokens:this.lexer.inline(X[K]),header:!0,align:$.align[K]});for(let K of Q)$.rows.push(w5(K,$.header.length).map((U,W)=>({text:U,tokens:this.lexer.inline(U),header:!1,align:$.align[W]})));return $}}lheading(Z){let Y=this.rules.block.lheading.exec(Z);if(Y)return{type:"heading",raw:Y[0],depth:Y[2].charAt(0)==="="?1:2,text:Y[1],tokens:this.lexer.inline(Y[1])}}paragraph(Z){let Y=this.rules.block.paragraph.exec(Z);if(Y){let X=Y[1].charAt(Y[1].length-1)===`
|
|
103
|
+
`?Y[1].slice(0,-1):Y[1];return{type:"paragraph",raw:Y[0],text:X,tokens:this.lexer.inline(X)}}}text(Z){let Y=this.rules.block.text.exec(Z);if(Y)return{type:"text",raw:Y[0],text:Y[0],tokens:this.lexer.inline(Y[0])}}escape(Z){let Y=this.rules.inline.escape.exec(Z);if(Y)return{type:"escape",raw:Y[0],text:Y[1]}}tag(Z){let Y=this.rules.inline.tag.exec(Z);if(Y)return!this.lexer.state.inLink&&this.rules.other.startATag.test(Y[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(Y[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(Y[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(Y[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:Y[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:Y[0]}}link(Z){let Y=this.rules.inline.link.exec(Z);if(Y){let X=Y[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(X)){if(!this.rules.other.endAngleBracket.test(X))return;let $=L4(X.slice(0,-1),"\\");if((X.length-$.length)%2===0)return}else{let $=ZK(Y[2],"()");if($===-2)return;if($>-1){let K=(Y[0].indexOf("!")===0?5:4)+Y[1].length+$;Y[2]=Y[2].substring(0,$),Y[0]=Y[0].substring(0,K).trim(),Y[3]=""}}let J=Y[2],Q="";if(this.options.pedantic){let $=this.rules.other.pedanticHrefTitle.exec(J);$&&(J=$[1],Q=$[3])}else Q=Y[3]?Y[3].slice(1,-1):"";return J=J.trim(),this.rules.other.startAngleBracket.test(J)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(X)?J=J.slice(1):J=J.slice(1,-1)),B5(Y,{href:J&&J.replace(this.rules.inline.anyPunctuation,"$1"),title:Q&&Q.replace(this.rules.inline.anyPunctuation,"$1")},Y[0],this.lexer,this.rules)}}reflink(Z,Y){let X;if((X=this.rules.inline.reflink.exec(Z))||(X=this.rules.inline.nolink.exec(Z))){let J=(X[2]||X[1]).replace(this.rules.other.multipleSpaceGlobal," "),Q=Y[J.toLowerCase()];if(!Q){let $=X[0].charAt(0);return{type:"text",raw:$,text:$}}return B5(X,Q,X[0],this.lexer,this.rules)}}emStrong(Z,Y,X=""){let J=this.rules.inline.emStrongLDelim.exec(Z);if(!J||J[3]&&X.match(this.rules.other.unicodeAlphaNumeric))return;if(!(J[1]||J[2])||!X||this.rules.inline.punctuation.exec(X)){let Q=[...J[0]].length-1,$,K,U=Q,W=0,z=J[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(z.lastIndex=0,Y=Y.slice(-1*Z.length+Q);(J=z.exec(Y))!=null;){if($=J[1]||J[2]||J[3]||J[4]||J[5]||J[6],!$)continue;if(K=[...$].length,J[3]||J[4]){U+=K;continue}else if((J[5]||J[6])&&Q%3&&!((Q+K)%3)){W+=K;continue}if(U-=K,U>0)continue;K=Math.min(K,K+U+W);let H=[...J[0]][0].length,G=Z.slice(0,Q+J.index+H+K);if(Math.min(Q,K)%2){let M=G.slice(1,-1);return{type:"em",raw:G,text:M,tokens:this.lexer.inlineTokens(M)}}let F=G.slice(2,-2);return{type:"strong",raw:G,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(Z){let Y=this.rules.inline.code.exec(Z);if(Y){let X=Y[2].replace(this.rules.other.newLineCharGlobal," "),J=this.rules.other.nonSpaceChar.test(X),Q=this.rules.other.startingSpaceChar.test(X)&&this.rules.other.endingSpaceChar.test(X);return J&&Q&&(X=X.substring(1,X.length-1)),{type:"codespan",raw:Y[0],text:X}}}br(Z){let Y=this.rules.inline.br.exec(Z);if(Y)return{type:"br",raw:Y[0]}}del(Z){let Y=this.rules.inline.del.exec(Z);if(Y)return{type:"del",raw:Y[0],text:Y[2],tokens:this.lexer.inlineTokens(Y[2])}}autolink(Z){let Y=this.rules.inline.autolink.exec(Z);if(Y){let X,J;return Y[2]==="@"?(X=Y[1],J="mailto:"+X):(X=Y[1],J=X),{type:"link",raw:Y[0],text:X,href:J,tokens:[{type:"text",raw:X,text:X}]}}}url(Z){let Y;if(Y=this.rules.inline.url.exec(Z)){let X,J;if(Y[2]==="@")X=Y[0],J="mailto:"+X;else{let Q;do Q=Y[0],Y[0]=this.rules.inline._backpedal.exec(Y[0])?.[0]??"";while(Q!==Y[0]);X=Y[0],Y[1]==="www."?J="http://"+Y[0]:J=Y[0]}return{type:"link",raw:Y[0],text:X,href:J,tokens:[{type:"text",raw:X,text:X}]}}}inlineText(Z){let Y=this.rules.inline.text.exec(Z);if(Y){let X=this.lexer.state.inRawBlock;return{type:"text",raw:Y[0],text:Y[0],escaped:X}}}},tZ=class Z{tokens;options;state;tokenizer;inlineQueue;constructor(Y){this.tokens=[],this.tokens.links=Object.create(null),this.options=Y||rY,this.options.tokenizer=this.options.tokenizer||new Z0,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let X={other:RZ,block:t4.normal,inline:B4.normal};this.options.pedantic?(X.block=t4.pedantic,X.inline=B4.pedantic):this.options.gfm&&(X.block=t4.gfm,this.options.breaks?X.inline=B4.breaks:X.inline=B4.gfm),this.tokenizer.rules=X}static get rules(){return{block:t4,inline:B4}}static lex(Y,X){return new Z(X).lex(Y)}static lexInline(Y,X){return new Z(X).inlineTokens(Y)}lex(Y){Y=Y.replace(RZ.carriageReturn,`
|
|
104
|
+
`),this.blockTokens(Y,this.tokens);for(let X=0;X<this.inlineQueue.length;X++){let J=this.inlineQueue[X];this.inlineTokens(J.src,J.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(Y,X=[],J=!1){for(this.options.pedantic&&(Y=Y.replace(RZ.tabCharGlobal," ").replace(RZ.spaceLine,""));Y;){let Q;if(this.options.extensions?.block?.some((K)=>(Q=K.call({lexer:this},Y,X))?(Y=Y.substring(Q.raw.length),X.push(Q),!0):!1))continue;if(Q=this.tokenizer.space(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);Q.raw.length===1&&K!==void 0?K.raw+=`
|
|
105
|
+
`:X.push(Q);continue}if(Q=this.tokenizer.code(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);K?.type==="paragraph"||K?.type==="text"?(K.raw+=(K.raw.endsWith(`
|
|
106
|
+
`)?"":`
|
|
107
|
+
`)+Q.raw,K.text+=`
|
|
108
|
+
`+Q.text,this.inlineQueue.at(-1).src=K.text):X.push(Q);continue}if(Q=this.tokenizer.fences(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.heading(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.hr(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.blockquote(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.list(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.html(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.def(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);K?.type==="paragraph"||K?.type==="text"?(K.raw+=(K.raw.endsWith(`
|
|
109
|
+
`)?"":`
|
|
110
|
+
`)+Q.raw,K.text+=`
|
|
111
|
+
`+Q.raw,this.inlineQueue.at(-1).src=K.text):this.tokens.links[Q.tag]||(this.tokens.links[Q.tag]={href:Q.href,title:Q.title},X.push(Q));continue}if(Q=this.tokenizer.table(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}if(Q=this.tokenizer.lheading(Y)){Y=Y.substring(Q.raw.length),X.push(Q);continue}let $=Y;if(this.options.extensions?.startBlock){let K=1/0,U=Y.slice(1),W;this.options.extensions.startBlock.forEach((z)=>{W=z.call({lexer:this},U),typeof W=="number"&&W>=0&&(K=Math.min(K,W))}),K<1/0&&K>=0&&($=Y.substring(0,K+1))}if(this.state.top&&(Q=this.tokenizer.paragraph($))){let K=X.at(-1);J&&K?.type==="paragraph"?(K.raw+=(K.raw.endsWith(`
|
|
112
|
+
`)?"":`
|
|
113
|
+
`)+Q.raw,K.text+=`
|
|
114
|
+
`+Q.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=K.text):X.push(Q),J=$.length!==Y.length,Y=Y.substring(Q.raw.length);continue}if(Q=this.tokenizer.text(Y)){Y=Y.substring(Q.raw.length);let K=X.at(-1);K?.type==="text"?(K.raw+=(K.raw.endsWith(`
|
|
115
|
+
`)?"":`
|
|
116
|
+
`)+Q.raw,K.text+=`
|
|
117
|
+
`+Q.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=K.text):X.push(Q);continue}if(Y){let K="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(K);break}else throw Error(K)}}return this.state.top=!0,X}inline(Y,X=[]){return this.inlineQueue.push({src:Y,tokens:X}),X}inlineTokens(Y,X=[]){let J=Y,Q=null;if(this.tokens.links){let W=Object.keys(this.tokens.links);if(W.length>0)for(;(Q=this.tokenizer.rules.inline.reflinkSearch.exec(J))!=null;)W.includes(Q[0].slice(Q[0].lastIndexOf("[")+1,-1))&&(J=J.slice(0,Q.index)+"["+"a".repeat(Q[0].length-2)+"]"+J.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Q=this.tokenizer.rules.inline.anyPunctuation.exec(J))!=null;)J=J.slice(0,Q.index)+"++"+J.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let $;for(;(Q=this.tokenizer.rules.inline.blockSkip.exec(J))!=null;)$=Q[2]?Q[2].length:0,J=J.slice(0,Q.index+$)+"["+"a".repeat(Q[0].length-$-2)+"]"+J.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);J=this.options.hooks?.emStrongMask?.call({lexer:this},J)??J;let K=!1,U="";for(;Y;){K||(U=""),K=!1;let W;if(this.options.extensions?.inline?.some((H)=>(W=H.call({lexer:this},Y,X))?(Y=Y.substring(W.raw.length),X.push(W),!0):!1))continue;if(W=this.tokenizer.escape(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.tag(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.link(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(W.raw.length);let H=X.at(-1);W.type==="text"&&H?.type==="text"?(H.raw+=W.raw,H.text+=W.text):X.push(W);continue}if(W=this.tokenizer.emStrong(Y,J,U)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.codespan(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.br(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.del(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(W=this.tokenizer.autolink(Y)){Y=Y.substring(W.raw.length),X.push(W);continue}if(!this.state.inLink&&(W=this.tokenizer.url(Y))){Y=Y.substring(W.raw.length),X.push(W);continue}let z=Y;if(this.options.extensions?.startInline){let H=1/0,G=Y.slice(1),F;this.options.extensions.startInline.forEach((M)=>{F=M.call({lexer:this},G),typeof F=="number"&&F>=0&&(H=Math.min(H,F))}),H<1/0&&H>=0&&(z=Y.substring(0,H+1))}if(W=this.tokenizer.inlineText(z)){Y=Y.substring(W.raw.length),W.raw.slice(-1)!=="_"&&(U=W.raw.slice(-1)),K=!0;let H=X.at(-1);H?.type==="text"?(H.raw+=W.raw,H.text+=W.text):X.push(W);continue}if(Y){let H="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(H);break}else throw Error(H)}}return X}},Y0=class{options;parser;constructor(Z){this.options=Z||rY}space(Z){return""}code({text:Z,lang:Y,escaped:X}){let J=(Y||"").match(RZ.notSpaceStart)?.[0],Q=Z.replace(RZ.endingNewline,"")+`
|
|
118
|
+
`;return J?'<pre><code class="language-'+OY(J)+'">'+(X?Q:OY(Q,!0))+`</code></pre>
|
|
119
|
+
`:"<pre><code>"+(X?Q:OY(Q,!0))+`</code></pre>
|
|
120
|
+
`}blockquote({tokens:Z}){return`<blockquote>
|
|
121
|
+
${this.parser.parse(Z)}</blockquote>
|
|
122
|
+
`}html({text:Z}){return Z}def(Z){return""}heading({tokens:Z,depth:Y}){return`<h${Y}>${this.parser.parseInline(Z)}</h${Y}>
|
|
123
|
+
`}hr(Z){return`<hr>
|
|
124
|
+
`}list(Z){let{ordered:Y,start:X}=Z,J="";for(let K=0;K<Z.items.length;K++){let U=Z.items[K];J+=this.listitem(U)}let Q=Y?"ol":"ul",$=Y&&X!==1?' start="'+X+'"':"";return"<"+Q+$+`>
|
|
125
|
+
`+J+"</"+Q+`>
|
|
126
|
+
`}listitem(Z){let Y="";if(Z.task){let X=this.checkbox({checked:!!Z.checked});Z.loose?Z.tokens[0]?.type==="paragraph"?(Z.tokens[0].text=X+" "+Z.tokens[0].text,Z.tokens[0].tokens&&Z.tokens[0].tokens.length>0&&Z.tokens[0].tokens[0].type==="text"&&(Z.tokens[0].tokens[0].text=X+" "+OY(Z.tokens[0].tokens[0].text),Z.tokens[0].tokens[0].escaped=!0)):Z.tokens.unshift({type:"text",raw:X+" ",text:X+" ",escaped:!0}):Y+=X+" "}return Y+=this.parser.parse(Z.tokens,!!Z.loose),`<li>${Y}</li>
|
|
127
|
+
`}checkbox({checked:Z}){return"<input "+(Z?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:Z}){return`<p>${this.parser.parseInline(Z)}</p>
|
|
128
|
+
`}table(Z){let Y="",X="";for(let Q=0;Q<Z.header.length;Q++)X+=this.tablecell(Z.header[Q]);Y+=this.tablerow({text:X});let J="";for(let Q=0;Q<Z.rows.length;Q++){let $=Z.rows[Q];X="";for(let K=0;K<$.length;K++)X+=this.tablecell($[K]);J+=this.tablerow({text:X})}return J&&(J=`<tbody>${J}</tbody>`),`<table>
|
|
129
|
+
<thead>
|
|
130
|
+
`+Y+`</thead>
|
|
131
|
+
`+J+`</table>
|
|
132
|
+
`}tablerow({text:Z}){return`<tr>
|
|
133
|
+
${Z}</tr>
|
|
134
|
+
`}tablecell(Z){let Y=this.parser.parseInline(Z.tokens),X=Z.header?"th":"td";return(Z.align?`<${X} align="${Z.align}">`:`<${X}>`)+Y+`</${X}>
|
|
135
|
+
`}strong({tokens:Z}){return`<strong>${this.parser.parseInline(Z)}</strong>`}em({tokens:Z}){return`<em>${this.parser.parseInline(Z)}</em>`}codespan({text:Z}){return`<code>${OY(Z,!0)}</code>`}br(Z){return"<br>"}del({tokens:Z}){return`<del>${this.parser.parseInline(Z)}</del>`}link({href:Z,title:Y,tokens:X}){let J=this.parser.parseInline(X),Q=_5(Z);if(Q===null)return J;Z=Q;let $='<a href="'+Z+'"';return Y&&($+=' title="'+OY(Y)+'"'),$+=">"+J+"</a>",$}image({href:Z,title:Y,text:X,tokens:J}){J&&(X=this.parser.parseInline(J,this.parser.textRenderer));let Q=_5(Z);if(Q===null)return OY(X);Z=Q;let $=`<img src="${Z}" alt="${X}"`;return Y&&($+=` title="${OY(Y)}"`),$+=">",$}text(Z){return"tokens"in Z&&Z.tokens?this.parser.parseInline(Z.tokens):("escaped"in Z)&&Z.escaped?Z.text:OY(Z.text)}},q8=class{strong({text:Z}){return Z}em({text:Z}){return Z}codespan({text:Z}){return Z}del({text:Z}){return Z}html({text:Z}){return Z}text({text:Z}){return Z}link({text:Z}){return""+Z}image({text:Z}){return""+Z}br(){return""}},eZ=class Z{options;renderer;textRenderer;constructor(Y){this.options=Y||rY,this.options.renderer=this.options.renderer||new Y0,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new q8}static parse(Y,X){return new Z(X).parse(Y)}static parseInline(Y,X){return new Z(X).parseInline(Y)}parse(Y,X=!0){let J="";for(let Q=0;Q<Y.length;Q++){let $=Y[Q];if(this.options.extensions?.renderers?.[$.type]){let U=$,W=this.options.extensions.renderers[U.type].call({parser:this},U);if(W!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(U.type)){J+=W||"";continue}}let K=$;switch(K.type){case"space":{J+=this.renderer.space(K);continue}case"hr":{J+=this.renderer.hr(K);continue}case"heading":{J+=this.renderer.heading(K);continue}case"code":{J+=this.renderer.code(K);continue}case"table":{J+=this.renderer.table(K);continue}case"blockquote":{J+=this.renderer.blockquote(K);continue}case"list":{J+=this.renderer.list(K);continue}case"html":{J+=this.renderer.html(K);continue}case"def":{J+=this.renderer.def(K);continue}case"paragraph":{J+=this.renderer.paragraph(K);continue}case"text":{let U=K,W=this.renderer.text(U);for(;Q+1<Y.length&&Y[Q+1].type==="text";)U=Y[++Q],W+=`
|
|
136
|
+
`+this.renderer.text(U);X?J+=this.renderer.paragraph({type:"paragraph",raw:W,text:W,tokens:[{type:"text",raw:W,text:W,escaped:!0}]}):J+=W;continue}default:{let U='Token with "'+K.type+'" type was not found.';if(this.options.silent)return console.error(U),"";throw Error(U)}}}return J}parseInline(Y,X=this.renderer){let J="";for(let Q=0;Q<Y.length;Q++){let $=Y[Q];if(this.options.extensions?.renderers?.[$.type]){let U=this.options.extensions.renderers[$.type].call({parser:this},$);if(U!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes($.type)){J+=U||"";continue}}let K=$;switch(K.type){case"escape":{J+=X.text(K);break}case"html":{J+=X.html(K);break}case"link":{J+=X.link(K);break}case"image":{J+=X.image(K);break}case"strong":{J+=X.strong(K);break}case"em":{J+=X.em(K);break}case"codespan":{J+=X.codespan(K);break}case"br":{J+=X.br(K);break}case"del":{J+=X.del(K);break}case"text":{J+=X.text(K);break}default:{let U='Token with "'+K.type+'" type was not found.';if(this.options.silent)return console.error(U),"";throw Error(U)}}}return J}},P4=class{options;block;constructor(Z){this.options=Z||rY}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(Z){return Z}postprocess(Z){return Z}processAllTokens(Z){return Z}emStrongMask(Z){return Z}provideLexer(){return this.block?tZ.lex:tZ.lexInline}provideParser(){return this.block?eZ.parse:eZ.parseInline}},XK=class{defaults=$8();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=eZ;Renderer=Y0;TextRenderer=q8;Lexer=tZ;Tokenizer=Z0;Hooks=P4;constructor(...Z){this.use(...Z)}walkTokens(Z,Y){let X=[];for(let J of Z)switch(X=X.concat(Y.call(this,J)),J.type){case"table":{let Q=J;for(let $ of Q.header)X=X.concat(this.walkTokens($.tokens,Y));for(let $ of Q.rows)for(let K of $)X=X.concat(this.walkTokens(K.tokens,Y));break}case"list":{let Q=J;X=X.concat(this.walkTokens(Q.items,Y));break}default:{let Q=J;this.defaults.extensions?.childTokens?.[Q.type]?this.defaults.extensions.childTokens[Q.type].forEach(($)=>{let K=Q[$].flat(1/0);X=X.concat(this.walkTokens(K,Y))}):Q.tokens&&(X=X.concat(this.walkTokens(Q.tokens,Y)))}}return X}use(...Z){let Y=this.defaults.extensions||{renderers:{},childTokens:{}};return Z.forEach((X)=>{let J={...X};if(J.async=this.defaults.async||J.async||!1,X.extensions&&(X.extensions.forEach((Q)=>{if(!Q.name)throw Error("extension name required");if("renderer"in Q){let $=Y.renderers[Q.name];$?Y.renderers[Q.name]=function(...K){let U=Q.renderer.apply(this,K);return U===!1&&(U=$.apply(this,K)),U}:Y.renderers[Q.name]=Q.renderer}if("tokenizer"in Q){if(!Q.level||Q.level!=="block"&&Q.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let $=Y[Q.level];$?$.unshift(Q.tokenizer):Y[Q.level]=[Q.tokenizer],Q.start&&(Q.level==="block"?Y.startBlock?Y.startBlock.push(Q.start):Y.startBlock=[Q.start]:Q.level==="inline"&&(Y.startInline?Y.startInline.push(Q.start):Y.startInline=[Q.start]))}"childTokens"in Q&&Q.childTokens&&(Y.childTokens[Q.name]=Q.childTokens)}),J.extensions=Y),X.renderer){let Q=this.defaults.renderer||new Y0(this.defaults);for(let $ in X.renderer){if(!($ in Q))throw Error(`renderer '${$}' does not exist`);if(["options","parser"].includes($))continue;let K=$,U=X.renderer[K],W=Q[K];Q[K]=(...z)=>{let H=U.apply(Q,z);return H===!1&&(H=W.apply(Q,z)),H||""}}J.renderer=Q}if(X.tokenizer){let Q=this.defaults.tokenizer||new Z0(this.defaults);for(let $ in X.tokenizer){if(!($ in Q))throw Error(`tokenizer '${$}' does not exist`);if(["options","rules","lexer"].includes($))continue;let K=$,U=X.tokenizer[K],W=Q[K];Q[K]=(...z)=>{let H=U.apply(Q,z);return H===!1&&(H=W.apply(Q,z)),H}}J.tokenizer=Q}if(X.hooks){let Q=this.defaults.hooks||new P4;for(let $ in X.hooks){if(!($ in Q))throw Error(`hook '${$}' does not exist`);if(["options","block"].includes($))continue;let K=$,U=X.hooks[K],W=Q[K];P4.passThroughHooks.has($)?Q[K]=(z)=>{if(this.defaults.async&&P4.passThroughHooksRespectAsync.has($))return(async()=>{let G=await U.call(Q,z);return W.call(Q,G)})();let H=U.call(Q,z);return W.call(Q,H)}:Q[K]=(...z)=>{if(this.defaults.async)return(async()=>{let G=await U.apply(Q,z);return G===!1&&(G=await W.apply(Q,z)),G})();let H=U.apply(Q,z);return H===!1&&(H=W.apply(Q,z)),H}}J.hooks=Q}if(X.walkTokens){let Q=this.defaults.walkTokens,$=X.walkTokens;J.walkTokens=function(K){let U=[];return U.push($.call(this,K)),Q&&(U=U.concat(Q.call(this,K))),U}}this.defaults={...this.defaults,...J}}),this}setOptions(Z){return this.defaults={...this.defaults,...Z},this}lexer(Z,Y){return tZ.lex(Z,Y??this.defaults)}parser(Z,Y){return eZ.parse(Z,Y??this.defaults)}parseMarkdown(Z){return(Y,X)=>{let J={...X},Q={...this.defaults,...J},$=this.onError(!!Q.silent,!!Q.async);if(this.defaults.async===!0&&J.async===!1)return $(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof Y>"u"||Y===null)return $(Error("marked(): input parameter is undefined or null"));if(typeof Y!="string")return $(Error("marked(): input parameter is of type "+Object.prototype.toString.call(Y)+", string expected"));if(Q.hooks&&(Q.hooks.options=Q,Q.hooks.block=Z),Q.async)return(async()=>{let K=Q.hooks?await Q.hooks.preprocess(Y):Y,U=await(Q.hooks?await Q.hooks.provideLexer():Z?tZ.lex:tZ.lexInline)(K,Q),W=Q.hooks?await Q.hooks.processAllTokens(U):U;Q.walkTokens&&await Promise.all(this.walkTokens(W,Q.walkTokens));let z=await(Q.hooks?await Q.hooks.provideParser():Z?eZ.parse:eZ.parseInline)(W,Q);return Q.hooks?await Q.hooks.postprocess(z):z})().catch($);try{Q.hooks&&(Y=Q.hooks.preprocess(Y));let K=(Q.hooks?Q.hooks.provideLexer():Z?tZ.lex:tZ.lexInline)(Y,Q);Q.hooks&&(K=Q.hooks.processAllTokens(K)),Q.walkTokens&&this.walkTokens(K,Q.walkTokens);let U=(Q.hooks?Q.hooks.provideParser():Z?eZ.parse:eZ.parseInline)(K,Q);return Q.hooks&&(U=Q.hooks.postprocess(U)),U}catch(K){return $(K)}}}onError(Z,Y){return(X)=>{if(X.message+=`
|
|
137
|
+
Please report this to https://github.com/markedjs/marked.`,Z){let J="<p>An error occurred:</p><pre>"+OY(X.message+"",!0)+"</pre>";return Y?Promise.resolve(J):J}if(Y)return Promise.reject(X);throw X}}},iY=new XK;function c(Z,Y){return iY.parse(Z,Y)}c.options=c.setOptions=function(Z){return iY.setOptions(Z),c.defaults=iY.defaults,L5(c.defaults),c};c.getDefaults=$8;c.defaults=rY;c.use=function(...Z){return iY.use(...Z),c.defaults=iY.defaults,L5(c.defaults),c};c.walkTokens=function(Z,Y){return iY.walkTokens(Z,Y)};c.parseInline=iY.parseInline;c.Parser=eZ;c.parser=eZ.parse;c.Renderer=Y0;c.TextRenderer=q8;c.Lexer=tZ;c.lexer=tZ.lex;c.Tokenizer=Z0;c.Hooks=P4;c.parse=c;var{options:WG,setOptions:UG,use:zG,walkTokens:HG,parseInline:GG}=c;var OG=eZ.parse,qG=tZ.lex;var pZ=L(x(),1);class YZ extends Error{constructor(Z){super(Z);this.name="ShikiError"}}function JK(Z){return L8(Z)}function L8(Z){if(Array.isArray(Z))return QK(Z);if(Z instanceof RegExp)return Z;if(typeof Z==="object")return $K(Z);return Z}function QK(Z){let Y=[];for(let X=0,J=Z.length;X<J;X++)Y[X]=L8(Z[X]);return Y}function $K(Z){let Y={};for(let X in Z)Y[X]=L8(Z[X]);return Y}function u5(Z,...Y){return Y.forEach((X)=>{for(let J in X)Z[J]=X[J]}),Z}function m5(Z){let Y=~Z.lastIndexOf("/")||~Z.lastIndexOf("\\");if(Y===0)return Z;else if(~Y===Z.length-1)return m5(Z.substring(0,Z.length-1));else return Z.substr(~Y+1)}var F8=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Q0=class{static hasCaptures(Z){if(Z===null)return!1;return F8.lastIndex=0,F8.test(Z)}static replaceCaptures(Z,Y,X){return Z.replace(F8,(J,Q,$,K)=>{let U=X[parseInt(Q||$,10)];if(U){let W=Y.substring(U.start,U.end);while(W[0]===".")W=W.substring(1);switch(K){case"downcase":return W.toLowerCase();case"upcase":return W.toUpperCase();default:return W}}else return J})}};function p5(Z,Y){if(Z<Y)return-1;if(Z>Y)return 1;return 0}function d5(Z,Y){if(Z===null&&Y===null)return 0;if(!Z)return-1;if(!Y)return 1;let X=Z.length,J=Y.length;if(X===J){for(let Q=0;Q<X;Q++){let $=p5(Z[Q],Y[Q]);if($!==0)return $}return 0}return X-J}function f5(Z){if(/^#[0-9a-f]{6}$/i.test(Z))return!0;if(/^#[0-9a-f]{8}$/i.test(Z))return!0;if(/^#[0-9a-f]{3}$/i.test(Z))return!0;if(/^#[0-9a-f]{4}$/i.test(Z))return!0;return!1}function c5(Z){return Z.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var l5=class{constructor(Z){this.fn=Z}cache=new Map;get(Z){if(this.cache.has(Z))return this.cache.get(Z);let Y=this.fn(Z);return this.cache.set(Z,Y),Y}},D4=class{constructor(Z,Y,X){this._colorMap=Z,this._defaults=Y,this._root=X}static createFromRawTheme(Z,Y){return this.createFromParsedTheme(UK(Z),Y)}static createFromParsedTheme(Z,Y){return HK(Z,Y)}_cachedMatchRoot=new l5((Z)=>this._root.match(Z));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(Z){if(Z===null)return this._defaults;let Y=Z.scopeName,J=this._cachedMatchRoot.get(Y).find((Q)=>KK(Z.parent,Q.parentScopes));if(!J)return null;return new i5(J.fontStyle,J.foreground,J.background)}},M8=class Z{constructor(Y,X){this.parent=Y,this.scopeName=X}static push(Y,X){for(let J of X)Y=new Z(Y,J);return Y}static from(...Y){let X=null;for(let J=0;J<Y.length;J++)X=new Z(X,Y[J]);return X}push(Y){return new Z(this,Y)}getSegments(){let Y=this,X=[];while(Y)X.push(Y.scopeName),Y=Y.parent;return X.reverse(),X}toString(){return this.getSegments().join(" ")}extends(Y){if(this===Y)return!0;if(this.parent===null)return!1;return this.parent.extends(Y)}getExtensionIfDefined(Y){let X=[],J=this;while(J&&J!==Y)X.push(J.scopeName),J=J.parent;return J===Y?X.reverse():void 0}};function KK(Z,Y){if(Y.length===0)return!0;for(let X=0;X<Y.length;X++){let J=Y[X],Q=!1;if(J===">"){if(X===Y.length-1)return!1;J=Y[++X],Q=!0}while(Z){if(WK(Z.scopeName,J))break;if(Q)return!1;Z=Z.parent}if(!Z)return!1;Z=Z.parent}return!0}function WK(Z,Y){return Y===Z||Z.startsWith(Y)&&Z[Y.length]==="."}var i5=class{constructor(Z,Y,X){this.fontStyle=Z,this.foregroundId=Y,this.backgroundId=X}};function UK(Z){if(!Z)return[];if(!Z.settings||!Array.isArray(Z.settings))return[];let Y=Z.settings,X=[],J=0;for(let Q=0,$=Y.length;Q<$;Q++){let K=Y[Q];if(!K.settings)continue;let U;if(typeof K.scope==="string"){let G=K.scope;G=G.replace(/^[,]+/,""),G=G.replace(/[,]+$/,""),U=G.split(",")}else if(Array.isArray(K.scope))U=K.scope;else U=[""];let W=-1;if(typeof K.settings.fontStyle==="string"){W=0;let G=K.settings.fontStyle.split(" ");for(let F=0,M=G.length;F<M;F++)switch(G[F]){case"italic":W=W|1;break;case"bold":W=W|2;break;case"underline":W=W|4;break;case"strikethrough":W=W|8;break}}let z=null;if(typeof K.settings.foreground==="string"&&f5(K.settings.foreground))z=K.settings.foreground;let H=null;if(typeof K.settings.background==="string"&&f5(K.settings.background))H=K.settings.background;for(let G=0,F=U.length;G<F;G++){let A=U[G].trim().split(" "),w=A[A.length-1],P=null;if(A.length>1)P=A.slice(0,A.length-1),P.reverse();X[J++]=new zK(w,P,Q,W,z,H)}}return X}var zK=class{constructor(Z,Y,X,J,Q,$){this.scope=Z,this.parentScopes=Y,this.index=X,this.fontStyle=J,this.foreground=Q,this.background=$}},GZ=((Z)=>{return Z[Z.NotSet=-1]="NotSet",Z[Z.None=0]="None",Z[Z.Italic=1]="Italic",Z[Z.Bold=2]="Bold",Z[Z.Underline=4]="Underline",Z[Z.Strikethrough=8]="Strikethrough",Z})(GZ||{});function HK(Z,Y){Z.sort((W,z)=>{let H=p5(W.scope,z.scope);if(H!==0)return H;if(H=d5(W.parentScopes,z.parentScopes),H!==0)return H;return W.index-z.index});let X=0,J="#000000",Q="#ffffff";while(Z.length>=1&&Z[0].scope===""){let W=Z.shift();if(W.fontStyle!==-1)X=W.fontStyle;if(W.foreground!==null)J=W.foreground;if(W.background!==null)Q=W.background}let $=new GK(Y),K=new i5(X,$.getId(J),$.getId(Q)),U=new qK(new A8(0,null,-1,0,0),[]);for(let W=0,z=Z.length;W<z;W++){let H=Z[W];U.insert(0,H.scope,H.parentScopes,H.fontStyle,$.getId(H.foreground),$.getId(H.background))}return new D4($,K,U)}var GK=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(Z){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(Z)){this._isFrozen=!0;for(let Y=0,X=Z.length;Y<X;Y++)this._color2id[Z[Y]]=Y,this._id2color[Y]=Z[Y]}else this._isFrozen=!1}getId(Z){if(Z===null)return 0;Z=Z.toUpperCase();let Y=this._color2id[Z];if(Y)return Y;if(this._isFrozen)throw Error(`Missing color in color map - ${Z}`);return Y=++this._lastColorId,this._color2id[Z]=Y,this._id2color[Y]=Z,Y}getColorMap(){return this._id2color.slice(0)}},OK=Object.freeze([]),A8=class Z{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(Y,X,J,Q,$){this.scopeDepth=Y,this.parentScopes=X||OK,this.fontStyle=J,this.foreground=Q,this.background=$}clone(){return new Z(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(Y){let X=[];for(let J=0,Q=Y.length;J<Q;J++)X[J]=Y[J].clone();return X}acceptOverwrite(Y,X,J,Q){if(this.scopeDepth>Y)console.log("how did this happen?");else this.scopeDepth=Y;if(X!==-1)this.fontStyle=X;if(J!==0)this.foreground=J;if(Q!==0)this.background=Q}},qK=class Z{constructor(Y,X=[],J={}){this._mainRule=Y,this._children=J,this._rulesWithParentScopes=X}_rulesWithParentScopes;static _cmpBySpecificity(Y,X){if(Y.scopeDepth!==X.scopeDepth)return X.scopeDepth-Y.scopeDepth;let J=0,Q=0;while(!0){if(Y.parentScopes[J]===">")J++;if(X.parentScopes[Q]===">")Q++;if(J>=Y.parentScopes.length||Q>=X.parentScopes.length)break;let $=X.parentScopes[Q].length-Y.parentScopes[J].length;if($!==0)return $;J++,Q++}return X.parentScopes.length-Y.parentScopes.length}match(Y){if(Y!==""){let J=Y.indexOf("."),Q,$;if(J===-1)Q=Y,$="";else Q=Y.substring(0,J),$=Y.substring(J+1);if(this._children.hasOwnProperty(Q))return this._children[Q].match($)}let X=this._rulesWithParentScopes.concat(this._mainRule);return X.sort(Z._cmpBySpecificity),X}insert(Y,X,J,Q,$,K){if(X===""){this._doInsertHere(Y,J,Q,$,K);return}let U=X.indexOf("."),W,z;if(U===-1)W=X,z="";else W=X.substring(0,U),z=X.substring(U+1);let H;if(this._children.hasOwnProperty(W))H=this._children[W];else H=new Z(this._mainRule.clone(),A8.cloneArr(this._rulesWithParentScopes)),this._children[W]=H;H.insert(Y+1,z,J,Q,$,K)}_doInsertHere(Y,X,J,Q,$){if(X===null){this._mainRule.acceptOverwrite(Y,J,Q,$);return}for(let K=0,U=this._rulesWithParentScopes.length;K<U;K++){let W=this._rulesWithParentScopes[K];if(d5(W.parentScopes,X)===0){W.acceptOverwrite(Y,J,Q,$);return}}if(J===-1)J=this._mainRule.fontStyle;if(Q===0)Q=this._mainRule.foreground;if($===0)$=this._mainRule.background;this._rulesWithParentScopes.push(new A8(Y,X,J,Q,$))}},oY=class Z{static toBinaryStr(Y){return Y.toString(2).padStart(32,"0")}static print(Y){let X=Z.getLanguageId(Y),J=Z.getTokenType(Y),Q=Z.getFontStyle(Y),$=Z.getForeground(Y),K=Z.getBackground(Y);console.log({languageId:X,tokenType:J,fontStyle:Q,foreground:$,background:K})}static getLanguageId(Y){return(Y&255)>>>0}static getTokenType(Y){return(Y&768)>>>8}static containsBalancedBrackets(Y){return(Y&1024)!==0}static getFontStyle(Y){return(Y&30720)>>>11}static getForeground(Y){return(Y&16744448)>>>15}static getBackground(Y){return(Y&4278190080)>>>24}static set(Y,X,J,Q,$,K,U){let W=Z.getLanguageId(Y),z=Z.getTokenType(Y),H=Z.containsBalancedBrackets(Y)?1:0,G=Z.getFontStyle(Y),F=Z.getForeground(Y),M=Z.getBackground(Y);if(X!==0)W=X;if(J!==8)z=MK(J);if(Q!==null)H=Q?1:0;if($!==-1)G=$;if(K!==0)F=K;if(U!==0)M=U;return(W<<0|z<<8|H<<10|G<<11|F<<15|M<<24)>>>0}};function FK(Z){return Z}function MK(Z){return Z}function K0(Z,Y){let X=[],J=NK(Z),Q=J.next();while(Q!==null){let W=0;if(Q.length===2&&Q.charAt(1)===":"){switch(Q.charAt(0)){case"R":W=1;break;case"L":W=-1;break;default:console.log(`Unknown priority ${Q} in scope selector`)}Q=J.next()}let z=K();if(X.push({matcher:z,priority:W}),Q!==",")break;Q=J.next()}return X;function $(){if(Q==="-"){Q=J.next();let W=$();return(z)=>!!W&&!W(z)}if(Q==="("){Q=J.next();let W=U();if(Q===")")Q=J.next();return W}if(j5(Q)){let W=[];do W.push(Q),Q=J.next();while(j5(Q));return(z)=>Y(W,z)}return null}function K(){let W=[],z=$();while(z)W.push(z),z=$();return(H)=>W.every((G)=>G(H))}function U(){let W=[],z=K();while(z){if(W.push(z),Q==="|"||Q===",")do Q=J.next();while(Q==="|"||Q===",");else break;z=K()}return(H)=>W.some((G)=>G(H))}}function j5(Z){return!!Z&&!!Z.match(/[\w\.:]+/)}function NK(Z){let Y=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,X=Y.exec(Z);return{next:()=>{if(!X)return null;let J=X[0];return X=Y.exec(Z),J}}}function r5(Z){if(typeof Z.dispose==="function")Z.dispose()}var V4=class{constructor(Z){this.scopeName=Z}toKey(){return this.scopeName}},AK=class{constructor(Z,Y){this.scopeName=Z,this.ruleName=Y}toKey(){return`${this.scopeName}#${this.ruleName}`}},_K=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(Z){let Y=Z.toKey();if(this._seenReferenceKeys.has(Y))return;this._seenReferenceKeys.add(Y),this._references.push(Z)}},wK=class{constructor(Z,Y){this.repo=Z,this.initialScopeName=Y,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new V4(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let Z=this.Q;this.Q=[];let Y=new _K;for(let X of Z)BK(X,this.initialScopeName,this.repo,Y);for(let X of Y.references)if(X instanceof V4){if(this.seenFullScopeRequests.has(X.scopeName))continue;this.seenFullScopeRequests.add(X.scopeName),this.Q.push(X)}else{if(this.seenFullScopeRequests.has(X.scopeName))continue;if(this.seenPartialScopeRequests.has(X.toKey()))continue;this.seenPartialScopeRequests.add(X.toKey()),this.Q.push(X)}}};function BK(Z,Y,X,J){let Q=X.lookup(Z.scopeName);if(!Q){if(Z.scopeName===Y)throw Error(`No grammar provided for <${Y}>`);return}let $=X.lookup(Y);if(Z instanceof V4)$0({baseGrammar:$,selfGrammar:Q},J);else _8(Z.ruleName,{baseGrammar:$,selfGrammar:Q,repository:Q.repository},J);let K=X.injections(Z.scopeName);if(K)for(let U of K)J.add(new V4(U))}function _8(Z,Y,X){if(Y.repository&&Y.repository[Z]){let J=Y.repository[Z];W0([J],Y,X)}}function $0(Z,Y){if(Z.selfGrammar.patterns&&Array.isArray(Z.selfGrammar.patterns))W0(Z.selfGrammar.patterns,{...Z,repository:Z.selfGrammar.repository},Y);if(Z.selfGrammar.injections)W0(Object.values(Z.selfGrammar.injections),{...Z,repository:Z.selfGrammar.repository},Y)}function W0(Z,Y,X){for(let J of Z){if(X.visitedRule.has(J))continue;X.visitedRule.add(J);let Q=J.repository?u5({},Y.repository,J.repository):Y.repository;if(Array.isArray(J.patterns))W0(J.patterns,{...Y,repository:Q},X);let $=J.include;if(!$)continue;let K=o5($);switch(K.kind){case 0:$0({...Y,selfGrammar:Y.baseGrammar},X);break;case 1:$0(Y,X);break;case 2:_8(K.ruleName,{...Y,repository:Q},X);break;case 3:case 4:let U=K.scopeName===Y.selfGrammar.scopeName?Y.selfGrammar:K.scopeName===Y.baseGrammar.scopeName?Y.baseGrammar:void 0;if(U){let W={baseGrammar:Y.baseGrammar,selfGrammar:U,repository:Q};if(K.kind===4)_8(K.ruleName,W,X);else $0(W,X)}else if(K.kind===4)X.add(new AK(K.scopeName,K.ruleName));else X.add(new V4(K.scopeName));break}}}var LK=class{kind=0},PK=class{kind=1},CK=class{constructor(Z){this.ruleName=Z}kind=2},RK=class{constructor(Z){this.scopeName=Z}kind=3},vK=class{constructor(Z,Y){this.scopeName=Z,this.ruleName=Y}kind=4};function o5(Z){if(Z==="$base")return new LK;else if(Z==="$self")return new PK;let Y=Z.indexOf("#");if(Y===-1)return new RK(Z);else if(Y===0)return new CK(Z.substring(1));else{let X=Z.substring(0,Y),J=Z.substring(Y+1);return new vK(X,J)}}var IK=/\\(\d+)/,S5=/\\(\d+)/g,LG=Symbol("RuleId"),DK=-1,n5=-2;function a5(Z){return Z}function s5(Z){return Z}var T4=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(Z,Y,X,J){this.$location=Z,this.id=Y,this._name=X||null,this._nameIsCapturing=Q0.hasCaptures(this._name),this._contentName=J||null,this._contentNameIsCapturing=Q0.hasCaptures(this._contentName)}get debugName(){let Z=this.$location?`${m5(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${Z}`}getName(Z,Y){if(!this._nameIsCapturing||this._name===null||Z===null||Y===null)return this._name;return Q0.replaceCaptures(this._name,Z,Y)}getContentName(Z,Y){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return Q0.replaceCaptures(this._contentName,Z,Y)}},VK=class extends T4{retokenizeCapturedWithRuleId;constructor(Z,Y,X,J,Q){super(Z,Y,X,J);this.retokenizeCapturedWithRuleId=Q}dispose(){}collectPatterns(Z,Y){throw Error("Not supported!")}compile(Z,Y){throw Error("Not supported!")}compileAG(Z,Y,X,J){throw Error("Not supported!")}},EK=class extends T4{_match;captures;_cachedCompiledPatterns;constructor(Z,Y,X,J,Q){super(Z,Y,X,null);this._match=new E4(J,this.id),this.captures=Q,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(Z,Y){Y.push(this._match)}compile(Z,Y){return this._getCachedCompiledPatterns(Z).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new b4,this.collectPatterns(Z,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},y5=class extends T4{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(Z,Y,X,J,Q){super(Z,Y,X,J);this.patterns=Q.patterns,this.hasMissingPatterns=Q.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(Z,Y){for(let X of this.patterns)Z.getRule(X).collectPatterns(Z,Y)}compile(Z,Y){return this._getCachedCompiledPatterns(Z).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new b4,this.collectPatterns(Z,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},w8=class extends T4{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(Z,Y,X,J,Q,$,K,U,W,z){super(Z,Y,X,J);this._begin=new E4(Q,this.id),this.beginCaptures=$,this._end=new E4(K?K:"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=U,this.applyEndPatternLast=W||!1,this.patterns=z.patterns,this.hasMissingPatterns=z.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(Z,Y){return this._end.resolveBackReferences(Z,Y)}collectPatterns(Z,Y){Y.push(this._begin)}compile(Z,Y){return this._getCachedCompiledPatterns(Z,Y).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z,Y).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z,Y){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new b4;for(let X of this.patterns)Z.getRule(X).collectPatterns(Z,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,Y);else this._cachedCompiledPatterns.setSource(0,Y);return this._cachedCompiledPatterns}},U0=class extends T4{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(Z,Y,X,J,Q,$,K,U,W){super(Z,Y,X,J);this._begin=new E4(Q,this.id),this.beginCaptures=$,this.whileCaptures=U,this._while=new E4(K,n5),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=W.patterns,this.hasMissingPatterns=W.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(Z,Y){return this._while.resolveBackReferences(Z,Y)}collectPatterns(Z,Y){Y.push(this._begin)}compile(Z,Y){return this._getCachedCompiledPatterns(Z).compile(Z)}compileAG(Z,Y,X,J){return this._getCachedCompiledPatterns(Z).compileAG(Z,X,J)}_getCachedCompiledPatterns(Z){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new b4;for(let Y of this.patterns)Z.getRule(Y).collectPatterns(Z,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(Z,Y){return this._getCachedCompiledWhilePatterns(Z,Y).compile(Z)}compileWhileAG(Z,Y,X,J){return this._getCachedCompiledWhilePatterns(Z,Y).compileAG(Z,X,J)}_getCachedCompiledWhilePatterns(Z,Y){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new b4,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,Y?Y:"");return this._cachedCompiledWhilePatterns}},t5=class Z{static createCaptureRule(Y,X,J,Q,$){return Y.registerRule((K)=>{return new VK(X,K,J,Q,$)})}static getCompiledRuleId(Y,X,J){if(!Y.id)X.registerRule((Q)=>{if(Y.id=Q,Y.match)return new EK(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.match,Z._compileCaptures(Y.captures,X,J));if(typeof Y.begin>"u"){if(Y.repository)J=u5({},J,Y.repository);let $=Y.patterns;if(typeof $>"u"&&Y.include)$=[{include:Y.include}];return new y5(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.contentName,Z._compilePatterns($,X,J))}if(Y.while)return new U0(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.contentName,Y.begin,Z._compileCaptures(Y.beginCaptures||Y.captures,X,J),Y.while,Z._compileCaptures(Y.whileCaptures||Y.captures,X,J),Z._compilePatterns(Y.patterns,X,J));return new w8(Y.$vscodeTextmateLocation,Y.id,Y.name,Y.contentName,Y.begin,Z._compileCaptures(Y.beginCaptures||Y.captures,X,J),Y.end,Z._compileCaptures(Y.endCaptures||Y.captures,X,J),Y.applyEndPatternLast,Z._compilePatterns(Y.patterns,X,J))});return Y.id}static _compileCaptures(Y,X,J){let Q=[];if(Y){let $=0;for(let K in Y){if(K==="$vscodeTextmateLocation")continue;let U=parseInt(K,10);if(U>$)$=U}for(let K=0;K<=$;K++)Q[K]=null;for(let K in Y){if(K==="$vscodeTextmateLocation")continue;let U=parseInt(K,10),W=0;if(Y[K].patterns)W=Z.getCompiledRuleId(Y[K],X,J);Q[U]=Z.createCaptureRule(X,Y[K].$vscodeTextmateLocation,Y[K].name,Y[K].contentName,W)}}return Q}static _compilePatterns(Y,X,J){let Q=[];if(Y)for(let $=0,K=Y.length;$<K;$++){let U=Y[$],W=-1;if(U.include){let z=o5(U.include);switch(z.kind){case 0:case 1:W=Z.getCompiledRuleId(J[U.include],X,J);break;case 2:let H=J[z.ruleName];if(H)W=Z.getCompiledRuleId(H,X,J);break;case 3:case 4:let G=z.scopeName,F=z.kind===4?z.ruleName:null,M=X.getExternalGrammar(G,J);if(M)if(F){let A=M.repository[F];if(A)W=Z.getCompiledRuleId(A,X,M.repository)}else W=Z.getCompiledRuleId(M.repository.$self,X,M.repository);break}}else W=Z.getCompiledRuleId(U,X,J);if(W!==-1){let z=X.getRule(W),H=!1;if(z instanceof y5||z instanceof w8||z instanceof U0){if(z.hasMissingPatterns&&z.patterns.length===0)H=!0}if(H)continue;Q.push(W)}}return{patterns:Q,hasMissingPatterns:(Y?Y.length:0)!==Q.length}}},E4=class Z{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(Y,X){if(Y&&typeof Y==="string"){let J=Y.length,Q=0,$=[],K=!1;for(let U=0;U<J;U++)if(Y.charAt(U)==="\\"){if(U+1<J){let z=Y.charAt(U+1);if(z==="z")$.push(Y.substring(Q,U)),$.push("$(?!\\n)(?<!\\n)"),Q=U+2;else if(z==="A"||z==="G")K=!0;U++}}if(this.hasAnchor=K,Q===0)this.source=Y;else $.push(Y.substring(Q,J)),this.source=$.join("")}else this.hasAnchor=!1,this.source=Y;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=X,typeof this.source==="string")this.hasBackReferences=IK.test(this.source);else this.hasBackReferences=!1}clone(){return new Z(this.source,this.ruleId)}setSource(Y){if(this.source===Y)return;if(this.source=Y,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(Y,X){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let J=X.map((Q)=>{return Y.substring(Q.start,Q.end)});return S5.lastIndex=0,this.source.replace(S5,(Q,$)=>{return c5(J[parseInt($,10)]||"")})}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let Y=[],X=[],J=[],Q=[],$,K,U,W;for($=0,K=this.source.length;$<K;$++)if(U=this.source.charAt($),Y[$]=U,X[$]=U,J[$]=U,Q[$]=U,U==="\\"){if($+1<K){if(W=this.source.charAt($+1),W==="A")Y[$+1]="",X[$+1]="",J[$+1]="A",Q[$+1]="A";else if(W==="G")Y[$+1]="",X[$+1]="G",J[$+1]="",Q[$+1]="G";else Y[$+1]=W,X[$+1]=W,J[$+1]=W,Q[$+1]=W;$++}}return{A0_G0:Y.join(""),A0_G1:X.join(""),A1_G0:J.join(""),A1_G1:Q.join("")}}resolveAnchors(Y,X){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(Y)if(X)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(X)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},b4=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(this._anchorCache.A1_G1)this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null}push(Z){this._items.push(Z),this._hasAnchors=this._hasAnchors||Z.hasAnchor}unshift(Z){this._items.unshift(Z),this._hasAnchors=this._hasAnchors||Z.hasAnchor}length(){return this._items.length}setSource(Z,Y){if(this._items[Z].source!==Y)this._disposeCaches(),this._items[Z].setSource(Y)}compile(Z){if(!this._cached){let Y=this._items.map((X)=>X.source);this._cached=new k5(Z,Y,this._items.map((X)=>X.ruleId))}return this._cached}compileAG(Z,Y,X){if(!this._hasAnchors)return this.compile(Z);else if(Y)if(X){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(Z,Y,X);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(Z,Y,X);return this._anchorCache.A1_G0}else if(X){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(Z,Y,X);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(Z,Y,X);return this._anchorCache.A0_G0}}_resolveAnchors(Z,Y,X){let J=this._items.map((Q)=>Q.resolveAnchors(Y,X));return new k5(Z,J,this._items.map((Q)=>Q.ruleId))}},k5=class{constructor(Z,Y,X){this.regExps=Y,this.rules=X,this.scanner=Z.createOnigScanner(Y)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let Z=[];for(let Y=0,X=this.rules.length;Y<X;Y++)Z.push(" - "+this.rules[Y]+": "+this.regExps[Y]);return Z.join(`
|
|
138
|
+
`)}findNextMatchSync(Z,Y,X){let J=this.scanner.findNextMatchSync(Z,Y,X);if(!J)return null;return{ruleId:this.rules[J.index],captureIndices:J.captureIndices}}},N8=class{constructor(Z,Y){this.languageId=Z,this.tokenType=Y}},bK=class Z{_defaultAttributes;_embeddedLanguagesMatcher;constructor(Y,X){this._defaultAttributes=new N8(Y,8),this._embeddedLanguagesMatcher=new TK(Object.entries(X||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(Y){if(Y===null)return Z._NULL_SCOPE_METADATA;return this._getBasicScopeAttributes.get(Y)}static _NULL_SCOPE_METADATA=new N8(0,0);_getBasicScopeAttributes=new l5((Y)=>{let X=this._scopeToLanguage(Y),J=this._toStandardTokenType(Y);return new N8(X,J)});_scopeToLanguage(Y){return this._embeddedLanguagesMatcher.match(Y)||0}_toStandardTokenType(Y){let X=Y.match(Z.STANDARD_TOKEN_TYPE_REGEXP);if(!X)return 8;switch(X[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},TK=class{values;scopesRegExp;constructor(Z){if(Z.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(Z);let Y=Z.map(([X,J])=>c5(X));Y.sort(),Y.reverse(),this.scopesRegExp=new RegExp(`^((${Y.join(")|(")}))($|\\.)`,"")}}match(Z){if(!this.scopesRegExp)return;let Y=Z.match(this.scopesRegExp);if(!Y)return;return this.values.get(Y[1])}},PG={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},e5=!1,h5=class{constructor(Z,Y){this.stack=Z,this.stoppedEarly=Y}};function Z6(Z,Y,X,J,Q,$,K,U){let W=Y.content.length,z=!1,H=-1;if(K){let M=fK(Z,Y,X,J,Q,$);Q=M.stack,J=M.linePos,X=M.isFirstLine,H=M.anchorPosition}let G=Date.now();while(!z){if(U!==0){if(Date.now()-G>U)return new h5(Q,!0)}F()}return new h5(Q,!1);function F(){let M=jK(Z,Y,X,J,Q,H);if(!M){$.produce(Q,W),z=!0;return}let{captureIndices:A,matchedRuleId:w}=M,P=A&&A.length>0?A[0].end>J:!1;if(w===DK){let B=Q.getRule(Z);$.produce(Q,A[0].start),Q=Q.withContentNameScopesList(Q.nameScopesList),v4(Z,Y,X,Q,$,B.endCaptures,A),$.produce(Q,A[0].end);let R=Q;if(Q=Q.parent,H=R.getAnchorPos(),!P&&R.getEnterPos()===J){Q=R,$.produce(Q,W),z=!0;return}}else{let B=Z.getRule(w);$.produce(Q,A[0].start);let R=Q,C=B.getName(Y.content,A),D=Q.contentNameScopesList.pushAttributed(C,Z);if(Q=Q.push(w,J,H,A[0].end===W,null,D,D),B instanceof w8){let j=B;v4(Z,Y,X,Q,$,j.beginCaptures,A),$.produce(Q,A[0].end),H=A[0].end;let E=j.getContentName(Y.content,A),d=D.pushAttributed(E,Z);if(Q=Q.withContentNameScopesList(d),j.endHasBackReferences)Q=Q.withEndRule(j.getEndWithResolvedBackReferences(Y.content,A));if(!P&&R.hasSameRuleAs(Q)){Q=Q.pop(),$.produce(Q,W),z=!0;return}}else if(B instanceof U0){let j=B;v4(Z,Y,X,Q,$,j.beginCaptures,A),$.produce(Q,A[0].end),H=A[0].end;let E=j.getContentName(Y.content,A),d=D.pushAttributed(E,Z);if(Q=Q.withContentNameScopesList(d),j.whileHasBackReferences)Q=Q.withEndRule(j.getWhileWithResolvedBackReferences(Y.content,A));if(!P&&R.hasSameRuleAs(Q)){Q=Q.pop(),$.produce(Q,W),z=!0;return}}else if(v4(Z,Y,X,Q,$,B.captures,A),$.produce(Q,A[0].end),Q=Q.pop(),!P){Q=Q.safePop(),$.produce(Q,W),z=!0;return}}if(A[0].end>J)J=A[0].end,X=!1}}function fK(Z,Y,X,J,Q,$){let K=Q.beginRuleCapturedEOL?0:-1,U=[];for(let W=Q;W;W=W.pop()){let z=W.getRule(Z);if(z instanceof U0)U.push({rule:z,stack:W})}for(let W=U.pop();W;W=U.pop()){let{ruleScanner:z,findOptions:H}=kK(W.rule,Z,W.stack.endRule,X,J===K),G=z.findNextMatchSync(Y,J,H);if(G){if(G.ruleId!==n5){Q=W.stack.pop();break}if(G.captureIndices&&G.captureIndices.length){if($.produce(W.stack,G.captureIndices[0].start),v4(Z,Y,X,W.stack,$,W.rule.whileCaptures,G.captureIndices),$.produce(W.stack,G.captureIndices[0].end),K=G.captureIndices[0].end,G.captureIndices[0].end>J)J=G.captureIndices[0].end,X=!1}}else{Q=W.stack.pop();break}}return{stack:Q,linePos:J,anchorPosition:K,isFirstLine:X}}function jK(Z,Y,X,J,Q,$){let K=SK(Z,Y,X,J,Q,$),U=Z.getInjections();if(U.length===0)return K;let W=yK(U,Z,Y,X,J,Q,$);if(!W)return K;if(!K)return W;let z=K.captureIndices[0].start,H=W.captureIndices[0].start;if(H<z||W.priorityMatch&&H===z)return W;return K}function SK(Z,Y,X,J,Q,$){let K=Q.getRule(Z),{ruleScanner:U,findOptions:W}=Y6(K,Z,Q.endRule,X,J===$),z=U.findNextMatchSync(Y,J,W);if(z)return{captureIndices:z.captureIndices,matchedRuleId:z.ruleId};return null}function yK(Z,Y,X,J,Q,$,K){let U=Number.MAX_VALUE,W=null,z,H=0,G=$.contentNameScopesList.getScopeNames();for(let F=0,M=Z.length;F<M;F++){let A=Z[F];if(!A.matcher(G))continue;let w=Y.getRule(A.ruleId),{ruleScanner:P,findOptions:B}=Y6(w,Y,null,J,Q===K),R=P.findNextMatchSync(X,Q,B);if(!R)continue;let C=R.captureIndices[0].start;if(C>=U)continue;if(U=C,W=R.captureIndices,z=R.ruleId,H=A.priority,U===Q)break}if(W)return{priorityMatch:H===-1,captureIndices:W,matchedRuleId:z};return null}function Y6(Z,Y,X,J,Q){if(e5){let K=Z.compile(Y,X),U=X6(J,Q);return{ruleScanner:K,findOptions:U}}return{ruleScanner:Z.compileAG(Y,X,J,Q),findOptions:0}}function kK(Z,Y,X,J,Q){if(e5){let K=Z.compileWhile(Y,X),U=X6(J,Q);return{ruleScanner:K,findOptions:U}}return{ruleScanner:Z.compileWhileAG(Y,X,J,Q),findOptions:0}}function X6(Z,Y){let X=0;if(!Z)X|=1;if(!Y)X|=4;return X}function v4(Z,Y,X,J,Q,$,K){if($.length===0)return;let U=Y.content,W=Math.min($.length,K.length),z=[],H=K[0].end;for(let G=0;G<W;G++){let F=$[G];if(F===null)continue;let M=K[G];if(M.length===0)continue;if(M.start>H)break;while(z.length>0&&z[z.length-1].endPos<=M.start)Q.produceFromScopes(z[z.length-1].scopes,z[z.length-1].endPos),z.pop();if(z.length>0)Q.produceFromScopes(z[z.length-1].scopes,M.start);else Q.produce(J,M.start);if(F.retokenizeCapturedWithRuleId){let w=F.getName(U,K),P=J.contentNameScopesList.pushAttributed(w,Z),B=F.getContentName(U,K),R=P.pushAttributed(B,Z),C=J.push(F.retokenizeCapturedWithRuleId,M.start,-1,!1,null,P,R),D=Z.createOnigString(U.substring(0,M.end));Z6(Z,D,X&&M.start===0,M.start,C,Q,!1,0),r5(D);continue}let A=F.getName(U,K);if(A!==null){let P=(z.length>0?z[z.length-1].scopes:J.contentNameScopesList).pushAttributed(A,Z);z.push(new hK(P,M.end))}}while(z.length>0)Q.produceFromScopes(z[z.length-1].scopes,z[z.length-1].endPos),z.pop()}var hK=class{scopes;endPos;constructor(Z,Y){this.scopes=Z,this.endPos=Y}};function xK(Z,Y,X,J,Q,$,K,U){return new uK(Z,Y,X,J,Q,$,K,U)}function x5(Z,Y,X,J,Q){let $=K0(Y,z0),K=t5.getCompiledRuleId(X,J,Q.repository);for(let U of $)Z.push({debugSelector:Y,matcher:U.matcher,ruleId:K,grammar:Q,priority:U.priority})}function z0(Z,Y){if(Y.length<Z.length)return!1;let X=0;return Z.every((J)=>{for(let Q=X;Q<Y.length;Q++)if(gK(Y[Q],J))return X=Q+1,!0;return!1})}function gK(Z,Y){if(!Z)return!1;if(Z===Y)return!0;let X=Y.length;return Z.length>X&&Z.substr(0,X)===Y&&Z[X]==="."}var uK=class{constructor(Z,Y,X,J,Q,$,K,U){if(this._rootScopeName=Z,this.balancedBracketSelectors=$,this._onigLib=U,this._basicScopeAttributesProvider=new bK(X,J),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=K,this._grammar=g5(Y,null),this._injections=null,this._tokenTypeMatchers=[],Q)for(let W of Object.keys(Q)){let z=K0(W,z0);for(let H of z)this._tokenTypeMatchers.push({matcher:H.matcher,type:Q[W]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let Z of this._ruleId2desc)if(Z)Z.dispose()}createOnigScanner(Z){return this._onigLib.createOnigScanner(Z)}createOnigString(Z){return this._onigLib.createOnigString(Z)}getMetadataForScope(Z){return this._basicScopeAttributesProvider.getBasicScopeAttributes(Z)}_collectInjections(){let Z={lookup:(Q)=>{if(Q===this._rootScopeName)return this._grammar;return this.getExternalGrammar(Q)},injections:(Q)=>{return this._grammarRepository.injections(Q)}},Y=[],X=this._rootScopeName,J=Z.lookup(X);if(J){let Q=J.injections;if(Q)for(let K in Q)x5(Y,K,Q[K],this,J);let $=this._grammarRepository.injections(X);if($)$.forEach((K)=>{let U=this.getExternalGrammar(K);if(U){let W=U.injectionSelector;if(W)x5(Y,W,U,this,U)}})}return Y.sort((Q,$)=>Q.priority-$.priority),Y}getInjections(){if(this._injections===null)this._injections=this._collectInjections();return this._injections}registerRule(Z){let Y=++this._lastRuleId,X=Z(a5(Y));return this._ruleId2desc[Y]=X,X}getRule(Z){return this._ruleId2desc[s5(Z)]}getExternalGrammar(Z,Y){if(this._includedGrammars[Z])return this._includedGrammars[Z];else if(this._grammarRepository){let X=this._grammarRepository.lookup(Z);if(X)return this._includedGrammars[Z]=g5(X,Y&&Y.$base),this._includedGrammars[Z]}return}tokenizeLine(Z,Y,X=0){let J=this._tokenize(Z,Y,!1,X);return{tokens:J.lineTokens.getResult(J.ruleStack,J.lineLength),ruleStack:J.ruleStack,stoppedEarly:J.stoppedEarly}}tokenizeLine2(Z,Y,X=0){let J=this._tokenize(Z,Y,!0,X);return{tokens:J.lineTokens.getBinaryResult(J.ruleStack,J.lineLength),ruleStack:J.ruleStack,stoppedEarly:J.stoppedEarly}}_tokenize(Z,Y,X,J){if(this._rootId===-1)this._rootId=t5.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections();let Q;if(!Y||Y===B8.NULL){Q=!0;let z=this._basicScopeAttributesProvider.getDefaultAttributes(),H=this.themeProvider.getDefaults(),G=oY.set(0,z.languageId,z.tokenType,null,H.fontStyle,H.foregroundId,H.backgroundId),F=this.getRule(this._rootId).getName(null,null),M;if(F)M=I4.createRootAndLookUpScopeName(F,G,this);else M=I4.createRoot("unknown",G);Y=new B8(null,this._rootId,-1,-1,!1,null,M,M)}else Q=!1,Y.reset();Z=Z+`
|
|
139
|
+
`;let $=this.createOnigString(Z),K=$.content.length,U=new pK(X,Z,this._tokenTypeMatchers,this.balancedBracketSelectors),W=Z6(this,$,Q,0,Y,U,!0,J);return r5($),{lineLength:K,lineTokens:U,ruleStack:W.stack,stoppedEarly:W.stoppedEarly}}};function g5(Z,Y){return Z=JK(Z),Z.repository=Z.repository||{},Z.repository.$self={$vscodeTextmateLocation:Z.$vscodeTextmateLocation,patterns:Z.patterns,name:Z.scopeName},Z.repository.$base=Y||Z.repository.$self,Z}var I4=class Z{constructor(Y,X,J){this.parent=Y,this.scopePath=X,this.tokenAttributes=J}static fromExtension(Y,X){let J=Y,Q=Y?.scopePath??null;for(let $ of X)Q=M8.push(Q,$.scopeNames),J=new Z(J,Q,$.encodedTokenAttributes);return J}static createRoot(Y,X){return new Z(null,new M8(null,Y),X)}static createRootAndLookUpScopeName(Y,X,J){let Q=J.getMetadataForScope(Y),$=new M8(null,Y),K=J.themeProvider.themeMatch($),U=Z.mergeAttributes(X,Q,K);return new Z(null,$,U)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(Y){return Z.equals(this,Y)}static equals(Y,X){do{if(Y===X)return!0;if(!Y&&!X)return!0;if(!Y||!X)return!1;if(Y.scopeName!==X.scopeName||Y.tokenAttributes!==X.tokenAttributes)return!1;Y=Y.parent,X=X.parent}while(!0)}static mergeAttributes(Y,X,J){let Q=-1,$=0,K=0;if(J!==null)Q=J.fontStyle,$=J.foregroundId,K=J.backgroundId;return oY.set(Y,X.languageId,X.tokenType,null,Q,$,K)}pushAttributed(Y,X){if(Y===null)return this;if(Y.indexOf(" ")===-1)return Z._pushAttributed(this,Y,X);let J=Y.split(/ /g),Q=this;for(let $ of J)Q=Z._pushAttributed(Q,$,X);return Q}static _pushAttributed(Y,X,J){let Q=J.getMetadataForScope(X),$=Y.scopePath.push(X),K=J.themeProvider.themeMatch($),U=Z.mergeAttributes(Y.tokenAttributes,Q,K);return new Z(Y,$,U)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(Y){let X=[],J=this;while(J&&J!==Y)X.push({encodedTokenAttributes:J.tokenAttributes,scopeNames:J.scopePath.getExtensionIfDefined(J.parent?.scopePath??null)}),J=J.parent;return J===Y?X.reverse():void 0}},B8=class Z{constructor(Y,X,J,Q,$,K,U,W){this.parent=Y,this.ruleId=X,this.beginRuleCapturedEOL=$,this.endRule=K,this.nameScopesList=U,this.contentNameScopesList=W,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=J,this._anchorPos=Q}_stackElementBrand=void 0;static NULL=new Z(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(Y){if(Y===null)return!1;return Z._equals(this,Y)}static _equals(Y,X){if(Y===X)return!0;if(!this._structuralEquals(Y,X))return!1;return I4.equals(Y.contentNameScopesList,X.contentNameScopesList)}static _structuralEquals(Y,X){do{if(Y===X)return!0;if(!Y&&!X)return!0;if(!Y||!X)return!1;if(Y.depth!==X.depth||Y.ruleId!==X.ruleId||Y.endRule!==X.endRule)return!1;Y=Y.parent,X=X.parent}while(!0)}clone(){return this}static _reset(Y){while(Y)Y._enterPos=-1,Y._anchorPos=-1,Y=Y.parent}reset(){Z._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(Y,X,J,Q,$,K,U){return new Z(this,Y,X,J,Q,$,K,U)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(Y){return Y.getRule(this.ruleId)}toString(){let Y=[];return this._writeString(Y,0),"["+Y.join(",")+"]"}_writeString(Y,X){if(this.parent)X=this.parent._writeString(Y,X);return Y[X++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,X}withContentNameScopesList(Y){if(this.contentNameScopesList===Y)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,Y)}withEndRule(Y){if(this.endRule===Y)return this;return new Z(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,Y,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(Y){let X=this;while(X&&X._enterPos===Y._enterPos){if(X.ruleId===Y.ruleId)return!0;X=X.parent}return!1}toStateStackFrame(){return{ruleId:s5(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(Y,X){let J=I4.fromExtension(Y?.nameScopesList??null,X.nameScopesList);return new Z(Y,a5(X.ruleId),X.enterPos??-1,X.anchorPos??-1,X.beginRuleCapturedEOL,X.endRule,J,I4.fromExtension(J,X.contentNameScopesList))}},mK=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(Z,Y){this.balancedBracketScopes=Z.flatMap((X)=>{if(X==="*")return this.allowAny=!0,[];return K0(X,z0).map((J)=>J.matcher)}),this.unbalancedBracketScopes=Y.flatMap((X)=>K0(X,z0).map((J)=>J.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(Z){for(let Y of this.unbalancedBracketScopes)if(Y(Z))return!1;for(let Y of this.balancedBracketScopes)if(Y(Z))return!0;return this.allowAny}},pK=class{constructor(Z,Y,X,J){this.balancedBracketSelectors=J,this._emitBinaryTokens=Z,this._tokenTypeOverrides=X,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(Z,Y){this.produceFromScopes(Z.contentNameScopesList,Y)}produceFromScopes(Z,Y){if(this._lastTokenEndIndex>=Y)return;if(this._emitBinaryTokens){let J=Z?.tokenAttributes??0,Q=!1;if(this.balancedBracketSelectors?.matchesAlways)Q=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let $=Z?.getScopeNames()??[];for(let K of this._tokenTypeOverrides)if(K.matcher($))J=oY.set(J,0,FK(K.type),null,-1,0,0);if(this.balancedBracketSelectors)Q=this.balancedBracketSelectors.match($)}if(Q)J=oY.set(J,0,8,Q,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===J){this._lastTokenEndIndex=Y;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(J),this._lastTokenEndIndex=Y;return}let X=Z?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:Y,scopes:X}),this._lastTokenEndIndex=Y}getResult(Z,Y){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===Y-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(Z,Y),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(Z,Y){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===Y-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(Z,Y),this._binaryTokens[this._binaryTokens.length-2]=0;let X=new Uint32Array(this._binaryTokens.length);for(let J=0,Q=this._binaryTokens.length;J<Q;J++)X[J]=this._binaryTokens[J];return X}},dK=class{constructor(Z,Y){this._onigLib=Y,this._theme=Z}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let Z of this._grammars.values())Z.dispose()}setTheme(Z){this._theme=Z}getColorMap(){return this._theme.getColorMap()}addGrammar(Z,Y){if(this._rawGrammars.set(Z.scopeName,Z),Y)this._injectionGrammars.set(Z.scopeName,Y)}lookup(Z){return this._rawGrammars.get(Z)}injections(Z){return this._injectionGrammars.get(Z)}getDefaults(){return this._theme.getDefaults()}themeMatch(Z){return this._theme.match(Z)}grammarForScopeName(Z,Y,X,J,Q){if(!this._grammars.has(Z)){let $=this._rawGrammars.get(Z);if(!$)return null;this._grammars.set(Z,xK(Z,$,Y,X,J,Q,this,this._onigLib))}return this._grammars.get(Z)}},J6=class{_options;_syncRegistry;_ensureGrammarCache;constructor(Z){this._options=Z,this._syncRegistry=new dK(D4.createFromRawTheme(Z.theme,Z.colorMap),Z.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(Z,Y){this._syncRegistry.setTheme(D4.createFromRawTheme(Z,Y))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(Z,Y,X){return this.loadGrammarWithConfiguration(Z,Y,{embeddedLanguages:X})}loadGrammarWithConfiguration(Z,Y,X){return this._loadGrammar(Z,Y,X.embeddedLanguages,X.tokenTypes,new mK(X.balancedBracketSelectors||[],X.unbalancedBracketSelectors||[]))}loadGrammar(Z){return this._loadGrammar(Z,0,null,null,null)}_loadGrammar(Z,Y,X,J,Q){let $=new wK(this._syncRegistry,Z);while($.Q.length>0)$.Q.map((K)=>this._loadSingleGrammar(K.scopeName)),$.processQueue();return this._grammarForScopeName(Z,Y,X,J,Q)}_loadSingleGrammar(Z){if(!this._ensureGrammarCache.has(Z))this._doLoadSingleGrammar(Z),this._ensureGrammarCache.set(Z,!0)}_doLoadSingleGrammar(Z){let Y=this._options.loadGrammar(Z);if(Y){let X=typeof this._options.getInjections==="function"?this._options.getInjections(Z):void 0;this._syncRegistry.addGrammar(Y,X)}}addGrammar(Z,Y=[],X=0,J=null){return this._syncRegistry.addGrammar(Z,Y),this._grammarForScopeName(Z.scopeName,X,J)}_grammarForScopeName(Z,Y=0,X=null,J=null,Q=null){return this._syncRegistry.grammarForScopeName(Z,Y,X,J,Q)}},H0=B8.NULL;var Q6=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class fY{constructor(Z,Y,X){if(this.normal=Y,this.property=Z,X)this.space=X}}fY.prototype.normal={};fY.prototype.property={};fY.prototype.space=void 0;function P8(Z,Y){let X={},J={};for(let Q of Z)Object.assign(X,Q.property),Object.assign(J,Q.normal);return new fY(X,J,Y)}function f4(Z){return Z.toLowerCase()}class wZ{constructor(Z,Y){this.attribute=Y,this.property=Z}}wZ.prototype.attribute="";wZ.prototype.booleanish=!1;wZ.prototype.boolean=!1;wZ.prototype.commaOrSpaceSeparated=!1;wZ.prototype.commaSeparated=!1;wZ.prototype.defined=!1;wZ.prototype.mustUseProperty=!1;wZ.prototype.number=!1;wZ.prototype.overloadedBoolean=!1;wZ.prototype.property="";wZ.prototype.spaceSeparated=!1;wZ.prototype.space=void 0;var j4={};cK(j4,{spaceSeparated:()=>l,overloadedBoolean:()=>G0,number:()=>I,commaSeparated:()=>jY,commaOrSpaceSeparated:()=>fZ,booleanish:()=>XZ,boolean:()=>y});var lK=0,y=nY(),XZ=nY(),G0=nY(),I=nY(),l=nY(),jY=nY(),fZ=nY();function nY(){return 2**++lK}var C8=Object.keys(j4);class q4 extends wZ{constructor(Z,Y,X,J){let Q=-1;super(Z,Y);if($6(this,"space",J),typeof X==="number")while(++Q<C8.length){let $=C8[Q];$6(this,C8[Q],(X&j4[$])===j4[$])}}}q4.prototype.defined=!0;function $6(Z,Y,X){if(X)Z[Y]=X}function mZ(Z){let Y={},X={};for(let[J,Q]of Object.entries(Z.properties)){let $=new q4(J,Z.transform(Z.attributes||{},J),Q,Z.space);if(Z.mustUseProperty&&Z.mustUseProperty.includes(J))$.mustUseProperty=!0;Y[J]=$,X[f4(J)]=J,X[f4($.attribute)]=J}return new fY(Y,X,Z.space)}var R8=mZ({properties:{ariaActiveDescendant:null,ariaAtomic:XZ,ariaAutoComplete:null,ariaBusy:XZ,ariaChecked:XZ,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:l,ariaCurrent:null,ariaDescribedBy:l,ariaDetails:null,ariaDisabled:XZ,ariaDropEffect:l,ariaErrorMessage:null,ariaExpanded:XZ,ariaFlowTo:l,ariaGrabbed:XZ,ariaHasPopup:null,ariaHidden:XZ,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l,ariaLevel:I,ariaLive:null,ariaModal:XZ,ariaMultiLine:XZ,ariaMultiSelectable:XZ,ariaOrientation:null,ariaOwns:l,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:XZ,ariaReadOnly:XZ,ariaRelevant:null,ariaRequired:XZ,ariaRoleDescription:l,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:XZ,ariaSetSize:I,ariaSort:null,ariaValueMax:I,ariaValueMin:I,ariaValueNow:I,ariaValueText:null,role:null},transform(Z,Y){return Y==="role"?Y:"aria-"+Y.slice(4).toLowerCase()}});function O0(Z,Y){return Y in Z?Z[Y]:Y}function q0(Z,Y){return O0(Z,Y.toLowerCase())}var K6=mZ({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:jY,acceptCharset:l,accessKey:l,action:null,allow:null,allowFullScreen:y,allowPaymentRequest:y,allowUserMedia:y,alt:null,as:null,async:y,autoCapitalize:null,autoComplete:l,autoFocus:y,autoPlay:y,blocking:l,capture:null,charSet:null,checked:y,cite:null,className:l,cols:I,colSpan:null,content:null,contentEditable:XZ,controls:y,controlsList:l,coords:I|jY,crossOrigin:null,data:null,dateTime:null,decoding:null,default:y,defer:y,dir:null,dirName:null,disabled:y,download:G0,draggable:XZ,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:y,formTarget:null,headers:l,height:I,hidden:G0,high:I,href:null,hrefLang:null,htmlFor:l,httpEquiv:l,id:null,imageSizes:null,imageSrcSet:null,inert:y,inputMode:null,integrity:null,is:null,isMap:y,itemId:null,itemProp:l,itemRef:l,itemScope:y,itemType:l,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:y,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:y,muted:y,name:null,nonce:null,noModule:y,noValidate:y,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:y,optimum:I,pattern:null,ping:l,placeholder:null,playsInline:y,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:y,referrerPolicy:null,rel:l,required:y,reversed:y,rows:I,rowSpan:I,sandbox:l,scope:null,scoped:y,seamless:y,selected:y,shadowRootClonable:y,shadowRootDelegatesFocus:y,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:XZ,src:null,srcDoc:null,srcLang:null,srcSet:null,start:I,step:null,style:null,tabIndex:I,target:null,title:null,translate:null,type:null,typeMustMatch:y,useMap:null,value:XZ,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:l,axis:null,background:null,bgColor:null,border:I,borderColor:null,bottomMargin:I,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:y,declare:y,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:y,noHref:y,noShade:y,noWrap:y,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:XZ,standby:null,summary:null,text:null,topMargin:I,valueType:null,version:null,vAlign:null,vLink:null,vSpace:I,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:y,disableRemotePlayback:y,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:q0});var W6=mZ({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:fZ,accentHeight:I,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:I,amplitude:I,arabicForm:null,ascent:I,attributeName:null,attributeType:null,azimuth:I,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:I,by:null,calcMode:null,capHeight:I,className:l,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:y,dx:null,dy:null,edgeMode:null,editable:null,elevation:I,enableBackground:null,end:null,event:null,exponent:I,externalResourcesRequired:null,fill:null,fillOpacity:I,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:jY,g2:jY,glyphName:jY,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:I,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:I,horizOriginX:I,horizOriginY:I,id:null,ideographic:I,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:I,k:I,k1:I,k2:I,k3:I,k4:I,kernelMatrix:fZ,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:I,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:I,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:I,overlineThickness:I,paintOrder:null,panose1:null,path:null,pathLength:I,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:l,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fZ,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fZ,rev:fZ,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fZ,requiredFeatures:fZ,requiredFonts:fZ,requiredFormats:fZ,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:I,specularExponent:I,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:I,strikethroughThickness:I,string:null,stroke:null,strokeDashArray:fZ,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:I,strokeOpacity:I,strokeWidth:null,style:null,surfaceScale:I,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fZ,tabIndex:I,tableValues:null,target:null,targetX:I,targetY:I,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fZ,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:I,underlineThickness:I,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:I,values:null,vAlphabetic:I,vMathematical:I,vectorEffect:null,vHanging:I,vIdeographic:I,version:null,vertAdvY:I,vertOriginX:I,vertOriginY:I,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:I,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:O0});var v8=mZ({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(Z,Y){return"xlink:"+Y.slice(5).toLowerCase()}});var I8=mZ({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:q0});var D8=mZ({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(Z,Y){return"xml:"+Y.slice(3).toLowerCase()}});var iK=/[A-Z]/g,U6=/-[a-z]/g,rK=/^data[-\w.:]+$/i;function V8(Z,Y){let X=f4(Y),J=Y,Q=wZ;if(X in Z.normal)return Z.property[Z.normal[X]];if(X.length>4&&X.slice(0,4)==="data"&&rK.test(Y)){if(Y.charAt(4)==="-"){let $=Y.slice(5).replace(U6,nK);J="data"+$.charAt(0).toUpperCase()+$.slice(1)}else{let $=Y.slice(4);if(!U6.test($)){let K=$.replace(iK,oK);if(K.charAt(0)!=="-")K="-"+K;Y="data"+K}}Q=q4}return new Q(J,Y)}function oK(Z){return"-"+Z.toLowerCase()}function nK(Z){return Z.charAt(1).toUpperCase()}var z6=P8([R8,K6,v8,I8,D8],"html"),F0=P8([R8,W6,v8,I8,D8],"svg");var H6={}.hasOwnProperty;function G6(Z,Y){let X=Y||{};function J(Q,...$){let{invalid:K,handlers:U}=J;if(Q&&H6.call(Q,Z)){let W=String(Q[Z]);K=H6.call(U,W)?U[W]:J.unknown}if(K)return K.call(this,Q,...$)}return J.handlers=X.handlers||{},J.invalid=X.invalid,J.unknown=X.unknown,J}var aK=/["&'<>`]/g,sK=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,tK=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,eK=/[|\\{}()[\]^$+*?.]/g,O6=new WeakMap;function q6(Z,Y){if(Z=Z.replace(Y.subset?Z7(Y.subset):aK,J),Y.subset||Y.escapeOnly)return Z;return Z.replace(sK,X).replace(tK,J);function X(Q,$,K){return Y.format((Q.charCodeAt(0)-55296)*1024+Q.charCodeAt(1)-56320+65536,K.charCodeAt($+2),Y)}function J(Q,$,K){return Y.format(Q.charCodeAt(0),K.charCodeAt($+1),Y)}}function Z7(Z){let Y=O6.get(Z);if(!Y)Y=Y7(Z),O6.set(Z,Y);return Y}function Y7(Z){let Y=[],X=-1;while(++X<Z.length)Y.push(Z[X].replace(eK,"\\$&"));return new RegExp("(?:"+Y.join("|")+")","g")}var X7=/[\dA-Fa-f]/;function F6(Z,Y,X){let J="&#x"+Z.toString(16).toUpperCase();return X&&Y&&!X7.test(String.fromCharCode(Y))?J:J+";"}var J7=/\d/;function M6(Z,Y,X){let J="&#"+String(Z);return X&&Y&&!J7.test(String.fromCharCode(Y))?J:J+";"}var N6=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var M0={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"};var A6=["cent","copy","divide","gt","lt","not","para","times"];var _6={}.hasOwnProperty,E8={},N0;for(N0 in M0)if(_6.call(M0,N0))E8[M0[N0]]=N0;var Q7=/[^\dA-Za-z]/;function w6(Z,Y,X,J){let Q=String.fromCharCode(Z);if(_6.call(E8,Q)){let $=E8[Q],K="&"+$;if(X&&N6.includes($)&&!A6.includes($)&&(!J||Y&&Y!==61&&Q7.test(String.fromCharCode(Y))))return K;return K+";"}return""}function B6(Z,Y,X){let J=F6(Z,Y,X.omitOptionalSemicolons),Q;if(X.useNamedReferences||X.useShortestReferences)Q=w6(Z,Y,X.omitOptionalSemicolons,X.attribute);if((X.useShortestReferences||!Q)&&X.useShortestReferences){let $=M6(Z,Y,X.omitOptionalSemicolons);if($.length<J.length)J=$}return Q&&(!X.useShortestReferences||Q.length<J.length)?Q:J}function PY(Z,Y){return q6(Z,Object.assign({format:B6},Y))}var $7=/^>|^->|<!--|-->|--!>|<!-$/g,K7=[">"],W7=["<",">"];function L6(Z,Y,X,J){return J.settings.bogusComments?"<?"+PY(Z.value,Object.assign({},J.settings.characterReferences,{subset:K7}))+">":"<!--"+Z.value.replace($7,Q)+"-->";function Q($){return PY($,Object.assign({},J.settings.characterReferences,{subset:W7}))}}function P6(Z,Y,X,J){return"<!"+(J.settings.upperDoctype?"DOCTYPE":"doctype")+(J.settings.tightDoctype?"":" ")+"html>"}function b8(Z,Y){let X=String(Z);if(typeof Y!=="string")throw TypeError("Expected character");let J=0,Q=X.indexOf(Y);while(Q!==-1)J++,Q=X.indexOf(Y,Q+Y.length);return J}function C6(Z,Y){let X=Y||{};return(Z[Z.length-1]===""?[...Z,""]:Z).join((X.padRight?" ":"")+","+(X.padLeft===!1?"":" ")).trim()}function R6(Z){return Z.join(" ").trim()}var U7=/[ \t\n\f\r]/g;function aY(Z){return typeof Z==="object"?Z.type==="text"?v6(Z.value):!1:v6(Z)}function v6(Z){return Z.replace(U7,"")===""}var QZ=I6(1),T8=I6(-1),z7=[];function I6(Z){return Y;function Y(X,J,Q){let $=X?X.children:z7,K=(J||0)+Z,U=$[K];if(!Q)while(U&&aY(U))K+=Z,U=$[K];return U}}var H7={}.hasOwnProperty;function A0(Z){return Y;function Y(X,J,Q){return H7.call(Z,X.tagName)&&Z[X.tagName](X,J,Q)}}var S4=A0({body:O7,caption:f8,colgroup:f8,dd:N7,dt:M7,head:f8,html:G7,li:F7,optgroup:A7,option:_7,p:q7,rp:D6,rt:D6,tbody:B7,td:V6,tfoot:L7,th:V6,thead:w7,tr:P7});function f8(Z,Y,X){let J=QZ(X,Y,!0);return!J||J.type!=="comment"&&!(J.type==="text"&&aY(J.value.charAt(0)))}function G7(Z,Y,X){let J=QZ(X,Y);return!J||J.type!=="comment"}function O7(Z,Y,X){let J=QZ(X,Y);return!J||J.type!=="comment"}function q7(Z,Y,X){let J=QZ(X,Y);return J?J.type==="element"&&(J.tagName==="address"||J.tagName==="article"||J.tagName==="aside"||J.tagName==="blockquote"||J.tagName==="details"||J.tagName==="div"||J.tagName==="dl"||J.tagName==="fieldset"||J.tagName==="figcaption"||J.tagName==="figure"||J.tagName==="footer"||J.tagName==="form"||J.tagName==="h1"||J.tagName==="h2"||J.tagName==="h3"||J.tagName==="h4"||J.tagName==="h5"||J.tagName==="h6"||J.tagName==="header"||J.tagName==="hgroup"||J.tagName==="hr"||J.tagName==="main"||J.tagName==="menu"||J.tagName==="nav"||J.tagName==="ol"||J.tagName==="p"||J.tagName==="pre"||J.tagName==="section"||J.tagName==="table"||J.tagName==="ul"):!X||!(X.type==="element"&&(X.tagName==="a"||X.tagName==="audio"||X.tagName==="del"||X.tagName==="ins"||X.tagName==="map"||X.tagName==="noscript"||X.tagName==="video"))}function F7(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&J.tagName==="li"}function M7(Z,Y,X){let J=QZ(X,Y);return Boolean(J&&J.type==="element"&&(J.tagName==="dt"||J.tagName==="dd"))}function N7(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&(J.tagName==="dt"||J.tagName==="dd")}function D6(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&(J.tagName==="rp"||J.tagName==="rt")}function A7(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&J.tagName==="optgroup"}function _7(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&(J.tagName==="option"||J.tagName==="optgroup")}function w7(Z,Y,X){let J=QZ(X,Y);return Boolean(J&&J.type==="element"&&(J.tagName==="tbody"||J.tagName==="tfoot"))}function B7(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&(J.tagName==="tbody"||J.tagName==="tfoot")}function L7(Z,Y,X){return!QZ(X,Y)}function P7(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&J.tagName==="tr"}function V6(Z,Y,X){let J=QZ(X,Y);return!J||J.type==="element"&&(J.tagName==="td"||J.tagName==="th")}var E6=A0({body:v7,colgroup:I7,head:R7,html:C7,tbody:D7});function C7(Z){let Y=QZ(Z,-1);return!Y||Y.type!=="comment"}function R7(Z){let Y=new Set;for(let J of Z.children)if(J.type==="element"&&(J.tagName==="base"||J.tagName==="title")){if(Y.has(J.tagName))return!1;Y.add(J.tagName)}let X=Z.children[0];return!X||X.type==="element"}function v7(Z){let Y=QZ(Z,-1,!0);return!Y||Y.type!=="comment"&&!(Y.type==="text"&&aY(Y.value.charAt(0)))&&!(Y.type==="element"&&(Y.tagName==="meta"||Y.tagName==="link"||Y.tagName==="script"||Y.tagName==="style"||Y.tagName==="template"))}function I7(Z,Y,X){let J=T8(X,Y),Q=QZ(Z,-1,!0);if(X&&J&&J.type==="element"&&J.tagName==="colgroup"&&S4(J,X.children.indexOf(J),X))return!1;return Boolean(Q&&Q.type==="element"&&Q.tagName==="col")}function D7(Z,Y,X){let J=T8(X,Y),Q=QZ(Z,-1);if(X&&J&&J.type==="element"&&(J.tagName==="thead"||J.tagName==="tbody")&&S4(J,X.children.indexOf(J),X))return!1;return Boolean(Q&&Q.type==="element"&&Q.tagName==="tr")}var _0={name:[[`
|
|
140
|
+
\f\r &/=>`.split(""),`
|
|
141
|
+
\f\r "&'/=>\``.split("")],[`\x00
|
|
142
|
+
\f\r "&'/<=>`.split(""),`\x00
|
|
143
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
144
|
+
\f\r &>`.split(""),`\x00
|
|
145
|
+
\f\r "&'<=>\``.split("")],[`\x00
|
|
146
|
+
\f\r "&'<=>\``.split(""),`\x00
|
|
147
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\x00&'".split(""),"\x00\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\x00"&'.split(""),"\x00\"&'`".split("")]]};function b6(Z,Y,X,J){let Q=J.schema,$=Q.space==="svg"?!1:J.settings.omitOptionalTags,K=Q.space==="svg"?J.settings.closeEmptyElements:J.settings.voids.includes(Z.tagName.toLowerCase()),U=[],W;if(Q.space==="html"&&Z.tagName==="svg")J.schema=F0;let z=V7(J,Z.properties),H=J.all(Q.space==="html"&&Z.tagName==="template"?Z.content:Z);if(J.schema=Q,H)K=!1;if(z||!$||!E6(Z,Y,X)){if(U.push("<",Z.tagName,z?" "+z:""),K&&(Q.space==="svg"||J.settings.closeSelfClosing)){if(W=z.charAt(z.length-1),!J.settings.tightSelfClosing||W==="/"||W&&W!=='"'&&W!=="'")U.push(" ");U.push("/")}U.push(">")}if(U.push(H),!K&&(!$||!S4(Z,Y,X)))U.push("</"+Z.tagName+">");return U.join("")}function V7(Z,Y){let X=[],J=-1,Q;if(Y){for(Q in Y)if(Y[Q]!==null&&Y[Q]!==void 0){let $=E7(Z,Q,Y[Q]);if($)X.push($)}}while(++J<X.length){let $=Z.settings.tightAttributes?X[J].charAt(X[J].length-1):void 0;if(J!==X.length-1&&$!=='"'&&$!=="'")X[J]+=" "}return X.join("")}function E7(Z,Y,X){let J=V8(Z.schema,Y),Q=Z.settings.allowParseErrors&&Z.schema.space==="html"?0:1,$=Z.settings.allowDangerousCharacters?0:1,K=Z.quote,U;if(J.overloadedBoolean&&(X===J.attribute||X===""))X=!0;else if((J.boolean||J.overloadedBoolean)&&(typeof X!=="string"||X===J.attribute||X===""))X=Boolean(X);if(X===null||X===void 0||X===!1||typeof X==="number"&&Number.isNaN(X))return"";let W=PY(J.attribute,Object.assign({},Z.settings.characterReferences,{subset:_0.name[Q][$]}));if(X===!0)return W;if(X=Array.isArray(X)?(J.commaSeparated?C6:R6)(X,{padLeft:!Z.settings.tightCommaSeparatedLists}):String(X),Z.settings.collapseEmptyAttributes&&!X)return W;if(Z.settings.preferUnquoted)U=PY(X,Object.assign({},Z.settings.characterReferences,{attribute:!0,subset:_0.unquoted[Q][$]}));if(U!==X){if(Z.settings.quoteSmart&&b8(X,K)>b8(X,Z.alternative))K=Z.alternative;U=K+PY(X,Object.assign({},Z.settings.characterReferences,{subset:(K==="'"?_0.single:_0.double)[Q][$],attribute:!0}))+K}return W+(U?"="+U:U)}var b7=["<","&"];function w0(Z,Y,X,J){return X&&X.type==="element"&&(X.tagName==="script"||X.tagName==="style")?Z.value:PY(Z.value,Object.assign({},J.settings.characterReferences,{subset:b7}))}function T6(Z,Y,X,J){return J.settings.allowDangerousHtml?Z.value:w0(Z,Y,X,J)}function f6(Z,Y,X,J){return J.all(Z)}var j6=G6("type",{invalid:T7,unknown:f7,handlers:{comment:L6,doctype:P6,element:b6,raw:T6,root:f6,text:w0}});function T7(Z){throw Error("Expected node, not `"+Z+"`")}function f7(Z){throw Error("Cannot compile unknown node `"+Z.type+"`")}var j7={},S7={},y7=[];function j8(Z,Y){let X=Y||j7,J=X.quote||'"',Q=J==='"'?"'":'"';if(J!=='"'&&J!=="'")throw Error("Invalid quote `"+J+"`, expected `'` or `\"`");return{one:k7,all:h7,settings:{omitOptionalTags:X.omitOptionalTags||!1,allowParseErrors:X.allowParseErrors||!1,allowDangerousCharacters:X.allowDangerousCharacters||!1,quoteSmart:X.quoteSmart||!1,preferUnquoted:X.preferUnquoted||!1,tightAttributes:X.tightAttributes||!1,upperDoctype:X.upperDoctype||!1,tightDoctype:X.tightDoctype||!1,bogusComments:X.bogusComments||!1,tightCommaSeparatedLists:X.tightCommaSeparatedLists||!1,tightSelfClosing:X.tightSelfClosing||!1,collapseEmptyAttributes:X.collapseEmptyAttributes||!1,allowDangerousHtml:X.allowDangerousHtml||!1,voids:X.voids||Q6,characterReferences:X.characterReferences||S7,closeSelfClosing:X.closeSelfClosing||!1,closeEmptyElements:X.closeEmptyElements||!1},schema:X.space==="svg"?F0:z6,quote:J,alternative:Q}.one(Array.isArray(Z)?{type:"root",children:Z}:Z,void 0,void 0)}function k7(Z,Y,X){return j6(Z,Y,X,this)}function h7(Z){let Y=[],X=Z&&Z.children||y7,J=-1;while(++J<X.length)Y[J]=this.one(X[J],J,Z);return Y.join("")}function B0(Z,Y){let X=typeof Z==="string"?{}:{...Z.colorReplacements},J=typeof Z==="string"?Z:Z.name;for(let[Q,$]of Object.entries(Y?.colorReplacements||{}))if(typeof $==="string")X[Q]=$;else if(Q===J)Object.assign(X,$);return X}function SY(Z,Y){if(!Z)return Z;return Y?.[Z?.toLowerCase()]||Z}function x7(Z){return Array.isArray(Z)?Z:[Z]}async function u6(Z){return Promise.resolve(typeof Z==="function"?Z():Z).then((Y)=>Y.default||Y)}function h8(Z){return!Z||["plaintext","txt","text","plain"].includes(Z)}function m6(Z){return Z==="ansi"||h8(Z)}function x8(Z){return Z==="none"}function p6(Z){return x8(Z)}function d6(Z,Y){if(!Y)return Z;if(Z.properties||={},Z.properties.class||=[],typeof Z.properties.class==="string")Z.properties.class=Z.properties.class.split(/\s+/g);if(!Array.isArray(Z.properties.class))Z.properties.class=[];let X=Array.isArray(Y)?Y:Y.split(/\s+/g);for(let J of X)if(J&&!Z.properties.class.includes(J))Z.properties.class.push(J);return Z}function v0(Z,Y=!1){if(Z.length===0)return[["",0]];let X=Z.split(/(\r?\n)/g),J=0,Q=[];for(let $=0;$<X.length;$+=2){let K=Y?X[$]+(X[$+1]||""):X[$];Q.push([K,J]),J+=X[$].length,J+=X[$+1]?.length||0}return Q}function g7(Z){let Y=v0(Z,!0).map(([Q])=>Q);function X(Q){if(Q===Z.length)return{line:Y.length-1,character:Y[Y.length-1].length};let $=Q,K=0;for(let U of Y){if($<U.length)break;$-=U.length,K++}return{line:K,character:$}}function J(Q,$){let K=0;for(let U=0;U<Q;U++)K+=Y[U].length;return K+=$,K}return{lines:Y,indexToPos:X,posToIndex:J}}function c6(Z,Y,X){let J=new Set;for(let $ of Z.matchAll(/:?lang=["']([^"']+)["']/g)){let K=$[1].toLowerCase().trim();if(K)J.add(K)}for(let $ of Z.matchAll(/(?:```|~~~)([\w-]+)/g)){let K=$[1].toLowerCase().trim();if(K)J.add(K)}for(let $ of Z.matchAll(/\\begin\{([\w-]+)\}/g)){let K=$[1].toLowerCase().trim();if(K)J.add(K)}for(let $ of Z.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){let K=$[1].toLowerCase().trim(),U=K.includes("/")?K.split("/").pop():K;if(U)J.add(U)}if(!X)return Array.from(J);let Q=X.getBundledLanguages();return Array.from(J).filter(($)=>$&&Q[$])}var g8="light-dark()",u7=["color","background-color"];function m7(Z,Y){let X=0,J=[];for(let Q of Y){if(Q>X)J.push({...Z,content:Z.content.slice(X,Q),offset:Z.offset+X});X=Q}if(X<Z.content.length)J.push({...Z,content:Z.content.slice(X),offset:Z.offset+X});return J}function p7(Z,Y){let X=Array.from(Y instanceof Set?Y:new Set(Y)).sort((J,Q)=>J-Q);if(!X.length)return Z;return Z.map((J)=>{return J.flatMap((Q)=>{let $=X.filter((K)=>Q.offset<K&&K<Q.offset+Q.content.length).map((K)=>K-Q.offset).sort((K,U)=>K-U);if(!$.length)return Q;return m7(Q,$)})})}function d7(Z,Y,X,J,Q="css-vars"){let $={content:Z.content,explanation:Z.explanation,offset:Z.offset},K=Y.map((H)=>L0(Z.variants[H])),U=new Set(K.flatMap((H)=>Object.keys(H))),W={},z=(H,G)=>{let F=G==="color"?"":G==="background-color"?"-bg":`-${G}`;return X+Y[H]+(G==="color"?"":F)};return K.forEach((H,G)=>{for(let F of U){let M=H[F]||"inherit";if(G===0&&J&&u7.includes(F))if(J===g8&&K.length>1){let A=Y.findIndex((R)=>R==="light"),w=Y.findIndex((R)=>R==="dark");if(A===-1||w===-1)throw new YZ('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let P=K[A][F]||"inherit",B=K[w][F]||"inherit";if(W[F]=`light-dark(${P}, ${B})`,Q==="css-vars")W[z(G,F)]=M}else W[F]=M;else if(Q==="css-vars")W[z(G,F)]=M}}),$.htmlStyle=W,$}function L0(Z){let Y={};if(Z.color)Y.color=Z.color;if(Z.bgColor)Y["background-color"]=Z.bgColor;if(Z.fontStyle){if(Z.fontStyle&GZ.Italic)Y["font-style"]="italic";if(Z.fontStyle&GZ.Bold)Y["font-weight"]="bold";let X=[];if(Z.fontStyle&GZ.Underline)X.push("underline");if(Z.fontStyle&GZ.Strikethrough)X.push("line-through");if(X.length)Y["text-decoration"]=X.join(" ")}return Y}function k8(Z){if(typeof Z==="string")return Z;return Object.entries(Z).map(([Y,X])=>`${Y}:${X}`).join(";")}var l6=new WeakMap;function I0(Z,Y){l6.set(Z,Y)}function k4(Z){return l6.get(Z)}class F4{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(Z,Y){return new F4(Object.fromEntries(x7(Y).map((X)=>[X,H0])),Z)}constructor(...Z){if(Z.length===2){let[Y,X]=Z;this.lang=X,this._stacks=Y}else{let[Y,X,J]=Z;this.lang=X,this._stacks={[J]:Y}}}getInternalStack(Z=this.theme){return this._stacks[Z]}getScopes(Z=this.theme){return c7(this._stacks[Z])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function c7(Z){let Y=[],X=new Set;function J(Q){if(X.has(Q))return;X.add(Q);let $=Q?.nameScopesList?.scopeName;if($)Y.push($);if(Q.parent)J(Q.parent)}return J(Z),Y}function l7(Z,Y){if(!(Z instanceof F4))throw new YZ("Invalid grammar state");return Z.getInternalStack(Y)}function i7(){let Z=new WeakMap;function Y(X){if(!Z.has(X.meta)){let J=function(K){if(typeof K==="number"){if(K<0||K>X.source.length)throw new YZ(`Invalid decoration offset: ${K}. Code length: ${X.source.length}`);return{...Q.indexToPos(K),offset:K}}else{let U=Q.lines[K.line];if(U===void 0)throw new YZ(`Invalid decoration position ${JSON.stringify(K)}. Lines length: ${Q.lines.length}`);let W=K.character;if(W<0)W=U.length+W;if(W<0||W>U.length)throw new YZ(`Invalid decoration position ${JSON.stringify(K)}. Line ${K.line} length: ${U.length}`);return{...K,character:W,offset:Q.posToIndex(K.line,W)}}},Q=g7(X.source),$=(X.options.decorations||[]).map((K)=>({...K,start:J(K.start),end:J(K.end)}));r7($),Z.set(X.meta,{decorations:$,converter:Q,source:X.source})}return Z.get(X.meta)}return{name:"shiki:decorations",tokens(X){if(!this.options.decorations?.length)return;let Q=Y(this).decorations.flatMap((K)=>[K.start.offset,K.end.offset]);return p7(X,Q)},code(X){if(!this.options.decorations?.length)return;let J=Y(this),Q=Array.from(X.children).filter((H)=>H.type==="element"&&H.tagName==="span");if(Q.length!==J.converter.lines.length)throw new YZ(`Number of lines in code element (${Q.length}) does not match the number of lines in the source (${J.converter.lines.length}). Failed to apply decorations.`);function $(H,G,F,M){let A=Q[H],w="",P=-1,B=-1;if(G===0)P=0;if(F===0)B=0;if(F===Number.POSITIVE_INFINITY)B=A.children.length;if(P===-1||B===-1)for(let C=0;C<A.children.length;C++){if(w+=i6(A.children[C]),P===-1&&w.length===G)P=C+1;if(B===-1&&w.length===F)B=C+1}if(P===-1)throw new YZ(`Failed to find start index for decoration ${JSON.stringify(M.start)}`);if(B===-1)throw new YZ(`Failed to find end index for decoration ${JSON.stringify(M.end)}`);let R=A.children.slice(P,B);if(!M.alwaysWrap&&R.length===A.children.length)U(A,M,"line");else if(!M.alwaysWrap&&R.length===1&&R[0].type==="element")U(R[0],M,"token");else{let C={type:"element",tagName:"span",properties:{},children:R};U(C,M,"wrapper"),A.children.splice(P,R.length,C)}}function K(H,G){Q[H]=U(Q[H],G,"line")}function U(H,G,F){let M=G.properties||{},A=G.transform||((w)=>w);if(H.tagName=G.tagName||"span",H.properties={...H.properties,...M,class:H.properties.class},G.properties?.class)d6(H,G.properties.class);return H=A(H,F)||H,H}let W=[],z=J.decorations.sort((H,G)=>G.start.offset-H.start.offset||H.end.offset-G.end.offset);for(let H of z){let{start:G,end:F}=H;if(G.line===F.line)$(G.line,G.character,F.character,H);else if(G.line<F.line){$(G.line,G.character,Number.POSITIVE_INFINITY,H);for(let M=G.line+1;M<F.line;M++)W.unshift(()=>K(M,H));$(F.line,0,F.character,H)}}W.forEach((H)=>H())}}}function r7(Z){for(let Y=0;Y<Z.length;Y++){let X=Z[Y];if(X.start.offset>X.end.offset)throw new YZ(`Invalid decoration range: ${JSON.stringify(X.start)} - ${JSON.stringify(X.end)}`);for(let J=Y+1;J<Z.length;J++){let Q=Z[J],$=X.start.offset<=Q.start.offset&&Q.start.offset<X.end.offset,K=X.start.offset<Q.end.offset&&Q.end.offset<=X.end.offset,U=Q.start.offset<=X.start.offset&&X.start.offset<Q.end.offset,W=Q.start.offset<X.end.offset&&X.end.offset<=Q.end.offset;if($||K||U||W){if($&&K)continue;if(U&&W)continue;if(U&&X.start.offset===X.end.offset)continue;if(K&&Q.start.offset===Q.end.offset)continue;throw new YZ(`Decorations ${JSON.stringify(X.start)} and ${JSON.stringify(Q.start)} intersect.`)}}}}function i6(Z){if(Z.type==="text")return Z.value;if(Z.type==="element")return Z.children.map(i6).join("");return""}var o7=[i7()];function P0(Z){let Y=n7(Z.transformers||[]);return[...Y.pre,...Y.normal,...Y.post,...o7]}function n7(Z){let Y=[],X=[],J=[];for(let Q of Z)switch(Q.enforce){case"pre":Y.push(Q);break;case"post":X.push(Q);break;default:J.push(Q)}return{pre:Y,post:X,normal:J}}var sY=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],S8={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function a7(Z,Y){let X=Z.indexOf("\x1B",Y);if(X!==-1){if(Z[X+1]==="["){let J=Z.indexOf("m",X);if(J!==-1)return{sequence:Z.substring(X+2,J).split(";"),startPosition:X,position:J+1}}}return{position:Z.length}}function S6(Z){let Y=Z.shift();if(Y==="2"){let X=Z.splice(0,3).map((J)=>Number.parseInt(J));if(X.length!==3||X.some((J)=>Number.isNaN(J)))return;return{type:"rgb",rgb:X}}else if(Y==="5"){let X=Z.shift();if(X)return{type:"table",index:Number(X)}}}function s7(Z){let Y=[];while(Z.length>0){let X=Z.shift();if(!X)continue;let J=Number.parseInt(X);if(Number.isNaN(J))continue;if(J===0)Y.push({type:"resetAll"});else if(J<=9){if(S8[J])Y.push({type:"setDecoration",value:S8[J]})}else if(J<=29){let Q=S8[J-20];if(Q){if(Y.push({type:"resetDecoration",value:Q}),Q==="dim")Y.push({type:"resetDecoration",value:"bold"})}}else if(J<=37)Y.push({type:"setForegroundColor",value:{type:"named",name:sY[J-30]}});else if(J===38){let Q=S6(Z);if(Q)Y.push({type:"setForegroundColor",value:Q})}else if(J===39)Y.push({type:"resetForegroundColor"});else if(J<=47)Y.push({type:"setBackgroundColor",value:{type:"named",name:sY[J-40]}});else if(J===48){let Q=S6(Z);if(Q)Y.push({type:"setBackgroundColor",value:Q})}else if(J===49)Y.push({type:"resetBackgroundColor"});else if(J===53)Y.push({type:"setDecoration",value:"overline"});else if(J===55)Y.push({type:"resetDecoration",value:"overline"});else if(J>=90&&J<=97)Y.push({type:"setForegroundColor",value:{type:"named",name:sY[J-90+8]}});else if(J>=100&&J<=107)Y.push({type:"setBackgroundColor",value:{type:"named",name:sY[J-100+8]}})}return Y}function t7(){let Z=null,Y=null,X=new Set;return{parse(J){let Q=[],$=0;do{let K=a7(J,$),U=K.sequence?J.substring($,K.startPosition):J.substring($);if(U.length>0)Q.push({value:U,foreground:Z,background:Y,decorations:new Set(X)});if(K.sequence){let W=s7(K.sequence);for(let z of W)if(z.type==="resetAll")Z=null,Y=null,X.clear();else if(z.type==="resetForegroundColor")Z=null;else if(z.type==="resetBackgroundColor")Y=null;else if(z.type==="resetDecoration")X.delete(z.value);for(let z of W)if(z.type==="setForegroundColor")Z=z.value;else if(z.type==="setBackgroundColor")Y=z.value;else if(z.type==="setDecoration")X.add(z.value)}$=K.position}while($<J.length);return Q}}}var e7={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Z9(Z=e7){function Y(U){return Z[U]}function X(U){return`#${U.map((W)=>Math.max(0,Math.min(W,255)).toString(16).padStart(2,"0")).join("")}`}let J;function Q(){if(J)return J;J=[];for(let z=0;z<sY.length;z++)J.push(Y(sY[z]));let U=[0,95,135,175,215,255];for(let z=0;z<6;z++)for(let H=0;H<6;H++)for(let G=0;G<6;G++)J.push(X([U[z],U[H],U[G]]));let W=8;for(let z=0;z<24;z++,W+=10)J.push(X([W,W,W]));return J}function $(U){return Q()[U]}function K(U){switch(U.type){case"named":return Y(U.name);case"rgb":return X(U.rgb);case"table":return $(U.index)}}return{value:K}}var Y9={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function X9(Z,Y,X){let J=B0(Z,X),Q=v0(Y),$=Object.fromEntries(sY.map((W)=>{let z=`terminal.ansi${W[0].toUpperCase()}${W.substring(1)}`,H=Z.colors?.[z];return[W,H||Y9[W]]})),K=Z9($),U=t7();return Q.map((W)=>U.parse(W[0]).map((z)=>{let H,G;if(z.decorations.has("reverse"))H=z.background?K.value(z.background):Z.bg,G=z.foreground?K.value(z.foreground):Z.fg;else H=z.foreground?K.value(z.foreground):Z.fg,G=z.background?K.value(z.background):void 0;if(H=SY(H,J),G=SY(G,J),z.decorations.has("dim"))H=J9(H);let F=GZ.None;if(z.decorations.has("bold"))F|=GZ.Bold;if(z.decorations.has("italic"))F|=GZ.Italic;if(z.decorations.has("underline"))F|=GZ.Underline;if(z.decorations.has("strikethrough"))F|=GZ.Strikethrough;return{content:z.value,offset:W[1],color:H,bgColor:G,fontStyle:F}}))}function J9(Z){let Y=Z.match(/#([0-9a-f]{3,8})/i);if(Y){let J=Y[1];if(J.length===8){let Q=Math.round(Number.parseInt(J.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${J.slice(0,6)}${Q}`}else if(J.length===6)return`#${J}80`;else if(J.length===4){let Q=J[0],$=J[1],K=J[2],U=J[3],W=Math.round(Number.parseInt(`${U}${U}`,16)/2).toString(16).padStart(2,"0");return`#${Q}${Q}${$}${$}${K}${K}${W}`}else if(J.length===3){let Q=J[0],$=J[1],K=J[2];return`#${Q}${Q}${$}${$}${K}${K}80`}}let X=Z.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);if(X)return`var(${X[1]}-dim)`;return Z}function u8(Z,Y,X={}){let{theme:J=Z.getLoadedThemes()[0]}=X,Q=Z.resolveLangAlias(X.lang||"text");if(h8(Q)||x8(J))return v0(Y).map((W)=>[{content:W[0],offset:W[1]}]);let{theme:$,colorMap:K}=Z.setTheme(J);if(Q==="ansi")return X9($,Y,X);let U=Z.getLanguage(X.lang||"text");if(X.grammarState){if(X.grammarState.lang!==U.name)throw new YZ(`Grammar state language "${X.grammarState.lang}" does not match highlight language "${U.name}"`);if(!X.grammarState.themes.includes($.name))throw new YZ(`Grammar state themes "${X.grammarState.themes}" do not contain highlight theme "${$.name}"`)}return $9(Y,U,$,K,X)}function Q9(...Z){if(Z.length===2)return k4(Z[1]);let[Y,X,J={}]=Z,{lang:Q="text",theme:$=Y.getLoadedThemes()[0]}=J;if(h8(Q)||x8($))throw new YZ("Plain language does not have grammar state");if(Q==="ansi")throw new YZ("ANSI language does not have grammar state");let{theme:K,colorMap:U}=Y.setTheme($),W=Y.getLanguage(Q);return new F4(m8(X,W,K,U,J).stateStack,W.name,K.name)}function $9(Z,Y,X,J,Q){let $=m8(Z,Y,X,J,Q),K=new F4($.stateStack,Y.name,X.name);return I0($.tokens,K),$.tokens}function m8(Z,Y,X,J,Q){let $=B0(X,Q),{tokenizeMaxLineLength:K=0,tokenizeTimeLimit:U=500}=Q,W=v0(Z),z=Q.grammarState?l7(Q.grammarState,X.name)??H0:Q.grammarContextCode!=null?m8(Q.grammarContextCode,Y,X,J,{...Q,grammarState:void 0,grammarContextCode:void 0}).stateStack:H0,H=[],G=[];for(let F=0,M=W.length;F<M;F++){let[A,w]=W[F];if(A===""){H=[],G.push([]);continue}if(K>0&&A.length>=K){H=[],G.push([{content:A,offset:w,color:"",fontStyle:0}]);continue}let P,B,R;if(Q.includeExplanation)P=Y.tokenizeLine(A,z,U),B=P.tokens,R=0;let C=Y.tokenizeLine2(A,z,U),D=C.tokens.length/2;for(let j=0;j<D;j++){let E=C.tokens[2*j],d=j+1<D?C.tokens[2*j+2]:A.length;if(E===d)continue;let i=C.tokens[2*j+1],g=SY(J[oY.getForeground(i)],$),r=oY.getFontStyle(i),o={content:A.substring(E,d),offset:w+E,color:g,fontStyle:r};if(Q.includeExplanation){let FY=[];if(Q.includeExplanation!=="scopeName")for(let xZ of X.settings){let xY;switch(typeof xZ.scope){case"string":xY=xZ.scope.split(/,/).map((VY)=>VY.trim());break;case"object":xY=xZ.scope;break;default:continue}FY.push({settings:xZ,selectors:xY.map((VY)=>VY.split(/ /))})}o.explanation=[];let MY=0;while(E+MY<d){let xZ=B[R],xY=A.substring(xZ.startIndex,xZ.endIndex);MY+=xY.length,o.explanation.push({content:xY,scopes:Q.includeExplanation==="scopeName"?K9(xZ.scopes):W9(FY,xZ.scopes)}),R+=1}}H.push(o)}G.push(H),H=[],z=C.ruleStack}return{tokens:G,stateStack:z}}function K9(Z){return Z.map((Y)=>({scopeName:Y}))}function W9(Z,Y){let X=[];for(let J=0,Q=Y.length;J<Q;J++){let $=Y[J];X[J]={scopeName:$,themeMatches:z9(Z,$,Y.slice(0,J))}}return X}function y6(Z,Y){return Z===Y||Y.substring(0,Z.length)===Z&&Y[Z.length]==="."}function U9(Z,Y,X){if(!y6(Z[Z.length-1],Y))return!1;let J=Z.length-2,Q=X.length-1;while(J>=0&&Q>=0){if(y6(Z[J],X[Q]))J-=1;Q-=1}if(J===-1)return!0;return!1}function z9(Z,Y,X){let J=[];for(let{selectors:Q,settings:$}of Z)for(let K of Q)if(U9(K,Y,X)){J.push($);break}return J}function r6(Z,Y,X){let J=Object.entries(X.themes).filter((W)=>W[1]).map((W)=>({color:W[0],theme:W[1]})),Q=J.map((W)=>{let z=u8(Z,Y,{...X,theme:W.theme}),H=k4(z),G=typeof W.theme==="string"?W.theme:W.theme.name;return{tokens:z,state:H,theme:G}}),$=H9(...Q.map((W)=>W.tokens)),K=$[0].map((W,z)=>W.map((H,G)=>{let F={content:H.content,variants:{},offset:H.offset};if("includeExplanation"in X&&X.includeExplanation)F.explanation=H.explanation;return $.forEach((M,A)=>{let{content:w,explanation:P,offset:B,...R}=M[z][G];F.variants[J[A].color]=R}),F})),U=Q[0].state?new F4(Object.fromEntries(Q.map((W)=>[W.theme,W.state?.getInternalStack(W.theme)])),Q[0].state.lang):void 0;if(U)I0(K,U);return K}function H9(...Z){let Y=Z.map(()=>[]),X=Z.length;for(let J=0;J<Z[0].length;J++){let Q=Z.map((W)=>W[J]),$=Y.map(()=>[]);Y.forEach((W,z)=>W.push($[z]));let K=Q.map(()=>0),U=Q.map((W)=>W[0]);while(U.every((W)=>W)){let W=Math.min(...U.map((z)=>z.content.length));for(let z=0;z<X;z++){let H=U[z];if(H.content.length===W)$[z].push(H),K[z]+=1,U[z]=Q[z][K[z]];else $[z].push({...H,content:H.content.slice(0,W)}),U[z]={...H,content:H.content.slice(W),offset:H.offset+W}}}}return Y}function C0(Z,Y,X){let J,Q,$,K,U,W;if("themes"in X){let{defaultColor:z="light",cssVariablePrefix:H="--shiki-",colorsRendering:G="css-vars"}=X,F=Object.entries(X.themes).filter((B)=>B[1]).map((B)=>({color:B[0],theme:B[1]})).sort((B,R)=>B.color===z?-1:R.color===z?1:0);if(F.length===0)throw new YZ("`themes` option must not be empty");let M=r6(Z,Y,X);if(W=k4(M),z&&g8!==z&&!F.find((B)=>B.color===z))throw new YZ(`\`themes\` option must contain the defaultColor key \`${z}\``);let A=F.map((B)=>Z.getTheme(B.theme)),w=F.map((B)=>B.color);if($=M.map((B)=>B.map((R)=>d7(R,w,H,z,G))),W)I0($,W);let P=F.map((B)=>B0(B.theme,X));Q=k6(F,A,P,H,z,"fg",G),J=k6(F,A,P,H,z,"bg",G),K=`shiki-themes ${A.map((B)=>B.name).join(" ")}`,U=z?void 0:[Q,J].join(";")}else if("theme"in X){let z=B0(X.theme,X);$=u8(Z,Y,X);let H=Z.getTheme(X.theme);J=SY(H.bg,z),Q=SY(H.fg,z),K=H.name,W=k4($)}else throw new YZ("Invalid options, either `theme` or `themes` must be provided");return{tokens:$,fg:Q,bg:J,themeName:K,rootStyle:U,grammarState:W}}function k6(Z,Y,X,J,Q,$,K){return Z.map((U,W)=>{let z=SY(Y[W][$],X[W])||"inherit",H=`${J+U.color}${$==="bg"?"-bg":""}:${z}`;if(W===0&&Q){if(Q===g8&&Z.length>1){let G=Z.findIndex((w)=>w.color==="light"),F=Z.findIndex((w)=>w.color==="dark");if(G===-1||F===-1)throw new YZ('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let M=SY(Y[G][$],X[G])||"inherit",A=SY(Y[F][$],X[F])||"inherit";return`light-dark(${M}, ${A});${H}`}return z}if(K==="css-vars")return H;return null}).filter((U)=>!!U).join(";")}function R0(Z,Y,X,J={meta:{},options:X,codeToHast:(Q,$)=>R0(Z,Q,$),codeToTokens:(Q,$)=>C0(Z,Q,$)}){let Q=Y;for(let A of P0(X))Q=A.preprocess?.call(J,Q,X)||Q;let{tokens:$,fg:K,bg:U,themeName:W,rootStyle:z,grammarState:H}=C0(Z,Q,X),{mergeWhitespaces:G=!0,mergeSameStyleTokens:F=!1}=X;if(G===!0)$=O9($);else if(G==="never")$=q9($);if(F)$=F9($);let M={...J,get source(){return Q}};for(let A of P0(X))$=A.tokens?.call(M,$)||$;return G9($,{...X,fg:K,bg:U,themeName:W,rootStyle:X.rootStyle===!1?!1:X.rootStyle??z},M,H)}function G9(Z,Y,X,J=k4(Z)){let Q=P0(Y),$=[],K={type:"root",children:[]},{structure:U="classic",tabindex:W="0"}=Y,z={class:`shiki ${Y.themeName||""}`};if(Y.rootStyle!==!1)if(Y.rootStyle!=null)z.style=Y.rootStyle;else z.style=`background-color:${Y.bg};color:${Y.fg}`;if(W!==!1&&W!=null)z.tabindex=W.toString();for(let[w,P]of Object.entries(Y.meta||{}))if(!w.startsWith("_"))z[w]=P;let H={type:"element",tagName:"pre",properties:z,children:[],data:Y.data},G={type:"element",tagName:"code",properties:{},children:$},F=[],M={...X,structure:U,addClassToHast:d6,get source(){return X.source},get tokens(){return Z},get options(){return Y},get root(){return K},get pre(){return H},get code(){return G},get lines(){return F}};if(Z.forEach((w,P)=>{if(P){if(U==="inline")K.children.push({type:"element",tagName:"br",properties:{},children:[]});else if(U==="classic")$.push({type:"text",value:`
|
|
148
|
+
`})}let B={type:"element",tagName:"span",properties:{class:"line"},children:[]},R=0;for(let C of w){let D={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]},j=k8(C.htmlStyle||L0(C));if(j)D.properties.style=j;for(let E of Q)D=E?.span?.call(M,D,P+1,R,B,C)||D;if(U==="inline")K.children.push(D);else if(U==="classic")B.children.push(D);R+=C.content.length}if(U==="classic"){for(let C of Q)B=C?.line?.call(M,B,P+1)||B;F.push(B),$.push(B)}else if(U==="inline")F.push(B)}),U==="classic"){for(let w of Q)G=w?.code?.call(M,G)||G;H.children.push(G);for(let w of Q)H=w?.pre?.call(M,H)||H;K.children.push(H)}else if(U==="inline"){let w=[],P={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let C of K.children)if(C.type==="element"&&C.tagName==="br")w.push(P),P={type:"element",tagName:"span",properties:{class:"line"},children:[]};else if(C.type==="element"||C.type==="text")P.children.push(C);w.push(P);let R={type:"element",tagName:"code",properties:{},children:w};for(let C of Q)R=C?.code?.call(M,R)||R;K.children=[];for(let C=0;C<R.children.length;C++){if(C>0)K.children.push({type:"element",tagName:"br",properties:{},children:[]});let D=R.children[C];if(D.type==="element")K.children.push(...D.children)}}let A=K;for(let w of Q)A=w?.root?.call(M,A)||A;if(J)I0(A,J);return A}function O9(Z){return Z.map((Y)=>{let X=[],J="",Q;return Y.forEach(($,K)=>{let W=!($.fontStyle&&($.fontStyle&GZ.Underline||$.fontStyle&GZ.Strikethrough));if(W&&$.content.match(/^\s+$/)&&Y[K+1]){if(Q===void 0)Q=$.offset;J+=$.content}else if(J){if(W)X.push({...$,offset:Q,content:J+$.content});else X.push({content:J,offset:Q},$);Q=void 0,J=""}else X.push($)}),X})}function q9(Z){return Z.map((Y)=>{return Y.flatMap((X)=>{if(X.content.match(/^\s+$/))return X;let J=X.content.match(/^(\s*)(.*?)(\s*)$/);if(!J)return X;let[,Q,$,K]=J;if(!Q&&!K)return X;let U=[{...X,offset:X.offset+Q.length,content:$}];if(Q)U.unshift({content:Q,offset:X.offset});if(K)U.push({content:K,offset:X.offset+Q.length+$.length});return U})})}function F9(Z){return Z.map((Y)=>{let X=[];for(let J of Y){if(X.length===0){X.push({...J});continue}let Q=X[X.length-1],$=k8(Q.htmlStyle||L0(Q)),K=k8(J.htmlStyle||L0(J)),U=Q.fontStyle&&(Q.fontStyle&GZ.Underline||Q.fontStyle&GZ.Strikethrough),W=J.fontStyle&&(J.fontStyle&GZ.Underline||J.fontStyle&GZ.Strikethrough);if(!U&&!W&&$===K)Q.content+=J.content;else X.push({...J})}return X})}var M9=j8;function N9(Z,Y,X){let J={meta:{},options:X,codeToHast:($,K)=>R0(Z,$,K),codeToTokens:($,K)=>C0(Z,$,K)},Q=M9(R0(Z,Y,X,J));for(let $ of P0(X))Q=$.postprocess?.call(J,Q,X)||Q;return Q}var h6={light:"#333333",dark:"#bbbbbb"},x6={light:"#fffffe",dark:"#1e1e1e"},g6="__shiki_resolved";function p8(Z){if(Z?.[g6])return Z;let Y={...Z};if(Y.tokenColors&&!Y.settings)Y.settings=Y.tokenColors,delete Y.tokenColors;Y.type||="dark",Y.colorReplacements={...Y.colorReplacements},Y.settings||=[];let{bg:X,fg:J}=Y;if(!X||!J){let U=Y.settings?Y.settings.find((W)=>!W.name&&!W.scope):void 0;if(U?.settings?.foreground)J=U.settings.foreground;if(U?.settings?.background)X=U.settings.background;if(!J&&Y?.colors?.["editor.foreground"])J=Y.colors["editor.foreground"];if(!X&&Y?.colors?.["editor.background"])X=Y.colors["editor.background"];if(!J)J=Y.type==="light"?h6.light:h6.dark;if(!X)X=Y.type==="light"?x6.light:x6.dark;Y.fg=J,Y.bg=X}if(!(Y.settings[0]&&Y.settings[0].settings&&!Y.settings[0].scope))Y.settings.unshift({settings:{foreground:Y.fg,background:Y.bg}});let Q=0,$=new Map;function K(U){if($.has(U))return $.get(U);Q+=1;let W=`#${Q.toString(16).padStart(8,"0").toLowerCase()}`;if(Y.colorReplacements?.[`#${W}`])return K(U);return $.set(U,W),W}Y.settings=Y.settings.map((U)=>{let W=U.settings?.foreground&&!U.settings.foreground.startsWith("#"),z=U.settings?.background&&!U.settings.background.startsWith("#");if(!W&&!z)return U;let H={...U,settings:{...U.settings}};if(W){let G=K(U.settings.foreground);Y.colorReplacements[G]=U.settings.foreground,H.settings.foreground=G}if(z){let G=K(U.settings.background);Y.colorReplacements[G]=U.settings.background,H.settings.background=G}return H});for(let U of Object.keys(Y.colors||{}))if(U==="editor.foreground"||U==="editor.background"||U.startsWith("terminal.ansi")){if(!Y.colors[U]?.startsWith("#")){let W=K(Y.colors[U]);Y.colorReplacements[W]=Y.colors[U],Y.colors[U]=W}}return Object.defineProperty(Y,g6,{enumerable:!1,writable:!1,value:!0}),Y}async function o6(Z){return Array.from(new Set((await Promise.all(Z.filter((Y)=>!m6(Y)).map(async(Y)=>await u6(Y).then((X)=>Array.isArray(X)?X:[X])))).flat()))}async function n6(Z){return(await Promise.all(Z.map(async(X)=>p6(X)?null:p8(await u6(X))))).filter((X)=>!!X)}var y8=3,A9=!1;function _9(Z,Y=3){if(!y8)return;if(typeof y8==="number"&&Y>y8)return;if(A9)throw Error(`[SHIKI DEPRECATE]: ${Z}`);else console.trace(`[SHIKI DEPRECATE]: ${Z}`)}class tY extends Error{constructor(Z){super(Z);this.name="ShikiError"}}function a6(Z,Y){if(!Y)return Z;if(Y[Z]){let X=new Set([Z]);while(Y[Z]){if(Z=Y[Z],X.has(Z))throw new tY(`Circular alias \`${Array.from(X).join(" -> ")} -> ${Z}\``);X.add(Z)}}return Z}class s6 extends J6{constructor(Z,Y,X,J={}){super(Z);this._resolver=Z,this._themes=Y,this._langs=X,this._alias=J,this._themes.map((Q)=>this.loadTheme(Q)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(Z){if(typeof Z==="string")return this._resolvedThemes.get(Z);else return this.loadTheme(Z)}loadTheme(Z){let Y=p8(Z);if(Y.name)this._resolvedThemes.set(Y.name,Y),this._loadedThemesCache=null;return Y}getLoadedThemes(){if(!this._loadedThemesCache)this._loadedThemesCache=[...this._resolvedThemes.keys()];return this._loadedThemesCache}setTheme(Z){let Y=this._textmateThemeCache.get(Z);if(!Y)Y=D4.createFromRawTheme(Z),this._textmateThemeCache.set(Z,Y);this._syncRegistry.setTheme(Y)}getGrammar(Z){return Z=a6(Z,this._alias),this._resolvedGrammars.get(Z)}loadLanguage(Z){if(this.getGrammar(Z.name))return;let Y=new Set([...this._langMap.values()].filter((Q)=>Q.embeddedLangsLazy?.includes(Z.name)));this._resolver.addLanguage(Z);let X={balancedBracketSelectors:Z.balancedBracketSelectors||["*"],unbalancedBracketSelectors:Z.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(Z.scopeName,Z);let J=this.loadGrammarWithConfiguration(Z.scopeName,1,X);if(J.name=Z.name,this._resolvedGrammars.set(Z.name,J),Z.aliases)Z.aliases.forEach((Q)=>{this._alias[Q]=Z.name});if(this._loadedLanguagesCache=null,Y.size)for(let Q of Y)this._resolvedGrammars.delete(Q.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(Q.scopeName),this._syncRegistry?._grammars?.delete(Q.scopeName),this.loadLanguage(this._langMap.get(Q.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(Z){for(let J of Z)this.resolveEmbeddedLanguages(J);let Y=Array.from(this._langGraph.entries()),X=Y.filter(([J,Q])=>!Q);if(X.length){let J=Y.filter(([Q,$])=>{if(!$)return!1;return($.embeddedLanguages||$.embeddedLangs)?.some((U)=>X.map(([W])=>W).includes(U))}).filter((Q)=>!X.includes(Q));throw new tY(`Missing languages ${X.map(([Q])=>`\`${Q}\``).join(", ")}, required by ${J.map(([Q])=>`\`${Q}\``).join(", ")}`)}for(let[J,Q]of Y)this._resolver.addLanguage(Q);for(let[J,Q]of Y)this.loadLanguage(Q)}getLoadedLanguages(){if(!this._loadedLanguagesCache)this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])];return this._loadedLanguagesCache}resolveEmbeddedLanguages(Z){this._langMap.set(Z.name,Z),this._langGraph.set(Z.name,Z);let Y=Z.embeddedLanguages??Z.embeddedLangs;if(Y)for(let X of Y)this._langGraph.set(X,this._langMap.get(X))}}class t6{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(Z,Y){this._onigLib={createOnigScanner:(X)=>Z.createScanner(X),createOnigString:(X)=>Z.createString(X)},Y.forEach((X)=>this.addLanguage(X))}get onigLib(){return this._onigLib}getLangRegistration(Z){return this._langs.get(Z)}loadGrammar(Z){return this._scopeToLang.get(Z)}addLanguage(Z){if(this._langs.set(Z.name,Z),Z.aliases)Z.aliases.forEach((Y)=>{this._langs.set(Y,Z)});if(this._scopeToLang.set(Z.scopeName,Z),Z.injectTo)Z.injectTo.forEach((Y)=>{if(!this._injections.get(Y))this._injections.set(Y,[]);this._injections.get(Y).push(Z.scopeName)})}getInjections(Z){let Y=Z.split("."),X=[];for(let J=1;J<=Y.length;J++){let Q=Y.slice(0,J).join(".");X=[...X,...this._injections.get(Q)||[]]}return X}}var y4=0;function w9(Z){if(y4+=1,Z.warnings!==!1&&y4>=10&&y4%10===0)console.warn(`[Shiki] ${y4} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let Y=!1;if(!Z.engine)throw new tY("`engine` option is required for synchronous mode");let X=(Z.langs||[]).flat(1),J=(Z.themes||[]).flat(1).map(p8),Q=new t6(Z.engine,X),$=new s6(Q,J,X,Z.langAlias),K;function U(C){return a6(C,Z.langAlias)}function W(C){B();let D=$.getGrammar(typeof C==="string"?C:C.name);if(!D)throw new tY(`Language \`${C}\` not found, you may need to load it first`);return D}function z(C){if(C==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};B();let D=$.getTheme(C);if(!D)throw new tY(`Theme \`${C}\` not found, you may need to load it first`);return D}function H(C){B();let D=z(C);if(K!==C)$.setTheme(D),K=C;let j=$.getColorMap();return{theme:D,colorMap:j}}function G(){return B(),$.getLoadedThemes()}function F(){return B(),$.getLoadedLanguages()}function M(...C){B(),$.loadLanguages(C.flat(1))}async function A(...C){return M(await o6(C))}function w(...C){B();for(let D of C.flat(1))$.loadTheme(D)}async function P(...C){return B(),w(await n6(C))}function B(){if(Y)throw new tY("Shiki instance has been disposed")}function R(){if(Y)return;Y=!0,$.dispose(),y4-=1}return{setTheme:H,getTheme:z,getLanguage:W,getLoadedThemes:G,getLoadedLanguages:F,resolveLangAlias:U,loadLanguage:A,loadLanguageSync:M,loadTheme:P,loadThemeSync:w,dispose:R,[Symbol.dispose]:R}}async function B9(Z){if(!Z.engine)_9("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[Y,X,J]=await Promise.all([n6(Z.themes||[]),o6(Z.langs||[]),Z.engine]);return w9({...Z,themes:Y,langs:X,engine:J})}async function L9(Z){let Y=await B9(Z);return{getLastGrammarState:(...X)=>Q9(Y,...X),codeToTokensBase:(X,J)=>u8(Y,X,J),codeToTokensWithThemes:(X,J)=>r6(Y,X,J),codeToTokens:(X,J)=>C0(Y,X,J),codeToHast:(X,J)=>R0(Y,X,J),codeToHtml:(X,J)=>N9(Y,X,J),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...Y,getInternalContext:()=>Y}}function e6(Z){let{langs:Y,themes:X,engine:J}=Z;async function Q($){function K(G){if(typeof G==="string"){if(G=$.langAlias?.[G]||G,m6(G))return[];let F=Y[G];if(!F)throw new YZ(`Language \`${G}\` is not included in this bundle. You may want to load it from external source.`);return F}return G}function U(G){if(p6(G))return"none";if(typeof G==="string"){let F=X[G];if(!F)throw new YZ(`Theme \`${G}\` is not included in this bundle. You may want to load it from external source.`);return F}return G}let W=($.themes??[]).map((G)=>U(G)),z=($.langs??[]).map((G)=>K(G)),H=await L9({engine:$.engine??J(),...$,themes:W,langs:z});return{...H,loadLanguage(...G){return H.loadLanguage(...G.map(K))},loadTheme(...G){return H.loadTheme(...G.map(U))},getBundledLanguages(){return Y},getBundledThemes(){return X}}}return Q}function P9(Z){let Y;async function X(J={}){if(!Y){Y=Z({...J,themes:[],langs:[]});let Q=await Y;return await Promise.all([Q.loadTheme(...J.themes||[]),Q.loadLanguage(...J.langs||[])]),Q}else{let Q=await Y;return await Promise.all([Q.loadTheme(...J.themes||[]),Q.loadLanguage(...J.langs||[])]),Q}}return X}function Z1(Z,Y){let X=P9(Z);async function J(Q,$){let K=await X({langs:[$.lang],themes:"theme"in $?[$.theme]:Object.values($.themes)}),U=await Y?.guessEmbeddedLanguages?.(Q,$.lang,K);if(U)await K.loadLanguage(...U);return K}return{getSingletonHighlighter(Q){return X(Q)},async codeToHtml(Q,$){return(await J(Q,$)).codeToHtml(Q,$)},async codeToHast(Q,$){return(await J(Q,$)).codeToHast(Q,$)},async codeToTokens(Q,$){return(await J(Q,$)).codeToTokens(Q,$)},async codeToTokensBase(Q,$){return(await J(Q,$)).codeToTokensBase(Q,$)},async codeToTokensWithThemes(Q,$){return(await J(Q,$)).codeToTokensWithThemes(Q,$)},async getLastGrammarState(Q,$){return(await X({langs:[$.lang],themes:[$.theme]})).getLastGrammarState(Q,$)}}}var Y1=[{id:"abap",name:"ABAP",import:()=>import("./chunk-8fzw4gqz.js")},{id:"actionscript-3",name:"ActionScript",import:()=>import("./chunk-0y6jq0a0.js")},{id:"ada",name:"Ada",import:()=>import("./chunk-p8pfkf84.js")},{id:"angular-html",name:"Angular HTML",import:()=>import("./chunk-bwvxp5dp.js")},{id:"angular-ts",name:"Angular TypeScript",import:()=>import("./chunk-yyr27vj3.js")},{id:"apache",name:"Apache Conf",import:()=>import("./chunk-a1s72wx6.js")},{id:"apex",name:"Apex",import:()=>import("./chunk-3f6xf4mm.js")},{id:"apl",name:"APL",import:()=>import("./chunk-yzgwn422.js")},{id:"applescript",name:"AppleScript",import:()=>import("./chunk-6fzgq7sb.js")},{id:"ara",name:"Ara",import:()=>import("./chunk-qddn1sea.js")},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>import("./chunk-6dat5vvb.js")},{id:"asm",name:"Assembly",import:()=>import("./chunk-m0k36mwn.js")},{id:"astro",name:"Astro",import:()=>import("./chunk-3pzth5e2.js")},{id:"awk",name:"AWK",import:()=>import("./chunk-7wnxdt11.js")},{id:"ballerina",name:"Ballerina",import:()=>import("./chunk-54j5njdj.js")},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>import("./chunk-zgyww0w8.js")},{id:"beancount",name:"Beancount",import:()=>import("./chunk-33xp86w3.js")},{id:"berry",name:"Berry",aliases:["be"],import:()=>import("./chunk-vg1dem7m.js")},{id:"bibtex",name:"BibTeX",import:()=>import("./chunk-35ncgr15.js")},{id:"bicep",name:"Bicep",import:()=>import("./chunk-s4ksgmax.js")},{id:"blade",name:"Blade",import:()=>import("./chunk-zwhbdwnt.js")},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>import("./chunk-dxyv2b1c.js")},{id:"c",name:"C",import:()=>import("./chunk-s237yqg5.js")},{id:"c3",name:"C3",import:()=>import("./chunk-4g2gfvyd.js")},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>import("./chunk-daahmb61.js")},{id:"cairo",name:"Cairo",import:()=>import("./chunk-5q1qtbx4.js")},{id:"clarity",name:"Clarity",import:()=>import("./chunk-8kt765dh.js")},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>import("./chunk-fsqndb8n.js")},{id:"cmake",name:"CMake",import:()=>import("./chunk-nq1k5tw4.js")},{id:"cobol",name:"COBOL",import:()=>import("./chunk-s6qt552a.js")},{id:"codeowners",name:"CODEOWNERS",import:()=>import("./chunk-j3c65h0m.js")},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>import("./chunk-10stn7rc.js")},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>import("./chunk-8kk9kv6s.js")},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>import("./chunk-131cad67.js")},{id:"coq",name:"Coq",import:()=>import("./chunk-j2vek58t.js")},{id:"cpp",name:"C++",aliases:["c++"],import:()=>import("./chunk-0dvy62vd.js")},{id:"crystal",name:"Crystal",import:()=>import("./chunk-vpbyhd1b.js")},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>import("./chunk-87s313qe.js")},{id:"css",name:"CSS",import:()=>import("./chunk-kephawnc.js")},{id:"csv",name:"CSV",import:()=>import("./chunk-gz0bg0j5.js")},{id:"cue",name:"CUE",import:()=>import("./chunk-vxzy50p0.js")},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>import("./chunk-pdfvchxr.js")},{id:"d",name:"D",import:()=>import("./chunk-5kns073z.js")},{id:"dart",name:"Dart",import:()=>import("./chunk-18k4wz02.js")},{id:"dax",name:"DAX",import:()=>import("./chunk-vrjcy7h1.js")},{id:"desktop",name:"Desktop",import:()=>import("./chunk-tfqwrnhz.js")},{id:"diff",name:"Diff",import:()=>import("./chunk-g0c5mmdz.js")},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>import("./chunk-ajxzbnbp.js")},{id:"dotenv",name:"dotEnv",import:()=>import("./chunk-1w5vehgm.js")},{id:"dream-maker",name:"Dream Maker",import:()=>import("./chunk-9dse3mh2.js")},{id:"edge",name:"Edge",import:()=>import("./chunk-2mb0trr0.js")},{id:"elixir",name:"Elixir",import:()=>import("./chunk-bkan2fr3.js")},{id:"elm",name:"Elm",import:()=>import("./chunk-bj4851d8.js")},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>import("./chunk-yynk0bam.js")},{id:"erb",name:"ERB",import:()=>import("./chunk-ftc3mh9t.js")},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>import("./chunk-by1h1fy3.js")},{id:"fennel",name:"Fennel",import:()=>import("./chunk-jmp4rprf.js")},{id:"fish",name:"Fish",import:()=>import("./chunk-b9s35wb6.js")},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>import("./chunk-zv3jegxm.js")},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>import("./chunk-0b5e8zpy.js")},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>import("./chunk-txdyy4ya.js")},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>import("./chunk-nay5m04y.js")},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:()=>import("./chunk-a5k1t6aj.js")},{id:"gdscript",name:"GDScript",aliases:["gd"],import:()=>import("./chunk-t49vbac9.js")},{id:"gdshader",name:"GDShader",import:()=>import("./chunk-3b63e6mc.js")},{id:"genie",name:"Genie",import:()=>import("./chunk-mkzpj7ht.js")},{id:"gherkin",name:"Gherkin",import:()=>import("./chunk-2xr9jk3t.js")},{id:"git-commit",name:"Git Commit Message",import:()=>import("./chunk-mnxav3bw.js")},{id:"git-rebase",name:"Git Rebase Message",import:()=>import("./chunk-9skn642s.js")},{id:"gleam",name:"Gleam",import:()=>import("./chunk-6r8jhnde.js")},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>import("./chunk-645r8yk7.js")},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>import("./chunk-kbaz8s34.js")},{id:"glsl",name:"GLSL",import:()=>import("./chunk-2xrccbwa.js")},{id:"gn",name:"GN",import:()=>import("./chunk-4cg3jh38.js")},{id:"gnuplot",name:"Gnuplot",import:()=>import("./chunk-ky2zgpqq.js")},{id:"go",name:"Go",import:()=>import("./chunk-skh4rx0s.js")},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>import("./chunk-5gjt4v98.js")},{id:"groovy",name:"Groovy",import:()=>import("./chunk-hqhqqe9q.js")},{id:"hack",name:"Hack",import:()=>import("./chunk-3mjwhvpy.js")},{id:"haml",name:"Ruby Haml",import:()=>import("./chunk-2yrz4qdk.js")},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>import("./chunk-kwhma00c.js")},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>import("./chunk-2kqs0amy.js")},{id:"haxe",name:"Haxe",import:()=>import("./chunk-bc95nfbs.js")},{id:"hcl",name:"HashiCorp HCL",import:()=>import("./chunk-z578v7vz.js")},{id:"hjson",name:"Hjson",import:()=>import("./chunk-t6bb31dn.js")},{id:"hlsl",name:"HLSL",import:()=>import("./chunk-8n9e3wbs.js")},{id:"html",name:"HTML",import:()=>import("./chunk-4mj1r6nd.js")},{id:"html-derivative",name:"HTML (Derivative)",import:()=>import("./chunk-xqhnnbfr.js")},{id:"http",name:"HTTP",import:()=>import("./chunk-tv25zrtk.js")},{id:"hurl",name:"Hurl",import:()=>import("./chunk-r53nsqbh.js")},{id:"hxml",name:"HXML",import:()=>import("./chunk-sbcw8d8z.js")},{id:"hy",name:"Hy",import:()=>import("./chunk-sy7vf5c5.js")},{id:"imba",name:"Imba",import:()=>import("./chunk-9xtq15gy.js")},{id:"ini",name:"INI",aliases:["properties"],import:()=>import("./chunk-1ek0xjkr.js")},{id:"java",name:"Java",import:()=>import("./chunk-y7qk76sv.js")},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>import("./chunk-vcbgawge.js")},{id:"jinja",name:"Jinja",import:()=>import("./chunk-x6je1qsq.js")},{id:"jison",name:"Jison",import:()=>import("./chunk-9qtsjepd.js")},{id:"json",name:"JSON",import:()=>import("./chunk-h77takma.js")},{id:"json5",name:"JSON5",import:()=>import("./chunk-yd3vzgxs.js")},{id:"jsonc",name:"JSON with Comments",import:()=>import("./chunk-jeavnd8g.js")},{id:"jsonl",name:"JSON Lines",import:()=>import("./chunk-6jdfap4a.js")},{id:"jsonnet",name:"Jsonnet",import:()=>import("./chunk-rnpfchb9.js")},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>import("./chunk-9n2ge60j.js")},{id:"jsx",name:"JSX",import:()=>import("./chunk-kzafnaxn.js")},{id:"julia",name:"Julia",aliases:["jl"],import:()=>import("./chunk-en2d49a7.js")},{id:"kdl",name:"KDL",import:()=>import("./chunk-srtwf73c.js")},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>import("./chunk-satxmrvx.js")},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>import("./chunk-87w588zd.js")},{id:"latex",name:"LaTeX",import:()=>import("./chunk-b79d73fy.js")},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>import("./chunk-xkvnfywa.js")},{id:"less",name:"Less",import:()=>import("./chunk-jwtpf45z.js")},{id:"liquid",name:"Liquid",import:()=>import("./chunk-n4s96jdz.js")},{id:"llvm",name:"LLVM IR",import:()=>import("./chunk-zv0nefnm.js")},{id:"log",name:"Log file",import:()=>import("./chunk-kkk1k414.js")},{id:"logo",name:"Logo",import:()=>import("./chunk-v667b8k4.js")},{id:"lua",name:"Lua",import:()=>import("./chunk-5hcvm27y.js")},{id:"luau",name:"Luau",import:()=>import("./chunk-gt6xd3pb.js")},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>import("./chunk-f4cn2y4x.js")},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>import("./chunk-3zf20ctr.js")},{id:"marko",name:"Marko",import:()=>import("./chunk-04mq56m4.js")},{id:"matlab",name:"MATLAB",import:()=>import("./chunk-vs72fgve.js")},{id:"mdc",name:"MDC",import:()=>import("./chunk-fyay9ztg.js")},{id:"mdx",name:"MDX",import:()=>import("./chunk-d20g16c2.js")},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>import("./chunk-mttnv195.js")},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>import("./chunk-5xhjmcrr.js")},{id:"mojo",name:"Mojo",import:()=>import("./chunk-kz78gsrq.js")},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>import("./chunk-54ya969p.js")},{id:"move",name:"Move",import:()=>import("./chunk-9xcz69sj.js")},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>import("./chunk-sjkk13dd.js")},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>import("./chunk-55pfd4pp.js")},{id:"nginx",name:"Nginx",import:()=>import("./chunk-a07p1cfs.js")},{id:"nim",name:"Nim",import:()=>import("./chunk-zq5ncapf.js")},{id:"nix",name:"Nix",import:()=>import("./chunk-zf96st2f.js")},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>import("./chunk-4w4ezegn.js")},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>import("./chunk-6wbgc1xz.js")},{id:"objective-cpp",name:"Objective-C++",import:()=>import("./chunk-m5rj1w7e.js")},{id:"ocaml",name:"OCaml",import:()=>import("./chunk-hd39y2wf.js")},{id:"odin",name:"Odin",import:()=>import("./chunk-35bvsa6m.js")},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>import("./chunk-5pt6e5bh.js")},{id:"pascal",name:"Pascal",import:()=>import("./chunk-w4kh5s54.js")},{id:"perl",name:"Perl",import:()=>import("./chunk-dtha8g8n.js")},{id:"php",name:"PHP",import:()=>import("./chunk-khd8ds90.js")},{id:"pkl",name:"Pkl",import:()=>import("./chunk-jk42e7d2.js")},{id:"plsql",name:"PL/SQL",import:()=>import("./chunk-sexnhyqf.js")},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>import("./chunk-xtrkc4bn.js")},{id:"polar",name:"Polar",import:()=>import("./chunk-xg586hyh.js")},{id:"postcss",name:"PostCSS",import:()=>import("./chunk-a22ebaj5.js")},{id:"powerquery",name:"PowerQuery",import:()=>import("./chunk-mwqg224k.js")},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>import("./chunk-q9wkyq6a.js")},{id:"prisma",name:"Prisma",import:()=>import("./chunk-7wqcxfc4.js")},{id:"prolog",name:"Prolog",import:()=>import("./chunk-f7rxszbz.js")},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>import("./chunk-jv8shhgk.js")},{id:"pug",name:"Pug",aliases:["jade"],import:()=>import("./chunk-5c13nrde.js")},{id:"puppet",name:"Puppet",import:()=>import("./chunk-xxwnet5y.js")},{id:"purescript",name:"PureScript",import:()=>import("./chunk-wkvnhk36.js")},{id:"python",name:"Python",aliases:["py"],import:()=>import("./chunk-mgkmr3xy.js")},{id:"qml",name:"QML",import:()=>import("./chunk-b3s0bcp6.js")},{id:"qmldir",name:"QML Directory",import:()=>import("./chunk-d7b0m60j.js")},{id:"qss",name:"Qt Style Sheets",import:()=>import("./chunk-p57dfnmm.js")},{id:"r",name:"R",import:()=>import("./chunk-ynjy01zm.js")},{id:"racket",name:"Racket",import:()=>import("./chunk-v6nssgv7.js")},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>import("./chunk-1ja6becj.js")},{id:"razor",name:"ASP.NET Razor",import:()=>import("./chunk-7jy1478y.js")},{id:"reg",name:"Windows Registry Script",import:()=>import("./chunk-wp436n3r.js")},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>import("./chunk-jn4wgzaz.js")},{id:"rel",name:"Rel",import:()=>import("./chunk-9b45fe34.js")},{id:"riscv",name:"RISC-V",import:()=>import("./chunk-yj3fncjn.js")},{id:"ron",name:"RON",import:()=>import("./chunk-8vsqygpz.js")},{id:"rosmsg",name:"ROS Interface",import:()=>import("./chunk-16jx4h98.js")},{id:"rst",name:"reStructuredText",import:()=>import("./chunk-5eg3bn3m.js")},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>import("./chunk-vdd1xyrt.js")},{id:"rust",name:"Rust",aliases:["rs"],import:()=>import("./chunk-dee62n5c.js")},{id:"sas",name:"SAS",import:()=>import("./chunk-9a6kwz9e.js")},{id:"sass",name:"Sass",import:()=>import("./chunk-sdr9ywjt.js")},{id:"scala",name:"Scala",import:()=>import("./chunk-v6faz3vj.js")},{id:"scheme",name:"Scheme",import:()=>import("./chunk-9rks3bc7.js")},{id:"scss",name:"SCSS",import:()=>import("./chunk-kz9rfhe3.js")},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>import("./chunk-9xp471ze.js")},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>import("./chunk-583jqck6.js")},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>import("./chunk-a0jc9gfw.js")},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>import("./chunk-exj3mryv.js")},{id:"smalltalk",name:"Smalltalk",import:()=>import("./chunk-h1j74efh.js")},{id:"solidity",name:"Solidity",import:()=>import("./chunk-brcvpmwp.js")},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>import("./chunk-3xfw5w0d.js")},{id:"sparql",name:"SPARQL",import:()=>import("./chunk-51rhc5g1.js")},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>import("./chunk-9as23fmk.js")},{id:"sql",name:"SQL",import:()=>import("./chunk-j9bkjc22.js")},{id:"ssh-config",name:"SSH Config",import:()=>import("./chunk-n3e766aj.js")},{id:"stata",name:"Stata",import:()=>import("./chunk-95963acy.js")},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>import("./chunk-q2qcexv0.js")},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:()=>import("./chunk-10qr9jk1.js")},{id:"svelte",name:"Svelte",import:()=>import("./chunk-dn2fe6a4.js")},{id:"swift",name:"Swift",import:()=>import("./chunk-07em03a3.js")},{id:"system-verilog",name:"SystemVerilog",import:()=>import("./chunk-b6xdt5xb.js")},{id:"systemd",name:"Systemd Units",import:()=>import("./chunk-n9yfs19q.js")},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>import("./chunk-x866vcqf.js")},{id:"tasl",name:"Tasl",import:()=>import("./chunk-g1r86637.js")},{id:"tcl",name:"Tcl",import:()=>import("./chunk-j4c847h3.js")},{id:"templ",name:"Templ",import:()=>import("./chunk-j7dazkh4.js")},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>import("./chunk-ntc51kg0.js")},{id:"tex",name:"TeX",import:()=>import("./chunk-pht0yvya.js")},{id:"toml",name:"TOML",import:()=>import("./chunk-x0xaw21f.js")},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>import("./chunk-3k4101h5.js")},{id:"tsv",name:"TSV",import:()=>import("./chunk-en6q3h2k.js")},{id:"tsx",name:"TSX",import:()=>import("./chunk-svcy27ht.js")},{id:"turtle",name:"Turtle",import:()=>import("./chunk-29tmghhd.js")},{id:"twig",name:"Twig",import:()=>import("./chunk-g1z6k96z.js")},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>import("./chunk-fsh8c4gw.js")},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>import("./chunk-xkfzt78k.js")},{id:"typst",name:"Typst",aliases:["typ"],import:()=>import("./chunk-t7qx43hg.js")},{id:"v",name:"V",import:()=>import("./chunk-1yq51mb3.js")},{id:"vala",name:"Vala",import:()=>import("./chunk-cypczp4s.js")},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>import("./chunk-my5y2p5a.js")},{id:"verilog",name:"Verilog",import:()=>import("./chunk-01tsa9cq.js")},{id:"vhdl",name:"VHDL",import:()=>import("./chunk-c04rr3mc.js")},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>import("./chunk-74j5prfv.js")},{id:"vue",name:"Vue",import:()=>import("./chunk-zgnjqvkp.js")},{id:"vue-html",name:"Vue HTML",import:()=>import("./chunk-6tf8wacp.js")},{id:"vue-vine",name:"Vue Vine",import:()=>import("./chunk-46ac6010.js")},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>import("./chunk-ggwb349q.js")},{id:"wasm",name:"WebAssembly",import:()=>import("./chunk-jva13pdt.js")},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>import("./chunk-2p664mgv.js")},{id:"wgsl",name:"WGSL",import:()=>import("./chunk-dne3hqde.js")},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>import("./chunk-4k9xgsq4.js")},{id:"wit",name:"WebAssembly Interface Types",import:()=>import("./chunk-sd9rvjt6.js")},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>import("./chunk-46bmfch2.js")},{id:"xml",name:"XML",import:()=>import("./chunk-vfwh7m86.js")},{id:"xsl",name:"XSL",import:()=>import("./chunk-fg2zmrdg.js")},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>import("./chunk-4h4fdqy9.js")},{id:"zenscript",name:"ZenScript",import:()=>import("./chunk-t3q0fpe0.js")},{id:"zig",name:"Zig",import:()=>import("./chunk-2cj25dc6.js")}],C9=Object.fromEntries(Y1.map((Z)=>[Z.id,Z.import])),R9=Object.fromEntries(Y1.flatMap((Z)=>Z.aliases?.map((Y)=>[Y,Z.import])||[])),X1={...C9,...R9};var v9=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>import("./chunk-e43hpgc8.js")},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>import("./chunk-fwmc6hwy.js")},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>import("./chunk-zcg0fy8h.js")},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:()=>import("./chunk-e07gx0kg.js")},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:()=>import("./chunk-tr01bt0h.js")},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>import("./chunk-c2gqabg2.js")},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>import("./chunk-cfsnygh0.js")},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>import("./chunk-665a7fke.js")},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>import("./chunk-dj82prdc.js")},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>import("./chunk-nzfjhsr7.js")},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>import("./chunk-0qys39ww.js")},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>import("./chunk-5yv6fsvn.js")},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>import("./chunk-8ynj83n2.js")},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>import("./chunk-ffyj4q4f.js")},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>import("./chunk-qcyfn6sh.js")},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>import("./chunk-nvynvczn.js")},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>import("./chunk-1r67ngsh.js")},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>import("./chunk-b7h6wk4v.js")},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>import("./chunk-6yk2jj1m.js")},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>import("./chunk-5em7s1at.js")},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>import("./chunk-w3y3sdmt.js")},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>import("./chunk-bcwnznke.js")},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>import("./chunk-f6rsbhs6.js")},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>import("./chunk-jpkm78je.js")},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>import("./chunk-jw043xpz.js")},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>import("./chunk-x0gm6db7.js")},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>import("./chunk-a4ah9wgn.js")},{id:"horizon",displayName:"Horizon",type:"dark",import:()=>import("./chunk-s7qqrnzh.js")},{id:"houston",displayName:"Houston",type:"dark",import:()=>import("./chunk-fesyrdnx.js")},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>import("./chunk-9dhex1sf.js")},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>import("./chunk-8w10sa5e.js")},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>import("./chunk-p0ys44e5.js")},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>import("./chunk-zqg7xzex.js")},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>import("./chunk-00jvgph3.js")},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>import("./chunk-p3yymm16.js")},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>import("./chunk-v02wftj8.js")},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>import("./chunk-bnma63xz.js")},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>import("./chunk-07fnyy77.js")},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>import("./chunk-k45jk0ge.js")},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>import("./chunk-6qce4a2z.js")},{id:"min-light",displayName:"Min Light",type:"light",import:()=>import("./chunk-zj03ksjd.js")},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>import("./chunk-66s9chr5.js")},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>import("./chunk-mxwqk6ht.js")},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:()=>import("./chunk-qhs3hh67.js")},{id:"nord",displayName:"Nord",type:"dark",import:()=>import("./chunk-yd6e0k1x.js")},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>import("./chunk-httqsv3p.js")},{id:"one-light",displayName:"One Light",type:"light",import:()=>import("./chunk-gc0daqhj.js")},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>import("./chunk-fdvezfdb.js")},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>import("./chunk-1a34fyjt.js")},{id:"red",displayName:"Red",type:"dark",import:()=>import("./chunk-mx8stxha.js")},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>import("./chunk-m0czpwvf.js")},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>import("./chunk-wgwaq8q1.js")},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>import("./chunk-ewgpt1pm.js")},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>import("./chunk-y62ja3na.js")},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>import("./chunk-667brfhx.js")},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>import("./chunk-eceb8jjd.js")},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>import("./chunk-fm4a6pgp.js")},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>import("./chunk-sw4h382q.js")},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>import("./chunk-8p1ebpny.js")},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>import("./chunk-p1e4d1an.js")},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>import("./chunk-pr8jrhq9.js")},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>import("./chunk-vbwkgvhq.js")},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>import("./chunk-962ms02t.js")},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>import("./chunk-k06v7jh2.js")}],J1=Object.fromEntries(v9.map((Z)=>[Z.id,Z.import]));class V0 extends Error{constructor(Z){super(Z);this.name="ShikiError"}}function I9(){return 2147483648}function D9(){return typeof performance<"u"?performance.now():Date.now()}var V9=(Z,Y)=>Z+(Y-Z%Y)%Y;async function E9(Z){let Y,X,J={};function Q(M){X=M,J.HEAPU8=new Uint8Array(M),J.HEAPU32=new Uint32Array(M)}function $(M,A,w){J.HEAPU8.copyWithin(M,A,A+w)}function K(M){try{return Y.grow(M-X.byteLength+65535>>>16),Q(Y.buffer),1}catch{}}function U(M){let A=J.HEAPU8.length;M=M>>>0;let w=I9();if(M>w)return!1;for(let P=1;P<=4;P*=2){let B=A*(1+0.2/P);B=Math.min(B,M+100663296);let R=Math.min(w,V9(Math.max(M,B),65536));if(K(R))return!0}return!1}let W=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function z(M,A,w=1024){let P=A+w,B=A;while(M[B]&&!(B>=P))++B;if(B-A>16&&M.buffer&&W)return W.decode(M.subarray(A,B));let R="";while(A<B){let C=M[A++];if(!(C&128)){R+=String.fromCharCode(C);continue}let D=M[A++]&63;if((C&224)===192){R+=String.fromCharCode((C&31)<<6|D);continue}let j=M[A++]&63;if((C&240)===224)C=(C&15)<<12|D<<6|j;else C=(C&7)<<18|D<<12|j<<6|M[A++]&63;if(C<65536)R+=String.fromCharCode(C);else{let E=C-65536;R+=String.fromCharCode(55296|E>>10,56320|E&1023)}}return R}function H(M,A){return M?z(J.HEAPU8,M,A):""}let G={emscripten_get_now:D9,emscripten_memcpy_big:$,emscripten_resize_heap:U,fd_write:()=>0};async function F(){let A=await Z({env:G,wasi_snapshot_preview1:G});Y=A.memory,Q(Y.buffer),Object.assign(J,A),J.UTF8ToString=H}return await F(),J}var b9=Object.defineProperty,T9=(Z,Y,X)=>(Y in Z)?b9(Z,Y,{enumerable:!0,configurable:!0,writable:!0,value:X}):Z[Y]=X,OZ=(Z,Y,X)=>T9(Z,typeof Y!=="symbol"?Y+"":Y,X),NZ=null;function f9(Z){throw new V0(Z.UTF8ToString(Z.getLastOnigError()))}class E0{constructor(Z){OZ(this,"utf16Length"),OZ(this,"utf8Length"),OZ(this,"utf16Value"),OZ(this,"utf8Value"),OZ(this,"utf16OffsetToUtf8"),OZ(this,"utf8OffsetToUtf16");let Y=Z.length,X=E0._utf8ByteLength(Z),J=X!==Y,Q=J?new Uint32Array(Y+1):null;if(J)Q[Y]=X;let $=J?new Uint32Array(X+1):null;if(J)$[X]=Y;let K=new Uint8Array(X),U=0;for(let W=0;W<Y;W++){let z=Z.charCodeAt(W),H=z,G=!1;if(z>=55296&&z<=56319){if(W+1<Y){let F=Z.charCodeAt(W+1);if(F>=56320&&F<=57343)H=(z-55296<<10)+65536|F-56320,G=!0}}if(J){if(Q[W]=U,G)Q[W+1]=U;if(H<=127)$[U+0]=W;else if(H<=2047)$[U+0]=W,$[U+1]=W;else if(H<=65535)$[U+0]=W,$[U+1]=W,$[U+2]=W;else $[U+0]=W,$[U+1]=W,$[U+2]=W,$[U+3]=W}if(H<=127)K[U++]=H;else if(H<=2047)K[U++]=192|(H&1984)>>>6,K[U++]=128|(H&63)>>>0;else if(H<=65535)K[U++]=224|(H&61440)>>>12,K[U++]=128|(H&4032)>>>6,K[U++]=128|(H&63)>>>0;else K[U++]=240|(H&1835008)>>>18,K[U++]=128|(H&258048)>>>12,K[U++]=128|(H&4032)>>>6,K[U++]=128|(H&63)>>>0;if(G)W++}this.utf16Length=Y,this.utf8Length=X,this.utf16Value=Z,this.utf8Value=K,this.utf16OffsetToUtf8=Q,this.utf8OffsetToUtf16=$}static _utf8ByteLength(Z){let Y=0;for(let X=0,J=Z.length;X<J;X++){let Q=Z.charCodeAt(X),$=Q,K=!1;if(Q>=55296&&Q<=56319){if(X+1<J){let U=Z.charCodeAt(X+1);if(U>=56320&&U<=57343)$=(Q-55296<<10)+65536|U-56320,K=!0}}if($<=127)Y+=1;else if($<=2047)Y+=2;else if($<=65535)Y+=3;else Y+=4;if(K)X++}return Y}createString(Z){let Y=Z.omalloc(this.utf8Length);return Z.HEAPU8.set(this.utf8Value,Y),Y}}var b0=class Z{constructor(Y){if(OZ(this,"id",++Z.LAST_ID),OZ(this,"_onigBinding"),OZ(this,"content"),OZ(this,"utf16Length"),OZ(this,"utf8Length"),OZ(this,"utf16OffsetToUtf8"),OZ(this,"utf8OffsetToUtf16"),OZ(this,"ptr"),!NZ)throw new V0("Must invoke loadWasm first.");this._onigBinding=NZ,this.content=Y;let X=new E0(Y);if(this.utf16Length=X.utf16Length,this.utf8Length=X.utf8Length,this.utf16OffsetToUtf8=X.utf16OffsetToUtf8,this.utf8OffsetToUtf16=X.utf8OffsetToUtf16,this.utf8Length<1e4&&!Z._sharedPtrInUse){if(!Z._sharedPtr)Z._sharedPtr=NZ.omalloc(1e4);Z._sharedPtrInUse=!0,NZ.HEAPU8.set(X.utf8Value,Z._sharedPtr),this.ptr=Z._sharedPtr}else this.ptr=X.createString(NZ)}convertUtf8OffsetToUtf16(Y){if(this.utf8OffsetToUtf16){if(Y<0)return 0;if(Y>this.utf8Length)return this.utf16Length;return this.utf8OffsetToUtf16[Y]}return Y}convertUtf16OffsetToUtf8(Y){if(this.utf16OffsetToUtf8){if(Y<0)return 0;if(Y>this.utf16Length)return this.utf8Length;return this.utf16OffsetToUtf8[Y]}return Y}dispose(){if(this.ptr===Z._sharedPtr)Z._sharedPtrInUse=!1;else this._onigBinding.ofree(this.ptr)}};OZ(b0,"LAST_ID",0);OZ(b0,"_sharedPtr",0);OZ(b0,"_sharedPtrInUse",!1);var Q1=b0;class $1{constructor(Z){if(OZ(this,"_onigBinding"),OZ(this,"_ptr"),!NZ)throw new V0("Must invoke loadWasm first.");let Y=[],X=[];for(let K=0,U=Z.length;K<U;K++){let W=new E0(Z[K]);Y[K]=W.createString(NZ),X[K]=W.utf8Length}let J=NZ.omalloc(4*Z.length);NZ.HEAPU32.set(Y,J/4);let Q=NZ.omalloc(4*Z.length);NZ.HEAPU32.set(X,Q/4);let $=NZ.createOnigScanner(J,Q,Z.length);for(let K=0,U=Z.length;K<U;K++)NZ.ofree(Y[K]);if(NZ.ofree(Q),NZ.ofree(J),$===0)f9(NZ);this._onigBinding=NZ,this._ptr=$}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(Z,Y,X){let J=0;if(typeof X==="number")J=X;if(typeof Z==="string"){Z=new Q1(Z);let Q=this._findNextMatchSync(Z,Y,!1,J);return Z.dispose(),Q}return this._findNextMatchSync(Z,Y,!1,J)}_findNextMatchSync(Z,Y,X,J){let Q=this._onigBinding,$=Q.findNextOnigScannerMatch(this._ptr,Z.id,Z.ptr,Z.utf8Length,Z.convertUtf16OffsetToUtf8(Y),J);if($===0)return null;let K=Q.HEAPU32,U=$/4,W=K[U++],z=K[U++],H=[];for(let G=0;G<z;G++){let F=Z.convertUtf8OffsetToUtf16(K[U++]),M=Z.convertUtf8OffsetToUtf16(K[U++]);H[G]={start:F,end:M,length:M-F}}return{index:W,captureIndices:H}}}function j9(Z){return typeof Z.instantiator==="function"}function S9(Z){return typeof Z.default==="function"}function y9(Z){return typeof Z.data<"u"}function k9(Z){return typeof Response<"u"&&Z instanceof Response}function h9(Z){return typeof ArrayBuffer<"u"&&(Z instanceof ArrayBuffer||ArrayBuffer.isView(Z))||typeof Buffer<"u"&&Buffer.isBuffer?.(Z)||typeof SharedArrayBuffer<"u"&&Z instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&Z instanceof Uint32Array}var D0;function x9(Z){if(D0)return D0;async function Y(){NZ=await E9(async(X)=>{let J=Z;if(J=await J,typeof J==="function")J=await J(X);if(typeof J==="function")J=await J(X);if(j9(J))J=await J.instantiator(X);else if(S9(J))J=await J.default(X);else{if(y9(J))J=J.data;if(k9(J))if(typeof WebAssembly.instantiateStreaming==="function")J=await g9(J)(X);else J=await u9(J)(X);else if(h9(J))J=await d8(J)(X);else if(J instanceof WebAssembly.Module)J=await d8(J)(X);else if("default"in J&&J.default instanceof WebAssembly.Module)J=await d8(J.default)(X)}if("instance"in J)J=J.instance;if("exports"in J)J=J.exports;return J})}return D0=Y(),D0}function d8(Z){return(Y)=>WebAssembly.instantiate(Z,Y)}function g9(Z){return(Y)=>WebAssembly.instantiateStreaming(Z,Y)}function u9(Z){return async(Y)=>{let X=await Z.arrayBuffer();return WebAssembly.instantiate(X,Y)}}async function K1(Z){if(Z)await x9(Z);return{createScanner(Y){return new $1(Y.map((X)=>typeof X==="string"?X:X.source))},createString(Y){return new Q1(Y)}}}var W1=e6({langs:X1,themes:J1,engine:()=>K1(import("./chunk-zed64rf0.js"))}),{codeToHtml:m9,codeToHast:p9,codeToTokens:c8,codeToTokensBase:d9,codeToTokensWithThemes:c9,getSingletonHighlighter:l9,getLastGrammarState:i9}=Z1(W1,{guessEmbeddedLanguages:c6});var vZ={h1:{bold:!0,marginBottom:1,color:"#f74cc7ff"},h2:{bold:!0,marginBottom:1,color:"#326cfcff"},h3:{bold:!0,color:"#24ffedff"},h4:{bold:!0,color:"#e29418ff"},h5:{bold:!0,color:"#9fc214ff"},h6:{bold:!0,dimColor:!0,color:"#88eb2bff"},paragraph:{},blockquote:{paddingLeft:1,dimColor:!0,borderTop:!1,borderBottom:!1,borderRight:!1,borderStyle:"single",borderDimColor:!0},code:{marginTop:1},codespan:{dimColor:!0},list:{},listItem:{bullet:"●",paddingLeft:2},hr:{char:"─",width:40,dimColor:!0},link:{color:"#343afcff",underline:!0},strong:{bold:!0},em:{italic:!0},del:{strikethrough:!0,dimColor:!0},image:{color:"blue"},table:{},tableCell:{paddingRight:2}},o9=["color","backgroundColor","dimColor","bold","italic","underline","strikethrough","inverse","wrap"],n9=["paddingLeft","paddingRight","paddingTop","paddingBottom","padding","paddingX","paddingY","marginLeft","marginRight","marginTop","marginBottom","margin","marginX","marginY","borderStyle","borderColor","borderTop","borderBottom","borderLeft","borderRight","borderDimColor","borderTopColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopDimColor","borderBottomDimColor","borderLeftDimColor","borderRightDimColor"];async function a9(Z,Y,X="github-dark"){try{let J=await c8(Z,{lang:Y||"text",theme:X}),Q=[],$=0;for(let K=0;K<J.tokens.length;K++){let U=J.tokens[K];if(U){for(let W of U){let z=W.color||void 0;Q.push(V.jsx(O,{color:z,children:W.content},`token-${$}`)),$++}if(K<J.tokens.length-1)Q.push(V.jsx(O,{children:`
|
|
149
|
+
`},`nl-${K}`))}}return Q}catch{return null}}function PZ(Z){if(!Z)return{};let Y={};for(let X of o9)if(X in Z)Y[X]=Z[X];return Y}function ZY(Z){if(!Z)return{};let Y={};for(let X of n9)if(X in Z)Y[X]=Z[X];return Y}function IZ(Z,Y){if(!Z&&!Y)return{};if(!Z)return Y;if(!Y)return Z;return{...Z,...Y}}function s9({code:Z,language:Y,style:X,theme:J}){let[Q,$]=pZ.useState(null),[K,U]=pZ.useState(!0);if(pZ.useEffect(()=>{let W=!1;async function z(){try{let H=await a9(Z,Y,J);if(!W)$(H),U(!1)}catch{if(!W)$(null),U(!1)}}return z(),()=>{W=!0}},[Z,Y,J]),K||!Q)return V.jsx(N,{...ZY(X),children:V.jsx(O,{...PZ(X),children:Z})});return V.jsx(N,{paddingX:2,paddingY:1,...ZY(X),children:V.jsx(O,{...PZ(X),children:Q})})}function SZ(Z,Y,X){if(!Z||Z.length===0)return null;return Z.map((J,Q)=>{let $=`inline-${Q}`;switch(J.type){case"text":case"escape":{let K=J;if("tokens"in K&&K.tokens)return V.jsx(O,{children:SZ(K.tokens,Y,X)},$);return V.jsx(O,{children:K.text},$)}case"strong":{let K=J,U=IZ(vZ.strong,Y.strong);if(X.strong)return V.jsx(O,{children:X.strong(SZ(K.tokens,Y,X),K)},$);return V.jsx(O,{...PZ(U),children:SZ(K.tokens,Y,X)},$)}case"em":{let K=J,U=IZ(vZ.em,Y.em);if(X.em)return V.jsx(O,{children:X.em(SZ(K.tokens,Y,X),K)},$);return V.jsx(O,{...PZ(U),children:SZ(K.tokens,Y,X)},$)}case"del":{let K=J,U=IZ(vZ.del,Y.del);if(X.del)return V.jsx(O,{children:X.del(SZ(K.tokens,Y,X),K)},$);return V.jsx(O,{...PZ(U),children:SZ(K.tokens,Y,X)},$)}case"codespan":{let K=J,U=IZ(vZ.codespan,Y.codespan);if(X.codespan)return V.jsx(O,{children:X.codespan(K.text,K)},$);return V.jsx(O,{...PZ(U),children:K.text},$)}case"link":{let K=J,U=IZ(vZ.link,Y.link);if(X.link)return V.jsx(O,{children:X.link(K.text,K.href,K.title,K)},$);return V.jsxs(O,{...PZ(U),children:[K.text,K.href&&` (${K.href})`]},$)}case"image":{let K=J,U=IZ(vZ.image,Y.image);if(X.image)return V.jsx(O,{children:X.image(K.text,K.href,K.title,K)},$);return V.jsxs(O,{...PZ(U),children:["[Image: ",K.text||K.href,"]"]},$)}case"br":return V.jsx(O,{children:`
|
|
150
|
+
`},$);default:if("text"in J)return V.jsx(O,{children:J.text},$);return null}})}function l8(Z,Y,X,J,Q,$="github-dark"){switch(Z.type){case"heading":{let K=Z,U=`h${K.depth}`,W=`h${K.depth}`,z=X[U];if(z)return z(K.text,K);let H=IZ(vZ[W],Y[W]),G=typeof H.showSharp=="boolean"?H.showSharp:Boolean(J);return V.jsx(N,{...ZY(H),children:V.jsxs(O,{...PZ(H),children:[G&&`${"#".repeat(K.depth)} `,SZ(K.tokens,Y,X)]})})}case"paragraph":{let K=Z,U=IZ(vZ.paragraph,Y.paragraph),W=SZ(K.tokens,Y,X);if(X.paragraph)return X.paragraph(W,K);return V.jsx(N,{...ZY(U),children:V.jsx(O,{...PZ(U),children:W})})}case"code":{let K=Z,U=IZ(vZ.code,Y.code);if(X.code)return X.code(K.text,K.lang,K);if(Q)return V.jsx(s9,{code:K.text,language:K.lang,style:U,theme:$});return V.jsx(N,{...ZY(U),children:V.jsx(O,{...PZ(U),children:K.text})})}case"blockquote":{let K=Z,U=IZ(vZ.blockquote,Y.blockquote),W=K.tokens.map((z,H)=>V.jsx(N,{children:l8(z,Y,X,J,Q,$)},`bq-${H}`));if(X.blockquote)return X.blockquote(W,K);return V.jsx(N,{...ZY(U),children:V.jsx(N,{flexDirection:"column",children:K.tokens.map((z,H)=>{if(l8(z,Y,X,J,Q,$))return V.jsx(O,{...PZ(U),children:z.type==="paragraph"?SZ(z.tokens,Y,X):z.text||""},`bq-text-${H}`);return null})})})}case"list":{let K=Z,U=IZ(vZ.list,Y.list),W=IZ(vZ.listItem,Y.listItem),z=W.bullet||"●",H=K.items.map((G,F)=>{let M=typeof K.start=="number"?K.start:1,A=K.ordered?`${M+F}. `:`${z} `,w=SZ(G.tokens,Y,X);if(X.listItem)return V.jsx(N,{...ZY(W),children:X.listItem(w,G)},`li-${F}`);return V.jsx(N,{...ZY(W),children:V.jsxs(O,{...PZ(W),children:[A,w]})},`li-${F}`)});if(X.list)return X.list(H,K.ordered,K);return V.jsx(N,{flexDirection:"column",...ZY(U),children:H})}case"hr":{let K=Z,U=IZ(vZ.hr,Y.hr),W=U.char||"─",z=U.width||40;if(X.hr)return X.hr(K);return V.jsx(N,{...ZY(U),children:V.jsx(O,{...PZ(U),children:W.repeat(z)})})}case"table":{let K=Z,U=IZ(vZ.table,Y.table),W=IZ(vZ.tableCell,Y.tableCell),z=(B)=>B.map((R)=>{if("text"in R)return R.text;return""}).join(""),H=K.header.map((B,R)=>{let C=z(B.tokens).length,D=Math.max(...K.rows.map((j)=>{let E=j[R]?.tokens;return E?z(E).length:0}),0);return Math.max(C,D,3)}),G=V.jsxs(O,{dimColor:!0,children:["┌─",H.map((B)=>"─".repeat(B)).join("─┬─"),"─┐"]}),F=V.jsxs(O,{children:[V.jsx(O,{dimColor:!0,children:"│ "}),K.header.map((B,R)=>{let C=SZ(B.tokens,Y,X),D=z(B.tokens);return V.jsxs(O,{children:[V.jsxs(O,{bold:!0,...PZ(W),children:[C," ".repeat(Math.max(0,(H[R]||3)-D.length))]}),V.jsxs(O,{dimColor:!0,children:[" │",R<K.header.length-1?" ":""]})]},`th-${R}`)})]}),M=V.jsxs(O,{dimColor:!0,children:["├─",H.map((B)=>"─".repeat(B)).join("─┼─"),"─┤"]}),A=K.rows.map((B,R)=>V.jsxs(O,{children:[V.jsx(O,{dimColor:!0,children:"│ "}),B.map((C,D)=>{let j=SZ(C.tokens,Y,X),E=z(C.tokens),d=H[D]||3;return V.jsxs(O,{children:[V.jsxs(O,{...PZ(W),children:[j," ".repeat(Math.max(0,d-E.length))]}),V.jsxs(O,{dimColor:!0,children:[" │",D<B.length-1?" ":""]})]},`td-${R}-${D}`)})]},`tr-${R}`)),w=V.jsxs(O,{dimColor:!0,children:["└─",H.map((B)=>"─".repeat(B)).join("─┴─"),"─┘"]}),P=V.jsxs(V.Fragment,{children:[G,F,M,A,w]});if(X.table)return X.table(F,A,K);return V.jsx(N,{flexDirection:"column",...ZY(U),children:P})}case"space":return V.jsx(O,{children:`
|
|
151
|
+
`});case"html":return V.jsx(O,{dimColor:!0,children:Z.text});default:if("text"in Z)return V.jsx(O,{children:Z.text});return null}}var U1=pZ.memo(function({token:Z,styles:Y,renderers:X,showSharp:J,highlight:Q,theme:$}){return V.jsx(V.Fragment,{children:l8(Z,Y,X,J,Q,$)})},(Z,Y)=>Z.token===Y.token);U1.displayName="MemoizedBlock";function t9({children:Z,id:Y,styles:X={},renderers:J={},showSharp:Q=!1,highlight:$=!0,theme:K="github-dark"}){let U=pZ.useId(),W=Y||U,z=pZ.useMemo(()=>c.lexer(Z,{silent:!0,gfm:!0}),[Z]);return V.jsx(N,{flexDirection:"column",children:z.map((H,G)=>V.jsx(U1,{token:H,styles:X,renderers:J,showSharp:Q,highlight:$,theme:K},`${W}-block-${G}`))})}var z1=pZ.memo(t9);z1.displayName="Markdown";var e9=z1,H1=e9;var G1=L(x(),1);var h4=L(v(),1),O1=({children:Z,color:Y,dim:X,bold:J,italic:Q})=>{let $=G1.useMemo(()=>{return Z.split(`
|
|
152
|
+
`).map((K)=>K===""?`
|
|
153
|
+
`:K)},[Z]);return h4.jsxDEV(h4.Fragment,{children:$.map((K,U)=>h4.jsxDEV(O,{color:Y,dimColor:X,bold:J,italic:Q,children:K},U,!1,void 0,this))},void 0,!1,void 0,this)};var T0=L(x(),1),i8=L(v(),1),ZW=(Z,Y,X=5)=>{if(!Y||!Z||Z.trim()==="")return Z;let J=Z.split(`
|
|
154
|
+
`);if(J.length<=X)return Z;let Q=J.length-X,$=J.slice(-X);return`\x1B[33m${Q} rows hidden...\x1B[0m
|
|
155
|
+
${$.join(`
|
|
156
|
+
`)}`},YW=({children:Z,simple:Y,loading:X,maxRows:J=5})=>{let Q=T0.useMemo(()=>{return ZW(Z,X,J)},[Z,X,J]);if(Y)return i8.jsxDEV(O1,{children:Q},void 0,!1,void 0,this);return i8.jsxDEV(H1,{children:Q},void 0,!1,void 0,this)},q1=T0.memo(YW);var yZ=L(v(),1),XW=({message:Z,messageNumber:Y,loading:X})=>{let Q=bX(Z),$=$4(Z);if(!$)return yZ.jsxDEV(yZ.Fragment,{},void 0,!1,void 0,this);return yZ.jsxDEV(N,{flexDirection:"column",children:[yZ.jsxDEV(N,{paddingBottom:0,marginBottom:1,children:yZ.jsxDEV(O,{color:bZ("teal"),children:[Y," ","Zen Code"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Q&&yZ.jsxDEV(JW,{thinking:Q,visible:$.trim().length===0},void 0,!1,void 0,this),yZ.jsxDEV(q1,{simple:!1,loading:X,children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},JW=({thinking:Z,visible:Y})=>{let X=Z.split(`
|
|
157
|
+
`);return yZ.jsxDEV(N,{flexDirection:"column",marginBottom:1,children:[yZ.jsxDEV(N,{paddingBottom:0,children:yZ.jsxDEV(O,{color:"gray",bold:!0,children:["Think ",X.length," rows"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Y&&yZ.jsxDEV(F1,{content:Z,maxLines:3},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},f0=XW;var f=L(v(),1),M1=["yellow","magenta","blue"],QW=(Z)=>{let Y=0;for(let J=0;J<Z.length;J++)Y=Z.charCodeAt(J)+((Y<<5)-Y);let X=Math.abs(Y%M1.length);return M1[X]},$W=(Z)=>{return{success:"✓",completed:"✓",ok:"✓",error:"✗",failed:"✗",pending:"⏳",in_progress:"⏳",running:"⏳",cancelled:"⏹"}[Z]||"⏳"},KW=(Z,Y=4,X=100)=>{let J=Z.split(`
|
|
158
|
+
`),Q=(U)=>{if(U.length<=X)return U;return U.substring(0,X)+`... (${U.length-X} more chars)`};if(J.length<=Y)return J.map(Q).join(`
|
|
159
|
+
`);let $=J.slice(0,2).map(Q),K=J.slice(J.length-3).map(Q);return[...$,`... and more ${J.length-5} lines`,...K].join(`
|
|
160
|
+
`)},WW=({content:Z})=>{let Y=(X,J=0,Q=0)=>{let K=" ".repeat(J);if(Q>=3)return f.jsxDEV(O,{dimColor:!0,children:"{...} (truncated)"},void 0,!1,void 0,this);if(X===null)return f.jsxDEV(O,{color:"gray",children:"null"},void 0,!1,void 0,this);if(typeof X!=="object"){let z=JSON.stringify(X);if(typeof X==="string"&&z.length>102){let H=z.substring(1,101);return f.jsxDEV(O,{children:[f.jsxDEV(O,{color:"cyan",children:['"',H,'..."']},void 0,!0,void 0,this)," ",f.jsxDEV(O,{dimColor:!0,children:["(truncated, ",z.length-2," chars)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}if(typeof X==="string")return f.jsxDEV(O,{color:"cyan",children:z},void 0,!1,void 0,this);else if(typeof X==="number")return f.jsxDEV(O,{color:"yellow",children:X},void 0,!1,void 0,this);else if(typeof X==="boolean")return f.jsxDEV(O,{color:"magenta",children:X.toString()},void 0,!1,void 0,this);else return f.jsxDEV(O,{children:z},void 0,!1,void 0,this)}if(Array.isArray(X)){if(X.length===0)return f.jsxDEV(O,{color:"gray",children:"[]"},void 0,!1,void 0,this);let z=5;return f.jsxDEV(f.Fragment,{children:[`
|
|
161
|
+
`,X.slice(0,z).map((H,G)=>f.jsxDEV(O,{children:[f.jsxDEV(O,{children:K},void 0,!1,void 0,this),f.jsxDEV(O,{color:"green",children:"- "},void 0,!1,void 0,this)," ",Y(H,J+1,Q+1),G<Math.min(X.length,z)-1?`
|
|
162
|
+
`:""]},void 0,!0,void 0,this)),X.length>z&&f.jsxDEV(O,{children:[`
|
|
163
|
+
`,f.jsxDEV(O,{children:K},void 0,!1,void 0,this),f.jsxDEV(O,{dimColor:!0,children:["... (",X.length-z," more)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}let U=Object.keys(X);if(U.length===0)return f.jsxDEV(O,{color:"gray"},void 0,!1,void 0,this);let W=5;return f.jsxDEV(f.Fragment,{children:[U.slice(0,W).map((z,H)=>f.jsxDEV(O,{children:[f.jsxDEV(O,{children:K},void 0,!1,void 0,this),f.jsxDEV(O,{color:"blue",children:z},void 0,!1,void 0,this)," ",f.jsxDEV(O,{color:"gray",children:": "},void 0,!1,void 0,this)," ",Y(X[z],J+1,Q+1),H<Math.min(U.length,W)-1?`
|
|
164
|
+
`:""]},void 0,!0,void 0,this)),U.length>W&&f.jsxDEV(O,{children:[`
|
|
165
|
+
`,f.jsxDEV(O,{children:K},void 0,!1,void 0,this),f.jsxDEV(O,{dimColor:!0,children:["... (",U.length-W," more)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};return f.jsxDEV(O,{children:Y(Z)},void 0,!1,void 0,this)},UW=({message:Z,messageNumber:Y})=>{let{getToolUIRender:X,client:J}=KZ(),Q=new o0(Z,J),$=Q.getInputRepaired(),K=$?.title?`: ${$.title}`:$?.description?`: ${$.description}`:"",U=Z.name?X(Z.name):null,W=QW(Z.name||"");return W=Z.status==="error"?"red":"yellow",f.jsxDEV(n,{children:f.jsxDEV(N,{flexDirection:"column",children:[f.jsxDEV(N,{children:[f.jsxDEV(O,{color:W,children:[Y," ",Z.name,f.jsxDEV(O,{color:"gray",children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f.jsxDEV(O,{children:[" ",$W(Z?.status)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),U?f.jsxDEV(N,{children:[f.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),f.jsxDEV(N,{flexDirection:"column",children:U(Z)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f.jsxDEV(N,{flexDirection:"column",paddingTop:0,children:[f.jsxDEV(N,{children:[f.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),f.jsxDEV(WW,{content:Q.getInputRepaired()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),f.jsxDEV(N,{paddingTop:0,paddingBottom:0,children:[f.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),f.jsxDEV(O,{dimColor:!0,italic:!0,children:KW(N1(Z.content))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z.sub_messages?.length?f.jsxDEV(N,{children:[f.jsxDEV(O,{color:"gray",children:"└─ "},void 0,!1,void 0,this),f.jsxDEV(O,{color:W,dimColor:!0,children:["(hidden ",Z.sub_messages.length," subagent messages)"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},A1=UW;var yY=L(v(),1),_1=S0.memo(function({renderMessages:Y,startIndex:X,staticKey:J,loading:Q}){let[$,K]=S0.useState(!1);oZ(()=>K(!0),$?null:0);let U=(G,F,M,A)=>yY.jsxDEV(N,{flexDirection:"column",borderStyle:M?"double":"single",borderLeft:!0,paddingLeft:1,paddingBottom:1,borderBottom:!1,borderTop:!1,borderRight:!1,borderLeftColor:G.type==="ai"?bZ("teal"):G.type==="human"?bZ("amber"):"yellow",children:G.type==="human"?yY.jsxDEV(s4,{content:G.content,messageNumber:F+1+X},void 0,!1,void 0,this):G.type==="tool"?yY.jsxDEV(A1,{message:G,messageNumber:F+1+X},void 0,!1,void 0,this):yY.jsxDEV(f0,{message:G,messageNumber:F+1+X,loading:Q},void 0,!1,void 0,this)},G.id?`${A}-${G.id}`:`${A}-msg-${F}`,!1,void 0,this),W=Y.findIndex((G)=>{if(G.type==="tool"&&!G.done&&!["success","error"].includes(G.status))return!0;return!1});if(W===-1)W=Y.length-1;let z=Y.slice(0,W),H=Y.slice(W);if(!$)return yY.jsxDEV(N,{flexDirection:"column",children:Y.map((G,F)=>U(G,F,F===W,"init"))},void 0,!1,void 0,this);return yY.jsxDEV(N,{flexDirection:"column",children:[yY.jsxDEV(j0,{items:z,children:(G,F)=>U(G,F,!1,"hist")},J,!1,void 0,this),H.map((G,F)=>U(G,z.length+F,!0,"curr"))]},void 0,!0,void 0,this)});var kY=L(x(),1);var qZ=L(v(),1),zW=kY.memo(function({toolGroup:Y,groupId:X,getToolUIRender:J,depth:Q=0,loading:$}){if(Q>1)return null;return qZ.jsxDEV(N,{flexDirection:"column",children:Y.map((K,U)=>{let W=K.name?J(K.name):null;if(!W)return null;let z=K.sub_messages?.length||0,H=K.sub_messages?.slice(-4)||[],G=z-H.length;return qZ.jsxDEV(kY.Fragment,{children:[W(K),H.length?qZ.jsxDEV(qZ.Fragment,{children:[G>0&&qZ.jsxDEV(N,{paddingLeft:2,children:qZ.jsxDEV(O,{dimColor:!0,children:["... ",G," more submessage",G>1?"s":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),qZ.jsxDEV(r8,{renderMessages:H,startIndex:1,depth:Q+1,staticKey:`${instanceId}-sub-d${Q}-i${U}`,getToolUIRender:J,loading:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null]},`${X}-${U}-${K.status}`,!0,void 0,this)})},void 0,!1,void 0,this)}),w1=kY.memo(function({message:Y,displayIndex:X,isCurrent:J,startIndex:Q=0,getToolUIRender:$,depth:K=0,loading:U}){return qZ.jsxDEV(N,{flexDirection:"column",borderStyle:J?"double":"single",paddingBottom:1,borderLeft:!1,borderBottom:!1,borderTop:Y.type==="group"?!1:!0,borderRight:!1,borderTopColor:Y.type==="ai"?bZ("teal"):Y.type==="human"?bZ("amber"):bZ("rose"),children:[Y.type==="human"?qZ.jsxDEV(s4,{content:Y.content,messageNumber:X+1+Q},void 0,!1,void 0,this):null,Y.type==="ai"?qZ.jsxDEV(f0,{message:Y,messageNumber:X+1+Q,loading:U},void 0,!1,void 0,this):null,Y.type==="group"&&qZ.jsxDEV(qZ.Fragment,{children:qZ.jsxDEV(zW,{toolGroup:Y.toolGroup,groupId:Y.id,getToolUIRender:$,depth:K,loading:U},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}),B1=(Z)=>{if(Z.type!=="ai")return!0;try{let Y=$4(Z);return!!(Y&&Y.trim().length>0)}catch{return!1}},r8=kY.memo(function({renderMessages:Y,startIndex:X,staticKey:J,depth:Q=0,getToolUIRender:$,loading:K}){let U=kY.useMemo(()=>{let G=0;return Y.filter((F)=>{if(F.type==="ai")return B1(F);return!0}).reduce((F,M)=>{if(M.type==="tool"){let A=F[F.length-1];if(A&&A.type==="group"&&A.toolGroup.length<5)A.toolGroup.push(M);else F.push({id:`tool-group-${G++}`,type:"group",toolGroup:[M]})}else F.push(M);return F},[])},[Y,B1]),W=U.length-1;if(W===-1)W=U.length-1;if(!K)W=U.length;let z=U.slice(0,W),H=U.slice(W);return qZ.jsxDEV(N,{flexDirection:"column",children:[qZ.jsxDEV(j0,{items:z,children:(G,F)=>qZ.jsxDEV(w1,{message:G,displayIndex:F,isCurrent:!1,startIndex:X,getToolUIRender:$,depth:Q,loading:K},G.id?`hist-${G.id}`:`hist-msg-${Q}-${F}`,!1,void 0,this)},void 0,!1,void 0,this),H.map((G,F)=>qZ.jsxDEV(w1,{message:G,displayIndex:z.length+F,isCurrent:!0,startIndex:X,getToolUIRender:$,depth:Q,loading:K},G.id?`curr-${G.id}`:`curr-msg-${Q}-${z.length}-${F}`,!1,void 0,this))]},void 0,!0,void 0,this)});var T=L(v(),1),HW=()=>{let Z=a4(),Y=new Date().toLocaleDateString(),{extraParams:X,AVAILABLE_MODELS:J,config:Q}=WZ(),$=X.mcp_config||{},K=Object.keys($).length,U=L1(),W=process.platform,z=W==="darwin"?"macOS":W==="win32"?"Windows":"Linux",H=process.cwd(),G=Q?.provider_id||process.env.MODEL_PROVIDER||"openai",M=!!Q?.providers?.find((P)=>P.id===G)?.apiKey,A=J.length>0,w=M&&A;return T.jsxDEV(N,{flexDirection:"column",borderStyle:"round",borderColor:"cyan",paddingX:1,marginBottom:1,children:[T.jsxDEV(N,{flexDirection:"row",justifyContent:"space-between",borderBottom:!1,children:[T.jsxDEV(O,{color:"cyan",bold:!0,children:"ZEN CODE"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"gray",children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{flexDirection:"row",marginTop:1,gap:2,children:[T.jsxDEV(N,{flexDirection:"column",children:T.jsxDEV(O,{color:"cyan",children:`███████╗███████╗███╗ ██╗
|
|
90
166
|
╚══███╔╝██╔════╝████╗ ██║
|
|
91
167
|
███╔╝ █████╗ ██╔██╗ ██║
|
|
92
168
|
███╔╝ ██╔══╝ ██║╚██╗██║
|
|
93
169
|
███████╗███████╗██║ ╚████║
|
|
94
|
-
╚══════╝╚══════╝╚═╝ ╚═══╝`},void 0,!1,void 0,this)},void 0,!1,void 0,this),
|
|
95
|
-
`;if(
|
|
96
|
-
`,
|
|
97
|
-
`;if(
|
|
98
|
-
`;return
|
|
99
|
-
`;for(let
|
|
100
|
-
`;return
|
|
101
|
-
使用 /help <命令名>
|
|
102
|
-
`);if(
|
|
103
|
-
`).trim();return{metadata:
|
|
104
|
-
`),shouldClearInput:!0}}},
|
|
105
|
-
${
|
|
170
|
+
╚══════╝╚══════╝╚═╝ ╚═══╝`},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(N,{flexDirection:"column",justifyContent:"center",flexGrow:1,children:[T.jsxDEV(N,{marginBottom:1,children:w?T.jsxDEV(O,{color:"green",bold:!0,children:[" ","[ SYSTEM ONLINE ]"]},void 0,!0,void 0,this):T.jsxDEV(O,{color:"red",bold:!0,children:[" ","[ CONFIG REQUIRED ]"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(N,{flexDirection:"column",gap:0,children:[T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"blue",children:"USER::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:Z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"blue",children:"ARCH::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:process.arch},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"blue",children:"PLATFORM::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"blue",children:"NODE::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:process.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"blue",children:"TERM::"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"blue",children:[G?.toUpperCase(),"::"]},void 0,!0,void 0,this),T.jsxDEV(O,{color:A?"white":"red",children:A?X.model_id:"无可用模型"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{marginTop:1,paddingX:1,flexDirection:"column",gap:0,children:[T.jsxDEV(N,{children:T.jsxDEV(O,{color:"blue",children:"WORKING_DIR ::"},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(N,{children:T.jsxDEV(O,{color:"gray",children:H},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!w&&T.jsxDEV(N,{marginTop:1,paddingX:1,flexDirection:"column",gap:0,children:[T.jsxDEV(O,{color:"red",bold:!0,children:["⚠️ 需要配置 ",G==="anthropic"?"Anthropic":"OpenAI"," API:"]},void 0,!0,void 0,this),!M&&T.jsxDEV(O,{color:"yellow",children:" • 请使用 /m 进入模型配置面板"},void 0,!1,void 0,this),!A&&T.jsxDEV(O,{color:"yellow",children:" • 请确保网络连接正常以获取模型列表"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"gray",children:" • 配置后使用 /m 查看可用模型"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{marginTop:1,paddingTop:1,borderTop:!1,flexDirection:"row",justifyContent:"space-between",children:[T.jsxDEV(N,{gap:3,children:[T.jsxDEV(N,{children:[T.jsxDEV(O,{color:"green",children:"●"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",dimColor:!0,children:[" ","AGENTS"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[T.jsxDEV(O,{color:K>0?"green":"gray",children:"●"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"white",dimColor:!0,children:[" ","MCP (",K,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(N,{children:[w?T.jsxDEV(O,{color:"yellow",bold:!0,children:">>> WAITING_FOR_INPUT"},void 0,!1,void 0,this):T.jsxDEV(O,{color:"red",bold:!0,children:">>> CONFIGURATION_NEEDED"},void 0,!1,void 0,this),T.jsxDEV(O,{color:"yellow",dimColor:!0,children:[" ","▌"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},P1=HW;var x0=L(x(),1);var g4=L(x(),1);class C1{commands=new Map;aliases=new Map;register(Z){if(this.commands.set(Z.name,Z),Z.aliases)Z.aliases.forEach((Y)=>{this.aliases.set(Y,Z.name)})}getCommand(Z){let Y=this.aliases.get(Z)||Z;return this.commands.get(Y)}getAllCommands(){return Array.from(this.commands.values())}isCommand(Z){return Z.trim().startsWith("/")}parseCommand(Z){if(!this.isCommand(Z))return null;let X=Z.trim().slice(1).split(/\s+/),J=X[0],Q=X.slice(1);return{command:J,args:Q}}async executeCommand(Z,Y){let X=this.parseCommand(Z);if(!X)return{success:!1,message:"无效的命令格式"};let{command:J,args:Q}=X,$=this.getCommand(J);if(!$)return{success:!1,message:`未知命令: /${J}`};if($.requiresArgs&&Q.length===0)return{success:!1,message:`命令 /${J} 需要参数。用法: ${$.usage||`/${J} <args>`}`};if($.validateArgs&&!$.validateArgs(Q))return{success:!1,message:`命令 /${J} 参数无效。用法: ${$.usage||`/${J} <args>`}`};try{return await $.execute(Q,Y)}catch(K){return{success:!1,message:`命令执行失败: ${K instanceof Error?K.message:String(K)}`}}}getSuggestions(Z){if(!Z.startsWith("/"))return[];let Y=Z.slice(1).toLowerCase(),X=[];if(Y===""){let U=["new","history","task","agent","model","settings","mcp","knowledge","summarize","template","plan","interview","help"];for(let W of U){let z=this.commands.get(W);if(z)X.push({command:W,displayText:`/${W}`,description:z.description})}return X.slice(0,10)}let J=new Set(["history","knowledge","help","init","model","config"]),Q=[],$=[];for(let[U,W]of this.commands){let z=U.toLowerCase();if(z.startsWith(Y))Q.push({command:U,displayText:`/${U}`,description:W.description});else if(z.includes(Y))$.push({command:U,displayText:`/${U}`,description:W.description});if(W.aliases)for(let H of W.aliases){let G=H.toLowerCase();if(G.startsWith(Y))Q.push({command:U,displayText:`/${H}`,description:`${W.description} (别名)`});else if(G.includes(Y))$.push({command:U,displayText:`/${H}`,description:`${W.description} (别名)`})}}let K=(U,W)=>{let z=J.has(U.command)?1:0,H=J.has(W.command)?1:0;if(z!==H)return H-z;return U.displayText.length-W.displayText.length};return Q.sort(K),$.sort(K),X.push(...Q,...$),X.slice(0,10)}getHelp(Z){if(Z){let X=this.getCommand(Z);if(!X)return`未找到命令: /${Z}`;let J=`命令: /${X.name}
|
|
171
|
+
`;if(J+=`描述: ${X.description}
|
|
172
|
+
`,X.usage)J+=`用法: ${X.usage}
|
|
173
|
+
`;if(X.aliases&&X.aliases.length>0)J+=`别名: ${X.aliases.map((Q)=>`/${Q}`).join(", ")}
|
|
174
|
+
`;return J}let Y=`可用命令:
|
|
175
|
+
`;for(let X of this.getAllCommands())Y+=` /${X.name} - ${X.description}
|
|
176
|
+
`;return Y+=`
|
|
177
|
+
使用 /help <命令名> 获取具体命令的帮助信息`,Y}}var CY=new C1;var R1={name:"settings",description:"打开 Settings 面板(Model 和 Provider 配置)",aliases:["s","model","settings","m"],usage:"/settings",execute:async(Z,Y)=>{return Y.switchToSettings?.(),{success:!0,message:"打开 Settings 面板",shouldClearInput:!0}}};var GW={name:"new",description:"初始化新的对话会话",aliases:["new","n"],usage:"/new [主题]",execute:async(Z,Y)=>{let X=Z.join(" ");if(await Y.createNewChat(),X){let J=`我想开始一个关于 "${X}" 的新对话。`;return Y.sendMessage([{type:"human",content:J}]),{success:!0,message:`已创建新对话,主题: ${X}`,shouldClearInput:!0}}return{success:!0,message:"已创建新对话",shouldClearInput:!0}}},OW={name:"help",description:"显示命令帮助信息",aliases:["h","?"],usage:"/help [命令名]",execute:async(Z,Y)=>{let X=Z[0];return{success:!0,message:CY.getHelp(X),shouldClearInput:!0}}},qW={name:"task",description:"打开任务看板面板",aliases:["tasks","kanban"],usage:"/task",execute:async(Z,Y)=>{return Y.switchToTask?.(),{success:!0,message:"打开任务看板",shouldClearInput:!0}}},v1=[GW,OW,qW,R1];import{readFileSync as FW,readdirSync as MW}from"fs";import{join as I1}from"path";var x4=null;function NW(Z){let Y=Z.split(`
|
|
178
|
+
`);if(Y[0]!=="---")return{metadata:{},content:Z};let X=Y.indexOf("---",1);if(X===-1)return{metadata:{},content:Z};let J=Y.slice(1,X),Q={};for(let K of J){let U=K.match(/^(\w+):\s*(.+)$/);if(U){let[,W,z]=U;if(W==="name")Q.name=z.trim();if(W==="description")Q.description=z.trim()}}let $=Y.slice(X+1).join(`
|
|
179
|
+
`).trim();return{metadata:Q,content:$}}function D1(Z,Y){let X=new Map;try{let J=MW(Z,{withFileTypes:!0});for(let Q of J){let $=I1(Z,Q.name);if(Q.isDirectory())D1($,Y).forEach((U)=>X.set(U.name,U));else if(Q.name.endsWith(".md"))try{let K=FW($,"utf-8"),{metadata:U,content:W}=NW(K),z=U.name||Q.name.replace(/\.md$/,"");if(!U.name)console.warn(`Template missing "name" in frontmatter: ${$}`);X.set(z,{name:z,description:U.description||"No description",content:W,path:$})}catch(K){console.warn(`Failed to read template file: ${$}`,K)}}}catch(J){if(J.code!=="ENOENT")console.warn(`Error scanning templates directory: ${Z}`,J)}return X}function V1(){x4=null}function E1(Z="./.claude/templates"){if(x4)return Array.from(x4.values());let Y=Z.startsWith("/")?Z:I1(process.cwd(),Z);return x4=D1(Y,Y),Array.from(x4.values())}var AW={name:"status",description:"显示当前聊天状态信息",aliases:["stat","info"],execute:async(Z,Y)=>{return{success:!0,message:[`当前代理: ${Y.client?.availableAssistants.find((Q)=>Q.graph_id===Y.currentAgent)?.name||"未选择"} (${Y.currentAgent||"N/A"})`,`聊天ID: ${Y.client?.currentChatId?.slice(-8)||"N/A"}`,`可用代理数: ${Y.client?.availableAssistants?.length||0}`,`模型: ${Y.extraParams?.model_id||"N/A"}`].join(`
|
|
180
|
+
`),shouldClearInput:!0}}},_W={name:"template",description:"插入预定义的消息模板",aliases:["tpl","t"],usage:"/template <模板名>",execute:async(Z,Y)=>{let X=Z[0];if(Z.includes("--refresh"))return V1(),{success:!0,message:"模板缓存已清除",shouldClearInput:!0};let J=E1();if(!X){if(J.length===0)return{success:!0,message:"当前没有可用的模板。可以在 ./.claude/templates/ 目录下创建 .md 模板文件。",shouldClearInput:!0};return{success:!0,message:`可用模板:
|
|
181
|
+
${J.map((K)=>` - ${K.name}: ${K.description}`).join(`
|
|
106
182
|
`)}
|
|
107
183
|
|
|
108
|
-
使用 /template <name> 插入模板`,shouldClearInput:!0}}let J
|
|
109
|
-
${
|
|
110
|
-
`),shouldClearInput:!0};let
|
|
111
|
-
可用配置项: ${
|
|
112
|
-
|
|
113
|
-
提示: 更换模型或提供商后,请重启程序以确保完整生效`;return{success:!0,message
|
|
114
|
-
`),shouldClearInput:!0};let
|
|
115
|
-
${
|
|
116
|
-
`)}`,shouldClearInput:!0}}case"add":{if(Z.length<2)return{success:!1,message:"用法: /mcp add <name> <json_string>",shouldClearInput:!0};let[
|
|
117
|
-
重启程序生效`,shouldClearInput:!0}}case"get":{if(Z.length<2)return{success:!1,message:"用法: /mcp get <name>",shouldClearInput:!0};let
|
|
118
|
-
`),shouldClearInput:!0}}default:return{success:!1,message:`未知操作: ${
|
|
119
|
-
可用操作: list, add, remove, get`,shouldClearInput:!0}}}catch(
|
|
184
|
+
使用 /template <name> 插入模板`,shouldClearInput:!0}}let Q=J.find(($)=>$.name===X);if(!Q){let $=J.map((K)=>K.name).join(", ");return{success:!1,message:`未找到模板 "${X}"。可用模板: ${$||"(无)"}`}}return Y.setUserInput(Q.content),{success:!0,message:`已插入模板: ${Q.name}
|
|
185
|
+
${Q.description}`,shouldClearInput:!1}}},wW={name:"config",description:"查看或设置配置项",aliases:["cfg"],usage:"/config [key] [value]",execute:async(Z,Y)=>{if(Z.length===0)return{success:!0,message:["当前配置:",` model_id: ${Y.extraParams?.model_id||"N/A"}`,` provider_id: ${Y.extraParams?.provider_id||"N/A"}`,` enable_thinking: ${Y.extraParams?.enable_thinking??!0}`,` compact_mode: ${Y.compactMode??!1}`,` stream_refresh_interval: ${Y.extraParams?.stream_refresh_interval}`,"","使用方法:"," /config <key> <value> - 设置配置项"," /config <key> - 查看配置项","","可用配置项:"," model_id - 当前使用的模型 ID"," provider_id - 当前使用的 Provider ID"," enable_thinking - 启用思考模式 (true, false)"," compact_mode - 紧凑模式 (true, false)"," stream_refresh_interval - 流刷新间隔"].join(`
|
|
186
|
+
`),shouldClearInput:!0};let X=Z[0],J=["enable_thinking","stream_refresh_interval","provider_id","model_id","compact_mode"];if(!J.includes(X))return{success:!1,message:`无效的配置项: ${X}
|
|
187
|
+
可用配置项: ${J.join(", ")}`,shouldClearInput:!0};if(Z.length===1){let $;switch(X){case"model_id":$=Y.extraParams?.model_id;break;case"provider_id":$=Y.extraParams?.provider_id;break;case"enable_thinking":$=Y.extraParams?.enable_thinking??!0;break;case"compact_mode":$=Y.compactMode??!1;break;case"stream_refresh_interval":$=Y.extraParams?.stream_refresh_interval;break}return{success:!0,message:`${X}: ${$??"未设置"}`,shouldClearInput:!0}}let Q=Z.slice(1).join(" ");if(X==="enable_thinking"||X==="compact_mode"){if(Q==="true"||Q==="1"||Q==="yes")Q=!0;else if(Q==="false"||Q==="0"||Q==="no")Q=!1}if(X==="stream_refresh_interval"){let $=parseInt(Q,10);if(!isNaN($))Q=$}try{if(!Y.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};await Y.updateConfig({[X]:Q});let $=`配置已更新: ${X} = ${Q} 重启程序生效`;if(X==="model_id"||X==="provider_id")$+=`
|
|
188
|
+
|
|
189
|
+
提示: 更换模型或提供商后,请重启程序以确保完整生效`;return{success:!0,message:$,shouldClearInput:!0}}catch($){return{success:!1,message:`配置更新失败: ${$ instanceof Error?$.message:String($)}`,shouldClearInput:!0}}}},BW={name:"mcp",description:"管理 MCP 服务器配置",aliases:[],usage:"/mcp [list|add|remove|get] [args]",execute:async(Z,Y)=>{if(Z.length===0)return{success:!0,message:["MCP 配置管理命令:","","用法:"," /mcp list - 列出所有 MCP 服务器"," /mcp add <name> <json_string> - 添加 MCP 服务器 (传统格式)"," /mcp remove <name> - 移除 MCP 服务器"," /mcp get <name> - 查看 MCP 服务器详情","","示例 (JSON 格式):",' /mcp add context7 {"name":"context7","url":"https://mcp.context7.com/mcp"}',""].join(`
|
|
190
|
+
`),shouldClearInput:!0};let X=Z[0];try{let Q=(Y.extraParams||{}).mcp_config||{};switch(X){case"list":{let $=Object.keys(Q);if($.length===0)return{success:!0,message:"当前未配置任何 MCP 服务器",shouldClearInput:!0};return{success:!0,message:`已配置的 MCP 服务器:
|
|
191
|
+
${$.map((U)=>{return` - ${U}`}).join(`
|
|
192
|
+
`)}`,shouldClearInput:!0}}case"add":{if(Z.length<2)return{success:!1,message:"用法: /mcp add <name> <json_string>",shouldClearInput:!0};let[$,K,...U]=Z,W=U.join(""),z={...Q,[K]:JSON.parse(W)};if(!Y.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};return await Y.updateConfig({mcp_config:z}),{success:!0,message:`MCP 服务器 "${K}" 已添加`,shouldClearInput:!0}}case"remove":{if(Z.length<2)return{success:!1,message:"用法: /mcp remove <name>",shouldClearInput:!0};let $=Z[1];if(!Q[$])return{success:!1,message:`MCP 服务器 "${$}" 不存在`,shouldClearInput:!0};let K={...Q};if(delete K[$],!Y.updateConfig)return{success:!1,message:"无法访问配置更新功能",shouldClearInput:!0};return await Y.updateConfig({mcp_config:K}),{success:!0,message:`MCP 服务器 "${$}" 已移除
|
|
193
|
+
重启程序生效`,shouldClearInput:!0}}case"get":{if(Z.length<2)return{success:!1,message:"用法: /mcp get <name>",shouldClearInput:!0};let $=Z[1],K=Q[$];if(!K)return{success:!1,message:`MCP 服务器 "${$}" 不存在`,shouldClearInput:!0};return{success:!0,message:[`MCP 服务器: ${$}`,` URL: ${K.url}`,` Headers: ${JSON.stringify(K.headers||{},null,2)}`].join(`
|
|
194
|
+
`),shouldClearInput:!0}}default:return{success:!1,message:`未知操作: ${X}
|
|
195
|
+
可用操作: list, add, remove, get`,shouldClearInput:!0}}}catch(J){return{success:!1,message:`MCP 操作失败: ${J instanceof Error?J.message:String(J)}`,shouldClearInput:!0}}}},LW={name:"summarize",description:"智能总结对话并提取有价值信息保存为记忆",aliases:["sum","summary","compact"],usage:"/sum",execute:async(Z,Y)=>{if(!Y.renderMessages||Y.renderMessages.length===0)return{success:!1,message:"当前会话没有消息可以总结",shouldClearInput:!0};let X=Y.renderMessages.length;try{let J={...Y.extraParams,switch_command:"smart_memory"};return await Y.sendMessage([],{extraParams:J}),{success:!0,message:`正在智能分析 ${X} 条消息并提取记忆...`,shouldClearInput:!0}}catch(J){return{success:!1,message:`总结失败: ${J instanceof Error?J.message:String(J)}`,shouldClearInput:!0}}}},PW={name:"history",description:"打开历史面板",aliases:["h"],execute:async(Z,Y)=>{if(Y.switchToHistory)return Y.switchToHistory(),{success:!0,message:"已打开历史面板",shouldClearInput:!0};return{success:!1,message:"面板切换功能不可用",shouldClearInput:!0}}},CW={name:"knowledge",description:"打开知识库面板",aliases:["k"],execute:async(Z,Y)=>{if(Y.switchToKnowledge)return Y.switchToKnowledge(),{success:!0,message:"已打开知识库面板",shouldClearInput:!0};return{success:!1,message:"面板切换功能不可用",shouldClearInput:!0}}},RW={name:"close",description:"关闭当前面板返回聊天",aliases:["c","q"],execute:async(Z,Y)=>{if(Y.closePanel)return Y.closePanel(),{success:!0,message:"已关闭面板",shouldClearInput:!0};return{success:!1,message:"面板关闭功能不可用",shouldClearInput:!0}}},vW={name:"model",description:"打开模型/Provider配置面板",aliases:["mp","m"],execute:async(Z,Y)=>{if(Y.switchToModelProvider)return Y.switchToModelProvider(),{success:!0,message:"已打开模型/Provider配置面板",shouldClearInput:!0};return{success:!1,message:"模型面板切换功能不可用",shouldClearInput:!0}}},IW={name:"ralph",description:"进入循环模式,持续发送响应直到返回 <COMPLETE></COMPLETE>",aliases:[],usage:"/ralph <text>",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ");if(!X.trim())return{success:!1,message:"请提供要循环的文本内容",shouldClearInput:!0};if(Y.startRalphLoop)return Y.startRalphLoop(X),{success:!0,message:`进入 Ralph 循环模式: "${X}"`,shouldClearInput:!0};return{success:!1,message:"Ralph 循环功能不可用",shouldClearInput:!0}}},b1=[AW,_W,wW,BW,LW,PW,CW,RW,vW,IW];var DW={name:"agent",description:"打开 Agent 选择面板",aliases:["a"],usage:"/agent",execute:async(Z,Y)=>{if(Y.switchToAgent)Y.switchToAgent();return{success:!0,message:"打开 Agent 面板",shouldClearInput:!0}}},T1=[DW];var VW=`
|
|
120
196
|
[Interview Mode Activated]
|
|
121
197
|
|
|
122
198
|
I want to clarify requirements through guided questions.
|
|
@@ -135,8 +211,8 @@ After getting answers:
|
|
|
135
211
|
---
|
|
136
212
|
|
|
137
213
|
User's original message:
|
|
138
|
-
`,
|
|
139
|
-
用法: /interview [your request]`};let
|
|
214
|
+
`,EW={name:"interview",description:"Start Interview mode to clarify requirements through questions",aliases:["i"],usage:"/interview [your request]",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ").trim();if(!X)return{success:!1,message:`❌ Interview 模式需要提供任务描述
|
|
215
|
+
用法: /interview [your request]`};let J=VW+X;return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCCB Interview mode activated",shouldClearInput:!0}}},f1=[EW];var bW=`
|
|
140
216
|
[Plan Mode Activated]
|
|
141
217
|
|
|
142
218
|
I want to create a comprehensive implementation plan for this task.
|
|
@@ -159,8 +235,8 @@ After the plan is created, ask if I want to execute it immediately or save for l
|
|
|
159
235
|
---
|
|
160
236
|
|
|
161
237
|
User's original request:
|
|
162
|
-
`,
|
|
163
|
-
用法: /plan [your task description]`};let
|
|
238
|
+
`,TW={name:"plan",description:"Enter Plan mode to create detailed implementation plans",aliases:["p"],usage:"/plan [your task description]",requiresArgs:!0,execute:async(Z,Y)=>{let X=Z.join(" ").trim();if(!X)return{success:!1,message:`❌ Plan 模式需要提供任务描述
|
|
239
|
+
用法: /plan [your task description]`};let J=bW+X;return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCCB Plan mode activated",shouldClearInput:!0}}},j1=[TW];var fW=`
|
|
164
240
|
[Create AGENTS.md Mode Activated]
|
|
165
241
|
|
|
166
242
|
I want to create or update the AGENTS.md file for this project.
|
|
@@ -192,7 +268,7 @@ After the AGENTS.md is created or updated, provide a summary of the changes made
|
|
|
192
268
|
---
|
|
193
269
|
|
|
194
270
|
User's request:
|
|
195
|
-
`,
|
|
271
|
+
`,jW={name:"create-agent-md",description:"Create or update AGENTS.md file with project guidelines",usage:"/create-agent-md [description or goal for AGENTS.md]",requiresArgs:!1,execute:async(Z,Y)=>{let X=Z.join(" ").trim()||"start to explore and create AGENTS.md",J=fW+X;return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83D\uDCDD AGENTS.md creation mode activated",shouldClearInput:!0}}},S1=[jW];var y1={name:"compact-message",description:"切换紧凑消息显示模式 (紧凑模式显示简化的消息预览)",aliases:["cm"],usage:"/compact-message",requiresArgs:!1,execute:async(Z,Y)=>{try{let{updateConfig:X,compactMode:J}=Y;if(!X)return{success:!1,message:"配置更新功能不可用"};let Q=J??!1;return await X({compact_mode:!Q}),{success:!0,message:!Q?"紧凑模式已启用":"紧凑模式已关闭",shouldClearInput:!0}}catch(X){return{success:!1,message:`切换紧凑模式失败: ${X instanceof Error?X.message:String(X)}`}}}};var k1={name:"mcp",description:"打开 MCP 服务器配置面板",aliases:[],usage:"/mcp",execute:async(Z,Y)=>{return Y.switchToMcp?.(),{success:!0,message:"打开 MCP 配置面板",shouldClearInput:!0}}};var h1={name:"settings",description:"打开通用设置面板",aliases:["set"],usage:"/settings",execute:async(Z,Y)=>{if(Y.switchToSettings)return Y.switchToSettings(),{success:!0,message:"打开通用设置面板",shouldClearInput:!0};return{success:!1,message:"Settings 面板不可用",shouldClearInput:!0}}};var SW=`
|
|
196
272
|
[Memory Organization Mode Activated]
|
|
197
273
|
|
|
198
274
|
I want to organize and manage the .claude/memories folder.
|
|
@@ -246,26 +322,26 @@ Provide a detailed report of:
|
|
|
246
322
|
|
|
247
323
|
---
|
|
248
324
|
|
|
249
|
-
`,
|
|
325
|
+
`,yW={name:"memory-clear",description:"整理 .claude/memories 文件夹,清理、合并和优化项目记忆",aliases:["mem-clean","clean-memory"],usage:"/memory-clear",execute:async(Z,Y)=>{let X=Z.join(" ").trim(),J=SW+(X?`Additional context: ${X}
|
|
250
326
|
|
|
251
|
-
---`:"开始整理记忆文件夹。");return
|
|
252
|
-
`+"当前内存使用: "+
|
|
253
|
-
`)}var
|
|
254
|
-
`;if(
|
|
327
|
+
---`:"开始整理记忆文件夹。");return Y.sendMessage([{type:"human",content:J}],{extraParams:Y.extraParams}),{success:!0,message:"\uD83E\uDDE0 记忆整理模式已激活 - 正在分析 .claude/memories 文件夹...",shouldClearInput:!0}}},x1=[yW];function YY(Z){if(Z===0)return"0 B";let Y=1024,X=["B","KB","MB","GB"],J=Math.floor(Math.log(Z)/Math.log(Y));return parseFloat((Z/Math.pow(Y,J)).toFixed(2))+" "+X[J]}function o8(){let Z=process.memoryUsage();return{heapTotal:Z.heapTotal,heapUsed:Z.heapUsed,external:Z.external,rss:Z.rss,heapUsedMB:(Z.heapUsed/1024/1024).toFixed(2),heapTotalMB:(Z.heapTotal/1024/1024).toFixed(2)}}function g1(){return typeof Bun<"u"}function kW(){let Z=o8();if(g1()&&typeof Bun.gc==="function"){Bun.gc(!0);let Y=o8(),X=Z.heapUsed-Y.heapUsed;return{success:!0,before:Z,after:Y,freed:X,message:`GC 执行成功,释放了 ${YY(Math.max(0,X))} 内存`}}if(globalThis.global&&typeof globalThis.global.gc==="function"){globalThis.global.gc();let Y=o8(),X=Z.heapUsed-Y.heapUsed;return{success:!0,before:Z,after:Y,freed:X,message:`GC 执行成功,释放了 ${YY(Math.max(0,X))} 内存`}}return{success:!1,before:Z,message:`/gc 命令仅在 Bun 或者 node --expose-gc 可用
|
|
328
|
+
`+"当前内存使用: "+YY(Z.heapUsed)+" / "+YY(Z.heapTotal)}}function hW(){let Z=[];if(!g1())Z.push("/gc 命令仅支持 Bun 运行时,请使用 bun 启动应用");else Z.push("当前运行在 Bun 环境,/gc 命令已就绪");return Z.join(`
|
|
329
|
+
`)}var u1={name:"gc",description:"手动触发垃圾回收,减少内存占用",aliases:["garbage-collect","mem-opt","memory"],usage:"/gc",execute:async(Z,Y)=>{let X=Z.includes("-v")||Z.includes("--verbose"),J=kW(),Q=`\uD83D\uDDD1️ ${J.message}
|
|
330
|
+
`;if(J.before&&J.after){if(Q+=`
|
|
255
331
|
\uD83D\uDCCA 内存统计:
|
|
256
|
-
`,
|
|
257
|
-
`,
|
|
258
|
-
`,
|
|
259
|
-
`}else if(
|
|
260
|
-
\uD83D\uDCCA 当前内存使用: ${
|
|
261
|
-
`;if(!
|
|
332
|
+
`,Q+=` Before: ${YY(J.before.heapUsed)} / ${YY(J.before.heapTotal)}
|
|
333
|
+
`,Q+=` After: ${YY(J.after.heapUsed)} / ${YY(J.after.heapTotal)}
|
|
334
|
+
`,J.freed!==void 0&&J.freed>0)Q+=` Freed: ${YY(J.freed)}
|
|
335
|
+
`}else if(J.before)Q+=`
|
|
336
|
+
\uD83D\uDCCA 当前内存使用: ${YY(J.before.heapUsed)} / ${YY(J.before.heapTotal)}
|
|
337
|
+
`;if(!J.success||X)Q+=`
|
|
262
338
|
\uD83D\uDCA1 提示:
|
|
263
|
-
`,
|
|
339
|
+
`,Q+=` ${hW().replace(/\n/g,`
|
|
264
340
|
`)}
|
|
265
|
-
`;return{success:
|
|
341
|
+
`;return{success:J.success,message:Q,shouldClearInput:!0}}};[...v1,...b1,...T1,...f1,...j1,...S1,...x1,y1,k1,h1,u1].forEach((Z)=>{CY.register(Z)});var RY=L(v(),1),m1=(Z)=>{let{onCommandExecuted:Y,switchToHistory:X,switchToKnowledge:J,switchToSettings:Q,switchToAgent:$,closePanel:K,switchToTask:U,switchToModelProvider:W,switchToMcp:z}=Z,{userInput:H,setUserInput:G,sendMessage:F,currentAgent:M,client:A,createNewChat:w,renderMessages:P}=KZ(),{extraParams:B,updateConfig:R,AVAILABLE_MODELS:C,compactMode:D}=WZ(),[j,E]=g4.useState(null),[d,i]=g4.useState(null);oZ(()=>{E(null)},j?3000:null),oZ(()=>{i(null)},d?5000:null);let g=H.startsWith("/"),r=g?CY.getSuggestions(H):[],o=g,FY=g4.useCallback(async(VY)=>{let M4=VY||H;if(!CY.isCommand(M4))return!1;try{let N4={userInput:M4,setUserInput:G,sendMessage(u0,QX={}){return F(u0,{extraParams:{...B,...QX.extraParams},...QX,metadata:WY})},currentAgent:M,client:A,extraParams:B,createNewChat(){return w(WY)},updateConfig:R,AVAILABLE_MODELS:C,renderMessages:P,compactMode:D,switchToHistory:X,switchToKnowledge:J,switchToSettings:Q,switchToModelProvider:W,switchToAgent:$,switchToTask:U,switchToMcp:z,closePanel:K,startRalphLoop:Z.startRalphLoop},EY=await CY.executeCommand(M4,N4);if(!EY.success)E(EY.message||"命令执行失败");else if(EY.message)i(EY.message);if(EY.shouldClearInput)G("");if(EY.shouldSendMessage&&EY.messageContent){let u0=[{type:"human",content:EY.messageContent}];F(u0,{extraParams:B})}return Y?.(),!0}catch(N4){return E(`命令执行错误: ${N4 instanceof Error?N4.message:String(N4)}`),!0}},[H,G,F,M,A,B,w,Y,C,D,X,J,Q,W,$,U,z,K,Z.startRalphLoop]);return{isCommandInput:g,commandSuggestions:r,showCommandHint:o,commandError:j,executeCommand:FY,CommandHintUI:()=>{if(!o||r.length===0)return null;return RY.jsxDEV(N,{marginBottom:1,flexDirection:"column",children:[RY.jsxDEV(O,{color:"yellow",bold:!0,children:"命令建议:"},void 0,!1,void 0,this),r.slice(0,5).map((VY,M4)=>RY.jsxDEV(O,{color:"cyan",children:[VY.displayText," - ",VY.description]},M4,!0,void 0,this)),r.length>5&&RY.jsxDEV(O,{color:"gray",children:["...还有 ",r.length-5," 个命令"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},CommandErrorUI:()=>{if(!j)return null;return RY.jsxDEV(N,{marginBottom:1,children:RY.jsxDEV(O,{color:"red",children:["❌ ",j]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},CommandSuccessUI:()=>{if(!d)return null;return RY.jsxDEV(N,{marginBottom:1,children:RY.jsxDEV(O,{color:"green",children:["✅ ",d]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}}};function p1({manager:Z,enabled:Y=!0}){return y0({queryKey:k0.skills.list(),queryFn:async()=>{if(!Z)throw Error("ConfigManager not initialized");return await Z.listSkills()},enabled:Y&&!!Z,staleTime:120000})}var xW=[{id:"agents/default",name:"Jarvis",description:"代码实现助手"},{id:"agents/manager",name:"Manager",description:"任务管理员"}];function d1({enabled:Z=!0}={}){return y0({queryKey:k0.agents.list(),queryFn:async()=>{return xW},enabled:Z,staleTime:300000})}var XY=L(x(),1);function c1({loading:Z,renderMessages:Y,sendMessage:X,setUserInput:J,extraParams:Q}){let[$,K]=XY.useState(null),[U,W]=XY.useState(!1),z=XY.useRef(!1),H=XY.useRef(0),G=XY.useCallback(async(M)=>{if(!M)return;let A=z.current?`
|
|
266
342
|
|
|
267
|
-
[System Context: You are currently in Ralph loop mode. Continue executing the task based on previous context. Respond with <COMPLETE></COMPLETE> tag when the task is complete.]`:"",
|
|
268
|
-
`||
|
|
269
|
-
`||Y==="\t"}function x4(Z,$){let Y=$+1;while(Y<Z.length&&!/[\s\n\t]/.test(Z[Y]))Y++;return Z.slice($+1,Y)}function d4(Z,$,Y){let X=$.toLowerCase(),J=Z.filter((Q)=>{let W=Q.name.toLowerCase(),O=Q.id.toLowerCase();return W.startsWith(X)||O.includes(X)});return J.sort((Q,W)=>Q.name.localeCompare(W.name)),J.slice(0,Y)}function S2({agents:Z,maxSuggestions:$=5}){let[Y,X]=U1.useState({visible:!1,query:"",filteredAgents:[],triggerPosition:-1}),J=U1.useCallback((G,F)=>{let U=G.lastIndexOf("@");if(U===-1){X((w)=>({...w,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}if(!c4(G,U)){X((w)=>({...w,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}let L=x4(G,U),A=d4(Z,L,$);if(A.length===1&&A[0].name.toLowerCase()===L.toLowerCase()){X((w)=>({...w,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}X((w)=>({...w,visible:!0,query:L,filteredAgents:A,triggerPosition:U}))},[Z.length,$]),Q=U1.useCallback(()=>{if(!Y.visible||Y.filteredAgents.length===0)return null;return Y.filteredAgents[0]??null},[Y.visible,Y.filteredAgents]),W=U1.useCallback((G)=>{let F=Q();if(!F)return G;let U=G.slice(0,Y.triggerPosition),L=G.slice(Y.triggerPosition+1+Y.query.length);return`${U}@${F.name} ${L}`},[Q,Y.triggerPosition,Y.query]),O=U1.useCallback(()=>{X((G)=>({...G,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}))},[]),N=Y.visible&&Y.filteredAgents.length>0;return{state:Y,checkTrigger:J,getFirstAgent:Q,complete:W,hide:O,isActive:N}}var f2=H(T(),1);var LZ=H(M(),1);function l4({name:Z,result:$}){if(!$)return LZ.jsxDEV(K,{color:"cyan",children:Z},void 0,!1,void 0,this);let Y=$.highlight((X)=>LZ.jsxDEV(K,{color:"green",bold:!0,children:X},void 0,!1,void 0,this));if(Array.isArray(Y))return LZ.jsxDEV(K,{color:"cyan",children:Y.map((X,J)=>{if(typeof X==="string")return LZ.jsxDEV(K,{children:X},`p-${J}`,!1,void 0,this);return LZ.jsxDEV(f2.default.Fragment,{children:X},`m-${J}`,!1,void 0,this)})},void 0,!1,void 0,this);return LZ.jsxDEV(K,{color:"cyan",children:Z},void 0,!1,void 0,this)}var k2=({visible:Z,skills:$,query:Y,maxVisible:X=5})=>{if(!Z||$.length===0)return null;let J=$.slice(0,X);return LZ.jsxDEV(_,{marginBottom:1,flexDirection:"column",children:[LZ.jsxDEV(K,{color:"yellow",bold:!0,children:"技能建议 (按 → 补全):"},void 0,!1,void 0,this),J.map(({skill:Q,result:W})=>LZ.jsxDEV(_,{children:[LZ.jsxDEV(K,{children:" #"},void 0,!1,void 0,this),LZ.jsxDEV(l4,{name:Q.name,result:W},void 0,!1,void 0,this)]},Q.name,!0,void 0,this)),$.length>X&&LZ.jsxDEV(K,{color:"gray",children:["...还有 ",$.length-X," 个技能"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var _Z=H(M(),1);function i4({name:Z,query:$}){if(!$)return _Z.jsxDEV(K,{color:"magenta",children:Z},void 0,!1,void 0,this);let Y=Z.toLowerCase(),X=$.toLowerCase();if(Y.startsWith(X))return _Z.jsxDEV(_Z.Fragment,{children:[_Z.jsxDEV(K,{color:"green",bold:!0,children:Z.slice(0,$.length)},void 0,!1,void 0,this),_Z.jsxDEV(K,{color:"magenta",children:Z.slice($.length)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return _Z.jsxDEV(K,{color:"magenta",children:Z},void 0,!1,void 0,this)}var T2=({visible:Z,agents:$,query:Y,maxVisible:X=5})=>{if(!Z||$.length===0)return null;let J=$.slice(0,X);return _Z.jsxDEV(_,{marginBottom:1,flexDirection:"column",children:[_Z.jsxDEV(K,{color:"yellow",bold:!0,children:"Agent 建议 (按 → 补全):"},void 0,!1,void 0,this),J.map((Q)=>_Z.jsxDEV(_,{children:[_Z.jsxDEV(K,{children:" @"},void 0,!1,void 0,this),_Z.jsxDEV(i4,{name:Q.name,query:Y},void 0,!1,void 0,this),_Z.jsxDEV(K,{dimColor:!0,children:[" - ",Q.description]},void 0,!0,void 0,this)]},Q.id,!0,void 0,this)),$.length>X&&_Z.jsxDEV(K,{color:"gray",children:["...还有 ",$.length-X," 个 Agent"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var D2=H(T(),1);function h2(){let{extraParams:Z}=n(),{sendMessage:$,loading:Y}=o(),{bufferedMessage:X,clearBuffer:J}=ZY(),Q=y2();D2.useEffect(()=>{if(!Y&&X.trim()){let W=[{type:"human",content:X}];J(),$(W,{extraParams:Z}).then(()=>{dZ("Zen Code 完成任务")}).catch((O)=>{console.error("Failed to send buffered message:",O)})}},[Y,X,$,Z,J,Q])}var sZ=H(M(),1),j2=({value:Z,onChange:$,onSubmit:Y,loading:X,placeholder:J="输入消息...",commandHandler:Q,skills:W=[],agents:O=[]})=>{h2();let{bufferedMessage:N,setBufferedMessage:G,clearBuffer:F}=ZY(),[U,L]=QZ.useState(Z),A=QZ.useRef(!1),w=I2({skills:W,maxSuggestions:5}),q=S2({agents:O,maxSuggestions:5});QZ.useEffect(()=>{if(Z!==U)A.current=!0,L(Z)},[Z]);let R=QZ.useMemo(()=>U.startsWith("/"),[U]);QZ.useEffect(()=>{if(!R)w.checkTrigger(U),q.checkTrigger(U)},[U,R]);let b=QZ.useCallback((g)=>{if(A.current){A.current=!1;return}L(g),$(g)},[$]),D=QZ.useCallback((g)=>{if(!g.trim())return;if(w.hide(),q.hide(),R){Y(g),L("");return}if(X)G(g),L("");else Y(g),L("")},[R,X,Y,G,w,q]),$Z=QZ.useCallback(()=>{if(q.isActive){q.hide();return}if(w.isActive){w.hide();return}if(N)F();else L("")},[N,F,w.isActive,q.isActive]),m=QZ.useCallback(()=>{if(!R||!Q.commandSuggestions||Q.commandSuggestions.length===0)return!1;let y=Q.commandSuggestions[0],x=(y.displayText||y.command||"")+" ";return b(x),!0},[R,Q.commandSuggestions,b]),XZ=QZ.useCallback(()=>{if(!w.isActive)return!1;let g=w.complete(U);return b(g),w.hide(),!0},[w.isActive,U,b]),S=QZ.useCallback(()=>{if(!q.isActive)return!1;let g=q.complete(U);return b(g),q.hide(),!0},[q.isActive,U,b]),OZ=QZ.useMemo(()=>{if(X)return N?"按 Esc 清空缓冲区":"AI 响应中,Enter 将消息加入缓冲区";if(R)return"输入命令... (试试 /help,按 → 补全第一个建议)";if(q.isActive)return"按 → 补全 Agent";if(w.isActive)return"按 → 补全技能";return J},[X,N,R,q.isActive,w.isActive,J]);return sZ.jsxDEV(_,{flexDirection:"column",children:[N&&sZ.jsxDEV(_,{padding:1,children:sZ.jsxDEV(K,{color:"yellow",children:["\uD83D\uDCDD 缓冲区: ",N.slice(0,50),N.length>50?"...":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),sZ.jsxDEV(Q.CommandHintUI,{},void 0,!1,void 0,this),sZ.jsxDEV(T2,{visible:q.state.visible,agents:q.state.filteredAgents,query:q.state.query},void 0,!1,void 0,this),sZ.jsxDEV(k2,{visible:w.state.visible,skills:w.state.filteredSkills,query:w.state.query},void 0,!1,void 0,this),sZ.jsxDEV(_,{paddingY:1,children:sZ.jsxDEV(CZ,{id:"global-input",value:U,onChange:b,onSubmit:D,onHotKey:(g,y)=>{if(y.escape)return $Z(),!1;if(y.rightArrow){if(q.isActive){if(S())return!1}if(w.isActive){if(XZ())return!1}if(m())return!1}return!0},placeholder:OZ},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};var E1=H(M(),1),vY=YY.memo(()=>{let{userInput:Z,setUserInput:$,loading:Y,renderMessages:X,sendMessage:J}=o(),{extraParams:Q,manager:W}=n(),{switchToHistory:O,switchToKnowledge:N,switchToSettings:G,switchToModelProvider:F,switchToAgent:U,switchToTask:L,switchToMcp:A,closePanel:w}=M1(),{data:q=[]}=b2({manager:W}),{data:R=[]}=v2(),{startRalphLoop:b}=C2({loading:Y,renderMessages:X,sendMessage:J,setUserInput:$,extraParams:Q}),D=B2({extraParams:Q,switchToHistory:O,switchToKnowledge:N,switchToSettings:G,switchToModelProvider:F,switchToAgent:U,switchToTask:L,switchToMcp:A,closePanel:w,startRalphLoop:b}),$Z=YY.useCallback(async(m)=>{if(!m)return;if(m.startsWith("/")){if(await D.executeCommand(m)){$("");return}}await J([{type:"human",content:m}],{extraParams:Q,metadata:EZ}),dZ("Zen Code 完成任务")},[D,$]);return E1.jsxDEV(_,{flexDirection:"column",paddingX:0,paddingY:0,borderColor:"grey",borderTop:!0,borderStyle:"single",borderLeft:!1,borderBottom:!1,borderRight:!1,children:[E1.jsxDEV(D.CommandErrorUI,{},void 0,!1,void 0,this),E1.jsxDEV(D.CommandSuccessUI,{},void 0,!1,void 0,this),E1.jsxDEV(j2,{value:Z,onChange:$,onSubmit:$Z,loading:Y,commandHandler:{isCommandInput:D.isCommandInput,CommandHintUI:D.CommandHintUI,commandSuggestions:D.commandSuggestions},skills:q,agents:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});vY.displayName="ChatInput";var wZ=H(M(),1),o4=()=>{let{renderMessages:Z,currentChatId:$,getToolUIRender:Y,loading:X}=o(),{compactMode:J}=n(),[Q]=E2(Z,100),W=$Y.useMemo(()=>{return`${$}-${Q.length}`},[$,Q.length]),O=$Y.useCallback((N)=>Y(N),[Y]);return wZ.jsxDEV(_,{flexDirection:"column",flexGrow:1,paddingX:0,paddingY:0,children:[Q.length===0&&wZ.jsxDEV(J2,{},void 0,!1,void 0,this),Q.length?J?wZ.jsxDEV(PY,{renderMessages:Q,startIndex:0,staticKey:W,getToolUIRender:O,loading:X},W,!1,void 0,this):wZ.jsxDEV(t0,{renderMessages:Q,startIndex:0,staticKey:W},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},CY=()=>{let{hasPendingInteractions:Z}=MZ();return wZ.jsxDEV(V2,{children:wZ.jsxDEV(_,{flexDirection:"column",flexGrow:1,children:[wZ.jsxDEV(E,{name:"ChatMessages",fallback:null,children:wZ.jsxDEV(o4,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),wZ.jsxDEV(E,{name:"InteractionArea",fallback:null,children:Z?wZ.jsxDEV(_,{paddingX:0,paddingY:0,children:wZ.jsxDEV(qY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this):wZ.jsxDEV(vY,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)};CY.displayName="ChatMain";var uZ=H(T(),1);var X1=H(T(),1),g2=X1.lazy(()=>import("./chunk-3znrwnd8.js").then((Z)=>({default:Z.default}))),p2=X1.lazy(()=>import("./chunk-mg8zpgaz.js").then((Z)=>({default:Z.default}))),m2=X1.lazy(()=>import("./chunk-4b8yaknt.js").then((Z)=>({default:Z.default}))),u2=X1.lazy(()=>import("./chunk-k67epfhc.js").then((Z)=>({default:Z.default}))),c2=X1.lazy(()=>import("./chunk-rdc9pxf6.js").then((Z)=>({default:Z.default}))),x2=X1.lazy(()=>import("./chunk-e0sqjq2h.js").then((Z)=>({default:Z.default}))),d2=X1.lazy(()=>import("./chunk-6ty22kkt.js").then((Z)=>({default:Z.default})));var k=H(M(),1),F1=()=>k.jsxDEV(_,{paddingX:1,paddingY:1,children:k.jsxDEV(K,{color:"grey",children:"Loading..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),H1=(Z)=>k.jsxDEV(_,{paddingX:1,paddingY:1,children:[k.jsxDEV(K,{color:"red",children:["✗ ",Z," panel error"]},void 0,!0,void 0,this),k.jsxDEV(_,{marginTop:1,children:k.jsxDEV(K,{color:"gray",children:"Try reopening or press ESC to return"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),IY=uZ.memo(()=>{let{activeView:Z,closePanel:$,handleExecuteTask:Y}=M1();return k.jsxDEV(_,{flexGrow:1,flexDirection:"row",children:[Z==="history"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"HistoryPanel",fallback:H1("History"),children:k.jsxDEV(g2,{onClose:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="knowledge"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"KnowledgePanel",fallback:H1("Knowledge"),children:k.jsxDEV(p2,{onClose:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="settings"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"SettingsPanel",fallback:H1("Settings"),children:k.jsxDEV(m2,{onClose:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="model-provider"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"ModelProviderPanel",fallback:H1("Model Provider"),children:k.jsxDEV(u2,{onClose:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="agent"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"AgentPanel",fallback:H1("Agent"),children:k.jsxDEV(c2,{onClose:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="task"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"TaskPanel",fallback:H1("Task"),children:k.jsxDEV(x2,{onClose:$,onExecuteTask:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="mcp"&&k.jsxDEV(uZ.Suspense,{fallback:k.jsxDEV(F1,{},void 0,!1,void 0,this),children:k.jsxDEV(E,{name:"McpPanel",fallback:H1("MCP"),children:k.jsxDEV(d2,{onClose:$},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});IY.displayName="LazyChatViewManager";var kY=H(T(),1);var l2=H(T(),1);var XY=H(M(),1),i2=()=>{let{renderMessages:Z}=o(),$=l2.default.useMemo(()=>{if(!Z)return null;for(let Y=Z.length-1;Y>=0;Y--){let X=Z[Y];if(X.role==="assistant"&&X.content)try{let Q=(Array.isArray(X.content)?X.content:[{type:"text",text:X.content}]).find((W)=>W.type==="text")?.text||"";if(Q.includes("load_mcp_tools"))try{let W=JSON.parse(Q);if(W.status&&W.status.toolCount!==void 0)return W.status}catch(W){}}catch(J){}}return null},[Z]);if(!$||$.toolCount===0)return null;return XY.jsxDEV(_,{paddingX:1,children:[XY.jsxDEV(K,{color:"green",bold:!0,children:"MCP"},void 0,!1,void 0,this),XY.jsxDEV(K,{color:"cyan",children:[" ",$.toolCount]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var yZ=H(T(),1);function fY(Z){if(Z===0)return"0";if(Z<1024)return`${Z}`;if(Z<1048576)return`${(Z/1024).toFixed(0)}K`;if(Z<1073741824)return`${(Z/1048576).toFixed(0)}M`;return`${(Z/1073741824).toFixed(1)}G`}function o2(Z){let $=Math.floor(Z/1000),Y=Math.floor($/3600),X=Math.floor($%3600/60),J=$%60;if(Y>0)return`${Y}:${String(X).padStart(2,"0")}:${String(J).padStart(2,"0")}`;return`${String(X).padStart(2,"0")}:${String(J).padStart(2,"0")}`}function n2(Z){let[$,Y]=yZ.useState(0),X=yZ.useRef(null);return yZ.useEffect(()=>{if(Z)X.current=Date.now(),Y(0);else X.current=null,Y(0)},[Z]),SY(()=>{if(X.current)Y(Date.now()-X.current)},Z?1000:null),$}function r2(){let[Z,$]=yZ.useState({cpuPercent:0,memoryRSS:0,memoryHeapUsed:0,memoryHeapTotal:0}),Y=yZ.useRef(process.cpuUsage()),X=yZ.useRef(Date.now()),J=()=>{let Q=Date.now(),W=process.cpuUsage(),O=process.memoryUsage(),N=Q-X.current,G=W.user-Y.current.user,F=W.system-Y.current.system,L=(G+F)/1000/N*100;$({cpuPercent:Math.min(100,Math.max(0,L)),memoryRSS:O.rss,memoryHeapUsed:O.heapUsed,memoryHeapTotal:O.heapTotal}),Y.current=W,X.current=Q};return yZ.useEffect(()=>{J()},[]),SY(J,2000),Z}function s2(Z){if(Z<50)return"green";if(Z<80)return"yellow";return"red"}function a2(Z,$){if($===0)return"gray";let Y=Z/$*100;if(Y<50)return"green";if(Y<80)return"yellow";return"red"}var aZ=H(M(),1),n4=()=>{let Z=r2(),$=s2(Z.cpuPercent),Y=a2(Z.memoryHeapUsed,Z.memoryHeapTotal);return aZ.jsxDEV(_,{paddingX:1,width:"100%",children:aZ.jsxDEV(_,{gap:2,children:[aZ.jsxDEV(_,{children:[aZ.jsxDEV(K,{dimColor:!0,children:"CPU:"},void 0,!1,void 0,this),aZ.jsxDEV(K,{color:$,children:[" ",Z.cpuPercent.toFixed(0),"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),aZ.jsxDEV(_,{children:[aZ.jsxDEV(K,{dimColor:!0,children:"MEM:"},void 0,!1,void 0,this),aZ.jsxDEV(K,{color:Y,children:[fY(Z.memoryHeapUsed),"/",fY(Z.memoryRSS)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},t2=n4;var YZ=H(M(),1);import r4 from"path";var s4=()=>{let{extraParams:Z,compactMode:$,showDetailedInfo:Y}=n(),{currentChatId:X,renderMessages:J}=o(),{loading:Q,stopGeneration:W}=o(),O=process.env.YOLO_MODE==="true",N=kY.default.useCallback((A,w)=>{if(w.ctrl&&A==="c")if(Q)W();else process.exit()},[Q,W]);qZ(N);let G=n2(Q),F=kY.default.useMemo(()=>{return r4.basename(process.cwd())},[]),L=(J?.length||0)>100;return YZ.jsxDEV(_,{flexDirection:"column",width:"100%",children:[YZ.jsxDEV(_,{paddingX:1,paddingY:0,justifyContent:"space-between",width:"100%",marginBottom:1,children:[YZ.jsxDEV(_,{gap:1,children:[Q&&YZ.jsxDEV(K,{color:"yellow",bold:!0,children:YZ.jsxDEV(e2,{text:"LOADING"},void 0,!1,void 0,this)},void 0,!1,void 0,this),!Q&&YZ.jsxDEV(K,{color:"magenta",bold:!0,children:"Zen Code"},void 0,!1,void 0,this),YZ.jsxDEV(K,{color:"cyan",bold:!0,children:[" ",Z.model_id]},void 0,!0,void 0,this),YZ.jsxDEV(K,{color:"yellow",bold:!0,children:[" ","@",Z.switch_command||"default"]},void 0,!0,void 0,this),!$&&YZ.jsxDEV(K,{color:"blue",bold:!0,children:[" ","[FULL]"]},void 0,!0,void 0,this),O&&YZ.jsxDEV(K,{color:"red",bold:!0,children:[" ","YOLO"]},void 0,!0,void 0,this),YZ.jsxDEV(i2,{},void 0,!1,void 0,this),L&&YZ.jsxDEV(K,{color:"red",bold:!0,children:[" ","/summary"]},void 0,!0,void 0,this),YZ.jsxDEV(K,{color:"green",bold:!0,children:J.length},void 0,!1,void 0,this),YZ.jsxDEV(K,{color:"blue",children:F},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q&&YZ.jsxDEV(_,{children:YZ.jsxDEV(K,{color:"yellow",children:o2(G)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&YZ.jsxDEV(t2,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Z$=s4;var V=H(M(),1),a4=()=>{let{activeView:Z}=M1();return V.jsxDEV(_,{flexDirection:"column",width:"100%",children:[V.jsxDEV(_,{flexGrow:1,flexDirection:"row",children:[V.jsxDEV(E,{name:"ChatMain",fallback:V.jsxDEV(K,{color:"yellow",children:"Chat view unavailable"},void 0,!1,void 0,this),children:Z==="chat"?V.jsxDEV(CY,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this),V.jsxDEV(E,{name:"PanelView",fallback:V.jsxDEV(K,{color:"yellow",children:"Panel unavailable"},void 0,!1,void 0,this),children:Z!=="chat"?V.jsxDEV(IY,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),V.jsxDEV(E,{name:"StatusBar",fallback:null,children:V.jsxDEV(Z$,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},t4=()=>{return V.jsxDEV(E,{name:"Chat",children:V.jsxDEV(d0,{children:V.jsxDEV(a4,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},e4=()=>{return V.jsxDEV(E,{name:"AppRoot",children:V.jsxDEV(Y$,{apiUrl:"http://127.0.0.1:8123",defaultAgent:"code",defaultHeaders:{},withCredentials:!1,showHistory:!1,showGraph:!1,onInitError:(Z,$)=>{console.error(Z,$)},fetch:oY,autoRestoreLastSession:!0,historyFilter:{metadata:{path:process.cwd()}},children:V.jsxDEV(E,{name:"TanStackQueryProvider",children:V.jsxDEV(VY,{children:V.jsxDEV(E,{name:"SettingsProvider",children:V.jsxDEV(X$,{get_allowed_models:nY,children:V.jsxDEV(E,{name:"ApprovalProvider",children:V.jsxDEV($$,{children:V.jsxDEV(E,{name:"InteractionProvider",children:V.jsxDEV(m1,{children:V.jsxDEV(t4,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},ZX=()=>V.jsxDEV(e4,{},void 0,!1,void 0,this),TY=ZX;var DZ=H(M(),1),YX=({error:Z})=>DZ.jsxDEV(_,{flexDirection:"column",padding:2,borderStyle:"double",borderColor:"red",children:[DZ.jsxDEV(K,{color:"red",bold:!0,children:"✗ Application Crashed"},void 0,!1,void 0,this),DZ.jsxDEV(_,{marginTop:1,children:DZ.jsxDEV(K,{color:"red",children:Z.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),DZ.jsxDEV(_,{marginTop:1,children:DZ.jsxDEV(K,{color:"gray",children:["Stack: ",Z.stack?.split(`
|
|
343
|
+
[System Context: You are currently in Ralph loop mode. Continue executing the task based on previous context. Respond with <COMPLETE></COMPLETE> tag when the task is complete.]`:"",w=[{type:"human",content:M+A}];await X(w,{extraParams:Q,metadata:WY})},[X,Q]);oZ(()=>{if($)G($);W(!1)},U?100:null);let F=XY.useCallback((M)=>{K(M),z.current=!0,H.current=0,W(!0)},[]);return XY.useEffect(()=>{if(z.current&&$&&!Z){let M=Y.length;if(M>H.current){H.current=M;let A=Y[M-1],w=$4(A);if(typeof w==="string"&&w.includes("<COMPLETE></COMPLETE>"))z.current=!1,K(null),_Y("Ralph 循环完成");else G($)}}},[Z,Y,$,G]),{ralphLoopText:$,startRalphLoop:F,sendTextMessage:G}}var BZ=L(x(),1);var eY=L(x(),1);import n8 from"fuzzysort";function gW(Z,Y){if(Y===0)return!0;let X=Z[Y-1];return X===" "||X===`
|
|
344
|
+
`||X==="\t"}function uW(Z,Y){let X=Y+1;while(X<Z.length&&!/[\s\n\t]/.test(Z[X]))X++;return Z.slice(Y+1,X)}function mW(Z,Y,X){if(!Y)return Z.slice(0,X).map((K)=>({skill:K,result:null}));let J=Z.map((K)=>({skill:K,name:n8.prepare(K.name.toLowerCase()),description:n8.prepare((K.description||"").toLowerCase())}));return n8.go(Y.toLowerCase(),J,{key:"name",limit:X,threshold:-1e4}).map((K)=>({skill:K.obj.skill,result:K}))}function l1({skills:Z,maxSuggestions:Y=5}){let[X,J]=eY.useState({visible:!1,query:"",filteredSkills:[],triggerPosition:-1}),Q=eY.useCallback((z,H)=>{let G=z.lastIndexOf("#");if(G===-1){J((A)=>({...A,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}if(!gW(z,G)){J((A)=>({...A,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}let F=uW(z,G),M=mW(Z,F,Y);if(M.length===1&&M[0].skill.name.toLowerCase()===F.toLowerCase()){J((A)=>({...A,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}));return}J((A)=>({...A,visible:!0,query:F,filteredSkills:M,triggerPosition:G}))},[Z.length,Y]),$=eY.useCallback(()=>{if(!X.visible||X.filteredSkills.length===0)return null;return X.filteredSkills[0]?.skill??null},[X.visible,X.filteredSkills]),K=eY.useCallback((z)=>{let H=$();if(!H)return z;let G=z.slice(0,X.triggerPosition),F=z.slice(X.triggerPosition+1+X.query.length);return`${G}#${H.name} ${F}`},[$,X.triggerPosition,X.query]),U=eY.useCallback(()=>{J((z)=>({...z,visible:!1,query:"",filteredSkills:[],triggerPosition:-1}))},[]),W=X.visible&&X.filteredSkills.length>0;return{state:X,checkTrigger:Q,getFirstSkill:$,complete:K,hide:U,isActive:W}}var Z4=L(x(),1);function pW(Z,Y){if(Y===0)return!0;let X=Z[Y-1];return X===" "||X===`
|
|
345
|
+
`||X==="\t"}function dW(Z,Y){let X=Y+1;while(X<Z.length&&!/[\s\n\t]/.test(Z[X]))X++;return Z.slice(Y+1,X)}function cW(Z,Y,X){let J=Y.toLowerCase(),Q=Z.filter(($)=>{let K=$.name.toLowerCase(),U=$.id.toLowerCase();return K.startsWith(J)||U.includes(J)});return Q.sort(($,K)=>$.name.localeCompare(K.name)),Q.slice(0,X)}function i1({agents:Z,maxSuggestions:Y=5}){let[X,J]=Z4.useState({visible:!1,query:"",filteredAgents:[],triggerPosition:-1}),Q=Z4.useCallback((z,H)=>{let G=z.lastIndexOf("@");if(G===-1){J((A)=>({...A,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}if(!pW(z,G)){J((A)=>({...A,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}let F=dW(z,G),M=cW(Z,F,Y);if(M.length===1&&M[0].name.toLowerCase()===F.toLowerCase()){J((A)=>({...A,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}));return}J((A)=>({...A,visible:!0,query:F,filteredAgents:M,triggerPosition:G}))},[Z.length,Y]),$=Z4.useCallback(()=>{if(!X.visible||X.filteredAgents.length===0)return null;return X.filteredAgents[0]??null},[X.visible,X.filteredAgents]),K=Z4.useCallback((z)=>{let H=$();if(!H)return z;let G=z.slice(0,X.triggerPosition),F=z.slice(X.triggerPosition+1+X.query.length);return`${G}@${H.name} ${F}`},[$,X.triggerPosition,X.query]),U=Z4.useCallback(()=>{J((z)=>({...z,visible:!1,query:"",filteredAgents:[],triggerPosition:-1}))},[]),W=X.visible&&X.filteredAgents.length>0;return{state:X,checkTrigger:Q,getFirstAgent:$,complete:K,hide:U,isActive:W}}var r1=L(x(),1);var kZ=L(v(),1);function lW({name:Z,result:Y}){if(!Y)return kZ.jsxDEV(O,{color:"cyan",children:Z},void 0,!1,void 0,this);let X=Y.highlight((J)=>kZ.jsxDEV(O,{color:"green",bold:!0,children:J},void 0,!1,void 0,this));if(Array.isArray(X))return kZ.jsxDEV(O,{color:"cyan",children:X.map((J,Q)=>{if(typeof J==="string")return kZ.jsxDEV(O,{children:J},`p-${Q}`,!1,void 0,this);return kZ.jsxDEV(r1.default.Fragment,{children:J},`m-${Q}`,!1,void 0,this)})},void 0,!1,void 0,this);return kZ.jsxDEV(O,{color:"cyan",children:Z},void 0,!1,void 0,this)}var o1=({visible:Z,skills:Y,query:X,maxVisible:J=5})=>{if(!Z||Y.length===0)return null;let Q=Y.slice(0,J);return kZ.jsxDEV(N,{marginBottom:1,flexDirection:"column",children:[kZ.jsxDEV(O,{color:"yellow",bold:!0,children:"技能建议 (按 → 补全):"},void 0,!1,void 0,this),Q.map(({skill:$,result:K})=>kZ.jsxDEV(N,{children:[kZ.jsxDEV(O,{children:" #"},void 0,!1,void 0,this),kZ.jsxDEV(lW,{name:$.name,result:K},void 0,!1,void 0,this)]},$.name,!0,void 0,this)),Y.length>J&&kZ.jsxDEV(O,{color:"gray",children:["...还有 ",Y.length-J," 个技能"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var DZ=L(v(),1);function iW({name:Z,query:Y}){if(!Y)return DZ.jsxDEV(O,{color:"magenta",children:Z},void 0,!1,void 0,this);let X=Z.toLowerCase(),J=Y.toLowerCase();if(X.startsWith(J))return DZ.jsxDEV(DZ.Fragment,{children:[DZ.jsxDEV(O,{color:"green",bold:!0,children:Z.slice(0,Y.length)},void 0,!1,void 0,this),DZ.jsxDEV(O,{color:"magenta",children:Z.slice(Y.length)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return DZ.jsxDEV(O,{color:"magenta",children:Z},void 0,!1,void 0,this)}var n1=({visible:Z,agents:Y,query:X,maxVisible:J=5})=>{if(!Z||Y.length===0)return null;let Q=Y.slice(0,J);return DZ.jsxDEV(N,{marginBottom:1,flexDirection:"column",children:[DZ.jsxDEV(O,{color:"yellow",bold:!0,children:"Agent 建议 (按 → 补全):"},void 0,!1,void 0,this),Q.map(($)=>DZ.jsxDEV(N,{children:[DZ.jsxDEV(O,{children:" @"},void 0,!1,void 0,this),DZ.jsxDEV(iW,{name:$.name,query:X},void 0,!1,void 0,this),DZ.jsxDEV(O,{dimColor:!0,children:[" - ",$.description]},void 0,!0,void 0,this)]},$.id,!0,void 0,this)),Y.length>J&&DZ.jsxDEV(O,{color:"gray",children:["...还有 ",Y.length-J," 个 Agent"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var s1=L(x(),1);function t1(){let{extraParams:Z}=WZ(),{sendMessage:Y,loading:X}=KZ(),{bufferedMessage:J,clearBuffer:Q}=h0(),$=a1();s1.useEffect(()=>{if(!X&&J.trim()){let K=[{type:"human",content:J}];Q(),Y(K,{extraParams:Z}).then(()=>{_Y("Zen Code 完成任务")}).catch((U)=>{console.error("Failed to send buffered message:",U)})}},[X,J,Y,Z,Q,$])}var vY=L(v(),1),e1=({value:Z,onChange:Y,onSubmit:X,loading:J,placeholder:Q="输入消息...",commandHandler:$,skills:K=[],agents:U=[]})=>{t1();let{bufferedMessage:W,setBufferedMessage:z,clearBuffer:H}=h0(),[G,F]=BZ.useState(Z),M=BZ.useRef(!1),A=l1({skills:K,maxSuggestions:5}),w=i1({agents:U,maxSuggestions:5});BZ.useEffect(()=>{if(Z!==G)M.current=!0,F(Z)},[Z]);let P=BZ.useMemo(()=>G.startsWith("/"),[G]);BZ.useEffect(()=>{if(!P)A.checkTrigger(G),w.checkTrigger(G)},[G,P]);let B=BZ.useCallback((i)=>{if(M.current){M.current=!1;return}F(i),Y(i)},[Y]),R=BZ.useCallback((i)=>{if(!i.trim())return;if(A.hide(),w.hide(),P){X(i),F("");return}if(J)z(i),F("");else X(i),F("")},[P,J,X,z,A,w]),C=BZ.useCallback(()=>{if(w.isActive){w.hide();return}if(A.isActive){A.hide();return}if(W)H();else F("")},[W,H,A.isActive,w.isActive]),D=BZ.useCallback(()=>{if(!P||!$.commandSuggestions||$.commandSuggestions.length===0)return!1;let g=$.commandSuggestions[0],o=(g.displayText||g.command||"")+" ";return B(o),!0},[P,$.commandSuggestions,B]),j=BZ.useCallback(()=>{if(!A.isActive)return!1;let i=A.complete(G);return B(i),A.hide(),!0},[A.isActive,G,B]),E=BZ.useCallback(()=>{if(!w.isActive)return!1;let i=w.complete(G);return B(i),w.hide(),!0},[w.isActive,G,B]),d=BZ.useMemo(()=>{if(J)return W?"按 Esc 清空缓冲区":"AI 响应中,Enter 将消息加入缓冲区";if(P)return"输入命令... (试试 /help,按 → 补全第一个建议)";if(w.isActive)return"按 → 补全 Agent";if(A.isActive)return"按 → 补全技能";return Q},[J,W,P,w.isActive,A.isActive,Q]);return vY.jsxDEV(N,{flexDirection:"column",children:[W&&vY.jsxDEV(N,{padding:1,children:vY.jsxDEV(O,{color:"yellow",children:["\uD83D\uDCDD 缓冲区: ",W.slice(0,50),W.length>50?"...":""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),vY.jsxDEV($.CommandHintUI,{},void 0,!1,void 0,this),vY.jsxDEV(n1,{visible:w.state.visible,agents:w.state.filteredAgents,query:w.state.query},void 0,!1,void 0,this),vY.jsxDEV(o1,{visible:A.state.visible,skills:A.state.filteredSkills,query:A.state.query},void 0,!1,void 0,this),vY.jsxDEV(N,{paddingY:1,children:vY.jsxDEV(rZ,{id:"global-input",value:G,onChange:B,onSubmit:R,onHotKey:(i,g)=>{if(g.escape)return C(),!1;if(g.rightArrow){if(w.isActive){if(E())return!1}if(A.isActive){if(j())return!1}if(D())return!1}return!0},placeholder:d},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};var u4=L(v(),1),a8=x0.memo(()=>{let{userInput:Z,setUserInput:Y,loading:X,renderMessages:J,sendMessage:Q}=KZ(),{extraParams:$,manager:K}=WZ(),{switchToHistory:U,switchToKnowledge:W,switchToSettings:z,switchToModelProvider:H,switchToAgent:G,switchToTask:F,switchToMcp:M,closePanel:A}=Q4(),{data:w=[]}=p1({manager:K}),{data:P=[]}=d1(),{startRalphLoop:B}=c1({loading:X,renderMessages:J,sendMessage:Q,setUserInput:Y,extraParams:$}),R=m1({extraParams:$,switchToHistory:U,switchToKnowledge:W,switchToSettings:z,switchToModelProvider:H,switchToAgent:G,switchToTask:F,switchToMcp:M,closePanel:A,startRalphLoop:B}),C=x0.useCallback(async(D)=>{if(!D)return;if(D.startsWith("/")){if(await R.executeCommand(D)){Y("");return}}await Q([{type:"human",content:D}],{extraParams:$,metadata:WY}),_Y("Zen Code 完成任务")},[R,Y]);return u4.jsxDEV(N,{flexDirection:"column",paddingX:0,paddingY:0,borderColor:"grey",borderTop:!0,borderStyle:"single",borderLeft:!1,borderBottom:!1,borderRight:!1,children:[u4.jsxDEV(R.CommandErrorUI,{},void 0,!1,void 0,this),u4.jsxDEV(R.CommandSuccessUI,{},void 0,!1,void 0,this),u4.jsxDEV(e1,{value:Z,onChange:Y,onSubmit:C,loading:X,commandHandler:{isCommandInput:R.isCommandInput,CommandHintUI:R.CommandHintUI,commandSuggestions:R.commandSuggestions},skills:w,agents:P},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});a8.displayName="ChatInput";var hZ=L(v(),1),rW=()=>{let{renderMessages:Z,currentChatId:Y,getToolUIRender:X,loading:J}=KZ(),{compactMode:Q}=WZ(),[$]=ZJ(Z,50),[K,U]=IY.useState(!0),[W,z]=IY.useState(J);IY.useEffect(()=>{if(W&&!J){U(!1);let F=setTimeout(()=>{U(!0)},200);return()=>clearTimeout(F)}z(J)},[J,W]);let H=IY.useMemo(()=>{return`${Y}-${$.length}`},[Y,$.length]),G=IY.useCallback((F)=>X(F),[X]);return hZ.jsxDEV(N,{flexDirection:"column",flexGrow:1,paddingX:0,paddingY:0,children:[$.length===0&&hZ.jsxDEV(P1,{},void 0,!1,void 0,this),K&&$.length?Q?hZ.jsxDEV(r8,{renderMessages:$,startIndex:0,staticKey:H,getToolUIRender:G,loading:J},H,!1,void 0,this):hZ.jsxDEV(_1,{loading:J,renderMessages:$,startIndex:0,staticKey:H},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)},s8=()=>{let{hasPendingInteractions:Z}=gZ();return hZ.jsxDEV(N,{flexDirection:"column",flexGrow:1,children:[hZ.jsxDEV(n,{name:"ChatMessages",fallback:null,children:hZ.jsxDEV(rW,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),hZ.jsxDEV(YJ,{children:hZ.jsxDEV(n,{name:"InteractionArea",fallback:null,children:Z?hZ.jsxDEV(N,{paddingX:0,paddingY:0,children:hZ.jsxDEV(X8,{},void 0,!1,void 0,this)},void 0,!1,void 0,this):hZ.jsxDEV(a8,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};s8.displayName="ChatMain";var qY=L(x(),1);var hY=L(x(),1),XJ=hY.lazy(()=>import("./chunk-84nqfeqh.js").then((Z)=>({default:Z.default}))),JJ=hY.lazy(()=>import("./chunk-bmb36b05.js").then((Z)=>({default:Z.default}))),QJ=hY.lazy(()=>import("./chunk-yk20e377.js").then((Z)=>({default:Z.default}))),$J=hY.lazy(()=>import("./chunk-9frwhzz8.js").then((Z)=>({default:Z.default}))),KJ=hY.lazy(()=>import("./chunk-vsedmhna.js").then((Z)=>({default:Z.default}))),WJ=hY.lazy(()=>import("./chunk-fj71pv2k.js").then((Z)=>({default:Z.default}))),UJ=hY.lazy(()=>import("./chunk-t7zrr341.js").then((Z)=>({default:Z.default})));var u=L(v(),1),Y4=()=>u.jsxDEV(N,{paddingX:1,paddingY:1,children:u.jsxDEV(O,{color:"grey",children:"Loading..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),X4=(Z)=>u.jsxDEV(N,{paddingX:1,paddingY:1,children:[u.jsxDEV(O,{color:"red",children:["✗ ",Z," panel error"]},void 0,!0,void 0,this),u.jsxDEV(N,{marginTop:1,children:u.jsxDEV(O,{color:"gray",children:"Try reopening or press ESC to return"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t8=qY.memo(()=>{let{activeView:Z,closePanel:Y,handleExecuteTask:X}=Q4();return u.jsxDEV(N,{flexGrow:1,flexDirection:"row",children:[Z==="history"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"HistoryPanel",fallback:X4("History"),children:u.jsxDEV(XJ,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="knowledge"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"KnowledgePanel",fallback:X4("Knowledge"),children:u.jsxDEV(JJ,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="settings"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"SettingsPanel",fallback:X4("Settings"),children:u.jsxDEV(QJ,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="model-provider"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"ModelProviderPanel",fallback:X4("Model Provider"),children:u.jsxDEV($J,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="agent"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"AgentPanel",fallback:X4("Agent"),children:u.jsxDEV(KJ,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="task"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"TaskPanel",fallback:X4("Task"),children:u.jsxDEV(WJ,{onClose:Y,onExecuteTask:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z==="mcp"&&u.jsxDEV(qY.Suspense,{fallback:u.jsxDEV(Y4,{},void 0,!1,void 0,this),children:u.jsxDEV(n,{name:"McpPanel",fallback:X4("MCP"),children:u.jsxDEV(UJ,{onClose:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});t8.displayName="LazyChatViewManager";var YX=L(x(),1);var zJ=L(x(),1);var g0=L(v(),1),HJ=()=>{let{renderMessages:Z}=KZ(),Y=zJ.default.useMemo(()=>{if(!Z)return null;for(let X=Z.length-1;X>=0;X--){let J=Z[X];if(J.role==="assistant"&&J.content)try{let $=(Array.isArray(J.content)?J.content:[{type:"text",text:J.content}]).find((K)=>K.type==="text")?.text||"";if($.includes("load_mcp_tools"))try{let K=JSON.parse($);if(K.status&&K.status.toolCount!==void 0)return K.status}catch(K){}}catch(Q){}}return null},[Z]);if(!Y||Y.toolCount===0)return null;return g0.jsxDEV(N,{paddingX:1,children:[g0.jsxDEV(O,{color:"green",bold:!0,children:"MCP"},void 0,!1,void 0,this),g0.jsxDEV(O,{color:"cyan",children:[" ",Y.toolCount]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var JY=L(x(),1);function ZX(Z){if(Z===0)return"0";if(Z<1024)return`${Z}`;if(Z<1048576)return`${(Z/1024).toFixed(0)}K`;if(Z<1073741824)return`${(Z/1048576).toFixed(0)}M`;return`${(Z/1073741824).toFixed(1)}G`}function GJ(Z){let Y=Math.floor(Z/1000),X=Math.floor(Y/3600),J=Math.floor(Y%3600/60),Q=Y%60;if(X>0)return`${X}:${String(J).padStart(2,"0")}:${String(Q).padStart(2,"0")}`;return`${String(J).padStart(2,"0")}:${String(Q).padStart(2,"0")}`}function OJ(Z){let[Y,X]=JY.useState(0),J=JY.useRef(null);return JY.useEffect(()=>{if(Z)J.current=Date.now(),X(0);else J.current=null,X(0)},[Z]),e8(()=>{if(J.current)X(Date.now()-J.current)},Z?1000:null),Y}function qJ(){let[Z,Y]=JY.useState({cpuPercent:0,memoryRSS:0,memoryHeapUsed:0,memoryHeapTotal:0}),X=JY.useRef(process.cpuUsage()),J=JY.useRef(Date.now()),Q=()=>{let $=Date.now(),K=process.cpuUsage(),U=process.memoryUsage(),W=$-J.current,z=K.user-X.current.user,H=K.system-X.current.system,F=(z+H)/1000/W*100;Y({cpuPercent:Math.min(100,Math.max(0,F)),memoryRSS:U.rss,memoryHeapUsed:U.heapUsed,memoryHeapTotal:U.heapTotal}),X.current=K,J.current=$};return JY.useEffect(()=>{Q()},[]),e8(Q,2000),Z}function FJ(Z){if(Z<50)return"green";if(Z<80)return"yellow";return"red"}function MJ(Z,Y){if(Y===0)return"gray";let X=Z/Y*100;if(X<50)return"green";if(X<80)return"yellow";return"red"}var DY=L(v(),1),oW=()=>{let Z=qJ(),Y=FJ(Z.cpuPercent),X=MJ(Z.memoryHeapUsed,Z.memoryHeapTotal);return DY.jsxDEV(N,{paddingX:1,width:"100%",children:DY.jsxDEV(N,{gap:2,children:[DY.jsxDEV(N,{children:[DY.jsxDEV(O,{dimColor:!0,children:"CPU:"},void 0,!1,void 0,this),DY.jsxDEV(O,{color:Y,children:[" ",Z.cpuPercent.toFixed(0),"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),DY.jsxDEV(N,{children:[DY.jsxDEV(O,{dimColor:!0,children:"MEM:"},void 0,!1,void 0,this),DY.jsxDEV(O,{color:X,children:[ZX(Z.memoryHeapUsed),"/",ZX(Z.memoryRSS)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},NJ=oW;var AZ=L(v(),1);import nW from"path";var aW=()=>{let{extraParams:Z,compactMode:Y,showDetailedInfo:X}=WZ(),{currentChatId:J,renderMessages:Q}=KZ(),{loading:$,stopGeneration:K}=KZ(),U=process.env.YOLO_MODE==="true",W=YX.default.useCallback((M,A)=>{if(A.ctrl&&M==="c")if($)K();else process.exit()},[$,K]);uZ(W);let z=OJ($),H=YX.default.useMemo(()=>{return nW.basename(process.cwd())},[]),F=(Q?.length||0)>100;return AZ.jsxDEV(N,{flexDirection:"column",width:"100%",children:[AZ.jsxDEV(N,{paddingX:1,paddingY:0,justifyContent:"space-between",width:"100%",marginBottom:1,children:[AZ.jsxDEV(N,{gap:1,children:[$&&AZ.jsxDEV(O,{color:"yellow",bold:!0,children:AZ.jsxDEV(AJ,{text:"LOADING"},void 0,!1,void 0,this)},void 0,!1,void 0,this),!$&&AZ.jsxDEV(O,{color:"magenta",bold:!0,children:"Zen Code"},void 0,!1,void 0,this),AZ.jsxDEV(O,{color:"cyan",bold:!0,children:[" ",Z.model_id]},void 0,!0,void 0,this),AZ.jsxDEV(O,{color:"yellow",bold:!0,children:[" ","@",Z.switch_command||"default"]},void 0,!0,void 0,this),!Y&&AZ.jsxDEV(O,{color:"blue",bold:!0,children:[" ","[FULL]"]},void 0,!0,void 0,this),U&&AZ.jsxDEV(O,{color:"red",bold:!0,children:[" ","YOLO"]},void 0,!0,void 0,this),AZ.jsxDEV(HJ,{},void 0,!1,void 0,this),F&&AZ.jsxDEV(O,{color:"red",bold:!0,children:[" ","/summary"]},void 0,!0,void 0,this),AZ.jsxDEV(O,{color:"green",bold:!0,children:Q.length},void 0,!1,void 0,this),AZ.jsxDEV(O,{color:"blue",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$&&AZ.jsxDEV(N,{children:AZ.jsxDEV(O,{color:"yellow",children:GJ(z)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X&&AZ.jsxDEV(NJ,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},_J=aW;var a=L(v(),1),sW=()=>{let{activeView:Z}=Q4();return a.jsxDEV(N,{flexDirection:"column",width:"100%",children:[a.jsxDEV(N,{flexGrow:1,flexDirection:"row",children:[a.jsxDEV(n,{name:"ChatMain",fallback:a.jsxDEV(O,{color:"yellow",children:"Chat view unavailable"},void 0,!1,void 0,this),children:Z==="chat"?a.jsxDEV(s8,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this),a.jsxDEV(n,{name:"PanelView",fallback:a.jsxDEV(O,{color:"yellow",children:"Panel unavailable"},void 0,!1,void 0,this),children:Z!=="chat"?a.jsxDEV(t8,{},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a.jsxDEV(n,{name:"StatusBar",fallback:null,children:a.jsxDEV(_J,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},tW=()=>{return a.jsxDEV(n,{name:"Chat",children:a.jsxDEV(F5,{children:a.jsxDEV(sW,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},eW=()=>{return a.jsxDEV(n,{name:"AppRoot",children:a.jsxDEV(wJ,{apiUrl:"http://127.0.0.1:8123",defaultAgent:"code",defaultHeaders:{},withCredentials:!1,showHistory:!1,showGraph:!1,onInitError:(Z,Y)=>{console.error(Z,Y)},fetch:AX,autoRestoreLastSession:!0,historyFilter:{metadata:{path:process.cwd()}},children:a.jsxDEV(n,{name:"TanStackQueryProvider",children:a.jsxDEV(WX,{children:a.jsxDEV(n,{name:"SettingsProvider",children:a.jsxDEV(LJ,{get_allowed_models:_X,children:a.jsxDEV(n,{name:"ApprovalProvider",children:a.jsxDEV(BJ,{children:a.jsxDEV(n,{name:"InteractionProvider",children:a.jsxDEV(d4,{children:a.jsxDEV(tW,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},Z2=()=>a.jsxDEV(eW,{},void 0,!1,void 0,this),XX=Z2;var QY=L(v(),1),Y2=({error:Z})=>QY.jsxDEV(N,{flexDirection:"column",padding:2,borderStyle:"double",borderColor:"red",children:[QY.jsxDEV(O,{color:"red",bold:!0,children:"✗ Application Crashed"},void 0,!1,void 0,this),QY.jsxDEV(N,{marginTop:1,children:QY.jsxDEV(O,{color:"red",children:Z.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),QY.jsxDEV(N,{marginTop:1,children:QY.jsxDEV(O,{color:"gray",children:["Stack: ",Z.stack?.split(`
|
|
270
346
|
`).slice(0,3).join(`
|
|
271
|
-
`)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),
|
|
347
|
+
`)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),QY.jsxDEV(N,{marginTop:1,children:QY.jsxDEV(O,{color:"blue",children:"Press Ctrl+C to exit"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);try{JX(QY.jsxDEV(XX,{},void 0,!1,void 0,this),{exitOnCtrlC:!1})}catch(Z){console.error("Critical rendering error:",Z),JX(QY.jsxDEV(Y2,{error:Z},void 0,!1,void 0,this))}process.on("unhandledRejection",(Z,Y)=>{console.error("Unhandled Rejection at:",Y,"reason:",Z)});process.on("uncaughtException",(Z)=>{console.error("Uncaught Exception:",Z)});
|