@shumai-one/shumai 0.6.2 → 0.6.3
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/bin/chunk-02b5bcmc.js +1 -0
- package/bin/{chunk-m0q2cgfg.js → chunk-09mj32d7.js} +1 -1
- package/bin/{chunk-b7bnp021.js → chunk-09mpcg9x.js} +2 -2
- package/bin/{chunk-257dcd2f.js → chunk-0a298n62.js} +2 -2
- package/bin/{chunk-cz13a82m.js → chunk-0rgbxp24.js} +2 -2
- package/bin/{chunk-mwktrwtx.js → chunk-19zbh4fr.js} +1 -1
- package/bin/{chunk-v05rrxp5.js → chunk-1e1q1hyg.js} +2 -2
- package/bin/{chunk-fatmqnp1.js → chunk-1ja2zw4w.js} +1 -1
- package/bin/chunk-1tar0x8s.js +7 -0
- package/bin/{chunk-1nvd90g2.js → chunk-1y6h4vge.js} +1 -1
- package/bin/{chunk-tekwpkjf.js → chunk-20bamhwa.js} +2 -2
- package/bin/{chunk-8mqbztj8.js → chunk-20w1w9x7.js} +2 -2
- package/bin/{chunk-qwpkcp8d.js → chunk-25npafhz.js} +2 -2
- package/bin/{chunk-km4gn6b6.js → chunk-2qgagdb7.js} +1 -1
- package/bin/chunk-2t6g3pny.js +3 -0
- package/bin/{chunk-ns33grgx.js → chunk-34f64q0q.js} +1 -1
- package/bin/{chunk-1wfg56z3.js → chunk-3hgrw1m0.js} +4 -4
- package/bin/{chunk-p3f5aevs.js → chunk-3s2ga6mt.js} +1 -1
- package/bin/{chunk-hzkjgcre.js → chunk-3vpz5nat.js} +1 -1
- package/bin/{chunk-2jj4j8cn.js → chunk-4p31kxjh.js} +2 -2
- package/bin/{chunk-9t3p4xp6.js → chunk-4vjgdj0h.js} +1 -1
- package/bin/{chunk-96qpjght.js → chunk-50pfmxt1.js} +2 -2
- package/bin/{chunk-2cdxm1cp.js → chunk-5ddg5ezb.js} +9 -9
- package/bin/chunk-5ngftxjb.js +218 -0
- package/bin/{chunk-r1xer8gn.js → chunk-6f3zhq64.js} +3 -3
- package/bin/chunk-6nqqe7w9.js +1 -0
- package/bin/{chunk-h1n7jqnw.js → chunk-6t525bmg.js} +1 -1
- package/bin/{chunk-01052ssf.js → chunk-7546ptwg.js} +11 -11
- package/bin/{chunk-82tps5n1.js → chunk-7jz3cmq6.js} +1 -1
- package/bin/{chunk-v5cn90cf.js → chunk-7kah3zb5.js} +2 -2
- package/bin/{chunk-73yncv54.js → chunk-7mawxsk3.js} +2 -2
- package/bin/chunk-8ww98y1m.js +2 -0
- package/bin/{chunk-55h9ze53.js → chunk-9405hzv2.js} +2 -2
- package/bin/{chunk-cgmebxx6.js → chunk-95b4mwyq.js} +1 -1
- package/bin/chunk-9vxmgvc8.js +2 -0
- package/bin/{chunk-knj2s8mg.js → chunk-9x42vgeq.js} +5 -5
- package/bin/{chunk-7sgrtxbt.js → chunk-a859y4e1.js} +2 -2
- package/bin/{chunk-y241cxff.js → chunk-addssm8d.js} +1 -1
- package/bin/{chunk-f6avg5qe.js → chunk-ajq9sxg0.js} +33 -33
- package/bin/chunk-amp9h878.js +2 -0
- package/bin/{chunk-yk12hydf.js → chunk-atdfqdkj.js} +4 -4
- package/bin/{chunk-5wapd171.js → chunk-atpt99h4.js} +10 -10
- package/bin/chunk-awshe30f.js +1 -0
- package/bin/chunk-b3t7gbhm.js +2 -0
- package/bin/{chunk-e4f56spj.js → chunk-bbxwyhz3.js} +3 -3
- package/bin/{chunk-a411xhmm.js → chunk-bd3v8mp1.js} +4 -4
- package/bin/{chunk-167z646e.js → chunk-brgns7hv.js} +1 -1
- package/bin/{chunk-576nj64j.js → chunk-c02727j9.js} +2 -2
- package/bin/{chunk-8yjsmr7g.js → chunk-c1wvs81k.js} +1 -1
- package/bin/chunk-c8frmqsk.js +2 -0
- package/bin/{chunk-xc54vhfz.js → chunk-cagzye3j.js} +1 -1
- package/bin/{chunk-s9ksftq2.js → chunk-cp96e9pq.js} +1 -1
- package/bin/{chunk-q5vkxee3.js → chunk-d55138xx.js} +2 -2
- package/bin/{chunk-7v7mypc6.js → chunk-ddmf9gqv.js} +2 -2
- package/bin/chunk-djb65frk.js +1 -0
- package/bin/{chunk-q83h0hkx.js → chunk-dkhdn92k.js} +2 -2
- package/bin/chunk-dx9f5wab.js +1 -0
- package/bin/{chunk-f25fe9th.js → chunk-dygj751y.js} +11 -11
- package/bin/{chunk-m9adtgzk.js → chunk-e55sgg8t.js} +1 -1
- package/bin/{chunk-q8w4mbw4.js → chunk-enax4303.js} +2 -2
- package/bin/{chunk-vcrmjtcz.js → chunk-erfkd3z9.js} +2 -2
- package/bin/{chunk-8cjet7pp.js → chunk-esj0kwe5.js} +5 -5
- package/bin/{chunk-atfz7g7e.js → chunk-etrm28sy.js} +1 -1
- package/bin/chunk-ex3174e3.js +2 -0
- package/bin/{chunk-9n1w5dw1.js → chunk-ezjxx44x.js} +3 -3
- package/bin/{chunk-cf5axr8c.js → chunk-f4xnx4n6.js} +1 -1
- package/bin/{chunk-7naa7tpn.js → chunk-f8hgy69t.js} +2 -2
- package/bin/chunk-fakph5jp.js +1 -0
- package/bin/{chunk-kvhf12b4.js → chunk-femnbfkj.js} +1 -1
- package/bin/{chunk-ah8fjb6f.js → chunk-ffjdkdcv.js} +2 -2
- package/bin/{chunk-vkzasgxw.js → chunk-gd016e9p.js} +2 -2
- package/bin/{chunk-ympbfzz4.js → chunk-gyv3yrhj.js} +1 -1
- package/bin/{chunk-jzgbxqdg.js → chunk-h2bphev9.js} +2 -2
- package/bin/chunk-h3atwgx2.js +1 -0
- package/bin/chunk-h7xny3de.js +2 -0
- package/bin/{chunk-m82tkhaa.js → chunk-hg3rkp41.js} +5 -5
- package/bin/{chunk-3z85zxkn.js → chunk-hpzk9k55.js} +1 -1
- package/bin/{chunk-9zsv6d2f.js → chunk-hsyfrzdd.js} +1 -1
- package/bin/chunk-hvyy8vct.js +3 -0
- package/bin/{chunk-b5rhvzv9.js → chunk-j2txsbxz.js} +2 -2
- package/bin/chunk-j6x53e33.js +1 -0
- package/bin/chunk-jacanzp7.js +1 -0
- package/bin/{chunk-g6sdezec.js → chunk-jc7dycy6.js} +1 -1
- package/bin/{chunk-cwat1jwx.js → chunk-k7vbk8v4.js} +1 -1
- package/bin/{chunk-zrszykjf.js → chunk-mn0kt3p6.js} +1 -1
- package/bin/chunk-mn71dffh.js +4 -0
- package/bin/{chunk-vp3czaeh.js → chunk-npeapp7e.js} +2 -2
- package/bin/{chunk-2nhgdqdg.js → chunk-p2vsdnd1.js} +2 -2
- package/bin/chunk-pdw77q09.js +2 -0
- package/bin/{chunk-zezje74z.js → chunk-pq6kdp83.js} +3 -3
- package/bin/chunk-ptcz4ed3.js +2 -0
- package/bin/{chunk-z1p13dnc.js → chunk-q1fzgqsv.js} +2 -2
- package/bin/chunk-q4ny4hpt.js +2 -0
- package/bin/{chunk-mzsw9var.js → chunk-q5x0yywj.js} +2 -2
- package/bin/{chunk-g22wmpk1.js → chunk-q8xr1a8j.js} +2 -2
- package/bin/chunk-q8ysc5ex.js +1 -0
- package/bin/{chunk-1ktk6764.js → chunk-qm50g4n5.js} +4 -4
- package/bin/{chunk-q2bew2vc.js → chunk-qvp24w0q.js} +2 -2
- package/bin/{chunk-9xhjy897.js → chunk-r6t0j0jx.js} +3 -3
- package/bin/chunk-s1j4v33x.js +2 -0
- package/bin/{chunk-yq32evnn.js → chunk-s6pk2zyg.js} +5 -5
- package/bin/{chunk-hnkcgvcj.js → chunk-s74g9vsk.js} +1 -1
- package/bin/{chunk-gxepkvt2.js → chunk-sz19nn1x.js} +1 -1
- package/bin/{chunk-hpbn0k9n.js → chunk-sz5zawfw.js} +1 -1
- package/bin/chunk-t68y25gf.js +1 -0
- package/bin/{chunk-mcw198kg.js → chunk-te484xtb.js} +8 -8
- package/bin/{chunk-jt0ykktx.js → chunk-tfrevef9.js} +1 -1
- package/bin/chunk-thpw6tcj.js +2 -0
- package/bin/{chunk-02fvcrej.js → chunk-v0yevesp.js} +7 -7
- package/bin/chunk-vj4gamdn.js +2 -0
- package/bin/{chunk-p4s95471.js → chunk-vmwys2ch.js} +1 -1
- package/bin/{chunk-e4yscwen.js → chunk-vnmggrd6.js} +7 -7
- package/bin/{chunk-hpwv4am3.js → chunk-vv0m0m2f.js} +4 -4
- package/bin/{chunk-x03jwaga.js → chunk-w6g84d59.js} +4 -4
- package/bin/{chunk-3ckkwdjx.js → chunk-wgvgtttc.js} +3 -3
- package/bin/chunk-xy9qpn6b.js +1 -0
- package/bin/{chunk-mcj1xpcc.js → chunk-y3haqtr8.js} +2 -2
- package/bin/chunk-y5dv67mg.js +2 -0
- package/bin/{chunk-4mws03es.js → chunk-yb4mzqrd.js} +2 -2
- package/bin/{chunk-x8mjh387.js → chunk-z0de127n.js} +4 -4
- package/bin/chunk-z8t6e0ee.js +1 -0
- package/bin/chunk-zfg4yy3c.js +2 -0
- package/bin/{chunk-hw6czrya.js → chunk-zkvezz89.js} +1 -1
- package/bin/chunk-zrrnvdxq.js +3 -0
- package/bin/{chunk-srxp5jav.js → chunk-zx1c4vm5.js} +30 -30
- package/bin/chunk-zzqse5qc.js +2 -0
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +328 -328
- package/package.json +7 -7
- package/bin/chunk-0bj887zm.js +0 -2
- package/bin/chunk-26qn7fek.js +0 -2
- package/bin/chunk-2ne2b54t.js +0 -2
- package/bin/chunk-2vbeqczj.js +0 -1
- package/bin/chunk-37p6bcx2.js +0 -1
- package/bin/chunk-3knfx6dm.js +0 -1
- package/bin/chunk-54tbfvya.js +0 -2
- package/bin/chunk-56kh5fxc.js +0 -1
- package/bin/chunk-6cnqjngz.js +0 -1
- package/bin/chunk-7g46e1wy.js +0 -3
- package/bin/chunk-84x8p7v5.js +0 -1
- package/bin/chunk-8fyg9dy4.js +0 -2
- package/bin/chunk-8gtfgkrn.js +0 -2
- package/bin/chunk-8xb6yz11.js +0 -2
- package/bin/chunk-91rb0jpb.js +0 -2
- package/bin/chunk-9f1xk1nt.js +0 -1
- package/bin/chunk-9mk9cvbk.js +0 -1
- package/bin/chunk-9nw5w8vh.js +0 -1
- package/bin/chunk-dk42gf7v.js +0 -2
- package/bin/chunk-eb7mzbfm.js +0 -1
- package/bin/chunk-er14d498.js +0 -3
- package/bin/chunk-fvx9k1dc.js +0 -2
- package/bin/chunk-gtf19jc1.js +0 -2
- package/bin/chunk-hfm82066.js +0 -2
- package/bin/chunk-kj6h5j5a.js +0 -4
- package/bin/chunk-ny1kbmxt.js +0 -2
- package/bin/chunk-p3j6ydk1.js +0 -1
- package/bin/chunk-pk406dgy.js +0 -2
- package/bin/chunk-s1e4qy3q.js +0 -14
- package/bin/chunk-swtwaaqe.js +0 -1
- package/bin/chunk-tagdrg7p.js +0 -1
- package/bin/chunk-twtxnzbv.js +0 -2
- package/bin/chunk-v5mcjwxy.js +0 -2
- package/bin/chunk-x342vzdx.js +0 -2
- package/bin/chunk-xvkwbczx.js +0 -3
- package/bin/chunk-zarz3sqn.js +0 -211
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S,M,w,Z,Y,a,g,ie,kl,X,ee,We,Je,R,z,Ar,K,qe,Re,Ge,B,F,$e,He,Qe,De,Ne,Fe,de,Vy,Ky,Ub,Ke,Zw,eE,oE,Jm,Mt,DE,NE,qE,Ix,Xx,eC,bd,FS,ET,_1,w1,Ip,C1,S1,I1,T1,I0,k1,vk,Di,Cd,Jc,JR,Yc,Sd,Id,XR,Td,tM,PM,wO,CO,TO,kO,gg,kd,_t,yt,vt,bt,wt,Et,xt,Ct,Se,xe,ke,ot,Ce,Ot,re,Xt,j,Zy,fe,Ve,Fr}from"./chunk-zarz3sqn.js";import{vu}from"./chunk-8mqbztj8.js";import{fu}from"./chunk-8fyg9dy4.js";import{ll}from"./chunk-vkzasgxw.js";import{zo}from"./chunk-kvhf12b4.js";import{qn}from"./chunk-qwpkcp8d.js";import"./chunk-v5cn90cf.js";var Ie=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],V=z("arrow-down-wide-narrow",Ie);var _e=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],te=z("sliders-vertical",_e);Z();function ae({open:o,onOpenChange:l,mode:c,teamId:f,project:i}){let p=ie(),m=We(),[s,h]=w(""),[I,b]=w(!0),[_,y]=w(void 0),[k,v]=w(void 0),[u,C]=w(!1),x=M(null);S(()=>{if(o)if(c==="edit"&&i)h(i.name||""),y(i.coverImageKey),v(i.coverImage),b(i.enableNotification!==!1);else h(""),y(void 0),v(void 0),b(!0)},[o,c,i]);let P=R.api.teams[":teamId"].projects.$post,{mutate:U}=ee({mutationFn:async(n)=>{let r=await P({param:{teamId:f},json:n});if(!r.ok)throw Error(Ix());return await r.json()},onSuccess:(n)=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1);let r=n;if(r&&typeof r.id==="string")m({to:"/projects/$projectId",params:{projectId:r.id}})}}),A=R.api.projects[":projectId"].$put,{mutate:O}=ee({mutationFn:async(n)=>{let r=await A({param:{projectId:i.id},json:n});if(!r.ok)throw Error(Xx());return await r.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1)}}),Q=R.api.teams[":teamId"].files.$post,{mutate:E}=ee({mutationFn:async({file:n})=>{let r=await Q({param:{teamId:f},form:{file:n}});if(!r.ok)throw Error(bd());return await r.json()},onSuccess:(n)=>{let r=n;if(r&&typeof r.key==="string")y(r.key);C(!1)},onError:()=>{C(!1)}}),d=(n)=>{let r=n.target.files?.[0];if(r){C(!0);let H=URL.createObjectURL(r);v(H),E({file:r})}},N=()=>{x.current?.click()},T=(n)=>{n.stopPropagation(),y(void 0),v(void 0)},D=()=>{if(!s.trim())return;if(c==="create")U({name:s.trim(),coverImageKey:_,enableNotification:I});else if(c==="edit"&&i?.id)O({name:s.trim(),coverImageKey:_,enableNotification:I})};return a(Se,{open:o,onOpenChange:l,children:g(xe,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[g(ke,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[a("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),a("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),a("div",{className:"flex items-center gap-3",children:g("div",{children:[a(Ce,{className:"text-xl font-semibold tracking-tight text-foreground",children:c==="create"?oE():I0()}),a(Ot,{className:"text-xs text-muted-foreground/80 mt-1",children:c==="create"?Zw():FS()})]})})]}),g("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[g("div",{className:"space-y-2",children:[a(fe,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:Ip()}),g("div",{className:"relative",children:[a(re,{id:"name",value:s,onChange:(n)=>h(n.target.value),placeholder:S1(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),s.trim()&&a("div",{className:"absolute inset-y-0 right-3 flex items-center",children:a(qe,{className:"w-4 h-4 text-primary"})})]}),a("p",{className:"text-[11px] text-muted-foreground",children:C1()})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g("div",{className:"flex items-center justify-between",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a(qn,{className:"w-4 h-4 text-primary"}),w1()]}),k&&g("button",{type:"button",onClick:T,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[a(Ge,{className:"w-3.5 h-3.5"}),vk()]})]}),g("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:N,children:[a("input",{type:"file",ref:x,className:"hidden",accept:"image/*",onChange:d}),u&&a("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:g("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[a(K,{className:"w-4 h-4 animate-spin text-primary"}),a("span",{className:"text-xs font-semibold text-foreground",children:kd()})]})}),k?g(Y,{children:[a("img",{src:k,alt:eE(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),g("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[a(zo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),a("span",{className:"text-xs font-semibold",children:gg()})]})]}):g("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[a("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:a(zo,{className:"w-4 h-4 text-muted-foreground"})}),g("div",{children:[a("p",{className:"text-xs font-medium text-foreground",children:TO()}),a("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:kO()})]})]})]})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a(te,{className:"w-4 h-4 text-primary"}),T1()]}),g("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[g("div",{className:"space-y-1 pr-4",children:[g("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[a(ll,{className:"w-4 h-4 text-primary"}),Vy()]}),a("p",{className:"text-xs text-muted-foreground leading-normal",children:Ky()})]}),a(Ve,{checked:I,onCheckedChange:b,disabled:u,className:"mt-0.5"})]})]})]}),g(ot,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[a(F,{type:"button",variant:"ghost",onClick:()=>l(!1),disabled:u,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:Ke()}),a(F,{type:"submit",onClick:D,disabled:!s.trim()||u,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:u?g(Y,{children:[a(K,{className:"w-4 h-4 animate-spin"}),_1()]}):c==="create"?Jm():Di()})]})]})})}function se({sortBy:o,sortDirection:l,onSortChange:c}){let f=(s)=>{c(s,l)},i=()=>{c(o,l==="asc"?"desc":"asc")},p=(s)=>{switch(s){case"name":return Yc();case"created_at":return JR();case"updated_at":return XR();default:return s}},m=l==="asc";return g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",className:"gap-2 bg-muted/50",children:[a("span",{className:"text-muted-foreground",children:tM()}),a("span",{className:"font-medium text-foreground",children:p(o)})]})}),g(Fe,{align:"end",className:"w-56 p-2",children:[a("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:Jc()}),g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[a("span",{children:p(o)}),a(V,{className:"h-4 w-4 opacity-50"})]})}),a(Fe,{className:"w-52",children:["name","created_at","updated_at"].map((s)=>g(de,{onClick:()=>f(s),className:"justify-between",children:[p(s),o===s&&a(qe,{className:"h-4 w-4"})]},s))})]}),g(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:i,children:[a("span",{className:"text-muted-foreground",children:o==="name"?m?a(Y,{children:Cd()}):a(Y,{children:Td()}):m?a(Y,{children:Id()}):a(Y,{children:Sd()})}),m?a(fu,{className:"h-4 w-4 opacity-50"}):a(V,{className:"h-4 w-4 opacity-50"})]})]})]})}Z();function Me(){let{teamId:o}=Pe.useParams(),{canEdit:l,canAdmin:c}=Xt(),f=We(),i=ie(),[p,m]=w(null),[s,h]=w(!1),[I,b]=w("create"),[_,y]=w(void 0),[k,v]=w(!1),[u,C]=w(void 0),[x,P]=w(""),[U,A]=w(!1),{metadata:O,setMetadata:Q}=Fr(),E=`team:${o}:projects:sort`,d=O[E],[N,T]=w(()=>d?.sortBy||"name"),[D,n]=w(()=>d?.sortDirection||"asc");S(()=>{if(d?.sortBy&&d.sortBy!==N)T(d.sortBy);if(d?.sortDirection&&d.sortDirection!==D)n(d.sortDirection)},[d]);let r=R.api.teams[":teamId"].projects.$get,{data:H}=X({queryKey:["teams",o,"projects",N,D],queryFn:async()=>{let e=await r({param:{teamId:o},query:{sortBy:N,sortDirection:D}});if(!e.ok)throw Error("Failed to fetch projects");return await e.json()},placeholderData:kl}),{data:W}=X({queryKey:["teams",o,"members"],queryFn:async()=>{let e=await R.api.teams[":teamId"].members.$get({param:{teamId:o},query:{}});if(!e.ok)throw Error("Failed to fetch members");return await e.json()}}),{data:G}=X({queryKey:["teams",o,"me"],queryFn:async()=>{let e=await R.api.teams[":teamId"].me.$get({param:{teamId:o}});if(!e.ok)throw Error("Failed to fetch me");return await e.json()}}),ne=R.api.teams[":teamId"].invite.$post,le=ee({mutationFn:async(e)=>{let t=await ne(e);if(!t.ok)throw Error("Failed to invite");return await t.json()}}),q=ee({mutationFn:async(e)=>{if(!(await R.api.projects[":projectId"].$delete({param:{projectId:e}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]})}}),ce=ee({mutationFn:async(e)=>{let t=await R.api.projects[":projectId"].$put({param:{projectId:e.id},json:{enableNotification:!e.enableNotification}});if(!t.ok)throw Error("Failed to update project notification settings");return await t.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]}),j.success(I1())},onError:(e)=>{j.error(e instanceof Error?e.message:eC())}}),J=()=>{b("create"),y(void 0),h(!0)},me=()=>{m("create"),setTimeout(()=>{m(null)},100),setTimeout(()=>{J()},200)},pe=(e)=>{b("edit"),y(e),h(!0)},ue=(e)=>{C(e),P(""),v(!0)},ge=async()=>{if(u&&x==="delete")try{await q.mutateAsync(u.id),v(!1)}catch(e){console.error(e)}},ve=(e,t)=>{if(t.detail>1)return;m(e),setTimeout(()=>{m(null)},100),setTimeout(()=>{f({to:"/projects/$projectId",params:{projectId:e}})},200)},he=async(e)=>(await le.mutateAsync({param:{teamId:o},json:{role:e}})).code,ye=ee({mutationFn:async({userId:e,role:t})=>{if(!(await R.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:o,userId:e},json:{role:t}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),be=ee({mutationFn:async(e)=>{if(!(await R.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:o,userId:e}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),we=(e)=>{if(!e)return"??";return e.split(" ").map((t)=>t[0]).slice(0,2).join("").toUpperCase()},je=(e,t)=>{T(e),n(t),Q(o,E,{sortBy:e,sortDirection:t})},L=Array.isArray(W)?W:[];return g("div",{className:"flex-1 overflow-y-auto p-4",children:[g("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[a("h1",{className:"text-2xl font-bold",children:k1()}),g("div",{className:"flex flex-wrap items-center gap-4",children:[g("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>A(!0),"data-testid":"team-members-trigger",children:[L.slice(0,3).map((e)=>g($e,{className:"border-2 border-background w-8 h-8",children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{className:"text-[10px]",children:we(e.name)})]},e.id)),L.length>3&&g("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",L.length-3]})]}),a(se,{sortBy:N,sortDirection:D,onSortChange:je}),l&&g(F,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:J,children:[a(Re,{className:"w-4 h-4"}),Jm()]})]})]}),g("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[H?.data?.map((e)=>a("div",{className:B("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",p===e.id?"scale-95":"scale-100"),onClick:(t)=>ve(e.id,t),children:g("div",{className:"flex flex-col",children:[g("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[e.coverImage?a("img",{src:e.coverImage,alt:e.name,className:"w-full h-full object-cover rounded"}):g("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[a("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),a("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),a("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),a("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),a("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),a("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),a("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),a("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),a("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),a("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),a("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),a("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),a("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),a("p",{className:"absolute left-1 bottom-2 text-white",children:e.name})]}),g("div",{className:"px-2 h-10 flex justify-between items-center",children:[g("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[CO()," ",Zy(e.updatedAt??"")]}),a("div",{onClick:(t)=>t.stopPropagation(),children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a("button",{className:"hover:bg-muted outline-none flex px-1",children:a(Ar,{className:"w-5 h-5 text-muted-foreground"})})}),g(Fe,{align:"end",children:[l&&a(de,{onClick:(t)=>{t.stopPropagation(),pe(e)},children:I0()}),g(de,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(t)=>{t.preventDefault(),ce.mutate(e)},children:[a("span",{children:ET()}),a(Ve,{checked:e.enableNotification??!0,className:"pointer-events-none"})]}),c&&a(de,{className:"text-destructive focus:text-destructive",onClick:()=>ue(e),children:Mt()})]})]})})]})]})},e.id)),l&&a("div",{className:B("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",p==="create"?"scale-95":"scale-100"),onClick:me,children:g("div",{className:"flex flex-col",children:[a("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:a(Re,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),a("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:a("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:Jm()})})]})})]}),a(ae,{open:s,onOpenChange:h,mode:I,teamId:o,project:_}),a(_t,{open:k,onOpenChange:v,children:g(yt,{children:[g(vt,{children:[a(wt,{children:Ub()}),g(Et,{children:[NE({name:u?.name??""}),g("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[a("span",{className:"text-sm font-medium",children:wO()}),a(re,{value:x,onChange:(e)=>P(e.target.value),placeholder:DE(),className:"h-9",autoFocus:!0})]})]})]}),g(bt,{children:[a(Ct,{disabled:q.isPending,children:Ke()}),a(xt,{onClick:(e)=>{e.preventDefault(),ge()},disabled:x!=="delete"||q.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q.isPending?qE():Mt()})]})]})}),a(vu,{open:U,onOpenChange:A,title:PM(),type:"team",members:L,isOwner:G?.role==="owner",onInvite:he,onUpdateRole:async(e,t)=>{await ye.mutateAsync({userId:e,role:t})},onRemoveMember:async(e)=>{await be.mutateAsync(e)},currentUserId:G?.id})]})}var Pe=Je("/teams/$teamId/")({component:Me});export{Pe as Route};
|
|
1
|
+
import{S,M,w,L,W,a,g,ie,Rl,X,ee,We,Je,R,z,_r,K,qe,Re,Ge,B,F,$e,He,Qe,De,Ne,Fe,de,ev,tv,Qb,Ve,$w,iE,uE,Xm,Mt,UE,zE,KE,Px,oC,sC,ma,zS,TT,E1,I1,Tp,R1,M1,O1,P1,R0,D1,Ck,Di,Sd,Yc,rM,Xc,Id,Td,oM,kd,iM,ZM,IO,RO,PO,DO,_g,tu,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,Ot,re,Xt,j,$y,fe,Ke,Lr}from"./chunk-5ngftxjb.js";import{wu}from"./chunk-20w1w9x7.js";import{mu}from"./chunk-y5dv67mg.js";import{cl}from"./chunk-gd016e9p.js";import{zo}from"./chunk-femnbfkj.js";import{$n}from"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";var Ie=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],Z=z("arrow-down-wide-narrow",Ie);var _e=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],te=z("sliders-vertical",_e);L();function ae({open:o,onOpenChange:l,mode:c,teamId:f,project:i}){let p=ie(),m=We(),[s,h]=w(""),[I,b]=w(!0),[_,y]=w(void 0),[k,v]=w(void 0),[u,C]=w(!1),x=M(null);S(()=>{if(o)if(c==="edit"&&i)h(i.name||""),y(i.coverImageKey),v(i.coverImage),b(i.enableNotification!==!1);else h(""),y(void 0),v(void 0),b(!0)},[o,c,i]);let P=R.api.teams[":teamId"].projects.$post,{mutate:O}=ee({mutationFn:async(n)=>{let r=await P({param:{teamId:f},json:n});if(!r.ok)throw Error(Px());return await r.json()},onSuccess:(n)=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1);let r=n;if(r&&typeof r.id==="string")m({to:"/projects/$projectId",params:{projectId:r.id}})}}),A=R.api.projects[":projectId"].$put,{mutate:Q}=ee({mutationFn:async(n)=>{let r=await A({param:{projectId:i.id},json:n});if(!r.ok)throw Error(oC());return await r.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["teams",f,"projects"]}),l(!1)}}),H=R.api.teams[":teamId"].files.$post,{mutate:E}=ee({mutationFn:async({file:n})=>{let r=await H({param:{teamId:f},form:{file:n}});if(!r.ok)throw Error(ma());return await r.json()},onSuccess:(n)=>{let r=n;if(r&&typeof r.key==="string")y(r.key);C(!1)},onError:()=>{C(!1)}}),d=(n)=>{let r=n.target.files?.[0];if(r){C(!0);let V=URL.createObjectURL(r);v(V),E({file:r})}},N=()=>{x.current?.click()},T=(n)=>{n.stopPropagation(),y(void 0),v(void 0)},D=()=>{if(!s.trim())return;if(c==="create")O({name:s.trim(),coverImageKey:_,enableNotification:I});else if(c==="edit"&&i?.id)Q({name:s.trim(),coverImageKey:_,enableNotification:I})};return a(Se,{open:o,onOpenChange:l,children:g(xe,{className:"sm:max-w-[550px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 backdrop-blur-md shadow-2xl p-0 gap-0",children:[g(ke,{className:"relative overflow-hidden bg-gradient-to-br from-primary/5 to-transparent p-6 border-b border-border/40",children:[a("div",{className:"absolute top-0 right-0 w-24 h-24 bg-primary/10 rounded-full blur-2xl pointer-events-none"}),a("div",{className:"absolute bottom-0 left-10 w-32 h-12 bg-primary/5 rounded-full blur-xl pointer-events-none"}),a("div",{className:"flex items-center gap-3",children:g("div",{children:[a(Ce,{className:"text-xl font-semibold tracking-tight text-foreground",children:c==="create"?uE():R0()}),a(Ot,{className:"text-xs text-muted-foreground/80 mt-1",children:c==="create"?$w():zS()})]})})]}),g("div",{className:"space-y-6 p-6 max-h-[75vh] overflow-y-auto",children:[g("div",{className:"space-y-2",children:[a(fe,{htmlFor:"name",className:"text-sm font-semibold tracking-tight text-foreground",children:Tp()}),g("div",{className:"relative",children:[a(re,{id:"name",value:s,onChange:(n)=>h(n.target.value),placeholder:M1(),className:"h-11 px-4 rounded-xl border-border/80 focus-visible:ring-ring/25 focus-visible:border-primary transition-all shadow-xs pr-10"}),s.trim()&&a("div",{className:"absolute inset-y-0 right-3 flex items-center",children:a(qe,{className:"w-4 h-4 text-primary"})})]}),a("p",{className:"text-[11px] text-muted-foreground",children:R1()})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g("div",{className:"flex items-center justify-between",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a($n,{className:"w-4 h-4 text-primary"}),I1()]}),k&&g("button",{type:"button",onClick:T,className:"text-xs text-muted-foreground hover:text-destructive hover:bg-destructive/5 px-2.5 py-1 rounded-lg transition-all flex items-center gap-1 font-medium",children:[a(Ge,{className:"w-3.5 h-3.5"}),Ck()]})]}),g("div",{className:"relative aspect-square w-48 mx-auto rounded-2xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 transition-all duration-300 hover:border-primary/50 hover:bg-muted/40",onClick:N,children:[a("input",{type:"file",ref:x,className:"hidden",accept:"image/*",onChange:d}),u&&a("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:g("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[a(K,{className:"w-4 h-4 animate-spin text-primary"}),a("span",{className:"text-xs font-semibold text-foreground",children:tu()})]})}),k?g(W,{children:[a("img",{src:k,alt:iE(),className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),g("div",{className:"absolute inset-0 bg-black/45 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center gap-1.5 text-white z-10",children:[a(zo,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),a("span",{className:"text-xs font-semibold",children:_g()})]})]}):g("div",{className:"flex flex-col items-center gap-2 text-center p-4",children:[a("div",{className:"p-2.5 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:a(zo,{className:"w-4 h-4 text-muted-foreground"})}),g("div",{children:[a("p",{className:"text-xs font-medium text-foreground",children:PO()}),a("p",{className:"text-[11px] text-muted-foreground mt-0.5 max-w-[140px] mx-auto leading-normal",children:DO()})]})]})]})]}),g("div",{className:"space-y-3 border-t border-border/40 pt-5",children:[g(fe,{className:"text-sm font-semibold tracking-tight text-foreground flex items-center gap-1.5",children:[a(te,{className:"w-4 h-4 text-primary"}),P1()]}),g("div",{className:"flex items-start justify-between rounded-xl border border-border/50 bg-muted/10 p-4 transition-all duration-300 hover:bg-muted/20",children:[g("div",{className:"space-y-1 pr-4",children:[g("div",{className:"text-sm font-semibold flex items-center gap-2 text-foreground",children:[a(cl,{className:"w-4 h-4 text-primary"}),ev()]}),a("p",{className:"text-xs text-muted-foreground leading-normal",children:tv()})]}),a(Ke,{checked:I,onCheckedChange:b,disabled:u,className:"mt-0.5"})]})]})]}),g(ot,{className:"flex items-center justify-end gap-3 px-6 py-4 bg-muted/20 border-t border-border/40",children:[a(F,{type:"button",variant:"ghost",onClick:()=>l(!1),disabled:u,className:"rounded-xl h-10 px-4 hover:bg-muted font-medium text-sm text-muted-foreground hover:text-foreground transition-colors",children:Ve()}),a(F,{type:"submit",onClick:D,disabled:!s.trim()||u,className:"rounded-xl h-10 px-5 bg-primary text-primary-foreground hover:bg-primary/90 font-semibold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 active:scale-98 transition-all flex items-center gap-2",children:u?g(W,{children:[a(K,{className:"w-4 h-4 animate-spin"}),E1()]}):c==="create"?Xm():Di()})]})]})})}function se({sortBy:o,sortDirection:l,onSortChange:c}){let f=(s)=>{c(s,l)},i=()=>{c(o,l==="asc"?"desc":"asc")},p=(s)=>{switch(s){case"name":return Xc();case"created_at":return rM();case"updated_at":return oM();default:return s}},m=l==="asc";return g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"outline",className:"gap-2 bg-muted/50",children:[a("span",{className:"text-muted-foreground",children:iM()}),a("span",{className:"font-medium text-foreground",children:p(o)})]})}),g(Fe,{align:"end",className:"w-56 p-2",children:[a("div",{className:"text-xs font-semibold text-muted-foreground mb-2 px-2",children:Yc()}),g(De,{children:[a(Ne,{asChild:!0,children:g(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted mb-2 border",children:[a("span",{children:p(o)}),a(Z,{className:"h-4 w-4 opacity-50"})]})}),a(Fe,{className:"w-52",children:["name","created_at","updated_at"].map((s)=>g(de,{onClick:()=>f(s),className:"justify-between",children:[p(s),o===s&&a(qe,{className:"h-4 w-4"})]},s))})]}),g(F,{variant:"ghost",className:"w-full justify-between font-normal px-2 h-10 bg-muted/50 hover:bg-muted border",onClick:i,children:[a("span",{className:"text-muted-foreground",children:o==="name"?m?a(W,{children:Sd()}):a(W,{children:kd()}):m?a(W,{children:Td()}):a(W,{children:Id()})}),m?a(mu,{className:"h-4 w-4 opacity-50"}):a(Z,{className:"h-4 w-4 opacity-50"})]})]})]})}L();function Me(){let{teamId:o}=Pe.useParams(),{canEdit:l,canAdmin:c}=Xt(),f=We(),i=ie(),[p,m]=w(null),[s,h]=w(!1),[I,b]=w("create"),[_,y]=w(void 0),[k,v]=w(!1),[u,C]=w(void 0),[x,P]=w(""),[O,A]=w(!1),{metadata:Q,setMetadata:H}=Lr(),E=`team:${o}:projects:sort`,d=Q[E],[N,T]=w(()=>d?.sortBy||"name"),[D,n]=w(()=>d?.sortDirection||"asc");S(()=>{if(d?.sortBy&&d.sortBy!==N)T(d.sortBy);if(d?.sortDirection&&d.sortDirection!==D)n(d.sortDirection)},[d]);let r=R.api.teams[":teamId"].projects.$get,{data:V}=X({queryKey:["teams",o,"projects",N,D],queryFn:async()=>{let e=await r({param:{teamId:o},query:{sortBy:N,sortDirection:D}});if(!e.ok)throw Error("Failed to fetch projects");return await e.json()},placeholderData:Rl}),{data:Y}=X({queryKey:["teams",o,"members"],queryFn:async()=>{let e=await R.api.teams[":teamId"].members.$get({param:{teamId:o},query:{}});if(!e.ok)throw Error("Failed to fetch members");return await e.json()}}),{data:G}=X({queryKey:["teams",o,"me"],queryFn:async()=>{let e=await R.api.teams[":teamId"].me.$get({param:{teamId:o}});if(!e.ok)throw Error("Failed to fetch me");return await e.json()}}),ne=R.api.teams[":teamId"].invite.$post,le=ee({mutationFn:async(e)=>{let t=await ne(e);if(!t.ok)throw Error("Failed to invite");return await t.json()}}),q=ee({mutationFn:async(e)=>{if(!(await R.api.projects[":projectId"].$delete({param:{projectId:e}})).ok)throw Error("Failed to delete project")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]})}}),ce=ee({mutationFn:async(e)=>{let t=await R.api.projects[":projectId"].$put({param:{projectId:e.id},json:{enableNotification:!e.enableNotification}});if(!t.ok)throw Error("Failed to update project notification settings");return await t.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"projects"]}),j.success(O1())},onError:(e)=>{j.error(e instanceof Error?e.message:sC())}}),J=()=>{b("create"),y(void 0),h(!0)},me=()=>{m("create"),setTimeout(()=>{m(null)},100),setTimeout(()=>{J()},200)},pe=(e)=>{b("edit"),y(e),h(!0)},ue=(e)=>{C(e),P(""),v(!0)},ge=async()=>{if(u&&x==="delete")try{await q.mutateAsync(u.id),v(!1)}catch(e){console.error(e)}},ve=(e,t)=>{if(t.detail>1)return;m(e),setTimeout(()=>{m(null)},100),setTimeout(()=>{f({to:"/projects/$projectId",params:{projectId:e}})},200)},he=async(e)=>(await le.mutateAsync({param:{teamId:o},json:{role:e}})).code,ye=ee({mutationFn:async({userId:e,role:t})=>{if(!(await R.api.teams[":teamId"].members[":userId"].$patch({param:{teamId:o,userId:e},json:{role:t}})).ok)throw Error("Failed to update member role")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),be=ee({mutationFn:async(e)=>{if(!(await R.api.teams[":teamId"].members[":userId"].$delete({param:{teamId:o,userId:e}})).ok)throw Error("Failed to remove member")},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",o,"members"]})}}),we=(e)=>{if(!e)return"??";return e.split(" ").map((t)=>t[0]).slice(0,2).join("").toUpperCase()},je=(e,t)=>{T(e),n(t),H(o,E,{sortBy:e,sortDirection:t})},U=Array.isArray(Y)?Y:[];return g("div",{className:"flex-1 overflow-y-auto p-4",children:[g("div",{className:"flex flex-wrap items-center justify-between mb-4 gap-4",children:[a("h1",{className:"text-2xl font-bold",children:D1()}),g("div",{className:"flex flex-wrap items-center gap-4",children:[g("div",{className:"flex items-center -space-x-2 cursor-pointer hover:opacity-90",onClick:()=>A(!0),"data-testid":"team-members-trigger",children:[U.slice(0,3).map((e)=>g($e,{className:"border-2 border-background w-8 h-8",children:[e.image&&a(He,{src:e.image,alt:e.name,className:"object-cover"}),a(Qe,{className:"text-[10px]",children:we(e.name)})]},e.id)),U.length>3&&g("div",{className:"flex items-center justify-center w-8 h-8 rounded-full border-2 border-background bg-muted text-[10px] font-medium",children:["+",U.length-3]})]}),a(se,{sortBy:N,sortDirection:D,onSortChange:je}),l&&g(F,{className:"bg-orange-600 hover:bg-orange-700 text-white gap-2",onClick:J,children:[a(Re,{className:"w-4 h-4"}),Xm()]})]})]}),g("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4",children:[V?.data?.map((e)=>a("div",{className:B("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out",p===e.id?"scale-95":"scale-100"),onClick:(t)=>ve(e.id,t),children:g("div",{className:"flex flex-col",children:[g("div",{className:"relative w-full h-full aspect-square flex items-center justify-center bg-zinc-400/20",children:[e.coverImage?a("img",{src:e.coverImage,alt:e.name,className:"w-full h-full object-cover rounded"}):g("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180.95 164.7",preserveAspectRatio:"xMidYMid slice",className:"w-full h-full object-cover rounded",children:[a("polygon",{fill:"#FC9F8E",points:"0 18.5 0 76.0 151.69 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FEBAB8",points:"0 0 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0"}),a("polyline",{fill:"#FAA5A5",points:"0 18.5 74.58 61.5 90.53 51.6 110.33 63.9 180.95 18.9 180.95 0 0 0"}),a("polygon",{fill:"#EC5B6C",points:"0 76.0 0 164.7 151.69 164.7"}),a("polygon",{fill:"#E85C71",points:"180.95 18.9 110.33 63.9 117.37 68.0 117.26 73.4 180.95 113.6"}),a("polygon",{fill:"#C8405B",points:"117.26 73.4 117.37 99.0 90.53 114.9 174.35 164.7 180.95 164.7 180.95 113.6"}),a("polygon",{fill:"#FFCCBE",points:"90.53 51.6 63.69 68.1 90.53 83.4"}),a("path",{fill:"#FB9991",d:"M 90.53 51.6 L 90.53 61.3 L 100.87 67.4 L 90.53 73.5 L 90.53 83.4 L 117.37 68.0 C 117.15 67.6 90.53 51.6 90.53 51.6 Z"}),a("path",{fill:"#FFEACD",d:"M 63.69 68.1 C 63.47 68.5 64.02 99.3 64.02 99.3 C 64.02 99.3 64.46 99.6 64.9 99.9 L 90.53 83.4 L 63.69 68.1 Z"}),a("polygon",{fill:"#FFCFB5",points:"64.02 99.3 90.53 114.9 90.53 83.4"}),a("path",{fill:"#F67D73",d:"M 90.53 83.4 L 90.53 114.9 L 117.37 99.0 Z"}),a("path",{fill:"#F26560",d:"M 90.53 83.4 L 117.37 99.0 L 117.37 68.0 Z"}),a("polygon",{fill:"#EB5F5B",points:"80.08 67.5 90.53 73.5 90.53 61.3"}),a("polygon",{fill:"#DB4D50",points:"90.53 61.3 90.53 73.5 100.87 67.4"})]}),a("div",{className:"absolute bottom-0 left-0 w-full h-[65%] bg-linear-to-t from-black/35 to-black/0"}),a("p",{className:"absolute left-1 bottom-2 text-white",children:e.name})]}),g("div",{className:"px-2 h-10 flex justify-between items-center",children:[g("p",{className:"truncate pr-1 text-xs text-muted-foreground",children:[RO()," ",$y(e.updatedAt??"")]}),a("div",{onClick:(t)=>t.stopPropagation(),children:g(De,{modal:!1,children:[a(Ne,{asChild:!0,children:a("button",{className:"hover:bg-muted outline-none flex px-1",children:a(_r,{className:"w-5 h-5 text-muted-foreground"})})}),g(Fe,{align:"end",children:[l&&a(de,{onClick:(t)=>{t.stopPropagation(),pe(e)},children:R0()}),g(de,{className:"flex items-center justify-between gap-4 cursor-pointer",onSelect:(t)=>{t.preventDefault(),ce.mutate(e)},children:[a("span",{children:TT()}),a(Ke,{checked:e.enableNotification??!0,className:"pointer-events-none"})]}),c&&a(de,{className:"text-destructive focus:text-destructive",onClick:()=>ue(e),children:Mt()})]})]})})]})]})},e.id)),l&&a("div",{className:B("shadow-md relative border rounded-xl overflow-hidden cursor-pointer transition-transform duration-100 ease-in-out border-dashed hover:border-orange-600/50 group",p==="create"?"scale-95":"scale-100"),onClick:me,children:g("div",{className:"flex flex-col",children:[a("div",{className:"relative w-full aspect-square flex items-center justify-center bg-zinc-400/5 group-hover:bg-orange-600/5 transition-colors",children:a(Re,{className:"w-8 h-8 text-zinc-400 group-hover:text-orange-600 transition-colors"})}),a("div",{className:"px-2 h-10 flex items-center justify-center bg-zinc-400/10 border-t group-hover:bg-orange-600/10 transition-colors",children:a("p",{className:"text-sm text-muted-foreground group-hover:text-orange-600 transition-colors",children:Xm()})})]})})]}),a(ae,{open:s,onOpenChange:h,mode:I,teamId:o,project:_}),a(dt,{open:k,onOpenChange:v,children:g(ft,{children:[g(pt,{children:[a(ht,{children:Qb()}),g(gt,{children:[zE({name:u?.name??""}),g("div",{className:"mt-4 flex flex-col gap-2 text-foreground",children:[a("span",{className:"text-sm font-medium",children:IO()}),a(re,{value:x,onChange:(e)=>P(e.target.value),placeholder:UE(),className:"h-9",autoFocus:!0})]})]})]}),g(mt,{children:[a(_t,{disabled:q.isPending,children:Ve()}),a(At,{onClick:(e)=>{e.preventDefault(),ge()},disabled:x!=="delete"||q.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q.isPending?KE():Mt()})]})]})}),a(wu,{open:O,onOpenChange:A,title:ZM(),type:"team",members:U,isOwner:G?.role==="owner",onInvite:he,onUpdateRole:async(e,t)=>{await ye.mutateAsync({userId:e,role:t})},onRemoveMember:async(e)=>{await be.mutateAsync(e)},currentUserId:G?.id})]})}var Pe=Je("/teams/$teamId/")({component:Me});export{Pe as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{z}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{z}from"./chunk-5ngftxjb.js";var a=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],fu=z("external-link",a);
|
|
2
|
+
export{fu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,Je}from"./chunk-5ngftxjb.js";import"./chunk-1tar0x8s.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import"./chunk-ajq9sxg0.js";import"./chunk-9405hzv2.js";import"./chunk-20w1w9x7.js";import"./chunk-thpw6tcj.js";import"./chunk-pq6kdp83.js";import"./chunk-6f3zhq64.js";import"./chunk-qm50g4n5.js";import"./chunk-q1fzgqsv.js";import"./chunk-d55138xx.js";import{wa}from"./chunk-9vxmgvc8.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-0a298n62.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-femnbfkj.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";function n(){let{shareId:r,fileId:i}=e.useParams(),{start:t,version:o,compare:c,cmpLeft:m,cmpRight:s,cmpActive:p}=e.useSearch();return a(wa,{shareId:r,initialFileId:i,startTime:t,versionId:o,compare:c,compareLeftId:m,compareRightId:s,compareActiveSide:p})}var e=Je("/share/$shareId/files/$fileId")({component:n});export{e as Route};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{z}from"./chunk-
|
|
1
|
+
import{z}from"./chunk-5ngftxjb.js";var a=[["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"}]],zo=z("upload",a);
|
|
2
2
|
export{zo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Q,S,M,w,Z,Y,a,g,ie,X,R,z,K,ao,$t,Be,Bt,Er,xr,Re,Ue,Ge,B,jb,qb,Vb,fw,Vm,e_,$w,dE,LE,ZE,Dr,B_,mh,yh,s0,tT,aT,RT,y0,Wh,Lp,PR,VM,dg,fg,bO,Jn,pg,Ie,Pt,ln,nn,ha,Xe,et,tt,rt,be,ts,Fi,ar,Ir}from"./chunk-zarz3sqn.js";import{ro}from"./chunk-55h9ze53.js";import{Gd,Bi}from"./chunk-1ktk6764.js";import{rs}from"./chunk-hpbn0k9n.js";var Ce=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ae=z("brain",Ce);Z();function va({projectId:m,contextAssetId:k,file:f,currentTime:ne,frameRate:C,startTimecode:V,formatTimestamp:I,onTyping:le,onSelectMessage:W,selectedMessageId:de}){let{isHistoryMode:p,setIsHistoryMode:A,currentSessionId:me,chatAssets:ce,removeAsset:ue,messages:h,historySessions:J,isStreaming:_,fetchHistorySessions:U,loadSession:pe,deleteSession:fe,startNewSession:G,sendMessage:ge,abortActiveSession:xe,selectedAgentId:T,setSelectedAgentId:j,inputText:he,setInputText:ve}=Ir(),{teamId:c,ensureTeamIdForProject:ee}=Pt(),{videoTimeDisplayMode:ye}=ar(),[q,D]=w(null);S(()=>{if(m)ee(m)},[m,ee]);let{data:we=[],isSuccess:te}=X({queryKey:["chat-agents",m],queryFn:async()=>{if(!m)return[];let e=await R.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:m}});if(!e.ok)throw Error("failed to fetch agents");return e.json()},enabled:!!m}),N=we.filter((e)=>e.type==="chat"&&e.enabled);S(()=>{if(!te)return;if(N.length>0){if(!N.some((t)=>t.id===T))j(N[0].id)}else if(T!==null)j(null)},[te,N,T,j]);let re=M(null),E=M(null),F=M(!0),H=M(!0);S(()=>{H.current=!0,F.current=!0},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let{scrollTop:t,isAtBottom:i}=Ir.getState(),r=setTimeout(()=>{if(i)e.scrollTop=e.scrollHeight;else e.scrollTop=t;let d=setTimeout(()=>{H.current=!1},50);return()=>clearTimeout(d)},0);return()=>clearTimeout(r)},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let t=()=>{if(H.current)return;let i=e.scrollTop,r=e.scrollHeight-i-e.clientHeight<10;Ir.getState().setScrollState(i,r)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[m,k,p]);let{ref:ke,isDropTarget:Ne}=ln({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});S(()=>{if(!p){let{isAtBottom:e}=Ir.getState();if(e||_){let t=F.current?"auto":"smooth";re.current?.scrollIntoView({behavior:t})}F.current=!1}},[h,_,p]),S(()=>{if(p&&c)U(c)},[p,U,c]);let v=ie(),_e=Q(()=>{v.invalidateQueries({queryKey:["search"]}),v.invalidateQueries({queryKey:["folders"]}),v.invalidateQueries({queryKey:["files"]}),v.invalidateQueries({queryKey:["file"]}),v.invalidateQueries({queryKey:["version_stacks"]}),v.invalidateQueries({queryKey:["projects"]})},[v]),O=(e)=>{if(typeof e==="string")return e;if(Array.isArray(e))return e.map((t)=>{if(typeof t==="string")return t;if(t&&typeof t==="object"&&"type"in t&&t.type==="text"&&"text"in t)return String(t.text);return""}).join("");return""},oe=(e)=>e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Se=(e)=>{switch(e.role){case"user":case"custom":{let t=e;if(e.role==="custom"&&t.customType==="context_display_info"){let d=t.details?.assets||[];if(d.length===0)return null;return g("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[a("div",{className:"font-semibold",children:qb()}),a("ul",{className:"list-disc list-inside space-y-0.5",children:d.map((s)=>g("li",{className:"truncate",children:[s.name," ",g("span",{className:"text-muted-foreground/70",children:["(",s.type,")"]})]},s.id))})]},e.id)}if(e.role==="user"||t.customType==="shumai_message"){let r=t.details,d=r?.referencedAssets||[],s=r?.attachedFiles||[],n=r?.position,u=r?.annotation||r?.annotations&&r.annotations.length>0,l=!r?.currentAsset?.id||k&&r.currentAsset.id===k||f?.id&&r.currentAsset.id===f.id,x=de===e.id,y="";if(n?.type==="time")if(I)y=I(n.seconds);else if(C){let o=Math.round(n.seconds*C);y=ro(o,C,ye,V)}else{let o=Math.floor(n.seconds/60),b=Math.floor(n.seconds%60);y=`${o.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`}else if(n?.type==="page")y=y0({page:n.page});let se=O(t.content),Te=s.length>0||d.length>0;return a("div",{onClick:()=>{if(l&&W)W(e)},className:B("flex flex-col items-end w-full group transition-all duration-150",l&&(u||n)&&"cursor-pointer"),children:g("div",{className:B("bg-primary text-primary-foreground rounded-lg px-3 py-2 text-sm whitespace-pre-wrap shadow-xs break-words transition-all border",Te?"w-full":"max-w-[85%]",x?"border-blue-500 dark:border-blue-400":"border-transparent"),children:[g("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:[u&&a("span",{className:"inline-flex items-center align-middle mr-1.5 p-0.5 rounded bg-primary-foreground/20 text-primary-foreground",title:$w(),children:a(ha,{className:"w-3.5 h-3.5"})}),n&&a("span",{className:"inline-flex items-center align-middle mr-1.5 px-1.5 py-0.5 rounded text-xs font-mono font-bold bg-primary-foreground/20 text-primary-foreground",children:y}),se&&a("span",{children:se})]}),s.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Vb()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:s.map((o)=>{let b=o.name||"file",P=Fi(b)||o.mediaType==="image"||o.mimeType?.startsWith("image/");return g("div",{className:B("group/att relative flex items-center w-full max-w-full rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",P?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"),onClick:(L)=>{if(L.stopPropagation(),o.url)if(P)D({url:o.url,name:b});else window.open(o.url,"_blank","noreferrer")},children:[P&&o.url?a("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-black/20 shrink-0",children:a("img",{src:o.url,alt:b,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("div",{className:"min-w-0 flex-1 overflow-hidden",children:a("p",{className:"text-xs font-medium text-primary-foreground truncate block w-full",title:b,children:b})}),o.url&&a("a",{href:o.url,target:"_blank",rel:"noreferrer",download:b,className:"p-1 text-primary-foreground/70 hover:text-primary-foreground shrink-0 rounded-md hover:bg-primary-foreground/20 transition-colors opacity-0 group-hover/att:opacity-100",onClick:(L)=>L.stopPropagation(),title:Dr(),children:a(Bt,{className:"w-3.5 h-3.5"})})]},o.id)})})]}),d.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:jb()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:d.map((o)=>g("div",{className:"flex items-center justify-between w-full h-9 px-2.5 rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",children:[g("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.type==="folder"?a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("span",{className:"text-xs font-medium truncate text-primary-foreground",title:o.name,children:o.name})]}),a("span",{className:"text-[10px] text-primary-foreground/60 uppercase shrink-0 font-mono ml-2",children:o.type})]},o.id))})]})]})},e.id)}let i=t.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}case"assistant":{let i=e.content;if(!i)return null;let r=[];if(i.forEach((s,n)=>{if(!s||typeof s!=="object")return;let u=s;switch(u.type){case"text":{let l=u.text;if(typeof l!=="string"||!l.trim())return;r.push(a("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:a(ts,{components:{pre:({node:x,...y})=>a("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...y})},children:oe(l)})},`txt-${n}`));break}case"thinking":{let l=u.thinking;if(typeof l!=="string"||!l.trim())return;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(ae,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),a("span",{children:Wh()||"Thinking"}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),a("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:a(ts,{children:oe(l)})})]},`think-${n}`));break}case"toolCall":{let l=String(u.name||u.toolName||Jn()),x=u.arguments||u.args;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(rs,{className:"h-3.5 w-3.5"}),a("span",{children:Vm()}),a("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:l}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!x&&g("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[a("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:dg()||"Arguments"}),a("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(x,null,2)})]})]},`tool-${n}`));break}case"image":{let l=String(u.mimeType||"image/png"),x=String(u.data||"");r.push(a("div",{className:"my-2 max-w-full",children:x?a("img",{src:x.startsWith("data:")?x:`data:${l};base64,${x}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):a("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:mh()})},`img-${n}`));break}default:{let l=JSON.stringify(s,null,2);if(l==="{}")return;r.push(a("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:l},`other-${n}`))}}}),r.length===0)return null;let d=!1;if(i.length>0){let s=i[i.length-1];if(typeof s==="string"&&s.trim().length>0)d=!0;else if(s&&typeof s==="object"){let n=s;if(n.type==="text"&&typeof n.text==="string"&&n.text.trim().length>0)d=!0}}return g("div",{className:"flex flex-col w-full space-y-1",children:[a("div",{className:"space-y-2 w-full",children:r}),d&&a("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:dE()})]},e.id)}case"toolResult":return a("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:a("span",{className:"font-semibold",children:fg({name:e.toolName||"tool"})})},e.id);case"thinking_level_change":{let i=e.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}default:return null}};return g("div",{ref:ke,className:B("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ne&&a("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:g("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[a($t,{className:"h-6 w-6 text-primary animate-bounce"}),a("span",{className:"text-sm font-semibold text-foreground",children:e_()})]})}),g("div",{className:"h-12 border-b border-border flex items-center justify-between px-4 flex-shrink-0 bg-background/50 backdrop-blur-sm",children:[g("div",{className:"flex items-center gap-2",children:[p&&a("button",{onClick:()=>A(!1),className:"p-1 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:fw(),children:a(Gd,{className:"h-4 w-4"})}),a($t,{className:"h-5 w-5 text-primary"}),a("span",{className:"font-semibold text-sm",children:p?B_():PR()})]}),a("div",{className:"flex items-center gap-1",children:!p?g(Y,{children:[a("button",{onClick:G,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:s0(),children:a(Re,{className:"h-4 w-4"})}),a("button",{onClick:()=>A(!0),className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:B_(),children:a(ao,{className:"h-4 w-4"})})]}):g("button",{onClick:()=>{G(),A(!1)},className:"flex items-center gap-1 text-xs bg-primary text-primary-foreground px-2.5 py-1 rounded-md hover:bg-primary/90 transition-colors shadow-xs cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5"}),a("span",{children:s0()})]})})]}),p?a(Ie,{className:"flex-1 p-3",children:J.length===0?a("div",{className:"text-center text-xs text-muted-foreground py-8",children:aT()}):a("div",{className:"space-y-1",children:J.map((e)=>{let t=e.id===me;return g("div",{onClick:()=>{if(c)pe(c,e.id),A(!1)},className:B("group flex items-center justify-between p-2.5 rounded-lg text-xs cursor-pointer transition-all border border-transparent",t?"bg-accent/80 text-accent-foreground font-medium border-border/40":"hover:bg-muted/60 text-muted-foreground hover:text-foreground"),children:[g("div",{className:"flex flex-col min-w-0 pr-2",children:[a("span",{className:"truncate text-foreground font-medium text-xs",children:e.name||pg()}),a("span",{className:"text-[10px] text-muted-foreground",children:nn(e.updatedAt)})]}),a("button",{onClick:(i)=>{if(i.stopPropagation(),c&&window.confirm(ZE()))fe(c,e.id)},className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted cursor-pointer",title:LE(),children:a(Ue,{className:"h-4 w-4"})})]},e.id)})})}):g(Y,{children:[a(Ie,{ref:E,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:h.length===0?g("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[a($t,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),a("p",{className:"text-sm",children:e_()})]}):g("div",{className:"space-y-4 pb-4",children:[h.map(Se),_&&h.length>0&&(h[h.length-1].role==="user"||h[h.length-1].customType==="shumai_message")&&g("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[a(K,{className:"h-3 w-3 animate-spin text-primary"}),a("span",{children:VM()})]}),a("div",{ref:re})]})}),a("div",{className:"p-2 flex-shrink-0 bg-background",children:a(Bi,{projectId:m,value:he,onChangeText:ve,placeholder:bO(),disabled:!T||!c,isStreaming:_,onAbort:()=>{if(c)xe(c)},allowMentions:!1,allowAttachments:!0,workspaceAssets:ce,onRemoveWorkspaceAsset:ue,allowMarkup:!0,canMarkup:!!f&&["image","video","pdf"].includes(f.proxyType||""),markupDisabledTooltip:!f?RT():yh(),allowTimestamp:f?.proxyType==="video"||f?.proxyType==="pdf",currentTime:ne,frameRate:C||f?.media?.metadata?.frameRate||30,startTimecode:V||f?.media?.metadata?.startTimecode,formatTimestamp:I||(f?.proxyType==="pdf"?(e)=>y0({page:Math.round(e)}):void 0),onTyping:le,onSendMessage:(e,t,i,r,d,s)=>{if(!c)return;ge(c,e,m,k,_e,t,i,d,s)},bottomLeftExtra:a("div",{className:"flex items-center gap-1.5 min-w-0 max-w-full",children:N.length>0?g(Xe,{value:T||"",onValueChange:(e)=>j(e),disabled:_,children:[a(tt,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full cursor-pointer",children:a(et,{placeholder:Lp()})}),a(rt,{children:N.map((e)=>a(be,{value:e.id,className:"cursor-pointer",children:g("div",{className:"flex items-center gap-2",children:[e.avatar?a("img",{src:e.avatar,alt:e.name,className:"w-4 h-4 rounded-full object-cover"}):a($t,{className:"w-4 h-4 text-muted-foreground"}),a("span",{className:"text-xs",children:e.name})]})},e.id))})]}):a("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:a("span",{children:tT()})})})})})]}),q&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>D(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",children:a(Ge,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:q.url,alt:q.name,className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),D(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:q.name})]})]})}
|
|
2
|
-
export{
|
|
1
|
+
import{G,S,M,w,L,W,a,g,ie,X,R,z,K,ao,$t,Be,Bt,Er,xr,Re,Ue,Ge,B,Vb,Kb,ew,_w,Wm,r_,Ww,AE,qE,$E,Dr,j_,gh,bh,l0,iT,fT,NT,w0,Yh,Zp,ZR,XM,pg,mg,SO,Yn,hg,Ie,Pt,ln,on,ga,Xe,et,tt,rt,be,ts,Fi,lr,Ir}from"./chunk-5ngftxjb.js";import{ro}from"./chunk-9405hzv2.js";import{Vd,Bi}from"./chunk-qm50g4n5.js";import{rs}from"./chunk-sz5zawfw.js";var Ce=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],ae=z("brain",Ce);L();function ba({projectId:m,contextAssetId:k,file:f,currentTime:ne,frameRate:C,startTimecode:V,formatTimestamp:I,onTyping:le,onSelectMessage:J,selectedMessageId:de}){let{isHistoryMode:p,setIsHistoryMode:A,currentSessionId:me,chatAssets:ce,removeAsset:ue,messages:h,historySessions:U,isStreaming:_,fetchHistorySessions:Z,loadSession:pe,deleteSession:fe,startNewSession:Y,sendMessage:ge,abortActiveSession:xe,selectedAgentId:T,setSelectedAgentId:j,inputText:he,setInputText:ve}=Ir(),{teamId:c,ensureTeamIdForProject:ee}=Pt(),{videoTimeDisplayMode:ye}=lr(),[q,D]=w(null);S(()=>{if(m)ee(m)},[m,ee]);let{data:we=[],isSuccess:te}=X({queryKey:["chat-agents",m],queryFn:async()=>{if(!m)return[];let e=await R.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:m}});if(!e.ok)throw Error("failed to fetch agents");return e.json()},enabled:!!m}),N=we.filter((e)=>e.type==="chat"&&e.enabled);S(()=>{if(!te)return;if(N.length>0){if(!N.some((t)=>t.id===T))j(N[0].id)}else if(T!==null)j(null)},[te,N,T,j]);let re=M(null),E=M(null),F=M(!0),H=M(!0);S(()=>{H.current=!0,F.current=!0},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let{scrollTop:t,isAtBottom:i}=Ir.getState(),r=setTimeout(()=>{if(i)e.scrollTop=e.scrollHeight;else e.scrollTop=t;let d=setTimeout(()=>{H.current=!1},50);return()=>clearTimeout(d)},0);return()=>clearTimeout(r)},[m,k,p]),S(()=>{let e=E.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!e)return;let t=()=>{if(H.current)return;let i=e.scrollTop,r=e.scrollHeight-i-e.clientHeight<10;Ir.getState().setScrollState(i,r)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[m,k,p]);let{ref:ke,isDropTarget:Ne}=ln({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});S(()=>{if(!p){let{isAtBottom:e}=Ir.getState();if(e||_){let t=F.current?"auto":"smooth";re.current?.scrollIntoView({behavior:t})}F.current=!1}},[h,_,p]),S(()=>{if(p&&c)Z(c)},[p,Z,c]);let v=ie(),_e=G(()=>{v.invalidateQueries({queryKey:["search"]}),v.invalidateQueries({queryKey:["folders"]}),v.invalidateQueries({queryKey:["files"]}),v.invalidateQueries({queryKey:["file"]}),v.invalidateQueries({queryKey:["version_stacks"]}),v.invalidateQueries({queryKey:["projects"]})},[v]),O=(e)=>{if(typeof e==="string")return e;if(Array.isArray(e))return e.map((t)=>{if(typeof t==="string")return t;if(t&&typeof t==="object"&&"type"in t&&t.type==="text"&&"text"in t)return String(t.text);return""}).join("");return""},oe=(e)=>e.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:"),Se=(e)=>{switch(e.role){case"user":case"custom":{let t=e;if(e.role==="custom"&&t.customType==="context_display_info"){let d=t.details?.assets||[];if(d.length===0)return null;return g("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[a("div",{className:"font-semibold",children:Kb()}),a("ul",{className:"list-disc list-inside space-y-0.5",children:d.map((s)=>g("li",{className:"truncate",children:[s.name," ",g("span",{className:"text-muted-foreground/70",children:["(",s.type,")"]})]},s.id))})]},e.id)}if(e.role==="user"||t.customType==="shumai_message"){let r=t.details,d=r?.referencedAssets||[],s=r?.attachedFiles||[],n=r?.position,u=r?.annotation||r?.annotations&&r.annotations.length>0,l=!r?.currentAsset?.id||k&&r.currentAsset.id===k||f?.id&&r.currentAsset.id===f.id,x=de===e.id,y="";if(n?.type==="time")if(I)y=I(n.seconds);else if(C){let o=Math.round(n.seconds*C);y=ro(o,C,ye,V)}else{let o=Math.floor(n.seconds/60),b=Math.floor(n.seconds%60);y=`${o.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}`}else if(n?.type==="page")y=w0({page:n.page});let se=O(t.content),Te=s.length>0||d.length>0;return a("div",{onClick:()=>{if(l&&J)J(e)},className:B("flex flex-col items-end w-full group transition-all duration-150",l&&(u||n)&&"cursor-pointer"),children:g("div",{className:B("bg-primary text-primary-foreground rounded-lg px-3 py-2 text-sm whitespace-pre-wrap shadow-xs break-words transition-all border",Te?"w-full":"max-w-[85%]",x?"border-blue-500 dark:border-blue-400":"border-transparent"),children:[g("div",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:[u&&a("span",{className:"inline-flex items-center align-middle mr-1.5 p-0.5 rounded bg-primary-foreground/20 text-primary-foreground",title:Ww(),children:a(ga,{className:"w-3.5 h-3.5"})}),n&&a("span",{className:"inline-flex items-center align-middle mr-1.5 px-1.5 py-0.5 rounded text-xs font-mono font-bold bg-primary-foreground/20 text-primary-foreground",children:y}),se&&a("span",{children:se})]}),s.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:ew()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:s.map((o)=>{let b=o.name||"file",P=Fi(b)||o.mediaType==="image"||o.mimeType?.startsWith("image/");return g("div",{className:B("group/att relative flex items-center w-full max-w-full rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",P?"h-18 p-1.5 gap-2.5 cursor-pointer":"h-9 px-2.5 gap-2.5"),onClick:(Q)=>{if(Q.stopPropagation(),o.url)if(P)D({url:o.url,name:b});else window.open(o.url,"_blank","noreferrer")},children:[P&&o.url?a("div",{className:"h-full aspect-square rounded-md overflow-hidden bg-black/20 shrink-0",children:a("img",{src:o.url,alt:b,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"})}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("div",{className:"min-w-0 flex-1 overflow-hidden",children:a("p",{className:"text-xs font-medium text-primary-foreground truncate block w-full",title:b,children:b})}),o.url&&a("a",{href:o.url,target:"_blank",rel:"noreferrer",download:b,className:"p-1 text-primary-foreground/70 hover:text-primary-foreground shrink-0 rounded-md hover:bg-primary-foreground/20 transition-colors opacity-0 group-hover/att:opacity-100",onClick:(Q)=>Q.stopPropagation(),title:Dr(),children:a(Bt,{className:"w-3.5 h-3.5"})})]},o.id)})})]}),d.length>0&&g("div",{className:"mt-2.5 w-full",children:[a("div",{className:"text-xs font-medium text-primary-foreground/70 mb-1",children:Vb()}),a("div",{className:"flex flex-col gap-1.5 w-full",children:d.map((o)=>g("div",{className:"flex items-center justify-between w-full h-9 px-2.5 rounded-lg border border-primary-foreground/15 bg-primary-foreground/10 hover:bg-primary-foreground/15 transition-colors overflow-hidden",children:[g("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[o.type==="folder"?a(xr,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}):a(Er,{className:"w-4 h-4 text-primary-foreground/70 shrink-0"}),a("span",{className:"text-xs font-medium truncate text-primary-foreground",title:o.name,children:o.name})]}),a("span",{className:"text-[10px] text-primary-foreground/60 uppercase shrink-0 font-mono ml-2",children:o.type})]},o.id))})]})]})},e.id)}let i=t.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}case"assistant":{let i=e.content;if(!i)return null;let r=[];if(i.forEach((s,n)=>{if(!s||typeof s!=="object")return;let u=s;switch(u.type){case"text":{let l=u.text;if(typeof l!=="string"||!l.trim())return;r.push(a("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:a(ts,{components:{pre:({node:x,...y})=>a("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...y})},children:oe(l)})},`txt-${n}`));break}case"thinking":{let l=u.thinking;if(typeof l!=="string"||!l.trim())return;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(ae,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),a("span",{children:Yh()||"Thinking"}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),a("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:a(ts,{children:oe(l)})})]},`think-${n}`));break}case"toolCall":{let l=String(u.name||u.toolName||Yn()),x=u.arguments||u.args;r.push(g("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[g("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[a(rs,{className:"h-3.5 w-3.5"}),a("span",{children:Wm()}),a("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:l}),a(Be,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!x&&g("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[a("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:pg()||"Arguments"}),a("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(x,null,2)})]})]},`tool-${n}`));break}case"image":{let l=String(u.mimeType||"image/png"),x=String(u.data||"");r.push(a("div",{className:"my-2 max-w-full",children:x?a("img",{src:x.startsWith("data:")?x:`data:${l};base64,${x}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):a("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:gh()})},`img-${n}`));break}default:{let l=JSON.stringify(s,null,2);if(l==="{}")return;r.push(a("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:l},`other-${n}`))}}}),r.length===0)return null;let d=!1;if(i.length>0){let s=i[i.length-1];if(typeof s==="string"&&s.trim().length>0)d=!0;else if(s&&typeof s==="object"){let n=s;if(n.type==="text"&&typeof n.text==="string"&&n.text.trim().length>0)d=!0}}return g("div",{className:"flex flex-col w-full space-y-1",children:[a("div",{className:"space-y-2 w-full",children:r}),d&&a("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:AE()})]},e.id)}case"toolResult":return a("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:a("span",{className:"font-semibold",children:mg({name:e.toolName||"tool"})})},e.id);case"thinking_level_change":{let i=e.content||"";return a("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:O(i)},e.id)}default:return null}};return g("div",{ref:ke,className:B("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Ne&&a("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:g("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[a($t,{className:"h-6 w-6 text-primary animate-bounce"}),a("span",{className:"text-sm font-semibold text-foreground",children:r_()})]})}),g("div",{className:"h-12 border-b border-border flex items-center justify-between px-4 flex-shrink-0 bg-background/50 backdrop-blur-sm",children:[g("div",{className:"flex items-center gap-2",children:[p&&a("button",{onClick:()=>A(!1),className:"p-1 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:_w(),children:a(Vd,{className:"h-4 w-4"})}),a($t,{className:"h-5 w-5 text-primary"}),a("span",{className:"font-semibold text-sm",children:p?j_():ZR()})]}),a("div",{className:"flex items-center gap-1",children:!p?g(W,{children:[a("button",{onClick:Y,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:l0(),children:a(Re,{className:"h-4 w-4"})}),a("button",{onClick:()=>A(!0),className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:j_(),children:a(ao,{className:"h-4 w-4"})})]}):g("button",{onClick:()=>{Y(),A(!1)},className:"flex items-center gap-1 text-xs bg-primary text-primary-foreground px-2.5 py-1 rounded-md hover:bg-primary/90 transition-colors shadow-xs cursor-pointer",children:[a(Re,{className:"h-3.5 w-3.5"}),a("span",{children:l0()})]})})]}),p?a(Ie,{className:"flex-1 p-3",children:U.length===0?a("div",{className:"text-center text-xs text-muted-foreground py-8",children:fT()}):a("div",{className:"space-y-1",children:U.map((e)=>{let t=e.id===me;return g("div",{onClick:()=>{if(c)pe(c,e.id),A(!1)},className:B("group flex items-center justify-between p-2.5 rounded-lg text-xs cursor-pointer transition-all border border-transparent",t?"bg-accent/80 text-accent-foreground font-medium border-border/40":"hover:bg-muted/60 text-muted-foreground hover:text-foreground"),children:[g("div",{className:"flex flex-col min-w-0 pr-2",children:[a("span",{className:"truncate text-foreground font-medium text-xs",children:e.name||hg()}),a("span",{className:"text-[10px] text-muted-foreground",children:on(e.updatedAt)})]}),a("button",{onClick:(i)=>{if(i.stopPropagation(),c&&window.confirm($E()))fe(c,e.id)},className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted cursor-pointer",title:qE(),children:a(Ue,{className:"h-4 w-4"})})]},e.id)})})}):g(W,{children:[a(Ie,{ref:E,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:h.length===0?g("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[a($t,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),a("p",{className:"text-sm",children:r_()})]}):g("div",{className:"space-y-4 pb-4",children:[h.map(Se),_&&h.length>0&&(h[h.length-1].role==="user"||h[h.length-1].customType==="shumai_message")&&g("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[a(K,{className:"h-3 w-3 animate-spin text-primary"}),a("span",{children:XM()})]}),a("div",{ref:re})]})}),a("div",{className:"p-2 flex-shrink-0 bg-background",children:a(Bi,{projectId:m,value:he,onChangeText:ve,placeholder:SO(),disabled:!T||!c,isStreaming:_,onAbort:()=>{if(c)xe(c)},allowMentions:!1,allowAttachments:!0,workspaceAssets:ce,onRemoveWorkspaceAsset:ue,allowMarkup:!0,canMarkup:!!f&&["image","video","pdf"].includes(f.proxyType||""),markupDisabledTooltip:!f?NT():bh(),allowTimestamp:f?.proxyType==="video"||f?.proxyType==="pdf",currentTime:ne,frameRate:C||f?.media?.metadata?.frameRate||30,startTimecode:V||f?.media?.metadata?.startTimecode,formatTimestamp:I||(f?.proxyType==="pdf"?(e)=>w0({page:Math.round(e)}):void 0),onTyping:le,onSendMessage:(e,t,i,r,d,s)=>{if(!c)return;ge(c,e,m,k,_e,t,i,d,s)},bottomLeftExtra:a("div",{className:"flex items-center gap-1.5 min-w-0 max-w-full",children:N.length>0?g(Xe,{value:T||"",onValueChange:(e)=>j(e),disabled:_,children:[a(tt,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full cursor-pointer",children:a(et,{placeholder:Zp()})}),a(rt,{children:N.map((e)=>a(be,{value:e.id,className:"cursor-pointer",children:g("div",{className:"flex items-center gap-2",children:[e.avatar?a("img",{src:e.avatar,alt:e.name,className:"w-4 h-4 rounded-full object-cover"}):a($t,{className:"w-4 h-4 text-muted-foreground"}),a("span",{className:"text-xs",children:e.name})]})},e.id))})]}):a("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:a("span",{children:iT()})})})})})]}),q&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>D(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",children:a(Ge,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:q.url,alt:q.name,className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),D(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:q.name})]})]})}
|
|
2
|
+
export{ba};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{z}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{z}from"./chunk-5ngftxjb.js";var e=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],cl=z("bell",e);
|
|
2
|
+
export{cl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yt}from"./chunk-
|
|
2
|
+
import{Yt}from"./chunk-r6t0j0jx.js";import{at}from"./chunk-vnmggrd6.js";import{se}from"./chunk-4p31kxjh.js";var a=se(Yt()),t=se(at());import{readFileSync as p}from"fs";var c=(e)=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:r,webIdentityToken:i,providerId:n,policyArns:m,policy:f,durationSeconds:g}=e,{roleAssumerWithWebIdentity:l}=e;if(!l){let{getDefaultRoleAssumerWithWebIdentity:E}=await import("./chunk-3vpz5nat.js");l=E({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...s?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins)}return l({RoleArn:o,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:n,PolicyArns:m,Policy:f,DurationSeconds:g})};var d="AWS_WEB_IDENTITY_TOKEN_FILE",_="AWS_ROLE_ARN",S="AWS_ROLE_SESSION_NAME",T=(e={})=>async(s)=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let o=e?.webIdentityTokenFile??process.env[d],r=e?.roleArn??process.env[_],i=e?.roleSessionName??process.env[S];if(!o||!r)throw new t.CredentialsProviderError("Web identity configuration not specified",{logger:e.logger});let n=await c({...e,webIdentityToken:t.externalDataInterceptor?.getTokenRecord?.()[o]??p(o,{encoding:"ascii"}),roleArn:r,roleSessionName:i})(s);if(o===process.env[d])a.setCredentialFeature(n,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h");return n};export{T as fromTokenFile};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ja,mr}from"./chunk-v05rrxp5.js";var C=function(e,t){if(typeof e==="string"&&/^\.\.?\//.test(e))return e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,a,s,i){return n?t?".jsx":".js":a&&(!s||!i)?r:a+s+"."+i.toLowerCase()+"js"});return e},x=(e)=>import(C(e));function P(){return globalThis.process?.env}function A(){return{async env(e){let t=P()?.[e];return typeof t==="string"&&t.trim().length>0?t:void 0},async fileExists(e){try{let t=await x("node:fs/promises"),r=e;if(r.startsWith("~"))r=(await x("node:os")).homedir()+r.slice(1);return await t.access(r),!0}catch{return!1}}}}class Wu{credentials=new Map;chains=new Map;enqueue(e,t){let r=this.chains.get(e)??Promise.resolve(),n=(async()=>(await r.catch(()=>{}),t()))();return this.chains.set(e,n.catch(()=>{})),n}async read(e){return this.credentials.get(e)}async list(){return[...this.credentials].map(([e,t])=>({providerId:e,type:t.type}))}modify(e,t){return this.enqueue(e,async()=>{let r=this.credentials.get(e),n=await t(r);if(n!==void 0)this.credentials.set(e,n);return n??r})}delete(e){return this.enqueue(e,async()=>{this.credentials.delete(e)})}}class u extends Error{code;constructor(e,t,r){super(S(t,r?.cause),r);this.name="ModelsError",this.code=e}}function S(e,t){if(t===void 0||t===null)return e;let r=ja(t).trim();if(!r||e.includes(r))return e;return`${e}: ${r}`}async function v(e,t,r,n){let a=n?.env?K(r,n.env):r;if(n?.apiKey!==void 0&&e.auth.apiKey)return m(a,e.auth.apiKey,e.id,{type:"api_key",key:n.apiKey,env:n.env});let s=await q(t,e.id);if(s){if(s.type==="oauth"&&e.auth.oauth)return b(t,e.id,e.auth.oauth,s);if(s.type==="api_key"&&e.auth.apiKey){let i=n?.env?{...s,env:{...s.env,...n.env}}:s;return m(a,e.auth.apiKey,e.id,i)}return}return e.auth.apiKey?m(a,e.auth.apiKey,e.id,void 0):void 0}function K(e,t){return{env:async(r)=>t[r]||await e.env(r),fileExists:(r)=>e.fileExists(r)}}async function b(e,t,r,n){let a=n;if(Date.now()>=a.expires){let s;try{s=await e.modify(t,async(i)=>{if(i?.type!=="oauth")return;if(Date.now()<i.expires)return;try{return await r.refresh(i)}catch(c){throw new u("oauth",`OAuth refresh failed for ${t}`,{cause:c})}})}catch(i){if(i instanceof u)throw i;throw new u("auth",`Credential store modify failed for ${t}`,{cause:i})}if(s?.type!=="oauth")return;a=s}try{return{auth:await r.toAuth(a),source:"OAuth"}}catch(s){throw new u("oauth",`OAuth auth derivation failed for ${t}`,{cause:s})}}async function m(e,t,r,n){try{return await t.resolve({ctx:e,credential:n})}catch(a){throw new u("auth",`API key auth failed for provider ${r}`,{cause:a})}}async function q(e,t){try{return await e.read(t)}catch(r){throw new u("auth",`Credential store read failed for ${t}`,{cause:r})}}function E(e,t){return{role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function R(e){return typeof e.result==="function"}async function _(e,t){for await(let r of t)e.push(r);e.end(R(t)?await t.result():void 0)}function y(e,t){let r=new mr;return t().then((n)=>_(r,n)).catch((n)=>{let a=E(e,n);r.push({type:"error",reason:"error",error:a}),r.end(a)}),r}function yn(e){return{stream:(t,r,n)=>y(t,async()=>(await e()).stream(t,r,n)),streamSimple:(t,r,n)=>y(t,async()=>(await e()).streamSimple(t,r,n))}}class g{entries=new Map;async read(e){let t=this.entries.get(e);return t?structuredClone(t):void 0}async write(e,t){this.entries.set(e,structuredClone(t))}async delete(e){this.entries.delete(e)}}function k(e,t){if(!e&&!t)return;let r={...e};for(let[n,a]of Object.entries(t??{})){let s=n.toLowerCase();for(let i of Object.keys(r))if(i.toLowerCase()===s)delete r[i];r[n]=a}return r}class M{providers=new Map;credentials;modelsStore;authContext;constructor(e){this.credentials=e?.credentials??new Wu,this.modelsStore=e?.modelsStore??new g,this.authContext=e?.authContext??A()}setProvider(e){this.providers.set(e.id,e)}deleteProvider(e){this.providers.delete(e)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let r=this.providers.get(e);if(!r)return[];try{return r.getModels()}catch{return[]}}let t=[];for(let r of this.providers.values())try{t.push(...r.getModels())}catch{}return t}getModel(e,t){return this.getModels(e).find((r)=>r.id===t)}async refresh(e={}){let t=e.allowNetwork??!0,r=new Map,n=Array.from(this.providers.values()).filter((a)=>a.refreshModels!==void 0);return await Promise.all(n.map(async(a)=>{if(e.signal?.aborted)return;let s={read:()=>this.modelsStore.read(a.id),write:(c)=>this.modelsStore.write(a.id,c),delete:()=>this.modelsStore.delete(a.id)},i;try{i=await this.readCredential(a.id);let c=await this.resolveRefreshCredential(a,i,t,e.signal);if(!c)return;await a.refreshModels({credential:c,store:s,allowNetwork:t,force:e.force,signal:e.signal})}catch(c){if(!e.signal?.aborted)r.set(a.id,c instanceof Error?c:new u("model_source",`Model refresh failed for ${a.id}`,{cause:c}));try{await a.refreshModels({credential:i,store:s,allowNetwork:!1,signal:e.signal})}catch{}}})),{aborted:e.signal?.aborted??!1,errors:r}}async resolveRefreshCredential(e,t,r,n){if(t?.type==="oauth"){let c=e.auth.oauth;if(!c)return;if(!r||Date.now()<t.expires)return t;if(n?.aborted)return;let p=await this.credentials.modify(e.id,async(l)=>{if(l?.type!=="oauth"||Date.now()<l.expires)return;return c.refresh(l,n)});return p?.type==="oauth"?p:void 0}let a=e.auth.apiKey;if(!a)return;let s=t?.type==="api_key"?t:void 0,i=await a.resolve({ctx:this.authContext,credential:s});if(!i)return;return{type:"api_key",key:i.auth.apiKey,env:i.env}}async readCredential(e){try{return await this.credentials.read(e)}catch(t){throw new u("auth",`Credential store read failed for ${e}`,{cause:t})}}async checkProviderAuth(e,t){if(t?.type==="oauth")return e.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let r=e.auth.apiKey;if(!r)return;if(r.check)try{return await r.check({ctx:this.authContext,credential:t?.type==="api_key"?t:void 0})}catch(a){throw new u("auth",`API key auth check failed for provider ${e.id}`,{cause:a})}let n=await v(e,this.credentials,this.authContext);return n?{source:n.source,type:"api_key"}:void 0}async checkAuth(e){let t=this.providers.get(e);if(!t)return;return this.checkProviderAuth(t,await this.readCredential(e))}async getAvailable(e){let t=e?[this.providers.get(e)].filter((n)=>n!==void 0):this.getProviders();return(await Promise.all(t.map(async(n)=>{let a=await this.readCredential(n.id);return{provider:n,credential:a,auth:await this.checkProviderAuth(n,a)}}))).flatMap(({provider:n,credential:a,auth:s})=>{if(!s)return[];let i=n.getModels();return n.filterModels?.(i,a)??i})}async getAuth(e,t){let r=typeof e==="string"?e:e.provider,n=this.providers.get(r);if(!n)return;let a=await v(n,this.credentials,this.authContext,t);if(!a||typeof e==="string"||!e.headers)return a;return{...a,auth:{...a.auth,headers:k(a.auth.headers,e.headers)}}}async login(e,t,r){let n=this.providers.get(e);if(!n)throw new u("provider",`Unknown provider: ${e}`);let a=t==="oauth"?n.auth.oauth:n.auth.apiKey;if(!a?.login)throw new u("auth",`${n.name} does not support ${t} login`);let s=await a.login(r);try{await this.credentials.modify(e,async()=>s)}catch(i){throw new u("auth",`Credential store modify failed for ${e}`,{cause:i})}return s}async logout(e){try{await this.credentials.delete(e)}catch(t){throw new u("auth",`Credential store delete failed for ${e}`,{cause:t})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new u("provider",`Unknown provider: ${e.provider}`);return t}async applyAuth(e,t){this.requireProvider(e);let r=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env});if(!r)throw new u("auth",`Provider is not configured: ${e.provider}`);let n=r.auth,a=t?.apiKey??n.apiKey,s=k(n.headers,t?.headers);if(t?.transformHeaders)s=await t.transformHeaders(s??{});let i=r.env||t?.env?{...r.env??{},...t?.env??{}}:void 0,c=n.baseUrl?{...e,baseUrl:n.baseUrl}:e,{transformHeaders:p,...l}=t??{},o={...l,apiKey:a,headers:s,env:i};return{requestModel:c,requestOptions:o}}stream(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.stream(a,t,s)})}async complete(e,t,r){return this.stream(e,t,r).result()}streamSimple(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.streamSimple(a,t,s)})}async completeSimple(e,t,r){return this.streamSimple(e,t,r).result()}}function eA(e){return new M(e)}function Ze(e){let t=e.models,r=[],n,a=e.fetchModels,s=()=>{let o=[...t];for(let h of r){let d=o.findIndex((f)=>f.id===h.id);if(d>=0)o[d]=h;else o.push(h)}return o},i=typeof e.api.stream==="function"?e.api:void 0,c=i?void 0:e.api,p=(o)=>i??c?.[o.api],l=(o,h)=>{let d=p(o);if(!d)return y(o,async()=>{throw new u("stream",`Provider ${e.id} has no API implementation for "${o.api}"`)});return h(d)};return{id:e.id,name:e.name??e.id,baseUrl:e.baseUrl,headers:e.headers,auth:e.auth,getModels:s,refreshModels:a?(o)=>(n??=(async()=>{try{let h=await o.store.read();if(h)r=h.models.filter((f)=>f.provider===e.id).map((f)=>f);if(!o.allowNetwork||o.signal?.aborted)return;let d=await a(o);if(o.signal?.aborted)return;r=d,await o.store.write({models:d,checkedAt:Date.now()})}finally{n=void 0}})(),n):void 0,filterModels:e.filterModels,stream:(o,h,d)=>l(o,(f)=>f.stream(o,h,d)),streamSimple:(o,h,d)=>l(o,(f)=>f.streamSimple(o,h,d))}}function Gn(e,t){let r=t.input+t.cacheRead+t.cacheWrite,n=e.cost,a=-1;for(let c of e.cost.tiers??[])if(r>c.inputTokensAbove&&c.inputTokensAbove>a)n=c,a=c.inputTokensAbove;let s=t.cacheWrite1h??0,i=t.cacheWrite-s;return t.cost.input=n.input/1e6*t.input,t.cost.output=n.output/1e6*t.output,t.cost.cacheRead=n.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(n.cacheWrite*i+n.input*2*s)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost}var w=["off","minimal","low","medium","high","xhigh","max"];function T(e){if(!e.reasoning)return["off"];return w.filter((t)=>{let r=e.thinkingLevelMap?.[t];if(r===null)return!1;if(t==="xhigh"||t==="max")return r!==void 0;return!0})}function vn(e,t){let r=T(e);if(r.includes(t))return t;let n=w.indexOf(t);if(n===-1)return r[0]??"off";for(let a=n;a<w.length;a++){let s=w[a];if(r.includes(s))return s}for(let a=n-1;a>=0;a--){let s=w[a];if(r.includes(s))return s}return r[0]??"off"}
|
|
3
|
-
export{
|
|
2
|
+
import{qa,hr}from"./chunk-1e1q1hyg.js";var C=function(e,t){if(typeof e==="string"&&/^\.\.?\//.test(e))return e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,a,s,i){return n?t?".jsx":".js":a&&(!s||!i)?r:a+s+"."+i.toLowerCase()+"js"});return e},x=(e)=>import(C(e));function P(){return globalThis.process?.env}function A(){return{async env(e){let t=P()?.[e];return typeof t==="string"&&t.trim().length>0?t:void 0},async fileExists(e){try{let t=await x("node:fs/promises"),r=e;if(r.startsWith("~"))r=(await x("node:os")).homedir()+r.slice(1);return await t.access(r),!0}catch{return!1}}}}class Yu{credentials=new Map;chains=new Map;enqueue(e,t){let r=this.chains.get(e)??Promise.resolve(),n=(async()=>(await r.catch(()=>{}),t()))();return this.chains.set(e,n.catch(()=>{})),n}async read(e){return this.credentials.get(e)}async list(){return[...this.credentials].map(([e,t])=>({providerId:e,type:t.type}))}modify(e,t){return this.enqueue(e,async()=>{let r=this.credentials.get(e),n=await t(r);if(n!==void 0)this.credentials.set(e,n);return n??r})}delete(e){return this.enqueue(e,async()=>{this.credentials.delete(e)})}}class u extends Error{code;constructor(e,t,r){super(S(t,r?.cause),r);this.name="ModelsError",this.code=e}}function S(e,t){if(t===void 0||t===null)return e;let r=qa(t).trim();if(!r||e.includes(r))return e;return`${e}: ${r}`}async function v(e,t,r,n){let a=n?.env?K(r,n.env):r;if(n?.apiKey!==void 0&&e.auth.apiKey)return m(a,e.auth.apiKey,e.id,{type:"api_key",key:n.apiKey,env:n.env});let s=await q(t,e.id);if(s){if(s.type==="oauth"&&e.auth.oauth)return b(t,e.id,e.auth.oauth,s);if(s.type==="api_key"&&e.auth.apiKey){let i=n?.env?{...s,env:{...s.env,...n.env}}:s;return m(a,e.auth.apiKey,e.id,i)}return}return e.auth.apiKey?m(a,e.auth.apiKey,e.id,void 0):void 0}function K(e,t){return{env:async(r)=>t[r]||await e.env(r),fileExists:(r)=>e.fileExists(r)}}async function b(e,t,r,n){let a=n;if(Date.now()>=a.expires){let s;try{s=await e.modify(t,async(i)=>{if(i?.type!=="oauth")return;if(Date.now()<i.expires)return;try{return await r.refresh(i)}catch(c){throw new u("oauth",`OAuth refresh failed for ${t}`,{cause:c})}})}catch(i){if(i instanceof u)throw i;throw new u("auth",`Credential store modify failed for ${t}`,{cause:i})}if(s?.type!=="oauth")return;a=s}try{return{auth:await r.toAuth(a),source:"OAuth"}}catch(s){throw new u("oauth",`OAuth auth derivation failed for ${t}`,{cause:s})}}async function m(e,t,r,n){try{return await t.resolve({ctx:e,credential:n})}catch(a){throw new u("auth",`API key auth failed for provider ${r}`,{cause:a})}}async function q(e,t){try{return await e.read(t)}catch(r){throw new u("auth",`Credential store read failed for ${t}`,{cause:r})}}function E(e,t){return{role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function R(e){return typeof e.result==="function"}async function _(e,t){for await(let r of t)e.push(r);e.end(R(t)?await t.result():void 0)}function y(e,t){let r=new hr;return t().then((n)=>_(r,n)).catch((n)=>{let a=E(e,n);r.push({type:"error",reason:"error",error:a}),r.end(a)}),r}function vn(e){return{stream:(t,r,n)=>y(t,async()=>(await e()).stream(t,r,n)),streamSimple:(t,r,n)=>y(t,async()=>(await e()).streamSimple(t,r,n))}}class g{entries=new Map;async read(e){let t=this.entries.get(e);return t?structuredClone(t):void 0}async write(e,t){this.entries.set(e,structuredClone(t))}async delete(e){this.entries.delete(e)}}function k(e,t){if(!e&&!t)return;let r={...e};for(let[n,a]of Object.entries(t??{})){let s=n.toLowerCase();for(let i of Object.keys(r))if(i.toLowerCase()===s)delete r[i];r[n]=a}return r}class M{providers=new Map;credentials;modelsStore;authContext;constructor(e){this.credentials=e?.credentials??new Yu,this.modelsStore=e?.modelsStore??new g,this.authContext=e?.authContext??A()}setProvider(e){this.providers.set(e.id,e)}deleteProvider(e){this.providers.delete(e)}clearProviders(){this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let r=this.providers.get(e);if(!r)return[];try{return r.getModels()}catch{return[]}}let t=[];for(let r of this.providers.values())try{t.push(...r.getModels())}catch{}return t}getModel(e,t){return this.getModels(e).find((r)=>r.id===t)}async refresh(e={}){let t=e.allowNetwork??!0,r=new Map,n=Array.from(this.providers.values()).filter((a)=>a.refreshModels!==void 0);return await Promise.all(n.map(async(a)=>{if(e.signal?.aborted)return;let s={read:()=>this.modelsStore.read(a.id),write:(c)=>this.modelsStore.write(a.id,c),delete:()=>this.modelsStore.delete(a.id)},i;try{i=await this.readCredential(a.id);let c=await this.resolveRefreshCredential(a,i,t,e.signal);if(!c)return;await a.refreshModels({credential:c,store:s,allowNetwork:t,force:e.force,signal:e.signal})}catch(c){if(!e.signal?.aborted)r.set(a.id,c instanceof Error?c:new u("model_source",`Model refresh failed for ${a.id}`,{cause:c}));try{await a.refreshModels({credential:i,store:s,allowNetwork:!1,signal:e.signal})}catch{}}})),{aborted:e.signal?.aborted??!1,errors:r}}async resolveRefreshCredential(e,t,r,n){if(t?.type==="oauth"){let c=e.auth.oauth;if(!c)return;if(!r||Date.now()<t.expires)return t;if(n?.aborted)return;let p=await this.credentials.modify(e.id,async(l)=>{if(l?.type!=="oauth"||Date.now()<l.expires)return;return c.refresh(l,n)});return p?.type==="oauth"?p:void 0}let a=e.auth.apiKey;if(!a)return;let s=t?.type==="api_key"?t:void 0,i=await a.resolve({ctx:this.authContext,credential:s});if(!i)return;return{type:"api_key",key:i.auth.apiKey,env:i.env}}async readCredential(e){try{return await this.credentials.read(e)}catch(t){throw new u("auth",`Credential store read failed for ${e}`,{cause:t})}}async checkProviderAuth(e,t){if(t?.type==="oauth")return e.auth.oauth?{source:"OAuth",type:"oauth"}:void 0;let r=e.auth.apiKey;if(!r)return;if(r.check)try{return await r.check({ctx:this.authContext,credential:t?.type==="api_key"?t:void 0})}catch(a){throw new u("auth",`API key auth check failed for provider ${e.id}`,{cause:a})}let n=await v(e,this.credentials,this.authContext);return n?{source:n.source,type:"api_key"}:void 0}async checkAuth(e){let t=this.providers.get(e);if(!t)return;return this.checkProviderAuth(t,await this.readCredential(e))}async getAvailable(e){let t=e?[this.providers.get(e)].filter((n)=>n!==void 0):this.getProviders();return(await Promise.all(t.map(async(n)=>{let a=await this.readCredential(n.id);return{provider:n,credential:a,auth:await this.checkProviderAuth(n,a)}}))).flatMap(({provider:n,credential:a,auth:s})=>{if(!s)return[];let i=n.getModels();return n.filterModels?.(i,a)??i})}async getAuth(e,t){let r=typeof e==="string"?e:e.provider,n=this.providers.get(r);if(!n)return;let a=await v(n,this.credentials,this.authContext,t);if(!a||typeof e==="string"||!e.headers)return a;return{...a,auth:{...a.auth,headers:k(a.auth.headers,e.headers)}}}async login(e,t,r){let n=this.providers.get(e);if(!n)throw new u("provider",`Unknown provider: ${e}`);let a=t==="oauth"?n.auth.oauth:n.auth.apiKey;if(!a?.login)throw new u("auth",`${n.name} does not support ${t} login`);let s=await a.login(r);try{await this.credentials.modify(e,async()=>s)}catch(i){throw new u("auth",`Credential store modify failed for ${e}`,{cause:i})}return s}async logout(e){try{await this.credentials.delete(e)}catch(t){throw new u("auth",`Credential store delete failed for ${e}`,{cause:t})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new u("provider",`Unknown provider: ${e.provider}`);return t}async applyAuth(e,t){this.requireProvider(e);let r=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env});if(!r)throw new u("auth",`Provider is not configured: ${e.provider}`);let n=r.auth,a=t?.apiKey??n.apiKey,s=k(n.headers,t?.headers);if(t?.transformHeaders)s=await t.transformHeaders(s??{});let i=r.env||t?.env?{...r.env??{},...t?.env??{}}:void 0,c=n.baseUrl?{...e,baseUrl:n.baseUrl}:e,{transformHeaders:p,...l}=t??{},o={...l,apiKey:a,headers:s,env:i};return{requestModel:c,requestOptions:o}}stream(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.stream(a,t,s)})}async complete(e,t,r){return this.stream(e,t,r).result()}streamSimple(e,t,r){return y(e,async()=>{let n=this.requireProvider(e),{requestModel:a,requestOptions:s}=await this.applyAuth(e,r);return n.streamSimple(a,t,s)})}async completeSimple(e,t,r){return this.streamSimple(e,t,r).result()}}function rA(e){return new M(e)}function Ze(e){let t=e.models,r=[],n,a=e.fetchModels,s=()=>{let o=[...t];for(let h of r){let d=o.findIndex((f)=>f.id===h.id);if(d>=0)o[d]=h;else o.push(h)}return o},i=typeof e.api.stream==="function"?e.api:void 0,c=i?void 0:e.api,p=(o)=>i??c?.[o.api],l=(o,h)=>{let d=p(o);if(!d)return y(o,async()=>{throw new u("stream",`Provider ${e.id} has no API implementation for "${o.api}"`)});return h(d)};return{id:e.id,name:e.name??e.id,baseUrl:e.baseUrl,headers:e.headers,auth:e.auth,getModels:s,refreshModels:a?(o)=>(n??=(async()=>{try{let h=await o.store.read();if(h)r=h.models.filter((f)=>f.provider===e.id).map((f)=>f);if(!o.allowNetwork||o.signal?.aborted)return;let d=await a(o);if(o.signal?.aborted)return;r=d,await o.store.write({models:d,checkedAt:Date.now()})}finally{n=void 0}})(),n):void 0,filterModels:e.filterModels,stream:(o,h,d)=>l(o,(f)=>f.stream(o,h,d)),streamSimple:(o,h,d)=>l(o,(f)=>f.streamSimple(o,h,d))}}function Vn(e,t){let r=t.input+t.cacheRead+t.cacheWrite,n=e.cost,a=-1;for(let c of e.cost.tiers??[])if(r>c.inputTokensAbove&&c.inputTokensAbove>a)n=c,a=c.inputTokensAbove;let s=t.cacheWrite1h??0,i=t.cacheWrite-s;return t.cost.input=n.input/1e6*t.input,t.cost.output=n.output/1e6*t.output,t.cost.cacheRead=n.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(n.cacheWrite*i+n.input*2*s)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost}var w=["off","minimal","low","medium","high","xhigh","max"];function T(e){if(!e.reasoning)return["off"];return w.filter((t)=>{let r=e.thinkingLevelMap?.[t];if(r===null)return!1;if(t==="xhigh"||t==="max")return r!==void 0;return!0})}function bn(e,t){let r=T(e);if(r.includes(t))return t;let n=w.indexOf(t);if(n===-1)return r[0]??"off";for(let a=n;a<w.length;a++){let s=w[a];if(r.includes(s))return s}for(let a=n-1;a>=0;a--){let s=w[a];if(r.includes(s))return s}return r[0]??"off"}
|
|
3
|
+
export{Yu,vn,rA,Ze,Vn,bn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S,M,w,L,W,a,g,ie,Rl,X,ee,We,Jn,Je,R,K,Er,B,F,Ve,Mt,bd,wd,VE,pp,Ll,Wx,N_,ms,Rk,wo,dt,ft,pt,mt,ht,gt,At,_t,Se,xe,ke,ot,Ce,re,Pt,Vt,j,Bn,An,lr,Ir,Lr,hs,Te,sm}from"./chunk-5ngftxjb.js";import"./chunk-34f64q0q.js";import"./chunk-qvp24w0q.js";import{un}from"./chunk-9405hzv2.js";import"./chunk-qm50g4n5.js";import{ba}from"./chunk-ffjdkdcv.js";import{Ps,_u,Ns,ci}from"./chunk-ajq9sxg0.js";import{hu,gu}from"./chunk-q1fzgqsv.js";import"./chunk-pq6kdp83.js";import{xa}from"./chunk-6f3zhq64.js";import{Yr}from"./chunk-d55138xx.js";import"./chunk-sz5zawfw.js";import"./chunk-c1wvs81k.js";import"./chunk-etrm28sy.js";import"./chunk-s1j4v33x.js";import"./chunk-pdw77q09.js";import"./chunk-25npafhz.js";import"./chunk-7kah3zb5.js";L();var xt=({item:t})=>{if(t.preview?.thumbnailUrl)return a("img",{src:t.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(t.preview?.proxyType==="audio"||t.proxyType==="audio")return a("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a(Ps,{className:"w-5 h-5 text-muted-foreground"})});return a("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:a(Er,{className:"w-5 h-5 text-muted-foreground"})})},Me=({projectId:t,currentAssetId:n,parentFolderId:v,initialFiles:f,initialNextCursor:b,isLoading:s=!1})=>{let{ref:N,inView:C}=Vt({threshold:0,rootMargin:"200px"}),D=M(null),i=M(!0),[d,p]=w(f),[E,z]=w(b),[O,H]=w(!!b),[u,G]=w(!1);return S(()=>{p(f),z(b),H(!!b),i.current=!0},[f,b]),S(()=>{(async()=>{if(!E||u||!C||!O)return;G(!0);try{let m=await R.api.folders[":folderId"].search.$post({param:{folderId:v},json:{assetType:"file",after:E,first:200,recursively:!1,conditions:[]}});if(!m.ok)throw Error("Failed to fetch next page");let V=await m.json(),P=V.data||[];p((J)=>[...J,...P]),z(V.pageInfo?.cursor||void 0),H(!!V.pageInfo?.cursor&&P.length>0)}catch(m){console.error("Error fetching next page:",m)}finally{G(!1)}})()},[C,E,O,u,v]),S(()=>{if(d.some((m)=>m?.id===n)&&D.current)if(i.current)D.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),i.current=!1;else D.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[d,n]),a("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:g("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[s&&d.length===0?Array.from({length:6}).map((c,m)=>a(Te,{className:"w-[52px] h-[52px] rounded-lg shrink-0","data-testid":"carousel-skeleton-item"},m)):d.map((c)=>{if(!c)return null;let m=c.id===n;return a("div",{ref:c.id===n?D:null,className:"flex-shrink-0",children:g(Jn,{to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:c.id},search:{version:void 0},className:B("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative",m?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:[a(xt,{item:c}),c.agent&&a("span",{className:"absolute top-1 right-1 z-10 pointer-events-none select-none rounded bg-black/60 px-1 py-0.5 text-[10px] font-medium leading-none text-white",title:c.agent.name,"data-testid":"carousel-agent-badge",children:"AI"})]})},c.id)}),!s&&O&&a("div",{ref:N,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:u&&a(K,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};L();function jt(){let{projectId:t,fileId:n}=Ne.useParams(),v=Ne.useSearch(),{version:f,start:b}=v,s=f||n,{cmpLeft:N,cmpRight:C}=v,D=v.cmpActive??"left",i=!!v.compare&&!!N&&!!C,d=M(null),{teamId:p,ensureTeamIdForProject:E}=Pt(),[z,O]=w(360),[H,u]=w([]),{fileViewRightSidebarCollapsed:G}=lr(),{isChatbotOpen:c}=Ir(),m=Lr((e)=>Boolean(e.metadata["appearance.hideAgent"])),[V,P]=w(0),[J,T]=w(null),[pe,Le]=w(null),[Ee,ge]=w(void 0),[Q,he]=w({show:!0,files:[],nextCursor:void 0,folderId:void 0}),[Pe,oe]=w(!0),qe=R.api.files[":fileId"].metadata.$patch,{mutate:_e}=ee({mutationFn:async(e)=>{let o=await qe(e);if(!o.ok)throw Error("Failed to patch metadata");return await o.json()}}),U=ie(),{members:Ke,fetchProjectMembers:Ie}=An(),Oe=hs();S(()=>{E(t)},[t,E]),S(()=>{if(t)Ie(t,!0)},[t,Ie]),S(()=>{if(t&&n)R.api.projects[":projectId"].recents.view.$post({param:{projectId:t},json:{assetId:n}}).catch(()=>{})},[t,n]);let{data:ye,isLoading:He,isError:Qe,isFetching:Be}=X({queryKey:["files",n],queryFn:async()=>{let e=await R.api.files[":fileId"].$get({param:{fileId:n}});if(!e.ok)throw Error("Failed to fetch stack");return await e.json()},enabled:!!p,placeholderData:Rl}),{data:Ue,isLoading:ze,isError:Ge,isFetching:Xe}=X({queryKey:["files",f],queryFn:async()=>{let e=await R.api.files[":fileId"].$get({param:{fileId:f}});if(!e.ok)throw Error("Failed to fetch version");return await e.json()},enabled:!!p&&!!f,placeholderData:Rl}),{data:Ye}=X({queryKey:["version_stacks",n,"versions"],queryFn:async()=>{let e=await R.api.version_stacks[":stackId"].versions.$get({param:{stackId:n}});if(!e.ok)throw Error("Failed to fetch versions");return await e.json()},enabled:!!t&&!!n&&(!!f||i)}),{data:A}=X({queryKey:["projects",t],queryFn:async()=>{let e=await R.api.projects[":projectId"].$get({param:{projectId:t}});if(!e.ok)throw Error("Failed to fetch project");return await e.json()}}),h=We(),{setProjectState:ve,clearProjectState:we}=Bn(),Ze=He||!!f&&ze,et=Qe||!!f&&Ge,tt=Be||!!f&&Xe,r=Ue||ye,k=f?Ye:ye?.versionStack?.versions,l=r?.ancestorFolders?.[0]?.id??A?.rootFolder??"",[ne,Y]=w(!1),[Z,Fe]=w(""),se=M(null),ae=M(!1),[nt,le]=w(!1),rt=R.api.files[":fileId"].$put,{mutate:st,mutateAsync:it,isPending:be}=ee({mutationFn:async(e)=>{let o=await rt(e);if(!o.ok)throw Error("Failed to rename file");return await o.json()},onSuccess:()=>{U.invalidateQueries({queryKey:["files"]}),U.invalidateQueries({queryKey:["version_stacks"]}),j.success(Rk?.()||"Renamed successfully"),Y(!1)},onError:()=>{j.error(Wx?.()||"Failed to rename")}}),at=R.api.files.$delete,{mutate:lt,mutateAsync:ct,isPending:Ae}=ee({mutationFn:async(e)=>{if(!(await at(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(U.invalidateQueries({queryKey:["files"]}),U.invalidateQueries({queryKey:["version_stacks"]}),j.success(VE?.()||"Deleted"),le(!1),l&&l!==A?.rootFolder)h({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:l}});else h({to:"/projects/$projectId",params:{projectId:t}})},onError:()=>{j.error(Ll?.()||"Failed to delete")}}),ut=(e)=>{if(e?.preventDefault(),!Z.trim()||!s)return;st({param:{fileId:s},json:{name:Z.trim()}})},It=()=>{if(!s)return;lt({json:{ids:[s]}})};S(()=>{if(r&&A&&p)ve({teamId:p,projectId:t,projectName:A.name??"",ancestorFolders:r.ancestorFolders??[],currentAsset:{id:s||n,name:r.name,type:"file",version:k?k.find((e)=>e.id===s)?.version??k.length:void 0,proxyType:r.proxyType},isRootFolder:!1,fileId:n,downloadInfo:{originalKey:r.media?.original?.key,videoTranscodes:r.media?.videoTranscodes?.map((e)=>({key:e.key,width:e.width,height:e.height,resolution:e.resolution,hdr:e.hdr}))},versions:k,compareMode:i,canCompareVersions:(k?.length??0)>=2,onCompareVersions:()=>{let e=_u(k);if(!e)return;h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,version:void 0,compare:!0,cmpLeft:e.left.id,cmpRight:e.right.id,cmpActive:"left"})})},onFolderClick:(e)=>{h({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:e}})},onRename:()=>{ae.current=!1,Fe(r?.name??""),Y(!0)},onDelete:()=>{le(!0)}});return()=>we()},[p,t,A,r,k,s,n,i,ve,we,h]),S(()=>{if(!ne)return;let e=setTimeout(()=>{ae.current=!0},1000);return()=>clearTimeout(e)},[ne]);let yt=()=>{if(ae.current)return;setTimeout(()=>{if(se.current)ci(se.current)},0)};if(S(()=>{if(!l||!s)return;if(Q.folderId===l){oe(!1);return}oe(!0);let e=!0;return(async()=>{try{let I="",y=!1,x=[],ce=void 0;for(let fe=0;fe<5;fe++){let ue=await R.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:I,first:200,recursively:!1,conditions:[]}});if(!ue.ok)throw Error("Failed to search parent folder for carousel");let _=await ue.json(),me=_.data||[];if(x.push(...me),me.some((te)=>te.id===s)){if(y=!0,ce=_.pageInfo?.cursor||void 0,_.pageInfo?.cursor)try{let te=await R.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:_.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(te.ok){let $e=await te.json(),bt=$e.data||[];x.push(...bt),ce=$e.pageInfo?.cursor||void 0}}catch{}break}if(!_.pageInfo?.cursor||me.length<200)break;I=_.pageInfo.cursor}if(e)he({show:!0,files:y?x:r?[r]:[],nextCursor:y?ce:void 0,folderId:l})}catch(I){if(console.error(I),e)he({show:!0,files:r?[r]:[],nextCursor:void 0,folderId:l})}finally{if(e)oe(!1)}})(),()=>{e=!1}},[l,s,Q.folderId,r]),S(()=>{P(0),T(null),u([])},[r?.id]),S(()=>{T(null),u([])},[pe?.id]),S(()=>{un.getState().reset(),un.getState().setIsDrawing(!1),u([]),T(null)},[s]),Ze&&!r)return a(sm,{});if(et||!r||!A||!p)return a("div",{children:N_()});let q=i?pe:r,je=q?.id??s,De=(e,o)=>{if(!p)return;_e({param:{fileId:je},json:[{key:e,value:o}]},{onSuccess:()=>{U.invalidateQueries({queryKey:["files",je]})}})},de=(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,...e})})},vt=()=>{de({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:D==="left"?N:C})},wt=(e)=>{T(e.id||null);let o=e.annotations;if(o&&o.length>0)u(o);else u([]);if(i){if(e.second!==null&&e.second!==void 0)ge({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)d.current?.seekTo(e.second),d.current?.pause();else if(o&&o.length>0)d.current?.pause()},Ft=(e)=>{T(e.id||null);let I=e.details,y=I?.annotations;if(y&&y.length>0)u(y);else u([]);let x=I?.position?.type==="time"?I.position.seconds:I?.position?.type==="page"?I.position.page:void 0;if(i){if(x!==void 0)ge({second:x,nonce:Date.now()});return}if(x!==void 0)d.current?.seekTo(x),d.current?.pause();else if(y&&y.length>0)d.current?.pause()},Re=()=>{u([]),T(null)},kt=()=>{u([]),T(null)};if(Oe&&!i)return a(hu,{projectId:t,teamId:p,fileId:n,file:r,projectInfo:A,ancestorFolders:r.ancestorFolders??[],parentFolderId:l,versions:k,activeFileId:s,startTime:b,siblingFiles:Q.files,onNavigateToFile:(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:e}})},onNavigateBack:()=>{if(l&&l!==A?.rootFolder)h({to:"/projects/$projectId/folders/$folderId",params:{projectId:t,folderId:l}});else h({to:"/projects/$projectId",params:{projectId:t}})},onSelectVersion:(e)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:t,fileId:n},search:(o)=>({...o,version:e})})},onRenameFile:async(e)=>{await it({param:{fileId:s},json:{name:e}})},onDeleteFile:async()=>{await ct({json:{ids:[s]}})},onSaveField:De});return g("div",{className:"h-full flex flex-1 flex-col bg-background",children:[g("div",{className:"h-full flex flex-1 overflow-hidden",children:[g("div",{className:"flex-1 relative",children:[tt&&!i&&a("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:a(K,{className:"h-8 w-8 animate-spin text-foreground"})}),i&&N&&C?a(gu,{versions:k??[],leftId:N,rightId:C,activeSide:D,annotations:H,seekRequest:Ee,onActiveSideChange:(e)=>de({cmpActive:e}),onSwitchVersion:(e,o)=>de(e==="left"?{cmpLeft:o}:{cmpRight:o}),onExit:vt,onActiveAssetChange:Le,onPlay:Re,onTimeUpdate:P}):a(Ns,{file:r,mediaControllerRef:d,onPlay:Re,onTimeUpdate:P,onSeek:kt,annotations:H,startTime:b,children:a(Me,{projectId:t,currentAssetId:s,parentFolderId:l,initialFiles:Q.files,initialNextCursor:Q.nextCursor,isLoading:Pe})})]}),(!G||c&&!m)&&g(W,{children:[a(Yr,{onResize:(e)=>{O((o)=>Math.max(300,Math.min(600,o-e)))},className:"hidden md:block"}),a("div",{style:{width:z},className:"flex-shrink-0 bg-background flex flex-col",children:c&&!m?a(ba,{projectId:t,contextAssetId:s,file:q,currentTime:V,frameRate:q?.media?.metadata?.frameRate||30,startTimecode:q?.media?.metadata?.startTimecode,onTyping:()=>{if(i)return;d.current?.pause()},onSelectMessage:Ft,selectedMessageId:J}):a(xa,{teamId:p,projectId:t,file:q,onSaveField:De,members:Ke,onCommentSelect:wt,currentTime:V,onTyping:()=>{if(i)return;d.current?.pause()},selectedCommentId:J,hideAnnotationControl:q?.proxyType==="audio"})})]})]}),a(Se,{open:ne,onOpenChange:Y,children:a(xe,{children:g("form",{onSubmit:ut,children:[a(ke,{children:a(Ce,{children:ms()})}),a("div",{className:"py-4",children:a(re,{ref:se,value:Z,onChange:(e)=>Fe(e.target.value),placeholder:pp?.()||"Enter new name",onFocus:yt,autoFocus:!0})}),g(ot,{children:[a(F,{type:"button",variant:"outline",onClick:()=>Y(!1),children:Ve()}),g(F,{type:"submit",disabled:be||!Z.trim(),children:[be&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),wo()]})]})]})})}),a(dt,{open:nt,onOpenChange:le,children:g(ft,{children:[g(pt,{children:[a(ht,{children:wd?.()||"Delete Asset?"}),a(gt,{children:bd?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),g(mt,{children:[a(_t,{children:Ve()}),g(At,{onClick:It,disabled:Ae,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[Ae&&a(K,{className:"mr-2 h-4 w-4 animate-spin"}),Mt()]})]})]})})]})}var Ne=Je("/projects/$projectId/files/$fileId")({component:jt});export{Ne as Route};
|