@intent-hq/web 2.380.0 → 2.380.1
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/{CDH3wgh9.js → 2V-FT4ZN.js} +1 -1
- package/web/app/immutable/chunks/{C3bHv6vj.js → 2tIg3zRC.js} +1 -1
- package/web/app/immutable/chunks/{BnnqUrrA.js → 3XDqrO07.js} +1 -1
- package/web/app/immutable/chunks/{DkIpepCI.js → 4IwpvVwZ.js} +1 -1
- package/web/app/immutable/chunks/{CujTNdGM.js → 4TQ-wOQj.js} +1 -1
- package/web/app/immutable/chunks/{B30IEaPI.js → 4dEsEkEW.js} +1 -1
- package/web/app/immutable/chunks/{wlRwGgvg.js → 8yY720EA.js} +1 -1
- package/web/app/immutable/chunks/{CPN1a4ER.js → 9Z-CGmW0.js} +1 -1
- package/web/app/immutable/chunks/{jnsZrPVB.js → 9kN-cZth.js} +1 -1
- package/web/app/immutable/chunks/{BQ_H_anx.js → B2KdznJa.js} +1 -1
- package/web/app/immutable/chunks/{Ble6-g5B.js → B4vl19YV.js} +1 -1
- package/web/app/immutable/chunks/{CYzN5BWb.js → B6aNgl-u.js} +6 -6
- package/web/app/immutable/chunks/{BYdTAlbb.js → B6kWt-NF.js} +1 -1
- package/web/app/immutable/chunks/{CUPLSgMR.js → BCME5FCI.js} +2 -2
- package/web/app/immutable/chunks/{BZIO5H42.js → BEWzvyPM.js} +1 -1
- package/web/app/immutable/chunks/{DPjD0DQx.js → BGIIIhAt.js} +3 -3
- package/web/app/immutable/chunks/{CqoNhUOR.js → BHM1cyPv.js} +1 -1
- package/web/app/immutable/chunks/{rull8DFa.js → BHQUrNk1.js} +3 -3
- package/web/app/immutable/chunks/{DECU-iIP.js → BNq2Q1Ih.js} +1 -1
- package/web/app/immutable/chunks/{CCQ7UDrk.js → BO6AmRhX.js} +1 -1
- package/web/app/immutable/chunks/{C3YmofVF.js → BOzhtrmb.js} +1 -1
- package/web/app/immutable/chunks/{BUvix1Kg.js → BPsBKYg_.js} +1 -1
- package/web/app/immutable/chunks/{D6N7T3x-.js → BT-SBMwG.js} +1 -1
- package/web/app/immutable/chunks/{DBOKH6iU.js → BUrKWYyT.js} +1 -1
- package/web/app/immutable/chunks/{DquFvZKr.js → BUs9PHLx.js} +1 -1
- package/web/app/immutable/chunks/{BXTpY5y8.js → BVVQo5Xu.js} +1 -1
- package/web/app/immutable/chunks/{e0tyUrux.js → BVZYGKUs.js} +1 -1
- package/web/app/immutable/chunks/{BYqjqyqc.js → BVls_E6i.js} +1 -1
- package/web/app/immutable/chunks/{CUwvPGZB.js → BYW8f2oV.js} +2 -2
- package/web/app/immutable/chunks/{Zxq4ML42.js → BYeqTXC2.js} +1 -1
- package/web/app/immutable/chunks/{CK_RweuK.js → BYm3oGAs.js} +1 -1
- package/web/app/immutable/chunks/{CE6R-dRp.js → BZUgE8w7.js} +1 -1
- package/web/app/immutable/chunks/{Be831IP4.js → BbCHGRAU.js} +1 -1
- package/web/app/immutable/chunks/{CLfdXuzT.js → Bd-3nxyB.js} +1 -1
- package/web/app/immutable/chunks/{BiBcmvkl.js → Bondcgar.js} +1 -1
- package/web/app/immutable/chunks/{B3Jw9XtV.js → BpY_21Cw.js} +4 -4
- package/web/app/immutable/chunks/{B7X-AK1d.js → Bs12y6Hh.js} +3 -3
- package/web/app/immutable/chunks/{C8C4dK2T.js → Btjc8Ky7.js} +1 -1
- package/web/app/immutable/chunks/{s3btz0Xv.js → BvGA2PYn.js} +1 -1
- package/web/app/immutable/chunks/{vNGikJQC.js → BvjokUWx.js} +1 -1
- package/web/app/immutable/chunks/{DNqGTO8s.js → Bwkbh1IC.js} +1 -1
- package/web/app/immutable/chunks/{ssAJdhye.js → C3btDKsC.js} +2 -2
- package/web/app/immutable/chunks/{DZMawptX.js → C5UZ-z7q.js} +2 -2
- package/web/app/immutable/chunks/{7bi3ZM7b.js → C7tMlsfz.js} +1 -1
- package/web/app/immutable/chunks/{BfAkJ2nl.js → C7vUMkVq.js} +1 -1
- package/web/app/immutable/chunks/{DvzNnLaI.js → CABtGAhT.js} +1 -1
- package/web/app/immutable/chunks/{Da34V0LY.js → CBpGFpXN.js} +1 -1
- package/web/app/immutable/chunks/{CNkRMqxA.js → CC0zIW-Q.js} +1 -1
- package/web/app/immutable/chunks/{AVD8By0j.js → CK0iX2TE.js} +1 -1
- package/web/app/immutable/chunks/{SRwBzLT8.js → CM22-mrT.js} +1 -1
- package/web/app/immutable/chunks/{DLpVNAiX.js → CMYiw90g.js} +1 -1
- package/web/app/immutable/chunks/{C6D8Jg6d.js → CN4T3mPu.js} +1 -1
- package/web/app/immutable/chunks/{5xu6eN4Z.js → COAAEUqs.js} +1 -1
- package/web/app/immutable/chunks/{BiGdiG6Z.js → CP6uC9cs.js} +1 -1
- package/web/app/immutable/chunks/{CFtiaJsb.js → CT1DR1ub.js} +1 -1
- package/web/app/immutable/chunks/{DASiBrIg.js → CU8fY_M-.js} +1 -1
- package/web/app/immutable/chunks/{ByytepOR.js → CXHQfPPq.js} +1 -1
- package/web/app/immutable/chunks/{CL7ZHYqg.js → CY6yMXcg.js} +1 -1
- package/web/app/immutable/chunks/{FRR_nxmc.js → CYkq1Sp7.js} +1 -1
- package/web/app/immutable/chunks/{CztIXNWc.js → Cd3YgLQX.js} +1 -1
- package/web/app/immutable/chunks/{BRRF7Md4.js → CdaU-PJY.js} +1 -1
- package/web/app/immutable/chunks/{CcxCR0t4.js → CeRXl9-a.js} +4 -4
- package/web/app/immutable/chunks/{D_4kRlvm.js → CeyWhdyo.js} +3 -3
- package/web/app/immutable/chunks/{DGR5PXqy.js → CgfPG4f5.js} +1 -1
- package/web/app/immutable/chunks/{DMvzpJTu.js → ChbSsiLP.js} +1 -1
- package/web/app/immutable/chunks/{B9NJITfb.js → ChsjUXyy.js} +1 -1
- package/web/app/immutable/chunks/{DWFswrSL.js → CjVluV7J.js} +1 -1
- package/web/app/immutable/chunks/{DnURDD89.js → ClRyc1RP.js} +3 -3
- package/web/app/immutable/chunks/{CBavoRbP.js → CpggW3GS.js} +1 -1
- package/web/app/immutable/chunks/{wY2249Ev.js → CpkJczBg.js} +1 -1
- package/web/app/immutable/chunks/{CLII-C57.js → CszQUuHS.js} +1 -1
- package/web/app/immutable/chunks/{C_KorY3-.js → Cvu5TPZ8.js} +1 -1
- package/web/app/immutable/chunks/{DpeKTeH0.js → Cw8_SJ4E.js} +1 -1
- package/web/app/immutable/chunks/{CfCVG4Rx.js → Cz2wArhm.js} +1 -1
- package/web/app/immutable/chunks/{DItMEnLb.js → D1bYGUz7.js} +1 -1
- package/web/app/immutable/chunks/{Do-rG8en.js → D4xidzA_.js} +1 -1
- package/web/app/immutable/chunks/{BH8UijQb.js → D5caROAF.js} +4 -4
- package/web/app/immutable/chunks/{C9GkUc94.js → D5xVaXHm.js} +1 -1
- package/web/app/immutable/chunks/{D5zI85k6.js → D7DlvngK.js} +1 -1
- package/web/app/immutable/chunks/{DgHJcjPY.js → D9uTgrXZ.js} +1 -1
- package/web/app/immutable/chunks/{DOdPMDnB.js → DBfX4Zz1.js} +1 -1
- package/web/app/immutable/chunks/{C4Sy5w4s.js → DDZsOuFy.js} +1 -1
- package/web/app/immutable/chunks/{DhP0_QuO.js → DGsSBTnE.js} +1 -1
- package/web/app/immutable/chunks/{CgsTiBK2.js → DH97ZRMJ.js} +2 -2
- package/web/app/immutable/chunks/{BsfvLYaY.js → DKEI0MVx.js} +1 -1
- package/web/app/immutable/chunks/{C4yj51Vt.js → DKushSGX.js} +1 -1
- package/web/app/immutable/chunks/{CRT5yBYQ.js → DLNiSKjY.js} +1 -1
- package/web/app/immutable/chunks/{BaqP50r9.js → DP1oZD4h.js} +1 -1
- package/web/app/immutable/chunks/{-Wss3p71.js → DU4vrWyh.js} +13 -13
- package/web/app/immutable/chunks/{2txgxj9r.js → DX_XAJ78.js} +2 -2
- package/web/app/immutable/chunks/{BBJQ4-nf.js → DXlnaAqr.js} +1 -1
- package/web/app/immutable/chunks/{CVS0TTpd.js → DXxcUvjl.js} +1 -1
- package/web/app/immutable/chunks/{CbJ0LpjU.js → D_kqKAPb.js} +1 -1
- package/web/app/immutable/chunks/{iMaMvcYZ.js → DcVQUcOT.js} +1 -1
- package/web/app/immutable/chunks/{DnuHjHFq.js → Df0tkK9d.js} +1 -1
- package/web/app/immutable/chunks/{D57UIjlo.js → DfaT6T2d.js} +1 -1
- package/web/app/immutable/chunks/{CB1h-wDc.js → DgHQu-vA.js} +1 -1
- package/web/app/immutable/chunks/{B2jkYe3V.js → Dlr9TJoI.js} +1 -1
- package/web/app/immutable/chunks/{DuWApQdO.js → DlzMT6wV.js} +1 -1
- package/web/app/immutable/chunks/{Ctn4iaf0.js → Dm-G_mI5.js} +1 -1
- package/web/app/immutable/chunks/{DPmIsnKt.js → DmRVnIPJ.js} +1 -1
- package/web/app/immutable/chunks/{DE1M1ef4.js → Dpx4iP0s.js} +1 -1
- package/web/app/immutable/chunks/{i6OXlSBf.js → Drd1b60V.js} +1 -1
- package/web/app/immutable/chunks/{CbGMjgt3.js → DuXKOgBL.js} +1 -1
- package/web/app/immutable/chunks/{CUWIRmNB.js → DwHA7V2D.js} +1 -1
- package/web/app/immutable/chunks/{lW75E5gc.js → Dzs4VSAo.js} +1 -1
- package/web/app/immutable/chunks/{Cg-C81DM.js → Erflp_L7.js} +1 -1
- package/web/app/immutable/chunks/{BrXTXdts.js → H8SQAotj.js} +3 -3
- package/web/app/immutable/chunks/{Dvkoo7QM.js → HW5J3T7a.js} +3 -3
- package/web/app/immutable/chunks/{DrXnULBv.js → JPasKHb8.js} +2 -2
- package/web/app/immutable/chunks/{CWGQdEyp.js → MUcwQb8t.js} +2 -2
- package/web/app/immutable/chunks/{D5Ys3IYT.js → P555Pw2w.js} +2 -2
- package/web/app/immutable/chunks/{50tAdUJR.js → Q4J_06hE.js} +1 -1
- package/web/app/immutable/chunks/{TArFmpEa.js → Qq8kw_LR.js} +1 -1
- package/web/app/immutable/chunks/{W3kZhUkG.js → S_Knf_qw.js} +1 -1
- package/web/app/immutable/chunks/{B6vL_HfU.js → UEAQx6Yh.js} +2 -2
- package/web/app/immutable/chunks/{DFlCKbS0.js → Uqxgj6Y3.js} +1 -1
- package/web/app/immutable/chunks/{D43gBypv.js → XnLS-7bS.js} +1 -1
- package/web/app/immutable/chunks/{B-SBCaz1.js → YloBm2cw.js} +1 -1
- package/web/app/immutable/chunks/{8530J6R1.js → _xgByTRL.js} +1 -1
- package/web/app/immutable/chunks/{BTW7La6X.js → aUozHpqP.js} +1 -1
- package/web/app/immutable/chunks/{loKq3Zo5.js → aci0ifiz.js} +1 -1
- package/web/app/immutable/chunks/{DIZUkYZL.js → euj4yvIS.js} +1 -1
- package/web/app/immutable/chunks/{CaYNEsBV.js → hyWBwv6O.js} +3 -3
- package/web/app/immutable/chunks/{CLtpiLYb.js → nTzhI5F1.js} +1 -1
- package/web/app/immutable/chunks/{C79aLQt9.js → ofygnKUk.js} +1 -1
- package/web/app/immutable/chunks/{B-JWrZED.js → vtO9QTmA.js} +1 -1
- package/web/app/immutable/entry/{app.CkDtO1q-.js → app.BdrQALQh.js} +2 -2
- package/web/app/immutable/entry/start.BqlnF3U7.js +1 -0
- package/web/app/immutable/nodes/{0.DvPi8w3E.js → 0.DBZauBI2.js} +1 -1
- package/web/app/immutable/nodes/{1.C2bqEog8.js → 1.CPgNb4Lf.js} +1 -1
- package/web/app/immutable/nodes/{10.CP4ExDBx.js → 10.DZuMROM9.js} +4 -4
- package/web/app/immutable/nodes/{11.Bho5JmtI.js → 11.DPsQWzO9.js} +1 -1
- package/web/app/immutable/nodes/{15.DtNQM8td.js → 15.BThkGFQN.js} +1 -1
- package/web/app/immutable/nodes/{19.BLmPxWGI.js → 19.CnfYy9JE.js} +2 -2
- package/web/app/immutable/nodes/{2.Dda6sH4i.js → 2.BU41VxwM.js} +4 -4
- package/web/app/immutable/nodes/{3.BDe_dAcT.js → 3.BlGAsrV5.js} +1 -1
- package/web/app/immutable/nodes/{4.C28j9ioo.js → 4.C9rwZlbu.js} +1 -1
- package/web/app/immutable/nodes/{5.CE6HGShw.js → 5.B9pXjqPK.js} +1 -1
- package/web/app/immutable/nodes/{6.Dz-oxHb7.js → 6.5nx1seqd.js} +1 -1
- package/web/app/immutable/nodes/{7.y6iKMGgi.js → 7.DaUM6jFq.js} +1 -1
- package/web/app/immutable/nodes/{8.i_Gce-pE.js → 8.BHoZX-hs.js} +1 -1
- package/web/app/immutable/nodes/{9.Dc1bO94U.js → 9.E1SwTSp3.js} +4 -4
- package/web/app/version.json +1 -1
- package/web/index.html +9 -9
- package/web/app/immutable/entry/start.BS0qtVof.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ao as s}from"./3SdAC2_C.js";import{d as r}from"./
|
|
1
|
+
import{ao as s}from"./3SdAC2_C.js";import{d as r}from"./B6aNgl-u.js";const t=()=>{const e=r;return{page:{subscribe:e.page.subscribe},navigating:{subscribe:e.navigating.subscribe},updated:e.updated}},c={subscribe(e){return(s?o("page"):t().page).subscribe(e)}};function o(e){try{return t()[e]}catch{throw new Error(`Cannot subscribe to '${e}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server`)}}export{c as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as ht,bo as U,bw as $t,bq as It,b as bt,bs as d}from"./Dv_tIgjy.js";import{bs as yt,ca as k,aD as t,c9 as s,a7 as Ct,ay as Rt,W as kt,bn as wt,bH as H,bV as q,aA as E}from"./3SdAC2_C.js";import{k as At}from"./D6gLzTDC.js";import{b as St}from"./Dn334wJv.js";import{Jv as a,eJ as Dt,eK as Pt,oj as Ut,A2 as Et,on as _t,oo as Tt,K3 as Ft,Ki as xt,K8 as Kt,vK as Wt,u$ as vt}from"./CWhRK5Rp.js";import{t as Ht}from"./C-BsEdGZ.js";import{g as qt}from"./DWGXN6Nr.js";import{dH as Lt,b$ as Nt,bQ as Ot,bU as Bt,bS as Mt}from"./BqA-3o9l.js";import{af as jt}from"./
|
|
1
|
+
import{t as ht,bo as U,bw as $t,bq as It,b as bt,bs as d}from"./Dv_tIgjy.js";import{bs as yt,ca as k,aD as t,c9 as s,a7 as Ct,ay as Rt,W as kt,bn as wt,bH as H,bV as q,aA as E}from"./3SdAC2_C.js";import{k as At}from"./D6gLzTDC.js";import{b as St}from"./Dn334wJv.js";import{Jv as a,eJ as Dt,eK as Pt,oj as Ut,A2 as Et,on as _t,oo as Tt,K3 as Ft,Ki as xt,K8 as Kt,vK as Wt,u$ as vt}from"./CWhRK5Rp.js";import{t as Ht}from"./C-BsEdGZ.js";import{g as qt}from"./DWGXN6Nr.js";import{dH as Lt,b$ as Nt,bQ as Ot,bU as Bt,bS as Mt}from"./BqA-3o9l.js";import{af as jt}from"./CeyWhdyo.js";import{C as Gt}from"./CP6uC9cs.js";import{V as Jt}from"./BEk-bvEu.js";import{bT as Vt,bN as Qt,b8 as zt}from"./ChbSsiLP.js";import{i as Xt}from"./H2jLkRRS.js";function Yt(_,f){if(new.target)return ht({component:Yt,..._});yt(f,!0);const L=()=>d(Z,"$gitRoots$",n),T=()=>d(Y,"$workspace",n),N=()=>d(st,"$ftCommits$",n),O=()=>d(ot,"$ftOlderCommits$",n),y=()=>d(tt,"$commitRead$",n),B=()=>d(z,"$foldUnchanged",n),M=()=>d(Q,"$lineWrapping",n),j=()=>d(X,"$diffSideBySide",n),G=()=>d(at,"$ftLoading$",n),[n,J]=It(),V=e=>{Jt(e,{embedded:!0,showExpand:!0,get expanded(){return t(C)},onToggleExpand:()=>{H(C,!t(C)),t(C)?t(R)?.expandAll():t(R)?.collapseAll()},get foldEnabled(){return B()},onToggleFold:()=>a.dispatch(Kt()),get wrapEnabled(){return M()},onToggleWrap:()=>a.dispatch(xt()),get splitEnabled(){return j()},onToggleSplit:()=>a.dispatch(Ft())})},Q=Vt(),z=Qt(),X=zt();let h=U(f,"tab",7),i=U(f,"workspaceId",7),$=U(f,"isActive",7);const F=qt(),g=Ht(()=>i()),Y=Lt(g),Z=jt(g),w=crypto.randomUUID(),tt=Nt(g,w),c=s(()=>h().data?.commitHash||""),x=s(()=>h().data?.commitMessage||"");k(()=>{const e=i();if(!(!$()||!e||t(r)))return a.dispatch(Dt(e,"history")),()=>a.dispatch(Pt(e,"history"))});const r=s(()=>h().data?.gitRootId||""),K=s(()=>t(r)&&L().find(e=>e.id===t(r))?.path||""),et=s(()=>t(K)||T()?.worktreePath||T()?.repositoryPath||""),st=Ot(g),ot=Bt(g),at=Mt(g),nt=s(()=>N()||[]),it=s(()=>O()||[]),p=s(()=>t(r)?void 0:t(nt).find(e=>e.hash===t(c))||t(it).find(e=>e.hash===t(c))),A=s(()=>t(p)?.files||[]),S=s(()=>y()?.request.kind==="commitDetails"&&y().request.commitHash===t(c)&&(y().request.gitRootId??"")===t(r)?y():void 0),l=s(()=>t(S)?.result?.kind==="commitDetails"?t(S).result.details:null),rt=s(()=>t(l)?t(l).fileDetails.length>0?t(l).fileDetails:t(l).files.map(e=>({path:e,additions:0,deletions:0})):[]),dt=s(()=>t(S)?.loading??!1);k(()=>{const e=t(c),o=i(),I=t(r);if(!e||!o||t(A).length>0)return;const u=crypto.randomUUID();return a.dispatch(Ut(o,w,u,{kind:"commitDetails",commitHash:e,gitRootId:I||void 0})),()=>a.dispatch(Et(o,w,u))});const ct=s(()=>t(A).length>0?t(A):t(rt));let C=q(!0),R=q(null);const lt=s(()=>t(ct).map(e=>{const o=typeof e=="string"?e:e.path||"",I=typeof e=="string"?0:e.additions||0,u=typeof e=="string"?0:e.deletions||0;return{filePath:Xt(o)?o:`${t(et)}/${o}`,action:"modify",additions:I,deletions:u,toolName:"local",toolCallId:`commit-${t(c)}-${o}`,staged:!1,category:"committed",commitHash:t(c),commitMessage:t(x)}}));k(()=>{!F||!$()||F.registerActions({display:V})});const W=crypto.randomUUID();k(()=>{const e=i();if(!(!($()&&t(r))||!e))return a.dispatch(_t(e,W)),()=>a.dispatch(Tt(e,W))});var mt={get tab(){return h()},set tab(e){h(e),E()},get workspaceId(){return i()},set workspaceId(e){i(e),E()},get isActive(){return $()},set isActive(e){$(e),E()},$set:$t,$on:(e,o)=>bt(f,e,o)},v=Ct(),gt=Rt(v);At(gt,()=>JSON.stringify([i(),t(r),t(c)]),e=>{{let o=s(()=>G()||t(dt)),I=s(()=>t(r)||void 0),u=s(()=>t(K)||void 0),ut=s(()=>({hash:t(c),message:t(x),author:t(p)?.author||t(l)?.author,authorEmail:t(p)?.authorEmail||t(l)?.authorEmail,date:t(p)?.date||t(l)?.date,agentId:t(p)?.agentId,linkedNoteId:t(p)?.linkedNoteId}));St(Gt(e,{get isLoading(){return t(o)},get changes(){return t(lt)},get gitRootId(){return t(I)},get gitRootPath(){return t(u)},get commitInfo(){return t(ut)},onOpenAgent:(b,m)=>{const D=m?.metaKey||m?.ctrlKey||!1,P=m?.target?.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0;a.dispatch(vt(i(),{agentId:b,openInAdjacentPanel:D,sourcePanelId:P}))},onOpenNote:(b,m)=>{const D=m?.metaKey||m?.ctrlKey||!1,P=m?.target?.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0;a.dispatch(Wt(i(),b,{openInAdjacentPanel:D,sourcePanelId:P}))}}),b=>H(R,b,!0),()=>t(R))}}),kt(_,v);var pt=wt(mt);return J(),pt}export{Yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ne=Object.defineProperty;var oe=(e,t,r)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var d=(e,t,r)=>oe(e,typeof t!="symbol"?t+"":t,r);import{m as ce,N as le,T as de,d as ue,o as pe,w as ge}from"./I4WMrmBa.js";import"./3SdAC2_C.js";import{bm as n,_ as he}from"./Dv_tIgjy.js";import"./DLx1kqr5.js";import"./BPxuNmyn.js";import"./D7fB2Oi-.js";import{c as V}from"./ChTqQfQN.js";import"./KS3jDVZW.js";import{Jv as a,uA as fe,nY as y,nX as k,mp as Se,yX as C,yY as N,yV as be,yU as me,yW as ve,rT as _e,c8 as Ae,c7 as ye,cm as ke,cl as we,n_ as w}from"./CWhRK5Rp.js";import{cU as Ee,cJ as Ce,bJ as Pe,cl as Re,cB as Me,cn as Te,cS as Q,aJ as Ie,c3 as Fe,c_ as De}from"./BqA-3o9l.js";import{a as Le,i as Oe}from"./CL3a4Hm1.js";import{i as D}from"./BBWuirRW.js";import{n as xe}from"./CUPLSgMR.js";import{x as We,aO as Ne,c as Be,aD as Ge,B as Ve,y as Ue,z as He}from"./Bsz2ybz8.js";import{a0 as qe,K as Y,a1 as $e,ay as U,Z as ze,a3 as je,L as Ke,$ as Ze,aA as Qe,x as Ye}from"./BivYofy-.js";const Je=5,L=120,Xe=4e3,j=.2,et=.8;function tt(e,t,r=Je){const s=e.length>0?t/(2*e.length):0,i=Xe/L;return Array.from({length:r},(o,l)=>{if(s<=0)return 0;const c=L*i**(l/r),g=L*i**((l+1)/r),f=Math.min(e.length-1,Math.floor(c/s)),b=Math.min(e.length,Math.max(f+1,Math.ceil(g/s)));let $=0;for(let F=f;F<b;F+=1)$+=e[F]??0;const z=($/(b-f)/255-j)/(et-j);return Number.isFinite(z)?Math.min(1,Math.max(0,z)):0})}const rt=Object.freeze(Object.defineProperty({__proto__:null,NOTIFY_DURATION:le,TOAST_COUNTDOWN_CLASS:de,TOAST_COUNTDOWN_NO_HOVER_PAUSE_CLASS:ue,notify:ce,notifyMetadata:pe,withToastCountdown:ge},Symbol.toStringTag,{value:"Module"})),Dr=a.createSelector(e=>Ee.select(e)?.capabilities.gitlabCheckout===!0),Lr=a.createSelector(e=>e.gitlabAuth.host),Or=a.createSelector(e=>e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host),xr=a.createSelector(e=>fe(e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host)??""),Wr=a.createSelector(e=>e.gitlabAuth.isCancelling),Nr=a.createSelector(e=>e.gitlabAuth.cancelOutcome),Br=a.createSelector(e=>e.gitlabAuth.isConfigured),Gr=a.createSelector(e=>e.gitlabAuth.isAuthenticating),Vr=a.createSelector(e=>e.gitlabAuth.deviceFlow),Ur=a.createSelector(e=>e.gitlabAuth.deviceGrantSupported),Hr=a.createSelector(e=>e.gitlabAuth.user),qr=a.createSelector(e=>e.gitlabAuth.error);a.createSelector(e=>e.gitlabAuth.method);const $r=a.createSelector(e=>e.gitlabAuth.statusReady===!0),A=[{id:"pr-reviewer",icon:"pr-reviewer",get name(){return n.specialists_builtin_prReviewer_name()},get description(){return n.specialists_builtin_prReviewer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"ui-designer",icon:"ui-designer",get name(){return n.specialists_builtin_uiDesigner_name()},get description(){return n.specialists_builtin_uiDesigner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"vulnerability-scanner",icon:"pr-reviewer",get name(){return n.specialists_builtin_vulnerabilityScanner_name()},get description(){return n.specialists_builtin_vulnerabilityScanner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"developer",icon:"verifier",get name(){return n.specialists_builtin_developer_name()},get description(){return n.specialists_builtin_developer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"product-manager",icon:"coordinator",get name(){return n.specialists_builtin_productManager_name()},get description(){return n.specialists_builtin_productManager_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"maintenance-coordinator",icon:"ralph",get name(){return n.specialists_builtin_maintenanceCoordinator_name()},get description(){return n.specialists_builtin_maintenanceCoordinator_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"chief-of-staff",icon:"chief-of-staff",get name(){return n.specialists_builtin_chiefOfStaff_name()},get description(){return n.specialists_builtin_chiefOfStaff_description()},hidden:!0,defaultBehaviorPrompt:"",promptUnavailable:!0}],J=new Set(["pr-reviewer"]),zr="developer";function jr(e){return A.find(t=>t.id===e)}const st=a.createSelector(e=>e.githubAuth.mutationRequestId),it=a.createSelector(e=>e.githubAuth.callbacksCancelled),at=a.createSelector(e=>e.githubAuth.isDisconnecting),X=a.createSelector(e=>e.githubAuth.isAuthenticated),nt=a.createSelector(e=>e.githubAuth.statusSettled===!0),ot=a.createSelector(e=>e.githubAuth.requiresDaemonAuth),ct=a.createSelector(e=>e.githubAuth.user),lt=a.createSelector(e=>e.githubAuth.isAuthenticating),dt=a.createSelector(e=>e.githubAuth.deviceFlow),ut=a.createSelector(e=>e.githubAuth.error),Kr=Object.freeze(Object.defineProperty({__proto__:null,selectGitHubAuthCallbacksCancelled:it,selectGitHubAuthDeviceFlow:dt,selectGitHubAuthError:ut,selectGitHubAuthIsAuthenticated:X,selectGitHubAuthIsAuthenticating:lt,selectGitHubAuthIsDisconnecting:at,selectGitHubAuthMutationRequestId:st,selectGitHubAuthRequiresDaemonAuth:ot,selectGitHubAuthStatusSettled:nt,selectGitHubAuthUser:ct},Symbol.toStringTag,{value:"Module"}));function u(e){return e??""}function pt(e,t){const r=e??[],s=t??[];return r.length===s.length&&r.every((i,o)=>u(i.provider)===u(s[o].provider)&&i.model===s[o].model&&i.hint===s[o].hint&&u(i.reasoningEffort)===u(s[o].reasoningEffort))}function K(e,t){if(e.source!=="user"||!t?.ignoreModelPin&&(e.model||e.codingAgent))return!1;const r=e.bundled;return r?u(e.name)===u(r.name)&&u(e.description)===u(r.description)&&u(e.behaviorPrompt)===u(r.behaviorPrompt)&&u(e.roleReminder)===u(r.roleReminder)&&u(e.reasoningEffort)===u(r.reasoningEffort)&&pt(e.modelOptions,r.modelOptions):!1}const Zr=a.createSelector(e=>e.specialists.bundledSpecialists),gt=a.createSelector(e=>e.specialists.fileSpecialists),Qr=a.createSelector(e=>y(gt.select(e))),Yr=a.createSelector(e=>e.specialists.userOverrides);a.createSelector(e=>e.specialists.overridesLoaded);const Jr=a.createSelector(e=>e.specialists.customSpecialistsLoaded),Xr=a.createSelector(e=>e.specialists.fileSpecialistsLoaded),es=a.createSelector(e=>e.specialists.bundledSpecialistsLoaded),ts=a.createSelector(e=>e.specialists.specialistsFolderPath),rs=a.createSelector((e,t)=>{if(!t)return e.specialists.defaultSpecialistId??"";const r=e.providerCatalog?.byWorkspaceId?.[t]?.settings.find(s=>s.path==="specialists.default")?.value;return typeof r=="string"?r:""});a.createSelector(e=>e.specialists.providerModelOverrides);const O=a.createSelector((e,t)=>!(J.has(t)&&!X.select(e)));function ht(e,t){return t?e:e.filter(r=>!J.has(r.id))}function ft(e,t){return ht(e,t).filter(r=>!r.hidden)}function ss(e,t){return ft(e,t).filter(r=>r.role!=="internal")}const v=a.createSelector((e,t)=>{if(t)return(e.providerCatalog?.byWorkspaceId?.[t]?.specialists??[]).map(c=>({...c,defaultModel:c.model,defaultBehaviorPrompt:c.behaviorPrompt??c.prompt??"",defaultAgentType:c.agentType}));const r=y(e.specialists.fileSpecialists),s=e.specialists.bundledSpecialists,i=new Set,o=[];for(const c of r)!i.has(c.id)&&O.select(e,c.id)&&(i.add(c.id),o.push({id:c.id,name:c.name,description:c.description,codingAgent:c.codingAgent,defaultModel:c.model||void 0,defaultBehaviorPrompt:c.behaviorPrompt,roleReminder:c.roleReminder,source:c.source,importedFrom:c.importedFrom,unsupportedFields:c.unsupportedFields,requiredSkills:c.requiredSkills,missingSkills:c.missingSkills,hidden:c.hidden,resolvedModel:c.resolvedModel,resolvedProvider:c.resolvedProvider,modelOptions:c.modelOptions,reasoningEffort:c.reasoningEffort,role:c.role,teamAgents:c.teamAgents,icon:c.icon}));for(const c of s)!i.has(c.id)&&O.select(e,c.id)&&(i.add(c.id),o.push(c));if(!e.specialists.bundledSpecialistsLoaded&&r.length===0&&s.length===0)for(const c of A)!i.has(c.id)&&O.select(e,c.id)&&(i.add(c.id),o.push(c));const l=new Map;for(const c of A)l.has(c.id)||l.set(c.id,l.size);for(const c of s)l.has(c.id)||l.set(c.id,l.size);return o.sort((c,g)=>{const f=l.has(c.id),b=l.has(g.id);return f&&b?(l.get(c.id)??0)-(l.get(g.id)??0):f&&!b?-1:!f&&b?1:c.name.localeCompare(g.name)}),o}),is=a.createSelector(e=>{const t=v.select(e).filter(s=>s.role==="orchestrator");if(t.length===0)return null;const r=new Set([...A.map(({id:s})=>s),...e.specialists.bundledSpecialists.map(({id:s})=>s)]);return t.sort((s,i)=>+!r.has(s.id)-+!r.has(i.id)||s.id.localeCompare(i.id)),t[0]}),St=a.createSelector((e,t)=>{const r=k(e.specialists.fileSpecialists,t);if(r)return{id:r.id,name:r.name,description:r.description,source:r.source};const s=e.specialists.bundledSpecialists.find(i=>i.id===t);if(s)return{id:s.id,name:s.name,description:s.description,source:"builtin"};if(!e.specialists.bundledSpecialistsLoaded&&y(e.specialists.fileSpecialists).length===0&&e.specialists.bundledSpecialists.length===0){const i=A.find(o=>o.id===t);if(i)return{id:i.id,name:i.name,description:i.description,source:"builtin"}}return null}),as=a.createSelector((e,t)=>St.select(e,t)?.name??null),ns=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultModel?i.defaultModel:i.resolvedModel??"":""}),os=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.defaultModel||void 0),cs=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.reasoningEffort||void 0),ls=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultBehaviorPrompt:""});function P(e,t){return t.some(r=>r.id===e)||A.some(r=>r.id===e)}const ds=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.importedFrom?!1:s.source==="bundled"||s.source==="user"&&P(t,e.specialists.bundledSpecialists)}return P(t,e.specialists.bundledSpecialists)}),us=a.createSelector((e,t,r)=>r?!!H.select(e,t,r):!!k(e.specialists.fileSpecialists,t)),ps=a.createSelector((e,t,r)=>{if(r){const o=H.select(e,t,r);return!o||o.importedFrom||o.source==="project"?!1:P(t,e.specialists.bundledSpecialists)&&!K(o)}if(!P(t,e.specialists.bundledSpecialists))return!1;const i=k(e.specialists.fileSpecialists,t);return!i||i.source!=="user"?!1:!K(i)}),H=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.source==="bundled"?void 0:{...s,source:s.source,model:s.model??"",behaviorPrompt:s.behaviorPrompt??s.prompt??"",filePath:s.path??""}}return k(e.specialists.fileSpecialists,t)}),gs=a.createSelector((e,t,r)=>{const s=H.select(e,t,r);return r&&!s?e.providerCatalog?.byWorkspaceId?.[r]?.specialists.some(i=>i.id===t)?"Built-in":null:s?.source==="project"?"Project":s?.source==="user"?"User":e.specialists.bundledSpecialists.some(i=>i.id===t)?"Built-in":null}),hs=a.createSelector((e,t,r)=>{if(r)return e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(o=>o.id===t)?.path;const s=k(e.specialists.fileSpecialists,t);if(s)return s.filePath;const i=e.specialists.bundledSpecialists.find(o=>o.id===t);if(i&&"filePath"in i)return i.filePath}),fs=a.createSelector((e,t,r)=>{if(r){const i=v.select(e,r).find(c=>c.id===t),o=i?.codingAgent||i?.resolvedProvider;if(o)return Ce.select(e,o,r);const l=Pe.select(e,r);return e.providerCatalog?.byWorkspaceId?.[r]?.readiness[l]?.available?l:""}const s=k(e.specialists.fileSpecialists,t);return s?.codingAgent?s.codingAgent:bt.select(e,t)}),bt=a.createSelector((e,t)=>{const s=v.select(e).find(i=>i.id===t);return s?.codingAgent?s.codingAgent:qe.select(e)?Y.select(e):""}),Ss=a.createSelector((e,t)=>{if(t)return e.providerCatalog?.byWorkspaceId?.[t]?.importDiagnostics??[];const r=e.specialists.importDiagnostics;return r?y(r):[]}),bs=a.createSelector((e,t)=>e.specialists.creationByContext?.[t]??Se),ms=a.createSelector(e=>Object.values(e.specialists.creationByContext??{}).flatMap(t=>t.specialistId?[t.specialistId]:[])),x=V("Clipboard");async function vs(e){let t;if(Le())try{const r=await Oe("system:write-clipboard",{text:e});if(r?.success===!1)throw new Error(r.error||"Electron clipboard write failed");return}catch(r){t=r,x.warn("Electron clipboard write failed; falling back to browser clipboard",{error:r})}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch(r){throw x.error("Browser clipboard write failed",r,{electronError:t}),r}throw x.error("No clipboard write API is available",void 0,{electronError:t}),t instanceof Error?t:new Error("Clipboard write API unavailable")}const _s=a.createSelector(e=>e.directoryPicker.source??"daemon"),As=a.createSelector(e=>e.directoryPicker.listing),ys=a.createSelector(e=>e.directoryPicker.loading),ks=a.createSelector(e=>e.directoryPicker.error),ws=a.createSelector(e=>e.directoryPicker.pathError),Es=a.createSelector(e=>e.directoryPicker.createError),mt=V("WorkspaceValidation");async function Cs(e,t=!1,r=!1){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_repoPathRequired_error(),suggestion:n.workspace_validation_repoPathRequired_suggestion()};const s=e.trim();return vt(s)?At(s):yt(s,t,r)}function vt(e){return[/^https?:\/\/github\.com\//i,/^git@github\.com:/i,/^github\.com\//i,/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/].some(r=>r.test(e.trim()))}function _t(e){const t=e.trim(),r=[/^https?:\/\/github\.com\/([^\/]+)\/([^\/]+)$/i,/^git@github\.com:([^\/]+)\/([^\/]+)$/i,/^github\.com\/([^\/]+)\/([^\/]+)$/i];for(const i of r){const o=t.match(i);if(o){const l=o[2].replace(/\.git$/,"");return l?{owner:o[1],repo:l}:null}}const s=t.match(/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/);if(s&&!t.includes("\\")&&!t.includes(":")){const i=s[2].replace(/\.git$/,"");return i?{owner:s[1],repo:i}:null}return null}async function At(e){return _t(e)?{valid:!0,warning:n.workspace_validation_githubCloneLocally_warning()}:{valid:!1,error:n.workspace_validation_invalidGithubUrl_error(),suggestion:n.workspace_validation_invalidGithubUrl_suggestion()}}async function yt(e,t=!1,r=!1){if(e.includes("\0"))return{valid:!1,error:n.workspace_validation_nullCharacters_error()};if(!e.startsWith("/")&&!e.startsWith("~")&&!e.startsWith(".")&&!e.includes(":\\")&&!/^[a-zA-Z]:\//.test(e))return{valid:!1,error:n.workspace_validation_pathNotAbsolute_error(),suggestion:n.workspace_validation_pathNotAbsolute_suggestion()};if(typeof window<"u"&&window.electronAPI)try{const s=await D("file:getDirectoryStatus",{path:e});if(s.success&&s.data){const l=s.data;return l.exists?l.isDirectory?l.isGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l}:l.isSubdirectoryOfGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l,warning:n.workspace_validation_insideParentRepo_warning({path:l.parentGitRoot??""})}:r?{valid:!0,isNewRepo:!1,directoryStatus:l}:t?l.isEmpty?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_emptyDirInit_warning()}:{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_nonGitDirInit_warning()}:{valid:!1,error:n.workspace_repoSelector_notGitRepository_label(),directoryStatus:l}:{valid:!1,error:n.workspace_validation_notDirectory_error(),suggestion:n.workspace_validation_notDirectory_suggestion(),directoryStatus:l}:t?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExist_suggestion(),directoryStatus:l}}if(!(await D("file:exists",{path:e})).exists)return t?{valid:!0,isNewRepo:!0,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExistLegacy_suggestion()};const o=await D("git:isRepository",{path:e});if(!t&&o?.isRepository!==!0)return{valid:!1,error:o?.isRepository===!1?n.workspace_repoSelector_notGitRepository_label():n.workspace_compactInitializer_gitCheckUnknown_label()};if(!o.isRepository)return{valid:!0,isNewRepo:!0,warning:n.workspace_validation_nonGitInit_warning()}}catch(s){if(mt.warn("Could not validate path existence",s),!t)return{valid:!1,error:n.workspace_compactInitializer_gitCheckUnknown_label()}}return{valid:!0,isNewRepo:!1}}function Ps(e){if(!e||e.trim().length===0)return{valid:!0};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchPrefixInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:t==="."||t===".."||t.startsWith(".")?{valid:!1,error:n.workspace_validation_branchPrefixDot_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchPrefixConsecutive_error()}:t.startsWith("/")?{valid:!1,error:n.workspace_validation_branchPrefixSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchPrefixLock_error()}:t.length>50?{valid:!1,error:n.workspace_validation_branchPrefixTooLong_error()}:{valid:!0}}function Rs(e){if(!e||e.trim().length===0)return"";let t=e.trim().replace(/^[./]+/,"").replace(/[\s~^:?*\[\]\\]/g,"-").replace(/\.{2,}/g,"-").replace(/\/{2,}/g,"/").replace(/-{2,}/g,"-").replace(/^-+/,"").replace(/\.lock$/,"").toLowerCase();return t.length>0&&!t.endsWith("/")&&!t.endsWith("-")&&(t=t.includes("/")?`${t}/`:`${t}/`),t}function Ms(e){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_branchNameRequired_error()};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchNameInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:["HEAD",".",".."].includes(t)?{valid:!1,error:n.workspace_validation_branchNameReserved_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchNameConsecutive_error()}:t.startsWith("/")||t.endsWith("/")?{valid:!1,error:n.workspace_validation_branchNameSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchNameLock_error()}:{valid:!0}}function Ts(e){return!e||e.trim().length===0?{valid:!0}:e.trim().length>1e5?{valid:!1,error:n.workspace_validation_promptTooLong_error(),suggestion:n.workspace_validation_promptTooLong_suggestion()}:{valid:!0}}function Is(e){const t=e.toLowerCase();return t.includes("maxbuffer")?n.workspace_gitError_maxBuffer():t.includes("clone")&&t.includes("timed out")?n.workspace_gitError_cloneTimeout():t.includes("json-rpc request timed out: workspace.create")?n.workspace_gitError_createTimeout():t.includes("timed out")&&["git","clone","fetch","worktree","pull","push","rebase","merge"].some(r=>t.includes(r))?n.workspace_gitError_gitTimeout():t.includes("git clone failed")?t.includes("could not read from remote")?n.workspace_gitError_cloneRemote():t.includes("authentication")||t.includes("permission denied")||t.includes("access denied")?n.workspace_gitError_cloneAuth():n.workspace_gitError_cloneFailed():t.includes("could not resolve any ref to create worktree")?n.workspace_gitError_worktreeRef():t.includes("failed to write file")?t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_writePermission():t.includes("enospc")||t.includes("disk space")?n.workspace_gitError_diskSpaceFree():t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_writeNoEnt():e:t.includes("failed to read file")?t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_readNotFound():t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_readPermission():e:t.includes("permission denied")?n.workspace_gitError_permissionDenied():t.includes("not found")||t.includes("enoent")?n.workspace_gitError_notFound():t.includes("already exists")?n.workspace_gitError_alreadyExists():t.includes("network")||t.includes("etimedout")?n.workspace_gitError_network():t.includes("authentication")||t.includes("401")?t.includes("private repositor")?e:n.workspace_gitError_authFailed():t.includes("rate limit")||t.includes("403")?n.workspace_gitError_rateLimit():t.includes("disk space")||t.includes("enospc")?n.workspace_gitError_diskSpace():e}const kt=["idle","exited"];function wt(e){return e===void 0||!kt.includes(e)}function Fs(e){return e.status==="restarting"?"restarting":wt(e.status)?"running":e.status==="idle"?"idle":e.exitCode===0?"succeeded":e.exitCode===null||e.exitCode===void 0?"exited":e.exitCode>=128?"stopped":"failed"}function Et(e){return e.engine==="os"?"os":e.isLoading||e.keyConfigured[e.provider]===!0?"daemon":e.osEngineAvailable?"os":"unavailable"}const Ds=a.createSelector(e=>e.voiceSettings.isLoading),Ls=a.createSelector(e=>e.voiceSettings.available),Os=a.createSelector(e=>e.voiceSettings.provider),xs=a.createSelector(e=>e.voiceSettings.engine),Ws=a.createSelector(e=>e.voiceSettings.osEngineAvailable),Ns=a.createSelector(e=>e.voiceSettings.keyConfigured),Bs=a.createSelector(e=>e.voiceSettings.vocabulary),Gs=a.createSelector(e=>e.voiceSettings.openaiModel),Vs=a.createSelector(e=>e.voiceSettings.language),Us=a.createSelector(e=>e.voiceSettings.workspaceVocabularyMaxTerms),Hs=a.createSelector(e=>e.voiceSettings.inputDeviceId),qs=a.createSelector(e=>e.voiceSettings.inputDevices),$s=a.createSelector(e=>e.voiceSettings.busyProvider),zs=a.createSelector(e=>e.voiceSettings.error),js=a.createSelector(e=>Re.select(e)?"unavailable":Et(e.voiceSettings)),B="intent.voice.inputDevice";let G;function Ct(){if(G!==void 0)return G;try{const e=localStorage.getItem(B);return typeof e=="string"&&e!==""?e:null}catch{return null}}function Ks(e){G=e;try{e===null?localStorage.removeItem(B):localStorage.setItem(B,e)}catch{}}let R=null;function Zs(e){R=e}function Qs(){const e=R;return R=null,e}function Pt(){R=null}const Rt=300,Mt=300;class Tt{constructor(t){d(this,"holdThresholdMs");d(this,"doublePressWindowMs");d(this,"onRecordStart");d(this,"onRecordStop");d(this,"currentState","idle");d(this,"timer",null);this.holdThresholdMs=t.holdThresholdMs??Rt,this.doublePressWindowMs=t.doublePressWindowMs??Mt,this.onRecordStart=t.onRecordStart,this.onRecordStop=t.onRecordStop}get state(){return this.currentState}keyDown(){switch(this.currentState){case"idle":this.currentState="first-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding"}),this.onRecordStart();break;case"await-second-press":this.clearTimer(),this.currentState="second-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding-send"});break;case"latched":this.currentState="latched-press";break;case"latched-await-second":this.clearTimer(),this.currentState="draining",this.onRecordStop({stopReason:"double-press",autoSend:!0});break}}keyUp(){switch(this.currentState){case"first-press":this.clearTimer(),this.currentState="await-second-press",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="latched"});break;case"holding":this.currentState="idle",this.onRecordStop({stopReason:"hold-release",autoSend:!1});break;case"second-press":this.clearTimer(),this.currentState="idle",this.onRecordStop({stopReason:"double-press",autoSend:!0});break;case"holding-send":this.currentState="idle",this.onRecordStop({stopReason:"double-hold-release",autoSend:!0});break;case"latched-press":this.currentState="latched-await-second",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="idle",this.onRecordStop({stopReason:"latch-stop",autoSend:!1})});break;case"draining":this.currentState="idle";break}}reset(){this.clearTimer(),this.currentState="idle"}armTimer(t,r){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,r()},t)}clearTimer(){this.timer!==null&&clearTimeout(this.timer),this.timer=null}}let M=null;function Ys(e){M=e}function Js(){const e=M;return M=null,e}function It(){M=null}const Ft=66;function Dt(e,t){const r=globalThis.AudioContext;if(typeof r!="function")return()=>{};let s,i,o;try{s=new r,i=s.createMediaStreamSource(e),o=s.createAnalyser(),o.fftSize=1024,o.smoothingTimeConstant=.5,o.minDecibels=-85,o.maxDecibels=-25,i.connect(o)}catch{return i?.disconnect(),s?.close().catch(()=>{}),()=>{}}if(!s||!i)return()=>{};const l=s,c=i,g=new Uint8Array(o.frequencyBinCount),f=setInterval(()=>{o.getByteFrequencyData(g),t(tt(g,l.sampleRate))},Ft);let b=!1;return()=>{b||(b=!0,clearInterval(f),c.disconnect(),l.close().catch(()=>{}))}}const Lt=12e4,Ot=["audio/webm;codecs=opus","audio/webm"];function Xs(){return typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof MediaRecorder<"u"}function xt(e){return e?{audio:{deviceId:{ideal:e}}}:{audio:!0}}function Wt(){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Ot.find(e=>MediaRecorder.isTypeSupported(e))}class Nt{constructor(t){d(this,"maxDurationMs");d(this,"now");d(this,"callbacks");d(this,"deviceId");d(this,"onLevels");d(this,"stopMeter",null);d(this,"currentState","idle");d(this,"recorder",null);d(this,"stream",null);d(this,"chunks",[]);d(this,"startedAt",0);d(this,"maxTimer",null);d(this,"discardRequested",!1);d(this,"cancelRequested",!1);this.maxDurationMs=t.maxDurationMs??Lt,this.now=t.now??Date.now,this.callbacks={onFinished:t.onFinished,onError:t.onError},this.deviceId=t.deviceId??null,this.onLevels=t.onLevels}get state(){return this.currentState}async start(){if(this.currentState!=="idle")return"discarded";this.currentState="starting";let t;try{t=await navigator.mediaDevices.getUserMedia(xt(this.deviceId))}catch(i){const o=this.discardRequested;return this.currentState="stopped",o||this.callbacks.onError(i),o?"discarded":"error"}if(this.discardRequested){for(const i of t.getTracks())i.stop();return this.currentState="stopped","discarded"}this.stream=t;const r=Wt(),s=r?new MediaRecorder(t,{mimeType:r}):new MediaRecorder(t);return this.recorder=s,s.ondataavailable=i=>{i.data&&i.data.size>0&&this.chunks.push(i.data)},s.onstop=()=>this.handleRecorderStop(),s.onerror=i=>this.handleRecorderError(i),s.start(),this.startedAt=this.now(),this.currentState="recording",this.maxTimer=setTimeout(()=>this.stop(),this.maxDurationMs),this.onLevels&&(this.stopMeter=Dt(t,this.onLevels)),"recording"}stop(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&this.recorder?.stop()}cancel(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&(this.cancelRequested=!0,this.recorder?.stop())}handleRecorderStop(){const t=this.now()-this.startedAt,r=this.recorder?.mimeType||"audio/webm",s=this.chunks,i=this.cancelRequested;this.teardown(),!i&&this.callbacks.onFinished({blob:new Blob(s,{type:r}),durationMs:t,mimeType:r})}handleRecorderError(t){const r=t?.error??t;this.teardown(),this.callbacks.onError(r)}teardown(){this.maxTimer!==null&&clearTimeout(this.maxTimer),this.maxTimer=null,this.stopMeter?.(),this.stopMeter=null,this.recorder&&(this.recorder.ondataavailable=null,this.recorder.onstop=null,this.recorder.onerror=null),this.recorder=null;for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null,this.chunks=[],this.currentState="stopped"}}const Bt=300;function Gt(e){const t=e?.name;return t==="NotAllowedError"||t==="SecurityError"}const Vt={stopReason:"manual",autoSend:!1};let p=null,m=null,_=0,E=null;const I=new Tt({onRecordStart:()=>{E&&Ut(E)},onRecordStop:e=>{ee(E,e)}});function ei(){return p!==null}function ti(){return p}function ri(e){E=e,_+=1,_===1&&I.keyDown()}function si(e){E=e,_!==0&&(_-=1,_===0&&I.keyUp())}function Ut(e,t="key"){if(p!==null)return;It(),Pt();const r=new Nt({deviceId:Ct(),onLevels:s=>{p===r&&e.dispatch(me(s))},onFinished:s=>{p===r&&(p=null);const i=m??{stopReason:"auto-stop",autoSend:!1},o=m!==null;if(m=null,e.dispatch(C()),o||I.reset(),s.durationMs<Bt){i.autoSend&&e.dispatch(N());return}e.dispatch(be({...s,stopReason:i.stopReason,autoSend:i.autoSend}))},onError:s=>{p===r&&(p=null),m=null,e.dispatch(C()),e.showHint(Gt(s)?n.hardwareConsole_ptt_micDenied_message():n.hardwareConsole_ptt_recordingFailed_message())}});p=r,e.dispatch(ve({source:t,startedAt:Date.now()})),r.start().then(s=>{if(s!=="recording"&&(p===r&&(p=null),s==="discarded")){const i=m?.autoSend===!0;m=null,e.dispatch(C()),i&&e.dispatch(N())}})}function ee(e,t){const r=p;if(r===null){t.autoSend&&e?.dispatch(N());return}m=t,r.stop()}function ii(){ee(null,Vt)}function ai(e){I.reset(),_=0,m=null;const t=p;t!==null&&(p=null,t.cancel(),e.dispatch(C()))}const Ht=V("HardwareConsoleVoiceSetupToast"),qt="hardware-console-voice-setup";let W=null;function $t(){return W||(W=he(()=>Promise.resolve().then(()=>rt),void 0,import.meta.url).then(e=>e.notify)),W}function zt(){xe("/settings?tab=connections#voice").catch(e=>{Ht.error("Failed to open voice settings from setup toast",e)})}function jt(){return{label:n.hardwareConsole_voice_openSettings_label(),onClick:()=>zt()}}function ni(){$t().then(e=>{e.error(n.hardwareConsole_voice_noKey_error(),{id:qt,action:jt()})})}const oi=a.createSelector(e=>e.externalEditors.selectedAction),Kt=a.createSelector(e=>e.externalEditors.editors),Zt=a.createSelector(e=>{const t=y(Kt.select(e)),r=e.externalEditors.editorOrder??[];if(!r.length)return t;const s=new Map(t.map(l=>[l.id,l])),i=r.flatMap(l=>{const c=s.get(l);return c?[c]:[]}),o=new Set(r);return[...i,...t.filter(({id:l})=>!o.has(l))]}),ci=a.createSelector(e=>e.externalEditors.editorOrder??[]),li=a.createSelector(e=>e.externalEditors.loading),di=a.createSelector(e=>e.externalEditors.lastFetched),Qt=a.createSelector(e=>e.externalEditors.hiddenEditorIds),ui=a.createSelector((e,t)=>{if(!(t?Me.select(e,t):Te.select(e))||_e())return[];const s=Qt.select(e);return Zt.select(e).filter(i=>i.installed&&!s.includes(i.id))});function pi(e,t){if(!e||!t||t===e.providerId)return!1;const r=e.providerSettings[t];return!!(r&&[r.defaultModel,...Object.values(r.typeOverrides??{})].some(s=>typeof s=="string"&&s.includes(":")))}let Yt=0;function Jt(e,t){const r=++Yt;return a.dispatch(ye(e,t,r)),r}function gi(e,t,r){a.dispatch(Ae(e,t,r))}async function te(e,t,r,s){const i=crypto.randomUUID(),o=s?.source??"control";try{return(await a.dispatch(ke({requestId:i,consumerId:o,agentId:e,workspaceId:t,operation:r,connection:Q.select(a.state)},{...s,intent:s?.intent??Jt(e,t)}))).status==="success"}finally{a.dispatch(we(i,o))}}async function hi(e,t,r,s,i){return te(e,t,{kind:"effort",effort:r,previous:s},i)}async function fi(e,t,r,s,i){return te(e,t,{kind:"reconcile",current:r??null,levels:s},i)}const Xt=a.createSelector((e,t)=>y(e.agentModel.mutations).filter(r=>r.consumerId===t)),Si=a.createSelector((e,t)=>Xt.select(e,t).some(r=>r.status==="pending")),bi=a.createSelector((e,t,r)=>{const s=e.agentSessions.byAgentId[t],i=Ie.select(e,t),o=We.select(e,t),l=e.daemonHealth.stats?.protocolVersion,c=Ne(l),g=c?Be(s?.model,null,o):s?.model;return{session:s,providerId:i,levels:o,legacy:c,identity:JSON.stringify([g,i]),connection:Q.select(e),canWrite:!!s&&s.workspaceId===r&&!Fe.select(e,r)}});function er(e,t,r=!1){const s=t?.available===!0&&t.viaNpx!==!0;return e!=="auggie"||s||r}const mi=a.createSelector(e=>$e.select(e)?null:U.select(e)),tr=a.createSelector(e=>e.providerCatalog?.workspaceEpoch??0),S=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]:void 0),vi=a.createSelector(e=>Object.keys(e.providerCatalog?.byWorkspaceId??{})),_i=a.createSelector((e,t)=>!!S.select(e,t)&&e.providerCatalog.workspaceSnapshotEpochs?.[t]===tr.select(e)),re=a.createSelector((e,t)=>t?S.select(e,t)?.catalog.providers??[]:De.select(e)),se=a.createSelector((e,t)=>{if(!t)return Y.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="model.defaultProvider")?.value;return typeof r=="string"?r:""}),q=a.createSelector((e,t)=>{if(!t)return ze.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="providers.enabled")?.value;return r&&typeof r=="object"?r:{}}),ie=a.createSelector((e,t)=>{if(!t)return je.select(e);const r=q.select(e,t),s=se.select(e,t),i=S.select(e,t)?.readiness??{};return re.select(e,t).filter(o=>o.visible&&(!o.canBeDisabled||r[o.id]||o.id===s)&&i[o.id]?.available).map(o=>o.id)}),Ai=a.createSelector((e,t)=>{const r=q.select(e,t),s=t?S.select(e,t)?.readiness??{}:U.select(e);return re.select(e,t).filter(i=>er(i.id,s[i.id],r[i.id]===!0)).map(i=>i.id)}),yi=a.createSelector((e,t)=>t?ie.select(e,t):Ke.select(e)),ki=a.createSelector((e,t)=>v.select(e,t)),wi=a.createSelector((e,t)=>t?!!S.select(e,t):Ze.select(e)),Ei=a.createSelector((e,t)=>{if(!t)return Ge.select(e);const r=S.select(e,t)?.settings??[],s=se.select(e,t),i=r.find(c=>c.path==="model.providerDefaults")?.value,o=i&&typeof i=="object"?i[s]:void 0;if(typeof o=="string")return o;const l=r.find(c=>c.path==="model.default")?.value;return typeof l=="string"?l:""}),Ci=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning?[[r,s.warning]]:[])):Ve.select(e)),Pi=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).map(([r,s])=>[r,s.stale===!0])):Ue.select(e)),Ri=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning&&s.warningKind?[[r,s.warningKind]]:[])):He.select(e)),Mi=a.createSelector((e,t,r)=>{if(!r)return Qe.select(e,t);const s=q.select(e,r),i=S.select(e,r);return ie.select(e,r).filter(o=>o!==t&&(s[o]||i?.catalog.providers.find(l=>l.id===o)?.canBeDisabled===!1)&&Ye(o,i?.readiness[o]?.authenticated))}),Ti=a.createSelector((e,t)=>t?S.select(e,t)?.readiness??{}:U.select(e)),rr={},Ii=a.createSelector(e=>e.providerSettings?.profiles?.status??rr),Z={},sr=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]?.mcpServers??[]:e.mcpSettings.servers),Fi=a.createSelector((e,t,r)=>{const s=e.providerCatalog?.byWorkspaceId?.[t];return s?s.mcpServers?.find(i=>i.id===r)?.name:e.providerCatalog?.mcpServerNamesByWorkspaceId?.[t]?.[r]}),Di=a.createSelector(e=>e.mcpSettings.loading),Li=a.createSelector(e=>e.mcpSettings.error),Oi=a.createSelector(e=>e.mcpSettings.mutationError??null),xi=a.createSelector(e=>e.mcpSettings.enabled),ir=a.createSelector(e=>e.mcpSettings.disabledServers),ar=a.createSelector(e=>e.mcpSettings.statusMap),nr=a.createSelector(e=>e.mcpSettings.toolsMap),or=a.createSelector((e,t)=>{if(!t)return e.mcpSettings.errorMessages;const r=e.providerCatalog?.byWorkspaceId?.[t],s=new Map(r?.mcpServers?.map(i=>[i.id,w(i)])??[]);return Object.fromEntries((r?.mcpStatuses??[]).flatMap(i=>{const o=s.get(i.serverId);return o&&i.lastError?[[o,i.lastError]]:[]}))}),cr=a.createSelector((e,t)=>t?e.mcpSettings.byWorkspaceId[t]?.disabledServers??Z:Z),Wi=a.createSelector((e,t)=>Object.keys(cr.select(e,t))),Ni=a.createSelector(e=>{const t=sr.select(e),r=ar.select(e),s=nr.select(e),i=ir.select(e),o=or.select(e);return t.map(l=>{const c=w(l)in i,g=s[w(l)]||[];let f=r[w(l)]||"disconnected";return c&&(f="disabled"),{...l,disabled:c,status:f,tools:g,toolCount:g.length,errorMessage:o[w(l)]}})});a.createSelector((e,t)=>e.mcpSettings.errorMessages[t]);const Bi=a.createSelector(e=>e.mcpSettings.lastImportedCount),Gi=a.createSelector(e=>e.mcpSettings.advancedSaveStatus),Vi=a.createSelector(e=>e.mcpSettings.advancedSaveError);function h(e){return{category:"settings",...e}}const T=[{id:"new-workspace",tab:"",label:"New workspace",route:"/workspace/new",category:"navigation",description:"Create-workspace flow."},h({id:"utility-default-model",tab:"providers",hashAliases:["utility-default-model","default-model","quickActions.defaultModel","backgroundAgents.defaultModel"],scrollSelector:"#utility-default-model",highlightSelector:'[data-highlight-id="utility-default-model"]',label:"Settings: Default model",route:"/settings?tab=providers#utility-default-model",description:"Default AI behavior model selection."}),h({id:"global-instructions",tab:"agent-behavior",hashAliases:["global-instructions","agents","specialists","all-agents"],scrollSelector:"#global-instructions",highlightSelector:'[data-highlight-id="global-instructions"]',label:"Settings: Agent Behavior",route:"/settings?tab=agent-behavior#global-instructions",description:"Global agent instructions and defaults."}),h({id:"create-specialist",tab:"specialists",hashAliases:["create-specialist"],scrollSelector:"#create-specialist",highlightSelector:'[data-highlight-id="create-specialist"]',label:"Settings: Create specialist",route:"/settings?tab=specialists&view=create-specialist#create-specialist",description:"Create-specialist entry point."}),h({id:"providers",tab:"providers",hashAliases:["providers"],scrollSelector:"#providers",highlightSelector:'[data-highlight-id="providers"]',label:"Settings: AI coding CLIs",route:"/settings?tab=providers#providers",description:"Provider/account selector settings."}),h({id:"integrations",tab:"connections",hashAliases:["integrations"],scrollSelector:"#integrations",highlightSelector:'[data-highlight-id="integrations"]',label:"Settings: Connections",route:"/settings?tab=connections#integrations",description:"Connected integrations settings."}),h({id:"devices",tab:"devices",hashAliases:["devices","machines"],scrollSelector:"#devices",highlightSelector:"#devices",label:"Settings: Machines",route:"/settings?tab=devices#devices",description:"Saved remote machine settings."}),h({id:"mobile",tab:"mobile",hashAliases:["mobile"],scrollSelector:"#mobile",highlightSelector:'[data-highlight-id="mobile"]',label:"Settings: Mobile",route:"/settings?tab=mobile#mobile",description:"Remote access and Intent Mobile pairing."}),h({id:"guest-sessions",tab:"collaboration",hashAliases:["collaboration","guest-sessions","sharing"],scrollSelector:"#collaboration",highlightSelector:"#collaboration",label:"Settings: Collaboration",route:"/settings?tab=collaboration#collaboration",description:"Host membership, workspace guests and joined hosts."}),h({id:"websocket-api",tab:"mobile",hashAliases:["websocket-api","remote-access"],scrollSelector:"#websocket-api",highlightSelector:'[data-highlight-id="websocket-api"]',label:"Settings: Remote Access",route:"/settings?tab=mobile#websocket-api",description:"Remote access (WebSocket API) settings."}),...[["voice","Voice Dictation","Voice dictation settings.","input"],["keyboard-shortcuts","Keyboard Shortcuts","Keyboard shortcuts reference.","input"],["autocomplete","Autocomplete","Suggest as you type: service, model and API keys.","input"],["mcp-servers","MCP Servers","MCP server configuration.","connections"],["plugins","Plugins","App-wide Agent Plugins.","connections"],["git-workspace","Git & Workspace","Git and workspace defaults.","setup"],["git","Git","Git defaults.","setup"],["shell","Shell","Shell settings.","setup"],["workspace","Workspace","Workspace defaults.","setup"],["cli-optimization","CLI Optimization","RTK/CLI optimization settings.","token-savings"],["workspace-api","Tool Output & Retention","Tool output size and retention settings.","advanced"],["notifications","Notifications","Notification preferences.","app-behavior"],["updates","Updates","Application update preferences.","app-behavior"],["open-in","Open In","External editor/app launch preferences.","app-behavior"],["github-link-action","GitHub Links","GitHub issue and pull request link behavior.","app-behavior"],["agent-features","Agent Features","Agent feature settings.","token-savings"],["font-style","Font style","Font style settings.","display"],["language","Language","Application language settings.","display"],["labs","Labs","Experimental feature switches.","advanced"],["agent-backend","Agent Backend","Agent backend settings.","performance"],["connection","Connection","Daemon connection details.","advanced"],["hardware","Hardware","Hardware integration settings.","input"],["developer","Developer","Development-only settings.","advanced"]].map(([e,t,r,s])=>h({id:e,tab:s,hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=${s}#${e}`,description:r})),h({id:"appearance",tab:"display",hashAliases:["appearance","theme"],scrollSelector:"#theme",highlightSelector:'[data-highlight-id="appearance"]',label:"Settings: Appearance",route:"/settings?tab=display#theme",description:"Theme mode controls."}),...[["color-theme","Color theme","Color theme selection."],["note-font","Notes font","Notes/spec font style."],["agent-chat-font","Agent chat font","Agent chat font style."],["code-font","Code font","Code editor and diff font."]].map(([e,t,r])=>h({id:e,tab:"display",hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=display#${e}`,description:r})),h({id:"general",tab:"advanced",hashAliases:["general","reset"],scrollSelector:"#reset",highlightSelector:'[data-highlight-id="general"]',label:"Settings: Advanced",route:"/settings?tab=advanced#reset",description:"Advanced settings and reset controls."}),{id:"workspace-card",tab:"",hashAliases:["workspace-card"],highlightSelector:'[data-highlight-id^="workspace-"]',label:"Workspace card",category:"workspace",description:"A workspace card on workspace list surfaces.",dynamic:!0,idPattern:"workspace-{workspaceId}"},{id:"specialist-entry",tab:"specialists",highlightSelector:'[data-highlight-id^="specialist-"]',label:"Specialist entry",route:"/settings?tab=specialists&specialist={specialistId}#specialist-{specialistId}",category:"specialist",description:"A specific specialist row in settings.",dynamic:!0,idPattern:"specialist-{specialistId}"}];function ae(e){const t=e.indexOf("#"),r=t>=0?e.slice(t+1):e;return decodeURIComponent(r.replace(/^#/,"")).trim()}function lr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dr(e,t){if(!t.match(/\{[^}]+\}/g)?.length)return e===t;const s=t.split(/\{[^}]+\}/g).map(lr).join("[^/]+");return new RegExp(`^${s}$`).test(e)}function ur(e){const t=ae(e);if(!t)return;const r=T.find(i=>i.id===t||i.hashAliases?.includes(t));if(r)return r;const s=T.find(i=>i.route&&i.dynamic&&i.idPattern&&dr(t,i.idPattern));return s?{...s,id:t}:void 0}function Ui(){return T.map(e=>({...e,hashAliases:e.hashAliases?[...e.hashAliases]:void 0}))}function pr(e){try{return new URL(e,"app://intent").pathname||"/"}catch{const t=e.indexOf("?"),r=e.indexOf("#");let s=e.length;return t>=0&&(s=Math.min(s,t)),r>=0&&(s=Math.min(s,r)),e.slice(0,s)||"/"}}const gr=new Set(T.flatMap(e=>e.route?[pr(e.route)]:[])),hr=[/^\/workspace\/[^/]+$/,/^\/agent\/[^/]+$/];function Hi(e){if(typeof e!="string")return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("intent://"))return!0;let r,s;try{const i=new URL(t,"app://intent");if(i.protocol!=="app:")return!1;r=i.pathname||"/",s=ae(i.hash)}catch{return!1}return gr.has(r)?s?!!ur(s):!0:hr.some(i=>i.test(r))}const qi=["agentFeatures.backgroundHooks","agentFeatures.hostExec","agentFeatures.secretRequests","agentFeatures.scripts","agentFeatures.terminalAccess","agentFeatures.browserAutomation","agentFeatures.desktopControl","agentFeatures.richChatBlocks","agentFeatures.structuredQuestions","agentFeatures.attentionRequests","agentFeatures.stateSnapshot","agentFeatures.prMonitor","agentFeatures.taskGraph","agentFeatures.peerAgents","agentFeatures.mcpTools"],fr=[{path:"agentFeatures.backgroundHooks",label:()=>n.settings_agentFeatures_backgroundHooks_label(),description:()=>n.settings_agentFeatures_backgroundHooks_description(),defaultValue:!0},{path:"agentFeatures.hostExec",label:()=>n.settings_agentFeatures_hostExec_label(),description:()=>n.settings_agentFeatures_hostExec_description(),defaultValue:!0},{path:"agentFeatures.secretRequests",label:()=>n.settings_agentFeatures_secretRequests_label(),description:()=>n.settings_agentFeatures_secretRequests_description(),defaultValue:!1},{path:"agentFeatures.scripts",label:()=>n.settings_agentFeatures_scripts_label(),description:()=>n.settings_agentFeatures_scripts_description(),defaultValue:!0},{path:"agentFeatures.terminalAccess",label:()=>n.settings_agentFeatures_terminalAccess_label(),description:()=>n.settings_agentFeatures_terminalAccess_description(),defaultValue:!0},{path:"agentFeatures.browserAutomation",label:()=>n.settings_agentFeatures_browserAutomation_label(),description:()=>n.settings_agentFeatures_browserAutomation_description(),defaultValue:!0},{path:"agentFeatures.desktopControl",label:()=>n.settings_agentFeatures_desktopControl_label(),description:()=>n.settings_agentFeatures_desktopControl_description(),info:()=>n.settings_agentFeatures_desktopControl_info(),defaultValue:!0},{path:"agentFeatures.richChatBlocks",label:()=>n.settings_agentFeatures_richChatBlocks_label(),description:()=>n.settings_agentFeatures_richChatBlocks_description(),defaultValue:!0},{path:"agentFeatures.structuredQuestions",label:()=>n.settings_agentFeatures_structuredQuestions_label(),description:()=>n.settings_agentFeatures_structuredQuestions_description(),defaultValue:!0},{path:"agentFeatures.attentionRequests",label:()=>n.settings_agentFeatures_attentionRequests_label(),description:()=>n.settings_agentFeatures_attentionRequests_description(),defaultValue:!0},{path:"agentFeatures.stateSnapshot",label:()=>n.settings_agentFeatures_stateSnapshot_label(),description:()=>n.settings_agentFeatures_stateSnapshot_description(),defaultValue:!0},{path:"agentFeatures.prMonitor",label:()=>n.settings_agentFeatures_prMonitor_label(),description:()=>n.settings_agentFeatures_prMonitor_description(),defaultValue:!0},{path:"agentFeatures.taskGraph",label:()=>n.settings_agentFeatures_taskGraph_label(),description:()=>n.settings_agentFeatures_taskGraph_description(),defaultValue:!0},{path:"agentFeatures.peerAgents",label:()=>n.settings_agentFeatures_peerAgents_label(),description:()=>n.settings_agentFeatures_peerAgents_description(),defaultValue:!0},{path:"agentFeatures.mcpTools",label:()=>n.settings_agentFeatures_mcpTools_label(),description:()=>n.settings_agentFeatures_mcpTools_description(),defaultValue:!0}],$i=Object.fromEntries(fr.map(e=>[e.path,e.defaultValue]));export{Ri as $,Hi as A,Xs as B,Ct as C,zr as D,Jt as E,fr as F,J as G,_t as H,fi as I,gi as J,Et as K,ur as L,Rs as M,Ks as N,Si as O,Xt as P,bi as Q,Zr as R,A as S,es as T,yi as U,se as V,q as W,Ai as X,ie as Y,re as Z,Pi as _,Je as a,sr as a$,Ci as a0,Mi as a1,Ti as a2,wi as a3,Ei as a4,ki as a5,Jr as a6,rs as a7,Es as a8,ks as a9,qr as aA,Lr as aB,xr as aC,Gr as aD,Wr as aE,Br as aF,Or as aG,Hr as aH,Dr as aI,$r as aJ,ps as aK,Qt as aL,Zt as aM,ui as aN,li as aO,ds as aP,us as aQ,di as aR,Vi as aS,Gi as aT,ir as aU,xi as aV,Li as aW,or as aX,Bi as aY,Di as aZ,Oi as a_,As as aa,ys as ab,ws as ac,_s as ad,ci as ae,ls as af,fs as ag,ns as ah,js as ai,os as aj,cs as ak,Qr as al,Xr as am,H as an,it as ao,dt as ap,ut as aq,X as ar,lt as as,at,st as au,ot as av,ct as aw,Nr as ax,Vr as ay,Ur as az,$i as b,Ni as b0,ar as b1,nr as b2,oi as b3,is as b4,Ii as b5,mi as b6,St as b7,bs as b8,ms as b9,Fi as bA,Zs as bB,Ys as bC,ni as bD,Ut as bE,ii as bF,Ms as bG,Ps as bH,Ts as bI,Cs as bJ,jt as bK,vs as bL,hs as ba,Ss as bb,as as bc,gs as bd,v as be,ts as bf,Yr as bg,$s as bh,xs as bi,Hs as bj,qs as bk,Ns as bl,Vs as bm,Gs as bn,Ws as bo,Os as bp,Ls as bq,zs as br,Ds as bs,Bs as bt,Us as bu,S as bv,tr as bw,_i as bx,vi as by,Wi as bz,qi as c,hi as d,ai as e,Pt as f,It as g,Qs as h,Js as i,ss as j,ft as k,ht as l,ti as m,Ui as n,Is as o,Fs as p,jr as q,Kr as r,ri as s,si as t,rt as u,wt as v,er as w,ei as x,pi as y,K as z};
|
|
1
|
+
var ne=Object.defineProperty;var oe=(e,t,r)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var d=(e,t,r)=>oe(e,typeof t!="symbol"?t+"":t,r);import{m as ce,N as le,T as de,d as ue,o as pe,w as ge}from"./I4WMrmBa.js";import"./3SdAC2_C.js";import{bm as n,_ as he}from"./Dv_tIgjy.js";import"./DLx1kqr5.js";import"./BPxuNmyn.js";import"./D7fB2Oi-.js";import{c as V}from"./ChTqQfQN.js";import"./KS3jDVZW.js";import{Jv as a,uA as fe,nY as y,nX as k,mp as Se,yX as C,yY as N,yV as be,yU as me,yW as ve,rT as _e,c8 as Ae,c7 as ye,cm as ke,cl as we,n_ as w}from"./CWhRK5Rp.js";import{cU as Ee,cJ as Ce,bJ as Pe,cl as Re,cB as Me,cn as Te,cS as Q,aJ as Ie,c3 as Fe,c_ as De}from"./BqA-3o9l.js";import{a as Le,i as Oe}from"./CL3a4Hm1.js";import{i as D}from"./BBWuirRW.js";import{n as xe}from"./BCME5FCI.js";import{x as We,aO as Ne,c as Be,aD as Ge,B as Ve,y as Ue,z as He}from"./Bsz2ybz8.js";import{a0 as qe,K as Y,a1 as $e,ay as U,Z as ze,a3 as je,L as Ke,$ as Ze,aA as Qe,x as Ye}from"./BivYofy-.js";const Je=5,L=120,Xe=4e3,j=.2,et=.8;function tt(e,t,r=Je){const s=e.length>0?t/(2*e.length):0,i=Xe/L;return Array.from({length:r},(o,l)=>{if(s<=0)return 0;const c=L*i**(l/r),g=L*i**((l+1)/r),f=Math.min(e.length-1,Math.floor(c/s)),b=Math.min(e.length,Math.max(f+1,Math.ceil(g/s)));let $=0;for(let F=f;F<b;F+=1)$+=e[F]??0;const z=($/(b-f)/255-j)/(et-j);return Number.isFinite(z)?Math.min(1,Math.max(0,z)):0})}const rt=Object.freeze(Object.defineProperty({__proto__:null,NOTIFY_DURATION:le,TOAST_COUNTDOWN_CLASS:de,TOAST_COUNTDOWN_NO_HOVER_PAUSE_CLASS:ue,notify:ce,notifyMetadata:pe,withToastCountdown:ge},Symbol.toStringTag,{value:"Module"})),Dr=a.createSelector(e=>Ee.select(e)?.capabilities.gitlabCheckout===!0),Lr=a.createSelector(e=>e.gitlabAuth.host),Or=a.createSelector(e=>e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host),xr=a.createSelector(e=>fe(e.gitlabAuth.instanceBaseUrl??e.gitlabAuth.host)??""),Wr=a.createSelector(e=>e.gitlabAuth.isCancelling),Nr=a.createSelector(e=>e.gitlabAuth.cancelOutcome),Br=a.createSelector(e=>e.gitlabAuth.isConfigured),Gr=a.createSelector(e=>e.gitlabAuth.isAuthenticating),Vr=a.createSelector(e=>e.gitlabAuth.deviceFlow),Ur=a.createSelector(e=>e.gitlabAuth.deviceGrantSupported),Hr=a.createSelector(e=>e.gitlabAuth.user),qr=a.createSelector(e=>e.gitlabAuth.error);a.createSelector(e=>e.gitlabAuth.method);const $r=a.createSelector(e=>e.gitlabAuth.statusReady===!0),A=[{id:"pr-reviewer",icon:"pr-reviewer",get name(){return n.specialists_builtin_prReviewer_name()},get description(){return n.specialists_builtin_prReviewer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"ui-designer",icon:"ui-designer",get name(){return n.specialists_builtin_uiDesigner_name()},get description(){return n.specialists_builtin_uiDesigner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"vulnerability-scanner",icon:"pr-reviewer",get name(){return n.specialists_builtin_vulnerabilityScanner_name()},get description(){return n.specialists_builtin_vulnerabilityScanner_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"developer",icon:"verifier",get name(){return n.specialists_builtin_developer_name()},get description(){return n.specialists_builtin_developer_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"product-manager",icon:"coordinator",get name(){return n.specialists_builtin_productManager_name()},get description(){return n.specialists_builtin_productManager_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"maintenance-coordinator",icon:"ralph",get name(){return n.specialists_builtin_maintenanceCoordinator_name()},get description(){return n.specialists_builtin_maintenanceCoordinator_description()},defaultBehaviorPrompt:"",promptUnavailable:!0},{id:"chief-of-staff",icon:"chief-of-staff",get name(){return n.specialists_builtin_chiefOfStaff_name()},get description(){return n.specialists_builtin_chiefOfStaff_description()},hidden:!0,defaultBehaviorPrompt:"",promptUnavailable:!0}],J=new Set(["pr-reviewer"]),zr="developer";function jr(e){return A.find(t=>t.id===e)}const st=a.createSelector(e=>e.githubAuth.mutationRequestId),it=a.createSelector(e=>e.githubAuth.callbacksCancelled),at=a.createSelector(e=>e.githubAuth.isDisconnecting),X=a.createSelector(e=>e.githubAuth.isAuthenticated),nt=a.createSelector(e=>e.githubAuth.statusSettled===!0),ot=a.createSelector(e=>e.githubAuth.requiresDaemonAuth),ct=a.createSelector(e=>e.githubAuth.user),lt=a.createSelector(e=>e.githubAuth.isAuthenticating),dt=a.createSelector(e=>e.githubAuth.deviceFlow),ut=a.createSelector(e=>e.githubAuth.error),Kr=Object.freeze(Object.defineProperty({__proto__:null,selectGitHubAuthCallbacksCancelled:it,selectGitHubAuthDeviceFlow:dt,selectGitHubAuthError:ut,selectGitHubAuthIsAuthenticated:X,selectGitHubAuthIsAuthenticating:lt,selectGitHubAuthIsDisconnecting:at,selectGitHubAuthMutationRequestId:st,selectGitHubAuthRequiresDaemonAuth:ot,selectGitHubAuthStatusSettled:nt,selectGitHubAuthUser:ct},Symbol.toStringTag,{value:"Module"}));function u(e){return e??""}function pt(e,t){const r=e??[],s=t??[];return r.length===s.length&&r.every((i,o)=>u(i.provider)===u(s[o].provider)&&i.model===s[o].model&&i.hint===s[o].hint&&u(i.reasoningEffort)===u(s[o].reasoningEffort))}function K(e,t){if(e.source!=="user"||!t?.ignoreModelPin&&(e.model||e.codingAgent))return!1;const r=e.bundled;return r?u(e.name)===u(r.name)&&u(e.description)===u(r.description)&&u(e.behaviorPrompt)===u(r.behaviorPrompt)&&u(e.roleReminder)===u(r.roleReminder)&&u(e.reasoningEffort)===u(r.reasoningEffort)&&pt(e.modelOptions,r.modelOptions):!1}const Zr=a.createSelector(e=>e.specialists.bundledSpecialists),gt=a.createSelector(e=>e.specialists.fileSpecialists),Qr=a.createSelector(e=>y(gt.select(e))),Yr=a.createSelector(e=>e.specialists.userOverrides);a.createSelector(e=>e.specialists.overridesLoaded);const Jr=a.createSelector(e=>e.specialists.customSpecialistsLoaded),Xr=a.createSelector(e=>e.specialists.fileSpecialistsLoaded),es=a.createSelector(e=>e.specialists.bundledSpecialistsLoaded),ts=a.createSelector(e=>e.specialists.specialistsFolderPath),rs=a.createSelector((e,t)=>{if(!t)return e.specialists.defaultSpecialistId??"";const r=e.providerCatalog?.byWorkspaceId?.[t]?.settings.find(s=>s.path==="specialists.default")?.value;return typeof r=="string"?r:""});a.createSelector(e=>e.specialists.providerModelOverrides);const O=a.createSelector((e,t)=>!(J.has(t)&&!X.select(e)));function ht(e,t){return t?e:e.filter(r=>!J.has(r.id))}function ft(e,t){return ht(e,t).filter(r=>!r.hidden)}function ss(e,t){return ft(e,t).filter(r=>r.role!=="internal")}const v=a.createSelector((e,t)=>{if(t)return(e.providerCatalog?.byWorkspaceId?.[t]?.specialists??[]).map(c=>({...c,defaultModel:c.model,defaultBehaviorPrompt:c.behaviorPrompt??c.prompt??"",defaultAgentType:c.agentType}));const r=y(e.specialists.fileSpecialists),s=e.specialists.bundledSpecialists,i=new Set,o=[];for(const c of r)!i.has(c.id)&&O.select(e,c.id)&&(i.add(c.id),o.push({id:c.id,name:c.name,description:c.description,codingAgent:c.codingAgent,defaultModel:c.model||void 0,defaultBehaviorPrompt:c.behaviorPrompt,roleReminder:c.roleReminder,source:c.source,importedFrom:c.importedFrom,unsupportedFields:c.unsupportedFields,requiredSkills:c.requiredSkills,missingSkills:c.missingSkills,hidden:c.hidden,resolvedModel:c.resolvedModel,resolvedProvider:c.resolvedProvider,modelOptions:c.modelOptions,reasoningEffort:c.reasoningEffort,role:c.role,teamAgents:c.teamAgents,icon:c.icon}));for(const c of s)!i.has(c.id)&&O.select(e,c.id)&&(i.add(c.id),o.push(c));if(!e.specialists.bundledSpecialistsLoaded&&r.length===0&&s.length===0)for(const c of A)!i.has(c.id)&&O.select(e,c.id)&&(i.add(c.id),o.push(c));const l=new Map;for(const c of A)l.has(c.id)||l.set(c.id,l.size);for(const c of s)l.has(c.id)||l.set(c.id,l.size);return o.sort((c,g)=>{const f=l.has(c.id),b=l.has(g.id);return f&&b?(l.get(c.id)??0)-(l.get(g.id)??0):f&&!b?-1:!f&&b?1:c.name.localeCompare(g.name)}),o}),is=a.createSelector(e=>{const t=v.select(e).filter(s=>s.role==="orchestrator");if(t.length===0)return null;const r=new Set([...A.map(({id:s})=>s),...e.specialists.bundledSpecialists.map(({id:s})=>s)]);return t.sort((s,i)=>+!r.has(s.id)-+!r.has(i.id)||s.id.localeCompare(i.id)),t[0]}),St=a.createSelector((e,t)=>{const r=k(e.specialists.fileSpecialists,t);if(r)return{id:r.id,name:r.name,description:r.description,source:r.source};const s=e.specialists.bundledSpecialists.find(i=>i.id===t);if(s)return{id:s.id,name:s.name,description:s.description,source:"builtin"};if(!e.specialists.bundledSpecialistsLoaded&&y(e.specialists.fileSpecialists).length===0&&e.specialists.bundledSpecialists.length===0){const i=A.find(o=>o.id===t);if(i)return{id:i.id,name:i.name,description:i.description,source:"builtin"}}return null}),as=a.createSelector((e,t)=>St.select(e,t)?.name??null),ns=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultModel?i.defaultModel:i.resolvedModel??"":""}),os=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.defaultModel||void 0),cs=a.createSelector((e,t,r)=>v.select(e,r).find(o=>o.id===t)?.reasoningEffort||void 0),ls=a.createSelector((e,t,r)=>{const i=v.select(e,r).find(o=>o.id===t);return i?i.defaultBehaviorPrompt:""});function P(e,t){return t.some(r=>r.id===e)||A.some(r=>r.id===e)}const ds=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.importedFrom?!1:s.source==="bundled"||s.source==="user"&&P(t,e.specialists.bundledSpecialists)}return P(t,e.specialists.bundledSpecialists)}),us=a.createSelector((e,t,r)=>r?!!H.select(e,t,r):!!k(e.specialists.fileSpecialists,t)),ps=a.createSelector((e,t,r)=>{if(r){const o=H.select(e,t,r);return!o||o.importedFrom||o.source==="project"?!1:P(t,e.specialists.bundledSpecialists)&&!K(o)}if(!P(t,e.specialists.bundledSpecialists))return!1;const i=k(e.specialists.fileSpecialists,t);return!i||i.source!=="user"?!1:!K(i)}),H=a.createSelector((e,t,r)=>{if(r){const s=e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(i=>i.id===t);return!s||s.source==="bundled"?void 0:{...s,source:s.source,model:s.model??"",behaviorPrompt:s.behaviorPrompt??s.prompt??"",filePath:s.path??""}}return k(e.specialists.fileSpecialists,t)}),gs=a.createSelector((e,t,r)=>{const s=H.select(e,t,r);return r&&!s?e.providerCatalog?.byWorkspaceId?.[r]?.specialists.some(i=>i.id===t)?"Built-in":null:s?.source==="project"?"Project":s?.source==="user"?"User":e.specialists.bundledSpecialists.some(i=>i.id===t)?"Built-in":null}),hs=a.createSelector((e,t,r)=>{if(r)return e.providerCatalog?.byWorkspaceId?.[r]?.specialists.find(o=>o.id===t)?.path;const s=k(e.specialists.fileSpecialists,t);if(s)return s.filePath;const i=e.specialists.bundledSpecialists.find(o=>o.id===t);if(i&&"filePath"in i)return i.filePath}),fs=a.createSelector((e,t,r)=>{if(r){const i=v.select(e,r).find(c=>c.id===t),o=i?.codingAgent||i?.resolvedProvider;if(o)return Ce.select(e,o,r);const l=Pe.select(e,r);return e.providerCatalog?.byWorkspaceId?.[r]?.readiness[l]?.available?l:""}const s=k(e.specialists.fileSpecialists,t);return s?.codingAgent?s.codingAgent:bt.select(e,t)}),bt=a.createSelector((e,t)=>{const s=v.select(e).find(i=>i.id===t);return s?.codingAgent?s.codingAgent:qe.select(e)?Y.select(e):""}),Ss=a.createSelector((e,t)=>{if(t)return e.providerCatalog?.byWorkspaceId?.[t]?.importDiagnostics??[];const r=e.specialists.importDiagnostics;return r?y(r):[]}),bs=a.createSelector((e,t)=>e.specialists.creationByContext?.[t]??Se),ms=a.createSelector(e=>Object.values(e.specialists.creationByContext??{}).flatMap(t=>t.specialistId?[t.specialistId]:[])),x=V("Clipboard");async function vs(e){let t;if(Le())try{const r=await Oe("system:write-clipboard",{text:e});if(r?.success===!1)throw new Error(r.error||"Electron clipboard write failed");return}catch(r){t=r,x.warn("Electron clipboard write failed; falling back to browser clipboard",{error:r})}if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch(r){throw x.error("Browser clipboard write failed",r,{electronError:t}),r}throw x.error("No clipboard write API is available",void 0,{electronError:t}),t instanceof Error?t:new Error("Clipboard write API unavailable")}const _s=a.createSelector(e=>e.directoryPicker.source??"daemon"),As=a.createSelector(e=>e.directoryPicker.listing),ys=a.createSelector(e=>e.directoryPicker.loading),ks=a.createSelector(e=>e.directoryPicker.error),ws=a.createSelector(e=>e.directoryPicker.pathError),Es=a.createSelector(e=>e.directoryPicker.createError),mt=V("WorkspaceValidation");async function Cs(e,t=!1,r=!1){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_repoPathRequired_error(),suggestion:n.workspace_validation_repoPathRequired_suggestion()};const s=e.trim();return vt(s)?At(s):yt(s,t,r)}function vt(e){return[/^https?:\/\/github\.com\//i,/^git@github\.com:/i,/^github\.com\//i,/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/].some(r=>r.test(e.trim()))}function _t(e){const t=e.trim(),r=[/^https?:\/\/github\.com\/([^\/]+)\/([^\/]+)$/i,/^git@github\.com:([^\/]+)\/([^\/]+)$/i,/^github\.com\/([^\/]+)\/([^\/]+)$/i];for(const i of r){const o=t.match(i);if(o){const l=o[2].replace(/\.git$/,"");return l?{owner:o[1],repo:l}:null}}const s=t.match(/^([a-zA-Z0-9\-_]+)\/([a-zA-Z0-9\-_\.]+)$/);if(s&&!t.includes("\\")&&!t.includes(":")){const i=s[2].replace(/\.git$/,"");return i?{owner:s[1],repo:i}:null}return null}async function At(e){return _t(e)?{valid:!0,warning:n.workspace_validation_githubCloneLocally_warning()}:{valid:!1,error:n.workspace_validation_invalidGithubUrl_error(),suggestion:n.workspace_validation_invalidGithubUrl_suggestion()}}async function yt(e,t=!1,r=!1){if(e.includes("\0"))return{valid:!1,error:n.workspace_validation_nullCharacters_error()};if(!e.startsWith("/")&&!e.startsWith("~")&&!e.startsWith(".")&&!e.includes(":\\")&&!/^[a-zA-Z]:\//.test(e))return{valid:!1,error:n.workspace_validation_pathNotAbsolute_error(),suggestion:n.workspace_validation_pathNotAbsolute_suggestion()};if(typeof window<"u"&&window.electronAPI)try{const s=await D("file:getDirectoryStatus",{path:e});if(s.success&&s.data){const l=s.data;return l.exists?l.isDirectory?l.isGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l}:l.isSubdirectoryOfGitRepo?{valid:!0,isNewRepo:!1,directoryStatus:l,warning:n.workspace_validation_insideParentRepo_warning({path:l.parentGitRoot??""})}:r?{valid:!0,isNewRepo:!1,directoryStatus:l}:t?l.isEmpty?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_emptyDirInit_warning()}:{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_nonGitDirInit_warning()}:{valid:!1,error:n.workspace_repoSelector_notGitRepository_label(),directoryStatus:l}:{valid:!1,error:n.workspace_validation_notDirectory_error(),suggestion:n.workspace_validation_notDirectory_suggestion(),directoryStatus:l}:t?{valid:!0,isNewRepo:!0,directoryStatus:l,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExist_suggestion(),directoryStatus:l}}if(!(await D("file:exists",{path:e})).exists)return t?{valid:!0,isNewRepo:!0,warning:n.workspace_validation_willCreateRepo_warning()}:{valid:!1,error:n.workspace_validation_dirNotExist_error(),suggestion:n.workspace_validation_dirNotExistLegacy_suggestion()};const o=await D("git:isRepository",{path:e});if(!t&&o?.isRepository!==!0)return{valid:!1,error:o?.isRepository===!1?n.workspace_repoSelector_notGitRepository_label():n.workspace_compactInitializer_gitCheckUnknown_label()};if(!o.isRepository)return{valid:!0,isNewRepo:!0,warning:n.workspace_validation_nonGitInit_warning()}}catch(s){if(mt.warn("Could not validate path existence",s),!t)return{valid:!1,error:n.workspace_compactInitializer_gitCheckUnknown_label()}}return{valid:!0,isNewRepo:!1}}function Ps(e){if(!e||e.trim().length===0)return{valid:!0};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchPrefixInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:t==="."||t===".."||t.startsWith(".")?{valid:!1,error:n.workspace_validation_branchPrefixDot_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchPrefixConsecutive_error()}:t.startsWith("/")?{valid:!1,error:n.workspace_validation_branchPrefixSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchPrefixLock_error()}:t.length>50?{valid:!1,error:n.workspace_validation_branchPrefixTooLong_error()}:{valid:!0}}function Rs(e){if(!e||e.trim().length===0)return"";let t=e.trim().replace(/^[./]+/,"").replace(/[\s~^:?*\[\]\\]/g,"-").replace(/\.{2,}/g,"-").replace(/\/{2,}/g,"/").replace(/-{2,}/g,"-").replace(/^-+/,"").replace(/\.lock$/,"").toLowerCase();return t.length>0&&!t.endsWith("/")&&!t.endsWith("-")&&(t=t.includes("/")?`${t}/`:`${t}/`),t}function Ms(e){if(!e||e.trim().length===0)return{valid:!1,error:n.workspace_validation_branchNameRequired_error()};const t=e.trim();return/[\s~^:?*\[\]\\]/.test(t)?{valid:!1,error:n.workspace_validation_branchNameInvalidChars_error(),suggestion:n.workspace_validation_branchChars_suggestion()}:["HEAD",".",".."].includes(t)?{valid:!1,error:n.workspace_validation_branchNameReserved_error()}:t.includes("..")||t.includes("//")?{valid:!1,error:n.workspace_validation_branchNameConsecutive_error()}:t.startsWith("/")||t.endsWith("/")?{valid:!1,error:n.workspace_validation_branchNameSlash_error()}:t.endsWith(".lock")?{valid:!1,error:n.workspace_validation_branchNameLock_error()}:{valid:!0}}function Ts(e){return!e||e.trim().length===0?{valid:!0}:e.trim().length>1e5?{valid:!1,error:n.workspace_validation_promptTooLong_error(),suggestion:n.workspace_validation_promptTooLong_suggestion()}:{valid:!0}}function Is(e){const t=e.toLowerCase();return t.includes("maxbuffer")?n.workspace_gitError_maxBuffer():t.includes("clone")&&t.includes("timed out")?n.workspace_gitError_cloneTimeout():t.includes("json-rpc request timed out: workspace.create")?n.workspace_gitError_createTimeout():t.includes("timed out")&&["git","clone","fetch","worktree","pull","push","rebase","merge"].some(r=>t.includes(r))?n.workspace_gitError_gitTimeout():t.includes("git clone failed")?t.includes("could not read from remote")?n.workspace_gitError_cloneRemote():t.includes("authentication")||t.includes("permission denied")||t.includes("access denied")?n.workspace_gitError_cloneAuth():n.workspace_gitError_cloneFailed():t.includes("could not resolve any ref to create worktree")?n.workspace_gitError_worktreeRef():t.includes("failed to write file")?t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_writePermission():t.includes("enospc")||t.includes("disk space")?n.workspace_gitError_diskSpaceFree():t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_writeNoEnt():e:t.includes("failed to read file")?t.includes("enoent")||t.includes("no such file")?n.workspace_gitError_readNotFound():t.includes("eacces")||t.includes("permission denied")?n.workspace_gitError_readPermission():e:t.includes("permission denied")?n.workspace_gitError_permissionDenied():t.includes("not found")||t.includes("enoent")?n.workspace_gitError_notFound():t.includes("already exists")?n.workspace_gitError_alreadyExists():t.includes("network")||t.includes("etimedout")?n.workspace_gitError_network():t.includes("authentication")||t.includes("401")?t.includes("private repositor")?e:n.workspace_gitError_authFailed():t.includes("rate limit")||t.includes("403")?n.workspace_gitError_rateLimit():t.includes("disk space")||t.includes("enospc")?n.workspace_gitError_diskSpace():e}const kt=["idle","exited"];function wt(e){return e===void 0||!kt.includes(e)}function Fs(e){return e.status==="restarting"?"restarting":wt(e.status)?"running":e.status==="idle"?"idle":e.exitCode===0?"succeeded":e.exitCode===null||e.exitCode===void 0?"exited":e.exitCode>=128?"stopped":"failed"}function Et(e){return e.engine==="os"?"os":e.isLoading||e.keyConfigured[e.provider]===!0?"daemon":e.osEngineAvailable?"os":"unavailable"}const Ds=a.createSelector(e=>e.voiceSettings.isLoading),Ls=a.createSelector(e=>e.voiceSettings.available),Os=a.createSelector(e=>e.voiceSettings.provider),xs=a.createSelector(e=>e.voiceSettings.engine),Ws=a.createSelector(e=>e.voiceSettings.osEngineAvailable),Ns=a.createSelector(e=>e.voiceSettings.keyConfigured),Bs=a.createSelector(e=>e.voiceSettings.vocabulary),Gs=a.createSelector(e=>e.voiceSettings.openaiModel),Vs=a.createSelector(e=>e.voiceSettings.language),Us=a.createSelector(e=>e.voiceSettings.workspaceVocabularyMaxTerms),Hs=a.createSelector(e=>e.voiceSettings.inputDeviceId),qs=a.createSelector(e=>e.voiceSettings.inputDevices),$s=a.createSelector(e=>e.voiceSettings.busyProvider),zs=a.createSelector(e=>e.voiceSettings.error),js=a.createSelector(e=>Re.select(e)?"unavailable":Et(e.voiceSettings)),B="intent.voice.inputDevice";let G;function Ct(){if(G!==void 0)return G;try{const e=localStorage.getItem(B);return typeof e=="string"&&e!==""?e:null}catch{return null}}function Ks(e){G=e;try{e===null?localStorage.removeItem(B):localStorage.setItem(B,e)}catch{}}let R=null;function Zs(e){R=e}function Qs(){const e=R;return R=null,e}function Pt(){R=null}const Rt=300,Mt=300;class Tt{constructor(t){d(this,"holdThresholdMs");d(this,"doublePressWindowMs");d(this,"onRecordStart");d(this,"onRecordStop");d(this,"currentState","idle");d(this,"timer",null);this.holdThresholdMs=t.holdThresholdMs??Rt,this.doublePressWindowMs=t.doublePressWindowMs??Mt,this.onRecordStart=t.onRecordStart,this.onRecordStop=t.onRecordStop}get state(){return this.currentState}keyDown(){switch(this.currentState){case"idle":this.currentState="first-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding"}),this.onRecordStart();break;case"await-second-press":this.clearTimer(),this.currentState="second-press",this.armTimer(this.holdThresholdMs,()=>{this.currentState="holding-send"});break;case"latched":this.currentState="latched-press";break;case"latched-await-second":this.clearTimer(),this.currentState="draining",this.onRecordStop({stopReason:"double-press",autoSend:!0});break}}keyUp(){switch(this.currentState){case"first-press":this.clearTimer(),this.currentState="await-second-press",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="latched"});break;case"holding":this.currentState="idle",this.onRecordStop({stopReason:"hold-release",autoSend:!1});break;case"second-press":this.clearTimer(),this.currentState="idle",this.onRecordStop({stopReason:"double-press",autoSend:!0});break;case"holding-send":this.currentState="idle",this.onRecordStop({stopReason:"double-hold-release",autoSend:!0});break;case"latched-press":this.currentState="latched-await-second",this.armTimer(this.doublePressWindowMs,()=>{this.currentState="idle",this.onRecordStop({stopReason:"latch-stop",autoSend:!1})});break;case"draining":this.currentState="idle";break}}reset(){this.clearTimer(),this.currentState="idle"}armTimer(t,r){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,r()},t)}clearTimer(){this.timer!==null&&clearTimeout(this.timer),this.timer=null}}let M=null;function Ys(e){M=e}function Js(){const e=M;return M=null,e}function It(){M=null}const Ft=66;function Dt(e,t){const r=globalThis.AudioContext;if(typeof r!="function")return()=>{};let s,i,o;try{s=new r,i=s.createMediaStreamSource(e),o=s.createAnalyser(),o.fftSize=1024,o.smoothingTimeConstant=.5,o.minDecibels=-85,o.maxDecibels=-25,i.connect(o)}catch{return i?.disconnect(),s?.close().catch(()=>{}),()=>{}}if(!s||!i)return()=>{};const l=s,c=i,g=new Uint8Array(o.frequencyBinCount),f=setInterval(()=>{o.getByteFrequencyData(g),t(tt(g,l.sampleRate))},Ft);let b=!1;return()=>{b||(b=!0,clearInterval(f),c.disconnect(),l.close().catch(()=>{}))}}const Lt=12e4,Ot=["audio/webm;codecs=opus","audio/webm"];function Xs(){return typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"&&typeof MediaRecorder<"u"}function xt(e){return e?{audio:{deviceId:{ideal:e}}}:{audio:!0}}function Wt(){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Ot.find(e=>MediaRecorder.isTypeSupported(e))}class Nt{constructor(t){d(this,"maxDurationMs");d(this,"now");d(this,"callbacks");d(this,"deviceId");d(this,"onLevels");d(this,"stopMeter",null);d(this,"currentState","idle");d(this,"recorder",null);d(this,"stream",null);d(this,"chunks",[]);d(this,"startedAt",0);d(this,"maxTimer",null);d(this,"discardRequested",!1);d(this,"cancelRequested",!1);this.maxDurationMs=t.maxDurationMs??Lt,this.now=t.now??Date.now,this.callbacks={onFinished:t.onFinished,onError:t.onError},this.deviceId=t.deviceId??null,this.onLevels=t.onLevels}get state(){return this.currentState}async start(){if(this.currentState!=="idle")return"discarded";this.currentState="starting";let t;try{t=await navigator.mediaDevices.getUserMedia(xt(this.deviceId))}catch(i){const o=this.discardRequested;return this.currentState="stopped",o||this.callbacks.onError(i),o?"discarded":"error"}if(this.discardRequested){for(const i of t.getTracks())i.stop();return this.currentState="stopped","discarded"}this.stream=t;const r=Wt(),s=r?new MediaRecorder(t,{mimeType:r}):new MediaRecorder(t);return this.recorder=s,s.ondataavailable=i=>{i.data&&i.data.size>0&&this.chunks.push(i.data)},s.onstop=()=>this.handleRecorderStop(),s.onerror=i=>this.handleRecorderError(i),s.start(),this.startedAt=this.now(),this.currentState="recording",this.maxTimer=setTimeout(()=>this.stop(),this.maxDurationMs),this.onLevels&&(this.stopMeter=Dt(t,this.onLevels)),"recording"}stop(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&this.recorder?.stop()}cancel(){if(this.currentState==="starting"){this.discardRequested=!0;return}this.currentState==="recording"&&(this.cancelRequested=!0,this.recorder?.stop())}handleRecorderStop(){const t=this.now()-this.startedAt,r=this.recorder?.mimeType||"audio/webm",s=this.chunks,i=this.cancelRequested;this.teardown(),!i&&this.callbacks.onFinished({blob:new Blob(s,{type:r}),durationMs:t,mimeType:r})}handleRecorderError(t){const r=t?.error??t;this.teardown(),this.callbacks.onError(r)}teardown(){this.maxTimer!==null&&clearTimeout(this.maxTimer),this.maxTimer=null,this.stopMeter?.(),this.stopMeter=null,this.recorder&&(this.recorder.ondataavailable=null,this.recorder.onstop=null,this.recorder.onerror=null),this.recorder=null;for(const t of this.stream?.getTracks()??[])t.stop();this.stream=null,this.chunks=[],this.currentState="stopped"}}const Bt=300;function Gt(e){const t=e?.name;return t==="NotAllowedError"||t==="SecurityError"}const Vt={stopReason:"manual",autoSend:!1};let p=null,m=null,_=0,E=null;const I=new Tt({onRecordStart:()=>{E&&Ut(E)},onRecordStop:e=>{ee(E,e)}});function ei(){return p!==null}function ti(){return p}function ri(e){E=e,_+=1,_===1&&I.keyDown()}function si(e){E=e,_!==0&&(_-=1,_===0&&I.keyUp())}function Ut(e,t="key"){if(p!==null)return;It(),Pt();const r=new Nt({deviceId:Ct(),onLevels:s=>{p===r&&e.dispatch(me(s))},onFinished:s=>{p===r&&(p=null);const i=m??{stopReason:"auto-stop",autoSend:!1},o=m!==null;if(m=null,e.dispatch(C()),o||I.reset(),s.durationMs<Bt){i.autoSend&&e.dispatch(N());return}e.dispatch(be({...s,stopReason:i.stopReason,autoSend:i.autoSend}))},onError:s=>{p===r&&(p=null),m=null,e.dispatch(C()),e.showHint(Gt(s)?n.hardwareConsole_ptt_micDenied_message():n.hardwareConsole_ptt_recordingFailed_message())}});p=r,e.dispatch(ve({source:t,startedAt:Date.now()})),r.start().then(s=>{if(s!=="recording"&&(p===r&&(p=null),s==="discarded")){const i=m?.autoSend===!0;m=null,e.dispatch(C()),i&&e.dispatch(N())}})}function ee(e,t){const r=p;if(r===null){t.autoSend&&e?.dispatch(N());return}m=t,r.stop()}function ii(){ee(null,Vt)}function ai(e){I.reset(),_=0,m=null;const t=p;t!==null&&(p=null,t.cancel(),e.dispatch(C()))}const Ht=V("HardwareConsoleVoiceSetupToast"),qt="hardware-console-voice-setup";let W=null;function $t(){return W||(W=he(()=>Promise.resolve().then(()=>rt),void 0,import.meta.url).then(e=>e.notify)),W}function zt(){xe("/settings?tab=connections#voice").catch(e=>{Ht.error("Failed to open voice settings from setup toast",e)})}function jt(){return{label:n.hardwareConsole_voice_openSettings_label(),onClick:()=>zt()}}function ni(){$t().then(e=>{e.error(n.hardwareConsole_voice_noKey_error(),{id:qt,action:jt()})})}const oi=a.createSelector(e=>e.externalEditors.selectedAction),Kt=a.createSelector(e=>e.externalEditors.editors),Zt=a.createSelector(e=>{const t=y(Kt.select(e)),r=e.externalEditors.editorOrder??[];if(!r.length)return t;const s=new Map(t.map(l=>[l.id,l])),i=r.flatMap(l=>{const c=s.get(l);return c?[c]:[]}),o=new Set(r);return[...i,...t.filter(({id:l})=>!o.has(l))]}),ci=a.createSelector(e=>e.externalEditors.editorOrder??[]),li=a.createSelector(e=>e.externalEditors.loading),di=a.createSelector(e=>e.externalEditors.lastFetched),Qt=a.createSelector(e=>e.externalEditors.hiddenEditorIds),ui=a.createSelector((e,t)=>{if(!(t?Me.select(e,t):Te.select(e))||_e())return[];const s=Qt.select(e);return Zt.select(e).filter(i=>i.installed&&!s.includes(i.id))});function pi(e,t){if(!e||!t||t===e.providerId)return!1;const r=e.providerSettings[t];return!!(r&&[r.defaultModel,...Object.values(r.typeOverrides??{})].some(s=>typeof s=="string"&&s.includes(":")))}let Yt=0;function Jt(e,t){const r=++Yt;return a.dispatch(ye(e,t,r)),r}function gi(e,t,r){a.dispatch(Ae(e,t,r))}async function te(e,t,r,s){const i=crypto.randomUUID(),o=s?.source??"control";try{return(await a.dispatch(ke({requestId:i,consumerId:o,agentId:e,workspaceId:t,operation:r,connection:Q.select(a.state)},{...s,intent:s?.intent??Jt(e,t)}))).status==="success"}finally{a.dispatch(we(i,o))}}async function hi(e,t,r,s,i){return te(e,t,{kind:"effort",effort:r,previous:s},i)}async function fi(e,t,r,s,i){return te(e,t,{kind:"reconcile",current:r??null,levels:s},i)}const Xt=a.createSelector((e,t)=>y(e.agentModel.mutations).filter(r=>r.consumerId===t)),Si=a.createSelector((e,t)=>Xt.select(e,t).some(r=>r.status==="pending")),bi=a.createSelector((e,t,r)=>{const s=e.agentSessions.byAgentId[t],i=Ie.select(e,t),o=We.select(e,t),l=e.daemonHealth.stats?.protocolVersion,c=Ne(l),g=c?Be(s?.model,null,o):s?.model;return{session:s,providerId:i,levels:o,legacy:c,identity:JSON.stringify([g,i]),connection:Q.select(e),canWrite:!!s&&s.workspaceId===r&&!Fe.select(e,r)}});function er(e,t,r=!1){const s=t?.available===!0&&t.viaNpx!==!0;return e!=="auggie"||s||r}const mi=a.createSelector(e=>$e.select(e)?null:U.select(e)),tr=a.createSelector(e=>e.providerCatalog?.workspaceEpoch??0),S=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]:void 0),vi=a.createSelector(e=>Object.keys(e.providerCatalog?.byWorkspaceId??{})),_i=a.createSelector((e,t)=>!!S.select(e,t)&&e.providerCatalog.workspaceSnapshotEpochs?.[t]===tr.select(e)),re=a.createSelector((e,t)=>t?S.select(e,t)?.catalog.providers??[]:De.select(e)),se=a.createSelector((e,t)=>{if(!t)return Y.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="model.defaultProvider")?.value;return typeof r=="string"?r:""}),q=a.createSelector((e,t)=>{if(!t)return ze.select(e);const r=S.select(e,t)?.settings.find(s=>s.path==="providers.enabled")?.value;return r&&typeof r=="object"?r:{}}),ie=a.createSelector((e,t)=>{if(!t)return je.select(e);const r=q.select(e,t),s=se.select(e,t),i=S.select(e,t)?.readiness??{};return re.select(e,t).filter(o=>o.visible&&(!o.canBeDisabled||r[o.id]||o.id===s)&&i[o.id]?.available).map(o=>o.id)}),Ai=a.createSelector((e,t)=>{const r=q.select(e,t),s=t?S.select(e,t)?.readiness??{}:U.select(e);return re.select(e,t).filter(i=>er(i.id,s[i.id],r[i.id]===!0)).map(i=>i.id)}),yi=a.createSelector((e,t)=>t?ie.select(e,t):Ke.select(e)),ki=a.createSelector((e,t)=>v.select(e,t)),wi=a.createSelector((e,t)=>t?!!S.select(e,t):Ze.select(e)),Ei=a.createSelector((e,t)=>{if(!t)return Ge.select(e);const r=S.select(e,t)?.settings??[],s=se.select(e,t),i=r.find(c=>c.path==="model.providerDefaults")?.value,o=i&&typeof i=="object"?i[s]:void 0;if(typeof o=="string")return o;const l=r.find(c=>c.path==="model.default")?.value;return typeof l=="string"?l:""}),Ci=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning?[[r,s.warning]]:[])):Ve.select(e)),Pi=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).map(([r,s])=>[r,s.stale===!0])):Ue.select(e)),Ri=a.createSelector((e,t)=>t?Object.fromEntries(Object.entries(e.providerModels?.byWorkspaceId?.[t]??{}).flatMap(([r,s])=>s.warning&&s.warningKind?[[r,s.warningKind]]:[])):He.select(e)),Mi=a.createSelector((e,t,r)=>{if(!r)return Qe.select(e,t);const s=q.select(e,r),i=S.select(e,r);return ie.select(e,r).filter(o=>o!==t&&(s[o]||i?.catalog.providers.find(l=>l.id===o)?.canBeDisabled===!1)&&Ye(o,i?.readiness[o]?.authenticated))}),Ti=a.createSelector((e,t)=>t?S.select(e,t)?.readiness??{}:U.select(e)),rr={},Ii=a.createSelector(e=>e.providerSettings?.profiles?.status??rr),Z={},sr=a.createSelector((e,t)=>t?e.providerCatalog?.byWorkspaceId?.[t]?.mcpServers??[]:e.mcpSettings.servers),Fi=a.createSelector((e,t,r)=>{const s=e.providerCatalog?.byWorkspaceId?.[t];return s?s.mcpServers?.find(i=>i.id===r)?.name:e.providerCatalog?.mcpServerNamesByWorkspaceId?.[t]?.[r]}),Di=a.createSelector(e=>e.mcpSettings.loading),Li=a.createSelector(e=>e.mcpSettings.error),Oi=a.createSelector(e=>e.mcpSettings.mutationError??null),xi=a.createSelector(e=>e.mcpSettings.enabled),ir=a.createSelector(e=>e.mcpSettings.disabledServers),ar=a.createSelector(e=>e.mcpSettings.statusMap),nr=a.createSelector(e=>e.mcpSettings.toolsMap),or=a.createSelector((e,t)=>{if(!t)return e.mcpSettings.errorMessages;const r=e.providerCatalog?.byWorkspaceId?.[t],s=new Map(r?.mcpServers?.map(i=>[i.id,w(i)])??[]);return Object.fromEntries((r?.mcpStatuses??[]).flatMap(i=>{const o=s.get(i.serverId);return o&&i.lastError?[[o,i.lastError]]:[]}))}),cr=a.createSelector((e,t)=>t?e.mcpSettings.byWorkspaceId[t]?.disabledServers??Z:Z),Wi=a.createSelector((e,t)=>Object.keys(cr.select(e,t))),Ni=a.createSelector(e=>{const t=sr.select(e),r=ar.select(e),s=nr.select(e),i=ir.select(e),o=or.select(e);return t.map(l=>{const c=w(l)in i,g=s[w(l)]||[];let f=r[w(l)]||"disconnected";return c&&(f="disabled"),{...l,disabled:c,status:f,tools:g,toolCount:g.length,errorMessage:o[w(l)]}})});a.createSelector((e,t)=>e.mcpSettings.errorMessages[t]);const Bi=a.createSelector(e=>e.mcpSettings.lastImportedCount),Gi=a.createSelector(e=>e.mcpSettings.advancedSaveStatus),Vi=a.createSelector(e=>e.mcpSettings.advancedSaveError);function h(e){return{category:"settings",...e}}const T=[{id:"new-workspace",tab:"",label:"New workspace",route:"/workspace/new",category:"navigation",description:"Create-workspace flow."},h({id:"utility-default-model",tab:"providers",hashAliases:["utility-default-model","default-model","quickActions.defaultModel","backgroundAgents.defaultModel"],scrollSelector:"#utility-default-model",highlightSelector:'[data-highlight-id="utility-default-model"]',label:"Settings: Default model",route:"/settings?tab=providers#utility-default-model",description:"Default AI behavior model selection."}),h({id:"global-instructions",tab:"agent-behavior",hashAliases:["global-instructions","agents","specialists","all-agents"],scrollSelector:"#global-instructions",highlightSelector:'[data-highlight-id="global-instructions"]',label:"Settings: Agent Behavior",route:"/settings?tab=agent-behavior#global-instructions",description:"Global agent instructions and defaults."}),h({id:"create-specialist",tab:"specialists",hashAliases:["create-specialist"],scrollSelector:"#create-specialist",highlightSelector:'[data-highlight-id="create-specialist"]',label:"Settings: Create specialist",route:"/settings?tab=specialists&view=create-specialist#create-specialist",description:"Create-specialist entry point."}),h({id:"providers",tab:"providers",hashAliases:["providers"],scrollSelector:"#providers",highlightSelector:'[data-highlight-id="providers"]',label:"Settings: AI coding CLIs",route:"/settings?tab=providers#providers",description:"Provider/account selector settings."}),h({id:"integrations",tab:"connections",hashAliases:["integrations"],scrollSelector:"#integrations",highlightSelector:'[data-highlight-id="integrations"]',label:"Settings: Connections",route:"/settings?tab=connections#integrations",description:"Connected integrations settings."}),h({id:"devices",tab:"devices",hashAliases:["devices","machines"],scrollSelector:"#devices",highlightSelector:"#devices",label:"Settings: Machines",route:"/settings?tab=devices#devices",description:"Saved remote machine settings."}),h({id:"mobile",tab:"mobile",hashAliases:["mobile"],scrollSelector:"#mobile",highlightSelector:'[data-highlight-id="mobile"]',label:"Settings: Mobile",route:"/settings?tab=mobile#mobile",description:"Remote access and Intent Mobile pairing."}),h({id:"guest-sessions",tab:"collaboration",hashAliases:["collaboration","guest-sessions","sharing"],scrollSelector:"#collaboration",highlightSelector:"#collaboration",label:"Settings: Collaboration",route:"/settings?tab=collaboration#collaboration",description:"Host membership, workspace guests and joined hosts."}),h({id:"websocket-api",tab:"mobile",hashAliases:["websocket-api","remote-access"],scrollSelector:"#websocket-api",highlightSelector:'[data-highlight-id="websocket-api"]',label:"Settings: Remote Access",route:"/settings?tab=mobile#websocket-api",description:"Remote access (WebSocket API) settings."}),...[["voice","Voice Dictation","Voice dictation settings.","input"],["keyboard-shortcuts","Keyboard Shortcuts","Keyboard shortcuts reference.","input"],["autocomplete","Autocomplete","Suggest as you type: service, model and API keys.","input"],["mcp-servers","MCP Servers","MCP server configuration.","connections"],["plugins","Plugins","App-wide Agent Plugins.","connections"],["git-workspace","Git & Workspace","Git and workspace defaults.","setup"],["git","Git","Git defaults.","setup"],["shell","Shell","Shell settings.","setup"],["workspace","Workspace","Workspace defaults.","setup"],["cli-optimization","CLI Optimization","RTK/CLI optimization settings.","token-savings"],["workspace-api","Tool Output & Retention","Tool output size and retention settings.","advanced"],["notifications","Notifications","Notification preferences.","app-behavior"],["updates","Updates","Application update preferences.","app-behavior"],["open-in","Open In","External editor/app launch preferences.","app-behavior"],["github-link-action","GitHub Links","GitHub issue and pull request link behavior.","app-behavior"],["agent-features","Agent Features","Agent feature settings.","token-savings"],["font-style","Font style","Font style settings.","display"],["language","Language","Application language settings.","display"],["labs","Labs","Experimental feature switches.","advanced"],["agent-backend","Agent Backend","Agent backend settings.","performance"],["connection","Connection","Daemon connection details.","advanced"],["hardware","Hardware","Hardware integration settings.","input"],["developer","Developer","Development-only settings.","advanced"]].map(([e,t,r,s])=>h({id:e,tab:s,hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=${s}#${e}`,description:r})),h({id:"appearance",tab:"display",hashAliases:["appearance","theme"],scrollSelector:"#theme",highlightSelector:'[data-highlight-id="appearance"]',label:"Settings: Appearance",route:"/settings?tab=display#theme",description:"Theme mode controls."}),...[["color-theme","Color theme","Color theme selection."],["note-font","Notes font","Notes/spec font style."],["agent-chat-font","Agent chat font","Agent chat font style."],["code-font","Code font","Code editor and diff font."]].map(([e,t,r])=>h({id:e,tab:"display",hashAliases:[e],scrollSelector:`#${e}`,highlightSelector:`[data-highlight-id="${e}"]`,label:`Settings: ${t}`,route:`/settings?tab=display#${e}`,description:r})),h({id:"general",tab:"advanced",hashAliases:["general","reset"],scrollSelector:"#reset",highlightSelector:'[data-highlight-id="general"]',label:"Settings: Advanced",route:"/settings?tab=advanced#reset",description:"Advanced settings and reset controls."}),{id:"workspace-card",tab:"",hashAliases:["workspace-card"],highlightSelector:'[data-highlight-id^="workspace-"]',label:"Workspace card",category:"workspace",description:"A workspace card on workspace list surfaces.",dynamic:!0,idPattern:"workspace-{workspaceId}"},{id:"specialist-entry",tab:"specialists",highlightSelector:'[data-highlight-id^="specialist-"]',label:"Specialist entry",route:"/settings?tab=specialists&specialist={specialistId}#specialist-{specialistId}",category:"specialist",description:"A specific specialist row in settings.",dynamic:!0,idPattern:"specialist-{specialistId}"}];function ae(e){const t=e.indexOf("#"),r=t>=0?e.slice(t+1):e;return decodeURIComponent(r.replace(/^#/,"")).trim()}function lr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dr(e,t){if(!t.match(/\{[^}]+\}/g)?.length)return e===t;const s=t.split(/\{[^}]+\}/g).map(lr).join("[^/]+");return new RegExp(`^${s}$`).test(e)}function ur(e){const t=ae(e);if(!t)return;const r=T.find(i=>i.id===t||i.hashAliases?.includes(t));if(r)return r;const s=T.find(i=>i.route&&i.dynamic&&i.idPattern&&dr(t,i.idPattern));return s?{...s,id:t}:void 0}function Ui(){return T.map(e=>({...e,hashAliases:e.hashAliases?[...e.hashAliases]:void 0}))}function pr(e){try{return new URL(e,"app://intent").pathname||"/"}catch{const t=e.indexOf("?"),r=e.indexOf("#");let s=e.length;return t>=0&&(s=Math.min(s,t)),r>=0&&(s=Math.min(s,r)),e.slice(0,s)||"/"}}const gr=new Set(T.flatMap(e=>e.route?[pr(e.route)]:[])),hr=[/^\/workspace\/[^/]+$/,/^\/agent\/[^/]+$/];function Hi(e){if(typeof e!="string")return!1;const t=e.trim();if(!t)return!1;if(t.startsWith("intent://"))return!0;let r,s;try{const i=new URL(t,"app://intent");if(i.protocol!=="app:")return!1;r=i.pathname||"/",s=ae(i.hash)}catch{return!1}return gr.has(r)?s?!!ur(s):!0:hr.some(i=>i.test(r))}const qi=["agentFeatures.backgroundHooks","agentFeatures.hostExec","agentFeatures.secretRequests","agentFeatures.scripts","agentFeatures.terminalAccess","agentFeatures.browserAutomation","agentFeatures.desktopControl","agentFeatures.richChatBlocks","agentFeatures.structuredQuestions","agentFeatures.attentionRequests","agentFeatures.stateSnapshot","agentFeatures.prMonitor","agentFeatures.taskGraph","agentFeatures.peerAgents","agentFeatures.mcpTools"],fr=[{path:"agentFeatures.backgroundHooks",label:()=>n.settings_agentFeatures_backgroundHooks_label(),description:()=>n.settings_agentFeatures_backgroundHooks_description(),defaultValue:!0},{path:"agentFeatures.hostExec",label:()=>n.settings_agentFeatures_hostExec_label(),description:()=>n.settings_agentFeatures_hostExec_description(),defaultValue:!0},{path:"agentFeatures.secretRequests",label:()=>n.settings_agentFeatures_secretRequests_label(),description:()=>n.settings_agentFeatures_secretRequests_description(),defaultValue:!1},{path:"agentFeatures.scripts",label:()=>n.settings_agentFeatures_scripts_label(),description:()=>n.settings_agentFeatures_scripts_description(),defaultValue:!0},{path:"agentFeatures.terminalAccess",label:()=>n.settings_agentFeatures_terminalAccess_label(),description:()=>n.settings_agentFeatures_terminalAccess_description(),defaultValue:!0},{path:"agentFeatures.browserAutomation",label:()=>n.settings_agentFeatures_browserAutomation_label(),description:()=>n.settings_agentFeatures_browserAutomation_description(),defaultValue:!0},{path:"agentFeatures.desktopControl",label:()=>n.settings_agentFeatures_desktopControl_label(),description:()=>n.settings_agentFeatures_desktopControl_description(),info:()=>n.settings_agentFeatures_desktopControl_info(),defaultValue:!0},{path:"agentFeatures.richChatBlocks",label:()=>n.settings_agentFeatures_richChatBlocks_label(),description:()=>n.settings_agentFeatures_richChatBlocks_description(),defaultValue:!0},{path:"agentFeatures.structuredQuestions",label:()=>n.settings_agentFeatures_structuredQuestions_label(),description:()=>n.settings_agentFeatures_structuredQuestions_description(),defaultValue:!0},{path:"agentFeatures.attentionRequests",label:()=>n.settings_agentFeatures_attentionRequests_label(),description:()=>n.settings_agentFeatures_attentionRequests_description(),defaultValue:!0},{path:"agentFeatures.stateSnapshot",label:()=>n.settings_agentFeatures_stateSnapshot_label(),description:()=>n.settings_agentFeatures_stateSnapshot_description(),defaultValue:!0},{path:"agentFeatures.prMonitor",label:()=>n.settings_agentFeatures_prMonitor_label(),description:()=>n.settings_agentFeatures_prMonitor_description(),defaultValue:!0},{path:"agentFeatures.taskGraph",label:()=>n.settings_agentFeatures_taskGraph_label(),description:()=>n.settings_agentFeatures_taskGraph_description(),defaultValue:!0},{path:"agentFeatures.peerAgents",label:()=>n.settings_agentFeatures_peerAgents_label(),description:()=>n.settings_agentFeatures_peerAgents_description(),defaultValue:!0},{path:"agentFeatures.mcpTools",label:()=>n.settings_agentFeatures_mcpTools_label(),description:()=>n.settings_agentFeatures_mcpTools_description(),defaultValue:!0}],$i=Object.fromEntries(fr.map(e=>[e.path,e.defaultValue]));export{Ri as $,Hi as A,Xs as B,Ct as C,zr as D,Jt as E,fr as F,J as G,_t as H,fi as I,gi as J,Et as K,ur as L,Rs as M,Ks as N,Si as O,Xt as P,bi as Q,Zr as R,A as S,es as T,yi as U,se as V,q as W,Ai as X,ie as Y,re as Z,Pi as _,Je as a,sr as a$,Ci as a0,Mi as a1,Ti as a2,wi as a3,Ei as a4,ki as a5,Jr as a6,rs as a7,Es as a8,ks as a9,qr as aA,Lr as aB,xr as aC,Gr as aD,Wr as aE,Br as aF,Or as aG,Hr as aH,Dr as aI,$r as aJ,ps as aK,Qt as aL,Zt as aM,ui as aN,li as aO,ds as aP,us as aQ,di as aR,Vi as aS,Gi as aT,ir as aU,xi as aV,Li as aW,or as aX,Bi as aY,Di as aZ,Oi as a_,As as aa,ys as ab,ws as ac,_s as ad,ci as ae,ls as af,fs as ag,ns as ah,js as ai,os as aj,cs as ak,Qr as al,Xr as am,H as an,it as ao,dt as ap,ut as aq,X as ar,lt as as,at,st as au,ot as av,ct as aw,Nr as ax,Vr as ay,Ur as az,$i as b,Ni as b0,ar as b1,nr as b2,oi as b3,is as b4,Ii as b5,mi as b6,St as b7,bs as b8,ms as b9,Fi as bA,Zs as bB,Ys as bC,ni as bD,Ut as bE,ii as bF,Ms as bG,Ps as bH,Ts as bI,Cs as bJ,jt as bK,vs as bL,hs as ba,Ss as bb,as as bc,gs as bd,v as be,ts as bf,Yr as bg,$s as bh,xs as bi,Hs as bj,qs as bk,Ns as bl,Vs as bm,Gs as bn,Ws as bo,Os as bp,Ls as bq,zs as br,Ds as bs,Bs as bt,Us as bu,S as bv,tr as bw,_i as bx,vi as by,Wi as bz,qi as c,hi as d,ai as e,Pt as f,It as g,Qs as h,Js as i,ss as j,ft as k,ht as l,ti as m,Ui as n,Is as o,Fs as p,jr as q,Kr as r,ri as s,si as t,rt as u,wt as v,er as w,ei as x,pi as y,K as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as gt}from"./
|
|
1
|
+
import{g as gt}from"./vtO9QTmA.js";import{d as mt,g as lt,f as xt,e as kt}from"./euj4yvIS.js";import{U as _t,aZ as vt,V as bt,a_ as wt,Y as Tt,b0 as St,b as s,X as R,aW as H,B as $t,r as Mt,d as it}from"./BpY_21Cw.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,W;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var X="";W=[];for(N in v[A])this.terminals_[N]&&N>yt&&W.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+W.join(", ")+", got '"+(this.terminals_[b]||b)+"'":X="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:W})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Cr=Object.defineProperty;var xr=(e,t,n)=>t in e?Cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var b=(e,t,n)=>xr(e,typeof t!="symbol"?t+"":t,n);import{t as oo,bo as M,bw as ro,b as so,bs as di,bq as Lr,bm as $e}from"./Dv_tIgjy.js";import{bs as ao,a5 as Me,ay as ui,bS as Xe,aD as C,bA as ke,b_ as Ie,bO as it,W as de,bl as Xt,be as Dn,bn as lo,c9 as oe,aA as I,b$ as uo,aB as ge,ai as wr,bV as Te,br as kr,ca as je,bH as Q,c5 as dt,bk as Er,bj as Rr,aj as Ar,c0 as ci}from"./3SdAC2_C.js";import{i as we}from"./D7nvPiBp.js";import{f as hi,g as mn,s as fi}from"./DLx1kqr5.js";import{b as Hr}from"./goTpbPhD.js";import{b as pi}from"./Dn334wJv.js";import{h as Dr,c as rt,J as co,Y as B,Z as Zt,a as ho,k as fo,_ as Je,H as po,j as go,aW as Tr,ak as mo,U as Mr,f as Ir,e as vo,T as Fr,g as Nr,S as Pr,ad as Qe,ac as Ve,C as zr,G as bo,F as Ur,I as _r,N as mt,ar as Or,a8 as Ht,am as Dt,x as K,w as Ue,ax as wt,ay as So,D as Br,d as Vr,aj as yo,aa as ct,l as Tn,b as gi,B as mi,z as vi,aU as Wr,aA as ft,al as Gr,V as Le,X as Ut,W as $r,a9 as Tt,E as jr,i as qr,av as Co,af as Kr,ab as bi,y as xo,ap as kt,ae as Et,an as ot,aq as Lo,O as vn,ao as Si,ai as bn,n as Xr,aS as yi}from"./
|
|
1
|
+
var Cr=Object.defineProperty;var xr=(e,t,n)=>t in e?Cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var b=(e,t,n)=>xr(e,typeof t!="symbol"?t+"":t,n);import{t as oo,bo as M,bw as ro,b as so,bs as di,bq as Lr,bm as $e}from"./Dv_tIgjy.js";import{bs as ao,a5 as Me,ay as ui,bS as Xe,aD as C,bA as ke,b_ as Ie,bO as it,W as de,bl as Xt,be as Dn,bn as lo,c9 as oe,aA as I,b$ as uo,aB as ge,ai as wr,bV as Te,br as kr,ca as je,bH as Q,c5 as dt,bk as Er,bj as Rr,aj as Ar,c0 as ci}from"./3SdAC2_C.js";import{i as we}from"./D7nvPiBp.js";import{f as hi,g as mn,s as fi}from"./DLx1kqr5.js";import{b as Hr}from"./goTpbPhD.js";import{b as pi}from"./Dn334wJv.js";import{h as Dr,c as rt,J as co,Y as B,Z as Zt,a as ho,k as fo,_ as Je,H as po,j as go,aW as Tr,ak as mo,U as Mr,f as Ir,e as vo,T as Fr,g as Nr,S as Pr,ad as Qe,ac as Ve,C as zr,G as bo,F as Ur,I as _r,N as mt,ar as Or,a8 as Ht,am as Dt,x as K,w as Ue,ax as wt,ay as So,D as Br,d as Vr,aj as yo,aa as ct,l as Tn,b as gi,B as mi,z as vi,aU as Wr,aA as ft,al as Gr,V as Le,X as Ut,W as $r,a9 as Tt,E as jr,i as qr,av as Co,af as Kr,ab as bi,y as xo,ap as kt,ae as Et,an as ot,aq as Lo,O as vn,ao as Si,ai as bn,n as Xr,aS as yi}from"./D5caROAF.js";import{h as Ye}from"./DEB8jcix.js";import{g as Yr,i as Jr}from"./52P8Bm3E.js";import{F as Sn,c9 as Qr,bi as Zr,ax as es,aw as ts}from"./B80pUkKE.js";import{f as Mn}from"./Z_oRTxSz.js";import"./D7fB2Oi-.js";import{g as ns}from"./CTbHaK7N.js";import{c as is}from"./KS3jDVZW.js";import{P as os}from"./HW7u71-8.js";import{l as Ci}from"./JGtSKGY1.js";class rs extends Dr{constructor(){super(...arguments),this.tokenize=as}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
2
2
|
`))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
|
|
3
3
|
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
|
|
4
4
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as Vt,bo as ee,_ as Xr,bw as zt,bs as ce,bq as ir,b as At,bm as c}from"./Dv_tIgjy.js";import{bs as Wt,ca as pe,aD as e,bH as f,a5 as T,bA as x,W as l,bn as Nt,bV as N,c9 as n,aA as te,c6 as jt,ay as ne,be as Ze,b$ as tt,b_ as k,bO as g,bS as p,bl as S,aB as P,bj as Gr,aw as rt,ai as Jr,c5 as rr,a as yr,a7 as Ue,aj as gt,cd as Yr,br as Zr}from"./3SdAC2_C.js";import{i as Q}from"./D7nvPiBp.js";import{k as Pr}from"./D6gLzTDC.js";import{g as Ct}from"./52P8Bm3E.js";import{c as Rt}from"./DpKzpN4e.js";import{b as $r}from"./Dn334wJv.js";import{Jv as U,nX as kr,we as Ir,wd as Cr,LL as Qr,LM as ea,eJ as ta,eK as ra,Lb as fr,m5 as Yt,Cx as vr,sG as pr,oj as aa,A2 as oa,ac as gr,K2 as ia,Ki as na,nx as sa,iW as la,nZ as da,vG as ca,Av as ua,La as fa}from"./CWhRK5Rp.js";import{g as va}from"./DWGXN6Nr.js";import{a as pa,h as ga,j as ma,c as _a,d as ha,i as wa,e as ba,f as mr,g as xa,b as Zt}from"./CSQyBrRH.js";import{bO as ya,b$ as Pa,dH as $a}from"./BqA-3o9l.js";import{w as _r,d as ka}from"./wEnqV1Ol.js";import{f as Ia}from"./CxTWC0xh.js";import{m as Qt}from"./I4WMrmBa.js";import{f as Ce}from"./Z_oRTxSz.js";import{h as Ca}from"./D7fB2Oi-.js";import"./BPxuNmyn.js";import{s as at,g as It,f as hr}from"./DLx1kqr5.js";import{F as et,ac as Sa,au as Fa,aZ as Da,b3 as Ut,ct as Ta,cu as Ea,bm as Ra,cS as Ma,c9 as ja}from"./B80pUkKE.js";import{E as Ua,b as La,S as wr}from"./Cv8U-Bhv.js";import{c as Va}from"./ChTqQfQN.js";import"./KS3jDVZW.js";import{$ as za}from"./-Wss3p71.js";import{i as er,b as Aa,a as Wa}from"./H2jLkRRS.js";import{C as ar,p as Na}from"./DfJ0n1tN.js";import{M as Ba}from"./DPjD0DQx.js";import{l as tr,m as Sr}from"./JGtSKGY1.js";import"./B23aic_N.js";import"./Cm6Te9Vq.js";import{M as Mt}from"./BMiwx6rS.js";import{V as Oa}from"./BEk-bvEu.js";import{bT as Ha,b7 as qa}from"./DMvzpJTu.js";import{g as Ka}from"./BH7eVR7o.js";import{H as Xa}from"./Bqd7fdCF.js";import{g as Ga,W as Ja}from"./g71ihZ8_.js";import{b as Ya,h as Za}from"./t5ofrZ-c.js";import{t as Qa}from"./DUpPMwJS.js";const Fr=U.createSelector((G,w)=>kr(G.pdfPreview.previews,w));var eo=P('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),to=P('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function or(G,w){if(new.target)return Vt({component:or,...G});Wt(w,!0);const ye=()=>ce(we,"$preview",ot),[ot,re]=ir();let y=ee(w,"workspaceId",7),ae=ee(w,"filePath",7),Pe=ee(w,"gitRootId",7);const Se=crypto.randomUUID(),we=Fr(Se),ge=new WeakMap;let Y=N(null),Xe=N(void 0),V=N(1),B=N(1),se=N(!0),me=N(!1),Fe=N(null),A=N(0);const be=n(()=>ye()?.error??e(Fe)),De=n(()=>e(be)==="missing"?c.file_pdf_missing_error():e(be)==="large"?c.file_pdf_large_error():e(be)==="invalid"?c.file_pdf_invalid_error():e(be)==="password"?c.file_pdf_password_error():c.file_pdf_load_error());pe(()=>{const d=y(),I=ae();e(A);const b=crypto.randomUUID();return U.dispatch(Ir(Se,b,d,I,...Pe()?[{gitRootId:Pe()}]:[])),()=>{U.dispatch(Cr(Se,b))}}),pe(()=>{const d=ye()?.url;let I=!1,b;if(f(Y,null),f(Fe,null),f(se,!0),f(V,1),f(B,1),!!d)return(async()=>{try{const{loadPdfDocument:W}=await Xr(async()=>{const{loadPdfDocument:_e}=await import("./cb1JHFKl.js");return{loadPdfDocument:_e}},[],import.meta.url);if(I)return;b=W(d);const M=await b.promise;I||f(Y,M)}catch(W){if(I)return;f(Fe,W instanceof Error&&W.name==="PasswordException"?"password":W instanceof Error&&W.name==="InvalidPDFException"?"invalid":"load",!0)}finally{I||f(se,!1)}})(),()=>{I=!0,b?.destroy()}}),pe(()=>{const d=e(Y),I=e(Xe),b=e(V),W=e(B);if(!d||!I)return;let M=!1,_e,E;const oe=()=>{if(!E)return;const X=(ge.get(E)??1)-1;X?ge.set(E,X):(ge.delete(E),E.cleanup()),E=void 0};return f(me,!0),(async()=>{try{if(E=await d.getPage(b),ge.set(E,(ge.get(E)??0)+1),M){oe();return}const X=E.getViewport({scale:W}),Z=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(X.width*X.height)));I.width=Math.ceil(X.width*Z),I.height=Math.ceil(X.height*Z),I.style.width=`${X.width}px`,I.style.height=`${X.height}px`,_e=E.render({canvas:I,viewport:X,transform:[Z,0,0,Z,0,0]}),await _e.promise}catch{M||f(Fe,"invalid")}finally{M||f(me,!1)}})(),()=>{M=!0,_e?.cancel(),_e?_e.promise.then(oe,oe):oe()}});var Ne={get workspaceId(){return y()},set workspaceId(d){y(d),te()},get filePath(){return ae()},set filePath(d){ae(d),te()},get gitRootId(){return Pe()},set gitRootId(d){Pe(d),te()},$set:zt,$on:(d,I)=>At(w,d,I)},Le=to(),Be=T(Le);{var o=d=>{{const I=W=>{Ze();var M=tt();k(()=>g(M,e(De))),l(W,M)};let b=n(()=>c.ui_combobox_retry_label());Ua(d,{onRetry:()=>jt(A),get retryLabel(){return e(b)},class:"m-auto",message:I,$$slots:{message:!0}})}},i=d=>{{let I=n(()=>c.file_pdf_loading_label());La(d,{get label(){return e(I)},count:1,class:"p-4"})}},F=d=>{var I=eo(),b=ne(I),W=T(b);{let ue=n(()=>e(V)<=1);Ce(W,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>jt(V,-1),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.file_pdf_previous_label()]),l(Ee,fe)},$$slots:{default:!0}})}var M=p(W,2),_e=S(M,!0),E=p(M,2);{let ue=n(()=>e(V)>=e(Y).numPages);Ce(E,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>jt(V),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.file_pdf_next_label()]),l(Ee,fe)},$$slots:{default:!0}})}var oe=p(E,2);{let ue=n(()=>e(B)<=.25);Ce(oe,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>f(B,Math.max(.25,e(B)-.25),!0),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.editor_fileViewer_zoomOut_tooltip()]),l(Ee,fe)},$$slots:{default:!0}})}var X=p(oe,2),Z=S(X,!0),it=p(X,2);{let ue=n(()=>e(B)>=3);Ce(it,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>f(B,Math.min(3,e(B)+.25),!0),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.editor_fileViewer_zoomIn_tooltip()]),l(Ee,fe)},$$slots:{default:!0}})}x(b);var nt=p(b,2),st=T(nt);let ut;$r(st,ue=>f(Xe,ue),()=>e(Xe)),x(nt),k((ue,Ee,Ve)=>{g(_e,ue),g(Z,Ee),at(nt,"aria-busy",e(me)),at(st,"aria-label",Ve),ut=It(st,"",ut,{visibility:e(me)?"hidden":"visible"})},[()=>c.file_pdf_page_label({page:tr(e(V)),total:tr(e(Y).numPages)}),()=>Sr(e(B),{style:"percent"}),()=>c.file_pdf_canvas_ariaLabel({name:ae(),page:tr(e(V))})]),l(d,I)};Q(Be,d=>{e(be)?d(o):e(se)||ye()?.status==="loading"?d(i,1):e(Y)&&d(F,2)})}x(Le),l(G,Le);var Te=Nt(Ne);return re(),Te}const ro=U.createSelector((G,w)=>kr(G.videoPreview.previews,w));var ao=P('<p role="status"> </p>'),oo=P('<p role="alert"> </p>'),io=P('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),no=P('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),so=P('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function Dr(G,w){if(new.target)return Vt({component:Dr,...G});Wt(w,!0);const ye=()=>ce(Xe,"$preview",ot),[ot,re]=ir();let y=ee(w,"sourceUrl",7),ae=ee(w,"fileName",7),Pe=ee(w,"allowDownload",7),Se=ee(w,"downloading",7),we=ee(w,"onDownload",7),ge=N(null);const Y=crypto.randomUUID(),Xe=ro(Y),V=n(()=>ye()?.status==="loading"),B=n(()=>e(ge)??ye()?.error);let se=!1,me=!1;Gr(()=>{me=!0,U.dispatch(Qr(Y))});function Fe(){if(me||e(V))return;const i=y().startsWith("workspace-file://")?new URL(y()):null;if(se||!i||!i.pathname.toLowerCase().endsWith(".mp4")){f(ge,"unsupported");return}se=!0,i.searchParams.set("preview","h264"),U.dispatch(ea(Y,i.hostname,i.toString()))}function A(i){if(me)return;const F=i.currentTarget.error?.code;F===2?f(ge,"network"):F!==1&&Fe()}var be={get sourceUrl(){return y()},set sourceUrl(i){y(i),te()},get fileName(){return ae()},set fileName(i){ae(i),te()},get allowDownload(){return Pe()},set allowDownload(i){Pe(i),te()},get downloading(){return Se()},set downloading(i){Se(i),te()},get onDownload(){return we()},set onDownload(i){we(i),te()},$set:zt,$on:(i,F)=>At(w,i,F)},De=so(),Ne=T(De);{var Le=i=>{var F=io(),Te=T(F),d=S(Te,!0),I=p(Te,2);{var b=E=>{var oe=ao(),X=S(oe,!0);k(Z=>g(X,Z),[()=>c.editor_fileViewer_videoPreparing_label()]),l(E,oe)},W=E=>{var oe=oo(),X=S(oe,!0);k(Z=>g(X,Z),[()=>e(B)==="network"?c.editor_fileViewer_videoLoad_error():c.editor_fileViewer_videoUnsupported_label()]),l(E,oe)};Q(I,E=>{e(V)?E(b):E(W,-1)})}var M=p(I,2);{var _e=E=>{Ce(E,{variant:"secondary",size:"sm",get onclick(){return we()},get disabled(){return Se()},children:(oe,X)=>{Ze();var Z=tt();k(it=>g(Z,it),[()=>c.layout_fileTab_downloadFile_label()]),l(oe,Z)},$$slots:{default:!0}})};Q(M,E=>{Pe()&&E(_e)})}x(F),k(()=>g(d,ae())),l(i,F)},Be=i=>{var F=no(),Te=S(F,!0);k(d=>{at(F,"src",ye()?.url??y()),g(Te,d)},[()=>c.editor_fileViewer_videoUnsupported_label()]),rt("error",F,A),rt("loadedmetadata",F,d=>{d.currentTarget.videoWidth===0&&Fe()}),l(i,F)};Q(Ne,i=>{e(B)||e(V)?i(Le):i(Be,-1)})}x(De),l(G,De);var o=Nt(be);return re(),o}var lo=P('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),co=P('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),uo=P('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),fo=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),vo=P("<!> ",1),po=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),go=P('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),mo=P('<td class="border border-border px-2 py-1 text-xs"> </td>'),_o=P("<tr></tr>"),ho=P('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),wo=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),bo=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),xo=P('<div class="h-full flex flex-col"><!></div>');function Lt(G,w){if(new.target)return Vt({component:Lt,...G});Wt(w,!0);const ye=t=>{var a=lo(),u=ne(a);{let O=n(()=>c.editor_fileViewer_zoomOut_tooltip());Ce(u,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:oe,get title(){return e(O)},children:(D,L)=>{et(D,{get icon(){return Ta},size:"sm"})},$$slots:{default:!0}})}var m=p(u,2),h=S(m,!0),R=p(m,2);{let O=n(()=>c.editor_fileViewer_zoomIn_tooltip());Ce(R,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:E,get title(){return e(O)},children:(D,L)=>{et(D,{get icon(){return Ea},size:"sm"})},$$slots:{default:!0}})}Ze(2),k(()=>g(h,e(Fe))),l(t,a)},ot=Va("FileViewer");let re=ee(w,"filePath",7),y=ee(w,"fileContent",7,""),ae=ee(w,"sourceUrl",7),Pe=ee(w,"language",7),Se=ee(w,"isBinary",7),we=ee(w,"allowDownload",7,!0),ge=ee(w,"onDownload",7),Y=ee(w,"downloading",7,!1);const Xe=t=>{const a=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(a)?"image":a==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(a)?"video":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":a==="pdf"?"pdf":["md","markdown"].includes(a)?"markdown":a==="json"?"json":a==="csv"?"csv":["yaml","yml"].includes(a)?"yaml":a==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(a)?"archive":["exe","dll","so","dylib","wasm"].includes(a)?"binary":"text"},V=n(()=>Xe(re())),B=n(()=>re().split("/").pop()||c.editor_fileViewer_unknown_fallback());let se=N(100),me=N(0);const Fe=n(()=>Sr(e(se)/100,{style:"percent",maximumFractionDigits:0}));let A=N(!1),be=N(0),De=N(0),Ne=N(0),Le=N(0),Be=N(!1),o=null;function i(){const t=o;o=null,f(Be,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function F(t){if(t.button!==0||!t.isPrimary||o)return;const a=t.currentTarget;a.setPointerCapture(t.pointerId),o={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:a},f(Be,!0),t.preventDefault()}function Te(t){if(!(!o||t.pointerId!==o.pointerId)){if((t.buttons&1)===0){i();return}f(Ne,o.viewport.scrollLeft,!0),f(Le,o.viewport.scrollTop,!0),f(be,e(be)+(t.clientX-o.x)),f(De,e(De)+(t.clientY-o.y)),o.x=t.clientX,o.y=t.clientY}}function d(t){t.pointerId===o?.pointerId&&i()}pe(()=>{re(),ae(),e(se),e(me),f(Ne,0),f(Le,0)}),pe(()=>(re(),ae(),rr(()=>{i(),f(be,0),f(De,0)}),i));const I=t=>{const a=t.split(".").pop()?.toLowerCase();return a==="jpg"||a==="jpeg"?"image/jpeg":a==="png"?"image/png":a==="gif"?"image/gif":a==="webp"?"image/webp":"application/octet-stream"},b=t=>{const a=t.split(".").pop()?.toLowerCase();if(a==="mp4")return"video/mp4";if(a==="webm")return"video/webm"},W=()=>{if(ae())return ae();if(typeof y()=="string")return y().startsWith("data:")||y().startsWith("http")?y():Se()?`data:${I(re())};base64,${y()}`:`data:${I(re())};base64,${y()}`;if(y()instanceof ArrayBuffer){const a=new Uint8Array(y()).reduce((m,h)=>m+String.fromCharCode(h),""),u=btoa(a);return`data:${I(re())};base64,${u}`}return""},M=()=>{if(ae())return ae();const t=b(re());if(!t)return"";if(typeof y()=="string")return y().startsWith("data:")||y().startsWith("http")?y():`data:${t};base64,${y()}`;const a=new Uint8Array(y()),u=[],m=32768;for(let h=0;h<a.length;h+=m)u.push(String.fromCharCode(...a.subarray(h,h+m)));return`data:${t};base64,${btoa(u.join(""))}`},_e=()=>{const t=typeof y()=="string"?new TextEncoder().encode(y()):new Uint8Array(y()),a=[],u=32768;for(let m=0;m<t.length;m+=u)a.push(String.fromCharCode(...t.subarray(m,m+u)));return`data:image/svg+xml;base64,${btoa(a.join(""))}`},E=()=>{f(se,Math.min(e(se)+25,500),!0)},oe=()=>{f(se,Math.max(e(se)-25,25),!0)},X=()=>{f(me,(e(me)+90)%360)},Z=()=>{if(!we()||Y())return;if(ge()){ge()();return}const t=document.createElement("a");t.href=e(V)==="video"?M():e(V)==="svg"?_e():W(),t.download=e(B),t.click()},it=async()=>{try{const t=W(),a=new Image;a.crossOrigin="anonymous";const u=await new Promise((m,h)=>{a.onload=()=>{const R=document.createElement("canvas");R.width=a.naturalWidth,R.height=a.naturalHeight;const O=R.getContext("2d");if(!O){h(new Error("Failed to get canvas context"));return}O.drawImage(a,0,0),R.toBlob(D=>{D?m(D):h(new Error("Failed to create blob from canvas"))},"image/png",1)},a.onerror=()=>h(new Error("Failed to load image")),a.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":u})]),f(A,!0),setTimeout(()=>f(A,!1),2e3)}catch(t){ot.error("Failed to copy image:",t)}},nt=t=>{try{const a=JSON.parse(t);return JSON.stringify(a,null,2)}catch{return t}},st=t=>t.split(`
|
|
1
|
+
import{t as Vt,bo as ee,_ as Xr,bw as zt,bs as ce,bq as ir,b as At,bm as c}from"./Dv_tIgjy.js";import{bs as Wt,ca as pe,aD as e,bH as f,a5 as T,bA as x,W as l,bn as Nt,bV as N,c9 as n,aA as te,c6 as jt,ay as ne,be as Ze,b$ as tt,b_ as k,bO as g,bS as p,bl as S,aB as P,bj as Gr,aw as rt,ai as Jr,c5 as rr,a as yr,a7 as Ue,aj as gt,cd as Yr,br as Zr}from"./3SdAC2_C.js";import{i as Q}from"./D7nvPiBp.js";import{k as Pr}from"./D6gLzTDC.js";import{g as Ct}from"./52P8Bm3E.js";import{c as Rt}from"./DpKzpN4e.js";import{b as $r}from"./Dn334wJv.js";import{Jv as U,nX as kr,we as Ir,wd as Cr,LL as Qr,LM as ea,eJ as ta,eK as ra,Lb as fr,m5 as Yt,Cx as vr,sG as pr,oj as aa,A2 as oa,ac as gr,K2 as ia,Ki as na,nx as sa,iW as la,nZ as da,vG as ca,Av as ua,La as fa}from"./CWhRK5Rp.js";import{g as va}from"./DWGXN6Nr.js";import{a as pa,h as ga,j as ma,c as _a,d as ha,i as wa,e as ba,f as mr,g as xa,b as Zt}from"./CSQyBrRH.js";import{bO as ya,b$ as Pa,dH as $a}from"./BqA-3o9l.js";import{w as _r,d as ka}from"./wEnqV1Ol.js";import{f as Ia}from"./CxTWC0xh.js";import{m as Qt}from"./I4WMrmBa.js";import{f as Ce}from"./Z_oRTxSz.js";import{h as Ca}from"./D7fB2Oi-.js";import"./BPxuNmyn.js";import{s as at,g as It,f as hr}from"./DLx1kqr5.js";import{F as et,ac as Sa,au as Fa,aZ as Da,b3 as Ut,ct as Ta,cu as Ea,bm as Ra,cS as Ma,c9 as ja}from"./B80pUkKE.js";import{E as Ua,b as La,S as wr}from"./Cv8U-Bhv.js";import{c as Va}from"./ChTqQfQN.js";import"./KS3jDVZW.js";import{$ as za}from"./DU4vrWyh.js";import{i as er,b as Aa,a as Wa}from"./H2jLkRRS.js";import{C as ar,p as Na}from"./DfJ0n1tN.js";import{M as Ba}from"./BGIIIhAt.js";import{l as tr,m as Sr}from"./JGtSKGY1.js";import"./B23aic_N.js";import"./Cm6Te9Vq.js";import{M as Mt}from"./BMiwx6rS.js";import{V as Oa}from"./BEk-bvEu.js";import{bT as Ha,b7 as qa}from"./ChbSsiLP.js";import{g as Ka}from"./BH7eVR7o.js";import{H as Xa}from"./Bqd7fdCF.js";import{g as Ga,W as Ja}from"./g71ihZ8_.js";import{b as Ya,h as Za}from"./t5ofrZ-c.js";import{t as Qa}from"./DUpPMwJS.js";const Fr=U.createSelector((G,w)=>kr(G.pdfPreview.previews,w));var eo=P('<div class="flex shrink-0 flex-wrap items-center justify-center gap-2 border-b border-border p-2"><!> <span aria-live="polite"> </span> <!> <!> <span> </span> <!></div> <div class="min-h-0 flex-1 overflow-auto p-4"><canvas class="mx-auto block" role="img"></canvas></div>',1),to=P('<div class="flex h-full min-h-0 flex-col" data-testid="pdf-viewer"><!></div>');function or(G,w){if(new.target)return Vt({component:or,...G});Wt(w,!0);const ye=()=>ce(we,"$preview",ot),[ot,re]=ir();let y=ee(w,"workspaceId",7),ae=ee(w,"filePath",7),Pe=ee(w,"gitRootId",7);const Se=crypto.randomUUID(),we=Fr(Se),ge=new WeakMap;let Y=N(null),Xe=N(void 0),V=N(1),B=N(1),se=N(!0),me=N(!1),Fe=N(null),A=N(0);const be=n(()=>ye()?.error??e(Fe)),De=n(()=>e(be)==="missing"?c.file_pdf_missing_error():e(be)==="large"?c.file_pdf_large_error():e(be)==="invalid"?c.file_pdf_invalid_error():e(be)==="password"?c.file_pdf_password_error():c.file_pdf_load_error());pe(()=>{const d=y(),I=ae();e(A);const b=crypto.randomUUID();return U.dispatch(Ir(Se,b,d,I,...Pe()?[{gitRootId:Pe()}]:[])),()=>{U.dispatch(Cr(Se,b))}}),pe(()=>{const d=ye()?.url;let I=!1,b;if(f(Y,null),f(Fe,null),f(se,!0),f(V,1),f(B,1),!!d)return(async()=>{try{const{loadPdfDocument:W}=await Xr(async()=>{const{loadPdfDocument:_e}=await import("./cb1JHFKl.js");return{loadPdfDocument:_e}},[],import.meta.url);if(I)return;b=W(d);const M=await b.promise;I||f(Y,M)}catch(W){if(I)return;f(Fe,W instanceof Error&&W.name==="PasswordException"?"password":W instanceof Error&&W.name==="InvalidPDFException"?"invalid":"load",!0)}finally{I||f(se,!1)}})(),()=>{I=!0,b?.destroy()}}),pe(()=>{const d=e(Y),I=e(Xe),b=e(V),W=e(B);if(!d||!I)return;let M=!1,_e,E;const oe=()=>{if(!E)return;const X=(ge.get(E)??1)-1;X?ge.set(E,X):(ge.delete(E),E.cleanup()),E=void 0};return f(me,!0),(async()=>{try{if(E=await d.getPage(b),ge.set(E,(ge.get(E)??0)+1),M){oe();return}const X=E.getViewport({scale:W}),Z=Math.min(window.devicePixelRatio||1,2,Math.sqrt(16e6/(X.width*X.height)));I.width=Math.ceil(X.width*Z),I.height=Math.ceil(X.height*Z),I.style.width=`${X.width}px`,I.style.height=`${X.height}px`,_e=E.render({canvas:I,viewport:X,transform:[Z,0,0,Z,0,0]}),await _e.promise}catch{M||f(Fe,"invalid")}finally{M||f(me,!1)}})(),()=>{M=!0,_e?.cancel(),_e?_e.promise.then(oe,oe):oe()}});var Ne={get workspaceId(){return y()},set workspaceId(d){y(d),te()},get filePath(){return ae()},set filePath(d){ae(d),te()},get gitRootId(){return Pe()},set gitRootId(d){Pe(d),te()},$set:zt,$on:(d,I)=>At(w,d,I)},Le=to(),Be=T(Le);{var o=d=>{{const I=W=>{Ze();var M=tt();k(()=>g(M,e(De))),l(W,M)};let b=n(()=>c.ui_combobox_retry_label());Ua(d,{onRetry:()=>jt(A),get retryLabel(){return e(b)},class:"m-auto",message:I,$$slots:{message:!0}})}},i=d=>{{let I=n(()=>c.file_pdf_loading_label());La(d,{get label(){return e(I)},count:1,class:"p-4"})}},F=d=>{var I=eo(),b=ne(I),W=T(b);{let ue=n(()=>e(V)<=1);Ce(W,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>jt(V,-1),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.file_pdf_previous_label()]),l(Ee,fe)},$$slots:{default:!0}})}var M=p(W,2),_e=S(M,!0),E=p(M,2);{let ue=n(()=>e(V)>=e(Y).numPages);Ce(E,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>jt(V),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.file_pdf_next_label()]),l(Ee,fe)},$$slots:{default:!0}})}var oe=p(E,2);{let ue=n(()=>e(B)<=.25);Ce(oe,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>f(B,Math.max(.25,e(B)-.25),!0),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.editor_fileViewer_zoomOut_tooltip()]),l(Ee,fe)},$$slots:{default:!0}})}var X=p(oe,2),Z=S(X,!0),it=p(X,2);{let ue=n(()=>e(B)>=3);Ce(it,{variant:"ghost",size:"compact",get disabled(){return e(ue)},onclick:()=>f(B,Math.min(3,e(B)+.25),!0),children:(Ee,Ve)=>{Ze();var fe=tt();k(ze=>g(fe,ze),[()=>c.editor_fileViewer_zoomIn_tooltip()]),l(Ee,fe)},$$slots:{default:!0}})}x(b);var nt=p(b,2),st=T(nt);let ut;$r(st,ue=>f(Xe,ue),()=>e(Xe)),x(nt),k((ue,Ee,Ve)=>{g(_e,ue),g(Z,Ee),at(nt,"aria-busy",e(me)),at(st,"aria-label",Ve),ut=It(st,"",ut,{visibility:e(me)?"hidden":"visible"})},[()=>c.file_pdf_page_label({page:tr(e(V)),total:tr(e(Y).numPages)}),()=>Sr(e(B),{style:"percent"}),()=>c.file_pdf_canvas_ariaLabel({name:ae(),page:tr(e(V))})]),l(d,I)};Q(Be,d=>{e(be)?d(o):e(se)||ye()?.status==="loading"?d(i,1):e(Y)&&d(F,2)})}x(Le),l(G,Le);var Te=Nt(Ne);return re(),Te}const ro=U.createSelector((G,w)=>kr(G.videoPreview.previews,w));var ao=P('<p role="status"> </p>'),oo=P('<p role="alert"> </p>'),io=P('<div class="flex flex-col items-center gap-3 p-6 text-center text-sm text-subtle"><p class="break-all"> </p> <!> <!></div>'),no=P('<video controls="" preload="metadata" playsinline="" class="max-w-full max-h-full" data-testid="file-video"> </video>',2),so=P('<div class="min-h-0 flex-1 flex items-center justify-center bg-background"><!></div>');function Dr(G,w){if(new.target)return Vt({component:Dr,...G});Wt(w,!0);const ye=()=>ce(Xe,"$preview",ot),[ot,re]=ir();let y=ee(w,"sourceUrl",7),ae=ee(w,"fileName",7),Pe=ee(w,"allowDownload",7),Se=ee(w,"downloading",7),we=ee(w,"onDownload",7),ge=N(null);const Y=crypto.randomUUID(),Xe=ro(Y),V=n(()=>ye()?.status==="loading"),B=n(()=>e(ge)??ye()?.error);let se=!1,me=!1;Gr(()=>{me=!0,U.dispatch(Qr(Y))});function Fe(){if(me||e(V))return;const i=y().startsWith("workspace-file://")?new URL(y()):null;if(se||!i||!i.pathname.toLowerCase().endsWith(".mp4")){f(ge,"unsupported");return}se=!0,i.searchParams.set("preview","h264"),U.dispatch(ea(Y,i.hostname,i.toString()))}function A(i){if(me)return;const F=i.currentTarget.error?.code;F===2?f(ge,"network"):F!==1&&Fe()}var be={get sourceUrl(){return y()},set sourceUrl(i){y(i),te()},get fileName(){return ae()},set fileName(i){ae(i),te()},get allowDownload(){return Pe()},set allowDownload(i){Pe(i),te()},get downloading(){return Se()},set downloading(i){Se(i),te()},get onDownload(){return we()},set onDownload(i){we(i),te()},$set:zt,$on:(i,F)=>At(w,i,F)},De=so(),Ne=T(De);{var Le=i=>{var F=io(),Te=T(F),d=S(Te,!0),I=p(Te,2);{var b=E=>{var oe=ao(),X=S(oe,!0);k(Z=>g(X,Z),[()=>c.editor_fileViewer_videoPreparing_label()]),l(E,oe)},W=E=>{var oe=oo(),X=S(oe,!0);k(Z=>g(X,Z),[()=>e(B)==="network"?c.editor_fileViewer_videoLoad_error():c.editor_fileViewer_videoUnsupported_label()]),l(E,oe)};Q(I,E=>{e(V)?E(b):E(W,-1)})}var M=p(I,2);{var _e=E=>{Ce(E,{variant:"secondary",size:"sm",get onclick(){return we()},get disabled(){return Se()},children:(oe,X)=>{Ze();var Z=tt();k(it=>g(Z,it),[()=>c.layout_fileTab_downloadFile_label()]),l(oe,Z)},$$slots:{default:!0}})};Q(M,E=>{Pe()&&E(_e)})}x(F),k(()=>g(d,ae())),l(i,F)},Be=i=>{var F=no(),Te=S(F,!0);k(d=>{at(F,"src",ye()?.url??y()),g(Te,d)},[()=>c.editor_fileViewer_videoUnsupported_label()]),rt("error",F,A),rt("loadedmetadata",F,d=>{d.currentTarget.videoWidth===0&&Fe()}),l(i,F)};Q(Ne,i=>{e(B)||e(V)?i(Le):i(Be,-1)})}x(De),l(G,De);var o=Nt(be);return re(),o}var lo=P('<!> <span class="text-xs text-subtle min-w-[50px] text-center"> </span> <!> <div class="w-px h-5 bg-border mx-1"></div>',1),co=P('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="w-px h-5 bg-border mx-1"></div> <!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),uo=P('<div class="min-h-0 flex-1 flex flex-col"><div class="flex items-center gap-2 p-2 border-b border-border bg-muted/30"><!> <!> <div class="ml-auto text-xs text-subtle"> </div></div> <div><img draggable="false" class="max-w-full max-h-full object-contain"/></div></div>'),fo=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path></svg></div> <div class="text-sm text-subtle mb-4"> </div> <audio controls="" class="w-full max-w-md"><source/> </audio></div>'),vo=P("<!> ",1),po=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"></path></svg></div> <p class="text-sm text-subtle mb-4"> </p> <!></div>'),go=P('<th class="border border-border px-2 py-1 text-left text-xs font-medium bg-muted"> </th>'),mo=P('<td class="border border-border px-2 py-1 text-xs"> </td>'),_o=P("<tr></tr>"),ho=P('<div class="flex-1 overflow-auto p-4"><table class="w-full border-collapse"><thead><tr></tr></thead><tbody></tbody></table></div>'),wo=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),bo=P('<div class="flex-1 flex flex-col items-center justify-center p-8"><div class="text-subtle mb-4"><svg class="w-24 h-24" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg></div> <p class="text-sm text-subtle mb-2"> </p> <p class="text-xs text-subtle"> </p></div>'),xo=P('<div class="h-full flex flex-col"><!></div>');function Lt(G,w){if(new.target)return Vt({component:Lt,...G});Wt(w,!0);const ye=t=>{var a=lo(),u=ne(a);{let O=n(()=>c.editor_fileViewer_zoomOut_tooltip());Ce(u,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:oe,get title(){return e(O)},children:(D,L)=>{et(D,{get icon(){return Ta},size:"sm"})},$$slots:{default:!0}})}var m=p(u,2),h=S(m,!0),R=p(m,2);{let O=n(()=>c.editor_fileViewer_zoomIn_tooltip());Ce(R,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:E,get title(){return e(O)},children:(D,L)=>{et(D,{get icon(){return Ea},size:"sm"})},$$slots:{default:!0}})}Ze(2),k(()=>g(h,e(Fe))),l(t,a)},ot=Va("FileViewer");let re=ee(w,"filePath",7),y=ee(w,"fileContent",7,""),ae=ee(w,"sourceUrl",7),Pe=ee(w,"language",7),Se=ee(w,"isBinary",7),we=ee(w,"allowDownload",7,!0),ge=ee(w,"onDownload",7),Y=ee(w,"downloading",7,!1);const Xe=t=>{const a=t.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","webp","bmp","ico","avif"].includes(a)?"image":a==="svg"?"svg":["mp4","webm","ogg","mov","avi"].includes(a)?"video":["mp3","wav","ogg","m4a","flac"].includes(a)?"audio":a==="pdf"?"pdf":["md","markdown"].includes(a)?"markdown":a==="json"?"json":a==="csv"?"csv":["yaml","yml"].includes(a)?"yaml":a==="xml"?"xml":["zip","tar","gz","rar","7z","bz2"].includes(a)?"archive":["exe","dll","so","dylib","wasm"].includes(a)?"binary":"text"},V=n(()=>Xe(re())),B=n(()=>re().split("/").pop()||c.editor_fileViewer_unknown_fallback());let se=N(100),me=N(0);const Fe=n(()=>Sr(e(se)/100,{style:"percent",maximumFractionDigits:0}));let A=N(!1),be=N(0),De=N(0),Ne=N(0),Le=N(0),Be=N(!1),o=null;function i(){const t=o;o=null,f(Be,!1),t?.viewport.hasPointerCapture(t.pointerId)&&t.viewport.releasePointerCapture(t.pointerId)}function F(t){if(t.button!==0||!t.isPrimary||o)return;const a=t.currentTarget;a.setPointerCapture(t.pointerId),o={pointerId:t.pointerId,x:t.clientX,y:t.clientY,viewport:a},f(Be,!0),t.preventDefault()}function Te(t){if(!(!o||t.pointerId!==o.pointerId)){if((t.buttons&1)===0){i();return}f(Ne,o.viewport.scrollLeft,!0),f(Le,o.viewport.scrollTop,!0),f(be,e(be)+(t.clientX-o.x)),f(De,e(De)+(t.clientY-o.y)),o.x=t.clientX,o.y=t.clientY}}function d(t){t.pointerId===o?.pointerId&&i()}pe(()=>{re(),ae(),e(se),e(me),f(Ne,0),f(Le,0)}),pe(()=>(re(),ae(),rr(()=>{i(),f(be,0),f(De,0)}),i));const I=t=>{const a=t.split(".").pop()?.toLowerCase();return a==="jpg"||a==="jpeg"?"image/jpeg":a==="png"?"image/png":a==="gif"?"image/gif":a==="webp"?"image/webp":"application/octet-stream"},b=t=>{const a=t.split(".").pop()?.toLowerCase();if(a==="mp4")return"video/mp4";if(a==="webm")return"video/webm"},W=()=>{if(ae())return ae();if(typeof y()=="string")return y().startsWith("data:")||y().startsWith("http")?y():Se()?`data:${I(re())};base64,${y()}`:`data:${I(re())};base64,${y()}`;if(y()instanceof ArrayBuffer){const a=new Uint8Array(y()).reduce((m,h)=>m+String.fromCharCode(h),""),u=btoa(a);return`data:${I(re())};base64,${u}`}return""},M=()=>{if(ae())return ae();const t=b(re());if(!t)return"";if(typeof y()=="string")return y().startsWith("data:")||y().startsWith("http")?y():`data:${t};base64,${y()}`;const a=new Uint8Array(y()),u=[],m=32768;for(let h=0;h<a.length;h+=m)u.push(String.fromCharCode(...a.subarray(h,h+m)));return`data:${t};base64,${btoa(u.join(""))}`},_e=()=>{const t=typeof y()=="string"?new TextEncoder().encode(y()):new Uint8Array(y()),a=[],u=32768;for(let m=0;m<t.length;m+=u)a.push(String.fromCharCode(...t.subarray(m,m+u)));return`data:image/svg+xml;base64,${btoa(a.join(""))}`},E=()=>{f(se,Math.min(e(se)+25,500),!0)},oe=()=>{f(se,Math.max(e(se)-25,25),!0)},X=()=>{f(me,(e(me)+90)%360)},Z=()=>{if(!we()||Y())return;if(ge()){ge()();return}const t=document.createElement("a");t.href=e(V)==="video"?M():e(V)==="svg"?_e():W(),t.download=e(B),t.click()},it=async()=>{try{const t=W(),a=new Image;a.crossOrigin="anonymous";const u=await new Promise((m,h)=>{a.onload=()=>{const R=document.createElement("canvas");R.width=a.naturalWidth,R.height=a.naturalHeight;const O=R.getContext("2d");if(!O){h(new Error("Failed to get canvas context"));return}O.drawImage(a,0,0),R.toBlob(D=>{D?m(D):h(new Error("Failed to create blob from canvas"))},"image/png",1)},a.onerror=()=>h(new Error("Failed to load image")),a.src=t});await navigator.clipboard.write([new ClipboardItem({"image/png":u})]),f(A,!0),setTimeout(()=>f(A,!1),2e3)}catch(t){ot.error("Failed to copy image:",t)}},nt=t=>{try{const a=JSON.parse(t);return JSON.stringify(a,null,2)}catch{return t}},st=t=>t.split(`
|
|
2
2
|
`).map(u=>u.split(",").map(m=>m.trim()));var ut={get filePath(){return re()},set filePath(t){re(t),te()},get fileContent(){return y()},set fileContent(t=""){y(t),te()},get sourceUrl(){return ae()},set sourceUrl(t){ae(t),te()},get language(){return Pe()},set language(t){Pe(t),te()},get isBinary(){return Se()},set isBinary(t){Se(t),te()},get allowDownload(){return we()},set allowDownload(t=!0){we(t),te()},get onDownload(){return ge()},set onDownload(t){ge(t),te()},get downloading(){return Y()},set downloading(t=!1){Y(t),te()},$set:zt,$on:(t,a)=>At(w,t,a)},ue=xo();rt("blur",yr,i);var Ee=T(ue);{var Ve=t=>{var a=co(),u=T(a),m=T(u);ye(m);var h=p(m,2);{let he=n(()=>c.editor_fileViewer_rotate_tooltip());Ce(h,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:X,get title(){return e(he)},children:($e,He)=>{et($e,{get icon(){return Sa},size:"sm"})},$$slots:{default:!0}})}var R=p(h,4);{let he=n(()=>c.editor_fileViewer_copyImage_tooltip());Ce(R,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:it,get title(){return e(he)},children:($e,He)=>{var ke=Ue(),Ft=ne(ke);{var Dt=Ie=>{et(Ie,{get icon(){return Fa},size:"sm",class:"text-green-500"})},Je=Ie=>{et(Ie,{get icon(){return Da},size:"sm"})};Q(Ft,Ie=>{e(A)?Ie(Dt):Ie(Je,-1)})}l($e,ke)},$$slots:{default:!0}})}var O=p(R,2);{let he=n(()=>!we()||Y()),$e=n(()=>c.editor_fileViewer_download_tooltip());Ce(O,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:Z,get disabled(){return e(he)},get title(){return e($e)},children:(He,ke)=>{et(He,{get icon(){return Ut},size:"sm"})},$$slots:{default:!0}})}var D=p(O,2),L=S(D,!0);x(u);var H=p(u,2),xe=S(H);x(a),k(he=>{g(L,e(B)),hr(H,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(Be)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),It(H,`--pan-scroll-x: ${e(Ne)??""}px; --pan-scroll-y: ${e(Le)??""}px;`),at(xe,"src",he),at(xe,"alt",e(B)),It(xe,`translate: ${e(be)??""}px ${e(De)??""}px; transform: scale(${e(se)/100}) rotate(${e(me)??""}deg); transition: transform 0.2s;`)},[()=>W()]),gt("pointerdown",H,F),gt("pointermove",H,Te),gt("pointerup",H,d),rt("pointercancel",H,d),rt("lostpointercapture",H,d),l(t,a)},fe=t=>{var a=uo(),u=T(a),m=T(u);ye(m);var h=p(m,2);{let H=n(()=>!we()||Y()),xe=n(()=>c.editor_fileViewer_download_tooltip());Ce(h,{size:"icon",variant:"ghost",class:"h-7 w-7",onclick:Z,get disabled(){return e(H)},get title(){return e(xe)},children:(he,$e)=>{et(he,{get icon(){return Ut},size:"sm"})},$$slots:{default:!0}})}var R=p(h,2),O=S(R,!0);x(u);var D=p(u,2),L=S(D);x(a),k(H=>{g(O,e(B)),hr(D,1,`relative min-h-0 flex-1 overflow-auto bg-checkered flex items-center justify-center p-4 select-none ${e(Be)?"cursor-grabbing":"cursor-grab"}`,"svelte-1uj35xu"),It(D,`--pan-scroll-x: ${e(Ne)??""}px; --pan-scroll-y: ${e(Le)??""}px;`),at(L,"src",H),at(L,"alt",e(B)),It(L,`translate: ${e(be)??""}px ${e(De)??""}px; transform: scale(${e(se)/100});`)},[()=>_e()]),gt("pointerdown",D,F),gt("pointermove",D,Te),gt("pointerup",D,d),rt("pointercancel",D,d),rt("lostpointercapture",D,d),l(t,a)},ze=t=>{const a=n(M);var u=Ue(),m=ne(u);Pr(m,()=>re()+e(a),h=>{Dr(h,{get sourceUrl(){return e(a)},get fileName(){return e(B)},get allowDownload(){return we()},get downloading(){return Y()},onDownload:Z})}),l(t,u)},mt=t=>{var a=fo(),u=p(T(a),2),m=S(u,!0),h=p(u,2),R=T(h),O=p(R);x(h),x(a),k((D,L)=>{g(m,e(B)),at(R,"src",D),g(O,` ${L??""}`)},[()=>W(),()=>c.editor_fileViewer_audioUnsupported_label()]),l(t,a)},Bt=t=>{var a=po(),u=p(T(a),2),m=S(u,!0),h=p(u,2);{let R=n(()=>!we()||Y());Ce(h,{size:"sm",variant:"secondary",onclick:Z,get disabled(){return e(R)},children:(O,D)=>{var L=vo(),H=ne(L);et(H,{get icon(){return Ut},size:"sm",class:"mr-2"});var xe=p(H);k(he=>g(xe,` ${he??""}`),[()=>c.editor_fileViewer_downloadPdf_label()]),l(O,L)},$$slots:{default:!0}})}x(a),k(R=>g(m,R),[()=>c.editor_fileViewer_pdfUnavailable_label()]),l(t,a)},Ot=t=>{{let a=n(()=>nt(y().toString()));ar(t,{get value(){return e(a)},language:"json",get fileName(){return re()},lineNumbers:!0,readOnly:!0})}},Oe=t=>{const a=n(()=>st(y().toString()));var u=ho(),m=T(u),h=T(m),R=T(h);Ct(R,23,()=>e(a)[0]||[],(D,L)=>`header-${L}-${D}`,(D,L)=>{var H=go(),xe=S(H,!0);k(()=>g(xe,e(L))),l(D,H)}),x(R),x(h);var O=p(h);Ct(O,23,()=>e(a).slice(1),(D,L)=>`row-${L}`,(D,L,H)=>{var xe=_o();Ct(xe,23,()=>e(L),(he,$e)=>`cell-${e(H)}-${$e}`,(he,$e)=>{var He=mo(),ke=S(He,!0);k(()=>g(ke,e($e))),l(he,He)}),x(xe),l(D,xe)}),x(O),x(m),x(u),l(t,u)},Ge=t=>{var a=wo(),u=p(T(a),2),m=S(u,!0),h=p(u,2),R=S(h,!0);x(a),k(O=>{g(m,e(B)),g(R,O)},[()=>c.editor_fileViewer_archive_label()]),l(t,a)},Ht=t=>{var a=bo(),u=p(T(a),2),m=S(u,!0),h=p(u,2),R=S(h,!0);x(a),k(O=>{g(m,e(B)),g(R,O)},[()=>c.editor_fileViewer_binary_label()]),l(t,a)},St=t=>{{let a=n(()=>y().toString());ar(t,{get value(){return e(a)},get language(){return Pe()},get fileName(){return re()},lineNumbers:!0,highlightActiveLine:!0})}};Q(Ee,t=>{e(V)==="image"?t(Ve):e(V)==="svg"?t(fe,1):e(V)==="video"?t(ze,2):e(V)==="audio"?t(mt,3):e(V)==="pdf"?t(Bt,4):e(V)==="json"?t(Ot,5):e(V)==="csv"?t(Oe,6):e(V)==="archive"?t(Ge,7):e(V)==="binary"?t(Ht,8):t(St,-1)})}return x(ue),l(G,ue),Nt(ut)}Jr(["pointerdown","pointermove","pointerup"]);const yo=/access denied|permission denied|outside (?:the )?workspace/i,Po=/file not found|no such file or directory/i;function $o(G){return yo.test(G)?"access-denied":G===c.files_read_notFound_error()||Po.test(G)?"not-found":"generic"}function ko(G){switch(G){case"access-denied":return c.layout_fileTab_errorAccessDenied_label();case"not-found":return c.layout_fileTab_errorNotFound_label();case"generic":return c.layout_fileTab_errorGeneric_label()}}var Io=P("<!> <!>",1),Co=P("<!> <!> <!>",1),So=P('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p> </p> <p class="text-xs"> </p></div>'),br=P('<div class="flex h-full items-center justify-center p-4 text-subtle"><p role="alert"> </p></div>'),Fo=P('<div class="flex h-full items-center justify-center text-subtle"><p> </p></div>'),xr=P('<div class="flex items-center justify-center h-full text-subtle"><p> </p></div>'),Do=P('<div class="flex items-center gap-3"><!> <!></div>'),To=P('<div class="flex flex-col h-full"><div class="flex-1 p-4 space-y-2"></div></div>'),Eo=P('<p class="text-xs"> </p>'),Ro=P("<li><!></li>"),Mo=P('<p class="text-xs mt-2"> </p> <ul class="flex flex-col items-center gap-1"></ul>',1),jo=P('<div class="flex flex-col items-center justify-center h-full text-subtle gap-2"><p class="text-danger" role="alert"> </p> <p class="text-xs font-mono"> </p> <!> <!></div>'),Uo=P('<div class="flex flex-col items-center justify-center h-full text-subtle gap-3 p-4"><p> </p> <p class="text-xs break-all"> </p> <!></div>'),Lo=P('<div class="h-full overflow-auto p-4"><!></div>');function Vo(G,w){if(new.target)return Vt({component:Vo,...G});Wt(w,!0);const ye=()=>ce(Ot,"$workspace",A),ot=()=>ce(_e,"$fileContentStore",A),re=()=>ce(E,"$fileLoadingStore",A),y=()=>ce(oe,"$fileSavingStore",A),ae=()=>ce(X,"$fileErrorStore",A),Pe=()=>ce(Z,"$fileErrorInfoStore",A),Se=()=>ce(it,"$homeView$",A),we=()=>ce(nt,"$fileNotFoundCandidatesStore",A),ge=()=>ce(st,"$isFileBinaryStore",A),Y=()=>ce(ut,"$isFileDirtyStore",A),Xe=()=>ce(ue,"$fileLastUpdatedStore",A),V=()=>ce(Ee,"$ftChanges$",A),B=()=>ce(Bt,"$gutterRead$",A),se=()=>ce(Le,"$lineWrapping",A),me=()=>ce(Be,"$diffIndicators",A),Fe=()=>ce(ze,"$rootMediaPreview",A),[A,be]=ir(),De=r=>{var s=Io(),$=ne(s);{var C=de=>{var Ae=Ue(),qe=ne(Ae);Rt(qe,()=>Mt,(pt,xt)=>{xt(pt,{get icon(){return Ra},get label(){return e(he)},disabled:!0})}),l(de,Ae)};Q($,de=>{!e(_t)&&!e(b)&&!e(L)&&de(C)})}var le=p($,2);{var Re=de=>{{let Ae=n(()=>!e(Tt)||!e(Je)),qe=n(()=>!e(b)&&(!e(Tt)||!e(Je)));Oa(de,{embedded:!0,showFold:!1,showSplit:!1,get showPreview(){return e(Tt)},get previewEnabled(){return e(Je)},onTogglePreview:()=>f(Je,!e(Je)),get showWrap(){return e(Ae)},get wrapEnabled(){return se()},onToggleWrap:()=>U.dispatch(na()),get showDiff(){return e(qe)},get diffEnabled(){return me()},onToggleDiff:()=>U.dispatch(ia())})}};Q(le,de=>{o().filePath&&!e(_t)&&!e(L)&&de(Re)})}l(r,s)},Ne=r=>{var s=Ue(),$=ne(s);{var C=le=>{var Re=Co(),de=ne(Re);{var Ae=We=>{var Ye=Ue(),dt=ne(Ye);{let yt=n(()=>c.layout_fileTab_goToChanges_tooltip());Rt(dt,()=>Mt,(Pt,$t)=>{$t(Pt,{get icon(){return ja},get label(){return e(yt)},onclick:zr})})}l(We,Ye)};Q(de,We=>{e(Rr)&&We(Ae)})}var qe=p(de,2);{var pt=We=>{var Ye=Ue(),dt=ne(Ye);{let yt=n(()=>c.layout_fileTab_downloadFile_label()),Pt=n(()=>!e(wt)||e(lt));Rt(dt,()=>Mt,($t,Xt)=>{Xt($t,{get icon(){return Ut},get label(){return e(yt)},onclick:Et,get disabled(){return e(Pt)}})})}l(We,Ye)};Q(qe,We=>{e(Qe)&&We(pt)})}var xt=p(qe,2);{let We=n(()=>c.layout_fileTab_deleteFile_tooltip());Rt(xt,()=>Mt,(Ye,dt)=>{dt(Ye,{get icon(){return Ma},get label(){return e(We)},onclick:Ar,destructive:!0})})}l(le,Re)};Q($,le=>{o().filePath&&!e(_t)&&!e(b)&&le(C)})}l(r,s)},Le=Ha(),Be=qa();let o=ee(w,"tab",7),i=ee(w,"workspaceId",7),F=ee(w,"isActive",7),Te=ee(w,"isPanelFocused",7);pe(()=>{const r=i();if(!(!F()||!r||e(d)))return U.dispatch(ta(r,"files")),()=>U.dispatch(ra(r,"files"))});const d=n(()=>typeof o().data?.gitRootId=="string"?o().data.gitRootId:void 0),I=n(()=>typeof o().data?.gitRootPath=="string"?o().data.gitRootPath:void 0),b=n(()=>!!e(d)),W=n(()=>o().filePath?Ia(o().filePath,e(d)):o().filePath),M=Yr(e(W));pe(()=>{M.set(e(W))});const _e=pa(i(),M),E=ga(i(),M),oe=ma(i(),M),X=_a(i(),M),Z=ha(i(),M),it=Qa(i()),nt=wa(i(),M),st=ba(i(),M),ut=mr(i(),M),ue=xa(i(),M),Ee=ya(i()),Ve=va(),fe=crypto.randomUUID(),ze=Fr(fe),mt=`file-gutter:${crypto.randomUUID()}`,Bt=Pa(i(),mt),Ot=$a(i()),Oe=n(()=>ye()?.worktreePath||ye()?.repositoryPath||ye()?.path||null),Ge=n(ot),Ht=Ga();pe(()=>{e(Ge)!==null&&e(Ge)!==void 0&&Ht?.markContentLoaded()});const St=n(re),t=n(y),a=n(ae),u=n(()=>e(a)?$o(e(a)):"generic"),m=n(()=>e(a)?Ya(Pe()):null);let h=N(0),R=!1;pe(()=>{const r=Se();if(!r||r.unavailable){R=!1;return}e(m)&&!R&&(R=!0,rr(()=>jt(h)))});const O=5,D=n(()=>(we()??[]).slice(0,O)),L=n(ge),H=n(Y),xe=n(Xe),he=n(()=>e(t)?c.ui_saveIndicator_saving_tooltip():e(H)?c.ui_saveIndicator_autoSaving_tooltip():c.ui_saveIndicator_saved_tooltip());let $e=N(null),He=N(Zr([])),ke=N(null),Ft=N(void 0),Dt=N(void 0),Je=N(!0);pe(()=>{const r=o().data?.line,s=o().data?.jumpTimestamp;!r||s!==void 0&&s===e(Dt)||(f(Dt,s,!0),f(Ft,{line:r},!0),f(Je,!1))});const Ie=n(()=>e(d)?_r(o().filePath,e(I)):null),_t=n(()=>e(d)?!e(Ie):!!(o().filePath&&(Aa(o().filePath)||e(Oe)&&Wa(o().filePath,e(Oe))))),ht=n(()=>o().filePath&&e(Oe)?er(o().filePath)?o().filePath:`${e(Oe)}/${o().filePath}`:null),ft=n(()=>!!o().filePath&&/\.pdf$/i.test(o().filePath)),vt=n(()=>!!o().filePath&&/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(o().filePath)),Qe=n(()=>i()&&/^[A-Za-z0-9._-]+$/.test(i())?_r(o().filePath,e(Oe)):null),Tr=n(()=>!e(d)&&e(Qe)?e(Qe).split("/").slice(0,-1).join("/"):void 0),qt=n(()=>e(ft)||e(vt)?e(Qe):null),nr=n(()=>e(d)&&e(vt)?{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",mp4:"video/mp4",webm:"video/webm"}[o().filePath?.split(".").pop()?.toLowerCase()??""]:void 0);pe(()=>{if(!F()||!e(d)||!e(Ie)||!e(nr))return;const r=crypto.randomUUID();return U.dispatch(Ir(fe,r,i(),e(Ie),{gitRootId:e(d),mimeType:e(nr)})),()=>U.dispatch(Cr(fe,r))});let lt=N(!1);const wt=n(()=>!!e(Qe)&&!e(St)&&(!e(vt)||e(ke)===e(Qe))),sr=n(()=>e(ke)&&i()?`workspace-file://${i()}/${e(ke).split("/").map(encodeURIComponent).join("/")}`:null),Kt=n(()=>o().filePath?da(o().filePath):"plaintext"),Tt=n(()=>e(Kt)==="markdown");pe(()=>{if(!F()||e(ft)||e(d))return;const r=e(qt),s=o().filePath,$=i(),C=o().id;if(f(ke,null),!r||!s||!$)return;let le=!1;const Re=()=>!le&&i()===$&&o().id===C&&o().filePath===s;return(async()=>{let de=!1;try{de=(await Ca("file.stat",{workspaceId:$,path:r}))?.isFile===!0}catch{}if(!Re())return;if(de){f(ke,r,!0);return}if(!/\.(?:png|jpe?g|gif|webp|mp4|webm)$/i.test(r)){f(ke,r,!0);return}const{candidates:Ae,truncated:qe}=await za($,r);if(Re()){if(!qe&&Ae.length===1){U.dispatch(fr($,s,Ae[0],C));return}f(ke,r,!0)}})(),()=>{le=!0}});function Er(r,s){return!!(r.file===s||r.relativePath===s||r.relativePath&&s.endsWith("/"+r.relativePath)||r.file&&s.endsWith("/"+r.file)||r.relativePath&&r.relativePath.endsWith("/"+s)||r.file&&r.file.endsWith("/"+s))}const bt=n(()=>e(b)||!o().filePath?null:V().find(r=>Er(r,o().filePath))??null),Rr=n(()=>!!e(bt));pe(()=>{if(e(b))return;const r=i(),s=o().filePath,$=e(Oe);return()=>{if(!r||!s)return;const C=Zt.select(U.state,r,s);if(C?.kind!=="editable-text")return;const le=Yt(C.localContent),Re=mr.select(U.state,r,s),de=er(s)?s:$?`${$}/${s}`:null;Re&&de&&U.dispatch(vr(r,s,de,le))}}),pe(()=>{const r=o().filePath,s=e(ht),$=i();if(e(h),!F())return;const C=!e(d)&&!!r&&er(r)&&!e(Oe);r&&$&&!e(_t)&&!e(vt)&&!e(ft)&&!C&&(e(d)&&e(Ie)&&e(W)?U.dispatch(pr($,e(W),s??r,{gitRoot:{id:e(d),relativePath:e(Ie)}})):U.dispatch(pr($,r,s??r)))});function Mr(){return e(Ge)??""}function jr(r){e(b)||e(L)||!o().filePath||!i()||!e(ht)||U.dispatch(fa(i(),o().filePath,Yt(r)))}function Ur(){if(e(b)||e(L)||!o().filePath||!e(ht)||e(Ge)===null||e(t))return;const r=Zt.select(U.state,i(),o().filePath);r?.kind==="editable-text"&&U.dispatch(vr(i(),o().filePath,e(ht),Yt(r.localContent)))}function Lr(r){const s=o().filePath;!s||!i()||(U.dispatch(ua(i(),s)),U.dispatch(fr(i(),s,r,o().id)))}pe(()=>{const r=o().filePath,s=e(bt);if(!r||!s){f(He,[],!0);return}if(!F())return;const $=i(),C=crypto.randomUUID();return U.dispatch(aa($,mt,C,{kind:"diffs",path:r,staged:s.stage==="staged"})),()=>{U.dispatch(oa($,mt,C))}}),pe(()=>{const r=B(),s=r?.result?.kind==="diffs"?r.result.chunks:[],$=s.find(C=>C.file===o().filePath)??s[0];f(He,$?Na($.chunks.map(C=>({oldStart:C.oldStart,oldLines:C.oldLines,newStart:C.newStart,newLines:C.newLines,lines:C.lines.map(le=>(le.type===gr.Addition?"+":le.type===gr.Deletion?"-":" ")+le.content)}))):[],!0)});function Vr(r){const s=/Mac|iPhone|iPad|iPod/.test(navigator.userAgent),$=Re=>Xa(r,Ka(Re),s);if($("editor.save")){r.preventDefault(),e(H)&&!e(t)&&Ur();return}const C=$("editor.undo")?"undo":$("editor.redo")?"redo":$("editor.toggle-task-list")?"toggle-task-list":$("editor.copy")?"copy":$("editor.select-all")?"select-all":null;if(!C||e(b)&&C!=="copy"&&C!=="select-all")return;C!=="toggle-task-list"&&e($e)?.runShortcut(C)&&r.preventDefault()}function zr(r){if(!o().filePath||!e(bt))return;const s=r?.metaKey||r?.ctrlKey||!1,C=r?.target?.closest("[data-panel-id]")?.getAttribute("data-panel-id")??void 0;U.dispatch(ca(i(),e(bt),{filePath:o().filePath,changeId:e(bt).id,openInAdjacentPanel:s,sourcePanelId:C}))}async function Et(){const r=e(Qe);if(!(e(b)||!r||!i()||!e(wt)||e(lt))){f(lt,!0);try{const s=await ka(i(),r,e(Oe));!s?.success&&!s?.canceled&&Qt.error(s?.error?.message||c.layout_fileTab_downloadFailed_error())}catch{Qt.error(c.layout_fileTab_downloadFailed_error())}finally{f(lt,!1)}}}function Ar(){const r=e(ht);if(e(b)||!o().filePath||!i()||!r)return;const s=sa(Zt.select(U.state,i(),o().filePath));if(!s){Qt.error(c.ui_reversibleActions_failed_error({message:c.fileExplorer_tree_undoUnavailable_error()}));return}U.dispatch(la(i(),o().filePath,{absolutePath:r,tabId:o().id,snapshot:s}))}pe(()=>{if(!Ve||!F())return;const r={isDirty:!e(b)&&e(H),isSaving:!e(b)&&e(t)};rr(()=>{Ve.registerActions({display:De,actions:Ne}),Ve.registerState(r)})});var Wr={get tab(){return o()},set tab(r){o(r),te()},get workspaceId(){return i()},set workspaceId(r){i(r),te()},get isActive(){return F()},set isActive(r){F(r),te()},get isPanelFocused(){return Te()},set isPanelFocused(r){Te(r),te()},$set:zt,$on:(r,s)=>At(w,r,s)},lr=Ue();rt("keydown",yr,r=>F()&&Vr(r));var Nr=ne(lr);{var Br=r=>{var s=Ue(),$=ne(s);Pr($,()=>o().filePath,C=>{var le=Ue(),Re=ne(le);{var de=_=>{var v=So(),j=T(v),q=S(j,!0),z=p(j,2),Me=S(z,!0);x(v),k(J=>{g(q,J),g(Me,o().filePath)},[()=>c.layout_fileTab_outsideWorkspace_label()]),l(_,v)},Ae=_=>{var v=Ue(),j=ne(v);{var q=z=>{or(z,{get workspaceId(){return i()},get filePath(){return e(Ie)},get gitRootId(){return e(d)}})};Q(j,z=>{F()&&z(q)})}l(_,v)},qe=_=>{var v=Ue(),j=ne(v);{var q=J=>{var K=br(),ie=T(K),je=S(ie,!0);x(K),k(ve=>g(je,ve),[()=>c.layout_fileTab_errorLoading_label()]),l(J,K)},z=J=>{Lt(J,{get filePath(){return o().filePath},get sourceUrl(){return Fe().url},allowDownload:!1})},Me=J=>{var K=Fo(),ie=T(K),je=S(ie,!0);x(K),k(ve=>g(je,ve),[()=>c.layout_fileTab_preparing_label()]),l(J,K)};Q(j,J=>{Fe()?.error?J(q):Fe()?.url?J(z,1):J(Me,-1)})}l(_,v)},pt=_=>{var v=Ue(),j=ne(v);{var q=z=>{or(z,{get workspaceId(){return i()},get filePath(){return e(qt)}})};Q(j,z=>{F()&&z(q)})}l(_,v)},xt=_=>{var v=br(),j=T(v),q=S(j,!0);x(v),k(z=>g(q,z),[()=>c.file_pdf_load_error()]),l(_,v)},We=_=>{{let v=n(()=>e(ke)??o().filePath),j=n(()=>!e(b)&&e(wt));Lt(_,{get filePath(){return e(v)},get sourceUrl(){return e(sr)},onDownload:Et,get allowDownload(){return e(j)},get downloading(){return e(lt)}})}},Ye=_=>{var v=xr(),j=T(v),q=S(j,!0);x(v),k(z=>g(q,z),[()=>c.layout_fileTab_preparing_label()]),l(_,v)},dt=_=>{var v=To(),j=T(v);Ct(j,20,()=>[...Array(20).keys()],q=>q,(q,z)=>{var Me=Do(),J=T(Me);wr(J,{class:"h-3 w-8 shrink-0"});var K=p(J,2);wr(K,{class:"h-3",style:`width: ${30+Math.random()*60}%`}),x(Me),l(q,Me)}),x(j),x(v),l(_,v)},yt=_=>{{let v=n(()=>Za(e(m)));Ja(_,{get view(){return e(v)}})}},Pt=_=>{var v=jo(),j=T(v),q=S(j,!0),z=p(j,2),Me=S(z,!0),J=p(z,2);{var K=ve=>{var Ke=Eo(),ct=S(Ke,!0);k(()=>g(ct,e(a))),l(ve,Ke)};Q(J,ve=>{e(u)==="generic"&&ve(K)})}var ie=p(J,2);{var je=ve=>{var Ke=Mo(),ct=ne(Ke),Gt=S(ct,!0),dr=p(ct,2);Ct(dr,20,()=>e(D),kt=>kt,(kt,cr)=>{var Jt=Ro(),qr=T(Jt);Ce(qr,{variant:"link",size:"compact",class:"h-auto p-0 font-mono text-xs",onclick:()=>Lr(cr),children:(Kr,zo)=>{Ze();var ur=tt();k(()=>g(ur,cr)),l(Kr,ur)},$$slots:{default:!0}}),x(Jt),l(kt,Jt)}),x(dr),k(kt=>g(Gt,kt),[()=>c.layout_fileTab_didYouMean_label()]),l(ve,Ke)};Q(ie,ve=>{e(D).length>0&&ve(je)})}x(v),k(ve=>{g(q,ve),g(Me,o().filePath)},[()=>ko(e(u))]),l(_,v)},$t=_=>{var v=Uo(),j=T(v),q=S(j,!0),z=p(j,2),Me=S(z,!0),J=p(z,2);{var K=ie=>{{let je=n(()=>!e(wt)||e(lt));Ce(ie,{variant:"secondary",size:"sm",onclick:Et,get disabled(){return e(je)},children:(ve,Ke)=>{Ze();var ct=tt();k(Gt=>g(ct,Gt),[()=>c.layout_fileTab_downloadFile_label()]),l(ve,ct)},$$slots:{default:!0}})}};Q(J,ie=>{!e(b)&&e(Qe)&&ie(K)})}x(v),k(ie=>{g(q,ie),g(Me,o().filePath)},[()=>c.editor_fileViewer_binary_label()]),l(_,v)},Xt=_=>{const v=n(()=>o().filePath?.toLowerCase().endsWith(".svg"));var j=Ue(),q=ne(j);{var z=K=>{{let ie=n(()=>o().filePath||""),je=n(()=>!e(b)&&e(wt));Lt(K,{get filePath(){return e(ie)},get fileContent(){return e(Ge)},get language(){return e(Kt)},get isBinary(){return e(L)},onDownload:Et,get allowDownload(){return e(je)},get downloading(){return e(lt)}})}},Me=K=>{var ie=Lo(),je=T(ie);Ba(je,{get content(){return e(Ge)},get workspaceId(){return i()},get relativeMediaBase(){return e(Tr)},renderRichFencesAsCode:!0,renderDiagrams:!0}),x(ie),l(K,ie)},J=K=>{var ie=Mr,je=jr;{let ve=n(()=>me()?e(He):[]);$r(ar(K,{get value(){return ie()},set value(Ke){je(Ke)},get language(){return e(Kt)},get readOnly(){return e(b)},get fileName(){return o().filePath},get workspaceId(){return i()},get filePath(){return o().filePath},get lineWrapping(){return se()},get lineChanges(){return e(ve)},get jumpTo(){return e(Ft)},get externalContentVersion(){return e(xe)},get isPanelFocused(){return Te()}}),Ke=>f($e,Ke,!0),()=>e($e))}};Q(q,K=>{e(v)?K(z):e(Tt)&&e(Je)?K(Me,1):K(J,-1)})}l(_,j)},Hr=_=>{var v=xr(),j=T(v),q=S(j,!0);x(v),k(z=>g(q,z),[()=>c.layout_fileTab_preparing_label()]),l(_,v)};Q(Re,_=>{e(_t)?_(de):e(d)&&e(ft)&&e(Ie)?_(Ae,1):e(d)&&e(vt)?_(qe,2):e(ft)&&e(qt)?_(pt,3):e(ft)?_(xt,4):e(sr)?_(We,5):e(vt)?_(Ye,6):e(St)?_(dt,7):e(m)?_(yt,8):e(a)?_(Pt,9):e(L)?_($t,10):e(Ge)!==null?_(Xt,11):_(Hr,-1)})}l(C,le)}),l(r,s)};Q(Nr,r=>{o().filePath&&r(Br)})}l(G,lr);var Or=Nt(Wr);return be(),Or}export{Vo as default};
|