@shumai-one/shumai 0.3.11 → 0.4.0

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 (177) hide show
  1. package/bin/{chunk-qrhf20g2.js → chunk-02afmyqy.js} +2 -2
  2. package/bin/chunk-045f1bw7.js +2 -0
  3. package/bin/{chunk-pz7ms4n2.js → chunk-06spnkta.js} +1 -1
  4. package/bin/{chunk-y0k1f3gk.js → chunk-0bfqrx5q.js} +2 -2
  5. package/bin/{chunk-8qg6jjz4.js → chunk-0h8rjeyj.js} +2 -2
  6. package/bin/{chunk-mkwrrdme.js → chunk-0n1wfwcm.js} +1 -1
  7. package/bin/chunk-1fwzepfn.js +2 -0
  8. package/bin/{chunk-c16vvzdj.js → chunk-1qr0ajc8.js} +1 -1
  9. package/bin/{chunk-f5c9g4y9.js → chunk-2rbexbv0.js} +1 -1
  10. package/bin/{chunk-0xqf53hc.js → chunk-2x46963w.js} +1 -1
  11. package/bin/chunk-2xevs82j.js +2 -0
  12. package/bin/{chunk-4pj17byj.js → chunk-2xgvs3as.js} +2 -2
  13. package/bin/chunk-31y5j4hr.js +1 -0
  14. package/bin/chunk-34adtqqh.js +1 -0
  15. package/bin/{chunk-gx410cm2.js → chunk-34kaja59.js} +2 -2
  16. package/bin/{chunk-rr12edz4.js → chunk-3gjn4pyp.js} +2 -2
  17. package/bin/{chunk-7888x3vz.js → chunk-3r33kewe.js} +3 -3
  18. package/bin/{chunk-fv14er33.js → chunk-3twtxs5m.js} +1 -1
  19. package/bin/{chunk-mvkqjrcd.js → chunk-41d9gkx7.js} +1 -1
  20. package/bin/{chunk-kbw63gr4.js → chunk-44edgqvy.js} +3 -3
  21. package/bin/{chunk-12ps84z8.js → chunk-4b7jcpgv.js} +2 -2
  22. package/bin/chunk-4j8fbckp.js +1 -0
  23. package/bin/{chunk-4yke5y3z.js → chunk-4q782s34.js} +3 -3
  24. package/bin/{chunk-xfzk0mrt.js → chunk-52dr035y.js} +2 -2
  25. package/bin/chunk-57s7yj35.js +1 -0
  26. package/bin/{chunk-7t31qfw5.js → chunk-5yhn31rd.js} +2 -2
  27. package/bin/chunk-62ebss6h.js +2 -0
  28. package/bin/{chunk-qrnw89xg.js → chunk-6m1k317a.js} +2 -2
  29. package/bin/{chunk-0wgqr4jg.js → chunk-6tse78c7.js} +1 -1
  30. package/bin/{chunk-qh3w5w8e.js → chunk-76433x4d.js} +2 -2
  31. package/bin/{chunk-szf2q87p.js → chunk-792t2653.js} +2 -2
  32. package/bin/chunk-7x1vkftb.js +68 -0
  33. package/bin/{chunk-f9ydhm8q.js → chunk-8956rryj.js} +2 -2
  34. package/bin/{chunk-jsqsrcse.js → chunk-8nyve0cr.js} +3 -3
  35. package/bin/{chunk-xext4yvc.js → chunk-8rcfhfq5.js} +1 -1
  36. package/bin/chunk-93ecxcy4.js +2 -0
  37. package/bin/{chunk-ps2hw0ps.js → chunk-9cmvymm5.js} +1 -1
  38. package/bin/{chunk-9qytehed.js → chunk-9k76s3y6.js} +2 -2
  39. package/bin/{chunk-r18tcdds.js → chunk-agabtxrc.js} +1 -1
  40. package/bin/{chunk-y1pnq12c.js → chunk-ajndx51c.js} +2 -2
  41. package/bin/{chunk-s04f76tb.js → chunk-aw5zkdma.js} +2 -2
  42. package/bin/chunk-bbyc2jfq.js +1 -0
  43. package/bin/chunk-br7d2qwc.js +1 -0
  44. package/bin/chunk-by6g0vye.js +2 -0
  45. package/bin/chunk-c24fvhm6.js +1 -0
  46. package/bin/{chunk-6qzcnkgx.js → chunk-c3msq02x.js} +2 -2
  47. package/bin/chunk-c6aszz6p.js +1 -0
  48. package/bin/{chunk-2s97ngr8.js → chunk-ck6msfch.js} +2 -2
  49. package/bin/chunk-csqvmx1m.js +2 -0
  50. package/bin/{chunk-k1jcdr0n.js → chunk-d7en47eh.js} +1 -1
  51. package/bin/{chunk-xsgxk1fj.js → chunk-dag45evp.js} +1 -1
  52. package/bin/chunk-dg8c91j5.js +1 -0
  53. package/bin/{chunk-kcg7d7pk.js → chunk-djx2r4nj.js} +2 -2
  54. package/bin/chunk-dk8vk17v.js +2 -0
  55. package/bin/{chunk-dwkv3bx5.js → chunk-dkjkn8t3.js} +2 -2
  56. package/bin/{chunk-v073nwjn.js → chunk-et0cewj7.js} +2 -2
  57. package/bin/{chunk-ty32j999.js → chunk-etprs58p.js} +2 -2
  58. package/bin/{chunk-byjze6hm.js → chunk-ex2ym5pz.js} +2 -2
  59. package/bin/{chunk-z8crenxd.js → chunk-ez6veng7.js} +1 -1
  60. package/bin/chunk-f2zbsrc9.js +2 -0
  61. package/bin/{chunk-sqy50q9g.js → chunk-fcsfssar.js} +1 -1
  62. package/bin/chunk-fvbd5dk7.js +9 -0
  63. package/bin/{chunk-knh1stxe.js → chunk-gazp5662.js} +2 -2
  64. package/bin/{chunk-b78s1cxz.js → chunk-gcc6pte2.js} +2 -2
  65. package/bin/chunk-gcpr2a24.js +7 -0
  66. package/bin/{chunk-aq7q5e36.js → chunk-gjnrd32m.js} +2 -2
  67. package/bin/chunk-gpjkegdp.js +1 -0
  68. package/bin/{chunk-393g7z2g.js → chunk-he1ywtxx.js} +1 -1
  69. package/bin/{chunk-s9yzt7s3.js → chunk-hx2mvd20.js} +2 -2
  70. package/bin/{chunk-whm06pnc.js → chunk-j04sztp3.js} +1 -1
  71. package/bin/{chunk-nzrrvn6c.js → chunk-j536e9nx.js} +2 -2
  72. package/bin/{chunk-p9w4ar11.js → chunk-j5rx3x1q.js} +1 -1
  73. package/bin/{chunk-0ash207y.js → chunk-jt6d0zb1.js} +2 -2
  74. package/bin/chunk-jwgfkpek.js +3 -0
  75. package/bin/chunk-k2065y29.js +2 -0
  76. package/bin/{chunk-qz3kfrpr.js → chunk-k3r97v7j.js} +1 -1
  77. package/bin/chunk-k514bttd.js +1 -0
  78. package/bin/chunk-k7chm9a9.js +2 -0
  79. package/bin/chunk-kjgejwjp.css +1 -0
  80. package/bin/{chunk-0vqefpcw.js → chunk-kjjhvrk1.js} +1 -1
  81. package/bin/chunk-kqpzx5az.js +73 -0
  82. package/bin/{chunk-a5ja6d97.js → chunk-kvnfgr29.js} +1 -1
  83. package/bin/chunk-kxr8fjsq.js +2 -0
  84. package/bin/{chunk-3qva5sqr.js → chunk-m2tbft2c.js} +2 -2
  85. package/bin/{chunk-ghw914d2.js → chunk-m8z8jvdq.js} +2 -2
  86. package/bin/{chunk-0g0gt4bj.js → chunk-md12a1sf.js} +2 -2
  87. package/bin/{chunk-nw03w9pa.js → chunk-mgnxa0vy.js} +1 -1
  88. package/bin/chunk-mha3rsh7.js +2 -0
  89. package/bin/{chunk-7anqxpyv.js → chunk-mhps85dd.js} +2 -2
  90. package/bin/{chunk-8r2agmv2.js → chunk-n8gsjwht.js} +2 -2
  91. package/bin/{chunk-n2ae527q.js → chunk-nn0px81k.js} +58 -58
  92. package/bin/chunk-ns804tmv.js +2 -0
  93. package/bin/{chunk-12r8a5ev.js → chunk-nz2v1jmd.js} +2 -2
  94. package/bin/chunk-p1temt1j.js +1 -0
  95. package/bin/{chunk-69at8jm8.js → chunk-p49h5fxs.js} +1 -1
  96. package/bin/{chunk-tdp1jjv1.js → chunk-pdjar480.js} +2 -2
  97. package/bin/{chunk-t2z4qys8.js → chunk-qac5hr5h.js} +1 -1
  98. package/bin/{chunk-31f07jzm.js → chunk-r2shjtte.js} +2 -2
  99. package/bin/{chunk-bthrbggg.js → chunk-rkz6x3r0.js} +2 -2
  100. package/bin/{chunk-1dzby9bb.js → chunk-s73c0brj.js} +1 -1
  101. package/bin/chunk-svz0ds0g.js +1 -0
  102. package/bin/{chunk-axnvvkdf.js → chunk-sx6y697s.js} +1 -1
  103. package/bin/chunk-t31basc5.js +1 -0
  104. package/bin/chunk-t6qdrw24.js +1 -0
  105. package/bin/{chunk-sepsqqdf.js → chunk-tcm57j8r.js} +2 -2
  106. package/bin/{chunk-wdgwymdp.js → chunk-thbfw1ed.js} +1 -1
  107. package/bin/{chunk-fsj3kxya.js → chunk-tn67sjb2.js} +2 -2
  108. package/bin/{chunk-s0jy7grq.js → chunk-vcf2qk9h.js} +2 -2
  109. package/bin/{chunk-dyen2t1p.js → chunk-vhcqazqf.js} +2 -2
  110. package/bin/{chunk-hpm4razn.js → chunk-vkgxrn1h.js} +2 -2
  111. package/bin/{chunk-50vzkdc8.js → chunk-vvhs586e.js} +1 -1
  112. package/bin/{chunk-vvx62hp4.js → chunk-wehhpcm1.js} +1 -1
  113. package/bin/{chunk-sdjss6ja.js → chunk-wrgwjg2g.js} +1 -1
  114. package/bin/chunk-wvwqgff4.js +1 -0
  115. package/bin/chunk-ww1cy08p.js +1 -0
  116. package/bin/{chunk-77c2xm0z.js → chunk-wy2f6mby.js} +1 -1
  117. package/bin/{chunk-zvjx64p5.js → chunk-wzmpvadf.js} +1 -1
  118. package/bin/{chunk-8bv8qsb8.js → chunk-x9akgj7w.js} +2 -2
  119. package/bin/chunk-xfp27ya9.js +2 -0
  120. package/bin/{chunk-dhhfwbns.js → chunk-xjnghr99.js} +1 -1
  121. package/bin/{chunk-cmd0feyq.js → chunk-xkhwj8mw.js} +2 -2
  122. package/bin/{chunk-3j47y8ah.js → chunk-xv5h4dv1.js} +1 -1
  123. package/bin/{chunk-xsqk7ek2.js → chunk-xzag8w1v.js} +1 -1
  124. package/bin/{chunk-gwzk0fvn.js → chunk-y0f4bc9f.js} +2 -2
  125. package/bin/{chunk-wch8ygpt.js → chunk-y2s0tjaa.js} +2 -2
  126. package/bin/chunk-y3dy4pdt.js +2 -0
  127. package/bin/{chunk-cyjh5qsk.js → chunk-yfqz6f72.js} +1 -1
  128. package/bin/{chunk-5nk7y4ec.js → chunk-ymr5ybxk.js} +2 -2
  129. package/bin/chunk-ysvhtgve.js +2 -0
  130. package/bin/{chunk-ntqn09r0.js → chunk-yyjx8nbq.js} +2 -2
  131. package/bin/{chunk-6edh2e59.js → chunk-zh752hw8.js} +1 -1
  132. package/bin/{chunk-res6r4tm.js → chunk-zmyawgth.js} +1 -1
  133. package/bin/{chunk-esa954t1.js → chunk-zye42cfp.js} +2 -2
  134. package/bin/shumai-app.html +1 -1
  135. package/bin/shumai-app.js +226 -216
  136. package/package.json +7 -7
  137. package/bin/chunk-02b97gsf.js +0 -2
  138. package/bin/chunk-0j3yb84c.js +0 -1
  139. package/bin/chunk-1tby7q3f.js +0 -1
  140. package/bin/chunk-3ztat2q9.js +0 -68
  141. package/bin/chunk-48yphy68.js +0 -73
  142. package/bin/chunk-4t2qcxp5.js +0 -1
  143. package/bin/chunk-5dfy6173.js +0 -2
  144. package/bin/chunk-68bfd8x7.js +0 -3
  145. package/bin/chunk-6ts5az6h.js +0 -2
  146. package/bin/chunk-72nj00dp.js +0 -1
  147. package/bin/chunk-8b11b9cj.js +0 -2
  148. package/bin/chunk-8ekjxb5q.js +0 -2
  149. package/bin/chunk-8zar6cc4.js +0 -2
  150. package/bin/chunk-9m9bn55a.js +0 -1
  151. package/bin/chunk-ayr3tsz3.js +0 -2
  152. package/bin/chunk-csh1ggtt.js +0 -1
  153. package/bin/chunk-ctx1ms5t.js +0 -2
  154. package/bin/chunk-day0vn14.js +0 -2
  155. package/bin/chunk-e5r6rnt9.js +0 -2
  156. package/bin/chunk-gx8sz5bw.js +0 -2
  157. package/bin/chunk-gydktfnx.js +0 -2
  158. package/bin/chunk-h5j1dqc0.js +0 -1
  159. package/bin/chunk-h7kyj2g2.js +0 -2
  160. package/bin/chunk-har4xctf.js +0 -2
  161. package/bin/chunk-hks5k0tm.js +0 -7
  162. package/bin/chunk-hv4t9h3e.js +0 -9
  163. package/bin/chunk-kchbbtdm.js +0 -2
  164. package/bin/chunk-mm995mvc.js +0 -2
  165. package/bin/chunk-mz9pthjh.js +0 -2
  166. package/bin/chunk-n3xn2ve1.js +0 -1
  167. package/bin/chunk-q3fdffq5.js +0 -1
  168. package/bin/chunk-rd2n0rs6.js +0 -1
  169. package/bin/chunk-sttc4axf.js +0 -1
  170. package/bin/chunk-t6pmgmg2.js +0 -1
  171. package/bin/chunk-txpqhfqw.js +0 -1
  172. package/bin/chunk-vrdbqapq.js +0 -2
  173. package/bin/chunk-vwa17b2r.js +0 -1
  174. package/bin/chunk-wqwvxskj.js +0 -1
  175. package/bin/chunk-wr3q8a9n.js +0 -1
  176. package/bin/chunk-wt01m93x.js +0 -1
  177. package/bin/chunk-xr1wr22v.css +0 -1
