@shumai-one/shumai 0.4.3 → 0.4.4

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 (168) hide show
  1. package/bin/chunk-071x515q.js +4 -0
  2. package/bin/chunk-0cmx7k4c.js +1 -0
  3. package/bin/{chunk-cqb415s6.js → chunk-0qaq0sp8.js} +2 -2
  4. package/bin/chunk-0qjfahk9.js +2 -0
  5. package/bin/{chunk-9t1ne8xr.js → chunk-0zv3bks2.js} +2 -2
  6. package/bin/chunk-16xax8kk.js +1 -0
  7. package/bin/chunk-1gvscz88.js +5 -0
  8. package/bin/{chunk-6gg1ymer.js → chunk-1j27fzy1.js} +2 -2
  9. package/bin/chunk-1t167cvj.js +11 -0
  10. package/bin/{chunk-pb1zf0vb.js → chunk-1xh34aew.js} +2 -2
  11. package/bin/{chunk-zmv8cg4s.js → chunk-1zwajpwf.js} +3 -3
  12. package/bin/chunk-2w5xqhjm.js +1 -0
  13. package/bin/{chunk-f3ehv01n.js → chunk-3tedzb2j.js} +26 -26
  14. package/bin/{chunk-zehyn6vd.js → chunk-3ttrhqy3.js} +2 -2
  15. package/bin/chunk-3zkasqb8.js +1 -0
  16. package/bin/chunk-453ykvaw.js +2 -0
  17. package/bin/{chunk-3cyrcgm5.js → chunk-4991gz3y.js} +9 -9
  18. package/bin/chunk-4hkkdm2q.js +2 -0
  19. package/bin/chunk-4mjywsj8.js +3 -0
  20. package/bin/{chunk-cnxwmycy.js → chunk-4v41a1r9.js} +3 -3
  21. package/bin/{chunk-87zxtf66.js → chunk-4wy87hwd.js} +2 -2
  22. package/bin/{chunk-sfx2588q.js → chunk-579e4wv4.js} +2 -2
  23. package/bin/{chunk-1yacmegc.js → chunk-5adsx8x4.js} +2 -2
  24. package/bin/{chunk-b235azv4.js → chunk-5hg6kcfz.js} +13 -13
  25. package/bin/{chunk-rbj4fad9.js → chunk-5nm2jvg5.js} +13 -13
  26. package/bin/chunk-5tcdwep5.js +11 -0
  27. package/bin/chunk-5vzrpz50.js +2 -0
  28. package/bin/chunk-6ghcj4a9.js +3 -0
  29. package/bin/{chunk-b9yrw9et.js → chunk-77fmkpdz.js} +4 -4
  30. package/bin/chunk-7bcxj1jd.js +2 -0
  31. package/bin/{chunk-qf24e71w.js → chunk-7gmdnsdg.js} +1 -1
  32. package/bin/{chunk-fxswt9hc.js → chunk-7jtmwt5a.js} +2 -2
  33. package/bin/chunk-7kjgvxqa.js +2 -0
  34. package/bin/{chunk-bay038pj.js → chunk-7pw1550a.js} +2 -2
  35. package/bin/chunk-7rhz2gze.js +211 -0
  36. package/bin/chunk-837fky18.js +3 -0
  37. package/bin/chunk-84as6x83.js +1 -0
  38. package/bin/chunk-8e28hcny.js +2 -0
  39. package/bin/{chunk-k7hss0bd.js → chunk-914bp49r.js} +3 -3
  40. package/bin/chunk-97f2af6d.js +12 -0
  41. package/bin/{chunk-4r81ghg8.js → chunk-98715kc3.js} +2 -2
  42. package/bin/chunk-9ccw540k.js +2 -0
  43. package/bin/{chunk-ag6p3mbf.js → chunk-9t8n2des.js} +2 -2
  44. package/bin/chunk-9ybt6vbm.js +1 -0
  45. package/bin/{chunk-f15qyp41.js → chunk-a6gx7f5q.js} +1 -1
  46. package/bin/chunk-avwgktxb.js +2 -0
  47. package/bin/chunk-bkr5zm4h.js +2 -0
  48. package/bin/{chunk-2yxj593j.js → chunk-cbgq517y.js} +2 -2
  49. package/bin/chunk-d27mm390.js +1 -0
  50. package/bin/{chunk-185qefn1.js → chunk-dj92fss9.js} +2 -2
  51. package/bin/{chunk-v9w25rp2.js → chunk-dqxeztfa.js} +2 -2
  52. package/bin/chunk-drepsbb4.js +2 -0
  53. package/bin/chunk-f6svp4dp.js +2 -0
  54. package/bin/{chunk-q2bvyv39.js → chunk-fahk9h62.js} +2 -2
  55. package/bin/{chunk-v9b3w8q5.js → chunk-fb40xxz3.js} +2 -2
  56. package/bin/chunk-fnmwksnb.js +3 -0
  57. package/bin/chunk-fpc4p0j8.js +3 -0
  58. package/bin/{chunk-aqbrzx9z.js → chunk-fsyzs0tf.js} +1 -1
  59. package/bin/{chunk-e2mvmq2m.js → chunk-fxecgp5k.js} +1 -1
  60. package/bin/{chunk-wfzqnpc1.js → chunk-g3fpmyyn.js} +2 -2
  61. package/bin/{chunk-ehc9adfz.js → chunk-gc5sbfa5.js} +2 -2
  62. package/bin/chunk-gdm6yfqq.js +2 -0
  63. package/bin/{chunk-ea79xnn3.js → chunk-gk2q9a3f.js} +2 -2
  64. package/bin/{chunk-jje8nj8h.js → chunk-gt4csat6.js} +2 -2
  65. package/bin/chunk-gye8gabk.js +2 -0
  66. package/bin/{chunk-wry2hvrq.js → chunk-hk5rc6cd.js} +2 -2
  67. package/bin/{chunk-zqv0zhfb.js → chunk-hm0dkzed.js} +2 -2
  68. package/bin/chunk-hmpwg5za.js +16 -0
  69. package/bin/{chunk-rpywcvg1.js → chunk-j1tkmcae.js} +2 -2
  70. package/bin/chunk-j2bvj2yn.js +2 -0
  71. package/bin/chunk-jffktpqg.js +1 -0
  72. package/bin/chunk-jgs8an3h.js +18 -0
  73. package/bin/{chunk-8fmy5jtp.js → chunk-jmpb5633.js} +1 -1
  74. package/bin/{chunk-xp59apdb.js → chunk-jrjnqx78.js} +1 -1
  75. package/bin/chunk-k2k9vjq6.js +1 -0
  76. package/bin/{chunk-32pcmaqm.js → chunk-kpgfqkp0.js} +2 -2
  77. package/bin/{chunk-twdxayky.js → chunk-ks8xzc95.js} +2 -2
  78. package/bin/{chunk-qwqvt9v6.js → chunk-kswvyqq1.js} +2 -2
  79. package/bin/{chunk-gk3eqd50.js → chunk-m9pr03kn.js} +2 -2
  80. package/bin/chunk-mfn9qjm4.js +2 -0
  81. package/bin/{chunk-e99dv20z.js → chunk-msfw3jmc.js} +2 -2
  82. package/bin/chunk-mz0yjra0.js +5 -0
  83. package/bin/chunk-nbdw8fen.js +1 -0
  84. package/bin/{chunk-cak32x57.js → chunk-nkdk229f.js} +1 -1
  85. package/bin/chunk-nr20tvnw.js +3 -0
  86. package/bin/{chunk-ck8azecb.js → chunk-pazjhrnf.js} +5 -5
  87. package/bin/chunk-q806pqeh.js +1 -0
  88. package/bin/{chunk-abt0azmv.js → chunk-qka4mkmj.js} +2 -2
  89. package/bin/{chunk-0e4wawpq.js → chunk-qsr1a0rp.js} +1 -1
  90. package/bin/chunk-rchsme43.js +3 -0
  91. package/bin/{chunk-tf28796q.js → chunk-reyxk4bw.js} +1 -1
  92. package/bin/{chunk-av1a8fqp.js → chunk-rhvv1vvk.js} +2 -2
  93. package/bin/{chunk-a32vreya.js → chunk-rq0n0vcc.js} +2 -2
  94. package/bin/chunk-rqf7999q.js +42 -0
  95. package/bin/chunk-rssgmj7x.js +2 -0
  96. package/bin/chunk-ryzz5fht.js +2 -0
  97. package/bin/chunk-s2fnfyn9.js +2 -0
  98. package/bin/{chunk-83e12sjg.js → chunk-s2k4qntr.js} +2 -2
  99. package/bin/{chunk-c007p0t8.js → chunk-snhsjs4x.js} +56 -56
  100. package/bin/{chunk-j8fxp8ej.js → chunk-t2hy6tj9.js} +1 -1
  101. package/bin/chunk-t7nsgg5k.js +4 -0
  102. package/bin/chunk-tm7f32c7.js +14 -0
  103. package/bin/{chunk-2291ehh5.js → chunk-trveq4wg.js} +2 -2
  104. package/bin/chunk-vap4k11j.js +20 -0
  105. package/bin/chunk-vm5fx7td.js +3 -0
  106. package/bin/chunk-vy8gntez.js +1 -0
  107. package/bin/{chunk-awfwk64v.js → chunk-vyzptrea.js} +2 -2
  108. package/bin/{chunk-hfh0c082.js → chunk-w4ghe71n.js} +1 -1
  109. package/bin/chunk-wdsf44hs.js +2 -0
  110. package/bin/chunk-wjyaezs7.js +2 -0
  111. package/bin/{chunk-3a13dcs1.js → chunk-wndm3px3.js} +1 -1
  112. package/bin/chunk-x5jwwvs0.js +1 -0
  113. package/bin/chunk-x92cq59c.js +1 -0
  114. package/bin/{chunk-vgn5zcpv.js → chunk-xa18z1py.js} +2 -2
  115. package/bin/{chunk-4v5n0ayb.js → chunk-xarsrs08.js} +1 -1
  116. package/bin/{chunk-66hsjnw6.js → chunk-xx337zcw.js} +2 -2
  117. package/bin/chunk-xz6713tj.js +2 -0
  118. package/bin/chunk-yfnem6se.js +2 -0
  119. package/bin/{chunk-m7m9d4fb.js → chunk-ytdwk2fq.js} +2 -2
  120. package/bin/{chunk-jy006gcv.js → chunk-ze20rm02.js} +4 -4
  121. package/bin/chunk-zw86wnwe.js +7 -0
  122. package/bin/{chunk-h3tbf521.js → chunk-zxk7q0zk.js} +1 -1
  123. package/bin/shumai-app.html +1 -1
  124. package/bin/shumai-app.js +773 -776
  125. package/package.json +7 -7
  126. package/prisma/migrations/20260907021754_add_asset_upload_id/migration.sql +2 -0
  127. package/prisma/schema.prisma +1 -0
  128. package/bin/chunk-1kw2mbqb.js +0 -1
  129. package/bin/chunk-1wm6ptdx.js +0 -1
  130. package/bin/chunk-2520aq8j.js +0 -2
  131. package/bin/chunk-29zdp63z.js +0 -3
  132. package/bin/chunk-3swpwb9v.js +0 -1
  133. package/bin/chunk-3wmcx2bv.js +0 -2
  134. package/bin/chunk-5a8nt4me.js +0 -1
  135. package/bin/chunk-6bhn1p8v.js +0 -211
  136. package/bin/chunk-70c3xrgd.js +0 -2
  137. package/bin/chunk-7esm0hqb.js +0 -2
  138. package/bin/chunk-7fst8kdw.js +0 -12
  139. package/bin/chunk-8zqgaxvv.js +0 -1
  140. package/bin/chunk-a3dmtt2j.js +0 -1
  141. package/bin/chunk-ce8m4zeg.js +0 -3
  142. package/bin/chunk-e7mqtkzn.js +0 -2
  143. package/bin/chunk-ejbvfj4r.js +0 -1
  144. package/bin/chunk-ekfem7kf.js +0 -1
  145. package/bin/chunk-etwkk0xh.js +0 -1
  146. package/bin/chunk-evrdd32b.js +0 -2
  147. package/bin/chunk-fm6p03ad.js +0 -2
  148. package/bin/chunk-fyha3r13.js +0 -2
  149. package/bin/chunk-g0vs7k2x.js +0 -1
  150. package/bin/chunk-g84z2w7v.js +0 -16
  151. package/bin/chunk-h837fyed.js +0 -2
  152. package/bin/chunk-j20e0qsw.js +0 -7
  153. package/bin/chunk-n1jwdb0a.js +0 -1
  154. package/bin/chunk-p5gf1zdm.js +0 -4
  155. package/bin/chunk-pfgxggaj.js +0 -11
  156. package/bin/chunk-q16490pv.js +0 -2
  157. package/bin/chunk-qh81zhg1.js +0 -1
  158. package/bin/chunk-qwp3kwbz.js +0 -2
  159. package/bin/chunk-qydeqgyj.js +0 -5
  160. package/bin/chunk-r7dty1tg.js +0 -2
  161. package/bin/chunk-rhdxwebf.js +0 -2
  162. package/bin/chunk-rhh716z0.js +0 -42
  163. package/bin/chunk-rza4ae5z.js +0 -3
  164. package/bin/chunk-sk4e6rb1.js +0 -1
  165. package/bin/chunk-t2n1dbgx.js +0 -4
  166. package/bin/chunk-x8f4defx.js +0 -3
  167. package/bin/chunk-z3gkt8w1.js +0 -3
  168. package/bin/chunk-zh6fqq44.js +0 -1
