@shumai-one/shumai 0.4.4 → 0.4.6

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 (178) hide show
  1. package/bin/{chunk-snhsjs4x.js → chunk-07jszkhj.js} +62 -62
  2. package/bin/chunk-0c67210c.js +1 -0
  3. package/bin/{chunk-kswvyqq1.js → chunk-0wvhahzh.js} +2 -2
  4. package/bin/chunk-161rxeq2.js +2 -0
  5. package/bin/{chunk-trveq4wg.js → chunk-1bgsphyz.js} +2 -2
  6. package/bin/{chunk-vap4k11j.js → chunk-1dqsf5qj.js} +6 -6
  7. package/bin/{chunk-zxk7q0zk.js → chunk-1jybg56e.js} +1 -1
  8. package/bin/chunk-1kt5dzjv.js +2 -0
  9. package/bin/{chunk-drepsbb4.js → chunk-1t51fp6n.js} +1 -1
  10. package/bin/{chunk-cbgq517y.js → chunk-2jrjwaqr.js} +2 -2
  11. package/bin/chunk-2qjfpmcf.js +2 -0
  12. package/bin/{chunk-wjyaezs7.js → chunk-2vzzd0q6.js} +1 -1
  13. package/bin/chunk-2yr5k567.js +2 -0
  14. package/bin/chunk-2z1pnt7h.js +2 -0
  15. package/bin/{chunk-0zv3bks2.js → chunk-3d5rm1d1.js} +1 -1
  16. package/bin/{chunk-w4ghe71n.js → chunk-3d9tfxp4.js} +1 -1
  17. package/bin/{chunk-0qjfahk9.js → chunk-3dgahs95.js} +1 -1
  18. package/bin/{chunk-dqxeztfa.js → chunk-3j5njrpr.js} +2 -2
  19. package/bin/{chunk-ryzz5fht.js → chunk-3n4224c0.js} +1 -1
  20. package/bin/{chunk-914bp49r.js → chunk-3tg39jx7.js} +3 -3
  21. package/bin/chunk-3vmapyk9.js +1 -0
  22. package/bin/{chunk-g3fpmyyn.js → chunk-46wfxyd7.js} +2 -2
  23. package/bin/{chunk-4hkkdm2q.js → chunk-47tn3vtg.js} +1 -1
  24. package/bin/{chunk-1zwajpwf.js → chunk-4syt6rn0.js} +3 -3
  25. package/bin/chunk-5kvc1gp2.js +1 -0
  26. package/bin/{chunk-xa18z1py.js → chunk-5vvvgjvz.js} +2 -2
  27. package/bin/{chunk-5nm2jvg5.js → chunk-6vxzkrsj.js} +11 -11
  28. package/bin/{chunk-ytdwk2fq.js → chunk-6y4xkcte.js} +2 -2
  29. package/bin/{chunk-fpc4p0j8.js → chunk-7e5z637e.js} +2 -2
  30. package/bin/chunk-7nvk7waw.js +1 -0
  31. package/bin/{chunk-rq0n0vcc.js → chunk-80qz30dc.js} +2 -2
  32. package/bin/chunk-886pnknh.js +3 -0
  33. package/bin/{chunk-6ghcj4a9.js → chunk-8cn7fx40.js} +1 -1
  34. package/bin/chunk-908pypkr.js +1 -0
  35. package/bin/chunk-952qwf17.js +2 -0
  36. package/bin/chunk-988casfy.js +1 -0
  37. package/bin/chunk-9a2tf0mh.js +2 -0
  38. package/bin/{chunk-nkdk229f.js → chunk-9d0thqcy.js} +1 -1
  39. package/bin/{chunk-s2k4qntr.js → chunk-9nvymwqj.js} +2 -2
  40. package/bin/{chunk-mz0yjra0.js → chunk-9trnkbtr.js} +4 -4
  41. package/bin/{chunk-t2hy6tj9.js → chunk-a4056d0r.js} +1 -1
  42. package/bin/{chunk-ze20rm02.js → chunk-a796sgcw.js} +4 -4
  43. package/bin/{chunk-kpgfqkp0.js → chunk-afnzb9ne.js} +2 -2
  44. package/bin/chunk-apfrw0wd.js +3 -0
  45. package/bin/{chunk-wndm3px3.js → chunk-axmd242s.js} +1 -1
  46. package/bin/{chunk-nr20tvnw.js → chunk-b3aqmcps.js} +2 -2
  47. package/bin/chunk-b6q287d1.js +2 -0
  48. package/bin/{chunk-j1tkmcae.js → chunk-b9hyc0a1.js} +2 -2
  49. package/bin/chunk-ba33nf0q.js +4 -0
  50. package/bin/chunk-batadmvr.js +2 -0
  51. package/bin/{chunk-1t167cvj.js → chunk-brwbhbmc.js} +7 -7
  52. package/bin/chunk-bvdvp192.js +1 -0
  53. package/bin/{chunk-fahk9h62.js → chunk-crja7whq.js} +2 -2
  54. package/bin/{chunk-98715kc3.js → chunk-d7fwggt6.js} +2 -2
  55. package/bin/chunk-db1msmdh.js +2 -0
  56. package/bin/{chunk-97f2af6d.js → chunk-dbw8c1jj.js} +5 -5
  57. package/bin/{chunk-7gmdnsdg.js → chunk-dj5a6kkh.js} +1 -1
  58. package/bin/chunk-dkx3pmdz.js +1 -0
  59. package/bin/{chunk-071x515q.js → chunk-dmvvt8va.js} +2 -2
  60. package/bin/{chunk-3tedzb2j.js → chunk-dpc11hpd.js} +9 -9
  61. package/bin/{chunk-ks8xzc95.js → chunk-dscq4a4k.js} +2 -2
  62. package/bin/{chunk-jmpb5633.js → chunk-dz076sh7.js} +1 -1
  63. package/bin/chunk-edqd8evk.js +2 -0
  64. package/bin/{chunk-0qaq0sp8.js → chunk-ehpfg3km.js} +2 -2
  65. package/bin/chunk-ey3h4sct.js +2 -0
  66. package/bin/{chunk-vm5fx7td.js → chunk-ga3pahzf.js} +1 -1
  67. package/bin/chunk-gc6m7agb.js +3 -0
  68. package/bin/{chunk-7bcxj1jd.js → chunk-gcjsw9yp.js} +1 -1
  69. package/bin/chunk-gqr5hxhj.js +2 -0
  70. package/bin/{chunk-jrjnqx78.js → chunk-gsfcpcye.js} +1 -1
  71. package/bin/chunk-h9mka9br.js +2 -0
  72. package/bin/chunk-hacyjx1s.js +1 -0
  73. package/bin/chunk-hd6dnnyg.js +2 -0
  74. package/bin/chunk-he5nvmqw.js +1 -0
  75. package/bin/{chunk-reyxk4bw.js → chunk-hnhdq2wd.js} +1 -1
  76. package/bin/{chunk-gt4csat6.js → chunk-hs2r9qaw.js} +2 -2
  77. package/bin/{chunk-fb40xxz3.js → chunk-hxyg5q2a.js} +2 -2
  78. package/bin/chunk-hyr1vtfp.js +1 -0
  79. package/bin/{chunk-zw86wnwe.js → chunk-j9ks8bd7.js} +2 -2
  80. package/bin/{chunk-1gvscz88.js → chunk-jg2v25d2.js} +2 -2
  81. package/bin/chunk-jh8q3885.js +211 -0
  82. package/bin/chunk-jzbrt2vk.js +1 -0
  83. package/bin/chunk-k6avge95.js +10 -0
  84. package/bin/{chunk-msfw3jmc.js → chunk-kg8eg9z3.js} +2 -2
  85. package/bin/chunk-kk42xhgz.js +1 -0
  86. package/bin/{chunk-3ttrhqy3.js → chunk-kmbjp5kp.js} +2 -2
  87. package/bin/{chunk-jgs8an3h.js → chunk-md5pcq46.js} +8 -8
  88. package/bin/{chunk-xarsrs08.js → chunk-mtb9fpj2.js} +1 -1
  89. package/bin/chunk-n3xjwszr.js +2 -0
  90. package/bin/chunk-nqym3zbs.js +1 -0
  91. package/bin/{chunk-579e4wv4.js → chunk-p75f5pgq.js} +2 -2
  92. package/bin/{chunk-hm0dkzed.js → chunk-pdh9bnyj.js} +2 -2
  93. package/bin/{chunk-rhvv1vvk.js → chunk-pgj2kjnn.js} +2 -2
  94. package/bin/{chunk-hmpwg5za.js → chunk-pvg3msgw.js} +8 -8
  95. package/bin/{chunk-4991gz3y.js → chunk-pwkby9h7.js} +6 -6
  96. package/bin/{chunk-fnmwksnb.js → chunk-qbqym9m6.js} +2 -2
  97. package/bin/{chunk-4wy87hwd.js → chunk-qgkbxw1k.js} +2 -2
  98. package/bin/{chunk-1j27fzy1.js → chunk-qs7855cz.js} +2 -2
  99. package/bin/{chunk-7jtmwt5a.js → chunk-radcwage.js} +2 -2
  100. package/bin/{chunk-gk2q9a3f.js → chunk-rmzcarv9.js} +2 -2
  101. package/bin/{chunk-s2fnfyn9.js → chunk-rp4pc6kz.js} +1 -1
  102. package/bin/{chunk-5adsx8x4.js → chunk-rsd164d9.js} +2 -2
  103. package/bin/{chunk-hk5rc6cd.js → chunk-s05cdax2.js} +4 -4
  104. package/bin/{chunk-pazjhrnf.js → chunk-sab7tjxw.js} +5 -5
  105. package/bin/chunk-sebbjvgv.css +1 -0
  106. package/bin/{chunk-bkr5zm4h.js → chunk-t350k3s1.js} +1 -1
  107. package/bin/{chunk-4v41a1r9.js → chunk-t7bvde99.js} +3 -3
  108. package/bin/chunk-t8gv2ekj.js +14 -0
  109. package/bin/chunk-teqprbd8.js +2 -0
  110. package/bin/chunk-tgr86ac4.js +2 -0
  111. package/bin/{chunk-5hg6kcfz.js → chunk-v8v8vdf7.js} +9 -9
  112. package/bin/chunk-vm5tn0zm.js +2 -0
  113. package/bin/chunk-vzj2j11x.js +2 -0
  114. package/bin/chunk-w1wxzqqb.js +2 -0
  115. package/bin/chunk-wmjp8dcm.js +1 -0
  116. package/bin/chunk-wy8dkyxj.js +1 -0
  117. package/bin/{chunk-a6gx7f5q.js → chunk-y1b3ck7m.js} +1 -1
  118. package/bin/{chunk-1xh34aew.js → chunk-y20sbaz5.js} +2 -2
  119. package/bin/{chunk-qsr1a0rp.js → chunk-y56yvezn.js} +1 -1
  120. package/bin/{chunk-9t8n2des.js → chunk-yfr0hzb7.js} +2 -2
  121. package/bin/chunk-ysv80zyb.js +5 -0
  122. package/bin/chunk-z08bqvkc.js +42 -0
  123. package/bin/{chunk-5tcdwep5.js → chunk-z6jpt0h6.js} +4 -4
  124. package/bin/shumai-app.html +1 -1
  125. package/bin/shumai-app.js +605 -370
  126. package/package.json +7 -7
  127. package/prisma/migrations/20260913130237_add_asset_comment_asset_id_idx/migration.sql +2 -0
  128. package/prisma/migrations/20260914024424_add_asset_comment_reactions/migration.sql +22 -0
  129. package/prisma/migrations/20260914064432_limit_reaction_code_length/migration.sql +8 -0
  130. package/prisma/migrations/20260914092940_add_jpeg_preview_flags/migration.sql +5 -0
  131. package/prisma/schema.prisma +22 -0
  132. package/bin/chunk-0cmx7k4c.js +0 -1
  133. package/bin/chunk-16xax8kk.js +0 -1
  134. package/bin/chunk-2w5xqhjm.js +0 -1
  135. package/bin/chunk-3zkasqb8.js +0 -1
  136. package/bin/chunk-453ykvaw.js +0 -2
  137. package/bin/chunk-4mjywsj8.js +0 -3
  138. package/bin/chunk-5vzrpz50.js +0 -2
  139. package/bin/chunk-77fmkpdz.js +0 -10
  140. package/bin/chunk-7kjgvxqa.js +0 -2
  141. package/bin/chunk-7pw1550a.js +0 -2
  142. package/bin/chunk-7rhz2gze.js +0 -211
  143. package/bin/chunk-837fky18.js +0 -3
  144. package/bin/chunk-84as6x83.js +0 -1
  145. package/bin/chunk-8e28hcny.js +0 -2
  146. package/bin/chunk-9ccw540k.js +0 -2
  147. package/bin/chunk-9ybt6vbm.js +0 -1
  148. package/bin/chunk-avwgktxb.js +0 -2
  149. package/bin/chunk-d27mm390.js +0 -1
  150. package/bin/chunk-dj92fss9.js +0 -2
  151. package/bin/chunk-f6svp4dp.js +0 -2
  152. package/bin/chunk-fsyzs0tf.js +0 -1
  153. package/bin/chunk-fxecgp5k.js +0 -1
  154. package/bin/chunk-gc5sbfa5.js +0 -2
  155. package/bin/chunk-gdm6yfqq.js +0 -2
  156. package/bin/chunk-gye8gabk.js +0 -2
  157. package/bin/chunk-j2bvj2yn.js +0 -2
  158. package/bin/chunk-jffktpqg.js +0 -1
  159. package/bin/chunk-k2k9vjq6.js +0 -1
  160. package/bin/chunk-m9pr03kn.js +0 -2
  161. package/bin/chunk-mfn9qjm4.js +0 -2
  162. package/bin/chunk-nbdw8fen.js +0 -1
  163. package/bin/chunk-q806pqeh.js +0 -1
  164. package/bin/chunk-qka4mkmj.js +0 -2
  165. package/bin/chunk-rchsme43.js +0 -3
  166. package/bin/chunk-rqf7999q.js +0 -42
  167. package/bin/chunk-rssgmj7x.js +0 -2
  168. package/bin/chunk-t7nsgg5k.js +0 -4
  169. package/bin/chunk-tm7f32c7.js +0 -14
  170. package/bin/chunk-vy8gntez.js +0 -1
  171. package/bin/chunk-vyzptrea.js +0 -2
  172. package/bin/chunk-wdsf44hs.js +0 -2
  173. package/bin/chunk-x5jwwvs0.js +0 -1
  174. package/bin/chunk-x92cq59c.js +0 -1
  175. package/bin/chunk-xtf3c29c.css +0 -1
  176. package/bin/chunk-xx337zcw.js +0 -2
  177. package/bin/chunk-xz6713tj.js +0 -2
  178. package/bin/chunk-yfnem6se.js +0 -2
