@stigmer/server-slim 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/console/404.html +1 -0
- package/console/Icon-bw.svg +10 -0
- package/console/Icon-light.svg +10 -0
- package/console/__next.__PAGE__.txt +5 -0
- package/console/__next._full.txt +28 -0
- package/console/__next._head.txt +6 -0
- package/console/__next._index.txt +17 -0
- package/console/__next._tree.txt +5 -0
- package/console/_next/static/XrBnttPHHP5Wmi7mT4uLM/_buildManifest.js +11 -0
- package/console/_next/static/XrBnttPHHP5Wmi7mT4uLM/_clientMiddlewareManifest.js +1 -0
- package/console/_next/static/XrBnttPHHP5Wmi7mT4uLM/_ssgManifest.js +1 -0
- package/console/_next/static/chunks/0-6znc4v4kg4~.js +1 -0
- package/console/_next/static/chunks/0-73gkqs33_.~.js +1 -0
- package/console/_next/static/chunks/0-l4jzu40dd8w.js +1 -0
- package/console/_next/static/chunks/0-z-fnjdx4ulh.js +1 -0
- package/console/_next/static/chunks/0-zcgxw8vt51~.js +1 -0
- package/console/_next/static/chunks/0.f-b71h~m9l_.js +1 -0
- package/console/_next/static/chunks/0.p57pbuzo8j7.js +90 -0
- package/console/_next/static/chunks/0.qu8zg6yocro.js +1 -0
- package/console/_next/static/chunks/00-fpv~l3r27l.js +1 -0
- package/console/_next/static/chunks/005ctashl3n1r.js +1 -0
- package/console/_next/static/chunks/0068d1zb538z~.js +1 -0
- package/console/_next/static/chunks/008b.zzs.t4bw.js +139 -0
- package/console/_next/static/chunks/00d~s.n2ue-_h.js +1 -0
- package/console/_next/static/chunks/00o8ud2dmna2j.js +1 -0
- package/console/_next/static/chunks/00r~itj4ekq5y.js +1 -0
- package/console/_next/static/chunks/01.9x7hzkgv7j.js +1 -0
- package/console/_next/static/chunks/016uwj-o-jqap.js +1 -0
- package/console/_next/static/chunks/01f1gh.2dzexy.js +1 -0
- package/console/_next/static/chunks/01ontipw7_pn-.js +1 -0
- package/console/_next/static/chunks/02fsq8lsaeu8j.js +1 -0
- package/console/_next/static/chunks/02qsbdquvk64o.js +1 -0
- package/console/_next/static/chunks/03.b9z-1o34dx.js +1 -0
- package/console/_next/static/chunks/038jxymv2x4u-.js +148 -0
- package/console/_next/static/chunks/03f2f6enzzhsy.js +1 -0
- package/console/_next/static/chunks/03l_lqxocp3uj.js +1 -0
- package/console/_next/static/chunks/03lth2le32c6r.js +201 -0
- package/console/_next/static/chunks/03v0v690_bw8u.js +62 -0
- package/console/_next/static/chunks/03yru4-m-450t.js +1 -0
- package/console/_next/static/chunks/03~yq9q893hmn.js +1 -0
- package/console/_next/static/chunks/04nu-nyhd8yfk.js +18 -0
- package/console/_next/static/chunks/04uzf6wcrofgt.js +1 -0
- package/console/_next/static/chunks/056bfxvkb8fd~.js +1 -0
- package/console/_next/static/chunks/06huuay3x3z07.js +1 -0
- package/console/_next/static/chunks/06o.rsm2b~dht.js +60 -0
- package/console/_next/static/chunks/07.l7154cu7z-.js +1 -0
- package/console/_next/static/chunks/07wnm1~gr1rx~.js +1 -0
- package/console/_next/static/chunks/08.rk-nar1l2t.js +25 -0
- package/console/_next/static/chunks/08iibm2~7e.mj.js +1 -0
- package/console/_next/static/chunks/08o5wsrurx9ux.js +5 -0
- package/console/_next/static/chunks/09~n7y-jkmjlj.js +152 -0
- package/console/_next/static/chunks/0_mhv9_2_g.-d.js +119 -0
- package/console/_next/static/chunks/0af53k.rxu1kn.js +1 -0
- package/console/_next/static/chunks/0amugang-25bm.js +1 -0
- package/console/_next/static/chunks/0awsj.h.eiuen.js +1 -0
- package/console/_next/static/chunks/0axtn1ln1j35_.js +79 -0
- package/console/_next/static/chunks/0c5xj4q0jmdu0.js +1 -0
- package/console/_next/static/chunks/0c7llz2igr3w7.js +1 -0
- package/console/_next/static/chunks/0cgp87bgoglgv.js +1 -0
- package/console/_next/static/chunks/0co3~00k0sae5.js +1 -0
- package/console/_next/static/chunks/0cq0zrqlu~xa7.js +1 -0
- package/console/_next/static/chunks/0cs_h74-ljzlt.js +77 -0
- package/console/_next/static/chunks/0cu8k_dz43e4y.js +1 -0
- package/console/_next/static/chunks/0d05q_m7mqj4o.js +1 -0
- package/console/_next/static/chunks/0dsde0n1co0l..js +1 -0
- package/console/_next/static/chunks/0e4xdug~7dxzk.js +1 -0
- package/console/_next/static/chunks/0e7hldxv930hc.js +12 -0
- package/console/_next/static/chunks/0ed3hfv95qark.js +10 -0
- package/console/_next/static/chunks/0f1nokqa6poai.js +1 -0
- package/console/_next/static/chunks/0f8bbcvfh6x_j.js +64 -0
- package/console/_next/static/chunks/0fy2-q-5a0j3r.js +1 -0
- package/console/_next/static/chunks/0g-98wql22rf4.css +1 -0
- package/console/_next/static/chunks/0g167wye7-x6z.js +1 -0
- package/console/_next/static/chunks/0g4_345f39a55.js +1 -0
- package/console/_next/static/chunks/0ge0mq0ea60lx.js +1 -0
- package/console/_next/static/chunks/0gepanyj709pr.js +1 -0
- package/console/_next/static/chunks/0glne1asott9e.js +2 -0
- package/console/_next/static/chunks/0hb.-vcj2w6kf.js +1 -0
- package/console/_next/static/chunks/0hdh_2akzrlxi.js +287 -0
- package/console/_next/static/chunks/0hhe78mplcj67.js +1 -0
- package/console/_next/static/chunks/0hori02zn~h3o.js +1 -0
- package/console/_next/static/chunks/0hq~c-~dp2g~1.js +1 -0
- package/console/_next/static/chunks/0i.l9589uvx0j.js +1 -0
- package/console/_next/static/chunks/0i8pgzf~hu-3m.js +24 -0
- package/console/_next/static/chunks/0icpvuwlmnlty.js +43 -0
- package/console/_next/static/chunks/0icsogze8wb_v.js +3 -0
- package/console/_next/static/chunks/0ij17mw0v0qd-.js +1 -0
- package/console/_next/static/chunks/0io-wgdji~5d0.js +1 -0
- package/console/_next/static/chunks/0ipk1er3w80bj.js +24 -0
- package/console/_next/static/chunks/0irq1yd9ix16u.js +1 -0
- package/console/_next/static/chunks/0iwpyv2wbln6f.js +1 -0
- package/console/_next/static/chunks/0ixo5_jc~m0~2.js +1 -0
- package/console/_next/static/chunks/0jxlubusvmdjm.js +1 -0
- package/console/_next/static/chunks/0j~3z.dgn_8ff.css +6 -0
- package/console/_next/static/chunks/0k9_1v72yx36d.js +226 -0
- package/console/_next/static/chunks/0ka-.7dww7nze.js +101 -0
- package/console/_next/static/chunks/0kt3942_0py-t.js +1 -0
- package/console/_next/static/chunks/0l3uvjh3oslhq.js +1 -0
- package/console/_next/static/chunks/0lp.du_t-~cqs.js +2 -0
- package/console/_next/static/chunks/0lq22-4n7_uyt.js +34 -0
- package/console/_next/static/chunks/0lypu-.xpph9..js +15 -0
- package/console/_next/static/chunks/0mb.pnhflhw95.js +1 -0
- package/console/_next/static/chunks/0mcz_room09fj.js +1 -0
- package/console/_next/static/chunks/0mo3-obfy2_6v.js +15 -0
- package/console/_next/static/chunks/0mtfbfe5xd3.6.js +1 -0
- package/console/_next/static/chunks/0mvcspqlkvjri.js +1 -0
- package/console/_next/static/chunks/0n2qydw3oc1oj.js +1 -0
- package/console/_next/static/chunks/0nnkdto25tilf.js +1 -0
- package/console/_next/static/chunks/0npm9l63~4j0v.js +1 -0
- package/console/_next/static/chunks/0nu6llqvg4741.js +1 -0
- package/console/_next/static/chunks/0n~glqz40m6gv.js +1 -0
- package/console/_next/static/chunks/0o-.19qua6web.js +5 -0
- package/console/_next/static/chunks/0omq5mq8dkd24.js +1 -0
- package/console/_next/static/chunks/0oprw5m.lmqln.js +1 -0
- package/console/_next/static/chunks/0ortphe030oky.js +1 -0
- package/console/_next/static/chunks/0oufb2b491l23.js +153 -0
- package/console/_next/static/chunks/0owq59irnycu5.js +1 -0
- package/console/_next/static/chunks/0ptwwlt0l20~o.js +1 -0
- package/console/_next/static/chunks/0q2tc-vqxe1_n.js +1 -0
- package/console/_next/static/chunks/0qfu4h5g.k-yt.js +1 -0
- package/console/_next/static/chunks/0qji_.pm~u8x3.js +1 -0
- package/console/_next/static/chunks/0qm2930z0c.8m.js +80 -0
- package/console/_next/static/chunks/0q~1rz_i~v0vs.js +1 -0
- package/console/_next/static/chunks/0r4lipg4xb6fx.js +1 -0
- package/console/_next/static/chunks/0rhvismtjivza.js +104 -0
- package/console/_next/static/chunks/0rmt10l3458p_.js +93 -0
- package/console/_next/static/chunks/0rob~86j~8vge.js +1 -0
- package/console/_next/static/chunks/0r~zu0c3j_b7p.js +1 -0
- package/console/_next/static/chunks/0s0v8xobo-2ok.js +34 -0
- package/console/_next/static/chunks/0s8nwq43gep9_.js +15 -0
- package/console/_next/static/chunks/0spswjguxbqfn.js +1 -0
- package/console/_next/static/chunks/0t6aq14rpn1.w.js +1 -0
- package/console/_next/static/chunks/0taiwi2j.k7mm.js +1 -0
- package/console/_next/static/chunks/0tj3k0t29gpn7.js +1 -0
- package/console/_next/static/chunks/0tq77.56bu2eu.js +1 -0
- package/console/_next/static/chunks/0ulcdeu8yx-cn.js +1 -0
- package/console/_next/static/chunks/0uvbqsa~x3_x6.js +1 -0
- package/console/_next/static/chunks/0uw8zy_zoej6s.js +1 -0
- package/console/_next/static/chunks/0uz5-~rqk9vr..js +1 -0
- package/console/_next/static/chunks/0w3ug0~zih~j2.js +1 -0
- package/console/_next/static/chunks/0wfrz3x.bxehc.js +1 -0
- package/console/_next/static/chunks/0wyb4nqlt6his.js +1 -0
- package/console/_next/static/chunks/0x.4919xjicc5.js +75 -0
- package/console/_next/static/chunks/0xr1dk~mec2dn.js +1 -0
- package/console/_next/static/chunks/0xxouzzjw_a6q.js +115 -0
- package/console/_next/static/chunks/0y0u4wm.3~_ac.js +1 -0
- package/console/_next/static/chunks/0y4vop46pw7ip.js +2 -0
- package/console/_next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
- package/console/_next/static/chunks/0y99xmlf_e2si.js +1 -0
- package/console/_next/static/chunks/0ydl92ezt_ppz.js +1 -0
- package/console/_next/static/chunks/0ywlzawl2ml3h.js +1 -0
- package/console/_next/static/chunks/0yysdfbgz-l8n.js +1 -0
- package/console/_next/static/chunks/0zjs5hlwbvch9.js +4 -0
- package/console/_next/static/chunks/0zsntdh42--v1.js +1 -0
- package/console/_next/static/chunks/104yvyc1ce3q5.js +1 -0
- package/console/_next/static/chunks/1051z1rwyse00.js +1 -0
- package/console/_next/static/chunks/10h6g4u9i~5h8.js +1 -0
- package/console/_next/static/chunks/10isn5~-bj4w5.js +4 -0
- package/console/_next/static/chunks/10ymqudg~95gr.js +1 -0
- package/console/_next/static/chunks/111eimn8nia.7.js +1 -0
- package/console/_next/static/chunks/1155_-gh-rcvi.js +1 -0
- package/console/_next/static/chunks/117cg_x8i7.ol.js +1 -0
- package/console/_next/static/chunks/11_7qxlc92f5s.js +1 -0
- package/console/_next/static/chunks/11h85j-8~tny3.js +36 -0
- package/console/_next/static/chunks/11t~35bechtea.js +1 -0
- package/console/_next/static/chunks/11uh-ttx4zin-.js +9 -0
- package/console/_next/static/chunks/11xfx57fbi3md.js +2 -0
- package/console/_next/static/chunks/12329wyw7127c.js +1 -0
- package/console/_next/static/chunks/123jshjvn0ocr.js +31 -0
- package/console/_next/static/chunks/128ahbvhdeeq-.js +1 -0
- package/console/_next/static/chunks/13hl4dngamd3l.js +127 -0
- package/console/_next/static/chunks/14.38bpm-d3-l.js +1 -0
- package/console/_next/static/chunks/14i46k409qlt0.js +1 -0
- package/console/_next/static/chunks/14j238ax8coge.js +29 -0
- package/console/_next/static/chunks/159151ghv9-cc.js +1 -0
- package/console/_next/static/chunks/15hlb71q~xfev.js +1 -0
- package/console/_next/static/chunks/15r_pfbdb2jhp.js +23 -0
- package/console/_next/static/chunks/15wc.2zpsy4wc.js +4 -0
- package/console/_next/static/chunks/16pzrphqjtyli.js +1 -0
- package/console/_next/static/chunks/16ukgtm3fhab~.js +1071 -0
- package/console/_next/static/chunks/170p3g7_6_620.js +2 -0
- package/console/_next/static/chunks/175hd_pl41_vh.js +15 -0
- package/console/_next/static/chunks/17glhyaxi4vs-.js +1 -0
- package/console/_next/static/chunks/17jhgtykn778_.js +1 -0
- package/console/_next/static/chunks/17v4twif7y~.b.js +1 -0
- package/console/_next/static/chunks/182b_f_n0-cdr.js +1 -0
- package/console/_next/static/chunks/187v8dzyf1l-f.js +80 -0
- package/console/_next/static/chunks/turbopack-0cvnq9zq1g68-.js +1 -0
- package/console/_next/static/chunks/turbopack-172c~.rma.yso.js +1 -0
- package/console/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
- package/console/_next/static/media/02263ebadd758ea4-s.0qg7j5o.yrclm.woff2 +0 -0
- package/console/_next/static/media/03fc1b4a8d284b5e-s.09.f.n_ccld80.woff2 +0 -0
- package/console/_next/static/media/07454f8ad8aaac57-s.0tqkxa-w3pk~c.woff2 +0 -0
- package/console/_next/static/media/1bcd0e671759a44c-s.0vnh8.d8wxa2x.woff2 +0 -0
- package/console/_next/static/media/1bffadaabf893a1e-s.16ipb6fqu393i.woff2 +0 -0
- package/console/_next/static/media/224e262ef877bfa4-s.0mo8vqgr8yagc.woff2 +0 -0
- package/console/_next/static/media/2bbe8d2671613f1f-s.067x_6k0k23tk.woff2 +0 -0
- package/console/_next/static/media/2c55a0e60120577a-s.0bjc5tiuqdqro.woff2 +0 -0
- package/console/_next/static/media/2fe89d53234c61d4-s.0k_.i63k_i_qa.woff2 +0 -0
- package/console/_next/static/media/4fa387ec64143e14-s.0wkzw~je483f-.woff2 +0 -0
- package/console/_next/static/media/53b9e256198e5412-s.0-wfv7uh4i7h9.woff2 +0 -0
- package/console/_next/static/media/5476f68d60460930-s.0wxq9webf.ew4.woff2 +0 -0
- package/console/_next/static/media/57215795b8570f5c-s.0vwgtotjdgnhr.woff2 +0 -0
- package/console/_next/static/media/59b15b4bcd7b1eb5-s.0x08jh8vondwt.woff2 +0 -0
- package/console/_next/static/media/5ce348bf30bf5439-s.0zgw-jeven.3w.woff2 +0 -0
- package/console/_next/static/media/5e05ae5b48faa55e-s.0m9hhkgdlzukj.woff2 +0 -0
- package/console/_next/static/media/6306c77e7c8268e4-s.0rhz0arwfsn~5.woff2 +0 -0
- package/console/_next/static/media/68757d6cddeff913-s.0hkrq11n-dhos.woff2 +0 -0
- package/console/_next/static/media/7178b3e590c64307-s.0nx0ww8fni_q3.woff2 +0 -0
- package/console/_next/static/media/797e433ab948586e-s.p.08e28id.o-okb.woff2 +0 -0
- package/console/_next/static/media/7d817b4c03b0c5f1-s.0l76wvqk9d84w.woff2 +0 -0
- package/console/_next/static/media/7f11d98043fdedc9-s.0r4w1y.tjq0ay.woff2 +0 -0
- package/console/_next/static/media/7fea77d1d19108bf-s.0xyeb7czu1stb.woff2 +0 -0
- package/console/_next/static/media/83afe278b6a6bb3c-s.0q-301v4kxxnr.woff2 +0 -0
- package/console/_next/static/media/8a480f0b521d4e75-s.0jzbimsg8vl84.woff2 +0 -0
- package/console/_next/static/media/90c51ce8fb754fe8-s.00z~hoalba5dm.woff2 +0 -0
- package/console/_next/static/media/99e609270109b47d-s.16-z~2sp29ex6.woff2 +0 -0
- package/console/_next/static/media/9c72aa0f40e4eef8-s.0m6w47a4e5dy9.woff2 +0 -0
- package/console/_next/static/media/a7afbb44bec2bb18-s.0juuwbcf7uz~t.woff2 +0 -0
- package/console/_next/static/media/ad66f9afd8947f86-s.11u06r12fd6v_.woff2 +0 -0
- package/console/_next/static/media/bbc41e54d2fcbd21-s.0k4k9394f2q-k.woff2 +0 -0
- package/console/_next/static/media/caa3a2e1cccd8315-s.p.09~u27dqhyhd6.woff2 +0 -0
- package/console/_next/static/media/d8cb5ab3660140cd-s.0ri_id_kcagyz.woff2 +0 -0
- package/console/_next/static/media/e15f58668ad64cb8-s.0~.8lt~vdqmc3.woff2 +0 -0
- package/console/_next/static/media/e390973e931a41c5-s.08hd0g.321csk.woff2 +0 -0
- package/console/_next/static/media/e532fa1b9921e1cd-s.0~wrfy7sm-h4g.woff2 +0 -0
- package/console/_next/static/media/e6d00ff86ef9e699-s.0lcb62h0-.jh3.woff2 +0 -0
- package/console/_next/static/media/effe91970fc4db64-s.07ig5l8azj~hy.woff2 +0 -0
- package/console/_next/static/media/elk-worker.min.13hrbirt7_.ef.js +6401 -0
- package/console/_next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
- package/console/_next/static/media/fef07dbb0973bf53-s.12tyk43_3sh9u.woff2 +0 -0
- package/console/_not-found/__next._full.txt +29 -0
- package/console/_not-found/__next._head.txt +6 -0
- package/console/_not-found/__next._index.txt +17 -0
- package/console/_not-found/__next._not-found.__PAGE__.txt +6 -0
- package/console/_not-found/__next._not-found.txt +5 -0
- package/console/_not-found/__next._tree.txt +3 -0
- package/console/_not-found.html +1 -0
- package/console/_not-found.txt +29 -0
- package/console/apple-touch-icon-dark.png +0 -0
- package/console/apple-touch-icon-light.png +0 -0
- package/console/auth/callback/__next._full.txt +36 -0
- package/console/auth/callback/__next._head.txt +6 -0
- package/console/auth/callback/__next._index.txt +17 -0
- package/console/auth/callback/__next._tree.txt +5 -0
- package/console/auth/callback/__next.auth.callback.__PAGE__.txt +9 -0
- package/console/auth/callback/__next.auth.callback.txt +5 -0
- package/console/auth/callback/__next.auth.txt +5 -0
- package/console/auth/callback.html +1 -0
- package/console/auth/callback.txt +36 -0
- package/console/auth/github/callback/__next._full.txt +37 -0
- package/console/auth/github/callback/__next._head.txt +6 -0
- package/console/auth/github/callback/__next._index.txt +17 -0
- package/console/auth/github/callback/__next._tree.txt +5 -0
- package/console/auth/github/callback/__next.auth.github.callback.__PAGE__.txt +9 -0
- package/console/auth/github/callback/__next.auth.github.callback.txt +5 -0
- package/console/auth/github/callback/__next.auth.github.txt +5 -0
- package/console/auth/github/callback/__next.auth.txt +5 -0
- package/console/auth/github/callback.html +1 -0
- package/console/auth/github/callback.txt +37 -0
- package/console/auth/oauth/callback/__next._full.txt +37 -0
- package/console/auth/oauth/callback/__next._head.txt +6 -0
- package/console/auth/oauth/callback/__next._index.txt +17 -0
- package/console/auth/oauth/callback/__next._tree.txt +5 -0
- package/console/auth/oauth/callback/__next.auth.oauth.callback.__PAGE__.txt +9 -0
- package/console/auth/oauth/callback/__next.auth.oauth.callback.txt +5 -0
- package/console/auth/oauth/callback/__next.auth.oauth.txt +5 -0
- package/console/auth/oauth/callback/__next.auth.txt +5 -0
- package/console/auth/oauth/callback.html +1 -0
- package/console/auth/oauth/callback.txt +37 -0
- package/console/chat/__placeholder__/__placeholder__/__next._full.txt +35 -0
- package/console/chat/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/chat/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/chat/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.txt +5 -0
- package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.txt +5 -0
- package/console/chat/__placeholder__/__placeholder__/__next.chat.txt +5 -0
- package/console/chat/__placeholder__/__placeholder__.html +1 -0
- package/console/chat/__placeholder__/__placeholder__.txt +35 -0
- package/console/conversations/__next._full.txt +32 -0
- package/console/conversations/__next._head.txt +6 -0
- package/console/conversations/__next._index.txt +17 -0
- package/console/conversations/__next._tree.txt +5 -0
- package/console/conversations/__next.conversations.__PAGE__.txt +6 -0
- package/console/conversations/__next.conversations.txt +5 -0
- package/console/conversations/__placeholder__/__placeholder__/__next._full.txt +35 -0
- package/console/conversations/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/conversations/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/conversations/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.__PAGE__.txt +6 -0
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.txt +5 -0
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.txt +5 -0
- package/console/conversations/__placeholder__/__placeholder__/__next.conversations.txt +5 -0
- package/console/conversations/__placeholder__/__placeholder__.html +1 -0
- package/console/conversations/__placeholder__/__placeholder__.txt +35 -0
- package/console/conversations.html +1 -0
- package/console/conversations.txt +32 -0
- package/console/dashboard/__next._full.txt +32 -0
- package/console/dashboard/__next._head.txt +6 -0
- package/console/dashboard/__next._index.txt +17 -0
- package/console/dashboard/__next._tree.txt +5 -0
- package/console/dashboard/__next.dashboard.__PAGE__.txt +6 -0
- package/console/dashboard/__next.dashboard.txt +5 -0
- package/console/dashboard.html +1 -0
- package/console/dashboard.txt +32 -0
- package/console/embed.js +1 -0
- package/console/executions/__placeholder__/__next._full.txt +32 -0
- package/console/executions/__placeholder__/__next._head.txt +6 -0
- package/console/executions/__placeholder__/__next._index.txt +17 -0
- package/console/executions/__placeholder__/__next._tree.txt +5 -0
- package/console/executions/__placeholder__/__next.executions.$d$id.__PAGE__.txt +5 -0
- package/console/executions/__placeholder__/__next.executions.$d$id.txt +5 -0
- package/console/executions/__placeholder__/__next.executions.txt +5 -0
- package/console/executions/__placeholder__.html +1 -0
- package/console/executions/__placeholder__.txt +32 -0
- package/console/favicon-dark-16x16.png +0 -0
- package/console/favicon-dark-32x32.png +0 -0
- package/console/favicon-dark.ico +0 -0
- package/console/favicon-dark.svg +11 -0
- package/console/favicon-light-16x16.png +0 -0
- package/console/favicon-light-32x32.png +0 -0
- package/console/favicon-light.ico +0 -0
- package/console/favicon-light.svg +11 -0
- package/console/favicon.ico +0 -0
- package/console/index.html +1 -0
- package/console/index.txt +28 -0
- package/console/invite/__placeholder__/__next._full.txt +33 -0
- package/console/invite/__placeholder__/__next._head.txt +6 -0
- package/console/invite/__placeholder__/__next._index.txt +17 -0
- package/console/invite/__placeholder__/__next._tree.txt +5 -0
- package/console/invite/__placeholder__/__next.invite.$d$token.__PAGE__.txt +6 -0
- package/console/invite/__placeholder__/__next.invite.$d$token.txt +5 -0
- package/console/invite/__placeholder__/__next.invite.txt +5 -0
- package/console/invite/__placeholder__.html +1 -0
- package/console/invite/__placeholder__.txt +33 -0
- package/console/library/__next._full.txt +33 -0
- package/console/library/__next._head.txt +6 -0
- package/console/library/__next._index.txt +17 -0
- package/console/library/__next._tree.txt +5 -0
- package/console/library/__next.library.__PAGE__.txt +6 -0
- package/console/library/__next.library.txt +7 -0
- package/console/library/agents/__next._full.txt +36 -0
- package/console/library/agents/__next._head.txt +6 -0
- package/console/library/agents/__next._index.txt +17 -0
- package/console/library/agents/__next._tree.txt +5 -0
- package/console/library/agents/__next.library.agents.__PAGE__.txt +6 -0
- package/console/library/agents/__next.library.agents.txt +5 -0
- package/console/library/agents/__next.library.txt +7 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next._full.txt +39 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.txt +5 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.txt +5 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.txt +5 -0
- package/console/library/agents/__placeholder__/__placeholder__/__next.library.txt +7 -0
- package/console/library/agents/__placeholder__/__placeholder__.html +1 -0
- package/console/library/agents/__placeholder__/__placeholder__.txt +39 -0
- package/console/library/agents/new/__next._full.txt +40 -0
- package/console/library/agents/new/__next._head.txt +6 -0
- package/console/library/agents/new/__next._index.txt +17 -0
- package/console/library/agents/new/__next._tree.txt +5 -0
- package/console/library/agents/new/__next.library.agents.new.__PAGE__.txt +9 -0
- package/console/library/agents/new/__next.library.agents.new.txt +5 -0
- package/console/library/agents/new/__next.library.agents.txt +5 -0
- package/console/library/agents/new/__next.library.txt +7 -0
- package/console/library/agents/new.html +1 -0
- package/console/library/agents/new.txt +40 -0
- package/console/library/agents.html +1 -0
- package/console/library/agents.txt +36 -0
- package/console/library/mcp-servers/__next._full.txt +36 -0
- package/console/library/mcp-servers/__next._head.txt +6 -0
- package/console/library/mcp-servers/__next._index.txt +17 -0
- package/console/library/mcp-servers/__next._tree.txt +5 -0
- package/console/library/mcp-servers/__next.library.mcp-servers.__PAGE__.txt +6 -0
- package/console/library/mcp-servers/__next.library.mcp-servers.txt +5 -0
- package/console/library/mcp-servers/__next.library.txt +7 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._full.txt +39 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.txt +5 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.txt +5 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.txt +5 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.txt +7 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__.html +1 -0
- package/console/library/mcp-servers/__placeholder__/__placeholder__.txt +39 -0
- package/console/library/mcp-servers/new/__next._full.txt +40 -0
- package/console/library/mcp-servers/new/__next._head.txt +6 -0
- package/console/library/mcp-servers/new/__next._index.txt +17 -0
- package/console/library/mcp-servers/new/__next._tree.txt +5 -0
- package/console/library/mcp-servers/new/__next.library.mcp-servers.new.__PAGE__.txt +9 -0
- package/console/library/mcp-servers/new/__next.library.mcp-servers.new.txt +5 -0
- package/console/library/mcp-servers/new/__next.library.mcp-servers.txt +5 -0
- package/console/library/mcp-servers/new/__next.library.txt +7 -0
- package/console/library/mcp-servers/new.html +1 -0
- package/console/library/mcp-servers/new.txt +40 -0
- package/console/library/mcp-servers.html +1 -0
- package/console/library/mcp-servers.txt +36 -0
- package/console/library/schedules/__next._full.txt +36 -0
- package/console/library/schedules/__next._head.txt +6 -0
- package/console/library/schedules/__next._index.txt +17 -0
- package/console/library/schedules/__next._tree.txt +5 -0
- package/console/library/schedules/__next.library.schedules.__PAGE__.txt +6 -0
- package/console/library/schedules/__next.library.schedules.txt +5 -0
- package/console/library/schedules/__next.library.txt +7 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next._full.txt +39 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.txt +5 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.txt +5 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.txt +5 -0
- package/console/library/schedules/__placeholder__/__placeholder__/__next.library.txt +7 -0
- package/console/library/schedules/__placeholder__/__placeholder__.html +1 -0
- package/console/library/schedules/__placeholder__/__placeholder__.txt +39 -0
- package/console/library/schedules/new/__next._full.txt +40 -0
- package/console/library/schedules/new/__next._head.txt +6 -0
- package/console/library/schedules/new/__next._index.txt +17 -0
- package/console/library/schedules/new/__next._tree.txt +5 -0
- package/console/library/schedules/new/__next.library.schedules.new.__PAGE__.txt +9 -0
- package/console/library/schedules/new/__next.library.schedules.new.txt +5 -0
- package/console/library/schedules/new/__next.library.schedules.txt +5 -0
- package/console/library/schedules/new/__next.library.txt +7 -0
- package/console/library/schedules/new.html +1 -0
- package/console/library/schedules/new.txt +40 -0
- package/console/library/schedules.html +1 -0
- package/console/library/schedules.txt +36 -0
- package/console/library/skills/__next._full.txt +36 -0
- package/console/library/skills/__next._head.txt +6 -0
- package/console/library/skills/__next._index.txt +17 -0
- package/console/library/skills/__next._tree.txt +5 -0
- package/console/library/skills/__next.library.skills.__PAGE__.txt +6 -0
- package/console/library/skills/__next.library.skills.txt +5 -0
- package/console/library/skills/__next.library.txt +7 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next._full.txt +39 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.txt +5 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.txt +5 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.txt +5 -0
- package/console/library/skills/__placeholder__/__placeholder__/__next.library.txt +7 -0
- package/console/library/skills/__placeholder__/__placeholder__.html +1 -0
- package/console/library/skills/__placeholder__/__placeholder__.txt +39 -0
- package/console/library/skills/new/__next._full.txt +40 -0
- package/console/library/skills/new/__next._head.txt +6 -0
- package/console/library/skills/new/__next._index.txt +17 -0
- package/console/library/skills/new/__next._tree.txt +5 -0
- package/console/library/skills/new/__next.library.skills.new.__PAGE__.txt +9 -0
- package/console/library/skills/new/__next.library.skills.new.txt +5 -0
- package/console/library/skills/new/__next.library.skills.txt +5 -0
- package/console/library/skills/new/__next.library.txt +7 -0
- package/console/library/skills/new.html +1 -0
- package/console/library/skills/new.txt +40 -0
- package/console/library/skills.html +1 -0
- package/console/library/skills.txt +36 -0
- package/console/library/workflows/__next._full.txt +36 -0
- package/console/library/workflows/__next._head.txt +6 -0
- package/console/library/workflows/__next._index.txt +17 -0
- package/console/library/workflows/__next._tree.txt +5 -0
- package/console/library/workflows/__next.library.txt +7 -0
- package/console/library/workflows/__next.library.workflows.__PAGE__.txt +6 -0
- package/console/library/workflows/__next.library.workflows.txt +5 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next._full.txt +39 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.txt +7 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.txt +5 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.txt +5 -0
- package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.txt +5 -0
- package/console/library/workflows/__placeholder__/__placeholder__.html +1 -0
- package/console/library/workflows/__placeholder__/__placeholder__.txt +39 -0
- package/console/library/workflows/executions/__next._full.txt +37 -0
- package/console/library/workflows/executions/__next._head.txt +6 -0
- package/console/library/workflows/executions/__next._index.txt +17 -0
- package/console/library/workflows/executions/__next._tree.txt +5 -0
- package/console/library/workflows/executions/__next.library.txt +7 -0
- package/console/library/workflows/executions/__next.library.workflows.executions.__PAGE__.txt +6 -0
- package/console/library/workflows/executions/__next.library.workflows.executions.txt +5 -0
- package/console/library/workflows/executions/__next.library.workflows.txt +5 -0
- package/console/library/workflows/executions.html +1 -0
- package/console/library/workflows/executions.txt +37 -0
- package/console/library/workflows/new/__next._full.txt +40 -0
- package/console/library/workflows/new/__next._head.txt +6 -0
- package/console/library/workflows/new/__next._index.txt +17 -0
- package/console/library/workflows/new/__next._tree.txt +5 -0
- package/console/library/workflows/new/__next.library.txt +7 -0
- package/console/library/workflows/new/__next.library.workflows.new.__PAGE__.txt +9 -0
- package/console/library/workflows/new/__next.library.workflows.new.txt +5 -0
- package/console/library/workflows/new/__next.library.workflows.txt +5 -0
- package/console/library/workflows/new.html +1 -0
- package/console/library/workflows/new.txt +40 -0
- package/console/library/workflows.html +1 -0
- package/console/library/workflows.txt +36 -0
- package/console/library.html +1 -0
- package/console/library.txt +33 -0
- package/console/login/__next._full.txt +35 -0
- package/console/login/__next._head.txt +6 -0
- package/console/login/__next._index.txt +17 -0
- package/console/login/__next._tree.txt +5 -0
- package/console/login/__next.login.__PAGE__.txt +9 -0
- package/console/login/__next.login.txt +5 -0
- package/console/login.html +1 -0
- package/console/login.txt +35 -0
- package/console/logo.svg +1 -0
- package/console/oauth/slack/callback/__next._full.txt +37 -0
- package/console/oauth/slack/callback/__next._head.txt +6 -0
- package/console/oauth/slack/callback/__next._index.txt +17 -0
- package/console/oauth/slack/callback/__next._tree.txt +5 -0
- package/console/oauth/slack/callback/__next.oauth.slack.callback.__PAGE__.txt +9 -0
- package/console/oauth/slack/callback/__next.oauth.slack.callback.txt +5 -0
- package/console/oauth/slack/callback/__next.oauth.slack.txt +5 -0
- package/console/oauth/slack/callback/__next.oauth.txt +5 -0
- package/console/oauth/slack/callback.html +1 -0
- package/console/oauth/slack/callback.txt +37 -0
- package/console/sessions/__placeholder__/__next._full.txt +32 -0
- package/console/sessions/__placeholder__/__next._head.txt +6 -0
- package/console/sessions/__placeholder__/__next._index.txt +17 -0
- package/console/sessions/__placeholder__/__next._tree.txt +5 -0
- package/console/sessions/__placeholder__/__next.sessions.$d$id.__PAGE__.txt +5 -0
- package/console/sessions/__placeholder__/__next.sessions.$d$id.txt +5 -0
- package/console/sessions/__placeholder__/__next.sessions.txt +5 -0
- package/console/sessions/__placeholder__.html +1 -0
- package/console/sessions/__placeholder__.txt +32 -0
- package/console/settings/__next._full.txt +35 -0
- package/console/settings/__next._head.txt +6 -0
- package/console/settings/__next._index.txt +17 -0
- package/console/settings/__next._tree.txt +5 -0
- package/console/settings/__next.settings.__PAGE__.txt +9 -0
- package/console/settings/__next.settings.txt +6 -0
- package/console/settings/account-preferences/__next._full.txt +35 -0
- package/console/settings/account-preferences/__next._head.txt +6 -0
- package/console/settings/account-preferences/__next._index.txt +17 -0
- package/console/settings/account-preferences/__next._tree.txt +5 -0
- package/console/settings/account-preferences/__next.settings.account-preferences.__PAGE__.txt +6 -0
- package/console/settings/account-preferences/__next.settings.account-preferences.txt +5 -0
- package/console/settings/account-preferences/__next.settings.txt +6 -0
- package/console/settings/account-preferences.html +1 -0
- package/console/settings/account-preferences.txt +35 -0
- package/console/settings/api-keys/__next._full.txt +35 -0
- package/console/settings/api-keys/__next._head.txt +6 -0
- package/console/settings/api-keys/__next._index.txt +17 -0
- package/console/settings/api-keys/__next._tree.txt +5 -0
- package/console/settings/api-keys/__next.settings.api-keys.__PAGE__.txt +6 -0
- package/console/settings/api-keys/__next.settings.api-keys.txt +5 -0
- package/console/settings/api-keys/__next.settings.txt +6 -0
- package/console/settings/api-keys.html +1 -0
- package/console/settings/api-keys.txt +35 -0
- package/console/settings/billing/__next._full.txt +38 -0
- package/console/settings/billing/__next._head.txt +6 -0
- package/console/settings/billing/__next._index.txt +17 -0
- package/console/settings/billing/__next._tree.txt +5 -0
- package/console/settings/billing/__next.settings.billing.__PAGE__.txt +9 -0
- package/console/settings/billing/__next.settings.billing.txt +5 -0
- package/console/settings/billing/__next.settings.txt +6 -0
- package/console/settings/billing.html +1 -0
- package/console/settings/billing.txt +38 -0
- package/console/settings/channel-apps/__next._full.txt +35 -0
- package/console/settings/channel-apps/__next._head.txt +6 -0
- package/console/settings/channel-apps/__next._index.txt +17 -0
- package/console/settings/channel-apps/__next._tree.txt +5 -0
- package/console/settings/channel-apps/__next.settings.channel-apps.__PAGE__.txt +6 -0
- package/console/settings/channel-apps/__next.settings.channel-apps.txt +5 -0
- package/console/settings/channel-apps/__next.settings.txt +6 -0
- package/console/settings/channel-apps.html +1 -0
- package/console/settings/channel-apps.txt +35 -0
- package/console/settings/cursor-accounts/__next._full.txt +38 -0
- package/console/settings/cursor-accounts/__next._head.txt +6 -0
- package/console/settings/cursor-accounts/__next._index.txt +17 -0
- package/console/settings/cursor-accounts/__next._tree.txt +5 -0
- package/console/settings/cursor-accounts/__next.settings.cursor-accounts.__PAGE__.txt +9 -0
- package/console/settings/cursor-accounts/__next.settings.cursor-accounts.txt +5 -0
- package/console/settings/cursor-accounts/__next.settings.txt +6 -0
- package/console/settings/cursor-accounts.html +1 -0
- package/console/settings/cursor-accounts.txt +38 -0
- package/console/settings/environments/__next._full.txt +35 -0
- package/console/settings/environments/__next._head.txt +6 -0
- package/console/settings/environments/__next._index.txt +17 -0
- package/console/settings/environments/__next._tree.txt +5 -0
- package/console/settings/environments/__next.settings.environments.__PAGE__.txt +6 -0
- package/console/settings/environments/__next.settings.environments.txt +5 -0
- package/console/settings/environments/__next.settings.txt +6 -0
- package/console/settings/environments.html +1 -0
- package/console/settings/environments.txt +35 -0
- package/console/settings/identity-providers/__next._full.txt +35 -0
- package/console/settings/identity-providers/__next._head.txt +6 -0
- package/console/settings/identity-providers/__next._index.txt +17 -0
- package/console/settings/identity-providers/__next._tree.txt +5 -0
- package/console/settings/identity-providers/__next.settings.identity-providers.__PAGE__.txt +6 -0
- package/console/settings/identity-providers/__next.settings.identity-providers.txt +5 -0
- package/console/settings/identity-providers/__next.settings.txt +6 -0
- package/console/settings/identity-providers.html +1 -0
- package/console/settings/identity-providers.txt +35 -0
- package/console/settings/invitations/__next._full.txt +35 -0
- package/console/settings/invitations/__next._head.txt +6 -0
- package/console/settings/invitations/__next._index.txt +17 -0
- package/console/settings/invitations/__next._tree.txt +5 -0
- package/console/settings/invitations/__next.settings.invitations.__PAGE__.txt +6 -0
- package/console/settings/invitations/__next.settings.invitations.txt +5 -0
- package/console/settings/invitations/__next.settings.txt +6 -0
- package/console/settings/invitations.html +1 -0
- package/console/settings/invitations.txt +35 -0
- package/console/settings/members/__next._full.txt +35 -0
- package/console/settings/members/__next._head.txt +6 -0
- package/console/settings/members/__next._index.txt +17 -0
- package/console/settings/members/__next._tree.txt +5 -0
- package/console/settings/members/__next.settings.members.__PAGE__.txt +6 -0
- package/console/settings/members/__next.settings.members.txt +5 -0
- package/console/settings/members/__next.settings.txt +6 -0
- package/console/settings/members.html +1 -0
- package/console/settings/members.txt +35 -0
- package/console/settings/memory/__next._full.txt +35 -0
- package/console/settings/memory/__next._head.txt +6 -0
- package/console/settings/memory/__next._index.txt +17 -0
- package/console/settings/memory/__next._tree.txt +5 -0
- package/console/settings/memory/__next.settings.memory.__PAGE__.txt +6 -0
- package/console/settings/memory/__next.settings.memory.txt +5 -0
- package/console/settings/memory/__next.settings.txt +6 -0
- package/console/settings/memory.html +1 -0
- package/console/settings/memory.txt +35 -0
- package/console/settings/oauth-apps/__next._full.txt +35 -0
- package/console/settings/oauth-apps/__next._head.txt +6 -0
- package/console/settings/oauth-apps/__next._index.txt +17 -0
- package/console/settings/oauth-apps/__next._tree.txt +5 -0
- package/console/settings/oauth-apps/__next.settings.oauth-apps.__PAGE__.txt +6 -0
- package/console/settings/oauth-apps/__next.settings.oauth-apps.txt +5 -0
- package/console/settings/oauth-apps/__next.settings.txt +6 -0
- package/console/settings/oauth-apps.html +1 -0
- package/console/settings/oauth-apps.txt +35 -0
- package/console/settings/org-preferences/__next._full.txt +35 -0
- package/console/settings/org-preferences/__next._head.txt +6 -0
- package/console/settings/org-preferences/__next._index.txt +17 -0
- package/console/settings/org-preferences/__next._tree.txt +5 -0
- package/console/settings/org-preferences/__next.settings.org-preferences.__PAGE__.txt +6 -0
- package/console/settings/org-preferences/__next.settings.org-preferences.txt +5 -0
- package/console/settings/org-preferences/__next.settings.txt +6 -0
- package/console/settings/org-preferences.html +1 -0
- package/console/settings/org-preferences.txt +35 -0
- package/console/settings/org-profile/__next._full.txt +35 -0
- package/console/settings/org-profile/__next._head.txt +6 -0
- package/console/settings/org-profile/__next._index.txt +17 -0
- package/console/settings/org-profile/__next._tree.txt +5 -0
- package/console/settings/org-profile/__next.settings.org-profile.__PAGE__.txt +6 -0
- package/console/settings/org-profile/__next.settings.org-profile.txt +5 -0
- package/console/settings/org-profile/__next.settings.txt +6 -0
- package/console/settings/org-profile.html +1 -0
- package/console/settings/org-profile.txt +35 -0
- package/console/settings/platform-clients/__next._full.txt +35 -0
- package/console/settings/platform-clients/__next._head.txt +6 -0
- package/console/settings/platform-clients/__next._index.txt +17 -0
- package/console/settings/platform-clients/__next._tree.txt +5 -0
- package/console/settings/platform-clients/__next.settings.platform-clients.__PAGE__.txt +6 -0
- package/console/settings/platform-clients/__next.settings.platform-clients.txt +5 -0
- package/console/settings/platform-clients/__next.settings.txt +6 -0
- package/console/settings/platform-clients.html +1 -0
- package/console/settings/platform-clients.txt +35 -0
- package/console/settings/pricing-governance/__next._full.txt +38 -0
- package/console/settings/pricing-governance/__next._head.txt +6 -0
- package/console/settings/pricing-governance/__next._index.txt +17 -0
- package/console/settings/pricing-governance/__next._tree.txt +5 -0
- package/console/settings/pricing-governance/__next.settings.pricing-governance.__PAGE__.txt +9 -0
- package/console/settings/pricing-governance/__next.settings.pricing-governance.txt +5 -0
- package/console/settings/pricing-governance/__next.settings.txt +6 -0
- package/console/settings/pricing-governance.html +1 -0
- package/console/settings/pricing-governance.txt +38 -0
- package/console/settings/provider-standing/__next._full.txt +38 -0
- package/console/settings/provider-standing/__next._head.txt +6 -0
- package/console/settings/provider-standing/__next._index.txt +17 -0
- package/console/settings/provider-standing/__next._tree.txt +5 -0
- package/console/settings/provider-standing/__next.settings.provider-standing.__PAGE__.txt +9 -0
- package/console/settings/provider-standing/__next.settings.provider-standing.txt +5 -0
- package/console/settings/provider-standing/__next.settings.txt +6 -0
- package/console/settings/provider-standing.html +1 -0
- package/console/settings/provider-standing.txt +38 -0
- package/console/settings/usage/__next._full.txt +35 -0
- package/console/settings/usage/__next._head.txt +6 -0
- package/console/settings/usage/__next._index.txt +17 -0
- package/console/settings/usage/__next._tree.txt +5 -0
- package/console/settings/usage/__next.settings.txt +6 -0
- package/console/settings/usage/__next.settings.usage.__PAGE__.txt +6 -0
- package/console/settings/usage/__next.settings.usage.txt +5 -0
- package/console/settings/usage.html +1 -0
- package/console/settings/usage.txt +35 -0
- package/console/settings.html +1 -0
- package/console/settings.txt +35 -0
- package/console/workflows/__next._full.txt +32 -0
- package/console/workflows/__next._head.txt +6 -0
- package/console/workflows/__next._index.txt +17 -0
- package/console/workflows/__next._tree.txt +5 -0
- package/console/workflows/__next.workflows.__PAGE__.txt +6 -0
- package/console/workflows/__next.workflows.txt +5 -0
- package/console/workflows/__placeholder__/__placeholder__/__next._full.txt +35 -0
- package/console/workflows/__placeholder__/__placeholder__/__next._head.txt +6 -0
- package/console/workflows/__placeholder__/__placeholder__/__next._index.txt +17 -0
- package/console/workflows/__placeholder__/__placeholder__/__next._tree.txt +5 -0
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.__PAGE__.txt +6 -0
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.txt +5 -0
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.txt +5 -0
- package/console/workflows/__placeholder__/__placeholder__/__next.workflows.txt +5 -0
- package/console/workflows/__placeholder__/__placeholder__.html +1 -0
- package/console/workflows/__placeholder__/__placeholder__.txt +35 -0
- package/console/workflows/executions/__next._full.txt +33 -0
- package/console/workflows/executions/__next._head.txt +6 -0
- package/console/workflows/executions/__next._index.txt +17 -0
- package/console/workflows/executions/__next._tree.txt +5 -0
- package/console/workflows/executions/__next.workflows.executions.__PAGE__.txt +6 -0
- package/console/workflows/executions/__next.workflows.executions.txt +5 -0
- package/console/workflows/executions/__next.workflows.txt +5 -0
- package/console/workflows/executions/__placeholder__/__next._full.txt +34 -0
- package/console/workflows/executions/__placeholder__/__next._head.txt +6 -0
- package/console/workflows/executions/__placeholder__/__next._index.txt +17 -0
- package/console/workflows/executions/__placeholder__/__next._tree.txt +5 -0
- package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.__PAGE__.txt +6 -0
- package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.txt +5 -0
- package/console/workflows/executions/__placeholder__/__next.workflows.executions.txt +5 -0
- package/console/workflows/executions/__placeholder__/__next.workflows.txt +5 -0
- package/console/workflows/executions/__placeholder__.html +1 -0
- package/console/workflows/executions/__placeholder__.txt +34 -0
- package/console/workflows/executions.html +1 -0
- package/console/workflows/executions.txt +33 -0
- package/console/workflows.html +1 -0
- package/console/workflows.txt +32 -0
- package/main.js +1138 -0
- package/mappings.wasm +0 -0
- package/package.json +25 -0
- package/workflow-bundle-agent-execution.js +31729 -0
- package/workflow-bundle-schedule.js +11315 -0
- package/workflow-bundle-workflow-execution.js +29297 -0
- package/workflow-worker-thread.cjs +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,695749,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(893976),a=e.i(468806),n=e.i(661438),o=e.i(610595),l=e.i(59309),i=e.i(28434),d=e.i(375954),g=e.i(574803),c=e.i(796545),u=e.i(839329);let m={org:"",slug:"workflow-architect"};var h=e.i(226634),p=e.i(379410),f=e.i(193799);e.s(["WorkflowExplainDialog",0,function({open:e,onOpenChange:x,org:v,currentYaml:b}){let y=function(e){let{org:t,currentYaml:r,onError:a}=e,[h,p]=(0,s.useState)("idle"),[f,x]=(0,s.useState)(null),[v,b]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),j=(0,s.useRef)(t);j.current=t;let N=(0,s.useRef)(r);N.current=r;let C=(0,s.useRef)(a);C.current=a;let w=(0,s.useRef)(!1),{create:_}=(0,l.useCreateSession)(),{create:S}=(0,i.useCreateAgentExecution)(),E=(0,c.useConversationStoreRef)(),T=(0,d.useExecutionStream)(f,{store:E});(0,s.useEffect)(()=>{if("streaming"===h&&T.phase!==n.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED&&(0,g.isTerminalPhase)(T.phase)&&!w.current){w.current=!0;let e=T.execution?.status?.structuredOutput;e?.explanation&&b(e.explanation),p("complete"),x(null)}},[h,T.phase,T.execution]),(0,s.useEffect)(()=>{if(T.error&&"streaming"===h){let e=(0,o.getUserMessage)(T.error,"Agent stream interrupted");p("error"),k(e),C.current?.(e)}},[T.error,h]);let M=(0,s.useCallback)(async()=>{if("idle"===h||"error"===h||"complete"===h){p("starting"),k(null),b(null),w.current=!1;try{let{sessionId:e}=await _({org:j.current,agentRef:{...m,org:j.current}}),t="Please explain the following workflow in plain language. Describe what each task does, how data flows between them, and any branching or error handling logic. Do NOT suggest any changes — just explain what it does.\n\n```yaml\n"+N.current+"\n```",{executionId:s}=await S({org:j.current,sessionId:e,message:t,structuredOutputSchema:u.WORKFLOW_ARCHITECT_RESPONSE_SCHEMA});x(s),p("streaming")}catch(t){let e=(0,o.getUserMessage)(t,"Failed to start the Workflow Architect agent");p("error"),k(e),C.current?.(e)}}},[h,_,S]),I=(0,s.useCallback)(()=>{p("idle"),x(null),b(null),k(null),w.current=!1},[]);return(0,s.useMemo)(()=>({phase:h,explanation:v,execution:T.execution,isStreaming:T.isStreaming||T.isConnecting,error:y,explain:M,reset:I}),[h,v,T.execution,T.isStreaming,T.isConnecting,y,M,I])}({org:v,currentYaml:b,onError:()=>{}});(0,s.useEffect)(()=>{e&&(y.reset(),y.explain())},[e,y.reset,y.explain]);let{copy:k,copied:j}=(0,f.useCopyFeedback)(),N=(0,s.useCallback)(()=>{y.explanation&&k(y.explanation)},[k,y.explanation]);return(0,t.jsx)(a.DialogShell,{open:e,onOpenChange:x,width:"2xl",dismissOnBackdrop:!0,"aria-label":"Workflow Explanation",children:(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:border-b stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsx)("h3",{className:"stg:text-base stg:font-semibold stg:text-foreground",children:"Workflow Explanation"}),y.isStreaming&&(0,t.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)(p.SpinnerIcon,{size:14}),"Analyzing…"]})]}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:"A plain-language walkthrough of what this workflow does"})]}),(0,t.jsxs)("div",{className:"stg:max-h-[60vh] stg:overflow-y-auto stg:px-6 stg:py-4",children:["starting"===y.phase&&(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:py-8",children:[(0,t.jsx)(p.SpinnerIcon,{size:20}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-muted-foreground",children:"Starting Workflow Architect…"})]}),"streaming"===y.phase&&y.execution&&(0,t.jsx)(h.MessageThread,{executions:[],activeStreamExecution:y.execution,className:"stg:min-h-[100px]"}),"complete"===y.phase&&y.explanation&&(0,t.jsx)("div",{className:"stg:whitespace-pre-wrap stg:text-sm stg:leading-relaxed stg:text-foreground",children:y.explanation}),"complete"===y.phase&&!y.explanation&&y.execution&&(0,t.jsx)(h.MessageThread,{executions:[y.execution],activeStreamExecution:null,className:"stg:min-h-[100px]"}),y.error&&"error"===y.phase&&(0,t.jsx)("div",{className:"stg:rounded-md stg:border stg:border-destructive/30 stg:bg-destructive/5 stg:px-3 stg:py-2 stg:text-sm stg:text-destructive",role:"alert",children:y.error})]}),(0,t.jsxs)("div",{className:"stg:flex stg:justify-between stg:border-t stg:border-border stg:px-6 stg:py-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>x(!1),className:(0,r.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium stg:transition-colors","stg:border stg:border-input stg:bg-background stg:text-foreground","stg:hover:bg-accent stg:hover:text-accent-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Close"}),(0,t.jsxs)("div",{className:"stg:flex stg:gap-2",children:["error"===y.phase&&(0,t.jsx)("button",{type:"button",onClick:y.explain,className:(0,r.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium stg:transition-colors","stg:border stg:border-input stg:bg-background stg:text-foreground","stg:hover:bg-accent stg:hover:text-accent-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Try Again"}),"complete"===y.phase&&y.explanation&&(0,t.jsx)("button",{type:"button",onClick:N,className:(0,r.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary/90","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:j?"Copied":"Copy to clipboard"})]})]})]})})}],695749)},23621,571471,622968,644223,967341,e=>{"use strict";var t=e.i(271645);e.i(222258);var s=e.i(967785),r=e.i(58039),a=e.i(207425);let n=new Set(["set_vars","http_call","grpc_call","activity_call","switch_case","for_each","fork","try_catch","listen","wait","raise_error","run_workflow","agent_call","llm_call","transform","human_input","validate","emit_event","notification","eval"]);function o(e,t){for(let s of e.items)if((0,r.isScalar)(s.key)&&s.key.value===t)return s}function l(e,t){let s=o(e,t);return s?.value??void 0}function i(e,t){let s=l(e,t);if((0,r.isScalar)(s)&&"string"==typeof s.value)return s.value}function d(e,t){if(e&&"object"==typeof e&&"range"in e){let s=e.range;if(s)return[s[0],Math.min(s[1],t.length)]}return[0,Math.min(t.length,1)]}function g(e,t){let s=d(e.key,t),r=d(e.value,t);return[s[0],Math.max(r[1],s[1])]}function c(e,t,s,r,a){let n=o(e,t);if(n){let e=g(n,s);return{from:e[0],to:e[1],severity:r,message:a}}let l=d(e,s);return{from:l[0],to:Math.min(l[0]+1,s.length),severity:r,message:a}}var u=e.i(455959);let m={nodes:[],edges:[]};var h=e.i(586108),p=e.i(521557),f=e.i(926059),x=e.i(264014);e.s(["useWorkflowEditor",0,function(e,v){let[b,y]=(0,t.useState)(e),[k,j]=(0,t.useState)(""),N=(0,t.useRef)(e),{diagnostics:C}=function(e,u){let[m,h]=(0,t.useState)([]),p=(0,t.useRef)(null),f=(0,t.useRef)(u);return f.current=u,(0,t.useEffect)(()=>(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{h(function(e,t){let u;if(!e.trim())return[];let m=[];try{u=(0,s.parseDocument)(e,{keepSourceTokens:!0})}catch{return m.push({from:0,to:Math.min(e.length,1),severity:"error",message:"Invalid YAML syntax"}),m}for(let e of u.errors){let[t,s]=e.pos??[0,1];m.push({from:t,to:Math.max(s,t+1),severity:"error",message:e.message})}if(m.length>0)return m;let h=u.contents;return(0,r.isMap)(h)?(function(e,t,s){let a=l(e,"spec");if(!a||!(0,r.isMap)(a))return t.push(c(e,"spec",s,"error","Missing required field: spec"));let n=l(a,"document");if(n&&(0,r.isMap)(n))for(let e of["namespace","name","version"])i(n,e)||t.push(c(n,e,s,"error",`Missing required field: spec.document.${e}`));else t.push(c(a,"document",s,"error","Missing required field: spec.document"));let o=l(a,"tasks");o&&(0,r.isSeq)(o)&&0!==o.items.length||t.push(c(a,"tasks",s,"error","Missing required field: spec.tasks (must be a non-empty list)"))}(h,m,e),function(e,t,s){let u=l(e,"spec");if(!u||!(0,r.isMap)(u))return;let m=l(u,"tasks");if(!m||!(0,r.isSeq)(m))return;let h=new Set,p=[];for(let e of m.items){if(!(0,r.isMap)(e))continue;let u=o(e,"name"),m=i(e,"name"),f=i(e,"kind");if(!m){let r=d(e,s);t.push({from:r[0],to:r[1],severity:"error",message:"Task is missing required field: name"});continue}if(!a.TASK_NAME_PATTERN.test(m)){let r=u?g(u,s):d(e,s);t.push({from:r[0],to:r[1],severity:"error",message:`Task name "${m}": ${a.TASK_NAME_PATTERN_ERROR}`})}if(h.has(m)){let r=u?g(u,s):d(e,s);t.push({from:r[0],to:r[1],severity:"warning",message:`Duplicate task name: "${m}"`})}if(h.add(m),p.push(m),!f){let r=d(e,s);t.push({from:r[0],to:r[1],severity:"error",message:`Task "${m}" is missing required field: kind`});continue}if(!n.has(f)){let r=o(e,"kind"),a=r?g(r,s):d(e,s);t.push({from:a[0],to:a[1],severity:"error",message:`Task "${m}" has unknown kind: "${f}"`});continue}let x=l(e,"task_config")??l(e,"taskConfig");if(x&&(0,r.isMap)(x))"eval"===f&&function(e,t,s,a){for(let r of["model","subject","rubric"])i(e,r)||s.push(c(e,r,a,"error",`Eval task "${t}" is missing required field: ${r}`));let n=l(e,"threshold");if(n&&(0,r.isScalar)(n)){let r=Number(n.value);if(!Number.isFinite(r)||r<0||r>1){let r=o(e,"threshold"),n=r?g(r,a):d(e,a);s.push({from:n[0],to:n[1],severity:"error",message:`Eval task "${t}": threshold must be between 0.0 and 1.0`})}}}(x,m,t,s);else{let r=d(e,s);t.push({from:r[0],to:r[1],severity:"error",message:`Task "${m}" is missing required field: task_config`})}}for(let e of m.items){if(!(0,r.isMap)(e))continue;let a=i(e,"name");a&&function(e,t,s,a,n){let c=l(e,"flow");if(!c||!(0,r.isMap)(c))return;let u=i(c,"then");if(u&&"end"!==u&&!s.has(u)){let e=o(c,"then"),s=e?g(e,n):d(c,n);a.push({from:s[0],to:s[1],severity:"warning",message:`Task "${t}" flow.then references unknown task "${u}"`})}}(e,a,h,t,s)}}(h,m,e)):m.push({from:0,to:Math.min(e.length,1),severity:"error",message:"Workflow YAML must be a mapping document"}),m}(e,f.current))},150),()=>{p.current&&clearTimeout(p.current)}),[e]),(0,t.useMemo)(()=>({diagnostics:m}),[m])}(b,(0,x.useTaskKindRegistry)()),w=(0,t.useMemo)(()=>{if(!b?.trim())return m;try{return function(e){let t;try{t=(0,s.parse)(e)}catch{return m}if(!t||"object"!=typeof t||Array.isArray(t))return m;let r=t.spec;if(!r)return m;let a=r.tasks;if(!Array.isArray(a)||0===a.length)return m;let n=a.filter(e=>null!=e&&"object"==typeof e&&"string"==typeof e.name);if(0===n.length)return m;let o=[],l=[],i=new Set(n.map(e=>e.name));for(let e of(o.push({id:"__start__",label:"Start",kind:"start",category:"start",x:0,y:0,width:180,height:40}),n))o.push({id:e.name,label:e.name,kind:e.kind||"unspecified",category:(0,u.categorizeKind)(e.kind),x:0,y:0,width:180,height:40});l.push({source:"__start__",target:n[0].name});let d=new Set;for(let e=0;e<n.length;e++){let t=n[e],s=t.flow?.then;if("end"===s){d.add(t.name);continue}if(s&&i.has(s)){l.push({source:t.name,target:s});continue}let r=t.task_config??t.taskConfig;if("switch_case"===t.kind&&r){let s=r.cases;if(Array.isArray(s)){let r=!1;for(let e of s)if(e&&"object"==typeof e){let s=e.then;s&&i.has(s)&&(l.push({source:t.name,target:s,label:e.name||void 0}),e.when||(r=!0))}!r&&e<n.length-1&&l.push({source:t.name,target:n[e+1].name});continue}}e<n.length-1?l.push({source:t.name,target:n[e+1].name}):d.add(t.name)}if(d.size>0)for(let e of(o.push({id:"__end__",label:"End",kind:"end",category:"end",x:0,y:0,width:180,height:40}),d))l.push({source:e,target:"__end__"});return{nodes:o,edges:l}}(b)}catch{return m}},[b]),{save:_,isSaving:S,error:E}=function(e){let s=(0,h.useStigmer)(),[r,a]=(0,t.useState)(!1),[n,o]=(0,t.useState)(null),l=(0,t.useRef)(e);l.current=e;let i=(0,t.useCallback)(async(e,t)=>{a(!0),o(null);try{let r=(0,f.parseWorkflowYaml)(e,l.current);return t?.versionMessage&&(r.versionMessage=t.versionMessage),await s.workflow.apply(r),!0}catch(t){let e=t instanceof Error?t:Error(String(t));return(0,p.isUnimplemented)(t)?o(Error("Workflow save is not yet available on this server. The workflow was validated locally but could not be persisted.")):o(e),!1}finally{a(!1)}},[s]);return(0,t.useMemo)(()=>({save:i,isSaving:r,error:n}),[i,r,n])}(v.org),T=b!==N.current,M=(0,t.useCallback)(async()=>{let e=k.trim()?{versionMessage:k.trim()}:void 0,t=await _(b,e);return t&&(N.current=b,j("")),t},[_,b,k]),I=(0,t.useCallback)(()=>{y(N.current)},[]),A=(0,t.useMemo)(()=>C.filter(e=>"error"===e.severity).length,[C]),D=(0,t.useMemo)(()=>C.filter(e=>"warning"===e.severity).length,[C]);return(0,t.useMemo)(()=>({yaml:b,setYaml:y,diagnostics:C,isDirty:T,isSaving:S,saveError:E,save:M,reset:I,topology:w,errorCount:A,warningCount:D,versionMessage:k,setVersionMessage:j}),[b,y,C,T,S,E,M,I,w,A,D,k,j])}],23621);var v=e.i(573732);e.s(["WorkflowYamlEditor",()=>v.YamlEditor],571471);var b=e.i(843476),y=e.i(154548),k=e.i(30590),j=e.i(893976),N=e.i(882267),C=e.i(144905),w=e.i(714028),_=e.i(286872),S=e.i(678321);let E={[w.CANVAS_TASK_NODE_TYPE]:N.WorkflowNode},T={[w.CANVAS_TRANSITION_EDGE_TYPE]:C.CanvasTransitionEdge},M={markerEnd:{type:k.MarkerType.ArrowClosed,width:16,height:16}},I=(0,t.memo)(function(e){return(0,b.jsx)(y.ReactFlowProvider,{children:(0,b.jsx)(A,{...e})})});function A({yaml:e,className:s}){var r;let{nodes:a,edges:n}=(r=e,(0,t.useMemo)(()=>{if(!r?.trim())return{nodes:[],edges:[]};try{let e=(0,w.yamlToGraph)(r),t=(0,_.applyDagreLayout)(e);return(0,w.toReactFlowElements)(t)}catch{return{nodes:[],edges:[]}}},[r])),{fitView:o}=(0,y.useReactFlow)(),l=(0,t.useRef)(!1),i=(0,t.useRef)(0);return((0,t.useEffect)(()=>{a.length>0&&a.length!==i.current?(i.current=a.length,setTimeout(()=>o({padding:.15,duration:200}),50)):a.length>0&&!l.current&&(l.current=!0,setTimeout(()=>o({padding:.15,duration:200}),50))},[a.length,o]),e?.trim()&&0!==a.length)?(0,b.jsx)(S.WorkflowGraphModeProvider,{mode:"overview",children:(0,b.jsx)("div",{className:(0,j.cn)("stg:h-full stg:w-full",s),children:(0,b.jsxs)(y.ReactFlow,{nodes:a,edges:n,nodeTypes:E,edgeTypes:T,defaultEdgeOptions:M,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,zoomOnScroll:!0,fitView:!1,minZoom:.2,maxZoom:2,proOptions:{hideAttribution:!0},children:[(0,b.jsx)(y.Background,{variant:y.BackgroundVariant.Dots,gap:16,size:1}),(0,b.jsx)(y.Controls,{showInteractive:!1}),(0,b.jsx)(y.MiniMap,{pannable:!0,zoomable:!0})]})})}):(0,b.jsx)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:items-center stg:justify-center stg:text-sm stg:text-[var(--stgm-muted-foreground,#737373)]",s),children:"No tasks to visualize"})}e.s(["WorkflowCodePreviewGraph",0,I],622968);var D=e.i(242792);let R="application/stigmer-task-kind",$=(0,t.memo)(function({className:e}){let{categories:s,isLoading:r,error:n,refetch:o}=(0,x.useTaskKindRegistry)(),[l,i]=(0,t.useState)(""),[d,g]=(0,t.useState)(new Set),c=(0,t.useCallback)(e=>{i(e.target.value)},[]),u=(0,t.useCallback)(e=>{g(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),m=(0,t.useMemo)(()=>{let e=l.toLowerCase().trim(),t=[];for(let r of a.CATEGORY_ORDER){let a=s.get(r);if(!a||0===a.length)continue;let n=e?a.filter(t=>t.displayName.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)):a;n.length>0&&t.push({category:r,descriptors:n})}return t},[s,l]);return r?(0,b.jsx)("div",{className:(0,j.cn)("stgm stg:flex stg:w-60 stg:flex-col stg:gap-3 stg:border-r stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))] stg:p-3",e),children:Array.from({length:4}).map((e,t)=>(0,b.jsxs)("div",{className:"stg:space-y-2",children:[(0,b.jsx)("div",{className:"stg:h-4 stg:w-20 stg:animate-pulse stg:rounded stg:bg-[var(--stgm-muted,#f5f5f5)]"}),(0,b.jsx)("div",{className:"stg:h-10 stg:w-full stg:animate-pulse stg:rounded stg:bg-[var(--stgm-muted,#f5f5f5)]"}),(0,b.jsx)("div",{className:"stg:h-10 stg:w-full stg:animate-pulse stg:rounded stg:bg-[var(--stgm-muted,#f5f5f5)]"})]},t))}):n?(0,b.jsxs)("div",{className:(0,j.cn)("stgm stg:flex stg:w-60 stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:border-r stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))] stg:p-4",e),children:[(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-destructive,#ef4444)]",children:"Failed to load task types"}),(0,b.jsx)("button",{type:"button",onClick:o,className:"stg:rounded stg:border stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))] stg:px-2 stg:py-1 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]",children:"Retry"})]}):(0,b.jsxs)("div",{className:(0,j.cn)("stgm stg:flex stg:w-60 stg:shrink-0 stg:flex-col stg:border-r stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))]",e),children:[(0,b.jsx)("div",{className:"stg:border-b stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:p-2",children:(0,b.jsx)("input",{type:"search",placeholder:"Search tasks…",value:l,onChange:c,className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-input-bg,var(--stgm-background,#fff))] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#737373)] stg:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":"Search task types"})}),(0,b.jsx)("div",{className:"stg:flex-1 stg:overflow-y-auto stg:p-2",children:0===m.length?(0,b.jsx)("div",{className:"stg:py-6 stg:text-center stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:l?"No matching tasks":"No task types available"}):m.map(({category:e,descriptors:t})=>(0,b.jsx)(O,{category:e,descriptors:t,isCollapsed:d.has(e),onToggle:u},e))})]})});function O({category:e,descriptors:t,isCollapsed:s,onToggle:r}){let n=a.CATEGORY_COLORS[e]??a.CATEGORY_COLORS.unspecified;return(0,b.jsxs)("div",{className:"stg:mb-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>r(e),className:"stg:flex stg:w-full stg:items-center stg:gap-1.5 stg:rounded stg:px-1 stg:py-1 stg:text-left stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wider stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]","aria-expanded":!s,children:[(0,b.jsx)("span",{className:"stg:inline-block stg:h-2 stg:w-2 stg:rounded-full",style:{backgroundColor:n},"aria-hidden":"true"}),a.CATEGORY_DISPLAY_NAMES[e],(0,b.jsx)("span",{className:"stg:ml-auto stg:text-[10px]",children:s?"+":"−"})]}),!s&&(0,b.jsx)("div",{className:"stg:mt-0.5 stg:space-y-0.5",role:"listbox","aria-label":a.CATEGORY_DISPLAY_NAMES[e],children:t.map(e=>(0,b.jsx)(L,{descriptor:e,categoryColor:n},e.kind))})]})}function L({descriptor:e,categoryColor:s}){let r=(0,t.useCallback)(t=>{t.dataTransfer.setData(R,e.kind),t.dataTransfer.effectAllowed="move"},[e.kind]);return(0,b.jsxs)("div",{draggable:!0,onDragStart:r,className:"stg:flex stg:cursor-grab stg:items-start stg:gap-2 stg:rounded stg:border stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:transition-colors stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:active:cursor-grabbing",role:"option","aria-label":`Drag to add ${e.displayName} task`,children:[(0,b.jsx)("span",{className:"stg:mt-0.5 stg:inline-block stg:h-2.5 stg:w-0.5 stg:shrink-0 stg:rounded-full",style:{backgroundColor:s},"aria-hidden":"true"}),(0,b.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,b.jsx)("div",{className:"stg:truncate stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.displayName}),(0,b.jsx)("div",{className:"stg:truncate stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.description})]})]})}class P{type="add_node";description;node;autoEdge;constructor(e,t=null){this.node=e,this.autoEdge=t,this.description=`Add task "${e.taskName}"`}apply(e){let t=[...e.nodes,this.node],s=this.autoEdge?[...e.edges,this.autoEdge]:[...e.edges];return{...e,nodes:t,edges:s}}undo(e){let t=e.nodes.filter(e=>e.id!==this.node.id),s=new Set([...this.autoEdge?[this.autoEdge.id]:[]]),r=s.size>0?e.edges.filter(e=>!s.has(e.id)):[...e.edges];return{...e,nodes:t,edges:r}}}class B{type="delete_node";description;nodeId;removedNode=null;removedEdges=[];constructor(e,t){this.nodeId=e,this.description=`Delete task "${t}"`}apply(e){this.removedNode=e.nodes.find(e=>e.id===this.nodeId)??null,this.removedEdges=e.edges.filter(e=>e.source===this.nodeId||e.target===this.nodeId);let t=e.nodes.filter(e=>e.id!==this.nodeId),s=new Set(this.removedEdges.map(e=>e.id)),r=e.edges.filter(e=>!s.has(e.id));return{...e,nodes:t,edges:r}}undo(e){if(!this.removedNode)return e;let t=[...e.nodes,this.removedNode],s=[...e.edges,...this.removedEdges];return{...e,nodes:t,edges:s}}}class H{type="add_edge";description;edge;constructor(e){this.edge=e,this.description=`Connect "${e.source}" → "${e.target}"`}apply(e){return{...e,edges:[...e.edges,this.edge]}}undo(e){return{...e,edges:e.edges.filter(e=>e.id!==this.edge.id)}}}class F{type="delete_edge";description;edgeId;removedEdge=null;constructor(e){this.edgeId=e,this.description="Delete connection"}apply(e){return this.removedEdge=e.edges.find(e=>e.id===this.edgeId)??null,{...e,edges:e.edges.filter(e=>e.id!==this.edgeId)}}undo(e){return this.removedEdge?{...e,edges:[...e.edges,this.removedEdge]}:e}}class U{type="move_nodes";description;oldPositions;newPositions;constructor(e,t){this.oldPositions=e,this.newPositions=t,this.description=1===e.length?"Move task":`Move ${e.length} tasks`}apply(e){return V(e,this.newPositions)}undo(e){return V(e,this.oldPositions)}}function V(e,t){let s=new Map(t.map(e=>[e.id,{x:e.x,y:e.y}])),r=e.nodes.map(e=>{let t=s.get(e.id);return t?{...e,position:t}:e});return{...e,nodes:r}}class W{type="compound";description;commands;constructor(e,t){this.description=e,this.commands=t}apply(e){let t=e;for(let e of this.commands)t=e.apply(t);return t}undo(e){let t=e;for(let e=this.commands.length-1;e>=0;e--)t=this.commands[e].undo(t);return t}}class K{type="update_node_field";description;nodeId;fieldPath;newValue;oldValue=void 0;constructor(e,t,s,r){this.nodeId=e,this.fieldPath=t,this.newValue=s,this.description=`Update "${r}" field "${t}"`}apply(e){let t=e.nodes.find(e=>e.id===this.nodeId);if(!t)return e;this.oldValue=function(e,t){let s=t.split("."),r=e;for(let e of s){if(null==r||"object"!=typeof r)return;r=r[e]}return r}(t.config,this.fieldPath);let s=J(t.config,this.fieldPath,this.newValue),r=e.nodes.map(e=>e.id===this.nodeId?{...e,config:s}:e);return{...e,nodes:r}}undo(e){let t=e.nodes.find(e=>e.id===this.nodeId);if(!t)return e;let s=void 0===this.oldValue?function e(t,s){let r=s.split(".");if(1===r.length){let{[r[0]]:e,...s}=t;return s}let[a,...n]=r,o=null!=t[a]&&"object"==typeof t[a]?t[a]:{};return{...t,[a]:e(o,n.join("."))}}(t.config,this.fieldPath):J(t.config,this.fieldPath,this.oldValue),r=e.nodes.map(e=>e.id===this.nodeId?{...e,config:s}:e);return{...e,nodes:r}}}class z{type="rename_node";description;oldName;newName;constructor(e,t){this.oldName=e,this.newName=t,this.description=`Rename "${e}" to "${t}"`}apply(e){return this.rename(e,this.oldName,this.newName)}undo(e){return this.rename(e,this.newName,this.oldName)}rename(e,t,s){let r=e.nodes.map(e=>e.id===t?{...e,id:s,taskName:s}:e.flow?.then===t?{...e,flow:{then:s}}:e),a=e.edges.map(e=>{let r=e.source===t,a=e.target===t;return r||a?{...e,...r&&{source:s},...a&&{target:s}}:e});return{...e,nodes:r,edges:a}}}class Y{type="update_node_meta";description;nodeId;field;newValue;oldValue=void 0;constructor(e,t,s,r){this.nodeId=e,this.field=t,this.newValue=s,this.description=`Update "${r}" ${t}`}apply(e){let t=e.nodes.find(e=>e.id===this.nodeId);if(!t)return e;if("export"===this.field){this.oldValue=t.export?.as;let s=this.newValue?{as:this.newValue}:void 0,r=e.nodes.map(e=>e.id===this.nodeId?{...e,export:s}:e);return{...e,nodes:r}}this.oldValue=t.flow?.then;let s=this.newValue?{then:this.newValue}:void 0,r=e.nodes.map(e=>e.id===this.nodeId?{...e,flow:s}:e);return{...e,nodes:r}}undo(e){if(!e.nodes.find(e=>e.id===this.nodeId))return e;if("export"===this.field){let t=this.oldValue?{as:this.oldValue}:void 0,s=e.nodes.map(e=>e.id===this.nodeId?{...e,export:t}:e);return{...e,nodes:s}}let t=this.oldValue?{then:this.oldValue}:void 0,s=e.nodes.map(e=>e.id===this.nodeId?{...e,flow:t}:e);return{...e,nodes:s}}}class G{type="migrate_branch_handle";description;nodeId;oldHandleId;newHandleId;constructor(e,t,s){this.nodeId=e,this.oldHandleId=t,this.newHandleId=s,this.description=`Rename handle "${t}" to "${s}"`}apply(e){return this.migrate(e,this.oldHandleId,this.newHandleId)}undo(e){return this.migrate(e,this.newHandleId,this.oldHandleId)}migrate(e,t,s){let r=e.edges.map(e=>e.source===this.nodeId&&e.sourceHandle===t?{...e,sourceHandle:s,label:s.includes("_")?s.split("_").slice(1).join("_"):e.label}:e);return{...e,edges:r}}}class q{type="duplicate_node";description;sourceNodeId;newTaskName;constructor(e,t){this.sourceNodeId=e,this.newTaskName=t,this.description=`Duplicate task "${e}" as "${t}"`}apply(e){let t=e.nodes.find(e=>e.id===this.sourceNodeId);if(!t)return e;let s={...t,id:this.newTaskName,taskName:this.newTaskName,config:structuredClone(t.config),position:{x:t.position.x+30,y:t.position.y+30},export:void 0,flow:void 0};return{...e,nodes:[...e.nodes,s]}}undo(e){return{...e,nodes:e.nodes.filter(e=>e.id!==this.newTaskName)}}}function J(e,t,s){let r=t.split(".");if(1===r.length)return{...e,[r[0]]:s};let[a,...n]=r,o=null!=e[a]&&"object"==typeof e[a]?e[a]:{};return{...e,[a]:J(o,n.join("."),s)}}class X{type="add_switch_case";description;switchNodeId;caseName;condition;childNode;childEdge;constructor(e,t,s,r=null,a=null){this.switchNodeId=e,this.caseName=t,this.condition=s,this.childNode=r,this.childEdge=a,this.description=`Add case "${t}"`}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.switchNodeId)return e;let t=e.config.cases,s=Array.isArray(t)?[...t]:[];return s.push({name:this.caseName,...this.condition.trim()&&{when:this.condition.trim()}}),{...e,config:{...e.config,cases:s}}}),s=this.childNode?[...t,this.childNode]:t,r=this.childEdge?[...e.edges,this.childEdge]:[...e.edges];return{...e,nodes:s,edges:r}}undo(e){let t=e.nodes.filter(e=>!this.childNode||e.id!==this.childNode.id).map(e=>{if(e.id!==this.switchNodeId)return e;let t=e.config.cases,s=Array.isArray(t)?t.filter(e=>"object"!=typeof e||null===e||e.name!==this.caseName):[];return{...e,config:{...e.config,cases:s}}}),s=this.childEdge?e.edges.filter(e=>e.id!==this.childEdge.id):[...e.edges];return{...e,nodes:t,edges:s}}}class Z{type="add_parallel_branch";description;forkNodeId;branchName;childNode;childEdge;constructor(e,t,s=null,r=null){this.forkNodeId=e,this.branchName=t,this.childNode=s,this.childEdge=r,this.description=`Add branch "${t}"`}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches,s=Array.isArray(t)?[...t]:[];return s.push({name:this.branchName,do:[]}),{...e,config:{...e.config,branches:s}}}),s=this.childNode?[...t,this.childNode]:t,r=this.childEdge?[...e.edges,this.childEdge]:[...e.edges];return{...e,nodes:s,edges:r}}undo(e){let t=e.nodes.filter(e=>!this.childNode||e.id!==this.childNode.id).map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches,s=Array.isArray(t)?t.filter(e=>"object"!=typeof e||null===e||e.name!==this.branchName):[];return{...e,config:{...e.config,branches:s}}}),s=this.childEdge?e.edges.filter(e=>e.id!==this.childEdge.id):[...e.edges];return{...e,nodes:t,edges:s}}}class Q{type="add_catch_handler";description;tryCatchNodeId;errorType;childNode;childEdge;previousCatch=void 0;constructor(e,t,s=null,r=null){this.tryCatchNodeId=e,this.errorType=t,this.childNode=s,this.childEdge=r,this.description="Add catch handler"}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.tryCatchNodeId)return e;this.previousCatch=e.config.catch;let t={as:this.errorType.trim()||"error",do:[]};return{...e,config:{...e.config,catch:t}}}),s=this.childNode?[...t,this.childNode]:t,r=this.childEdge?[...e.edges,this.childEdge]:[...e.edges];return{...e,nodes:s,edges:r}}undo(e){let t=e.nodes.filter(e=>!this.childNode||e.id!==this.childNode.id).map(e=>{if(e.id!==this.tryCatchNodeId)return e;if(void 0===this.previousCatch){let{catch:t,...s}=e.config;return{...e,config:s}}return{...e,config:{...e.config,catch:this.previousCatch}}}),s=this.childEdge?e.edges.filter(e=>e.id!==this.childEdge.id):[...e.edges];return{...e,nodes:t,edges:s}}}class ee{type="remove_switch_case";description;switchNodeId;caseName;removedCase=void 0;removedCaseIndex=-1;removedEdges=[];constructor(e,t){this.switchNodeId=e,this.caseName=t,this.description=`Remove case "${t}"`}apply(e){let t=`case_${this.caseName}`,s=e.nodes.map(e=>{if(e.id!==this.switchNodeId)return e;let t=e.config.cases;if(!Array.isArray(t))return e;this.removedCaseIndex=t.findIndex(e=>null!=e&&"object"==typeof e&&e.name===this.caseName),this.removedCaseIndex>=0&&(this.removedCase=t[this.removedCaseIndex]);let s=t.filter(e=>null==e||"object"!=typeof e||e.name!==this.caseName);return{...e,config:{...e.config,cases:s}}});this.removedEdges=e.edges.filter(e=>e.source===this.switchNodeId&&e.sourceHandle===t);let r=e.edges.filter(e=>e.source!==this.switchNodeId||e.sourceHandle!==t);return{...e,nodes:s,edges:r}}undo(e){if(void 0===this.removedCase||this.removedCaseIndex<0)return e;let t=e.nodes.map(e=>{if(e.id!==this.switchNodeId)return e;let t=e.config.cases,s=Array.isArray(t)?[...t]:[];return s.splice(this.removedCaseIndex,0,this.removedCase),{...e,config:{...e.config,cases:s}}}),s=[...e.edges,...this.removedEdges];return{...e,nodes:t,edges:s}}}class et{type="reorder_switch_cases";description;switchNodeId;newOrder;previousOrder=[];constructor(e,t){this.switchNodeId=e,this.newOrder=t,this.description="Reorder switch cases"}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.switchNodeId)return e;let t=e.config.cases;if(!Array.isArray(t))return e;this.previousOrder=t.filter(e=>null!=e&&"object"==typeof e).map(e=>e.name);let s=new Map;for(let e of t)null!=e&&"object"==typeof e&&s.set(e.name,e);let r=this.newOrder.map(e=>s.get(e)).filter(e=>void 0!==e);return{...e,config:{...e.config,cases:r}}});return{...e,nodes:t}}undo(e){if(0===this.previousOrder.length)return e;let t=e.nodes.map(e=>{if(e.id!==this.switchNodeId)return e;let t=e.config.cases;if(!Array.isArray(t))return e;let s=new Map;for(let e of t)null!=e&&"object"==typeof e&&s.set(e.name,e);let r=this.previousOrder.map(e=>s.get(e)).filter(e=>void 0!==e);return{...e,config:{...e.config,cases:r}}});return{...e,nodes:t}}}class es{type="remove_fork_branch";description;forkNodeId;branchName;removedBranch=void 0;removedIndex=-1;constructor(e,t){this.forkNodeId=e,this.branchName=t,this.description=`Remove branch "${t}"`}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches;if(!Array.isArray(t)||t.length<=2)return e;this.removedIndex=t.findIndex(e=>null!=e&&"object"==typeof e&&e.name===this.branchName),this.removedIndex>=0&&(this.removedBranch=t[this.removedIndex]);let s=t.filter(e=>null==e||"object"!=typeof e||e.name!==this.branchName);return{...e,config:{...e.config,branches:s}}});return{...e,nodes:t}}undo(e){if(void 0===this.removedBranch||this.removedIndex<0)return e;let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches,s=Array.isArray(t)?[...t]:[];return s.splice(this.removedIndex,0,this.removedBranch),{...e,config:{...e.config,branches:s}}});return{...e,nodes:t}}}class er{type="reorder_fork_branches";description;forkNodeId;newOrder;previousOrder=[];constructor(e,t){this.forkNodeId=e,this.newOrder=t,this.description="Reorder fork branches"}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches;if(!Array.isArray(t))return e;this.previousOrder=t.filter(e=>null!=e&&"object"==typeof e).map(e=>e.name);let s=new Map;for(let e of t)null!=e&&"object"==typeof e&&s.set(e.name,e);let r=this.newOrder.map(e=>s.get(e)).filter(e=>void 0!==e);return{...e,config:{...e.config,branches:r}}});return{...e,nodes:t}}undo(e){if(0===this.previousOrder.length)return e;let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches;if(!Array.isArray(t))return e;let s=new Map;for(let e of t)null!=e&&"object"==typeof e&&s.set(e.name,e);let r=this.previousOrder.map(e=>s.get(e)).filter(e=>void 0!==e);return{...e,config:{...e.config,branches:r}}});return{...e,nodes:t}}}class ea{type="rename_fork_branch";description;forkNodeId;oldName;newName;constructor(e,t,s){this.forkNodeId=e,this.oldName=t,this.newName=s,this.description=`Rename branch "${t}" to "${s}"`}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches;if(!Array.isArray(t))return e;let s=t.map(e=>null!=e&&"object"==typeof e&&e.name===this.oldName?{...e,name:this.newName}:e);return{...e,config:{...e.config,branches:s}}});return{...e,nodes:t}}undo(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t=e.config.branches;if(!Array.isArray(t))return e;let s=t.map(e=>null!=e&&"object"==typeof e&&e.name===this.newName?{...e,name:this.oldName}:e);return{...e,config:{...e.config,branches:s}}});return{...e,nodes:t}}}class en{type="set_fork_compete";description;forkNodeId;compete;previousValue=!1;constructor(e,t){this.forkNodeId=e,this.compete=t,this.description=t?"Set fork to race mode":"Set fork to wait-for-all"}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;this.previousValue=!0===e.config.compete;let t={...e.config};return this.compete?t.compete=!0:delete t.compete,{...e,config:t}});return{...e,nodes:t}}undo(e){let t=e.nodes.map(e=>{if(e.id!==this.forkNodeId)return e;let t={...e.config};return this.previousValue?t.compete=!0:delete t.compete,{...e,config:t}});return{...e,nodes:t}}}class eo{type="update_catch_config";description;tryCatchNodeId;updates;previousValues={};updatedKeys=[];constructor(e,t){this.tryCatchNodeId=e,this.updates=t,this.description="Update catch configuration"}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.tryCatchNodeId)return e;let t=e.config,s=t.catch;if(!s)return e;this.updatedKeys=[],this.previousValues={};let r={...s};return void 0!==this.updates.as&&(this.previousValues.as=s.as,this.updatedKeys.push("as"),r.as=this.updates.as),void 0!==this.updates.compensate&&(this.previousValues.compensate=s.compensate,this.updatedKeys.push("compensate"),this.updates.compensate?r.compensate=!0:delete r.compensate),{...e,config:{...t,catch:r}}});return{...e,nodes:t}}undo(e){let t=e.nodes.map(e=>{if(e.id!==this.tryCatchNodeId)return e;let t=e.config,s=t.catch;if(!s)return e;let r={...s};for(let e of this.updatedKeys){let t=this.previousValues[e];void 0===t?delete r[e]:r[e]=t}return{...e,config:{...t,catch:r}}});return{...e,nodes:t}}}class el{type="remove_catch_block";description="Remove catch handler";tryCatchNodeId;previousCatch=void 0;constructor(e){this.tryCatchNodeId=e}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.tryCatchNodeId)return e;let t=e.config;this.previousCatch=t.catch;let{catch:s,...r}=t;return{...e,config:r}});return{...e,nodes:t}}undo(e){if(void 0===this.previousCatch)return e;let t=e.nodes.map(e=>e.id!==this.tryCatchNodeId?e:{...e,config:{...e.config,catch:this.previousCatch}});return{...e,nodes:t}}}class ei{type="update_for_each_config";description;forEachNodeId;updates;previousValues={};constructor(e,t){this.forEachNodeId=e,this.updates=t,this.description="Update for-each configuration"}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.forEachNodeId)return e;let t={...e.config};for(let[e,s]of Object.entries(this.updates))void 0!==s&&(this.previousValues[e]=t[e],t[e]=s);return{...e,config:t}});return{...e,nodes:t}}undo(e){let t=e.nodes.map(e=>{if(e.id!==this.forEachNodeId)return e;let t={...e.config};for(let[e,s]of Object.entries(this.previousValues))void 0===s?delete t[e]:t[e]=s;return{...e,config:t}});return{...e,nodes:t}}}class ed{type="toggle_node_disabled";description;nodeId;previousValue=!1;constructor(e,t){this.nodeId=e,this.description=`Toggle disabled on "${t}"`}apply(e){let t=e.nodes.map(e=>{if(e.id!==this.nodeId)return e;let t=!0===e.config["x-stigmer-disabled"];this.previousValue=t;let s={...e.config};return t?delete s["x-stigmer-disabled"]:s["x-stigmer-disabled"]=!0,{...e,config:s}});return{...e,nodes:t}}undo(e){let t=e.nodes.map(e=>{if(e.id!==this.nodeId)return e;let t={...e.config};return this.previousValue?t["x-stigmer-disabled"]=!0:delete t["x-stigmer-disabled"],{...e,config:t}});return{...e,nodes:t}}}class eg{type="wrap_in_try_catch";description;nodeId;tryCatchName;snapshot=null;constructor(e,t,s){this.nodeId=e,this.tryCatchName=s,this.description=`Wrap "${t}" in try/catch`}apply(e){let t=e.nodes.find(e=>e.id===this.nodeId);if(!t)return e;let s=e.edges.filter(e=>e.source===this.nodeId||e.target===this.nodeId);this.snapshot={originalNode:t,originalEdges:s};let r={id:this.tryCatchName,taskName:this.tryCatchName,kind:t.kind,category:"control_flow",config:{try:[{name:t.taskName,kind:t.kind.toString(),task_config:t.config}]},position:t.position},a=e.nodes.filter(e=>e.id!==this.nodeId).concat(r),n=e.edges.map(e=>e.source===this.nodeId?{...e,source:this.tryCatchName}:e.target===this.nodeId?{...e,target:this.tryCatchName}:e);return{...e,nodes:a,edges:n}}undo(e){if(!this.snapshot)return e;let t=e.nodes.filter(e=>e.id!==this.tryCatchName).concat(this.snapshot.originalNode),s=new Set(e.edges.filter(e=>e.source===this.tryCatchName||e.target===this.tryCatchName).map(e=>e.id)),r=e.edges.filter(e=>!s.has(e.id)).concat(this.snapshot.originalEdges);return{...e,nodes:t,edges:r}}}class ec{model;undoStack=[];redoStack=[];constructor(e){this.model=e}get current(){return this.model}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}dispatch(e){return this.model=e.apply(this.model),this.undoStack.push(e),this.undoStack.length>50&&this.undoStack.shift(),this.redoStack=[],this.model}undo(){let e=this.undoStack.pop();return e&&(this.model=e.undo(this.model),this.redoStack.push(e)),this.model}redo(){let e=this.redoStack.pop();return e&&(this.model=e.apply(this.model),this.undoStack.push(e)),this.model}reset(e){this.model=e,this.undoStack=[],this.redoStack=[]}}let eu=0;function em(){return`e_canvas_${Date.now()}_${eu++}`}function eh(e,t){let s=1;for(;t.has(`${e}_${s}`);)s++;return`${e}_${s}`}function ep(e,t,s,r,a){return{id:e,taskName:e,kind:t,category:r,config:{},position:a}}function ef(e){return e===D.START_NODE_ID||e===D.END_NODE_ID}e.i(247167);var ex=e.i(165825);function ev(e){let t=e.id===D.START_NODE_ID||e.id===D.END_NODE_ID;return{width:t?a.SENTINEL_NODE_WIDTH:a.CANVAS_NODE_WIDTH,height:t?a.SENTINEL_NODE_HEIGHT:a.CANVAS_NODE_HEIGHT}}var eb=e.i(455665);let ey={x:40,y:40};function ek(e){try{return(0,w.graphToYaml)(e)}catch{return null}}var ej=e.i(927056),eN=e.i(188482),eC=e.i(364802);let ew=(0,t.memo)(function({identity:e,graph:s,mutations:r,onViewYaml:n,className:o}){let[l,i]=(0,t.useState)(!1),[d,g]=(0,t.useState)(e.taskName),[c,u]=(0,t.useState)(null),[m,h]=(0,t.useState)(!1),p=new Set(s.nodes.filter(t=>t.id!==e.nodeId).map(e=>e.taskName)),f=(0,t.useCallback)(()=>{i(!0),g(e.taskName),u(null),h(!1)},[e.taskName]),x=(0,t.useCallback)(()=>{let t=d.trim();t?a.TASK_NAME_PATTERN.test(t)?p.has(t)?u("A task with this name already exists"):(i(!1),u(null),t!==e.taskName&&r.onRenameNode(e.nodeId,t)):u(a.TASK_NAME_PATTERN_ERROR):u("Name cannot be empty")},[d,p,e.nodeId,e.taskName,r.onRenameNode]),v=(0,t.useCallback)(e=>{"Enter"===e.key&&x(),"Escape"===e.key&&(i(!1),u(null))},[x]),y=(0,t.useCallback)(()=>h(e=>!e),[]),k=(0,t.useCallback)(()=>h(!1),[]);return(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:flex-col stg:gap-1.5 stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:px-3 stg:py-2.5",o),children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)("div",{className:"stg:min-w-0 stg:flex-1",children:l?(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,b.jsx)("input",{type:"text",value:d,onChange:e=>{g(e.target.value),u(null)},onBlur:x,onKeyDown:v,autoFocus:!0,className:"stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1 stg:text-sm stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]"}),c&&(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)]",children:c})]}):(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:f,className:"stg:w-fit stg:max-w-full stg:truncate stg:text-left stg:text-sm stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:underline"}),children:e.taskName}),(0,b.jsx)(eN.TooltipContent,{side:"top",children:"Click to rename"})]})}),(0,b.jsxs)("div",{className:"stg:relative stg:shrink-0",children:[(0,b.jsx)("button",{type:"button",onClick:y,className:"stg:flex stg:h-6 stg:w-6 stg:items-center stg:justify-center stg:rounded stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":"Node actions","aria-expanded":m,"aria-haspopup":"true",children:(0,b.jsx)(eT,{})}),m&&(0,b.jsx)(e_,{nodeId:e.nodeId,mutations:r,onRename:f,onViewYaml:n,onClose:k})]})]}),(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,b.jsx)("span",{className:"stg:inline-block stg:rounded stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:font-medium stg:leading-tight",style:{color:e.categoryColor,backgroundColor:`color-mix(in srgb, ${e.categoryColor} 12%, transparent)`},children:e.kindString.replace(/_/g," ")}),e.description&&(0,b.jsx)(eC.TruncatedText,{text:e.description,className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]"})]})]})});function e_({nodeId:e,mutations:s,onRename:r,onViewYaml:a,onClose:n}){let o=(0,t.useCallback)(e=>{n(),e()},[n]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"stg:fixed stg:inset-0 stg:z-40",onClick:n,"aria-hidden":"true"}),(0,b.jsxs)("div",{role:"menu",className:"stg:absolute stg:right-0 stg:top-full stg:z-50 stg:mt-1 stg:min-w-[160px] stg:rounded-md stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-popover,var(--stgm-background,#fff))] stg:py-1 stg:shadow-md",children:[(0,b.jsx)(eS,{label:"Rename",onClick:()=>o(r)}),s.onDuplicateNode&&(0,b.jsx)(eS,{label:"Duplicate",onClick:()=>o(()=>s.onDuplicateNode(e))}),s.onToggleDisabled&&(0,b.jsx)(eS,{label:"Disable / Bypass",onClick:()=>o(()=>s.onToggleDisabled(e))}),s.onWrapInTryCatch&&(0,b.jsx)(eS,{label:"Wrap in Try/Catch",onClick:()=>o(()=>s.onWrapInTryCatch(e))}),a&&(0,b.jsx)(eS,{label:"View YAML",onClick:()=>o(()=>a(e))}),(0,b.jsx)(eE,{}),s.onDeleteNode&&(0,b.jsx)(eS,{label:"Delete task",destructive:!0,onClick:()=>o(()=>s.onDeleteNode(e))})]})]})}function eS({label:e,onClick:t,destructive:s}){return(0,b.jsx)("button",{type:"button",role:"menuitem",onClick:t,className:(0,j.cn)("stg:flex stg:w-full stg:items-center stg:px-3 stg:py-1.5 stg:text-left stg:text-xs stg:transition-colors",s?"stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:bg-[var(--stgm-destructive,#ef4444)]/10":"stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]"),children:e})}function eE(){return(0,b.jsx)("div",{className:"stg:my-1 stg:border-t stg:border-[var(--stgm-border,#e5e5e5)]"})}function eT(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[(0,b.jsx)("circle",{cx:"8",cy:"3",r:"1.5"}),(0,b.jsx)("circle",{cx:"8",cy:"8",r:"1.5"}),(0,b.jsx)("circle",{cx:"8",cy:"13",r:"1.5"})]})}let eM=new Set(["agent_call","llm_call","eval"]),eI=new Set(["http_call","grpc_call","activity_call","run_workflow"]),eA=new Set(["for_each","fork","try_catch"]),eD=new Set(["switch_case","fork"]),eR=new Set(["try_catch"]),e$=new Set(["for_each"]),eO=/prompt|expression|body|template|query|script/i,eL=(0,t.memo)(function({fields:e,fieldGroups:t,config:s,onChange:r,className:a}){let n=function(e,t){let s=new Map,r=[];for(let t of e)if(t.groupId){let e=s.get(t.groupId);e?e.push(t):s.set(t.groupId,[t])}else r.push(t);let a=[];for(let e of(r.length>0&&a.push({id:"__general",displayName:"General",fields:r}),t)){let t=s.get(e.id);t&&t.length>0&&a.push({id:e.id,displayName:e.displayName,description:e.description,fields:t})}return a}(e,t);return 0===e.length?(0,b.jsx)("div",{className:(0,j.cn)("stg:px-3 stg:py-4 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",a),children:"No configurable fields for this task kind."}):(0,b.jsx)("div",{className:(0,j.cn)("stg:flex stg:flex-col stg:gap-1",a),children:n.map(e=>(0,b.jsx)(eP,{group:e,config:s,onChange:r},e.id))})});function eP({group:e,config:s,onChange:r}){let[a,n]=(0,t.useState)("__advanced"===e.id),o=(0,t.useCallback)(()=>n(e=>!e),[]);return(0,b.jsxs)("div",{className:"stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:last:border-b-0",children:[(0,b.jsxs)("button",{type:"button",onClick:o,className:"stg:flex stg:w-full stg:items-center stg:gap-1.5 stg:px-3 stg:py-2 stg:text-left stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]","aria-expanded":!a,children:[(0,b.jsx)(eq,{collapsed:a}),e.displayName]}),!a&&(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3 stg:px-3 stg:pb-3",children:[e.description&&(0,b.jsx)("p",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.description}),e.fields.map(e=>(0,b.jsx)(eB,{field:e,value:s[e.name],onChange:t=>r(e.name,t),depth:0},e.name))]})]})}function eB({field:e,value:t,onChange:s,depth:r}){return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1 stg:text-[11px] stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:[e.displayName,e.required&&(0,b.jsx)("span",{className:"stg:text-[var(--stgm-destructive,#ef4444)]","aria-label":"required",children:"*"}),e.isExpression&&(0,b.jsx)("span",{className:"stg:rounded stg:bg-[var(--stgm-accent,#e5e5e5)] stg:px-1 stg:text-[9px] stg:font-normal stg:text-[var(--stgm-muted-foreground,#737373)]",children:"expr"})]}),e.description&&(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.description}),(0,b.jsx)(eH,{field:e,value:t,onChange:s,depth:r})]})}function eH({field:e,value:t,onChange:s,depth:r}){switch(e.type){case"string":return(0,b.jsx)(eU,{field:e,value:t,onChange:s});case"int32":case"float":return(0,b.jsx)(eV,{field:e,value:t,onChange:s});case"bool":return(0,b.jsx)(eW,{value:t,onChange:s});case"enum":return(0,b.jsx)(eK,{field:e,value:t,onChange:s});case"struct":case"message":default:return(0,b.jsx)(ez,{value:t,onChange:s});case"repeated":return(0,b.jsx)(eY,{field:e,value:t,onChange:s});case"map":return(0,b.jsx)(eG,{value:t,onChange:s})}}let eF="stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]";function eU({field:e,value:s,onChange:r}){let a="string"==typeof s?s:"",n=eO.test(e.name),o=e.isExpression?"${...}":e.defaultValue??"",l=(0,t.useCallback)(e=>{r(e.target.value||void 0)},[r]);return n?(0,b.jsx)("textarea",{value:a,onChange:l,placeholder:o,rows:4,className:(0,j.cn)(eF,"stg:resize-y stg:font-mono",e.isExpression&&"stg:border-[var(--stgm-chart-purple,#8b5cf6)]/40")}):(0,b.jsx)("input",{type:"text",value:a,onChange:l,placeholder:o,className:(0,j.cn)(eF,e.isExpression&&"stg:border-[var(--stgm-chart-purple,#8b5cf6)]/40")})}function eV({field:e,value:s,onChange:r}){let a=(0,t.useCallback)(t=>{let s=t.target.value;if(""===s)return void r(void 0);let a="float"===e.type?parseFloat(s):parseInt(s,10);isNaN(a)||r(a)},[r,e.type]);return(0,b.jsx)("input",{type:"number",value:"number"==typeof s?s:"",onChange:a,placeholder:e.defaultValue??"",step:"float"===e.type?"any":"1",className:eF})}function eW({value:e,onChange:s}){let r=!0===e,a=(0,t.useCallback)(e=>{s(e.target.checked)},[s]);return(0,b.jsxs)("label",{className:"stg:flex stg:cursor-pointer stg:items-center stg:gap-2",children:[(0,b.jsx)("input",{type:"checkbox",checked:r,onChange:a,className:"stg:h-4 stg:w-4 stg:rounded stg:border-[var(--stgm-border,#d4d4d8)] stg:text-[var(--stgm-primary,#6366f1)] stg:focus:ring-[var(--stgm-ring,#3b82f6)]"}),(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:r?"Enabled":"Disabled"})]})}function eK({field:e,value:s,onChange:r}){let a=(0,t.useCallback)(e=>{r(e.target.value||void 0)},[r]);return(0,b.jsxs)("select",{value:"string"==typeof s?s:"",onChange:a,className:eF,children:[(0,b.jsx)("option",{value:"",children:"— Select —"}),e.enumValues?.map(e=>(0,b.jsx)("option",{value:e,children:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())},e))]})}function ez({value:e,onChange:s}){let r=null!=e?JSON.stringify(e,null,2):"",[a,n]=(0,t.useState)(r),[o,l]=(0,t.useState)(null),i=(0,t.useCallback)(e=>{let t=e.target.value;if(n(t),!t.trim()){l(null),s(void 0);return}try{let e=JSON.parse(t);l(null),s(e)}catch{l("Invalid JSON")}},[s]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,b.jsx)("textarea",{value:a,onChange:i,rows:4,className:(0,j.cn)(eF,"stg:resize-y stg:font-mono stg:text-[11px]"),placeholder:"{}"}),o&&(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)]",children:o})]})}function eY({field:e,value:s,onChange:r}){let a=Array.isArray(s)?s:[],n=(0,t.useCallback)(()=>{r([...a,function(e){switch(e){case"int32":case"float":return 0;case"bool":return!1;default:return""}}(e.elementType)])},[a,r,e.elementType]),o=(0,t.useCallback)(e=>{r(a.filter((t,s)=>s!==e))},[a,r]),l=(0,t.useCallback)((e,t)=>{let s=[...a];s[e]=t,r(s)},[a,r]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[a.map((e,t)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:"string"==typeof e?e:JSON.stringify(e??""),onChange:e=>l(t,e.target.value||void 0),className:(0,j.cn)(eF,"stg:flex-1")}),(0,b.jsx)("button",{type:"button",onClick:()=>o(t),className:"stg:mt-1 stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline","aria-label":`Remove item ${t+1}`,children:"✕"})]},t)),(0,b.jsx)("button",{type:"button",onClick:n,className:"stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add item"})]})}function eG({value:e,onChange:s}){let r=null==e||"object"!=typeof e||Array.isArray(e)?{}:e,a=Object.entries(r),n=(0,t.useCallback)(()=>{s({...r,"":""})},[r,s]),o=(0,t.useCallback)(e=>{let{[e]:t,...a}=r;s(Object.keys(a).length>0?a:void 0)},[r,s]),l=(0,t.useCallback)((e,t,a)=>{let n={};for(let[s,o]of Object.entries(r))s===e?n[t]=a:n[s]=o;s(n)},[r,s]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[a.map(([e,t],s)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:e,onChange:s=>l(e,s.target.value,t),placeholder:"key",className:(0,j.cn)(eF,"stg:w-1/3")}),(0,b.jsx)("input",{type:"text",value:"string"==typeof t?t:JSON.stringify(t??""),onChange:t=>l(e,e,t.target.value||void 0),placeholder:"value",className:(0,j.cn)(eF,"stg:flex-1")}),(0,b.jsx)("button",{type:"button",onClick:()=>o(e),className:"stg:mt-1 stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline","aria-label":`Remove entry ${e}`,children:"✕"})]},s)),(0,b.jsx)("button",{type:"button",onClick:n,className:"stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add entry"})]})}function eq({collapsed:e}){return(0,b.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(0,j.cn)("stg:transition-transform",!e&&"stg:rotate-90"),children:(0,b.jsx)("path",{d:"M6 4l4 4-4 4"})})}let eJ=(0,t.memo)(function({nodeId:e,config:s,edges:r,allTaskNames:a,onUpdateConfig:n,onUpdateBranchRouting:o,onMigrateBranchHandle:l,onRemoveBranchEdges:i}){let d,g=Array.isArray(d=s.cases)?d.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:"string"==typeof e.name?e.name:"",when:"string"==typeof e.when?e.when:"",then:"string"==typeof e.then?e.then:""})):[],[c,u]=(0,t.useState)(null),[m,h]=(0,t.useState)(null),p=function(e,t,s){let r=new Map;for(let a of t)a.source===e&&a.sourceHandle?.startsWith(s)&&r.set(a.sourceHandle,a.target);return r}(e,r,"case_"),f=(0,t.useCallback)(e=>{n("cases",e.map(e=>({name:e.name,...e.when&&{when:e.when},...e.then&&{then:e.then}})))},[n]),x=(0,t.useCallback)(()=>{let e=new Set(g.map(e=>e.name)),t=g.length+1;for(;e.has(`case_${t}`);)t++;f([...g,{name:`case_${t}`,when:"",then:""}])},[g,f]),v=(0,t.useCallback)(e=>{if(g.length<=1)return;let t=g[e];i(`case_${t.name}`),f(g.filter((t,s)=>s!==e))},[g,f,i]),y=(0,t.useCallback)((e,t)=>{let s=e+t;if(s<0||s>=g.length)return;let r=[...g];[r[e],r[s]]=[r[s],r[e]],f(r)},[g,f]),k=(0,t.useCallback)((e,t)=>{let s=g[e].name;if(s===t)return;let r=[...g];r[e]={...r[e],name:t},f(r),s&&l(`case_${s}`,`case_${t}`)},[g,f,l]),j=(0,t.useCallback)((e,t)=>{let s=[...g];s[e]={...s[e],when:t},f(s)},[g,f]),N=(0,t.useCallback)((e,t)=>{let s=g[e].name;o(`case_${s}`,t||void 0)},[g,o]),C=(0,t.useCallback)(e=>{u(e)},[]),w=(0,t.useCallback)(e=>{h(e)},[]),_=(0,t.useCallback)(()=>{if(null!=c&&null!=m&&c!==m){let e=[...g],[t]=e.splice(c,1);e.splice(m,0,t),f(e)}u(null),h(null)},[c,m,g,f]),S=(0,t.useCallback)(()=>{u(null),h(null)},[]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2 stg:px-3 stg:pb-3",children:[0===g.length&&(0,b.jsx)("p",{className:"stg:py-2 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No cases defined. Add a case to start branching."}),g.map((e,t)=>{let s=!e.when&&t===g.length-1,r=p.get(`case_${e.name}`)??"";return(0,b.jsx)(eX,{caseDef:e,index:t,total:g.length,isDefault:s,routeTarget:r,allTaskNames:a,allCaseNames:g.map(e=>e.name),onNameChange:e=>k(t,e),onWhenChange:e=>j(t,e),onThenChange:e=>N(t,e),onMoveUp:()=>y(t,-1),onMoveDown:()=>y(t,1),onRemove:()=>v(t),canRemove:g.length>1,isDragOver:m===t&&c!==t,onDragStart:()=>C(t),onDragOver:()=>w(t),onDrop:_,onDragEnd:S},`${e.name}_${t}`)}),(0,b.jsx)("button",{type:"button",onClick:x,className:"stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add case"})]})});function eX({caseDef:e,index:s,total:r,isDefault:n,routeTarget:o,allTaskNames:l,allCaseNames:i,onNameChange:d,onWhenChange:g,onThenChange:c,onMoveUp:u,onMoveDown:m,onRemove:h,canRemove:p,isDragOver:f,onDragStart:x,onDragOver:v,onDrop:y,onDragEnd:k}){let[N,C]=(0,t.useState)(null),[w,_]=(0,t.useState)(e.name),S=(0,t.useCallback)(()=>{let e=w.trim();e?a.TASK_NAME_PATTERN.test(e)?i.some((t,r)=>r!==s&&t===e)?C("Duplicate name"):(C(null),d(e)):C(a.TASK_NAME_PATTERN_ERROR):C("Name required")},[w,i,s,d]),E=(0,t.useCallback)(e=>{e.preventDefault(),v()},[v]);return(0,b.jsxs)("div",{onDragOver:E,onDrop:y,className:(0,j.cn)("stg:flex stg:flex-col stg:gap-1.5 stg:rounded-md stg:border stg:p-2 stg:transition-[border-color]",n?"stg:border-[var(--stgm-chart-amber,#f59e0b)]/30 stg:bg-[var(--stgm-chart-amber,#f59e0b)]/5":"stg:border-[var(--stgm-border,#e5e5e5)]",f&&"stg:border-[var(--stgm-primary,#6366f1)]"),children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)(eZ,{onDragStart:x,onDragEnd:k}),(0,b.jsx)("input",{type:"text",value:w,onChange:e=>{_(e.target.value),C(null)},onBlur:S,onKeyDown:e=>{"Enter"===e.key&&S()},placeholder:"case_name",className:"stg:min-w-0 stg:flex-1 stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1.5 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":`Case ${s+1} name`}),n&&(0,b.jsx)("span",{className:"stg:shrink-0 stg:rounded stg:bg-[var(--stgm-chart-amber,#f59e0b)]/15 stg:px-1 stg:py-px stg:text-[9px] stg:font-medium stg:text-[var(--stgm-chart-amber,#f59e0b)]",children:"default"}),(0,b.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center",children:[(0,b.jsx)(eQ,{direction:"up",disabled:0===s,onClick:u}),(0,b.jsx)(eQ,{direction:"down",disabled:s===r-1,onClick:m}),(0,b.jsx)("button",{type:"button",onClick:h,disabled:!p,className:"stg:ml-0.5 stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline stg:disabled:opacity-30","aria-label":`Remove case ${e.name}`,children:"✕"})]})]}),N&&(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)]",children:N}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,b.jsx)("label",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Condition"}),(0,b.jsx)("textarea",{value:e.when,onChange:e=>g(e.target.value),placeholder:n?"(no condition — default case)":"${ $context.value > 5 }",rows:2,className:"stg:w-full stg:resize-y stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1.5 stg:py-1 stg:font-mono stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":`Condition for case ${e.name}`})]}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,b.jsx)("label",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Then go to"}),(0,b.jsxs)("select",{value:o,onChange:e=>c(e.target.value),className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1.5 stg:py-1 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":`Target task for case ${e.name}`,children:[(0,b.jsx)("option",{value:"",children:"— Not connected —"}),l.map(e=>(0,b.jsx)("option",{value:e,children:e},e))]})]})]})}function eZ({onDragStart:e,onDragEnd:t}){return(0,b.jsx)("div",{draggable:!0,onDragStart:e,onDragEnd:t,className:"stg:flex stg:shrink-0 stg:cursor-grab stg:items-center stg:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)] stg:active:cursor-grabbing","aria-label":"Drag to reorder",children:(0,b.jsxs)("svg",{width:"8",height:"14",viewBox:"0 0 8 14",fill:"currentColor",children:[(0,b.jsx)("circle",{cx:"2",cy:"2",r:"1"}),(0,b.jsx)("circle",{cx:"6",cy:"2",r:"1"}),(0,b.jsx)("circle",{cx:"2",cy:"7",r:"1"}),(0,b.jsx)("circle",{cx:"6",cy:"7",r:"1"}),(0,b.jsx)("circle",{cx:"2",cy:"12",r:"1"}),(0,b.jsx)("circle",{cx:"6",cy:"12",r:"1"})]})})}function eQ({direction:e,disabled:t,onClick:s}){return(0,b.jsx)("button",{type:"button",onClick:s,disabled:t,className:"stg:px-0.5 stg:py-0.5 stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)] stg:disabled:opacity-30","aria-label":`Move ${e}`,children:(0,b.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:"up"===e?(0,b.jsx)("path",{d:"M4 10l4-4 4 4"}):(0,b.jsx)("path",{d:"M4 6l4 4 4-4"})})})}let e0=[{value:"HUMAN_INPUT_TIMEOUT_FAIL",label:"Fail — task errors on timeout"},{value:"HUMAN_INPUT_TIMEOUT_APPROVE",label:"Auto-approve — proceed as approved"},{value:"HUMAN_INPUT_TIMEOUT_DENY",label:"Auto-deny — proceed as denied"},{value:"HUMAN_INPUT_TIMEOUT_ESCALATE",label:"Escalate — route via the 'escalate' outcome"}],e1=[{value:1,label:"seconds"},{value:60,label:"minutes"},{value:3600,label:"hours"},{value:86400,label:"days"}],e3=(0,t.memo)(function({nodeId:e,config:s,edges:r,allTaskNames:a,onUpdateConfig:n,onUpdateBranchRouting:o,onMigrateBranchHandle:l,onRemoveBranchEdges:i}){let d=(0,t.useMemo)(()=>{let t=new Map;for(let s of r)s.source===e&&s.sourceHandle?.startsWith("outcome_")&&t.set(s.sourceHandle,s.target);return t},[e,r]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,b.jsx)(e5,{prompt:"string"==typeof s.prompt?s.prompt:"",onUpdate:n}),(0,b.jsx)(e4,{config:s,routingMap:d,allTaskNames:a,onUpdateConfig:n,onUpdateBranchRouting:o,onMigrateBranchHandle:l,onRemoveBranchEdges:i}),(0,b.jsx)(e7,{formSchema:s.form_schema,onUpdateConfig:n}),(0,b.jsx)(e8,{timeout:"number"==typeof s.timeout?s.timeout:0,onTimeout:"string"==typeof s.on_timeout?s.on_timeout:"",hasEscalateOutcome:tn(s).some(e=>"escalate"===e.name),onUpdateConfig:n}),(0,b.jsx)(e9,{title:"Approvers",fieldPath:"approvers",values:to(s.approvers),placeholder:"e.g., user:jane@acme.com, team:engineering-leads",onUpdateConfig:n}),(0,b.jsx)(e9,{title:"Notification Channels",fieldPath:"notification_channels",values:to(s.notification_channels),placeholder:"e.g., slack:#approvals, email:ops@acme.com",onUpdateConfig:n})]})});function e5({prompt:e,onUpdate:t}){return(0,b.jsx)(te,{title:"Prompt",defaultOpen:!0,children:(0,b.jsx)("textarea",{value:e,onChange:e=>t("prompt",e.target.value||void 0),placeholder:"${ $context.ticket.id } needs approval — review and decide.",rows:3,className:(0,j.cn)(tr,"stg:resize-y stg:font-mono"),"aria-label":"Prompt message"})})}function e4({config:e,routingMap:s,allTaskNames:r,onUpdateConfig:a,onUpdateBranchRouting:n,onMigrateBranchHandle:o,onRemoveBranchEdges:l}){let i=tn(e),d=(0,t.useCallback)(e=>{a("outcomes",0===e.length?void 0:e.map(e=>({name:e.name,...e.label&&{label:e.label},...e.then&&{then:e.then}})))},[a]),g=(0,t.useCallback)(()=>{let e=new Set(i.map(e=>e.name)),t=i.length+1;for(;e.has(`outcome_${t}`);)t++;d([...i,{name:`outcome_${t}`,label:"",then:""}])},[i,d]),c=(0,t.useCallback)(e=>{let t=i[e];l(`outcome_${t.name}`),d(i.filter((t,s)=>s!==e))},[i,d,l]),u=(0,t.useCallback)((e,t)=>{let s=e+t;if(s<0||s>=i.length)return;let r=[...i];[r[e],r[s]]=[r[s],r[e]],d(r)},[i,d]),m=(0,t.useCallback)((e,t)=>{let s=i[e].name;if(s===t)return;let r=[...i];r[e]={...r[e],name:t},d(r),s&&o(`outcome_${s}`,`outcome_${t}`)},[i,d,o]),h=(0,t.useCallback)((e,t)=>{let s=[...i];s[e]={...s[e],label:t},d(s)},[i,d]),p=(0,t.useCallback)((e,t)=>{let s=i[e].name;n(`outcome_${s}`,t||void 0)},[i,n]),[f,x]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),k=(0,t.useCallback)(e=>{x(e)},[]),j=(0,t.useCallback)(e=>{y(e)},[]),N=(0,t.useCallback)(()=>{if(null!=f&&null!=v&&f!==v){let e=[...i],[t]=e.splice(f,1);e.splice(v,0,t),d(e)}x(null),y(null)},[f,v,i,d]),C=(0,t.useCallback)(()=>{x(null),y(null)},[]);return(0,b.jsxs)(te,{title:"Outcomes",children:[0===i.length&&(0,b.jsx)("p",{className:"stg:py-1 stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No custom outcomes. Default: binary Approve / Deny."}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:i.map((e,t)=>{let a=s.get(`outcome_${e.name}`)??"";return(0,b.jsx)(e2,{outcome:e,index:t,total:i.length,routeTarget:a,allTaskNames:r,allOutcomeNames:i.map(e=>e.name),onNameChange:e=>m(t,e),onLabelChange:e=>h(t,e),onThenChange:e=>p(t,e),onMoveUp:()=>u(t,-1),onMoveDown:()=>u(t,1),onRemove:()=>c(t),isDragOver:v===t&&f!==t,onDragStart:()=>k(t),onDragOver:()=>j(t),onDrop:N,onDragEnd:C},`${e.name}_${t}`)})}),(0,b.jsx)("button",{type:"button",onClick:g,className:"stg:mt-1 stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add outcome"})]})}function e2({outcome:e,index:s,total:r,routeTarget:n,allTaskNames:o,allOutcomeNames:l,onNameChange:i,onLabelChange:d,onThenChange:g,onMoveUp:c,onMoveDown:u,onRemove:m,isDragOver:h,onDragStart:p,onDragOver:f,onDrop:x,onDragEnd:v}){let[y,k]=(0,t.useState)(e.name),[N,C]=(0,t.useState)(null),w=(0,t.useCallback)(()=>{let e=y.trim();e?a.TASK_NAME_PATTERN.test(e)?l.some((t,r)=>r!==s&&t===e)?C("Duplicate name"):(C(null),i(e)):C(a.TASK_NAME_PATTERN_ERROR):C("Name required")},[y,l,s,i]),_=(0,t.useCallback)(e=>{e.preventDefault(),f()},[f]);return(0,b.jsxs)("div",{onDragOver:_,onDrop:x,className:(0,j.cn)("stg:flex stg:flex-col stg:gap-1 stg:rounded-md stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:p-2 stg:transition-[border-color]",h&&"stg:border-[var(--stgm-primary,#6366f1)]"),children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)(tt,{onDragStart:p,onDragEnd:v}),(0,b.jsx)("input",{type:"text",value:y,onChange:e=>{k(e.target.value),C(null)},onBlur:w,onKeyDown:e=>{"Enter"===e.key&&w()},placeholder:"outcome_name",className:"stg:min-w-0 stg:flex-1 stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1.5 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":`Outcome ${s+1} name`}),(0,b.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center",children:[(0,b.jsx)(ts,{direction:"up",disabled:0===s,onClick:c}),(0,b.jsx)(ts,{direction:"down",disabled:s===r-1,onClick:u}),(0,b.jsx)("button",{type:"button",onClick:m,className:"stg:ml-0.5 stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline","aria-label":`Remove outcome ${e.name}`,children:"✕"})]})]}),N&&(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)]",children:N}),(0,b.jsx)("input",{type:"text",value:e.label,onChange:e=>d(e.target.value),placeholder:e.name.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase()),className:(0,j.cn)(ta),"aria-label":`Label for outcome ${e.name}`}),(0,b.jsxs)("select",{value:n,onChange:e=>g(e.target.value),className:(0,j.cn)(ta),"aria-label":`Target task for outcome ${e.name}`,children:[(0,b.jsx)("option",{value:"",children:"— Continue (next task) —"}),o.map(e=>(0,b.jsx)("option",{value:e,children:e},e))]})]})}function e7({formSchema:e,onUpdateConfig:s}){let[r,a]=(0,t.useState)(!1),n=(0,t.useMemo)(()=>(function(e){if(!e||"object"!=typeof e||Array.isArray(e))return[];let t=e.properties;if(!t||"object"!=typeof t||Array.isArray(t))return[];let s=new Set(Array.isArray(e.required)?e.required.filter(e=>"string"==typeof e):[]);return Object.entries(t).filter(([,e])=>e&&"object"==typeof e&&!Array.isArray(e)).map(([e,t])=>{let r=Array.isArray(t.enum),a="string";return r?a="enum":"number"===t.type||"integer"===t.type?a="number":"boolean"===t.type&&(a="boolean"),{name:e,type:a,required:s.has(e),description:"string"==typeof t.description?t.description:"",enumValues:r?t.enum.map(String).join(", "):""}})})(e),[e]),o=(0,t.useCallback)(e=>{s("form_schema",function(e){if(0===e.length)return;let t={},s=[];for(let r of e){if(!r.name.trim())continue;let e={};if("enum"===r.type){e.type="string";let t=r.enumValues.split(",").map(e=>e.trim()).filter(Boolean);t.length>0&&(e.enum=t)}else"number"===r.type?e.type="number":"boolean"===r.type?e.type="boolean":e.type="string";r.description&&(e.description=r.description),r.required&&s.push(r.name),t[r.name]=e}return{type:"object",properties:t,...s.length>0&&{required:s}}}(e))},[s]),l=(0,t.useCallback)(()=>{let e=new Set(n.map(e=>e.name)),t=n.length+1;for(;e.has(`field_${t}`);)t++;o([...n,{name:`field_${t}`,type:"string",required:!1,description:"",enumValues:""}])},[n,o]),i=(0,t.useCallback)(e=>o(n.filter((t,s)=>s!==e)),[n,o]),d=(0,t.useCallback)((e,t)=>{let s=[...n];s[e]={...s[e],...t},o(s)},[n,o]),g=(0,t.useCallback)(e=>{try{let t=JSON.parse(e);s("form_schema",t)}catch{}},[s]);return(0,b.jsxs)(te,{title:"Form Fields",children:[(0,b.jsxs)("div",{className:"stg:mb-1 stg:flex stg:items-center stg:justify-between",children:[(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:r?"Raw JSON Schema":"Visual builder"}),(0,b.jsx)("button",{type:"button",onClick:()=>a(!r),className:"stg:text-[10px] stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:r?"Visual":"Raw JSON"})]}),r?(0,b.jsx)("textarea",{value:null!=e?JSON.stringify(e,null,2):"",onChange:e=>g(e.target.value),rows:8,className:(0,j.cn)(tr,"stg:resize-y stg:font-mono stg:text-[11px]"),placeholder:'{ "type": "object", "properties": { ... } }'}):(0,b.jsxs)(b.Fragment,{children:[0===n.length&&(0,b.jsx)("p",{className:"stg:py-1 stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No form fields. Reviewer sees only outcome buttons."}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:n.map((e,t)=>(0,b.jsx)(e6,{field:e,index:t,onUpdate:e=>d(t,e),onRemove:()=>i(t)},`${e.name}_${t}`))}),(0,b.jsx)("button",{type:"button",onClick:l,className:"stg:mt-1 stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add field"})]})]})}function e6({field:e,index:t,onUpdate:s,onRemove:r}){return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1 stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:p-1.5",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:e.name,onChange:e=>s({name:e.target.value}),placeholder:"field_name",className:"stg:min-w-0 stg:flex-1 stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1 stg:py-0.5 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":`Field ${t+1} name`}),(0,b.jsxs)("select",{value:e.type,onChange:e=>s({type:e.target.value}),className:"stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1 stg:py-0.5 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]","aria-label":`Type for field ${e.name}`,children:[(0,b.jsx)("option",{value:"string",children:"string"}),(0,b.jsx)("option",{value:"number",children:"number"}),(0,b.jsx)("option",{value:"boolean",children:"boolean"}),(0,b.jsx)("option",{value:"enum",children:"enum"})]}),(0,b.jsxs)("label",{className:"stg:flex stg:shrink-0 stg:cursor-pointer stg:items-center stg:gap-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:[(0,b.jsx)("input",{type:"checkbox",checked:e.required,onChange:e=>s({required:e.target.checked}),className:"stg:h-3 stg:w-3"}),"Req"]}),(0,b.jsx)("button",{type:"button",onClick:r,className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline","aria-label":`Remove field ${e.name}`,children:"✕"})]}),(0,b.jsx)("input",{type:"text",value:e.description,onChange:e=>s({description:e.target.value}),placeholder:"Description (optional)",className:"stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1 stg:py-0.5 stg:text-[10px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]"}),"enum"===e.type&&(0,b.jsx)("input",{type:"text",value:e.enumValues,onChange:e=>s({enumValues:e.target.value}),placeholder:"P1, P2, P3 (comma-separated)",className:"stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1 stg:py-0.5 stg:text-[10px] stg:font-mono stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]"})]})}function e8({timeout:e,onTimeout:s,hasEscalateOutcome:r,onUpdateConfig:a}){let n=(0,t.useMemo)(()=>{if(e<=0)return 1;for(let t=e1.length-1;t>=0;t--)if(e%e1[t].value==0)return e1[t].value;return 1},[e]),[o,l]=(0,t.useState)(n),i=e>0?Math.round(e/o):"",d=(0,t.useCallback)(e=>{let t=e.target.value;if(""===t)return void a("timeout",0);let s=parseInt(t,10);!isNaN(s)&&s>=0&&a("timeout",s*o)},[o,a]),g=(0,t.useCallback)(t=>{let s=Number(t.target.value);l(s),e>0&&a("timeout",Math.round(e/o)*s)},[e,o,a]);return(0,b.jsxs)(te,{title:"Timeout",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)("input",{type:"number",value:i,onChange:d,placeholder:"0",min:0,className:(0,j.cn)(ta,"stg:w-16"),"aria-label":"Timeout duration"}),(0,b.jsx)("select",{value:o,onChange:g,className:(0,j.cn)(ta,"stg:w-20"),"aria-label":"Timeout unit",children:e1.map(e=>(0,b.jsx)("option",{value:e.value,children:e.label},e.value))})]}),e>0&&(0,b.jsxs)("div",{className:"stg:mt-1.5 stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsx)("label",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"On timeout"}),(0,b.jsxs)("select",{value:s,onChange:e=>a("on_timeout",e.target.value||void 0),className:(0,j.cn)(ta),"aria-label":"Timeout policy",children:[(0,b.jsx)("option",{value:"",children:"— Default (fail) —"}),e0.map(e=>(0,b.jsx)("option",{value:e.value,children:e.label},e.value))]}),"HUMAN_INPUT_TIMEOUT_ESCALATE"===s&&!r&&(0,b.jsx)("p",{role:"alert",className:"stg:text-[10px] stg:text-[var(--stgm-warning,#d97706)]",children:'Escalate needs an outcome named "escalate" with routing — the timeout resolves to it. Add the outcome above, or the server will reject this workflow.'})]})]})}function e9({title:e,fieldPath:s,values:r,placeholder:a,onUpdateConfig:n}){let o=(0,t.useCallback)(e=>{n(s,e.length>0?e:void 0)},[s,n]),l=(0,t.useCallback)(()=>{o([...r,""])},[r,o]),i=(0,t.useCallback)(e=>o(r.filter((t,s)=>s!==e)),[r,o]),d=(0,t.useCallback)((e,t)=>{let s=[...r];s[e]=t,o(s)},[r,o]);return(0,b.jsxs)(te,{title:e,children:[(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:r.map((t,s)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:t,onChange:e=>d(s,e.target.value),placeholder:a,className:(0,j.cn)(ta,"stg:flex-1"),"aria-label":`${e} entry ${s+1}`}),(0,b.jsx)("button",{type:"button",onClick:()=>i(s),className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline","aria-label":`Remove ${e.toLowerCase()} entry ${s+1}`,children:"✕"})]},s))}),(0,b.jsx)("button",{type:"button",onClick:l,className:"stg:mt-1 stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add entry"})]})}function te({title:e,defaultOpen:s=!1,children:r}){let[a,n]=(0,t.useState)(s);return(0,b.jsxs)("div",{className:"stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:last:border-b-0",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>n(!a),className:"stg:flex stg:w-full stg:items-center stg:gap-1.5 stg:px-3 stg:py-2 stg:text-left stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]","aria-expanded":a,children:[(0,b.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:(0,j.cn)("stg:transition-transform",a&&"stg:rotate-90"),children:(0,b.jsx)("path",{d:"M6 4l4 4-4 4"})}),e]}),a&&(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5 stg:px-3 stg:pb-3",children:r})]})}function tt({onDragStart:e,onDragEnd:t}){return(0,b.jsx)("div",{draggable:!0,onDragStart:e,onDragEnd:t,className:"stg:flex stg:shrink-0 stg:cursor-grab stg:items-center stg:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)] stg:active:cursor-grabbing","aria-label":"Drag to reorder",children:(0,b.jsxs)("svg",{width:"8",height:"14",viewBox:"0 0 8 14",fill:"currentColor",children:[(0,b.jsx)("circle",{cx:"2",cy:"2",r:"1"}),(0,b.jsx)("circle",{cx:"6",cy:"2",r:"1"}),(0,b.jsx)("circle",{cx:"2",cy:"7",r:"1"}),(0,b.jsx)("circle",{cx:"6",cy:"7",r:"1"}),(0,b.jsx)("circle",{cx:"2",cy:"12",r:"1"}),(0,b.jsx)("circle",{cx:"6",cy:"12",r:"1"})]})})}function ts({direction:e,disabled:t,onClick:s}){return(0,b.jsx)("button",{type:"button",onClick:s,disabled:t,className:"stg:px-0.5 stg:py-0.5 stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)] stg:disabled:opacity-30","aria-label":`Move ${e}`,children:(0,b.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:"up"===e?(0,b.jsx)("path",{d:"M4 10l4-4 4 4"}):(0,b.jsx)("path",{d:"M4 6l4 4 4-4"})})})}let tr="stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",ta="stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-1.5 stg:py-1 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]";function tn(e){let t=e.outcomes;return Array.isArray(t)?t.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:"string"==typeof e.name?e.name:"",label:"string"==typeof e.label?e.label:"",then:"string"==typeof e.then?e.then:""})):[]}function to(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}let tl="stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",ti=(0,t.memo)(function({node:e,onFieldChange:s}){let r=e.config,a=r.run_config??{},n=r.output??{},o=Object.keys(n).length>0,[l,i]=(0,t.useState)(o),d=(0,t.useCallback)((e,t)=>{s(e,""===t?void 0:t)},[s]),g=(0,t.useCallback)((e,t)=>{let r={...a,[e]:""===t?void 0:t};for(let e of Object.keys(r))void 0===r[e]&&delete r[e];s("run_config",Object.keys(r).length>0?r:void 0)},[a,s]),c=(0,t.useCallback)((e,t)=>{s("output",{...n,[e]:""===t?void 0:t})},[n,s]),u=(0,t.useCallback)(()=>{l?(s("output",void 0),i(!1)):i(!0)},[l,s]),m=(0,t.useMemo)(()=>{let e=r.env;return!e||"object"!=typeof e||Array.isArray(e)?[]:Object.entries(e)},[r.env]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:[(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tu,{children:"Agent"}),(0,b.jsx)(tm,{label:"Agent",hint:'Slug or "org/slug" format',required:!0,children:(0,b.jsx)("input",{type:"text",value:"string"==typeof r.agent?r.agent:"",onChange:e=>d("agent",e.target.value),placeholder:"e.g., code-reviewer or acme/analyst",className:tl,"data-testid":"agent-call-agent-input"})}),(0,b.jsx)(tm,{label:"Harness",hint:"Execution engine for this agent call",children:(0,b.jsxs)("div",{className:"stg:flex stg:gap-3",children:[(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1.5 stg:text-xs",children:[(0,b.jsx)("input",{type:"radio",name:`${e.id}-harness`,checked:!r.harness||"HARNESS_NATIVE"===r.harness||"native"===r.harness,onChange:()=>d("harness",void 0),className:"stg:h-3.5 stg:w-3.5 stg:border-[var(--stgm-border,#d4d4d8)] stg:text-[var(--stgm-primary,#6366f1)]"}),"Native"]}),(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1.5 stg:text-xs",children:[(0,b.jsx)("input",{type:"radio",name:`${e.id}-harness`,checked:"cursor"===r.harness||"HARNESS_CURSOR"===r.harness,onChange:()=>d("harness","cursor"),className:"stg:h-3.5 stg:w-3.5 stg:border-[var(--stgm-border,#d4d4d8)] stg:text-[var(--stgm-primary,#6366f1)]"}),"Cursor"]})]})})]}),(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tu,{children:"Message"}),(0,b.jsx)(tm,{label:"Prompt",hint:"Instructions sent to the agent. Supports ${ } expressions.",required:!0,children:(0,b.jsx)("textarea",{value:"string"==typeof r.message?r.message:"",onChange:e=>d("message",e.target.value),placeholder:"Analyze this data: ${ $context.fetchData.body }",rows:4,className:`${tl} stg:resize-y stg:font-mono stg:border-[var(--stgm-chart-purple,#8b5cf6)]/40`,"data-testid":"agent-call-message-input"})})]}),m.length>0&&(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tu,{children:"Environment"}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:m.map(([e,t])=>(0,b.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:e,readOnly:!0,className:`${tl} stg:w-1/3 stg:bg-[var(--stgm-muted,#f5f5f5)]`}),(0,b.jsx)("input",{type:"text",value:"string"==typeof t?t:"",onChange:t=>{let s={...r.env??{}};s[e]=t.target.value||void 0,d("env",s)},placeholder:"value",className:`${tl} stg:flex-1`})]},e))})]}),(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tu,{children:"Execution"}),(0,b.jsx)(tm,{label:"Model",hint:"Override the agent's default model",children:(0,b.jsx)("input",{type:"text",value:"string"==typeof a.model_name?a.model_name:"",onChange:e=>g("model_name",e.target.value),placeholder:"Agent default",className:tl,"data-testid":"agent-call-model-input"})}),(0,b.jsx)(tm,{label:"Budget per run (USD)",hint:"The call stops when its estimated cost reaches this amount",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof a.max_cost_usd?a.max_cost_usd:"",onChange:e=>g("max_cost_usd",e.target.value?parseFloat(e.target.value):void 0),placeholder:"No limit",min:0,step:.05,className:tl,"data-testid":"agent-call-budget-input"})})]}),(0,b.jsx)(td,{entries:r.workspace_entries,onChange:e=>s("workspace_entries",e)}),(0,b.jsx)(tg,{refs:r.environment_refs,onChange:e=>s("environment_refs",e)}),(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,b.jsx)(tu,{children:"Structured output"}),(0,b.jsxs)("label",{className:"stg:flex stg:cursor-pointer stg:items-center stg:gap-1.5",children:[(0,b.jsx)("input",{type:"checkbox",checked:l,onChange:u,className:"stg:h-3.5 stg:w-3.5 stg:rounded stg:border-[var(--stgm-border,#d4d4d8)] stg:text-[var(--stgm-primary,#6366f1)]"}),(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:l?"Enabled":"Disabled"})]})]}),l&&(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tm,{label:"Schema",hint:"JSON Schema for the agent's structured response",children:(0,b.jsx)(tc,{value:n.schema,onChange:e=>c("schema",e)})}),(0,b.jsx)(tm,{label:"On invalid",hint:"Policy when output fails schema validation",children:(0,b.jsxs)("select",{value:"string"==typeof n.on_invalid?n.on_invalid:"",onChange:e=>c("on_invalid",e.target.value||void 0),className:tl,children:[(0,b.jsx)("option",{value:"",children:"Fail (default)"}),(0,b.jsx)("option",{value:"ON_INVALID_RETRY",children:"Retry"}),(0,b.jsx)("option",{value:"ON_INVALID_FALLBACK",children:"Fallback"})]})}),"ON_INVALID_RETRY"===n.on_invalid&&(0,b.jsx)(tm,{label:"Max retries",hint:"1–5 attempts",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof n.max_retries?n.max_retries:"",onChange:e=>c("max_retries",e.target.value?parseInt(e.target.value,10):void 0),placeholder:"1",min:1,max:5,className:tl})}),(0,b.jsx)(tm,{label:"Fallback task",hint:"Task to branch to if validation fails",children:(0,b.jsx)("input",{type:"text",value:"string"==typeof n.fallback_task?n.fallback_task:"",onChange:e=>c("fallback_task",e.target.value||void 0),placeholder:"Optional",className:tl})})]})]})]})});function td({entries:e,onChange:s}){let r=(0,t.useMemo)(()=>Array.isArray(e)?e:[],[e]),a=(0,t.useCallback)(e=>{s(e.length>0?e:void 0)},[s]),n=(0,t.useCallback)((e,t,s)=>{a([...r.map((r,a)=>{if(a!==e)return r;let n={url:t};return s&&(n.branch=s),{...r.name?{name:r.name}:{},source:{git_repo:n}}})])},[r,a]);return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,b.jsx)(tu,{children:"Workspace"}),(0,b.jsx)("button",{type:"button",onClick:()=>a([...r,{source:{git_repo:{url:""}}}]),className:"stg:text-[10px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)]","data-testid":"agent-call-workspace-add",children:"+ Add repository"})]}),0===r.length?(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Git repositories the agent works on. Private repos need an org-shared environment holding GITHUB_TOKEN bound under Environments."}):(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:r.map((e,t)=>{let s=e.source?.git_repo??{};return(0,b.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:s.url??"",onChange:e=>n(t,e.target.value,s.branch??""),placeholder:"https://github.com/org/repo",className:`${tl} stg:flex-1`,"data-testid":`agent-call-workspace-url-${t}`}),(0,b.jsx)("input",{type:"text",value:s.branch??"",onChange:e=>n(t,s.url??"",e.target.value),placeholder:"branch",className:`${tl} stg:w-1/4`,"data-testid":`agent-call-workspace-branch-${t}`}),(0,b.jsx)("button",{type:"button",onClick:()=>a(r.filter((e,s)=>s!==t)),"aria-label":`Remove workspace entry ${t+1}`,className:"stg:mt-1 stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-destructive,#ef4444)]",children:"×"})]},t)})})]})}function tg({refs:e,onChange:s}){let r=(0,t.useMemo)(()=>Array.isArray(e)?e:[],[e]),a=(0,t.useCallback)(e=>{s(e.length>0?e:void 0)},[s]),n=(0,t.useCallback)((e,t,s)=>{a([...r.map((r,a)=>{if(a!==e)return r;let n={},o="org"===t?s:r.org??"",l="slug"===t?s:r.slug??"";return o&&(n.org=o),n.slug=l,n})])},[r,a]);return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,b.jsx)(tu,{children:"Environments"}),(0,b.jsx)("button",{type:"button",onClick:()=>a([...r,{slug:""}]),className:"stg:text-[10px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)]","data-testid":"agent-call-envref-add",children:"+ Bind environment"})]}),0===r.length?(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Environment resources whose values are provided to this call's runs — credentials bind here, not on the agent."}):(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:r.map((e,t)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:e.org??"",onChange:e=>n(t,"org",e.target.value),placeholder:"org (optional)",className:`${tl} stg:w-1/3`,"data-testid":`agent-call-envref-org-${t}`}),(0,b.jsx)("input",{type:"text",value:e.slug??"",onChange:e=>n(t,"slug",e.target.value),placeholder:"environment slug",className:`${tl} stg:flex-1`,"data-testid":`agent-call-envref-slug-${t}`}),(0,b.jsx)("button",{type:"button",onClick:()=>a(r.filter((e,s)=>s!==t)),"aria-label":`Remove environment reference ${t+1}`,className:"stg:mt-1 stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-destructive,#ef4444)]",children:"×"})]},t))})]})}function tc({value:e,onChange:s}){let r=null!=e?JSON.stringify(e,null,2):"",[a,n]=(0,t.useState)(r),[o,l]=(0,t.useState)(null),i=(0,t.useCallback)(e=>{let t=e.target.value;if(n(t),!t.trim()){l(null),s(void 0);return}try{let e=JSON.parse(t);l(null),s(e)}catch{l("Invalid JSON Schema")}},[s]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,b.jsx)("textarea",{value:a,onChange:i,rows:5,className:`${tl} stg:resize-y stg:font-mono stg:text-[11px]`,placeholder:'{ "type": "object", "properties": { ... } }'}),o&&(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)]",children:o})]})}function tu({children:e}){return(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:e})}function tm({label:e,hint:t,required:s,children:r}){return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-1 stg:text-[11px] stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:[e,s&&(0,b.jsx)("span",{className:"stg:text-[var(--stgm-destructive,#ef4444)]","aria-label":"required",children:"*"})]}),t&&(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:t}),r]})}let th=["GET","POST","PUT","DELETE","PATCH"],tp=new Set(["POST","PUT","PATCH"]),tf="stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",tx=(0,t.memo)(function({node:e,onFieldChange:s}){let r=e.config,a=r.endpoint??{},n="string"==typeof r.method?r.method:"GET",o=tp.has(n),l=(0,t.useCallback)((e,t)=>{s(e,""===t?void 0:t)},[s]),i=(0,t.useCallback)((e,t)=>{s("endpoint",{...a,[e]:""===t?void 0:t})},[a,s]),d=(0,t.useMemo)(()=>{let e=r.headers;return!e||"object"!=typeof e||Array.isArray(e)?{}:e},[r.headers]),g=(0,t.useMemo)(()=>Object.entries(d),[d]),c=(0,t.useCallback)((e,t,s)=>{let r={};for(let[a,n]of Object.entries(d))a===e?r[t]=s:r[a]=n;l("headers",Object.keys(r).length>0?r:void 0)},[d,l]),u=(0,t.useCallback)(()=>{l("headers",{...d,"":""})},[d,l]),m=(0,t.useCallback)(e=>{let{[e]:t,...s}=d;l("headers",Object.keys(s).length>0?s:void 0)},[d,l]),[h,p]=(0,t.useState)(null!=r.body?JSON.stringify(r.body,null,2):""),[f,x]=(0,t.useState)(null),v=(0,t.useCallback)(e=>{let t=e.target.value;if(p(t),!t.trim()){x(null),l("body",void 0);return}try{let e=JSON.parse(t);x(null),l("body",e)}catch{x("Invalid JSON")}},[l]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:[(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tv,{children:"Request"}),(0,b.jsxs)("div",{className:"stg:flex stg:gap-2",children:[(0,b.jsx)("select",{value:n,onChange:e=>l("method",e.target.value),className:`${tf} stg:w-24 stg:shrink-0`,"data-testid":"http-call-method-select",children:th.map(e=>(0,b.jsx)("option",{value:e,children:e},e))}),(0,b.jsx)("input",{type:"text",value:"string"==typeof a.uri?a.uri:"",onChange:e=>i("uri",e.target.value),placeholder:"https://api.example.com/data",className:`${tf} stg:flex-1 stg:font-mono stg:border-[var(--stgm-chart-purple,#8b5cf6)]/40`,"data-testid":"http-call-url-input"})]})]}),(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tv,{children:"Headers"}),g.length>0&&(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:g.map(([e,t],s)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-1",children:[(0,b.jsx)("input",{type:"text",value:e,onChange:s=>c(e,s.target.value,t),placeholder:"Header name",className:`${tf} stg:w-2/5`}),(0,b.jsx)("input",{type:"text",value:"string"==typeof t?t:"",onChange:t=>c(e,e,t.target.value),placeholder:"Value",className:`${tf} stg:flex-1`}),(0,b.jsx)("button",{type:"button",onClick:()=>m(e),className:"stg:mt-1 stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:underline","aria-label":`Remove header ${e}`,children:"✕"})]},s))}),(0,b.jsx)("button",{type:"button",onClick:u,className:"stg:self-start stg:text-[11px] stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"+ Add header"})]}),o&&(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tv,{children:"Body"}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5",children:[(0,b.jsx)("textarea",{value:h,onChange:v,rows:5,className:`${tf} stg:resize-y stg:font-mono stg:text-[11px]`,placeholder:'{ "key": "value" }',"data-testid":"http-call-body-input"}),f&&(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-destructive,#ef4444)]",children:f})]})]}),(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)(tv,{children:"Settings"}),(0,b.jsx)(tb,{label:"Timeout",hint:"Seconds (1–300)",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof r.timeout_seconds?r.timeout_seconds:"",onChange:e=>l("timeout_seconds",e.target.value?parseInt(e.target.value,10):void 0),placeholder:"30",min:1,max:300,className:tf})})]})]})});function tv({children:e}){return(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:e})}function tb({label:e,hint:t,children:s}){return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsx)("label",{className:"stg:text-[11px] stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e}),t&&(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:t}),s]})}let ty=(0,t.memo)(function({node:e,graph:t,descriptor:s,kindString:r,otherTaskNames:a,onFieldChange:n,mutations:o}){return"agent_call"===r?(0,b.jsx)(ti,{node:e,onFieldChange:n}):"http_call"===r?(0,b.jsx)(tx,{node:e,onFieldChange:n}):"switch_case"===r&&o.onUpdateBranchRouting&&o.onMigrateBranchHandle&&o.onRemoveBranchEdges?(0,b.jsx)("div",{className:"stg:px-3 stg:py-3",children:(0,b.jsx)(eJ,{nodeId:e.id,config:e.config,edges:t.edges,allTaskNames:a,onUpdateConfig:n,onUpdateBranchRouting:(t,s)=>o.onUpdateBranchRouting(e.id,t,s),onMigrateBranchHandle:(t,s)=>o.onMigrateBranchHandle(e.id,t,s),onRemoveBranchEdges:t=>o.onRemoveBranchEdges(e.id,t)})}):"human_input"===r&&o.onUpdateBranchRouting&&o.onMigrateBranchHandle&&o.onRemoveBranchEdges?(0,b.jsx)("div",{className:"stg:px-3 stg:py-3",children:(0,b.jsx)(e3,{nodeId:e.id,config:e.config,edges:t.edges,allTaskNames:a,onUpdateConfig:n,onUpdateBranchRouting:(t,s)=>o.onUpdateBranchRouting(e.id,t,s),onMigrateBranchHandle:(t,s)=>o.onMigrateBranchHandle(e.id,t,s),onRemoveBranchEdges:t=>o.onRemoveBranchEdges(e.id,t)})}):s&&s.fields.length>0?(0,b.jsx)(eL,{fields:s.fields,fieldGroups:s.fieldGroups,config:e.config,onChange:n}):(0,b.jsx)("div",{className:"stg:px-3 stg:py-4 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No configurable fields for this task kind."})});var tk=e.i(869803);let tj=(0,t.memo)(function({node:e,graph:t,mutations:s,kindString:r}){return"switch_case"===r?(0,b.jsx)(tN,{node:e,graph:t,mutations:s}):"fork"===r?(0,b.jsx)(tC,{node:e,mutations:s}):null});function tN({node:e,graph:s,mutations:r}){let a=e.config,n=(0,t.useMemo)(()=>{let e=a.cases;return Array.isArray(e)?e.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:e.name||"",when:e.when||"",then:e.then||""})):[]},[a.cases]),o=s.edges.filter(t=>t.source===e.id&&t.sourceHandle?.startsWith("case_")),l=(0,t.useCallback)(t=>{r.onRemoveSwitchCase?.(e.id,t)},[r,e.id]),i=(0,t.useCallback)(t=>{if(t<=0||!r.onReorderSwitchCases)return;let s=n.map(e=>e.name);[s[t-1],s[t]]=[s[t],s[t-1]],r.onReorderSwitchCases(e.id,s)},[n,r,e.id]),d=(0,t.useCallback)(t=>{if(t>=n.length-1||!r.onReorderSwitchCases)return;let s=n.map(e=>e.name);[s[t],s[t+1]]=[s[t+1],s[t]],r.onReorderSwitchCases(e.id,s)},[n,r,e.id]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3 stg:px-3 stg:py-3",children:[(0,b.jsx)("div",{className:"stg:flex stg:items-center stg:justify-between",children:(0,b.jsxs)("h3",{className:"stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)]",children:["Cases (",n.length,")"]})}),0===n.length?(0,b.jsx)("p",{className:"stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No cases defined. Add a case to create conditional branches."}):(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:n.map((e,t)=>{let s=!e.when,r=o.find(t=>t.sourceHandle===`case_${e.name}`);return(0,b.jsxs)("div",{className:(0,j.cn)("stg:group/case stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:px-2 stg:py-1.5",s?"stg:border-dashed stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-muted,#f5f5f5)]":"stg:border-[var(--stgm-border,#e5e5e5)]"),children:[(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5 stg:opacity-0 stg:group-hover/case:opacity-100 stg:transition-opacity",children:[(0,b.jsx)("button",{type:"button",onClick:()=>i(t),disabled:0===t,className:"stg:text-[var(--stgm-muted-foreground,#737373)] stg:disabled:opacity-30 stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":`Move ${e.name} up`,children:(0,b.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M4 1L1 5h6L4 1z"})})}),(0,b.jsx)("button",{type:"button",onClick:()=>d(t),disabled:t===n.length-1,className:"stg:text-[var(--stgm-muted-foreground,#737373)] stg:disabled:opacity-30 stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":`Move ${e.name} down`,children:(0,b.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M4 7L1 3h6L4 7z"})})})]}),(0,b.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,b.jsx)("span",{className:"stg:text-[11px] stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)] stg:truncate",children:e.name}),s&&(0,b.jsx)("span",{className:"stg:shrink-0 stg:rounded-sm stg:bg-[var(--stgm-muted,#f5f5f5)] stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:px-1 stg:py-px stg:text-[9px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"default"})]}),e.when&&(0,b.jsx)("p",{className:"stg:mt-0.5 stg:text-[10px] stg:font-mono stg:text-[var(--stgm-muted-foreground,#737373)] stg:truncate",children:e.when}),r&&(0,b.jsxs)("p",{className:"stg:mt-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:["→ ",r.target]})]}),(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:()=>l(e.name),className:"stg:shrink-0 stg:opacity-0 stg:group-hover/case:opacity-100 stg:transition-opacity stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-destructive,#ef4444)]","aria-label":`Remove case ${e.name}`}),children:(0,b.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M3 3l6 6M9 3l-6 6"})})}),(0,b.jsx)(eN.TooltipContent,{side:"top",children:"Remove case"})]})]},e.name)})})]})}function tC({node:e,mutations:s}){let r=e.config,a=(0,t.useMemo)(()=>{let e=r.branches;return Array.isArray(e)?e.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:e.name||"",taskCount:Array.isArray(e.do)?e.do.length:0})):[]},[r.branches]),n=!0===r.compete,o=(0,t.useCallback)(t=>{s.onSetForkCompete?.(e.id,t)},[s,e.id]),l=(0,t.useCallback)(t=>{s.onRemoveForkBranch?.(e.id,t)},[s,e.id]),i=(0,t.useCallback)(t=>{if(t<=0||!s.onReorderForkBranches)return;let r=a.map(e=>e.name);[r[t-1],r[t]]=[r[t],r[t-1]],s.onReorderForkBranches(e.id,r)},[a,s,e.id]),d=(0,t.useCallback)(t=>{if(t>=a.length-1||!s.onReorderForkBranches)return;let r=a.map(e=>e.name);[r[t],r[t+1]]=[r[t+1],r[t]],s.onReorderForkBranches(e.id,r)},[a,s,e.id]),[g,c]=(0,t.useState)(null),[u,m]=(0,t.useState)(""),h=(0,t.useCallback)((e,t)=>{c(e),m(t)},[]),p=(0,t.useCallback)(()=>{if(null===g)return;let t=a[g]?.name,r=u.trim();t&&r&&r!==t&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&s.onRenameForkBranch?.(e.id,t,r),c(null)},[g,u,a,s,e.id]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3 stg:px-3 stg:py-3",children:[(0,b.jsxs)("fieldset",{className:tk.UNSTYLED_FIELDSET,children:[(0,b.jsx)("legend",{className:"stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:mb-1.5",children:"Join policy"}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-2 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:`join-policy-${e.id}`,checked:!n,onChange:()=>o(!1),className:"stg:h-3 stg:w-3 stg:accent-[var(--stgm-primary,#6366f1)]"}),"Wait for all branches"]}),(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-2 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:`join-policy-${e.id}`,checked:n,onChange:()=>o(!0),className:"stg:h-3 stg:w-3 stg:accent-[var(--stgm-primary,#6366f1)]"}),"Race mode (first branch wins)"]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("h3",{className:"stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:mb-1.5",children:["Parallel branches (",a.length,")"]}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:a.map((e,t)=>(0,b.jsxs)("div",{className:"stg:group/branch stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:px-2 stg:py-1.5",children:[(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-0.5 stg:opacity-0 stg:group-hover/branch:opacity-100 stg:transition-opacity",children:[(0,b.jsx)("button",{type:"button",onClick:()=>i(t),disabled:0===t,className:"stg:text-[var(--stgm-muted-foreground,#737373)] stg:disabled:opacity-30 stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":`Move ${e.name} up`,children:(0,b.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M4 1L1 5h6L4 1z"})})}),(0,b.jsx)("button",{type:"button",onClick:()=>d(t),disabled:t===a.length-1,className:"stg:text-[var(--stgm-muted-foreground,#737373)] stg:disabled:opacity-30 stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":`Move ${e.name} down`,children:(0,b.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M4 7L1 3h6L4 7z"})})})]}),(0,b.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[g===t?(0,b.jsx)("input",{type:"text",value:u,onChange:e=>m(e.target.value),onBlur:p,onKeyDown:e=>{"Enter"===e.key&&p(),"Escape"===e.key&&c(null)},autoFocus:!0,className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-ring,#3b82f6)] stg:bg-[var(--stgm-background,#fff)] stg:px-1 stg:py-0.5 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:outline-none"}):(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("span",{className:"stg:text-[11px] stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)] stg:truncate stg:block stg:cursor-text",onDoubleClick:()=>h(t,e.name)}),children:e.name}),(0,b.jsx)(eN.TooltipContent,{side:"top",children:"Double-click to rename"})]}),(0,b.jsxs)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:[e.taskCount," ",1===e.taskCount?"task":"tasks"]})]}),(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("span",{className:"stg:inline-flex stg:shrink-0"}),children:(0,b.jsx)("button",{type:"button",onClick:()=>l(e.name),disabled:a.length<=2,className:"stg:shrink-0 stg:opacity-0 stg:group-hover/branch:opacity-100 stg:transition-opacity stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:text-[var(--stgm-destructive,#ef4444)] stg:disabled:opacity-30 stg:disabled:cursor-not-allowed","aria-label":`Remove branch ${e.name}`,children:(0,b.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M3 3l6 6M9 3l-6 6"})})})}),(0,b.jsx)(eN.TooltipContent,{side:"top",children:a.length<=2?"Fork requires at least 2 branches":"Remove branch"})]})]},e.name))})]})]})}let tw=(0,t.memo)(function({node:e,mutations:s}){let r=e.config,a=(0,t.useMemo)(()=>{let e=r.try;return Array.isArray(e)?e.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:e.name||"unnamed",kind:e.kind||"unknown"})):[]},[r.try]),n=(0,t.useMemo)(()=>{let e=r.catch;return e&&"object"==typeof e?{as:e.as||"error",compensate:!0===e.compensate,tasks:Array.isArray(e.do)?e.do.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:e.name||"unnamed",kind:e.kind||"unknown"})):[]}:null},[r.catch]),[o,l]=(0,t.useState)(n?.as??"error"),i=(0,t.useCallback)(()=>{let t=o.trim();t&&t!==n?.as&&s.onUpdateCatchConfig?.(e.id,{as:t})},[o,n?.as,s,e.id]),d=(0,t.useCallback)(t=>{s.onUpdateCatchConfig?.(e.id,{compensate:t.target.checked})},[s,e.id]),g=(0,t.useCallback)(()=>{s.onRemoveCatchBlock?.(e.id)},[s,e.id]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:[(0,b.jsxs)("section",{children:[(0,b.jsxs)("h3",{className:"stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:mb-1.5",children:["Protected tasks (",a.length,")"]}),0===a.length?(0,b.jsx)("p",{className:"stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No tasks in the try block."}):(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:a.map((e,t)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:px-2 stg:py-1",children:[(0,b.jsx)("span",{className:"stg:text-[10px] stg:font-mono stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.kind}),(0,b.jsx)("span",{className:"stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:truncate",children:e.name})]},`${e.name}-${t}`))})]}),n?(0,b.jsxs)("section",{children:[(0,b.jsx)("h3",{className:"stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:mb-1.5",children:"Catch handler"}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2.5",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"stg:mb-1 stg:block stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Error variable name"}),(0,b.jsx)("input",{type:"text",value:o,onChange:e=>l(e.target.value),onBlur:i,onKeyDown:e=>{"Enter"===e.key&&i()},className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-input-bg,var(--stgm-background,#fff))] stg:px-2 stg:py-1.5 stg:text-xs stg:font-mono stg:text-[var(--stgm-foreground,#1a1a2e)] stg:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",placeholder:"error"}),(0,b.jsxs)("p",{className:"stg:mt-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:["Access in catch block as ",(0,b.jsxs)("code",{className:"stg:font-mono",children:["$","${","$context.",o,"}"]})]})]}),(0,b.jsxs)("label",{className:"stg:flex stg:items-center stg:gap-2 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:n.compensate,onChange:d,className:"stg:h-3 stg:w-3 stg:accent-[var(--stgm-primary,#6366f1)]"}),"Run compensation before catch block"]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("h4",{className:"stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)] stg:mb-1",children:["Catch tasks (",n.tasks.length,")"]}),0===n.tasks.length?(0,b.jsx)("p",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)] stg:italic",children:"No tasks in catch block"}):(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:n.tasks.map((e,t)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded stg:border stg:border-dashed stg:border-[var(--stgm-border,#e5e5e5)] stg:px-2 stg:py-1",children:[(0,b.jsx)("span",{className:"stg:text-[10px] stg:font-mono stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.kind}),(0,b.jsx)("span",{className:"stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:truncate",children:e.name})]},`${e.name}-${t}`))})]}),(0,b.jsx)("button",{type:"button",onClick:g,className:"stg:mt-1 stg:w-full stg:rounded stg:border stg:border-[var(--stgm-destructive,#ef4444)]/30 stg:px-2 stg:py-1.5 stg:text-[11px] stg:font-medium stg:text-[var(--stgm-destructive,#ef4444)] stg:transition-colors stg:hover:bg-[var(--stgm-destructive,#ef4444)]/10",children:"Remove catch handler"})]})]}):(0,b.jsx)("section",{children:(0,b.jsx)("p",{className:"stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No catch handler configured. Add one using the + button on the node."})})]})}),t_=[{value:"FOR_EACH_FAIL_FAST",label:"Fail fast",description:"Stop on first error, cancel in-flight iterations"},{value:"FOR_EACH_CONTINUE",label:"Continue",description:"Continue remaining iterations, collect failures in output"},{value:"FOR_EACH_SKIP",label:"Skip",description:"Skip failed items silently, exclude from output"}],tS=(0,t.memo)(function({node:e,mutations:s}){let r=e.config,a=(0,t.useMemo)(()=>({each:r.each||"",in:r.in||"",max_parallelism:r.max_parallelism||0,batch_size:r.batch_size||0,on_error:r.on_error||"FOR_EACH_FAIL_FAST"}),[r.each,r.in,r.max_parallelism,r.batch_size,r.on_error]),n=(0,t.useMemo)(()=>{let e=r.do;return Array.isArray(e)?e.filter(e=>null!=e&&"object"==typeof e).map(e=>({name:e.name||"unnamed",kind:e.kind||"unknown"})):[]},[r.do]),[o,l]=(0,t.useState)(a.each),[i,d]=(0,t.useState)(a.in),[g,c]=(0,t.useState)(a.max_parallelism),[u,m]=(0,t.useState)(a.batch_size),[h,p]=(0,t.useState)(a.on_error),f=(0,t.useCallback)((t,r)=>{s.onUpdateForEachConfig?.(e.id,{[t]:r})},[s,e.id]),x=(0,t.useCallback)(()=>{let e=o.trim();e&&e!==a.each&&f("each",e)},[o,a.each,f]),v=(0,t.useCallback)(()=>{let e=i.trim();e&&e!==a.in&&f("in",e)},[i,a.in,f]),y=(0,t.useCallback)(()=>{g!==a.max_parallelism&&f("max_parallelism",g)},[g,a.max_parallelism,f]),k=(0,t.useCallback)(()=>{u!==a.batch_size&&f("batch_size",u)},[u,a.batch_size,f]),j=(0,t.useCallback)(e=>{p(e),f("on_error",e)},[f]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"stg:mb-1 stg:block stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Item variable name"}),(0,b.jsx)("input",{type:"text",value:o,onChange:e=>l(e.target.value),onBlur:x,onKeyDown:e=>{"Enter"===e.key&&x()},className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-input-bg,var(--stgm-background,#fff))] stg:px-2 stg:py-1.5 stg:text-xs stg:font-mono stg:text-[var(--stgm-foreground,#1a1a2e)] stg:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",placeholder:"item"}),(0,b.jsxs)("p",{className:"stg:mt-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:["Access as ",(0,b.jsxs)("code",{className:"stg:font-mono",children:["${","$data.",o||"item","}"]})," in nested tasks"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"stg:mb-1 stg:block stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Collection expression"}),(0,b.jsx)("input",{type:"text",value:i,onChange:e=>d(e.target.value),onBlur:v,onKeyDown:e=>{"Enter"===e.key&&v()},className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-input-bg,var(--stgm-background,#fff))] stg:px-2 stg:py-1.5 stg:text-xs stg:font-mono stg:text-[var(--stgm-foreground,#1a1a2e)] stg:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",placeholder:"${ $data.items }"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"stg:mb-1 stg:block stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Concurrency (max_parallelism)"}),(0,b.jsx)("input",{type:"number",min:0,value:g,onChange:e=>c(Math.max(0,parseInt(e.target.value)||0)),onBlur:y,className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-input-bg,var(--stgm-background,#fff))] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]"}),(0,b.jsx)("p",{className:"stg:mt-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:0===g?"Sequential execution (one at a time)":`Up to ${g} iterations in parallel`})]}),g>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"stg:mb-1 stg:block stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Batch size"}),(0,b.jsx)("input",{type:"number",min:0,value:u,onChange:e=>m(Math.max(0,parseInt(e.target.value)||0)),onBlur:k,className:"stg:w-full stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-input-bg,var(--stgm-background,#fff))] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]"}),(0,b.jsx)("p",{className:"stg:mt-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:0===u?"No batching — all items available for parallel execution":`Process ${u} items per batch`})]}),g>0&&(0,b.jsxs)("fieldset",{className:tk.UNSTYLED_FIELDSET,children:[(0,b.jsx)("legend",{className:"stg:text-[10px] stg:font-medium stg:text-[var(--stgm-muted-foreground,#737373)] stg:mb-1.5",children:"Error policy"}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:t_.map(t=>(0,b.jsxs)("label",{className:"stg:flex stg:items-start stg:gap-2 stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:cursor-pointer",children:[(0,b.jsx)("input",{type:"radio",name:`error-policy-${e.id}`,value:t.value,checked:h===t.value,onChange:()=>j(t.value),className:"stg:mt-0.5 stg:h-3 stg:w-3 stg:accent-[var(--stgm-primary,#6366f1)]"}),(0,b.jsxs)("span",{children:[(0,b.jsx)("span",{className:"stg:font-medium",children:t.label}),(0,b.jsx)("br",{}),(0,b.jsx)("span",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:t.description})]})]},t.value))})]}),(0,b.jsxs)("section",{children:[(0,b.jsxs)("h3",{className:"stg:text-xs stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)] stg:mb-1.5",children:["Loop body (",n.length," ",1===n.length?"task":"tasks",")"]}),0===n.length?(0,b.jsx)("p",{className:"stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No tasks in loop body."}):(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:n.map((e,t)=>(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:px-2 stg:py-1",children:[(0,b.jsx)("span",{className:"stg:text-[10px] stg:font-mono stg:text-[var(--stgm-muted-foreground,#737373)]",children:e.kind}),(0,b.jsx)("span",{className:"stg:text-[11px] stg:text-[var(--stgm-foreground,#1a1a2e)] stg:truncate",children:e.name})]},`${e.name}-${t}`))})]})]})}),tE=(0,t.memo)(function({node:e,onUpdateExport:s}){let[r,a]=(0,t.useState)(e.export?.as??""),n=(0,t.useCallback)(e=>{a(e.target.value)},[]),o=(0,t.useCallback)(()=>{let t=r.trim();s(e.id,t||void 0)},[r,e.id,s]);return(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Export"}),(0,b.jsxs)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:["Save task output to the workflow context for downstream tasks. Use ",(0,b.jsx)("code",{className:"stg:rounded stg:bg-[var(--stgm-muted,#f5f5f5)] stg:px-1 stg:text-[10px]",children:"${ . }"})," to export the entire output."]}),(0,b.jsx)("input",{type:"text",value:r,onChange:n,onBlur:o,placeholder:"e.g., ${ . } or ${ .fieldName }",className:"stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]"})]})})}),tT=new Set(["agent_call","llm_call","eval"]),tM=new Set(["http_call","grpc_call","activity_call","run_workflow"]),tI=(0,t.memo)(function({node:e,kindString:s,descriptor:r,onFieldChange:a}){let n=e.config,o=tT.has(s),l=tM.has(s),i=(0,t.useCallback)((e,t)=>a(e,t),[a]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:["agent_call"===s&&(0,b.jsx)(tA,{config:n,onChange:i}),o&&"agent_call"!==s&&(0,b.jsx)(tD,{config:n,onChange:i}),l&&(0,b.jsx)(tR,{config:n,kindString:s,onChange:i}),"fork"===s&&(0,b.jsx)(t$,{config:n,onChange:i}),"for_each"===s&&(0,b.jsx)(tO,{config:n,onChange:i}),!o&&!l&&"fork"!==s&&"for_each"!==s&&(0,b.jsx)("p",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No runtime settings available for this task kind."})]})});function tA({config:e,onChange:s}){let r=e.run_config??{},a=(0,t.useCallback)((e,t)=>{let a={...r,[e]:""===t?void 0:t};for(let e of Object.keys(a))void 0===a[e]&&delete a[e];s("run_config",Object.keys(a).length>0?a:void 0)},[r,s]);return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,b.jsx)(tP,{children:"Execution"}),(0,b.jsx)(tB,{label:"Model",hint:"Override agent default model",children:(0,b.jsx)("input",{type:"text",value:"string"==typeof r.model_name?r.model_name:"",onChange:e=>a("model_name",e.target.value||void 0),placeholder:"Agent default",className:tL})}),(0,b.jsx)(tB,{label:"Budget per run (USD)",hint:"The call stops when its estimated cost reaches this amount",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof r.max_cost_usd?r.max_cost_usd:"",onChange:e=>a("max_cost_usd",e.target.value?parseFloat(e.target.value):void 0),placeholder:"No limit",min:0,step:.05,className:tL})})]})}function tD({config:e,onChange:s}){let r=e.config??{},a=(0,t.useCallback)((e,t)=>{s("config",{...r,[e]:""===t?void 0:t})},[r,s]);return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,b.jsx)(tP,{children:"Execution"}),(0,b.jsx)(tB,{label:"Timeout",hint:"Seconds before the task is cancelled",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof r.timeout?r.timeout:"",onChange:e=>a("timeout",e.target.value?parseInt(e.target.value,10):void 0),placeholder:"300",min:1,max:3600,className:tL})}),(0,b.jsx)(tB,{label:"Max cost",hint:"Per-task cost cap in micro-USD",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof r.max_cost_micros?r.max_cost_micros:"",onChange:e=>a("max_cost_micros",e.target.value?parseInt(e.target.value,10):void 0),placeholder:"No limit",min:0,className:tL})})]})}function tR({config:e,kindString:t,onChange:s}){let r="http_call"===t?"timeout_seconds":"timeout",a=e[r];return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,b.jsx)(tP,{children:"Execution"}),(0,b.jsx)(tB,{label:"Timeout",hint:"Seconds before the request is cancelled",children:(0,b.jsx)("input",{type:"number",value:"number"==typeof a?a:"",onChange:e=>s(r,e.target.value?parseInt(e.target.value,10):void 0),placeholder:"30",min:1,className:tL})})]})}function t$({config:e,onChange:t}){let s=!0===e.compete;return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,b.jsx)(tP,{children:"Join policy"}),(0,b.jsxs)("label",{className:"stg:flex stg:cursor-pointer stg:items-center stg:gap-2",children:[(0,b.jsx)("input",{type:"checkbox",checked:s,onChange:e=>t("compete",e.target.checked||void 0),className:"stg:h-4 stg:w-4 stg:rounded stg:border-[var(--stgm-border,#d4d4d8)] stg:text-[var(--stgm-primary,#6366f1)]"}),(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:"Compete mode (first branch wins)"})]}),(0,b.jsx)("p",{className:"stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:s?"The join resumes when any branch completes. Other branches are cancelled.":"The join waits for all branches to complete before continuing."})]})}function tO({config:e,onChange:t}){return(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,b.jsx)(tP,{children:"Iteration"}),(0,b.jsx)(tB,{label:"Collection",hint:"Expression that produces the items to iterate",children:(0,b.jsx)("input",{type:"text",value:"string"==typeof e.collection?e.collection:"",onChange:e=>t("collection",e.target.value||void 0),placeholder:"${ $context.items }",className:tL})})]})}let tL="stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]";function tP({children:e}){return(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:e})}function tB({label:e,hint:t,children:s}){return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsx)("label",{className:"stg:text-[11px] stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e}),t&&(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:t}),s]})}let tH=new Set(["switch_case","human_input"]),tF=(0,t.memo)(function({node:e,otherTaskNames:s,kindString:r,onUpdateFlow:a}){let n=tH.has(r),o=e.flow?.then??"",l=(0,t.useCallback)(t=>{a(e.id,t.target.value||void 0)},[e.id,a]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:[!n&&(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Flow control"}),(0,b.jsx)("p",{className:"stg:text-[10px] stg:leading-tight stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Override the default sequential execution order."}),(0,b.jsxs)("select",{value:o,onChange:l,className:"stg:w-full stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-ring,#3b82f6)]",children:[(0,b.jsx)("option",{value:"",children:"Next (implicit sequential)"}),(0,b.jsx)("option",{value:"end",children:"End workflow"}),s.map(e=>(0,b.jsx)("option",{value:e,children:e},e))]})]}),n&&(0,b.jsx)("p",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Flow routing for this task is managed through its branch configuration in the Configure tab."}),(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Task metadata"}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1 stg:text-[11px]",children:[(0,b.jsx)(tU,{label:"ID",value:e.id}),(0,b.jsx)(tU,{label:"Kind",value:r}),(0,b.jsx)(tU,{label:"Category",value:e.category}),e.export?.as&&(0,b.jsx)(tU,{label:"Exports as",value:e.export.as}),e.flow?.then&&(0,b.jsx)(tU,{label:"Then",value:e.flow.then})]})]})]})});function tU({label:e,value:t}){return(0,b.jsxs)("div",{className:"stg:flex stg:items-baseline stg:gap-2",children:[(0,b.jsxs)("span",{className:"stg:shrink-0 stg:text-[var(--stgm-muted-foreground,#737373)]",children:[e,":"]}),(0,b.jsx)("span",{className:"stg:min-w-0 stg:break-all stg:font-mono stg:text-[var(--stgm-foreground,#1a1a2e)]",children:t})]})}let tV=(0,t.memo)(function({descriptor:e}){let t=e.yamlExamples&&e.yamlExamples.length>0,s=!!e.documentationUrl;return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4 stg:px-3 stg:py-3",children:[e.description&&(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Description"}),(0,b.jsx)("p",{className:"stg:text-xs stg:leading-relaxed stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.description})]}),t&&(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"YAML examples"}),e.yamlExamples.map((e,t)=>(0,b.jsx)("pre",{className:"stg:overflow-x-auto stg:rounded-md stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-muted,#f5f5f5)] stg:p-2 stg:text-[11px] stg:leading-relaxed stg:text-[var(--stgm-foreground,#1a1a2e)]",children:(0,b.jsx)("code",{children:e})},t))]}),s&&(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Documentation"}),(0,b.jsx)("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"stg:text-xs stg:font-medium stg:text-[var(--stgm-primary,#6366f1)] stg:hover:underline",children:"View full documentation →"})]}),!t&&!s&&!e.description&&(0,b.jsx)("p",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No documentation available for this task kind."})]})});function tW({edge:e,graph:t,onDeleteEdge:s,className:r}){let a=t.nodes.find(t=>t.id===e.source),n=t.nodes.find(t=>t.id===e.target);return(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:flex-col stg:gap-4 stg:p-3",r),children:[(0,b.jsx)("h3",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Connection"}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs",children:[(0,b.jsx)("span",{className:"stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:a?.taskName??e.source}),(0,b.jsx)("span",{className:"stg:text-[var(--stgm-muted-foreground,#737373)]",children:"→"}),(0,b.jsx)("span",{className:"stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:n?.taskName??e.target})]}),e.label&&(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,b.jsx)("span",{className:"stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Label:"}),(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.label})]}),e.sourceHandle&&(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,b.jsx)("span",{className:"stg:text-[11px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Port:"}),(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.sourceHandle})]})]}),s&&(0,b.jsx)("button",{type:"button",onClick:()=>s(e.id),className:"stg:self-start stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:text-[var(--stgm-destructive,#ef4444)] stg:hover:bg-[var(--stgm-destructive,#ef4444)]/10",children:"Delete connection"})]})}function tK({node:e,className:t}){let s=e.id===D.START_NODE_ID;return(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:flex-col stg:gap-2 stg:p-3",t),children:[(0,b.jsx)("h3",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:s?"Start":"End"}),(0,b.jsx)("p",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:s?"Entry point of the workflow. The first task is connected automatically.":"Terminal point. Tasks routing here end the workflow execution."})]})}let tz=(0,t.memo)(function({selection:e,graph:t,descriptor:s,mutations:r,validationErrors:a,emptyState:n,onViewYaml:o,className:l}){if(!e||!t)return(0,b.jsx)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:flex-col",l),children:n??(0,b.jsx)("div",{className:"stg:flex stg:flex-1 stg:items-center stg:justify-center stg:p-4",children:(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Select a task or connection to inspect"})})});if("edge"===e.type){let s=t.edges.find(t=>t.id===e.id);return s?(0,b.jsx)(tW,{edge:s,graph:t,onDeleteEdge:r.onDeleteEdge,className:l}):null}let i=t.nodes.find(t=>t.id===e.id);return i?i.id===D.START_NODE_ID||i.id===D.END_NODE_ID?(0,b.jsx)(tK,{node:i,className:l}):(0,b.jsx)(tY,{node:i,graph:t,descriptor:s,mutations:r,validationErrors:a,onViewYaml:o,className:l}):null});function tY({node:e,graph:s,descriptor:r,mutations:n,validationErrors:o,onViewYaml:l,className:i}){let d=(0,w.taskKindToString)(e.kind),g=(0,t.useMemo)(()=>({nodeId:e.id,taskName:e.taskName,kindString:d,category:e.category,categoryColor:a.CATEGORY_COLORS[e.category],displayName:r?.displayName??d.replace(/_/g," "),description:r?.description,icon:r?.icon}),[e.id,e.taskName,e.category,d,r]),{tabs:c,activeTab:u,setActiveTab:m}=function({kindString:e,descriptor:s,mode:r,nodeId:a}){let[n,o]=(0,t.useState)("configure"),l=(0,t.useRef)(a);(0,t.useEffect)(()=>{a!==l.current&&(l.current=a,o("configure"))},[a]);let i=(0,t.useCallback)(e=>{o(e)},[]);return{tabs:(0,t.useMemo)(()=>{if("design"!==r||!e)return[];let t=[{id:"configure",label:"Configure"}];return eD.has(e)&&t.push({id:"branches",label:"Branches"}),eR.has(e)&&t.push({id:"catch",label:"Catch"}),e$.has(e)&&t.push({id:"iteration",label:"Iteration"}),t.push({id:"data",label:"Data"}),(eM.has(e)||eI.has(e)||eA.has(e))&&t.push({id:"runtime",label:"Runtime"}),t.push({id:"advanced",label:"Advanced"}),s&&(s.documentationUrl||s.yamlExamples&&s.yamlExamples.length>0)&&t.push({id:"docs",label:"Docs"}),t},[e,s,r]),activeTab:n,setActiveTab:i}}({kindString:d,descriptor:r,mode:"design",nodeId:e.id}),h=(0,t.useCallback)(e=>m(e),[m]),p=(0,t.useCallback)((t,s)=>{n.onUpdateField(e.id,t,s)},[e.id,n.onUpdateField]),f=(0,t.useMemo)(()=>s.nodes.filter(t=>t.id!==e.id&&t.id!==D.START_NODE_ID&&t.id!==D.END_NODE_ID).map(e=>e.taskName),[s.nodes,e.id]);return o?.get(e.id),(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:flex-col",i),children:[(0,b.jsx)(ew,{identity:g,graph:s,mutations:n,onViewYaml:l}),(0,b.jsx)(ej.Tabs,{tabs:c.map(e=>({id:e.id,label:e.label,badge:e.badge,icon:e.icon})),activeTab:u,onTabChange:h,"aria-label":"Task configuration",className:"stg:min-h-0 stg:flex-1",children:(0,b.jsxs)("div",{className:"stg:overflow-y-auto",children:["configure"===u&&(0,b.jsx)(ty,{node:e,graph:s,descriptor:r,kindString:d,otherTaskNames:f,onFieldChange:p,mutations:n}),"branches"===u&&(0,b.jsx)(tj,{node:e,graph:s,mutations:n,kindString:d}),"catch"===u&&(0,b.jsx)(tw,{node:e,mutations:n}),"iteration"===u&&(0,b.jsx)(tS,{node:e,mutations:n}),"data"===u&&(0,b.jsx)(tE,{node:e,onUpdateExport:n.onUpdateExport}),"runtime"===u&&(0,b.jsx)(tI,{node:e,kindString:d,descriptor:r,onFieldChange:p}),"advanced"===u&&(0,b.jsx)(tF,{node:e,otherTaskNames:f,kindString:d,onUpdateFlow:n.onUpdateFlow}),"docs"===u&&r&&(0,b.jsx)(tV,{descriptor:r})]})})]})}let tG=(0,t.memo)(function({selection:e,graph:s,descriptor:r,onUpdateField:a,onRenameNode:n,onUpdateExport:o,onUpdateFlow:l,onDeleteEdge:i,onDeleteNode:d,onDuplicateNode:g,onToggleDisabled:c,onWrapInTryCatch:u,onUpdateBranchRouting:m,onMigrateBranchHandle:h,onRemoveBranchEdges:p,onRemoveSwitchCase:f,onReorderSwitchCases:x,onRemoveForkBranch:v,onReorderForkBranches:y,onRenameForkBranch:k,onSetForkCompete:j,onUpdateCatchConfig:N,onRemoveCatchBlock:C,onUpdateForEachConfig:w,onViewYaml:_,validationErrors:S,emptyState:E,className:T}){let M=(0,t.useMemo)(()=>({onUpdateField:a,onRenameNode:n,onUpdateExport:o,onUpdateFlow:l,onDeleteEdge:i,onDeleteNode:d,onDuplicateNode:g,onToggleDisabled:c,onWrapInTryCatch:u,onUpdateBranchRouting:m,onMigrateBranchHandle:h,onRemoveBranchEdges:p,onRemoveSwitchCase:f,onReorderSwitchCases:x,onRemoveForkBranch:v,onReorderForkBranches:y,onRenameForkBranch:k,onSetForkCompete:j,onUpdateCatchConfig:N,onRemoveCatchBlock:C,onUpdateForEachConfig:w}),[a,n,o,l,i,d,g,c,u,m,h,p,f,x,v,y,k,j,N,C,w]);return(0,b.jsx)(tz,{selection:e,graph:s,descriptor:r,mutations:M,validationErrors:S,emptyState:E,onViewYaml:_,className:T})}),tq=(0,t.memo)(function({graph:e,validationErrors:s,className:r}){let{doc:n}=(0,t.useMemo)(()=>({doc:e.document}),[e.document]),o=(0,t.useMemo)(()=>{let t=e.nodes.filter(e=>e.id!==D.START_NODE_ID&&e.id!==D.END_NODE_ID),s=new Map;for(let e of t)s.set(e.category,(s.get(e.category)??0)+1);return{taskCount:t.length,byCategory:s}},[e.nodes]),l=(0,t.useMemo)(()=>e.env?Object.entries(e.env):[],[e.env]),i=(0,t.useMemo)(()=>{if(!s)return 0;let e=0;for(let t of s.values())e+=t.length;return e},[s]);return(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:flex-col stg:overflow-y-auto",r),children:[(0,b.jsxs)("section",{className:"stg:flex stg:flex-col stg:gap-1.5 stg:px-3 stg:py-3",children:[(0,b.jsx)(tQ,{children:"Workflow"}),(0,b.jsx)("h3",{className:"stg:text-sm stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)]",children:n.name}),(0,b.jsxs)("div",{className:"stg:flex stg:flex-wrap stg:gap-1.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:[(0,b.jsx)("span",{children:n.namespace}),(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:["v",n.version]}),(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:["DSL ",n.dsl]})]}),n.description&&(0,b.jsx)("p",{className:"stg:text-xs stg:leading-relaxed stg:text-[var(--stgm-muted-foreground,#737373)]",children:n.description})]}),i>0&&s&&(0,b.jsx)("section",{className:"stg:border-t stg:border-[var(--stgm-border,#e5e5e5)] stg:px-3 stg:py-3",children:(0,b.jsx)(tJ,{errors:s,totalCount:i})}),(0,b.jsxs)("section",{className:"stg:border-t stg:border-[var(--stgm-border,#e5e5e5)] stg:px-3 stg:py-3",children:[(0,b.jsx)(tQ,{children:"Tasks"}),(0,b.jsxs)("div",{className:"stg:mt-1 stg:flex stg:flex-col stg:gap-1",children:[(0,b.jsxs)("span",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:[o.taskCount," task",1!==o.taskCount?"s":""]}),o.byCategory.size>0&&(0,b.jsx)("div",{className:"stg:flex stg:flex-wrap stg:gap-1.5",children:Array.from(o.byCategory.entries()).map(([e,t])=>(0,b.jsxs)("span",{className:"stg:rounded stg:bg-[var(--stgm-muted,#f5f5f5)] stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:[a.CATEGORY_DISPLAY_NAMES[e]??e," (",t,")"]},e))})]})]}),l.length>0&&(0,b.jsx)("section",{className:"stg:border-t stg:border-[var(--stgm-border,#e5e5e5)] stg:px-3 stg:py-3",children:(0,b.jsx)(tX,{entries:l})}),e.budget&&(0,b.jsx)("section",{className:"stg:border-t stg:border-[var(--stgm-border,#e5e5e5)] stg:px-3 stg:py-3",children:(0,b.jsx)(tZ,{budget:e.budget})})]})});function tJ({errors:e,totalCount:s}){let[r,a]=(0,t.useState)(!1),n=(0,t.useCallback)(()=>a(e=>!e),[]);return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsxs)("button",{type:"button",onClick:n,className:"stg:flex stg:items-center stg:gap-1.5 stg:text-left","aria-expanded":r,children:[(0,b.jsx)(tQ,{children:"Validation"}),(0,b.jsxs)("span",{className:"stg:rounded-full stg:bg-[var(--stgm-destructive,#ef4444)]/10 stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:font-medium stg:text-[var(--stgm-destructive,#ef4444)]",children:[s," issue",1!==s?"s":""]})]}),r&&(0,b.jsx)("ul",{className:(0,j.cn)(tk.UNSTYLED_LIST,"stg:flex stg:flex-col stg:gap-1"),role:"list",children:Array.from(e.entries()).map(([e,t])=>t.map((t,s)=>(0,b.jsxs)("li",{className:"stg:flex stg:items-start stg:gap-1.5 stg:text-[11px]",children:[(0,b.jsxs)("span",{className:"stg:shrink-0 stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:[e,":"]}),(0,b.jsx)("span",{className:"stg:text-[var(--stgm-destructive,#ef4444)]",children:t})]},`${e}-${s}`)))})]})}function tX({entries:e}){return(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsx)(tQ,{children:"Environment variables"}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:e.map(([e,t])=>(0,b.jsxs)("div",{className:"stg:flex stg:items-baseline stg:gap-2 stg:text-[11px]",children:[(0,b.jsx)("span",{className:"stg:shrink-0 stg:font-mono stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e}),t.isSecret&&(0,b.jsx)("span",{className:"stg:rounded stg:bg-[var(--stgm-warning,#f59e0b)]/10 stg:px-1 stg:text-[9px] stg:font-medium stg:text-[var(--stgm-warning,#f59e0b)]",children:"secret"}),t.optional&&(0,b.jsx)("span",{className:"stg:text-[var(--stgm-muted-foreground,#737373)]",children:"optional"}),t.description&&(0,b.jsx)(eC.TruncatedText,{text:t.description,className:"stg:text-[var(--stgm-muted-foreground,#737373)]"})]},e))})]})}function tZ({budget:e}){let t=[];if(e.maxCostMicros&&t.push({label:"Max cost",value:`$${(e.maxCostMicros/1e6).toFixed(2)}`}),e.maxTotalTokens&&t.push({label:"Max tokens",value:e.maxTotalTokens.toLocaleString()}),e.maxDurationSeconds){let s=Math.floor(e.maxDurationSeconds/60),r=e.maxDurationSeconds%60;t.push({label:"Max duration",value:s>0?`${s}m ${r}s`:`${r}s`})}return(e.onExceeded&&t.push({label:"On exceeded",value:e.onExceeded.replace(/_/g," ")}),0===t.length)?null:(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-1.5",children:[(0,b.jsx)(tQ,{children:"Budget"}),(0,b.jsx)("div",{className:"stg:flex stg:flex-col stg:gap-1",children:t.map(e=>(0,b.jsxs)("div",{className:"stg:flex stg:items-baseline stg:gap-2 stg:text-[11px]",children:[(0,b.jsxs)("span",{className:"stg:shrink-0 stg:text-[var(--stgm-muted-foreground,#737373)]",children:[e.label,":"]}),(0,b.jsx)("span",{className:"stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e.value})]},e.label))})]})}function tQ({children:e}){return(0,b.jsx)("h4",{className:"stg:text-[11px] stg:font-semibold stg:uppercase stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",children:e})}var t0=e.i(965132),t1=e.i(704077),t3=e.i(740582),t5=e.i(364354),t4=e.i(493284);let t2="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform);function t7(e,t,s,r,a){return{id:e,label:t,keys:s,hint:t2?s.replace(/Mod\+/g,"⌘").replace(/Shift\+/g,"⇧").replace(/Alt\+/g,"⌥").replace(/Backspace/g,"⌫").replace(/Delete/g,"⌫"):s.replace(/Mod\+/g,"Ctrl+").replace(/Backspace/g,"Del").replace(/Delete/g,"Del"),scope:r,requiresDesignMode:a}}let t6=new Map([t7("duplicate","Duplicate","Mod+D","node",!0),t7("copy","Copy","Mod+C","selection",!0),t7("cut","Cut","Mod+X","selection",!0),t7("paste","Paste","Mod+V","canvas",!0),t7("delete","Delete","Backspace","selection",!0),t7("addTaskAfter","Add task after…","N","node",!0),t7("selectAll","Select all","Mod+A","canvas",!0),t7("undo","Undo","Mod+Z","canvas",!0),t7("redo","Redo","Mod+Shift+Z","canvas",!0),t7("escape","Deselect","Escape","canvas",!1)].map(e=>[e.id,e]));function t8(e){return t6.get(e)?.hint??""}let t9=(0,j.cn)("stgm stg:z-50 stg:min-w-[160px] stg:rounded-md stg:border stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-popover,var(--stgm-background,#fff))] stg:p-1 stg:shadow-md","stg:outline-none"),se=(0,j.cn)("stg:flex stg:cursor-default stg:select-none stg:items-center stg:gap-2 stg:rounded-sm stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-popover-foreground,var(--stgm-foreground,#1a1a2e))] stg:outline-none","stg:data-[highlighted]:bg-[var(--stgm-accent,#e5e5e5)]"),st=(0,j.cn)("stg:flex stg:cursor-default stg:select-none stg:items-center stg:gap-2 stg:rounded-sm stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-destructive,#ef4444)] stg:outline-none","stg:data-[highlighted]:bg-[var(--stgm-destructive,#ef4444)]/10"),ss=(0,j.cn)("stg:flex stg:cursor-default stg:select-none stg:items-center stg:gap-2 stg:rounded-sm stg:px-2 stg:py-1.5 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)] stg:outline-none","stg:opacity-50"),sr="stg:ml-auto stg:pl-4 stg:text-[10px] stg:tracking-wide stg:text-[var(--stgm-muted-foreground,#737373)]",sa="stg:my-1 stg:h-px stg:bg-[var(--stgm-border,#e5e5e5)]",sn=(0,t.memo)(function({open:e,onOpenChange:s,target:r,position:a,onDeleteNode:n,onDuplicateNode:o,onAddTaskAfter:l,onToggleDisabled:i,onWrapInTryCatch:d,onCopyNode:g,onRenameNode:c,onViewYaml:u,onDeleteEdge:m,onInsertTaskOnEdge:h,onAddTaskAtPosition:p,onSelectAll:f,onAutoLayout:x,onPaste:v,hasClipboard:y,onFitView:k,onCopySelection:N,onDuplicateSelection:C,onDisableSelection:w,onDeleteSelection:_,className:S}){let E=(0,t5.useStigmerPortalContainer)(),T=(0,t.useMemo)(()=>{if(!a)return;let{x:e,y:t}=a;return{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,right:e,bottom:t,left:e})}},[a]),M=(0,t.useCallback)(e=>{s(e)},[s]);return r&&a?(0,b.jsx)(t1.Menu.Root,{open:e,onOpenChange:M,modal:!1,children:(0,b.jsx)(t1.Menu.Portal,{container:E,children:(0,b.jsx)(t1.Menu.Positioner,{anchor:T,side:"bottom",align:"start",sideOffset:0,children:(0,b.jsxs)(t1.Menu.Popup,{className:(0,j.cn)(t9,S),children:["node"===r.type&&(0,b.jsx)(so,{nodeId:r.id,taskName:r.taskName,onDelete:n,onDuplicate:o,onAddTaskAfter:l,onToggleDisabled:i,onWrapInTryCatch:d,onCopy:g,onRename:c,onViewYaml:u}),"edge"===r.type&&(0,b.jsx)(sl,{edgeId:r.id,onDelete:m,onInsertTask:h}),"pane"===r.type&&(0,b.jsx)(si,{onAddTask:p,onSelectAll:f,onAutoLayout:x,onPaste:v,hasClipboard:y,onFitView:k}),"selection"===r.type&&(0,b.jsx)(sd,{count:r.count,onCopy:N,onDuplicate:C,onDisable:w,onDelete:_})]})})})}):null});function so({nodeId:e,taskName:t,onDelete:s,onDuplicate:r,onAddTaskAfter:a,onToggleDisabled:n,onWrapInTryCatch:o,onCopy:l,onRename:i,onViewYaml:d}){return(0,b.jsxs)(b.Fragment,{children:[i&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>i(e),label:"Rename task",children:[(0,b.jsx)(sh,{}),"Rename"]}),r&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>r(e),label:"Duplicate task",children:[(0,b.jsx)(t4.DuplicateIcon,{}),"Duplicate",(0,b.jsx)("span",{className:sr,children:t8("duplicate")})]}),l&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>l(e),label:"Copy task",children:[(0,b.jsx)(su,{}),"Copy",(0,b.jsx)("span",{className:sr,children:t8("copy")})]}),a&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>a(e),label:"Add task after",children:[(0,b.jsx)(t4.PlusIcon,{}),"Add task after…",(0,b.jsx)("span",{className:sr,children:t8("addTaskAfter")})]}),(0,b.jsx)(t3.Separator,{className:sa}),n&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>n(e),label:"Toggle disabled",children:[(0,b.jsx)(sp,{}),"Disable / Bypass"]}),o&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>o(e),label:"Wrap in try/catch",children:[(0,b.jsx)(sf,{}),"Wrap in Try/Catch"]}),d&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>d(e),label:"View YAML",children:[(0,b.jsx)(sx,{}),"View YAML"]}),(0,b.jsx)(t3.Separator,{className:sa}),s&&(0,b.jsxs)(t1.Menu.Item,{className:st,onClick:()=>s(e),"aria-label":`Delete task ${t}`,label:"Delete task",children:[(0,b.jsx)(t4.TrashIcon,{}),"Delete",(0,b.jsx)("span",{className:sr,children:t8("delete")})]})]})}function sl({edgeId:e,onDelete:t,onInsertTask:s}){return(0,b.jsxs)(b.Fragment,{children:[s&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:()=>s(e),label:"Insert task",children:[(0,b.jsx)(t4.PlusIcon,{}),"Insert task…"]}),s&&t&&(0,b.jsx)(t3.Separator,{className:sa}),t&&(0,b.jsxs)(t1.Menu.Item,{className:st,onClick:()=>t(e),label:"Delete connection",children:[(0,b.jsx)(t4.TrashIcon,{}),"Delete connection"]})]})}function si({onAddTask:e,onSelectAll:t,onAutoLayout:s,onPaste:r,hasClipboard:a,onFitView:n}){return(0,b.jsxs)(b.Fragment,{children:[e&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:e,label:"Add task",children:[(0,b.jsx)(t4.PlusIcon,{}),"Add task…",(0,b.jsx)("span",{className:sr,children:t8("addTaskAfter")})]}),r&&(0,b.jsxs)(t1.Menu.Item,{className:a?se:ss,onClick:a?r:void 0,label:"Paste","aria-disabled":!a,children:[(0,b.jsx)(sm,{}),"Paste",(0,b.jsx)("span",{className:sr,children:t8("paste")})]}),(0,b.jsx)(t3.Separator,{className:sa}),t&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:t,label:"Select all",children:[(0,b.jsx)(sg,{}),"Select all",(0,b.jsx)("span",{className:sr,children:t8("selectAll")})]}),s&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:s,label:"Auto-layout",children:[(0,b.jsx)(sc,{}),"Auto-layout"]}),n&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:n,label:"Zoom to fit",children:[(0,b.jsx)(sv,{}),"Zoom to fit"]})]})}function sd({count:e,onCopy:t,onDuplicate:s,onDisable:r,onDelete:a}){let n=`${e} task${e>1?"s":""}`;return(0,b.jsxs)(b.Fragment,{children:[t&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:t,label:`Copy ${n}`,children:[(0,b.jsx)(su,{}),"Copy ",n,(0,b.jsx)("span",{className:sr,children:t8("copy")})]}),s&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:s,label:`Duplicate ${n}`,children:[(0,b.jsx)(t4.DuplicateIcon,{}),"Duplicate ",n,(0,b.jsx)("span",{className:sr,children:t8("duplicate")})]}),r&&(0,b.jsxs)(t1.Menu.Item,{className:se,onClick:r,label:`Disable ${n}`,children:[(0,b.jsx)(sp,{}),"Disable ",n]}),(t||s||r)&&a&&(0,b.jsx)(t3.Separator,{className:sa}),a&&(0,b.jsxs)(t1.Menu.Item,{className:st,onClick:a,label:`Delete ${n}`,children:[(0,b.jsx)(t4.TrashIcon,{}),"Delete ",n,(0,b.jsx)("span",{className:sr,children:t8("delete")})]})]})}function sg(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,b.jsx)("rect",{x:"2",y:"2",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),(0,b.jsx)("path",{d:"M5 7l1.5 1.5L9 5.5"})]})}function sc(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,b.jsx)("rect",{x:"4",y:"1.5",width:"6",height:"3",rx:"0.5"}),(0,b.jsx)("rect",{x:"1",y:"9.5",width:"5",height:"3",rx:"0.5"}),(0,b.jsx)("rect",{x:"8",y:"9.5",width:"5",height:"3",rx:"0.5"}),(0,b.jsx)("path",{d:"M7 4.5V7M7 7H3.5M7 7h3.5M3.5 7v2.5M10.5 7v2.5"})]})}function su(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,b.jsx)("rect",{x:"5",y:"5",width:"7",height:"7",rx:"1"}),(0,b.jsx)("path",{d:"M9 5V3a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h2"})]})}function sm(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,b.jsx)("path",{d:"M5.5 2H4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H8.5"}),(0,b.jsx)("rect",{x:"5",y:"1",width:"4",height:"2.5",rx:"0.5"})]})}function sh(){return(0,b.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M8.5 2.5l3 3M2 12l.7-2.8L9.6 2.3a1 1 0 0 1 1.4 0l1.7 1.7a1 1 0 0 1 0 1.4L5.8 12.3 3 13z"})})}function sp(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,b.jsx)("circle",{cx:"7",cy:"7",r:"5"}),(0,b.jsx)("path",{d:"M3.5 10.5l7-7"})]})}function sf(){return(0,b.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M7 1.5L2 3.5v3c0 3.5 2.2 5.5 5 6.5 2.8-1 5-3 5-6.5v-3L7 1.5z"})})}function sx(){return(0,b.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M4.5 4L1.5 7l3 3M9.5 4l3 3-3 3M8 2l-2 10"})})}function sv(){return(0,b.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,b.jsx)("path",{d:"M1.5 5V2.5a1 1 0 0 1 1-1H5M9 1.5h2.5a1 1 0 0 1 1 1V5M12.5 9v2.5a1 1 0 0 1-1 1H9M5 12.5H2.5a1 1 0 0 1-1-1V9"}),(0,b.jsx)("rect",{x:"4",y:"4",width:"6",height:"6",rx:"0.5"})]})}var sb=e.i(106926);function sy(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||!!e.isContentEditable||"textbox"===e.getAttribute("role")}var sk=e.i(468806),sj=e.i(193799);let sN=(0,t.memo)(function({nodeId:e,graph:s,onClose:r}){let{copy:a,copied:n}=(0,sj.useCopyFeedback)(),o=e&&s?s.nodes.find(t=>t.id===e)??null:null,l=o?function(e){let t=(0,w.taskKindToString)(e.kind),s=[];if(s.push(`- name: ${e.taskName}`),s.push(` kind: ${t}`),Object.keys(e.config).length>0){s.push(" task_config:");let t=function e(t,s){let r=" ".repeat(s),a=[];for(let[n,o]of Object.entries(t))if(null!=o)if("string"==typeof o){let e=o.includes("${")||o.includes(":")||o.includes("#")||""===o;a.push(`${r}${n}: ${e?`"${o}"`:o}`)}else if("number"==typeof o||"boolean"==typeof o)a.push(`${r}${n}: ${o}`);else if(Array.isArray(o))for(let t of(a.push(`${r}${n}:`),o))if("object"==typeof t&&null!==t){let n=e(t,s+4);n.length>0&&(a.push(`${r} - ${n[0].trimStart()}`),a.push(...n.slice(1).map(e=>`${r} ${e.slice(s)}`)))}else a.push(`${r} - ${t}`);else"object"==typeof o&&(a.push(`${r}${n}:`),a.push(...e(o,s+2)));return a}(e.config,4);s.push(...t)}return e.export?.as&&(s.push(" export:"),s.push(` as: "${e.export.as}"`)),e.flow?.then&&(s.push(" flow:"),s.push(` then: ${e.flow.then}`)),s.join("\n")}(o):"",i=(0,t.useCallback)(e=>{e||r()},[r]),d=(0,t.useCallback)(()=>{a(l)},[a,l]);return(0,b.jsx)(sk.DialogShell,{open:!!(e&&o),onOpenChange:i,width:"lg",dismissOnBackdrop:!0,className:"stgm stg:max-h-[80vh] stg:bg-[var(--stgm-background,#fff)] stg:border-[var(--stgm-border,#e5e5e5)]","aria-label":o?`YAML for ${o.taskName}`:"View YAML",children:o&&(0,b.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:px-4 stg:py-3",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,b.jsx)(sC,{}),(0,b.jsx)("span",{className:"stg:text-sm stg:font-semibold stg:text-[var(--stgm-foreground,#1a1a2e)]",children:o.taskName})]}),(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1",children:[(0,b.jsx)("button",{type:"button",onClick:d,className:"stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]",children:n?"Copied!":"Copy"}),(0,b.jsx)("button",{type:"button",onClick:r,className:"stg:flex stg:h-6 stg:w-6 stg:items-center stg:justify-center stg:rounded stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]","aria-label":"Close",children:(0,b.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M2 2l8 8M10 2l-8 8"})})})]})]}),(0,b.jsx)("div",{className:"stg:overflow-auto stg:p-4",children:(0,b.jsx)("pre",{className:"stg:whitespace-pre stg:text-xs stg:leading-relaxed stg:text-[var(--stgm-foreground,#1a1a2e)]",children:(0,b.jsx)("code",{children:l})})})]})})});function sC(){return(0,b.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"stg:text-[var(--stgm-muted-foreground,#737373)]",children:(0,b.jsx)("path",{d:"M5 4L1.5 8 5 12M11 4l3.5 4-3.5 4M9 2l-2 12"})})}let sw=(0,t.lazy)(()=>e.A(508951).then(e=>({default:e.WorkflowCanvasInner}))),s_=(0,t.memo)(function({yaml:e,onNodeSelect:s,onEdgeSelect:r,onSelectionClear:n,showPalette:o=!0,showInspector:l=!0,onSave:i,isSaving:d=!1,onDirtyChange:g,nodeErrors:c,className:m,loadingFallback:h,layoutEngine:p}){let f=(0,t.useRef)(null),v=function(e,s){let[r,n]=(0,t.useState)(null),[o,l]=(0,t.useState)(null),i=(0,t.useRef)(null),d=(0,t.useRef)(null),[g,c,m]=(0,y.useNodesState)([]),[h,p,f]=(0,y.useEdgesState)([]),{screenToFlowPosition:v}=(0,y.useReactFlow)(),b=function(e){let s=(0,t.useRef)(null),[r,a]=(0,t.useState)(null),[,n]=(0,t.useState)(0);e&&!s.current&&(s.current=new ec(e),r||a(e));let o=(0,t.useCallback)(()=>{n(e=>e+1)},[]),l=(0,t.useCallback)(e=>{let t=s.current;if(!t)throw Error("GraphHistory not initialized.");let r=t.dispatch(e);return a(r),o(),r},[o]),i=(0,t.useCallback)(()=>{let e=s.current;if(!e?.canUndo)return null;let t=e.undo();return a(t),o(),t},[o]),d=(0,t.useCallback)(()=>{let e=s.current;if(!e?.canRedo)return null;let t=e.redo();return a(t),o(),t},[o]),g=(0,t.useCallback)(e=>{s.current?s.current.reset(e):s.current=new ec(e),a(e),o()},[o]),c=s.current?.canUndo??!1;return{currentModel:r??{document:{dsl:"1.0.0",namespace:"",name:"",version:"0.0.1"},nodes:[],edges:[]},canUndo:c,canRedo:s.current?.canRedo??!1,dispatch:l,undo:i,redo:d,reset:g}}((0,t.useMemo)(()=>{if(!e?.trim())return null;try{let t=(0,w.yamlToGraph)(e);return(0,_.applyDagreLayout)(t)}catch(e){return null}},[e]));(0,t.useEffect)(()=>{if(!e?.trim()){n(null),c([]),p([]),i.current=null,d.current=null;return}try{let t=(0,w.yamlToGraph)(e),s=(0,_.applyDagreLayout)(t);b.reset(s),i.current=s,d.current=ek(s),n(null);let r=(0,w.toReactFlowElements)(s);c(r.nodes),p(r.edges)}catch(e){n(e instanceof Error?e.message:"Failed to parse workflow YAML."),c([]),p([]),i.current=null,d.current=null}},[e]);let k=(0,t.useCallback)(e=>{let t=(0,w.toReactFlowElements)(e);c(t.nodes),p(t.edges)},[c,p]),j=(0,t.useCallback)(e=>{let t=b.dispatch(e);return k(t),t},[b.dispatch,k]),N=(0,t.useCallback)(e=>{m(e)},[m]),C=(0,t.useRef)(null),S=(0,t.useCallback)(()=>{C.current=b.currentModel},[b.currentModel]),E=(0,t.useCallback)((e,t,s)=>{let r=b.currentModel,a=C.current;if(C.current=null,!a||r!==a)return;let n=[],o=[];for(let e of s){let t=r.nodes.find(t=>t.id===e.id);t&&(n.push({id:t.id,x:t.position.x,y:t.position.y}),o.push({id:e.id,x:e.position.x,y:e.position.y}))}o.some((e,t)=>{let s=n[t];return Math.abs(s.x-e.x)>.5||Math.abs(s.y-e.y)>.5})&&b.dispatch(new U(n,o))},[b.currentModel,b.dispatch]),T=(0,t.useCallback)(e=>{f(e)},[f]),M=(0,t.useCallback)(e=>{let t=b.currentModel;return!(!t||!e.source||!e.target||e.source===e.target||e.target===D.START_NODE_ID||e.source===D.END_NODE_ID||t.edges.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle??null)===(e.sourceHandle??null)))},[b.currentModel]),I=(0,t.useCallback)(e=>{if(!e.source||!e.target)return;let t=b.currentModel;if(!t)return;let s=t.nodes.find(t=>t.id===e.source);if(!s)return;let r=(0,w.taskKindToString)(s.kind),a={id:em(),source:e.source,target:e.target,...e.sourceHandle&&{sourceHandle:e.sourceHandle}};if("switch_case"!==r&&"human_input"!==r&&!e.sourceHandle){let s=t.edges.find(t=>t.source===e.source&&!t.sourceHandle);if(s)return void j(new W("Replace connection",[new F(s.id),new H(a)]))}j(new H(a))},[b.currentModel,j]),A=(0,t.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData(R);if(!t)return;let s=b.currentModel,r=(0,w.stringToTaskKind)(t),a=(0,u.categorizeKind)(t),n=eh(t,new Set(s.nodes.map(e=>e.taskName))),o=ep(n,r,t,a,v({x:e.clientX,y:e.clientY})),l=s.nodes.filter(e=>!ef(e.id));if(0===s.nodes.length){let e={document:{dsl:"1.0.0",namespace:"",name:"",version:"0.0.1"},nodes:[{id:D.START_NODE_ID,taskName:"Start",kind:0,category:"start",config:{},position:{x:0,y:0}},{id:D.END_NODE_ID,taskName:"End",kind:0,category:"end",config:{},position:{x:0,y:0}}],edges:[]};b.reset(e),i.current=e,d.current=ek(e),j(new P(o,{id:em(),source:D.START_NODE_ID,target:n}))}else 0===l.length?j(new P(o,{id:em(),source:D.START_NODE_ID,target:n})):j(new P(o,null))},[b,j,k,v]),$=(0,t.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),O=(0,t.useCallback)(e=>{let t=e.filter(e=>!ef(e.id));if(0!==t.length)if(1===t.length){let e=t[0];j(new B(e.id,e.data?.taskName??e.id))}else{let e=t.map(e=>new B(e.id,e.data?.taskName??e.id));j(new W(`Delete ${t.length} tasks`,e))}},[j]),L=(0,t.useCallback)(e=>{if(0!==e.length)if(1===e.length)j(new F(e[0].id));else{let t=e.map(e=>new F(e.id));j(new W(`Delete ${e.length} connections`,t))}},[j]),V=(0,x.useTaskKindRegistry)(),J=(0,t.useCallback)((e,t,s)=>{let r=b.currentModel;if(!r)return;let a=r.nodes.find(t=>t.id===e);a&&j(new K(e,t,s,a.taskName))},[b.currentModel,j]),eu=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=s.nodes.find(t=>t.id===e);r&&r.taskName!==t&&(j(new z(r.taskName,t)),l({type:"node",id:t}))},[b.currentModel,j]),ej=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=s.nodes.find(t=>t.id===e);r&&j(new Y(e,"export",t,r.taskName))},[b.currentModel,j]),eN=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=s.nodes.find(t=>t.id===e);r&&j(new Y(e,"flow",t,r.taskName))},[b.currentModel,j]),eC=(0,t.useCallback)(e=>{let t=b.currentModel;if(!t)return;let s=t.nodes.find(t=>t.id===e);if(!s)return;let r=(0,w.taskKindToString)(s.kind);return V.getByKind(r)},[b.currentModel,V.getByKind]),ew=(0,t.useCallback)((e,t,s)=>{let r=b.currentModel;if(!r)return;let a=r.edges.find(s=>s.source===e&&s.sourceHandle===t);if(!s){a&&j(new F(a.id));return}if(a){if(a.target===s)return;let r=t.includes("_")?t.split("_").slice(1).join("_"):void 0;j(new W(`Route ${t} to ${s}`,[new F(a.id),new H({id:em(),source:e,target:s,sourceHandle:t,label:r})]))}else{let r=t.includes("_")?t.split("_").slice(1).join("_"):void 0;j(new H({id:em(),source:e,target:s,sourceHandle:t,label:r}))}},[b.currentModel,j]),e_=(0,t.useCallback)((e,t,s)=>{t!==s&&j(new G(e,t,s))},[j]),eS=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=s.edges.filter(s=>s.source===e&&s.sourceHandle===t);0!==r.length&&(1===r.length?j(new F(r[0].id)):j(new W(`Remove ${r.length} branch edges`,r.map(e=>new F(e.id)))))},[b.currentModel,j]),eE=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=s.edges.find(t=>t.id===e);if(!r)return;let a=s.nodes.find(e=>e.id===r.source),n=s.nodes.find(e=>e.id===r.target);if(!a||!n)return;let o=(0,w.stringToTaskKind)(t),i=(0,u.categorizeKind)(t),d=eh(t,new Set(s.nodes.map(e=>e.taskName))),g=ep(d,o,t,i,{x:(a.position.x+n.position.x)/2,y:(a.position.y+n.position.y)/2+40}),c={id:em(),source:r.source,target:d,...r.sourceHandle&&{sourceHandle:r.sourceHandle}},m={id:em(),source:d,target:r.target};j(new W(`Insert ${t} on edge`,[new F(e),new P(g,c),new H(m)])),l({type:"node",id:d})},[b,j,k]),eT=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=s.nodes.find(t=>t.id===e);if(!r)return;let n=(0,w.stringToTaskKind)(t),o=(0,u.categorizeKind)(t),i=eh(t,new Set(s.nodes.map(e=>e.taskName))),d=ep(i,n,t,o,{x:r.position.x,y:r.position.y+a.CANVAS_NODE_HEIGHT+a.DAGRE_CONFIG.ranksep}),g=s.edges.find(t=>t.source===e&&t.target===D.END_NODE_ID),c=[new P(d,null)];g?(c.unshift(new F(g.id)),c.push(new H({id:em(),source:e,target:i,...g.sourceHandle&&{sourceHandle:g.sourceHandle}})),c.push(new H({id:em(),source:i,target:D.END_NODE_ID}))):c.push(new H({id:em(),source:e,target:i})),j(new W(`Add ${t} after "${r.taskName}"`,c)),l({type:"node",id:i})},[b,j,k]),eM=(0,t.useCallback)(e=>{let t=b.currentModel;if(!t)return;let s=t.nodes.find(t=>t.id===e);if(!s||ef(e))return;let r=eh((0,w.taskKindToString)(s.kind),new Set(t.nodes.map(e=>e.taskName)));j(new q(e,r)),l({type:"node",id:r})},[b.currentModel,j]),eI=(0,t.useCallback)(e=>{let t=b.currentModel;if(!t)return;let s=t.nodes.find(t=>t.id===e);!s||ef(e)||j(new ed(e,s.taskName))},[b.currentModel,j]),eA=(0,t.useCallback)(e=>{let t=b.currentModel;if(!t)return;let s=t.nodes.find(t=>t.id===e);if(!s||ef(e))return;let r=eh("try_catch",new Set(t.nodes.map(e=>e.taskName)));j(new eg(e,s.taskName,r)),l({type:"node",id:r})},[b.currentModel,j]),eD=(0,t.useCallback)((e,t)=>{let s=b.currentModel;if(!s)return;let r=(0,w.stringToTaskKind)(e),a=(0,u.categorizeKind)(e),n=eh(e,new Set(s.nodes.map(e=>e.taskName)));j(new P(ep(n,r,e,a,t),null)),l({type:"node",id:n})},[b.currentModel,j]),eR=(0,t.useCallback)((e,t,s)=>{j(new X(e,t,s))},[j]),e$=(0,t.useCallback)((e,t)=>{j(new Z(e,t))},[j]),eO=(0,t.useCallback)((e,t)=>{j(new Q(e,t))},[j]),eL=(0,t.useCallback)((e,t)=>{j(new ee(e,t))},[j]),eP=(0,t.useCallback)((e,t)=>{j(new et(e,t))},[j]),eB=(0,t.useCallback)((e,t)=>{j(new es(e,t))},[j]),eH=(0,t.useCallback)((e,t)=>{j(new er(e,t))},[j]),eF=(0,t.useCallback)((e,t,s)=>{j(new ea(e,t,s))},[j]),eU=(0,t.useCallback)((e,t)=>{j(new en(e,t))},[j]),eV=(0,t.useCallback)((e,t)=>{j(new eo(e,t))},[j]),eW=(0,t.useCallback)(e=>{j(new el(e))},[j]),eK=(0,t.useCallback)((e,t)=>{j(new ei(e,t))},[j]),ez=(0,t.useCallback)(()=>b.currentModel,[b.currentModel]),eY=(0,t.useCallback)(()=>{let e=b.currentModel;if(!e)return;let t=e.nodes.filter(e=>!ef(e.id)).map(e=>({id:e.id,type:"select",selected:!0}));t.length>0&&m(t)},[b.currentModel,m]),eG=(0,t.useCallback)(e=>{l({type:"node",id:e})},[]),eq=(0,t.useCallback)(e=>{l({type:"edge",id:e})},[]),eJ=(0,t.useCallback)(()=>{l(null)},[]),{layoutGraph:eX,isLayouting:eZ}=function(e={}){let{engine:s,fallbackEngine:r,getNodeDimensions:a}=e,[n,o]=(0,t.useState)(!1),[l,i]=(0,t.useState)(null),[d,g]=(0,t.useState)(null),c=(0,t.useRef)(0),u=(0,t.useRef)(null);function m(){return r||(u.current||(u.current={name:"dagre",async layout(e){let t=performance.now();return{positions:function(e){let{graph:t,getNodeDimensions:s=ev}=e,r=new ex.default.graphlib.Graph;for(let e of(r.setGraph({rankdir:"TB",ranksep:60,nodesep:30}),r.setDefaultEdgeLabel(()=>({})),t.nodes)){let t=s(e);r.setNode(e.id,{width:t.width,height:t.height})}for(let e of t.edges)r.setEdge(e.source,e.target);ex.default.layout(r);let a=new Map;for(let e of t.nodes){let t=r.node(e.id);if(!t)continue;let n=s(e);a.set(e.id,{x:t.x-n.width/2,y:t.y-n.height/2})}return a}(e),durationMs:performance.now()-t,engine:"dagre"}}}),u.current)}return(0,t.useEffect)(()=>()=>{s?.terminate?.()},[s]),{layoutGraph:(0,t.useCallback)(async(e,t)=>{let r=++c.current;o(!0),g(null);let n={graph:e,scope:t,getNodeDimensions:a},l=s??m();try{let e=await l.layout(n);if(r!==c.current)return null;return i(e),o(!1),e}catch(e){if(r!==c.current)return null;if(l!==m()){let t=e instanceof Error?e.message:"Layout engine failed";try{let e=await m().layout(n);if(r!==c.current)return null;return i(e),g(`Layout optimized with fallback engine (${t})`),o(!1),e}catch(e){if(r!==c.current)return null;return g(e instanceof Error?e.message:"Fallback layout also failed"),o(!1),null}}return g(e instanceof Error?e.message:"Layout failed"),o(!1),null}},[s,r,a]),isLayouting:n,lastResult:l,error:d}}({engine:s?.layoutEngine??void 0,getNodeDimensions:eb.registryNodeDimensions}),eQ=(0,t.useCallback)(async()=>{let e=b.currentModel;if(!e||0===e.nodes.length)return;let t=e.nodes.map(e=>({id:e.id,x:e.position.x,y:e.position.y})),s=await eX(e,{type:"whole-graph"});if(!s)return;let r=e.nodes.map(e=>{let t=s.positions.get(e.id);return{id:e.id,x:t?.x??e.position.x,y:t?.y??e.position.y}});r.some(e=>{let s=t.find(t=>t.id===e.id);return s&&(Math.abs(s.x-e.x)>.5||Math.abs(s.y-e.y)>.5)})&&j(new U(t,r))},[b,j,eX]),e0=(0,t.useRef)(null),[e1,e3]=(0,t.useState)(!1),e5=(0,t.useCallback)(()=>{let e=new Set;for(let t of g)t.selected&&!ef(t.id)&&e.add(t.id);return 0!==e.size||o?.type!=="node"||ef(o.id)||e.add(o.id),e},[g,o]),e4=(0,t.useCallback)(()=>{let e=b.currentModel;if(!e)return;let t=e5();if(0===t.size)return;let s=function(e,t){let s=new Set;for(let e of t)e!==D.START_NODE_ID&&e!==D.END_NODE_ID&&s.add(e);return 0===s.size?null:{nodes:e.nodes.filter(e=>s.has(e.id)).map(e=>structuredClone(e)),edges:e.edges.filter(e=>s.has(e.source)&&s.has(e.target)).map(e=>structuredClone(e))}}(e,t);s&&(e0.current=s,e3(!0))},[b.currentModel,e5]),e2=(0,t.useCallback)(()=>{let e=e0.current,t=b.currentModel;if(!e||!t)return;let s=function(e,t){if(0===e.nodes.length)return null;let s=(void 0)??ey,r=new Set(t.nodes.map(e=>e.taskName)),a=new Map,n=[],o=[];for(let t of e.nodes){let e=eh({0:"task",1:"agent_call",2:"llm_call",3:"http_call",4:"grpc_call",5:"activity_call",6:"set_variables",7:"switch_case",8:"for_each",9:"raise_error",10:"listen",11:"wait",12:"human_input",13:"run_workflow",14:"try_catch",15:"fork",16:"transform",17:"validate",18:"notification",19:"eval"}[t.kind]??"task",r);r.add(e),a.set(t.id,e),o.push(e),n.push(new P({...t,id:e,taskName:e,config:structuredClone(t.config),position:{x:t.position.x+s.x,y:t.position.y+s.y},export:void 0,flow:void 0}))}for(let t of e.edges){let e=a.get(t.source),s=a.get(t.target);e&&s&&n.push(new H({...t,id:em(),source:e,target:s}))}return{command:new W(`Paste ${e.nodes.length} task${e.nodes.length>1?"s":""}`,n),newNodeIds:o}}(e,t);s&&(j(s.command),s.newNodeIds.length>0&&l({type:"node",id:s.newNodeIds[0]}))},[b.currentModel,j]),e7=(0,t.useCallback)(()=>{e4();let e=e5();if(0===e.size)return;let t=g.filter(t=>e.has(t.id));t.length>0&&O(t)},[e4,e5,g,O]),e6=(0,t.useCallback)(()=>{let e=b.currentModel;if(!e)return;let t=e5();if(0===t.size)return;let s=new Set(e.nodes.map(e=>e.taskName)),r=[];for(let a of t){let t=e.nodes.find(e=>e.id===a);if(!t)continue;let n=eh((0,w.taskKindToString)(t.kind),s);s.add(n),r.push(new q(a,n))}r.length>0&&j(new W(`Duplicate ${r.length} tasks`,r))},[b.currentModel,e5,j]),e8=(0,t.useCallback)(()=>{let e=b.currentModel;if(!e)return;let t=e5();if(0===t.size)return;let s=[];for(let r of t){let t=e.nodes.find(e=>e.id===r);t&&s.push(new ed(r,t.taskName))}s.length>0&&j(new W(`Toggle disabled on ${s.length} tasks`,s))},[b.currentModel,e5,j]),e9=(0,t.useCallback)(()=>{let e=e5();if(0===e.size)return;let t=g.filter(t=>e.has(t.id));t.length>0&&O(t)},[e5,g,O]),te=(0,t.useCallback)(()=>{let e=b.undo();e&&k(e)},[b.undo,k]),tt=(0,t.useCallback)(()=>{let e=b.redo();e&&k(e)},[b.redo,k]),ts=b.currentModel.nodes.length>0?b.currentModel:null,tr=(0,t.useMemo)(()=>ts?ek(ts):null,[ts]),ta=null!==i.current&&(null!==tr&&null!==d.current?tr!==d.current:ts!==i.current),tn=(0,t.useCallback)(()=>tr,[tr]);return(0,t.useMemo)(()=>({nodes:g,edges:h,onNodesChange:N,onEdgesChange:T,onNodeDragStart:S,onNodeDragStop:E,onConnect:I,isValidConnection:M,onDrop:A,onDragOver:$,onNodesDelete:O,onEdgesDelete:L,selection:o,selectNode:eG,selectEdge:eq,clearSelection:eJ,autoLayout:eQ,undo:te,redo:tt,canUndo:b.canUndo,canRedo:b.canRedo,isDirty:ta,graph:ts,error:r,updateNodeField:J,renameNode:eu,updateNodeExport:ej,updateNodeFlow:eN,getNodeDescriptor:eC,serializeToYaml:tn,updateBranchRouting:ew,migrateBranchHandle:e_,removeBranchEdges:eS,insertTaskOnEdge:eE,addSuccessorTask:eT,duplicateNode:eM,addNodeAtPosition:eD,addSwitchCase:eR,addForkBranch:e$,addCatchHandler:eO,removeSwitchCase:eL,reorderSwitchCases:eP,removeForkBranch:eB,reorderForkBranches:eH,renameForkBranch:eF,setForkCompete:eU,updateCatchConfig:eV,removeCatchBlock:eW,updateForEachConfig:eK,getGraphModel:ez,selectAll:eY,toggleNodeDisabled:eI,wrapInTryCatch:eA,copySelection:e4,pasteAtCenter:e2,cutSelection:e7,hasClipboard:e1,duplicateSelection:e6,disableSelection:e8,deleteSelection:e9,getSelectedNodeIds:e5}),[g,h,N,T,S,E,I,M,A,$,O,L,o,eG,eq,eJ,eQ,te,tt,b.canUndo,b.canRedo,ta,ts,r,J,eu,ej,eN,eC,tn,ew,e_,eS,eE,eT,eM,eD,eR,e$,eO,eL,eP,eB,eH,eF,eU,eV,eW,eK,ez,eY,eI,eA,e4,e2,e7,e1,e6,e8,e9,e5])}(e,{layoutEngine:p??void 0}),[k,N]=(0,t.useState)(!1),C=(0,t.useCallback)(()=>N(e=>!e),[]),[S,E]=(0,t.useState)(null),[T,M]=(0,t.useState)(null),I=(0,t.useCallback)(()=>{E(null),M(null)},[]),A=(0,t.useCallback)((e,t)=>{if(t){let s=f.current?.querySelector(`[data-id="${CSS.escape(t)}"]`);if(s){let e=s.getBoundingClientRect();M({purpose:"add-after-node",sourceId:t,position:{x:e.left+e.width/2,y:e.bottom+8}})}else M({purpose:"add-after-node",sourceId:t,position:e})}else M({purpose:"add-at-position",position:e})},[]);!function({containerRef:e,selection:s,duplicateNode:r,selectAll:a,clearSelection:n,onRequestTaskPicker:o,onDismiss:l,copySelection:i,pasteAtCenter:d,cutSelection:g,undo:c,redo:u}){(0,t.useEffect)(()=>{let t=e.current;if(t)return document.addEventListener("keydown",m,!0),()=>document.removeEventListener("keydown",m,!0);function m(e){let m;if(!t||!((m=document.activeElement)===t||t.contains(m)))return;let h=e.metaKey||e.ctrlKey;if(h&&!e.altKey&&"z"===e.key.toLowerCase()){if(sy(e.target))return;e.preventDefault(),e.stopPropagation(),e.shiftKey?u?.():c?.();return}if(h&&!e.shiftKey&&!e.altKey&&"d"===e.key.toLowerCase()){e.preventDefault(),e.stopPropagation(),s?.type==="node"&&r(s.id);return}if(h&&!e.shiftKey&&!e.altKey&&"a"===e.key.toLowerCase()){if(sy(e.target))return;e.preventDefault(),e.stopPropagation(),a();return}if(h&&!e.shiftKey&&!e.altKey&&"c"===e.key.toLowerCase()){if(sy(e.target))return;e.preventDefault(),e.stopPropagation(),i?.();return}if(h&&!e.shiftKey&&!e.altKey&&"v"===e.key.toLowerCase()){if(sy(e.target))return;e.preventDefault(),e.stopPropagation(),d?.();return}if(h&&!e.shiftKey&&!e.altKey&&"x"===e.key.toLowerCase()){if(sy(e.target))return;e.preventDefault(),e.stopPropagation(),g?.();return}if(!h&&!e.altKey){if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),l(),n();return}if(!e.shiftKey&&"n"===e.key.toLowerCase()){if(sy(e.target))return;if(e.preventDefault(),e.stopPropagation(),s?.type==="node")o({x:0,y:0},s.id);else{let e=t.getBoundingClientRect();o({x:e.left+e.width/2,y:e.top+e.height/2})}return}}}},[e,s,r,a,n,o,l,i,d,g,c,u])}({containerRef:f,selection:v.selection,duplicateNode:v.duplicateNode,selectAll:v.selectAll,clearSelection:v.clearSelection,onRequestTaskPicker:A,onDismiss:I,copySelection:v.copySelection,pasteAtCenter:v.pasteAtCenter,cutSelection:v.cutSelection,undo:v.undo,redo:v.redo});let O=(0,t.useCallback)(()=>{f.current?.focus({preventScroll:!0})},[]),L=(0,t.useCallback)(e=>{v.onNodesDelete(e),f.current?.focus({preventScroll:!0})},[v.onNodesDelete]);(0,t.useEffect)(()=>{g?.(v.isDirty)},[v.isDirty,g]);let V=(0,t.useCallback)((e,t)=>{v.selectNode(t.id),s?.(t.id)},[v.selectNode,s]),J=(0,t.useCallback)((e,t)=>{v.selectEdge(t.id),r?.(t.id)},[v.selectEdge,r]),eu=(0,t.useCallback)(()=>{v.clearSelection(),n?.(),E(null)},[v.clearSelection,n]),ej=(0,t.useCallback)((e,t)=>{e.preventDefault();let s=t.data?.taskName??t.id;E({target:{type:"node",id:t.id,taskName:s},position:{x:e.clientX,y:e.clientY}})},[]),eN=(0,t.useCallback)((e,t)=>{e.preventDefault(),E({target:{type:"edge",id:t.id},position:{x:e.clientX,y:e.clientY}})},[]),eC=(0,t.useCallback)(e=>{e.preventDefault(),E({target:{type:"pane"},position:{x:e.clientX,y:e.clientY}})},[]),ew=(0,t.useCallback)(e=>{e||E(null)},[]),e_=(0,t.useCallback)(e=>{L([{id:e}]),E(null)},[L]),eS=(0,t.useCallback)(e=>{v.duplicateNode(e),E(null)},[v.duplicateNode]),eE=(0,t.useCallback)(e=>{let t=S?.position;E(null),t&&M({purpose:"add-after-node",sourceId:e,position:t})},[S?.position]),eT=(0,t.useCallback)(e=>{v.onEdgesDelete([{id:e}]),E(null)},[v.onEdgesDelete]),eM=(0,t.useCallback)(e=>{let t=S?.position;E(null),t&&M({purpose:"insert-on-edge",sourceId:e,position:t})},[S?.position]),eI=(0,t.useCallback)(()=>{let e=S?.position;E(null),e&&M({purpose:"add-at-position",position:e})},[S?.position]),eA=(0,t.useCallback)(()=>{v.selectAll(),E(null)},[v.selectAll]),eD=(0,t.useCallback)(()=>{v.autoLayout(),E(null)},[v.autoLayout]),eR=(0,t.useCallback)(e=>{v.toggleNodeDisabled(e),E(null)},[v.toggleNodeDisabled]),e$=(0,t.useCallback)(e=>{v.wrapInTryCatch(e),E(null)},[v.wrapInTryCatch]),eO=(0,t.useCallback)(e=>{v.selectNode(e),v.copySelection(),E(null)},[v.selectNode,v.copySelection]),eL=(0,t.useCallback)(e=>{v.selectNode(e),E(null)},[v.selectNode]),[eP,eB]=(0,t.useState)(null),eH=(0,t.useCallback)(e=>{eB(e),E(null)},[]),eF=(0,t.useCallback)(()=>{v.pasteAtCenter(),E(null)},[v.pasteAtCenter]),eU=(0,t.useCallback)(()=>{E(null)},[]),eV=(0,t.useCallback)(()=>{v.copySelection(),E(null)},[v.copySelection]),eW=(0,t.useCallback)(()=>{v.duplicateSelection(),E(null)},[v.duplicateSelection]),eK=(0,t.useCallback)(()=>{v.disableSelection(),E(null)},[v.disableSelection]),ez=(0,t.useCallback)(()=>{v.deleteSelection(),E(null),f.current?.focus({preventScroll:!0})},[v.deleteSelection]),eY=(0,t.useCallback)((e,t)=>{e.preventDefault();let s=t.filter(e=>"__start__"!==e.id&&"__end__"!==e.id);0!==s.length&&E({target:{type:"selection",count:s.length},position:{x:e.clientX,y:e.clientY}})},[]),eG=(0,t.useMemo)(()=>{if(!T)return{current:null};let{x:e,y:t}=T.position,s=document.createElement("button");return s.getBoundingClientRect=()=>({x:e,y:t,width:0,height:0,top:t,right:e,bottom:t,left:e,toJSON:()=>({})}),{current:s}},[T]),eq=(0,t.useCallback)(e=>{e||M(null)},[]),eJ=(0,t.useCallback)(e=>{T&&("add-after-node"===T.purpose&&T.sourceId?v.addSuccessorTask(T.sourceId,e):"insert-on-edge"===T.purpose&&T.sourceId?v.insertTaskOnEdge(T.sourceId,e):"add-at-position"===T.purpose&&v.addNodeAtPosition(e,T.position),M(null))},[T,v.addSuccessorTask,v.insertTaskOnEdge,v.addNodeAtPosition]),eX=(0,t.useMemo)(()=>{if(!T)return null;if("add-after-node"===T.purpose&&T.sourceId){let e=v.getGraphModel().nodes.find(e=>e.id===T.sourceId);return{mode:"append-after",sourceNodeId:T.sourceId,sourceDisplayName:e?.taskName??T.sourceId}}if("insert-on-edge"===T.purpose&&T.sourceId){let e=v.getGraphModel(),t=e.edges.find(e=>e.id===T.sourceId);if(!t)return null;let s=e.nodes.find(e=>e.id===t.source),r=e.nodes.find(e=>e.id===t.target);return{mode:"edge-splice",edgeId:t.id,sourceNodeId:t.source,targetNodeId:t.target,sourceDisplayName:s?.taskName??t.source,targetDisplayName:r?.taskName??t.target}}return{mode:"add-at-position"}},[T,v]),eZ=(0,t.useCallback)(()=>{if(!i)return;let e=v.serializeToYaml();e&&i(e)},[i,v.serializeToYaml]),eQ=(0,t.useCallback)(e=>{v.onEdgesDelete([{id:e}])},[v.onEdgesDelete]),e0=(0,t.useCallback)(e=>{L([{id:e}])},[L]),e1=(0,t.useCallback)(e=>{v.duplicateNode(e)},[v.duplicateNode]),e3=(0,t.useMemo)(()=>({insertTaskOnEdge:v.insertTaskOnEdge,deleteNode:e0,addSuccessorTask:v.addSuccessorTask,duplicateNode:e1,addSwitchCase:v.addSwitchCase,addForkBranch:v.addForkBranch,addCatchHandler:v.addCatchHandler,removeSwitchCase:v.removeSwitchCase,reorderSwitchCases:v.reorderSwitchCases,removeForkBranch:v.removeForkBranch,reorderForkBranches:v.reorderForkBranches,renameForkBranch:v.renameForkBranch,setForkCompete:v.setForkCompete,updateCatchConfig:v.updateCatchConfig,removeCatchBlock:v.removeCatchBlock,updateForEachConfig:v.updateForEachConfig,getGraphModel:v.getGraphModel}),[v.insertTaskOnEdge,e0,v.addSuccessorTask,e1,v.addSwitchCase,v.addForkBranch,v.addCatchHandler,v.removeSwitchCase,v.reorderSwitchCases,v.removeForkBranch,v.reorderForkBranches,v.renameForkBranch,v.setForkCompete,v.updateCatchConfig,v.removeCatchBlock,v.updateForEachConfig,v.getGraphModel]),e5=v.selection?.type==="node"?v.getNodeDescriptor(v.selection.id):void 0,e4=(0,t.useMemo)(()=>{if(!v.selection||!v.graph)return"";if("node"===v.selection.type){let e=v.graph.nodes.find(e=>e.id===v.selection.id);return e?`Selected task: ${e.taskName}`:""}if("edge"===v.selection.type){let e=v.graph.edges.find(e=>e.id===v.selection.id);return e?`Selected edge: ${e.source} to ${e.target}`:""}return""},[v.selection,v.graph]),e2=h??(0,b.jsx)("div",{className:"stg:flex stg:h-full stg:w-full stg:items-center stg:justify-center stg:text-sm stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Loading canvas…"});if(v.error)return(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:w-full stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:p-4",m),children:[(0,b.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-[var(--stgm-destructive,#ef4444)]",children:"Failed to parse workflow"}),(0,b.jsx)("span",{className:"stg:max-w-md stg:text-center stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:v.error})]});let e7=!!v.graph;return(0,b.jsxs)("div",{ref:f,className:(0,j.cn)("stgm stg:relative stg:flex stg:h-full stg:w-full",m),tabIndex:-1,children:[(0,b.jsx)("div",{className:"stg:sr-only","aria-live":"polite","aria-atomic":"true",children:e4}),o&&!k&&(0,b.jsx)($,{}),(0,b.jsxs)("div",{className:"stg:relative stg:flex-1",onPointerDownCapture:O,children:[o&&(0,b.jsx)(sE,{collapsed:k,onToggle:C}),e7&&(0,b.jsx)(sI,{onAutoLayout:v.autoLayout,onUndo:v.undo,onRedo:v.redo,canUndo:v.canUndo,canRedo:v.canRedo,isDirty:v.isDirty,onSave:i?eZ:void 0,isSaving:d}),(0,b.jsxs)(t0.CanvasActionsContext.Provider,{value:e3,children:[(0,b.jsx)(t.Suspense,{fallback:e2,children:(0,b.jsx)(sw,{nodes:v.nodes,edges:v.edges,onNodesChange:v.onNodesChange,onEdgesChange:v.onEdgesChange,onNodeDragStart:v.onNodeDragStart,onNodeDragStop:v.onNodeDragStop,onNodeClick:V,onEdgeClick:J,onPaneClick:eu,onConnect:v.onConnect,isValidConnection:v.isValidConnection,onDrop:v.onDrop,onDragOver:v.onDragOver,onNodesDelete:L,onEdgesDelete:v.onEdgesDelete,onNodeContextMenu:ej,onEdgeContextMenu:eN,onPaneContextMenu:eC,onSelectionContextMenu:eY,nodeErrors:c})}),!e7&&(0,b.jsx)("div",{className:"stg:pointer-events-none stg:absolute stg:inset-0 stg:flex stg:items-center stg:justify-center",children:(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:gap-2 stg:text-center",children:[(0,b.jsx)("span",{className:"stg:text-sm stg:text-[var(--stgm-muted-foreground,#737373)]",children:"No workflow to visualize"}),(0,b.jsx)("span",{className:"stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Drag a task from the palette to get started"})]})})]}),(0,b.jsx)(sn,{open:null!==S,onOpenChange:ew,target:S?.target??null,position:S?.position??null,onDeleteNode:e_,onDuplicateNode:eS,onAddTaskAfter:eE,onToggleDisabled:eR,onWrapInTryCatch:e$,onCopyNode:eO,onRenameNode:eL,onViewYaml:eH,onDeleteEdge:eT,onInsertTaskOnEdge:eM,onAddTaskAtPosition:eI,onSelectAll:eA,onAutoLayout:eD,onPaste:eF,hasClipboard:v.hasClipboard,onFitView:eU,onCopySelection:eV,onDuplicateSelection:eW,onDisableSelection:eK,onDeleteSelection:ez}),(0,b.jsx)(sb.TaskPickerPopover,{open:null!==T,onOpenChange:eq,onSelectKind:eJ,anchorRef:eG,insertionContext:eX,graph:v.getGraphModel(),side:"bottom"}),(0,b.jsx)(sN,{nodeId:eP,graph:v.graph,onClose:()=>eB(null)})]}),l&&e7&&(0,b.jsx)("div",{className:"stg:w-[280px] stg:min-w-[240px] stg:overflow-hidden stg:border-l stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))]",children:(0,b.jsx)(tG,{selection:v.selection,graph:v.graph,descriptor:e5,onUpdateField:v.updateNodeField,onRenameNode:v.renameNode,onUpdateExport:v.updateNodeExport,onUpdateFlow:v.updateNodeFlow,onDeleteEdge:eQ,onDeleteNode:e0,onDuplicateNode:e1,onToggleDisabled:v.toggleNodeDisabled,onWrapInTryCatch:v.wrapInTryCatch,onUpdateBranchRouting:v.updateBranchRouting,onMigrateBranchHandle:v.migrateBranchHandle,onRemoveBranchEdges:v.removeBranchEdges,onViewYaml:eH,validationErrors:c,emptyState:v.graph?(0,b.jsx)(tq,{graph:v.graph,validationErrors:c}):void 0})})]})}),sS=(0,t.memo)(function(e){return(0,b.jsx)(y.ReactFlowProvider,{children:(0,b.jsx)(s_,{...e})})});function sE({collapsed:e,onToggle:t}){return(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:t,className:(0,j.cn)("stg:absolute stg:left-2 stg:z-10 stg:rounded stg:border stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))] stg:p-1 stg:shadow-sm","stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:active:bg-[var(--stgm-accent,#e5e5e5)]",e?"stg:top-2":"stg:bottom-2"),"aria-label":e?"Show task palette":"Hide task palette"}),children:(0,b.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:text-[var(--stgm-foreground,#1a1a2e)]",children:e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"1",y:"1",width:"5",height:"14",rx:"1"}),(0,b.jsx)("path",{d:"M10 8h5M11 6l2 2-2 2"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("rect",{x:"1",y:"1",width:"5",height:"14",rx:"1"}),(0,b.jsx)("path",{d:"M14 8H9M13 6l-2 2 2 2"})]})})}),(0,b.jsx)(eN.TooltipContent,{side:"right",children:e?"Show task palette":"Hide task palette"})]})}let sT="u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),sM={undo:sT?"⌘Z":"Ctrl+Z",redo:sT?"⇧⌘Z":"Ctrl+Shift+Z"};function sI({onAutoLayout:e,onUndo:t,onRedo:s,canUndo:r,canRedo:a,isDirty:n,onSave:o,isSaving:l=!1}){let i="stg:rounded stg:border stg:border-[var(--stgm-border-prominent,#d4d4d8)] stg:bg-[var(--stgm-card,var(--stgm-background,#fff))] stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-foreground,#1a1a2e)] stg:shadow-sm stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:active:bg-[var(--stgm-accent,#e5e5e5)] stg:disabled:cursor-not-allowed stg:disabled:opacity-40";return(0,b.jsx)(eN.TooltipProvider,{children:(0,b.jsxs)("div",{className:"stg:absolute stg:left-2 stg:top-2 stg:z-10 stg:flex stg:items-center stg:gap-1",children:[(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("span",{className:"stg:inline-flex"}),children:(0,b.jsx)("button",{type:"button",onClick:t,disabled:!r,className:i,"aria-label":"Undo",children:"Undo"})}),(0,b.jsx)(eN.TooltipContent,{side:"bottom",children:sM.undo})]}),(0,b.jsxs)(eN.Tooltip,{children:[(0,b.jsx)(eN.TooltipTrigger,{render:(0,b.jsx)("span",{className:"stg:inline-flex"}),children:(0,b.jsx)("button",{type:"button",onClick:s,disabled:!a,className:i,"aria-label":"Redo",children:"Redo"})}),(0,b.jsx)(eN.TooltipContent,{side:"bottom",children:sM.redo})]}),(0,b.jsx)("div",{className:"stg:mx-1 stg:h-4 stg:w-px stg:bg-[var(--stgm-border,#d4d4d8)]","aria-hidden":"true"}),(0,b.jsx)("button",{type:"button",onClick:e,className:i,"aria-label":"Auto-layout",children:"Auto-layout"}),o&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"stg:mx-1 stg:h-4 stg:w-px stg:bg-[var(--stgm-border,#d4d4d8)]","aria-hidden":"true"}),(0,b.jsx)("button",{type:"button",onClick:o,disabled:!n||l,className:"stg:rounded stg:bg-[var(--stgm-primary,#6366f1)] stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-primary-foreground,#fff)] stg:shadow-sm stg:hover:opacity-90 stg:disabled:cursor-not-allowed stg:disabled:opacity-40",children:l?"Saving…":"Save"})]}),n&&!o&&(0,b.jsx)("span",{className:"stg:ml-1 stg:text-[10px] stg:text-[var(--stgm-muted-foreground,#737373)]",children:"Modified"})]})})}e.s(["WorkflowCanvasEditor",0,sS],644223);var sA=e.i(661438),sD=e.i(610595),sR=e.i(59309),s$=e.i(28434),sO=e.i(375954),sL=e.i(574803),sP=e.i(796545),sB=e.i(145995),sH=e.i(839329);let sF={org:"",slug:"workflow-architect"};var sU=e.i(226634),sV=e.i(953520),sW=e.i(163732),sK=e.i(379410);let sz=new Set(["idle","ready","complete","error"]);function sY({extractedYaml:e,explanation:s,beforeYaml:r,onAccept:a,onDiscard:n}){let[o,l]=(0,t.useState)(!1),i=(0,sV.computeUnifiedDiff)(r,e),d=i.some(e=>"equal"!==e.type);return(0,b.jsxs)("div",{className:"stg:border-t stg:border-border stg:px-3 stg:py-3","aria-live":"polite",children:[s&&(0,b.jsxs)("div",{className:"stg:mb-3",children:[(0,b.jsx)("h4",{className:"stg:mb-1 stg:text-[0.65rem] stg:font-medium stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"Changes"}),(0,b.jsx)("p",{className:"stg:text-xs stg:leading-relaxed stg:text-foreground",children:s})]}),d&&(0,b.jsx)("div",{className:"stg:mb-3",children:(0,b.jsx)("div",{className:"stg:h-[200px] stg:overflow-hidden stg:rounded-md stg:border stg:border-border",children:(0,b.jsx)(sW.WorkflowDiffGraph,{beforeYaml:r,afterYaml:e})})}),d&&(0,b.jsxs)("div",{className:"stg:mb-3",children:[(0,b.jsx)("button",{type:"button",onClick:()=>l(e=>!e),className:"stg:text-[0.65rem] stg:font-medium stg:text-muted-foreground stg:hover:text-foreground",children:o?"▾ Hide YAML diff":"▸ View YAML diff"}),o&&(0,b.jsx)("div",{className:"stg:mt-1",children:(0,b.jsx)(sG,{lines:i})})]}),(0,b.jsxs)("div",{className:"stg:flex stg:gap-2",children:[(0,b.jsx)("button",{type:"button",onClick:a,className:(0,j.cn)("stg:flex-1 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary/90","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Accept"}),(0,b.jsx)("button",{type:"button",onClick:n,className:(0,j.cn)("stg:flex-1 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:border stg:border-input stg:bg-background stg:text-foreground","stg:hover:bg-accent stg:hover:text-accent-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Discard"})]})]})}function sG({lines:e}){return e.filter(e=>"equal"!==e.type||""!==e.content.trim()).length>200?(0,b.jsx)("p",{className:"stg:text-[0.7rem] stg:text-muted-foreground",children:"Diff is too large to display. Accept to see the updated YAML."}):(0,b.jsx)("pre",{className:"stg:max-h-60 stg:overflow-auto stg:rounded-md stg:border stg:border-border stg:text-[0.7rem] stg:leading-relaxed",children:e.map((e,t)=>(0,b.jsxs)("div",{className:(0,j.cn)("stg:px-2","added"===e.type&&"stg:bg-success/10 stg:text-success","removed"===e.type&&"stg:bg-destructive/10 stg:text-destructive","equal"===e.type&&"stg:text-muted-foreground"),children:[(0,b.jsx)("span",{className:"stg:mr-2 stg:inline-block stg:w-3 stg:select-none stg:text-right stg:opacity-60",children:"added"===e.type?"+":"removed"===e.type?"-":" "}),e.content]},t))})}function sq(){return(0,b.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M8 2l1.5 4.5L14 8l-4.5 1.5L8 14l-1.5-4.5L2 8l4.5-1.5z"})})}function sJ(){return(0,b.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M4 4l8 8M12 4l-8 8"})})}e.s(["WorkflowRefinePanel",0,function({org:e,currentYaml:s,onAccept:r,onClose:a,initialInstruction:n,className:o}){let[l,i]=(0,t.useState)(""),d=(0,t.useRef)(null),g=(0,t.useRef)(!1),c=function(e){let{org:s,currentYaml:r,onError:a}=e,[n,o]=(0,t.useState)("idle"),[l,i]=(0,t.useState)(null),[d,g]=(0,t.useState)([]),[c,u]=(0,t.useState)(null),[m,h]=(0,t.useState)(null),p=(0,t.useRef)(s);p.current=s;let f=(0,t.useRef)(r);f.current=r;let x=(0,t.useRef)(a);x.current=a;let v=(0,t.useRef)(null),b=(0,t.useRef)(null),y=(0,t.useRef)(!1),{create:k}=(0,sR.useCreateSession)(),{create:j}=(0,s$.useCreateAgentExecution)(),N=(0,sP.useConversationStoreRef)(),C=(0,sO.useExecutionStream)(l,{store:N});(0,t.useEffect)(()=>{if("streaming"===n&&C.phase!==sA.ExecutionPhase.EXECUTION_PHASE_UNSPECIFIED&&(0,sL.isTerminalPhase)(C.phase)&&!y.current){y.current=!0,C.execution&&g(e=>[...e,C.execution]);let e=C.execution?.status?.structuredOutput;if(e){let t=e.action,s=e.yaml,r=e.explanation;"generated_yaml"===t&&s?(u({yaml:s,explanation:r??""}),o("complete")):o("ready")}else{let e=(0,sB.extractWorkflowYaml)(C.execution);e?(u(e),o("complete")):o("ready")}i(null)}},[n,C.phase,C.execution]),(0,t.useEffect)(()=>{if(C.error&&"streaming"===n){let e=(0,sD.getUserMessage)(C.error,"Agent stream interrupted");o("error"),h(e),x.current?.(e)}},[C.error,n]);let w=(0,t.useCallback)(e=>{let t=f.current,s=t!==b.current;return(b.current=t,s&&t)?"Here is the current workflow YAML:\n\n```yaml\n"+t+"\n```\n\n"+e:e},[]),_=(0,t.useCallback)(async e=>{let t=e.trim();if(t.length<5)return void h("Instruction must be at least 5 characters");if("idle"===n||"ready"===n||"complete"===n||"error"===n){o("starting"),h(null),u(null),y.current=!1;try{let e=v.current;if(!e){let{sessionId:t}=await k({org:p.current,agentRef:{...sF,org:p.current}});v.current=t,e=t}let s=w(t),{executionId:r}=await j({org:p.current,sessionId:e,message:s,structuredOutputSchema:sH.WORKFLOW_ARCHITECT_RESPONSE_SCHEMA});i(r),o("streaming")}catch(t){let e=(0,sD.getUserMessage)(t,"Failed to start the Workflow Architect agent");o("error"),h(e),x.current?.(e)}}},[n,k,j,w]),S=(0,t.useCallback)(()=>{if("complete"!==n||!c)return null;let e=c.yaml;return u(null),o("ready"),e},[n,c]),E=(0,t.useCallback)(()=>{"complete"===n&&(u(null),o("ready"))},[n]),T=(0,t.useCallback)(()=>{o("idle"),i(null),g([]),u(null),h(null),v.current=null,b.current=null,y.current=!1},[]);return(0,t.useMemo)(()=>({phase:n,completedExecutions:d,activeExecution:C.execution,isStreaming:C.isStreaming||C.isConnecting,extractedYaml:c?.yaml??null,explanation:c?.explanation??null,error:m,sendInstruction:_,acceptResult:S,discardResult:E,reset:T}),[n,d,C.execution,C.isStreaming,C.isConnecting,c,m,_,S,E,T])}({org:e,currentYaml:s,onError:()=>{}}),{sendInstruction:u,phase:m}=c;n&&!g.current&&"idle"===m&&(g.current=!0,Promise.resolve().then(()=>u(n)));let h=sz.has(c.phase),p=c.completedExecutions.length>0||null!==c.activeExecution,f=(0,t.useCallback)(async()=>{let e=l.trim();e.length<5||(i(""),await c.sendInstruction(e),requestAnimationFrame(()=>{d.current?.scrollTo({top:d.current.scrollHeight,behavior:"smooth"})}))},[c.sendInstruction,l]),x=(0,t.useCallback)(()=>{let e=c.acceptResult();e&&r(e)},[c.acceptResult,r]),v=(0,t.useCallback)(()=>{c.discardResult()},[c.discardResult]),y=(0,t.useCallback)(e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())},[f]);return(0,b.jsxs)("div",{className:(0,j.cn)("stg:flex stg:h-full stg:flex-col stg:border-l stg:border-border stg:bg-background",o),role:"complementary","aria-label":"Workflow refinement panel",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-3 stg:py-2",children:[(0,b.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-1.5",children:[(0,b.jsx)(sq,{}),(0,b.jsx)("h3",{className:"stg:text-xs stg:font-semibold stg:text-foreground",children:"Refine with AI"}),c.isStreaming&&(0,b.jsxs)("span",{className:"stg:inline-flex stg:items-center stg:gap-1 stg:text-[0.65rem] stg:text-muted-foreground",children:[(0,b.jsx)(sK.SpinnerIcon,{size:10}),"Working…"]})]}),(0,b.jsx)("button",{type:"button",onClick:a,className:"stg:rounded stg:p-0.5 stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground","aria-label":"Close refinement panel",children:(0,b.jsx)(sJ,{})})]}),(0,b.jsxs)("div",{ref:d,className:"stg:flex stg:min-h-0 stg:flex-1 stg:flex-col stg:overflow-y-auto",children:[!p&&"idle"===c.phase&&(0,b.jsxs)("div",{className:"stg:flex stg:flex-1 stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:px-4 stg:py-8 stg:text-center",children:[(0,b.jsx)(sq,{}),(0,b.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Describe the changes you want and the Workflow Architect agent will refine your workflow definition."})]}),"starting"===c.phase&&(0,b.jsxs)("div",{className:"stg:flex stg:flex-col stg:items-center stg:justify-center stg:gap-2 stg:py-8",children:[(0,b.jsx)(sK.SpinnerIcon,{size:14}),(0,b.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Starting Workflow Architect…"})]}),p&&(0,b.jsx)(sU.MessageThread,{executions:c.completedExecutions,activeStreamExecution:c.activeExecution,pendingUserMessage:"starting"===c.phase&&l||void 0,className:"stg:flex-1"}),c.error&&"error"===c.phase&&(0,b.jsx)("div",{className:"stg:mx-3 stg:mt-3 stg:rounded-md stg:border stg:border-destructive/30 stg:bg-destructive/5 stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",role:"alert",children:c.error})]}),"complete"===c.phase&&c.extractedYaml&&(0,b.jsx)(sY,{extractedYaml:c.extractedYaml,explanation:c.explanation,beforeYaml:s,onAccept:x,onDiscard:v}),(0,b.jsxs)("div",{className:"stg:border-t stg:border-border stg:p-3",children:[(0,b.jsx)("textarea",{value:l,onChange:e=>i(e.target.value),onKeyDown:y,placeholder:"What would you like to change?",disabled:!h,rows:3,className:(0,j.cn)("stg:w-full stg:resize-none stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-sm stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50")}),(0,b.jsxs)("div",{className:"stg:mt-2 stg:flex stg:items-center stg:justify-between",children:[(0,b.jsxs)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:["⌘","+Enter to submit"]}),(0,b.jsx)("button",{type:"button",onClick:f,disabled:!h||l.trim().length<5,className:(0,j.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:rounded-md stg:px-3 stg:py-1.5 stg:text-xs stg:font-medium stg:transition-colors","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary/90","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:"Send"})]})]})]})}],967341)},59306,380568,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(893976),a=e.i(23621),n=e.i(571471),o=e.i(622968),l=e.i(644223),i=e.i(967341),d=e.i(695749),g=e.i(714028);let c=(0,s.memo)(function({initialYaml:e,org:c,onSaveSuccess:f,onSaveError:k,defaultMode:j="code",className:N,layoutEngine:C}){let w=(0,a.useWorkflowEditor)(e,{org:c}),[_,S]=(0,s.useState)(!1),[E,T]=(0,s.useState)(j),[M,I]=(0,s.useState)(!1),[A,D]=(0,s.useState)(!1),[R,$]=(0,s.useState)(!1),[O,L]=(0,s.useState)(void 0),[P,B]=(0,s.useState)(!1),[H,F]=(0,s.useState)(!1),[U,V]=(0,s.useState)(!1),W=(0,s.useCallback)(async()=>{await w.save()?f?.():w.saveError&&k?.(w.saveError)},[w,f,k]),K=(0,s.useCallback)(()=>{S(e=>!e)},[]),z=(0,s.useCallback)(()=>{try{(0,g.yamlToGraph)(w.yaml),I(!0)}catch{k?.(Error("Cannot switch to visual mode: the current YAML has structural errors that prevent parsing."))}},[w.yaml,k]),Y=(0,s.useCallback)(()=>{I(!1),T("visual")},[]),G=(0,s.useCallback)(()=>{I(!1)},[]),q=(0,s.useCallback)(()=>{H?V(!0):T("code")},[H]),J=(0,s.useCallback)(()=>{V(!1),T("code"),F(!1)},[]),X=(0,s.useCallback)(()=>{V(!1)},[]),Z=(0,s.useCallback)(async e=>{D(!0),w.setYaml(e),setTimeout(async()=>{let e=await w.save();D(!1),F(!1),e?f?.():w.saveError&&k?.(w.saveError)},0)},[w,f,k]),Q=(0,s.useCallback)(()=>{$(e=>!e),L(void 0)},[]),ee=(0,s.useCallback)(()=>{let e=w.diagnostics.filter(e=>"error"===e.severity);0===e.length||(L(["Fix the following validation errors in this workflow:","",...e.map((e,t)=>`${t+1}. ${e.message}`),"","Please fix these issues and return the corrected workflow."].join("\n")),$(!0))},[w.diagnostics]),et=(0,s.useCallback)(e=>{if(w.setYaml(e),"visual"===E)try{(0,g.yamlToGraph)(e)}catch{}},[w,E]),es=(0,s.useMemo)(()=>{if("visual"!==E)return new Map;let e=new Map;for(let t of w.diagnostics){if("error"!==t.severity)continue;let s=t.message.match(/task\s+"([^"]+)"/i)??t.message.match(/task\s+(\S+)/i);if(s){let r=s[1],a=e.get(r);a?a.push(t.message):e.set(r,[t.message])}}return e},[E,w.diagnostics]),er=(0,r.cn)("stgm-workflow-editor stg:flex stg:flex-col",_&&"stg:fixed stg:inset-0 stg:z-50 stg:bg-background",!_&&"stg:h-full",N);return(0,t.jsxs)("div",{className:er,children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-3 stg:py-2",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(u,{mode:E,onSwitchToCode:q,onSwitchToVisual:z}),(0,t.jsx)("div",{className:"stg:mx-1 stg:h-4 stg:w-px stg:bg-[var(--stgm-border,#d4d4d8)]","aria-hidden":"true"}),(0,t.jsxs)("button",{type:"button",onClick:Q,className:(0,r.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors",R?"stg:bg-primary/10 stg:text-primary":"stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground"),"aria-pressed":R,"aria-label":"Refine with AI",children:[(0,t.jsx)(x,{}),"Refine"]}),(0,t.jsx)("div",{className:"stg:mx-1 stg:h-4 stg:w-px stg:bg-[var(--stgm-border,#d4d4d8)]","aria-hidden":"true"}),(0,t.jsx)(p,{errorCount:w.errorCount,warningCount:w.warningCount}),w.errorCount>0&&(0,t.jsxs)("button",{type:"button",onClick:ee,className:(0,r.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors","stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground"),"aria-label":"Fix validation errors with AI",children:[(0,t.jsx)(b,{}),"Fix with AI"]}),(w.isDirty||H)&&(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"Unsaved changes"})]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:["code"===E&&(w.isDirty||w.versionMessage)&&(0,t.jsx)("input",{type:"text",value:w.versionMessage,onChange:e=>w.setVersionMessage(e.target.value),placeholder:"Version message (optional)",disabled:w.isSaving,className:(0,r.cn)("stg:h-7 stg:w-48 stg:rounded stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:bg-[var(--stgm-background,#fff)] stg:px-2 stg:text-xs","stg:text-[var(--stgm-foreground,#1a1a2e)] stg:placeholder:text-[var(--stgm-muted-foreground,#a3a3a3)]","stg:focus:border-[var(--stgm-primary,#6366f1)] stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-[var(--stgm-primary,#6366f1)]","stg:disabled:opacity-40")}),"code"===E&&(0,t.jsx)("button",{type:"button",onClick:w.reset,disabled:!w.isDirty||w.isSaving,className:(0,r.cn)("stg:rounded stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors","stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:"Reset"}),"code"===E&&(0,t.jsx)("button",{type:"button",onClick:W,disabled:!w.isDirty||w.isSaving||w.errorCount>0,className:(0,r.cn)("stg:rounded stg:bg-primary stg:px-3 stg:py-1 stg:text-xs stg:font-medium stg:text-primary-foreground stg:transition-colors","stg:hover:bg-primary/90","stg:disabled:pointer-events-none stg:disabled:opacity-40"),children:w.isSaving?"Saving…":"Save"}),(0,t.jsxs)("button",{type:"button",onClick:()=>B(!0),className:(0,r.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors","stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground"),"aria-label":"Explain this workflow",children:[(0,t.jsx)(v,{}),"Explain"]}),(0,t.jsx)("button",{type:"button",onClick:K,className:"stg:rounded stg:p-1 stg:text-muted-foreground stg:hover:bg-muted stg:hover:text-foreground","aria-label":_?"Exit full page":"Full page",children:(0,t.jsx)(y,{expanded:_})})]})]}),w.saveError&&(0,t.jsx)("div",{className:"stg:border-b stg:border-destructive/20 stg:bg-destructive/5 stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",children:w.saveError.message}),M&&(0,t.jsx)(m,{onConfirm:Y,onCancel:G}),U&&(0,t.jsx)(h,{onDiscard:J,onCancel:X}),(0,t.jsx)(d.WorkflowExplainDialog,{open:P,onOpenChange:B,org:c,currentYaml:w.yaml}),(0,t.jsx)("div",{className:"stg:flex stg:min-h-0 stg:flex-1",children:"code"===E?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"stg:flex-1 stg:overflow-hidden stg:border-r stg:border-border",children:(0,t.jsx)(n.WorkflowYamlEditor,{value:w.yaml,onChange:w.setYaml,diagnostics:w.diagnostics,className:"stg:h-full stg:rounded-none stg:border-0"})}),(0,t.jsx)("div",{className:"stg:w-[40%] stg:min-w-[240px] stg:overflow-hidden",children:R?(0,t.jsx)(i.WorkflowRefinePanel,{org:c,currentYaml:w.yaml,onAccept:et,onClose:Q,initialInstruction:O,className:"stg:h-full"}):(0,t.jsx)(o.WorkflowCodePreviewGraph,{yaml:w.yaml,className:"stg:h-full"})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.WorkflowCanvasEditor,{yaml:w.yaml,onSave:Z,isSaving:A,onDirtyChange:F,nodeErrors:es,layoutEngine:C,className:R?"stg:w-[60%]":"stg:flex-1"}),R&&(0,t.jsx)("div",{className:"stg:w-[40%] stg:min-w-[240px] stg:overflow-hidden",children:(0,t.jsx)(i.WorkflowRefinePanel,{org:c,currentYaml:w.yaml,onAccept:et,onClose:Q,initialInstruction:O,className:"stg:h-full"})})]})})]})});function u({mode:e,onSwitchToCode:s,onSwitchToVisual:a}){let n=e=>(0,r.cn)("stg:rounded stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:transition-colors",e?"stg:bg-[var(--stgm-primary,#6366f1)] stg:text-[var(--stgm-primary-foreground,#fff)]":"stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)] stg:hover:text-[var(--stgm-foreground,#1a1a2e)]");return(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-0.5 stg:rounded-md stg:border stg:border-[var(--stgm-border,#d4d4d8)] stg:p-0.5",role:"tablist","aria-label":"Editor mode",children:[(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":"code"===e,onClick:s,className:n("code"===e),children:"Code"}),(0,t.jsx)("button",{type:"button",role:"tab","aria-selected":"visual"===e,onClick:a,className:n("visual"===e),children:"Visual"})]})}function m({onConfirm:e,onCancel:s}){return(0,t.jsx)("div",{className:"stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-accent,#fffbeb)] stg:px-3 stg:py-2",children:(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:"Switching to visual mode will normalize YAML formatting. Comments and custom ordering will not be preserved."}),(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:s,className:"stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:e,className:"stg:rounded stg:bg-[var(--stgm-primary,#6366f1)] stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-primary-foreground,#fff)] stg:hover:opacity-90",children:"Continue"})]})]})})}function h({onDiscard:e,onCancel:s}){return(0,t.jsx)("div",{className:"stg:border-b stg:border-[var(--stgm-border,#e5e5e5)] stg:bg-[var(--stgm-accent,#fffbeb)] stg:px-3 stg:py-2",children:(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-[var(--stgm-foreground,#1a1a2e)]",children:"You have unsaved changes in the visual editor. Switching to code mode will discard them."}),(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:s,className:"stg:rounded stg:px-2 stg:py-1 stg:text-xs stg:text-[var(--stgm-muted-foreground,#737373)] stg:hover:bg-[var(--stgm-muted,#f5f5f5)]",children:"Stay in Visual"}),(0,t.jsx)("button",{type:"button",onClick:e,className:"stg:rounded stg:bg-[var(--stgm-destructive,#ef4444)] stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium stg:text-[var(--stgm-destructive-foreground,#fff)] stg:hover:opacity-90",children:"Discard & Switch"})]})]})})}function p({errorCount:e,warningCount:s}){return 0===e&&0===s?(0,t.jsxs)("span",{className:"stg:text-xs stg:text-success",children:[(0,t.jsx)(f,{})," ","Valid"]}):(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[e>0&&(0,t.jsxs)("span",{className:"stg:text-xs stg:text-destructive",children:[e," ",1===e?"error":"errors"]}),s>0&&(0,t.jsxs)("span",{className:"stg:text-xs stg:text-warning",children:[s," ",1===s?"warning":"warnings"]})]})}function f(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"stg:inline-block",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.5"}),(0,t.jsx)("path",{d:"M5.5 8l2 2 3-3.5"})]})}function x(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2l1.5 4.5L14 8l-4.5 1.5L8 14l-1.5-4.5L2 8l4.5-1.5z"})})}function v(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.5"}),(0,t.jsx)("path",{d:"M6.5 6a1.5 1.5 0 1 1 1.5 1.5V9"}),(0,t.jsx)("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor"})]})}function b(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2l1.5 4.5L14 8l-4.5 1.5L8 14l-1.5-4.5L2 8l4.5-1.5z"})})}function y({expanded:e}){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M6 2H2v4M10 14h4v-4"}),(0,t.jsx)("path",{d:"M2 2l5 5M14 14l-5-5"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("path",{d:"M14 2h-4M2 14h4"}),(0,t.jsx)("path",{d:"M14 2l-5 5M2 14l5-5"})]})})}e.s(["WorkflowEditorView",0,c],59306);var k=e.i(242792),j=e.i(207425),N=e.i(735922);function C(e,t,s,r){return{id:e,side:t,index:s,...void 0!==r&&{label:r}}}let w={"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.nodePlacement.favorStraightEdges":"true","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.crossingMinimization.greedySwitch.type":"TWO_SIDED","elk.spacing.nodeNode":"30","elk.layered.spacing.nodeNodeBetweenLayers":"60","elk.spacing.edgeNode":"20","elk.spacing.edgeEdge":"15","elk.portConstraints":"FIXED_SIDE","elk.portAlignment.default":"CENTER","elk.layered.considerModelOrder.strategy":"NODES_AND_EDGES"};function _(e){let t=e.id===k.START_NODE_ID||e.id===k.END_NODE_ID;return{width:t?j.SENTINEL_NODE_WIDTH:j.CANVAS_NODE_WIDTH,height:t?j.SENTINEL_NODE_HEIGHT:j.CANVAS_NODE_HEIGHT}}async function S(e){return new T(await E(e),e?.layoutOptions)}async function E(t){if(t?.workerFactory)try{let s=await e.A(846022);return new(s.default??s)({workerFactory:t.workerFactory})}catch{}let s=await e.A(600124);return new(s.default??s)}class T{name="elk-layered";elk;optionOverrides;terminated=!1;constructor(e,t){this.elk=e,this.optionOverrides=t}async layout(e){var t,s,r;let a,n;if(this.terminated)throw Error("ELK layout engine has been terminated.");let o=performance.now(),l=function(e,t){var s,r,a,n,o;let{graph:l,getNodeDimensions:i=_}=e,d=function(e,t){let s=new Map;for(let r of e)s.set(r.id,function(e,t){let s=e.id;if(s===k.START_NODE_ID)return{nodeId:s,inputPorts:[],outputPorts:[C(`${s}__out`,"SOUTH",0)]};if(s===k.END_NODE_ID)return{nodeId:s,inputPorts:[C(`${s}__in`,"NORTH",0)],outputPorts:[]};let r=[C(`${s}__in`,"NORTH",0)];return{nodeId:s,inputPorts:r,outputPorts:function(e,t){let s=e.config;return e.kind===N.WorkflowTaskKind.switch_case&&s?function(e,t){let s=t.cases;if(!Array.isArray(s)||0===s.length)return[C(`${e}__out`,"SOUTH",0)];let r=[],a=0;for(let t of s)if(null!=t&&"object"==typeof t&&"string"==typeof t.name){let s=t.name;r.push(C(`${e}__case_${s}`,"SOUTH",a,s)),a++}return r.length>0?r:[C(`${e}__out`,"SOUTH",0)]}(e.id,s):e.kind===N.WorkflowTaskKind.human_input&&s?function(e,t){let s=t.outcomes;if(!Array.isArray(s)||0===s.length)return[C(`${e}__out`,"SOUTH",0)];let r=[],a=0;for(let t of s)if(null!=t&&"object"==typeof t&&"string"==typeof t.name){let s=t.name;r.push(C(`${e}__outcome_${s}`,"SOUTH",a,s)),a++}return r.length>0?r:[C(`${e}__out`,"SOUTH",0)]}(e.id,s):e.kind===N.WorkflowTaskKind.fork?function(e,t){let s=t.filter(t=>t.source===e);return s.length<=1?[C(`${e}__out`,"SOUTH",0)]:s.map((t,s)=>{let r=t.sourceHandle??`branch_${s}`;return C(`${e}__${r}`,"SOUTH",s)})}(e.id,t):[C(`${e.id}__out`,"SOUTH",0)]}(e,t)}}(r,t));return s}(l.nodes,l.edges),g=(s=l.nodes,r=d,a=i,s.map(e=>{let t=a(e),s=r.get(e.id),n=s?function(e){let t=[];for(let s of e.inputPorts)t.push({id:s.id,width:8,height:8,layoutOptions:{"elk.port.side":s.side,"elk.port.index":String(s.index)}});for(let s of e.outputPorts)t.push({id:s.id,width:8,height:8,layoutOptions:{"elk.port.side":s.side,"elk.port.index":String(s.index)}});return t}(s):[],o={id:e.id,width:t.width,height:t.height,ports:n,labels:[{text:e.taskName}]};return n.length>0?{...o,layoutOptions:{"elk.portConstraints":"FIXED_ORDER"}}:o})),c=(n=l.edges,o=d,n.map(e=>{var t;let s,r=function(e,t){let s=t.get(e.source);if(!s||0===s.outputPorts.length)return e.source;if(e.sourceHandle){let t=s.outputPorts.find(t=>t.id===`${e.source}__${e.sourceHandle}`);if(t)return t.id}return s.outputPorts[0].id}(e,o),a=(t=e,(s=o.get(t.target))&&0!==s.inputPorts.length?s.inputPorts[0].id:t.target);return{id:e.id,sources:[r],targets:[a]}}));return{id:"root",layoutOptions:{...w,...t},children:g,edges:c}}(e,this.optionOverrides),i=await this.elk.layout(l),d=performance.now()-o;return t=e.scope,s=e.graph,r=this.name,a=function(e){let t=new Map;if(!e.children)return t;for(let s of e.children)t.set(s.id,{x:s.x,y:s.y});return t}(i),n=function(e){let t=new Map;if(!e.edges)return t;for(let s of e.edges){if(!s.sections||0===s.sections.length)continue;let e=function(e){let t=[];for(let s of e)t.push(s.startPoint),s.bendPoints&&t.push(...s.bendPoints),t.push(s.endPoint);return t}(s.sections);e.length>0&&t.set(s.id,e)}return t}(i),{positions:function(e,t,s){switch(t.type){case"whole-graph":return e;case"selected":var r=e,a=t.nodeIds;let n=new Map;for(let[e,t]of r)a.has(e)&&n.set(e,t);return n;case"downstream":return function(e,t,s){let r=function(e,t){let s=new Map;for(let e of t){let t=s.get(e.source);t?t.push(e.target):s.set(e.source,[e.target])}let r=new Set,a=[e];for(;a.length>0;){let e=a.shift();if(r.has(e))continue;r.add(e);let t=s.get(e);if(t)for(let e of t)r.has(e)||a.push(e)}return r}(t,s),a=new Map;for(let[t,s]of e)r.has(t)&&a.set(t,s);return a}(e,t.fromNodeId,s.edges)}}(a,t,s),edgePaths:n.size>0?n:void 0,durationMs:d,engine:r}}terminate(){this.terminated=!0,"terminateWorker"in this.elk&&"function"==typeof this.elk.terminateWorker&&this.elk.terminateWorker()}}e.s(["useElkLayoutEngine",0,function(e){let[t,r]=(0,s.useState)(null),a=(0,s.useRef)(null),n=(0,s.useRef)(e);n.current=e;let o=e?.enabled!==!1;return(0,s.useEffect)(()=>{if(!o)return;let e=!1,t={};return n.current?.workerFactory&&(t.workerFactory=n.current.workerFactory),n.current?.layoutOptions&&(t.layoutOptions=n.current.layoutOptions),S(t).then(t=>{e?t.terminate?.():(a.current=t,r(t))},()=>{}),()=>{e=!0,a.current?.terminate?.(),a.current=null,r(null)}},[o]),t}],380568)},195737,e=>{e.v(function(t,s){return e.b(t,"static/chunks/turbopack-worker-0sjn--fhq~1cg.js",["static/chunks/0tq77.56bu2eu.js","static/chunks/turbopack-0cvnq9zq1g68-.js"],s)})}]);
|