agent-tower 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/output/__tests__/claude-code-parser-token.test.js +98 -0
- package/dist/output/__tests__/claude-code-parser-token.test.js.map +1 -1
- package/dist/output/claude-code-parser.d.ts.map +1 -1
- package/dist/output/claude-code-parser.js +22 -17
- package/dist/output/claude-code-parser.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-BUf47Q1S.js → AgentDemoPage-CCHa9x-c.js} +1 -1
- package/dist/web/assets/{DemoPage-YJoGCFRc.js → DemoPage-CdT6VXkX.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-nd-W-FdH.js → NotificationSettingsPage-CqZPABEG.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-D2JttFbQ.js → ProfileSettingsPage-CSgX4NOe.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-CBqZr0b3.js → ProjectKanbanPage-Pk7nnDcc.js} +3 -3
- package/dist/web/assets/{ProjectSettingsPage-oVQG2wKD.js → ProjectSettingsPage-COrzQUwG.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-Cohs_N3t.js → ProviderSettingsPage-CzRDghu7.js} +1 -1
- package/dist/web/assets/{api-client-CK7WrmCJ.js → api-client-DUkeyNRB.js} +1 -1
- package/dist/web/assets/{chevron-down-DuVZacYQ.js → chevron-down-jKHLtCQs.js} +1 -1
- package/dist/web/assets/{circle-alert-QR4Sm3dT.js → circle-alert-DggTOwqB.js} +1 -1
- package/dist/web/assets/{circle-check-BNF8hoPa.js → circle-check-38jFi9hD.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-BGPNmTcY.js → code-block-OCS4YCEC-BhBg2bzT.js} +1 -1
- package/dist/web/assets/{confirm-dialog-B39HcvMN.js → confirm-dialog-CUtMe44J.js} +1 -1
- package/dist/web/assets/{folder-picker-BbnTFUfi.js → folder-picker-BTgXPrUp.js} +1 -1
- package/dist/web/assets/{index-CodcwCOY.js → index-2lw92znX.js} +2 -2
- package/dist/web/assets/{loader-circle-Cu8puJkL.js → loader-circle-eX5KttSb.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-DJpYVrxf.js → mermaid-NOHMQCX5-CQgpbmIW.js} +19 -19
- package/dist/web/assets/{modal-CJRZJTMz.js → modal-DpSqKQgt.js} +1 -1
- package/dist/web/assets/{pencil-B3yCMa88.js → pencil-BaroHDtz.js} +1 -1
- package/dist/web/assets/{query-keys-WXeaXHkZ.js → query-keys-DpgVNQA1.js} +1 -1
- package/dist/web/assets/{select-6qwMA-o0.js → select-5Ta6iqIf.js} +1 -1
- package/dist/web/assets/{use-profiles-DxFPMF3P.js → use-profiles-BHlH-mYH.js} +1 -1
- package/dist/web/assets/{use-projects-DFCPcnP9.js → use-projects-DC5whFow.js} +1 -1
- package/dist/web/assets/{x-BmW9bXtL.js → x-_SSVUTap.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-
|
|
2
|
-
import{z as Br,A as Do,B as To,a as jo,q as rr,d as Lo,D as Ao,u as Ie,r as R,n as No,c as ge,R as ee,E as Tt,j as a,s as dt,S as Oe,C as ot,i as Qt,g as Zt,G as Ir,H as Mo,y as Po,L as Fr,_ as Wi}from"./index-CodcwCOY.js";import{Q as pr,b as Oo,c as Bo,e as Io,d as Fo,f as Ho,s as Hr,g as zr,w as zo,h as Wo,i as $o,a as Ge,q as he,u as lt}from"./query-keys-WXeaXHkZ.js";import{C as kt,h as mr,b as vr,d as gr,c as _r,i as br,G as Ds,u as $i,a as Ui,Q as Ki,e as qi,T as Xi,P as ms,f as Yi,S as Wr}from"./mermaid-NOHMQCX5-DJpYVrxf.js";import{C as pt,a as Ut}from"./chevron-down-DuVZacYQ.js";import{P as ir,X as Ts}from"./x-BmW9bXtL.js";import{u as js,T as Vi,g as Uo,S as Me,C as Gi,h as nt,A as as}from"./confirm-dialog-B39HcvMN.js";import"./log-adapter-50wgehrc.js";import{a as ve,c as Se,B as at,t as $r}from"./api-client-CK7WrmCJ.js";import{F as Ko,a as qo,c as Xo,u as Yo,d as Vo}from"./use-projects-DFCPcnP9.js";import{L as Be}from"./loader-circle-Cu8puJkL.js";import{M as xr,T as Qi}from"./modal-CJRZJTMz.js";import{S as ls}from"./select-6qwMA-o0.js";var Go=class extends pr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Br()})}getOptimisticResult(e){return e.behavior=Br(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,l=super.createResult(e,t),{isFetching:m,isRefetching:b,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:To(t,s.data),hasPreviousPage:Do(t,s.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:b&&!d&&!p}}};function Ur(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function Qo(e,t,s){const l=e.slice(0);return l[t]=s,l}var Zo=class extends jo{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,t,s){super(),this.#r=e,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,rr.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=l.map(d=>d.observer),b=m.map(d=>d.getCurrentResult()),C=s.length!==m.length,r=m.some((d,o)=>d!==s[o]),i=C||r,c=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!Lo(d,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Ur(s,m).forEach(d=>{d.destroy()}),Ur(m,s).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const s=this.#d(e),l=s.map(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[l,b=>this.#u(b??l,t,m),()=>this.#h(l,s)]}#h(e,t){return t.map((s,l)=>{const m=e[l];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((b,C)=>b!==l[C]));return(!this.#s||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=Ao(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const m=l.options.queryHash;if(!m)return;const b=t.get(m);b?b.push(l):t.set(m,[l])});const s=[];return e.forEach(l=>{const m=this.#r.defaultQueryOptions(l),C=t.get(m.queryHash)?.shift()??new pr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=Qo(this.#e,s,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&rr.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Jo({queries:e,...t},s){const l=Ie(),m=Oo(),b=Bo(),C=R.useMemo(()=>e.map(_=>{const n=l.defaultQueryOptions(_);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(_=>{Io(_);const n=l.getQueryCache().get(_.queryHash);Fo(_,b,n)}),Ho(b);const[r]=R.useState(()=>new Zo(l,C,t)),[i,c,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(_=>o?r.subscribe(rr.batchCalls(_)):No,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const g=i.some((_,n)=>Hr(C[n],_))?i.flatMap((_,n)=>{const f=C[n];if(f){const h=new pr(l,f);if(Hr(f,_))return zr(f,h,b);zo(_,m)&&zr(f,h,b)}return[]}):[];if(g.length>0)throw Promise.all(g);const S=i.find((_,n)=>{const f=C[n];return f&&Wo({result:_,errorResetBoundary:b,throwOnError:f.throwOnError,query:l.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S?.error)throw S.error;return c(d())}function Zi(e,t){return $o(e,Go)}const ea=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ji=ge("arrow-down",ea);const ta=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],en=ge("arrow-right",ta);const sa=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],tn=ge("arrow-up",sa);const ra=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Kr=ge("circle-check-big",ra);const ia=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ls=ge("code-xml",ia);const na=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qr=ge("copy",na);const oa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],sn=ge("ellipsis-vertical",oa);const aa=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],la=ge("file-braces-corner",aa);const ca=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Kt=ge("file-code-corner",ca);const ha=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ua=ge("file-exclamation-point",ha);const da=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],rn=ge("file-text",da);const fa=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],nn=ge("folder-open",fa);const pa=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ma=ge("gauge",pa);const va=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],ga=ge("git-branch",va);const _a=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],ba=ge("git-fork",_a);const xa=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],qt=ge("git-graph",xa);const Sa=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],on=ge("git-merge",Sa);const ya=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Mt=ge("history",ya);const Ca=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Sr=ge("image",Ca);const wa=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Xr=ge("layers",wa);const Ea=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ka=ge("maximize",Ea);const Ra=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Da=ge("message-square",Ra);const Ta=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],ja=ge("panel-left-close",Ta);const La=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Aa=ge("panel-left-open",La);const Na=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ma=ge("panel-right-close",Na);const Pa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Oa=ge("panel-right-open",Pa);const Ba=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],At=ge("play",Ba);const Ia=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fa=ge("refresh-cw",Ia);const Ha=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],za=ge("shield",Ha);const Wa=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],vs=ge("terminal",Wa);const $a=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ua=ge("zap",$a);const Ka=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],qa=ge("zoom-in",Ka);const Xa=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Ya=ge("zoom-out",Xa),As=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Pt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function yr(e){return"nodeType"in e}function Ve(e){var t,s;return e?Pt(e)?e:yr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function Cr(e){const{Document:t}=Ve(e);return e instanceof t}function Jt(e){return Pt(e)?!1:e instanceof Ve(e).HTMLElement}function an(e){return e instanceof Ve(e).SVGElement}function Ot(e){return e?Pt(e)?e.document:yr(e)?Cr(e)?e:Jt(e)||an(e)?e.ownerDocument:document:document:document}const ft=As?R.useLayoutEffect:R.useEffect;function Ns(e){const t=R.useRef(e);return ft(()=>{t.current=e}),R.useCallback(function(){for(var s=arguments.length,l=new Array(s),m=0;m<s;m++)l[m]=arguments[m];return t.current==null?void 0:t.current(...l)},[])}function Va(){const e=R.useRef(null),t=R.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Xt(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return ft(()=>{s.current!==e&&(s.current=e)},t),s}function es(e,t){const s=R.useRef();return R.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function gs(e){const t=Ns(e),s=R.useRef(null),l=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function _s(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Ws={};function Ms(e,t){return R.useMemo(()=>{if(t)return t;const s=Ws[e]==null?0:Ws[e]+1;return Ws[e]=s,e+"-"+s},[e,t])}function ln(e){return function(t){for(var s=arguments.length,l=new Array(s>1?s-1:0),m=1;m<s;m++)l[m-1]=arguments[m];return l.reduce((b,C)=>{const r=Object.entries(C);for(const[i,c]of r){const d=b[i];d!=null&&(b[i]=d+e*c)}return b},{...t})}}const Nt=ln(1),bs=ln(-1);function Ga(e){return"clientX"in e&&"clientY"in e}function wr(e){if(!e)return!1;const{KeyboardEvent:t}=Ve(e.target);return t&&e instanceof t}function Qa(e){if(!e)return!1;const{TouchEvent:t}=Ve(e.target);return t&&e instanceof t}function xs(e){if(Qa(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return Ga(e)?{x:e.clientX,y:e.clientY}:null}const Yt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[Yt.Translate.toString(e),Yt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),Yr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Za(e){return e.matches(Yr)?e:e.querySelector(Yr)}const Ja={display:"none"};function el(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Ja},s)}function tl(e){let{id:t,announcement:s,ariaLiveType:l="assertive"}=e;const m={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ee.createElement("div",{id:t,style:m,role:"status","aria-live":l,"aria-atomic":!0},s)}function sl(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const cn=R.createContext(null);function rl(e){const t=R.useContext(cn);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function il(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:m,event:b}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const nl={draggable:`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/modal-DpSqKQgt.js","assets/index-2lw92znX.js","assets/index-Br9066ZX.css","assets/api-client-DUkeyNRB.js","assets/x-_SSVUTap.js","assets/folder-picker-BTgXPrUp.js","assets/mermaid-NOHMQCX5-CQgpbmIW.js","assets/log-adapter-50wgehrc.js","assets/chevron-down-jKHLtCQs.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/loader-circle-eX5KttSb.js","assets/circle-alert-DggTOwqB.js","assets/use-projects-DC5whFow.js","assets/query-keys-DpgVNQA1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{z as Br,A as Do,B as To,a as jo,q as rr,d as Lo,D as Ao,u as Ie,r as R,n as No,c as ge,R as ee,E as Tt,j as a,s as dt,S as Oe,C as ot,i as Qt,g as Zt,G as Ir,H as Mo,y as Po,L as Fr,_ as Wi}from"./index-2lw92znX.js";import{Q as pr,b as Oo,c as Bo,e as Io,d as Fo,f as Ho,s as Hr,g as zr,w as zo,h as Wo,i as $o,a as Ge,q as he,u as lt}from"./query-keys-DpgVNQA1.js";import{C as kt,h as mr,b as vr,d as gr,c as _r,i as br,G as Ds,u as $i,a as Ui,Q as Ki,e as qi,T as Xi,P as ms,f as Yi,S as Wr}from"./mermaid-NOHMQCX5-CQgpbmIW.js";import{C as pt,a as Ut}from"./chevron-down-jKHLtCQs.js";import{P as ir,X as Ts}from"./x-_SSVUTap.js";import{u as js,T as Vi,g as Uo,S as Me,C as Gi,h as nt,A as as}from"./confirm-dialog-CUtMe44J.js";import"./log-adapter-50wgehrc.js";import{a as ve,c as Se,B as at,t as $r}from"./api-client-DUkeyNRB.js";import{F as Ko,a as qo,c as Xo,u as Yo,d as Vo}from"./use-projects-DC5whFow.js";import{L as Be}from"./loader-circle-eX5KttSb.js";import{M as xr,T as Qi}from"./modal-DpSqKQgt.js";import{S as ls}from"./select-5Ta6iqIf.js";var Go=class extends pr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Br()})}getOptimisticResult(e){return e.behavior=Br(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,l=super.createResult(e,t),{isFetching:m,isRefetching:b,isError:C,isRefetchError:r}=l,i=s.fetchMeta?.fetchMore?.direction,c=C&&i==="forward",d=m&&i==="forward",o=C&&i==="backward",p=m&&i==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:To(t,s.data),hasPreviousPage:Do(t,s.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:o,isFetchingPreviousPage:p,isRefetchError:r&&!c&&!o,isRefetching:b&&!d&&!p}}};function Ur(e,t){const s=new Set(t);return e.filter(l=>!s.has(l))}function Qo(e,t,s){const l=e.slice(0);return l[t]=s,l}var Zo=class extends jo{#r;#e;#i;#n;#t;#s;#o;#a;#l;#c=[];constructor(e,t,s){super(),this.#r=e,this.#n=s,this.#i=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#i=e,this.#n=t,rr.batch(()=>{const s=this.#t,l=this.#d(this.#i);l.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const m=l.map(d=>d.observer),b=m.map(d=>d.getCurrentResult()),C=s.length!==m.length,r=m.some((d,o)=>d!==s[o]),i=C||r,c=i?!0:b.some((d,o)=>{const p=this.#e[o];return!p||!Lo(d,p)});!i&&!c||(i&&(this.#c=l,this.#t=m),this.#e=b,this.hasListeners()&&(i&&(Ur(s,m).forEach(d=>{d.destroy()}),Ur(m,s).forEach(d=>{d.subscribe(o=>{this.#f(d,o)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const s=this.#d(e),l=s.map(b=>b.observer.getOptimisticResult(b.defaultedQueryOptions)),m=s.map(b=>b.defaultedQueryOptions.queryHash);return[l,b=>this.#u(b??l,t,m),()=>this.#h(l,s)]}#h(e,t){return t.map((s,l)=>{const m=e[l];return s.defaultedQueryOptions.notifyOnChangeProps?m:s.observer.trackResult(m,b=>{t.forEach(C=>{C.observer.trackProp(b)})})})}#u(e,t,s){if(t){const l=this.#l,m=s!==void 0&&l!==void 0&&(l.length!==s.length||s.some((b,C)=>b!==l[C]));return(!this.#s||this.#e!==this.#a||m||t!==this.#o)&&(this.#o=t,this.#a=this.#e,s!==void 0&&(this.#l=s),this.#s=Ao(this.#s,t(e))),this.#s}return e}#d(e){const t=new Map;this.#t.forEach(l=>{const m=l.options.queryHash;if(!m)return;const b=t.get(m);b?b.push(l):t.set(m,[l])});const s=[];return e.forEach(l=>{const m=this.#r.defaultQueryOptions(l),C=t.get(m.queryHash)?.shift()??new pr(this.#r,m);s.push({defaultedQueryOptions:m,observer:C})}),s}#f(e,t){const s=this.#t.indexOf(e);s!==-1&&(this.#e=Qo(this.#e,s,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#s,t=this.#h(this.#e,this.#c),s=this.#u(t,this.#n?.combine);e!==s&&rr.batch(()=>{this.listeners.forEach(l=>{l(this.#e)})})}}};function Jo({queries:e,...t},s){const l=Ie(),m=Oo(),b=Bo(),C=R.useMemo(()=>e.map(_=>{const n=l.defaultQueryOptions(_);return n._optimisticResults=m?"isRestoring":"optimistic",n}),[e,l,m]);C.forEach(_=>{Io(_);const n=l.getQueryCache().get(_.queryHash);Fo(_,b,n)}),Ho(b);const[r]=R.useState(()=>new Zo(l,C,t)),[i,c,d]=r.getOptimisticResult(C,t.combine),o=!m&&t.subscribed!==!1;R.useSyncExternalStore(R.useCallback(_=>o?r.subscribe(rr.batchCalls(_)):No,[r,o]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),R.useEffect(()=>{r.setQueries(C,t)},[C,t,r]);const g=i.some((_,n)=>Hr(C[n],_))?i.flatMap((_,n)=>{const f=C[n];if(f){const h=new pr(l,f);if(Hr(f,_))return zr(f,h,b);zo(_,m)&&zr(f,h,b)}return[]}):[];if(g.length>0)throw Promise.all(g);const S=i.find((_,n)=>{const f=C[n];return f&&Wo({result:_,errorResetBoundary:b,throwOnError:f.throwOnError,query:l.getQueryCache().get(f.queryHash),suspense:f.suspense})});if(S?.error)throw S.error;return c(d())}function Zi(e,t){return $o(e,Go)}const ea=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ji=ge("arrow-down",ea);const ta=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],en=ge("arrow-right",ta);const sa=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],tn=ge("arrow-up",sa);const ra=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Kr=ge("circle-check-big",ra);const ia=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ls=ge("code-xml",ia);const na=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qr=ge("copy",na);const oa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],sn=ge("ellipsis-vertical",oa);const aa=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],la=ge("file-braces-corner",aa);const ca=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Kt=ge("file-code-corner",ca);const ha=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ua=ge("file-exclamation-point",ha);const da=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],rn=ge("file-text",da);const fa=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],nn=ge("folder-open",fa);const pa=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ma=ge("gauge",pa);const va=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],ga=ge("git-branch",va);const _a=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],ba=ge("git-fork",_a);const xa=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],qt=ge("git-graph",xa);const Sa=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],on=ge("git-merge",Sa);const ya=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Mt=ge("history",ya);const Ca=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Sr=ge("image",Ca);const wa=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Xr=ge("layers",wa);const Ea=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ka=ge("maximize",Ea);const Ra=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Da=ge("message-square",Ra);const Ta=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],ja=ge("panel-left-close",Ta);const La=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Aa=ge("panel-left-open",La);const Na=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ma=ge("panel-right-close",Na);const Pa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Oa=ge("panel-right-open",Pa);const Ba=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],At=ge("play",Ba);const Ia=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fa=ge("refresh-cw",Ia);const Ha=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],za=ge("shield",Ha);const Wa=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],vs=ge("terminal",Wa);const $a=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ua=ge("zap",$a);const Ka=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],qa=ge("zoom-in",Ka);const Xa=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Ya=ge("zoom-out",Xa),As=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Pt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function yr(e){return"nodeType"in e}function Ve(e){var t,s;return e?Pt(e)?e:yr(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function Cr(e){const{Document:t}=Ve(e);return e instanceof t}function Jt(e){return Pt(e)?!1:e instanceof Ve(e).HTMLElement}function an(e){return e instanceof Ve(e).SVGElement}function Ot(e){return e?Pt(e)?e.document:yr(e)?Cr(e)?e:Jt(e)||an(e)?e.ownerDocument:document:document:document}const ft=As?R.useLayoutEffect:R.useEffect;function Ns(e){const t=R.useRef(e);return ft(()=>{t.current=e}),R.useCallback(function(){for(var s=arguments.length,l=new Array(s),m=0;m<s;m++)l[m]=arguments[m];return t.current==null?void 0:t.current(...l)},[])}function Va(){const e=R.useRef(null),t=R.useCallback((l,m)=>{e.current=setInterval(l,m)},[]),s=R.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Xt(e,t){t===void 0&&(t=[e]);const s=R.useRef(e);return ft(()=>{s.current!==e&&(s.current=e)},t),s}function es(e,t){const s=R.useRef();return R.useMemo(()=>{const l=e(s.current);return s.current=l,l},[...t])}function gs(e){const t=Ns(e),s=R.useRef(null),l=R.useCallback(m=>{m!==s.current&&t?.(m,s.current),s.current=m},[]);return[s,l]}function _s(e){const t=R.useRef();return R.useEffect(()=>{t.current=e},[e]),t.current}let Ws={};function Ms(e,t){return R.useMemo(()=>{if(t)return t;const s=Ws[e]==null?0:Ws[e]+1;return Ws[e]=s,e+"-"+s},[e,t])}function ln(e){return function(t){for(var s=arguments.length,l=new Array(s>1?s-1:0),m=1;m<s;m++)l[m-1]=arguments[m];return l.reduce((b,C)=>{const r=Object.entries(C);for(const[i,c]of r){const d=b[i];d!=null&&(b[i]=d+e*c)}return b},{...t})}}const Nt=ln(1),bs=ln(-1);function Ga(e){return"clientX"in e&&"clientY"in e}function wr(e){if(!e)return!1;const{KeyboardEvent:t}=Ve(e.target);return t&&e instanceof t}function Qa(e){if(!e)return!1;const{TouchEvent:t}=Ve(e.target);return t&&e instanceof t}function xs(e){if(Qa(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return Ga(e)?{x:e.clientX,y:e.clientY}:null}const Yt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[Yt.Translate.toString(e),Yt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:l}=e;return t+" "+s+"ms "+l}}}),Yr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Za(e){return e.matches(Yr)?e:e.querySelector(Yr)}const Ja={display:"none"};function el(e){let{id:t,value:s}=e;return ee.createElement("div",{id:t,style:Ja},s)}function tl(e){let{id:t,announcement:s,ariaLiveType:l="assertive"}=e;const m={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ee.createElement("div",{id:t,style:m,role:"status","aria-live":l,"aria-atomic":!0},s)}function sl(){const[e,t]=R.useState("");return{announce:R.useCallback(l=>{l!=null&&t(l)},[]),announcement:e}}const cn=R.createContext(null);function rl(e){const t=R.useContext(cn);R.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function il(){const[e]=R.useState(()=>new Set),t=R.useCallback(l=>(e.add(l),()=>e.delete(l)),[e]);return[R.useCallback(l=>{let{type:m,event:b}=l;e.forEach(C=>{var r;return(r=C[m])==null?void 0:r.call(C,b)})},[e]),t]}const nl={draggable:`
|
|
3
3
|
To pick up a draggable item, press the space bar.
|
|
4
4
|
While dragging, use the arrow keys to move the item.
|
|
5
5
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -78,7 +78,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
78
78
|
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:Se("px-3 whitespace-pre",d,o),children:i},c)})})}function Qf({entry:e,type:t,workingDir:s}){const[l,m]=R.useState(!1),b=Ai[e.status]||Ai.M,C=Vf(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:Se("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:Se("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Yf(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(pt,{size:14}):a.jsx(kt,{size:14})})]}),l&&a.jsx(Gf,{workingDir:s,filePath:e.path,type:t})]})}function Ni({title:e,entries:t,type:s,workingDir:l,defaultOpen:m}){const[b,C]=R.useState(m);return t.length===0?null:a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>C(r=>!r),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[a.jsx("span",{className:"text-neutral-400",children:b?a.jsx(pt,{size:14}):a.jsx(kt,{size:14})}),a.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:e}),a.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:t.length})]}),b&&a.jsx("div",{className:"divide-y divide-neutral-100",children:t.map(r=>a.jsx(Qf,{entry:r,type:s,workingDir:l},`${s}:${r.path}`))})]})}function Zf({workingDir:e}){const{data:t,isLoading:s,isError:l}=Jn(e);if(!e)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."});if(s)return a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(Be,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading changes..."})]});if(l)return a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load changes."});const m=t?.uncommitted||[],b=t?.committed||[];return m.length+b.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(qt,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:"No pending changes"})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx(Ni,{title:"Uncommitted",entries:m,type:"uncommitted",workingDir:e,defaultOpen:!0}),a.jsx(Ni,{title:"Committed",entries:b,type:"committed",workingDir:e,defaultOpen:!1})]})}const tr=50,Mi={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Jf(e){const s=Math.floor(Date.now()/1e3)-e;return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:s<86400?`${Math.floor(s/3600)}h ago`:s<604800?`${Math.floor(s/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function ep(e){const t=e.split("/");return t[t.length-1]||e}function tp(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):""}function sp({workingDir:e,hash:t,filePath:s}){const{data:l,isLoading:m,isError:b}=so(e,t,s);if(m)return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[a.jsx(Be,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading diff..."})]});if(b)return a.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:"Failed to load diff."});const C=l?.diff||"";if(!C.trim())return a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No diff content."});const r=C.split(`
|
|
79
79
|
`);return a.jsx("div",{className:"overflow-x-auto bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:r.map((i,c)=>{let d="",o="text-neutral-400";return i.startsWith("+")&&!i.startsWith("+++")?(d="bg-emerald-950/40",o="text-emerald-400"):i.startsWith("-")&&!i.startsWith("---")?(d="bg-red-950/40",o="text-red-400"):i.startsWith("@@")&&(d="bg-blue-950/30",o="text-blue-400"),a.jsx("div",{className:Se("px-3 whitespace-pre",d,o),children:i},c)})})}function rp({entry:e,workingDir:t,hash:s}){const[l,m]=R.useState(!1),b=Mi[e.status]||Mi.M,C=tp(e.path);return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>m(r=>!r),className:Se("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",l&&"bg-neutral-50"),children:[a.jsx("span",{className:Se("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",b),children:e.status}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:ep(e.path)}),C&&a.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:C})]}),a.jsx("span",{className:"text-neutral-400 shrink-0",children:l?a.jsx(pt,{size:14}):a.jsx(kt,{size:14})})]}),l&&a.jsx(sp,{workingDir:t,hash:s,filePath:e.path})]})}function ip({commit:e,workingDir:t}){const[s,l]=R.useState(!1),{data:m,isLoading:b}=to(t,s?e.hash:null),C=m?.files||[];return a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>l(r=>!r),className:Se("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",s&&"bg-neutral-50"),children:[a.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:a.jsx("div",{className:Se("w-2.5 h-2.5 rounded-full shrink-0",s?"bg-blue-500":"bg-neutral-300")})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:e.shortHash}),a.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:e.message})]}),a.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[a.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:e.author}),a.jsx("span",{className:"text-[11px] text-neutral-400",children:Jf(e.timestamp)})]})]}),a.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:s?a.jsx(pt,{size:14}):a.jsx(kt,{size:14})})]}),s&&a.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[e.body&&a.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:e.body}),b?a.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[a.jsx(Be,{size:14,className:"animate-spin"}),a.jsx("span",{className:"text-xs",children:"Loading files..."})]}):C.length===0?a.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:"No files changed"}):a.jsx("div",{className:"divide-y divide-neutral-100",children:C.map(r=>a.jsx(rp,{entry:r,workingDir:t,hash:e.hash},r.path))})]})]})}function np({workingDir:e}){const{data:t,isLoading:s,isError:l,fetchNextPage:m,hasNextPage:b,isFetchingNextPage:C}=Zi({queryKey:he.git.log(e||""),queryFn:({pageParam:i=0})=>ve.get("/git/log",{params:{workingDir:e||"",limit:String(tr),skip:String(i)}}),initialPageParam:0,getNextPageParam:(i,c)=>i.commits.length<tr?void 0:c.length*tr,enabled:!!e}),r=t?.pages.flatMap(i=>i.commits)||[];return e?s?a.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[a.jsx(Be,{size:16,className:"animate-spin mr-2"}),a.jsx("span",{className:"text-sm",children:"Loading history..."})]}):l?a.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:"Failed to load history."}):r.length===0?a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[a.jsx(Mt,{size:28,className:"mb-3"}),a.jsx("span",{className:"text-sm",children:"No commit history"})]}):a.jsxs("div",{className:"flex-1 overflow-y-auto overscroll-y-contain",children:[a.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(i=>a.jsx(ip,{commit:i,workingDir:e},i.hash))}),b&&a.jsx("button",{type:"button",onClick:()=>m(),disabled:C,className:"w-full py-4 text-sm text-neutral-500 active:text-neutral-700 active:bg-neutral-50 flex items-center justify-center gap-2",children:C?a.jsxs(a.Fragment,{children:[a.jsx(Be,{size:14,className:"animate-spin"})," Loading..."]}):"Load more"})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:"No workspace selected."})}const op="/api";function ap(e){if(!Qt())return e;const t=Zt();if(!t)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(t)}`}const lp=e=>e.includes("://")||e.startsWith("/api/")?e:e.startsWith("/")?ap(`${op}/attachments/by-path?path=${encodeURIComponent(e)}`):e,cp=({src:e,alt:t,...s})=>a.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:a.jsx("img",{src:e,alt:t,...s,className:"max-w-[300px] max-h-[200px] object-contain rounded-lg border border-neutral-200 cursor-pointer active:opacity-90 transition-opacity"})}),hp={img:cp};function up({status:e}){const t={[le.Running]:"bg-blue-500",[le.Review]:"bg-amber-500",[le.Pending]:"bg-neutral-400",[le.Done]:"bg-emerald-500",[le.Cancelled]:"bg-neutral-400"};return a.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t[e]}`})}const dp=[{key:"chat",label:"Chat",icon:Da},{key:"changes",label:"Changes",icon:qt},{key:"history",label:"History",icon:Mt},{key:"workspace",label:"Workspace",icon:nn}];function fp({task:e,onBack:t,onDeleteTask:s,isDeleting:l}){const[m,b]=R.useState("chat"),[C,r]=R.useState(""),[i,c]=R.useState(!1),[d,o]=R.useState(!1),[p,g]=R.useState(!1),S=R.useRef(null),_=R.useRef(null),n=R.useRef(null),{scrollRef:f,contentRef:h,isAtBottom:u,scrollToBottom:v}=kn({resize:"smooth",initial:"instant"}),x=Ie();R.useEffect(()=>{if(!p)return;const G=ae=>{S.current&&!S.current.contains(ae.target)&&g(!1)};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[p]);const{data:w,isLoading:k}=io(e.id),y=R.useMemo(()=>{if(!w)return null;const G=w.filter(se=>se.status==="ACTIVE"&&Array.isArray(se.sessions)).flatMap(se=>se.sessions??[]),ae=se=>{const me=se.createdAt,pe=se.endedAt??se.startedAt??me;if(!pe)return 0;const Ce=Date.parse(pe);return Number.isNaN(Ce)?0:Ce},ce=se=>{const me=G.filter(pe=>se.includes(pe.status));return me.length===0?null:me.sort((pe,Ce)=>ae(Ce)-ae(pe))[0]??null};return ce([Me.RUNNING])??ce([Me.PENDING])??ce([Me.COMPLETED,Me.FAILED,Me.CANCELLED])},[w]),E=y?.id??"",j=y?.status===Me.RUNNING||y?.status===Me.PENDING,{data:A}=js(),[L,N]=R.useState(null);R.useEffect(()=>{N(y?.providerId??null)},[y?.providerId]);const B=R.useMemo(()=>{if(w){for(const G of w)if(G.status==="ACTIVE"&&G.worktreePath)return G.worktreePath;return w[0]?.worktreePath}},[w]),I=R.useMemo(()=>{if(w)return w.find(G=>G.status==="ACTIVE")?.id},[w]),H=R.useMemo(()=>{const G=[];if(w&&w.length>0){const ae=w.some(se=>se.status==="ACTIVE");w.some(se=>se.sessions?.some(me=>me.status===Me.RUNNING||me.status===Me.PENDING))&&G.push("正在运行的 Agent 将被停止"),ae&&(G.push("分支上未合并的变更将丢失"),G.push("关联的工作目录(worktree)将被清理"))}return G},[w]),W=Mr(),D=Nr(),M=ao(),{isConnected:P,isLoadingSnapshot:O,logs:U,entries:X,attach:Y}=$i({sessionId:E,onExit:R.useCallback(()=>{x.invalidateQueries({queryKey:["workspaces"]})},[x])}),{todos:Q}=Ui(X),{files:oe,addFiles:T,removeFile:F,clear:$,buildMarkdownLinks:z,hasFiles:Z,isUploading:q}=Pr(),ne=R.useMemo(()=>{if(!y?.tokenUsage)return;const G=y.tokenUsage;if(typeof G.totalTokens=="number")return G},[y?.tokenUsage]),fe=lo(U,ne);R.useEffect(()=>{E&&P&&Y()},[E,P,Y]),R.useEffect(()=>{v()},[e.id,v]);const ye=R.useRef(!1),Le=R.useCallback(async()=>{if(!C.trim()&&!Z||!E||ye.current||q)return;ye.current=!0;const G=z(),ae=[C.trim(),G].filter(Boolean).join(`
|
|
80
80
|
|
|
81
|
-
`);r(""),$(),_.current&&(_.current.style.height="40px"),W.mutate({id:E,message:ae,providerId:L??void 0},{onSuccess:()=>Y(),onSettled:()=>{ye.current=!1}})},[C,E,W,Y,Z,q,z,$,L]),J=R.useCallback(async()=>{E&&(await M.mutateAsync(E),x.invalidateQueries({queryKey:["workspaces"]}))},[E,M,x]),Fe=R.useCallback(G=>{const ae=G.target.files;ae&&ae.length>0&&T(Array.from(ae)),G.target.value=""},[T]),Ke=R.useCallback(G=>{const ae=G.clipboardData.items,ce=[];for(const se of ae)if(se.kind==="file"){const me=se.getAsFile();me&&ce.push(me)}ce.length>0&&(G.preventDefault(),T(ce))},[T]),Ne=R.useCallback(G=>{r(G.target.value);const ae=G.target;ae.style.height="auto",ae.style.height=`${Math.max(40,Math.min(ae.scrollHeight,140))}px`},[]),qe=R.useCallback(()=>{I&&D.mutate({workspaceId:I})},[I,D]),Re=R.useRef(null);return R.useEffect(()=>{const G=window.visualViewport;if(!G)return;let ae=!1;const ce=()=>{Re.current&&(Re.current.style.height=`${G.height}px`,Re.current.style.top=`${G.offsetTop}px`)},se=()=>ce(),me=()=>{ae||ce()},pe=()=>{ae=!0},Ce=()=>{ae=!1,requestAnimationFrame(ce)};return G.addEventListener("resize",se),G.addEventListener("scroll",me),document.addEventListener("touchstart",pe,{passive:!0}),document.addEventListener("touchend",Ce,{passive:!0}),document.addEventListener("touchcancel",Ce,{passive:!0}),()=>{G.removeEventListener("resize",se),G.removeEventListener("scroll",me),document.removeEventListener("touchstart",pe),document.removeEventListener("touchend",Ce),document.removeEventListener("touchcancel",Ce)}},[]),R.useEffect(()=>{const G=Re.current;if(!G)return;const ae=ce=>{let se=ce.target;for(;se&&se!==G;){if(se.tagName==="TEXTAREA"){if(se.scrollHeight>se.clientHeight)return;se=se.parentElement;continue}const pe=window.getComputedStyle(se).overflowY;if((pe==="auto"||pe==="scroll")&&se.scrollHeight>se.clientHeight)return;se=se.parentElement}ce.preventDefault()};return G.addEventListener("touchmove",ae,{passive:!1}),()=>G.removeEventListener("touchmove",ae)},[]),a.jsxs("div",{ref:Re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[a.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[a.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[a.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:a.jsx(Mo,{size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[a.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(up,{status:e.status}),a.jsx("button",{onClick:qe,disabled:!I,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(Ls,{size:16})}),s&&a.jsxs("div",{className:"relative",ref:S,children:[a.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(sn,{size:16})}),p&&a.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:a.jsxs("button",{onClick:()=>{o(!0),g(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[a.jsx(Qi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:dp.map(({key:G,label:ae,icon:ce})=>a.jsxs("button",{onClick:()=>b(G),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${m===G?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(ce,{size:13}),a.jsx("span",{children:ae})]},G))})]}),m==="chat"&&a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:h,children:[a.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx(Ki,{urlTransform:lp,components:hp,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),k?a.jsx(Pi,{label:"Loading..."}):E?O?a.jsx(Pi,{label:"Loading logs..."}):U.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:j?"Waiting for agent output...":"No logs recorded."}):a.jsx(qi,{logs:U}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:a.jsx(At,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),a.jsxs(at,{onClick:()=>c(!0),children:[a.jsx(At,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&a.jsxs("button",{onClick:()=>v(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[a.jsx(Ji,{size:12}),a.jsx("span",{children:"回到底部"})]})]}),Q.length>0&&a.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:a.jsx(Xi,{todos:Q,compact:!0})}),E&&a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Es,{files:oe,onRemove:F}),a.jsx("textarea",{ref:_,value:C,onChange:Ne,onPaste:Ke,onKeyDown:G=>{G.key==="Enter"&&!G.shiftKey&&!G.repeat&&!G.nativeEvent.isComposing&&G.nativeEvent.keyCode!==229&&(G.preventDefault(),Le())},rows:1,placeholder:j?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),a.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:Fe}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[a.jsx("div",{className:"flex items-center gap-0.5",children:a.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ms,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[y&&A&&a.jsx(ho,{providers:A,currentProviderId:L,agentType:y.agentType,onSelect:N}),a.jsx(Rn,{usage:fe}),j&&!C.trim()&&!Z?a.jsx("button",{onClick:J,disabled:M.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(Yi,{size:12})}):a.jsx("button",{onClick:Le,disabled:!C.trim()&&!Z||q,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||Z)&&!q?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(tn,{size:15})})]})]})]})})]}),m==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Zf,{workingDir:B})}),m==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(np,{workingDir:B})}),m==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(ro,{sessionId:E||void 0,workingDir:B,projectId:e.projectId,className:"h-full",hideChanges:!0})}),a.jsx(co,{isOpen:i,onClose:()=>c(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(Gi,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),H.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:H.map((G,ae)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:G})]},ae))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function Pi({label:e}){return a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:e})]})}var pp=Object.defineProperty,Rs=Object.getOwnPropertySymbols,mo=Object.prototype.hasOwnProperty,vo=Object.prototype.propertyIsEnumerable,Oi=(e,t,s)=>t in e?pp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,dr=(e,t)=>{for(var s in t||(t={}))mo.call(t,s)&&Oi(e,s,t[s]);if(Rs)for(var s of Rs(t))vo.call(t,s)&&Oi(e,s,t[s]);return e},fr=(e,t)=>{var s={};for(var l in e)mo.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&Rs)for(var l of Rs(e))t.indexOf(l)<0&&vo.call(e,l)&&(s[l]=e[l]);return s};var Et;(e=>{const t=class ue{constructor(i,c,d,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<ue.MIN_VERSION||i>ue.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let S=0;S<this.size;S++)p.push(!1);for(let S=0;S<this.size;S++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(d);if(this.drawCodewords(g),o==-1){let S=1e9;for(let _=0;_<8;_++){this.applyMask(_),this.drawFormatBits(_);const n=this.getPenaltyScore();n<S&&(o=_,S=n),this.applyMask(_)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,c){const d=e.QrSegment.makeSegments(i);return ue.encodeSegments(d,c)}static encodeBinary(i,c){const d=e.QrSegment.makeBytes(i);return ue.encodeSegments([d],c)}static encodeSegments(i,c,d=1,o=40,p=-1,g=!0){if(!(ue.MIN_VERSION<=d&&d<=o&&o<=ue.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,_;for(S=d;;S++){const u=ue.getNumDataCodewords(S,c)*8,v=C.getTotalBits(i,S);if(v<=u){_=v;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[ue.Ecc.MEDIUM,ue.Ecc.QUARTILE,ue.Ecc.HIGH])g&&_<=ue.getNumDataCodewords(S,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(S),n);for(const v of u.getData())n.push(v)}m(n.length==_);const f=ue.getNumDataCodewords(S,c)*8;m(n.length<=f),s(0,Math.min(4,f-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<f;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,v)=>h[v>>>3]|=u<<7-(v&7)),new ue(S,c,h,p)}getModule(i,c){return 0<=i&&i<this.size&&0<=c&&c<this.size&&this.modules[c][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),c=i.length;for(let d=0;d<c;d++)for(let o=0;o<c;o++)d==0&&o==0||d==0&&o==c-1||d==c-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(c<<10|d)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let d=0;d<18;d++){const o=l(c,d),p=this.size-11+d%3,g=Math.floor(d/3);this.setFunctionModule(p,g,o),this.setFunctionModule(g,p,o)}}drawFinderPattern(i,c){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),g=i+o,S=c+d;0<=g&&g<this.size&&0<=S&&S<this.size&&this.setFunctionModule(g,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,c,d){this.modules[c][i]=d,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,d=this.errorCorrectionLevel;if(i.length!=ue.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const o=ue.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=ue.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],g=Math.floor(ue.getNumRawDataModules(c)/8),S=o-g%o,_=Math.floor(g/o);let n=[];const f=ue.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let x=i.slice(v,v+_-p+(u<S?0:1));v+=x.length;const w=ue.reedSolomonComputeRemainder(x,f);u<S&&x.push(0),n.push(x.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,x)=>{(u!=_-p||x>=S)&&h.push(v[u])});return m(h.length==g),h}drawCodewords(i){if(i.length!=Math.floor(ue.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const g=d-p,_=(d+1&2)==0?this.size-1-o:o;!this.isFunction[_][g]&&c<i.length*8&&(this.modules[_][g]=l(i[c>>>3],7-(c&7)),c++)}}m(c==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+c)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:o=d*c%2+d*c%3==0;break;case 6:o=(d*c%2+d*c%3)%2==0;break;case 7:o=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&o&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let g=!1,S=0,_=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==g?(S++,S==5?i+=ue.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,_),g||(i+=this.finderPenaltyCountPatterns(_)*ue.PENALTY_N3),g=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(g,S,_)*ue.PENALTY_N3}for(let p=0;p<this.size;p++){let g=!1,S=0,_=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==g?(S++,S==5?i+=ue.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,_),g||(i+=this.finderPenaltyCountPatterns(_)*ue.PENALTY_N3),g=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(g,S,_)*ue.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let g=0;g<this.size-1;g++){const S=this.modules[p][g];S==this.modules[p][g+1]&&S==this.modules[p+1][g]&&S==this.modules[p+1][g+1]&&(i+=ue.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((g,S)=>g+(S?1:0),c);const d=this.size*this.size,o=Math.ceil(Math.abs(c*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*ue.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let d=[6];for(let o=this.size-7;d.length<i;o-=c)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<ue.MIN_VERSION||i>ue.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;c-=(25*d-10)*d-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(ue.getNumRawDataModules(i)/8)-ue.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*ue.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let c=[];for(let o=0;o<i-1;o++)c.push(0);c.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=ue.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=ue.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(i,c){let d=c.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),c.forEach((g,S)=>d[S]^=ue.reedSolomonMultiply(g,p))}return d}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(c>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const d=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(d&&i[0]>=c*4&&i[6]>=c?1:0)+(d&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,d){return i&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,c){c[0]==0&&(i+=this.size),c.pop(),c.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function s(r,i,c){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)c.push(r>>>d&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class Ae{constructor(i,c,d){if(this.mode=i,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let c=[];for(const d of i)s(d,8,c);return new Ae(Ae.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Ae.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);s(parseInt(i.substring(d,d+o),10),o*3+1,c),d+=o}return new Ae(Ae.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Ae.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=i.length;d+=2){let o=Ae.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=Ae.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,c)}return d<i.length&&s(Ae.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,c),new Ae(Ae.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Ae.isNumeric(i)?[Ae.makeNumeric(i)]:Ae.isAlphanumeric(i)?[Ae.makeAlphanumeric(i)]:[Ae.makeBytes(Ae.toUtf8ByteArray(i))]}static makeEci(i){let c=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,c);else if(i<16384)s(2,2,c),s(i,14,c);else if(i<1e6)s(6,3,c),s(i,21,c);else throw new RangeError("ECI assignment value out of range");return new Ae(Ae.Mode.ECI,0,c)}static isNumeric(i){return Ae.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Ae.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let d=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?c.push(i.charCodeAt(d)):(c.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return c}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.ordinal=m,this.formatBits=b}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.modeBits=m,this.numBitsCharCount=b}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(Et||(Et={}));var Lt=Et;var mp={L:Lt.QrCode.Ecc.LOW,M:Lt.QrCode.Ecc.MEDIUM,Q:Lt.QrCode.Ecc.QUARTILE,H:Lt.QrCode.Ecc.HIGH},go=128,_o="L",bo="#FFFFFF",xo="#000000",So=!1,yo=1,vp=4,gp=0,_p=.1;function Co(e,t=0){const s=[];return e.forEach(function(l,m){let b=null;l.forEach(function(C,r){if(!C&&b!==null){s.push(`M${b+t} ${m+t}h${r-b}v1H${b+t}z`),b=null;return}if(r===l.length-1){if(!C)return;b===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${b+t},${m+t} h${r+1-b}v1H${b+t}z`);return}C&&b===null&&(b=r)})}),s.join("")}function wo(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function bp(e,t,s,l){if(l==null)return null;const m=e.length+s*2,b=Math.floor(t*_p),C=m/t,r=(l.width||b)*C,i=(l.height||b)*C,c=l.x==null?e.length/2-r/2:l.x*C,d=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let S=Math.floor(c),_=Math.floor(d),n=Math.ceil(r+c-S),f=Math.ceil(i+d-_);p={x:S,y:_,w:n,h:f}}const g=l.crossOrigin;return{x:c,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:g}}function xp(e,t){return t!=null?Math.max(Math.floor(t),0):e?vp:gp}function Eo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((_,n)=>(_.push(...Lt.QrSegment.makeSegments(n)),_),[]);return Lt.QrCode.encodeSegments(S,mp[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:d,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let g=i.getModules();const S=xp(l,m),_=g.length+S*2,n=bp(g,C,S,b);return{cells:g,margin:S,numCells:_,calculatedImageSettings:n}},[i,C,b,l,m]);return{qrcode:i,margin:d,cells:c,numCells:o,calculatedImageSettings:p}}var Sp=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),yp=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=go,level:C=_o,bgColor:r=bo,fgColor:i=xo,includeMargin:c=So,minVersion:d=yo,boostLevel:o,marginSize:p,imageSettings:g}=l,_=fr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=_,f=fr(_,["style"]),h=g?.src,u=ee.useRef(null),v=ee.useRef(null),x=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,k]=ee.useState(!1),{margin:y,cells:E,numCells:j,calculatedImageSettings:A}=Eo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:g,size:b});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=E;const W=v.current,D=A!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;D&&A.excavation!=null&&(H=wo(E,A.excavation));const M=window.devicePixelRatio||1;B.height=B.width=b*M;const P=b/j*M;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,Sp?I.fill(new Path2D(Co(H,y))):E.forEach(function(O,U){O.forEach(function(X,Y){X&&I.fillRect(Y+y,U+y,1,1)})}),A&&(I.globalAlpha=A.opacity),D&&I.drawImage(W,A.x+y,A.y+y,A.w,A.h)}}),ee.useEffect(()=>{k(!1)},[h]);const L=dr({height:b,width:b},n);let N=null;return h!=null&&(N=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:A?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",dr({style:L,height:b,width:b,ref:x,role:"img"},f)),N)});yp.displayName="QRCodeCanvas";var ko=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=go,level:C=_o,bgColor:r=bo,fgColor:i=xo,includeMargin:c=So,minVersion:d=yo,boostLevel:o,title:p,marginSize:g,imageSettings:S}=l,_=fr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=Eo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:g,imageSettings:S,size:b});let v=f,x=null;S!=null&&u!=null&&(u.excavation!=null&&(v=wo(f,u.excavation)),x=ee.createElement("image",{href:S.src,height:u.h,width:u.w,x:u.x+n,y:u.y+n,preserveAspectRatio:"none",opacity:u.opacity,crossOrigin:u.crossOrigin}));const w=Co(v,n);return ee.createElement("svg",dr({height:b,width:b,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},_),!!p&&ee.createElement("title",null,p),ee.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),x)});ko.displayName="QRCodeSVG";function Cp(){return lt({queryKey:he.tunnel.status,queryFn:()=>ve.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function wp(){const e=Ie();return Ge({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return ve.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Ep(){const e=Ie();return Ge({mutationFn:()=>ve.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Bi(){const{data:e}=Cp(),t=wp(),s=Ep(),[l,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,c]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,g=t.isPending,S=e?.shareableUrl,_=e?.token;R.useEffect(()=>{if(l&&r.current){const v=r.current.getBoundingClientRect();c({top:v.bottom+8,right:window.innerWidth-v.right})}},[l]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{S&&(navigator.clipboard.writeText(S),C("url"),setTimeout(()=>C(null),2e3))},[S]),h=R.useCallback(()=>{_&&(navigator.clipboard.writeText(_),C("token"),setTimeout(()=>C(null),2e3))},[_]),u=R.useCallback(()=>{s.mutate(),m(!1),o(!1)},[s]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:r,onClick:n,disabled:g,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:g?a.jsx(Be,{size:16,className:"animate-spin"}):a.jsx(Ds,{size:16})}),p&&!g&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&&Tt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.right},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),a.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(Ts,{size:14})})]}),_&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[a.jsx(za,{size:12}),a.jsx("span",{children:"Token protected"})]}),S&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(ko,{value:S,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:S??e?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:v=>v.target.select()}),a.jsx("button",{onClick:f,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:b==="url"?a.jsx(Ut,{size:14,className:"text-emerald-500"}):a.jsx(qr,{size:14})})]}),_&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:_}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:b==="token"?a.jsx(Ut,{size:14,className:"text-emerald-500"}):a.jsx(qr,{size:14})})]})]}),a.jsx("button",{onClick:u,disabled:s.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:s.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Ii={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},It=R.lazy(()=>Wi(()=>import("./modal-CJRZJTMz.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),sr=R.lazy(()=>Wi(()=>import("./folder-picker-BbnTFUfi.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13])).then(e=>({default:e.FolderPicker}))),Fi=a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Hi=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),kp=260,Rp=600,zi=400;function Wp(){const[e,t]=R.useState(null),[s,l]=R.useState(null),[m,b]=R.useState(zi),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(""),[p,g]=R.useState(""),[S,_]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,x]=R.useState(""),[w,k]=R.useState("idle"),{files:y,addFiles:E,removeFile:j,clear:A,buildMarkdownLinks:L,isUploading:N}=Pr(),B=R.useRef(null),I=R.useRef(!1),H=R.useRef(0),W=R.useRef(zi),D=R.useRef(null),M=Ie(),{data:P,isLoading:O}=js(),{data:U,isLoading:X}=Yo(),Y=U?.data??[],Q=R.useMemo(()=>Y.map(Pf),[Y]),oe=R.useMemo(()=>Y.map(K=>K.id),[Y]);$f(oe);const{data:T,isLoading:F}=Ff(s??""),$=Jo({queries:s?[]:Y.map(K=>({queryKey:he.tasks.list(K.id),queryFn:()=>ve.get(`/projects/${K.id}/tasks`,{params:{limit:"100"}})}))}),z=!s&&$.some(K=>K.isLoading),Z=R.useMemo(()=>{if(s)return T?.data??[];const K=[];for(const re of $)re.data?.data&&K.push(...re.data.data);return K},[s,T,$]),q=R.useMemo(()=>{const K=new Map;for(const re of Z){const ie=re.createdAt?new Date(re.createdAt).getTime():0,de=K.get(re.projectId)??0;ie>de&&K.set(re.projectId,ie)}return[...Y].sort((re,ie)=>{const de=K.get(re.id)??(re.createdAt?new Date(re.createdAt).getTime():0);return(K.get(ie.id)??(ie.createdAt?new Date(ie.createdAt).getTime():0))-de})},[Y,Z]),ne=R.useMemo(()=>{if(!P)return[];const K=localStorage.getItem("providerUsageCount"),re=K?JSON.parse(K):{};return[...P].sort((ie,de)=>{const _e=ie.availability.type!=="NOT_FOUND",je=de.availability.type!=="NOT_FOUND";if(_e!==je)return _e?-1:1;const We=re[ie.provider.id]??0;return(re[de.provider.id]??0)-We})},[P]),fe=R.useMemo(()=>Z.map(Bf),[Z]),ye=R.useMemo(()=>new Set,[]),Le=R.useMemo(()=>{if(!e)return null;const K=Z.find(ie=>ie.id===e);if(!K)return null;const re=Y.find(ie=>ie.id===K.projectId);if(!re){const ie=K.workspaces?.find(de=>de.status==="ACTIVE")?.branchName??K.workspaces?.[0]?.branchName??"—";return{id:K.id,projectId:K.projectId,projectName:"Unknown",projectColor:"text-neutral-500",title:K.title,status:Or(K.status),branch:ie,mainBranch:"main",description:K.description??""}}return If(K,re)},[e,Z,Y]),J=Vo(),Fe=Hf(h),Ke=Wf(),Ne=zf(),qe=R.useCallback(K=>{Ke.mutate(K,{onSuccess:()=>{e===K&&t(null),M.invalidateQueries({queryKey:he.tasks.all})}})},[Ke,e,M]),Re=R.useCallback((K,re)=>{Ne.mutate({id:K,status:Nf(re)},{onError:()=>{Po.error("状态变更失败,该操作不被允许")}})},[Ne]),G=R.useCallback(K=>{K.preventDefault(),I.current=!0,H.current=K.clientX,W.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const K=ie=>{if(!I.current)return;const de=ie.clientX-H.current,_e=Math.max(kp,Math.min(Rp,W.current+de));b(_e)},re=()=>{I.current&&(I.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",re)}},[]);const ae=R.useCallback(()=>{r(!0)},[]),ce=R.useCallback(()=>{const K=localStorage.getItem("lastSelectedProjectId"),re=localStorage.getItem("lastSelectedProviderId"),ie=K&&q.find(je=>je.id===K)?K:s??q[0]?.id??"";u(ie);const de=ne?.find(je=>je.availability.type!=="NOT_FOUND"),_e=re&&ne?.find(je=>je.provider.id===re&&je.availability.type!=="NOT_FOUND")?re:de?.provider.id??"";x(_e),k("idle"),c(!0)},[s,q,ne]),se=R.useCallback(()=>{r(!1),o(""),g("")},[]),me=R.useCallback(()=>{w==="idle"&&(c(!1),_(""),f(""),u(""),x(""),k("idle"),A())},[w,A]),pe=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await J.mutateAsync({name:d.trim(),repoPath:p.trim()}),se()}catch{}},[d,p,J,se]),Ce=oo(),Te=R.useCallback(async()=>{if(!(!S.trim()||!h))try{const K=L(),re=[n.trim(),K].filter(Boolean).join(`
|
|
81
|
+
`);r(""),$(),_.current&&(_.current.style.height="40px"),W.mutate({id:E,message:ae,providerId:L??void 0},{onSuccess:()=>Y(),onSettled:()=>{ye.current=!1}})},[C,E,W,Y,Z,q,z,$,L]),J=R.useCallback(async()=>{E&&(await M.mutateAsync(E),x.invalidateQueries({queryKey:["workspaces"]}))},[E,M,x]),Fe=R.useCallback(G=>{const ae=G.target.files;ae&&ae.length>0&&T(Array.from(ae)),G.target.value=""},[T]),Ke=R.useCallback(G=>{const ae=G.clipboardData.items,ce=[];for(const se of ae)if(se.kind==="file"){const me=se.getAsFile();me&&ce.push(me)}ce.length>0&&(G.preventDefault(),T(ce))},[T]),Ne=R.useCallback(G=>{r(G.target.value);const ae=G.target;ae.style.height="auto",ae.style.height=`${Math.max(40,Math.min(ae.scrollHeight,140))}px`},[]),qe=R.useCallback(()=>{I&&D.mutate({workspaceId:I})},[I,D]),Re=R.useRef(null);return R.useEffect(()=>{const G=window.visualViewport;if(!G)return;let ae=!1;const ce=()=>{Re.current&&(Re.current.style.height=`${G.height}px`,Re.current.style.top=`${G.offsetTop}px`)},se=()=>ce(),me=()=>{ae||ce()},pe=()=>{ae=!0},Ce=()=>{ae=!1,requestAnimationFrame(ce)};return G.addEventListener("resize",se),G.addEventListener("scroll",me),document.addEventListener("touchstart",pe,{passive:!0}),document.addEventListener("touchend",Ce,{passive:!0}),document.addEventListener("touchcancel",Ce,{passive:!0}),()=>{G.removeEventListener("resize",se),G.removeEventListener("scroll",me),document.removeEventListener("touchstart",pe),document.removeEventListener("touchend",Ce),document.removeEventListener("touchcancel",Ce)}},[]),R.useEffect(()=>{const G=Re.current;if(!G)return;const ae=ce=>{let se=ce.target;for(;se&&se!==G;){if(se.tagName==="TEXTAREA"){if(se.scrollHeight>se.clientHeight)return;se=se.parentElement;continue}const pe=window.getComputedStyle(se).overflowY;if((pe==="auto"||pe==="scroll")&&se.scrollHeight>se.clientHeight)return;se=se.parentElement}ce.preventDefault()};return G.addEventListener("touchmove",ae,{passive:!1}),()=>G.removeEventListener("touchmove",ae)},[]),a.jsxs("div",{ref:Re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[a.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[a.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[a.jsx("button",{onClick:t,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:a.jsx(Mo,{size:18})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h1",{className:"text-[13px] font-bold text-neutral-900 truncate leading-tight",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[a.jsx("span",{className:`font-medium ${e.projectColor}`,children:e.projectName}),a.jsx("span",{className:"text-neutral-300",children:"/"}),a.jsx("span",{className:"font-mono truncate",children:e.branch})]})]}),a.jsx(up,{status:e.status}),a.jsx("button",{onClick:qe,disabled:!I,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:a.jsx(Ls,{size:16})}),s&&a.jsxs("div",{className:"relative",ref:S,children:[a.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:a.jsx(sn,{size:16})}),p&&a.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:a.jsxs("button",{onClick:()=>{o(!0),g(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[a.jsx(Qi,{size:15}),a.jsx("span",{children:"删除任务"})]})})]})]}),a.jsx("div",{className:"flex border-t border-neutral-100",children:dp.map(({key:G,label:ae,icon:ce})=>a.jsxs("button",{onClick:()=>b(G),className:`flex-1 flex items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors ${m===G?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[a.jsx(ce,{size:13}),a.jsx("span",{children:ae})]},G))})]}),m==="chat"&&a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a.jsxs("div",{className:"relative flex-1 min-h-0",children:[a.jsx("div",{ref:f,className:"h-full overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 pt-3 pb-2",children:a.jsxs("div",{ref:h,children:[a.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:e.description?a.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:a.jsx(Ki,{urlTransform:lp,components:hp,children:e.description})}):a.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),k?a.jsx(Pi,{label:"Loading..."}):E?O?a.jsx(Pi,{label:"Loading logs..."}):U.length===0?a.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:j?"Waiting for agent output...":"No logs recorded."}):a.jsx(qi,{logs:U}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:a.jsx(At,{size:20,className:"text-neutral-400 ml-0.5"})}),a.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:"尚未启动 Agent"}),a.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:"选择一个 Agent 来执行此任务"}),a.jsxs(at,{onClick:()=>c(!0),children:[a.jsx(At,{size:16,className:"mr-1.5"}),"启动 Agent"]})]})]})}),!u&&a.jsxs("button",{onClick:()=>v(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[a.jsx(Ji,{size:12}),a.jsx("span",{children:"回到底部"})]})]}),Q.length>0&&a.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:a.jsx(Xi,{todos:Q,compact:!0})}),E&&a.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:a.jsxs("div",{className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[a.jsx(Es,{files:oe,onRemove:F}),a.jsx("textarea",{ref:_,value:C,onChange:Ne,onPaste:Ke,onKeyDown:G=>{G.key==="Enter"&&!G.shiftKey&&!G.repeat&&!G.nativeEvent.isComposing&&G.nativeEvent.keyCode!==229&&(G.preventDefault(),Le())},rows:1,placeholder:j?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),a.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:Fe}),a.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[a.jsx("div",{className:"flex items-center gap-0.5",children:a.jsx("button",{onClick:()=>n.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:a.jsx(ms,{size:15})})}),a.jsxs("div",{className:"flex items-center gap-1",children:[y&&A&&a.jsx(ho,{providers:A,currentProviderId:L,agentType:y.agentType,onSelect:N}),a.jsx(Rn,{usage:fe}),j&&!C.trim()&&!Z?a.jsx("button",{onClick:J,disabled:M.isPending,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:a.jsx(Yi,{size:12})}):a.jsx("button",{onClick:Le,disabled:!C.trim()&&!Z||q,className:`p-1.5 rounded-lg transition-colors ${(C.trim()||Z)&&!q?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:a.jsx(tn,{size:15})})]})]})]})})]}),m==="changes"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(Zf,{workingDir:B})}),m==="history"&&a.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:a.jsx(np,{workingDir:B})}),m==="workspace"&&a.jsx("div",{className:"flex-1 overflow-hidden",children:a.jsx(ro,{sessionId:E||void 0,workingDir:B,projectId:e.projectId,className:"h-full",hideChanges:!0})}),a.jsx(co,{isOpen:i,onClose:()=>c(!1),taskId:e.id,taskTitle:e.title,taskDescription:e.description}),a.jsx(Gi,{isOpen:d,onClose:()=>o(!1),onConfirm:()=>{s?.(e.id),o(!1)},title:"删除任务",description:a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["确认删除任务「",e.title,"」?此操作不可撤销。"]}),H.length>0&&a.jsx("ul",{className:"mt-2 space-y-1",children:H.map((G,ae)=>a.jsxs("li",{className:"flex items-start gap-1.5 text-amber-600",children:[a.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-amber-400"}),a.jsx("span",{children:G})]},ae))})]}),confirmText:"删除",variant:"danger",isLoading:l})]})}function Pi({label:e}){return a.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[a.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a.jsx("span",{className:"text-sm",children:e})]})}var pp=Object.defineProperty,Rs=Object.getOwnPropertySymbols,mo=Object.prototype.hasOwnProperty,vo=Object.prototype.propertyIsEnumerable,Oi=(e,t,s)=>t in e?pp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,dr=(e,t)=>{for(var s in t||(t={}))mo.call(t,s)&&Oi(e,s,t[s]);if(Rs)for(var s of Rs(t))vo.call(t,s)&&Oi(e,s,t[s]);return e},fr=(e,t)=>{var s={};for(var l in e)mo.call(e,l)&&t.indexOf(l)<0&&(s[l]=e[l]);if(e!=null&&Rs)for(var l of Rs(e))t.indexOf(l)<0&&vo.call(e,l)&&(s[l]=e[l]);return s};var Et;(e=>{const t=class ue{constructor(i,c,d,o){if(this.version=i,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],i<ue.MIN_VERSION||i>ue.MAX_VERSION)throw new RangeError("Version value out of range");if(o<-1||o>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let S=0;S<this.size;S++)p.push(!1);for(let S=0;S<this.size;S++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(d);if(this.drawCodewords(g),o==-1){let S=1e9;for(let _=0;_<8;_++){this.applyMask(_),this.drawFormatBits(_);const n=this.getPenaltyScore();n<S&&(o=_,S=n),this.applyMask(_)}}m(0<=o&&o<=7),this.mask=o,this.applyMask(o),this.drawFormatBits(o),this.isFunction=[]}static encodeText(i,c){const d=e.QrSegment.makeSegments(i);return ue.encodeSegments(d,c)}static encodeBinary(i,c){const d=e.QrSegment.makeBytes(i);return ue.encodeSegments([d],c)}static encodeSegments(i,c,d=1,o=40,p=-1,g=!0){if(!(ue.MIN_VERSION<=d&&d<=o&&o<=ue.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let S,_;for(S=d;;S++){const u=ue.getNumDataCodewords(S,c)*8,v=C.getTotalBits(i,S);if(v<=u){_=v;break}if(S>=o)throw new RangeError("Data too long")}for(const u of[ue.Ecc.MEDIUM,ue.Ecc.QUARTILE,ue.Ecc.HIGH])g&&_<=ue.getNumDataCodewords(S,u)*8&&(c=u);let n=[];for(const u of i){s(u.mode.modeBits,4,n),s(u.numChars,u.mode.numCharCountBits(S),n);for(const v of u.getData())n.push(v)}m(n.length==_);const f=ue.getNumDataCodewords(S,c)*8;m(n.length<=f),s(0,Math.min(4,f-n.length),n),s(0,(8-n.length%8)%8,n),m(n.length%8==0);for(let u=236;n.length<f;u^=253)s(u,8,n);let h=[];for(;h.length*8<n.length;)h.push(0);return n.forEach((u,v)=>h[v>>>3]|=u<<7-(v&7)),new ue(S,c,h,p)}getModule(i,c){return 0<=i&&i<this.size&&0<=c&&c<this.size&&this.modules[c][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),c=i.length;for(let d=0;d<c;d++)for(let o=0;o<c;o++)d==0&&o==0||d==0&&o==c-1||d==c-1&&o==0||this.drawAlignmentPattern(i[d],i[o]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const c=this.errorCorrectionLevel.formatBits<<3|i;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const o=(c<<10|d)^21522;m(o>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,l(o,p));this.setFunctionModule(8,7,l(o,6)),this.setFunctionModule(8,8,l(o,7)),this.setFunctionModule(7,8,l(o,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,l(o,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,l(o,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,l(o,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let d=0;d<12;d++)i=i<<1^(i>>>11)*7973;const c=this.version<<12|i;m(c>>>18==0);for(let d=0;d<18;d++){const o=l(c,d),p=this.size-11+d%3,g=Math.floor(d/3);this.setFunctionModule(p,g,o),this.setFunctionModule(g,p,o)}}drawFinderPattern(i,c){for(let d=-4;d<=4;d++)for(let o=-4;o<=4;o++){const p=Math.max(Math.abs(o),Math.abs(d)),g=i+o,S=c+d;0<=g&&g<this.size&&0<=S&&S<this.size&&this.setFunctionModule(g,S,p!=2&&p!=4)}}drawAlignmentPattern(i,c){for(let d=-2;d<=2;d++)for(let o=-2;o<=2;o++)this.setFunctionModule(i+o,c+d,Math.max(Math.abs(o),Math.abs(d))!=1)}setFunctionModule(i,c,d){this.modules[c][i]=d,this.isFunction[c][i]=!0}addEccAndInterleave(i){const c=this.version,d=this.errorCorrectionLevel;if(i.length!=ue.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const o=ue.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=ue.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],g=Math.floor(ue.getNumRawDataModules(c)/8),S=o-g%o,_=Math.floor(g/o);let n=[];const f=ue.reedSolomonComputeDivisor(p);for(let u=0,v=0;u<o;u++){let x=i.slice(v,v+_-p+(u<S?0:1));v+=x.length;const w=ue.reedSolomonComputeRemainder(x,f);u<S&&x.push(0),n.push(x.concat(w))}let h=[];for(let u=0;u<n[0].length;u++)n.forEach((v,x)=>{(u!=_-p||x>=S)&&h.push(v[u])});return m(h.length==g),h}drawCodewords(i){if(i.length!=Math.floor(ue.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let o=0;o<this.size;o++)for(let p=0;p<2;p++){const g=d-p,_=(d+1&2)==0?this.size-1-o:o;!this.isFunction[_][g]&&c<i.length*8&&(this.modules[_][g]=l(i[c>>>3],7-(c&7)),c++)}}m(c==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let d=0;d<this.size;d++){let o;switch(i){case 0:o=(d+c)%2==0;break;case 1:o=c%2==0;break;case 2:o=d%3==0;break;case 3:o=(d+c)%3==0;break;case 4:o=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:o=d*c%2+d*c%3==0;break;case 6:o=(d*c%2+d*c%3)%2==0;break;case 7:o=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&o&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let g=!1,S=0,_=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[p][n]==g?(S++,S==5?i+=ue.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,_),g||(i+=this.finderPenaltyCountPatterns(_)*ue.PENALTY_N3),g=this.modules[p][n],S=1);i+=this.finderPenaltyTerminateAndCount(g,S,_)*ue.PENALTY_N3}for(let p=0;p<this.size;p++){let g=!1,S=0,_=[0,0,0,0,0,0,0];for(let n=0;n<this.size;n++)this.modules[n][p]==g?(S++,S==5?i+=ue.PENALTY_N1:S>5&&i++):(this.finderPenaltyAddHistory(S,_),g||(i+=this.finderPenaltyCountPatterns(_)*ue.PENALTY_N3),g=this.modules[n][p],S=1);i+=this.finderPenaltyTerminateAndCount(g,S,_)*ue.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let g=0;g<this.size-1;g++){const S=this.modules[p][g];S==this.modules[p][g+1]&&S==this.modules[p+1][g]&&S==this.modules[p+1][g+1]&&(i+=ue.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((g,S)=>g+(S?1:0),c);const d=this.size*this.size,o=Math.ceil(Math.abs(c*20-d*10)/d)-1;return m(0<=o&&o<=9),i+=o*ue.PENALTY_N4,m(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let d=[6];for(let o=this.size-7;d.length<i;o-=c)d.splice(1,0,o);return d}}static getNumRawDataModules(i){if(i<ue.MIN_VERSION||i>ue.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*i+128)*i+64;if(i>=2){const d=Math.floor(i/7)+2;c-=(25*d-10)*d-55,i>=7&&(c-=36)}return m(208<=c&&c<=29648),c}static getNumDataCodewords(i,c){return Math.floor(ue.getNumRawDataModules(i)/8)-ue.ECC_CODEWORDS_PER_BLOCK[c.ordinal][i]*ue.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let c=[];for(let o=0;o<i-1;o++)c.push(0);c.push(1);let d=1;for(let o=0;o<i;o++){for(let p=0;p<c.length;p++)c[p]=ue.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=ue.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(i,c){let d=c.map(o=>0);for(const o of i){const p=o^d.shift();d.push(0),c.forEach((g,S)=>d[S]^=ue.reedSolomonMultiply(g,p))}return d}static reedSolomonMultiply(i,c){if(i>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let o=7;o>=0;o--)d=d<<1^(d>>>7)*285,d^=(c>>>o&1)*i;return m(d>>>8==0),d}finderPenaltyCountPatterns(i){const c=i[1];m(c<=this.size*3);const d=c>0&&i[2]==c&&i[3]==c*3&&i[4]==c&&i[5]==c;return(d&&i[0]>=c*4&&i[6]>=c?1:0)+(d&&i[6]>=c*4&&i[0]>=c?1:0)}finderPenaltyTerminateAndCount(i,c,d){return i&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(i,c){c[0]==0&&(i+=this.size),c.pop(),c.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function s(r,i,c){if(i<0||i>31||r>>>i)throw new RangeError("Value out of range");for(let d=i-1;d>=0;d--)c.push(r>>>d&1)}function l(r,i){return(r>>>i&1)!=0}function m(r){if(!r)throw new Error("Assertion error")}const b=class Ae{constructor(i,c,d){if(this.mode=i,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(i){let c=[];for(const d of i)s(d,8,c);return new Ae(Ae.Mode.BYTE,i.length,c)}static makeNumeric(i){if(!Ae.isNumeric(i))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<i.length;){const o=Math.min(i.length-d,3);s(parseInt(i.substring(d,d+o),10),o*3+1,c),d+=o}return new Ae(Ae.Mode.NUMERIC,i.length,c)}static makeAlphanumeric(i){if(!Ae.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=i.length;d+=2){let o=Ae.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d))*45;o+=Ae.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d+1)),s(o,11,c)}return d<i.length&&s(Ae.ALPHANUMERIC_CHARSET.indexOf(i.charAt(d)),6,c),new Ae(Ae.Mode.ALPHANUMERIC,i.length,c)}static makeSegments(i){return i==""?[]:Ae.isNumeric(i)?[Ae.makeNumeric(i)]:Ae.isAlphanumeric(i)?[Ae.makeAlphanumeric(i)]:[Ae.makeBytes(Ae.toUtf8ByteArray(i))]}static makeEci(i){let c=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)s(i,8,c);else if(i<16384)s(2,2,c),s(i,14,c);else if(i<1e6)s(6,3,c),s(i,21,c);else throw new RangeError("ECI assignment value out of range");return new Ae(Ae.Mode.ECI,0,c)}static isNumeric(i){return Ae.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return Ae.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,c){let d=0;for(const o of i){const p=o.mode.numCharCountBits(c);if(o.numChars>=1<<p)return 1/0;d+=4+p+o.bitData.length}return d}static toUtf8ByteArray(i){i=encodeURI(i);let c=[];for(let d=0;d<i.length;d++)i.charAt(d)!="%"?c.push(i.charCodeAt(d)):(c.push(parseInt(i.substring(d+1,d+3),16)),d+=2);return c}};b.NUMERIC_REGEX=/^[0-9]*$/,b.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,b.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=b;e.QrSegment=b})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.ordinal=m,this.formatBits=b}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),t.Ecc=s})(e.QrCode||(e.QrCode={}))})(Et||(Et={}));(e=>{(t=>{const s=class{constructor(m,b){this.modeBits=m,this.numBitsCharCount=b}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),t.Mode=s})(e.QrSegment||(e.QrSegment={}))})(Et||(Et={}));var Lt=Et;var mp={L:Lt.QrCode.Ecc.LOW,M:Lt.QrCode.Ecc.MEDIUM,Q:Lt.QrCode.Ecc.QUARTILE,H:Lt.QrCode.Ecc.HIGH},go=128,_o="L",bo="#FFFFFF",xo="#000000",So=!1,yo=1,vp=4,gp=0,_p=.1;function Co(e,t=0){const s=[];return e.forEach(function(l,m){let b=null;l.forEach(function(C,r){if(!C&&b!==null){s.push(`M${b+t} ${m+t}h${r-b}v1H${b+t}z`),b=null;return}if(r===l.length-1){if(!C)return;b===null?s.push(`M${r+t},${m+t} h1v1H${r+t}z`):s.push(`M${b+t},${m+t} h${r+1-b}v1H${b+t}z`);return}C&&b===null&&(b=r)})}),s.join("")}function wo(e,t){return e.slice().map((s,l)=>l<t.y||l>=t.y+t.h?s:s.map((m,b)=>b<t.x||b>=t.x+t.w?m:!1))}function bp(e,t,s,l){if(l==null)return null;const m=e.length+s*2,b=Math.floor(t*_p),C=m/t,r=(l.width||b)*C,i=(l.height||b)*C,c=l.x==null?e.length/2-r/2:l.x*C,d=l.y==null?e.length/2-i/2:l.y*C,o=l.opacity==null?1:l.opacity;let p=null;if(l.excavate){let S=Math.floor(c),_=Math.floor(d),n=Math.ceil(r+c-S),f=Math.ceil(i+d-_);p={x:S,y:_,w:n,h:f}}const g=l.crossOrigin;return{x:c,y:d,h:i,w:r,excavation:p,opacity:o,crossOrigin:g}}function xp(e,t){return t!=null?Math.max(Math.floor(t),0):e?vp:gp}function Eo({value:e,level:t,minVersion:s,includeMargin:l,marginSize:m,imageSettings:b,size:C,boostLevel:r}){let i=ee.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((_,n)=>(_.push(...Lt.QrSegment.makeSegments(n)),_),[]);return Lt.QrCode.encodeSegments(S,mp[t],s,void 0,void 0,r)},[e,t,s,r]);const{cells:c,margin:d,numCells:o,calculatedImageSettings:p}=ee.useMemo(()=>{let g=i.getModules();const S=xp(l,m),_=g.length+S*2,n=bp(g,C,S,b);return{cells:g,margin:S,numCells:_,calculatedImageSettings:n}},[i,C,b,l,m]);return{qrcode:i,margin:d,cells:c,numCells:o,calculatedImageSettings:p}}var Sp=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),yp=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=go,level:C=_o,bgColor:r=bo,fgColor:i=xo,includeMargin:c=So,minVersion:d=yo,boostLevel:o,marginSize:p,imageSettings:g}=l,_=fr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:n}=_,f=fr(_,["style"]),h=g?.src,u=ee.useRef(null),v=ee.useRef(null),x=ee.useCallback(B=>{u.current=B,typeof s=="function"?s(B):s&&(s.current=B)},[s]),[w,k]=ee.useState(!1),{margin:y,cells:E,numCells:j,calculatedImageSettings:A}=Eo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:p,imageSettings:g,size:b});ee.useEffect(()=>{if(u.current!=null){const B=u.current,I=B.getContext("2d");if(!I)return;let H=E;const W=v.current,D=A!=null&&W!==null&&W.complete&&W.naturalHeight!==0&&W.naturalWidth!==0;D&&A.excavation!=null&&(H=wo(E,A.excavation));const M=window.devicePixelRatio||1;B.height=B.width=b*M;const P=b/j*M;I.scale(P,P),I.fillStyle=r,I.fillRect(0,0,j,j),I.fillStyle=i,Sp?I.fill(new Path2D(Co(H,y))):E.forEach(function(O,U){O.forEach(function(X,Y){X&&I.fillRect(Y+y,U+y,1,1)})}),A&&(I.globalAlpha=A.opacity),D&&I.drawImage(W,A.x+y,A.y+y,A.w,A.h)}}),ee.useEffect(()=>{k(!1)},[h]);const L=dr({height:b,width:b},n);let N=null;return h!=null&&(N=ee.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{k(!0)},ref:v,crossOrigin:A?.crossOrigin})),ee.createElement(ee.Fragment,null,ee.createElement("canvas",dr({style:L,height:b,width:b,ref:x,role:"img"},f)),N)});yp.displayName="QRCodeCanvas";var ko=ee.forwardRef(function(t,s){const l=t,{value:m,size:b=go,level:C=_o,bgColor:r=bo,fgColor:i=xo,includeMargin:c=So,minVersion:d=yo,boostLevel:o,title:p,marginSize:g,imageSettings:S}=l,_=fr(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:n,cells:f,numCells:h,calculatedImageSettings:u}=Eo({value:m,level:C,minVersion:d,boostLevel:o,includeMargin:c,marginSize:g,imageSettings:S,size:b});let v=f,x=null;S!=null&&u!=null&&(u.excavation!=null&&(v=wo(f,u.excavation)),x=ee.createElement("image",{href:S.src,height:u.h,width:u.w,x:u.x+n,y:u.y+n,preserveAspectRatio:"none",opacity:u.opacity,crossOrigin:u.crossOrigin}));const w=Co(v,n);return ee.createElement("svg",dr({height:b,width:b,viewBox:`0 0 ${h} ${h}`,ref:s,role:"img"},_),!!p&&ee.createElement("title",null,p),ee.createElement("path",{fill:r,d:`M0,0 h${h}v${h}H0z`,shapeRendering:"crispEdges"}),ee.createElement("path",{fill:i,d:w,shapeRendering:"crispEdges"}),x)});ko.displayName="QRCodeSVG";function Cp(){return lt({queryKey:he.tunnel.status,queryFn:()=>ve.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?1e4:!1})}function wp(){const e=Ie();return Ge({mutationFn:()=>{const t=parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10);return ve.post("/tunnel/start",{port:t})},onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Ep(){const e=Ie();return Ge({mutationFn:()=>ve.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:he.tunnel.status})}})}function Bi(){const{data:e}=Cp(),t=wp(),s=Ep(),[l,m]=R.useState(!1),[b,C]=R.useState(null),r=R.useRef(null),[i,c]=R.useState({top:0,right:0}),[d,o]=R.useState(!1),p=e?.running??!1,g=t.isPending,S=e?.shareableUrl,_=e?.token;R.useEffect(()=>{if(l&&r.current){const v=r.current.getBoundingClientRect();c({top:v.bottom+8,right:window.innerWidth-v.right})}},[l]);const n=R.useCallback(()=>{p?m(!0):t.mutate(void 0,{onSuccess:()=>m(!0)})},[p,t]),f=R.useCallback(()=>{S&&(navigator.clipboard.writeText(S),C("url"),setTimeout(()=>C(null),2e3))},[S]),h=R.useCallback(()=>{_&&(navigator.clipboard.writeText(_),C("token"),setTimeout(()=>C(null),2e3))},[_]),u=R.useCallback(()=>{s.mutate(),m(!1),o(!1)},[s]);return a.jsxs("div",{className:"relative",children:[a.jsx("button",{ref:r,onClick:n,disabled:g,className:`p-1.5 rounded-md transition-colors ${p?"text-emerald-600 hover:bg-emerald-50":"text-neutral-400 hover:text-neutral-900 hover:bg-neutral-100"}`,title:p?"Tunnel active":"Share via tunnel",children:g?a.jsx(Be,{size:16,className:"animate-spin"}):a.jsx(Ds,{size:16})}),p&&!g&&a.jsx("span",{className:"absolute top-0.5 right-0.5 w-2 h-2 bg-emerald-500 rounded-full"}),l&&p&&Tt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[100]",onClick:()=>m(!1)}),a.jsxs("div",{className:"fixed z-[101] w-80 bg-white rounded-lg shadow-lg border border-neutral-200 p-3",style:{top:i.top,right:i.right},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1.5",children:[a.jsx("span",{className:"w-1.5 h-1.5 bg-emerald-500 rounded-full inline-block"}),"Tunnel Active"]}),a.jsx("button",{onClick:()=>m(!1),className:"p-0.5 text-neutral-400 hover:text-neutral-600 rounded",children:a.jsx(Ts,{size:14})})]}),_&&a.jsxs("div",{className:"flex items-center gap-1.5 mb-2 px-2 py-1 bg-emerald-50 rounded text-xs text-emerald-700",children:[a.jsx(za,{size:12}),a.jsx("span",{children:"Token protected"})]}),S&&a.jsx("div",{className:"flex justify-center py-3",children:a.jsx(ko,{value:S,size:160})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{readOnly:!0,value:S??e?.url??"",className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-700 select-all",onFocus:v=>v.target.select()}),a.jsx("button",{onClick:f,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors",title:"Copy shareable link",children:b==="url"?a.jsx(Ut,{size:14,className:"text-emerald-500"}):a.jsx(qr,{size:14})})]}),_&&a.jsxs("div",{className:"mt-2",children:[a.jsx("button",{onClick:()=>o(!d),className:"text-xs text-neutral-500 hover:text-neutral-700 transition-colors",children:d?"Hide token":"Show token"}),d&&a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("code",{className:"flex-1 px-2 py-1.5 text-xs bg-neutral-50 border border-neutral-200 rounded-md text-neutral-600 break-all",children:_}),a.jsx("button",{onClick:h,className:"p-1.5 text-neutral-500 hover:text-neutral-900 hover:bg-neutral-100 rounded-md transition-colors shrink-0",title:"Copy token",children:b==="token"?a.jsx(Ut,{size:14,className:"text-emerald-500"}):a.jsx(qr,{size:14})})]})]}),a.jsx("button",{onClick:u,disabled:s.isPending,className:"mt-2 w-full px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 rounded-md transition-colors",children:s.isPending?"Stopping...":"Stop Tunnel"})]})]}),document.body)]})}const Ii={idle:"Create & Start","creating-task":"Creating Task...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},It=R.lazy(()=>Wi(()=>import("./modal-DpSqKQgt.js").then(e=>e.m),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.Modal}))),sr=R.lazy(()=>Wi(()=>import("./folder-picker-BTgXPrUp.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,10,11,12,13])).then(e=>({default:e.FolderPicker}))),Fi=a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-neutral-900",children:[a.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),a.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Hi=a.jsx("span",{className:"font-bold text-neutral-900 tracking-tight text-base",children:"Agent Tower"}),kp=260,Rp=600,zi=400;function Wp(){const[e,t]=R.useState(null),[s,l]=R.useState(null),[m,b]=R.useState(zi),[C,r]=R.useState(!1),[i,c]=R.useState(!1),[d,o]=R.useState(""),[p,g]=R.useState(""),[S,_]=R.useState(""),[n,f]=R.useState(""),[h,u]=R.useState(""),[v,x]=R.useState(""),[w,k]=R.useState("idle"),{files:y,addFiles:E,removeFile:j,clear:A,buildMarkdownLinks:L,isUploading:N}=Pr(),B=R.useRef(null),I=R.useRef(!1),H=R.useRef(0),W=R.useRef(zi),D=R.useRef(null),M=Ie(),{data:P,isLoading:O}=js(),{data:U,isLoading:X}=Yo(),Y=U?.data??[],Q=R.useMemo(()=>Y.map(Pf),[Y]),oe=R.useMemo(()=>Y.map(K=>K.id),[Y]);$f(oe);const{data:T,isLoading:F}=Ff(s??""),$=Jo({queries:s?[]:Y.map(K=>({queryKey:he.tasks.list(K.id),queryFn:()=>ve.get(`/projects/${K.id}/tasks`,{params:{limit:"100"}})}))}),z=!s&&$.some(K=>K.isLoading),Z=R.useMemo(()=>{if(s)return T?.data??[];const K=[];for(const re of $)re.data?.data&&K.push(...re.data.data);return K},[s,T,$]),q=R.useMemo(()=>{const K=new Map;for(const re of Z){const ie=re.createdAt?new Date(re.createdAt).getTime():0,de=K.get(re.projectId)??0;ie>de&&K.set(re.projectId,ie)}return[...Y].sort((re,ie)=>{const de=K.get(re.id)??(re.createdAt?new Date(re.createdAt).getTime():0);return(K.get(ie.id)??(ie.createdAt?new Date(ie.createdAt).getTime():0))-de})},[Y,Z]),ne=R.useMemo(()=>{if(!P)return[];const K=localStorage.getItem("providerUsageCount"),re=K?JSON.parse(K):{};return[...P].sort((ie,de)=>{const _e=ie.availability.type!=="NOT_FOUND",je=de.availability.type!=="NOT_FOUND";if(_e!==je)return _e?-1:1;const We=re[ie.provider.id]??0;return(re[de.provider.id]??0)-We})},[P]),fe=R.useMemo(()=>Z.map(Bf),[Z]),ye=R.useMemo(()=>new Set,[]),Le=R.useMemo(()=>{if(!e)return null;const K=Z.find(ie=>ie.id===e);if(!K)return null;const re=Y.find(ie=>ie.id===K.projectId);if(!re){const ie=K.workspaces?.find(de=>de.status==="ACTIVE")?.branchName??K.workspaces?.[0]?.branchName??"—";return{id:K.id,projectId:K.projectId,projectName:"Unknown",projectColor:"text-neutral-500",title:K.title,status:Or(K.status),branch:ie,mainBranch:"main",description:K.description??""}}return If(K,re)},[e,Z,Y]),J=Vo(),Fe=Hf(h),Ke=Wf(),Ne=zf(),qe=R.useCallback(K=>{Ke.mutate(K,{onSuccess:()=>{e===K&&t(null),M.invalidateQueries({queryKey:he.tasks.all})}})},[Ke,e,M]),Re=R.useCallback((K,re)=>{Ne.mutate({id:K,status:Nf(re)},{onError:()=>{Po.error("状态变更失败,该操作不被允许")}})},[Ne]),G=R.useCallback(K=>{K.preventDefault(),I.current=!0,H.current=K.clientX,W.current=m,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[m]);R.useEffect(()=>{const K=ie=>{if(!I.current)return;const de=ie.clientX-H.current,_e=Math.max(kp,Math.min(Rp,W.current+de));b(_e)},re=()=>{I.current&&(I.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",re)}},[]);const ae=R.useCallback(()=>{r(!0)},[]),ce=R.useCallback(()=>{const K=localStorage.getItem("lastSelectedProjectId"),re=localStorage.getItem("lastSelectedProviderId"),ie=K&&q.find(je=>je.id===K)?K:s??q[0]?.id??"";u(ie);const de=ne?.find(je=>je.availability.type!=="NOT_FOUND"),_e=re&&ne?.find(je=>je.provider.id===re&&je.availability.type!=="NOT_FOUND")?re:de?.provider.id??"";x(_e),k("idle"),c(!0)},[s,q,ne]),se=R.useCallback(()=>{r(!1),o(""),g("")},[]),me=R.useCallback(()=>{w==="idle"&&(c(!1),_(""),f(""),u(""),x(""),k("idle"),A())},[w,A]),pe=R.useCallback(async()=>{if(!(!d.trim()||!p.trim()))try{await J.mutateAsync({name:d.trim(),repoPath:p.trim()}),se()}catch{}},[d,p,J,se]),Ce=oo(),Te=R.useCallback(async()=>{if(!(!S.trim()||!h))try{const K=L(),re=[n.trim(),K].filter(Boolean).join(`
|
|
82
82
|
|
|
83
83
|
`);k("creating-task");const ie=await Fe.mutateAsync({title:S.trim(),description:re||void 0});if(localStorage.setItem("lastSelectedProjectId",h),v){localStorage.setItem("lastSelectedProviderId",v);const de=localStorage.getItem("providerUsageCount"),_e=de?JSON.parse(de):{};_e[v]=(_e[v]??0)+1,localStorage.setItem("providerUsageCount",JSON.stringify(_e))}if(v){const de=[S.trim(),re].filter(Boolean).join(`
|
|
84
84
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as P,r as o,j as e}from"./index-
|
|
1
|
+
import{c as P,r as o,j as e}from"./index-2lw92znX.js";import{a as k,F as w,u as z,b as q}from"./use-projects-DC5whFow.js";import{a as R,B as I}from"./api-client-DUkeyNRB.js";import{S as L}from"./select-5Ta6iqIf.js";import{X as C,P as S}from"./x-_SSVUTap.js";import"./query-keys-DpgVNQA1.js";import"./chevron-down-jKHLtCQs.js";const A=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],K=P("folder-plus",A);function M({value:r,onChange:h,repoPath:d,placeholder:m}){const[l,c]=o.useState(""),[u,x]=o.useState([]),[p,s]=o.useState(!1),[a,g]=o.useState(-1),j=o.useRef(null),y=o.useRef(null),i=o.useRef(void 0),f=o.useCallback(async t=>{if(!d||!t){x([]),s(!1);return}try{const n=await R.get("/filesystem/complete",{params:{basePath:d,prefix:t}});x(n.results),s(n.results.length>0),g(-1)}catch{x([]),s(!1)}},[d]);o.useEffect(()=>{if(clearTimeout(i.current),!l){x([]),s(!1);return}return i.current=setTimeout(()=>f(l),200),()=>clearTimeout(i.current)},[l,f]),o.useEffect(()=>{const t=n=>{y.current&&!y.current.contains(n.target)&&j.current&&!j.current.contains(n.target)&&s(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const b=t=>{const n=t.trim();!n||r.includes(n)||(h([...r,n]),c(""),s(!1),j.current?.focus())},E=t=>{h(r.filter((n,v)=>v!==t))},N=t=>{t.type==="directory"?(c(t.path),j.current?.focus()):b(t.path)},D=(t,n)=>{n.stopPropagation(),b(t.path.replace(/\/$/,""))},F=t=>{t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(p&&u.length>0?t.key==="ArrowDown"?(t.preventDefault(),g(n=>Math.min(n+1,u.length-1))):t.key==="ArrowUp"?(t.preventDefault(),g(n=>Math.max(n-1,-1))):t.key==="Enter"?(t.preventDefault(),a>=0?N(u[a]):b(l)):t.key==="Escape"&&s(!1):t.key==="Enter"&&(t.preventDefault(),b(l)))};return e.jsxs("div",{children:[r.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:r.map((t,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[t.includes(".")&&!t.endsWith("/")?e.jsx(k,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(w,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:t}),e.jsx("button",{onClick:()=>E(n),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(C,{size:14})})]},t))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:j,type:"text",value:l,onChange:t=>c(t.target.value),onKeyDown:F,onFocus:()=>{l&&u.length>0&&s(!0)},placeholder:m??"输入文件路径...",className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:()=>b(l),disabled:!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(S,{size:14}),e.jsx("span",{children:"添加"})]})]}),p&&e.jsx("div",{ref:y,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:u.map((t,n)=>e.jsxs("button",{onClick:()=>N(t),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${n===a?"bg-neutral-100":""}`,children:[t.type==="directory"?e.jsx(w,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(k,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:t.path}),t.type==="directory"&&e.jsx("span",{onClick:v=>D(t,v),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:"添加此目录",children:e.jsx(K,{size:14})})]},t.path))})]})]})}function _({value:r,onChange:h}){const[d,m]=o.useState(""),[l,c]=o.useState(""),u=()=>{const s=d.trim(),a=l.trim();!s||!a||(h([...r,{name:s,command:a}]),m(""),c(""))},x=s=>{h(r.filter((a,g)=>g!==s))},p=s=>{s.key==="Enter"&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),u())};return e.jsxs("div",{children:[r.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:r.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:s.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:s.command}),e.jsx("button",{onClick:()=>x(a),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(C,{size:14})})]},a))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:d,onChange:s=>m(s.target.value),onKeyDown:p,placeholder:"名称",className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:l,onChange:s=>c(s.target.value),onKeyDown:p,placeholder:"命令",className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:u,disabled:!d.trim()||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(S,{size:14}),e.jsx("span",{children:"添加"})]})]})]})}function B(r){return r?r.split(",").map(h=>h.trim()).filter(Boolean):[]}function O(r){if(!r)return[];try{return JSON.parse(r)}catch{return[]}}function W(){const{data:r,isLoading:h}=z({limit:100}),d=q(),[m,l]=o.useState(""),[c,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),s=r?.data??[],a=s.find(i=>i.id===m);if(o.useEffect(()=>{!m&&s.length>0&&l(s[0].id)},[s,m]),o.useEffect(()=>{a&&!x&&u({copyFiles:B(a.copyFiles),setupScript:a.setupScript??"",quickCommands:O(a.quickCommands)})},[a,x]),h)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"加载中..."});if(s.length===0)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:"暂无项目,请先创建项目"});const g=s.map(i=>({value:i.id,label:i.name})),j=()=>{m&&d.mutate({id:m,copyFiles:c.copyFiles.length>0?c.copyFiles.join(", "):null,setupScript:c.setupScript.trim()||null,quickCommands:c.quickCommands.length>0?JSON.stringify(c.quickCommands):null},{onSuccess:()=>p(!1)})},y=i=>{l(i),p(!1)};return e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-3xl space-y-8",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"选择项目"}),e.jsx(L,{value:m,onChange:y,options:g,placeholder:"选择项目..."})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"自动复制文件"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"创建 worktree 时自动从主仓库复制的文件或目录。支持 glob 模式。"}),e.jsx(M,{value:c.copyFiles,onChange:i=>{u(f=>({...f,copyFiles:i})),p(!0)},repoPath:a?.repoPath??""}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-2",children:"适用于不在 git 管理中但启动必需的文件,如 .env、node_modules、数据库文件等"})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"Setup 脚本"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"创建 worktree 后自动执行的命令,每行一条,按顺序执行。"}),e.jsx("textarea",{value:c.setupScript,onChange:i=>{u(f=>({...f,setupScript:i.target.value})),p(!0)},placeholder:`pnpm install
|
|
2
2
|
pnpm run setup`,rows:4,className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 resize-none"}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-1",children:"命令在 worktree 目录下执行,单条命令超时 5 分钟,失败不会阻断后续命令"})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:"常用命令"}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:"在终端中可快速执行的命令,不会自动运行。"}),e.jsx(_,{value:c.quickCommands,onChange:i=>{u(f=>({...f,quickCommands:i})),p(!0)}})]}),x&&e.jsx("div",{className:"sticky bottom-6 flex justify-end",children:e.jsx(I,{size:"sm",onClick:j,disabled:d.isPending,children:d.isPending?"保存中...":"保存"})})]})}export{W as ProjectSettingsPage};
|
package/dist/web/assets/{ProviderSettingsPage-Cohs_N3t.js → ProviderSettingsPage-CzRDghu7.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as B,r as N,j as n,y as P}from"./index-
|
|
1
|
+
import{c as B,r as N,j as n,y as P}from"./index-2lw92znX.js";import{u as fe,a as xe,b as pe,c as he,d as ge,e as be,f as ve,C as ye,A as j}from"./confirm-dialog-CUtMe44J.js";import{B as E}from"./api-client-DUkeyNRB.js";import{T as Q,M as G}from"./modal-DpSqKQgt.js";import{S as ee}from"./select-5Ta6iqIf.js";import"./log-adapter-50wgehrc.js";import{P as te}from"./x-_SSVUTap.js";import{P as je}from"./pencil-BaroHDtz.js";import{C as we}from"./circle-check-38jFi9hD.js";import{C as Ne}from"./chevron-down-jKHLtCQs.js";import"./query-keys-DpgVNQA1.js";const Ee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Ce=B("circle-x",Ee);const Pe=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ke=B("download",Pe);const _e=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Oe=B("upload",_e);function Ie(e,t){let s=e.slice(0,t).split(/\r\n|\n|\r/g);return[s.length,s.pop().length+1]}function Te(e,t,s){let a=e.split(/\r\n|\n|\r/g),l="",r=(Math.log10(t+1)|0)+1;for(let i=t-1;i<=t+1;i++){let o=a[i-1];o&&(l+=i.toString().padEnd(r," "),l+=": ",l+=o,l+=`
|
|
2
2
|
`,i===t&&(l+=" ".repeat(r+s+2),l+=`^
|
|
3
3
|
`))}return l}class x extends Error{line;column;codeblock;constructor(t,s){const[a,l]=Ie(s.toml,s.ptr),r=Te(s.toml,a,l);super(`Invalid TOML document: ${t}
|
|
4
4
|
|