@shumai-one/shumai 0.5.0 → 0.5.2

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.
Files changed (164) hide show
  1. package/bin/{chunk-h82r29wm.js → chunk-04avc4fn.js} +49 -49
  2. package/bin/chunk-0asthrjf.js +2 -0
  3. package/bin/chunk-0ge2mm8j.js +1 -0
  4. package/bin/{chunk-3z20b2hz.js → chunk-0j22699g.js} +2 -2
  5. package/bin/{chunk-j909v9p5.js → chunk-0v9srsdz.js} +1 -1
  6. package/bin/{chunk-exgtwask.js → chunk-0y4zq3y4.js} +1 -1
  7. package/bin/{chunk-5yd9cv7f.js → chunk-15vsw36h.js} +5 -5
  8. package/bin/{chunk-eez1yncf.js → chunk-15w79661.js} +2 -2
  9. package/bin/{chunk-xvdd04gy.js → chunk-19jpn3r6.js} +1 -1
  10. package/bin/{chunk-grsgkkrb.js → chunk-19q13a80.js} +6 -6
  11. package/bin/{chunk-r6gkv98n.js → chunk-1nvj833s.js} +6 -6
  12. package/bin/chunk-23780yj6.js +3 -0
  13. package/bin/chunk-2gf95tj0.js +1 -0
  14. package/bin/{chunk-6vvs18bw.js → chunk-2pw7xcrn.js} +1 -1
  15. package/bin/chunk-2tk5w3jc.js +1 -0
  16. package/bin/chunk-2w6gve12.js +4 -0
  17. package/bin/chunk-301e7g3z.js +2 -0
  18. package/bin/chunk-3kmjbc3m.js +2 -0
  19. package/bin/{chunk-zhe16jvg.js → chunk-3pm6q6kg.js} +1 -1
  20. package/bin/{chunk-zfqz72sd.js → chunk-3q5qkfkc.js} +1 -1
  21. package/bin/chunk-3td60k1m.js +2 -0
  22. package/bin/chunk-42hrvk6k.js +211 -0
  23. package/bin/chunk-4zksqvwj.js +2 -0
  24. package/bin/chunk-5bk16qdp.js +2 -0
  25. package/bin/{chunk-y03z5rrg.js → chunk-5nqvqvqp.js} +3 -3
  26. package/bin/{chunk-e3r1m6rb.js → chunk-5rzxekn4.js} +1 -1
  27. package/bin/{chunk-h9x81yp6.js → chunk-5vqbzsjv.js} +1 -1
  28. package/bin/{chunk-628k58ek.js → chunk-6hzktewz.js} +2 -2
  29. package/bin/{chunk-yfe6hkzk.js → chunk-6jkjx0n2.js} +3 -3
  30. package/bin/{chunk-gy8z8sd7.js → chunk-6rn094yj.js} +1 -1
  31. package/bin/{chunk-3cvbb6kh.js → chunk-7qvvf0yd.js} +2 -2
  32. package/bin/{chunk-35mpp84e.js → chunk-81dawvn4.js} +2 -2
  33. package/bin/chunk-8abhmarc.js +2 -0
  34. package/bin/{chunk-51h2bgpf.js → chunk-8ayz61rc.js} +3 -3
  35. package/bin/{chunk-03bfjh8k.js → chunk-8ny7wvzb.js} +2 -2
  36. package/bin/{chunk-3btc8a0p.js → chunk-8tzfcqtb.js} +2 -2
  37. package/bin/{chunk-5patxztz.js → chunk-8zgq5sav.js} +3 -3
  38. package/bin/{chunk-m1xc3t0p.js → chunk-93p27bbm.js} +6 -6
  39. package/bin/chunk-951r2rx1.js +1 -0
  40. package/bin/chunk-965102pf.js +3 -0
  41. package/bin/{chunk-hr2027z3.js → chunk-98mg3dpd.js} +8 -8
  42. package/bin/{chunk-v42jcex0.js → chunk-9bakwac0.js} +4 -4
  43. package/bin/{chunk-z8mmqfm4.js → chunk-9ggwc289.js} +1 -1
  44. package/bin/{chunk-6bgbx563.js → chunk-9zgqjdx1.js} +2 -2
  45. package/bin/{chunk-kzsdp31a.js → chunk-a8bymrv1.js} +2 -2
  46. package/bin/chunk-acn3r2m2.js +1 -0
  47. package/bin/{chunk-z1r86fna.js → chunk-ae6zgjhd.js} +2 -2
  48. package/bin/{chunk-trndqdaa.js → chunk-asy868kq.js} +1 -1
  49. package/bin/{chunk-r1m4q8vw.js → chunk-b5r0be06.js} +2 -2
  50. package/bin/{chunk-dz33q4v1.js → chunk-bbcmhcvc.js} +2 -2
  51. package/bin/{chunk-myd3wg9a.js → chunk-bpxw19ez.js} +1 -1
  52. package/bin/{chunk-sg7n2g3z.js → chunk-cdk8vqeg.js} +4 -4
  53. package/bin/chunk-ce0bhc72.js +2 -0
  54. package/bin/chunk-ce75dw3k.css +1 -0
  55. package/bin/{chunk-m7dp8rqv.js → chunk-cpj562n6.js} +1 -1
  56. package/bin/{chunk-h153xefb.js → chunk-cx32wsa1.js} +1 -1
  57. package/bin/{chunk-r5rpdhed.js → chunk-d2dgazjj.js} +1 -1
  58. package/bin/{chunk-3zvvct3r.js → chunk-d5hbzp7t.js} +1 -1
  59. package/bin/chunk-d9qpgkek.js +2 -0
  60. package/bin/{chunk-9h6nn1a3.js → chunk-dche0gy0.js} +1 -1
  61. package/bin/{chunk-zcrtr8qd.js → chunk-dppfek34.js} +2 -2
  62. package/bin/chunk-dv6p6n5e.js +1 -0
  63. package/bin/{chunk-hx76pje1.js → chunk-e439kt05.js} +1 -1
  64. package/bin/{chunk-gptzcgte.js → chunk-eqr0znmc.js} +1 -1
  65. package/bin/{chunk-q5mkbnr9.js → chunk-f5z3096k.js} +2 -2
  66. package/bin/{chunk-b9j5575n.js → chunk-ffj9cq9y.js} +2 -2
  67. package/bin/{chunk-80qz30dc.js → chunk-fxg81vtx.js} +2 -2
  68. package/bin/{chunk-5jbx9gqe.js → chunk-ggfx2b0f.js} +1 -1
  69. package/bin/chunk-gnt9gewm.js +2 -0
  70. package/bin/{chunk-czny5thj.js → chunk-grjek810.js} +2 -2
  71. package/bin/chunk-gvas3xkp.js +2 -0
  72. package/bin/{chunk-ghjhyajn.js → chunk-j53sjkxt.js} +2 -2
  73. package/bin/{chunk-0tf15vee.js → chunk-jgfye6nf.js} +2 -2
  74. package/bin/{chunk-tcat7q9p.js → chunk-jt6v15wx.js} +2 -2
  75. package/bin/{chunk-rn9rktp4.js → chunk-k3prp6c6.js} +4 -4
  76. package/bin/{chunk-mqr096rn.js → chunk-k97axrc4.js} +1 -1
  77. package/bin/{chunk-20anqpf1.js → chunk-kvwec0p3.js} +2 -2
  78. package/bin/{chunk-vbbn4hth.js → chunk-kzr6ecke.js} +1 -1
  79. package/bin/{chunk-rkq6jvhb.js → chunk-m6v8vt2b.js} +2 -2
  80. package/bin/{chunk-32japja5.js → chunk-mn108p93.js} +1 -1
  81. package/bin/{chunk-31vx01aw.js → chunk-mn208vrv.js} +2 -2
  82. package/bin/chunk-mneeg71d.js +2 -0
  83. package/bin/{chunk-d7mgjqf8.js → chunk-n76w2wcr.js} +1 -1
  84. package/bin/{chunk-fyssg02c.js → chunk-n9vp9nbg.js} +29 -29
  85. package/bin/{chunk-2g5qdx4s.js → chunk-p0j4wpa5.js} +2 -2
  86. package/bin/chunk-qb178ntp.js +2 -0
  87. package/bin/{chunk-7vd5yajk.js → chunk-qmrg2jhs.js} +7 -7
  88. package/bin/{chunk-d9btz95y.js → chunk-qxscgcn9.js} +2 -2
  89. package/bin/{chunk-0vtk7wrf.js → chunk-r249n1xe.js} +2 -2
  90. package/bin/{chunk-36r20sj7.js → chunk-r776bhsg.js} +1 -1
  91. package/bin/{chunk-1k16xsqq.js → chunk-rmvhyqyb.js} +6 -6
  92. package/bin/{chunk-zwb9kamp.js → chunk-rtaya5wc.js} +2 -2
  93. package/bin/chunk-rw5h0n0s.js +1 -0
  94. package/bin/{chunk-m9sp00a9.js → chunk-ryepy5er.js} +4 -4
  95. package/bin/{chunk-mcd7zas7.js → chunk-rza95y4z.js} +2 -2
  96. package/bin/chunk-s4r6e6ms.js +1 -0
  97. package/bin/{chunk-qgkbxw1k.js → chunk-sbyyn9yw.js} +2 -2
  98. package/bin/chunk-syjjke3f.js +1 -0
  99. package/bin/chunk-t1yamxgk.js +2 -0
  100. package/bin/chunk-tgfxe0sb.js +1 -0
  101. package/bin/chunk-tjretpx8.js +1 -0
  102. package/bin/chunk-tvkekn4z.js +1 -0
  103. package/bin/{chunk-5t05jpna.js → chunk-twpc640e.js} +1 -1
  104. package/bin/{chunk-p5v22g5n.js → chunk-v034sfw8.js} +2 -2
  105. package/bin/{chunk-wydd7sz7.js → chunk-v5hz09a1.js} +2 -2
  106. package/bin/{chunk-j3xaq9s3.js → chunk-vm2pz2hm.js} +2 -2
  107. package/bin/{chunk-mt532a33.js → chunk-vzdgsfkf.js} +1 -1
  108. package/bin/chunk-w4yjgez6.js +14 -0
  109. package/bin/{chunk-0yv0nnmh.js → chunk-w73v578p.js} +2 -2
  110. package/bin/{chunk-edjtb7pk.js → chunk-w9z27p0m.js} +2 -2
  111. package/bin/chunk-wjcebkpb.js +1 -0
  112. package/bin/{chunk-cw8z9w5c.js → chunk-wnqxyqrg.js} +2 -2
  113. package/bin/chunk-ws71fg50.js +2 -0
  114. package/bin/{chunk-g8h1e1kh.js → chunk-wwkhskce.js} +2 -2
  115. package/bin/{chunk-kgfa5y9w.js → chunk-xr2v0d6y.js} +5 -5
  116. package/bin/{chunk-wkxm6yny.js → chunk-y2dhf3p0.js} +2 -2
  117. package/bin/chunk-yfp3q4da.js +1 -0
  118. package/bin/{chunk-f22nrm6r.js → chunk-ypkkfwfb.js} +4 -4
  119. package/bin/chunk-z8e4wc59.js +1 -0
  120. package/bin/{chunk-fhq5m9ya.js → chunk-zckxc8m6.js} +2 -2
  121. package/bin/{chunk-3fjgf7eb.js → chunk-zdzkjp4q.js} +2 -2
  122. package/bin/chunk-zf5cyxnt.js +2 -0
  123. package/bin/shumai-app.html +1 -1
  124. package/bin/shumai-app.js +402 -397
  125. package/package.json +7 -7
  126. package/prisma/migrations/20261008134859_add_transcode_3d/migration.sql +2 -0
  127. package/prisma/schema.prisma +1 -0
  128. package/bin/chunk-12npypek.js +0 -2
  129. package/bin/chunk-13d525jm.js +0 -2
  130. package/bin/chunk-1yt1gsyy.js +0 -2
  131. package/bin/chunk-3ewmtf1c.js +0 -1
  132. package/bin/chunk-3xw70yr4.js +0 -2
  133. package/bin/chunk-5seey9ee.js +0 -2
  134. package/bin/chunk-66hdwm6f.js +0 -2
  135. package/bin/chunk-756mr32b.js +0 -2
  136. package/bin/chunk-7wb3dga5.js +0 -2
  137. package/bin/chunk-9k86d2a3.js +0 -4
  138. package/bin/chunk-9wk11jtz.js +0 -1
  139. package/bin/chunk-a1crhhzy.js +0 -1
  140. package/bin/chunk-axfwh5et.js +0 -2
  141. package/bin/chunk-cgsxyw07.js +0 -2
  142. package/bin/chunk-dckdnqc0.js +0 -2
  143. package/bin/chunk-dx0wz749.js +0 -211
  144. package/bin/chunk-dz4fdrmk.js +0 -1
  145. package/bin/chunk-hz9stgvn.js +0 -1
  146. package/bin/chunk-hzr8100w.js +0 -3
  147. package/bin/chunk-jb6d142z.js +0 -1
  148. package/bin/chunk-k9cgfzgk.js +0 -3
  149. package/bin/chunk-meyvvmgk.js +0 -1
  150. package/bin/chunk-n1b3pt17.js +0 -14
  151. package/bin/chunk-n5v48hz5.js +0 -2
  152. package/bin/chunk-phzemmmy.js +0 -2
  153. package/bin/chunk-qhzat67w.js +0 -2
  154. package/bin/chunk-smcn7ep7.js +0 -2
  155. package/bin/chunk-tf8q7h6b.js +0 -1
  156. package/bin/chunk-tvr5rm1g.js +0 -1
  157. package/bin/chunk-ty88m3yg.js +0 -2
  158. package/bin/chunk-v2x9915x.js +0 -1
  159. package/bin/chunk-vnk2p7mq.css +0 -1
  160. package/bin/chunk-x8hky9td.js +0 -1
  161. package/bin/chunk-y12ah7c6.js +0 -1
  162. package/bin/chunk-y7jz31ay.js +0 -1
  163. package/bin/chunk-ydk3edsw.js +0 -1
  164. package/bin/chunk-zbma2zeh.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{m,_,u,S,L,t,o,V,B,A,O,Kr,ve,Et,ht,Us,de,C,ge,Ae,_e,K,De,na,lh,ct,jc,qc,yh,Eb,Cb,Zh,Bh,Uh,ap,lp,cp,up,El,hg,pp,mp,Cg,Ig,Mp,Kg,mA,$p,p1,Kp,Wp,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,Ot,Nt,M,Jr,bn,UA}from"./chunk-42hrvk6k.js";import{lu,cu,uu,du,fu}from"./chunk-w4yjgez6.js";import{Uo}from"./chunk-04avc4fn.js";import{uo}from"./chunk-qxscgcn9.js";S();var Se=[];function $l({teamId:r,projectId:D,assetId:p,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:w,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:$e,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:y,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:b,isRecentlyDeleted:x=!1,isRecents:k=!1,isLoading:se=!1,isShareView:q=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=V(),{canEdit:N,canAdmin:We}=Ot(D),ne=_(null),ce=_(null),[W,je]=u(!0),[j,Qe]=u(!0),[He,F]=u(!1),[I,me]=u(""),[Ke,Q]=u(!1),fe=Me??a.length,he=Re??l.length,we=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),ye=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=we>-1,Pe=ye>-1,be=(e,s)=>{if(s)return e===1?lp({count:e}):ap({count:e});else return e===1?up({count:e}):cp({count:e})},{editingItemId:xe,setEditingItemId:ke,handleAction:Ce,onRenameSubmit:Ne,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Je,isDownloadDialogOpen:Ye,setIsDownloadDialogOpen:H,isLoadingLinks:T,resolvedFiles:Fe,startDownload:Ze}=fu({teamId:r,projectId:D,assetId:p,folders:a,files:l,selectedIds:w,isPublic:ie,shareId:Oe}),{ref:at,inView:Ie}=Nt();m(()=>{if(Ie){if(ee&&!y)Z();else if(oe&&!b)te()}},[Ie,ee,y,oe,b,Z,te]);let lt=bn((e)=>e.startTask),dt=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=B({mutationFn:async(e)=>{let s=await dt(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let f=n?.files||[],g=f.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),R=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||R?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),h=f.filter((i)=>!i.file.name.startsWith(".")),E=h.length===1?h[0].file.name:`${h.length} Items`;if(e.taskId)lt(e.taskId,E,g);d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await cu({files:f,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,p]})}}),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],f=new Map;for(let g of e){let h=(g.webkitRelativePath||g.name).split("/");if(h.some((U)=>U.startsWith(".")))continue;let E=h.pop(),i=n,v="";for(let U of h)if(v=`${v}/${U}`,!f.has(v)){let G=[],wt={name:U,type:"folder",id:Uo(),children:G,size:0};i.push(wt),f.set(v,G),i=G}else i=f.get(v);let R={file:g,id:Uo()};s.push(R);let c=g.type;if(E.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:E,size:g.size,type:"file",id:R.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:p,files:n}})},pt=A.api.folders.$post,{mutate:ut,isPending:Ee}=B({mutationFn:async(e)=>{let s=await pt({json:{name:e,parentId:p}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{M.success(El()),F(!1),me(""),d.invalidateQueries({queryKey:["search",r,p]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{M.error(`Error: ${e.message}`)}}),{mutate:ft,isPending:P}=B({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:D}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{M.success(p1()),d.invalidateQueries({queryKey:["projects",D,"recently-deleted"]}),$e(),Q(!1)},onError:(e)=>{M.error(`Error: ${e.message}`)}}),gt=(e)=>{if(e.preventDefault(),!I.trim())return;ut(I.trim())},vt=!se&&a.length===0&&l.length===0&&!y&&!b;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[N&&o(L,{children:[t("input",{type:"file",ref:ne,multiple:!0,className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}}),t("input",{type:"file",ref:ce,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),x&&o("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted/20 border-b border-border text-sm shrink-0",children:[o("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t(Kr,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:Mp()})]}),We&&t(C,{variant:"destructive",size:"sm",disabled:P||a.length===0&&l.length===0,onClick:()=>Q(!0),className:"h-7 px-2.5 text-xs font-medium bg-destructive/10 text-destructive border border-destructive/20 hover:bg-destructive hover:text-destructive-foreground",children:"Delete"})]}),o("div",{className:"flex-1 overflow-y-auto min-h-0 p-3 pb-24",children:[se&&a.length===0&&l.length===0?t(UA,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[fe>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!W),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[W?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(fe,!1),Le?` • ${Jr(we)}`:""]})]}),W&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(du,{item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]}),he>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>Qe(!j),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[j?t(ve,{className:"h-4 w-4"}):t(Et,{className:"h-4 w-4"}),o("span",{children:[be(he,!0),Pe?` • ${Jr(ye)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(uu,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:w.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>Ne(e,s),onFinishEditing:()=>ke(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>Ce(s,n),isRecentlyDeleted:x,isRecents:k,selectedCount:w.size,canEdit:N,isShareView:q,allowDownload:re},e.id))})]})]}),vt&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:k?o("div",{className:"flex flex-col items-center gap-2",children:[t(Us,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:pp()}),t("p",{className:"text-xs text-muted-foreground",children:mp()})]}):t("span",{children:$p()})}),t("div",{ref:at,className:"py-4 flex justify-center items-center min-h-6",children:(y||b)&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),N&&!x&&!k&&!q&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{size:"icon",className:"h-14 w-14 rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/25 hover:bg-primary/90 flex items-center justify-center","aria-label":"Actions",children:t(de,{className:"h-6 w-6"})})}),o(_e,{align:"end",side:"top",className:"w-48 mb-2",children:[o(K,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Kp()})]}),o(K,{onClick:()=>ce.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(uo,{className:"h-4 w-4"}),t("span",{children:Wp()})]}),o(K,{onClick:()=>F(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(lu,{className:"h-4 w-4"}),t("span",{children:El()})]})]})]})}),t(ue,{open:He,onOpenChange:F,children:t(ae,{className:"sm:max-w-md",children:o("form",{onSubmit:gt,children:[o(pe,{children:[t(le,{children:El()}),t(Mt,{children:Bh()})]}),t("div",{className:"py-4",children:t(z,{autoFocus:!0,placeholder:Bh(),value:I,onChange:(e)=>me(e.target.value)})}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:()=>F(!1),children:De()}),o(C,{type:"submit",disabled:!I.trim()||Ee,children:[Ee?t(O,{className:"h-4 w-4 animate-spin mr-2"}):null,na()]})]})]})})}),t(Xe,{open:Ve,onOpenChange:Ge,children:o(et,{children:[o(tt,{children:[t(nt,{children:qc()}),t(ot,{children:jc()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:()=>Je(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ct()})]})]})}),t(Xe,{open:Ke,onOpenChange:Q,children:o(et,{children:[o(tt,{children:[t(nt,{children:Cb()}),t(ot,{children:Eb()})]}),o(rt,{children:[t(it,{children:De()}),t(st,{onClick:(e)=>{e.preventDefault(),ft()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:P,children:P?"Deleting...":ct()})]})]})}),t(ue,{open:Ye,onOpenChange:H,children:o(ae,{className:"sm:max-w-md",children:[o(pe,{children:[t(le,{children:T?Cg():lh()}),t(Mt,{children:T?Kg():Zh()})]}),T?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(O,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:Ig()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:yh({count:Fe.length})}),o("div",{className:"flex items-start gap-3 p-3 text-sm rounded-lg bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 border border-amber-200 dark:border-amber-900/30",children:[t(Kr,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:hg()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:Uh()})]})]})]}),t(qe,{children:!T?o(L,{children:[t(C,{variant:"outline",onClick:()=>H(!1),children:De()}),o(C,{onClick:Ze,className:"gap-2",disabled:Fe.length===0,children:[t(ht,{className:"h-4 w-4"}),mA()]})]}):t(C,{variant:"outline",onClick:()=>H(!1),children:De()})})]})})]})}
2
+ export{$l};
@@ -0,0 +1 @@
1
+ import{m,D,u,S,L,t,o,V,Z,B,mt,ze,A,I,or,O,Kr,Tt,jn,on,Et,ka,rr,js,xo,de,So,we,Ne,E,C,Ce,Ie,Te,ge,Ae,_e,K,Ym,nh,De,B_,$_,Uc,by,vy,Ff,ct,Qy,Ky,sb,ib,gd,gb,bh,Mn,$v,Gv,Vv,Qv,Kv,Wv,Yv,xd,zw,Wx,dg,yS,RS,Eg,Vg,Gs,zd,Op,jd,hA,qp,NT,DT,gA,AA,_A,yA,bA,Hd,vA,UT,_s,Xe,et,tt,rt,nt,ot,st,it,ue,ae,pe,qe,le,Mt,z,ce,es,Dr,yn,Vn,bs,Or,Qd,Nt,M,xe,Ar,Qe,zr,wi,LA,io,tm,aa,la,Si,W,Me,Le,Ze,Be,Ue,ne,Ei,Xd,ef,tf,nf}from"./chunk-42hrvk6k.js";import{$a}from"./chunk-r249n1xe.js";import{Kn,co}from"./chunk-8tzfcqtb.js";import{fn}from"./chunk-grjek810.js";S();var Ye=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ye=I("pen",Ye);function Se({scope:e,onScopeChange:r,selectedGoal:v,onClearGoal:f,onCreateTask:w,canCreateTask:h=!0}){return o("header",{className:"h-14 border-b border-border bg-card/60 backdrop-blur-sm px-4 flex items-center justify-between gap-3 shrink-0 select-none",children:[o("div",{className:"flex items-center gap-3 min-w-0",children:[o("div",{className:"flex items-center bg-muted/60 p-0.5 rounded-lg border border-border/50",children:[o(C,{variant:e==="team"?"secondary":"ghost",size:"sm",onClick:()=>r("team"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="team"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[t(co,{className:"w-3.5 h-3.5"}),t("span",{children:UT()})]}),o(C,{variant:e==="my"?"secondary":"ghost",size:"sm",onClick:()=>r("my"),className:`h-7 px-2.5 text-xs font-medium gap-1.5 transition-all ${e==="my"?"bg-background text-foreground shadow-xs":"text-muted-foreground hover:text-foreground"}`,children:[t(Kn,{className:"w-3.5 h-3.5"}),t("span",{children:Wx()})]})]}),v&&o("div",{className:"hidden sm:flex items-center gap-1.5 px-2 py-1 rounded-md bg-sidebar-accent border border-sidebar-border text-xs text-sidebar-accent-foreground min-w-0 max-w-[200px] md:max-w-[280px]",children:[t(So,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),t("span",{className:"truncate font-medium",children:v.id===wi?_s():v.title}),t(C,{variant:"ghost",size:"icon-xs",onClick:f,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:$_(),children:t(Ne,{className:"w-3 h-3"})})]})]}),h&&t("div",{className:"flex items-center gap-2 shrink-0",children:o(C,{size:"sm",onClick:w,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[t(de,{className:"w-3.5 h-3.5"}),t("span",{children:Ff()})]})})]})}S();S();function fe({teamId:e,isOpen:r,onClose:v,goalToEdit:f}){let w=V(),[h,_]=u(""),[b,P]=u("");m(()=>{if(f)_(f.title),P(f.description||"");else _(""),P("")},[f,r]);let{mutate:G,isPending:q}=B({mutationFn:async()=>{let n=await A.api.teams[":teamId"].kanban.goals.$post({param:{teamId:e},json:{title:h.trim(),description:b.trim()||void 0}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success($v()),v()},onError:(n)=>{M.error(n.message)}}),{mutate:Q,isPending:F}=B({mutationFn:async()=>{if(!f)return;let n=await A.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:e,goalId:f.id},json:{title:h.trim(),description:b.trim()||null}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(Yv()),v()},onError:(n)=>{M.error(n.message)}}),H=(n)=>{if(n.preventDefault(),!h.trim())return;if(f)Q();else G()},d=q||F;return t(ue,{open:r,onOpenChange:(n)=>!n&&v(),children:t(ae,{className:"sm:max-w-xl",children:o("form",{onSubmit:H,className:"space-y-4",children:[o(pe,{children:[t(le,{children:f?bh():vy()}),t(Mt,{children:f?bh():by()})]}),o("div",{className:"space-y-3 py-2",children:[o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"goal-title",children:Kv()}),t(z,{id:"goal-title",value:h,onChange:(n)=>_(n.target.value),placeholder:Wv(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"goal-description",children:Vv()}),t(Si,{id:"goal-description",value:b,onChange:(n)=>P(n.target.value),placeholder:Qv(),rows:3})]})]}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:v,disabled:d,children:De()}),o(C,{type:"submit",disabled:!h.trim()||d,children:[d&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),f?Gs():Uc()]})]})]})})})}function Ke({teamId:e,selectedGoalId:r,onSelectGoal:v,isOwnerOrEditor:f=!0}){let w=V(),[h,_]=u(!1),[b,P]=u(null),[G,q]=u(null),[Q,F]=u(!1),{data:H,isLoading:d}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let i=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!i.ok)throw Error("Failed to fetch goals");return await i.json()},enabled:!!e}),n=H?.data||[],x=n.reduce((i,s)=>i+(s.taskCount||0),0),{mutate:N,isPending:l}=B({mutationFn:async(i)=>{let s=await A.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:e,goalId:i}});if(!s.ok){let p=await s.json().catch(()=>({message:Mn()}));throw Error(p.message||Mn())}return await s.json()},onSuccess:(i,s)=>{if(w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),M.success(Gv()),r===s)v(null);q(null)},onError:(i)=>{M.error(i.message)}});if(Q)return o("div",{className:"border-r border-sidebar-border bg-sidebar flex flex-col items-center w-12 shrink-0 transition-all duration-300",children:[t("div",{className:"h-14 flex items-center justify-center border-b border-sidebar-border w-full shrink-0",children:t(C,{variant:"ghost",size:"icon-sm",onClick:()=>F(!1),title:xd(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(Et,{className:"w-4 h-4"})})}),o("div",{className:"mt-3 flex flex-col items-center gap-2",children:[t(C,{variant:r===null?"secondary":"ghost",size:"icon-sm",onClick:()=>v(null),title:Ym(),className:E("w-8 h-8 rounded-md",r===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:t($a,{className:"w-4 h-4"})}),t(C,{variant:"ghost",size:"icon-sm",onClick:()=>_(!0),title:dg(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(de,{className:"w-4 h-4"})})]}),h&&t(fe,{teamId:e,isOpen:h,onClose:()=>_(!1)})]});return o("aside",{className:"w-64 border-r border-sidebar-border bg-sidebar flex flex-col shrink-0 transition-all duration-300 select-none",children:[o("div",{className:"h-14 px-3 flex items-center justify-between border-b border-sidebar-border shrink-0",children:[o("div",{className:"flex items-center gap-2 font-semibold text-xs tracking-wider uppercase text-sidebar-foreground/70",children:[t(So,{className:"w-4 h-4 text-sidebar-primary"}),t("span",{children:xd()})]}),o("div",{className:"flex items-center gap-1",children:[f&&t(C,{variant:"ghost",size:"icon-sm",onClick:()=>_(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:dg(),children:t(de,{className:"w-4 h-4"})}),t(C,{variant:"ghost",size:"icon-sm",onClick:()=>F(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:t(on,{className:"w-4 h-4"})})]})]}),t(ce,{className:"flex-1 p-2",children:o("div",{className:"space-y-1",children:[o("div",{onClick:()=>v(null),className:E("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group h-8 min-h-[32px]",r===null?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[o("div",{className:"flex items-center gap-2 truncate min-w-0",children:[t($a,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),t("span",{className:"truncate",children:Ym()})]}),x>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 shrink-0",children:x})]}),d?t("div",{className:"flex items-center justify-center p-4",children:t(O,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):n.length===0?t("div",{className:"px-2.5 py-4 text-center text-xs text-muted-foreground",children:yS()}):n.map((i)=>{let s=r===i.id,p=i.id===wi,k=p?_s():i.title,g=f&&!p;return o("div",{onClick:()=>v(i.id),className:E("flex items-center justify-between px-2.5 py-1 rounded-md text-xs font-medium cursor-pointer transition-colors group relative min-h-[32px]",s?"bg-sidebar-accent text-sidebar-accent-foreground font-semibold shadow-xs":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[o("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[t(So,{className:E("w-3.5 h-3.5 shrink-0",s?"text-sidebar-primary":"text-muted-foreground")}),t("span",{className:"line-clamp-2 break-words leading-tight",title:k,children:k})]}),t("div",{className:"flex items-center shrink-0 ml-1",children:g?o(L,{children:[(i.taskCount??0)>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60 group-hover:hidden group-focus-within:hidden [&:has(~_div_[data-state=open])]:hidden",children:i.taskCount}),t("div",{className:"hidden group-hover:flex group-focus-within:flex [&:has([data-state=open])]:flex items-center",onClick:(c)=>c.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:t(or,{className:"w-3.5 h-3.5"})})}),o(_e,{align:"end",className:"w-36",children:[o(K,{onClick:()=>{P(i)},children:[t(ye,{className:"w-3.5 h-3.5 mr-2"}),gb()]}),o(K,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{q(i)},children:[t(we,{className:"w-3.5 h-3.5 mr-2"}),ct()]})]})]})})]}):(i.taskCount??0)>0&&t("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-full bg-sidebar-border text-sidebar-foreground/60",children:i.taskCount})})]},i.id)})]})}),(h||b)&&t(fe,{teamId:e,isOpen:h||!!b,goalToEdit:b,onClose:()=>{_(!1),P(null)}}),G&&t(Xe,{open:!!G,onOpenChange:(i)=>!i&&q(null),children:o(et,{children:[o(tt,{children:[t(nt,{children:Qy()}),t(ot,{children:Ky({title:G.title})})]}),o(rt,{children:[t(it,{disabled:l,children:De()}),o(st,{onClick:()=>N(G.id),disabled:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[l&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),ct()]})]})]})})]})}S();S();function Pe(e){return+xe(e)<Date.now()}function Fe({task:e,onClick:r,onDelete:v,disabled:f,isFirst:w,isLast:h,showBottomIndicator:_,currentUserId:b,currentUserRole:P}){let{source:G}=Qd(),q=!!G,Q=P?.toLowerCase()==="owner",F=P?.toLowerCase()==="editor",H=!!b&&e.creator?.id===b,d=e.reporter?.id===b||H,n=e.assignee?.id===b,x=Q||F||d||n,N=H||Q||d,l=f||!x,{ref:i,isDragging:s}=bs({id:e.id,data:{type:"kanban_task",task:e},disabled:l}),{ref:p,isDropTarget:k}=Or({id:`reorder-before-${e.id}`,data:{type:"reorder",task:e,position:"before"},disabled:s||f}),{ref:g,isDropTarget:c}=Or({id:`reorder-after-${e.id}`,data:{type:"reorder",task:e,position:"after"},disabled:s||f}),T=e.isAgentTask,j=e.status===Qe.BLOCKED,y=e.dueDate?Pe(new Date(e.dueDate))&&e.status!==Qe.DONE:!1;return o("div",{className:"relative",children:[t("div",{ref:p,className:E("absolute left-0 right-0 z-20",w?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",q&&!s?"pointer-events-auto":"pointer-events-none")}),t("div",{ref:g,className:E("absolute bottom-0 left-0 right-0 z-20",h?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",q&&!s?"pointer-events-auto":"pointer-events-none")}),k&&!s&&t("div",{className:"absolute -top-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),(c||_)&&!s&&t("div",{className:"absolute -bottom-1.5 left-0 right-0 h-[3px] rounded-full bg-primary shadow-[0_0_8px_rgba(var(--primary),0.6)] z-30 pointer-events-none"}),o("div",{ref:i,onClick:()=>r(e),className:E("group relative flex flex-col gap-2 p-3 rounded-lg border text-card-foreground transition-all duration-200 cursor-pointer select-none",s&&"opacity-40 scale-95 shadow-lg ring-2 ring-primary",!s&&"hover:shadow-md","border-border/80 bg-card hover:border-primary/50 shadow-2xs",j&&"border-red-500/60 bg-red-500/[0.03] ring-1 ring-red-500/20"),children:[o("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[o("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] font-medium border uppercase tracking-wider shrink-0",la(e.priority)),children:aa(e.priority)}),T&&o("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[t(Tt,{className:"w-3 h-3"}),t("span",{children:Hd()})]}),e.goal&&o("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-muted text-muted-foreground border border-border/70 truncate max-w-[130px]",children:[t(So,{className:"w-2.5 h-2.5 shrink-0"}),t("span",{className:"truncate",children:e.goal.title})]})]}),t("div",{className:"flex items-center gap-1 shrink-0",children:N&&t("div",{className:"opacity-0 group-hover:opacity-100 [&:has([data-state=open])]:opacity-100 focus-within:opacity-100 transition-opacity flex items-center",onClick:(X)=>X.stopPropagation(),children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(C,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:t(or,{className:"w-3.5 h-3.5"})})}),t(_e,{align:"end",className:"w-32",children:o(K,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>v?.(e),children:[t(we,{className:"w-3.5 h-3.5 mr-2"}),ct()]})})]})})})]}),t("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:e.title}),j&&o("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-red-500/10 border border-red-500/20 text-[11px] text-red-600 dark:text-red-400",children:[t(Kr,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),t("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent?.blockReason||e.latestStatusEvent?.reason||e.latestStatusEvent?.summary||hA()})]}),e.status===Qe.IN_REVIEW&&e.latestStatusEvent?.summary&&o("div",{className:"flex items-start gap-1.5 p-1.5 rounded bg-purple-500/10 border border-purple-500/20 text-[11px] text-purple-600 dark:text-purple-400",children:[t(fn,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),t("span",{className:"line-clamp-2 break-words",children:e.latestStatusEvent.summary})]}),o("div",{className:"flex items-center justify-between gap-2 pt-1 mt-auto border-t border-border/40 text-[11px] text-muted-foreground",children:[t("div",{className:"flex items-center gap-1.5 min-w-0",children:e.assignee?o(L,{children:[T?t("div",{className:"w-5 h-5 rounded-full bg-orange-500/15 border border-orange-500/30 flex items-center justify-center shrink-0",children:t(Tt,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):o(Ce,{size:"sm",className:"w-5 h-5 border border-border",children:[t(Ie,{src:e.assignee.image}),t(Te,{className:"text-[9px]",children:e.assignee.name.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate text-xs font-medium text-foreground/80 max-w-[90px]",children:e.assignee.name})]}):t("span",{className:"text-[11px] italic text-muted-foreground/60",children:_s()})}),o("div",{className:"flex items-center gap-2 shrink-0",children:[e.dueDate&&o("div",{className:E("flex items-center gap-1 text-[10px] font-mono",y?"text-red-500 font-semibold":"text-muted-foreground"),title:Ar(new Date(e.dueDate),"yyyy/MM/dd HH:mm"),children:[t(jn,{className:"w-3 h-3"}),t("span",{children:Ar(new Date(e.dueDate),"MM/dd")})]}),e.assetCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:zw({count:e.assetCount}),children:[t(ka,{className:"w-3 h-3"}),t("span",{children:e.assetCount})]}),e.dependencyCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.dependencyCount} dependencies`,children:[t(js,{className:"w-3 h-3"}),t("span",{children:e.dependencyCount})]}),e.commentCount>0&&o("div",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground",title:`${e.commentCount} comments`,children:[t(xo,{className:"w-3 h-3"}),t("span",{children:e.commentCount})]})]})]})]})]})}function Ee({teamId:e,status:r,selectedGoalId:v,scope:f,currentUserId:w,currentUserRole:h,onTaskClick:_,onDeleteTask:b,onCreateTaskInColumn:P}){let G=h?.toLowerCase()==="owner"||h?.toLowerCase()==="editor",q=f==="my"?w:void 0,{data:Q,fetchNextPage:F,hasNextPage:H,isFetchingNextPage:d,isLoading:n}=mt({queryKey:["teams",e,"kanban","tasks",{status:r,goalId:v,assigneeId:q}],queryFn:async({pageParam:R=""})=>{let J=await A.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:e},query:{status:r,goalId:v||void 0,assigneeId:q||void 0,first:"20",after:R||void 0}});if(!J.ok)throw Error("Failed to fetch column tasks");return await J.json()},initialPageParam:"",getNextPageParam:(R)=>R.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!e}),{ref:x,inView:N}=Nt({threshold:0.1});m(()=>{if(N&&H&&!d)F()},[N,H,d,F]);let l=D(()=>Q?.pages?.flatMap((R)=>Array.isArray(R?.data)?R.data:[])||[],[Q]),{source:i,target:s}=Qd(),p=l.filter((R)=>R.id!==i?.id).at(-1),{ref:k,isDropTarget:g}=Or({id:r,data:{type:"kanban_column",status:r,lastTask:p}}),c=i?.data?.type==="kanban_task",T=c&&(g||s?.data?.type==="kanban_column"&&s.data.status===r||s?.data?.type==="reorder"&&s.data.task?.status===r),j=c&&s?.data?.type==="kanban_column"&&s.data.status===r,y=Q?.pages?.[0]?.pageInfo?.total??l.length,X=tm(r);return o("div",{ref:k,className:E("flex flex-col h-full max-h-full w-80 md:w-84 shrink-0 rounded-xl bg-card/60 border border-border/70 shadow-xs transition-colors duration-200 overflow-hidden select-none",T&&"ring-2 ring-primary/60 bg-primary/[0.03] border-primary/40"),children:[o("div",{className:"h-11 px-3.5 flex items-center justify-between border-b border-border/60 bg-card/80 shrink-0",children:[o("div",{className:"flex items-center gap-2 min-w-0",children:[t("div",{className:E("w-2.5 h-2.5 rounded-full shrink-0",X.dot)}),t("h3",{className:"text-xs font-bold tracking-wide uppercase text-foreground/90 truncate",children:io(r)})]}),t("div",{className:"flex items-center gap-1 shrink-0",children:t("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-muted-foreground",children:y})})]}),t(ce,{className:"flex-1 min-h-0 [&>div>div]:block!",children:o("div",{className:"p-2.5 space-y-2.5 min-h-full flex flex-col",children:[n?t("div",{className:"flex items-center justify-center py-10",children:t(O,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):l.length===0?t("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:t("p",{className:"text-xs text-muted-foreground/70",children:RS()})}):l.map((R,J)=>t(Fe,{task:R,onClick:_,onDelete:b,isFirst:J===0,isLast:J===l.length-1,showBottomIndicator:j&&R.id===p?.id,currentUserId:w,currentUserRole:h},R.id)),t("div",{ref:x,className:"h-2"}),d&&t("div",{className:"flex justify-center py-2",children:t(O,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),G&&t("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:o(C,{variant:"ghost",size:"sm",onClick:()=>P(r),className:"w-full justify-center h-8 text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted/80 border border-dashed border-border/80",children:[t(de,{className:"w-3.5 h-3.5 mr-1.5"}),t("span",{children:Ff()})]})})]})}function Oe({teamId:e,selectedGoalId:r,scope:v,currentUserId:f,currentUserRole:w,onTaskClick:h,onCreateTaskInColumn:_}){let b=V(),[P,G]=u(null),{mutate:q,isPending:Q}=B({mutationFn:async(d)=>{let n=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:e,taskId:d}});if(!n.ok){let x=await n.json().catch(()=>({message:Mn()}));throw Error(x.message||Mn())}return await n.json()},onSuccess:()=>{b.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),b.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(DT()),G(null)},onError:(d)=>{M.error(d.message)}}),{mutate:F}=B({mutationFn:async({taskId:d,fromStatus:n,status:x,reason:N,beforeIndex:l,afterIndex:i})=>{let s=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:e,taskId:d},json:{fromStatus:n,status:x,reason:N,beforeIndex:l,afterIndex:i}});if(!s.ok){let p=await s.json().catch(()=>({message:Mn()}));throw Error(p.message||Mn())}return await s.json()},onMutate:async({taskId:d,status:n,targetTaskId:x,position:N})=>{await b.cancelQueries({queryKey:["teams",e,"kanban","tasks"]});let l=b.getQueriesData({queryKey:["teams",e,"kanban","tasks"]}),i=null,s=(p)=>p[0]==="teams"&&p[1]===e&&p[2]==="kanban"&&p[3]==="tasks"&&typeof p[4]==="object"&&p[4]!==null&&("status"in p[4]);if(b.setQueriesData({predicate:(p)=>s(p.queryKey)},(p)=>{if(!p||!Array.isArray(p.pages))return p;let k=!1,g=p.pages.map((c)=>{if(!c||!Array.isArray(c.data))return c;let T=c.data.find((j)=>j.id===d);if(T)return i={...T,status:n},k=!0,{...c,data:c.data.filter((j)=>j.id!==d),pageInfo:{...c.pageInfo,total:Math.max(0,(c.pageInfo?.total??c.data.length)-1)}};return c});return k?{...p,pages:g}:p}),i){let p=i;b.setQueriesData({predicate:(k)=>{if(!s(k.queryKey))return!1;return k.queryKey[4]?.status===n}},(k)=>{if(!k||!Array.isArray(k.pages))return k;let g=k.pages.flatMap((y)=>y?.data??[]).filter((y)=>y.id!==d),c=g.length;if(x){let y=g.findIndex((X)=>X.id===x);if(y!==-1)c=N==="before"?y:y+1}g.splice(c,0,p);let T=0,j=k.pages.map((y,X)=>{let R=y?.data?y.data.length:0,J=X===0&&R===0?1:X===k.pages.length-1?g.length-T:R,te=g.slice(T,T+J);return T+=J,{...y,data:te,pageInfo:{...y?.pageInfo,total:(y?.pageInfo?.total??0)+1}}});if(T<g.length&&j.length>0){let y=j.length-1;j[y]={...j[y],data:[...j[y]?.data??[],...g.slice(T)]}}return{...k,pages:j}})}return{previousQueries:l}},onError:(d,n,x)=>{if(x?.previousQueries)for(let[N,l]of x.previousQueries)b.setQueryData(N,l);M.error(d.message)},onSettled:()=>{b.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]})}}),H=(d)=>{if(d.canceled)return;let{source:n,target:x}=d.operation;if(!n||!x)return;let N=n.data;if(N?.type!=="kanban_task"||!N.task)return;let l=N.task,i=w?.toLowerCase()==="owner",s=w?.toLowerCase()==="editor",p=l.reporter?.id===f||l.creator?.id===f,k=l.assignee?.id===f;if(!i&&!s&&!p&&!k){M.error(B_());return}let g=x.data;if(!g)return;if(g.type==="reorder"&&g.task&&g.position){let c=g.task,T=c.status;if(l.id===c.id)return;let j=g.position==="before"?c.sortIndex??void 0:void 0,y=g.position==="after"?c.sortIndex??void 0:void 0;F({taskId:l.id,fromStatus:l.status,status:T,beforeIndex:j,afterIndex:y,targetTaskId:c.id,position:g.position});return}if(g.type==="kanban_column"&&g.status){let{status:c,lastTask:T}=g;if(T){if(l.id===T.id){if(l.status===c)return;F({taskId:l.id,fromStatus:l.status,status:c});return}F({taskId:l.id,fromStatus:l.status,status:c,afterIndex:T.sortIndex??void 0,targetTaskId:T.id,position:"after"});return}if(l.status===c)return;F({taskId:l.id,fromStatus:l.status,status:c})}};return o(Vn,{sensors:[yn.configure({activationConstraints:[new Dr.Distance({value:8})]}),es],onDragEnd:H,children:[t("div",{className:"flex-1 min-h-0 overflow-x-auto overflow-y-hidden p-4 bg-background/50",children:t("div",{className:"flex gap-4 h-full min-w-max pb-2",children:LA.map((d)=>t(Ee,{teamId:e,status:d,selectedGoalId:r,scope:v,currentUserId:f,currentUserRole:w,onTaskClick:h,onDeleteTask:(n)=>G(n),onCreateTaskInColumn:_},d))})}),P&&t(Xe,{open:!!P,onOpenChange:(d)=>!d&&G(null),children:o(et,{children:[o(tt,{children:[t(nt,{children:sb()}),t(ot,{children:ib({title:P.title})})]}),o(rt,{children:[t(it,{disabled:Q,children:De()}),o(st,{onClick:()=>q(P.id),disabled:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[Q&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),ct()]})]})]})})]})}S();function Ge({teamId:e,isOpen:r,onClose:v,initialGoalId:f}){let w=V(),h=f===wi||!f?"none":f,[_,b]=u(""),[P,G]=u(""),[q,Q]=u(!1),[F,H]=u(zr.MEDIUM),[d,n]=u(h),[x,N]=u("none"),[l,i]=u("none"),[s,p]=u(void 0),[k,g]=u(void 0),[c,T]=u(null),[j,y]=u(null),[X,R]=u(null),[J,te]=u([]),[re,oe]=u([]),[be,ve]=u(!1),{data:he}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let a=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!a.ok)return null;return await a.json()},enabled:!!e&&r});m(()=>{if(r)b(""),G(""),Q(!1),H(zr.MEDIUM),n(h),N("none"),i(he?.id||"none"),p(void 0),g(void 0),T(null),y(null),R(null),te([]),oe([])},[r,h,he?.id]);let{data:ke=[]}=Z({queryKey:["teams",e,"members","human"],queryFn:async()=>{let a=await A.api.teams[":teamId"].members.$get({param:{teamId:e},query:{includeAgents:"false"}});if(!a.ok)return[];let U=await a.json();return Array.isArray(U)?U:[]},enabled:!!e&&r}),{data:$e=[]}=Z({queryKey:["teams",e,"agents"],queryFn:async()=>{let a=await A.api.teams[":teamId"].agents.$get({param:{teamId:e}});if(!a.ok)return[];return await a.json()||[]},enabled:!!e&&r}),{data:He}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let a=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!a.ok)return{data:[]};return await a.json()},enabled:!!e&&r}),Ve=He?.data||[],{mutate:Je,isPending:se}=B({mutationFn:async()=>{let a=await A.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:e},json:{title:_.trim(),description:P.trim()||void 0,isAgentTask:q,priority:F,goalId:d!=="none"?d:void 0,assigneeId:x!=="none"?x:void 0,reporterId:l!=="none"?l:void 0,startDate:s?s.toISOString():void 0,dueDate:k?k.toISOString():void 0,projectId:c||void 0,targetFolderId:j||void 0,parentIds:J.length>0?J:void 0,assetIds:re.length>0?re.map((U)=>U.id):void 0}});if(!a.ok){let U=await a.text().catch(()=>""),Y=Mn();if(U)try{let me=JSON.parse(U);if(me&&typeof me.message==="string")Y=me.message}catch{Y=U}throw Error(Y)}return await a.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),M.success(NT()),v()},onError:(a)=>{M.error(a.message)}}),We=(a)=>{if(a.preventDefault(),!_.trim()||se)return;Je()},ie=q;return t(ue,{open:r,onOpenChange:(a)=>!a&&v(),children:o(ae,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[o("form",{onSubmit:We,className:"space-y-4",children:[t(pe,{children:t(le,{children:Ff()})}),o("div",{className:"space-y-3.5 py-1",children:[o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"create-task-title",children:yA()}),t(z,{id:"create-task-title",value:_,onChange:(a)=>b(a.target.value),placeholder:bA(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(W,{htmlFor:"create-task-desc",children:gA()}),t(Si,{id:"create-task-desc",value:P,onChange:(a)=>G(a.target.value),placeholder:AA(),rows:3})]}),o("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-lg border border-border/80 bg-muted/30 p-2.5 h-14",children:[o("div",{className:"space-y-0.5 min-w-0 pr-2",children:[o(W,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[t(Tt,{className:"w-3.5 h-3.5 text-orange-500"}),t("span",{children:Hd()})]}),t("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:vA()})]}),t(Me,{id:"create-is-agent-task",checked:q,onCheckedChange:(a)=>{Q(a),N("none")}})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:_A()}),o(Le,{value:F,onValueChange:(a)=>H(a),children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{})}),t(Ue,{children:Object.values(zr).map((a)=>t(ne,{value:a,children:t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",la(a)),children:aa(a)})},a))})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:xd()}),o(Le,{value:d,onValueChange:n,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:"None"})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:"None"})}),Ve.filter((a)=>a.id!==wi).map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(So,{className:"w-3.5 h-3.5 text-primary"}),t("span",{children:a.title})]})},a.id))]})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:ie?zd():nh()}),o(Le,{value:x,onValueChange:N,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:_s()})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:_s()})}),ie?$e.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(Tt,{className:"w-3.5 h-3.5 text-purple-500"}),t("span",{children:a.name})]})},a.id)):ke.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{size:"sm",className:"w-4 h-4",children:[t(Ie,{src:a.image}),t(Te,{className:"text-[8px]",children:a.name.slice(0,2).toUpperCase()})]}),t("span",{children:a.name})]})},a.id))]})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Vg()}),o(Le,{value:l,onValueChange:i,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:_s()})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:_s()})}),ke.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{size:"sm",className:"w-4 h-4",children:[t(Ie,{src:a.image}),t(Te,{className:"text-[8px]",children:a.name.slice(0,2).toUpperCase()})]}),t("span",{children:a.name})]})},a.id))]})]})]}),ie&&o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:qp()}),o(C,{type:"button",variant:"outline",size:"sm",onClick:()=>ve(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[t(rr,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),t("span",{className:"truncate",children:X||Op()})]})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:jd()}),t(Ei,{value:s,onChange:p,placeholder:jd(),className:"h-9 text-xs"})]}),o("div",{className:"space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:gd()}),t(Ei,{value:k,onChange:g,placeholder:gd(),className:"h-9 text-xs"})]}),o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(W,{className:"text-xs font-medium text-muted-foreground",children:Eg()}),t(Xd,{teamId:e,value:J,onChange:te})]}),t("div",{className:"sm:col-span-2 pt-1",children:t(ef,{teamId:e,projectId:c,assets:re,onAddAssets:(a)=>oe((U)=>[...U,...a]),onRemoveAsset:(a)=>oe((U)=>U.filter((Y)=>Y.id!==a))})})]})]}),o(qe,{children:[t(C,{type:"button",variant:"outline",onClick:v,disabled:se,children:De()}),o(C,{type:"submit",disabled:!_.trim()||se,children:[se&&t(O,{className:"w-4 h-4 mr-1.5 animate-spin"}),Uc()]})]})]}),be&&t(tf,{teamId:e,currentProjectId:c,currentTargetFolderId:j,isOpen:be,onClose:()=>ve(!1),onSelect:(a,U,Y)=>{T(a),y(U),R(Y||"Selected Folder")}})]})})}function je({teamId:e,initialTaskId:r}){let[v,f]=u("team"),[w,h]=u(null),[_,b]=u(r??null),[P,G]=u(!1);m(()=>{if(r)b(r)},[r]);let[q,Q]=u(Qe.TODO),{data:F,isLoading:H}=Z({queryKey:["teams",e,"me"],queryFn:async()=>{let s=await A.api.teams[":teamId"].me.$get({param:{teamId:e}});if(!s.ok)throw Error("Failed to fetch me");return await s.json()},enabled:!!e}),{data:d}=Z({queryKey:["teams",e,"kanban","goals"],queryFn:async()=>{let s=await A.api.teams[":teamId"].kanban.goals.$get({param:{teamId:e},query:{}});if(!s.ok)return{data:[]};return await s.json()},enabled:!!e}),n=d?.data||[],x=w?n.find((s)=>s.id===w)||null:null,N=F?.role?.toLowerCase()==="owner"||F?.role?.toLowerCase()==="editor",l=(s=Qe.TODO)=>{Q(s),G(!0)},i=(s)=>{b(s.id)};if(H)return t("div",{className:"flex h-full items-center justify-center",children:t(O,{className:"w-8 h-8 animate-spin text-muted-foreground"})});return o("div",{className:"flex flex-row h-full bg-background overflow-hidden font-sans",children:[t(Ke,{teamId:e,selectedGoalId:w,onSelectGoal:h,isOwnerOrEditor:N}),o("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[t(Se,{scope:v,onScopeChange:f,selectedGoal:x,onClearGoal:()=>h(null),onCreateTask:()=>l(Qe.TODO),canCreateTask:N}),t(Oe,{teamId:e,selectedGoalId:w,scope:v,currentUserId:F?.id,currentUserRole:F?.role,onTaskClick:i,onCreateTaskInColumn:(s)=>l(s)})]}),_&&t(nf,{teamId:e,taskId:_,isOpen:!!_,onClose:()=>b(null),canEdit:N}),P&&t(Ge,{teamId:e,isOpen:P,initialStatus:q,initialGoalId:w,onClose:()=>G(!1)})]})}function at(){let{teamId:e}=Re.useParams(),{taskId:r}=Re.useSearch();return t(je,{teamId:e,initialTaskId:r})}var Re=ze("/teams/$teamId/kanban")({component:at});export{Re as Route};