@@ -1,3 +0,0 @@
1
- // @bun
2
- function es(_){if(_===void 0)return;let n=Array.from(_);if(n.length<=64)return _;return n.slice(0,64).join("")}
3
- export{es};
@@ -1 +0,0 @@
1
- import{t,Fe}from"./chunk-7rhz2gze.js";import"./chunk-tm7f32c7.js";import"./chunk-7kjgvxqa.js";import"./chunk-gc5sbfa5.js";import"./chunk-rssgmj7x.js";import"./chunk-8e28hcny.js";import"./chunk-snhsjs4x.js";import"./chunk-77fmkpdz.js";import"./chunk-914bp49r.js";import"./chunk-f6svp4dp.js";import"./chunk-0qaq0sp8.js";import{ha}from"./chunk-vyzptrea.js";import"./chunk-98715kc3.js";import"./chunk-m9pr03kn.js";import"./chunk-j2bvj2yn.js";import"./chunk-cbgq517y.js";import"./chunk-gk2q9a3f.js";import"./chunk-9t8n2des.js";import"./chunk-ytdwk2fq.js";import"./chunk-0zv3bks2.js";function s(){let{shareId:e,folderId:a}=n.useParams();return t(ha,{shareId:e,initialFolderId:a})}var n=Fe("/share/$shareId/folders/$folderId")({component:s});export{n as Route};
@@ -1,2 +0,0 @@
1
- import{h,w,u,C,B,t,o,K,U,A,L,$r,be,pt,vt,Ms,fe,S,ge,Ae,ye,W,ke,Wa,qm,at,Nc,Oc,Xm,j_,q_,ph,mh,hh,qf,Hf,$f,Gf,gl,Zh,Kf,Wf,Qh,Vh,dp,hg,Ng,Ip,EI,kp,Pp,Je,Xe,et,tt,rt,nt,ot,st,pe,ue,me,$e,de,Tt,H,Pt,Mt,R,Kr,dn,tA}from"./chunk-7rhz2gze.js";import{Yc,Jc,Xc,eu,tu}from"./chunk-tm7f32c7.js";import{Bo}from"./chunk-7kjgvxqa.js";import{so}from"./chunk-9t8n2des.js";C();var Se=[];function Ll({teamId:r,projectId:y,assetId:m,folders:a,files:l,totalFolders:Me,totalFiles:Re,totalFoldersSize:ze,totalFilesSize:Ue,selectedItem:J,selectedIds:D,onItemSelect:X,onItemDoubleClick:Y,onSaveField:Be,onClearSelection:qe,fetchNextFoldersPage:Z,hasNextFoldersPage:ee,isFetchingNextFoldersPage:b,fetchNextFilesPage:te,hasNextFilesPage:oe,isFetchingNextFilesPage:x,isRecentlyDeleted:k=!1,isRecents:N=!1,isLoading:se=!1,isShareView:q=!1,isPublic:ie=!1,shareId:Oe,allowDownload:re=!0}){let d=K(),{canEdit:_,canAdmin:We}=Pt(y),ne=w(null),ae=w(null),[O,je]=u(!0),[j,Qe]=u(!0),[He,F]=u(!1),[I,le]=u(""),[Ke,Q]=u(!1),ce=Me??a.length,he=Re??l.length,ve=ze??(a.length>0?a.reduce((e,s)=>e+(s.sizeByte||0),0):-1),we=Ue??(l.length>0?l.reduce((e,s)=>e+(s.sizeByte||0),0):-1),Le=ve>-1,Pe=we>-1,De=(e,s)=>{if(s)return e===1?Hf({count:e}):qf({count:e});else return e===1?Gf({count:e}):$f({count:e})},{editingItemId:xe,setEditingItemId:Ce,handleAction:Ne,onRenameSubmit:_e,isDeleteDialogOpen:Ve,setIsDeleteDialogOpen:Ge,confirmDelete:Ye,isDownloadDialogOpen:Ze,setIsDownloadDialogOpen:P,isLoadingLinks:T,resolvedFiles:Fe,startDownload:it}=tu({teamId:r,projectId:y,assetId:m,folders:a,files:l,selectedIds:D,isPublic:ie,shareId:Oe}),{ref:lt,inView:Ie}=Mt();h(()=>{if(Ie){if(ee&&!b)Z();else if(oe&&!x)te()}},[Ie,ee,b,oe,x,Z,te]);let dt=dn((e)=>e.startTask),ct=A.api.teams[":teamId"].upload.tasks.$post,{mutate:mt}=U({mutationFn:async(e)=>{let s=await ct(e);if(!s.ok)throw Error("Failed to create upload task");return await s.json()},onMutate:()=>({files:[...Se]}),onSuccess:async(e,s,n)=>{let p=n?.files||[],f=p.map((i)=>{let v=e.createdAssets?.find((c)=>c.tempId===i.id),M=e.presignedUrls?.find((c)=>c.id===i.id);return{fileId:v?.assetId||M?.fileId||i.id,name:i.file.name,size:i.file.size}}).filter((i)=>!!i.fileId),g=p.filter((i)=>!i.file.name.startsWith(".")),E=g.length===1?g[0].file.name:`${g.length} Items`;if(e.taskId)dt(e.taskId,E,f);d.invalidateQueries({queryKey:["search",r,m]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]}),await Jc({files:p,taskId:e.taskId,teamId:r,storageBackend:e.storageBackend||"local",createdAssets:e.createdAssets,presignedUrls:e.presignedUrls,onFileFinished:async()=>{await d.invalidateQueries({queryKey:["search",r,m]})}}),d.invalidateQueries({queryKey:["search",r,m]}),d.invalidateQueries({queryKey:["teams",r,"upload","tasks"]})}}),Te=(e)=>{if(!e||e.length===0)return;let s=[],n=[],p=new Map;for(let f of e){let g=(f.webkitRelativePath||f.name).split("/");if(g.some((z)=>z.startsWith(".")))continue;let E=g.pop(),i=n,v="";for(let z of g)if(v=`${v}/${z}`,!p.has(v)){let G=[],Dt={name:z,type:"folder",id:Bo(),children:G,size:0};i.push(Dt),p.set(v,G),i=G}else i=p.get(v);let M={file:f,id:Bo()};s.push(M);let c=f.type;if(E.toLowerCase().endsWith(".wma")&&c?.startsWith("video/"))c=c.replace(/^video\//,"audio/");i.push({name:E,size:f.size,type:"file",id:M.id,children:[],mediaType:c})}Se=s,mt({param:{teamId:r},json:{parentId:m,files:n}})},ut=A.api.folders.$post,{mutate:ft,isPending:Ee}=U({mutationFn:async(e)=>{let s=await ut({json:{name:e,parentId:m}});if(!s.ok)throw Error("Failed to create folder");return await s.json()},onSuccess:()=>{R.success(gl()),F(!1),le(""),d.invalidateQueries({queryKey:["search",r,m]}),d.invalidateQueries({queryKey:["folders"]})},onError:(e)=>{R.error(`Error: ${e.message}`)}}),{mutate:gt,isPending:V}=U({mutationFn:async()=>{let e=await A.api.projects[":projectId"]["empty-trash"].$post({param:{projectId:y}});if(!e.ok)throw Error("Failed to empty trash");return await e.json()},onSuccess:()=>{R.success(EI()),d.invalidateQueries({queryKey:["projects",y,"recently-deleted"]}),qe(),Q(!1)},onError:(e)=>{R.error(`Error: ${e.message}`)}}),ht=(e)=>{if(e.preventDefault(),!I.trim())return;ft(I.trim())},wt=!se&&a.length===0&&l.length===0&&!b&&!x;return o("div",{className:"flex-1 flex flex-col min-h-0 bg-background overflow-hidden relative",children:[_&&o(B,{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:ae,multiple:!0,webkitdirectory:"true",className:"hidden",onChange:(e)=>{if(e.target.files)Te(e.target.files)}})]}),k&&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($r,{className:"h-4 w-4 text-amber-500 shrink-0"}),t("span",{className:"text-xs",children:dp()})]}),We&&t(S,{variant:"destructive",size:"sm",disabled:V||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(tA,{}):o("div",{className:"max-w-lg mx-auto w-full",children:[ce>0&&o("div",{className:"mb-4",children:[o("button",{onClick:()=>je(!O),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-3 font-medium select-none cursor-pointer",children:[O?t(be,{className:"h-4 w-4"}):t(pt,{className:"h-4 w-4"}),o("span",{children:[De(ce,!1),Le?` • ${Kr(ve)}`:""]})]}),O&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:a.map((e)=>t(eu,{item:e,isSelected:J?.id===e.id,isChecked:D.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>_e(e,s),onFinishEditing:()=>Ce(null),onAction:(s,n)=>Ne(s,n),isRecentlyDeleted:k,isRecents:N,selectedCount:D.size,canEdit:_,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(be,{className:"h-4 w-4"}):t(pt,{className:"h-4 w-4"}),o("span",{children:[De(he,!0),Pe?` • ${Kr(we)}`:""]})]}),j&&t("div",{className:"grid grid-cols-1 gap-4 w-full",children:l.map((e)=>t(Xc,{teamId:r,item:e,isSelected:J?.id===e.id,isChecked:D.has(e.id),isEditing:xe===e.id,onSelect:X,onDoubleClick:Y,onContextMenu:()=>{},onDragStart:()=>{},onDrop:()=>{},onRename:(s)=>_e(e,s),onFinishEditing:()=>Ce(null),onSaveField:(s,n)=>Be?.(e.id,s,n),fields:[],onAction:(s,n)=>Ne(s,n),isRecentlyDeleted:k,isRecents:N,selectedCount:D.size,canEdit:_,isShareView:q,allowDownload:re},e.id))})]})]}),wt&&t("div",{className:"flex flex-col items-center justify-center h-64 text-sm text-muted-foreground p-6 text-center",children:N?o("div",{className:"flex flex-col items-center gap-2",children:[t(Ms,{className:"h-10 w-10 text-muted-foreground/40 mb-1"}),t("p",{className:"font-medium text-foreground",children:Kf()}),t("p",{className:"text-xs text-muted-foreground",children:Wf()})]}):t("span",{children:Ip()})}),t("div",{ref:lt,className:"py-4 flex justify-center items-center min-h-6",children:(b||x)&&t(L,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]}),_&&!k&&!N&&!q&&!ie&&t("div",{className:"fixed bottom-6 right-6 z-30",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(S,{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(fe,{className:"h-6 w-6"})})}),o(ye,{align:"end",side:"top",className:"w-48 mb-2",children:[o(W,{onClick:()=>ne.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(so,{className:"h-4 w-4"}),t("span",{children:kp()})]}),o(W,{onClick:()=>ae.current?.click(),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(so,{className:"h-4 w-4"}),t("span",{children:Pp()})]}),o(W,{onClick:()=>F(!0),className:"flex items-center gap-2.5 py-2 cursor-pointer",children:[t(Yc,{className:"h-4 w-4"}),t("span",{children:gl()})]})]})]})}),t(pe,{open:He,onOpenChange:F,children:t(ue,{className:"sm:max-w-md",children:o("form",{onSubmit:ht,children:[o(me,{children:[t(de,{children:gl()}),t(Tt,{children:mh()})]}),t("div",{className:"py-4",children:t(H,{autoFocus:!0,placeholder:mh(),value:I,onChange:(e)=>le(e.target.value)})}),o($e,{children:[t(S,{type:"button",variant:"outline",onClick:()=>F(!1),children:ke()}),o(S,{type:"submit",disabled:!I.trim()||Ee,children:[Ee?t(L,{className:"h-4 w-4 animate-spin mr-2"}):null,Wa()]})]})]})})}),t(Je,{open:Ve,onOpenChange:Ge,children:o(Xe,{children:[o(et,{children:[t(rt,{children:Oc()}),t(nt,{children:Nc()})]}),o(tt,{children:[t(st,{children:ke()}),t(ot,{onClick:()=>Ye(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:at()})]})]})}),t(Je,{open:Ke,onOpenChange:Q,children:o(Xe,{children:[o(et,{children:[t(rt,{children:q_()}),t(nt,{children:j_()})]}),o(tt,{children:[t(st,{children:ke()}),t(ot,{onClick:()=>gt(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:V,children:V?"Deleting...":at()})]})]})}),t(pe,{open:Ze,onOpenChange:P,children:o(ue,{className:"sm:max-w-md",children:[o(me,{children:[t(de,{children:T?Qh():qm()}),t(Tt,{children:T?hg():ph()})]}),T?o("div",{className:"space-y-4 py-6 flex flex-col items-center justify-center",children:[t(L,{className:"h-8 w-8 animate-spin text-primary"}),t("span",{className:"text-sm font-medium text-muted-foreground mt-2",children:Vh()})]}):o("div",{className:"space-y-4 py-2",children:[t("div",{className:"text-sm text-muted-foreground",children:Xm({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($r,{className:"h-5 w-5 shrink-0 mt-0.5"}),o("div",{children:[t("p",{className:"font-semibold",children:Zh()}),t("p",{className:"mt-0.5 text-xs text-amber-700/90 dark:text-amber-400/90",children:hh()})]})]})]}),t($e,{children:!T?o(B,{children:[t(S,{variant:"outline",onClick:()=>P(!1),children:ke()}),o(S,{onClick:it,className:"gap-2",disabled:Fe.length===0,children:[t(vt,{className:"h-4 w-4"}),Ng()]})]}):t(S,{variant:"outline",onClick:()=>P(!1),children:ke()})})]})})]})}
2
- export{Ll};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{kt}from"./chunk-5tcdwep5.js";import{He}from"./chunk-jgs8an3h.js";import{z}from"./chunk-fnmwksnb.js";var _=z(kt()),N=z(He()),yc="AWS_ACCESS_KEY_ID",_c="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",Pu=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[yc],E=process.env[_c],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{yc,_c,Pu};
@@ -1 +0,0 @@
1
- import{h,C,t,Z,Fe,A,it,_t,Gp}from"./chunk-7rhz2gze.js";import"./chunk-7kjgvxqa.js";import"./chunk-tm7f32c7.js";import"./chunk-gc5sbfa5.js";import"./chunk-77fmkpdz.js";import"./chunk-1j27fzy1.js";import"./chunk-7pw1550a.js";import"./chunk-rssgmj7x.js";import"./chunk-8e28hcny.js";import"./chunk-914bp49r.js";import"./chunk-snhsjs4x.js";import"./chunk-0qaq0sp8.js";import{qn}from"./chunk-dj92fss9.js";import{er}from"./chunk-5vzrpz50.js";import"./chunk-98715kc3.js";import"./chunk-m9pr03kn.js";import"./chunk-5adsx8x4.js";import"./chunk-j2bvj2yn.js";import"./chunk-cbgq517y.js";import"./chunk-gk2q9a3f.js";import"./chunk-9t8n2des.js";import"./chunk-ytdwk2fq.js";import"./chunk-0zv3bks2.js";C();function l(){let{projectId:o,folderId:n}=c.useParams(),{teamId:r,ensureTeamIdForProject:a}=it();h(()=>{a(o)},[o,a]);let{data:s}=er(Gp(o)),e=s?.rootFolder,{data:i}=Z({queryKey:["folders",e],queryFn:()=>(async()=>await(await A.api.folders[":folderId"].$get({param:{folderId:e}})).json())(),enabled:!!e});if(!r||!e||!i)return t(_t,{});return t(qn,{teamId:r,projectId:o,projectName:s.name??"",assetId:n,rootFolderId:e})}var c=Fe("/projects/$projectId/folders/$folderId")({component:l});export{c as Route};
@@ -1,2 +0,0 @@
1
- import{T}from"./chunk-7rhz2gze.js";var e=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Hl=T("code",e);
2
- export{Hl};
@@ -1 +0,0 @@
1
- import{h,C,t,Z,Fe,A,it,_t,Fp}from"./chunk-7rhz2gze.js";import"./chunk-7kjgvxqa.js";import"./chunk-tm7f32c7.js";import"./chunk-gc5sbfa5.js";import"./chunk-77fmkpdz.js";import"./chunk-1j27fzy1.js";import"./chunk-7pw1550a.js";import"./chunk-rssgmj7x.js";import"./chunk-8e28hcny.js";import"./chunk-914bp49r.js";import"./chunk-snhsjs4x.js";import"./chunk-0qaq0sp8.js";import{qn}from"./chunk-dj92fss9.js";import{er}from"./chunk-5vzrpz50.js";import"./chunk-98715kc3.js";import"./chunk-m9pr03kn.js";import"./chunk-5adsx8x4.js";import"./chunk-j2bvj2yn.js";import"./chunk-cbgq517y.js";import"./chunk-gk2q9a3f.js";import"./chunk-9t8n2des.js";import"./chunk-ytdwk2fq.js";import"./chunk-0zv3bks2.js";C();function i(){let{projectId:o}=l.useParams(),{teamId:r,ensureTeamIdForProject:a}=it();h(()=>{a(o)},[o,a]);let{data:s}=er(Fp(o)),e=s?.rootFolder,{data:n}=Z({queryKey:["folders",e],queryFn:()=>(async()=>await(await A.api.folders[":folderId"].$get({param:{folderId:e}})).json())(),enabled:!!e});if(!r||!e||!n)return t(_t,{});return t(qn,{teamId:r,projectId:o,projectName:s.name??"",assetId:"recents",rootFolderId:e})}var l=Fe("/projects/$projectId/recents")({component:i});export{l as Route};
@@ -1,2 +0,0 @@
1
- import{h,O,w,u,C,B,t,o,K,Z,U,ut,Re,A,E,dg,fg,HC,Pt,us,kr,un,jn,qc,Ar,en,Ur,Qt,yr,Do,Lo}from"./chunk-7rhz2gze.js";import{Or}from"./chunk-7kjgvxqa.js";import{Aa}from"./chunk-tm7f32c7.js";import{ga}from"./chunk-1j27fzy1.js";import{oi,Dl}from"./chunk-7pw1550a.js";import{Ll}from"./chunk-8e28hcny.js";import{ba}from"./chunk-snhsjs4x.js";import{Sr}from"./chunk-0qaq0sp8.js";C();function Ce(i,s,F,r,c,f){let D=i.type==="folder",g=s.type==="folder";if(D!==g)return null;let x=g?r:c,b=x.findIndex((a)=>a.id===F),S=x.findIndex((a)=>a.id===s.id);if(b===-1||S===-1)return null;let T=Math.min(b,S),q=Math.max(b,S),v=x.slice(T,q+1),l=new Set(f);return v.forEach((a)=>{if(a.id)l.add(a.id)}),l}function qn({teamId:i,projectId:s,projectName:F,assetId:r,rootFolderId:c,collection:f,onUpdateCollection:D}){let g=Re(),x=K(),{canEdit:b}=Pt(s),{setFields:S}=Or(),T=A.api.files[":fileId"].metadata.$patch,{mutate:q}=U({mutationFn:async(e)=>{if(!(await T(e)).ok)throw Error("Failed to patch metadata");return null}}),{data:v}=Z({queryKey:["fields",s],queryFn:async()=>{let e=await A.api.projects[":projectId"].fields.$get({param:{projectId:s}});if(!e.ok)throw Error("Failed to fetch fields");return await e.json()},enabled:!!s});h(()=>{if(v)S(v,s)},[v,s,S]);let l=r==="recently-deleted",a=r==="recents",[te,Q]=u(null),[p,L]=u(new Set),[W,se]=u(null),[Pe,ke]=u(240),[Ne,Me]=u(360),{isChatbotOpen:_}=yr(),{members:Ae,fetchMembers:oe}=Ur(),{metadata:ze,fetchMetadata:ne,setMetadata:Le}=Lo();h(()=>{if(i)oe(i),ne(i)},[i,oe,ne]);let H=O(()=>f?.filter?.searchFilter?.conditions||[],[f]),[I,V]=u(H);h(()=>{V(H)},[H]);let ae=`project:${s}:sort`,P=ze[ae]||{field:"custom",order:"asc"},je=(e)=>{if(e)Le(i,ae,e)},m=!!f,R=I.length>0||m,{fileListLeftSidebarCollapsed:re,setFileListLeftSidebarCollapsed:De,fileListRightSidebarCollapsed:ie,setFileListRightSidebarCollapsed:$e,viewModes:Te}=Qt(),le=Te[s]??"card",qe=w(null),{data:k}=l||a?{data:void 0}:Z({queryKey:["folders",r],queryFn:async()=>{let e=await A.api.folders[":folderId"].$get({param:{folderId:r}});if(!e.ok)throw Error("failed to fetch folder");return await e.json()}}),{setProjectState:de,clearProjectState:ce}=en();h(()=>(de({teamId:i,projectId:s,projectName:F,rootFolderId:c,ancestorFolders:k?.ancestorFolders??[],currentAsset:l?{name:dg(),type:"folder"}:a?{name:fg(),type:"folder"}:m?{id:f.id,name:f.name,type:"folder"}:{id:k?.id||r,name:k?.name,type:"folder"},isRootFolder:!l&&!a&&!m&&r===c,onFolderClick:(e)=>{g({to:"/projects/$projectId/folders/$folderId",params:{projectId:s,folderId:e}})}}),()=>ce()),[i,s,F,k,l,a,r,c,de,ce,g]);let{data:X,fetchNextPage:fe,hasNextPage:pe,isFetchingNextPage:ue,isLoading:Ee}=ut({queryKey:l?["projects",s,"recently-deleted","folder"]:a?["projects",s,"recents","folder"]:["search",i,r,"folder",I,P,m],queryFn:async({pageParam:e})=>{if(l||m||a){if(l){let d=await A.api.projects[":projectId"]["recently-deleted"].$get({param:{projectId:s},query:{assetType:"folder",after:e}});if(!d.ok)throw Error("failed to fetch recently deleted folders");return await d.json()}return{data:[],pageInfo:{total:0}}}if(R)return{data:[],pageInfo:{total:0}};let n=await A.api.folders[":folderId"].search.$post({param:{folderId:r},json:{assetType:"folder",after:e,recursively:!1,sort:P,conditions:[]}});if(!n.ok)throw Error("failed to search folders");return await n.json()},enabled:!R&&!a,initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),{data:G,fetchNextPage:ge,hasNextPage:me,isFetchingNextPage:he,isLoading:Ke}=ut({queryKey:l?["projects",s,"recently-deleted","file"]:a?["projects",s,"recents","file"]:["search",i,r,"file",I,P,m],queryFn:async({pageParam:e})=>{if(l){let d=await A.api.projects[":projectId"]["recently-deleted"].$get({param:{projectId:s},query:{assetType:"file",after:e}});if(!d.ok)throw Error("failed to fetch recently deleted files");return await d.json()}if(a){let d=await A.api.projects[":projectId"].recents.$get({param:{projectId:s},query:{after:e,first:"20"}});if(!d.ok)throw Error("failed to fetch recent files");return await d.json()}let n=await A.api.folders[":folderId"].search.$post({param:{folderId:r},json:{assetType:"file",after:e,recursively:R||m,conditions:I,sort:P}});if(!n.ok)throw Error("failed to search files");return await n.json()},initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),N=X?.pages.flatMap((e)=>e.data??[])??[],y=G?.pages.flatMap((e)=>e.data??[])??[],ye=(!R&&!a?Ee:!1)||Ke,xe=X?.pages[0]?.pageInfo?.total,Se=G?.pages[0]?.pageInfo?.total,Fe=X?.pages[0]?.pageInfo?.totalSize,we=G?.pages[0]?.pageInfo?.totalSize,J=()=>{L(new Set),Q(null),se(null)},{dragState:M,handleDragStart:Qe,handleDragEnd:Oe}=Dl({teamId:i,projectId:s,assetId:r,folders:N,files:y,selectedIds:p,onClearSelection:J}),Y=O(()=>{if(p.size!==1)return null;let e=Array.from(p)[0];return y.find((d)=>d.id===e)||null},[p,y]),be=(e)=>{if(l)return;if(e.type==="folder")V([]),g({to:"/projects/$projectId/folders/$folderId",params:{projectId:s,folderId:e.id}});else g({to:"/projects/$projectId/files/$fileId",params:{projectId:s,fileId:e.versionStack?e.versionStack.id:e.id},search:{version:void 0}})},ve=(e,n)=>{let d=n.metaKey||n.ctrlKey;if(n.shiftKey&&W){let Ie=[...N,...y].find((j)=>j.id===W);if(Ie){let j=Ce(Ie,e,W,N,y,p);if(j){L(j),Q(e);return}}}if(d){let z=new Set(p);if(z.has(e.id))z.delete(e.id);else z.add(e.id);L(z)}else L(new Set([e.id]));se(e.id),Q(e)},ee=(e,n,d)=>{q({param:{fileId:e},json:[{key:n,value:d}]},{onSuccess:()=>{x.invalidateQueries({queryKey:["folders",r,"children",{assetType:"file"}]}),x.invalidateQueries({queryKey:["search",i,r]})}})};if(Do())return t(Ll,{teamId:i,projectId:s,assetId:r,folders:N,files:y,totalFolders:xe,totalFiles:Se,totalFoldersSize:Fe,totalFilesSize:we,selectedItem:te,selectedIds:p,onItemSelect:ve,onItemDoubleClick:be,onSaveField:ee,onClearSelection:J,fetchNextFoldersPage:fe,hasNextFoldersPage:pe||!1,isFetchingNextFoldersPage:ue,fetchNextFilesPage:ge,hasNextFilesPage:me||!1,isFetchingNextFilesPage:he,isRecentlyDeleted:l,isRecents:a,isLoading:ye,rootFolderId:c});return o(jn,{modifiers:[oi.configure({anchor:{x:0,y:0}})],plugins:(e)=>e.map((n)=>{if(n===us)return us.configure({dropAnimation:null});if(typeof n==="object"&&n!==null&&"plugin"in n&&n.plugin===us)return us.configure({dropAnimation:null});return n}),sensors:l||a||!b?[]:[un.configure({activationConstraints:[new kr.Distance({value:10})]})],onDragStart:Qe,onDragEnd:Oe,children:[t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{ref:qe,className:"flex flex-1 overflow-hidden relative",children:[!re&&t("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>De(!0)}),(!ie||_)&&t("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>{$e(!0),yr.getState().setIsChatbotOpen(!1)}}),!re&&o(B,{children:[t("div",{className:"bg-background",style:{width:Pe},children:t(Ar,{teamId:i,projectId:s,projectName:F,rootFolderId:c,dragState:M,ancestorFolders:k?.ancestorFolders??[]})}),t(Sr,{onResize:(e)=>{ke((n)=>Math.max(180,Math.min(400,n+e)))},className:"hidden md:block"})]}),t(Aa,{teamId:i,projectId:s,assetId:r,folders:N,files:y,totalFolders:xe,totalFiles:Se,totalFoldersSize:Fe,totalFilesSize:we,selectedItem:te,selectedIds:p,onItemSelect:ve,onItemDoubleClick:be,onSaveField:ee,displayStyle:le,onClearSelection:J,fetchNextFoldersPage:fe,hasNextFoldersPage:pe||!1,isFetchingNextFoldersPage:ue,fetchNextFilesPage:ge,hasNextFilesPage:me||!1,isFetchingNextFilesPage:he,isRecentlyDeleted:l,isRecents:a,isLoading:ye,filterConditions:I,onFilterChange:V,sort:P,onSortChange:je,dragState:M,collection:f,onUpdateCollection:D,rootFolderId:c}),(!ie||_)&&o(B,{children:[t(Sr,{onResize:(e)=>{Me((n)=>Math.max(240,Math.min(600,n-e)))},className:"hidden md:block"}),t("div",{style:{width:Ne},className:"bg-background flex flex-col flex-shrink-0",children:_?t(ga,{projectId:s,contextAssetId:r}):Y?t(ba,{teamId:i,projectId:s,file:Y,onSaveField:(e,n)=>ee(Y.id,e,n),members:Ae,hideAnnotationControl:!0}):t("div",{className:"flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground",children:HC()})})]})]})}),t(qc,{children:M?.isActive?t("div",{className:E("flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium text-popover-foreground shadow-md ring-1 ring-border cursor-grabbing",le==="list"&&"w-30 h-[40px] px-0 flex-none overflow-hidden justify-center"),style:{transform:"translate(0px, 0px)"},children:o("span",{children:["Moving ",M.itemCount," item",M.itemCount!==1?"s":""]})}):null})]})}
2
- export{qn};
@@ -1,2 +0,0 @@
1
- import{N,h,O,w,u,C,B,t,o,K,Z,U,ut,A,T,wr,L,ko,Me,be,Gr,pt,vt,Xt,ve,De,E,S,ge,Ga,Ae,ye,W,Qr,Gt,Qa,Va,Ka,py,ke,od,at,Nc,Oc,gr,id,rb,Ab,Ti,Lf,Ov,Oh,Dh,bl,Kh,tp,No,Oo,kd,Je,Xe,et,tt,rt,nt,ot,st,pe,ue,me,$e,de,H,ie,Pt,Mt,R,wo,vo,Vr,En,we,Ur,Hd}from"./chunk-7rhz2gze.js";import{ya,_a,ru,nu,fs,Zi,ou}from"./chunk-snhsjs4x.js";import{Or,ps,hs}from"./chunk-7kjgvxqa.js";import{Us}from"./chunk-77fmkpdz.js";var ct=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Qe=T("pencil",ct);function ni({file:i,mediaControllerRef:a,onPlay:r,onPause:l,onTimeUpdate:D,annotations:c,startTime:I,shareId:v,allowDownload:y,children:m}){let b=fs(i),z=b.viewer;return t(z,{ref:a,file:i,onPlay:r,onPause:l,onTimeUpdate:D,annotations:c,startTime:I,shareId:v,allowDownload:y,children:m},b.id)}C();C();function Ge({teamId:i,projectId:a,file:r,onSaveField:l,members:D,onCommentSelect:c,hideAnnotationControl:I=!1,readOnly:v=!1,publicFields:y,isPublic:m=!1,shareId:b,currentTime:z,onTyping:te,selectedCommentId:f,heightPercent:_,onHeightPercentChange:Q}){let{canEdit:j}=Pt(a),{fields:p,setFields:J}=Or(),se=K(),{ref:re,inView:fe}=Mt(),[s,P]=u(null),[q,ne]=u(!1),[Ne,Ee]=u(null),G=w(!1),ze=w(0),Y=w(_),je=(e)=>{G.current=!0,ze.current=e.clientY,Y.current=_,e.target.setPointerCapture?.(e.pointerId)},Pe=N((e)=>{if(!G.current)return;let k=(ze.current-e.clientY)/window.innerHeight*100,oe=Math.min(85,Math.max(10,Y.current+k));Q(oe)},[Q]),Te=(e)=>{G.current=!1;try{e.target.releasePointerCapture?.(e.pointerId)}catch{}},{data:ee}=Z({queryKey:["fields",a],queryFn:async()=>{let e=await A.api.projects[":projectId"].fields.$get({param:{projectId:a}});if(!e.ok)throw Error("Failed to fetch fields");return await e.json()},enabled:!!a&&!y}),M=fs(r);h(()=>{if(y)J(y,a);else if(ee)J(ee,a)},[ee,y,a,J]);let{data:he,fetchNextPage:X,hasNextPage:Ie}=ut({queryKey:m?["shares",b,"files",r?.id,"comments"]:["files",r?.id,"comments"],queryFn:async({pageParam:e})=>{if(m){let d=localStorage.getItem(`share_pwd_${b}`)||"",k=await A.api.shares[":shareId"].files[":fileId"].comments.$get({param:{shareId:b,fileId:r.id},query:{after:e}},{headers:{"x-share-password":d}});if(!k.ok)throw Error("Failed to fetch comments");return await k.json()}else{let d=await A.api.files[":fileId"].comments.$get({param:{fileId:r.id},query:{after:e}});if(!d.ok)throw Error("Failed to fetch comments");return await d.json()}},enabled:!!r?.id&&(!m||!!b),initialPageParam:"",refetchInterval:2000,getNextPageParam:(e)=>e.pageInfo?.cursor||void 0}),{mutate:Fe}=U({mutationFn:async({text:e,attachmentIds:d,annotations:k,replyToId:oe,guestUserId:xe,second:Ce})=>{if(m){let le=localStorage.getItem(`share_pwd_${b}`)||"",Be=await A.api.shares[":shareId"].files[":fileId"].comments.$post({param:{shareId:b,fileId:r.id},json:{message:e,attachmentIds:d,replyToId:oe??void 0,annotations:k,second:Ce??void 0}},{headers:{"x-share-password":le,...xe?{"x-guest-user-id":xe}:{}}});if(!Be.ok)throw Error("Failed to create comment");return await Be.json()}else{let le=await A.api.files[":fileId"].comments.$post({param:{fileId:r.id},json:{message:e,attachmentIds:d,replyToId:oe??void 0,annotations:k,second:Ce??void 0}});if(!le.ok)throw Error("Failed to create comment");return await le.json()}},onSuccess:()=>{se.invalidateQueries({queryKey:m?["shares",b,"files",r?.id,"comments"]:["files",r?.id,"comments"]})},onError:()=>{R.error(Ab?.()||"Failed to post comment")}}),Se=he?.pages?.[0]?.pageInfo?.total??he?.pages.reduce((e,d)=>e+(d.data?.length||0),0)??0;h(()=>{if(fe&&Ie)X()},[fe,X,Ie]);let V=O(()=>(r?.fieldValues||[]).reduce((e,d)=>(e[d.fieldId]=d,e),{}),[r?.fieldValues]),ae=O(()=>[...p].sort((e,d)=>{let k=e.config?.name?.toLowerCase()||"",oe=d.config?.name?.toLowerCase()||"";if(k<oe)return-1;if(k>oe)return 1;return 0}),[p]),Ve=he?.pages.flatMap((e)=>e.data??[])??[],_e=(e,d,k=[],oe,xe)=>{if(!e.trim()&&d.length===0&&k.length===0)return;let Ce=oe||s?.id||null;if(m){let le=localStorage.getItem(`guest_user_id_${b}`);if(!le)Ee({text:e,attachmentIds:d,annotations:k,replyToId:Ce,second:xe}),ne(!0);else Fe({text:e,attachmentIds:d,annotations:k,replyToId:Ce,guestUserId:le,second:xe})}else Fe({text:e,attachmentIds:d,annotations:k,replyToId:Ce,second:xe});P(null)},Oe=(e)=>{if(Ne)Fe({...Ne,guestUserId:e}),Ee(null),P(null)},Re=(e)=>{let d=D.find((k)=>k.id===e);if(d)return d;return{id:"unknown",name:"Unknown",role:"unknown"}},Le=_<=15;return o("div",{style:{height:`${_}dvh`},className:"shrink-0 flex flex-col bg-background border-t border-border shadow-2xl rounded-t-2xl overflow-hidden select-none z-20","data-testid":"mobile-bottom-sheet",children:[t("div",{onPointerDown:je,onPointerMove:Pe,onPointerUp:Te,onPointerCancel:Te,className:"w-full pt-2 pb-1.5 flex flex-col items-center justify-center cursor-grab active:cursor-grabbing touch-none shrink-0","aria-label":"Drag to resize bottom sheet",children:t("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/30 hover:bg-muted-foreground/50 transition-colors"})}),o(wo,{defaultValue:"comments",className:"flex-1 flex flex-col min-h-0 px-2 pb-1 overflow-hidden",children:[o(vo,{className:"w-full shrink-0 h-9 bg-muted/60 p-1",children:[o(Vr,{value:"comments",className:"flex-1 text-xs font-semibold py-1",children:[od()," ",Se>0&&`(${Se})`]}),t(Vr,{value:"fields",className:"flex-1 text-xs font-semibold py-1",children:Ti()})]}),o(En,{value:"comments",className:E("flex-1 flex flex-col overflow-hidden min-h-0 mt-2",Le&&"hidden"),children:[t("div",{className:"flex items-center justify-between px-2 pb-1.5 shrink-0 border-b border-border/50",children:o("span",{className:"text-xs font-bold text-foreground",children:[py?.()||"All comments",Se>0?` (${Se})`:""]})}),t(ie,{className:"flex-1 min-h-0 px-2 py-2 [&>div>div]:block!",children:Ve.length===0?t("div",{className:"py-8 text-center text-xs text-muted-foreground",children:Dh()}):o("div",{className:"space-y-3",children:[Ve.map((e)=>o("div",{children:[t(Zi,{teamId:i,message:e,getUser:Re,onReply:P,hasReplies:!!e.replies?.length,formatTimestamp:M?.commentsConfig?.formatTimestamp,frameRate:M?.commentsConfig?.hasTimestamp?r?.media?.metadata?.frameRate||30:void 0,startTimecode:M?.commentsConfig?.hasTimestamp?r?.media?.metadata?.startTimecode:void 0,isSelected:f===e.id,onSelect:()=>{c?.(e)}}),e.replies?.map((d,k)=>t("div",{children:t(Zi,{teamId:i,isReply:!0,message:d,getUser:Re,onReply:P,hasReplies:!1,isLastReply:k===(e.replies?.length??0)-1,formatTimestamp:M?.commentsConfig?.formatTimestamp,frameRate:M?.commentsConfig?.hasTimestamp?r?.media?.metadata?.frameRate||30:void 0,startTimecode:M?.commentsConfig?.hasTimestamp?r?.media?.metadata?.startTimecode:void 0,isSelected:f===d.id,onSelect:()=>{c?.(d)}})},d.id))]},e.id)),t("div",{ref:re})]})}),(!v||m)&&t("div",{className:"mt-auto shrink-0 bg-background border-t border-border pt-1",children:t(ou,{isOpen:q,onClose:()=>ne(!1),onSuccess:Oe,children:t(Us,{projectId:a,onSendMessage:_e,replyingTo:s,onCancelReply:()=>P(null),hideAnnotationControl:I,disableMentions:m,currentTime:M?.commentsConfig?.hasTimestamp?z:void 0,formatTimestamp:M?.commentsConfig?.formatTimestamp,frameRate:M?.commentsConfig?.hasTimestamp?r?.media?.metadata?.frameRate||30:void 0,startTimecode:M?.commentsConfig?.hasTimestamp?r?.media?.metadata?.startTimecode:void 0,onTyping:te})})})]}),t(En,{value:"fields",className:E("flex-1 flex flex-col overflow-hidden min-h-0 mt-2",Le&&"hidden"),children:t(ie,{className:"flex-1 px-3 py-2 min-h-0 [&>div>div]:block!",children:ae&&ae.length>0?t("div",{className:"space-y-4 pb-6",children:ae.map((e)=>o("div",{className:"space-y-1.5",children:[t("label",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:e.config?.name}),t("div",{className:"min-h-[32px]",children:t(hs,{fieldId:e.id,config:e.config,value:V[e.id]?.value,onSave:j?(d)=>l(e.id,d):void 0,readOnly:v||e.readOnly||!j})})]},e.id))}):t("div",{className:"py-8 text-center text-xs text-muted-foreground",children:"No custom fields defined"})})})]})]})}function Ye({fileName:i,folderName:a,version:r,versions:l,activeFileId:D,isPublic:c=!1,shareId:I,allowDownload:v=!0,downloadInfo:y,canEdit:m=!1,onBack:b,onPrevFile:z,onNextFile:te,hasPrevFile:f=!1,hasNextFile:_=!1,onSelectVersion:Q,onRename:j,onDelete:p,onLinkedTasks:J,linkedTaskCount:se=0}){let re=async(s)=>{try{let P=c&&I?await A.api.shares[":shareId"].files[":fileId"]["download-url"].$post({param:{shareId:I,fileId:D},json:{key:s}}):await A.api.files["download-url"].$post({json:{key:s,assetId:D}});if(!P.ok)return;let{url:q}=await P.json(),ne=document.createElement("a");ne.href=q,ne.download="",document.body.appendChild(ne),ne.click(),document.body.removeChild(ne)}catch{}},fe=(y?.videoTranscodes?.length??0)>0;return o("header",{className:"flex h-12 w-full items-center justify-between border-b border-border bg-card px-2 py-1.5 shrink-0 select-none z-30",children:[t("div",{className:"flex items-center",children:t(S,{variant:"ghost",size:"icon",onClick:b,className:"h-8 w-8 text-foreground hover:bg-accent cursor-pointer","aria-label":tp(),children:t(Gr,{className:"h-5 w-5"})})}),o("div",{className:"flex flex-1 items-center justify-center gap-1 min-w-0 px-1",children:[o("div",{className:"flex items-center min-w-0 max-w-[65vw]",children:[a&&o(B,{children:[t("span",{className:"truncate text-xs font-medium text-muted-foreground max-w-[80px]",children:a}),t("span",{className:"text-muted-foreground mx-1 text-xs",children:"/"})]}),l&&l.length>1?o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:o("button",{className:"flex items-center gap-1 min-w-0 truncate text-xs font-medium text-foreground hover:bg-accent rounded px-1 py-0.5 transition-colors cursor-pointer",children:[t("span",{className:"truncate max-w-[120px] font-semibold",children:i}),r!==void 0&&o(we,{variant:"outline",className:"px-1 py-0 text-[10px] shrink-0 font-normal",children:["v",r]}),t(be,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),o(ye,{align:"center",className:"w-48 z-40",children:[t(Qr,{className:"text-xs",children:kd()}),l.map((s)=>o(W,{onClick:()=>Q?.(s.id),className:E("flex items-center justify-between text-xs cursor-pointer",s.id===D?"bg-accent font-semibold text-accent-foreground":""),children:[o("span",{children:["v",s.version]}),t("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:s.name||i})]},s.id))]})]}):o("div",{className:"flex items-center gap-1 min-w-0 truncate",children:[t("span",{className:"truncate text-xs font-semibold text-foreground max-w-[140px]",children:i}),r!==void 0&&o(we,{variant:"outline",className:"px-1 py-0 text-[10px] shrink-0 font-normal",children:["v",r]})]})]}),(f||_)&&o("div",{className:"flex items-center gap-0.5 shrink-0 bg-muted/60 rounded p-0.5 ml-1",children:[t(S,{variant:"ghost",size:"icon",disabled:!f,onClick:z,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:Kh(),"aria-label":Kh(),children:t(Gr,{className:"h-3.5 w-3.5"})}),t(S,{variant:"ghost",size:"icon",disabled:!_,onClick:te,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:Oh(),"aria-label":Oh(),children:t(pt,{className:"h-3.5 w-3.5"})})]})]}),t("div",{className:"flex items-center gap-1",children:o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(S,{variant:"ghost",size:"icon",className:"h-8 w-8 text-foreground hover:bg-accent cursor-pointer","aria-label":Ov(),children:t(wr,{className:"h-4 w-4"})})}),o(ye,{align:"end",className:"w-52 z-40",children:[v&&(fe?o(Qa,{children:[o(Va,{className:"flex items-center gap-2 text-xs cursor-pointer",children:[t(vt,{className:"h-3.5 w-3.5"}),t("span",{children:gr()})]}),t(Ga,{children:o(Ka,{className:"w-48 z-50",children:[t(Qr,{className:"text-xs",children:gr()}),y?.videoTranscodes?.map((s)=>{let P=Math.max(s.width,s.height),q=`${s.height}p`;if(P>=3840)q="2160p";else if(P>=1920)q="1080p";else if(P>=1280)q="720p";else if(P>=960)q="540p";else if(P>=640)q="360p";else if(P>=320)q="180p";return o(W,{onClick:()=>re(s.key),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{children:q}),t("span",{className:"text-[10px] text-muted-foreground",children:"MP4"})]},q)}),y?.originalKey&&o(B,{children:[t(Gt,{}),o(W,{onClick:()=>re(y.originalKey),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{children:bl?.()||"Original"}),t("span",{className:"text-[10px] text-muted-foreground",children:i.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})})]}):o(W,{onClick:()=>y?.originalKey&&re(y.originalKey),disabled:!y?.originalKey,className:"flex items-center gap-2 text-xs cursor-pointer",children:[t(vt,{className:"h-3.5 w-3.5"}),t("span",{children:gr()})]})),l&&l.length>1&&Q&&o(Qa,{children:[t(Va,{className:"flex items-center gap-2 text-xs cursor-pointer",children:t("span",{children:kd?.()||"Switch version"})}),t(Ga,{children:o(Ka,{className:"w-48 z-50",children:[t(Qr,{className:"text-xs",children:kd?.()||"Switch version"}),l.map((s)=>o(W,{onClick:()=>Q(s.id),className:E("flex items-center justify-between text-xs cursor-pointer",s.id===D?"bg-accent font-semibold text-accent-foreground":""),children:[o("span",{children:["v",s.version]}),t("span",{className:"text-[10px] text-muted-foreground truncate max-w-[120px]",children:s.name||i})]},s.id))]})})]}),J&&o(W,{onClick:J,className:"flex items-center justify-between text-xs cursor-pointer",children:[o("span",{className:"flex items-center gap-2",children:[t(ko,{className:"h-3.5 w-3.5"}),t("span",{children:Lf?.()||"Linked Tasks"})]}),se>0&&t("span",{className:"inline-flex items-center justify-center px-1.5 py-0.2 text-[10px] font-semibold rounded-full bg-muted-foreground/15 text-foreground",children:se})]}),m&&j&&o(W,{onClick:j,className:"flex items-center gap-2 text-xs cursor-pointer",children:[t(Qe,{className:"h-3.5 w-3.5"}),t("span",{children:No()})]}),m&&p&&o(B,{children:[t(Gt,{}),o(W,{onClick:p,className:"flex items-center gap-2 text-xs text-destructive focus:text-destructive cursor-pointer",children:[t(ve,{className:"h-3.5 w-3.5"}),t("span",{children:at()})]})]})]})]})})]})}function Nl({projectId:i,teamId:a="",fileId:r,file:l,projectInfo:D,ancestorFolders:c=[],versions:I,activeFileId:v,startTime:y,isPublic:m=!1,shareId:b,allowDownload:z=!0,publicFields:te,siblingFiles:f=[],onNavigateToFile:_,onNavigateBack:Q,onRenameFile:j,onDeleteFile:p,onSaveField:J,onSelectVersion:se}){let{canEdit:re}=Pt(i),{members:fe}=Ur(),s=w(null),[P,q]=u(50),[ne,Ne]=u([]),[Ee,G]=u(0),[ze,Y]=u(null),[je,Pe]=u(!1),[Te,ee]=u(""),M=w(null),[he,X]=u(!1),[Ie,Fe]=u(!1),[Se,V]=u(!1),[ae,Ve]=u(!1),{data:_e}=Z({queryKey:["teams",a,"kanban","assets",v,"tasks"],queryFn:async()=>{if(!a||!v||m)return{data:[],total:0};let x=await A.api.teams[":teamId"].kanban.assets[":assetId"].tasks.$get({param:{teamId:a,assetId:v}});if(!x.ok)return{data:[],total:0};return await x.json()},enabled:!!a&&!!v&&!m}),Oe=_e?.total??_e?.data?.length??0,{prevFile:Re,nextFile:Le}=O(()=>{if(!f||f.length===0)return{prevFile:null,nextFile:null};let x=f.findIndex((ce)=>ce.id===r||ce.id===v);if(x===-1)return{prevFile:null,nextFile:null};return{prevFile:x>0?f[x-1]:null,nextFile:x<f.length-1?f[x+1]:null}},[f,r,v]),e=c.length>0?c[0]?.name:D?.name,k=I?.find((x)=>x.id===v)?.version??(I&&I.length>0?I.length:void 0),oe=O(()=>({originalKey:l.media?.original?.key,videoTranscodes:l.media?.videoTranscodes?.map((x)=>({key:x.key,width:x.width,height:x.height}))}),[l.media]),xe=()=>{Ne([]),Y(null)},Ce=(x)=>{Y(x.id||null);let ce=x.annotations;if(ce&&ce.length>0)Ne(ce);else Ne([]);if(x.second!==null&&x.second!==void 0)s.current?.seekTo(x.second),s.current?.pause();else if(ce&&ce.length>0)s.current?.pause()},le=async(x)=>{if(x?.preventDefault(),!Te.trim()||!j)return;try{Fe(!0),await j(Te.trim()),Pe(!1)}finally{Fe(!1)}},Be=async()=>{if(!p)return;try{X(!0),await p(),V(!1)}finally{X(!1)}};return h(()=>{G(0),Y(null),Ne([])},[l?.id]),o("div",{className:"flex h-[100dvh] w-full flex-col bg-background overflow-hidden relative",children:[t(Ye,{fileName:l.name,folderName:e,version:k,versions:I,activeFileId:v,isPublic:m,shareId:b,allowDownload:z,downloadInfo:oe,canEdit:re,onBack:Q,hasPrevFile:!!Re,hasNextFile:!!Le,onPrevFile:()=>Re&&_(Re.id),onNextFile:()=>Le&&_(Le.id),onSelectVersion:se,onRename:()=>{ee(l.name),Pe(!0)},onDelete:()=>V(!0),onLinkedTasks:!m?()=>Ve(!0):void 0,linkedTaskCount:Oe}),t("div",{className:"relative flex-1 min-h-0 bg-background overflow-hidden flex flex-col",children:t(ni,{file:l,mediaControllerRef:s,onPlay:xe,onTimeUpdate:G,annotations:ne,startTime:y,shareId:b,allowDownload:z})}),t(Ge,{teamId:a,projectId:i,file:l,onSaveField:J,members:fe,onCommentSelect:Ce,hideAnnotationControl:l.proxyType==="audio",readOnly:m||!re,publicFields:te,isPublic:m,shareId:b,currentTime:Ee,onTyping:()=>s.current?.pause(),selectedCommentId:ze,heightPercent:P,onHeightPercentChange:q}),!m&&ae&&t(Hd,{teamId:a,assetId:v,assetName:l.name,isOpen:ae,onClose:()=>Ve(!1)}),!m&&t(pe,{open:je,onOpenChange:Pe,children:t(ue,{children:o("form",{onSubmit:le,children:[t(me,{children:t(de,{children:No()})}),t("div",{className:"py-4",children:t(H,{ref:M,value:Te,onChange:(x)=>ee(x.target.value),placeholder:id?.()||"Enter new name",onFocus:()=>{setTimeout(()=>{if(M.current)ps(M.current)},0)},autoFocus:!0})}),o($e,{children:[t(S,{type:"button",variant:"outline",onClick:()=>Pe(!1),children:ke()}),o(S,{type:"submit",disabled:Ie||!Te.trim(),children:[Ie&&t(L,{className:"mr-2 h-4 w-4 animate-spin"}),Oo()]})]})]})})}),!m&&t(Je,{open:Se,onOpenChange:V,children:o(Xe,{children:[o(et,{children:[t(rt,{children:Oc?.()||"Delete Asset?"}),t(nt,{children:Nc?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),o(tt,{children:[t(st,{children:ke()}),o(ot,{onClick:Be,disabled:he,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[he&&t(L,{className:"mr-2 h-4 w-4 animate-spin"}),at()]})]})]})})]})}C();function We({activeState:i,activeAsset:a,previewUrl:r,isFullScreen:l,onTogglePlay:D,onToggleLoop:c,onSeek:I,onVolumeChange:v,onToggleMute:y,onChangePlaybackRate:m,onChangeResolution:b,onZoomIn:z,onZoomOut:te,onFit:f,onDownload:_,onToggleFullScreen:Q,allowDownload:j=!0}){if(i?.kind==="video"&&i.video&&a){let p=i.video,J=p.totalFrames/p.frameRate,se=p.currentFrame/p.frameRate,re={isPlaying:p.isPlaying,progress:J>0?se/J*100:0,currentTime:se,duration:J,volume:p.volume,isMuted:p.isMuted,isLooping:p.isLooping,playbackRate:p.playbackRate,isFullScreen:l,showFrames:!1,currentResolution:p.currentResolution},fe=r&&!a.media?.videoPreview?{...a,media:{...a.media,videoPreview:{url:r}}}:a;return t(ru,{state:re,zoom:i.zoom,isControlsVisible:!0,floatOverlayInFullScreen:!1,buffered:p.buffered,data:fe,resolutions:p.resolutions,togglePlay:D,toggleLoop:c,toggleMute:y,handleVolumeChange:v,changePlaybackRate:m,changeResolution:(s)=>b(s.resolution),handleDownload:(s)=>_(s),toggleFullScreen:Q,onZoomChange:(s)=>s>=i.zoom?z():te(),onZoomReset:f,frameRate:p.frameRate,totalFrames:p.totalFrames,currentFrame:p.currentFrame,seekToFrame:I,allowDownload:j})}if(i?.kind==="image")return t(nu,{zoom:i.zoom,onZoomIn:z,onZoomOut:te,onFit:f,onDownload:()=>_(),canDownload:!!a?.media?.original?.key,fullscreen:{isFullScreen:l,onToggle:Q},allowDownload:j});return t("div",{className:"relative z-10 flex items-center justify-end gap-2 border-t border-border bg-card px-4 py-3",children:t("button",{onClick:Q,className:"text-foreground transition-colors hover:text-primary",title:"Fullscreen",children:l?t(_a,{className:"h-5 w-5"}):t(ya,{className:"h-5 w-5"})})})}function Ke({side:i,fileName:a,version:r,activeVersionId:l,versions:D,isActive:c,onActivate:I,onSwitchVersion:v,onExit:y}){let m=E("flex-shrink-0 rounded p-1 transition-colors hover:bg-muted",c?"text-foreground":"text-muted-foreground hover:text-foreground"),b=t("button",{onClick:y,title:rb(),className:m,children:t(De,{className:"h-4 w-4"})}),z=o("button",{onClick:I,className:E("flex min-w-0 items-center gap-1 rounded px-2 py-1 text-sm font-medium transition-colors hover:bg-muted",c?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[t("span",{className:"truncate",children:a}),r!==void 0&&o("span",{className:E("flex-shrink-0 rounded border px-1 py-0 text-xs",c?"border-foreground/40":"border-border"),children:["v",r]})]}),te=o(ge,{children:[t(Ae,{onClick:I,title:kd(),className:m,children:t(be,{className:"h-4 w-4"})}),t(ye,{align:i==="left"?"start":"end",className:"w-80 p-1",children:t("div",{className:"flex max-h-96 flex-col gap-1 overflow-y-auto",children:D.map((f)=>{let _=f.id===l;return o(W,{onClick:()=>v(f.id),className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2",children:[o("div",{className:"flex min-w-[2rem] flex-shrink-0 items-center justify-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground select-none",children:["v",f.version]}),t("div",{className:"flex h-10 w-16 flex-shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted",children:f.previewUrl?t("img",{src:f.previewUrl,alt:f.name||void 0,className:"h-full w-full object-cover"}):t(Xt,{className:"h-4 w-4 text-muted-foreground"})}),o("div",{className:"flex min-w-0 flex-1 flex-col text-left",children:[t("span",{className:"truncate text-sm font-semibold text-foreground",children:f.name}),t("span",{className:"truncate text-xs text-muted-foreground",children:f.creator?.name||"Unknown"})]}),_&&t(Me,{className:"ml-auto h-4 w-4 flex-shrink-0 text-primary"})]},f.id)})})})]});return t("div",{onMouseDown:I,className:E("dark flex h-10 flex-shrink-0 items-center gap-1 border-b bg-background px-2 transition-colors",c?"border-b-2 border-primary":"border-border"),children:i==="left"?o(B,{children:[b,z,te]}):o(B,{children:[z,te,t("div",{className:"ml-auto"}),b]})})}function it(i,a,r){return Z({queryKey:a?["public-share-file",r,i,localStorage.getItem(`share_pwd_${r}`)||""]:["files",i],queryFn:async()=>{if(a){let D=localStorage.getItem(`share_pwd_${r}`)||"",c=await A.api.shares[":shareId"].files[":fileId"].$get({param:{shareId:r,fileId:i}},{headers:{"x-share-password":D}});if(!c.ok)throw Error("Failed to fetch version asset");return await c.json()}let l=await A.api.files[":fileId"].$get({param:{fileId:i}});if(!l.ok)throw Error("Failed to fetch version asset");return await l.json()},enabled:!!i&&(!a||!!r)})}function Ol({isPublic:i=!1,shareId:a,versions:r,leftId:l,rightId:D,activeSide:c,annotations:I,seekRequest:v,onActiveSideChange:y,onSwitchVersion:m,onExit:b,onActiveAssetChange:z,onPlay:te,onTimeUpdate:f,allowDownload:_=!0}){let Q=w(null),j=w(null),p=w(null),[J,se]=u(null),[re,fe]=u(null),[s,P]=u(1),[q,ne]=u(!1),[Ne,Ee]=u(!1),{data:G,isLoading:ze}=it(l,i,a),{data:Y,isLoading:je}=it(D,i,a),Pe=fs(G),Te=fs(Y),ee=!!G&&!!Y&&Pe.id===Te.id,M=c==="left"?G:Y,he=c==="left"?J:re,X=N(()=>c==="left"?j.current:p.current,[c]),Ie=N(()=>c==="left"?p.current:j.current,[c]);h(()=>{z(M??null)},[M,z]),h(()=>{if(!v)return;let n=X();if(n?.seekToSecond(v.second),n?.pause(),ee){let g=Ie();g?.seekToSecond(v.second),g?.pause()}},[v?.nonce]),h(()=>{let n=()=>Ee(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);let Fe=N((n)=>se(n),[]),Se=N((n)=>fe(n),[]),V=N((n)=>{let g=X();if(g)n(g);if(ee){let F=Ie();if(F)n(F)}},[X,Ie,ee]),ae=N(()=>{let n=!he?.video?.isPlaying;V((g)=>n?g.play():g.pause())},[he?.video?.isPlaying,V]);h(()=>{let n=(g)=>{let F=document.activeElement;if(F&&(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F instanceof HTMLElement&&F.isContentEditable))return;let He=g.key===" ",Ue=F&&(F.tagName==="BUTTON"||F.tagName==="A"||F.tagName==="SELECT"||F.tagName==="OPTION"||F.getAttribute("role")==="button"||F.getAttribute("role")==="link"||F.getAttribute("role")==="checkbox"||F.getAttribute("role")==="radio"||F.getAttribute("role")==="menuitem");if(He&&Ue)return;if(g.key===" "||g.key.toLowerCase()==="k")g.preventDefault(),ae()};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[ae]);let Ve=N((n)=>V((g)=>g.seekToFrame(n)),[V]),_e=N(()=>X()?.toggleLoop(),[X]),Oe=N((n)=>{P(n),ne(n===0)},[]),Re=N(()=>ne((n)=>!n),[]),Le=N((n)=>V((g)=>g.setPlaybackRate(n)),[V]),e=N((n)=>X()?.changeResolution(n),[X]),d=N(()=>V((n)=>n.zoomBy(1.2)),[V]),k=N(()=>V((n)=>n.zoomBy(0.8)),[V]),oe=N(()=>V((n)=>n.fit()),[V]),xe=N((n)=>{X()?.download(n)},[X]),Ce=N(()=>{let n=Q.current;if(!n||typeof n.requestFullscreen!=="function")return;if(!document.fullscreenElement)n.requestFullscreen().catch(()=>{});else if(document.exitFullscreen)document.exitFullscreen().catch(()=>{})},[]),le=N((n,g)=>{if(ee)p.current?.panBy(n,g)},[ee]),Be=N((n,g)=>{if(ee)j.current?.panBy(n,g)},[ee]),x=N(()=>ae(),[ae]),ce=N((n)=>r.find((g)=>g.id===n)?.version,[r]),lt=O(()=>M?.media?.videoPreview?.url,[M?.media?.videoPreview?.url]),Ze=(n,g)=>{let He=fs(g)?.comparePane;if(!He)return t("div",{className:"flex flex-1 items-center justify-center bg-gray-100 dark:bg-gray-950",children:t("p",{className:"text-muted-foreground",children:"Preview unavailable"})});let Ue=c===n;return t(He,{ref:n==="left"?j:p,file:g,shareId:a,isActive:Ue,annotations:Ue?I:[],onStateChange:n==="left"?Fe:Se,onUserPan:n==="left"?le:Be,onActivate:()=>y(n),muted:Ue?q:!0,volume:s,onPlay:te,onTimeUpdate:f,onRequestTogglePlay:x},g.id)},dt=!!G&&!!Y,mt=ze||je;return o("div",{ref:Q,className:"flex h-full flex-1 flex-col bg-background",children:[o("div",{className:"flex min-h-0 flex-1",children:[o("div",{className:"flex min-w-0 flex-1 flex-col border-r border-zinc-800",children:[G&&t(Ke,{side:"left",fileName:G.name,version:ce(l),activeVersionId:l,versions:r,isActive:c==="left",onActivate:()=>y("left"),onSwitchVersion:(n)=>m("left",n),onExit:b}),t("div",{className:"relative flex min-h-0 flex-1",children:G?Ze("left",G):t("div",{className:"flex flex-1 items-center justify-center",children:t(L,{className:"h-6 w-6 animate-spin text-foreground"})})})]}),o("div",{className:"flex min-w-0 flex-1 flex-col",children:[Y&&t(Ke,{side:"right",fileName:Y.name,version:ce(D),activeVersionId:D,versions:r,isActive:c==="right",onActivate:()=>y("right"),onSwitchVersion:(n)=>m("right",n),onExit:b}),t("div",{className:"relative flex min-h-0 flex-1",children:Y?Ze("right",Y):t("div",{className:"flex flex-1 items-center justify-center",children:t(L,{className:"h-6 w-6 animate-spin text-foreground"})})})]})]}),mt&&!dt&&t("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/30",children:t(L,{className:"h-8 w-8 animate-spin text-foreground"})}),t(We,{activeState:he,activeAsset:M??null,previewUrl:lt,isFullScreen:Ne,onTogglePlay:ae,onToggleLoop:_e,onSeek:Ve,onVolumeChange:Oe,onToggleMute:Re,onChangePlaybackRate:Le,onChangeResolution:e,onZoomIn:d,onZoomOut:k,onFit:oe,onDownload:xe,onToggleFullScreen:Ce,allowDownload:_})]})}
2
- export{ni,Nl,Ol};
@@ -1 +0,0 @@
1
- import{N,h,O,w,u,C,B,t,o,K,Z,U,ut,Fe,A,T,L,Me,Gr,pt,Yn,Jn,Po,fe,ve,De,S,ge,Ae,ye,W,Qr,Gt,df,pm,pf,yy,_y,Ey,mf,ke,m0,Wa,R0,N0,Qm,at,xf,B_,W_,oh,nb,ab,ib,lb,cb,ub,Ii,ca,Dc,Mf,Ti,Db,qb,aw,pw,hw,Rw,Pw,Nw,pd,Dv,bx,vx,Mx,kx,Jf,Hh,Xf,fS,pS,vl,_C,MC,Oo,NC,jC,$C,Ig,Rg,Bc,xl,bp,wp,vp,Sl,Uc,Fc,xp,Sp,zc,oI,sI,aI,iI,lI,cn,Np,ZI,BI,Op,Gg,$I,GI,QI,VI,KI,pe,ue,me,$e,de,H,ie,it,kr,un,jn,qc,R,Ar,en,V,qe,Le,Ze,Be,Ue,ne,ma,Qt,Lo,_t,$p}from"./chunk-7rhz2gze.js";import{Bi,Bs}from"./chunk-7kjgvxqa.js";import{Wc,Aa}from"./chunk-tm7f32c7.js";import"./chunk-gc5sbfa5.js";import"./chunk-rssgmj7x.js";import{Sr}from"./chunk-0qaq0sp8.js";import{oi,Dl}from"./chunk-7pw1550a.js";import{ri}from"./chunk-3ttrhqy3.js";import{kl}from"./chunk-kswvyqq1.js";import{Pl}from"./chunk-453ykvaw.js";import{er}from"./chunk-5vzrpz50.js";import"./chunk-98715kc3.js";import"./chunk-m9pr03kn.js";import{zl}from"./chunk-yfnem6se.js";import"./chunk-cbgq517y.js";import"./chunk-gk2q9a3f.js";import{so}from"./chunk-9t8n2des.js";import"./chunk-ytdwk2fq.js";import{ao}from"./chunk-rq0n0vcc.js";import{Rr}from"./chunk-0zv3bks2.js";C();var Ct=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],lt=T("folder-open",Ct);var It=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],dt=T("list-filter",It);var Ft=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ct=T("palette",Ft);C();function Dt({ratio:a}){switch(a){case"16:9":return t("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"});case"9:16":return t("span",{className:"inline-block w-2.5 h-4 border border-current rounded-[1px] shrink-0"});case"4:3":return t("span",{className:"inline-block w-3.5 h-2.5 border border-current rounded-[1px] shrink-0"});case"3:4":return t("span",{className:"inline-block w-2.5 h-3.5 border border-current rounded-[1px] shrink-0"});case"1:1":return t("span",{className:"inline-block w-3 h-3 border border-current rounded-[1px] shrink-0"});default:return t("span",{className:"inline-block w-4 h-2.5 border border-current rounded-[1px] shrink-0"})}}function rt(){return Math.random().toString(36).substring(2,9)}function mt(){return{id:rt(),type:"text",text:"CONFIDENTIAL",x:0.5,y:0.5,size:0.05,color:"#999999",opacity:0.5,rotation:-30}}function Mt(){return{id:rt(),type:"image",imageAssetKey:"",x:0.5,y:0.5,size:0.15,opacity:0.5,rotation:0}}var tt=[{id:"dark",label:"Dark Slate",bg:"#1e293b",dot:"#475569"},{id:"black",label:"Black",bg:"#000000",dot:"#404040"},{id:"gray",label:"Slate Gray",bg:"#64748b",dot:"#cbd5e1"},{id:"white",label:"White",bg:"#ffffff",dot:"#94a3b8"},{id:"green",label:"Chroma Green",bg:"#059669",dot:"#047857"}],Bt={"16:9":1.7777777777777777,"9:16":0.5625,"4:3":1.3333333333333333,"3:4":0.75,"1:1":1};function gt({open:a,onOpenChange:b,initialConfig:g,shareId:p,teamId:k,onSaveSuccess:x}){let P=K(),[d,v]=u([]),[c,f]=u(null),[j,z]=u(null),[_,he]=u("16:9"),[Ne,Se]=u("grid"),[Ce,X]=u(!1),[we,oe]=u("new"),[ce,Y]=u(""),[J,ee]=u(null),I=w(null),te=w(null),[ae,Ie]=u({w:0,h:0}),[F,q]=u(!1),s=N((e)=>{if(te.current=e,!e)return;let l=()=>{let{clientWidth:M,clientHeight:y}=e;if(M<=0||y<=0)return;let E=Bt[_],et=M,We=et/E;if(We>y)We=y,et=We*E;Ie({w:Math.round(et),h:Math.round(We)})};l();let n=new ResizeObserver(l);return n.observe(e),()=>{n.disconnect(),te.current=null}},[_]),G=it((e)=>e.teamId),_e=k||G,[Oe,Te]=u(!1),[re,je]=u({}),le=w(null),Pe=A.api.teams[":teamId"].files.$post,xe=async(e,l)=>{let n=e.target.files?.[0];if(!n)return;if(n.size>1048576){if(R.error(Db()),le.current)le.current.value="";return}if(!_e){R.error(Dc());return}Te(!0);let M=URL.createObjectURL(n);je((y)=>({...y,[l]:M}));try{let y=await Pe({param:{teamId:_e},form:{file:n}});if(!y.ok)throw Error(Dc());let E=await y.json();D(l,{imageAssetKey:E.key,imageAssetUrl:E.url})}catch(y){let E=y instanceof Error?y.message:Dc();R.error(E)}finally{if(Te(!1),le.current)le.current.value=""}};h(()=>{if(a){if(g?.blocks&&g.blocks.length>0)v(g.blocks),f(g.blocks[0].id);else{let e=mt();v([e]),f(e.id)}z(null)}},[a,g]);let{data:se=[]}=Z({queryKey:["watermark-templates",k],queryFn:async()=>{let e=await A.api["watermark-templates"].$get({query:k?{teamId:k}:{}});if(!e.ok)return[];return await e.json()},enabled:a}),Ke=A.api.shares[":shareId"].watermark.$put,{mutate:Qe,isPending:Ve}=U({mutationFn:async(e)=>{let l=await Ke({param:{shareId:p},json:{enabled:!0,config:e}});if(!l.ok){let n=await l.json().catch(()=>null);throw Error(n?.error||ca())}return await l.json()},onSuccess:()=>{P.invalidateQueries({queryKey:["share",p]}),P.invalidateQueries({queryKey:["shares"]}),R.success(KI()),b(!1),x?.()},onError:(e)=>{R.error(e.message||ca())}}),He=A.api["watermark-templates"].$post,{mutate:Ge,isPending:Ee}=U({mutationFn:async({name:e,config:l})=>{let n=await He({json:{name:e,teamId:k||void 0,config:l}});if(!n.ok)throw Error(ca());return await n.json()},onSuccess:(e)=>{P.invalidateQueries({queryKey:["watermark-templates"]}),z(e.id),X(!1),R.success(aI())},onError:()=>{R.error(ca())}}),Xe=A.api["watermark-templates"][":templateId"].$put,{mutate:r,isPending:m}=U({mutationFn:async({templateId:e,config:l})=>{let n=await Xe({param:{templateId:e},json:{config:l}});if(!n.ok)throw Error(ca());return await n.json()},onSuccess:()=>{P.invalidateQueries({queryKey:["watermark-templates"]}),X(!1),R.success(iI())},onError:()=>{R.error(ca())}}),Q=A.api["watermark-templates"][":templateId"].$delete,{mutate:ht}=U({mutationFn:async(e)=>{if(!(await Q({param:{templateId:e}})).ok)throw Error(Ii())},onSuccess:(e,l)=>{if(P.invalidateQueries({queryKey:["watermark-templates"]}),j===l)z(null);R.success(oI())},onError:()=>{R.error(Ii())}}),be=d.findIndex((e)=>e.id===c),i=be>=0?d[be]:null,ot=()=>{let e=mt();v((l)=>[...l,e]),f(e.id)},vt=()=>{let e=Mt();v((l)=>[...l,e]),f(e.id)},nt=(e)=>{if(!e)return;v((l)=>{let n=l.filter((M)=>M.id!==e);if(c===e)f(n.length>0?n[Math.max(0,be-1)].id:null);return n})},D=(e,l)=>{v((n)=>n.map((M)=>M.id===e?{...M,...l}:M))},wt=()=>{if(d.length===0)return;let e=(be-1+d.length)%d.length;f(d[e].id)},yt=()=>{if(d.length===0)return;let e=(be+1)%d.length;f(d[e].id)},bt=(e,l)=>{e.stopPropagation(),f(l),q(!0)},Ye=N((e)=>{if(!F||!c||!I.current)return;let l=I.current.getBoundingClientRect(),n=(e.clientX-l.left)/l.width,M=(e.clientY-l.top)/l.height,y=Math.max(0,Math.min(1,Math.round(n*100)/100)),E=Math.max(0,Math.min(1,Math.round(M*100)/100));D(c,{x:y,y:E})},[F,c]),Je=N(()=>{q(!1)},[]);h(()=>{if(F)window.addEventListener("mousemove",Ye),window.addEventListener("mouseup",Je);return()=>{window.removeEventListener("mousemove",Ye),window.removeEventListener("mouseup",Je)}},[F,Ye,Je]),h(()=>{let e=(l)=>{if(!a||!c)return;let n=l.target?.tagName?.toLowerCase();if(n==="input"||n==="textarea"||n==="select")return;if(l.key==="Delete"||l.key==="Backspace")l.preventDefault(),nt(c)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a,c,be]);let Nt=(e)=>{if(e.config?.blocks&&e.config.blocks.length>0){let l=e.config.blocks.map((n)=>({...n,id:rt()}));v(l),f(l[0].id),z(e.id)}},kt=()=>{if(d.length===0){R.error(vx());return}Qe({blocks:d})},St=()=>{if(we==="new"){if(!ce.trim()){R.error(oh());return}Ge({name:ce.trim(),config:{blocks:d}})}else{let e=J||j;if(!e){R.error(Ig());return}r({templateId:e,config:{blocks:d}})}};return o(B,{children:[t(pe,{open:a,onOpenChange:b,children:o(ue,{showCloseButton:!1,className:"sm:max-w-[1400px] max-w-[95vw] w-[95vw] h-[88vh] flex flex-col p-0 gap-0 overflow-hidden",onPointerDownOutside:(e)=>e.preventDefault(),children:[o("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border bg-card",children:[t("div",{className:"flex items-center gap-3",children:t(de,{className:"text-base font-semibold",children:GI()})}),o("div",{className:"flex items-center gap-2",children:[o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:o(S,{variant:"outline",size:"sm",className:"gap-2 text-xs",children:[t(lt,{className:"h-4 w-4 text-muted-foreground"}),QI()]})}),o(ye,{align:"end",className:"w-56",children:[t(Qr,{className:"text-xs font-semibold text-muted-foreground",children:Nw()}),se.length===0?t("div",{className:"px-2 py-1.5 text-xs text-muted-foreground italic",children:bx()}):se.map((e)=>o(W,{onClick:()=>Nt(e),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{className:"truncate flex-1",children:e.name}),j===e.id&&t(Me,{className:"h-3.5 w-3.5 text-primary ml-2 flex-shrink-0"}),t(S,{variant:"ghost",size:"icon",className:"h-5 w-5 hover:bg-destructive/10 hover:text-destructive ml-1",onClick:(l)=>{l.stopPropagation(),ht(e.id)},children:t(ve,{className:"h-3 w-3"})})]},e.id)),t(Gt,{}),o(W,{onClick:()=>{oe("new"),Y(""),X(!0)},className:"text-xs gap-2 cursor-pointer",children:[t(fe,{className:"h-3.5 w-3.5 text-primary"}),Qm()]}),se.length>0&&o(W,{onClick:()=>{oe("overwrite"),ee(j||se[0].id),X(!0)},className:"text-xs gap-2 cursor-pointer",children:[t(ri,{className:"h-3.5 w-3.5 text-muted-foreground"}),Hh()]})]})]}),t(S,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>b(!1),children:ke()}),o(S,{size:"sm",className:"text-xs bg-primary hover:bg-primary/90 text-primary-foreground gap-1.5",disabled:Ve,onClick:kt,children:[t(ri,{className:"h-3.5 w-3.5"}),NC()]})]})]}),o("div",{className:"flex-1 flex overflow-hidden",children:[o("div",{className:"w-[65%] flex flex-col p-4 bg-muted/20 border-r border-border overflow-hidden select-none",children:[o("div",{className:"flex items-center justify-between mb-3",children:[t("div",{className:"flex items-center gap-1 bg-muted/60 p-1 rounded-md border border-border/60",children:["16:9","9:16","4:3","3:4","1:1"].map((e)=>o(S,{variant:_===e?"secondary":"ghost",size:"sm",className:ze("h-7 px-2.5 text-xs gap-1.5 font-mono transition-all",_===e?"bg-background shadow-xs font-semibold text-foreground border border-border/50":"text-muted-foreground hover:text-foreground"),onClick:()=>he(e),children:[t(Dt,{ratio:e}),t("span",{children:e})]},e))}),t("div",{className:"flex items-center gap-1.5 bg-background border border-border/60 rounded-md p-1",children:tt.map((e)=>t("button",{type:"button",onClick:()=>Se(e.id),style:{backgroundColor:e.bg},className:ze("w-5 h-5 rounded-full border border-border/80 transition-all cursor-pointer relative",Ne===e.id?"ring-2 ring-primary ring-offset-1 scale-110":"hover:scale-105 opacity-80 hover:opacity-100"),title:e.label},e.id))})]}),t("div",{ref:s,className:"flex-1 flex items-center justify-center overflow-hidden",children:(()=>{let e=tt.find((n)=>n.id===Ne)||tt[0],l=ae.w>0&&ae.h>0;return t("div",{ref:I,onClick:()=>f(null),style:{backgroundColor:e.bg,backgroundImage:`radial-gradient(${e.dot} 1px, transparent 1px)`,backgroundSize:"16px 16px",...l?{width:ae.w,height:ae.h}:{}},className:ze("relative rounded-lg border border-border overflow-hidden shadow-inner transition-all",_==="16:9"&&"aspect-[16/9] w-full max-h-full",_==="9:16"&&"aspect-[9/16] h-full max-w-full",_==="4:3"&&"aspect-[4/3] w-full max-h-full",_==="3:4"&&"aspect-[3/4] h-full max-w-full",_==="1:1"&&"aspect-square h-full max-w-full"),children:d.map((n)=>{let M=n.id===c,y=n.size*(ae.w||640);return t("div",{onMouseDown:(E)=>bt(E,n.id),onClick:(E)=>{E.stopPropagation(),f(n.id)},style:{left:`${n.x*100}%`,top:`${n.y*100}%`,transform:`translate(-50%, -50%) rotate(${n.rotation}deg)`,opacity:n.opacity},className:ze("absolute cursor-move select-none transition-shadow rounded p-1.5 flex items-center justify-center",M?"ring-2 ring-primary ring-offset-2 ring-offset-background/80 bg-primary/10":"hover:ring-1 hover:ring-muted-foreground/50"),children:n.type==="text"?t("span",{style:{fontSize:`${y}px`,color:n.color,lineHeight:1,whiteSpace:"nowrap",fontWeight:700,textShadow:"0 1px 3px rgba(0,0,0,0.5)"},children:n.text||"Text"}):t("div",{style:{width:`${y}px`,height:`${y}px`},className:"bg-primary/20 border border-primary/40 rounded flex items-center justify-center p-1 overflow-hidden",children:re[n.id]||n.imageAssetUrl?t("img",{src:re[n.id]||n.imageAssetUrl,alt:"Watermark logo",className:"w-full h-full object-contain pointer-events-none"}):t(Yn,{className:"h-1/2 w-1/2 opacity-70 text-primary"})})},n.id)})})})()})]}),o("div",{className:"w-[35%] flex flex-col bg-card overflow-hidden border-l border-border",children:[t("div",{className:"p-4 border-b border-border bg-muted/10 flex items-center justify-between",children:o("div",{className:"flex items-center gap-2",children:[t(Jn,{className:"h-4 w-4 text-muted-foreground"}),t("span",{className:"text-xs font-semibold",children:Gg()})]})}),o("div",{className:"p-3 border-b border-border bg-background flex items-center justify-between gap-2",children:[o("div",{className:"flex items-center gap-1",children:[t(S,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:d.length<=1,onClick:wt,children:t(Gr,{className:"h-4 w-4"})}),o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:t(S,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs font-mono",children:d.length===0?"0 / 0":`${be+1} / ${d.length}`})}),t(ye,{align:"start",className:"w-48",children:d.map((e,l)=>o(W,{onClick:()=>f(e.id),className:"text-xs flex items-center justify-between cursor-pointer",children:[o("span",{className:"flex items-center gap-2 truncate",children:[e.type==="text"?t(Bi,{className:"h-3.5 w-3.5 text-muted-foreground"}):t(Yn,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.type==="text"?e.text||"Text":e.imageAssetKey||"Image"]}),o("span",{className:"text-[10px] font-mono text-muted-foreground ml-2",children:["#",l+1]})]},e.id))})]}),t(S,{variant:"outline",size:"icon",className:"h-7 w-7",disabled:d.length<=1,onClick:yt,children:t(pt,{className:"h-4 w-4"})})]}),o("div",{className:"flex items-center gap-1",children:[i&&t(S,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10",title:at(),onClick:()=>nt(i.id),children:t(ve,{className:"h-4 w-4"})}),o(ge,{modal:!1,children:[t(Ae,{asChild:!0,children:o(S,{size:"sm",className:"h-7 text-xs gap-1",children:[t(fe,{className:"h-3.5 w-3.5"}),df()]})}),o(ye,{align:"end",children:[o(W,{onClick:ot,className:"text-xs gap-2 cursor-pointer",children:[t(Bi,{className:"h-3.5 w-3.5"}),pf()]}),o(W,{onClick:vt,className:"text-xs gap-2 cursor-pointer",children:[t(Yn,{className:"h-3.5 w-3.5"}),pm()]})]})]})]})]}),t(ie,{className:"flex-1 min-h-0 p-4",children:i?o("div",{className:"space-y-5 text-xs",children:[o("div",{className:"flex items-center justify-between pb-2 border-b border-border",children:[o("span",{className:"font-semibold text-muted-foreground flex items-center gap-1.5",children:[i.type==="text"?t(Bi,{className:"h-4 w-4 text-primary"}):t(Yn,{className:"h-4 w-4 text-primary"}),i.type==="text"?pf():pm()]}),o("span",{className:"text-[10px] font-mono text-muted-foreground",children:["ID: ",i.id.slice(0,6)]})]}),i.type==="text"&&o("div",{className:"space-y-2",children:[t(V,{className:"text-xs",children:lI()}),t(H,{type:"text",value:i.text,onChange:(e)=>D(i.id,{text:e.target.value}),className:"text-xs h-8"})]}),i.type==="image"&&o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:pw()}),i.imageAssetKey&&o("button",{type:"button",onClick:()=>D(i.id,{imageAssetKey:"",imageAssetUrl:void 0}),className:"text-xs text-muted-foreground hover:text-destructive flex items-center gap-1 font-medium transition-colors cursor-pointer",children:[t(De,{className:"w-3.5 h-3.5"}),vl?vl():"Remove"]})]}),t("input",{type:"file",ref:le,className:"hidden",accept:"image/*",onChange:(e)=>xe(e,i.id)}),o("div",{onClick:()=>le.current?.click(),className:"relative aspect-square w-full rounded-xl border border-dashed border-border flex items-center justify-center cursor-pointer overflow-hidden group shadow-inner bg-muted/20 hover:border-primary/50 hover:bg-muted/40 transition-all p-2",children:[Oe&&t("div",{className:"absolute inset-0 bg-background/70 backdrop-blur-xs flex flex-col items-center justify-center gap-2 z-20",children:o("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-background border rounded-full shadow-lg",children:[t(L,{className:"w-4 h-4 animate-spin text-primary"}),t("span",{className:"text-xs font-semibold",children:Op()})]})}),re[i.id]||i.imageAssetUrl?o(B,{children:[t("img",{src:re[i.id]||i.imageAssetUrl,alt:"Uploaded logo preview",className:"max-w-full max-h-full object-contain transition-transform duration-300 group-hover:scale-105"}),o("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 text-white z-10",children:[t(so,{className:"w-5 h-5 transform translate-y-1 group-hover:translate-y-0 transition-transform duration-300"}),t("span",{className:"text-xs font-semibold",children:Np()})]})]}):o("div",{className:"flex flex-col items-center gap-1.5 text-center p-3",children:[t("div",{className:"p-2 rounded-full bg-background border shadow-xs group-hover:scale-110 transition-transform duration-300",children:t(so,{className:"w-4 h-4 text-muted-foreground"})}),o("div",{children:[t("p",{className:"text-xs font-medium text-foreground",children:ZI()}),t("p",{className:"text-[10px] text-muted-foreground mt-0.5 max-w-[150px] mx-auto leading-normal",children:BI()})]})]})]})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:i.type==="text"?qb():hw()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.size*100),"%"]})]}),o("div",{className:"flex items-center gap-3",children:[t(Bs,{min:i.type==="text"?0.01:0.02,max:i.type==="text"?0.12:0.5,step:0.005,value:[i.size],onValueChange:([e])=>D(i.id,{size:e}),className:"flex-1"}),t(H,{type:"number",min:1,max:100,value:Math.round(i.size*100),onChange:(e)=>D(i.id,{size:Math.min(1,Math.max(0.001,Number(e.target.value)/100))}),className:"w-16 h-7 text-xs font-mono text-right"})]})]}),i.type==="text"&&o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:m0()}),t("span",{className:"font-mono text-[11px] text-muted-foreground uppercase",children:i.color})]}),o("div",{className:"flex items-center gap-2",children:[t("input",{type:"color",value:i.color,onChange:(e)=>D(i.id,{color:e.target.value}),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent p-0"}),t(H,{type:"text",value:i.color,onChange:(e)=>D(i.id,{color:e.target.value}),className:"flex-1 h-8 text-xs font-mono"})]}),t("div",{className:"flex items-center gap-1.5 pt-1",children:["#FFFFFF","#000000","#999999","#EF4444","#3B82F6","#10B981","#F59E0B"].map((e)=>t("button",{type:"button",onClick:()=>D(i.id,{color:e}),style:{backgroundColor:e},className:"w-5 h-5 rounded-full border border-border hover:scale-110 transition-transform"},e))})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:Mx()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.opacity*100),"%"]})]}),t(Bs,{min:0,max:1,step:0.01,value:[i.opacity],onValueChange:([e])=>D(i.id,{opacity:e})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:MC()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[i.rotation,"°"]})]}),t(Bs,{min:-180,max:180,step:1,value:[i.rotation],onValueChange:([e])=>D(i.id,{rotation:e})}),t("div",{className:"flex items-center gap-1.5 pt-1",children:[-45,-30,0,30,45].map((e)=>o(S,{variant:"outline",size:"sm",className:"h-6 text-[10px] flex-1 px-1 font-mono",onClick:()=>D(i.id,{rotation:e}),children:[e,"°"]},e))})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:fS()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.x*100),"%"]})]}),t(Bs,{min:0,max:1,step:0.01,value:[i.x],onValueChange:([e])=>D(i.id,{x:e})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:pS()}),o("span",{className:"font-mono text-[11px] text-muted-foreground",children:[Math.round(i.y*100),"%"]})]}),t(Bs,{min:0,max:1,step:0.01,value:[i.y],onValueChange:([e])=>D(i.id,{y:e})})]})]}):o("div",{className:"py-12 text-center text-xs text-muted-foreground space-y-3",children:[t("p",{children:$C()}),o(S,{size:"sm",variant:"outline",onClick:ot,children:[t(fe,{className:"h-3.5 w-3.5 mr-1"}),pf()]})]})})]})]})]})}),t(pe,{open:Ce,onOpenChange:X,children:o(ue,{className:"max-w-md",children:[t(me,{children:t(de,{className:"text-sm font-semibold",children:we==="new"?Qm():Hh()})}),t("div",{className:"py-3 space-y-4 text-xs",children:we==="new"?o("div",{className:"space-y-2",children:[t(V,{children:sI()}),t(H,{type:"text",value:ce,onChange:(e)=>Y(e.target.value),placeholder:oh(),className:"text-xs"})]}):o("div",{className:"space-y-2",children:[t(V,{children:Ig()}),t("select",{value:J||"",onChange:(e)=>ee(e.target.value),className:"w-full h-9 rounded-md border border-input bg-background px-3 text-xs",children:se.map((e)=>t("option",{value:e.id,children:e.name},e.id))})]})}),o($e,{children:[t(S,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>X(!1),children:ke()}),t(S,{size:"sm",className:"text-xs",disabled:Ee||m,onClick:St,children:Wa()})]})]})})]})}function ze(...a){return a.filter(Boolean).join(" ")}C();function xt({shareLink:a,viewMode:b,onViewModeChange:g,defaultSortOrder:p,onSortOrderChange:k}){let x=K(),[P,d]=u(a.password||""),[v,c]=u(a.expireAt?new Date(a.expireAt):void 0),[f,j]=u(!1);h(()=>{d(a.password||"")},[a.password]);let[z,_]=u(a.hasPassword),[he,Ne]=u(!!a.expireAt),{data:Se,refetch:Ce}=Z({queryKey:["share-watermark",a.id],queryFn:async()=>{let s=await A.api.shares[":shareId"].watermark.$get({param:{shareId:a.id}});if(!s.ok)return null;return await s.json()},refetchInterval:(s)=>(s.state.data?.watermarkStatus||a.watermarkStatus)==="processing"?3000:!1}),X=A.api.shares[":shareId"].watermark.$put,{mutate:we}=U({mutationFn:async()=>{let s=await X({param:{shareId:a.id},json:{enabled:!1}});if(!s.ok)throw Error(ca());return await s.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["shares",a.projectId]}),x.invalidateQueries({queryKey:["share",a.id]}),x.invalidateQueries({queryKey:["share-watermark",a.id]}),R.success($I())}}),oe=Se?.watermarkStatus??a.watermarkStatus??(a.watermarkConfigId?"ready":"disabled"),ce=Se?.watermarkConfig?.config??a.watermarkConfig?.config??null,Y=ce!==null&&oe!=="disabled",{data:J}=Z({queryKey:["fields",a.projectId],queryFn:async()=>{let s=await A.api.projects[":projectId"].fields.$get({param:{projectId:a.projectId}});if(!s.ok)throw Error(ab());return await s.json()},enabled:!!a.projectId}),ee=A.api.shares[":shareId"].$put,{mutate:I}=U({mutationFn:async(s)=>{let G=await ee({param:{shareId:a.id},json:s});if(!G.ok)throw Error(ca());return await G.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["shares",a.projectId]}),x.invalidateQueries({queryKey:["share",a.id]}),R.success(Rg())}}),te=`${window.location.origin}/share/${a.id}`,ae=async(s)=>{if(await ao(s))R.success(R0())},Ie=(s)=>{let G=a.fieldVisibility||{},_e={...G,[s]:!G[s]};I({fieldVisibility:_e})},F="index",q="asc";if(p){let s=p.split(":");F=s[0],q=s[1]||"asc"}return o("div",{className:"flex flex-col h-full bg-background border-l border-border",children:[t("div",{className:"flex-1 overflow-y-auto",children:o("div",{className:"p-4 space-y-6",children:[o("div",{className:"space-y-4",children:[o("div",{className:"flex items-center justify-between",children:[t("h3",{className:"text-sm font-medium",children:Rw()}),t(qe,{checked:!a.isDisabled,onCheckedChange:(s)=>I({isDisabled:!s})})]}),o("div",{className:"relative w-full",children:[t(H,{value:te,readOnly:!0,className:"pr-10 bg-muted/50 text-xs"}),t(S,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full",onClick:()=>ae(te),children:t(Rr,{className:"h-4 w-4"})})]})]}),o("div",{className:"space-y-1",children:[t(Re,{title:jC(),icon:t(zl,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-4 pt-2",children:[o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:Xf()}),t(qe,{checked:z,onCheckedChange:(s)=>{if(_(s),!s)I({password:null})}})]}),z&&o("div",{className:"flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200",children:[t(H,{type:"text",value:P,onChange:(s)=>d(s.target.value),placeholder:W_(),className:"text-xs"}),t(S,{size:"sm",onClick:()=>I({password:P}),children:Oo()})]})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:nb()}),t(qe,{checked:he,onCheckedChange:(s)=>{if(Ne(s),!s)c(void 0),I({expireAt:null})}})]}),he&&t("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:t(ma,{value:v,onChange:(s)=>{c(s),I({expireAt:s?s.toISOString():null})},className:"text-xs"})})]}),o("div",{className:"space-y-2",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:yy()}),t(qe,{checked:a.allowDownload,onCheckedChange:(s)=>I({allowDownload:s})})]}),t("p",{className:"text-xs text-muted-foreground",children:_y()})]}),o("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:Gg()}),t(qe,{checked:Y,disabled:oe==="processing",onCheckedChange:(s)=>{if(!s)we();else j(!0)}})]}),Y&&oe==="processing"&&o("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 font-medium py-1 animate-pulse",children:[t(L,{className:"h-3.5 w-3.5 animate-spin"}),t("span",{children:VI()})]}),Y&&oe!=="processing"&&t(S,{variant:"outline",size:"sm",className:"w-full text-xs gap-1.5 mt-1",onClick:()=>j(!0),children:B_()})]})]})}),t(Re,{title:Ey(),icon:t(ct,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-3 pt-2 flex gap-2",children:[o(S,{variant:b==="card"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>g("card"),children:[t(Jn,{className:"h-4 w-4"}),aw()]}),o(S,{variant:b==="list"?"secondary":"outline",size:"sm",className:"flex-1 gap-2 text-xs",onClick:()=>g("list"),children:[t(Po,{className:"h-4 w-4"}),Pw()]})]})}),t(Re,{title:Ti(),icon:t(dt,{className:"h-4 w-4"}),children:t("div",{className:"p-3 space-y-3 pt-2",children:J?.map((s)=>o("div",{className:"flex items-center justify-between",children:[t(V,{className:"text-xs",children:s.config?.name}),t(qe,{checked:a.fieldVisibility?.[s.id]??!1,onCheckedChange:()=>Ie(s.id)})]},s.id))})}),t(Re,{title:xl(),icon:t(Pl,{className:"h-4 w-4"}),children:o("div",{className:"p-3 space-y-4 pt-2",children:[o("div",{className:"space-y-2",children:[t(V,{className:"text-xs text-muted-foreground",children:Mf()}),o(Le,{value:F,onValueChange:(s)=>{if(s==="index")k(null);else k(`${s}:${q}`)},children:[t(Be,{className:"w-full text-xs h-9",children:t(Ze,{})}),o(Ue,{children:[t(ne,{value:"index",children:bp()}),t(ne,{value:"name",children:Sl()}),t(ne,{value:"createdAt",children:wp()}),t(ne,{value:"size",children:xp()})]})]})]}),o("div",{className:"space-y-2",children:[t(V,{className:"text-xs text-muted-foreground",children:Jf()}),o(S,{variant:"outline",className:"w-full justify-between font-normal text-xs h-9",disabled:F==="index",onClick:()=>{k(`${F}:${q==="asc"?"desc":"asc"}`)},children:[t("span",{children:F==="name"?q==="asc"?Bc():zc():F==="createdAt"?q==="asc"?Fc():Uc():F==="size"?q==="asc"?Sp():vp():q==="asc"?mf():xf()}),t(Wc,{className:"h-4 w-4 opacity-50"})]})]})]})})]})]})}),o("div",{className:"p-4 border-t border-border space-y-2",children:[o(S,{variant:"outline",className:"w-full justify-center",onClick:()=>window.open(te,"_blank"),children:[t(kl,{className:"h-4 w-4 mr-2"}),kx()]}),o(S,{className:"w-full justify-center bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>ae(te),children:[t(Rr,{className:"h-4 w-4 mr-2"}),N0()]})]}),t(gt,{open:f,onOpenChange:j,initialConfig:ce,shareId:a.id,onSaveSuccess:()=>{Ce(),x.invalidateQueries({queryKey:["share",a.id]}),x.invalidateQueries({queryKey:["shares",a.projectId]})}})]})}function Re({title:a,icon:b,children:g}){let[p,k]=u(!1);return o("div",{className:"border-b border-border last:border-0",children:[o("button",{onClick:()=>k(!p),className:"w-full flex items-center justify-between py-3 px-2 hover:bg-muted/50 transition-colors",children:[o("div",{className:"flex items-center gap-3",children:[b,t("span",{className:"text-sm font-medium",children:a})]}),t(pt,{className:Pt("h-4 w-4 transition-transform",p&&"rotate-90")})]}),p&&g&&t("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200",children:g})]})}function Pt(...a){return a.filter(Boolean).join(" ")}function st({teamId:a,projectId:b,projectName:g,shareId:p,rootFolderId:k}){let x=K(),{fetchMetadata:P}=Lo();h(()=>{if(a)P(a)},[a,P]);let{data:d}=Z({queryKey:["share",p],queryFn:async()=>{let r=await A.api.shares[":shareId"].$get({param:{shareId:p}});if(!r.ok)throw Error(cb());return await r.json()}}),v=d?.rootFolderId,[c,f]=u(null),[j,z]=u([]);h(()=>{if(v)f(v),z([]),xe(new Set)},[v,p]);let _=en((r)=>r.setProjectState),he=en((r)=>r.clearProjectState),Ne=(r)=>{if(r===c)return;if(r===v)f(v),z([]);else{let m=j.findIndex((Q)=>Q.id===r);if(m!==-1)f(r),z(j.slice(m+1))}xe(new Set)},[Se,Ce]=u(240),[X,we]=u(360),{shareConfigLeftSidebarCollapsed:oe,shareConfigRightSidebarCollapsed:ce}=Qt(),Y=d?.defaultSortOrder||null,J,ee;if(Y){let r=Y.split(":");J=r[0],ee=r[1]}let I=d?.viewMode??"card",{data:te,fetchNextPage:ae,hasNextPage:Ie,isFetchingNextPage:F,isLoading:q}=ut({queryKey:["folder-children",a,c,"folder",J,ee],queryFn:async({pageParam:r})=>{let m=await A.api.folders[":folderId"].children.$get({param:{folderId:c},query:{assetType:"folder",after:r,sort:J,order:ee}});if(!m.ok)throw Error(lb());return await m.json()},enabled:!!c,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),{data:s,fetchNextPage:G,hasNextPage:_e,isFetchingNextPage:Oe,isLoading:Te}=ut({queryKey:["folder-children",a,c,"file",J,ee],queryFn:async({pageParam:r})=>{let m=await A.api.folders[":folderId"].children.$get({param:{folderId:c},query:{assetType:"file",after:r,sort:J,order:ee}});if(!m.ok)throw Error(ib());return await m.json()},enabled:!!c,initialPageParam:"",getNextPageParam:(r)=>r.pageInfo?.cursor||void 0}),re=O(()=>te?.pages.flatMap((r)=>r.data??[])??[],[te]),je=O(()=>s?.pages.flatMap((r)=>r.data??[])??[],[s]);h(()=>{if(d)_({teamId:a,projectId:b,projectName:g,ancestorFolders:j,currentAsset:{name:c===v?d.name:re.find((r)=>r.id===c)?.name||d.name,type:"folder"},isRootFolder:!1,shareId:p,onFolderClick:Ne});return()=>he()},[a,b,g,j,c,v,d,p,re,_,he]);let le=()=>{xe(new Set)},[Pe,xe]=u(new Set),{dragState:se,handleDragStart:Ke,handleDragEnd:Qe}=Dl({teamId:a,projectId:b,assetId:c||"",folders:re,files:je,selectedIds:Pe,onClearSelection:le}),Ve=A.api.shares[":shareId"].assets[":assetId"].$delete,{mutate:He}=U({mutationFn:async(r)=>{if(!(await Ve({param:{shareId:p,assetId:r}})).ok)throw Error(ub())},onSuccess:()=>{x.invalidateQueries({queryKey:["folder-children",a,c]}),R.success(_C())}}),Ge=A.api.shares[":shareId"].$put,{mutate:Ee}=U({mutationFn:async(r)=>{let m=await Ge({param:{shareId:p},json:r});if(!m.ok)throw Error(ca());return await m.json()},onSuccess:()=>{x.invalidateQueries({queryKey:["share",p]}),R.success(Rg())}}),Xe=(r)=>{if(r.type==="folder"||r.targetType==="folder"){let m=c===v?d?.name||"":re.find((Q)=>Q.id===c)?.name||cn();z((Q)=>[{id:c,name:m},...Q]),f(r.id),xe(new Set)}};if(!d)return t("div",{children:pd()});return o(jn,{modifiers:[oi.configure({anchor:{x:0,y:0}})],sensors:[un.configure({activationConstraints:[new kr.Distance({value:10})]})],onDragStart:Ke,onDragEnd:Qe,children:[t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!oe&&o(B,{children:[t("div",{className:"bg-background",style:{width:Se},children:t(Ar,{teamId:a,projectId:b,projectName:g,rootFolderId:k,dragState:se})}),t(Sr,{onResize:(r)=>Ce((m)=>Math.max(180,Math.min(400,m+r)))})]}),t(Aa,{teamId:a,projectId:b,assetId:c||"",folders:re,files:je,selectedItem:null,selectedIds:Pe,onItemSelect:(r,m)=>{if(m.metaKey||m.ctrlKey){let Q=new Set(Pe);if(Q.has(r.id))Q.delete(r.id);else Q.add(r.id);xe(Q)}else xe(new Set([r.id]))},onItemDoubleClick:Xe,onSaveField:()=>{},displayStyle:I,onClearSelection:le,fetchNextFoldersPage:ae,hasNextFoldersPage:Ie,isFetchingNextFoldersPage:F,fetchNextFilesPage:G,hasNextFilesPage:_e,isFetchingNextFilesPage:Oe,isLoading:q||Te,filterConditions:[],onFilterChange:()=>{},dragState:se,isShareView:!0,onRemoveFromShare:(r)=>{r.forEach((m)=>He(m.id))},fieldVisibility:d.fieldVisibility}),!ce&&o(B,{children:[t(Sr,{onResize:(r)=>we((m)=>Math.max(240,Math.min(600,m-r)))}),t("div",{style:{width:X},className:"flex-shrink-0 h-full",children:t(xt,{shareLink:d,viewMode:I,onViewModeChange:(r)=>Ee({viewMode:r}),defaultSortOrder:Y,onSortOrderChange:(r)=>Ee({defaultSortOrder:r})})})]})]})}),t(qc,{children:se?.isActive?t("div",{className:"flex items-center gap-2 rounded-md bg-popover px-3 py-2 text-sm font-medium shadow-md",children:Dv({count:se.itemCount})}):null})]})}C();function Tt(){let{projectId:a,shareId:b}=jt.useParams(),{teamId:g,ensureTeamIdForProject:p}=it();h(()=>{p(a)},[a,p]);let{data:k}=er($p(a)),x=k?.rootFolder,{data:P}=Z({queryKey:["folders",x],queryFn:async()=>{let d=await A.api.folders[":folderId"].$get({param:{folderId:x}});if(!d.ok)throw Error("Failed to fetch folder");return await d.json()},enabled:!!x});if(!g||!x||!P)return t(_t,{});return t(st,{teamId:g,projectId:a,projectName:k.name??"",shareId:b,rootFolderId:x})}var jt=Fe("/projects/$projectId/shares/$shareId")({component:Tt});export{jt as Route};
@@ -1 +0,0 @@
1
- import{h,w,u,C,B,t,o,K,wi,Z,U,Re,Zn,Fe,A,L,Xt,E,S,ke,at,Nc,Oc,C_,id,Ii,_b,dh,No,bC,Oo,Je,Xe,et,tt,rt,nt,ot,st,pe,ue,me,$e,de,H,it,Mt,R,en,Ur,Qt,yr,Do,Xg}from"./chunk-7rhz2gze.js";import{Zo,ps}from"./chunk-7kjgvxqa.js";import"./chunk-gc5sbfa5.js";import{tn}from"./chunk-77fmkpdz.js";import{ga}from"./chunk-1j27fzy1.js";import{Zl,ba}from"./chunk-snhsjs4x.js";import{ni,Nl,Ol}from"./chunk-f6svp4dp.js";import"./chunk-914bp49r.js";import{Sr}from"./chunk-0qaq0sp8.js";import"./chunk-m9pr03kn.js";import"./chunk-5adsx8x4.js";import"./chunk-j2bvj2yn.js";import"./chunk-cbgq517y.js";import"./chunk-ytdwk2fq.js";import"./chunk-0zv3bks2.js";C();var Ft=({item:n})=>{if(n.preview?.thumbnailUrl)return t("img",{src:n.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(n.preview?.proxyType==="audio"||n.proxyType==="audio")return t("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:t(Zo,{className:"w-5 h-5 text-muted-foreground"})});return t("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:t(Xt,{className:"w-5 h-5 text-muted-foreground"})})},Ne=({projectId:n,currentAssetId:s,parentFolderId:x,initialFiles:d,initialNextCursor:k})=>{let{ref:a,inView:M}=Mt({threshold:0,rootMargin:"200px"}),b=w(null),N=w(!0),[c,p]=u(d),[f,W]=u(k),[X,J]=u(!!k),[V,g]=u(!1);return h(()=>{p(d),W(k),J(!!k),N.current=!0},[d,k]),h(()=>{(async()=>{if(!f||V||!M||!X)return;g(!0);try{let y=await A.api.folders[":folderId"].search.$post({param:{folderId:x},json:{assetType:"file",after:f,first:200,recursively:!1,conditions:[]}});if(!y.ok)throw Error("Failed to fetch next page");let q=await y.json(),P=q.data||[];p((Y)=>[...Y,...P]),W(q.pageInfo?.cursor||void 0),J(!!q.pageInfo?.cursor&&P.length>0)}catch(y){console.error("Error fetching next page:",y)}finally{g(!1)}})()},[M,f,X,V,x]),h(()=>{if(c.some((y)=>y?.id===s)&&b.current)if(N.current)b.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),N.current=!1;else b.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[c,s]),t("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:o("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:[c.map((m)=>{if(!m)return null;let y=m.id===s;return t("div",{ref:m.id===s?b:null,className:"flex-shrink-0",children:o(Zn,{to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:m.id},search:{version:void 0},className:E("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative",y?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:[t(Ft,{item:m}),m.agent&&t("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:m.agent.name,"data-testid":"carousel-agent-badge",children:"AI"})]})},m.id)}),X&&t("div",{ref:a,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:V&&t(L,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};C();function kt(){let{projectId:n,fileId:s}=Le.useParams(),x=Le.useSearch(),{version:d,start:k}=x,a=d||s,{cmpLeft:M,cmpRight:b}=x,N=x.cmpActive??"left",c=!!x.compare&&!!M&&!!b,p=w(null),{teamId:f,ensureTeamIdForProject:W}=it(),[X,J]=u(360),[V,g]=u([]),{fileViewRightSidebarCollapsed:m}=Qt(),{isChatbotOpen:y}=yr(),[q,P]=u(0),[Y,z]=u(null),[he,Ee]=u(null),[Ve,ge]=u(void 0),[_,ne]=u({show:!1,files:[],nextCursor:void 0,folderId:void 0}),qe=A.api.files[":fileId"].metadata.$patch,{mutate:Pe}=U({mutationFn:async(e)=>{let r=await qe(e);if(!r.ok)throw Error("Failed to patch metadata");return await r.json()}}),G=K(),{members:ze,fetchProjectMembers:ye}=Ur(),_e=Do();h(()=>{W(n)},[n,W]),h(()=>{if(n)ye(n,!0)},[n,ye]),h(()=>{if(n&&s)A.api.projects[":projectId"].recents.view.$post({param:{projectId:n},json:{assetId:s}}).catch(()=>{})},[n,s]);let{data:Ie,isLoading:Ke,isError:Oe,isFetching:He}=Z({queryKey:["files",s],queryFn:async()=>{let e=await A.api.files[":fileId"].$get({param:{fileId:s}});if(!e.ok)throw Error("Failed to fetch stack");return await e.json()},enabled:!!f,placeholderData:wi}),{data:Qe,isLoading:Be,isError:Ue,isFetching:We}=Z({queryKey:["files",d],queryFn:async()=>{let e=await A.api.files[":fileId"].$get({param:{fileId:d}});if(!e.ok)throw Error("Failed to fetch version");return await e.json()},enabled:!!f&&!!d,placeholderData:wi}),{data:Ge}=Z({queryKey:["version_stacks",s,"versions"],queryFn:async()=>{let e=await A.api.version_stacks[":stackId"].versions.$get({param:{stackId:s}});if(!e.ok)throw Error("Failed to fetch versions");return await e.json()},enabled:!!n&&!!s&&(!!d||c)}),{data:j}=Z({queryKey:["projects",n],queryFn:async()=>{let e=await A.api.projects[":projectId"].$get({param:{projectId:n}});if(!e.ok)throw Error("Failed to fetch project");return await e.json()}}),I=Re(),{setProjectState:ve,clearProjectState:we}=en(),Ye=Ke||!!d&&Be,Ze=Oe||!!d&&Ue,lt=He||!!d&&We,i=Qe||Ie,F=d?Ge:Ie?.versionStack?.versions,l=i?.ancestorFolders?.[0]?.id??j?.rootFolder??"",[re,ee]=u(!1),[te,xe]=u(""),se=w(null),ae=w(!1),[ct,ie]=u(!1),dt=A.api.files[":fileId"].$put,{mutate:ft,mutateAsync:pt,isPending:be}=U({mutationFn:async(e)=>{let r=await dt(e);if(!r.ok)throw Error("Failed to rename file");return await r.json()},onSuccess:()=>{G.invalidateQueries({queryKey:["files"]}),G.invalidateQueries({queryKey:["version_stacks"]}),R.success(bC?.()||"Renamed successfully"),ee(!1)},onError:()=>{R.error(_b?.()||"Failed to rename")}}),ut=A.api.files.$delete,{mutate:mt,mutateAsync:ht,isPending:je}=U({mutationFn:async(e)=>{if(!(await ut(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(G.invalidateQueries({queryKey:["files"]}),G.invalidateQueries({queryKey:["version_stacks"]}),R.success(C_?.()||"Deleted"),ie(!1),l&&l!==j?.rootFolder)I({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:l}});else I({to:"/projects/$projectId",params:{projectId:n}})},onError:()=>{R.error(Ii?.()||"Failed to delete")}}),gt=(e)=>{if(e?.preventDefault(),!te.trim()||!a)return;ft({param:{fileId:a},json:{name:te.trim()}})},yt=()=>{if(!a)return;mt({json:{ids:[a]}})};h(()=>{if(i&&j&&f)ve({teamId:f,projectId:n,projectName:j.name??"",ancestorFolders:i.ancestorFolders??[],currentAsset:{id:a||s,name:i.name,type:"file",version:F?F.find((e)=>e.id===a)?.version??F.length:void 0,proxyType:i.proxyType},isRootFolder:!1,fileId:s,downloadInfo:{originalKey:i.media?.original?.key,videoTranscodes:i.media?.videoTranscodes?.map((e)=>({key:e.key,width:e.width,height:e.height}))},versions:F,compareMode:c,canCompareVersions:(F?.length??0)>=2,onCompareVersions:()=>{let e=Zl(F);if(!e)return;I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,version:void 0,compare:!0,cmpLeft:e.left.id,cmpRight:e.right.id,cmpActive:"left"})})},onFolderClick:(e)=>{I({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:e}})},onRename:()=>{ae.current=!1,xe(i?.name??""),ee(!0)},onDelete:()=>{ie(!0)}});return()=>we()},[f,n,j,i,F,a,s,c,ve,we,I]),h(()=>{if(!re)return;let e=setTimeout(()=>{ae.current=!0},1000);return()=>clearTimeout(e)},[re]);let It=()=>{if(ae.current)return;setTimeout(()=>{if(se.current)ps(se.current)},0)};if(h(()=>{if(!l||!a)return;if(_.folderId===l)return;let e=!0;return(async()=>{try{let v="",D=!1,T=[],ce=void 0;for(let Se=0;Se<5;Se++){let Te=await A.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:v,first:200,recursively:!1,conditions:[]}});if(!Te.ok)throw Error("Failed to search parent folder for carousel");let Q=await Te.json(),fe=Q.data||[];if(T.push(...fe),fe.some((oe)=>oe.id===a)){if(D=!0,ce=Q.pageInfo?.cursor||void 0,Q.pageInfo?.cursor)try{let oe=await A.api.folders[":folderId"].search.$post({param:{folderId:l},json:{assetType:"file",after:Q.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(oe.ok){let Me=await oe.json(),bt=Me.data||[];T.push(...bt),ce=Me.pageInfo?.cursor||void 0}}catch{}break}if(!Q.pageInfo?.cursor||fe.length<200)break;v=Q.pageInfo.cursor}if(e)if(D)ne({show:!0,files:T,nextCursor:ce,folderId:l});else ne({show:!1,files:[],nextCursor:void 0,folderId:l})}catch(v){if(console.error(v),e)ne({show:!1,files:[],nextCursor:void 0,folderId:l})}})(),()=>{e=!1}},[l,a,_.folderId]),h(()=>{P(0),z(null),g([])},[i?.id]),h(()=>{z(null),g([])},[he?.id]),h(()=>{tn.getState().reset(),tn.getState().setIsDrawing(!1),g([]),z(null)},[a]),Ye&&!i)return t(Xg,{});if(Ze||!i||!j||!f)return t("div",{children:dh()});let O=c?he:i,Ae=O?.id??a,Ce=(e,r)=>{if(!f)return;Pe({param:{fileId:Ae},json:[{key:e,value:r}]},{onSuccess:()=>{G.invalidateQueries({queryKey:["files",Ae]})}})},le=(e)=>{I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,...e})})},vt=()=>{le({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?M:b})},wt=(e)=>{z(e.id||null);let r=e.annotations;if(r&&r.length>0)g(r);else g([]);if(c){if(e.second!==null&&e.second!==void 0)ge({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)p.current?.seekTo(e.second),p.current?.pause();else if(r&&r.length>0)p.current?.pause()},xt=(e)=>{z(e.id||null);let v=e.details,D=v?.annotations;if(D&&D.length>0)g(D);else g([]);let T=v?.position?.type==="time"?v.position.seconds:v?.position?.type==="page"?v.position.page:void 0;if(c){if(T!==void 0)ge({second:T,nonce:Date.now()});return}if(T!==void 0)p.current?.seekTo(T),p.current?.pause();else if(D&&D.length>0)p.current?.pause()},De=()=>{g([]),z(null)};if(_e&&!c)return t(Nl,{projectId:n,teamId:f,fileId:s,file:i,projectInfo:j,ancestorFolders:i.ancestorFolders??[],parentFolderId:l,versions:F,activeFileId:a,startTime:k,siblingFiles:_.files,onNavigateToFile:(e)=>{I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:e}})},onNavigateBack:()=>{if(l&&l!==j?.rootFolder)I({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:l}});else I({to:"/projects/$projectId",params:{projectId:n}})},onSelectVersion:(e)=>{I({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,version:e})})},onRenameFile:async(e)=>{await pt({param:{fileId:a},json:{name:e}})},onDeleteFile:async()=>{await ht({json:{ids:[a]}})},onSaveField:Ce});return o("div",{className:"h-full flex flex-1 flex-col bg-background",children:[o("div",{className:"h-full flex flex-1 overflow-hidden",children:[o("div",{className:"flex-1 relative",children:[lt&&!c&&t("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:t(L,{className:"h-8 w-8 animate-spin text-foreground"})}),c&&M&&b?t(Ol,{versions:F??[],leftId:M,rightId:b,activeSide:N,annotations:V,seekRequest:Ve,onActiveSideChange:(e)=>le({cmpActive:e}),onSwitchVersion:(e,r)=>le(e==="left"?{cmpLeft:r}:{cmpRight:r}),onExit:vt,onActiveAssetChange:Ee,onPlay:De,onTimeUpdate:P}):t(ni,{file:i,mediaControllerRef:p,onPlay:De,onTimeUpdate:P,annotations:V,startTime:k,children:_.show&&t(Ne,{projectId:n,currentAssetId:a,parentFolderId:l,initialFiles:_.files,initialNextCursor:_.nextCursor})})]}),(!m||y)&&o(B,{children:[t(Sr,{onResize:(e)=>{J((r)=>Math.max(300,Math.min(600,r-e)))},className:"hidden md:block"}),t("div",{style:{width:X},className:"flex-shrink-0 bg-background flex flex-col",children:y?t(ga,{projectId:n,contextAssetId:a,file:O,currentTime:q,frameRate:O?.media?.metadata?.frameRate||30,startTimecode:O?.media?.metadata?.startTimecode,onTyping:()=>{if(c)return;p.current?.pause()},onSelectMessage:xt,selectedMessageId:Y}):t(ba,{teamId:f,projectId:n,file:O,onSaveField:Ce,members:ze,onCommentSelect:wt,currentTime:q,onTyping:()=>{if(c)return;p.current?.pause()},selectedCommentId:Y,hideAnnotationControl:O?.proxyType==="audio"})})]})]}),t(pe,{open:re,onOpenChange:ee,children:t(ue,{children:o("form",{onSubmit:gt,children:[t(me,{children:t(de,{children:No()})}),t("div",{className:"py-4",children:t(H,{ref:se,value:te,onChange:(e)=>xe(e.target.value),placeholder:id?.()||"Enter new name",onFocus:It,autoFocus:!0})}),o($e,{children:[t(S,{type:"button",variant:"outline",onClick:()=>ee(!1),children:ke()}),o(S,{type:"submit",disabled:be||!te.trim(),children:[be&&t(L,{className:"mr-2 h-4 w-4 animate-spin"}),Oo()]})]})]})})}),t(Je,{open:ct,onOpenChange:ie,children:o(Xe,{children:[o(et,{children:[t(rt,{children:Oc?.()||"Delete Asset?"}),t(nt,{children:Nc?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),o(tt,{children:[t(st,{children:ke()}),o(ot,{onClick:yt,disabled:je,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[je&&t(L,{className:"mr-2 h-4 w-4 animate-spin"}),at()]})]})]})})]})}var Le=Fe("/projects/$projectId/files/$fileId")({component:kt});export{Le as Route};
@@ -1,2 +0,0 @@
1
- import{xt,D,N,St,O,w,C,t,E,as,dt,Y,Lt,se,zn,aa,cl,ul}from"./chunk-7rhz2gze.js";C();C();var S=Object.defineProperty,z=(s,e)=>S(s,"name",{value:e,configurable:!0}),M="Toggle",T=D(z(function(e,o){let{pressed:r,defaultPressed:n,onPressedChange:a,...g}=e,[l,i]=Lt({prop:r,onChange:a,defaultProp:n??!1,caller:M});return t(se.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...g,ref:o,onClick:Y(e.onClick,()=>{if(!e.disabled)i(!l)})})},"Toggle"));C();var k=Object.defineProperty,p=(s,e)=>k(s,"name",{value:e,configurable:!0}),m="ToggleGroup",[b,ie]=dt(m,[aa]),R=aa(),F=D(p(function(e,o){let{type:r,...n}=e;if(r==="single")return t(A,{role:"radiogroup",...n,ref:o});if(r==="multiple")return t(j,{role:"toolbar",...n,ref:o});throw Error(`Missing prop \`type\` expected on \`${m}\``)},"ToggleGroup")),[h,x]=b(m),A=D(p(function(e,o){let{value:r,defaultValue:n,onValueChange:a=p(()=>{},"onValueChange"),...g}=e,[l,i]=Lt({prop:r,defaultProp:n??"",onChange:a,caller:m});return t(h,{scope:e.__scopeToggleGroup,type:"single",value:O(()=>l?[l]:[],[l]),onItemActivate:i,onItemDeactivate:N(()=>i(""),[i]),children:t(I,{...g,ref:o})})},"ToggleGroupImplSingle")),j=D(p(function(e,o){let{value:r,defaultValue:n,onValueChange:a=p(()=>{},"onValueChange"),...g}=e,[l,i]=Lt({prop:r,defaultProp:n??[],onChange:a,caller:m}),u=N((c)=>i((d=[])=>[...d,c]),[i]),f=N((c)=>i((d=[])=>d.filter((y)=>y!==c)),[i]);return t(h,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:f,children:t(I,{...g,ref:o})})},"ToggleGroupImplMultiple")),[B,H]=b(m),I=D(p(function(e,o){let{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:a=!0,orientation:g,dir:l,loop:i=!0,...u}=e,f=R(r),c=zn(l),d={dir:c,...u};return t(B,{scope:r,rovingFocus:a,disabled:n,children:a?t(cl,{asChild:!0,...f,orientation:g,dir:c,loop:i,children:t(se.div,{...d,ref:o})}):t(se.div,{...d,ref:o})})},"ToggleGroupImpl")),v="ToggleGroupItem",L=D(p(function(e,o){let r=x(v,e.__scopeToggleGroup),n=H(v,e.__scopeToggleGroup),a=R(e.__scopeToggleGroup),g=r.value.includes(e.value),l=n.disabled||e.disabled,i={...e,pressed:g,disabled:l},u=w(null);return n.rovingFocus?t(ul,{asChild:!0,...a,focusable:!l,active:g,ref:u,children:t(P,{...i,ref:o})}):t(P,{...i,ref:o})},"ToggleGroupItem")),P=D(p(function(e,o){let{__scopeToggleGroup:r,value:n,...a}=e,g=x(v,r),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=g.type==="single"?l:void 0;return t(T,{...i,...a,ref:o,onPressedChange:(u)=>{if(u)g.onItemActivate(n);else g.onItemDeactivate(n)}})},"ToggleGroupItemImpl"));var _=as("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var V=xt({size:"default",variant:"default",spacing:0});function Eo({className:s,variant:e,size:o,spacing:r=0,children:n,...a}){return t(F,{"data-slot":"toggle-group","data-variant":e,"data-size":o,"data-spacing":r,style:{"--gap":r},className:E("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",s),...a,children:t(V.Provider,{value:{variant:e,size:o,spacing:r},children:n})})}function pr({className:s,children:e,variant:o,size:r,...n}){let a=St(V);return t(L,{"data-slot":"toggle-group-item","data-variant":a.variant||o,"data-size":a.size||r,"data-spacing":a.spacing,className:E(_({variant:a.variant||o,size:a.size||r}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",s),...n,children:e})}
2
- export{Eo,pr};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Jd,kn,nc,oc,sc,ac,mu,hu,em,nA,ys,zo,Fr}from"./chunk-nkdk229f.js";export{sc as EncryptJWT,oc as SignJWT,em as UnsecuredJWT,Jd as base64url,ac as calculateJwkThumbprint,mu as createLocalJWKSet,hu as createRemoteJWKSet,Fr as decodeJwt,zo as decodeProtectedHeader,ys as importJWK,nA as importPKCS8,nc as jwtDecrypt,kn as jwtVerify};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{yc,_c,Pu}from"./chunk-9ccw540k.js";export{yc as ENV_KEY,_c as ENV_SECRET,Pu as fromEnv};
@@ -1,2 +0,0 @@
1
- import{T}from"./chunk-7rhz2gze.js";var e=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Co=T("terminal",e);
2
- export{Co};
@@ -1 +0,0 @@
1
- import{t,Fe}from"./chunk-7rhz2gze.js";import"./chunk-tm7f32c7.js";import"./chunk-7kjgvxqa.js";import"./chunk-gc5sbfa5.js";import"./chunk-rssgmj7x.js";import"./chunk-8e28hcny.js";import"./chunk-snhsjs4x.js";import"./chunk-77fmkpdz.js";import"./chunk-914bp49r.js";import"./chunk-f6svp4dp.js";import"./chunk-0qaq0sp8.js";import{ha}from"./chunk-vyzptrea.js";import"./chunk-98715kc3.js";import"./chunk-m9pr03kn.js";import"./chunk-j2bvj2yn.js";import"./chunk-cbgq517y.js";import"./chunk-gk2q9a3f.js";import"./chunk-9t8n2des.js";import"./chunk-ytdwk2fq.js";import"./chunk-0zv3bks2.js";function a(){let{shareId:e}=s.useParams();return t(ha,{shareId:e})}var s=Fe("/share/$shareId/")({component:a});export{s as Route};
@@ -1 +0,0 @@
1
- import{h,O,u,C,B,t,o,K,U,ut,Re,Fe,A,L,Un,ks,Ci,S,Ee,Ie,Te,lA,Ay,d0,wf,Pc,Ns,Mw,hl,gx,ZS,yE,cn,it,Mt,R,Ar,qe,Qt,_t,qp}from"./chunk-7rhz2gze.js";import{Sr}from"./chunk-0qaq0sp8.js";import{kl}from"./chunk-kswvyqq1.js";import{er}from"./chunk-5vzrpz50.js";import{Tn,Mn,Rn,_r,bt,mt}from"./chunk-xx337zcw.js";import{ao}from"./chunk-rq0n0vcc.js";import{Rr}from"./chunk-0zv3bks2.js";C();var F=(a)=>{if(!a)return"??";return a.split(" ").map((i)=>i[0]).slice(0,2).join("").toUpperCase()};function P(){let{projectId:a}=H.useParams(),{teamId:i,ensureTeamIdForProject:d}=it(),N=K(),y=Re();h(()=>{d(a)},[a,d]);let{data:n}=er(qp(a)),m=n?.rootFolder,[w,k]=u(240),{shareConfigLeftSidebarCollapsed:c,setShareConfigLeftSidebarCollapsed:I}=Qt(),{data:p,isLoading:T,fetchNextPage:f,hasNextPage:b,isFetchingNextPage:l}=ut({queryKey:["shares",a],queryFn:async({pageParam:e})=>{let r=await A.api.projects[":projectId"].shares.$get({param:{projectId:a},query:{first:"20",after:e}});if(!r.ok)throw Error("Failed to fetch share links");return await r.json()},initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,enabled:!!a}),{ref:j,inView:g}=Mt();h(()=>{if(g&&b&&!l)f()},[g,b,l,f]);let x=O(()=>p?.pages.flatMap((e)=>e.data)||[],[p]),{mutate:_}=U({mutationFn:async({id:e,isDisabled:r})=>{let s=await A.api.shares[":shareId"].$put({param:{shareId:e},json:{isDisabled:r}});if(!s.ok)throw Error("Failed to update share link");return await s.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["shares",a]}),R.success(yE())},onError:(e)=>{R.error(Ns({message:e.message}))}});if(!i||!m||!n)return t(_t,{});let v=async(e)=>{let r=`${window.location.origin}/share/${e}`;if(await ao(r))R.success(Mw())};return t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!c&&t("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>I(!0)}),!c&&o(B,{children:[t("div",{className:"bg-background",style:{width:w},children:t(Ar,{teamId:i,projectId:a,projectName:n.name??"",rootFolderId:m})}),t(Sr,{onResize:(e)=>{k((r)=>Math.max(180,Math.min(400,r+e)))},className:"hidden md:block"})]}),o("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[t("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:o("div",{className:"flex items-center gap-2",children:[t(Ci,{className:"h-5 w-5 text-primary"}),t("h1",{className:"font-bold text-lg text-foreground",children:Ay()})]})}),t("div",{className:"flex-1 overflow-y-auto p-6",children:T?t("div",{className:"flex justify-center items-center h-64",children:t("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):x.length===0?o("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[t(ks,{className:"h-10 w-10 text-muted-foreground/50"}),t("p",{children:gx()})]}):o("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[o(Tn,{children:[t(Mn,{children:o(_r,{className:"hover:bg-transparent bg-muted/20",children:[t(bt,{className:"font-semibold px-4 py-3",children:hl()}),t(bt,{className:"font-semibold px-4 py-3",children:ZS()}),t(bt,{className:"font-semibold px-4 py-3",children:Pc()}),t(bt,{className:"font-semibold px-4 py-3 w-[150px]",children:wf()}),t(bt,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:lA()})]})}),t(Rn,{children:x.map((e)=>{let r=`${window.location.origin}/share/${e.id}`;return o(_r,{className:"hover:bg-muted/10 transition-colors",children:[t(mt,{className:"font-medium px-4 py-3.5",children:t("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>y({to:"/projects/$projectId/shares/$shareId",params:{projectId:a,shareId:e.id}}),children:e.name})}),t(mt,{className:"px-4 py-3.5 max-w-[300px]",children:o("div",{className:"flex items-center gap-2 group",children:[t("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>v(e.id),title:d0(),children:r}),t(S,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(e.id),children:t(Rr,{className:"h-3.5 w-3.5"})}),t("a",{href:r,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:t(kl,{className:"h-3.5 w-3.5"})})]})}),t(mt,{className:"px-4 py-3.5",children:o("div",{className:"flex items-center gap-2",children:[o(Ee,{className:"h-6 w-6",children:[e.creator?.image&&t(Ie,{src:e.creator.image,alt:e.creator.name,className:"object-cover"}),t(Te,{className:"text-[10px]",children:F(e.creator?.name)})]}),t("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:e.creator?.name||cn()})]})}),t(mt,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:o("div",{className:"flex items-center gap-2",children:[t(Un,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),t("span",{children:new Date(e.createdAt).toLocaleDateString()})]})}),t(mt,{className:"px-4 py-3.5 text-right",children:t("div",{className:"flex justify-end",children:t(qe,{checked:!e.isDisabled,onCheckedChange:(s)=>_({id:e.id,isDisabled:!s})})})})]},e.id)})})]}),t("div",{ref:j,className:"h-10 w-full flex items-center justify-center",children:l&&t(L,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var H=Fe("/projects/$projectId/shares/")({component:P});export{H as Route};
@@ -1,2 +0,0 @@
1
- import{t,o,E}from"./chunk-7rhz2gze.js";var Sa=(r)=>{if(isNaN(r))return"00:00";let e=new Date(r*1000),c=e.getUTCHours(),a=e.getUTCMinutes().toString().padStart(2,"0"),n=e.getUTCSeconds().toString().padStart(2,"0");if(c)return`${c}:${a}:${n}`;return`${a}:${n}`},In=(r,e,c,a)=>{if(c==="frames")return`${r} fr`;if(c==="standard")return Sa(r/e);let n=Math.round(e),d=e!==n,i=!1;if(d&&(n===30||n===60))i=!0;let l=0;if(a){let s=a.match(/^([012]\d):(\d\d):(\d\d)(:|;|\.)(\d+)$/);if(s){let f=parseInt(s[1],10),u=parseInt(s[2],10),S=parseInt(s[3],10),N=parseInt(s[5],10);if(i=s[4]!==":",l=(f*3600+u*60+S)*n+N,i){let h=f*60+u,C=e<30?2:4;l-=C*(h-Math.floor(h/10))}}}let m=r+l;if(i){let s=e<30?2:4,f=Math.floor(m/(17982*s/2)),u=m%(17982*s/2);if(u<s)u=u+s;m+=9*s*f+s*Math.floor((u-s)/(1798*s/2))}let p=m%n,g=Math.floor(m/n)%60,b=Math.floor(m/(n*60))%60,M=Math.floor(m/(n*3600))%24,x=i?";":":";return`${M.toString().padStart(2,"0")}:${b.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}${x}${p.toString().padStart(2,"0")}`};var lu=(r,e)=>{if(!e)return 0;let c=1/e;return r*c+c/2},cu=(r)=>Math.max(100,3000/(r||30)),uu=({dbTotalFrames:r,containerDuration:e,frameRate:c})=>{let a=c||30,n=Math.round(e*a);if(r<=0)return n;let d=r/a,i=e-d,l=cu(a)/1000;return i>l?n:r};var ii=({progress:r,className:e})=>{let a=2*Math.PI*20,n=a-Math.min(100,Math.max(0,r))/100*a;return o("svg",{viewBox:"0 0 50 50",className:E("w-12 h-12",e),children:[t("circle",{cx:"25",cy:"25",r:20,className:"stroke-muted",strokeWidth:"4",fill:"transparent"}),t("circle",{cx:"25",cy:"25",r:20,className:"stroke-primary transition-all duration-300 ease-out",strokeWidth:"4",fill:"transparent",strokeDasharray:a,strokeDashoffset:n,transform:"rotate(-90 25 25)"}),t("text",{x:"50%",y:"50%",textAnchor:"middle",dy:".3em",className:"fill-foreground text-[10px] font-bold",children:`${Math.round(r)}%`})]})};
2
- export{ii,Sa,In,lu,cu,uu};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-97f2af6d.js";import{nf,sT}from"./chunk-4v41a1r9.js";export{nf as createKyselyAdapter,sT as kyselyAdapter};
@@ -1 +0,0 @@
1
- import{h,O,u,C,B,t,o,ut,Re,Fe,A,L,$a,Un,Jn,Ee,Ie,Te,fy,f0,wf,Pc,nx,cn,it,Mt,Ar,Qt,_t,Hp}from"./chunk-7rhz2gze.js";import{Sr}from"./chunk-0qaq0sp8.js";import{er}from"./chunk-5vzrpz50.js";import{Tn,Mn,Rn,_r,bt,mt}from"./chunk-xx337zcw.js";C();var k=(a)=>{if(!a)return"??";return a.split(" ").map((r)=>r[0]).slice(0,2).join("").toUpperCase()};function T(){let{projectId:a}=j.useParams(),{teamId:r,ensureTeamIdForProject:n}=it(),g=Re();h(()=>{n(a)},[a,n]);let{data:i}=er(Hp(a)),d=i?.rootFolder,[v,N]=u(240),{fileListLeftSidebarCollapsed:m,setFileListLeftSidebarCollapsed:y}=Qt(),{data:c,isLoading:w,fetchNextPage:f,hasNextPage:p,isFetchingNextPage:l}=ut({queryKey:["collections",a],queryFn:async({pageParam:e})=>{let s=await A.api.projects[":projectId"].collections.$get({param:{projectId:a},query:{first:"20",after:e}});if(!s.ok)throw Error("Failed to fetch collections");return await s.json()},initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,enabled:!!a}),{ref:I,inView:b}=Mt();h(()=>{if(b&&p&&!l)f()},[b,p,l,f]);let x=O(()=>c?.pages.flatMap((e)=>e.data)||[],[c]);if(!r||!d||!i)return t(_t,{});return t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!m&&t("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>y(!0)}),!m&&o(B,{children:[t("div",{className:"bg-background",style:{width:v},children:t(Ar,{teamId:r,projectId:a,projectName:i.name??"",rootFolderId:d})}),t(Sr,{onResize:(e)=>{N((s)=>Math.max(180,Math.min(400,s+e)))},className:"hidden md:block"})]}),o("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[t("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:o("div",{className:"flex items-center gap-2",children:[t($a,{className:"h-5 w-5 text-primary"}),t("h1",{className:"font-bold text-lg text-foreground",children:fy()})]})}),t("div",{className:"flex-1 overflow-y-auto p-6",children:w?t("div",{className:"flex justify-center items-center h-64",children:t("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):x.length===0?o("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[t(Jn,{className:"h-10 w-10 text-muted-foreground/50"}),t("p",{children:nx()})]}):o("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[o(Tn,{children:[t(Mn,{children:o(_r,{className:"hover:bg-transparent bg-muted/20",children:[t(bt,{className:"font-semibold px-4 py-3",children:f0()}),t(bt,{className:"font-semibold px-4 py-3",children:Pc()}),t(bt,{className:"font-semibold px-4 py-3 w-[200px]",children:wf()})]})}),t(Rn,{children:x.map((e)=>o(_r,{className:"hover:bg-muted/10 transition-colors cursor-pointer",onClick:()=>g({to:"/projects/$projectId/collections/$collectionId",params:{projectId:a,collectionId:e.id}}),children:[t(mt,{className:"font-medium px-4 py-3.5",children:o("div",{className:"flex items-center gap-2",children:[t($a,{className:"h-4 w-4 text-primary shrink-0"}),t("span",{className:"text-foreground font-semibold hover:underline",children:e.name})]})}),t(mt,{className:"px-4 py-3.5",children:o("div",{className:"flex items-center gap-2",children:[o(Ee,{className:"h-6 w-6",children:[e.creator?.image&&t(Ie,{src:e.creator.image,alt:e.creator.name,className:"object-cover"}),t(Te,{className:"text-[10px]",children:k(e.creator?.name)})]}),t("span",{className:"text-sm font-medium text-foreground truncate max-w-[200px]",children:e.creator?.name||cn()})]})}),t(mt,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:o("div",{className:"flex items-center gap-2",children:[t(Un,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),t("span",{children:new Date(e.createdAt).toLocaleDateString()})]})})]},e.id))})]}),t("div",{ref:I,className:"h-10 w-full flex items-center justify-center",children:l&&t(L,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var j=Fe("/projects/$projectId/collections/")({component:T});export{j as Route};
@@ -1 +0,0 @@
1
- import{h,O,u,C,B,t,o,K,Z,U,ut,Fe,A,T,cr,L,$r,wt,Un,Gr,pt,xi,or,ks,_o,fe,bo,ve,De,E,S,Ee,Ie,Te,ge,Ae,ye,W,Om,Bm,ke,n0,c0,kc,B0,U0,bf,at,f_,p_,x_,S_,ad,O_,eh,Sn,Xb,ew,tw,rw,nw,ow,sw,fd,kw,Lv,Nh,ix,_x,Gh,pg,Ds,Md,Ap,Rd,Og,Cp,WE,YE,Dg,Lg,Zg,Bg,Ug,Pd,Fg,rI,cs,Je,Xe,et,tt,rt,nt,ot,st,pe,ue,me,$e,de,Tt,H,ie,Wo,kr,un,jn,ds,Pr,Dd,Mt,R,xe,fr,Qe,Br,fa,Jg,to,Bp,ei,ti,pa,V,qe,Le,Ze,Be,Ue,ne,ma,Ud,Fd,zd,qd}from"./chunk-7rhz2gze.js";import{Li}from"./chunk-1xh34aew.js";import{Hn,oo}from"./chunk-cbgq517y.js";import{rn}from"./chunk-ytdwk2fq.js";C();var it=[["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"}]],Ce=T("pen",it);function Se({scope:e,onScopeChange:r,selectedGoal:x,onClearGoal:p,onCreateTask:w,canCreateTask:v=!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(S,{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(oo,{className:"w-3.5 h-3.5"}),t("span",{children:rI()})]}),o(S,{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(Hn,{className:"w-3.5 h-3.5"}),t("span",{children:Lv()})]})]}),x&&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(bo,{className:"w-3.5 h-3.5 text-sidebar-primary shrink-0"}),t("span",{className:"truncate font-medium",children:x.id===fa?cs():x.title}),t(S,{variant:"ghost",size:"icon-xs",onClick:p,className:"h-4 w-4 p-0 ml-0.5 text-muted-foreground hover:text-foreground",title:c0(),children:t(De,{className:"w-3 h-3"})})]})]}),v&&t("div",{className:"flex items-center gap-2 shrink-0",children:o(S,{size:"sm",onClick:w,className:"h-8 px-3 text-xs gap-1.5 shadow-xs",children:[t(fe,{className:"w-3.5 h-3.5"}),t("span",{children:bf()})]})})]})}C();C();function ce({teamId:e,isOpen:r,onClose:x,goalToEdit:p}){let w=K(),[v,I]=u(""),[g,_]=u("");h(()=>{if(p)I(p.title),_(p.description||"");else I(""),_("")},[p,r]);let{mutate:F,isPending:G}=U({mutationFn:async()=>{let n=await A.api.teams[":teamId"].kanban.goals.$post({param:{teamId:e},json:{title:v.trim(),description:g.trim()||void 0}});if(!n.ok){let b=await n.json().catch(()=>({message:Sn()}));throw Error(b.message||Sn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),R.success(Xb()),x()},onError:(n)=>{R.error(n.message)}}),{mutate:j,isPending:P}=U({mutationFn:async()=>{if(!p)return;let n=await A.api.teams[":teamId"].kanban.goals[":goalId"].$patch({param:{teamId:e,goalId:p.id},json:{title:v.trim(),description:g.trim()||null}});if(!n.ok){let b=await n.json().catch(()=>({message:Sn()}));throw Error(b.message||Sn())}return await n.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),R.success(sw()),x()},onError:(n)=>{R.error(n.message)}}),z=(n)=>{if(n.preventDefault(),!v.trim())return;if(p)j();else F()},d=G||P;return t(pe,{open:r,onOpenChange:(n)=>!n&&x(),children:t(ue,{className:"sm:max-w-xl",children:o("form",{onSubmit:z,className:"space-y-4",children:[o(me,{children:[t(de,{children:p?eh():U0()}),t(Tt,{children:p?eh():B0()})]}),o("div",{className:"space-y-3 py-2",children:[o("div",{className:"space-y-1.5",children:[t(V,{htmlFor:"goal-title",children:nw()}),t(H,{id:"goal-title",value:v,onChange:(n)=>I(n.target.value),placeholder:ow(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(V,{htmlFor:"goal-description",children:tw()}),t(pa,{id:"goal-description",value:g,onChange:(n)=>_(n.target.value),placeholder:rw(),rows:3})]})]}),o($e,{children:[t(S,{type:"button",variant:"outline",onClick:x,disabled:d,children:ke()}),o(S,{type:"submit",disabled:!v.trim()||d,children:[d&&t(L,{className:"w-4 h-4 mr-1.5 animate-spin"}),p?Ds():kc()]})]})]})})})}function Ke({teamId:e,selectedGoalId:r,onSelectGoal:x,isOwnerOrEditor:p=!0}){let w=K(),[v,I]=u(!1),[g,_]=u(null),[F,G]=u(null),[j,P]=u(!1),{data:z,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=z?.data||[],b=n.reduce((i,s)=>i+(s.taskCount||0),0),{mutate:N,isPending:l}=U({mutationFn:async(i)=>{let s=await A.api.teams[":teamId"].kanban.goals[":goalId"].$delete({param:{teamId:e,goalId:i}});if(!s.ok){let m=await s.json().catch(()=>({message:Sn()}));throw Error(m.message||Sn())}return await s.json()},onSuccess:(i,s)=>{if(w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),R.success(ew()),r===s)x(null);G(null)},onError:(i)=>{R.error(i.message)}});if(j)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(S,{variant:"ghost",size:"icon-sm",onClick:()=>P(!1),title:fd(),className:"text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(pt,{className:"w-4 h-4"})})}),o("div",{className:"mt-3 flex flex-col items-center gap-2",children:[t(S,{variant:r===null?"secondary":"ghost",size:"icon-sm",onClick:()=>x(null),title:Om(),className:E("w-8 h-8 rounded-md",r===null&&"bg-sidebar-accent text-sidebar-accent-foreground"),children:t(Li,{className:"w-4 h-4"})}),t(S,{variant:"ghost",size:"icon-sm",onClick:()=>I(!0),title:Nh(),className:"w-8 h-8 rounded-md text-sidebar-foreground/70 hover:text-sidebar-foreground",children:t(fe,{className:"w-4 h-4"})})]}),v&&t(ce,{teamId:e,isOpen:v,onClose:()=>I(!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(bo,{className:"w-4 h-4 text-sidebar-primary"}),t("span",{children:fd()})]}),o("div",{className:"flex items-center gap-1",children:[p&&t(S,{variant:"ghost",size:"icon-sm",onClick:()=>I(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:Nh(),children:t(fe,{className:"w-4 h-4"})}),t(S,{variant:"ghost",size:"icon-sm",onClick:()=>P(!0),className:"h-7 w-7 text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"Collapse",children:t(Gr,{className:"w-4 h-4"})})]})]}),t(ie,{className:"flex-1 p-2",children:o("div",{className:"space-y-1",children:[o("div",{onClick:()=>x(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(Li,{className:"w-3.5 h-3.5 shrink-0 text-sidebar-primary"}),t("span",{className:"truncate",children:Om()})]}),b>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:b})]}),d?t("div",{className:"flex items-center justify-center p-4",children:t(L,{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:ix()}):n.map((i)=>{let s=r===i.id,m=i.id===fa,k=m?cs():i.title,f=p&&!m;return o("div",{onClick:()=>x(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(bo,{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:f?o(B,{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(S,{variant:"ghost",size:"icon-xs",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:t(cr,{className:"w-3.5 h-3.5"})})}),o(ye,{align:"end",className:"w-36",children:[o(W,{onClick:()=>{_(i)},children:[t(Ce,{className:"w-3.5 h-3.5 mr-2"}),O_()]}),o(W,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>{G(i)},children:[t(ve,{className:"w-3.5 h-3.5 mr-2"}),at()]})]})]})})]}):(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)})]})}),(v||g)&&t(ce,{teamId:e,isOpen:v||!!g,goalToEdit:g,onClose:()=>{I(!1),_(null)}}),F&&t(Je,{open:!!F,onOpenChange:(i)=>!i&&G(null),children:o(Xe,{children:[o(et,{children:[t(rt,{children:f_()}),t(nt,{children:p_({title:F.title})})]}),o(tt,{children:[t(st,{disabled:l,children:ke()}),o(ot,{onClick:()=>N(F.id),disabled:l,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[l&&t(L,{className:"w-4 h-4 mr-1.5 animate-spin"}),at()]})]})]})})]})}C();C();function _e(e){return+xe(e)<Date.now()}function Pe({task:e,onClick:r,onDelete:x,disabled:p,isFirst:w,isLast:v,showBottomIndicator:I,currentUserId:g,currentUserRole:_}){let{source:F}=Dd(),G=!!F,j=_?.toLowerCase()==="owner",P=_?.toLowerCase()==="editor",z=!!g&&e.creator?.id===g,d=e.reporter?.id===g||z,n=e.assignee?.id===g,b=j||P||d||n,N=z||j||d,l=p||!b,{ref:i,isDragging:s}=ds({id:e.id,data:{type:"kanban_task",task:e},disabled:l}),{ref:m,isDropTarget:k}=Pr({id:`reorder-before-${e.id}`,data:{type:"reorder",task:e,position:"before"},disabled:s||p}),{ref:f,isDropTarget:c}=Pr({id:`reorder-after-${e.id}`,data:{type:"reorder",task:e,position:"after"},disabled:s||p}),D=e.isAgentTask,M=e.status===Qe.BLOCKED,y=e.dueDate?_e(new Date(e.dueDate))&&e.status!==Qe.DONE:!1;return o("div",{className:"relative",children:[t("div",{ref:m,className:E("absolute left-0 right-0 z-20",w?"-top-6 h-[calc(50%+24px)]":"-top-1 h-[calc(50%+4px)]",G&&!s?"pointer-events-auto":"pointer-events-none")}),t("div",{ref:f,className:E("absolute bottom-0 left-0 right-0 z-20",v?"-bottom-6 h-[calc(50%+24px)]":"h-1/2",G&&!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||I)&&!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",M&&"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",ti(e.priority)),children:ei(e.priority)}),D&&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(wt,{className:"w-3 h-3"}),t("span",{children:Pd()})]}),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(bo,{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(S,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground",children:t(cr,{className:"w-3.5 h-3.5"})})}),t(ye,{align:"end",className:"w-32",children:o(W,{className:"text-destructive focus:text-destructive focus:bg-destructive/10",onClick:()=>x?.(e),children:[t(ve,{className:"w-3.5 h-3.5 mr-2"}),at()]})})]})})})]}),t("h4",{className:"text-xs font-semibold leading-snug line-clamp-2 text-foreground break-words",children:e.title}),M&&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($r,{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||Og()})]}),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(rn,{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(B,{children:[D?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(wt,{className:"w-3 h-3 text-orange-600 dark:text-orange-400"})}):o(Ee,{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:cs()})}),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:fr(new Date(e.dueDate),"yyyy/MM/dd HH:mm"),children:[t(Un,{className:"w-3 h-3"}),t("span",{children:fr(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:kw({count:e.assetCount}),children:[t(xi,{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(ks,{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(_o,{className:"w-3 h-3"}),t("span",{children:e.commentCount})]})]})]})]})]})}function Me({teamId:e,status:r,selectedGoalId:x,scope:p,currentUserId:w,currentUserRole:v,onTaskClick:I,onDeleteTask:g,onCreateTaskInColumn:_}){let F=v?.toLowerCase()==="owner"||v?.toLowerCase()==="editor",G=p==="my"?w:void 0,{data:j,fetchNextPage:P,hasNextPage:z,isFetchingNextPage:d,isLoading:n}=ut({queryKey:["teams",e,"kanban","tasks",{status:r,goalId:x,assigneeId:G}],queryFn:async({pageParam:q=""})=>{let J=await A.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:e},query:{status:r,goalId:x||void 0,assigneeId:G||void 0,first:"20",after:q||void 0}});if(!J.ok)throw Error("Failed to fetch column tasks");return await J.json()},initialPageParam:"",getNextPageParam:(q)=>q.pageInfo?.cursor||void 0,refetchInterval:5000,enabled:!!e}),{ref:b,inView:N}=Mt({threshold:0.1});h(()=>{if(N&&z&&!d)P()},[N,z,d,P]);let l=O(()=>j?.pages?.flatMap((q)=>Array.isArray(q?.data)?q.data:[])||[],[j]),{source:i,target:s}=Dd(),m=l.filter((q)=>q.id!==i?.id).at(-1),{ref:k,isDropTarget:f}=Pr({id:r,data:{type:"kanban_column",status:r,lastTask:m}}),c=i?.data?.type==="kanban_task",D=c&&(f||s?.data?.type==="kanban_column"&&s.data.status===r||s?.data?.type==="reorder"&&s.data.task?.status===r),M=c&&s?.data?.type==="kanban_column"&&s.data.status===r,y=j?.pages?.[0]?.pageInfo?.total??l.length,X=Bp(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",D&&"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:to(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(ie,{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(L,{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:_x()})}):l.map((q,J)=>t(Pe,{task:q,onClick:I,onDelete:g,isFirst:J===0,isLast:J===l.length-1,showBottomIndicator:M&&q.id===m?.id,currentUserId:w,currentUserRole:v},q.id)),t("div",{ref:b,className:"h-2"}),d&&t("div",{className:"flex justify-center py-2",children:t(L,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})}),F&&t("div",{className:"p-2 border-t border-border/50 bg-card/90 shrink-0",children:o(S,{variant:"ghost",size:"sm",onClick:()=>_(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(fe,{className:"w-3.5 h-3.5 mr-1.5"}),t("span",{children:bf()})]})})]})}function Oe({teamId:e,selectedGoalId:r,scope:x,currentUserId:p,currentUserRole:w,onTaskClick:v,onCreateTaskInColumn:I}){let g=K(),[_,F]=u(null),{mutate:G,isPending:j}=U({mutationFn:async(d)=>{let n=await A.api.teams[":teamId"].kanban.tasks[":taskId"].$delete({param:{teamId:e,taskId:d}});if(!n.ok){let b=await n.json().catch(()=>({message:Sn()}));throw Error(b.message||Sn())}return await n.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),g.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),R.success(YE()),F(null)},onError:(d)=>{R.error(d.message)}}),{mutate:P}=U({mutationFn:async({taskId:d,fromStatus:n,status:b,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:b,reason:N,beforeIndex:l,afterIndex:i}});if(!s.ok){let m=await s.json().catch(()=>({message:Sn()}));throw Error(m.message||Sn())}return await s.json()},onMutate:async({taskId:d,status:n,targetTaskId:b,position:N})=>{await g.cancelQueries({queryKey:["teams",e,"kanban","tasks"]});let l=g.getQueriesData({queryKey:["teams",e,"kanban","tasks"]}),i=null,s=(m)=>m[0]==="teams"&&m[1]===e&&m[2]==="kanban"&&m[3]==="tasks"&&typeof m[4]==="object"&&m[4]!==null&&("status"in m[4]);if(g.setQueriesData({predicate:(m)=>s(m.queryKey)},(m)=>{if(!m||!Array.isArray(m.pages))return m;let k=!1,f=m.pages.map((c)=>{if(!c||!Array.isArray(c.data))return c;let D=c.data.find((M)=>M.id===d);if(D)return i={...D,status:n},k=!0,{...c,data:c.data.filter((M)=>M.id!==d),pageInfo:{...c.pageInfo,total:Math.max(0,(c.pageInfo?.total??c.data.length)-1)}};return c});return k?{...m,pages:f}:m}),i){let m=i;g.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 f=k.pages.flatMap((y)=>y?.data??[]).filter((y)=>y.id!==d),c=f.length;if(b){let y=f.findIndex((X)=>X.id===b);if(y!==-1)c=N==="before"?y:y+1}f.splice(c,0,m);let D=0,M=k.pages.map((y,X)=>{let q=y?.data?y.data.length:0,J=X===0&&q===0?1:X===k.pages.length-1?f.length-D:q,te=f.slice(D,D+J);return D+=J,{...y,data:te,pageInfo:{...y?.pageInfo,total:(y?.pageInfo?.total??0)+1}}});if(D<f.length&&M.length>0){let y=M.length-1;M[y]={...M[y],data:[...M[y]?.data??[],...f.slice(D)]}}return{...k,pages:M}})}return{previousQueries:l}},onError:(d,n,b)=>{if(b?.previousQueries)for(let[N,l]of b.previousQueries)g.setQueryData(N,l);R.error(d.message)},onSettled:()=>{g.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]})}}),z=(d)=>{if(d.canceled)return;let{source:n,target:b}=d.operation;if(!n||!b)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",m=l.reporter?.id===p||l.creator?.id===p,k=l.assignee?.id===p;if(!i&&!s&&!m&&!k){R.error(n0());return}let f=b.data;if(!f)return;if(f.type==="reorder"&&f.task&&f.position){let c=f.task,D=c.status;if(l.id===c.id)return;let M=f.position==="before"?c.sortIndex??void 0:void 0,y=f.position==="after"?c.sortIndex??void 0:void 0;P({taskId:l.id,fromStatus:l.status,status:D,beforeIndex:M,afterIndex:y,targetTaskId:c.id,position:f.position});return}if(f.type==="kanban_column"&&f.status){let{status:c,lastTask:D}=f;if(D){if(l.id===D.id){if(l.status===c)return;P({taskId:l.id,fromStatus:l.status,status:c});return}P({taskId:l.id,fromStatus:l.status,status:c,afterIndex:D.sortIndex??void 0,targetTaskId:D.id,position:"after"});return}if(l.status===c)return;P({taskId:l.id,fromStatus:l.status,status:c})}};return o(jn,{sensors:[un.configure({activationConstraints:[new kr.Distance({value:8})]}),Wo],onDragEnd:z,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:Jg.map((d)=>t(Me,{teamId:e,status:d,selectedGoalId:r,scope:x,currentUserId:p,currentUserRole:w,onTaskClick:v,onDeleteTask:(n)=>F(n),onCreateTaskInColumn:I},d))})}),_&&t(Je,{open:!!_,onOpenChange:(d)=>!d&&F(null),children:o(Xe,{children:[o(et,{children:[t(rt,{children:x_()}),t(nt,{children:S_({title:_.title})})]}),o(tt,{children:[t(st,{disabled:j,children:ke()}),o(ot,{onClick:()=>G(_.id),disabled:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[j&&t(L,{className:"w-4 h-4 mr-1.5 animate-spin"}),at()]})]})]})})]})}C();function Ge({teamId:e,isOpen:r,onClose:x,initialGoalId:p}){let w=K(),v=p===fa||!p?"none":p,[I,g]=u(""),[_,F]=u(""),[G,j]=u(!1),[P,z]=u(Br.MEDIUM),[d,n]=u(v),[b,N]=u("none"),[l,i]=u("none"),[s,m]=u(void 0),[k,f]=u(void 0),[c,D]=u(null),[M,y]=u(null),[X,q]=u(null),[J,te]=u([]),[se,re]=u([]),[be,he]=u(!1),{data:we}=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});h(()=>{if(r)g(""),F(""),j(!1),z(Br.MEDIUM),n(v),N("none"),i(we?.id||"none"),m(void 0),f(void 0),D(null),y(null),q(null),te([]),re([])},[r,v,we?.id]);let{data:Ne=[]}=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 Q=await a.json();return Array.isArray(Q)?Q:[]},enabled:!!e&&r}),{data:Re=[]}=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:We,isPending:ae}=U({mutationFn:async()=>{let a=await A.api.teams[":teamId"].kanban.tasks.$post({param:{teamId:e},json:{title:I.trim(),description:_.trim()||void 0,isAgentTask:G,priority:P,goalId:d!=="none"?d:void 0,assigneeId:b!=="none"?b: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:M||void 0,parentIds:J.length>0?J:void 0,assetIds:se.length>0?se.map((Q)=>Q.id):void 0}});if(!a.ok){let Q=await a.text().catch(()=>""),Y=Sn();if(Q)try{let le=JSON.parse(Q);if(le&&typeof le.message==="string")Y=le.message}catch{Y=Q}throw Error(Y)}return await a.json()},onSuccess:()=>{w.invalidateQueries({queryKey:["teams",e,"kanban","tasks"]}),w.invalidateQueries({queryKey:["teams",e,"kanban","goals"]}),R.success(WE()),x()},onError:(a)=>{R.error(a.message)}}),Ye=(a)=>{if(a.preventDefault(),!I.trim()||ae)return;We()},oe=G;return t(pe,{open:r,onOpenChange:(a)=>!a&&x(),children:o(ue,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",children:[o("form",{onSubmit:Ye,className:"space-y-4",children:[t(me,{children:t(de,{children:bf()})}),o("div",{className:"space-y-3.5 py-1",children:[o("div",{className:"space-y-1.5",children:[t(V,{htmlFor:"create-task-title",children:Bg()}),t(H,{id:"create-task-title",value:I,onChange:(a)=>g(a.target.value),placeholder:Ug(),required:!0,autoFocus:!0})]}),o("div",{className:"space-y-1.5",children:[t(V,{htmlFor:"create-task-desc",children:Dg()}),t(pa,{id:"create-task-desc",value:_,onChange:(a)=>F(a.target.value),placeholder:Lg(),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(V,{htmlFor:"create-is-agent-task",className:"text-xs font-medium cursor-pointer flex items-center gap-1.5",children:[t(wt,{className:"w-3.5 h-3.5 text-orange-500"}),t("span",{children:Pd()})]}),t("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:Fg()})]}),t(qe,{id:"create-is-agent-task",checked:G,onCheckedChange:(a)=>{j(a),N("none")}})]}),o("div",{className:"space-y-1.5",children:[t(V,{className:"text-xs font-medium text-muted-foreground",children:Zg()}),o(Le,{value:P,onValueChange:(a)=>z(a),children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{})}),t(Ue,{children:Object.values(Br).map((a)=>t(ne,{value:a,children:t("span",{className:E("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",ti(a)),children:ei(a)})},a))})]})]}),o("div",{className:"space-y-1.5",children:[t(V,{className:"text-xs font-medium text-muted-foreground",children:fd()}),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!==fa).map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(bo,{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(V,{className:"text-xs font-medium text-muted-foreground",children:oe?Md():Bm()}),o(Le,{value:b,onValueChange:N,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:cs()})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:cs()})}),oe?Re.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[t(wt,{className:"w-3.5 h-3.5 text-purple-500"}),t("span",{children:a.name})]})},a.id)):Ne.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ee,{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(V,{className:"text-xs font-medium text-muted-foreground",children:pg()}),o(Le,{value:l,onValueChange:i,children:[t(Be,{className:"w-full h-9 text-xs",children:t(Ze,{placeholder:cs()})}),o(Ue,{children:[t(ne,{value:"none",children:t("span",{className:"text-muted-foreground italic",children:cs()})}),Ne.map((a)=>t(ne,{value:a.id,children:o("div",{className:"flex items-center gap-2",children:[o(Ee,{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))]})]})]}),oe&&o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(V,{className:"text-xs font-medium text-muted-foreground",children:Cp()}),o(S,{type:"button",variant:"outline",size:"sm",onClick:()=>he(!0),className:"w-full justify-start h-9 text-xs truncate font-normal",children:[t(or,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),t("span",{className:"truncate",children:X||Ap()})]})]}),o("div",{className:"space-y-1.5",children:[t(V,{className:"text-xs font-medium text-muted-foreground",children:Rd()}),t(ma,{value:s,onChange:m,placeholder:Rd(),className:"h-9 text-xs"})]}),o("div",{className:"space-y-1.5",children:[t(V,{className:"text-xs font-medium text-muted-foreground",children:ad()}),t(ma,{value:k,onChange:f,placeholder:ad(),className:"h-9 text-xs"})]}),o("div",{className:"sm:col-span-2 space-y-1.5",children:[t(V,{className:"text-xs font-medium text-muted-foreground",children:Gh()}),t(Ud,{teamId:e,value:J,onChange:te})]}),t("div",{className:"sm:col-span-2 pt-1",children:t(Fd,{teamId:e,projectId:c,assets:se,onAddAssets:(a)=>re((Q)=>[...Q,...a]),onRemoveAsset:(a)=>re((Q)=>Q.filter((Y)=>Y.id!==a))})})]})]}),o($e,{children:[t(S,{type:"button",variant:"outline",onClick:x,disabled:ae,children:ke()}),o(S,{type:"submit",disabled:!I.trim()||ae,children:[ae&&t(L,{className:"w-4 h-4 mr-1.5 animate-spin"}),kc()]})]})]}),be&&t(zd,{teamId:e,currentProjectId:c,currentTargetFolderId:M,isOpen:be,onClose:()=>he(!1),onSelect:(a,Q,Y)=>{D(a),y(Q),q(Y||"Selected Folder")}})]})})}function je({teamId:e,initialTaskId:r}){let[x,p]=u("team"),[w,v]=u(null),[I,g]=u(r??null),[_,F]=u(!1);h(()=>{if(r)g(r)},[r]);let[G,j]=u(Qe.TODO),{data:P,isLoading:z}=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||[],b=w?n.find((s)=>s.id===w)||null:null,N=P?.role?.toLowerCase()==="owner"||P?.role?.toLowerCase()==="editor",l=(s=Qe.TODO)=>{j(s),F(!0)},i=(s)=>{g(s.id)};if(z)return t("div",{className:"flex h-full items-center justify-center",children:t(L,{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:v,isOwnerOrEditor:N}),o("div",{className:"flex-1 flex flex-col min-w-0 h-full overflow-hidden",children:[t(Se,{scope:x,onScopeChange:p,selectedGoal:b,onClearGoal:()=>v(null),onCreateTask:()=>l(Qe.TODO),canCreateTask:N}),t(Oe,{teamId:e,selectedGoalId:w,scope:x,currentUserId:P?.id,currentUserRole:P?.role,onTaskClick:i,onCreateTaskInColumn:(s)=>l(s)})]}),I&&t(qd,{teamId:e,taskId:I,isOpen:!!I,onClose:()=>g(null),canEdit:N}),_&&t(Ge,{teamId:e,isOpen:_,initialStatus:G,initialGoalId:w,onClose:()=>F(!1)})]})}function lt(){let{teamId:e}=ze.useParams(),{taskId:r}=ze.useSearch();return t(je,{teamId:e,initialTaskId:r})}var ze=Fe("/teams/$teamId/kanban")({component:lt});export{ze as Route};
@@ -1,2 +0,0 @@
1
- import{T}from"./chunk-7rhz2gze.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"}]],ui=T("bell",e);
2
- export{ui};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function on(n){let e={};for(let[t,r]of n.entries())e[t]=r;return e}function Na(n){if(!n)return;let e={};for(let[t,r]of Object.entries(n))if(r!==null)e[t]=r;return Object.keys(e).length>0?e:void 0}
3
- export{on,Na};