@@ -1,2 +0,0 @@
1
- import{N,h,O,v,u,C,B,t,o,Q,L,U,ct,A,T,Ar,Z,vo,Te,_e,jr,ft,vt,Kt,ve,Oe,E,S,he,Ps,ge,Ae,V,qr,qt,Ns,Os,Ds,GA,Re,Lu,at,mc,hc,dr,zu,O_,K_,fi,mf,fw,fh,ph,ol,Ih,Nf,xo,So,ud,We,Ye,Je,Xe,et,tt,rt,nt,fe,ce,pe,qe,ue,q,se,Rt,Tt,R,uo,fo,Hr,_n,be,Dr,xd}from"./chunk-6bhn1p8v.js";import{as,ss,Zc,Lc,Xo,xi,Bc}from"./chunk-c007p0t8.js";import{Rr,ea,ra}from"./chunk-3wmcx2bv.js";import{Sa}from"./chunk-b9yrw9et.js";var ut=[["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",ut);function qs({file:i,mediaControllerRef:a,onPlay:r,onPause:l,onTimeUpdate:D,annotations:c,startTime:I,shareId:w,allowDownload:y,children:m}){let b=Xo(i),_=b.viewer;return t(_,{ref:a,file:i,onPlay:r,onPause:l,onTimeUpdate:D,annotations:c,startTime:I,shareId:w,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:w=!1,publicFields:y,isPublic:m=!1,shareId:b,currentTime:_,onTyping:te,selectedCommentId:f,heightPercent:j,onHeightPercentChange:G}){let{canEdit:H}=Rt(a),{fields:p,setFields:J}=Rr(),ie=Q(),{ref:re,inView:me}=Tt(),[s,P]=u(null),[K,ne]=u(!1),[Ce,Le]=u(null),Y=v(!1),Ve=v(0),W=v(j),Be=(e)=>{Y.current=!0,Ve.current=e.clientY,W.current=j,e.target.setPointerCapture?.(e.pointerId)},De=N((e)=>{if(!Y.current)return;let k=(Ve.current-e.clientY)/window.innerHeight*100,oe=Math.min(85,Math.max(10,W.current+k));G(oe)},[G]),ke=(e)=>{Y.current=!1;try{e.target.releasePointerCapture?.(e.pointerId)}catch{}},{data:ee}=L({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=Xo(r);h(()=>{if(y)J(y,a);else if(ee)J(ee,a)},[ee,y,a,J]);let{data:xe,fetchNextPage:X,hasNextPage:Ne}=ct({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:Ie}=U({mutationFn:async({text:e,attachmentIds:d,annotations:k,replyToId:oe,guestUserId:we,second:ye})=>{if(m){let le=localStorage.getItem(`share_pwd_${b}`)||"",ze=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:ye??void 0}},{headers:{"x-share-password":le,...we?{"x-guest-user-id":we}:{}}});if(!ze.ok)throw Error("Failed to create comment");return await ze.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:ye??void 0}});if(!le.ok)throw Error("Failed to create comment");return await le.json()}},onSuccess:()=>{ie.invalidateQueries({queryKey:m?["shares",b,"files",r?.id,"comments"]:["files",r?.id,"comments"]})},onError:()=>{R.error(K_?.()||"Failed to post comment")}}),Me=xe?.pages?.[0]?.pageInfo?.total??xe?.pages.reduce((e,d)=>e+(d.data?.length||0),0)??0;h(()=>{if(me&&Ne)X()},[me,X,Ne]);let z=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]),Se=xe?.pages.flatMap((e)=>e.data??[])??[],Ee=(e,d,k=[],oe,we)=>{if(!e.trim()&&d.length===0&&k.length===0)return;let ye=oe||s?.id||null;if(m){let le=localStorage.getItem(`guest_user_id_${b}`);if(!le)Le({text:e,attachmentIds:d,annotations:k,replyToId:ye,second:we}),ne(!0);else Ie({text:e,attachmentIds:d,annotations:k,replyToId:ye,guestUserId:le,second:we})}else Ie({text:e,attachmentIds:d,annotations:k,replyToId:ye,second:we});P(null)},je=(e)=>{if(Ce)Ie({...Ce,guestUserId:e}),Le(null),P(null)},Pe=(e)=>{let d=D.find((k)=>k.id===e);if(d)return d;return{id:"unknown",name:"Unknown",role:"unknown"}},Fe=j<=15;return o("div",{style:{height:`${j}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:Be,onPointerMove:De,onPointerUp:ke,onPointerCancel:ke,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(uo,{defaultValue:"comments",className:"flex-1 flex flex-col min-h-0 px-2 pb-1 overflow-hidden",children:[o(fo,{className:"w-full shrink-0 h-9 bg-muted/60 p-1",children:[o(Hr,{value:"comments",className:"flex-1 text-xs font-semibold py-1",children:[Lu()," ",Me>0&&`(${Me})`]}),t(Hr,{value:"fields",className:"flex-1 text-xs font-semibold py-1",children:fi()})]}),o(_n,{value:"comments",className:E("flex-1 flex flex-col overflow-hidden min-h-0 mt-2",Fe&&"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:[GA?.()||"All comments",Me>0?` (${Me})`:""]})}),t(se,{className:"flex-1 min-h-0 px-2 py-2 [&>div>div]:block!",children:Se.length===0?t("div",{className:"py-8 text-center text-xs text-muted-foreground",children:ph()}):o("div",{className:"space-y-3",children:[Se.map((e)=>o("div",{children:[t(xi,{teamId:i,message:e,getUser:Pe,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(xi,{teamId:i,isReply:!0,message:d,getUser:Pe,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})]})}),(!w||m)&&t("div",{className:"mt-auto shrink-0 bg-background border-t border-border pt-1",children:t(Bc,{isOpen:K,onClose:()=>ne(!1),onSuccess:je,children:t(Sa,{projectId:a,onSendMessage:Ee,replyingTo:s,onCancelReply:()=>P(null),hideAnnotationControl:I,disableMentions:m,currentTime:M?.commentsConfig?.hasTimestamp?_: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(_n,{value:"fields",className:E("flex-1 flex flex-col overflow-hidden min-h-0 mt-2",Fe&&"hidden"),children:t(se,{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(ra,{fieldId:e.id,config:e.config,value:z[e.id]?.value,onSave:H?(d)=>l(e.id,d):void 0,readOnly:w||e.readOnly||!H})})]},e.id))}):t("div",{className:"py-8 text-center text-xs text-muted-foreground",children:"No custom fields defined"})})})]})]})}function ot({fileName:i,folderName:a,version:r,versions:l,activeFileId:D,isPublic:c=!1,shareId:I,allowDownload:w=!0,downloadInfo:y,canEdit:m=!1,onBack:b,onPrevFile:_,onNextFile:te,hasPrevFile:f=!1,hasNextFile:j=!1,onSelectVersion:G,onRename:H,onDelete:p,onLinkedTasks:J,linkedTaskCount:ie=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:K}=await P.json(),ne=document.createElement("a");ne.href=K,ne.download="",document.body.appendChild(ne),ne.click(),document.body.removeChild(ne)}catch{}},me=(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":Nf(),children:t(jr,{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(he,{modal:!1,children:[t(ge,{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(be,{variant:"outline",className:"px-1 py-0 text-[10px] shrink-0 font-normal",children:["v",r]}),t(_e,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),o(Ae,{align:"center",className:"w-48 z-40",children:[t(qr,{className:"text-xs",children:ud()}),l.map((s)=>o(V,{onClick:()=>G?.(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(be,{variant:"outline",className:"px-1 py-0 text-[10px] shrink-0 font-normal",children:["v",r]})]})]}),(f||j)&&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:_,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:Ih(),"aria-label":Ih(),children:t(jr,{className:"h-3.5 w-3.5"})}),t(S,{variant:"ghost",size:"icon",disabled:!j,onClick:te,className:"h-5 w-5 p-0 text-muted-foreground hover:text-foreground disabled:opacity-30 cursor-pointer",title:fh(),"aria-label":fh(),children:t(ft,{className:"h-3.5 w-3.5"})})]})]}),t("div",{className:"flex items-center gap-1",children:o(he,{modal:!1,children:[t(ge,{asChild:!0,children:t(S,{variant:"ghost",size:"icon",className:"h-8 w-8 text-foreground hover:bg-accent cursor-pointer","aria-label":fw(),children:t(Ar,{className:"h-4 w-4"})})}),o(Ae,{align:"end",className:"w-52 z-40",children:[w&&(me?o(Ns,{children:[o(Os,{className:"flex items-center gap-2 text-xs cursor-pointer",children:[t(vt,{className:"h-3.5 w-3.5"}),t("span",{children:dr()})]}),t(Ps,{children:o(Ds,{className:"w-48 z-50",children:[t(qr,{className:"text-xs",children:dr()}),y?.videoTranscodes?.map((s)=>{let P=Math.max(s.width,s.height),K=`${s.height}p`;if(P>=3840)K="2160p";else if(P>=1920)K="1080p";else if(P>=1280)K="720p";else if(P>=960)K="540p";else if(P>=640)K="360p";else if(P>=320)K="180p";return o(V,{onClick:()=>re(s.key),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{children:K}),t("span",{className:"text-[10px] text-muted-foreground",children:"MP4"})]},K)}),y?.originalKey&&o(B,{children:[t(qt,{}),o(V,{onClick:()=>re(y.originalKey),className:"flex items-center justify-between text-xs cursor-pointer",children:[t("span",{children:ol?.()||"Original"}),t("span",{className:"text-[10px] text-muted-foreground",children:i.split(".").pop()?.toUpperCase()||"RAW"})]})]})]})})]}):o(V,{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:dr()})]})),l&&l.length>1&&G&&o(Ns,{children:[t(Os,{className:"flex items-center gap-2 text-xs cursor-pointer",children:t("span",{children:ud?.()||"Switch version"})}),t(Ps,{children:o(Ds,{className:"w-48 z-50",children:[t(qr,{className:"text-xs",children:ud?.()||"Switch version"}),l.map((s)=>o(V,{onClick:()=>G(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(V,{onClick:J,className:"flex items-center justify-between text-xs cursor-pointer",children:[o("span",{className:"flex items-center gap-2",children:[t(vo,{className:"h-3.5 w-3.5"}),t("span",{children:mf?.()||"Linked Tasks"})]}),ie>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:ie})]}),m&&H&&o(V,{onClick:H,className:"flex items-center gap-2 text-xs cursor-pointer",children:[t(Qe,{className:"h-3.5 w-3.5"}),t("span",{children:xo()})]}),m&&p&&o(B,{children:[t(qt,{}),o(V,{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 Al({projectId:i,teamId:a="",fileId:r,file:l,projectInfo:D,ancestorFolders:c=[],versions:I,activeFileId:w,startTime:y,isPublic:m=!1,shareId:b,allowDownload:_=!0,publicFields:te,siblingFiles:f=[],onNavigateToFile:j,onNavigateBack:G,onRenameFile:H,onDeleteFile:p,onSaveField:J,onSelectVersion:ie}){let{canEdit:re}=Rt(i),{members:me}=Dr(),s=v(null),[P,K]=u(50),[ne,Ce]=u([]),[Le,Y]=u(0),[Ve,W]=u(null),[Be,De]=u(!1),[ke,ee]=u(""),M=v(null),[xe,X]=u(!1),[Ne,Ie]=u(!1),[Me,z]=u(!1),[ae,Se]=u(!1),{data:Ee}=L({queryKey:["teams",a,"kanban","assets",w,"tasks"],queryFn:async()=>{if(!a||!w||m)return{data:[],total:0};let x=await A.api.teams[":teamId"].kanban.assets[":assetId"].tasks.$get({param:{teamId:a,assetId:w}});if(!x.ok)return{data:[],total:0};return await x.json()},enabled:!!a&&!!w&&!m}),je=Ee?.total??Ee?.data?.length??0,{prevFile:Pe,nextFile:Fe}=O(()=>{if(!f||f.length===0)return{prevFile:null,nextFile:null};let x=f.findIndex((de)=>de.id===r||de.id===w);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,w]),e=c.length>0?c[0]?.name:D?.name,k=I?.find((x)=>x.id===w)?.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]),we=()=>{Ce([]),W(null)},ye=(x)=>{W(x.id||null);let de=x.annotations;if(de&&de.length>0)Ce(de);else Ce([]);if(x.second!==null&&x.second!==void 0)s.current?.seekTo(x.second),s.current?.pause();else if(de&&de.length>0)s.current?.pause()},le=async(x)=>{if(x?.preventDefault(),!ke.trim()||!H)return;try{Ie(!0),await H(ke.trim()),De(!1)}finally{Ie(!1)}},ze=async()=>{if(!p)return;try{X(!0),await p(),z(!1)}finally{X(!1)}};return h(()=>{Y(0),W(null),Ce([])},[l?.id]),o("div",{className:"flex h-[100dvh] w-full flex-col bg-background overflow-hidden relative",children:[t(ot,{fileName:l.name,folderName:e,version:k,versions:I,activeFileId:w,isPublic:m,shareId:b,allowDownload:_,downloadInfo:oe,canEdit:re,onBack:G,hasPrevFile:!!Pe,hasNextFile:!!Fe,onPrevFile:()=>Pe&&j(Pe.id),onNextFile:()=>Fe&&j(Fe.id),onSelectVersion:ie,onRename:()=>{ee(l.name),De(!0)},onDelete:()=>z(!0),onLinkedTasks:!m?()=>Se(!0):void 0,linkedTaskCount:je}),t("div",{className:"relative flex-1 min-h-0 bg-background overflow-hidden flex flex-col",children:t(qs,{file:l,mediaControllerRef:s,onPlay:we,onTimeUpdate:Y,annotations:ne,startTime:y,shareId:b,allowDownload:_})}),t(Ge,{teamId:a,projectId:i,file:l,onSaveField:J,members:me,onCommentSelect:ye,hideAnnotationControl:l.proxyType==="audio",readOnly:m||!re,publicFields:te,isPublic:m,shareId:b,currentTime:Le,onTyping:()=>s.current?.pause(),selectedCommentId:Ve,heightPercent:P,onHeightPercentChange:K}),!m&&ae&&t(xd,{teamId:a,assetId:w,assetName:l.name,isOpen:ae,onClose:()=>Se(!1)}),!m&&t(fe,{open:Be,onOpenChange:De,children:t(ce,{children:o("form",{onSubmit:le,children:[t(pe,{children:t(ue,{children:xo()})}),t("div",{className:"py-4",children:t(q,{ref:M,value:ke,onChange:(x)=>ee(x.target.value),placeholder:zu?.()||"Enter new name",onFocus:()=>{setTimeout(()=>{if(M.current)ea(M.current)},0)},autoFocus:!0})}),o(qe,{children:[t(S,{type:"button",variant:"outline",onClick:()=>De(!1),children:Re()}),o(S,{type:"submit",disabled:Ne||!ke.trim(),children:[Ne&&t(Z,{className:"mr-2 h-4 w-4 animate-spin"}),So()]})]})]})})}),!m&&t(We,{open:Me,onOpenChange:z,children:o(Ye,{children:[o(Je,{children:[t(et,{children:hc?.()||"Delete Asset?"}),t(tt,{children:mc?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),o(Xe,{children:[t(nt,{children:Re()}),o(rt,{onClick:ze,disabled:xe,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[xe&&t(Z,{className:"mr-2 h-4 w-4 animate-spin"}),at()]})]})]})})]})}C();function st({activeState:i,activeAsset:a,previewUrl:r,isFullScreen:l,onTogglePlay:D,onToggleLoop:c,onSeek:I,onVolumeChange:w,onToggleMute:y,onChangePlaybackRate:m,onChangeResolution:b,onZoomIn:_,onZoomOut:te,onFit:f,onDownload:j,onToggleFullScreen:G,allowDownload:H=!0}){if(i?.kind==="video"&&i.video&&a){let p=i.video,J=p.totalFrames/p.frameRate,ie=p.currentFrame/p.frameRate,re={isPlaying:p.isPlaying,progress:J>0?ie/J*100:0,currentTime:ie,duration:J,volume:p.volume,isMuted:p.isMuted,isLooping:p.isLooping,playbackRate:p.playbackRate,isFullScreen:l,showFrames:!1,currentResolution:p.currentResolution},me=r&&!a.media?.videoPreview?{...a,media:{...a.media,videoPreview:{url:r}}}:a;return t(Zc,{state:re,zoom:i.zoom,isControlsVisible:!0,floatOverlayInFullScreen:!1,buffered:p.buffered,data:me,resolutions:p.resolutions,togglePlay:D,toggleLoop:c,toggleMute:y,handleVolumeChange:w,changePlaybackRate:m,changeResolution:(s)=>b(s.resolution),handleDownload:(s)=>j(s),toggleFullScreen:G,onZoomChange:(s)=>s>=i.zoom?_():te(),onZoomReset:f,frameRate:p.frameRate,totalFrames:p.totalFrames,currentFrame:p.currentFrame,seekToFrame:I,allowDownload:H})}if(i?.kind==="image")return t(Lc,{zoom:i.zoom,onZoomIn:_,onZoomOut:te,onFit:f,onDownload:()=>j(),canDownload:!!a?.media?.original?.key,fullscreen:{isFullScreen:l,onToggle:G},allowDownload:H});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:G,className:"text-foreground transition-colors hover:text-primary",title:"Fullscreen",children:l?t(ss,{className:"h-5 w-5"}):t(as,{className:"h-5 w-5"})})})}function Ke({side:i,fileName:a,version:r,activeVersionId:l,versions:D,isActive:c,onActivate:I,onSwitchVersion:w,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:O_(),className:m,children:t(Oe,{className:"h-4 w-4"})}),_=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(he,{children:[t(ge,{onClick:I,title:ud(),className:m,children:t(_e,{className:"h-4 w-4"})}),t(Ae,{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 j=f.id===l;return o(V,{onClick:()=>w(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(Kt,{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"})]}),j&&t(Te,{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,_,te]}):o(B,{children:[_,te,t("div",{className:"ml-auto"}),b]})})}function it(i,a,r){return L({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 yl({isPublic:i=!1,shareId:a,versions:r,leftId:l,rightId:D,activeSide:c,annotations:I,seekRequest:w,onActiveSideChange:y,onSwitchVersion:m,onExit:b,onActiveAssetChange:_,onPlay:te,onTimeUpdate:f,allowDownload:j=!0}){let G=v(null),H=v(null),p=v(null),[J,ie]=u(null),[re,me]=u(null),[s,P]=u(1),[K,ne]=u(!1),[Ce,Le]=u(!1),{data:Y,isLoading:Ve}=it(l,i,a),{data:W,isLoading:Be}=it(D,i,a),De=Xo(Y),ke=Xo(W),ee=!!Y&&!!W&&De.id===ke.id,M=c==="left"?Y:W,xe=c==="left"?J:re,X=N(()=>c==="left"?H.current:p.current,[c]),Ne=N(()=>c==="left"?p.current:H.current,[c]);h(()=>{_(M??null)},[M,_]),h(()=>{if(!w)return;let n=X();if(n?.seekToSecond(w.second),n?.pause(),ee){let g=Ne();g?.seekToSecond(w.second),g?.pause()}},[w?.nonce]),h(()=>{let n=()=>Le(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);let Ie=N((n)=>ie(n),[]),Me=N((n)=>me(n),[]),z=N((n)=>{let g=X();if(g)n(g);if(ee){let F=Ne();if(F)n(F)}},[X,Ne,ee]),ae=N(()=>{let n=!xe?.video?.isPlaying;z((g)=>n?g.play():g.pause())},[xe?.video?.isPlaying,z]);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 Se=N((n)=>z((g)=>g.seekToFrame(n)),[z]),Ee=N(()=>X()?.toggleLoop(),[X]),je=N((n)=>{P(n),ne(n===0)},[]),Pe=N(()=>ne((n)=>!n),[]),Fe=N((n)=>z((g)=>g.setPlaybackRate(n)),[z]),e=N((n)=>X()?.changeResolution(n),[X]),d=N(()=>z((n)=>n.zoomBy(1.2)),[z]),k=N(()=>z((n)=>n.zoomBy(0.8)),[z]),oe=N(()=>z((n)=>n.fit()),[z]),we=N((n)=>{X()?.download(n)},[X]),ye=N(()=>{let n=G.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]),ze=N((n,g)=>{if(ee)H.current?.panBy(n,g)},[ee]),x=N(()=>ae(),[ae]),de=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=Xo(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"?H:p,file:g,shareId:a,isActive:Ue,annotations:Ue?I:[],onStateChange:n==="left"?Ie:Me,onUserPan:n==="left"?le:ze,onActivate:()=>y(n),muted:Ue?K:!0,volume:s,onPlay:te,onTimeUpdate:f,onRequestTogglePlay:x},g.id)},dt=!!Y&&!!W,mt=Ve||Be;return o("div",{ref:G,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:[Y&&t(Ke,{side:"left",fileName:Y.name,version:de(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:Y?Ze("left",Y):t("div",{className:"flex flex-1 items-center justify-center",children:t(Z,{className:"h-6 w-6 animate-spin text-foreground"})})})]}),o("div",{className:"flex min-w-0 flex-1 flex-col",children:[W&&t(Ke,{side:"right",fileName:W.name,version:de(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:W?Ze("right",W):t("div",{className:"flex flex-1 items-center justify-center",children:t(Z,{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(Z,{className:"h-8 w-8 animate-spin text-foreground"})}),t(st,{activeState:xe,activeAsset:M??null,previewUrl:lt,isFullScreen:Ce,onTogglePlay:ae,onToggleLoop:Ee,onSeek:Se,onVolumeChange:je,onToggleMute:Pe,onChangePlaybackRate:Fe,onChangeResolution:e,onZoomIn:d,onZoomOut:k,onFit:oe,onDownload:we,onToggleFullScreen:ye,allowDownload:j})]})}
2
- export{qs,Al,yl};
@@ -1 +0,0 @@
1
- import{h,C,t,L,U,Ue,A,Xm,st,Cp,Og}from"./chunk-6bhn1p8v.js";import"./chunk-3wmcx2bv.js";import"./chunk-j20e0qsw.js";import"./chunk-ehc9adfz.js";import"./chunk-b9yrw9et.js";import"./chunk-6gg1ymer.js";import"./chunk-bay038pj.js";import"./chunk-7esm0hqb.js";import"./chunk-q16490pv.js";import"./chunk-k7hss0bd.js";import"./chunk-c007p0t8.js";import"./chunk-cqb415s6.js";import{Zn}from"./chunk-185qefn1.js";import{Wt}from"./chunk-rhdxwebf.js";import"./chunk-4r81ghg8.js";import"./chunk-gk3eqd50.js";import"./chunk-ag6p3mbf.js";import"./chunk-9t1ne8xr.js";import"./chunk-m7m9d4fb.js";import"./chunk-1yacmegc.js";import"./chunk-r7dty1tg.js";import"./chunk-2yxj593j.js";import"./chunk-ea79xnn3.js";C();function u(){let{projectId:o,collectionId:r}=y.useParams(),{teamId:s,ensureTeamIdForProject:i}=st();h(()=>{i(o)},[o,i]);let{data:l}=Wt(Cp(o)),{data:a,refetch:d}=L({...Og(r)}),{mutate:p}=U({mutationFn:async(n)=>{let c=await A.api.collections[":collectionId"].$patch({param:{collectionId:r},json:n});if(!c.ok)throw Error("Failed to update collection");return await c.json()},onSuccess:()=>{d()}}),e=l?.rootFolder,{data:f}=L({queryKey:["folders",e],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:e}});if(!n.ok)throw Error("Failed to fetch folder");return await n.json()},enabled:!!e});if(!s||!e||!f||!a)return t("div",{children:Xm()});let m=a.filter.sourceFolderId||e;return t(Zn,{teamId:s,projectId:o,projectName:l.name??"",assetId:m,rootFolderId:e,collection:a,onUpdateCollection:p})}var y=Ue("/projects/$projectId/collections/$collectionId")({component:u});export{y as Route};
@@ -1 +0,0 @@
1
- import{t,Ue}from"./chunk-6bhn1p8v.js";import"./chunk-j20e0qsw.js";import"./chunk-3wmcx2bv.js";import"./chunk-ehc9adfz.js";import"./chunk-7esm0hqb.js";import"./chunk-q16490pv.js";import"./chunk-c007p0t8.js";import"./chunk-b9yrw9et.js";import"./chunk-k7hss0bd.js";import"./chunk-e7mqtkzn.js";import"./chunk-cqb415s6.js";import{ts}from"./chunk-awfwk64v.js";import"./chunk-4r81ghg8.js";import"./chunk-gk3eqd50.js";import"./chunk-ag6p3mbf.js";import"./chunk-9t1ne8xr.js";import"./chunk-m7m9d4fb.js";import"./chunk-r7dty1tg.js";import"./chunk-2yxj593j.js";import"./chunk-ea79xnn3.js";function a(){let{shareId:e}=s.useParams();return t(ts,{shareId:e})}var s=Ue("/share/$shareId/")({component:a});export{s as Route};
@@ -1 +0,0 @@
1
- import{h,C,t,L,Ue,A,st,yt,bp}from"./chunk-6bhn1p8v.js";import"./chunk-b9yrw9et.js";import"./chunk-6gg1ymer.js";import"./chunk-cqb415s6.js";import{_i}from"./chunk-rhh716z0.js";import"./chunk-zehyn6vd.js";import"./chunk-70c3xrgd.js";import"./chunk-pb1zf0vb.js";import{Wt}from"./chunk-rhdxwebf.js";import"./chunk-4r81ghg8.js";import"./chunk-gk3eqd50.js";import"./chunk-1yacmegc.js";import"./chunk-ea79xnn3.js";C();function l(){let{projectId:e}=p.useParams(),{teamId:r,ensureTeamIdForProject:i}=st();h(()=>{i(e)},[e,i]);let{data:a}=Wt(bp(e)),o=a?.rootFolder,{data:d}=L({queryKey:["folders",o],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:o}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!o});if(!r||!o||!d)return t(yt,{});return t(_i,{teamId:r,projectId:e,projectName:a.name??"",assetId:o,rootFolderId:o,isRoot:!0})}var p=Ue("/projects/$projectId/agentsmd")({component:l});export{p as Route};
@@ -1,2 +0,0 @@
1
- import{T}from"./chunk-6bhn1p8v.js";var e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],bl=T("shield",e);
2
- export{bl};
@@ -1,2 +0,0 @@
1
- import{T}from"./chunk-6bhn1p8v.js";var o=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],gl=T("arrow-up-narrow-wide",o);
2
- export{gl};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-7fst8kdw.js";import{Rd,LI}from"./chunk-cnxwmycy.js";export{Rd as createKyselyAdapter,LI as kyselyAdapter};
@@ -1 +0,0 @@
1
- import{D,N,h,O,v,u,Fn,C,B,t,o,Q,pu,mu,cr,nc,Is,io,zt,Do,hu,gu,Au,yu,oc,_u,L,U,ct,Ue,A,T,gr,Z,bt,_e,ur,Lt,Oe,E,ut,me,K,Et,yr,Ot,oe,er,S,Ce,Ee,Ie,Lg,Bg,BA,jA,qA,$d,hy,ym,Re,Zs,xm,x0,pc,Im,ya,Ko,Um,zm,Ab,yb,Jm,ev,ew,tw,Nw,Cf,Ef,Qw,ax,bh,yc,Jx,Uh,yS,bS,Df,wS,CS,Fh,IS,TS,jh,MS,kS,od,ad,sd,al,Ff,US,zS,FS,jS,id,ba,aC,yC,vC,ZC,jC,HC,GC,$C,QC,ig,VC,fd,kE,DE,VE,bg,rn,lp,AI,yI,xc,We,Ye,Je,Xe,et,tt,rt,nt,q,Tt,R,yn,hp,be,ht,gt,At,dl,Mr,Cd,St,kt,Pt,Ft,Mt}from"./chunk-6bhn1p8v.js";import{go,lr}from"./chunk-ehc9adfz.js";import{Tl}from"./chunk-k7hss0bd.js";import{xa,Io,vl,$s,vi,rs,wl}from"./chunk-v9w25rp2.js";import{bn,vn,wn,hr,_t,pt}from"./chunk-66hsjnw6.js";import"./chunk-1yacmegc.js";import"./chunk-r7dty1tg.js";import{Ln,Xn}from"./chunk-2yxj593j.js";C();function te(a,e){let s=new Set(e);return a.filter((i)=>!s.has(i))}var ae=class extends io{#r;#e;#o;#a;#t;#s;#i;#n;#l;#d=[];constructor(a,e,s){super();this.#r=a,this.#a=s,this.#o=[],this.#t=[],this.#e=[],this.setQueries(e)}onSubscribe(){if(this.listeners.size===1)this.#t.forEach((a)=>{a.subscribe((e)=>{this.#p(a,e)})})}onUnsubscribe(){if(!this.listeners.size)this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach((a)=>{a.destroy()})}setQueries(a,e){this.#o=a,this.#a=e,zt.batch(()=>{let s=this.#t,i=this.#u(this.#o);i.forEach((c)=>c.observer.setOptions(c.defaultedQueryOptions));let m=i.map((c)=>c.observer),r=m.map((c)=>c.getCurrentResult()),p=s.length!==m.length,f=m.some((c,x)=>c!==s[x]),g=p||f,y=g?!0:r.some((c,x)=>{let w=this.#e[x];return!w||!Is(c,w)});if(!g&&!y)return;if(g)this.#d=i,this.#t=m;if(this.#e=r,!this.hasListeners())return;if(g)te(s,m).forEach((c)=>{c.destroy()}),te(m,s).forEach((c)=>{c.subscribe((x)=>{this.#p(c,x)})});this.#f()})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map((a)=>a.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(a,e){let s=this.#u(a),i=s.map((r)=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),m=s.map((r)=>r.defaultedQueryOptions.queryHash);return[i,(r)=>this.#c(r??i,e,m),()=>this.#m(i,s)]}#m(a,e){let s=new Set;return e.map((i,m)=>{let r=a[m];return!i.defaultedQueryOptions.notifyOnChangeProps?i.observer.trackResult(r,(p)=>{if(!s.has(p))s.add(p),e.forEach((f)=>{f.observer.trackProp(p)})}):r})}#c(a,e,s){if(e){let i=this.#l,m=s!==void 0&&i!==void 0&&(i.length!==s.length||s.some((r,p)=>r!==i[p]));if(this.#e!==this.#n||m||e!==this.#i){if(this.#i=e,this.#n=this.#e,s!==void 0)this.#l=s;this.#s=nc(this.#s,e(a))}return this.#s}return a}#g(){return!this.#a?.combine||this.#t.some((a,e)=>a.options.suspense&&this.#e[e]?.data===void 0)}#u(a){let e=new Map;this.#t.forEach((i)=>{let m=i.options.queryHash;if(!m)return;let r=e.get(m);if(r)r.push(i);else e.set(m,[i])});let s=[];return a.forEach((i)=>{let m=this.#r.defaultQueryOptions(i),r=e.get(m.queryHash)?.shift()??new Do(this.#r,m);s.push({defaultedQueryOptions:m,observer:r})}),s}#p(a,e){let s=this.#t.indexOf(a);if(s!==-1)this.#e=this.#e.slice(),this.#e[s]=e,this.#f()}#f(){if(this.hasListeners()){let a=this.#g(),e=this.#s,s=a?e:this.#c(this.#m(this.#e,this.#d),this.#a?.combine);if(a||e!==s)zt.batch(()=>{this.listeners.forEach((i)=>{i(this.#e)})})}}};C();function se({queries:a,...e},s){let i=Q(s),m=pu(),r=mu(),p=e.subscribed!==!1,f=O(()=>a.map((d)=>{let b=i.defaultQueryOptions(d);return b._optimisticResults=m?"isRestoring":p?"optimistic":void 0,b}),[a,i,m,p]);f.forEach((d)=>{yu(d);let b=i.getQueryCache().get(d.queryHash);hu(d,r,b)}),gu(r);let[g]=u(()=>new ae(i,f,e)),[y,c,x]=g.getOptimisticResult(f,e.combine),w=!m&&p;Fn(N((d)=>w?g.subscribe(zt.batchCalls(d)):cr,[g,w]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),h(()=>{g.setQueries(f,e)},[f,e,g]);let n=y.some((d,b)=>oc(f[b],d))?y.flatMap((d,b)=>{let k=f[b];if(k&&oc(k,d)){let M=new Do(i,k);return _u(k,M,r)}return[]}):[];if(n.length>0)throw Promise.all(n);let _=y.find((d,b)=>{let k=f[b];return k&&Au({result:d,errorResetBoundary:r,throwOnError:k.throwOnError,query:i.getQueryCache().get(k.queryHash),suspense:k.suspense})});if(_)throw _.error;return c(x())}C();C();var ve=Object.defineProperty,F=(a,e)=>ve(a,"name",{value:e,configurable:!0}),X="Collapsible",[Ne,Qt]=ut(X),[ye,J]=Ne(X),we=D(F(function(e,s){let{__scopeCollapsible:i,open:m,defaultOpen:r,disabled:p,onOpenChange:f,...g}=e,[y,c]=Ot({prop:m,defaultProp:r??!1,onChange:f,caller:X});return t(ye,{scope:i,disabled:p,contentId:yr(),open:y,onOpenToggle:N(()=>c((x)=>!x),[c]),children:t(oe.div,{"data-state":G(y),"data-disabled":p?"":void 0,...g,ref:s})})},"Collapsible")),Te="CollapsibleTrigger",ke=D(F(function(e,s){let{__scopeCollapsible:i,...m}=e,r=J(Te,i);return t(oe.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":G(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...m,ref:s,onClick:K(e.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),re="CollapsibleContent",Ae=D(F(function(e,s){let{forceMount:i,...m}=e,r=J(re,e.__scopeCollapsible);return t(er,{present:i||r.open,children:({present:p})=>t(qe,{...m,ref:s,present:p})})},"CollapsibleContent")),qe=D(F(function(e,s){let{__scopeCollapsible:i,present:m,children:r,...p}=e,f=J(re,i),[g,y]=u(m),c=v(null),x=me(s,c),w=v(0),n=w.current,_=v(0),d=_.current,b=f.open||g,k=v(b),M=v(void 0);return h(()=>{let P=requestAnimationFrame(()=>k.current=!1);return()=>cancelAnimationFrame(P)},[]),Et(()=>{let P=c.current;if(P){M.current=M.current||{transitionDuration:P.style.transitionDuration,animationName:P.style.animationName},P.style.transitionDuration="0s",P.style.animationName="none";let z=P.getBoundingClientRect();if(w.current=z.height,_.current=z.width,!k.current)P.style.transitionDuration=M.current.transitionDuration,P.style.animationName=M.current.animationName;y(m)}},[f.open,m]),t(oe.div,{"data-state":G(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!b,...p,ref:x,style:{["--radix-collapsible-content-height"]:n?`${n}px`:void 0,["--radix-collapsible-content-width"]:d?`${d}px`:void 0,...e.style},children:b&&r})},"CollapsibleContentImpl"));function G(a){return a?"open":"closed"}F(G,"getState");var De=we;var Se=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],ie=T("chart-no-axes-column",Se);var He=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Y=T("funnel",He);var Qe=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],j=T("messages-square",Qe);function ne({teamId:a}){let[e,s]=u("team"),[i,m]=u("1h"),{data:r,isLoading:p}=L({queryKey:["teams",a,"ai-usage",i,"team"],queryFn:async()=>{let d=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i}});if(!d.ok)throw Error("Failed to fetch team AI usage");return await d.json()},enabled:!!a&&e==="team"}),{data:f,isLoading:g}=L({queryKey:["teams",a,"members"],queryFn:async()=>{let d=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!d.ok)throw Error("Failed to fetch team members");return await d.json()},enabled:!!a&&e==="members"}),y=se({queries:(f||[]).map((d)=>({queryKey:["teams",a,"ai-usage",i,d.id],queryFn:async()=>{let b=await A.api.teams[":teamId"]["ai-usage"].$get({param:{teamId:a},query:{timeframe:i,userId:d.id}});if(!b.ok)throw Error(`Failed to fetch AI usage for member ${d.id}`);return await b.json()},enabled:!!a&&e==="members"}))}),c=g||y.some((d)=>d.isLoading),x=(d)=>{if(!d)return"U";let b=d.split(" ");if(b.length>1)return`${b[0][0]}${b[b.length-1][0]}`.toUpperCase();return d.substring(0,2).toUpperCase()},w=(d)=>{if(!d)return"";switch(d.toLowerCase()){case"owner":return yc();case"editor":return ya();case"reviewer":return ba();default:return d}},n=(d)=>(d??0).toLocaleString(),_=(d)=>`$${(d??0).toFixed(6)}`;return o(St,{className:"border-border/60 shadow-sm",children:[o(kt,{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between pb-6",children:[o("div",{children:[t(Pt,{className:"text-xl font-semibold tracking-tight",children:jA()}),t(Ft,{className:"text-sm text-muted-foreground mt-1",children:qA()})]}),o("div",{className:"flex flex-wrap items-center gap-3",children:[o(go,{type:"single",value:e,onValueChange:(d)=>{if(d)s(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(lr,{value:"team",className:"px-3 py-1.5 text-xs font-medium",children:DE()}),t(lr,{value:"members",className:"px-3 py-1.5 text-xs font-medium",children:tw()})]}),o(go,{type:"single",value:i,onValueChange:(d)=>{if(d)m(d)},className:"border rounded-lg p-1 bg-muted/30",children:[t(lr,{value:"1h",className:"px-2.5 py-1.5 text-xs font-medium",children:"1h"}),t(lr,{value:"24h",className:"px-2.5 py-1.5 text-xs font-medium",children:"24h"}),t(lr,{value:"7d",className:"px-2.5 py-1.5 text-xs font-medium",children:"7d"}),t(lr,{value:"30d",className:"px-2.5 py-1.5 text-xs font-medium",children:"30d"})]})]})]}),t(Mt,{children:e==="team"?p?t("div",{className:"flex h-48 items-center justify-center",children:t(Z,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(bn,{children:[t(vn,{children:o(hr,{children:[t(_t,{children:fd()}),t(_t,{className:"text-right",children:Jm()}),t(_t,{className:"text-right",children:bh()}),t(_t,{className:"text-right",children:ym()}),t(_t,{className:"text-right",children:bg()}),t(_t,{className:"text-right",children:xm()})]})}),t(wn,{children:o(hr,{children:[t(pt,{className:"font-medium",children:fd()}),t(pt,{className:"text-right",children:n(r?.team?.inputTokens)}),t(pt,{className:"text-right",children:n(r?.team?.outputTokens)}),t(pt,{className:"text-right",children:n(r?.team?.cacheReadTokens)}),t(pt,{className:"text-right font-medium",children:n(r?.team?.totalTokens)}),t(pt,{className:"text-right font-medium",children:_(r?.team?.cost)})]})})]})}):c?t("div",{className:"flex h-48 items-center justify-center",children:t(Z,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t("div",{className:"rounded-md border",children:o(bn,{children:[t(vn,{children:o(hr,{children:[t(_t,{children:ew()}),t(_t,{children:aC()}),t(_t,{className:"text-right",children:Jm()}),t(_t,{className:"text-right",children:bh()}),t(_t,{className:"text-right",children:ym()}),t(_t,{className:"text-right",children:bg()}),t(_t,{className:"text-right",children:xm()})]})}),t(wn,{children:(f||[]).map((d,b)=>{let k=y[b]?.data?.member;return o(hr,{children:[t(pt,{children:o("div",{className:"flex items-center gap-3",children:[o(Ce,{className:"h-8 w-8 rounded-full",children:[d.image&&t(Ee,{src:d.image,alt:d.name,className:"object-cover"}),t(Ie,{className:"bg-primary/20 text-xs",children:x(d.name)})]}),o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-medium leading-none",children:d.name}),t("span",{className:"text-xs text-muted-foreground mt-0.5",children:d.email})]})]})}),t(pt,{className:"text-xs text-muted-foreground",children:w(d.role)}),t(pt,{className:"text-right",children:n(k?.inputTokens)}),t(pt,{className:"text-right",children:n(k?.outputTokens)}),t(pt,{className:"text-right",children:n(k?.cacheReadTokens)}),t(pt,{className:"text-right font-medium",children:n(k?.totalTokens)}),t(pt,{className:"text-right font-medium",children:_(k?.cost)})]},d.id)})})]})})})]})}C();function le({teamId:a}){let[e,s]=u(null),{ref:i,inView:m}=Tt(),{data:r,isLoading:p,isError:f,fetchNextPage:g,hasNextPage:y,isFetchingNextPage:c}=ct({queryKey:["teams",a,"agent-sessions"],queryFn:async({pageParam:n})=>{let _=await A.api.teams[":teamId"]["agent-sessions"].$get({param:{teamId:a},query:{first:"20",after:n?String(n):void 0}});if(!_.ok)throw Error("Failed to fetch agent sessions");return await _.json()},initialPageParam:"",getNextPageParam:(n)=>n.pageInfo.cursor||void 0,enabled:!!a});h(()=>{if(m&&y&&!c)g()},[m,y,c,g]);let x=r?.pages.flatMap((n)=>n.data).filter((n)=>n.id!=="pending")||[],w=(n)=>{switch(n){case"comment":return t(be,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",children:$C()});case"chat":return t(be,{variant:"outline",className:"bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20",children:GC()});case"naming":return t(be,{variant:"outline",className:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",children:QC()});default:return t(be,{variant:"outline",className:"bg-muted text-muted-foreground border-border",children:n})}};return o("div",{className:"space-y-6",children:[o(St,{className:"border border-border/50 shadow-xs",children:[t(kt,{className:"pb-4",children:t("div",{className:"flex items-center justify-between",children:o("div",{children:[o(Pt,{className:"text-xl font-bold flex items-center gap-2",children:[t(j,{className:"w-5 h-5 text-violet-500"}),ig()]}),t(Ft,{className:"mt-1 text-sm text-muted-foreground",children:VC()})]})})}),t(Mt,{children:p?t("div",{className:"flex h-64 items-center justify-center",children:t(Z,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):f?t("div",{className:"flex h-64 items-center justify-center text-destructive",children:"Failed to load agent sessions."}):x.length===0?o("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:[t(j,{className:"w-10 h-10 text-muted-foreground/40 mb-3"}),t("p",{className:"text-base font-medium",children:Qw()})]}):o("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o(bn,{children:[t(vn,{className:"bg-muted/40",children:o(hr,{children:[t(_t,{children:jC()}),t(_t,{children:pc()}),t(_t,{children:HC()}),t(_t,{className:"text-right",children:x0()})]})}),t(wn,{children:x.map((n)=>o(hr,{onClick:()=>s(n.id),className:"cursor-pointer hover:bg-muted/50 transition-colors",children:[t(pt,{className:"font-medium",children:o("div",{className:"flex flex-col",children:[t("span",{className:"text-sm font-semibold text-foreground",children:n.name||lp()}),t("span",{className:"text-xs font-mono text-muted-foreground/70",children:n.id})]})}),t(pt,{children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ee,{src:n.creator?.image||void 0}),t(Ie,{className:"text-[10px]",children:n.creator?.name?.[0]?.toUpperCase()||"?"})]}),t("span",{className:"text-sm text-foreground/90",children:n.creator?.name||"System / Agent"})]})}),t(pt,{children:w(n.type)}),t(pt,{className:"text-right text-xs text-muted-foreground",children:yn(n.createdAt)})]},n.id))})]}),t("div",{ref:i,className:"py-4 flex justify-center",children:c&&t(Z,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})})]}),t(Tl,{sessionId:e,open:!!e,onOpenChange:(n)=>{if(!n)s(null)}})]})}C();function de({...a}){return t(De,{"data-slot":"collapsible",...a})}function ce({...a}){return t(ke,{"data-slot":"collapsible-trigger",...a})}function ue({...a}){return t(Ae,{"data-slot":"collapsible-content",...a})}function ee(a){switch(a.toLowerCase()){case"owner":return yc();case"editor":return ya();case"reviewer":return ba();default:return a}}function Le(a,e){if(typeof a==="object"&&a!==null&&"message"in a){let s=a.message;if(typeof s==="string")return s}return e}function Be({rule:a}){let e=a.resourceData??{};if(a.resource==="agent_mcp_call_count")return t("span",{children:zS({value:String(e.id??"")})});if(a.resource==="agent_bash_call_count")return t("span",{children:US({value:String(e.match??"*")})});if(a.resource==="agent_tool_call_count")return t("span",{children:FS({value:String(e.name??e.toolName??"*")})});return null}function Me({rule:a}){if(a.scopeMode==="all_members")return o(be,{variant:"secondary",className:"gap-1 text-xs",children:[t(Xn,{className:"h-3 w-3"}),o("span",{children:[od(),a.role?` (${ee(a.role)})`:` (${al()})`]})]});if(a.scopeMode==="each_member")return o(be,{variant:"secondary",className:"gap-1 text-xs",children:[t(Ln,{className:"h-3 w-3"}),o("span",{children:[ad(),a.role?` (${ee(a.role)})`:` (${al()})`]})]});return o(be,{variant:"secondary",className:"gap-1 text-xs",children:[t($s,{className:"h-3 w-3"}),o("span",{children:[sd()," (",a.userIds?.length||0,")"]})]})}function Fe({teamId:a,rule:e,record:s}){let i=Q(),[m,r]=u(!1),[p,f]=u(()=>new Date),g=vi[e.resource],y=e.scopeMode==="all_members",c=s.percent>=100,x=y?e.role?`${kS()}: ${ee(e.role)}`:jS():s.user?.name||s.userId||rn();h(()=>{if(!s.isWindowActive||!s.periodEnd)return;let n=window.setInterval(()=>f(new Date),60000);return()=>window.clearInterval(n)},[s.isWindowActive,s.periodEnd]);let w=U({mutationFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.reset.$post({param:{teamId:a,id:e.id},json:{userId:s.userId??null}});if(!n.ok){let _=await n.json().catch(()=>null);throw Error(Le(_,zm()))}return await n.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["teams",a,"quotas",e.id,"records"]}),i.invalidateQueries({queryKey:["teams",a,"quotas"]}),r(!1),R.success(TS())},onError:(n)=>{let _=n instanceof Error?n.message:zm();r(!1),R.error(_)}});return o(B,{children:[o("div",{className:"space-y-3 rounded-xl border border-border/70 bg-card p-4 text-card-foreground shadow-2xs",children:[o("div",{className:"flex items-center justify-between gap-3",children:[o("div",{className:"flex min-w-0 items-center gap-3",children:[y?t("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:t(Xn,{className:"h-5 w-5"})}):o(Ce,{className:"h-9 w-9 shrink-0 border border-border/50",children:[t(Ee,{src:s.user?.image||void 0}),t(Ie,{className:"text-xs font-semibold",children:s.user?.name?.[0]?.toUpperCase()||"U"})]}),o("div",{className:"min-w-0",children:[t("div",{className:"truncate text-sm font-semibold text-foreground",children:x}),!y&&s.user?.email&&t("div",{className:"truncate text-xs text-muted-foreground",children:s.user.email})]})]}),o("div",{className:"flex shrink-0 items-center gap-2",children:[s.isWindowActive&&s.periodEnd?o(be,{variant:"outline",className:"hidden gap-1 border-primary/30 bg-primary/5 text-xs text-primary sm:flex",children:[t(ur,{className:"h-3 w-3"}),t("span",{children:Fh({time:hp(s.periodEnd,p)})})]}):o(be,{variant:"secondary",className:"hidden gap-1 text-xs text-muted-foreground sm:flex",children:[t(gr,{className:"h-3 w-3 text-primary"}),t("span",{children:Uh()})]}),o(S,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>r(!0),disabled:w.isPending,children:[w.isPending?t(Z,{className:"h-3.5 w-3.5 animate-spin"}):t(xa,{className:"h-3.5 w-3.5"}),jh()]})]})]}),o("div",{className:"space-y-1.5 pt-1",children:[t(Cd,{value:Math.min(100,Math.max(0,s.percent)),className:"h-2"}),o("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[o("span",{className:c?"font-bold text-destructive":"text-foreground",children:[rs(e.resource,s.consumed)," /"," ",rs(e.resource,e.limit)," ",g?.unit]}),o("span",{className:c?"font-bold text-destructive":"text-muted-foreground",children:[s.percent,"%"]})]})]}),o("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground sm:hidden",children:[s.isWindowActive&&s.periodEnd?o("span",{className:"flex items-center gap-1 text-primary",children:[t(ur,{className:"h-3 w-3"}),Fh({time:hp(s.periodEnd,p)})]}):o("span",{className:"flex items-center gap-1",children:[t(gr,{className:"h-3 w-3 text-primary"}),Uh()]}),o("span",{children:[IS(),": ",rs(e.resource,s.remaining)," ",g?.unit]})]})]}),t(We,{open:m,onOpenChange:r,children:o(Ye,{children:[o(Je,{children:[t(et,{children:jh()}),t(tt,{children:MS({target:x})})]}),o(Xe,{children:[t(nt,{disabled:w.isPending,children:Re()}),o(rt,{onClick:(n)=>{n.preventDefault(),w.mutate()},disabled:w.isPending,children:[w.isPending&&t(Z,{className:"mr-2 h-4 w-4 animate-spin"}),Zs()]})]})]})})]})}function je({teamId:a,rule:e}){let[s,i]=u(!1),[m,r]=u(""),p=vi[e.resource],f=p?.icon||Io,{data:g,isLoading:y,isError:c}=L({queryKey:["teams",a,"quotas",e.id,"records"],queryFn:async()=>{let n=await A.api.teams[":teamId"].quotas[":id"].records.$get({param:{teamId:a,id:e.id}});if(!n.ok)throw Error(Um());return await n.json()},enabled:s,refetchInterval:s?1e4:!1}),x=g?.records??[],w=x.filter((n)=>{if(!m.trim())return!0;let _=m.toLowerCase();return n.user?.name.toLowerCase().includes(_)||n.user?.email.toLowerCase().includes(_)});return o(de,{open:s,onOpenChange:i,className:"rounded-xl border border-border/70",children:[t(ce,{asChild:!0,children:o("button",{type:"button","aria-label":s?yS():wS(),className:"flex w-full items-center justify-between gap-4 p-4 text-left transition-colors hover:bg-muted/40",children:[o("div",{className:"flex min-w-0 items-start gap-3",children:[t("div",{className:"mt-0.5 rounded-lg bg-primary/10 p-2 text-primary",children:t(f,{className:"h-5 w-5"})}),o("div",{className:"min-w-0",children:[o("div",{className:"flex flex-wrap items-center gap-2",children:[t("span",{className:"font-semibold text-foreground",children:p?.label()||e.resource}),!e.enabled&&t(be,{variant:"secondary",children:Df()})]}),o("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t(Me,{rule:e}),o(be,{variant:"outline",className:"gap-1 text-xs",children:[t(ur,{className:"h-3 w-3"}),rs(e.resource,e.limit)," ",p?.unit," /"," ",wl(e.period)]}),t(Be,{rule:e})]})]})]}),t(_e,{className:`h-5 w-5 shrink-0 text-muted-foreground transition-transform ${s?"rotate-180":""}`})]})}),t(ue,{children:o("div",{className:"space-y-3 border-t border-border/60 bg-muted/10 p-4",children:[e.scopeMode!=="all_members"&&x.length>3&&o("div",{className:"relative",children:[t(Lt,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),t(q,{value:m,onChange:(n)=>r(n.target.value),placeholder:Ff(),className:"h-9 pl-9 text-sm"})]}),y?t("div",{className:"flex justify-center py-10",children:t(Z,{className:"h-7 w-7 animate-spin text-primary"})}):c?t("div",{className:"py-8 text-center text-sm text-destructive",children:Um()}):w.length===0?t("div",{className:"py-8 text-center text-sm text-muted-foreground",children:CS()}):w.map((n,_)=>t(Fe,{teamId:a,rule:e,record:n},n.id||n.userId||`record-${_}`))]})})]})}function pe({teamId:a}){let{data:e,isLoading:s,isError:i}=L({queryKey:["teams",a,"quotas"],queryFn:async()=>{let r=await A.api.teams[":teamId"].quotas.$get({param:{teamId:a}});if(!r.ok)throw Error(Ko());return await r.json()},enabled:!!a}),m=e?.rules??[];return o(St,{className:"border-border/60 shadow-sm",children:[o(kt,{children:[o(Pt,{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[t(Io,{className:"h-5 w-5 text-primary"}),id()]}),t(Ft,{children:bS()})]}),t(Mt,{children:s?t("div",{className:"flex h-48 items-center justify-center",children:t(Z,{className:"h-7 w-7 animate-spin text-muted-foreground"})}):i?t("div",{className:"py-10 text-center text-sm text-destructive",children:Ko()}):m.length===0?o("div",{className:"flex flex-col items-center justify-center rounded-xl border-2 border-dashed border-border py-12 text-center",children:[t(Io,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),t("p",{className:"text-base font-medium text-foreground",children:Ef()}),t("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:Cf()})]}):t("div",{className:"space-y-3",children:m.map((r)=>t(je,{teamId:a,rule:r},r.id))})})]})}C();var $e=Object.values(dl);function fe({teamId:a}){let[e,s]=u([]),[i,m]=u([]),[r,p]=u(""),{ref:f,inView:g}=Tt(),{data:y}=L({queryKey:["teams",a,"members"],queryFn:async()=>{let l=await A.api.teams[":teamId"].members.$get({param:{teamId:a},query:{}});if(!l.ok)return[];return await l.json()},enabled:!!a}),c=y||[],{data:x,isLoading:w,isError:n,fetchNextPage:_,hasNextPage:d,isFetchingNextPage:b}=ct({queryKey:["teams",a,"audit-logs",e,i,r],queryFn:async({pageParam:l})=>{let I=await A.api.teams[":teamId"]["audit-logs"].$get({param:{teamId:a},query:{first:"20",after:l?String(l):void 0,actions:e.length>0?e:void 0,userIds:i.length>0?i:void 0,itemId:r.trim()||void 0}});if(!I.ok)throw Error("Failed to fetch audit logs");return await I.json()},initialPageParam:"",getNextPageParam:(l)=>l.pageInfo.endCursor||void 0,enabled:!!a});h(()=>{if(g&&d&&!b)_()},[g,d,b,_]);let k=x?.pages.flatMap((l)=>l.nodes)||[],M=x?.pages[0]?.total??0,P=(l)=>{s((I)=>I.includes(l)?I.filter((H)=>H!==l):[...I,l])},z=(l)=>{m((I)=>I.includes(l)?I.filter((H)=>H!==l):[...I,l])},ge=(l)=>{if(l.includes("delete")||l.includes("remove")||l.includes("revoke"))return t(be,{variant:"outline",className:"bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs",children:l});if(l.includes("create")||l.includes("add"))return t(be,{variant:"outline",className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs",children:l});if(l.includes("update")||l.includes("reparent")||l.includes("copy"))return t(be,{variant:"outline",className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs",children:l});return t(be,{variant:"outline",className:"bg-muted text-muted-foreground border-border font-mono text-xs",children:l})},he=new Map(c.map((l)=>[l.userId||l.id,l]));return t("div",{className:"space-y-6",children:o(St,{className:"border border-border/50 shadow-xs",children:[o(kt,{className:"pb-4",children:[o("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[o("div",{children:[o(Pt,{className:"text-xl font-bold flex items-center gap-2",children:[t(xa,{className:"h-5 w-5 text-primary"}),$d()]}),t(Ft,{className:"mt-1",children:hy()})]}),M>0&&o(be,{variant:"secondary",className:"w-fit text-xs font-normal",children:[M," ",$d()]})]}),o("div",{className:"mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40",children:[o(ht,{children:[t(gt,{asChild:!0,children:o(S,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(Y,{className:"h-3.5 w-3.5"}),Ab(),e.length>0&&t(be,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:e.length})]})}),o(At,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:vC()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:$e.map((l)=>o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(Mr,{checked:e.includes(l),onCheckedChange:()=>P(l)}),t("span",{className:"font-mono",children:l})]},l))}),e.length>0&&t(S,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>s([]),children:"Clear Actions"})]})]}),o(ht,{children:[t(gt,{asChild:!0,children:o(S,{variant:"outline",size:"sm",className:"h-9 gap-2 text-xs border-dashed",children:[t(Y,{className:"h-3.5 w-3.5"}),yb(),i.length>0&&t(be,{variant:"secondary",className:"ml-1 px-1.5 py-0 text-[10px]",children:i.length})]})}),o(At,{className:"w-64 p-2",align:"start",children:[t("div",{className:"text-xs font-semibold text-muted-foreground px-2 py-1 mb-1",children:ZC()}),t("div",{className:"max-h-60 overflow-y-auto space-y-1 pr-1",children:c.map((l)=>{let I=l.userId||l.user?.id||l.id,H=l.user?.name||l.name||I,W=l.user?.image||l.image;return o("label",{className:"flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs",children:[t(Mr,{checked:i.includes(I),onCheckedChange:()=>z(I)}),o(Ce,{className:"h-5 w-5",children:[t(Ee,{src:W||void 0}),t(Ie,{className:"text-[10px]",children:H.slice(0,2).toUpperCase()})]}),t("span",{className:"truncate",children:H})]},I)})}),i.length>0&&t(S,{variant:"ghost",size:"sm",className:"w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>m([]),children:"Clear Users"})]})]}),o("div",{className:"relative flex-1 min-w-[200px] max-w-xs",children:[t(Lt,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),t(q,{type:"text",placeholder:yC(),value:r,onChange:(l)=>p(l.target.value),className:"pl-8 pr-8 h-9 text-xs"}),r&&t("button",{onClick:()=>p(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:t(Oe,{className:"h-4 w-4"})})]}),(e.length>0||i.length>0||r)&&t(S,{variant:"ghost",size:"sm",className:"h-9 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{s([]),m([]),p("")},children:"Clear all"})]})]}),o(Mt,{className:"p-0",children:[w?t("div",{className:"flex h-64 items-center justify-center",children:t(Z,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):n?t("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load audit logs."}):k.length===0?t("div",{className:"p-12 text-center text-sm text-muted-foreground",children:Nw()}):o(bn,{children:[t(vn,{children:o(hr,{className:"hover:bg-transparent border-b border-border/50",children:[t(_t,{className:"w-[180px] text-xs font-semibold",children:Bg()}),t(_t,{className:"w-[200px] text-xs font-semibold",children:yI()}),t(_t,{className:"text-xs font-semibold",children:ev()}),t(_t,{className:"text-xs font-semibold",children:Jx()}),t(_t,{className:"w-[160px] text-right text-xs font-semibold",children:VE()})]})}),t(wn,{children:k.map((l)=>{let I=l.userId?he.get(l.userId):null,H=I?.user?.name||I?.name||l.userId||"System",W=I?.user?.image||I?.image;return o(hr,{className:"hover:bg-muted/40 transition-colors",children:[t(pt,{className:"py-3 font-medium",children:ge(l.action)}),t(pt,{className:"py-3",children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[t(Ee,{src:W||void 0}),t(Ie,{className:"text-[10px]",children:H.slice(0,2).toUpperCase()})]}),t("span",{className:"text-xs font-medium text-foreground truncate max-w-[160px]",children:l.agent?xc({user:H,agent:l.agent.name}):H}),l.agent&&t(bt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]})}),t(pt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.itemId||"-"}),t(pt,{className:"py-3 text-xs font-mono text-muted-foreground",children:l.projectId||"-"}),t(pt,{className:"py-3 text-right text-xs text-muted-foreground",children:yn(l.createdAt)})]},l.id)})})]}),t("div",{ref:f,className:"py-4 flex justify-center",children:b&&t(Z,{className:"h-6 w-6 animate-spin text-muted-foreground"})})]})]})})}function ze(){let{teamId:a}=Ge.useParams(),[e,s]=u("audit-logs"),{data:i,isLoading:m}=L({queryKey:["teams",a,"me"],queryFn:async()=>{let r=await A.api.teams[":teamId"].me.$get({param:{teamId:a}});if(!r.ok)throw Error("Failed to fetch me");return await r.json()},enabled:!!a});if(m)return t("div",{className:"flex h-screen items-center justify-center",children:t(Z,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(i?.role?.toLowerCase()!=="owner")return o("div",{className:"flex h-full flex-col items-center justify-center p-8 text-center",children:[t(vl,{className:"h-12 w-12 text-destructive mb-4"}),t("h2",{className:"text-xl font-bold tracking-tight mb-2",children:Lg()}),t("p",{className:"text-sm text-muted-foreground max-w-md",children:ax()})]});return t("div",{className:"h-full bg-background font-sans selection:bg-primary/20 transition-colors duration-300",children:o("div",{className:"flex flex-col md:flex-row h-full",children:[t("div",{className:"w-full h-full md:w-72 bg-sidebar border-b md:border-b-0 md:border-r border-sidebar-border z-10 md:left-16 overflow-y-auto transition-colors duration-300",children:o("nav",{className:"p-4 space-y-1 mt-4",children:[t("div",{className:"mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider",children:Im()}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:kE()}),o("button",{onClick:()=>s("audit-logs"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="audit-logs"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(xa,{className:"w-5 h-5"}),$d(),e==="audit-logs"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("quotas"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="quotas"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(Io,{className:"w-5 h-5"}),id(),e==="quotas"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),t("div",{className:"mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border",children:BA()}),o("button",{onClick:()=>s("ai-usage"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-usage"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(ie,{className:"w-5 h-5"}),AI(),e==="ai-usage"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]}),o("button",{onClick:()=>s("ai-sessions"),className:E("w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all",e==="ai-sessions"?"bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border":"text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"),children:[t(j,{className:"w-5 h-5"}),ig(),e==="ai-sessions"&&t("div",{className:"ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary"})]})]})}),t("div",{className:"flex-1 overflow-y-auto p-4 md:p-8",children:o("div",{className:"max-w-6xl mx-auto space-y-8",children:[e==="audit-logs"&&t(fe,{teamId:a}),e==="ai-usage"&&t(ne,{teamId:a}),e==="ai-sessions"&&t(le,{teamId:a}),e==="quotas"&&t(pe,{teamId:a})]})})]})})}var Ge=Ue("/teams/$teamId/dashboard")({component:ze});export{Ge as Route};