@@ -1,2 +1,2 @@
1
- import{hi as w,li as l,ni as f,oi as g,qi as p}from"./chunk-jsqsrcse.js";import{Ji as D,Kl as r,Li as n,Mi as u,Mj as m,Qj as c,Wl as d}from"./chunk-48yphy68.js";import{Zm as P}from"./chunk-69at8jm8.js";function x({...t}){return n(r.Root,{"data-slot":"dropdown-menu",...t})}function T({...t}){return n(r.Portal,{"data-slot":"dropdown-menu-portal",...t})}function I({...t}){return n(r.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function z({className:t,sideOffset:o=4,...e}){return n(r.Portal,{children:n(r.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:d("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...e})})}function S({className:t,inset:o,variant:e="default",...a}){return n(r.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":e,className:d("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",t),...a})}function N({...t}){return n(r.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function _({className:t,children:o,...e}){return u(r.RadioItem,{"data-slot":"dropdown-menu-radio-item",className:d("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e,children:[n("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:n(r.ItemIndicator,{children:n(c,{className:"size-2 fill-current"})})}),o]})}function k({className:t,inset:o,...e}){return n(r.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:d("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...e})}function G({className:t,...o}){return n(r.Separator,{"data-slot":"dropdown-menu-separator",className:d("-mx-1 my-1 h-px bg-border",t),...o})}function F({...t}){return n(r.Sub,{"data-slot":"dropdown-menu-sub",...t})}function L({className:t,inset:o,children:e,...a}){return u(r.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:d("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...a,children:[e,n(m,{className:"ml-auto size-4"})]})}function O({className:t,...o}){return n(r.SubContent,{"data-slot":"dropdown-menu-sub-content",className:d("z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...o})}var v=l()(g((t,o)=>({teamId:null,projectTeamMap:{},setTeamId:(e)=>t({teamId:e}),ensureTeamIdForProject:async(e)=>{let a=o();if(a.projectTeamMap[e]){let i=a.projectTeamMap[e];if(a.teamId!==i)t({teamId:i});return i}try{let i=await p.api.projects[":projectId"].team.$get({param:{projectId:e}});if(!i.ok)throw Error("failed to fetch project team");let s=await i.json();if(s&&s.teamId)return t((M)=>({teamId:s.teamId,projectTeamMap:{...M.projectTeamMap,[e]:s.teamId}})),s.teamId}catch(i){console.error("Failed to fetch team ID for project",e,i)}return null}}),{name:"team-context-storage",storage:f(()=>localStorage)}));var b=P(D(),1);function Y(t){let o=v((a)=>a.teamId),{data:e}=w({queryKey:t?["projects",t,"me"]:["teams",o,"me"],queryFn:async()=>{if(t){let a=await p.api.projects[":projectId"].me.$get({param:{projectId:t}});if(!a.ok)throw Error("Failed to fetch project me");return await a.json()}else{if(!o)return null;let a=await p.api.teams[":teamId"].me.$get({param:{teamId:o}});if(!a.ok)throw Error("Failed to fetch team me");return await a.json()}},enabled:t?!!t:!!o});return b.useMemo(()=>({role:e?.role,canEdit:e?.role==="owner"||e?.role==="editor",canAdmin:e?.role==="owner"}),[e?.role])}
2
- export{x as Qh,T as Rh,I as Sh,z as Th,S as Uh,N as Vh,_ as Wh,k as Xh,G as Yh,F as Zh,L as _h,O as $h,v as ai,Y as bi};
1
+ import{Ai as g,Ci as p,ti as w,xi as l,zi as f}from"./chunk-8nyve0cr.js";import{Pl as d,Vi as D,Xi as n,Yi as u,Yj as m,Yl as r,ak as c}from"./chunk-kqpzx5az.js";import{kn as P}from"./chunk-p49h5fxs.js";function x({...t}){return n(r.Root,{"data-slot":"dropdown-menu",...t})}function T({...t}){return n(r.Portal,{"data-slot":"dropdown-menu-portal",...t})}function I({...t}){return n(r.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function z({className:t,sideOffset:o=4,...e}){return n(r.Portal,{children:n(r.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:d("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...e})})}function S({className:t,inset:o,variant:e="default",...a}){return n(r.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":e,className:d("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",t),...a})}function N({...t}){return n(r.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function _({className:t,children:o,...e}){return u(r.RadioItem,{"data-slot":"dropdown-menu-radio-item",className:d("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...e,children:[n("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:n(r.ItemIndicator,{children:n(c,{className:"size-2 fill-current"})})}),o]})}function k({className:t,inset:o,...e}){return n(r.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:d("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...e})}function G({className:t,...o}){return n(r.Separator,{"data-slot":"dropdown-menu-separator",className:d("-mx-1 my-1 h-px bg-border",t),...o})}function F({...t}){return n(r.Sub,{"data-slot":"dropdown-menu-sub",...t})}function L({className:t,inset:o,children:e,...a}){return u(r.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:d("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...a,children:[e,n(m,{className:"ml-auto size-4"})]})}function O({className:t,...o}){return n(r.SubContent,{"data-slot":"dropdown-menu-sub-content",className:d("z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...o})}var v=l()(g((t,o)=>({teamId:null,projectTeamMap:{},setTeamId:(e)=>t({teamId:e}),ensureTeamIdForProject:async(e)=>{let a=o();if(a.projectTeamMap[e]){let i=a.projectTeamMap[e];if(a.teamId!==i)t({teamId:i});return i}try{let i=await p.api.projects[":projectId"].team.$get({param:{projectId:e}});if(!i.ok)throw Error("failed to fetch project team");let s=await i.json();if(s&&s.teamId)return t((M)=>({teamId:s.teamId,projectTeamMap:{...M.projectTeamMap,[e]:s.teamId}})),s.teamId}catch(i){console.error("Failed to fetch team ID for project",e,i)}return null}}),{name:"team-context-storage",storage:f(()=>localStorage)}));var b=P(D(),1);function Y(t){let o=v((a)=>a.teamId),{data:e}=w({queryKey:t?["projects",t,"me"]:["teams",o,"me"],queryFn:async()=>{if(t){let a=await p.api.projects[":projectId"].me.$get({param:{projectId:t}});if(!a.ok)throw Error("Failed to fetch project me");return await a.json()}else{if(!o)return null;let a=await p.api.teams[":teamId"].me.$get({param:{teamId:o}});if(!a.ok)throw Error("Failed to fetch team me");return await a.json()}},enabled:t?!!t:!!o});return b.useMemo(()=>({role:e?.role,canEdit:e?.role==="owner"||e?.role==="editor",canAdmin:e?.role==="owner"}),[e?.role])}
2
+ export{x as ai,T as bi,I as ci,z as di,S as ei,N as fi,_ as gi,k as hi,G as ii,F as ji,L as ki,O as li,v as mi,Y as ni};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Oa as e,Pa as p,Qa as t}from"./chunk-44edgqvy.js";import"./chunk-3r33kewe.js";import"./chunk-n8gsjwht.js";import"./chunk-hx2mvd20.js";import"./chunk-8rcfhfq5.js";import"./chunk-c3msq02x.js";import"./chunk-p49h5fxs.js";export{t as kyselyAdapter,e as getKyselyDatabaseType,p as createKyselyAdapter};
@@ -21,4 +21,4 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
21
21
  new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
22
22
 
23
23
  https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
24
- `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as jm,b3 as km};
24
+ `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as wm,b3 as xm};
@@ -1,2 +1,2 @@
1
- import{Li as k,Mi as z}from"./chunk-48yphy68.js";var A={viewBox:"0 -960 960 960",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},E=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Z"})}),F=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Zm200 0v-560H640v560h120Z"})}),H=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm560-80v-560H400v560h360Z"})}),J=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Z"})}),K=(q)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...q,children:[k("path",{d:"M12 8V4H8"}),k("path",{d:"M6 7H18A3 3 0 0 1 21 10V18A3 3 0 0 1 18 21H6A3 3 0 0 1 3 18V10A3 3 0 0 1 6 7ZM8 13V15A1 1 0 0 0 10 15V13A1 1 0 0 0 8 13ZM14 13V15A1 1 0 0 0 16 15V13A1 1 0 0 0 14 13Z",fill:"currentColor",stroke:"none"}),k("path",{d:"M2 14h2"}),k("path",{d:"M20 14h2"})]}),L=(q)=>k("svg",{xmlns:"http://www.w3.org/2000/svg",width:30,height:30,viewBox:"120 -792 720 720",fill:"none","aria-hidden":"true",focusable:"false",...q,children:k("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M 160 -180 v -72 h 80 v -252 q 0 -74.7 50 -132.75 T 420 -712.8 v -25.2 q 0 -22.5 17.5 -38.25 T 480 -792 q 25 0 42.5 15.75 T 540 -738 v 25.2 q 80 18 130 76.05 T 720 -504 v 252 h 80 v 72 H 160 Z M 480 -72 q -33 0 -56.5 -21.15 T 400 -144 h 160 q 0 29.7 -23.5 50.85 T 480 -72 Z",fill:"currentColor"})}),M=(q)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",...q,children:[k("path",{d:"M10.77 10.377a1 1 0 0 0-.132.437l-.105 1.665a.5.5 0 0 0 .793.436l1.32-.96a1 1 0 0 0 .278-.309l3.912-6.775a1.25 1.25 0 1 0-2.165-1.25l-3.901 6.756Z",fill:"currentColor"}),k("path",{d:"M11.016 6.75a.758.758 0 0 1-.758.748c-2.938 0-4.882 1.71-5.517 3.95-.708 2.499.245 4.459 1.979 5.851 1.767 1.42 4.31 2.203 6.547 2.203.415 0 .749.335.745.748a.758.758 0 0 1-.758.748c-2.536 0-5.421-.873-7.485-2.531-2.098-1.686-3.38-4.225-2.475-7.414.818-2.883 3.354-5.051 6.977-5.051.415 0 .749.335.745.748Z",fill:"currentColor"}),k("path",{d:"M17.147 8.315a.767.767 0 0 1 1.058-.168c1.666 1.188 2.508 2.542 2.733 3.876a4.5 4.5 0 0 1-.805 3.392c-.919 1.434-2.714 2.074-4.479 2.185-1.799.113-3.78-.302-5.292-1.216a.733.733 0 0 1-.242-1.022.768.768 0 0 1 1.042-.246c1.216.734 2.881 1.096 4.409 1 1.553-.097 2.755-.647 3.292-1.5l.015-.022.015-.021a3.025 3.025 0 0 0 .553-2.294c-.148-.876-.72-1.915-2.137-2.926a.733.733 0 0 1-.162-1.038Z",fill:"currentColor"})]}),O=(q)=>{return z("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",...q,children:[k("defs",{children:k("clipPath",{id:"bg-clip",children:k("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22"})})}),k("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22",fill:"#D95A66"}),k("path",{d:"M 35 75 L 65 75 L 80 60 L 75 30 L 175 130 L 135 175 Z",fill:"#A8384D",clipPath:"url(#bg-clip)"}),k("path",{d:"M 25 30 Q 38 36 50 42 L 35 55 L 35 75 L 20 60 Z",fill:"#FDF0D5"}),k("path",{d:"M 50 42 Q 62 36 75 30 L 80 60 L 65 75 L 65 55 Z",fill:"#E77A65"}),k("path",{d:"M 35 75 L 65 75 L 65 55 L 50 42 L 35 55 Z",fill:"#F5B895"}),k("path",{d:"M 50 42 Q 38 36 25 30 Q 38 26 50 20 Q 62 26 75 30 Q 62 36 50 42 Z",fill:"#F4B8B8"}),k("path",{d:"M 50 25 L 42 30 L 50 35 Z",fill:"#E57A5F"}),k("path",{d:"M 50 25 L 58 30 L 50 35 Z",fill:"#C2523C"})]})},Q=(q)=>k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"24 24 152 152",fill:"none","aria-hidden":"true",focusable:"false",...q,children:k("path",{d:"M 44 170 L 44 100 L 24 100 L 100 30 L 126 54 L 126 36 L 142 36 L 142 69 L 176 100 L 156 100 L 156 170 L 120 170 L 120 136 A 20 20 0 0 0 80 136 L 80 170 Z",fill:"currentColor"})});function T({uploading:q=!1,className:B="",...D}){return z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"15 15 70 70",width:30,height:30,className:`${B} ${q?"animate-upload-breathing":""}`,"aria-hidden":"true",focusable:"false",style:q?{transformOrigin:"center"}:void 0,...D,children:[q&&k("defs",{children:z("linearGradient",{id:"upload-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[k("stop",{offset:"0%",stopColor:"#3b82f6",children:k("animate",{attributeName:"stop-color",values:"#3b82f6;#ec4899;#8b5cf6;#3b82f6",dur:"3s",repeatCount:"indefinite"})}),k("stop",{offset:"50%",stopColor:"#8b5cf6",children:k("animate",{attributeName:"stop-color",values:"#8b5cf6;#3b82f6;#ec4899;#8b5cf6",dur:"3s",repeatCount:"indefinite"})}),k("stop",{offset:"100%",stopColor:"#ec4899",children:k("animate",{attributeName:"stop-color",values:"#ec4899;#8b5cf6;#3b82f6;#ec4899",dur:"3s",repeatCount:"indefinite"})})]})}),k("path",{d:"M 44.1 75 H 30 A 15 15 0 0 1 30 45 A 20 20 0 0 1 70 45 A 15 15 0 0 1 70 75 H 55.9 V 60.2 H 61.9 L 50 45.3 L 38.1 60.2 H 44.1 Z",fill:q?"url(#upload-gradient)":"currentColor"})]})}var W=({className:q,...B})=>k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",fill:"currentColor","aria-hidden":"true",focusable:"false",className:q?`rotate-180 ${q}`:"rotate-180",...B,children:k("path",{d:"M172-84q-36.3 0-62.15-25.85T84-172v-616q0-36.3 25.85-62.15T172-876h616q36.3 0 62.15 25.85T876-788v616q0 36.3-25.85 62.15T788-84H172Zm88-176h88v-440h-88v440Zm176 0h88v-264h-88v264Zm176 0h88v-352h-88v352Z"})}),X=(q)=>k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",fill:"currentColor","aria-hidden":"true",focusable:"false",...q,children:k("path",{d:"M520-600v-240h320v240H520ZM120-440v-400h320v400H120Zm400 320v-400h320v400H520Zm-400 0v-240h320v240H120Z"})});
2
- export{E as Vg,F as Wg,H as Xg,J as Yg,K as Zg,L as _g,M as $g,O as ah,Q as bh,T as ch,W as dh,X as eh};
1
+ import{Xi as k,Yi as z}from"./chunk-kqpzx5az.js";var A={viewBox:"0 -960 960 960",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},E=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Z"})}),F=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Zm200 0v-560H640v560h120Z"})}),H=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm560-80v-560H400v560h360Z"})}),J=(q)=>k("svg",{...A,...q,children:k("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm360-80v-560H200v560h360Z"})}),K=(q)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...q,children:[k("path",{d:"M12 8V4H8"}),k("path",{d:"M6 7H18A3 3 0 0 1 21 10V18A3 3 0 0 1 18 21H6A3 3 0 0 1 3 18V10A3 3 0 0 1 6 7ZM8 13V15A1 1 0 0 0 10 15V13A1 1 0 0 0 8 13ZM14 13V15A1 1 0 0 0 16 15V13A1 1 0 0 0 14 13Z",fill:"currentColor",stroke:"none"}),k("path",{d:"M2 14h2"}),k("path",{d:"M20 14h2"})]}),L=(q)=>k("svg",{xmlns:"http://www.w3.org/2000/svg",width:30,height:30,viewBox:"120 -792 720 720",fill:"none","aria-hidden":"true",focusable:"false",...q,children:k("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M 160 -180 v -72 h 80 v -252 q 0 -74.7 50 -132.75 T 420 -712.8 v -25.2 q 0 -22.5 17.5 -38.25 T 480 -792 q 25 0 42.5 15.75 T 540 -738 v 25.2 q 80 18 130 76.05 T 720 -504 v 252 h 80 v 72 H 160 Z M 480 -72 q -33 0 -56.5 -21.15 T 400 -144 h 160 q 0 29.7 -23.5 50.85 T 480 -72 Z",fill:"currentColor"})}),M=(q)=>z("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",...q,children:[k("path",{d:"M10.77 10.377a1 1 0 0 0-.132.437l-.105 1.665a.5.5 0 0 0 .793.436l1.32-.96a1 1 0 0 0 .278-.309l3.912-6.775a1.25 1.25 0 1 0-2.165-1.25l-3.901 6.756Z",fill:"currentColor"}),k("path",{d:"M11.016 6.75a.758.758 0 0 1-.758.748c-2.938 0-4.882 1.71-5.517 3.95-.708 2.499.245 4.459 1.979 5.851 1.767 1.42 4.31 2.203 6.547 2.203.415 0 .749.335.745.748a.758.758 0 0 1-.758.748c-2.536 0-5.421-.873-7.485-2.531-2.098-1.686-3.38-4.225-2.475-7.414.818-2.883 3.354-5.051 6.977-5.051.415 0 .749.335.745.748Z",fill:"currentColor"}),k("path",{d:"M17.147 8.315a.767.767 0 0 1 1.058-.168c1.666 1.188 2.508 2.542 2.733 3.876a4.5 4.5 0 0 1-.805 3.392c-.919 1.434-2.714 2.074-4.479 2.185-1.799.113-3.78-.302-5.292-1.216a.733.733 0 0 1-.242-1.022.768.768 0 0 1 1.042-.246c1.216.734 2.881 1.096 4.409 1 1.553-.097 2.755-.647 3.292-1.5l.015-.022.015-.021a3.025 3.025 0 0 0 .553-2.294c-.148-.876-.72-1.915-2.137-2.926a.733.733 0 0 1-.162-1.038Z",fill:"currentColor"})]}),O=(q)=>{return z("svg",{viewBox:"0 0 100 100",fill:"none",xmlns:"http://www.w3.org/2000/svg",...q,children:[k("defs",{children:k("clipPath",{id:"bg-clip",children:k("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22"})})}),k("rect",{x:"5",y:"5",width:"90",height:"90",rx:"22",fill:"#D95A66"}),k("path",{d:"M 35 75 L 65 75 L 80 60 L 75 30 L 175 130 L 135 175 Z",fill:"#A8384D",clipPath:"url(#bg-clip)"}),k("path",{d:"M 25 30 Q 38 36 50 42 L 35 55 L 35 75 L 20 60 Z",fill:"#FDF0D5"}),k("path",{d:"M 50 42 Q 62 36 75 30 L 80 60 L 65 75 L 65 55 Z",fill:"#E77A65"}),k("path",{d:"M 35 75 L 65 75 L 65 55 L 50 42 L 35 55 Z",fill:"#F5B895"}),k("path",{d:"M 50 42 Q 38 36 25 30 Q 38 26 50 20 Q 62 26 75 30 Q 62 36 50 42 Z",fill:"#F4B8B8"}),k("path",{d:"M 50 25 L 42 30 L 50 35 Z",fill:"#E57A5F"}),k("path",{d:"M 50 25 L 58 30 L 50 35 Z",fill:"#C2523C"})]})},Q=(q)=>k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"24 24 152 152",fill:"none","aria-hidden":"true",focusable:"false",...q,children:k("path",{d:"M 44 170 L 44 100 L 24 100 L 100 30 L 126 54 L 126 36 L 142 36 L 142 69 L 176 100 L 156 100 L 156 170 L 120 170 L 120 136 A 20 20 0 0 0 80 136 L 80 170 Z",fill:"currentColor"})});function T({uploading:q=!1,className:B="",...D}){return z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"15 15 70 70",width:30,height:30,className:`${B} ${q?"animate-upload-breathing":""}`,"aria-hidden":"true",focusable:"false",style:q?{transformOrigin:"center"}:void 0,...D,children:[q&&k("defs",{children:z("linearGradient",{id:"upload-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[k("stop",{offset:"0%",stopColor:"#3b82f6",children:k("animate",{attributeName:"stop-color",values:"#3b82f6;#ec4899;#8b5cf6;#3b82f6",dur:"3s",repeatCount:"indefinite"})}),k("stop",{offset:"50%",stopColor:"#8b5cf6",children:k("animate",{attributeName:"stop-color",values:"#8b5cf6;#3b82f6;#ec4899;#8b5cf6",dur:"3s",repeatCount:"indefinite"})}),k("stop",{offset:"100%",stopColor:"#ec4899",children:k("animate",{attributeName:"stop-color",values:"#ec4899;#8b5cf6;#3b82f6;#ec4899",dur:"3s",repeatCount:"indefinite"})})]})}),k("path",{d:"M 44.1 75 H 30 A 15 15 0 0 1 30 45 A 20 20 0 0 1 70 45 A 15 15 0 0 1 70 75 H 55.9 V 60.2 H 61.9 L 50 45.3 L 38.1 60.2 H 44.1 Z",fill:q?"url(#upload-gradient)":"currentColor"})]})}var W=({className:q,...B})=>k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",fill:"currentColor","aria-hidden":"true",focusable:"false",className:q?`rotate-180 ${q}`:"rotate-180",...B,children:k("path",{d:"M172-84q-36.3 0-62.15-25.85T84-172v-616q0-36.3 25.85-62.15T172-876h616q36.3 0 62.15 25.85T876-788v616q0 36.3-25.85 62.15T788-84H172Zm88-176h88v-440h-88v440Zm176 0h88v-264h-88v264Zm176 0h88v-352h-88v352Z"})}),X=(q)=>k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",fill:"currentColor","aria-hidden":"true",focusable:"false",...q,children:k("path",{d:"M520-600v-240h320v240H520ZM120-440v-400h320v400H120Zm400 320v-400h320v400H520Zm-400 0v-240h320v240H120Z"})});
2
+ export{E as fh,F as gh,H as hh,J as ih,K as jh,L as kh,M as lh,O as mh,Q as nh,T as oh,W as ph,X as qh};
@@ -1,2 +1,2 @@
1
- import{we as A}from"./chunk-gwzk0fvn.js";import{qi as z}from"./chunk-jsqsrcse.js";import{Li as v,Vi as w}from"./chunk-48yphy68.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
- export{B as ce,H as de};
1
+ import{Ee as A}from"./chunk-y0f4bc9f.js";import{Ci as z}from"./chunk-8nyve0cr.js";import{Xi as v,fj as w}from"./chunk-kqpzx5az.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
+ export{B as ke,H as le};
@@ -1,2 +1,2 @@
1
- import{Tf as v}from"./chunk-wch8ygpt.js";import{Uf as _z,Vf as $z,Wf as Kz,Xf as Uz,Yf as Vz}from"./chunk-ntqn09r0.js";import{Zf as I}from"./chunk-esa954t1.js";import{Pg as Zz}from"./chunk-3ztat2q9.js";import{Rg as S}from"./chunk-2s97ngr8.js";import{qh as Xz}from"./chunk-4pj17byj.js";import{ai as Yz}from"./chunk-qrhf20g2.js";import{ei as n,hi as r,qi as o}from"./chunk-jsqsrcse.js";import{$l as Y,Ej as T,Fj as zz,Ji as Mz,Ki as M,Kj as b,Li as z,Mi as J,Qk as Gz,Wl as w,kj as t,ll as A,mk as h,vj as e,xj as s,xl as Jz}from"./chunk-48yphy68.js";import{Zm as Bz}from"./chunk-69at8jm8.js";var Z=Bz(Mz(),1);function gz({projectId:V,contextAssetId:R}){let{isHistoryMode:L,setIsHistoryMode:p,currentSessionId:Wz,chatAssets:u,removeAsset:Lz,messages:E,historySessions:g,isStreaming:D,fetchHistorySessions:m,loadSession:Nz,deleteSession:Qz,startNewSession:Pz,sendMessage:Oz,abortActiveSession:Dz,selectedAgentId:F,setSelectedAgentId:B,inputText:C,setInputText:l}=v(),{teamId:W,ensureTeamIdForProject:j}=Yz();Z.useEffect(()=>{if(V)j(V)},[V,j]);let{data:qz=[],isSuccess:d}=r({queryKey:["chat-agents",V],queryFn:async()=>{if(!V)return[];let G=await o.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:V}});if(!G.ok)throw Error("failed to fetch agents");return G.json()},enabled:!!V}),H=qz.filter((G)=>G.type==="chat"&&G.enabled);Z.useEffect(()=>{if(!d)return;if(H.length>0){if(!H.some((X)=>X.id===F))B(H[0].id)}else if(F!==null)B(null)},[d,H,F,B]);let x=Z.useRef(null),y=Z.useRef(null),k=Z.useRef(!0),f=Z.useRef(!0);Z.useEffect(()=>{f.current=!0,k.current=!0},[V,R,L]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let{scrollTop:X,isAtBottom:_}=v.getState(),U=setTimeout(()=>{if(_)G.scrollTop=G.scrollHeight;else G.scrollTop=X;let P=setTimeout(()=>{f.current=!1},50);return()=>clearTimeout(P)},0);return()=>clearTimeout(U)},[V,R,L]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let X=()=>{if(f.current)return;let _=G.scrollTop,U=G.scrollHeight-_-G.clientHeight<10;v.getState().setScrollState(_,U)};return G.addEventListener("scroll",X),()=>{G.removeEventListener("scroll",X)}},[V,R,L]);let{ref:Ez,isDropTarget:Fz}=Zz({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});Z.useEffect(()=>{if(!L){let{isAtBottom:G}=v.getState();if(G||D){let X=k.current?"auto":"smooth";x.current?.scrollIntoView({behavior:X})}k.current=!1}},[E,D,L]),Z.useEffect(()=>{if(L&&W)m(W)},[L,m,W]);let q=n(),Hz=Z.useCallback(()=>{q.invalidateQueries({queryKey:["search"]}),q.invalidateQueries({queryKey:["folders"]}),q.invalidateQueries({queryKey:["files"]}),q.invalidateQueries({queryKey:["file"]}),q.invalidateQueries({queryKey:["version_stacks"]}),q.invalidateQueries({queryKey:["projects"]})},[q]),i=()=>{if(!C.trim()||D||!W)return;Oz(W,C,V,R,Hz),l("")},Cz=(G)=>{if(G.nativeEvent.isComposing)return;if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),i()},a=(G)=>{if(typeof G==="string")return G;if(Array.isArray(G))return G.map((X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"&&"type"in X&&X.type==="text"&&"text"in X)return String(X.text);return""}).join("");return""},c=(G)=>{return G.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},vz=(G)=>{switch(G.role){case"user":return z("div",{className:"flex justify-end w-full",children:z("div",{className:"bg-primary text-primary-foreground rounded-lg px-3 py-2 max-w-[85%] text-sm whitespace-pre-wrap shadow-xs break-words",children:a(G.content)})},G.id);case"assistant":{let _=G.content;if(!_)return null;let U=[];if(_.forEach(($,N)=>{if(!$||typeof $!=="object")return;let Q=$;switch(Q.type){case"text":{let K=Q.text;if(typeof K!=="string"||!K.trim())return;U.push(z("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:z(I,{components:{pre:({node:O,...Rz})=>z("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...Rz})},children:c(K)})},`txt-${N}`));break}case"thinking":{let K=Q.thinking;if(typeof K!=="string"||!K.trim())return;U.push(J("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(zz,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),z("span",{children:Y.role_thinking()||"Thinking"}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),z("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:z(I,{children:c(K)})})]},`think-${N}`));break}case"toolCall":{let K=String(Q.name||Q.toolName||Y.unknown()),O=Q.arguments||Q.args;U.push(J("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(Jz,{className:"h-3.5 w-3.5"}),z("span",{children:Y.calling_tool()}),z("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:K}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!O&&J("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[z("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Y.tool_arguments()||"Arguments"}),z("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(O,null,2)})]})]},`tool-${N}`));break}case"image":{let K=String(Q.mimeType||"image/png"),O=String(Q.data||"");U.push(z("div",{className:"my-2 max-w-full",children:O?z("img",{src:O.startsWith("data:")?O:`data:${K};base64,${O}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):z("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Y.image_object()})},`img-${N}`));break}default:{let K=JSON.stringify($,null,2);if(K==="{}")return;U.push(z("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:K},`other-${N}`))}}}),U.length===0)return null;let P=!1;if(_.length>0){let $=_[_.length-1];if(typeof $==="string"&&$.trim().length>0)P=!0;else if($&&typeof $==="object"){let N=$;if(N.type==="text"&&typeof N.text==="string"&&N.text.trim().length>0)P=!0}}return J("div",{className:"flex flex-col w-full space-y-1",children:[z("div",{className:"space-y-2 w-full",children:U}),P&&z("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Y.created_by_agent()})]},G.id)}case"toolResult":return z("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:z("span",{className:"font-semibold",children:Y.tool_result_with_name({name:G.toolName||"tool"})})},G.id);case"thinking_level_change":case"custom":{let X=G;if(X.customType==="context_display_info"){let P=X.details?.assets||[];if(P.length===0)return null;return J("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[z("div",{className:"font-semibold",children:Y.assets_added_to_context()}),z("ul",{className:"list-disc list-inside space-y-0.5",children:P.map(($)=>J("li",{className:"truncate",children:[$.name," ",J("span",{className:"text-muted-foreground/70",children:["(",$.type,")"]})]},$.id))})]},G.id)}let _=X.content||"";return z("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:a(_)},G.id)}default:return null}};return J("div",{ref:Ez,className:w("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Fz&&z("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:J("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[z(T,{className:"h-6 w-6 text-primary animate-bounce"}),z("span",{className:"text-sm font-semibold text-foreground",children:Y.chatbot_drag_drop_hint()||"Drop assets here"})]})}),z("div",{className:"flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0",children:L?J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.history()})}),z("button",{onClick:()=>p(!1),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:"Close History",children:z(e,{className:"h-4 w-4"})})]}):J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.shumai_agent()})}),J("div",{className:"flex items-center gap-1",children:[z("button",{onClick:Pz,className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.new_chat(),children:z(Gz,{className:"h-4 w-4"})}),z("button",{onClick:()=>p(!0),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.history(),children:z(h,{className:"h-4 w-4"})})]})]})}),L?z(S,{className:"flex-1 p-4 min-h-0",children:g.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground p-4 text-center",children:[z(h,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.no_history_sessions()})]}):z("div",{className:"space-y-2 pb-4",children:g.map((G)=>{let X=G.id===Wz;return J("div",{className:w("group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card",X?"border-primary":"border-border hover:bg-accent/30"),children:[J("div",{onClick:()=>W&&Nz(W,G.id),className:"flex-1 min-w-0 pr-6",children:[z("div",{className:"text-sm font-semibold text-foreground truncate",children:G.name||Y.new_chat()}),z("div",{className:"text-xs text-muted-foreground mt-0.5",children:Xz(G.createdAt)})]}),z("button",{onClick:(_)=>{if(_.stopPropagation(),W&&confirm(Y.delete_session_confirm()))Qz(W,G.id)},className:"absolute right-3 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted",title:"Delete Session",children:z(A,{className:"h-4 w-4"})})]},G.id)})})}):J(M,{children:[z(S,{ref:y,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:E.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[z(T,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.chatbot_drag_drop_hint()})]}):J("div",{className:"space-y-4 pb-4",children:[E.map(vz),D&&E.length>0&&E[E.length-1].role==="user"&&J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[z(t,{className:"h-3 w-3 animate-spin text-primary"}),z("span",{children:"Thinking..."})]}),z("div",{ref:x})]})}),z("div",{className:"p-2 flex-shrink-0 bg-background",children:J("div",{className:"relative flex flex-col w-full border border-foreground/20 rounded-2xl shadow-xs transition-all duration-200 focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent bg-background overflow-hidden",children:[u.length>0&&z("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border-b border-border bg-muted/5 p-3 divide-y divide-border/50",children:u.map((G)=>J("div",{className:"flex items-center justify-between py-1.5 text-xs group",children:[J("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[z("span",{className:"truncate font-medium text-foreground",children:G.name}),z("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:G.type})]}),z("button",{onClick:()=>Lz(G.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5",title:Y.remove_from_context(),children:z(A,{className:"h-3.5 w-3.5"})})]},G.id))}),z("textarea",{value:C,onChange:(G)=>l(G.target.value),onKeyDown:Cz,placeholder:"Type a message...",rows:2,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-hidden resize-none min-h-[44px] max-h-[120px] px-3 py-2 text-sm focus-visible:outline-hidden focus:ring-transparent focus:border-transparent focus-visible:ring-0",disabled:D}),J("div",{className:"flex justify-between items-center px-3 pb-2 pt-1",children:[z("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[70%]",children:H.length>0?J(_z,{value:F||"",onValueChange:(G)=>B(G),disabled:D,children:[z(Kz,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full",children:z($z,{placeholder:Y.select_agent()})}),z(Uz,{children:H.map((G)=>z(Vz,{value:G.id,children:J("div",{className:"flex items-center gap-2",children:[G.avatar?z("img",{src:G.avatar,alt:G.name,className:"w-4 h-4 rounded-full object-cover"}):z(T,{className:"w-4 h-4 text-muted-foreground"}),z("span",{className:"text-xs",children:G.name})]})},G.id))})]}):z("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:z("span",{children:Y.no_chat_agents_warning()})})}),D?z("button",{onClick:()=>{if(W)Dz(W)},className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5",title:"Stop generation",children:z("div",{className:"h-4 w-4 flex items-center justify-center",children:z("div",{className:"h-3 w-3 bg-current rounded-[2px] bg-white"})})}):z("button",{onClick:i,disabled:!C.trim()||!F,className:w("p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm",C.trim()&&F?"bg-primary text-primary-foreground hover:bg-primary/95 transform hover:-translate-y-0.5":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:z(s,{className:"h-4 w-4"})})]})]})})]})]})}
1
+ import{dg as v}from"./chunk-y2s0tjaa.js";import{eg as _z,fg as $z,gg as Kz,hg as Uz,ig as Vz}from"./chunk-yyjx8nbq.js";import{jg as I}from"./chunk-zye42cfp.js";import{_g as Yz}from"./chunk-7x1vkftb.js";import{bh as S}from"./chunk-ck6msfch.js";import{Ch as Zz}from"./chunk-2xgvs3as.js";import{mi as Xz}from"./chunk-02afmyqy.js";import{Ci as o,qi as n,ti as r}from"./chunk-8nyve0cr.js";import{Hj as e,Jj as s,Kl as Jz,Pl as w,Qj as T,Rj as zz,Vi as Mz,Wi as M,Wj as b,Xi as z,Yi as J,bl as Gz,mm as Y,wj as t,yk as h,yl as A}from"./chunk-kqpzx5az.js";import{kn as Bz}from"./chunk-p49h5fxs.js";var Z=Bz(Mz(),1);function gz({projectId:V,contextAssetId:R}){let{isHistoryMode:L,setIsHistoryMode:p,currentSessionId:Wz,chatAssets:u,removeAsset:Lz,messages:E,historySessions:g,isStreaming:D,fetchHistorySessions:m,loadSession:Nz,deleteSession:Qz,startNewSession:Pz,sendMessage:Oz,abortActiveSession:Dz,selectedAgentId:F,setSelectedAgentId:B,inputText:C,setInputText:l}=v(),{teamId:W,ensureTeamIdForProject:j}=Xz();Z.useEffect(()=>{if(V)j(V)},[V,j]);let{data:qz=[],isSuccess:d}=r({queryKey:["chat-agents",V],queryFn:async()=>{if(!V)return[];let G=await o.api.projects[":projectId"]["chat-agents"].$get({param:{projectId:V}});if(!G.ok)throw Error("failed to fetch agents");return G.json()},enabled:!!V}),H=qz.filter((G)=>G.type==="chat"&&G.enabled);Z.useEffect(()=>{if(!d)return;if(H.length>0){if(!H.some((X)=>X.id===F))B(H[0].id)}else if(F!==null)B(null)},[d,H,F,B]);let x=Z.useRef(null),y=Z.useRef(null),k=Z.useRef(!0),f=Z.useRef(!0);Z.useEffect(()=>{f.current=!0,k.current=!0},[V,R,L]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let{scrollTop:X,isAtBottom:_}=v.getState(),U=setTimeout(()=>{if(_)G.scrollTop=G.scrollHeight;else G.scrollTop=X;let P=setTimeout(()=>{f.current=!1},50);return()=>clearTimeout(P)},0);return()=>clearTimeout(U)},[V,R,L]),Z.useEffect(()=>{let G=y.current?.querySelector('[data-slot="scroll-area-viewport"]');if(!G)return;let X=()=>{if(f.current)return;let _=G.scrollTop,U=G.scrollHeight-_-G.clientHeight<10;v.getState().setScrollState(_,U)};return G.addEventListener("scroll",X),()=>{G.removeEventListener("scroll",X)}},[V,R,L]);let{ref:Ez,isDropTarget:Fz}=Yz({id:"chatbot-sidebar",data:{type:"chatbot-sidebar"}});Z.useEffect(()=>{if(!L){let{isAtBottom:G}=v.getState();if(G||D){let X=k.current?"auto":"smooth";x.current?.scrollIntoView({behavior:X})}k.current=!1}},[E,D,L]),Z.useEffect(()=>{if(L&&W)m(W)},[L,m,W]);let q=n(),Hz=Z.useCallback(()=>{q.invalidateQueries({queryKey:["search"]}),q.invalidateQueries({queryKey:["folders"]}),q.invalidateQueries({queryKey:["files"]}),q.invalidateQueries({queryKey:["file"]}),q.invalidateQueries({queryKey:["version_stacks"]}),q.invalidateQueries({queryKey:["projects"]})},[q]),i=()=>{if(!C.trim()||D||!W)return;Oz(W,C,V,R,Hz),l("")},Cz=(G)=>{if(G.nativeEvent.isComposing)return;if(G.key==="Enter"&&!G.shiftKey)G.preventDefault(),i()},a=(G)=>{if(typeof G==="string")return G;if(Array.isArray(G))return G.map((X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"&&"type"in X&&X.type==="text"&&"text"in X)return String(X.text);return""}).join("");return""},c=(G)=>{return G.replace(/<@([a-zA-Z0-9_-]+)>/g,"@$1").replace(/^\[([^\]]+)\]:/gm,"\\[$1\\]:")},vz=(G)=>{switch(G.role){case"user":return z("div",{className:"flex justify-end w-full",children:z("div",{className:"bg-primary text-primary-foreground rounded-lg px-3 py-2 max-w-[85%] text-sm whitespace-pre-wrap shadow-xs break-words",children:a(G.content)})},G.id);case"assistant":{let _=G.content;if(!_)return null;let U=[];if(_.forEach(($,N)=>{if(!$||typeof $!=="object")return;let Q=$;switch(Q.type){case"text":{let K=Q.text;if(typeof K!=="string"||!K.trim())return;U.push(z("div",{className:"text-sm leading-[1.8] prose prose-sm dark:prose-invert max-w-none break-words",children:z(I,{components:{pre:({node:O,...Rz})=>z("pre",{className:"whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm",...Rz})},children:c(K)})},`txt-${N}`));break}case"thinking":{let K=Q.thinking;if(typeof K!=="string"||!K.trim())return;U.push(J("details",{className:"group border border-border/50 rounded-lg bg-muted/20 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-medium text-muted-foreground select-none cursor-pointer hover:bg-muted/40 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(zz,{className:"h-3.5 w-3.5 text-primary/70 animate-pulse"}),z("span",{children:Y.role_thinking()||"Thinking"}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),z("div",{className:"p-3 pt-0 text-xs text-muted-foreground/90 border-t border-border/40 bg-muted/10 leading-relaxed prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-sans",children:z(I,{children:c(K)})})]},`think-${N}`));break}case"toolCall":{let K=String(Q.name||Q.toolName||Y.unknown()),O=Q.arguments||Q.args;U.push(J("details",{className:"group border border-border/50 rounded-lg bg-violet-500/5 my-2 overflow-hidden",children:[J("summary",{className:"flex items-center gap-2 p-2.5 text-xs font-semibold text-violet-600 dark:text-violet-400 select-none cursor-pointer hover:bg-violet-500/10 transition-colors list-none [&::-webkit-details-marker]:hidden",children:[z(Jz,{className:"h-3.5 w-3.5"}),z("span",{children:Y.calling_tool()}),z("span",{className:"font-mono bg-violet-500/10 px-1.5 py-0.5 rounded text-[11px] text-violet-700 dark:text-violet-300",children:K}),z(b,{className:"h-3 w-3 ml-auto transition-transform group-open:rotate-180"})]}),!!O&&J("div",{className:"p-3 pt-0 text-[10px] text-muted-foreground/90 border-t border-border/40 bg-violet-500/5 font-sans",children:[z("div",{className:"text-[9px] text-muted-foreground/60 uppercase font-bold tracking-wider mb-1.5",children:Y.tool_arguments()||"Arguments"}),z("pre",{className:"font-mono bg-muted/30 p-2 rounded border border-border/30 overflow-x-auto max-h-32",children:JSON.stringify(O,null,2)})]})]},`tool-${N}`));break}case"image":{let K=String(Q.mimeType||"image/png"),O=String(Q.data||"");U.push(z("div",{className:"my-2 max-w-full",children:O?z("img",{src:O.startsWith("data:")?O:`data:${K};base64,${O}`,alt:"Attached asset",className:"max-h-60 rounded border border-border/50 object-contain shadow-xs"}):z("div",{className:"text-xs text-muted-foreground italic flex items-center gap-1.5 py-1",children:Y.image_object()})},`img-${N}`));break}default:{let K=JSON.stringify($,null,2);if(K==="{}")return;U.push(z("pre",{className:"text-xs text-foreground/80 font-mono whitespace-pre-wrap break-words bg-muted/20 p-2 rounded",children:K},`other-${N}`))}}}),U.length===0)return null;let P=!1;if(_.length>0){let $=_[_.length-1];if(typeof $==="string"&&$.trim().length>0)P=!0;else if($&&typeof $==="object"){let N=$;if(N.type==="text"&&typeof N.text==="string"&&N.text.trim().length>0)P=!0}}return J("div",{className:"flex flex-col w-full space-y-1",children:[z("div",{className:"space-y-2 w-full",children:U}),P&&z("div",{className:"text-[10px] text-muted-foreground self-start italic pt-1",children:Y.created_by_agent()})]},G.id)}case"toolResult":return z("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/40 p-2 rounded-md border border-border/50",children:z("span",{className:"font-semibold",children:Y.tool_result_with_name({name:G.toolName||"tool"})})},G.id);case"thinking_level_change":case"custom":{let X=G;if(X.customType==="context_display_info"){let P=X.details?.assets||[];if(P.length===0)return null;return J("div",{className:"text-xs text-muted-foreground bg-muted/40 p-2.5 rounded-lg border border-border/50 space-y-1 my-1",children:[z("div",{className:"font-semibold",children:Y.assets_added_to_context()}),z("ul",{className:"list-disc list-inside space-y-0.5",children:P.map(($)=>J("li",{className:"truncate",children:[$.name," ",J("span",{className:"text-muted-foreground/70",children:["(",$.type,")"]})]},$.id))})]},G.id)}let _=X.content||"";return z("div",{className:"text-center text-xs text-muted-foreground italic bg-muted/20 py-1.5 rounded",children:a(_)},G.id)}default:return null}};return J("div",{ref:Ez,className:w("relative flex flex-col h-full bg-background transition-colors duration-200 min-h-0"),children:[Fz&&z("div",{className:"absolute inset-0 bg-accent/30 border-2 border-primary z-50 pointer-events-none flex items-center justify-center p-6 text-center animate-in fade-in duration-150",children:J("div",{className:"bg-background/95 text-foreground px-4 py-3 rounded-xl border border-border/80 flex flex-col items-center gap-2 shadow-lg max-w-[80%] animate-in zoom-in-95 duration-150",children:[z(T,{className:"h-6 w-6 text-primary animate-bounce"}),z("span",{className:"text-sm font-semibold text-foreground",children:Y.chatbot_drag_drop_hint()||"Drop assets here"})]})}),z("div",{className:"flex items-center justify-between p-4 pt-[0.7rem] flex-shrink-0",children:L?J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.history()})}),z("button",{onClick:()=>p(!1),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:"Close History",children:z(e,{className:"h-4 w-4"})})]}):J(M,{children:[z("div",{className:"flex items-center gap-2 font-semibold",children:z("span",{children:Y.shumai_agent()})}),J("div",{className:"flex items-center gap-1",children:[z("button",{onClick:Pz,className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.new_chat(),children:z(Gz,{className:"h-4 w-4"})}),z("button",{onClick:()=>p(!0),className:"p-1.5 hover:bg-accent rounded-md text-muted-foreground hover:text-foreground transition-colors",title:Y.history(),children:z(h,{className:"h-4 w-4"})})]})]})}),L?z(S,{className:"flex-1 p-4 min-h-0",children:g.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 text-muted-foreground p-4 text-center",children:[z(h,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.no_history_sessions()})]}):z("div",{className:"space-y-2 pb-4",children:g.map((G)=>{let X=G.id===Wz;return J("div",{className:w("group relative flex items-center justify-between p-3 border rounded-lg transition-all cursor-pointer bg-card",X?"border-primary":"border-border hover:bg-accent/30"),children:[J("div",{onClick:()=>W&&Nz(W,G.id),className:"flex-1 min-w-0 pr-6",children:[z("div",{className:"text-sm font-semibold text-foreground truncate",children:G.name||Y.new_chat()}),z("div",{className:"text-xs text-muted-foreground mt-0.5",children:Zz(G.createdAt)})]}),z("button",{onClick:(_)=>{if(_.stopPropagation(),W&&confirm(Y.delete_session_confirm()))Qz(W,G.id)},className:"absolute right-3 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity text-muted-foreground hover:text-destructive p-1 rounded hover:bg-muted",title:"Delete Session",children:z(A,{className:"h-4 w-4"})})]},G.id)})})}):J(M,{children:[z(S,{ref:y,className:"flex-1 p-4 min-h-0 [&>div>div]:!block",children:E.length===0?J("div",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-border rounded-lg text-muted-foreground p-4 text-center",children:[z(T,{className:"h-8 w-8 mb-2 opacity-50 text-muted-foreground"}),z("p",{className:"text-sm",children:Y.chatbot_drag_drop_hint()})]}):J("div",{className:"space-y-4 pb-4",children:[E.map(vz),D&&E.length>0&&E[E.length-1].role==="user"&&J("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground italic",children:[z(t,{className:"h-3 w-3 animate-spin text-primary"}),z("span",{children:"Thinking..."})]}),z("div",{ref:x})]})}),z("div",{className:"p-2 flex-shrink-0 bg-background",children:J("div",{className:"relative flex flex-col w-full border border-foreground/20 rounded-2xl shadow-xs transition-all duration-200 focus-within:ring-2 focus-within:ring-primary focus-within:border-transparent bg-background overflow-hidden",children:[u.length>0&&z("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border-b border-border bg-muted/5 p-3 divide-y divide-border/50",children:u.map((G)=>J("div",{className:"flex items-center justify-between py-1.5 text-xs group",children:[J("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[z("span",{className:"truncate font-medium text-foreground",children:G.name}),z("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:G.type})]}),z("button",{onClick:()=>Lz(G.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5",title:Y.remove_from_context(),children:z(A,{className:"h-3.5 w-3.5"})})]},G.id))}),z("textarea",{value:C,onChange:(G)=>l(G.target.value),onKeyDown:Cz,placeholder:"Type a message...",rows:2,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-hidden resize-none min-h-[44px] max-h-[120px] px-3 py-2 text-sm focus-visible:outline-hidden focus:ring-transparent focus:border-transparent focus-visible:ring-0",disabled:D}),J("div",{className:"flex justify-between items-center px-3 pb-2 pt-1",children:[z("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[70%]",children:H.length>0?J(_z,{value:F||"",onValueChange:(G)=>B(G),disabled:D,children:[z(Kz,{className:"h-8 border-none bg-transparent hover:bg-muted text-muted-foreground hover:text-foreground focus:ring-0 focus:ring-offset-0 px-2 py-0 gap-1.5 text-xs shrink-0 select-none shadow-none max-w-full",children:z($z,{placeholder:Y.select_agent()})}),z(Uz,{children:H.map((G)=>z(Vz,{value:G.id,children:J("div",{className:"flex items-center gap-2",children:[G.avatar?z("img",{src:G.avatar,alt:G.name,className:"w-4 h-4 rounded-full object-cover"}):z(T,{className:"w-4 h-4 text-muted-foreground"}),z("span",{className:"text-xs",children:G.name})]})},G.id))})]}):z("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[11px] text-muted-foreground/60 italic select-none",children:z("span",{children:Y.no_chat_agents_warning()})})}),D?z("button",{onClick:()=>{if(W)Dz(W)},className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5",title:"Stop generation",children:z("div",{className:"h-4 w-4 flex items-center justify-center",children:z("div",{className:"h-3 w-3 bg-current rounded-[2px] bg-white"})})}):z("button",{onClick:i,disabled:!C.trim()||!F,className:w("p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm",C.trim()&&F?"bg-primary text-primary-foreground hover:bg-primary/95 transform hover:-translate-y-0.5":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:z(s,{className:"h-4 w-4"})})]})]})})]})]})}
2
2
  export{gz as h};
@@ -0,0 +1,2 @@
1
+ import{$e as o0}from"./chunk-ex2ym5pz.js";import{af as $b}from"./chunk-34kaja59.js";import{Af as Sb,Bf as rb,Cf as u0,Df as I0}from"./chunk-r2shjtte.js";import{Jf as Q0,Kf as Pb}from"./chunk-ns804tmv.js";import{Mf as l0,Nf as i0,Of as x0,Pf as Q,Qf as x,Rf as m,ag as Gb,bg as t0}from"./chunk-2xevs82j.js";import{eg as H0,fg as W0,gg as y0,hg as J0,ig as I}from"./chunk-yyjx8nbq.js";import{jg as Rb}from"./chunk-zye42cfp.js";import{kg as bb}from"./chunk-dk8vk17v.js";import{ah as p0}from"./chunk-7x1vkftb.js";import{bh as u}from"./chunk-ck6msfch.js";import{eh as a0}from"./chunk-tcm57j8r.js";import{Xh as S0}from"./chunk-9cmvymm5.js";import{Yh as Yb}from"./chunk-6m1k317a.js";import{$h as z0,Zh as Z0,_h as f0}from"./chunk-kxr8fjsq.js";import{ai as Jb,ci as Zb,di as fb,ei as zb}from"./chunk-02afmyqy.js";import{Ci as R,Di as Xb,Ei as Ub,Fi as Db,Gi as Vb,Hi as Ob,Ii as qb,Ji as Bb,Ki as Qb,Li as V0,Ni as O0,Oi as q0,Pi as h0,Qi as B0,Si as c,qi as R0,ti as S,vi as _0,wi as r0}from"./chunk-8nyve0cr.js";import{Ui as d}from"./chunk-62ebss6h.js";import{Gk as m0,Jj as Lb,Ll as U0,Pl as j,Qj as L0,Tk as gb,Vi as Y0,Vj as M0,Wi as w0,Xi as b,Yi as N,Zk as Mb,bl as g0,hk as k0,jk as A0,jm as r,kk as C0,kl as d0,lk as e0,mm as K,nm as P0,qk as a,uj as Wb,vl as Kb,wj as h,yl as yb,zk as vb}from"./chunk-kqpzx5az.js";import{kn as $0}from"./chunk-p49h5fxs.js";var db=[Q.TODO,Q.READY,Q.IN_PROGRESS,Q.BLOCKED,Q.IN_REVIEW,Q.DONE];function K0(_){switch(_){case Q.TODO:return K.status_todo();case Q.READY:return K.status_ready();case Q.IN_PROGRESS:return K.status_in_progress();case Q.BLOCKED:return K.status_blocked();case Q.IN_REVIEW:return K.status_in_review();case Q.DONE:return K.status_done();default:return _}}function ub(_){switch(_){case Q.TODO:return{badge:"bg-muted text-muted-foreground border-border",border:"border-border",dot:"bg-muted-foreground",bg:"bg-muted/30"};case Q.READY:return{badge:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",border:"border-blue-500/30",dot:"bg-blue-500",bg:"bg-blue-500/5"};case Q.IN_PROGRESS:return{badge:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",border:"border-amber-500/30",dot:"bg-amber-500",bg:"bg-amber-500/5"};case Q.BLOCKED:return{badge:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",border:"border-red-500/30",dot:"bg-red-500",bg:"bg-red-500/5"};case Q.IN_REVIEW:return{badge:"bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20",border:"border-purple-500/30",dot:"bg-purple-500",bg:"bg-purple-500/5"};case Q.DONE:return{badge:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",border:"border-emerald-500/30",dot:"bg-emerald-500",bg:"bg-emerald-500/5"}}}function T0(_){return ub(_).badge}function c0(_){switch(_){case x.LOW:return K.priority_low();case x.MEDIUM:return K.priority_medium();case x.HIGH:return K.priority_high();case x.URGENT:return K.priority_urgent();default:return _}}function n0(_){switch(_){case x.LOW:return"bg-muted text-muted-foreground border-border";case x.MEDIUM:return"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20";case x.HIGH:return"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20";case x.URGENT:return"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20 font-semibold";default:return"bg-muted text-muted-foreground border-border"}}var X0=$0(Y0(),1);var G0=$0(Y0(),1);var Ib=[Q.TODO,Q.READY,Q.IN_PROGRESS,Q.IN_REVIEW,Q.DONE,Q.BLOCKED];function j0({teamId:_,currentTaskId:G,excludeTaskIds:Y=[],value:Z=[],knownTasks:O=[],onChange:D,disabled:X=!1,canEdit:L=!0,className:y}){let[U,T]=G0.useState(!1),[P,v]=G0.useState(Q.TODO),[W,f]=G0.useState(""),[p,z]=G0.useState(()=>{let H={};for(let q of O)H[q.id]={title:q.title,status:q.status};return H}),{data:w,isLoading:E0}=S({queryKey:["teams",_,"kanban","tasks","status",P],queryFn:async()=>{let H=await R.api.teams[":teamId"].kanban.tasks.$get({param:{teamId:_},query:{status:P,first:"100"}});if(!H.ok)return{data:[]};return await H.json()},enabled:!!_&&U}),k=w?.data||[];G0.useMemo(()=>{if(k.length>0)z((H)=>{let q=!1,A={...H};for(let o of k)if(!A[o.id]||A[o.id].title!==o.title||A[o.id].status!==o.status)A[o.id]={title:o.title,status:o.status},q=!0;return q?A:H})},[k]);let F=G0.useMemo(()=>{let H=new Set(Y);if(G)H.add(G);return H},[G,Y]),l=G0.useMemo(()=>{let H=W.trim().toLowerCase();return k.filter((q)=>{if(F.has(q.id))return!1;if(!H)return!0;return q.title.toLowerCase().includes(H)})},[k,F,W]),i=(H)=>{if(!L||X)return;let A=Z.includes(H)?Z.filter((o)=>o!==H):[...Z,H];D?.(A)},E=(H,q)=>{if(q.stopPropagation(),!L||X)return;D?.(Z.filter((A)=>A!==H))},V=L&&!X;return N(l0,{open:U&&V,onOpenChange:(H)=>V&&T(H),children:[b(i0,{asChild:!0,children:b("div",{role:"button",tabIndex:V?0:-1,className:j("w-full min-h-[36px] px-2.5 py-1.5 flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background text-xs transition-colors",V?"cursor-pointer hover:border-ring/60 focus:outline-none focus:ring-2 focus:ring-ring/50":"cursor-not-allowed opacity-70",y),children:Z.length===0?N("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[b(m0,{className:"w-3.5 h-3.5 text-muted-foreground/70"}),b("span",{children:K.select_parent_tasks()})]}):Z.map((H)=>{let q=p[H];return N("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] bg-muted text-foreground border border-border/80 shrink-0 max-w-[220px]",children:[q?.status&&b("span",{className:j("px-1 py-0.2 rounded text-[9px] uppercase font-semibold shrink-0",T0(q.status)),children:K0(q.status)}),b("span",{className:"truncate font-medium",children:q?.title||H}),V&&b("button",{type:"button",onClick:(A)=>E(H,A),className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 -mr-1",children:b(U0,{className:"w-3 h-3"})})]},H)})})}),N(x0,{align:"start",sideOffset:4,className:"w-[var(--radix-popover-trigger-width)] min-w-[320px] sm:min-w-[420px] max-w-[500px] p-2.5 space-y-2 bg-popover border border-border rounded-lg shadow-lg",children:[b("div",{className:"flex flex-wrap gap-1.5 pb-0.5",children:Ib.map((H)=>{return b("button",{type:"button",onClick:()=>v(H),className:j("text-[11px] h-7 px-2.5 rounded-md font-medium transition-colors border shrink-0",P===H?"bg-primary text-primary-foreground border-primary shadow-xs":"bg-muted/50 hover:bg-accent text-muted-foreground hover:text-foreground border-border/60"),children:K0(H)},H)})}),N("div",{className:"relative",children:[b(d0,{className:"w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),b(P0,{value:W,onChange:(H)=>f(H.target.value),placeholder:K.filter_tasks_placeholder(),className:"h-8 pl-8 text-xs bg-muted/40",autoFocus:!0})]}),b("div",{className:"border rounded-md overflow-hidden bg-background/50",children:b(u,{className:"h-48 p-1",children:E0?b("div",{className:"flex items-center justify-center py-8",children:b(h,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):l.length===0?b("div",{className:"py-8 text-center text-xs text-muted-foreground italic",children:K.no_matching_tasks()}):b("div",{className:"space-y-1",children:l.map((H)=>{let q=Z.includes(H.id);return N("div",{onClick:()=>i(H.id),className:j("flex items-center justify-between p-2 rounded-md hover:bg-accent cursor-pointer transition-colors text-xs border border-transparent",q&&"bg-accent/50 border-border/50"),children:[N("div",{className:"flex items-center gap-2 min-w-0 flex-1 pr-2",children:[b("div",{className:j("w-4 h-4 rounded border flex items-center justify-center shrink-0 transition-colors",q?"bg-primary border-primary text-primary-foreground":"border-input bg-background"),children:q&&b(M0,{className:"w-3 h-3 stroke-[3]"})}),b("span",{className:j("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium shrink-0",T0(H.status)),children:K0(H.status)}),b("span",{className:"font-medium text-foreground truncate",children:H.title})]}),H.assignee&&b("span",{className:"text-[10px] text-muted-foreground truncate shrink-0",children:H.assignee.name})]},H.id)})})})})]})]})}var Nb=$0(Y0(),1);var D0=$0(Y0(),1);function s0({teamId:_,initialProjectId:G,excludeAssetIds:Y=[],isOpen:Z,onClose:O,onConfirm:D}){let[X,L]=D0.useState(G||""),[y,U]=D0.useState(null),[T,P]=D0.useState(new Map),{data:v,isLoading:W}=S({queryKey:["teams",_,"projects"],queryFn:async()=>{let $=await R.api.teams[":teamId"].projects.$get({param:{teamId:_},query:{first:"100"}});if(!$.ok)throw Error("Failed to fetch projects");return await $.json()},enabled:!!_&&Z}),f=v?.data||[],p=X||(f[0]?.id??""),z=f.find(($)=>$.id===p),w=y?.id||z?.rootFolder||"",E0=w===z?.rootFolder,{data:k,fetchNextPage:F,hasNextPage:l,isFetchingNextPage:i,isLoading:E}=r0({queryKey:["folders",w,"children","folder","picker"],queryFn:async({pageParam:$})=>{let g=await R.api.folders[":folderId"].children.$get({param:{folderId:w},query:{assetType:"folder",after:$,first:"20"}});if(!g.ok)throw Error("Failed to fetch folders");return await g.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo?.cursor||void 0,enabled:!!w&&Z}),{data:V,fetchNextPage:H,hasNextPage:q,isFetchingNextPage:A,isLoading:o}=r0({queryKey:["folders",w,"children","file","picker"],queryFn:async({pageParam:$})=>{let g=await R.api.folders[":folderId"].children.$get({param:{folderId:w},query:{assetType:"file",after:$,first:"20"}});if(!g.ok)throw Error("Failed to fetch files");return await g.json()},initialPageParam:"",getNextPageParam:($)=>$.pageInfo?.cursor||void 0,enabled:!!w&&Z}),{ref:J,inView:B}=a0();D0.useEffect(()=>{if(B){if(l&&!i)F();else if(q&&!A)H()}},[B,l,i,F,q,A,H]);let t=E&&!k||o&&!V,C=i||A,M=D0.useMemo(()=>{let $=k?.pages.flatMap((N0)=>N0.data??[])??[],g=V?.pages.flatMap((N0)=>N0.data??[])??[];return[...$,...g]},[k,V]),s=($)=>{let g=new Map(T);if(g.has($.id))g.delete($.id);else{let N0=z?`/${[z.name,...($.ancestorFolders||[]).map((v0)=>v0.name)].filter(Boolean).join("/")}`:"/";g.set($.id,{id:$.id,name:$.name,type:$.type,proxyType:$.proxyType??null,thumbnailUrl:$.preview?.thumbnailUrl??null,path:N0,creator:$.creator?{id:$.creator.id,name:$.creator.name,image:$.creator.image??void 0}:null,sizeByte:$.sizeByte??0,fileCount:$.fileCount??null,projectId:$.projectId??z?.id??null,createdAt:$.createdAt??new Date().toISOString()})}P(g)},e=()=>{if(!y||E0)return;let $=new Map(T);if($.has(y.id))$.delete(y.id);else{let g=z?`/${[z.name,...(y.ancestorFolders||[]).map((N0)=>N0.name)].filter(Boolean).join("/")}`:"/";$.set(y.id,{id:y.id,name:y.name,type:"folder",proxyType:null,thumbnailUrl:null,path:g,creator:y.creator?{id:y.creator.id,name:y.creator.name,image:y.creator.image??void 0}:null,sizeByte:y.sizeByte??0,fileCount:y.fileCount??null,projectId:y.projectId??z?.id??null,createdAt:y.createdAt??new Date().toISOString()})}P($)},b0=()=>{D(Array.from(T.values())),O()};return b(V0,{open:Z,onOpenChange:($)=>{if(!$)O()},children:N(O0,{className:"sm:max-w-4xl flex flex-col h-[650px] p-0 overflow-hidden gap-1",children:[b(q0,{className:"px-4 py-3 border-b shrink-0",children:N("div",{className:"flex items-center gap-2",children:[b(a,{className:"w-5 h-5 text-primary"}),b(B0,{children:K.select_assets()})]})}),N("div",{className:"flex items-center gap-2.5 px-4 py-1.5 border-b bg-transparent shrink-0",children:[N("span",{className:"text-xs font-medium text-muted-foreground whitespace-nowrap",children:[K.current_project_label(),":"]}),b("div",{className:"w-64",children:N(H0,{value:p,onValueChange:($)=>{L($),U(null)},children:[b(y0,{className:"h-8 text-xs bg-background",children:b(W0,{placeholder:K.select_project()})}),b(J0,{children:f.map(($)=>b(I,{value:$.id,className:"text-xs",children:$.name},$.id))})]})})]}),N("div",{className:"flex-1 min-h-0 flex overflow-hidden",children:[b("div",{className:"w-1/3 min-h-0 border-r bg-sidebar/30 flex flex-col overflow-hidden",children:b(u,{className:"flex-1 min-h-0 [&>div>div]:block!",children:z&&z.rootFolder?b("div",{className:"p-2",children:b(p0,{teamId:_,projectId:z.id,projectName:z.name,rootFolderId:z.rootFolder,onSelect:($)=>U($),selectedFolderId:w,hideCollections:!0,hideShares:!0,hideRecentlyDeleted:!0})}):b("div",{className:"flex items-center justify-center h-full p-6 text-xs text-muted-foreground",children:W?b(h,{className:"w-5 h-5 animate-spin text-muted-foreground"}):K.no_project_selected()})})}),N("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden bg-background",children:[N("div",{className:"p-2.5 px-4 border-b flex items-center justify-between bg-muted/20 shrink-0",children:[N("div",{className:"flex items-center gap-2 text-xs font-medium truncate",children:[b(a,{className:"w-4 h-4 text-muted-foreground shrink-0"}),b("span",{className:"truncate",children:y?y.name:z?.name||""}),E0&&b("span",{className:"text-[10px] text-muted-foreground/70 bg-muted px-1.5 py-0.5 rounded",children:"Root"})]}),!E0&&y&&b(r,{size:"sm",variant:T.has(y.id)?"secondary":"outline",className:"h-7 text-xs gap-1.5",onClick:e,disabled:Y.includes(y.id),children:T.has(y.id)?N(w0,{children:[b(M0,{className:"w-3.5 h-3.5 text-primary"}),K.saved()]}):N(w0,{children:[b(g0,{className:"w-3.5 h-3.5"}),K.select_current_folder()]})})]}),b(u,{className:"flex-1 min-h-0 [&>div>div]:block!",children:t?b("div",{className:"flex items-center justify-center p-12",children:b(h,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):M.length===0?N("div",{className:"flex flex-col items-center justify-center p-12 text-center text-xs text-muted-foreground gap-2",children:[b(a,{className:"w-8 h-8 opacity-30"}),b("p",{children:K.no_assets_in_folder()})]}):N("div",{className:"divide-y divide-border/40",children:[M.map(($)=>{let g=Y.includes($.id),N0=T.has($.id),v0=$.type==="folder";return N("div",{onClick:()=>{if(!g)s($)},className:`flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 cursor-pointer transition-colors ${N0?"bg-primary/5":""} ${g?"opacity-50 cursor-not-allowed":""}`,children:[b(t0,{checked:N0,disabled:g,onCheckedChange:()=>{if(!g)s($)},onClick:(kb)=>kb.stopPropagation()}),b("div",{className:"w-9 h-9 rounded bg-muted/60 border shrink-0 flex items-center justify-center overflow-hidden",children:$.preview?.thumbnailUrl?b("img",{src:$.preview.thumbnailUrl,alt:$.name,className:"w-full h-full object-cover"}):v0?b(a,{className:"w-5 h-5 text-primary fill-primary/20"}):b(C0,{className:"w-5 h-5 text-muted-foreground"})}),N("div",{className:"flex-1 min-w-0",children:[b("p",{className:"text-xs font-medium truncate text-foreground",children:$.name}),N("p",{className:"text-[11px] text-muted-foreground truncate",children:[v0?`${$.fileCount??0} items`:Q0($.sizeByte||0),$.creator?.name?` • ${$.creator.name}`:""]})]})]},$.id)}),b("div",{ref:J,className:"h-1"}),C&&b("div",{className:"flex items-center justify-center p-3",children:b(h,{className:"w-4 h-4 animate-spin text-muted-foreground"})})]})})]})]}),N(h0,{className:"p-3 px-4 border-t flex items-center justify-between sm:justify-between bg-muted/10 shrink-0",children:[b("div",{className:"text-xs text-muted-foreground",children:T.size>0&&K.n_assets_selected({count:T.size})}),N("div",{className:"flex items-center gap-2",children:[b(r,{variant:"outline",size:"sm",onClick:O,children:K.cancel()}),b(r,{size:"sm",onClick:b0,disabled:T.size===0,children:K.add_assets()})]})]})]})})}function _b({teamId:_,projectId:G,assets:Y,onAddAssets:Z,onRemoveAsset:O,disabled:D=!1}){let[X,L]=Nb.useState(!1),y=(U)=>{let T=new Set(Y.map((v)=>v.id)),P=U.filter((v)=>!T.has(v.id));if(P.length>0)Z(P)};return N("div",{className:"space-y-2",children:[N("div",{className:"flex items-center justify-between",children:[N("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-foreground",children:[b(e0,{className:"w-3.5 h-3.5 text-muted-foreground"}),b("span",{children:K.related_assets()}),Y.length>0&&N("span",{className:"text-[11px] text-muted-foreground font-normal",children:["(",Y.length,")"]})]}),!D&&b(r,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-muted",onClick:()=>L(!0),title:K.add_assets(),children:b(g0,{className:"w-3.5 h-3.5"})})]}),b(bb,{}),Y.length===0?b("p",{className:"text-xs text-muted-foreground/70 py-1 italic",children:K.no_related_assets()}):b("div",{className:"space-y-1.5 max-h-48 overflow-y-auto pr-1",children:Y.map((U)=>{let T=U.type==="folder";return N("div",{className:"flex items-center justify-between gap-2 p-1.5 px-2 rounded-md bg-muted/40 hover:bg-muted/70 transition-colors text-xs border border-border/40",children:[N("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[b("div",{className:"w-7 h-7 rounded bg-muted border shrink-0 flex items-center justify-center overflow-hidden",children:U.thumbnailUrl?b("img",{src:U.thumbnailUrl,alt:U.name,className:"w-full h-full object-cover"}):T?b(a,{className:"w-4 h-4 text-primary fill-primary/20"}):b(C0,{className:"w-4 h-4 text-muted-foreground"})}),N("div",{className:"flex-1 min-w-0",children:[b("p",{className:"font-medium truncate text-foreground leading-snug",children:U.name}),b("p",{className:"text-[10px] text-muted-foreground truncate leading-none mt-0.5",children:U.path||"/"})]})]}),N("div",{className:"flex items-center gap-2 shrink-0",children:[U.creator&&N("div",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",title:U.creator.name,children:[N(Z0,{className:"w-4 h-4 text-[9px]",children:[b(f0,{src:U.creator.image||void 0}),b(z0,{children:U.creator.name.slice(0,1).toUpperCase()})]}),b("span",{className:"hidden sm:inline text-[11px] max-w-[80px] truncate",children:U.creator.name})]}),!D&&b(r,{type:"button",variant:"ghost",size:"sm",className:"h-5 w-5 p-0 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:()=>O(U.id),title:K.unlink_asset(),children:b(U0,{className:"w-3 h-3"})})]})]},U.id)})}),X&&b(s0,{teamId:_,initialProjectId:G,excludeAssetIds:Y.map((U)=>U.id),isOpen:X,onClose:()=>L(!1),onConfirm:y})]})}var F0=$0(Y0(),1);function Eb({teamId:_,currentProjectId:G,currentTargetFolderId:Y,isOpen:Z,onClose:O,onSelect:D}){let[X,L]=F0.useState(G||""),[y,U]=F0.useState(null),{data:T,isLoading:P}=S({queryKey:["teams",_,"projects"],queryFn:async()=>{let z=await R.api.teams[":teamId"].projects.$get({param:{teamId:_},query:{first:"100"}});if(!z.ok)throw Error("Failed to fetch projects");return await z.json()},enabled:!!_&&Z}),v=T?.data||[],W=X||(v[0]?.id??""),f=v.find((z)=>z.id===W),p=()=>{if(!W)return;let z=y?.id||f?.rootFolder;if(z)D(W,z,y?.name||f?.name),O()};return b(V0,{open:Z,onOpenChange:(z)=>!z&&O(),children:N(O0,{className:"sm:max-w-2xl flex flex-col h-[580px]",children:[b(q0,{children:N("div",{className:"flex items-center gap-2",children:[b(a,{className:"w-5 h-5 text-primary"}),b(B0,{children:K.select_target_folder()})]})}),N("div",{className:"flex flex-col gap-3 flex-1 overflow-hidden py-2",children:[N("div",{className:"space-y-1.5",children:[b("label",{className:"text-xs font-medium text-muted-foreground",children:K.select_project()}),N(H0,{value:W,onValueChange:(z)=>{L(z),U(null)},children:[b(y0,{className:"h-9",children:b(W0,{placeholder:K.select_project()})}),b(J0,{children:v.map((z)=>b(I,{value:z.id,children:z.name},z.id))})]})]}),N("div",{className:"space-y-1.5 flex-1 flex flex-col overflow-hidden",children:[b("label",{className:"text-xs font-medium text-muted-foreground",children:K.target_folder()}),b("div",{className:"border rounded-md flex-1 overflow-hidden bg-sidebar/50",children:b(u,{className:"h-full",children:f&&f.rootFolder?b(p0,{teamId:_,projectId:f.id,projectName:f.name,rootFolderId:f.rootFolder,onSelect:U,selectedFolderId:y?.id||Y||f.rootFolder,hideCollections:!0,hideShares:!0,hideRecentlyDeleted:!0}):b("div",{className:"flex items-center justify-center h-full p-6 text-xs text-muted-foreground",children:P?b(h,{className:"w-5 h-5 animate-spin text-muted-foreground"}):K.no_project_selected()})})})]})]}),N(h0,{children:[b(r,{variant:"outline",onClick:O,children:K.cancel()}),b(r,{onClick:p,disabled:!W,children:K.confirm()})]})]})})}function Hb({teamId:_,task:G,canEdit:Y=!0}){let Z=R0(),[O,D]=X0.useState(G.title),[X,L]=X0.useState(G.description||""),[y,U]=X0.useState(!1),[T,P]=X0.useState(null),v=X0.useRef(null);X0.useEffect(()=>{D(G.title),L(G.description||"")},[G.id,G.title,G.description]);let{data:W=[]}=S({queryKey:["teams",_,"members","human"],queryFn:async()=>{let E=await R.api.teams[":teamId"].members.$get({param:{teamId:_},query:{includeAgents:"false"}});if(!E.ok)return[];let V=await E.json();return Array.isArray(V)?V:[]},enabled:!!_}),{data:f=[]}=S({queryKey:["teams",_,"agents"],queryFn:async()=>{let E=await R.api.teams[":teamId"].agents.$get({param:{teamId:_}});if(!E.ok)return[];return await E.json()||[]},enabled:!!_}),{data:p}=S({queryKey:["teams",_,"kanban","goals"],queryFn:async()=>{let E=await R.api.teams[":teamId"].kanban.goals.$get({param:{teamId:_},query:{}});if(!E.ok)return{data:[]};return await E.json()},enabled:!!_}),z=p?.data||[],{mutate:w,isPending:E0}=_0({mutationFn:async(E)=>{let V=await R.api.teams[":teamId"].kanban.tasks[":taskId"].$patch({param:{teamId:_,taskId:G.id},json:E});if(!V.ok){let H=await V.json().catch(()=>({message:K.error()}));throw Error(H.message||K.error())}return await V.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G.id]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]})},onError:(E)=>{c.error(E.message)}}),{mutate:k}=_0({mutationFn:async(E)=>{let V=await R.api.teams[":teamId"].kanban.tasks[":taskId"].assets.$post({param:{teamId:_,taskId:G.id},json:{assetIds:E.map((H)=>H.id)}});if(!V.ok)throw Error("Failed to link assets");return await V.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G.id]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]}),c.success(K.asset_linked())},onError:(E)=>{c.error(E.message)}}),{mutate:F}=_0({mutationFn:async(E)=>{let V=await R.api.teams[":teamId"].kanban.tasks[":taskId"].assets[":assetId"].$delete({param:{teamId:_,taskId:G.id,assetId:E}});if(!V.ok)throw Error("Failed to unlink asset");return await V.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G.id]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]}),c.success(K.asset_unlinked())},onError:(E)=>{c.error(E.message)}}),l=(E,V)=>{if(E==="title")D(V);if(E==="description")L(V);if(v.current)clearTimeout(v.current);v.current=setTimeout(()=>{if(E==="title"&&V.trim()&&V.trim()!==G.title)w({title:V.trim()});else if(E==="description"&&V!==(G.description||""))w({description:V.trim()||null})},600)},i=G.isAgentTask;return N(u,{className:"h-full p-5",children:[N("div",{className:"space-y-6 w-full pr-3",children:[N("div",{className:"space-y-1.5",children:[N("div",{className:"flex items-center justify-between",children:[b(d,{htmlFor:"task-title",className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:K.task_title()}),E0&&N("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground animate-pulse",children:[b(h,{className:"w-3 h-3 animate-spin"}),K.saving()]})]}),b(P0,{id:"task-title",value:O,onChange:(E)=>l("title",E.target.value),disabled:!Y,className:"text-base font-semibold h-10 bg-background",placeholder:K.task_title_placeholder()})]}),N("div",{className:"space-y-1.5",children:[b(d,{htmlFor:"task-description",className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:K.task_description()}),b($b,{id:"task-description",value:X,onChange:(E)=>l("description",E.target.value),disabled:!Y,rows:5,className:"text-xs leading-relaxed bg-background",placeholder:K.task_description_placeholder()})]}),N("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 p-4 rounded-lg bg-muted/20 border border-border/60",children:[N("div",{className:"sm:col-span-2 flex items-center justify-between space-x-2 rounded-md border border-border/60 bg-background/50 px-3 py-2 h-14",children:[N("div",{className:"space-y-0.5 min-w-0 pr-2",children:[N(d,{className:"text-xs font-medium text-muted-foreground flex items-center gap-1.5",children:[b(L0,{className:"w-3.5 h-3.5 text-orange-500"}),b("span",{children:K.task_type_agent()})]}),b("p",{className:"text-[11px] text-muted-foreground/80 line-clamp-1",children:K.task_type_agent_desc()})]}),b(Yb,{checked:G.isAgentTask,disabled:!0})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.task_priority()}),N(H0,{value:G.priority,onValueChange:(E)=>w({priority:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{})}),b(J0,{children:Object.values(x).map((E)=>b(I,{value:E,children:b("span",{className:j("px-1.5 py-0.5 rounded text-[10px] uppercase font-medium",n0(E)),children:c0(E)})},E))})]})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.goals()}),N(H0,{value:G.goal?.id||"none",onValueChange:(E)=>w({goalId:E==="none"?null:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{placeholder:K.no_folder_selected()})}),N(J0,{children:[b(I,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:"None"})}),z.filter((E)=>E.id!==Gb).map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[b(Kb,{className:"w-3.5 h-3.5 text-primary"}),b("span",{children:E.title})]})},E.id))]})]})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:i?K.select_agent():K.assignee()}),N(H0,{value:G.assignee?.id||"none",onValueChange:(E)=>w({assigneeId:E==="none"?null:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{placeholder:K.unassigned()})}),N(J0,{children:[b(I,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:K.unassigned()})}),i?f.map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[b(L0,{className:"w-3.5 h-3.5 text-purple-500"}),b("span",{children:E.name})]})},E.id)):W.map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[N(Z0,{size:"sm",className:"w-4 h-4",children:[b(f0,{src:E.image}),b(z0,{className:"text-[8px]",children:E.name.slice(0,2).toUpperCase()})]}),b("span",{children:E.name})]})},E.id))]})]})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.reporter()}),N(H0,{value:G.reporter?.id||"none",onValueChange:(E)=>w({reporterId:E==="none"?null:E}),disabled:!Y,children:[b(y0,{className:"w-full h-8 text-xs bg-background",children:b(W0,{placeholder:K.unassigned()})}),N(J0,{children:[b(I,{value:"none",children:b("span",{className:"text-muted-foreground italic",children:K.unassigned()})}),W.map((E)=>b(I,{value:E.id,children:N("div",{className:"flex items-center gap-2",children:[N(Z0,{size:"sm",className:"w-4 h-4",children:[b(f0,{src:E.image}),b(z0,{className:"text-[8px]",children:E.name.slice(0,2).toUpperCase()})]}),b("span",{children:E.name})]})},E.id))]})]})]}),i&&N("div",{className:"sm:col-span-2 space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.target_folder()}),b("div",{className:"flex items-center gap-2",children:N(r,{type:"button",variant:"outline",size:"sm",onClick:()=>U(!0),disabled:!Y,className:"w-full justify-start h-8 text-xs bg-background truncate font-normal",children:[b(a,{className:"w-3.5 h-3.5 mr-2 text-primary shrink-0"}),b("span",{className:"truncate",children:T||(G.targetFolderId?"Selected Folder":K.select_target_folder())})]})})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.start_date()}),b(o0,{value:G.startDate?new Date(G.startDate):void 0,onChange:(E)=>w({startDate:E?E.toISOString():null}),disabled:!Y,placeholder:K.start_date(),className:"h-8 text-xs bg-background"})]}),N("div",{className:"space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.due_date()}),b(o0,{value:G.dueDate?new Date(G.dueDate):void 0,onChange:(E)=>w({dueDate:E?E.toISOString():null}),disabled:!Y,placeholder:K.due_date(),className:"h-8 text-xs bg-background"})]}),N("div",{className:"sm:col-span-2 space-y-1.5",children:[b(d,{className:"text-xs font-medium text-muted-foreground",children:K.parent_tasks()}),b(j0,{teamId:_,currentTaskId:G.id,excludeTaskIds:G.dependents.map((E)=>E.id),value:G.dependencies.map((E)=>E.id),knownTasks:[...G.dependencies,...G.dependents],onChange:(E)=>w({parentIds:E}),canEdit:Y})]}),b("div",{className:"sm:col-span-2 pt-1",children:b(_b,{teamId:_,projectId:G.projectId,assets:G.assets||[],onAddAssets:(E)=>k(E),onRemoveAsset:(E)=>F(E),disabled:!Y})})]})]}),y&&b(Eb,{teamId:_,currentProjectId:G.projectId,currentTargetFolderId:G.targetFolderId,isOpen:y,onClose:()=>U(!1),onSelect:(E,V,H)=>{P(H||"Selected Folder"),w({projectId:E,targetFolderId:V})}})]})}var Fb=$0(Y0(),1);var hb=$0(Y0(),1);var Tb=$0(Y0(),1);function wb({teamId:_,taskId:G,comment:Y,currentUserId:Z,isOwnerOrAdmin:O,onViewAttachment:D}){let X=R0(),[L,y]=Tb.useState(!1),U=O||Y.author.id===Z,{mutate:T,isPending:P}=_0({mutationFn:async()=>{let W=await R.api.teams[":teamId"].kanban.tasks[":taskId"].comments[":commentId"].$delete({param:{teamId:_,taskId:G,commentId:Y.id}});if(!W.ok){let f=await W.json().catch(()=>({message:K.error()}));throw Error(f.message||K.error())}return await W.json()},onSuccess:()=>{X.invalidateQueries({queryKey:["teams",_,"kanban","tasks",G,"comments"]}),X.invalidateQueries({queryKey:["teams",_,"kanban","task",G]}),X.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]}),c.success("Comment deleted"),y(!1)},onError:(W)=>{c.error(W.message)}}),v=(Y.author.name||"U").split(" ").map((W)=>W[0]).slice(0,2).join("").toUpperCase();return N("div",{className:"relative flex gap-3 p-3 rounded-xl border border-transparent bg-foreground/[0.03] dark:bg-foreground/[0.08] hover:bg-foreground/[0.06] dark:hover:bg-foreground/[0.12] transition-colors group",children:[N(Z0,{className:"w-7 h-7 shrink-0 mt-0.5 border border-border",children:[Y.author.image&&b(f0,{src:Y.author.image,alt:Y.author.name}),b(z0,{className:"text-[10px] font-medium bg-muted text-muted-foreground",children:v})]}),N("div",{className:"flex-1 min-w-0 space-y-1.5",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("div",{className:"flex items-center gap-2 min-w-0",children:[b("span",{className:"font-semibold text-xs text-foreground truncate",children:Y.author.name}),b("span",{className:"text-[10px] text-muted-foreground shrink-0 font-mono",children:S0(new Date(Y.createdAt),"MMM d, h:mm a")})]}),U&&b("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity",children:N(Jb,{modal:!1,children:[b(Zb,{asChild:!0,children:b(r,{size:"icon-xs",variant:"ghost",className:"h-5 w-5 text-muted-foreground",children:b(Wb,{className:"h-3.5 w-3.5"})})}),b(fb,{align:"end",children:N(zb,{className:"text-destructive focus:text-destructive cursor-pointer text-xs",onClick:()=>y(!0),children:[b(yb,{className:"mr-1.5 h-3.5 w-3.5"}),b("span",{children:K.delete()})]})})]})})]}),Y.body&&b("div",{className:"text-xs leading-relaxed prose prose-xs dark:prose-invert max-w-none break-words text-foreground/90 font-sans",children:b(Rb,{children:Y.body})}),Y.attachments&&Y.attachments.length>0&&b("div",{className:"flex flex-wrap gap-2 pt-1.5",children:Y.attachments.map((W)=>{let f=W.proxyType==="image"||W.contentType?.startsWith("image/");return b("div",{className:"relative group/att rounded-lg border border-border bg-card overflow-hidden transition-all duration-200",children:f?N("div",{className:"w-40 h-28 relative cursor-pointer overflow-hidden bg-muted/40",onClick:()=>D?.(W),children:[b("img",{src:W.url,alt:W.name,className:"w-full h-full object-cover group-hover/att:scale-105 transition-transform duration-200"}),b("a",{href:W.url,download:W.name,target:"_blank",rel:"noreferrer",className:"absolute right-1.5 bottom-1.5 bg-black/60 hover:bg-black/80 text-white p-1 rounded-md opacity-0 group-hover/att:opacity-100 transition-opacity shadow-xs",onClick:(p)=>p.stopPropagation(),title:"Download",children:b(k0,{className:"w-3.5 h-3.5"})})]}):N("div",{className:"flex items-center gap-2.5 p-2.5 max-w-[240px] bg-card hover:bg-muted/40 transition-colors",children:[b(A0,{className:"w-7 h-7 text-primary/80 shrink-0"}),N("div",{className:"min-w-0 flex-1",children:[b("p",{className:"text-xs font-medium text-foreground truncate",title:W.name,children:W.name}),b("p",{className:"text-[10px] text-muted-foreground font-mono",children:Q0(W.sizeByte)})]}),b("a",{href:W.url,download:W.name,target:"_blank",rel:"noreferrer",className:"p-1 text-muted-foreground hover:text-foreground shrink-0 rounded-md hover:bg-muted transition-colors",title:"Download",children:b(k0,{className:"w-3.5 h-3.5"})})]})},W.id)})})]}),b(Xb,{open:L,onOpenChange:y,children:N(Ub,{children:[N(Db,{children:[b(Ob,{children:K.delete_comment_confirm()}),b(qb,{children:K.delete_comment_description()})]}),N(Vb,{children:[b(Qb,{disabled:P,children:K.cancel()}),b(Bb,{className:"bg-destructive hover:bg-destructive/90 text-white",disabled:P,onClick:()=>T(),children:K.delete()})]})]})})]})}var n=$0(Y0(),1);function Cb({teamId:_,onSendMessage:G,isSubmitting:Y}){let[Z,O]=n.useState(""),[D,X]=n.useState([]),[L,y]=n.useState(!1),[U,T]=n.useState(""),[P,v]=n.useState(0),W=n.useRef(null),f=n.useRef(null),p=n.useRef(null),{members:z,fetchMembers:w}=Pb();n.useEffect(()=>{if(_)w(_,!0,!0)},[_,w]);let{mutateAsync:E0}=_0({mutationFn:async(J)=>{let B=await R.api.teams[":teamId"].kanban.attachments.$post({param:{teamId:_},json:J});if(!B.ok)throw Error("Failed to get attachment upload url");return await B.json()}}),k=(J)=>{let B=J.target.value;if(O(B),W.current)W.current.style.height="auto",W.current.style.height=`${Math.min(W.current.scrollHeight,160)}px`;let t=J.target.selectionStart||0,C=B.slice(0,t),M=C.lastIndexOf("@");if(M!==-1){let s=M===0,e=C[M-1];if(s||/\s/.test(e)){let $=C.slice(M+1);if(!/\s/.test($)){T($),y(!0);return}}}y(!1)},F=z.filter((J)=>J.name?.toLowerCase().includes(U.toLowerCase()));n.useEffect(()=>{v(0)},[U,L]);let l=(J)=>{if(!W.current)return;let B=W.current.selectionStart||0,t=Z.slice(0,B),C=Z.slice(B),M=t.lastIndexOf("@");if(M!==-1){let s=`${Z.slice(0,M)}@${J.name} ${C}`;O(s),y(!1),setTimeout(()=>{if(W.current){W.current.focus();let e=M+J.name.length+2;W.current.setSelectionRange(e,e)}},0)}},i=async(J)=>{let B=Array.from(J.target.files||[]);if(B.length===0)return;let t=B.map((C)=>({id:`${Date.now()}-${C.name}-${Math.random()}`,file:C,isUploading:!0}));X((C)=>[...C,...t]);for(let C of t)try{let M=await E0({fileName:C.file.name,size:C.file.size,contentType:C.file.type||"application/octet-stream"});if(!(await fetch(M.uploadUrl,{method:"PUT",body:C.file,headers:{"Content-Type":C.file.type||"application/octet-stream"}})).ok)throw Error("Failed to upload file to storage");X((e)=>e.map((b0)=>b0.id===C.id?{...b0,isUploading:!1,payload:{id:M.id,name:M.name,key:M.key,sizeByte:M.sizeByte,contentType:M.contentType,proxyType:M.proxyType}}:b0))}catch(M){let s=M instanceof Error?M.message:"Upload failed";c.error(`${C.file.name}: ${s}`),X((e)=>e.map((b0)=>b0.id===C.id?{...b0,isUploading:!1,error:s}:b0))}if(f.current)f.current.value=""},E=(J)=>{X((B)=>B.filter((t)=>t.id!==J))},V=D.some((J)=>J.isUploading),H=D.map((J)=>J.payload).filter((J)=>!!J),q=(Z.trim().length>0||H.length>0)&&!V,A=async()=>{if(!q||Y)return;try{if(await G(Z.trim(),H.length>0?H:void 0),O(""),X([]),W.current)W.current.style.height="auto"}catch{}},o=(J)=>{if(L&&F.length>0){if(J.key==="ArrowDown"){J.preventDefault(),v((B)=>(B+1)%F.length);return}if(J.key==="ArrowUp"){J.preventDefault(),v((B)=>(B-1+F.length)%F.length);return}if(J.key==="Enter"||J.key==="Tab"){J.preventDefault();let B=F[P];if(B)l(B);return}if(J.key==="Escape"){y(!1);return}}if(J.key==="Enter"&&(J.metaKey||J.ctrlKey))J.preventDefault(),A()};return N("div",{className:"relative flex flex-col w-full border border-border focus-within:border-foreground/40 bg-card rounded-2xl p-2.5 shadow-2xs transition-all",children:[L&&F.length>0&&b("div",{ref:p,className:"absolute bottom-full left-0 mb-2 w-64 max-h-48 overflow-y-auto rounded-xl border border-border bg-popover p-1 shadow-lg z-50",children:F.map((J,B)=>N("button",{type:"button",onClick:()=>l(J),className:`w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-xs transition-colors text-left ${B===P?"bg-primary text-primary-foreground font-medium":"hover:bg-muted text-foreground"}`,children:[N(Z0,{className:"w-5 h-5",children:[J.image&&b(f0,{src:J.image}),b(z0,{className:"text-[9px]",children:J.name?.slice(0,2).toUpperCase()})]}),b("span",{className:"truncate",children:J.name})]},J.id))}),D.length>0&&b("div",{className:"flex flex-wrap gap-1.5 pb-2 mb-1.5 border-b border-border/50",children:D.map((J)=>{let B=J.file.type.startsWith("image/");return N("div",{className:"flex items-center gap-1.5 pl-2 pr-1.5 py-1 rounded-lg bg-muted/60 border border-border text-xs max-w-[200px]",children:[J.isUploading?b(h,{className:"w-3.5 h-3.5 animate-spin text-primary shrink-0"}):B?b(vb,{className:"w-3.5 h-3.5 text-primary shrink-0"}):b(A0,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),N("div",{className:"min-w-0 flex-1 truncate",children:[b("span",{className:"truncate block font-medium text-[11px]",children:J.file.name}),b("span",{className:"text-[9px] text-muted-foreground font-mono",children:Q0(J.file.size)})]}),b("button",{type:"button",onClick:()=>E(J.id),className:"p-0.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0",children:b(U0,{className:"w-3 h-3"})})]},J.id)})}),b("textarea",{ref:W,value:Z,onChange:k,onKeyDown:o,placeholder:K.comment_placeholder(),rows:1,className:"w-full min-h-[44px] max-h-[160px] bg-transparent border-0 focus:outline-hidden focus-visible:ring-0 resize-none text-xs text-foreground placeholder:text-muted-foreground/70 p-1 font-sans leading-relaxed"}),N("div",{className:"flex items-center justify-between pt-1 mt-1 border-t border-border/40",children:[N("div",{className:"flex items-center gap-1",children:[b("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:i}),b(r,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>f.current?.click(),className:"h-7 w-7 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted",title:"Attach files",disabled:Y,children:b(Mb,{className:"w-3.5 h-3.5"})}),b("span",{className:"text-[10px] text-muted-foreground/60 hidden sm:inline pl-1",children:"Cmd+Enter to send"})]}),b(r,{type:"button",size:"icon-xs",onClick:A,disabled:!q||Y,className:"h-7 w-7 rounded-full shadow-xs bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-all shrink-0",title:"Send comment",children:Y||V?b(h,{className:"w-3.5 h-3.5 animate-spin"}):b(Lb,{className:"w-3.5 h-3.5 stroke-[2.5]"})})]})]})}function pb({teamId:_,taskId:G,initialComments:Y}){let Z=R0(),[O,D]=hb.useState(null),{data:X}=S({queryKey:["teams",_,"me"],queryFn:async()=>{let f=await R.api.teams[":teamId"].me.$get({param:{teamId:_}});if(!f.ok)throw Error("Failed to fetch me");return await f.json()},enabled:!!_}),L=X?.role?.toLowerCase()==="owner"||X?.role?.toLowerCase()==="editor",{data:y,isLoading:U}=S({queryKey:["teams",_,"kanban","tasks",G,"comments"],queryFn:async()=>{let f=await R.api.teams[":teamId"].kanban.tasks[":taskId"].comments.$get({param:{teamId:_,taskId:G}});if(!f.ok)throw Error("Failed to fetch comments");return await f.json()},initialData:Y?{data:Y}:void 0,enabled:!!_&&!!G,refetchInterval:4000}),T=y?.data||[],{mutateAsync:P,isPending:v}=_0({mutationFn:async({body:f,attachments:p})=>{let z=await R.api.teams[":teamId"].kanban.tasks[":taskId"].comments.$post({param:{teamId:_,taskId:G},json:{body:f,attachments:p}});if(!z.ok){let w=await z.json().catch(()=>({message:K.error()}));throw Error(w.message||K.error())}return await z.json()},onSuccess:()=>{Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks",G,"comments"]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","task",G]}),Z.invalidateQueries({queryKey:["teams",_,"kanban","tasks"]})},onError:(f)=>{c.error(f.message)}}),W=async(f,p)=>{await P({body:f,attachments:p})};return N("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[O&&N("div",{className:"fixed inset-0 z-50 bg-black/90 flex flex-col items-center justify-center p-4 animate-in fade-in duration-150",onClick:()=>D(null),children:[b("button",{type:"button",onClick:()=>D(null),className:"absolute top-4 right-4 text-white/80 hover:text-white bg-white/10 hover:bg-white/20 rounded-full p-2 transition-colors z-50 cursor-pointer",title:"Close",children:b(U0,{className:"w-6 h-6"})}),b("div",{className:"w-full h-full flex items-center justify-center p-2",children:b("img",{src:O.url,alt:O.name,className:"max-w-full max-h-[85vh] object-contain rounded-lg shadow-2xl",onClick:(f)=>f.stopPropagation()})})]}),b(u,{className:"flex-1 p-3.5",children:b("div",{className:"space-y-3 pr-1 pb-2",children:U?b("div",{className:"flex items-center justify-center py-12",children:b(h,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):T.length===0?N("div",{className:"flex flex-col items-center justify-center py-16 text-center text-xs text-muted-foreground/80 space-y-2",children:[b("div",{className:"w-10 h-10 rounded-full bg-muted/60 flex items-center justify-center",children:b(gb,{className:"w-5 h-5 opacity-40"})}),b("p",{className:"font-medium",children:K.no_comments_yet()})]}):T.map((f)=>b(wb,{teamId:_,taskId:G,comment:f,currentUserId:X?.id,isOwnerOrAdmin:L,onViewAttachment:(p)=>D(p)},f.id))})}),b("div",{className:"p-3 border-t border-border/60 bg-card/60 shrink-0",children:b(Cb,{teamId:_,onSendMessage:W,isSubmitting:v})})]})}function cb(_){let G=_.data||{};switch(_.type){case m.CREATED:return"Created task";case m.STATUS_CHANGED:return`Changed status from ${_.fromStatus?K0(_.fromStatus):"None"} to ${_.toStatus?K0(_.toStatus):"None"}`;case m.ASSIGNED:return"Assigned task";case m.UNASSIGNED:return"Unassigned task";case m.PRIORITY_CHANGED:return`Changed priority to ${String(G.to||"")}`;case m.GOAL_CHANGED:return"Updated goal association";case m.DEPENDENCY_ADDED:return"Added prerequisite dependency";case m.DEPENDENCY_REMOVED:return"Removed prerequisite dependency";case m.CHANGES_REQUESTED:return`Requested changes: "${String(G.reason||"")}"`;case m.BLOCKED:return`Task blocked: "${String(G.reason||G.blockReason||"")}"`;case m.UNBLOCKED:return"Task unblocked";case m.COMMENTED:return"Added a comment";default:return _.type}}function Ab({teamId:_,taskId:G,initialEvents:Y}){let{data:Z,isLoading:O}=S({queryKey:["teams",_,"kanban","tasks",G,"events"],queryFn:async()=>{let X=await R.api.teams[":teamId"].kanban.tasks[":taskId"].events.$get({param:{teamId:_,taskId:G}});if(!X.ok)throw Error("Failed to fetch events");return await X.json()},initialData:Y?{data:Y}:void 0,enabled:!!_&&!!G}),D=Z?.data||[];return b(u,{className:"h-full p-3",children:b("div",{className:"space-y-4 pr-2",children:b("div",{className:"space-y-2",children:O?b("div",{className:"flex items-center justify-center py-6",children:b(h,{className:"w-4 h-4 animate-spin text-muted-foreground"})}):D.length===0?b("div",{className:"py-6 text-center text-xs text-muted-foreground",children:K.no_activity_yet()}):b("div",{className:"relative pl-5 space-y-3 before:absolute before:left-[4px] before:top-2 before:bottom-2 before:w-[2px] before:bg-border/60",children:D.map((X)=>N("div",{className:"relative flex items-start gap-2 text-xs",children:[b("div",{className:"absolute -left-5 top-[3px] w-2.5 h-2.5 rounded-full bg-background border-2 border-primary shrink-0"}),N("div",{className:"flex-1 min-w-0",children:[N("div",{className:"flex items-center justify-between gap-1",children:[b("span",{className:"font-medium text-foreground truncate",children:X.actor?.name||"System"}),b("span",{className:"text-[10px] text-muted-foreground font-mono shrink-0",children:S0(new Date(X.createdAt),"MM/dd HH:mm")})]}),b("p",{className:"text-[11px] text-muted-foreground leading-snug mt-0.5",children:cb(X)})]})]},X.id))})})})})}function ob({teamId:_,task:G}){let[Y,Z]=Fb.useState("comments");return b("div",{className:"flex flex-col h-full bg-sidebar/30 border-l border-border/60 overflow-hidden",children:N(Sb,{value:Y,onValueChange:(O)=>Z(O),className:"flex flex-col h-full",children:[b("div",{className:"px-3 pt-2.5 pb-1 border-b border-border/60 bg-card/50 shrink-0",children:N(rb,{className:"w-full grid grid-cols-2 h-8 bg-muted/60",children:[N(u0,{value:"comments",className:"text-xs h-7",children:[b("span",{children:K.comments()}),G.comments.length>0&&N("span",{className:"text-[10px] font-mono text-muted-foreground ml-1",children:["(",G.comments.length,")"]})]}),b(u0,{value:"activity",className:"text-xs h-7",children:b("span",{children:K.activity()})})]})}),N("div",{className:"flex-1 overflow-hidden",children:[b(I0,{value:"comments",className:"h-full m-0 data-[state=active]:flex data-[state=active]:flex-col",children:b(pb,{teamId:_,taskId:G.id,initialComments:G.comments})}),b(I0,{value:"activity",className:"h-full m-0 data-[state=active]:block",children:b(Ab,{teamId:_,taskId:G.id,initialEvents:G.events})})]})]})})}function z_({teamId:_,taskId:G,isOpen:Y,onClose:Z,canEdit:O=!0}){let{data:D,isLoading:X,error:L}=S({queryKey:["teams",_,"kanban","task",G],queryFn:async()=>{if(!G)return null;let y=await R.api.teams[":teamId"].kanban.tasks[":taskId"].$get({param:{teamId:_,taskId:G}});if(!y.ok)throw Error("Failed to fetch task details");return await y.json()},enabled:!!_&&!!G&&Y});return b(V0,{open:Y,onOpenChange:(y)=>!y&&Z(),children:N(O0,{className:"sm:max-w-5xl w-[95vw] h-[88vh] p-0 gap-0 flex flex-col overflow-hidden bg-background",children:[b(q0,{className:"px-5 py-3 border-b border-border/70 flex flex-row items-center justify-between space-y-0 shrink-0 bg-card/80",children:N("div",{className:"flex items-center gap-2 min-w-0 pr-4",children:[D?.isAgentTask&&N("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold bg-orange-500/15 text-orange-600 dark:text-orange-400 border border-orange-500/30 shrink-0",children:[b(L0,{className:"w-3.5 h-3.5"}),b("span",{children:K.task_type_agent()})]}),D?.status&&b("span",{className:j("px-2 py-0.5 rounded text-[11px] font-medium border uppercase shrink-0",T0(D.status)),children:K0(D.status)}),b(B0,{className:"text-sm font-semibold truncate text-foreground",children:D?.title||K.edit_task()})]})}),b("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:X?b("div",{className:"flex-1 flex items-center justify-center p-12",children:b(h,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):L||!D?b("div",{className:"flex-1 flex items-center justify-center p-12 text-xs text-muted-foreground",children:K.file_not_found()}):N(w0,{children:[b("div",{className:"flex-1 md:w-2/3 h-full overflow-hidden flex flex-col",children:b(Hb,{teamId:_,task:D,canEdit:O})}),b("div",{className:"md:w-1/3 h-full overflow-hidden flex flex-col",children:b(ob,{teamId:_,task:D})})]})})]})})}
2
+ export{db as Re,K0 as Se,ub as Te,T0 as Ue,c0 as Ve,n0 as We,j0 as Xe,_b as Ye,Eb as Ze,z_ as _e};