@intent-hq/web 2.373.0 → 2.374.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/package.json +1 -1
- package/web/app/immutable/chunks/{CGf2gpvp.js → 0Xr6eOOE.js} +1 -1
- package/web/app/immutable/chunks/{BKN8g-SH.js → 1e1uSG0B.js} +1 -1
- package/web/app/immutable/chunks/{B16R3gcp.js → 49cgEwsv.js} +1 -1
- package/web/app/immutable/chunks/{dIHmpCQU.js → 4aIDpPwE.js} +1 -1
- package/web/app/immutable/chunks/{DKfX0H_n.js → 50l-lj9m.js} +1 -1
- package/web/app/immutable/chunks/{mvlVGSeb.js → 5kmlNoKC.js} +4 -4
- package/web/app/immutable/chunks/{CP45YnfV.js → 5rvkVpHO.js} +1 -1
- package/web/app/immutable/chunks/{Cd-cZZzm.js → 6svm3ALY.js} +1 -1
- package/web/app/immutable/chunks/{ewVf6PIZ.js → 78vu4B3v.js} +1 -1
- package/web/app/immutable/chunks/{DD146Q03.js → 89cPEaN9.js} +1 -1
- package/web/app/immutable/chunks/{BQ8qAv7M.js → 8un-1yF0.js} +1 -1
- package/web/app/immutable/chunks/{CErePAlp.js → 9sLim_4t.js} +1 -1
- package/web/app/immutable/chunks/{D3ndslw4.js → Ax2B7QQh.js} +1 -1
- package/web/app/immutable/chunks/{C35YmXbg.js → B-W7deES.js} +1 -1
- package/web/app/immutable/chunks/{Coutr3Mi.js → B0zwGZ_O.js} +1 -1
- package/web/app/immutable/chunks/{Bx9jW2hM.js → B3pPpWYK.js} +1 -1
- package/web/app/immutable/chunks/{CA8MYKPh.js → B4LvWoln.js} +1 -1
- package/web/app/immutable/chunks/{CETwR3pL.js → B4Pcyup-.js} +1 -1
- package/web/app/immutable/chunks/{BZEL244B.js → B4on2wzU.js} +1 -1
- package/web/app/immutable/chunks/{kLX0oQjt.js → B55Lo0FS.js} +1 -1
- package/web/app/immutable/chunks/{n-7qZfot.js → B5L_fzQJ.js} +1 -1
- package/web/app/immutable/chunks/{Cuea3cpS.js → B5yEHkSy.js} +1 -1
- package/web/app/immutable/chunks/{BoOU7UK-.js → B6z9N_8y.js} +1 -1
- package/web/app/immutable/chunks/{szZ8pRnr.js → B7FRjLIO.js} +2 -2
- package/web/app/immutable/chunks/{By3d2aKb.js → B7v8ICP4.js} +1 -1
- package/web/app/immutable/chunks/{CWJC1lxP.js → B8BkT7-k.js} +1 -1
- package/web/app/immutable/chunks/{CYALE4XC.js → B94otgnH.js} +1 -1
- package/web/app/immutable/chunks/{CO4Rte0G.js → BE1cGlQD.js} +1 -1
- package/web/app/immutable/chunks/{H95XSLd_.js → BEtv8tBy.js} +1 -1
- package/web/app/immutable/chunks/{CIG7_Ars.js → BGL-uifv.js} +1 -1
- package/web/app/immutable/chunks/{qim_Ct3_.js → BHhpe04T.js} +1 -1
- package/web/app/immutable/chunks/{DM4j5ANN.js → BHrccWS6.js} +1 -1
- package/web/app/immutable/chunks/{CQzabfN4.js → BIXB2sEM.js} +4 -4
- package/web/app/immutable/chunks/{6w617QdY.js → BIzGfV52.js} +1 -1
- package/web/app/immutable/chunks/{gF4jlhhn.js → BJkBPBON.js} +2 -2
- package/web/app/immutable/chunks/{BmDq-uhT.js → BJs6L98H.js} +1 -1
- package/web/app/immutable/chunks/{mFH5JSTn.js → BLKGmMKH.js} +1 -1
- package/web/app/immutable/chunks/{B-gBT6Wp.js → BLM5WEkv.js} +1 -1
- package/web/app/immutable/chunks/{DoSi2n5h.js → BLub_WLN.js} +3 -3
- package/web/app/immutable/chunks/{DkNt2yt8.js → BMT3BZWc.js} +1 -1
- package/web/app/immutable/chunks/{DFvB5yOL.js → BMfEzUyf.js} +1 -1
- package/web/app/immutable/chunks/{BylMfQ8a.js → BNlcBg5q.js} +1 -1
- package/web/app/immutable/chunks/{CzlyzR5w.js → BOABr5iA.js} +1 -1
- package/web/app/immutable/chunks/{DYdDF6N_.js → BOImXhxR.js} +1 -1
- package/web/app/immutable/chunks/{BjxfkKmH.js → BOijq64j.js} +1 -1
- package/web/app/immutable/chunks/{BycCRh1U.js → BQMaTSUT.js} +1 -1
- package/web/app/immutable/chunks/{DJbFr8xM.js → BUT4El0L.js} +1 -1
- package/web/app/immutable/chunks/{DGjX-g5M.js → BUTJbFoT.js} +1 -1
- package/web/app/immutable/chunks/{cplLJoH8.js → BWsFbeUj.js} +1 -1
- package/web/app/immutable/chunks/{BGHJsG8l.js → BWtNXuH3.js} +1 -1
- package/web/app/immutable/chunks/{5lMMsSad.js → BWxQ5UZF.js} +1 -1
- package/web/app/immutable/chunks/{DSK8O9Vd.js → BXwdEeCG.js} +1 -1
- package/web/app/immutable/chunks/{DlxIFfaX.js → BYqiRSP_.js} +1 -1
- package/web/app/immutable/chunks/{Bps-K7_G.js → BZSpcC6v.js} +1 -1
- package/web/app/immutable/chunks/{D6H0b5RP.js → B_fuDTJc.js} +1 -1
- package/web/app/immutable/chunks/{-x2KiTdv.js → Bb4KDW-H.js} +1 -1
- package/web/app/immutable/chunks/{4kjAauCt.js → BbRVqgQZ.js} +1 -1
- package/web/app/immutable/chunks/{c8-6qMPD.js → BcubO1aW.js} +1 -1
- package/web/app/immutable/chunks/{BdpnQog4.js → BeTiPXK7.js} +1 -1
- package/web/app/immutable/chunks/{6_rpMdx6.js → BeigtvFK.js} +1 -1
- package/web/app/immutable/chunks/{Dk2HcklO.js → BfQPFCP7.js} +2 -2
- package/web/app/immutable/chunks/{CReqoCJu.js → BfdTnj-p.js} +1 -1
- package/web/app/immutable/chunks/{CSEth5B8.js → BfmZaG-s.js} +3 -3
- package/web/app/immutable/chunks/{CzlfnNwB.js → BgsG3ZiB.js} +1 -1
- package/web/app/immutable/chunks/{DSF6kjeh.js → Bi-OoqI4.js} +3 -3
- package/web/app/immutable/chunks/{UWZjMttV.js → Bi08_5Fn.js} +1 -1
- package/web/app/immutable/chunks/{CCt5EXjV.js → BiByqANf.js} +1 -1
- package/web/app/immutable/chunks/{rPhSJlXw.js → BjC_rKsH.js} +1 -1
- package/web/app/immutable/chunks/{QulM8iJe.js → BkB7PRB0.js} +1 -1
- package/web/app/immutable/chunks/{aJuiKWzg.js → BlEa7UsU.js} +1 -1
- package/web/app/immutable/chunks/{xMwKWjB7.js → BlTs1zAy.js} +1 -1
- package/web/app/immutable/chunks/{DGLC3mk9.js → BmO6NekI.js} +1 -1
- package/web/app/immutable/chunks/{EP05ckdk.js → BnVNvux0.js} +1 -1
- package/web/app/immutable/chunks/{DiNPchhP.js → BoDtRDem.js} +1 -1
- package/web/app/immutable/chunks/{BgTFeyrq.js → BoaqP5ET.js} +1 -1
- package/web/app/immutable/chunks/{CncWt3O6.js → BpM87Usm.js} +1 -1
- package/web/app/immutable/chunks/{DQLfBH7I.js → Bq5w_10y.js} +1 -1
- package/web/app/immutable/chunks/{B0r15Yat.js → BqB2D1x5.js} +9 -9
- package/web/app/immutable/chunks/{2EufkTRJ.js → BqJSWZOr.js} +1 -1
- package/web/app/immutable/chunks/{CT1vJyZh.js → BrfF5NLx.js} +1 -1
- package/web/app/immutable/chunks/{DhbWoWDC.js → BrrhiHyd.js} +1 -1
- package/web/app/immutable/chunks/{Cbbfu3DD.js → BtLlD_LO.js} +1 -1
- package/web/app/immutable/chunks/{Fzjn8DZE.js → BtdtsPJb.js} +1 -1
- package/web/app/immutable/chunks/{DfX9QhMz.js → Btxass_5.js} +1 -1
- package/web/app/immutable/chunks/{t6t3mdUn.js → BuXfbkCo.js} +1 -1
- package/web/app/immutable/chunks/{_e4xep-2.js → ByAetY4P.js} +1 -1
- package/web/app/immutable/chunks/{CljKdpeo.js → BymgwXRn.js} +1 -1
- package/web/app/immutable/chunks/{DWiL9mAL.js → BzL9Egzq.js} +1 -1
- package/web/app/immutable/chunks/{7aQTBNpP.js → BzPBikEv.js} +1 -1
- package/web/app/immutable/chunks/{BGMke03b.js → C-MW647h.js} +1 -1
- package/web/app/immutable/chunks/{xfUYUYD5.js → C-hRvbpj.js} +3 -3
- package/web/app/immutable/chunks/{D_G-1JiF.js → C0_snm4j.js} +1 -1
- package/web/app/immutable/chunks/{CiSv5u8J.js → C2eOYH_G.js} +1 -1
- package/web/app/immutable/chunks/{BaeKUSxM.js → C33vrAzQ.js} +1 -1
- package/web/app/immutable/chunks/{-pTsRhwv.js → C3XalDjV.js} +1 -1
- package/web/app/immutable/chunks/{C20fDEam.js → C4ERaDtS.js} +1 -1
- package/web/app/immutable/chunks/{DDdcGQT_.js → C5DeEaYP.js} +1 -1
- package/web/app/immutable/chunks/{FJqzUSSZ.js → C600Ggsz.js} +1 -1
- package/web/app/immutable/chunks/{DkH5cZvV.js → C6a1-Err.js} +1 -1
- package/web/app/immutable/chunks/{DH7M58MP.js → C7CeFFBU.js} +1 -1
- package/web/app/immutable/chunks/{C-ip9N1T.js → C7PhRIIZ.js} +1 -1
- package/web/app/immutable/chunks/{R0qfr5ax.js → C7QIVjEh.js} +1 -1
- package/web/app/immutable/chunks/{DbEXn4_y.js → C8hkzPoK.js} +2 -2
- package/web/app/immutable/chunks/{CDCE6oTg.js → CAeNUoVv.js} +1 -1
- package/web/app/immutable/chunks/{Bb1Qji_z.js → CCK5TGK5.js} +1 -1
- package/web/app/immutable/chunks/{DMTCts09.js → CD-hT3fi.js} +1 -1
- package/web/app/immutable/chunks/{IHRvbath.js → CGCLUZ3o.js} +1 -1
- package/web/app/immutable/chunks/{B0Vj4qoa.js → CGDwhMyu.js} +3 -3
- package/web/app/immutable/chunks/{nhnuI90y.js → CGvpPKXI.js} +1 -1
- package/web/app/immutable/chunks/{D5haHDwG.js → CIFNI35-.js} +1 -1
- package/web/app/immutable/chunks/{D-q4DlJb.js → CLMgFYIH.js} +1 -1
- package/web/app/immutable/chunks/{C6qzokod.js → CN1fsMHu.js} +1 -1
- package/web/app/immutable/chunks/{C8IMuGeP.js → CPUsWCCN.js} +1 -1
- package/web/app/immutable/chunks/{BsRM8yjb.js → CPc9hi45.js} +1 -1
- package/web/app/immutable/chunks/{DOHVP8r1.js → CPthbtAR.js} +1 -1
- package/web/app/immutable/chunks/{DanM5oR1.js → CSiViQVW.js} +1 -1
- package/web/app/immutable/chunks/{DwyFrp4u.js → CSrI4A-Z.js} +1 -1
- package/web/app/immutable/chunks/{CYIfyDKk.js → CVKwip72.js} +1 -1
- package/web/app/immutable/chunks/{CQ_L8AeY.js → CW2YUdJi.js} +1 -1
- package/web/app/immutable/chunks/{C81hO4Na.js → CWplqerm.js} +1 -1
- package/web/app/immutable/chunks/{KT1ygtoE.js → CXwkFfQD.js} +1 -1
- package/web/app/immutable/chunks/{DNjgbEGg.js → CYk_a71f.js} +1 -1
- package/web/app/immutable/chunks/{ZawOZTIQ.js → CZoORueB.js} +1 -1
- package/web/app/immutable/chunks/{DnzGwHHz.js → C_-1lZIi.js} +1 -1
- package/web/app/immutable/chunks/{CZL5vFO8.js → CaAd_cyY.js} +1 -1
- package/web/app/immutable/chunks/{B7kAC2QO.js → CbMctCk2.js} +1 -1
- package/web/app/immutable/chunks/{DJFHa_93.js → CddxYcvS.js} +1 -1
- package/web/app/immutable/chunks/{DYUZxGEP.js → Cdgx1q8N.js} +1 -1
- package/web/app/immutable/chunks/{D14WwGOw.js → CeNk7AI9.js} +1 -1
- package/web/app/immutable/chunks/{DqFPqj_c.js → Cf5H5FW2.js} +1 -1
- package/web/app/immutable/chunks/{C7HVlmGs.js → Cf6Y8_8o.js} +1 -1
- package/web/app/immutable/chunks/{EF-B7qSv.js → Cft5DaOC.js} +1 -1
- package/web/app/immutable/chunks/{D41qh-5f.js → Ch-D6DCZ.js} +1 -1
- package/web/app/immutable/chunks/{2m_u3bgL.js → Chgxj7dA.js} +1 -1
- package/web/app/immutable/chunks/{DRhcvZ9X.js → CiEru0ce.js} +1 -1
- package/web/app/immutable/chunks/{CinOJOVh.js → Cij6f88k.js} +1 -1
- package/web/app/immutable/chunks/Ciub7-gv.js +1 -0
- package/web/app/immutable/chunks/{Ym_4xzmH.js → CivTzCBV.js} +1 -1
- package/web/app/immutable/chunks/CkJd-nyM.js +1 -0
- package/web/app/immutable/chunks/{DjwaFIuf.js → CkbzWFJM.js} +1 -1
- package/web/app/immutable/chunks/{DM9LmF5j.js → CmHh0Wvy.js} +1 -1
- package/web/app/immutable/chunks/{BiYllXNK.js → CnLJ_N14.js} +1 -1
- package/web/app/immutable/chunks/{DjNq-V1x.js → Cncxuk-H.js} +1 -1
- package/web/app/immutable/chunks/{DIcqfvJD.js → Co5Wv5vC.js} +1 -1
- package/web/app/immutable/chunks/{02YUL-k8.js → CoVtH1zm.js} +1 -1
- package/web/app/immutable/chunks/{CB4UdDb9.js → CruJ4jyB.js} +1 -1
- package/web/app/immutable/chunks/{Do5F-HPE.js → CsFzjSWo.js} +1 -1
- package/web/app/immutable/chunks/{DHuSm3be.js → CsI7oUrd.js} +1 -1
- package/web/app/immutable/chunks/{D4lamhem.js → CsaKmxO_.js} +2 -2
- package/web/app/immutable/chunks/{D4dQaEzK.js → CtVskF6o.js} +1 -1
- package/web/app/immutable/chunks/{CSp7X79w.js → CttZcTQ2.js} +1 -1
- package/web/app/immutable/chunks/{DunKT6dS.js → CuLrgEBU.js} +2 -2
- package/web/app/immutable/chunks/{OnVz_1Np.js → CvP7-iXZ.js} +1 -1
- package/web/app/immutable/chunks/{DKfvgKdK.js → D--r5mHa.js} +1 -1
- package/web/app/immutable/chunks/{CXEOyFq9.js → D-zxS9tA.js} +1 -1
- package/web/app/immutable/chunks/{Dv4BYa-Z.js → D1E_1zhz.js} +1 -1
- package/web/app/immutable/chunks/{BA-uukBX.js → D1F-b1I5.js} +1 -1
- package/web/app/immutable/chunks/{BCG-StgC.js → D1ZkKLqt.js} +1 -1
- package/web/app/immutable/chunks/{BJT5G4Vv.js → D208CAsp.js} +1 -1
- package/web/app/immutable/chunks/{CXS-R8zY.js → D5D__L6c.js} +1 -1
- package/web/app/immutable/chunks/{BaUOI4IK.js → D5XjMLtX.js} +1 -1
- package/web/app/immutable/chunks/{CHVFOL-2.js → D5eCb9SA.js} +1 -1
- package/web/app/immutable/chunks/{DfZDDoxc.js → D7metssC.js} +1 -1
- package/web/app/immutable/chunks/{0LGjiHaB.js → D8IZMM7C.js} +1 -1
- package/web/app/immutable/chunks/{0iM-y8KY.js → DBEo2Y3v.js} +1 -1
- package/web/app/immutable/chunks/{BvxuCpa1.js → DBI9dTMM.js} +1 -1
- package/web/app/immutable/chunks/{Bs8Uk6ug.js → DCEkJXus.js} +1 -1
- package/web/app/immutable/chunks/{DQPJa1PL.js → DCwrIUyt.js} +1 -1
- package/web/app/immutable/chunks/{DxVSJQW2.js → DGK1iojf.js} +1 -1
- package/web/app/immutable/chunks/{k2cU06qa.js → DH2xXdI1.js} +1 -1
- package/web/app/immutable/chunks/{CYmtPuTl.js → DH7vXXdq.js} +1 -1
- package/web/app/immutable/chunks/{CevGDj0_.js → DHyTxmrF.js} +1 -1
- package/web/app/immutable/chunks/{C-AAKukn.js → DJsRid9i.js} +1 -1
- package/web/app/immutable/chunks/{CVbN130s.js → DKBM0Gj4.js} +1 -1
- package/web/app/immutable/chunks/{XgcRf2OO.js → DKOHx2a9.js} +2 -2
- package/web/app/immutable/chunks/{DhCgtN_p.js → DLJOBEeO.js} +3 -3
- package/web/app/immutable/chunks/{8SiHtB72.js → DM5MJ3Sn.js} +1 -1
- package/web/app/immutable/chunks/{B7ubb8f-.js → DMnVAzAI.js} +1 -1
- package/web/app/immutable/chunks/{BWMQtsIY.js → DNvCdh98.js} +1 -1
- package/web/app/immutable/chunks/{CwsVBSUF.js → DP6Xlts5.js} +1 -1
- package/web/app/immutable/chunks/{5x3ldUtC.js → DQPV9Jid.js} +1 -1
- package/web/app/immutable/chunks/{BYe7PWsd.js → DQQg-_Fv.js} +1 -1
- package/web/app/immutable/chunks/{DQvYqUjR.js → DQbaQwzY.js} +1 -1
- package/web/app/immutable/chunks/{8-vxLh_H.js → DQjZPSYr.js} +1 -1
- package/web/app/immutable/chunks/{CMdAOXEb.js → DQvmr3ea.js} +1 -1
- package/web/app/immutable/chunks/{hGZqfbJu.js → DSjVYlVX.js} +1 -1
- package/web/app/immutable/chunks/{CksX9wbO.js → DT6jGD_v.js} +2 -2
- package/web/app/immutable/chunks/{DeXfipOI.js → DTXx_iLa.js} +1 -1
- package/web/app/immutable/chunks/{C-QKLo6O.js → DUGzdx5G.js} +1 -1
- package/web/app/immutable/chunks/{CBNJqQCc.js → DUaNnRvN.js} +1 -1
- package/web/app/immutable/chunks/{DcvRBAV3.js → DUmGlkcv.js} +1 -1
- package/web/app/immutable/chunks/{BoBZ73YE.js → DVK3tNru.js} +1 -1
- package/web/app/immutable/chunks/{D-_v7kDk.js → DWBuWaVE.js} +1 -1
- package/web/app/immutable/chunks/{8gAO4rBm.js → DXFg1wKa.js} +1 -1
- package/web/app/immutable/chunks/{DJE_dF7Z.js → DYME5vl6.js} +1 -1
- package/web/app/immutable/chunks/{B9YvG8aT.js → DZLkwu2T.js} +1 -1
- package/web/app/immutable/chunks/{Vg0EpBe7.js → DZc-gQMq.js} +1 -1
- package/web/app/immutable/chunks/{DppUFX6O.js → Da8jWysx.js} +1 -1
- package/web/app/immutable/chunks/{CCgl5yNk.js → DcPZVozd.js} +1 -1
- package/web/app/immutable/chunks/{BOv3_02t.js → Dd92kFdo.js} +1 -1
- package/web/app/immutable/chunks/{DjrbQ2JE.js → DeREMpl2.js} +1 -1
- package/web/app/immutable/chunks/{DZ1MmJsG.js → DeaknxEN.js} +1 -1
- package/web/app/immutable/chunks/{DC4EvC84.js → Dep4c5m-.js} +1 -1
- package/web/app/immutable/chunks/{Bd7wm9ou.js → Df8V6WlA.js} +1 -1
- package/web/app/immutable/chunks/{BaKHwctr.js → DgNmFGXj.js} +1 -1
- package/web/app/immutable/chunks/{DkE1KcNT.js → DgboVgd_.js} +1 -1
- package/web/app/immutable/chunks/{BIW6jxDi.js → Dgmf4O3-.js} +1 -1
- package/web/app/immutable/chunks/{DGaBtrvB.js → DhNEeuS_.js} +1 -1
- package/web/app/immutable/chunks/{1KkdIMQF.js → DhezPe3y.js} +1 -1
- package/web/app/immutable/chunks/{CFxELBeY.js → DiE8v_X5.js} +1 -1
- package/web/app/immutable/chunks/{hR-DaH6k.js → DkkzFfYK.js} +1 -1
- package/web/app/immutable/chunks/{DnT_wkoM.js → Dl3FDpKM.js} +1 -1
- package/web/app/immutable/chunks/{D7thg7Ha.js → Dlu7eNjM.js} +1 -1
- package/web/app/immutable/chunks/{BSTl1RvT.js → DmmbYbmC.js} +2 -2
- package/web/app/immutable/chunks/{CHxdiRFz.js → Do2AbdMZ.js} +1 -1
- package/web/app/immutable/chunks/{wQ32vU9q.js → DoA8ABAE.js} +1 -1
- package/web/app/immutable/chunks/{cYKcpEeG.js → DoEVipUF.js} +1 -1
- package/web/app/immutable/chunks/{DzveesLa.js → Dotp5YRU.js} +1 -1
- package/web/app/immutable/chunks/{BlBb1keW.js → DreYzK2d.js} +1 -1
- package/web/app/immutable/chunks/DsRXAU7N.js +1 -0
- package/web/app/immutable/chunks/{GnS8SMtq.js → Dt0cEsoV.js} +2 -2
- package/web/app/immutable/chunks/{Dcl67lxX.js → DtVS2Hpo.js} +1 -1
- package/web/app/immutable/chunks/{CG456d1E.js → DtYEnzBU.js} +1 -1
- package/web/app/immutable/chunks/{DXXCttvN.js → Dtfq8wlv.js} +1 -1
- package/web/app/immutable/chunks/{DWGCjk6V.js → Dw2_URl8.js} +1 -1
- package/web/app/immutable/chunks/{BfXbOT8i.js → DxXHN0Kd.js} +1 -1
- package/web/app/immutable/chunks/{BBQsIbOZ.js → Dxc-KEkE.js} +3 -3
- package/web/app/immutable/chunks/DxxarOOi.js +1 -0
- package/web/app/immutable/chunks/{D2YGMA8q.js → Dyo489Aj.js} +4 -4
- package/web/app/immutable/chunks/{BL2ujNK_.js → Dz150vD0.js} +1 -1
- package/web/app/immutable/chunks/{D6XIvyP3.js → DzAQQ1i-.js} +1 -1
- package/web/app/immutable/chunks/{D9rf8Jdd.js → EKAiX2GI.js} +1 -1
- package/web/app/immutable/chunks/{CT9j94JK.js → FC-pHBfg.js} +2 -2
- package/web/app/immutable/chunks/{BvIER3hk.js → GfYLoKaL.js} +1 -1
- package/web/app/immutable/chunks/{C_92InJL.js → HP6Cq9rf.js} +1 -1
- package/web/app/immutable/chunks/{Dw9M83Lw.js → HjJJbdN8.js} +1 -1
- package/web/app/immutable/chunks/{Dt5BioTS.js → Hxdz4eYy.js} +1 -1
- package/web/app/immutable/chunks/I7PibMUG.js +1 -0
- package/web/app/immutable/chunks/{frim2Lpk.js → IcK2O8wN.js} +1 -1
- package/web/app/immutable/chunks/{B3Xs1bS2.js → IfuzSDQC.js} +1 -1
- package/web/app/immutable/chunks/{ChI9mvUS.js → Jd-PTJBp.js} +3 -3
- package/web/app/immutable/chunks/{BNGx8qtU.js → LIjxNVmo.js} +1 -1
- package/web/app/immutable/chunks/{B-Km1hE1.js → MncpPyA-.js} +1 -1
- package/web/app/immutable/chunks/{DeAaK3tO.js → OjneFxUj.js} +1 -1
- package/web/app/immutable/chunks/{CDPoeQz1.js → Opn_u-ak.js} +1 -1
- package/web/app/immutable/chunks/{Ctelf0jH.js → Or6TlXVc.js} +1 -1
- package/web/app/immutable/chunks/{ckTlOLII.js → PoxwHYkO.js} +1 -1
- package/web/app/immutable/chunks/{BhIqqwku.js → PrLg-ksP.js} +1 -1
- package/web/app/immutable/chunks/{4PwdPd7u.js → Qk2Uvykz.js} +1 -1
- package/web/app/immutable/chunks/{B-k5wsvC.js → QpoIgRGw.js} +1 -1
- package/web/app/immutable/chunks/{BwQ4aQNw.js → SqcDn3FF.js} +1 -1
- package/web/app/immutable/chunks/{70EoeQTk.js → Tsg7Rikm.js} +1 -1
- package/web/app/immutable/chunks/{DzibEiL0.js → U7PCJ0KW.js} +1 -1
- package/web/app/immutable/chunks/{BIMyMsOv.js → UCKuBGVM.js} +1 -1
- package/web/app/immutable/chunks/{B41DOn_L.js → VfcZjJDU.js} +1 -1
- package/web/app/immutable/chunks/{gkFzY6r7.js → VlOW_lom.js} +1 -1
- package/web/app/immutable/chunks/{BfrXK-ZU.js → Wu03VY_-.js} +1 -1
- package/web/app/immutable/chunks/{QL_pZGWA.js → ZQWbYglS.js} +1 -1
- package/web/app/immutable/chunks/{CmlGvxmu.js → Z_Zl_SfR.js} +1 -1
- package/web/app/immutable/chunks/Zas8kAKr.js +1 -0
- package/web/app/immutable/chunks/{_LMIM985.js → ZdR-PTAn.js} +1 -1
- package/web/app/immutable/chunks/{CKmtKxD0.js → Zs30783q.js} +1 -1
- package/web/app/immutable/chunks/{Q8JNttIh.js → ZyBOjDmf.js} +1 -1
- package/web/app/immutable/chunks/{Bah_ExD8.js → _NdZi_dM.js} +1 -1
- package/web/app/immutable/chunks/{8s1d6VlB.js → _rr6nsRq.js} +1 -1
- package/web/app/immutable/chunks/{BHRpMLDk.js → b7K3kFDW.js} +1 -1
- package/web/app/immutable/chunks/{C1q0hSky.js → dLGWDtiP.js} +1 -1
- package/web/app/immutable/chunks/{CniNJafb.js → eO_Y6Zjh.js} +1 -1
- package/web/app/immutable/chunks/{DHeLwLtz.js → euI_ACTK.js} +1 -1
- package/web/app/immutable/chunks/{BLlTtC--.js → fvPmV5Gi.js} +2 -2
- package/web/app/immutable/chunks/{Bm7RRc9h.js → ggBdElOR.js} +1 -1
- package/web/app/immutable/chunks/{DTCoCNln.js → hjdg1APe.js} +2 -2
- package/web/app/immutable/chunks/{lHD19ydf.js → hsWXTUXg.js} +1 -1
- package/web/app/immutable/chunks/{BRE1DYz5.js → mln4aKyz.js} +1 -1
- package/web/app/immutable/chunks/{CmeuXd0X.js → mzRkGv5m.js} +1 -1
- package/web/app/immutable/chunks/{Bup3f7j4.js → o6BZHHo-.js} +1 -1
- package/web/app/immutable/chunks/{qRbd1ibI.js → oHriEIAi.js} +2 -2
- package/web/app/immutable/chunks/{B72JTqS_.js → ow3T0tN7.js} +1 -1
- package/web/app/immutable/chunks/{ChAOamky.js → qM_0Sky2.js} +1 -1
- package/web/app/immutable/chunks/{R00Ksy_g.js → sX1SzO2T.js} +1 -1
- package/web/app/immutable/chunks/{C7eBooB_.js → v1GNktmz.js} +3 -3
- package/web/app/immutable/chunks/{DWoh9eLQ.js → vE_bc7tB.js} +1 -1
- package/web/app/immutable/chunks/{h0nUJIdx.js → w8yC-37t.js} +1 -1
- package/web/app/immutable/chunks/{DiJpPQTH.js → wWw37-Ke.js} +1 -1
- package/web/app/immutable/chunks/{MGCpuCf0.js → wouXHNlM.js} +13 -13
- package/web/app/immutable/chunks/{Bjnv-7Ay.js → wrK6ZRyS.js} +1 -1
- package/web/app/immutable/chunks/{BY3bBVx0.js → xOVHBiMd.js} +1 -1
- package/web/app/immutable/chunks/{D5N-4pZG.js → xzC0xG4O.js} +1 -1
- package/web/app/immutable/chunks/{Clbflwy_.js → ygVTpe0W.js} +1 -1
- package/web/app/immutable/chunks/{DQyVwHJA.js → yglMjm12.js} +1 -1
- package/web/app/immutable/entry/{app.B8U18HSQ.js → app.C3_ct89H.js} +3 -3
- package/web/app/immutable/entry/start.BIOjq307.js +1 -0
- package/web/app/immutable/nodes/{0.DLYOUyU1.js → 0.B60cY-E8.js} +1 -1
- package/web/app/immutable/nodes/{1.v44QLmv3.js → 1.Fg7YybpB.js} +1 -1
- package/web/app/immutable/nodes/10.CGBrSCkB.js +39 -0
- package/web/app/immutable/nodes/{11.zviYRL3w.js → 11.CxV9uXd7.js} +1 -1
- package/web/app/immutable/nodes/{12.BjGJ5mRG.js → 12.Chwv84gV.js} +1 -1
- package/web/app/immutable/nodes/{13.D6Me5QTp.js → 13.BT6BhMtf.js} +1 -1
- package/web/app/immutable/nodes/{14.CfuetyXy.js → 14.CYMJv-a-.js} +3 -3
- package/web/app/immutable/nodes/{15.LEAnwNjt.js → 15.Bh_nopxE.js} +1 -1
- package/web/app/immutable/nodes/{16.DaihUhp2.js → 16.7rbyrDeT.js} +1 -1
- package/web/app/immutable/nodes/{17.Cfmxzlp8.js → 17.DrMiOxPX.js} +1 -1
- package/web/app/immutable/nodes/{18.DMndf1DM.js → 18.BfN58CyI.js} +1 -1
- package/web/app/immutable/nodes/{19.D5f5Zs_m.js → 19.0bOGZuAY.js} +2 -2
- package/web/app/immutable/nodes/{2.DSNu5875.js → 2.DREuwjqg.js} +4 -4
- package/web/app/immutable/nodes/{20.B5_24cng.js → 20.BiFgSIxy.js} +1 -1
- package/web/app/immutable/nodes/{3.D7crSQQY.js → 3.DSIPMWPB.js} +1 -1
- package/web/app/immutable/nodes/{4.BQ4kX-MO.js → 4.CZVyJ7C4.js} +1 -1
- package/web/app/immutable/nodes/{5.CNI4QIY6.js → 5.DND6GJwF.js} +1 -1
- package/web/app/immutable/nodes/{6.aqqkkpU3.js → 6.Bk5k_Omu.js} +1 -1
- package/web/app/immutable/nodes/{7.31uDDPNB.js → 7.DCF-Fawn.js} +1 -1
- package/web/app/immutable/nodes/{8.WLZs12tR.js → 8.aBszzfhj.js} +1 -1
- package/web/app/immutable/nodes/9.Bs6CVTCT.js +12 -0
- package/web/app/version.json +1 -1
- package/web/generated/paraglide.js +49 -49
- package/web/index.html +18 -18
- package/web/app/immutable/chunks/7HKQ-XDk.js +0 -1
- package/web/app/immutable/chunks/BLAU86XX.js +0 -1
- package/web/app/immutable/chunks/BpsIzxWJ.js +0 -1
- package/web/app/immutable/chunks/C8Ie7Deo.js +0 -1
- package/web/app/immutable/chunks/CmpHo399.js +0 -1
- package/web/app/immutable/chunks/DNGlU1yL.js +0 -1
- package/web/app/immutable/entry/start.C8nrElOF.js +0 -1
- package/web/app/immutable/nodes/10.CBX5mYGD.js +0 -39
- package/web/app/immutable/nodes/9.XMp3gBDl.js +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
var De=Object.defineProperty;var Ce=(i,s,e)=>s in i?De(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var E=(i,s,e)=>Ce(i,typeof s!="symbol"?s+"":s,e);import{K as Le,P as ce,a6 as le,as as z,aC as ve}from"./mvlVGSeb.js";import{b_ as we,c_ as ue,cq as de,cp as be}from"./8gAO4rBm.js";import{Jq as p,C1 as Fe,bI as ke,i as Ge,Lv as me,ip as Ee,bU as Pe,DZ as H,Cq as xe,fk as Ve,Aw as Ue,e2 as fe,fg as _e,e1 as he,A$ as Be,L9 as $e,wt as Xe}from"./CKmtKxD0.js";import{aN as Se,dT as ge,A as K,P as Re,aJ as Q}from"./CReqoCJu.js";import{h as qe}from"./Dk2HcklO.js";import{c as W}from"./ChTqQfQN.js";import{a as We}from"./BdWqymET.js";import{m as j}from"./hR-DaH6k.js";import"./3SdAC2_C.js";import{bm as n}from"./C8Ie7Deo.js";import"./D41qh-5f.js";import"./FJqzUSSZ.js";import"./cplLJoH8.js";import{R as pe}from"./B5aYN90J.js";import{L as Ye}from"./CSiaiLHL.js";function ze(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Te="confirmUnslothModelSwitch";function He(i){if(!i||typeof i!="object")return!1;const{agentId:s,agentName:e,workspaceId:t,workspaceTitle:r}=i;return typeof s=="string"&&typeof e=="string"&&typeof t=="string"&&(r===null||typeof r=="string")}function Ke(i){for(let s=i,e=0;s&&e<4;e++){const t=s.data;if(t&&typeof t=="object"){const{code:r,currentModel:a,requestedModel:l,agents:o}=t;if(r==="unsloth-model-switch-confirmation-required"&&typeof a=="string"&&typeof l=="string"&&Array.isArray(o)&&o.every(He))return{currentModel:a,requestedModel:l,agents:o}}s=s.cause}}function bt(i){if(!i||!(Te in i))return i;const{[Te]:s,...e}=i;return Object.keys(e).length>0?e:void 0}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new We("PerformanceOptimizer"),w=class w{constructor(){E(this,"metricsBuffer");E(this,"metricsIndex",0);E(this,"metricsCount",0);E(this,"MAX_METRICS",500);E(this,"TARGET_RESPONSE_TIME",100);E(this,"memoCache",new Map);E(this,"MEMO_TTL",6e4);E(this,"MAX_CACHE_SIZE",100);E(this,"cacheHits",0);E(this,"cacheMisses",0);E(this,"pendingRequests",new Map);E(this,"requestQueue",[]);E(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let o=0;o<s.length;o+=r){const _=s.slice(o,o+r).map((c,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(c);d(k)},g)})}),u=await Promise.all(_);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const _=this.getMemoized(a);if(_!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),_;this.cacheMisses++}if(t.coalesce){const _=this.pendingRequests.get(s);if(_)return V.debug("Request coalesced",{operation:s}),_}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const o=await l;t.memoize&&this.memoize(a,o);const f=Z.now()-r;return this.recordMetric(s,f,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),f>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(f),target:this.TARGET_RESPONSE_TIME}),o}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const c=this.metricsBuffer[(e+u)%this.MAX_METRICS];c&&s.push(c)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,c)=>u.duration-c.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const o=a/s.length,f=Math.floor(t.length*.95),_=Math.floor(t.length*.99);return{avgResponseTime:Math.round(o),p95ResponseTime:Math.round(t[f]?.duration||0),p99ResponseTime:Math.round(t[_]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};E(w,"instance");let te=w;const Qe=te.getInstance(),Ae={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},J={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},je={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function Ze(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Je(i,s){return Ze(i).every(t=>t in s)}function Oe(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function ee(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function et(i,s){return s&&J[i]&&Je(J[i],s)?Oe(J[i],s):je[i]||n.errors_userFriendly_fallback_error()}function tt(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?Ae[e]:Ae.GENERAL}const st={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function it(i){return st[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var N=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(N||{});class q extends Error{constructor(e,t,r={},a){super(e);E(this,"code");E(this,"context");E(this,"recoverySuggestions");E(this,"userMessage");E(this,"isRecoverable");E(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return et(e,this.context)}getDefaultRecoverySuggestions(e){return it(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return tt(this.code)}formatMessage(e){return Oe(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const rt={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function re(i){const s=i.toLowerCase();for(const e of rt.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const at="Agent already has an in-flight prompt. Message was not delivered.",v=W("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=pe.DEFAULT_ATTEMPTS,retryDelay:a=pe.BASE_DELAY,exponentialBackoff:l=!0,notify:o=!1,notifyOnRetry:f=!1,context:_={},onError:u,onRetry:c,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const C=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),C}catch(C){if(g=C,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:_}),u?.(g,d),d<=r&&R(g)){const h=l?a*Math.pow(2,d-1):a;f&&j.warning(n.agent_errorBoundary_retrying_message({seconds:h/1e3})),c?.(d),v.info(`[${e}] Retrying in ${h}ms`),await this.sleep(h)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=ee(g?.message||n.agent_errorBoundary_generic_error()),D=g?.message?.toLowerCase()||"",$=D.includes("no available models")||D.includes("all models exhausted")||D.includes("all models unavailable");throw o&&!$&&j.error(P),new q(P,N.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:_})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&j.error(ee(a.message)),new q(ee(a.message),N.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return re(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof q?[N.NETWORK_ERROR,N.STREAM_TIMEOUT,N.STREAM_CONNECTION_FAILED,N.PROVIDER_CONNECTION_FAILED,N.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new q(`${t} timed out after ${e}ms`,N.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,o=[],f=[];for(let _=0;_<s.length;_+=r){const u=s.slice(_,_+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")o.push(R.value);else{const d=R.reason;if(f.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return f.length>0&&v.warn(`[${l}] Completed with ${f.length} errors`),{results:o,errors:f}}};E(b,"instance");let se=b;const nt=se.getInstance(),ie=W("browser/index"),F=new Map,B=new Map;let U;function ot(i,s,e){for(const t of s)try{t(e)}catch(r){ie.error("Error in agent subscriber callback",{agentId:i,error:r})}}function ct(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Se.select(e,t);B.get(t)!==a&&(B.set(t,a),ot(t,r,a))}})}function lt(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ft(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),ct();const a=p.state,l=Se.select(a,i);return r&&B.set(i,l),l?ie.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):ie.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const o=F.get(i);o&&(o.delete(s),o.size===0&&(F.delete(i),B.delete(i))),lt()}}const y=W("ErrorRecovery"),ye={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||re(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class ut{constructor(){E(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class dt extends ut{constructor(){super(...arguments);E(this,"activeRecoveries",new Map);E(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=ye.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let o,f=t.initialBackoffMs,_=0;for(let u=1;u<=t.maxRetries;u++){if(_=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const c=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:c,attempts:u,totalTime:Date.now()-a}}catch(c){o=c,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:o.message});const R=o.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:o.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:o.message});break}if(re(o.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:o.message});break}if(!t.shouldRetry(o,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:o.message});break}if(u<t.maxRetries){const g=Math.random()*.2*f,d=Math.min(f+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:o.message}),await this.delay(d,l.signal),f=Math.min(f*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(o,_),this.emit("recovery:failure",{operationId:r,attempts:_,duration:Date.now()-a,error:o?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:o,attempts:_,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const o=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",o);const f=r;r=()=>{t.removeEventListener("abort",o),f()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const mt=new dt,O=new Ye({category:"WorkspaceMetrics"}),Et=100;class ft{constructor(){E(this,"metrics",new Map);E(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>Et;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const _t=new ft,M=W("AgentSend");function A(i){p.dispatch(i)}function Ie(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ht(i){const s=Ie(i)&&i.success===!0&&"data"in i?i.data:i;return!Ie(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(at)}async function kt(i,s,e,t={}){const r=ge.select(p.state,e.id);if(!r)return;const a=Le(i,e.id),l=t.submission,o=!!l&&we.select(p.state,l.scope)?.supported===!0,f=(c,R,g=!1)=>{l&&A(Xe(l.scope,l.id,c,Date.now(),R,g))};let _=!1;const u=()=>(!l||_||be.select(p.state,l))&&r===ge.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return Qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let c=await p.dispatch(Fe(e.id,i));if(u()){if(!c)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));c={...c,isStreaming:c.isStreaming??!1};{if(c&&(c.status==="pending"||!c.id)&&!c.backendSessionId&&c.activationState!==K.ACTIVE&&c.activationState!==K.ACTIVATING){const h=e.id.startsWith("optimistic-"),Y=e.worktreePath||e.repositoryPath||e.path;if(!h&&Y){M.info("Activating pending session in sendMessage",{agentId:i,status:c.status,activationState:c.activationState,hasBackendSessionId:!!c.backendSessionId});const x=await p.dispatch(ke(e.id,i));if(!u())return;x&&(c=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else c&&c.status==="pending"&&c.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:c.backendSessionId,activationState:c.activationState}),c={...c,status:Ge.Active,activationState:K.ACTIVE},A(me({...c,workspaceId:e.id})));if(!c)throw new Error(`Failed to get or create session for agent ${i}`);A(me({...c,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??ce(),k=t.messageMetadata?.[Re],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[Re]:k}:{}},D={id:Ee(ue()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};o||(l&&(f("rejected"),_=!0),A(Pe(c.id,D))),A(H(c.id,!0));let $=!1,C;try{o||await p.dispatch(xe(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=Ee(`msg_${ue()}`),Y=ce(),x=async()=>nt.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:c.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(m=>({type:m.type,mimeType:m.mimeType,dataLength:m.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(m=>({type:m.type,fileName:m.fileName,mimeType:m.mimeType,attachmentId:m.attachmentId,size:m.size}))||[]});const Me=t.model??t.modelId??c.model??void 0;A(Ve(i));const Ne=le(i,e.id),ne=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await qe("agent.sendMessage",{agentId:i,...o&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Me,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:Y,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(m=>{if(u())throw Ke(m)&&(C=m),m});if(u()){if(ht(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:c.id}),f("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const m=T.error,I=typeof m=="string"?m:m?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:c.id,queuedMessageId:T.queuedMessage?.id}),(!o||!l||!de.select(p.state,l))&&A(H(c.id,!1)),o||A(Ue(c.id,D.id)),o){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=fe(s,t),X=Q.select(p.state,i,e.id).find(oe=>oe.id===I.id||oe.turnId===L);A(_e(i,I.id,S,L,he(X??I,S),!X&&!!l&&de.select(p.state,l),ne))}f("accepted",I,!0),z(i,e.id);return}const m=T.queuedMessage;if(m){const I=T.turnId,G=typeof I=="string"?I:m.turnId;let L=m;if(u()&&le(i,e.id)===Ne){const S=Q.select(p.state,i,e.id),X=ze(S,m);A(Be(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:m.id}),await z(i,e.id).catch(()=>{}),L=Q.select(p.state,i,e.id).find(S=>S.id===m.id||S.turnId===G));if(u()&&typeof G=="string"){const S=fe(s,t);A(_e(i,m.id,S,G,he(L??m,S),!L,ne))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:m.id})}return}}o&&(f("accepted"),z(i,e.id),ve(i,e.id)),_t.incrementMessageSent(e.id)}},"send message",{retries:o?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),ae=o?await x().then(()=>({success:!0,error:void 0})):await mt.executeWithRecovery(x,ye.streaming,`send-message-${i}`);if(!ae.success)throw ae.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(H(c.id,!1)),!o&&t.messageMetadata&&A($e(c.id,D.id,{metadata:P})),o&&f($||C?"rejected":"uncertain"),C??h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Te as U,Ft as a,ee as c,ze as r,kt as s,Ke as u,bt as w};
|
|
1
|
+
var De=Object.defineProperty;var Ce=(i,s,e)=>s in i?De(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var E=(i,s,e)=>Ce(i,typeof s!="symbol"?s+"":s,e);import{K as Le,P as ce,a6 as le,as as z,aC as ve}from"./5kmlNoKC.js";import{b_ as we,c_ as ue,cq as de,cp as be}from"./DXFg1wKa.js";import{Jq as p,C1 as Fe,bI as ke,i as Ge,Lv as me,ip as Ee,bU as Pe,DZ as H,Cq as xe,fk as Ve,Aw as Ue,e2 as fe,fg as _e,e1 as he,A$ as Be,L9 as $e,wt as Xe}from"./Zs30783q.js";import{aN as Se,dT as ge,A as K,P as Re,aJ as Q}from"./BfdTnj-p.js";import{h as qe}from"./BfQPFCP7.js";import{c as W}from"./ChTqQfQN.js";import{a as We}from"./BdWqymET.js";import{m as j}from"./DkkzFfYK.js";import"./3SdAC2_C.js";import{bm as n}from"./DxxarOOi.js";import"./Ch-D6DCZ.js";import"./C600Ggsz.js";import"./BWsFbeUj.js";import{R as pe}from"./B5aYN90J.js";import{L as Ye}from"./CSiaiLHL.js";function ze(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Te="confirmUnslothModelSwitch";function He(i){if(!i||typeof i!="object")return!1;const{agentId:s,agentName:e,workspaceId:t,workspaceTitle:r}=i;return typeof s=="string"&&typeof e=="string"&&typeof t=="string"&&(r===null||typeof r=="string")}function Ke(i){for(let s=i,e=0;s&&e<4;e++){const t=s.data;if(t&&typeof t=="object"){const{code:r,currentModel:a,requestedModel:l,agents:o}=t;if(r==="unsloth-model-switch-confirmation-required"&&typeof a=="string"&&typeof l=="string"&&Array.isArray(o)&&o.every(He))return{currentModel:a,requestedModel:l,agents:o}}s=s.cause}}function bt(i){if(!i||!(Te in i))return i;const{[Te]:s,...e}=i;return Object.keys(e).length>0?e:void 0}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new We("PerformanceOptimizer"),w=class w{constructor(){E(this,"metricsBuffer");E(this,"metricsIndex",0);E(this,"metricsCount",0);E(this,"MAX_METRICS",500);E(this,"TARGET_RESPONSE_TIME",100);E(this,"memoCache",new Map);E(this,"MEMO_TTL",6e4);E(this,"MAX_CACHE_SIZE",100);E(this,"cacheHits",0);E(this,"cacheMisses",0);E(this,"pendingRequests",new Map);E(this,"requestQueue",[]);E(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let o=0;o<s.length;o+=r){const _=s.slice(o,o+r).map((c,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(c);d(k)},g)})}),u=await Promise.all(_);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const _=this.getMemoized(a);if(_!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),_;this.cacheMisses++}if(t.coalesce){const _=this.pendingRequests.get(s);if(_)return V.debug("Request coalesced",{operation:s}),_}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const o=await l;t.memoize&&this.memoize(a,o);const f=Z.now()-r;return this.recordMetric(s,f,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),f>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(f),target:this.TARGET_RESPONSE_TIME}),o}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const c=this.metricsBuffer[(e+u)%this.MAX_METRICS];c&&s.push(c)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,c)=>u.duration-c.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const o=a/s.length,f=Math.floor(t.length*.95),_=Math.floor(t.length*.99);return{avgResponseTime:Math.round(o),p95ResponseTime:Math.round(t[f]?.duration||0),p99ResponseTime:Math.round(t[_]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};E(w,"instance");let te=w;const Qe=te.getInstance(),Ae={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},J={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},je={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function Ze(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Je(i,s){return Ze(i).every(t=>t in s)}function Oe(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function ee(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function et(i,s){return s&&J[i]&&Je(J[i],s)?Oe(J[i],s):je[i]||n.errors_userFriendly_fallback_error()}function tt(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?Ae[e]:Ae.GENERAL}const st={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function it(i){return st[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var N=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(N||{});class q extends Error{constructor(e,t,r={},a){super(e);E(this,"code");E(this,"context");E(this,"recoverySuggestions");E(this,"userMessage");E(this,"isRecoverable");E(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return et(e,this.context)}getDefaultRecoverySuggestions(e){return it(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return tt(this.code)}formatMessage(e){return Oe(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const rt={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function re(i){const s=i.toLowerCase();for(const e of rt.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const at="Agent already has an in-flight prompt. Message was not delivered.",v=W("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=pe.DEFAULT_ATTEMPTS,retryDelay:a=pe.BASE_DELAY,exponentialBackoff:l=!0,notify:o=!1,notifyOnRetry:f=!1,context:_={},onError:u,onRetry:c,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const C=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),C}catch(C){if(g=C,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:_}),u?.(g,d),d<=r&&R(g)){const h=l?a*Math.pow(2,d-1):a;f&&j.warning(n.agent_errorBoundary_retrying_message({seconds:h/1e3})),c?.(d),v.info(`[${e}] Retrying in ${h}ms`),await this.sleep(h)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=ee(g?.message||n.agent_errorBoundary_generic_error()),D=g?.message?.toLowerCase()||"",$=D.includes("no available models")||D.includes("all models exhausted")||D.includes("all models unavailable");throw o&&!$&&j.error(P),new q(P,N.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:_})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&j.error(ee(a.message)),new q(ee(a.message),N.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return re(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof q?[N.NETWORK_ERROR,N.STREAM_TIMEOUT,N.STREAM_CONNECTION_FAILED,N.PROVIDER_CONNECTION_FAILED,N.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new q(`${t} timed out after ${e}ms`,N.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,o=[],f=[];for(let _=0;_<s.length;_+=r){const u=s.slice(_,_+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")o.push(R.value);else{const d=R.reason;if(f.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return f.length>0&&v.warn(`[${l}] Completed with ${f.length} errors`),{results:o,errors:f}}};E(b,"instance");let se=b;const nt=se.getInstance(),ie=W("browser/index"),F=new Map,B=new Map;let U;function ot(i,s,e){for(const t of s)try{t(e)}catch(r){ie.error("Error in agent subscriber callback",{agentId:i,error:r})}}function ct(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Se.select(e,t);B.get(t)!==a&&(B.set(t,a),ot(t,r,a))}})}function lt(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ft(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),ct();const a=p.state,l=Se.select(a,i);return r&&B.set(i,l),l?ie.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):ie.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const o=F.get(i);o&&(o.delete(s),o.size===0&&(F.delete(i),B.delete(i))),lt()}}const y=W("ErrorRecovery"),ye={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||re(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class ut{constructor(){E(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class dt extends ut{constructor(){super(...arguments);E(this,"activeRecoveries",new Map);E(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=ye.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let o,f=t.initialBackoffMs,_=0;for(let u=1;u<=t.maxRetries;u++){if(_=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const c=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:c,attempts:u,totalTime:Date.now()-a}}catch(c){o=c,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:o.message});const R=o.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:o.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:o.message});break}if(re(o.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:o.message});break}if(!t.shouldRetry(o,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:o.message});break}if(u<t.maxRetries){const g=Math.random()*.2*f,d=Math.min(f+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:o.message}),await this.delay(d,l.signal),f=Math.min(f*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(o,_),this.emit("recovery:failure",{operationId:r,attempts:_,duration:Date.now()-a,error:o?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:o,attempts:_,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const o=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",o);const f=r;r=()=>{t.removeEventListener("abort",o),f()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const mt=new dt,O=new Ye({category:"WorkspaceMetrics"}),Et=100;class ft{constructor(){E(this,"metrics",new Map);E(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>Et;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const _t=new ft,M=W("AgentSend");function A(i){p.dispatch(i)}function Ie(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ht(i){const s=Ie(i)&&i.success===!0&&"data"in i?i.data:i;return!Ie(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(at)}async function kt(i,s,e,t={}){const r=ge.select(p.state,e.id);if(!r)return;const a=Le(i,e.id),l=t.submission,o=!!l&&we.select(p.state,l.scope)?.supported===!0,f=(c,R,g=!1)=>{l&&A(Xe(l.scope,l.id,c,Date.now(),R,g))};let _=!1;const u=()=>(!l||_||be.select(p.state,l))&&r===ge.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return Qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let c=await p.dispatch(Fe(e.id,i));if(u()){if(!c)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));c={...c,isStreaming:c.isStreaming??!1};{if(c&&(c.status==="pending"||!c.id)&&!c.backendSessionId&&c.activationState!==K.ACTIVE&&c.activationState!==K.ACTIVATING){const h=e.id.startsWith("optimistic-"),Y=e.worktreePath||e.repositoryPath||e.path;if(!h&&Y){M.info("Activating pending session in sendMessage",{agentId:i,status:c.status,activationState:c.activationState,hasBackendSessionId:!!c.backendSessionId});const x=await p.dispatch(ke(e.id,i));if(!u())return;x&&(c=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else c&&c.status==="pending"&&c.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:c.backendSessionId,activationState:c.activationState}),c={...c,status:Ge.Active,activationState:K.ACTIVE},A(me({...c,workspaceId:e.id})));if(!c)throw new Error(`Failed to get or create session for agent ${i}`);A(me({...c,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??ce(),k=t.messageMetadata?.[Re],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[Re]:k}:{}},D={id:Ee(ue()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};o||(l&&(f("rejected"),_=!0),A(Pe(c.id,D))),A(H(c.id,!0));let $=!1,C;try{o||await p.dispatch(xe(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=Ee(`msg_${ue()}`),Y=ce(),x=async()=>nt.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:c.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(m=>({type:m.type,mimeType:m.mimeType,dataLength:m.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(m=>({type:m.type,fileName:m.fileName,mimeType:m.mimeType,attachmentId:m.attachmentId,size:m.size}))||[]});const Me=t.model??t.modelId??c.model??void 0;A(Ve(i));const Ne=le(i,e.id),ne=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await qe("agent.sendMessage",{agentId:i,...o&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Me,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:Y,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(m=>{if(u())throw Ke(m)&&(C=m),m});if(u()){if(ht(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:c.id}),f("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const m=T.error,I=typeof m=="string"?m:m?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:c.id,queuedMessageId:T.queuedMessage?.id}),(!o||!l||!de.select(p.state,l))&&A(H(c.id,!1)),o||A(Ue(c.id,D.id)),o){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=fe(s,t),X=Q.select(p.state,i,e.id).find(oe=>oe.id===I.id||oe.turnId===L);A(_e(i,I.id,S,L,he(X??I,S),!X&&!!l&&de.select(p.state,l),ne))}f("accepted",I,!0),z(i,e.id);return}const m=T.queuedMessage;if(m){const I=T.turnId,G=typeof I=="string"?I:m.turnId;let L=m;if(u()&&le(i,e.id)===Ne){const S=Q.select(p.state,i,e.id),X=ze(S,m);A(Be(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:m.id}),await z(i,e.id).catch(()=>{}),L=Q.select(p.state,i,e.id).find(S=>S.id===m.id||S.turnId===G));if(u()&&typeof G=="string"){const S=fe(s,t);A(_e(i,m.id,S,G,he(L??m,S),!L,ne))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:m.id})}return}}o&&(f("accepted"),z(i,e.id),ve(i,e.id)),_t.incrementMessageSent(e.id)}},"send message",{retries:o?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),ae=o?await x().then(()=>({success:!0,error:void 0})):await mt.executeWithRecovery(x,ye.streaming,`send-message-${i}`);if(!ae.success)throw ae.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(H(c.id,!1)),!o&&t.messageMetadata&&A($e(c.id,D.id,{metadata:P})),o&&f($||C?"rejected":"uncertain"),C??h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Te as U,Ft as a,ee as c,ze as r,kt as s,Ke as u,bt as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as C,bo as s,bw as A,b as G}from"./
|
|
1
|
+
import{t as C,bo as s,bw as A,b as G}from"./DxxarOOi.js";import{bs as H,cb as B,aD as u,bH as p,a7 as y,ay as h,W as v,bn as D,bV as I,c9 as N,aA as r,bf as R,b_ as S,aw as V,bz as W,aB as j}from"./3SdAC2_C.js";import{i as q}from"./DzAQQ1i-.js";import{s as E}from"./C600Ggsz.js";import{s as n,f as F,c as J}from"./Ch-D6DCZ.js";var K=j('<img loading="lazy"/>');function L(b,t){if(new.target)return C({component:L,...b});H(t,!0);let l=s(t,"identity",7),f=s(t,"avatarUrl",7),i=s(t,"size",7,16),c=s(t,"class",7,""),o=s(t,"alt",7),d=s(t,"fallback",7),m=I(!1);const g=N(()=>f()||`https://github.com/${encodeURIComponent(l())}.png?size=${i()*2}`);B(()=>{l(),u(g),p(m,!1)});var z={get identity(){return l()},set identity(a){l(a),r()},get avatarUrl(){return f()},set avatarUrl(a){f(a),r()},get size(){return i()},set size(a=16){i(a),r()},get class(){return c()},set class(a=""){c(a),r()},get alt(){return o()},set alt(a){o(a),r()},get fallback(){return d()},set fallback(a){d(a),r()},$set:A,$on:(a,e)=>G(t,a,e)},_=y(),k=h(_);{var U=a=>{var e=y(),x=h(e);E(x,()=>d()??R),v(a,e)},w=a=>{var e=K();S(()=>{n(e,"src",u(g)),n(e,"width",i()),n(e,"height",i()),n(e,"alt",o()??""),n(e,"aria-hidden",o()===void 0?"true":void 0),F(e,1,J(c()))}),V("error",e,()=>{p(m,!0)}),W(e),v(a,e)};q(k,a=>{u(m)?a(U):a(w,-1)})}return v(b,_),D(z)}export{L as G};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as st}from"./CReqoCJu.js";import{nV as ct,bq as ut}from"./CKmtKxD0.js";import{g as dt}from"./CMiilI_P.js";import{t as ze,bo as g,bw as Ae,b as Ue,bm as u,br as mt}from"./C8Ie7Deo.js";import{ai as We,bs as Ee,ca as xe,aD as e,a7 as we,ay as te,W as y,bn as Te,bV as se,aA as v,a5 as pe,bS as E,bH as P,bA as ge,b_ as Y,aj as Ce,aw as Ne,bl as ye,bO as ne,aB as V,c9 as $,be as Me,b$ as Ie}from"./3SdAC2_C.js";import{i as q}from"./D6XIvyP3.js";import{k as ft}from"./_e4xep-2.js";import{s as ke,e as qe,f as pt,g as gt}from"./D41qh-5f.js";import{b as Se}from"./Dn334wJv.js";import{c as me}from"./CB4UdDb9.js";import{q as He,l as Ge,d as Je,e as $e,K as Qe,h as et,M as tt}from"./OnVz_1Np.js";import{a as vt}from"./CC7to1B5.js";import{m as _e}from"./hR-DaH6k.js";import{f as Le}from"./CHVFOL-2.js";import"./Dk2HcklO.js";import{l as Ke,f as nt,m as _t,a as ht}from"./2EufkTRJ.js";import"./ChTqQfQN.js";import"./cplLJoH8.js";import"./CT1vJyZh.js";import{bL as Re}from"./BsRM8yjb.js";import{s as je}from"./FJqzUSSZ.js";import{F as Pe,d3 as bt,bW as wt,bX as yt,cq as xt,bF as kt,cr as Ct,aZ as Pt,a8 as Lt}from"./Cuea3cpS.js";import{S as Mt}from"./DWiL9mAL.js";import{n as It,g as $t}from"./hGZqfbJu.js";import{e as De}from"./DJbFr8xM.js";import{i as zt,f as At}from"./gkFzY6r7.js";import{P as Ut}from"./DJE_dF7Z.js";import{h as Et}from"./DTCoCNln.js";import{t as Tt}from"./DAsc1V4f.js";function Nt(i,t){return i?.isExternalLink===!0&&typeof i.workspaceId=="string"&&i.workspaceId?i.workspaceId:t||void 0}function St(i,t,o){const c=i.label||i.id||"mention";if(i.type==="member")return st(c);if(i.type==="note"&&i.id&&o){const s=Nt(i.meta,t),_=s?o(s,i.id)?.trim():void 0;if(_)return _}return c}function Bn(i,t,o){if(typeof document>"u"||!i.includes('data-type="note"'))return i;const c=document.createElement("template");c.innerHTML=i;let s=!1;for(const _ of c.content.querySelectorAll('[data-mention][data-type="note"]')){let h=null;try{h=JSON.parse(_.getAttribute("data-meta")||"{}")}catch{h=null}const I=_.textContent??"",C=St({type:"note",id:_.getAttribute("data-id"),label:I,meta:h},t,o);C!==I&&(_.textContent=C,s=!0)}return s?c.innerHTML:i}const jn=(i,t)=>{let o;try{o=dt().state}catch{return}const c=o?.workspaceNotes?.byWorkspaceId?.[i]?.notes;return c?ct(c,t)?.title:void 0};var Kt=V('<p class="mt-2 max-w-[90vw] rounded-md bg-black/60 px-3 py-1.5 text-center text-sm text-white"> </p>'),Rt=V('<div data-media-lightbox-root="" data-image-lightbox-root="" class="fixed inset-0 z-[1000] flex cursor-zoom-out flex-col items-center justify-center bg-black/80 p-4 backdrop-blur-sm" style="pointer-events: auto;" role="dialog" aria-modal="true" tabindex="-1"><div class="absolute right-4 top-4 z-[1002] flex items-center gap-1"><!> <!></div> <div class="flex min-h-0 w-full flex-1 items-center justify-center"><!></div> <!></div>');function Xe(i,t){if(new.target)return ze({component:Xe,...i});Ee(t,!0);let o=g(t,"open",15,!1),c=g(t,"ariaLabel",7),s=g(t,"closeLabel",7),_=g(t,"onClose",7),h=g(t,"openerElement",7,null),I=g(t,"children",7),C=g(t,"actions",7),T=g(t,"caption",7),w=g(t,"onKeydown",7),L=g(t,"onCopy",7);const S=zt(),d=At(b);let M=se(null),N=se(null);function b(){o()&&(o(!1),_()?.(),h()?.isConnected&&h().focus({preventScroll:!0}))}function O(n){(n.target instanceof Element?n.target:null)?.closest('[data-media-lightbox-content], [role="toolbar"], button, input')||b()}function K(n){if(w()?.(n),n.defaultPrevented||n.key!=="Tab"||!e(M))return;const r=Array.from(e(M).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),m=r[0],l=r[r.length-1];!m||!l||(n.shiftKey&&document.activeElement===m?(n.preventDefault(),l.focus()):!n.shiftKey&&document.activeElement===l&&(n.preventDefault(),m.focus()))}xe(()=>{if(o())return He(b)}),xe(()=>{!o()||!e(N)||requestAnimationFrame(()=>e(N)?.focus())});var ae={get open(){return o()},set open(n=!1){o(n),v()},get ariaLabel(){return c()},set ariaLabel(n){c(n),v()},get closeLabel(){return s()},set closeLabel(n){s(n),v()},get onClose(){return _()},set onClose(n){_(n),v()},get openerElement(){return h()},set openerElement(n=null){h(n),v()},get children(){return I()},set children(n){I(n),v()},get actions(){return C()},set actions(n){C(n),v()},get caption(){return T()},set caption(n){T(n),v()},get onKeydown(){return w()},set onKeydown(n){w(n),v()},get onCopy(){return L()},set onCopy(n){L(n),v()},$set:Ae,$on:(n,r)=>Ue(t,n,r)},B=we(),G=te(B);{var J=n=>{{let r=$(()=>S?.target()??"body");Ut(n,{get target(){return e(r)},zIndex:1e3,children:(m,l)=>{var f=Rt(),k=pe(f),z=pe(k);{var R=x=>{var re=we(),D=te(re);je(D,C),y(x,re)};q(z,x=>{C()&&x(R)})}var Q=E(z,2);Le(Q,{variant:"ghost",size:"icon",class:"text-white hover:bg-white/20 hover:text-white",onclick:b,get"aria-label"(){return s()},get ref(){return e(N)},set ref(x){P(N,x,!0)},children:(x,re)=>{Pe(x,{get icon(){return bt},size:"lg"})},$$slots:{default:!0}}),ge(k),De(k,x=>d?.(x));var j=E(k,2),F=pe(j);je(F,I),ge(j),De(j,x=>d?.(x));var W=E(j,2);{var ce=x=>{var re=Kt(),D=ye(re,!0);Y(()=>ne(D,T())),y(x,re)};q(W,x=>{T()&&x(ce)})}ge(f),Se(f,x=>P(M,x),()=>e(M)),Y(()=>ke(f,"aria-label",c())),Ce("click",f,O),Ce("keydown",f,K),Ne("copy",f,function(...x){L()?.apply(this,x)}),It(3,f,()=>$t,()=>({tier:"moderate"})),y(m,f)},$$slots:{default:!0}})}};q(G,n=>{o()&&n(J)})}return y(i,B),Te(ae)}We(["click","keydown"]);function Ye(i){if(!i.startsWith("workspace-file://"))return null;const o=i.slice(17).split(/[?#]/)[0].split("/"),c=o[0],s=o.slice(1);if(!c||s.length===0)return null;const _=[];for(const h of s){if(!h)return null;try{_.push(decodeURIComponent(h))}catch{return null}}return{workspaceId:c,path:_.join("/")}}function at(i){try{return new URL(i).protocol==="https:"}catch{return!1}}function Ze(i){const t=/^data:([^;,]+);base64,(.*)$/s.exec(i);return t?{mimeType:t[1],base64:t[2]}:null}function Ve(i){return at(i)||Ye(i)!==null||/^workspace-asset:\/\/[^/?#]+/.test(i)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(i)}function rt(i){if(i.length===0)return 0;let t=0;return i.endsWith("==")?t=2:i.endsWith("=")&&(t=1),Math.floor(i.length*3/4)-t}function Ft(i,t){const o=atob(i),c=new Uint8Array(o.length);for(let s=0;s<o.length;s++)c[s]=o.charCodeAt(s);return new Blob([c],{type:t})}const Ot={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function Bt(i){if(i.workspacePath){const s=i.workspacePath.split("/").pop();if(s)return s}const t=(i.imageName||"image").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(t))return t;const o=i.mimeType?.split(";")[0].trim().toLowerCase(),c=o&&Ot[o]||"png";return`${t}.${c}`}var jt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),Dt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),Zt=V("<!> <!> <!>",1),Vt=V("<!> <!> <!> <!>",1),Wt=V("<!> <!>",1);function ot(i,t){if(new.target)return ze({component:ot,...i});Ee(t,!0);let o=g(t,"imageUrl",7),c=g(t,"imageName",7),s=g(t,"open",15,!1),_=g(t,"triggerClass",7),h=g(t,"contentClass",7);const I=$(()=>Ze(o())),C=$(()=>Ye(o())),T=$(()=>at(o()));let w=se(null),L=se(null),S=null;function d(){if(S===o())return;const l=S=o();P(w,null),P(L,e(I)?rt(e(I).base64):null,!0);const f=new Image;f.onload=()=>{S===l&&P(w,{width:f.naturalWidth,height:f.naturalHeight},!0)},f.src=o(),e(I)||fetch(o()).then(k=>k.ok?k.blob():null).then(k=>{k&&S===l&&P(L,k.size,!0)}).catch(()=>{})}xe(()=>{s()&&d()}),xe(()=>{if(s())return He(()=>{s(!1)})});async function M(l=o()){const f=Ze(l);if(f)return Ft(f.base64,f.mimeType);const k=await fetch(l);if(!k.ok)throw new Error(`Image fetch failed: ${k.status}`);return await k.blob()}async function N(){let l=null;try{let f=o(),k=e(I)?.mimeType;if(!e(I)){const R=await M();k=R.type,l=URL.createObjectURL(R),f=l}const z=document.createElement("a");z.href=f,z.download=Bt({workspacePath:e(C)?.path,imageName:c(),mimeType:k}),document.body.appendChild(z);try{z.click()}finally{z.remove()}}catch{_e.error(u.ui_imageActionsMenu_downloadFailed_error())}finally{l&&URL.revokeObjectURL(l)}}async function b(){if(e(C))try{await Re(e(C).path),_e.success(u.ui_imageActionsMenu_pathCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}async function O(){if(e(T))try{await Re(o()),_e.success(u.ui_imageActionsMenu_linkCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}async function K(l){let f,k;try{let z;if(l.type.split(";")[0].trim()==="image/svg+xml"){k=URL.createObjectURL(l);const j=new Image;j.src=k,await j.decode(),z=j}else z=f=await createImageBitmap(l);const R=document.createElement("canvas");R.width=z instanceof HTMLImageElement?z.naturalWidth:z.width,R.height=z instanceof HTMLImageElement?z.naturalHeight:z.height;const Q=R.getContext("2d");if(!Q)throw new Error("2d canvas context unavailable");return Q.drawImage(z,0,0),await new Promise((j,F)=>{R.toBlob(W=>W?j(W):F(new Error("canvas toBlob failed")),"image/png")})}finally{f?.close(),k&&URL.revokeObjectURL(k)}}async function ae(l=o()){try{let f=await M(l);f.type!=="image/png"&&(f=await K(f)),await navigator.clipboard.write([new ClipboardItem({"image/png":f})]),_e.success(u.ui_imageActionsMenu_imageCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}function B(l,f=o()){return l.defaultPrevented||!Ve(f)||l instanceof KeyboardEvent&&(l.key.toLowerCase()!=="c"||!(l.metaKey||l.ctrlKey)||l.altKey||l.shiftKey||l.isComposing)||vt(l.target)||document.getSelection()?.toString()?!1:(l.preventDefault(),l.stopPropagation(),l instanceof KeyboardEvent&&l.repeat||(ae(f),s(!1)),!0)}var G={handleCopy:B,get imageUrl(){return o()},set imageUrl(l){o(l),v()},get imageName(){return c()},set imageName(l){c(l),v()},get open(){return s()},set open(l=!1){s(l),v()},get triggerClass(){return _()},set triggerClass(l){_(l),v()},get contentClass(){return h()},set contentClass(l){h(l),v()},$set:Ae,$on:(l,f)=>Ue(t,l,f)},J=we(),n=te(J);{var r=l=>{var f=we(),k=te(f);me(k,()=>tt,(z,R)=>{R(z,{get open(){return s()},set open(Q){s(Q)},children:(Q,j)=>{var F=Wt(),W=te(F);{const x=(D,he)=>{let oe=()=>(he?.()).props;{let Z=$(()=>u.ui_imageActionsMenu_trigger_ariaLabel());Le(D,mt(oe,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return e(Z)},children:(ie,fe)=>{Qe(ie,{class:"size-3.5"})},$$slots:{default:!0}}))}};let re=$(()=>qe("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",_()));me(W,()=>Ge,(D,he)=>{he(D,{get class(){return e(re)},onclick:oe=>oe.stopPropagation(),onkeydown:oe=>B(oe),oncopy:oe=>B(oe),child:x,$$slots:{child:!0}})})}var ce=E(W,2);me(ce,()=>Je,(x,re)=>{re(x,{get class(){return h()},align:"end",onkeydown:D=>B(D),oncopy:D=>B(D),children:(D,he)=>{var oe=Vt(),Z=te(oe);me(Z,()=>$e,(A,X)=>{X(A,{onSelect:()=>void N(),children:(U,ee)=>{Me();var le=Ie();Y(ue=>ne(le,ue),[()=>u.ui_imageActionsMenu_download_label()]),y(U,le)},$$slots:{default:!0}})});var ie=E(Z,2);me(ie,()=>$e,(A,X)=>{X(A,{onSelect:()=>void ae(),children:(U,ee)=>{Me();var le=Ie();Y(ue=>ne(le,ue),[()=>u.ui_imageActionsMenu_copyImage_label()]),y(U,le)},$$slots:{default:!0}})});var fe=E(ie,2);{var a=A=>{var X=we(),U=te(X);me(U,()=>$e,(ee,le)=>{le(ee,{onSelect:()=>void b(),children:(ue,Fe)=>{Me();var de=Ie();Y(be=>ne(de,be),[()=>u.ui_imageActionsMenu_copyPath_label()]),y(ue,de)},$$slots:{default:!0}})}),y(A,X)},p=A=>{var X=we(),U=te(X);me(U,()=>$e,(ee,le)=>{le(ee,{onSelect:()=>void O(),children:(ue,Fe)=>{Me();var de=Ie();Y(be=>ne(de,be),[()=>u.ui_imageActionsMenu_copyLink_label()]),y(ue,de)},$$slots:{default:!0}})}),y(A,X)};q(fe,A=>{e(C)?A(a):e(T)&&A(p,1)})}var H=E(fe,2);{var ve=A=>{var X=Zt(),U=te(X);me(U,()=>et,(de,be)=>{be(de,{})});var ee=E(U,2);{var le=de=>{var be=jt(),Oe=ye(be,!0);Y(Be=>ne(Oe,Be),[()=>u.ui_imageActionsMenu_dimensions_label({width:Ke(e(w).width),height:Ke(e(w).height)})]),y(de,be)};q(ee,de=>{e(w)&&de(le)})}var ue=E(ee,2);{var Fe=de=>{var be=Dt(),Oe=ye(be,!0);Y(Be=>ne(Oe,Be),[()=>nt(e(L))]),y(de,be)};q(ue,de=>{e(L)!==null&&de(Fe)})}y(A,X)};q(H,A=>{(e(w)||e(L)!==null)&&A(ve)})}y(D,oe)},$$slots:{default:!0}})}),y(Q,F)},$$slots:{default:!0}})}),y(l,f)},m=$(()=>Ve(o()));q(n,l=>{e(m)&&l(r)})}return y(i,J),Te(G)}var Ht=V('<div role="application" tabindex="0" data-testid="zoom-pan-viewport"><div class="flex h-full w-full items-center justify-center will-change-transform" data-testid="zoom-pan-content"><!></div> <div class="absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 cursor-default items-center gap-2 rounded-full bg-black/60 px-3 py-1.5 backdrop-blur-sm" role="toolbar" tabindex="-1" data-testid="zoom-pan-controls"><!> <div class="w-36"><!></div> <!> <span class="min-w-12 text-center text-xs tabular-nums text-white/90" data-testid="zoom-pan-percent"> </span> <!></div></div>');function it(i,t){if(new.target)return ze({component:it,...i});Ee(t,!0);let o=g(t,"children",7),c=g(t,"minZoom",7,.25),s=g(t,"maxZoom",7,8),_=g(t,"onScaleChange",7);const h=1.25,I=.0015,C=.01,T=4;let w=se(1),L=se(0),S=se(0),d=se(!1),M=se(null);xe(()=>{_()?.(e(w))});let N=null,b=0,O=0,K=0,ae=!1;const B=$(()=>_t(e(w),{style:"percent",maximumFractionDigits:0}));function G(a){return Math.min(s(),Math.max(c(),a))}function J(a,p,H){const ve=G(H),A=e(M)?.getBoundingClientRect(),X=A?a-A.left:0,U=A?p-A.top:0;P(L,X-(X-e(L))/e(w)*ve),P(S,U-(U-e(S))/e(w)*ve),P(w,ve,!0)}function n(a){const p=e(M)?.getBoundingClientRect();p?J(p.left+p.width/2,p.top+p.height/2,a):P(w,G(a),!0)}function r(){P(w,1),P(L,0),P(S,0)}function m(a){a.preventDefault();const p=a.ctrlKey?C:I;J(a.clientX,a.clientY,e(w)*Math.exp(-a.deltaY*p))}xe(()=>{const a=e(M);if(a)return a.addEventListener("wheel",m,{passive:!1}),()=>a.removeEventListener("wheel",m)});function l(a){if(a.metaKey||a.ctrlKey||a.altKey)return!1;if(a.key==="+"||a.key==="=")n(e(w)*h);else if(a.key==="-")n(e(w)/h);else if(a.key==="0")r();else return!1;return a.preventDefault(),!0}function f(a){if(a.button>0)return;P(d,!0),N=a.pointerId,b=a.clientX,O=a.clientY,K=0;const p=a.currentTarget;typeof p.setPointerCapture=="function"&&p.setPointerCapture(a.pointerId)}function k(a){if(!e(d)||a.pointerId!==N)return;const p=a.clientX-b,H=a.clientY-O;K+=Math.abs(p)+Math.abs(H),P(L,e(L)+p),P(S,e(S)+H),b=a.clientX,O=a.clientY}function z(a){if(!e(d)||a.pointerId!==N)return;P(d,!1),N=null,K>T&&(ae=!0);const p=a.currentTarget;typeof p.hasPointerCapture=="function"&&typeof p.releasePointerCapture=="function"&&p.hasPointerCapture(a.pointerId)&&p.releasePointerCapture(a.pointerId)}function R(a){ae&&(ae=!1,a.preventDefault(),a.stopPropagation())}function Q(a){const p=Number.parseFloat(a.currentTarget.value);Number.isFinite(p)&&n(p)}var j={handleKeydown:l,get children(){return o()},set children(a){o(a),v()},get minZoom(){return c()},set minZoom(a=.25){c(a),v()},get maxZoom(){return s()},set maxZoom(a=8){s(a),v()},get onScaleChange(){return _()},set onScaleChange(a){_(a),v()},$set:Ae,$on:(a,p)=>Ue(t,a,p)},F=Ht(),W=pe(F),ce=pe(W);je(ce,o),ge(W);var x=E(W,2),re=pe(x);{let a=$(()=>u.ui_zoomPanViewport_zoomOut_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_zoomOut_ariaLabel());Le(re,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>n(e(w)/h),get"aria-label"(){return e(a)},get title(){return e(p)},children:(H,ve)=>{Pe(H,{get icon(){return wt}})},$$slots:{default:!0}})}var D=E(re,2),he=pe(D);{let a=$(()=>u.ui_zoomPanViewport_zoomSlider_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_zoomSlider_ariaLabel());Mt(he,{class:"accent-white",get min(){return c()},get max(){return s()},step:"0.01",get value(){return e(w)},oninput:Q,get"aria-label"(){return e(a)},get title(){return e(p)},"data-testid":"zoom-pan-slider"})}ge(D);var oe=E(D,2);{let a=$(()=>u.ui_zoomPanViewport_zoomIn_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_zoomIn_ariaLabel());Le(oe,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>n(e(w)*h),get"aria-label"(){return e(a)},get title(){return e(p)},children:(H,ve)=>{Pe(H,{get icon(){return yt}})},$$slots:{default:!0}})}var Z=E(oe,2),ie=ye(Z,!0),fe=E(Z,2);{let a=$(()=>u.ui_zoomPanViewport_resetZoom_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_resetZoom_ariaLabel());Le(fe,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:r,get"aria-label"(){return e(a)},get title(){return e(p)},children:(H,ve)=>{Pe(H,{get icon(){return xt}})},$$slots:{default:!0}})}return ge(x),ge(F),Se(F,a=>P(M,a),()=>e(M)),Y((a,p)=>{pt(F,1,`relative h-full w-full touch-none select-none overflow-hidden ${e(d)?"cursor-grabbing":"cursor-grab"}`),ke(F,"aria-label",a),gt(W,`transform: translate(${e(L)??""}px, ${e(S)??""}px) scale(${e(w)??""}); transform-origin: 0 0;`),ke(x,"aria-label",p),ne(ie,e(B))},[()=>u.ui_zoomPanViewport_viewport_ariaLabel(),()=>u.ui_zoomPanViewport_controls_ariaLabel()]),Ce("pointerdown",F,f),Ce("pointermove",F,k),Ce("pointerup",F,z),Ne("pointercancel",F,z),Ne("click",F,R,!0),Ce("keydown",F,l),Ce("pointerdown",x,a=>a.stopPropagation()),y(i,F),Te(j)}We(["pointerdown","pointermove","pointerup","keydown"]);var Xt=V('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function Yt(i,t){if(new.target)return ze({component:Yt,...i});Ee(t,!0);const o=b=>{var O=we(),K=te(O);{var ae=B=>{Se(ot(B,{get imageUrl(){return s()},get imageName(){return _()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]",get open(){return e(L)},set open(G){P(L,G,!0)}}),G=>P(w,G,!0),()=>e(w))};q(K,B=>{C()&&B(ae)})}y(b,O)};let c=g(t,"open",15,!1),s=g(t,"imageUrl",7),_=g(t,"imageName",23,()=>u.ui_imageLightbox_image_alt()),h=g(t,"onClose",7),I=g(t,"openerElement",7,null),C=g(t,"showActionsMenu",7,!1),T=se(void 0),w=se(void 0),L=se(!1);xe(()=>{c()||P(L,!1)});function S(b){d(b),b.defaultPrevented||e(T)?.handleKeydown(b)}function d(b){c()&&C()&&e(w)?.handleCopy(b)}function M(b){!C()||!Ve(s())||(b.preventDefault(),b.stopPropagation(),P(L,!0))}var N={get open(){return c()},set open(b=!1){c(b),v()},get imageUrl(){return s()},set imageUrl(b){s(b),v()},get imageName(){return _()},set imageName(b=u.ui_imageLightbox_image_alt()){_(b),v()},get onClose(){return h()},set onClose(b){h(b),v()},get openerElement(){return I()},set openerElement(b=null){I(b),v()},get showActionsMenu(){return C()},set showActionsMenu(b=!1){C(b),v()},$set:Ae,$on:(b,O)=>Ue(t,b,O)};{let b=$(()=>u.ui_imageLightbox_preview_ariaLabel()),O=$(()=>u.ui_imageLightbox_close_ariaLabel());Xe(i,{get ariaLabel(){return e(b)},get closeLabel(){return e(O)},get onClose(){return h()},get openerElement(){return I()},get actions(){return o},onKeydown:S,onCopy:d,get open(){return c()},set open(K){c(K)},children:(K,ae)=>{var B=we(),G=te(B);ft(G,s,J=>{Se(it(J,{children:(n,r)=>{var m=Xt();Y(()=>{ke(m,"src",s()),ke(m,"alt",_())}),Ce("contextmenu",m,M),y(n,m)},$$slots:{default:!0}}),n=>P(T,n,!0),()=>e(T))}),y(K,B)},$$slots:{default:!0}})}return Te(N)}We(["contextmenu"]);var qt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),Gt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),Jt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),Qt=V("<!> <!> <!> <!>",1),en=V("<!> <!> <!>",1),tn=V("<!> <!>",1);function lt(i,t){if(new.target)return ze({component:lt,...i});Ee(t,!0);let o=g(t,"videoUrl",7),c=g(t,"videoName",7),s=g(t,"sourceKind",7),_=g(t,"mimeType",7),h=g(t,"open",15,!1),I=g(t,"triggerClass",7),C=g(t,"contentClass",7);const T=$(()=>Ze(o())),w=$(()=>Ye(o())),L=$(()=>s()??(e(T)?"inline":e(w)?"workspace":"remote"));let S=se(null),d=se(null),M=se(null),N=null;function b(){if(N===o())return;const n=N=o();P(S,null),P(d,null),P(M,e(T)?rt(e(T).base64):null,!0);const r=document.createElement("video");r.preload="metadata",r.onloadedmetadata=()=>{N===n&&(Number.isFinite(r.duration)&&r.duration>0&&P(S,r.duration,!0),r.videoWidth>0&&r.videoHeight>0&&P(d,{width:r.videoWidth,height:r.videoHeight},!0))},r.src=o(),e(T)||fetch(o()).then(m=>m.ok?m.blob():null).then(m=>{m&&N===n&&P(M,m.size,!0)}).catch(()=>{})}function O(){const n=e(w)?.path.split("/").pop();if(n)return n;const r=(c()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(r))return r;const m=(_()??e(T)?.mimeType)==="video/webm"?"webm":"mp4";return`${r}.${m}`}async function K(){let n=null;try{let r=o();if(!e(T)){const l=await fetch(o());if(!l.ok)throw new Error(`Video fetch failed: ${l.status}`);n=URL.createObjectURL(await l.blob()),r=n}const m=document.createElement("a");m.href=r,m.download=O(),document.body.appendChild(m),m.click(),m.remove(),n&&URL.revokeObjectURL(n)}catch{n&&URL.revokeObjectURL(n),_e.error(u.ui_videoActionsMenu_downloadFailed_error())}}async function ae(n,r){try{await Re(n),_e.success(r)}catch{_e.error(u.ui_videoActionsMenu_copyFailed_error())}}xe(()=>{h()&&b()}),xe(()=>{if(h())return He(()=>{h(!1)})});var B={get videoUrl(){return o()},set videoUrl(n){o(n),v()},get videoName(){return c()},set videoName(n){c(n),v()},get sourceKind(){return s()},set sourceKind(n){s(n),v()},get mimeType(){return _()},set mimeType(n){_(n),v()},get open(){return h()},set open(n=!1){h(n),v()},get triggerClass(){return I()},set triggerClass(n){I(n),v()},get contentClass(){return C()},set contentClass(n){C(n),v()},$set:Ae,$on:(n,r)=>Ue(t,n,r)},G=we(),J=te(G);return me(J,()=>tt,(n,r)=>{r(n,{get open(){return h()},set open(m){h(m)},children:(m,l)=>{var f=tn(),k=te(f);{let R=$(()=>qe("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",I())),Q=$(()=>u.ui_videoActionsMenu_trigger_ariaLabel());me(k,()=>Ge,(j,F)=>{F(j,{get class(){return e(R)},get"aria-label"(){return e(Q)},onclick:W=>W.stopPropagation(),children:(W,ce)=>{Qe(W,{class:"size-3.5"})},$$slots:{default:!0}})})}var z=E(k,2);me(z,()=>Je,(R,Q)=>{Q(R,{get class(){return C()},align:"end",children:(j,F)=>{var W=en(),ce=te(W);me(ce,()=>$e,(Z,ie)=>{ie(Z,{onSelect:()=>void K(),children:(fe,a)=>{Me();var p=Ie();Y(H=>ne(p,H),[()=>u.ui_videoActionsMenu_download_label()]),y(fe,p)},$$slots:{default:!0}})});var x=E(ce,2);{var re=Z=>{var ie=we(),fe=te(ie);me(fe,()=>$e,(a,p)=>{p(a,{onSelect:()=>void ae(e(w).path,u.ui_videoActionsMenu_pathCopied_label()),children:(H,ve)=>{Me();var A=Ie();Y(X=>ne(A,X),[()=>u.ui_videoActionsMenu_copyPath_label()]),y(H,A)},$$slots:{default:!0}})}),y(Z,ie)},D=Z=>{var ie=we(),fe=te(ie);me(fe,()=>$e,(a,p)=>{p(a,{onSelect:()=>void ae(o(),u.ui_videoActionsMenu_linkCopied_label()),children:(H,ve)=>{Me();var A=Ie();Y(X=>ne(A,X),[()=>u.ui_videoActionsMenu_copyLink_label()]),y(H,A)},$$slots:{default:!0}})}),y(Z,ie)};q(x,Z=>{e(L)==="workspace"&&e(w)?Z(re):e(L)==="remote"&&Z(D,1)})}var he=E(x,2);{var oe=Z=>{var ie=Qt(),fe=te(ie);me(fe,()=>et,(U,ee)=>{ee(U,{})});var a=E(fe,2);{var p=U=>{var ee=qt(),le=ye(ee,!0);Y(ue=>ne(le,ue),[()=>u.ui_videoActionsMenu_duration_label({duration:ht(e(S)*1e3)})]),y(U,ee)};q(a,U=>{e(S)!==null&&U(p)})}var H=E(a,2);{var ve=U=>{var ee=Gt(),le=ye(ee,!0);Y(ue=>ne(le,ue),[()=>u.ui_videoActionsMenu_dimensions_label({width:Ke(e(d).width),height:Ke(e(d).height)})]),y(U,ee)};q(H,U=>{e(d)&&U(ve)})}var A=E(H,2);{var X=U=>{var ee=Jt(),le=ye(ee,!0);Y(ue=>ne(le,ue),[()=>nt(e(M))]),y(U,ee)};q(A,U=>{e(M)!==null&&U(X)})}y(Z,ie)};q(he,Z=>{(e(S)!==null||e(d)||e(M)!==null)&&Z(oe)})}y(j,W)},$$slots:{default:!0}})}),y(m,f)},$$slots:{default:!0}})}),y(i,G),Te(B)}var nn=V('<p class="type-body text-white/80" role="status"> </p>'),an=V('<div data-media-lightbox-content="" data-video-lightbox-root="" class="flex max-h-[90vh] max-w-[90vw] cursor-default flex-col items-center gap-3"><video controls="" preload="metadata" playsinline="" class="max-h-[85vh] max-w-[90vw] rounded-lg bg-black object-contain shadow-(--elevation-overlay)" data-testid="chat-video-player"> </video> <!></div>',2);function rn(i,t){if(new.target)return ze({component:rn,...i});Ee(t,!0);const o=d=>{lt(d,{get videoUrl(){return s()},get videoName(){return _()},get sourceKind(){return I()},get mimeType(){return C()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]"})};let c=g(t,"open",15,!1),s=g(t,"videoUrl",7),_=g(t,"videoName",23,()=>u.chat_videoBlock_fromAgent_label()),h=g(t,"poster",7),I=g(t,"sourceKind",7),C=g(t,"mimeType",7),T=g(t,"openerElement",7,null),w=g(t,"onClose",7),L=se(!1);xe(()=>{!c()||!s()||P(L,!1)});var S={get open(){return c()},set open(d=!1){c(d),v()},get videoUrl(){return s()},set videoUrl(d){s(d),v()},get videoName(){return _()},set videoName(d=u.chat_videoBlock_fromAgent_label()){_(d),v()},get poster(){return h()},set poster(d){h(d),v()},get sourceKind(){return I()},set sourceKind(d){I(d),v()},get mimeType(){return C()},set mimeType(d){C(d),v()},get openerElement(){return T()},set openerElement(d=null){T(d),v()},get onClose(){return w()},set onClose(d){w(d),v()},$set:Ae,$on:(d,M)=>Ue(t,d,M)};{let d=$(()=>u.chat_videoBlock_dialog_title({name:_()})),M=$(()=>u.chat_videoBlock_close_ariaLabel());Xe(i,{get ariaLabel(){return e(d)},get closeLabel(){return e(M)},get openerElement(){return T()},get onClose(){return w()},get actions(){return o},get open(){return c()},set open(N){c(N)},children:(N,b)=>{var O=an(),K=pe(O),ae=ye(K,!0),B=E(K,2);{var G=J=>{var n=nn(),r=ye(n,!0);Y(m=>ne(r,m),[()=>u.chat_videoBlock_unavailable_description()]),y(J,n)};q(B,J=>{e(L)&&J(G)})}ge(O),Y(J=>{ke(K,"src",s()),ke(K,"poster",h()),ke(K,"aria-label",_()),ne(ae,J)},[()=>u.chat_videoBlock_unsupported_description()]),Ne("error",K,()=>P(L,!0)),y(N,O)},$$slots:{default:!0}})}return Te(S)}var on=V('<span class="block truncate text-foreground"> </span>'),ln=V("<!> ",1),sn=V("<!> <!>",1),cn=V('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),un=V('<div class="type-caption flex w-fit min-w-0 max-w-full items-center gap-3 whitespace-normal py-1 text-muted-foreground" role="status" data-testid="media-unavailable"><span class="flex min-w-0 max-w-full flex-1 items-start gap-2"><span class="first-line-icon" aria-hidden="true"><!></span> <span class="min-w-0"><!> <span class="block break-words"> </span></span></span> <!></div>');function dn(i,t){if(new.target)return ze({component:dn,...i});Ee(t,!0);let o=g(t,"name",7),c=g(t,"reason",7),s=g(t,"path",7),_=g(t,"workspaceId",7),h=g(t,"onRetry",7);const I=$(()=>c()==="missing"?u.ui_mediaUnavailable_missing_description():c()==="unsupported"?u.ui_mediaUnavailable_unsupported_description():c()==="other-workspace"?u.ui_mediaUnavailable_otherWorkspace_description():c()==="invalid-link"?u.ui_mediaUnavailable_invalidLink_description():u.ui_mediaUnavailable_loadFailed_description());function C(r){r.preventDefault(),r.stopPropagation()}function T(r){C(r),h()?.()}async function w(r){if(C(r),!!s())try{await Re(s()),_e.success(u.ui_imageActionsMenu_pathCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}function L(r){if(C(r),!s()||!_())return;const m=s().split("/").map(encodeURIComponent).join("/");Et(`intent://local/file/${m}`,{workspaceId:ut(_())})}var S={get name(){return o()},set name(r){o(r),v()},get reason(){return c()},set reason(r){c(r),v()},get path(){return s()},set path(r){s(r),v()},get workspaceId(){return _()},set workspaceId(r){_(r),v()},get onRetry(){return h()},set onRetry(r){h(r),v()},$set:Ae,$on:(r,m)=>Ue(t,r,m)},d=un(),M=pe(d),N=pe(M),b=pe(N);Pe(b,{get icon(){return kt},class:"size-3.5"}),ge(N);var O=E(N,2),K=pe(O);{var ae=r=>{var m=on(),l=ye(m,!0);De(m,(f,k)=>Tt?.(f,k),o),Y(()=>ne(l,o())),y(r,m)};q(K,r=>{o()&&r(ae)})}var B=E(K,2),G=ye(B,!0);ge(O),ge(M);var J=E(M,2);{var n=r=>{var m=cn(),l=pe(m);{var f=R=>{{let Q=$(()=>u.chat_shared_retry_label());Le(R,{variant:"ghost",size:"icon-compact",get tooltip(){return e(Q)},onclick:T,children:(j,F)=>{Pe(j,{get icon(){return Ct},size:"xs"})},$$slots:{default:!0}})}};q(l,R=>{h()&&R(f)})}var k=E(l,2);{var z=R=>{var Q=sn(),j=te(Q);{var F=ce=>{Le(ce,{variant:"ghost",size:"compact",onclick:L,children:(x,re)=>{var D=ln(),he=te(D);Pe(he,{get icon(){return Lt},size:"xs"});var oe=E(he);Y(Z=>ne(oe,` ${Z??""}`),[()=>u.chat_changesPanel_openFile_tooltip()]),y(x,D)},$$slots:{default:!0}})};q(j,ce=>{_()&&c()!=="other-workspace"&&c()!=="invalid-link"&&ce(F)})}var W=E(j,2);{let ce=$(()=>u.ui_imageActionsMenu_copyPath_label());Le(W,{variant:"ghost",size:"icon-compact",get tooltip(){return e(ce)},onclick:w,children:(x,re)=>{Pe(x,{get icon(){return Pt},size:"xs"})},$$slots:{default:!0}})}y(R,Q)};q(k,R=>{s()&&R(z)})}ge(m),y(r,m)};q(J,r=>{(h()||s())&&r(n)})}return ge(d),Y(()=>{ke(d,"data-reason",c()),ne(G,e(I))}),y(i,d),Te(S)}export{ot as I,Xe as M,lt as V,it as Z,Yt as a,dn as b,rn as c,rt as d,Ft as e,Ve as f,St as m,Ye as p,Bn as r,jn as s};
|
|
1
|
+
import{$ as st}from"./BfdTnj-p.js";import{nV as ct,bq as ut}from"./Zs30783q.js";import{g as dt}from"./CMiilI_P.js";import{t as ze,bo as g,bw as Ae,b as Ue,bm as u,br as mt}from"./DxxarOOi.js";import{ai as We,bs as Ee,ca as xe,aD as e,a7 as we,ay as te,W as y,bn as Te,bV as se,aA as v,a5 as pe,bS as E,bH as P,bA as ge,b_ as Y,aj as Ce,aw as Ne,bl as ye,bO as ne,aB as V,c9 as $,be as Me,b$ as Ie}from"./3SdAC2_C.js";import{i as q}from"./DzAQQ1i-.js";import{k as ft}from"./ByAetY4P.js";import{s as ke,e as qe,f as pt,g as gt}from"./Ch-D6DCZ.js";import{b as Se}from"./Dn334wJv.js";import{c as me}from"./CruJ4jyB.js";import{q as He,l as Ge,d as Je,e as $e,K as Qe,h as et,M as tt}from"./CvP7-iXZ.js";import{a as vt}from"./CC7to1B5.js";import{m as _e}from"./DkkzFfYK.js";import{f as Le}from"./D5eCb9SA.js";import"./BfQPFCP7.js";import{l as Ke,f as nt,m as _t,a as ht}from"./BqJSWZOr.js";import"./ChTqQfQN.js";import"./BWsFbeUj.js";import"./BrfF5NLx.js";import{bL as Re}from"./CPc9hi45.js";import{s as je}from"./C600Ggsz.js";import{F as Pe,d3 as bt,bW as wt,bX as yt,cq as xt,bF as kt,cr as Ct,aZ as Pt,a8 as Lt}from"./B5yEHkSy.js";import{S as Mt}from"./BzL9Egzq.js";import{n as It,g as $t}from"./DSjVYlVX.js";import{e as De}from"./BUT4El0L.js";import{i as zt,f as At}from"./VlOW_lom.js";import{P as Ut}from"./DYME5vl6.js";import{h as Et}from"./hjdg1APe.js";import{t as Tt}from"./DAsc1V4f.js";function Nt(i,t){return i?.isExternalLink===!0&&typeof i.workspaceId=="string"&&i.workspaceId?i.workspaceId:t||void 0}function St(i,t,o){const c=i.label||i.id||"mention";if(i.type==="member")return st(c);if(i.type==="note"&&i.id&&o){const s=Nt(i.meta,t),_=s?o(s,i.id)?.trim():void 0;if(_)return _}return c}function Bn(i,t,o){if(typeof document>"u"||!i.includes('data-type="note"'))return i;const c=document.createElement("template");c.innerHTML=i;let s=!1;for(const _ of c.content.querySelectorAll('[data-mention][data-type="note"]')){let h=null;try{h=JSON.parse(_.getAttribute("data-meta")||"{}")}catch{h=null}const I=_.textContent??"",C=St({type:"note",id:_.getAttribute("data-id"),label:I,meta:h},t,o);C!==I&&(_.textContent=C,s=!0)}return s?c.innerHTML:i}const jn=(i,t)=>{let o;try{o=dt().state}catch{return}const c=o?.workspaceNotes?.byWorkspaceId?.[i]?.notes;return c?ct(c,t)?.title:void 0};var Kt=V('<p class="mt-2 max-w-[90vw] rounded-md bg-black/60 px-3 py-1.5 text-center text-sm text-white"> </p>'),Rt=V('<div data-media-lightbox-root="" data-image-lightbox-root="" class="fixed inset-0 z-[1000] flex cursor-zoom-out flex-col items-center justify-center bg-black/80 p-4 backdrop-blur-sm" style="pointer-events: auto;" role="dialog" aria-modal="true" tabindex="-1"><div class="absolute right-4 top-4 z-[1002] flex items-center gap-1"><!> <!></div> <div class="flex min-h-0 w-full flex-1 items-center justify-center"><!></div> <!></div>');function Xe(i,t){if(new.target)return ze({component:Xe,...i});Ee(t,!0);let o=g(t,"open",15,!1),c=g(t,"ariaLabel",7),s=g(t,"closeLabel",7),_=g(t,"onClose",7),h=g(t,"openerElement",7,null),I=g(t,"children",7),C=g(t,"actions",7),T=g(t,"caption",7),w=g(t,"onKeydown",7),L=g(t,"onCopy",7);const S=zt(),d=At(b);let M=se(null),N=se(null);function b(){o()&&(o(!1),_()?.(),h()?.isConnected&&h().focus({preventScroll:!0}))}function O(n){(n.target instanceof Element?n.target:null)?.closest('[data-media-lightbox-content], [role="toolbar"], button, input')||b()}function K(n){if(w()?.(n),n.defaultPrevented||n.key!=="Tab"||!e(M))return;const r=Array.from(e(M).querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),m=r[0],l=r[r.length-1];!m||!l||(n.shiftKey&&document.activeElement===m?(n.preventDefault(),l.focus()):!n.shiftKey&&document.activeElement===l&&(n.preventDefault(),m.focus()))}xe(()=>{if(o())return He(b)}),xe(()=>{!o()||!e(N)||requestAnimationFrame(()=>e(N)?.focus())});var ae={get open(){return o()},set open(n=!1){o(n),v()},get ariaLabel(){return c()},set ariaLabel(n){c(n),v()},get closeLabel(){return s()},set closeLabel(n){s(n),v()},get onClose(){return _()},set onClose(n){_(n),v()},get openerElement(){return h()},set openerElement(n=null){h(n),v()},get children(){return I()},set children(n){I(n),v()},get actions(){return C()},set actions(n){C(n),v()},get caption(){return T()},set caption(n){T(n),v()},get onKeydown(){return w()},set onKeydown(n){w(n),v()},get onCopy(){return L()},set onCopy(n){L(n),v()},$set:Ae,$on:(n,r)=>Ue(t,n,r)},B=we(),G=te(B);{var J=n=>{{let r=$(()=>S?.target()??"body");Ut(n,{get target(){return e(r)},zIndex:1e3,children:(m,l)=>{var f=Rt(),k=pe(f),z=pe(k);{var R=x=>{var re=we(),D=te(re);je(D,C),y(x,re)};q(z,x=>{C()&&x(R)})}var Q=E(z,2);Le(Q,{variant:"ghost",size:"icon",class:"text-white hover:bg-white/20 hover:text-white",onclick:b,get"aria-label"(){return s()},get ref(){return e(N)},set ref(x){P(N,x,!0)},children:(x,re)=>{Pe(x,{get icon(){return bt},size:"lg"})},$$slots:{default:!0}}),ge(k),De(k,x=>d?.(x));var j=E(k,2),F=pe(j);je(F,I),ge(j),De(j,x=>d?.(x));var W=E(j,2);{var ce=x=>{var re=Kt(),D=ye(re,!0);Y(()=>ne(D,T())),y(x,re)};q(W,x=>{T()&&x(ce)})}ge(f),Se(f,x=>P(M,x),()=>e(M)),Y(()=>ke(f,"aria-label",c())),Ce("click",f,O),Ce("keydown",f,K),Ne("copy",f,function(...x){L()?.apply(this,x)}),It(3,f,()=>$t,()=>({tier:"moderate"})),y(m,f)},$$slots:{default:!0}})}};q(G,n=>{o()&&n(J)})}return y(i,B),Te(ae)}We(["click","keydown"]);function Ye(i){if(!i.startsWith("workspace-file://"))return null;const o=i.slice(17).split(/[?#]/)[0].split("/"),c=o[0],s=o.slice(1);if(!c||s.length===0)return null;const _=[];for(const h of s){if(!h)return null;try{_.push(decodeURIComponent(h))}catch{return null}}return{workspaceId:c,path:_.join("/")}}function at(i){try{return new URL(i).protocol==="https:"}catch{return!1}}function Ze(i){const t=/^data:([^;,]+);base64,(.*)$/s.exec(i);return t?{mimeType:t[1],base64:t[2]}:null}function Ve(i){return at(i)||Ye(i)!==null||/^workspace-asset:\/\/[^/?#]+/.test(i)||/^data:image\/[a-z0-9.+-]+(?:;[^,]*)?,/i.test(i)}function rt(i){if(i.length===0)return 0;let t=0;return i.endsWith("==")?t=2:i.endsWith("=")&&(t=1),Math.floor(i.length*3/4)-t}function Ft(i,t){const o=atob(i),c=new Uint8Array(o.length);for(let s=0;s<o.length;s++)c[s]=o.charCodeAt(s);return new Blob([c],{type:t})}const Ot={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp","image/svg+xml":"svg","image/avif":"avif","image/bmp":"bmp"};function Bt(i){if(i.workspacePath){const s=i.workspacePath.split("/").pop();if(s)return s}const t=(i.imageName||"image").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(t))return t;const o=i.mimeType?.split(";")[0].trim().toLowerCase(),c=o&&Ot[o]||"png";return`${t}.${c}`}var jt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-dimensions"> </div>'),Dt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="image-info-size"> </div>'),Zt=V("<!> <!> <!>",1),Vt=V("<!> <!> <!> <!>",1),Wt=V("<!> <!>",1);function ot(i,t){if(new.target)return ze({component:ot,...i});Ee(t,!0);let o=g(t,"imageUrl",7),c=g(t,"imageName",7),s=g(t,"open",15,!1),_=g(t,"triggerClass",7),h=g(t,"contentClass",7);const I=$(()=>Ze(o())),C=$(()=>Ye(o())),T=$(()=>at(o()));let w=se(null),L=se(null),S=null;function d(){if(S===o())return;const l=S=o();P(w,null),P(L,e(I)?rt(e(I).base64):null,!0);const f=new Image;f.onload=()=>{S===l&&P(w,{width:f.naturalWidth,height:f.naturalHeight},!0)},f.src=o(),e(I)||fetch(o()).then(k=>k.ok?k.blob():null).then(k=>{k&&S===l&&P(L,k.size,!0)}).catch(()=>{})}xe(()=>{s()&&d()}),xe(()=>{if(s())return He(()=>{s(!1)})});async function M(l=o()){const f=Ze(l);if(f)return Ft(f.base64,f.mimeType);const k=await fetch(l);if(!k.ok)throw new Error(`Image fetch failed: ${k.status}`);return await k.blob()}async function N(){let l=null;try{let f=o(),k=e(I)?.mimeType;if(!e(I)){const R=await M();k=R.type,l=URL.createObjectURL(R),f=l}const z=document.createElement("a");z.href=f,z.download=Bt({workspacePath:e(C)?.path,imageName:c(),mimeType:k}),document.body.appendChild(z);try{z.click()}finally{z.remove()}}catch{_e.error(u.ui_imageActionsMenu_downloadFailed_error())}finally{l&&URL.revokeObjectURL(l)}}async function b(){if(e(C))try{await Re(e(C).path),_e.success(u.ui_imageActionsMenu_pathCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}async function O(){if(e(T))try{await Re(o()),_e.success(u.ui_imageActionsMenu_linkCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}async function K(l){let f,k;try{let z;if(l.type.split(";")[0].trim()==="image/svg+xml"){k=URL.createObjectURL(l);const j=new Image;j.src=k,await j.decode(),z=j}else z=f=await createImageBitmap(l);const R=document.createElement("canvas");R.width=z instanceof HTMLImageElement?z.naturalWidth:z.width,R.height=z instanceof HTMLImageElement?z.naturalHeight:z.height;const Q=R.getContext("2d");if(!Q)throw new Error("2d canvas context unavailable");return Q.drawImage(z,0,0),await new Promise((j,F)=>{R.toBlob(W=>W?j(W):F(new Error("canvas toBlob failed")),"image/png")})}finally{f?.close(),k&&URL.revokeObjectURL(k)}}async function ae(l=o()){try{let f=await M(l);f.type!=="image/png"&&(f=await K(f)),await navigator.clipboard.write([new ClipboardItem({"image/png":f})]),_e.success(u.ui_imageActionsMenu_imageCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}function B(l,f=o()){return l.defaultPrevented||!Ve(f)||l instanceof KeyboardEvent&&(l.key.toLowerCase()!=="c"||!(l.metaKey||l.ctrlKey)||l.altKey||l.shiftKey||l.isComposing)||vt(l.target)||document.getSelection()?.toString()?!1:(l.preventDefault(),l.stopPropagation(),l instanceof KeyboardEvent&&l.repeat||(ae(f),s(!1)),!0)}var G={handleCopy:B,get imageUrl(){return o()},set imageUrl(l){o(l),v()},get imageName(){return c()},set imageName(l){c(l),v()},get open(){return s()},set open(l=!1){s(l),v()},get triggerClass(){return _()},set triggerClass(l){_(l),v()},get contentClass(){return h()},set contentClass(l){h(l),v()},$set:Ae,$on:(l,f)=>Ue(t,l,f)},J=we(),n=te(J);{var r=l=>{var f=we(),k=te(f);me(k,()=>tt,(z,R)=>{R(z,{get open(){return s()},set open(Q){s(Q)},children:(Q,j)=>{var F=Wt(),W=te(F);{const x=(D,he)=>{let oe=()=>(he?.()).props;{let Z=$(()=>u.ui_imageActionsMenu_trigger_ariaLabel());Le(D,mt(oe,{variant:"plain",size:"icon-sm",wrapContent:!1,get active(){return s()},get"aria-label"(){return e(Z)},children:(ie,fe)=>{Qe(ie,{class:"size-3.5"})},$$slots:{default:!0}}))}};let re=$(()=>qe("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",_()));me(W,()=>Ge,(D,he)=>{he(D,{get class(){return e(re)},onclick:oe=>oe.stopPropagation(),onkeydown:oe=>B(oe),oncopy:oe=>B(oe),child:x,$$slots:{child:!0}})})}var ce=E(W,2);me(ce,()=>Je,(x,re)=>{re(x,{get class(){return h()},align:"end",onkeydown:D=>B(D),oncopy:D=>B(D),children:(D,he)=>{var oe=Vt(),Z=te(oe);me(Z,()=>$e,(A,X)=>{X(A,{onSelect:()=>void N(),children:(U,ee)=>{Me();var le=Ie();Y(ue=>ne(le,ue),[()=>u.ui_imageActionsMenu_download_label()]),y(U,le)},$$slots:{default:!0}})});var ie=E(Z,2);me(ie,()=>$e,(A,X)=>{X(A,{onSelect:()=>void ae(),children:(U,ee)=>{Me();var le=Ie();Y(ue=>ne(le,ue),[()=>u.ui_imageActionsMenu_copyImage_label()]),y(U,le)},$$slots:{default:!0}})});var fe=E(ie,2);{var a=A=>{var X=we(),U=te(X);me(U,()=>$e,(ee,le)=>{le(ee,{onSelect:()=>void b(),children:(ue,Fe)=>{Me();var de=Ie();Y(be=>ne(de,be),[()=>u.ui_imageActionsMenu_copyPath_label()]),y(ue,de)},$$slots:{default:!0}})}),y(A,X)},p=A=>{var X=we(),U=te(X);me(U,()=>$e,(ee,le)=>{le(ee,{onSelect:()=>void O(),children:(ue,Fe)=>{Me();var de=Ie();Y(be=>ne(de,be),[()=>u.ui_imageActionsMenu_copyLink_label()]),y(ue,de)},$$slots:{default:!0}})}),y(A,X)};q(fe,A=>{e(C)?A(a):e(T)&&A(p,1)})}var H=E(fe,2);{var ve=A=>{var X=Zt(),U=te(X);me(U,()=>et,(de,be)=>{be(de,{})});var ee=E(U,2);{var le=de=>{var be=jt(),Oe=ye(be,!0);Y(Be=>ne(Oe,Be),[()=>u.ui_imageActionsMenu_dimensions_label({width:Ke(e(w).width),height:Ke(e(w).height)})]),y(de,be)};q(ee,de=>{e(w)&&de(le)})}var ue=E(ee,2);{var Fe=de=>{var be=Dt(),Oe=ye(be,!0);Y(Be=>ne(Oe,Be),[()=>nt(e(L))]),y(de,be)};q(ue,de=>{e(L)!==null&&de(Fe)})}y(A,X)};q(H,A=>{(e(w)||e(L)!==null)&&A(ve)})}y(D,oe)},$$slots:{default:!0}})}),y(Q,F)},$$slots:{default:!0}})}),y(l,f)},m=$(()=>Ve(o()));q(n,l=>{e(m)&&l(r)})}return y(i,J),Te(G)}var Ht=V('<div role="application" tabindex="0" data-testid="zoom-pan-viewport"><div class="flex h-full w-full items-center justify-center will-change-transform" data-testid="zoom-pan-content"><!></div> <div class="absolute bottom-4 left-1/2 z-10 flex -translate-x-1/2 cursor-default items-center gap-2 rounded-full bg-black/60 px-3 py-1.5 backdrop-blur-sm" role="toolbar" tabindex="-1" data-testid="zoom-pan-controls"><!> <div class="w-36"><!></div> <!> <span class="min-w-12 text-center text-xs tabular-nums text-white/90" data-testid="zoom-pan-percent"> </span> <!></div></div>');function it(i,t){if(new.target)return ze({component:it,...i});Ee(t,!0);let o=g(t,"children",7),c=g(t,"minZoom",7,.25),s=g(t,"maxZoom",7,8),_=g(t,"onScaleChange",7);const h=1.25,I=.0015,C=.01,T=4;let w=se(1),L=se(0),S=se(0),d=se(!1),M=se(null);xe(()=>{_()?.(e(w))});let N=null,b=0,O=0,K=0,ae=!1;const B=$(()=>_t(e(w),{style:"percent",maximumFractionDigits:0}));function G(a){return Math.min(s(),Math.max(c(),a))}function J(a,p,H){const ve=G(H),A=e(M)?.getBoundingClientRect(),X=A?a-A.left:0,U=A?p-A.top:0;P(L,X-(X-e(L))/e(w)*ve),P(S,U-(U-e(S))/e(w)*ve),P(w,ve,!0)}function n(a){const p=e(M)?.getBoundingClientRect();p?J(p.left+p.width/2,p.top+p.height/2,a):P(w,G(a),!0)}function r(){P(w,1),P(L,0),P(S,0)}function m(a){a.preventDefault();const p=a.ctrlKey?C:I;J(a.clientX,a.clientY,e(w)*Math.exp(-a.deltaY*p))}xe(()=>{const a=e(M);if(a)return a.addEventListener("wheel",m,{passive:!1}),()=>a.removeEventListener("wheel",m)});function l(a){if(a.metaKey||a.ctrlKey||a.altKey)return!1;if(a.key==="+"||a.key==="=")n(e(w)*h);else if(a.key==="-")n(e(w)/h);else if(a.key==="0")r();else return!1;return a.preventDefault(),!0}function f(a){if(a.button>0)return;P(d,!0),N=a.pointerId,b=a.clientX,O=a.clientY,K=0;const p=a.currentTarget;typeof p.setPointerCapture=="function"&&p.setPointerCapture(a.pointerId)}function k(a){if(!e(d)||a.pointerId!==N)return;const p=a.clientX-b,H=a.clientY-O;K+=Math.abs(p)+Math.abs(H),P(L,e(L)+p),P(S,e(S)+H),b=a.clientX,O=a.clientY}function z(a){if(!e(d)||a.pointerId!==N)return;P(d,!1),N=null,K>T&&(ae=!0);const p=a.currentTarget;typeof p.hasPointerCapture=="function"&&typeof p.releasePointerCapture=="function"&&p.hasPointerCapture(a.pointerId)&&p.releasePointerCapture(a.pointerId)}function R(a){ae&&(ae=!1,a.preventDefault(),a.stopPropagation())}function Q(a){const p=Number.parseFloat(a.currentTarget.value);Number.isFinite(p)&&n(p)}var j={handleKeydown:l,get children(){return o()},set children(a){o(a),v()},get minZoom(){return c()},set minZoom(a=.25){c(a),v()},get maxZoom(){return s()},set maxZoom(a=8){s(a),v()},get onScaleChange(){return _()},set onScaleChange(a){_(a),v()},$set:Ae,$on:(a,p)=>Ue(t,a,p)},F=Ht(),W=pe(F),ce=pe(W);je(ce,o),ge(W);var x=E(W,2),re=pe(x);{let a=$(()=>u.ui_zoomPanViewport_zoomOut_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_zoomOut_ariaLabel());Le(re,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>n(e(w)/h),get"aria-label"(){return e(a)},get title(){return e(p)},children:(H,ve)=>{Pe(H,{get icon(){return wt}})},$$slots:{default:!0}})}var D=E(re,2),he=pe(D);{let a=$(()=>u.ui_zoomPanViewport_zoomSlider_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_zoomSlider_ariaLabel());Mt(he,{class:"accent-white",get min(){return c()},get max(){return s()},step:"0.01",get value(){return e(w)},oninput:Q,get"aria-label"(){return e(a)},get title(){return e(p)},"data-testid":"zoom-pan-slider"})}ge(D);var oe=E(D,2);{let a=$(()=>u.ui_zoomPanViewport_zoomIn_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_zoomIn_ariaLabel());Le(oe,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:()=>n(e(w)*h),get"aria-label"(){return e(a)},get title(){return e(p)},children:(H,ve)=>{Pe(H,{get icon(){return yt}})},$$slots:{default:!0}})}var Z=E(oe,2),ie=ye(Z,!0),fe=E(Z,2);{let a=$(()=>u.ui_zoomPanViewport_resetZoom_ariaLabel()),p=$(()=>u.ui_zoomPanViewport_resetZoom_ariaLabel());Le(fe,{variant:"ghost",size:"icon-sm",class:"text-white hover:bg-white/20 hover:text-white",onclick:r,get"aria-label"(){return e(a)},get title(){return e(p)},children:(H,ve)=>{Pe(H,{get icon(){return xt}})},$$slots:{default:!0}})}return ge(x),ge(F),Se(F,a=>P(M,a),()=>e(M)),Y((a,p)=>{pt(F,1,`relative h-full w-full touch-none select-none overflow-hidden ${e(d)?"cursor-grabbing":"cursor-grab"}`),ke(F,"aria-label",a),gt(W,`transform: translate(${e(L)??""}px, ${e(S)??""}px) scale(${e(w)??""}); transform-origin: 0 0;`),ke(x,"aria-label",p),ne(ie,e(B))},[()=>u.ui_zoomPanViewport_viewport_ariaLabel(),()=>u.ui_zoomPanViewport_controls_ariaLabel()]),Ce("pointerdown",F,f),Ce("pointermove",F,k),Ce("pointerup",F,z),Ne("pointercancel",F,z),Ne("click",F,R,!0),Ce("keydown",F,l),Ce("pointerdown",x,a=>a.stopPropagation()),y(i,F),Te(j)}We(["pointerdown","pointermove","pointerup","keydown"]);var Xt=V('<img class="max-h-[90vh] max-w-[90vw] rounded-lg object-contain" draggable="false" data-media-lightbox-content=""/>');function Yt(i,t){if(new.target)return ze({component:Yt,...i});Ee(t,!0);const o=b=>{var O=we(),K=te(O);{var ae=B=>{Se(ot(B,{get imageUrl(){return s()},get imageName(){return _()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]",get open(){return e(L)},set open(G){P(L,G,!0)}}),G=>P(w,G,!0),()=>e(w))};q(K,B=>{C()&&B(ae)})}y(b,O)};let c=g(t,"open",15,!1),s=g(t,"imageUrl",7),_=g(t,"imageName",23,()=>u.ui_imageLightbox_image_alt()),h=g(t,"onClose",7),I=g(t,"openerElement",7,null),C=g(t,"showActionsMenu",7,!1),T=se(void 0),w=se(void 0),L=se(!1);xe(()=>{c()||P(L,!1)});function S(b){d(b),b.defaultPrevented||e(T)?.handleKeydown(b)}function d(b){c()&&C()&&e(w)?.handleCopy(b)}function M(b){!C()||!Ve(s())||(b.preventDefault(),b.stopPropagation(),P(L,!0))}var N={get open(){return c()},set open(b=!1){c(b),v()},get imageUrl(){return s()},set imageUrl(b){s(b),v()},get imageName(){return _()},set imageName(b=u.ui_imageLightbox_image_alt()){_(b),v()},get onClose(){return h()},set onClose(b){h(b),v()},get openerElement(){return I()},set openerElement(b=null){I(b),v()},get showActionsMenu(){return C()},set showActionsMenu(b=!1){C(b),v()},$set:Ae,$on:(b,O)=>Ue(t,b,O)};{let b=$(()=>u.ui_imageLightbox_preview_ariaLabel()),O=$(()=>u.ui_imageLightbox_close_ariaLabel());Xe(i,{get ariaLabel(){return e(b)},get closeLabel(){return e(O)},get onClose(){return h()},get openerElement(){return I()},get actions(){return o},onKeydown:S,onCopy:d,get open(){return c()},set open(K){c(K)},children:(K,ae)=>{var B=we(),G=te(B);ft(G,s,J=>{Se(it(J,{children:(n,r)=>{var m=Xt();Y(()=>{ke(m,"src",s()),ke(m,"alt",_())}),Ce("contextmenu",m,M),y(n,m)},$$slots:{default:!0}}),n=>P(T,n,!0),()=>e(T))}),y(K,B)},$$slots:{default:!0}})}return Te(N)}We(["contextmenu"]);var qt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-duration"> </div>'),Gt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-dimensions"> </div>'),Jt=V('<div class="type-caption px-2 py-1 text-muted-foreground" data-testid="video-info-size"> </div>'),Qt=V("<!> <!> <!> <!>",1),en=V("<!> <!> <!>",1),tn=V("<!> <!>",1);function lt(i,t){if(new.target)return ze({component:lt,...i});Ee(t,!0);let o=g(t,"videoUrl",7),c=g(t,"videoName",7),s=g(t,"sourceKind",7),_=g(t,"mimeType",7),h=g(t,"open",15,!1),I=g(t,"triggerClass",7),C=g(t,"contentClass",7);const T=$(()=>Ze(o())),w=$(()=>Ye(o())),L=$(()=>s()??(e(T)?"inline":e(w)?"workspace":"remote"));let S=se(null),d=se(null),M=se(null),N=null;function b(){if(N===o())return;const n=N=o();P(S,null),P(d,null),P(M,e(T)?rt(e(T).base64):null,!0);const r=document.createElement("video");r.preload="metadata",r.onloadedmetadata=()=>{N===n&&(Number.isFinite(r.duration)&&r.duration>0&&P(S,r.duration,!0),r.videoWidth>0&&r.videoHeight>0&&P(d,{width:r.videoWidth,height:r.videoHeight},!0))},r.src=o(),e(T)||fetch(o()).then(m=>m.ok?m.blob():null).then(m=>{m&&N===n&&P(M,m.size,!0)}).catch(()=>{})}function O(){const n=e(w)?.path.split("/").pop();if(n)return n;const r=(c()||"video").replace(/[/\\]/g,"_");if(/\.[A-Za-z0-9]+$/.test(r))return r;const m=(_()??e(T)?.mimeType)==="video/webm"?"webm":"mp4";return`${r}.${m}`}async function K(){let n=null;try{let r=o();if(!e(T)){const l=await fetch(o());if(!l.ok)throw new Error(`Video fetch failed: ${l.status}`);n=URL.createObjectURL(await l.blob()),r=n}const m=document.createElement("a");m.href=r,m.download=O(),document.body.appendChild(m),m.click(),m.remove(),n&&URL.revokeObjectURL(n)}catch{n&&URL.revokeObjectURL(n),_e.error(u.ui_videoActionsMenu_downloadFailed_error())}}async function ae(n,r){try{await Re(n),_e.success(r)}catch{_e.error(u.ui_videoActionsMenu_copyFailed_error())}}xe(()=>{h()&&b()}),xe(()=>{if(h())return He(()=>{h(!1)})});var B={get videoUrl(){return o()},set videoUrl(n){o(n),v()},get videoName(){return c()},set videoName(n){c(n),v()},get sourceKind(){return s()},set sourceKind(n){s(n),v()},get mimeType(){return _()},set mimeType(n){_(n),v()},get open(){return h()},set open(n=!1){h(n),v()},get triggerClass(){return I()},set triggerClass(n){I(n),v()},get contentClass(){return C()},set contentClass(n){C(n),v()},$set:Ae,$on:(n,r)=>Ue(t,n,r)},G=we(),J=te(G);return me(J,()=>tt,(n,r)=>{r(n,{get open(){return h()},set open(m){h(m)},children:(m,l)=>{var f=tn(),k=te(f);{let R=$(()=>qe("flex h-7 w-7 items-center justify-center rounded-md bg-black/60 text-white","hover:bg-black/75",I())),Q=$(()=>u.ui_videoActionsMenu_trigger_ariaLabel());me(k,()=>Ge,(j,F)=>{F(j,{get class(){return e(R)},get"aria-label"(){return e(Q)},onclick:W=>W.stopPropagation(),children:(W,ce)=>{Qe(W,{class:"size-3.5"})},$$slots:{default:!0}})})}var z=E(k,2);me(z,()=>Je,(R,Q)=>{Q(R,{get class(){return C()},align:"end",children:(j,F)=>{var W=en(),ce=te(W);me(ce,()=>$e,(Z,ie)=>{ie(Z,{onSelect:()=>void K(),children:(fe,a)=>{Me();var p=Ie();Y(H=>ne(p,H),[()=>u.ui_videoActionsMenu_download_label()]),y(fe,p)},$$slots:{default:!0}})});var x=E(ce,2);{var re=Z=>{var ie=we(),fe=te(ie);me(fe,()=>$e,(a,p)=>{p(a,{onSelect:()=>void ae(e(w).path,u.ui_videoActionsMenu_pathCopied_label()),children:(H,ve)=>{Me();var A=Ie();Y(X=>ne(A,X),[()=>u.ui_videoActionsMenu_copyPath_label()]),y(H,A)},$$slots:{default:!0}})}),y(Z,ie)},D=Z=>{var ie=we(),fe=te(ie);me(fe,()=>$e,(a,p)=>{p(a,{onSelect:()=>void ae(o(),u.ui_videoActionsMenu_linkCopied_label()),children:(H,ve)=>{Me();var A=Ie();Y(X=>ne(A,X),[()=>u.ui_videoActionsMenu_copyLink_label()]),y(H,A)},$$slots:{default:!0}})}),y(Z,ie)};q(x,Z=>{e(L)==="workspace"&&e(w)?Z(re):e(L)==="remote"&&Z(D,1)})}var he=E(x,2);{var oe=Z=>{var ie=Qt(),fe=te(ie);me(fe,()=>et,(U,ee)=>{ee(U,{})});var a=E(fe,2);{var p=U=>{var ee=qt(),le=ye(ee,!0);Y(ue=>ne(le,ue),[()=>u.ui_videoActionsMenu_duration_label({duration:ht(e(S)*1e3)})]),y(U,ee)};q(a,U=>{e(S)!==null&&U(p)})}var H=E(a,2);{var ve=U=>{var ee=Gt(),le=ye(ee,!0);Y(ue=>ne(le,ue),[()=>u.ui_videoActionsMenu_dimensions_label({width:Ke(e(d).width),height:Ke(e(d).height)})]),y(U,ee)};q(H,U=>{e(d)&&U(ve)})}var A=E(H,2);{var X=U=>{var ee=Jt(),le=ye(ee,!0);Y(ue=>ne(le,ue),[()=>nt(e(M))]),y(U,ee)};q(A,U=>{e(M)!==null&&U(X)})}y(Z,ie)};q(he,Z=>{(e(S)!==null||e(d)||e(M)!==null)&&Z(oe)})}y(j,W)},$$slots:{default:!0}})}),y(m,f)},$$slots:{default:!0}})}),y(i,G),Te(B)}var nn=V('<p class="type-body text-white/80" role="status"> </p>'),an=V('<div data-media-lightbox-content="" data-video-lightbox-root="" class="flex max-h-[90vh] max-w-[90vw] cursor-default flex-col items-center gap-3"><video controls="" preload="metadata" playsinline="" class="max-h-[85vh] max-w-[90vw] rounded-lg bg-black object-contain shadow-(--elevation-overlay)" data-testid="chat-video-player"> </video> <!></div>',2);function rn(i,t){if(new.target)return ze({component:rn,...i});Ee(t,!0);const o=d=>{lt(d,{get videoUrl(){return s()},get videoName(){return _()},get sourceKind(){return I()},get mimeType(){return C()},triggerClass:"h-9 w-9 bg-white/0 hover:bg-white/20",contentClass:"z-[1003]"})};let c=g(t,"open",15,!1),s=g(t,"videoUrl",7),_=g(t,"videoName",23,()=>u.chat_videoBlock_fromAgent_label()),h=g(t,"poster",7),I=g(t,"sourceKind",7),C=g(t,"mimeType",7),T=g(t,"openerElement",7,null),w=g(t,"onClose",7),L=se(!1);xe(()=>{!c()||!s()||P(L,!1)});var S={get open(){return c()},set open(d=!1){c(d),v()},get videoUrl(){return s()},set videoUrl(d){s(d),v()},get videoName(){return _()},set videoName(d=u.chat_videoBlock_fromAgent_label()){_(d),v()},get poster(){return h()},set poster(d){h(d),v()},get sourceKind(){return I()},set sourceKind(d){I(d),v()},get mimeType(){return C()},set mimeType(d){C(d),v()},get openerElement(){return T()},set openerElement(d=null){T(d),v()},get onClose(){return w()},set onClose(d){w(d),v()},$set:Ae,$on:(d,M)=>Ue(t,d,M)};{let d=$(()=>u.chat_videoBlock_dialog_title({name:_()})),M=$(()=>u.chat_videoBlock_close_ariaLabel());Xe(i,{get ariaLabel(){return e(d)},get closeLabel(){return e(M)},get openerElement(){return T()},get onClose(){return w()},get actions(){return o},get open(){return c()},set open(N){c(N)},children:(N,b)=>{var O=an(),K=pe(O),ae=ye(K,!0),B=E(K,2);{var G=J=>{var n=nn(),r=ye(n,!0);Y(m=>ne(r,m),[()=>u.chat_videoBlock_unavailable_description()]),y(J,n)};q(B,J=>{e(L)&&J(G)})}ge(O),Y(J=>{ke(K,"src",s()),ke(K,"poster",h()),ke(K,"aria-label",_()),ne(ae,J)},[()=>u.chat_videoBlock_unsupported_description()]),Ne("error",K,()=>P(L,!0)),y(N,O)},$$slots:{default:!0}})}return Te(S)}var on=V('<span class="block truncate text-foreground"> </span>'),ln=V("<!> ",1),sn=V("<!> <!>",1),cn=V('<span class="flex shrink-0 flex-wrap items-center gap-1"><!> <!></span>'),un=V('<div class="type-caption flex w-fit min-w-0 max-w-full items-center gap-3 whitespace-normal py-1 text-muted-foreground" role="status" data-testid="media-unavailable"><span class="flex min-w-0 max-w-full flex-1 items-start gap-2"><span class="first-line-icon" aria-hidden="true"><!></span> <span class="min-w-0"><!> <span class="block break-words"> </span></span></span> <!></div>');function dn(i,t){if(new.target)return ze({component:dn,...i});Ee(t,!0);let o=g(t,"name",7),c=g(t,"reason",7),s=g(t,"path",7),_=g(t,"workspaceId",7),h=g(t,"onRetry",7);const I=$(()=>c()==="missing"?u.ui_mediaUnavailable_missing_description():c()==="unsupported"?u.ui_mediaUnavailable_unsupported_description():c()==="other-workspace"?u.ui_mediaUnavailable_otherWorkspace_description():c()==="invalid-link"?u.ui_mediaUnavailable_invalidLink_description():u.ui_mediaUnavailable_loadFailed_description());function C(r){r.preventDefault(),r.stopPropagation()}function T(r){C(r),h()?.()}async function w(r){if(C(r),!!s())try{await Re(s()),_e.success(u.ui_imageActionsMenu_pathCopied_label())}catch{_e.error(u.ui_imageActionsMenu_copyFailed_error())}}function L(r){if(C(r),!s()||!_())return;const m=s().split("/").map(encodeURIComponent).join("/");Et(`intent://local/file/${m}`,{workspaceId:ut(_())})}var S={get name(){return o()},set name(r){o(r),v()},get reason(){return c()},set reason(r){c(r),v()},get path(){return s()},set path(r){s(r),v()},get workspaceId(){return _()},set workspaceId(r){_(r),v()},get onRetry(){return h()},set onRetry(r){h(r),v()},$set:Ae,$on:(r,m)=>Ue(t,r,m)},d=un(),M=pe(d),N=pe(M),b=pe(N);Pe(b,{get icon(){return kt},class:"size-3.5"}),ge(N);var O=E(N,2),K=pe(O);{var ae=r=>{var m=on(),l=ye(m,!0);De(m,(f,k)=>Tt?.(f,k),o),Y(()=>ne(l,o())),y(r,m)};q(K,r=>{o()&&r(ae)})}var B=E(K,2),G=ye(B,!0);ge(O),ge(M);var J=E(M,2);{var n=r=>{var m=cn(),l=pe(m);{var f=R=>{{let Q=$(()=>u.chat_shared_retry_label());Le(R,{variant:"ghost",size:"icon-compact",get tooltip(){return e(Q)},onclick:T,children:(j,F)=>{Pe(j,{get icon(){return Ct},size:"xs"})},$$slots:{default:!0}})}};q(l,R=>{h()&&R(f)})}var k=E(l,2);{var z=R=>{var Q=sn(),j=te(Q);{var F=ce=>{Le(ce,{variant:"ghost",size:"compact",onclick:L,children:(x,re)=>{var D=ln(),he=te(D);Pe(he,{get icon(){return Lt},size:"xs"});var oe=E(he);Y(Z=>ne(oe,` ${Z??""}`),[()=>u.chat_changesPanel_openFile_tooltip()]),y(x,D)},$$slots:{default:!0}})};q(j,ce=>{_()&&c()!=="other-workspace"&&c()!=="invalid-link"&&ce(F)})}var W=E(j,2);{let ce=$(()=>u.ui_imageActionsMenu_copyPath_label());Le(W,{variant:"ghost",size:"icon-compact",get tooltip(){return e(ce)},onclick:w,children:(x,re)=>{Pe(x,{get icon(){return Pt},size:"xs"})},$$slots:{default:!0}})}y(R,Q)};q(k,R=>{s()&&R(z)})}ge(m),y(r,m)};q(J,r=>{(h()||s())&&r(n)})}return ge(d),Y(()=>{ke(d,"data-reason",c()),ne(G,e(I))}),y(i,d),Te(S)}export{ot as I,Xe as M,lt as V,it as Z,Yt as a,dn as b,rn as c,rt as d,Ft as e,Ve as f,St as m,Ye as p,Bn as r,jn as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as g,bo as n,br as v,bw as b,bp as h,b as x}from"./
|
|
1
|
+
import{t as g,bo as n,br as v,bw as b,bp as h,b as x}from"./DxxarOOi.js";import{bs as w,a7 as S,ay as y,aD as _,W as k,bn as z,aA as i,c9 as C}from"./3SdAC2_C.js";import{c as A}from"./CruJ4jyB.js";import{e as I,p as M}from"./Ch-D6DCZ.js";import{S as P}from"./BtdtsPJb.js";var W=new Set(["$$slots","$$events","$$legacy","ref","class","data-slot"]);function D(l,t){if(new.target)return g({component:D,...l});w(t,!0);let a=n(t,"ref",15,null),r=n(t,"class",7),s=n(t,"data-slot",7,"separator"),c=h(t,W);var m={get ref(){return a()},set ref(e=null){a(e),i()},get class(){return r()},set class(e){r(e),i()},get"data-slot"(){return s()},set"data-slot"(e="separator"){s(e),i()},$set:b,$on:(e,o)=>x(t,e,o)},p=S(),d=y(p);{let e=C(()=>I("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",r()));A(d,()=>P,(o,u)=>{u(o,v({get"data-slot"(){return s()},get class(){return _(e)}},()=>c,{get ref(){return a()},set ref(f){a(f)}}))})}return k(l,p),z(m)}const F=[{id:"separator-state-matrix",title:"Separator states",states:["horizontal","vertical","decorative","semantic","compact","zoom-200","light","dark"],themes:["light","dark","high-contrast"],viewport:"both"}];M({id:"separator",source:"src/lib/components/ui/separator/separator.svelte",publicImport:"$lib/components/ui/separator",legacyImports:["$lib/components/ui/separator/index.js"],exports:["Root","Separator","separatorMetadata"],category:"primitive",owner:"design-system",callers:["src/features/discussions/components/DiscussionMentionPicker.svelte","src/features/home/HomeAssistantThreads.svelte","src/features/workspace-sharing/components/WorkspaceSharingSetup.svelte","src/lib/component-catalog/renderers/ContentFieldCatalogPreview.svelte","src/lib/components/file-explorer/file-explorer-layout.svelte","src/lib/components/ui/sidebar/sidebar-separator.svelte","src/lib/components/workspace/WorkspaceAgentsList.svelte"],replacement:null,characterizationTest:"src/lib/components/ui/separator/separator.test.ts",removalGate:"Retain while exported and orientation, semantic, and fixture tests pass.",dynamicImports:[],fixtures:F});export{D as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jq as o,nW as d,nV as n,oN as i,bq as a,sa as S,pC as p,oK as k}from"./
|
|
1
|
+
import{Jq as o,nW as d,nV as n,oN as i,bq as a,sa as S,pC as p,oK as k}from"./Zs30783q.js";import{bl as g,b4 as m,dQ as v,dD as W,c as h,cR as I,cc as R}from"./BfdTnj-p.js";const w={status:"loading",members:[]},u=o.createSelector(e=>d(e.guestSessions.sessions)),K=o.createSelector(e=>e.guestSessions.hasReceivedList),l=o.createSelector(e=>n(e.guestSessions.sessions,e.connections.windowBackendId)??null);o.createSelector(e=>l.select(e)!==null);const M=o.createSelector(e=>e.guestSessions.openIds),F=o.createSelector(e=>e.guestSessions.connectedIds),O=o.createSelector(e=>e.guestSessions.leavingIds),P=o.createSelector(e=>e.guestSessions.leavingWorkspaceKeys),x=o.createSelector(e=>u.select(e).filter(s=>e.guestSessions.failedLeaveIds.includes(s.id))),B=o.createSelector(e=>u.select(e).flatMap(s=>(s.workspaces??[]).filter(t=>e.guestSessions.failedLeaveWorkspaceKeys.includes(i(s.id,t.id))).map(t=>({session:s,workspace:t})))),N=o.createSelector(e=>e.guestSessions.failedLeaveIds),q=o.createSelector(e=>d(e.guestSessions.sweepReports)),A=o.createSelector((e,s)=>n(e.guestSessions.sweepReports,s)),J=o.createSelector(e=>e.guestSessions.clearingWorkspaceIds),$=o.createSelector((e,s)=>n(e.workspace.workspaces,a(s))!==void 0),L=o.createSelector((e,s)=>e.guestSessions.hostedRosters[s]?.status==="withheld"?!1:n(e.workspace.workspaces,a(s))!==void 0&&g.select(e)&&m.select(e,s)),b=o.createSelector((e,s)=>{const t=n(e.workspace.workspaces,a(s));if(t?.openInviteCount!=null)return t.openInviteCount;const c=e.guestSessions.hostedRosters[s];return c?.guestCount!=null?Math.max(0,c.guestCount-c.members.filter(S).length):null}),j=o.createSelector(e=>e.workspace.error?"error":v.select(e,e.connections.windowBackendId)?"loaded":"loading"),D=o.createSelector(e=>{const s=W.select(e);return d(e.workspace.workspaces).filter(t=>{if(!s.collaborationReady||!h(s,t.id,()=>t))return!1;const c=b.select(e,t.id);if((t.memberCount??1/0)<=1&&c===0)return!1;const r=e.guestSessions.hostedRosters[t.id];return!r||r.status!=="loaded"?!0:r.members.some(S)||c===null||c>0})}),f=o.createSelector(e=>{const s=l.select(e),t=I.select(e);return u.select(e).filter(c=>{const r=s?.id===c.id&&t?.principal.id===c.principalId?R.select(e):null;return r?r!=="guest":c.hostRole==="member"})}),E=o.createSelector(e=>{const s=new Set(f.select(e).map(t=>t.id));return u.select(e).filter(t=>!s.has(t.id))}),U=o.createSelector(e=>e.guestSessions.listUnavailable),y=o.createSelector((e,s)=>e.guestSessions.hostedRosters[s]??w),V=o.createSelector((e,s)=>y.select(e,s).members.filter(t=>e.guestSessions.failedMemberKeys.includes(p(s,t.principalId)))),C=[],_=o.createSelector((e,s)=>{const t=p(s,""),c=e.guestSessions.removingMemberKeys.filter(r=>r.startsWith(t)).map(r=>r.slice(t.length));return c.length===0?C:c}),z=o.createSelector((e,s)=>e.guestSessions.clearingWorkspaceIds.includes(s)),Q=o.createSelector(e=>{const s=[];for(const[t,c]of Object.entries(e.guestSessions.hostedRosters)){if(c.status==="withheld")continue;const r=n(e.workspace.workspaces,a(t));!r||!L.select(e,t)||s.push(`${t}:${r.memberCount??0},${c.invalidation??0}`)}return s.sort()}),T=o.createSelector(e=>e.guestSessions.inheritedWorkspaceKeys),X=o.createSelector(e=>e.guestSessions.leaveConfirmations),Y=o.createSelector((e,s)=>k(n(e.guestSessions.sessions,s))),Z=o.createSelector((e,s)=>{if(!s||!g.select(e))return!1;const t=l.select(e);return!t||!(t.workspaces??[]).some(c=>c.id===s)||f.select(e).some(c=>c.id===t.id)||e.guestSessions.inheritedWorkspaceKeys.includes(i(t.id,s))?!1:n(e.workspace.workspaces,a(s))?.myRole!=="owner"}),ee=o.createSelector((e,s)=>{const t=l.select(e);return!!t&&e.guestSessions.selfLeaveWorkspaceKeys.includes(i(t.id,s))}),se=o.createSelector((e,s)=>{const t=l.select(e);return!!t&&e.guestSessions.leavingWorkspaceKeys.includes(i(t.id,s))});export{$ as A,se as B,ee as C,f as D,E,l as F,L as a,x as b,B as c,X as d,N as e,O as f,P as g,Y as h,u as i,F as j,K as k,M as l,U as m,J as n,V as o,b as p,_ as q,y as r,Z as s,Q as t,j as u,A as v,q as w,D as x,T as y,z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as Qe,bo as h,bw as Ye,b as $e,bq as nt,bm as w,bs as Ve}from"./C8Ie7Deo.js";import{bo as st,bs as et,a7 as L,ay as y,aD as e,bS as U,W as c,a5 as Pe,bA as De,bH as V,bl as _e,b_ as oe,bO as de,bn as tt,bf as je,bV as Ee,aA as v,c9 as k,aB as X,be as it,b$ as lt,bj as dt,cd as ct,ca as Je,bk as ut}from"./3SdAC2_C.js";import{i as G}from"./CL3a4Hm1.js";import{Jq as Le,ne as pt,vd as ft}from"./CKmtKxD0.js";import{aN as ht}from"./BsRM8yjb.js";import{cy as vt}from"./CReqoCJu.js";import{c as gt}from"./ChTqQfQN.js";import{i as Ue,t as Xe}from"./H2jLkRRS.js";import{w as _t}from"./Bqd7fdCF.js";import{d as mt}from"./B0Z-1lwJ.js";import{F as Re,aw as bt,ax as wt,cV as He,aZ as qe,bg as kt,ao as yt,an as At,cS as Ge}from"./Cuea3cpS.js";import{m as K,w as Ft}from"./hR-DaH6k.js";import{s as Ne,f as xe,c as Wt}from"./D41qh-5f.js";import{s as Ct}from"./FJqzUSSZ.js";import{w as xt}from"./Dk2HcklO.js";import"./cplLJoH8.js";import{i as M}from"./D6XIvyP3.js";import{g as It,e as Te}from"./DJbFr8xM.js";import{c as Z}from"./CB4UdDb9.js";import{a as Pt,r as Dt}from"./C-QKLo6O.js";import{f as Mt,aa as Et}from"./CHVFOL-2.js";import{t as Be}from"./DAsc1V4f.js";import{h as Ke,k as Ot,j as St,R as Rt,i as Nt,g as Tt,c as Bt,e as zt}from"./OnVz_1Np.js";import{M as Vt}from"./mFH5JSTn.js";import{m as ze}from"./CT1vJyZh.js";var jt=X('<img alt="" class="size-4"/>'),Jt=X('<span class="min-w-0 flex-1 text-left"><span class="block truncate"> </span> <span class="block text-muted-foreground" aria-hidden="true" data-menu-action-reason=""> </span></span>'),Lt=X("<span> </span>"),Ut=X('<span data-menu-action-detail=""> </span>'),Xt=X('<span aria-hidden="true"><!></span>'),Ze=X("<!> <!> <!>",1),Ht=X('<div class="my-1 h-px bg-border" role="separator"></div>'),Me=X("<!> <!>",1),qt=X('<!> <p data-menu-action-note=""> </p>',1),Gt=X('<span class="flex size-4 shrink-0 items-center justify-center" aria-hidden="true"><!></span> <!> <!>',1),Kt=X('<p data-menu-action-note=""> </p>'),Zt=X('<div class="pl-4"><!> <!></div>'),Qt=X('<span class="sr-only"> </span>');function me(be,d){const we=st();if(new.target)return Qe({component:me,...be});et(d,!0);const Ie=(p,r=je)=>{var O=L(),S=y(O);{var j=W=>{const x=k(()=>Pt(r().editor));var J=L(),m=y(J);{var f=s=>{var i=jt();oe(()=>Ne(i,"src",`data:image/png;base64,${r().editor.iconBase64??""}`)),c(s,i)},o=s=>{var i=L(),b=y(i);Z(b,()=>e(x),(T,ae)=>{ae(T,{size:16})}),c(s,i)},N=s=>{{let i=k(()=>Dt(r().editor.category));Re(s,{get icon(){return e(i)},size:16})}};M(m,s=>{r().editor.iconBase64?s(f):e(x)?s(o,1):s(N,-1)})}c(W,J)},R=W=>{var x=L(),J=y(x);Ct(J,()=>r().iconSnippet),c(W,x)},q=W=>{{let x=k(()=>r().variant==="destructive"?"text-current":"text-muted-foreground");Re(W,{get icon(){return r().icon},get weight(){return H()},size:16,get class(){return e(x)}})}};M(S,W=>{r().editor?W(j):r().iconSnippet?W(R,1):r().icon&&W(q,2)})}c(p,O)},ne=(p,r=je)=>{var O=Ze(),S=y(O);{var j=m=>{var f=Jt(),o=Pe(f),N=_e(o,!0);Te(o,(b,T)=>Be?.(b,T),()=>r().label);var s=U(o,2),i=_e(s,!0);De(f),oe(()=>{de(N,r().label),de(i,r().disabledReason)}),c(m,f)},R=m=>{var f=Lt(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().label),oe(()=>{xe(f,1,`min-w-0 truncate text-left ${r().detail?"flex-[1_0_auto]":"flex-1"}`),de(o,r().label)}),c(m,f)};M(S,m=>{r().disabledReason?m(j):m(R,-1)})}var q=U(S,2);{var W=m=>{var f=Ut(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().detail),oe(()=>{xe(f,1,`ml-4 min-w-0 truncate ${(r().detailTone==="danger"?"text-danger":ze)??""}`),de(o,r().detail)}),c(m,f)};M(q,m=>{r().detail&&m(W)})}var x=U(q,2);{var J=m=>{var f=Xt(),o=Pe(f);Et(o,{children:(N,s)=>{it();var i=lt();oe(b=>de(i,b),[()=>xt(r().shortcut)]),c(N,i)},$$slots:{default:!0}}),De(f),oe(()=>xe(f,1,Wt(E()?"ml-4 flex h-lh shrink-0 items-center":"ml-4"))),c(m,f)};M(x,m=>{r().shortcut&&m(J)})}c(p,O)};let ke=h(d,"actions",7),E=h(d,"menu",7),H=h(d,"iconWeight",7),u=h(d,"onClose",7),A=h(d,"selection",7),F=Ee(null);function Q(p){p.disabled||p.disabledReason!==void 0||(p.onClick(),u()?.())}var ce={get actions(){return ke()},set actions(p){ke(p),v()},get menu(){return E()},set menu(p){E(p),v()},get iconWeight(){return H()},set iconWeight(p){H(p),v()},get onClose(){return u()},set onClose(p){u(p),v()},get selection(){return A()},set selection(p){A(p),v()},$set:Ye,$on:(p,r)=>$e(d,p,r)},se=L(),ie=y(se);return It(ie,17,ke,p=>p.id,(p,r)=>{const O=i=>{Ie(i,()=>e(r))},S=k(()=>!!(e(r).editor||e(r).iconSnippet||e(r).icon)),j=k(()=>e(r).disabled||e(r).disabledReason!==void 0),R=k(()=>e(r).disabledReason?`${we}-${e(r).id}-reason`:void 0);var q=Ze(),W=y(q);{var x=i=>{var b=L(),T=y(b);{var ae=a=>{var n=L(),g=y(n);Z(g,()=>Ke,(C,P)=>{P(C,{})}),c(a,n)},ue=a=>{var n=Ht();c(a,n)};M(T,a=>{E()?a(ae):a(ue,-1)})}c(i,b)};M(W,i=>{e(r).dividerBefore&&i(x)})}var J=U(W,2);{var m=i=>{var b=L(),T=y(b);{var ae=g=>{var C=L(),P=y(C);Z(P,()=>Nt,(I,D)=>{D(I,{children:(B,Y)=>{var $=Me(),pe=y($);{let te=k(()=>e(S)?O:void 0);Z(pe,()=>Ot,(fe,he)=>{he(fe,{get leading(){return e(te)},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},get"data-action-id"(){return e(r).id},children:(ve,ye)=>{ne(ve,()=>e(r))},$$slots:{default:!0}})})}var ee=U(pe,2);{let te=k(()=>e(r).note?`${we}-${e(r).id}-note`:void 0);Z(ee,()=>St,(fe,he)=>{he(fe,{class:"w-60",get"aria-describedby"(){return e(te)},children:(ve,ye)=>{var t=Me(),l=y(t);{var _=re=>{var Ae=Me(),Fe=y(Ae);{let Ce=k(()=>e(r).submenu.find(ge=>ge.checked)?.id??"");Z(Fe,()=>Rt,(ge,Se)=>{Se(ge,{get value(){return e(Ce)},get"aria-label"(){return e(r).label},children:(rt,$t)=>{{let at=k(()=>e(r).submenu.filter(ot=>ot.checked!==void 0));me(rt,{get actions(){return e(at)},selection:"single",get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})}},$$slots:{default:!0}})})}var We=U(Fe,2);{let Ce=k(()=>e(r).submenu.filter(ge=>ge.checked===void 0));me(We,{get actions(){return e(Ce)},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})}c(re,Ae)},z=re=>{me(re,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})};M(l,re=>{e(r).selection==="single"?re(_):re(z,-1)})}var le=U(l,2);{var Oe=re=>{var Ae=qt(),Fe=y(Ae);Z(Fe,()=>Ke,(ge,Se)=>{Se(ge,{})});var We=U(Fe,2),Ce=_e(We,!0);oe(()=>{Ne(We,"id",`${we}-${e(r).id}-note`),xe(We,1,`type-caption px-2 py-1 ${ze}`),de(Ce,e(r).note)}),c(re,Ae)};M(le,re=>{e(r).note&&re(Oe)})}c(ve,t)},$$slots:{default:!0}})})}c(B,$)},$$slots:{default:!0}})}),c(g,C)},ue=g=>{var C=L(),P=y(C);{let I=k(()=>e(S)?O:void 0);Z(P,()=>Tt,(D,B)=>{B(D,{get leading(){return e(I)},get value(){return e(r).id},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Q(e(r)),get"data-action-id"(){return e(r).id},children:(Y,$)=>{ne(Y,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},a=g=>{var C=L(),P=y(C);{let I=k(()=>e(S)?O:void 0);Z(P,()=>Bt,(D,B)=>{B(D,{get leading(){return e(I)},get checked(){return e(r).checked},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Q(e(r)),get"data-action-id"(){return e(r).id},children:(Y,$)=>{ne(Y,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},n=g=>{var C=L(),P=y(C);{let I=k(()=>e(S)?O:void 0),D=k(()=>e(r).variant==="destructive");Z(P,()=>zt,(B,Y)=>{Y(B,{get leading(){return e(I)},get destructive(){return e(D)},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},onSelect:()=>Q(e(r)),get"data-action-id"(){return e(r).id},children:($,pe)=>{ne($,()=>e(r))},$$slots:{default:!0}})})}c(g,C)};M(T,g=>{e(r).submenu?g(ae):A()==="single"&&e(r).checked!==void 0?g(ue,1):e(r).checked!==void 0?g(a,2):g(n,-1)})}c(i,b)},f=i=>{me(i,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})},o=i=>{var b=Me(),T=y(b);{let a=k(()=>e(r).variant==="destructive"?"text-danger hover:text-danger":""),n=k(()=>e(r).submenu?e(F)===e(r).id:void 0);Mt(T,{variant:"ghost",size:"sm",get class(){return`w-full justify-start gap-2 ${e(a)??""}`},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},get"aria-expanded"(){return e(n)},onclick:()=>e(r).submenu?V(F,e(F)===e(r).id?null:e(r).id,!0):Q(e(r)),children:(g,C)=>{var P=Gt(),I=y(P),D=Pe(I);Ie(D,()=>e(r)),De(I);var B=U(I,2);ne(B,()=>e(r));var Y=U(B,2);{var $=ee=>{{let te=k(()=>e(F)===e(r).id?bt:wt);Re(ee,{get icon(){return e(te)},size:12})}},pe=ee=>{var te=L(),fe=y(te);{let he=k(()=>e(r).checked?"checked":"empty");Z(fe,()=>Vt,(ve,ye)=>{ye(ve,{get state(){return e(he)}})})}c(ee,te)};M(Y,ee=>{e(r).submenu?ee($):e(r).checked!==void 0&&ee(pe,1)})}c(g,P)},$$slots:{default:!0}})}var ae=U(T,2);{var ue=a=>{var n=Zt(),g=Pe(n);me(g,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}});var C=U(g,2);{var P=I=>{var D=Kt(),B=_e(D,!0);oe(()=>{xe(D,1,`type-caption px-2 py-1 ${ze}`),de(B,e(r).note)}),c(I,D)};M(C,I=>{e(r).note&&I(P)})}De(n),c(a,n)};M(ae,a=>{e(r).submenu&&e(F)===e(r).id&&a(ue)})}c(i,b)};M(J,i=>{E()?i(m):e(r).id==="open-in"&&e(r).submenu?i(f,1):i(o,-1)})}var N=U(J,2);{var s=i=>{var b=Qt(),T=_e(b,!0);oe(()=>{Ne(b,"id",e(R)),de(T,e(r).disabledReason)}),c(i,b)};M(N,i=>{e(r).disabledReason&&i(s)})}c(p,q)}),c(be,se),tt(ce)}function Yt(be,d){if(new.target)return Qe({component:Yt,...be});et(d,!0);const we=()=>Ve(T,"$installedEditors$",ne),Ie=()=>Ve(ue,"$isWorkspaceHostLocal$",ne),[ne,ke]=nt();let E=h(d,"layout",7,"list"),H=h(d,"iconWeight",7),u=h(d,"filePath",7,""),A=h(d,"workspaceId",7,""),F=h(d,"isDirectory",7,!0),Q=h(d,"onDelete",7,void 0),ce=h(d,"onArchive",7,void 0),se=h(d,"onUnarchive",7,void 0),ie=h(d,"isArchived",7,!1),p=h(d,"onClose",7,void 0),r=h(d,"showDeleteOption",7,!0),O=h(d,"showArchiveOption",7,!1),S=h(d,"showPathCopy",7,!0),j=h(d,"showFileNameCopy",7,!1),R=h(d,"showFileActions",7,!0),q=h(d,"workspaceFolderPath",7,""),W=h(d,"isDiff",7,!1),x=h(d,"isWorkspaceRoot",7,!1),J=h(d,"additionalActions",23,()=>[]),m=h(d,"showDeleteFileOption",7,!1),f=h(d,"onFileDeleted",7,void 0);const o=gt("WorkspaceActionsMenu");let N=!1;dt(()=>{N=!0});function s(){N||p()?.()}const i=_t("externalEditors"),b=ct(A());Je(()=>{b.set(A())});const T=ht(b),ae=k(we),ue=vt(b);let a=Ee(""),n=Ee(""),g=Ee(!1);ut(()=>{Le.dispatch(pt())}),Je(()=>{u()&&A()?G("workspace:get",{id:A()}).then(t=>{if(t&&t.success&&t.data){const l=t.data,_=l.worktreePath||l.repositoryPath||l.path,z=q()==="__WORKSPACE_ROOT__"?_:q()||_;if(z){const le=z.replace(/\\/g,"/");x()?V(a,le,!0):Ue(u())?V(a,u().replace(/\\/g,"/"),!0):V(a,`${le}/${u()}`.replace(/\/+/g,"/"),!0),V(n,le,!0),o.info("[WorkspaceActionsMenu] Resolved file path:",{filePath:u(),workspacePath:z,resolvedPath:e(a)})}else V(a,u()),V(n,""),l.status!=="archived"&&l.status!=="deleted"&&o.warn("[WorkspaceActionsMenu] No workspace path found:",l)}else V(a,u()),V(n,""),t?.error&&!t.error.includes("not found")&&o.warn("[WorkspaceActionsMenu] Workspace not available:",t)}).catch(t=>{V(a,u()),V(n,""),t?.message?.includes("not found")||o.error("[WorkspaceActionsMenu] Failed to resolve path:",t)}):(V(a,u()),o.info("[WorkspaceActionsMenu] Using filePath directly:",{filePath:u(),workspaceId:A()}))});async function C(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for VSCode");return}try{if(W()&&!F()){o.info("[WorkspaceActionsMenu] Opening diff in VSCode:",{resolvedPath:e(a)}),await G("vscode:open-git-diff",{filePath:e(a),workspacePath:e(n)||void 0}),s();return}let t=e(a);if(e(n))!F()&&!x()?t={folder:e(n),file:e(a)}:t=e(n);else if(!F()){const l=e(a).includes("\\")?"\\":"/",_=e(a).split(l);_.length>1&&(t={folder:_.slice(0,-1).join(l),file:e(a)})}await G("vscode:open",t),s()}catch(t){o.error("Failed to open in VSCode:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openFailed_error({name:"VS Code"}))}}async function P(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for JetBrains");return}try{let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t=e(n)),await G("jetbrains:open",t),s()}catch(t){o.error("Failed to open in JetBrains:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openFailed_error({name:"JetBrains"}))}}async function I(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for Xcode");return}try{if(A()&&e(n)){Le.dispatch(ft(A(),e(n),F()?void 0:e(a))),s();return}let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t={folder:e(n)}),await G("xcode:open",t),s()}catch(t){o.error("Failed to open in Xcode:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openFailed_error({name:"Xcode"}))}}async function D(t){if(o.info("[WorkspaceActionsMenu] openInEditor called",{editorId:t.id,appName:t.appName,handlerType:t.handlerType,resolvedPath:e(a),isDirectory:F()}),!e(a)){o.warn("[WorkspaceActionsMenu] openInEditor: No resolved path, aborting");return}const l=F()?e(a):e(a).substring(0,e(a).lastIndexOf("/"));o.info(`[WorkspaceActionsMenu] openInEditor: targetPath=${l}, handlerType=${t.handlerType}`);try{switch(t.handlerType){case"finder":o.info("[WorkspaceActionsMenu] openInEditor: Invoking shell:showItemInFolder"),await G("shell:showItemInFolder",{path:l});break;case"vscode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInVSCode"),await C();return;case"jetbrains":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInJetBrains"),await P();return;case"xcode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInXcode"),await I();return;case"generic":default:{o.info(`[WorkspaceActionsMenu] openInEditor: Invoking external-editors:open for ${t.id}`);const _=await G("external-editors:open",{editorId:t.id,path:l});o.info("[WorkspaceActionsMenu] openInEditor: external-editors:open result",_);break}}s()}catch(_){o.error(`[WorkspaceActionsMenu] Failed to open in ${t.appName}:`,_),K.error(_ instanceof Error?_.message:w.ui_workspaceActions_openFailed_error({name:t.appName}))}}async function B(){if(!e(a)){o.warn("No resolved path for openWithOther");return}try{let t=e(a);F()&&e(n)&&(t=e(n));const l=await G("external-editors:open-with-other",{path:t});if(!l?.success){l?.error!=="No application selected"&&(o.error("Failed to open with other app:",l?.error),K.error(l?.error||w.ui_workspaceActions_openOtherFailed_error()));return}s()}catch(t){o.error("Failed to open with other app:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openOtherFailed_error())}}async function Y(){if(e(a))try{await navigator.clipboard.writeText(Xe(e(a))),s()}catch(t){o.error("Failed to copy path:",t)}}async function $(){if(u())try{let t=u().replace(/\\/g,"/");if(Ue(u())&&e(n)){const l=e(n).endsWith("/")?e(n):e(n)+"/";t.startsWith(l)&&(t=t.slice(l.length))}await navigator.clipboard.writeText(Xe(t)),s()}catch(t){o.error("Failed to copy workspace path:",t)}}async function pe(){if(u())try{const t=u().split(/[/\\]/).pop()||"";await navigator.clipboard.writeText(t),s()}catch(t){o.error("Failed to copy file name:",t)}}function ee(){Q()&&(Q()(),s())}async function te(){if(!(!A()||!e(a)||e(g))){V(g,!0);try{const t=u().split(/[/\\]/).pop()||"file",l=e(a);let _="";try{_=(await G("file:read",{path:l,workspaceId:A()}))?.data?.content??""}catch{}const z=await G("file:delete",{path:l,workspaceId:A()});if(z?.success){f()?.(),s();const le=K.warning(w.ui_workspaceActions_deletedFile_label({name:t}),Ft({duration:15e3,action:{label:w.ui_workspaceActions_undo_label(),onClick:async()=>{try{await G("file:write",{path:l,content:_,workspaceId:A()}),mt("file:changed",{workspaceId:A(),type:"create",filePath:l}),K.dismiss(le)}catch(Oe){o.error("[WorkspaceActionsMenu] Failed to restore file",Oe),K.error(w.ui_workspaceActions_restoreFileFailed_error())}}}}))}else K.error(w.ui_workspaceActions_deleteFileFailedDetail_error({error:z?.error||w.ui_workspaceActions_unknown_error()}))}catch(t){o.error("[WorkspaceActionsMenu] Error deleting file",t),K.error(w.ui_workspaceActions_deleteFileFailed_error())}finally{V(g,!1)}}}function fe(){ie()&&se()?(se()(),s()):!ie()&&ce()&&(ce()(),s())}const he=k(()=>{const t=[];R()&&(i&&Ie()&&t.push({id:"open-in",label:w.ui_openCombo_openInApp_tooltip(),icon:He,onClick:()=>{},submenu:[...e(ae).map(_=>({id:`editor:${_.id}`,label:w.ui_workspaceActions_openIn_label({name:_.name}),editor:_,onClick:()=>{D(_)}})),{id:"choose-app",label:w.ui_workspaceActions_chooseApp_label(),icon:He,onClick:()=>{B()}}]}),S()&&t.push({id:"copy-absolute-path",label:w.ui_workspaceActions_copyAbsolutePath_label(),icon:qe,disabled:!e(a),dividerBefore:t.length>0,onClick:()=>{Y()}}),S()&&!x()&&t.push({id:"copy-relative-path",label:w.ui_workspaceActions_copyRelativePath_label(),icon:qe,disabled:!u(),onClick:()=>{$()}}),j()&&!F()&&t.push({id:"copy-file-name",label:w.ui_workspaceActions_copyFileName_label(),icon:kt,disabled:!u(),onClick:()=>{pe()}}));const l=_=>_.map(z=>({...z,submenu:z.submenu?l(z.submenu):void 0,onClick:()=>{z.onClick(),s()}}));return t.push(...l(J())),O()&&(ce()||se())&&t.push({id:"archive-workspace",label:ie()?w.ui_workspaceActions_unarchiveSpace_label():w.ui_workspaceActions_archiveSpace_label(),icon:ie()?yt:At,dividerBefore:t.length>0,onClick:fe}),r()&&Q()&&t.push({id:"delete-workspace",label:w.ui_workspaceActions_deleteSpace_label(),icon:Ge,variant:"destructive",dividerBefore:t.length>0&&t.at(-1)?.id!=="archive-workspace",onClick:ee}),m()&&!F()&&t.push({id:"delete-file",label:w.ui_workspaceActions_deleteFile_label(),icon:Ge,variant:"destructive",disabled:e(g)||!e(a)||!A(),dividerBefore:t.length>0,onClick:()=>{te()}}),t});var ve={get layout(){return E()},set layout(t="list"){E(t),v()},get iconWeight(){return H()},set iconWeight(t){H(t),v()},get filePath(){return u()},set filePath(t=""){u(t),v()},get workspaceId(){return A()},set workspaceId(t=""){A(t),v()},get isDirectory(){return F()},set isDirectory(t=!0){F(t),v()},get onDelete(){return Q()},set onDelete(t=void 0){Q(t),v()},get onArchive(){return ce()},set onArchive(t=void 0){ce(t),v()},get onUnarchive(){return se()},set onUnarchive(t=void 0){se(t),v()},get isArchived(){return ie()},set isArchived(t=!1){ie(t),v()},get onClose(){return p()},set onClose(t=void 0){p(t),v()},get showDeleteOption(){return r()},set showDeleteOption(t=!0){r(t),v()},get showArchiveOption(){return O()},set showArchiveOption(t=!1){O(t),v()},get showPathCopy(){return S()},set showPathCopy(t=!0){S(t),v()},get showFileNameCopy(){return j()},set showFileNameCopy(t=!1){j(t),v()},get showFileActions(){return R()},set showFileActions(t=!0){R(t),v()},get workspaceFolderPath(){return q()},set workspaceFolderPath(t=""){q(t),v()},get isDiff(){return W()},set isDiff(t=!1){W(t),v()},get isWorkspaceRoot(){return x()},set isWorkspaceRoot(t=!1){x(t),v()},get additionalActions(){return J()},set additionalActions(t=[]){J(t),v()},get showDeleteFileOption(){return m()},set showDeleteFileOption(t=!1){m(t),v()},get onFileDeleted(){return f()},set onFileDeleted(t=void 0){f(t),v()},$set:Ye,$on:(t,l)=>$e(d,t,l)};{let t=k(()=>E()!=="list");me(be,{get actions(){return e(he)},get menu(){return e(t)},get iconWeight(){return H()}})}var ye=tt(ve);return ke(),ye}export{Yt as default};
|
|
1
|
+
import{t as Qe,bo as h,bw as Ye,b as $e,bq as nt,bm as w,bs as Ve}from"./DxxarOOi.js";import{bo as st,bs as et,a7 as L,ay as y,aD as e,bS as U,W as c,a5 as Pe,bA as De,bH as V,bl as _e,b_ as oe,bO as de,bn as tt,bf as je,bV as Ee,aA as v,c9 as k,aB as X,be as it,b$ as lt,bj as dt,cd as ct,ca as Je,bk as ut}from"./3SdAC2_C.js";import{i as G}from"./CL3a4Hm1.js";import{Jq as Le,ne as pt,vd as ft}from"./Zs30783q.js";import{aN as ht}from"./CPc9hi45.js";import{cy as vt}from"./BfdTnj-p.js";import{c as gt}from"./ChTqQfQN.js";import{i as Ue,t as Xe}from"./H2jLkRRS.js";import{w as _t}from"./Bqd7fdCF.js";import{d as mt}from"./B0Z-1lwJ.js";import{F as Re,aw as bt,ax as wt,cV as He,aZ as qe,bg as kt,ao as yt,an as At,cS as Ge}from"./B5yEHkSy.js";import{m as K,w as Ft}from"./DkkzFfYK.js";import{s as Ne,f as xe,c as Wt}from"./Ch-D6DCZ.js";import{s as Ct}from"./C600Ggsz.js";import{w as xt}from"./BfQPFCP7.js";import"./BWsFbeUj.js";import{i as M}from"./DzAQQ1i-.js";import{g as It,e as Te}from"./BUT4El0L.js";import{c as Z}from"./CruJ4jyB.js";import{a as Pt,r as Dt}from"./DUGzdx5G.js";import{f as Mt,aa as Et}from"./D5eCb9SA.js";import{t as Be}from"./DAsc1V4f.js";import{h as Ke,k as Ot,j as St,R as Rt,i as Nt,g as Tt,c as Bt,e as zt}from"./CvP7-iXZ.js";import{M as Vt}from"./BLKGmMKH.js";import{m as ze}from"./BrfF5NLx.js";var jt=X('<img alt="" class="size-4"/>'),Jt=X('<span class="min-w-0 flex-1 text-left"><span class="block truncate"> </span> <span class="block text-muted-foreground" aria-hidden="true" data-menu-action-reason=""> </span></span>'),Lt=X("<span> </span>"),Ut=X('<span data-menu-action-detail=""> </span>'),Xt=X('<span aria-hidden="true"><!></span>'),Ze=X("<!> <!> <!>",1),Ht=X('<div class="my-1 h-px bg-border" role="separator"></div>'),Me=X("<!> <!>",1),qt=X('<!> <p data-menu-action-note=""> </p>',1),Gt=X('<span class="flex size-4 shrink-0 items-center justify-center" aria-hidden="true"><!></span> <!> <!>',1),Kt=X('<p data-menu-action-note=""> </p>'),Zt=X('<div class="pl-4"><!> <!></div>'),Qt=X('<span class="sr-only"> </span>');function me(be,d){const we=st();if(new.target)return Qe({component:me,...be});et(d,!0);const Ie=(p,r=je)=>{var O=L(),S=y(O);{var j=W=>{const x=k(()=>Pt(r().editor));var J=L(),m=y(J);{var f=s=>{var i=jt();oe(()=>Ne(i,"src",`data:image/png;base64,${r().editor.iconBase64??""}`)),c(s,i)},o=s=>{var i=L(),b=y(i);Z(b,()=>e(x),(T,ae)=>{ae(T,{size:16})}),c(s,i)},N=s=>{{let i=k(()=>Dt(r().editor.category));Re(s,{get icon(){return e(i)},size:16})}};M(m,s=>{r().editor.iconBase64?s(f):e(x)?s(o,1):s(N,-1)})}c(W,J)},R=W=>{var x=L(),J=y(x);Ct(J,()=>r().iconSnippet),c(W,x)},q=W=>{{let x=k(()=>r().variant==="destructive"?"text-current":"text-muted-foreground");Re(W,{get icon(){return r().icon},get weight(){return H()},size:16,get class(){return e(x)}})}};M(S,W=>{r().editor?W(j):r().iconSnippet?W(R,1):r().icon&&W(q,2)})}c(p,O)},ne=(p,r=je)=>{var O=Ze(),S=y(O);{var j=m=>{var f=Jt(),o=Pe(f),N=_e(o,!0);Te(o,(b,T)=>Be?.(b,T),()=>r().label);var s=U(o,2),i=_e(s,!0);De(f),oe(()=>{de(N,r().label),de(i,r().disabledReason)}),c(m,f)},R=m=>{var f=Lt(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().label),oe(()=>{xe(f,1,`min-w-0 truncate text-left ${r().detail?"flex-[1_0_auto]":"flex-1"}`),de(o,r().label)}),c(m,f)};M(S,m=>{r().disabledReason?m(j):m(R,-1)})}var q=U(S,2);{var W=m=>{var f=Ut(),o=_e(f,!0);Te(f,(N,s)=>Be?.(N,s),()=>r().detail),oe(()=>{xe(f,1,`ml-4 min-w-0 truncate ${(r().detailTone==="danger"?"text-danger":ze)??""}`),de(o,r().detail)}),c(m,f)};M(q,m=>{r().detail&&m(W)})}var x=U(q,2);{var J=m=>{var f=Xt(),o=Pe(f);Et(o,{children:(N,s)=>{it();var i=lt();oe(b=>de(i,b),[()=>xt(r().shortcut)]),c(N,i)},$$slots:{default:!0}}),De(f),oe(()=>xe(f,1,Wt(E()?"ml-4 flex h-lh shrink-0 items-center":"ml-4"))),c(m,f)};M(x,m=>{r().shortcut&&m(J)})}c(p,O)};let ke=h(d,"actions",7),E=h(d,"menu",7),H=h(d,"iconWeight",7),u=h(d,"onClose",7),A=h(d,"selection",7),F=Ee(null);function Q(p){p.disabled||p.disabledReason!==void 0||(p.onClick(),u()?.())}var ce={get actions(){return ke()},set actions(p){ke(p),v()},get menu(){return E()},set menu(p){E(p),v()},get iconWeight(){return H()},set iconWeight(p){H(p),v()},get onClose(){return u()},set onClose(p){u(p),v()},get selection(){return A()},set selection(p){A(p),v()},$set:Ye,$on:(p,r)=>$e(d,p,r)},se=L(),ie=y(se);return It(ie,17,ke,p=>p.id,(p,r)=>{const O=i=>{Ie(i,()=>e(r))},S=k(()=>!!(e(r).editor||e(r).iconSnippet||e(r).icon)),j=k(()=>e(r).disabled||e(r).disabledReason!==void 0),R=k(()=>e(r).disabledReason?`${we}-${e(r).id}-reason`:void 0);var q=Ze(),W=y(q);{var x=i=>{var b=L(),T=y(b);{var ae=a=>{var n=L(),g=y(n);Z(g,()=>Ke,(C,P)=>{P(C,{})}),c(a,n)},ue=a=>{var n=Ht();c(a,n)};M(T,a=>{E()?a(ae):a(ue,-1)})}c(i,b)};M(W,i=>{e(r).dividerBefore&&i(x)})}var J=U(W,2);{var m=i=>{var b=L(),T=y(b);{var ae=g=>{var C=L(),P=y(C);Z(P,()=>Nt,(I,D)=>{D(I,{children:(B,Y)=>{var $=Me(),pe=y($);{let te=k(()=>e(S)?O:void 0);Z(pe,()=>Ot,(fe,he)=>{he(fe,{get leading(){return e(te)},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},get"data-action-id"(){return e(r).id},children:(ve,ye)=>{ne(ve,()=>e(r))},$$slots:{default:!0}})})}var ee=U(pe,2);{let te=k(()=>e(r).note?`${we}-${e(r).id}-note`:void 0);Z(ee,()=>St,(fe,he)=>{he(fe,{class:"w-60",get"aria-describedby"(){return e(te)},children:(ve,ye)=>{var t=Me(),l=y(t);{var _=re=>{var Ae=Me(),Fe=y(Ae);{let Ce=k(()=>e(r).submenu.find(ge=>ge.checked)?.id??"");Z(Fe,()=>Rt,(ge,Se)=>{Se(ge,{get value(){return e(Ce)},get"aria-label"(){return e(r).label},children:(rt,$t)=>{{let at=k(()=>e(r).submenu.filter(ot=>ot.checked!==void 0));me(rt,{get actions(){return e(at)},selection:"single",get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})}},$$slots:{default:!0}})})}var We=U(Fe,2);{let Ce=k(()=>e(r).submenu.filter(ge=>ge.checked===void 0));me(We,{get actions(){return e(Ce)},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})}c(re,Ae)},z=re=>{me(re,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})};M(l,re=>{e(r).selection==="single"?re(_):re(z,-1)})}var le=U(l,2);{var Oe=re=>{var Ae=qt(),Fe=y(Ae);Z(Fe,()=>Ke,(ge,Se)=>{Se(ge,{})});var We=U(Fe,2),Ce=_e(We,!0);oe(()=>{Ne(We,"id",`${we}-${e(r).id}-note`),xe(We,1,`type-caption px-2 py-1 ${ze}`),de(Ce,e(r).note)}),c(re,Ae)};M(le,re=>{e(r).note&&re(Oe)})}c(ve,t)},$$slots:{default:!0}})})}c(B,$)},$$slots:{default:!0}})}),c(g,C)},ue=g=>{var C=L(),P=y(C);{let I=k(()=>e(S)?O:void 0);Z(P,()=>Tt,(D,B)=>{B(D,{get leading(){return e(I)},get value(){return e(r).id},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Q(e(r)),get"data-action-id"(){return e(r).id},children:(Y,$)=>{ne(Y,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},a=g=>{var C=L(),P=y(C);{let I=k(()=>e(S)?O:void 0);Z(P,()=>Bt,(D,B)=>{B(D,{get leading(){return e(I)},get checked(){return e(r).checked},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},closeOnSelect:!0,onSelect:()=>Q(e(r)),get"data-action-id"(){return e(r).id},children:(Y,$)=>{ne(Y,()=>e(r))},$$slots:{default:!0}})})}c(g,C)},n=g=>{var C=L(),P=y(C);{let I=k(()=>e(S)?O:void 0),D=k(()=>e(r).variant==="destructive");Z(P,()=>zt,(B,Y)=>{Y(B,{get leading(){return e(I)},get destructive(){return e(D)},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},onSelect:()=>Q(e(r)),get"data-action-id"(){return e(r).id},children:($,pe)=>{ne($,()=>e(r))},$$slots:{default:!0}})})}c(g,C)};M(T,g=>{e(r).submenu?g(ae):A()==="single"&&e(r).checked!==void 0?g(ue,1):e(r).checked!==void 0?g(a,2):g(n,-1)})}c(i,b)},f=i=>{me(i,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}})},o=i=>{var b=Me(),T=y(b);{let a=k(()=>e(r).variant==="destructive"?"text-danger hover:text-danger":""),n=k(()=>e(r).submenu?e(F)===e(r).id:void 0);Mt(T,{variant:"ghost",size:"sm",get class(){return`w-full justify-start gap-2 ${e(a)??""}`},get disabled(){return e(j)},get"aria-describedby"(){return e(R)},get"aria-expanded"(){return e(n)},onclick:()=>e(r).submenu?V(F,e(F)===e(r).id?null:e(r).id,!0):Q(e(r)),children:(g,C)=>{var P=Gt(),I=y(P),D=Pe(I);Ie(D,()=>e(r)),De(I);var B=U(I,2);ne(B,()=>e(r));var Y=U(B,2);{var $=ee=>{{let te=k(()=>e(F)===e(r).id?bt:wt);Re(ee,{get icon(){return e(te)},size:12})}},pe=ee=>{var te=L(),fe=y(te);{let he=k(()=>e(r).checked?"checked":"empty");Z(fe,()=>Vt,(ve,ye)=>{ye(ve,{get state(){return e(he)}})})}c(ee,te)};M(Y,ee=>{e(r).submenu?ee($):e(r).checked!==void 0&&ee(pe,1)})}c(g,P)},$$slots:{default:!0}})}var ae=U(T,2);{var ue=a=>{var n=Zt(),g=Pe(n);me(g,{get actions(){return e(r).submenu},get menu(){return E()},get iconWeight(){return H()},get onClose(){return u()}});var C=U(g,2);{var P=I=>{var D=Kt(),B=_e(D,!0);oe(()=>{xe(D,1,`type-caption px-2 py-1 ${ze}`),de(B,e(r).note)}),c(I,D)};M(C,I=>{e(r).note&&I(P)})}De(n),c(a,n)};M(ae,a=>{e(r).submenu&&e(F)===e(r).id&&a(ue)})}c(i,b)};M(J,i=>{E()?i(m):e(r).id==="open-in"&&e(r).submenu?i(f,1):i(o,-1)})}var N=U(J,2);{var s=i=>{var b=Qt(),T=_e(b,!0);oe(()=>{Ne(b,"id",e(R)),de(T,e(r).disabledReason)}),c(i,b)};M(N,i=>{e(r).disabledReason&&i(s)})}c(p,q)}),c(be,se),tt(ce)}function Yt(be,d){if(new.target)return Qe({component:Yt,...be});et(d,!0);const we=()=>Ve(T,"$installedEditors$",ne),Ie=()=>Ve(ue,"$isWorkspaceHostLocal$",ne),[ne,ke]=nt();let E=h(d,"layout",7,"list"),H=h(d,"iconWeight",7),u=h(d,"filePath",7,""),A=h(d,"workspaceId",7,""),F=h(d,"isDirectory",7,!0),Q=h(d,"onDelete",7,void 0),ce=h(d,"onArchive",7,void 0),se=h(d,"onUnarchive",7,void 0),ie=h(d,"isArchived",7,!1),p=h(d,"onClose",7,void 0),r=h(d,"showDeleteOption",7,!0),O=h(d,"showArchiveOption",7,!1),S=h(d,"showPathCopy",7,!0),j=h(d,"showFileNameCopy",7,!1),R=h(d,"showFileActions",7,!0),q=h(d,"workspaceFolderPath",7,""),W=h(d,"isDiff",7,!1),x=h(d,"isWorkspaceRoot",7,!1),J=h(d,"additionalActions",23,()=>[]),m=h(d,"showDeleteFileOption",7,!1),f=h(d,"onFileDeleted",7,void 0);const o=gt("WorkspaceActionsMenu");let N=!1;dt(()=>{N=!0});function s(){N||p()?.()}const i=_t("externalEditors"),b=ct(A());Je(()=>{b.set(A())});const T=ht(b),ae=k(we),ue=vt(b);let a=Ee(""),n=Ee(""),g=Ee(!1);ut(()=>{Le.dispatch(pt())}),Je(()=>{u()&&A()?G("workspace:get",{id:A()}).then(t=>{if(t&&t.success&&t.data){const l=t.data,_=l.worktreePath||l.repositoryPath||l.path,z=q()==="__WORKSPACE_ROOT__"?_:q()||_;if(z){const le=z.replace(/\\/g,"/");x()?V(a,le,!0):Ue(u())?V(a,u().replace(/\\/g,"/"),!0):V(a,`${le}/${u()}`.replace(/\/+/g,"/"),!0),V(n,le,!0),o.info("[WorkspaceActionsMenu] Resolved file path:",{filePath:u(),workspacePath:z,resolvedPath:e(a)})}else V(a,u()),V(n,""),l.status!=="archived"&&l.status!=="deleted"&&o.warn("[WorkspaceActionsMenu] No workspace path found:",l)}else V(a,u()),V(n,""),t?.error&&!t.error.includes("not found")&&o.warn("[WorkspaceActionsMenu] Workspace not available:",t)}).catch(t=>{V(a,u()),V(n,""),t?.message?.includes("not found")||o.error("[WorkspaceActionsMenu] Failed to resolve path:",t)}):(V(a,u()),o.info("[WorkspaceActionsMenu] Using filePath directly:",{filePath:u(),workspaceId:A()}))});async function C(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for VSCode");return}try{if(W()&&!F()){o.info("[WorkspaceActionsMenu] Opening diff in VSCode:",{resolvedPath:e(a)}),await G("vscode:open-git-diff",{filePath:e(a),workspacePath:e(n)||void 0}),s();return}let t=e(a);if(e(n))!F()&&!x()?t={folder:e(n),file:e(a)}:t=e(n);else if(!F()){const l=e(a).includes("\\")?"\\":"/",_=e(a).split(l);_.length>1&&(t={folder:_.slice(0,-1).join(l),file:e(a)})}await G("vscode:open",t),s()}catch(t){o.error("Failed to open in VSCode:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openFailed_error({name:"VS Code"}))}}async function P(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for JetBrains");return}try{let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t=e(n)),await G("jetbrains:open",t),s()}catch(t){o.error("Failed to open in JetBrains:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openFailed_error({name:"JetBrains"}))}}async function I(){if(!e(a)){o.warn("[WorkspaceActionsMenu] No resolved path for Xcode");return}try{if(A()&&e(n)){Le.dispatch(ft(A(),e(n),F()?void 0:e(a))),s();return}let t=e(a);e(n)&&!F()?t={folder:e(n),file:e(a)}:e(n)&&(t={folder:e(n)}),await G("xcode:open",t),s()}catch(t){o.error("Failed to open in Xcode:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openFailed_error({name:"Xcode"}))}}async function D(t){if(o.info("[WorkspaceActionsMenu] openInEditor called",{editorId:t.id,appName:t.appName,handlerType:t.handlerType,resolvedPath:e(a),isDirectory:F()}),!e(a)){o.warn("[WorkspaceActionsMenu] openInEditor: No resolved path, aborting");return}const l=F()?e(a):e(a).substring(0,e(a).lastIndexOf("/"));o.info(`[WorkspaceActionsMenu] openInEditor: targetPath=${l}, handlerType=${t.handlerType}`);try{switch(t.handlerType){case"finder":o.info("[WorkspaceActionsMenu] openInEditor: Invoking shell:showItemInFolder"),await G("shell:showItemInFolder",{path:l});break;case"vscode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInVSCode"),await C();return;case"jetbrains":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInJetBrains"),await P();return;case"xcode":o.info("[WorkspaceActionsMenu] openInEditor: Delegating to openInXcode"),await I();return;case"generic":default:{o.info(`[WorkspaceActionsMenu] openInEditor: Invoking external-editors:open for ${t.id}`);const _=await G("external-editors:open",{editorId:t.id,path:l});o.info("[WorkspaceActionsMenu] openInEditor: external-editors:open result",_);break}}s()}catch(_){o.error(`[WorkspaceActionsMenu] Failed to open in ${t.appName}:`,_),K.error(_ instanceof Error?_.message:w.ui_workspaceActions_openFailed_error({name:t.appName}))}}async function B(){if(!e(a)){o.warn("No resolved path for openWithOther");return}try{let t=e(a);F()&&e(n)&&(t=e(n));const l=await G("external-editors:open-with-other",{path:t});if(!l?.success){l?.error!=="No application selected"&&(o.error("Failed to open with other app:",l?.error),K.error(l?.error||w.ui_workspaceActions_openOtherFailed_error()));return}s()}catch(t){o.error("Failed to open with other app:",t),K.error(t instanceof Error?t.message:w.ui_workspaceActions_openOtherFailed_error())}}async function Y(){if(e(a))try{await navigator.clipboard.writeText(Xe(e(a))),s()}catch(t){o.error("Failed to copy path:",t)}}async function $(){if(u())try{let t=u().replace(/\\/g,"/");if(Ue(u())&&e(n)){const l=e(n).endsWith("/")?e(n):e(n)+"/";t.startsWith(l)&&(t=t.slice(l.length))}await navigator.clipboard.writeText(Xe(t)),s()}catch(t){o.error("Failed to copy workspace path:",t)}}async function pe(){if(u())try{const t=u().split(/[/\\]/).pop()||"";await navigator.clipboard.writeText(t),s()}catch(t){o.error("Failed to copy file name:",t)}}function ee(){Q()&&(Q()(),s())}async function te(){if(!(!A()||!e(a)||e(g))){V(g,!0);try{const t=u().split(/[/\\]/).pop()||"file",l=e(a);let _="";try{_=(await G("file:read",{path:l,workspaceId:A()}))?.data?.content??""}catch{}const z=await G("file:delete",{path:l,workspaceId:A()});if(z?.success){f()?.(),s();const le=K.warning(w.ui_workspaceActions_deletedFile_label({name:t}),Ft({duration:15e3,action:{label:w.ui_workspaceActions_undo_label(),onClick:async()=>{try{await G("file:write",{path:l,content:_,workspaceId:A()}),mt("file:changed",{workspaceId:A(),type:"create",filePath:l}),K.dismiss(le)}catch(Oe){o.error("[WorkspaceActionsMenu] Failed to restore file",Oe),K.error(w.ui_workspaceActions_restoreFileFailed_error())}}}}))}else K.error(w.ui_workspaceActions_deleteFileFailedDetail_error({error:z?.error||w.ui_workspaceActions_unknown_error()}))}catch(t){o.error("[WorkspaceActionsMenu] Error deleting file",t),K.error(w.ui_workspaceActions_deleteFileFailed_error())}finally{V(g,!1)}}}function fe(){ie()&&se()?(se()(),s()):!ie()&&ce()&&(ce()(),s())}const he=k(()=>{const t=[];R()&&(i&&Ie()&&t.push({id:"open-in",label:w.ui_openCombo_openInApp_tooltip(),icon:He,onClick:()=>{},submenu:[...e(ae).map(_=>({id:`editor:${_.id}`,label:w.ui_workspaceActions_openIn_label({name:_.name}),editor:_,onClick:()=>{D(_)}})),{id:"choose-app",label:w.ui_workspaceActions_chooseApp_label(),icon:He,onClick:()=>{B()}}]}),S()&&t.push({id:"copy-absolute-path",label:w.ui_workspaceActions_copyAbsolutePath_label(),icon:qe,disabled:!e(a),dividerBefore:t.length>0,onClick:()=>{Y()}}),S()&&!x()&&t.push({id:"copy-relative-path",label:w.ui_workspaceActions_copyRelativePath_label(),icon:qe,disabled:!u(),onClick:()=>{$()}}),j()&&!F()&&t.push({id:"copy-file-name",label:w.ui_workspaceActions_copyFileName_label(),icon:kt,disabled:!u(),onClick:()=>{pe()}}));const l=_=>_.map(z=>({...z,submenu:z.submenu?l(z.submenu):void 0,onClick:()=>{z.onClick(),s()}}));return t.push(...l(J())),O()&&(ce()||se())&&t.push({id:"archive-workspace",label:ie()?w.ui_workspaceActions_unarchiveSpace_label():w.ui_workspaceActions_archiveSpace_label(),icon:ie()?yt:At,dividerBefore:t.length>0,onClick:fe}),r()&&Q()&&t.push({id:"delete-workspace",label:w.ui_workspaceActions_deleteSpace_label(),icon:Ge,variant:"destructive",dividerBefore:t.length>0&&t.at(-1)?.id!=="archive-workspace",onClick:ee}),m()&&!F()&&t.push({id:"delete-file",label:w.ui_workspaceActions_deleteFile_label(),icon:Ge,variant:"destructive",disabled:e(g)||!e(a)||!A(),dividerBefore:t.length>0,onClick:()=>{te()}}),t});var ve={get layout(){return E()},set layout(t="list"){E(t),v()},get iconWeight(){return H()},set iconWeight(t){H(t),v()},get filePath(){return u()},set filePath(t=""){u(t),v()},get workspaceId(){return A()},set workspaceId(t=""){A(t),v()},get isDirectory(){return F()},set isDirectory(t=!0){F(t),v()},get onDelete(){return Q()},set onDelete(t=void 0){Q(t),v()},get onArchive(){return ce()},set onArchive(t=void 0){ce(t),v()},get onUnarchive(){return se()},set onUnarchive(t=void 0){se(t),v()},get isArchived(){return ie()},set isArchived(t=!1){ie(t),v()},get onClose(){return p()},set onClose(t=void 0){p(t),v()},get showDeleteOption(){return r()},set showDeleteOption(t=!0){r(t),v()},get showArchiveOption(){return O()},set showArchiveOption(t=!1){O(t),v()},get showPathCopy(){return S()},set showPathCopy(t=!0){S(t),v()},get showFileNameCopy(){return j()},set showFileNameCopy(t=!1){j(t),v()},get showFileActions(){return R()},set showFileActions(t=!0){R(t),v()},get workspaceFolderPath(){return q()},set workspaceFolderPath(t=""){q(t),v()},get isDiff(){return W()},set isDiff(t=!1){W(t),v()},get isWorkspaceRoot(){return x()},set isWorkspaceRoot(t=!1){x(t),v()},get additionalActions(){return J()},set additionalActions(t=[]){J(t),v()},get showDeleteFileOption(){return m()},set showDeleteFileOption(t=!1){m(t),v()},get onFileDeleted(){return f()},set onFileDeleted(t=void 0){f(t),v()},$set:Ye,$on:(t,l)=>$e(d,t,l)};{let t=k(()=>E()!=="list");me(be,{get actions(){return e(he)},get menu(){return e(t)},get iconWeight(){return H()}})}var ye=tt(ve);return ke(),ye}export{Yt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as W}from"./
|
|
1
|
+
import{I as W}from"./BWtNXuH3.js";import{p as X}from"./B3pPpWYK.js";import{b0 as z,a_ as G,aZ as Y,Y as P,U as F,V as Z,b as g,q as N,ay as A,aX as q,B as U,W as E,r as j,aV as J,a0 as K,O as Q,aO as ee}from"./Dyo489Aj.js";import{p as te}from"./Co5Wv5vC.js";var L=/[─━│┃└┗├┣]/,D=/[└┗├┣]/,ne=/[─━]/,V=/^[\s│┃]+$/,T=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,$=/^\s*%%/,re=" ";function _(n){return n.some(t=>L.test(t))}g(_,"isBoxDrawingFormat");function M(n){for(const t of n){const e=D.exec(t);if(e?.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function S(n,t){return n.replace(/\bline\s+(\d+)\b/gi,(e,r)=>{const s=parseInt(r,10),i=t.get(s);return i?`line ${i}`:e})}g(S,"remapErrorLines");function R(n){const t=n.split(`
|
|
2
2
|
`),e=new Map;let r=-1;for(const[p,c]of t.entries())if(c.trim()==="treeView-beta"){r=p;break}if(r===-1)return{text:n,lineMap:e};const s=[];for(let p=r+1;p<t.length;p++){const c=t[p];c.trim()===""||$.test(c)||T.test(c)||V.test(c)||s.push(c.replace(/\t/g," "))}if(!_(s))return{text:n,lineMap:e};const i=M(s),o=[];let a=0;for(let p=0;p<=r;p++)o.push(t[p]),a++,e.set(a,p+1);for(let p=r+1;p<t.length;p++){const c=t[p],d=c.trim(),h=p+1;if(d===""){o.push(c),a++,e.set(a,h);continue}if($.test(c)){o.push(c),a++,e.set(a,h);continue}if(T.test(c)){o.push(c),a++,e.set(a,h);continue}if(V.test(c))continue;const l=c.replace(/\t/g," "),w=D.exec(l);if(w?.index!==void 0){const f=w.index,m=Math.round(f/i)+1;let u=f+1;for(;u<l.length&&ne.test(l[u]);)u++;for(;u<l.length&&l[u]===" ";)u++;const v=l.slice(u).trimEnd();if(!v)throw new Error(`Line ${h}: Empty node — expected a filename or directory name after the box-drawing prefix`);const O=re.repeat(m);o.push(O+v),a++,e.set(a,h)}else{if(/^[\s─━│┃└┗├┣]+$/.test(l))continue;if(L.test(l))o.push(c),a++,e.set(a,h);else{if(/^\s+/.test(l))throw new Error(`Line ${h}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);o.push(c),a++,e.set(a,h)}}}return{text:o.join(`
|
|
3
3
|
`),lineMap:e}}g(R,"preprocessBoxDrawing");var x=new W(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),j()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>N(ae,E().treeView),"getConfig"),le=g((n,t,e,r,s,i)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const o={id:x.records.cnt++,level:n,name:t,nodeType:e,icon:s,cssClass:r,description:i,children:[]};x.records.stack[x.records.stack.length-1].children.push(o),x.records.stack.push(o)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:F,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:z},I=de,he=g(n=>{X(n,I);for(const t of n.nodes){const e=typeof t.indent=="number"?t.indent:0;let r=t.name;const s=r.endsWith("/");s&&(r=r.slice(0,-1));const i=s?"directory":"file",o=t.classAnnotation||void 0,a=t.iconAnnotation,p=a!==void 0?a||"none":void 0,c=t.descAnnotation||void 0,d=c?J(c,E()):void 0;I.addNode(e,r,i,o,p,d)}},"populate"),pe={parse:g(async n=>{const{text:t,lineMap:e}=R(n);try{const r=await te("treeView",t);A.debug(r),he(r)}catch(r){throw e.size>0&&r instanceof Error&&(r.message=S(r.message,e)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function H(n,t){const e=t?.filenameIcons?.[n];if(e)return e;const r=n.lastIndexOf(".");if(r>0){const s=n.substring(r).toLowerCase(),i=t?.extensionIcons;return i?.[s]??i?.[s.slice(1)]}}g(H,"detectIcon");function C(n,t){return n.includes(":")?n:n in b.icons||!t?`${b.prefix}:${n}`:`${t}:${n}`}g(C,"qualifyIcon");function B(n,t){if(n.icon!=="none"){if(n.icon)return C(n.icon,t.defaultIconPack);if(t.showIcons){if(n.nodeType==="file"){const e=H(n.name,t);if(e==="none")return;if(e)return C(e,t.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}g(B,"getNodeIcon");ee([{name:b.prefix,icons:b}]);var y=14,ge=4,fe=16,ue=g(async(n,t)=>{const e=[],r=g(i=>{const o=B(i,t);o&&e.push({icon:o,node:i}),i.children.forEach(r)},"collect");r(n);const s=await Promise.all(e.map(async({icon:i,node:o})=>({id:o.id,svg:await K(i,{height:y,width:y})})));return new Map(s.map(({id:i,svg:o})=>[i,o]))},"resolveNodeIcons"),we=g((n,t,e,r,s,i)=>{const o=r.append("g");let a="treeView-node-label";e.nodeType==="directory"&&(a+=" treeView-node-dir"),e.cssClass&&(a+=` ${e.cssClass}`);const p=y+ge,c=B(e,s),d=c!==void 0;c&&o.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${n+s.paddingX}, ${t+s.paddingY})`).html(i.get(e.id)??"");const h=o.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",a),{height:l,width:w}=h.node().getBBox(),f=l+s.paddingY*2,m=n+s.paddingX+(d?p:0);h.attr("x",m),h.attr("y",t+f/2);const u=m+w,v=w+s.paddingX*2+(d?p:0);return e.BBox={x:n,y:t,width:v,height:f},e.cssClass?.split(/\s+/).includes("highlight")&&o.insert("rect",":first-child").attr("x",n).attr("y",t+1).attr("width",0).attr("height",f-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:o,labelRightEdge:u,centerY:t+f/2}},"positionLabel"),k=g((n,t,e,r,s,i)=>n.append("line").attr("x1",t).attr("y1",e).attr("x2",r).attr("y2",s).attr("stroke-width",i).attr("class","treeView-node-line"),"positionLine"),me=g((n,t,e,r)=>{let s=0,i=0;const o=[],a=g((d,h,l,w)=>{const f=w*(l.rowIndent+l.paddingX),m=we(f,s,h,d,l,r);o.push(m);const{height:u,width:v}=h.BBox;k(d,f-l.rowIndent,s+u/2,f,s+u/2,l.lineThickness),i=Math.max(i,f+v),s+=u},"drawNode"),p=g((d,h=0)=>{a(n,d,e,h),d.children.forEach(m=>{p(m,h+1)});const{x:l,y:w,height:f}=d.BBox;if(d.children.length){const{y:m,height:u}=d.children[d.children.length-1].BBox;k(n,l+e.paddingX,w+f,l+e.paddingX,m+u/2+e.lineThickness/2,e.lineThickness)}},"processNode");p(t);const c=o.filter(d=>d.node.description);if(c.length>0){const h=Math.max(...o.map(l=>l.labelRightEdge))+fe;for(const l of c){const f=l.nodeGroup.append("text").text(l.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",h).attr("y",l.centerY).node().getBBox();i=Math.max(i,h+f.width+e.paddingX)}}for(const d of o)if(d.node.cssClass?.split(/\s+/).includes("highlight")){const h=d.nodeGroup.select(".treeView-highlight-bg");if(!h.empty()){const l=i-d.node.BBox.x+8;h.attr("width",l),i=Math.max(i,d.node.BBox.x+l+2)}}return{totalHeight:s,totalWidth:i}},"drawTree"),xe=g(async(n,t,e,r)=>{A.debug(`Rendering treeView diagram
|
|
4
4
|
`+n);const s=r.db,i=s.getRoot(),o=s.getConfig(),a=q(t),p=a.append("g");p.attr("class","tree-view");const c=await ue(i,o),{totalHeight:d,totalWidth:h}=me(p,i,o,c);a.attr("viewBox",`-${o.lineThickness/2} 0 ${h} ${d}`),U(a,d,h,o.useMaxWidth)},"draw"),ve={draw:xe},be=ve,Ie={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ce=g(({treeView:n})=>{const{labelFontSize:t,labelColor:e,lineColor:r,iconColor:s,descriptionColor:i,highlightBg:o,highlightStroke:a}=N(Ie,n);return`
|