@shumai-one/shumai 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/bin/{chunk-qag3w2dd.js → chunk-0aj303as.js} +1 -1
  2. package/bin/{chunk-976v5s8y.js → chunk-0qkj838r.js} +1 -1
  3. package/bin/{chunk-mg6fce5x.js → chunk-0rxhc7ka.js} +1 -1
  4. package/bin/chunk-0xbf8bcg.js +2 -0
  5. package/bin/{chunk-t1mxqskx.js → chunk-15sefy5t.js} +1 -1
  6. package/bin/{chunk-jfjcxyhf.js → chunk-1wm57c6y.js} +3 -3
  7. package/bin/{chunk-7ktvhtp1.js → chunk-1xpec5r8.js} +1 -1
  8. package/bin/chunk-23d3968z.js +2 -0
  9. package/bin/{chunk-y4s3xr4n.js → chunk-262hkppb.js} +2 -2
  10. package/bin/{chunk-qj2kpkje.js → chunk-29tx9qe2.js} +1 -1
  11. package/bin/{chunk-a5s5ny4z.js → chunk-2aamsc5v.js} +1 -1
  12. package/bin/{chunk-gd5xwgp6.js → chunk-2aascrtb.js} +1 -1
  13. package/bin/chunk-2g12s6mc.js +2 -0
  14. package/bin/{chunk-pv76qkym.js → chunk-31baz5n0.js} +1 -1
  15. package/bin/{chunk-hmsb7ehr.js → chunk-46ar48f9.js} +1 -1
  16. package/bin/chunk-4e3jbp84.js +1 -0
  17. package/bin/chunk-4jk0y1w1.js +1 -0
  18. package/bin/{chunk-ga0drqj7.js → chunk-4qpa7b5t.js} +1 -1
  19. package/bin/{chunk-99db4j0k.js → chunk-54tr7y2x.js} +1 -1
  20. package/bin/{chunk-9n783gva.js → chunk-5d2q46mx.js} +1 -1
  21. package/bin/{chunk-qf7n519d.js → chunk-5m9be8an.js} +2 -2
  22. package/bin/{chunk-1w9dnk5p.js → chunk-5r8858hx.js} +1 -1
  23. package/bin/{chunk-ydagqpny.js → chunk-5t6c3038.js} +1 -1
  24. package/bin/chunk-6z65xd0w.js +3 -0
  25. package/bin/{chunk-qjjr3fff.js → chunk-77r8w95d.js} +1 -1
  26. package/bin/chunk-7e06b2zb.js +2 -0
  27. package/bin/{chunk-58aabg1f.js → chunk-7hsgmjpa.js} +2 -2
  28. package/bin/{chunk-7mnezagc.js → chunk-88fg1sw7.js} +1 -1
  29. package/bin/{chunk-m11g9hx7.js → chunk-8mkfgcvb.js} +2 -2
  30. package/bin/chunk-8tf6kgdj.js +2 -0
  31. package/bin/{chunk-b9hb5jzt.js → chunk-8wqfkm4c.js} +1 -1
  32. package/bin/{chunk-ag35pxnb.js → chunk-922nnh39.js} +1 -1
  33. package/bin/{chunk-ymyyap80.js → chunk-925q4paa.js} +1 -1
  34. package/bin/{chunk-wfex9jw0.js → chunk-92xxys10.js} +6 -6
  35. package/bin/{chunk-0a5k9avd.js → chunk-97jzve52.js} +1 -1
  36. package/bin/{chunk-dzm2f82x.js → chunk-9ab6k4rq.js} +1 -1
  37. package/bin/{chunk-mwh2n8yt.js → chunk-9avkn3x1.js} +1 -1
  38. package/bin/{chunk-pmx9760x.js → chunk-9h027f50.js} +1 -1
  39. package/bin/chunk-av71yjaa.js +1 -0
  40. package/bin/{chunk-mjncyjwf.js → chunk-b8js74jk.js} +1 -1
  41. package/bin/{chunk-861dz0bf.js → chunk-bd71dp4j.js} +1 -1
  42. package/bin/{chunk-v3j7acwn.js → chunk-bs0fjz3w.js} +2 -2
  43. package/bin/chunk-byqc8tzq.js +1 -0
  44. package/bin/chunk-ccw7mjgq.js +5 -0
  45. package/bin/{chunk-kj751zje.js → chunk-cxhmr356.js} +1 -1
  46. package/bin/{chunk-hcz4snm7.js → chunk-d3wmdjze.js} +1 -1
  47. package/bin/{chunk-82w2419d.js → chunk-de99643r.js} +2 -2
  48. package/bin/{chunk-dwf5e5g3.js → chunk-dghtwyq1.js} +1 -1
  49. package/bin/{chunk-5k03xpzq.js → chunk-dqgv5yy1.js} +1 -1
  50. package/bin/{chunk-q72ax3m8.js → chunk-e3s3rz2e.js} +1 -1
  51. package/bin/{chunk-79n633wf.js → chunk-e52nga6c.js} +1 -1
  52. package/bin/{chunk-8abs8d48.js → chunk-e7ndw3hg.js} +2 -2
  53. package/bin/chunk-f14sqw1d.js +1 -0
  54. package/bin/chunk-f7sbkfmk.js +2 -0
  55. package/bin/{chunk-2xnys7v4.js → chunk-fa2g2wge.js} +1 -1
  56. package/bin/{chunk-044xt1se.js → chunk-fbte2rmd.js} +1 -1
  57. package/bin/{chunk-k1r17nfa.js → chunk-fcvtgx1y.js} +1 -1
  58. package/bin/chunk-fd5a3pdd.js +1 -0
  59. package/bin/{chunk-hqptebzb.js → chunk-fepymbka.js} +1 -1
  60. package/bin/{chunk-cpr05qng.js → chunk-fz88kkk1.js} +1 -1
  61. package/bin/chunk-g6zzg6v2.js +1 -0
  62. package/bin/{chunk-6724dtsx.js → chunk-g8th86na.js} +1 -1
  63. package/bin/chunk-gswbc6y9.js +2 -0
  64. package/bin/{chunk-pvy0gccg.js → chunk-gtrc5ka2.js} +1 -1
  65. package/bin/chunk-h0ytx8zc.js +2 -0
  66. package/bin/{chunk-mv8c5fky.js → chunk-hkbybhww.js} +1 -1
  67. package/bin/{chunk-e3c6hyz8.js → chunk-hr97a5j5.js} +1 -1
  68. package/bin/{chunk-7h75r7ep.js → chunk-j8qtab70.js} +1 -1
  69. package/bin/{chunk-jyjnt0s9.js → chunk-jf3vn5c3.js} +2 -2
  70. package/bin/{chunk-azfgjqjx.js → chunk-kfhtk3eh.js} +1 -1
  71. package/bin/chunk-kr06nrbx.js +2 -0
  72. package/bin/{chunk-nceqrqey.js → chunk-m4zpf9gg.js} +1 -1
  73. package/bin/{chunk-1ae8csk6.js → chunk-mqjzmn0e.js} +1 -1
  74. package/bin/{chunk-sp75qe28.js → chunk-mzg1h07d.js} +1 -1
  75. package/bin/{chunk-cj5qwc9c.js → chunk-nrwna4ha.js} +1 -1
  76. package/bin/chunk-nyhqy6q2.js +62 -0
  77. package/bin/{chunk-4zq8vxcy.css → chunk-pmswtfe3.css} +1 -1
  78. package/bin/chunk-pq18zenh.js +2 -0
  79. package/bin/{chunk-p3emandj.js → chunk-q24epdh8.js} +2 -2
  80. package/bin/{chunk-2djd6pq1.js → chunk-qksb0v3c.js} +2 -2
  81. package/bin/chunk-qqk51620.js +2 -0
  82. package/bin/chunk-r0w920zb.js +1 -0
  83. package/bin/{chunk-2dz8nn9v.js → chunk-re0b7sj7.js} +1 -1
  84. package/bin/{chunk-x9q2vzn8.js → chunk-rtngbgpk.js} +1 -1
  85. package/bin/{chunk-zn9jbc6t.js → chunk-ry33f2qk.js} +1 -1
  86. package/bin/{chunk-k5bekrrp.js → chunk-s46zwr4p.js} +1 -1
  87. package/bin/chunk-s8t74q9m.js +1 -0
  88. package/bin/chunk-sd86v1e6.js +1 -0
  89. package/bin/{chunk-v98yavtp.js → chunk-srn8t0v7.js} +1 -1
  90. package/bin/chunk-szzff7gd.js +1 -0
  91. package/bin/{chunk-46c5xkmn.js → chunk-t3t6021k.js} +1 -1
  92. package/bin/{chunk-jbde7evp.js → chunk-thsbcbay.js} +1 -1
  93. package/bin/chunk-tspps87j.js +1 -0
  94. package/bin/{chunk-v05d1aeq.js → chunk-w7dn1m95.js} +1 -1
  95. package/bin/{chunk-w1d5vmtc.js → chunk-wc8sc9r9.js} +1 -1
  96. package/bin/chunk-wg98cacx.js +2 -0
  97. package/bin/chunk-wsyg4rwg.js +2 -0
  98. package/bin/{chunk-ga3mh3cd.js → chunk-xcwbg4w9.js} +1 -1
  99. package/bin/{chunk-9bpjfkjf.js → chunk-xyjw8w3r.js} +1 -1
  100. package/bin/chunk-y2qp11v9.js +1 -0
  101. package/bin/{chunk-ngd23mtc.js → chunk-ybhgmvxa.js} +1 -1
  102. package/bin/{chunk-phw4ne8b.js → chunk-ygz6pawn.js} +1 -1
  103. package/bin/{chunk-hy50c4pw.js → chunk-ymeycphq.js} +2 -2
  104. package/bin/{chunk-c1v946wb.js → chunk-zemrvz79.js} +2 -2
  105. package/bin/{chunk-29pkpmvy.js → chunk-zzx99j8t.js} +1 -1
  106. package/bin/shumai-app.html +1 -1
  107. package/bin/shumai-app.js +248 -224
  108. package/package.json +7 -7
  109. package/prisma/migrations/20260723025234_add_ai_usage_table/migration.sql +28 -0
  110. package/prisma/migrations/20260723032755_add_ai_usage_unique_constraint/migration.sql +8 -0
  111. package/prisma/schema.prisma +25 -0
  112. package/bin/chunk-211y81mp.js +0 -1
  113. package/bin/chunk-25d1g086.js +0 -2
  114. package/bin/chunk-4fnak2zn.js +0 -2
  115. package/bin/chunk-50ebjdkv.js +0 -2
  116. package/bin/chunk-5j7axztv.js +0 -2
  117. package/bin/chunk-6h4ay2p8.js +0 -2
  118. package/bin/chunk-6w5cn6p3.js +0 -3
  119. package/bin/chunk-75jka5v9.js +0 -5
  120. package/bin/chunk-9evm8x70.js +0 -1
  121. package/bin/chunk-bepnbw1g.js +0 -2
  122. package/bin/chunk-bg24g9kk.js +0 -1
  123. package/bin/chunk-dqtq9t8e.js +0 -1
  124. package/bin/chunk-fgnxtqtk.js +0 -1
  125. package/bin/chunk-fxvb6g2r.js +0 -1
  126. package/bin/chunk-kjkmh26f.js +0 -1
  127. package/bin/chunk-m3dwydr3.js +0 -2
  128. package/bin/chunk-mk1jewvw.js +0 -2
  129. package/bin/chunk-q9sgjs4d.js +0 -1
  130. package/bin/chunk-s2725w64.js +0 -1
  131. package/bin/chunk-saq5797j.js +0 -1
  132. package/bin/chunk-sy8rqacm.js +0 -2
  133. package/bin/chunk-t84t3v6q.js +0 -1
  134. package/bin/chunk-ttsqdsxr.js +0 -2
  135. package/bin/chunk-vreq89j6.js +0 -1
  136. package/bin/chunk-wbhsmhgp.js +0 -2
  137. package/bin/chunk-wf4d1anc.js +0 -62
  138. package/bin/chunk-xv4mfppt.js +0 -2
@@ -0,0 +1 @@
1
+ import{h as RB,i as bB}from"./chunk-h0ytx8zc.js";import{k as gB}from"./chunk-f7sbkfmk.js";import{p as LB,s as MB}from"./chunk-xyjw8w3r.js";import{O as NB}from"./chunk-pq18zenh.js";import"./chunk-wsyg4rwg.js";import{Va as DB}from"./chunk-srn8t0v7.js";import"./chunk-kfhtk3eh.js";import"./chunk-b8js74jk.js";import"./chunk-0xbf8bcg.js";import{Af as kB}from"./chunk-ry33f2qk.js";import"./chunk-77r8w95d.js";import{hg as VB,ig as wB}from"./chunk-54tr7y2x.js";import"./chunk-0rxhc7ka.js";import{og as $B,pg as EB}from"./chunk-fa2g2wge.js";import"./chunk-fz88kkk1.js";import"./chunk-dghtwyq1.js";import{bh as PB}from"./chunk-gswbc6y9.js";import{Bh as qB,Dh as YB,Gh as TB,Mi as _B,Sh as q,ai as p,gk as UB,kh as d,mh as XB,mk as yB,nh as zB,ni as ZB,oh as G,ph as D,qh as HB,th as j,vh as QB}from"./chunk-nyhqy6q2.js";import{Vk as KB}from"./chunk-0qkj838r.js";var $=KB(XB(),1);var tB=({item:J})=>{if(J.preview?.thumbnailUrl)return G("img",{src:J.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(J.preview?.proxyType==="audio"||J.proxyType==="audio")return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(ZB,{className:"w-5 h-5 text-muted-foreground"})});return G("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:G(_B,{className:"w-5 h-5 text-muted-foreground"})})},OB=({projectId:J,currentAssetId:X,parentFolderId:Q,initialFiles:_,initialNextCursor:w})=>{let{ref:z,inView:k}=$B({threshold:0,rootMargin:"200px"}),T=$.useRef(null),N=$.useRef(!1),[O,y]=$.useState(_),[Z,R]=$.useState(w),[b,S]=$.useState(!!w),[L,P]=$.useState(!1);return $.useEffect(()=>{y(_),R(w),S(!!w),N.current=!1},[_,w]),$.useEffect(()=>{(async()=>{if(!Z||L||!k||!b)return;P(!0);try{let W=await q.api.folders[":folderId"].search.$post({param:{folderId:Q},json:{assetType:"file",after:Z,first:200,recursively:!1,conditions:[]}});if(!W.ok)throw Error("Failed to fetch next page");let g=await W.json(),M=g.data||[];y((f)=>[...f,...M]),R(g.pageInfo?.cursor||void 0),S(!!g.pageInfo?.cursor&&M.length>0)}catch(W){console.error("Error fetching next page:",W)}finally{P(!1)}})()},[k,Z,b,L,Q]),$.useEffect(()=>{N.current=!1},[X]),$.useEffect(()=>{if(O.some((W)=>W?.id===X)&&T.current&&!N.current)T.current.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}),N.current=!0},[O,X]),G("div",{className:"h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none",children:D("div",{className:"flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar",children:[O.map((H)=>{if(!H)return null;let W=H.id===X;return G("div",{ref:H.id===X?T:null,className:"flex-shrink-0",children:G(YB,{to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:H.id},search:{version:void 0},className:UB("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",W?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:G(tB,{item:H})})},H.id)}),b&&G("div",{ref:z,className:"px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0",children:L&&G(p,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var Y=KB(XB(),1);function eB(){let{projectId:J,fileId:X}=WB.useParams(),Q=WB.useSearch(),_=Q.version,w=Q.start,z=_||X,k=Q.cmpLeft,T=Q.cmpRight,N=Q.cmpActive??"left",O=!!Q.compare&&!!k&&!!T,y=Y.useRef(null),{teamId:Z,ensureTeamIdForProject:R}=PB(),[b,S]=Y.useState(360),[L,P]=Y.useState([]),{fileViewRightSidebarCollapsed:H}=EB(),{isChatbotOpen:W}=wB(),[g,M]=Y.useState(0),[f,C]=Y.useState(null),[l,AB]=Y.useState(null),[xB,jB]=Y.useState(void 0),[A,I]=Y.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),SB=q.api.files[":fileId"].metadata.$patch,{mutate:CB}=QB({mutationFn:async(B)=>{let K=await SB(B);if(!K.ok)throw Error("Failed to patch metadata");return await K.json()}}),hB=HB(),{members:FB,fetchMembers:n}=NB();Y.useEffect(()=>{R(J)},[J,R]),Y.useEffect(()=>{if(Z)n(Z,!0)},[Z,n]);let{data:o,isLoading:vB,isError:pB,isFetching:fB}=j({queryKey:["files",X],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:X}});if(!B.ok)throw Error("Failed to fetch stack");return await B.json()},enabled:!!Z,placeholderData:d}),{data:IB,isLoading:mB,isError:uB,isFetching:cB}=j({queryKey:["files",_],queryFn:async()=>{let B=await q.api.files[":fileId"].$get({param:{fileId:_}});if(!B.ok)throw Error("Failed to fetch version");return await B.json()},enabled:!!Z&&!!_,placeholderData:d}),{data:dB}=j({queryKey:["version_stacks",X,"versions"],queryFn:async()=>{let B=await q.api.version_stacks[":stackId"].versions.$get({param:{stackId:X}});if(!B.ok)throw Error("Failed to fetch versions");return await B.json()},enabled:!!J&&!!X&&(!!_||O)}),{data:x}=j({queryKey:["projects",J],queryFn:async()=>{let B=await q.api.projects[":projectId"].$get({param:{projectId:J}});if(!B.ok)throw Error("Failed to fetch project");return await B.json()}}),h=qB(),{setProjectState:a,clearProjectState:r}=VB(),lB=vB||!!_&&mB,nB=pB||!!_&&uB,oB=fB||!!_&&cB,U=IB||o,V=_?dB:o?.versionStack?.versions;Y.useEffect(()=>{if(U&&x&&Z)a({teamId:Z,projectId:J,projectName:x.name??"",ancestorFolders:U.ancestorFolders??[],currentAsset:{name:U.name,type:"file",version:V?V.find((B)=>B.id===z)?.version??V.length:void 0,proxyType:U.proxyType},isRootFolder:!1,fileId:X,downloadInfo:{originalKey:U.media?.original?.key,videoTranscodes:U.media?.videoTranscodes?.map((B)=>({key:B.key,width:B.width,height:B.height,isRaw:B.isRaw}))},versions:V,compareMode:O,canCompareVersions:(V?.length??0)>=2,onCompareVersions:()=>{let B=LB(V);if(!B)return;h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,version:void 0,compare:!0,cmpLeft:B.left.id,cmpRight:B.right.id,cmpActive:"left"})})},onFolderClick:(B)=>{h({to:"/projects/$projectId/folders/$folderId",params:{projectId:J,folderId:B}})}});return()=>r()},[Z,J,x,U,V,z,X,O,a,r,h]);let E=U?.ancestorFolders?.[0]?.id??x?.rootFolder??"";if(Y.useEffect(()=>{if(!E||!z)return;if(A.folderId===E)return;let B=!0;return(async()=>{try{let F="",t=!1,e=[],BB=void 0;for(let GB=0;GB<5;GB++){let JB=await q.api.folders[":folderId"].search.$post({param:{folderId:E},json:{assetType:"file",after:F,first:200,recursively:!1,conditions:[]}});if(!JB.ok)throw Error("Failed to search parent folder for carousel");let v=await JB.json(),c=v.data||[];if(e.push(...c),c.some((sB)=>sB.id===z)){t=!0,BB=v.pageInfo?.cursor||void 0;break}if(!v.pageInfo?.cursor||c.length<200)break;F=v.pageInfo.cursor}if(B)if(t)I({show:!0,files:e,nextCursor:BB,folderId:E});else I({show:!1,files:[],nextCursor:void 0,folderId:E})}catch(F){if(console.error(F),B)I({show:!1,files:[],nextCursor:void 0,folderId:E})}})(),()=>{B=!1}},[E,z,A.folderId]),Y.useEffect(()=>{M(0),C(null),P([])},[U?.id]),Y.useEffect(()=>{C(null),P([])},[l?.id]),lB&&!U)return G(kB,{});if(nB||!U||!x||!Z)return G("div",{children:yB.file_not_found()});let m=O?l:U,i=m?.id??z,aB=(B,K)=>{if(!Z)return;CB({param:{fileId:i},json:[{key:B,value:K}]},{onSuccess:()=>{hB.invalidateQueries({queryKey:["files",i]})}})},u=(B)=>{h({to:"/projects/$projectId/files/$fileId",params:{projectId:J,fileId:X},search:(K)=>({...K,...B})})},rB=()=>{u({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?k:T})},iB=(B)=>{C(B.id||null);let K=B.annotations;if(K&&K.length>0)P(K);else P([]);if(O){if(B.second!==null&&B.second!==void 0)jB({second:B.second,nonce:Date.now()});return}if(B.second!==null&&B.second!==void 0)y.current?.seekTo(B.second),y.current?.pause();else if(K&&K.length>0)y.current?.pause()},s=()=>{P([]),C(null)};return G("div",{className:"h-full flex flex-1 flex-col bg-background",children:D("div",{className:"h-full flex flex-1 overflow-hidden",children:[D("div",{className:"flex-1 relative",children:[oB&&!O&&G("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:G(p,{className:"h-8 w-8 animate-spin text-foreground"})}),O&&k&&T?G(bB,{versions:V??[],leftId:k,rightId:T,activeSide:N,annotations:L,seekRequest:xB,onActiveSideChange:(B)=>u({cmpActive:B}),onSwitchVersion:(B,K)=>u(B==="left"?{cmpLeft:K}:{cmpRight:K}),onExit:rB,onActiveAssetChange:AB,onPlay:s,onTimeUpdate:M}):G(RB,{file:U,mediaControllerRef:y,onPlay:s,onTimeUpdate:M,annotations:L,startTime:w,children:A.show&&G(OB,{projectId:J,currentAssetId:z,parentFolderId:E,initialFiles:A.files,initialNextCursor:A.nextCursor})})]}),(!H||W)&&D(zB,{children:[G(DB,{onResize:(B)=>{S((K)=>Math.max(300,Math.min(600,K-B)))},className:"hidden md:block"}),G("div",{style:{width:b},className:"flex-shrink-0 bg-background flex flex-col",children:W?G(gB,{projectId:J,contextAssetId:z}):G(MB,{teamId:Z,projectId:J,file:m,onSaveField:aB,members:FB,onCommentSelect:iB,currentTime:g,onTyping:()=>{if(O)return;y.current?.pause()},selectedCommentId:f,hideAnnotationControl:m?.proxyType==="audio"})})]})]})})}var WB=TB("/projects/$projectId/files/$fileId")({component:eB});export{WB as Route};
@@ -0,0 +1 @@
1
+ import{j as V}from"./chunk-2g12s6mc.js";import"./chunk-f7sbkfmk.js";import"./chunk-fepymbka.js";import"./chunk-xyjw8w3r.js";import"./chunk-ccw7mjgq.js";import"./chunk-pq18zenh.js";import"./chunk-wsyg4rwg.js";import"./chunk-7e06b2zb.js";import"./chunk-srn8t0v7.js";import"./chunk-kfhtk3eh.js";import"./chunk-kr06nrbx.js";import"./chunk-b8js74jk.js";import"./chunk-0xbf8bcg.js";import{hf as U}from"./chunk-8mkfgcvb.js";import"./chunk-88fg1sw7.js";import{zf as N}from"./chunk-ry33f2qk.js";import"./chunk-77r8w95d.js";import"./chunk-t3t6021k.js";import"./chunk-54tr7y2x.js";import"./chunk-1xpec5r8.js";import"./chunk-0rxhc7ka.js";import"./chunk-fa2g2wge.js";import"./chunk-fz88kkk1.js";import"./chunk-dghtwyq1.js";import{bh as K}from"./chunk-gswbc6y9.js";import{Gh as H,Sh as J,mh as Z,oh as q,th as B,uh as G}from"./chunk-nyhqy6q2.js";import{Vk as Y}from"./chunk-0qkj838r.js";var W=Y(Z(),1);function _(){let{projectId:h}=$.useParams(),{teamId:v,ensureTeamIdForProject:w}=K();W.useEffect(()=>{w(h)},[h,w]);let{data:A}=G(U(h)),b=A?.rootFolder,{data:X}=B({queryKey:["folders",b],queryFn:()=>(async()=>{return await(await J.api.folders[":folderId"].$get({param:{folderId:b}})).json()})(),enabled:!!b});if(!v||!b||!X)return q(N,{});return q(V,{teamId:v,projectId:h,projectName:A.name??"",assetId:"recently-deleted",rootFolderId:b})}var $=H("/projects/$projectId/recently-deleted")({component:_});export{$ as Route};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function x(f){let b={};for(let[q,w]of f.entries())b[q]=w;return b}
3
- export{x as wk};
3
+ export{x as Ck};
@@ -1,3 +1,3 @@
1
- import{Rg as u,Xg as z,mh as B,nh as J,sh as $,uh as w}from"./chunk-wf4d1anc.js";import{Pk as b}from"./chunk-976v5s8y.js";var E=null,g=J((p)=>({projectState:null,setProjectState:(j)=>{if(E)clearTimeout(E),E=null;p({projectState:j})},clearProjectState:()=>{if(E)clearTimeout(E);E=setTimeout(()=>{p({projectState:null}),E=null},10)}}));var H=J((p)=>({isChatbotOpen:!1,setIsChatbotOpen:(j)=>p({isChatbotOpen:j}),isHistoryMode:!1,setIsHistoryMode:(j)=>p({isHistoryMode:j}),currentSessionId:null,setCurrentSessionId:(j)=>p({currentSessionId:j}),chatAssets:[],addAssets:(j)=>p((c)=>{let f=new Set(c.chatAssets.map((P)=>P.id)),F=j.filter((P)=>!f.has(P.id));return{chatAssets:[...c.chatAssets,...F]}}),removeAsset:(j)=>p((c)=>({chatAssets:c.chatAssets.filter((f)=>f.id!==j)})),clearAssets:()=>p({chatAssets:[]}),messages:[],setMessages:(j)=>p({messages:j}),historySessions:[],setHistorySessions:(j)=>p({historySessions:j}),isStreaming:!1,setIsStreaming:(j)=>p({isStreaming:j}),selectedAgentId:null,setSelectedAgentId:(j)=>p({selectedAgentId:j}),scrollTop:0,isAtBottom:!0,setScrollState:(j,c)=>p({scrollTop:j,isAtBottom:c}),fetchHistorySessions:async(j)=>{try{let c=await w.api.teams[":teamId"].chat.sessions.$get({param:{teamId:j},query:{first:"50"}});if(c.ok){let f=await c.json();p({historySessions:f.data||[]})}}catch(c){console.error("Failed to fetch history sessions:",c)}},loadSession:async(j,c)=>{try{let f=await w.api.teams[":teamId"].chat.sessions[":sessionId"].messages.$get({param:{teamId:j,sessionId:c}});if(f.ok){let F=await f.json(),T=H.getState().historySessions.find((O)=>O.id===c)?.agentId||null;p({currentSessionId:c,messages:F,isHistoryMode:!1,scrollTop:0,isAtBottom:!0,...T?{selectedAgentId:T}:{}})}else throw Error("Failed to load session messages")}catch(f){let F=f instanceof Error?f.message:"Failed to load session";$.error(F)}},deleteSession:async(j,c)=>{try{if((await w.api.teams[":teamId"].chat.sessions[":sessionId"].$delete({param:{teamId:j,sessionId:c}})).ok)$.success("Session deleted successfully"),p((F)=>({historySessions:F.historySessions.filter((P)=>P.id!==c),currentSessionId:F.currentSessionId===c?null:F.currentSessionId,messages:F.currentSessionId===c?[]:F.messages}));else throw Error("Failed to delete session")}catch(f){let F=f instanceof Error?f.message:"Failed to delete session";$.error(F)}},startNewSession:()=>{p({currentSessionId:null,messages:[],chatAssets:[],scrollTop:0,isAtBottom:!0})},sendMessage:async(j,c,f,F)=>{let P=H.getState();if(P.isStreaming)return;let T=`temp-${Date.now()}`,O={id:T,role:"user",content:[{type:"text",text:c}],timestamp:Date.now()},R=[...P.messages];if(P.chatAssets.length>0){let G={id:`temp-context-${Date.now()}`,role:"custom",customType:"context_display_info",details:{assets:P.chatAssets.map((k)=>({id:k.id,name:k.name,type:k.type}))},timestamp:Date.now()-1};R.push(G)}R.push(O),p({messages:R,isStreaming:!0,chatAssets:[],isAtBottom:!0});let v=P.chatAssets.map((K)=>K.id),Y=P.selectedAgentId;if(!Y){$.error("No agent selected");return}try{let K=await w.api.teams[":teamId"].chat.$post({param:{teamId:j},json:{agentId:Y,textPrompt:c,assetIds:v,sessionId:P.currentSessionId||void 0,contextAssetId:F,projectId:f}});if(!K.ok)throw Error("Failed to start chat");let G=K.headers.get("x-session-id");if(G&&!P.currentSessionId)p({currentSessionId:G});let k=K.body?.getReader();if(!k)throw Error("No stream body");let U=new TextDecoder,V="";while(!0){let{done:A,value:y}=await k.read();if(A)break;V+=U.decode(y,{stream:!0});let Z=V.split(`
1
+ import{Kh as B,Lh as J,Qh as $,Sh as w,mh as u,th as z}from"./chunk-nyhqy6q2.js";import{Vk as b}from"./chunk-0qkj838r.js";var E=null,g=J((p)=>({projectState:null,setProjectState:(j)=>{if(E)clearTimeout(E),E=null;p({projectState:j})},clearProjectState:()=>{if(E)clearTimeout(E);E=setTimeout(()=>{p({projectState:null}),E=null},10)}}));var H=J((p)=>({isChatbotOpen:!1,setIsChatbotOpen:(j)=>p({isChatbotOpen:j}),isHistoryMode:!1,setIsHistoryMode:(j)=>p({isHistoryMode:j}),currentSessionId:null,setCurrentSessionId:(j)=>p({currentSessionId:j}),chatAssets:[],addAssets:(j)=>p((c)=>{let f=new Set(c.chatAssets.map((P)=>P.id)),F=j.filter((P)=>!f.has(P.id));return{chatAssets:[...c.chatAssets,...F]}}),removeAsset:(j)=>p((c)=>({chatAssets:c.chatAssets.filter((f)=>f.id!==j)})),clearAssets:()=>p({chatAssets:[]}),messages:[],setMessages:(j)=>p({messages:j}),historySessions:[],setHistorySessions:(j)=>p({historySessions:j}),isStreaming:!1,setIsStreaming:(j)=>p({isStreaming:j}),selectedAgentId:null,setSelectedAgentId:(j)=>p({selectedAgentId:j}),scrollTop:0,isAtBottom:!0,setScrollState:(j,c)=>p({scrollTop:j,isAtBottom:c}),fetchHistorySessions:async(j)=>{try{let c=await w.api.teams[":teamId"].chat.sessions.$get({param:{teamId:j},query:{first:"50"}});if(c.ok){let f=await c.json();p({historySessions:f.data||[]})}}catch(c){console.error("Failed to fetch history sessions:",c)}},loadSession:async(j,c)=>{try{let f=await w.api.teams[":teamId"].chat.sessions[":sessionId"].messages.$get({param:{teamId:j,sessionId:c}});if(f.ok){let F=await f.json(),T=H.getState().historySessions.find((O)=>O.id===c)?.agentId||null;p({currentSessionId:c,messages:F,isHistoryMode:!1,scrollTop:0,isAtBottom:!0,...T?{selectedAgentId:T}:{}})}else throw Error("Failed to load session messages")}catch(f){let F=f instanceof Error?f.message:"Failed to load session";$.error(F)}},deleteSession:async(j,c)=>{try{if((await w.api.teams[":teamId"].chat.sessions[":sessionId"].$delete({param:{teamId:j,sessionId:c}})).ok)$.success("Session deleted successfully"),p((F)=>({historySessions:F.historySessions.filter((P)=>P.id!==c),currentSessionId:F.currentSessionId===c?null:F.currentSessionId,messages:F.currentSessionId===c?[]:F.messages}));else throw Error("Failed to delete session")}catch(f){let F=f instanceof Error?f.message:"Failed to delete session";$.error(F)}},startNewSession:()=>{p({currentSessionId:null,messages:[],chatAssets:[],scrollTop:0,isAtBottom:!0})},sendMessage:async(j,c,f,F)=>{let P=H.getState();if(P.isStreaming)return;let T=`temp-${Date.now()}`,O={id:T,role:"user",content:[{type:"text",text:c}],timestamp:Date.now()},R=[...P.messages];if(P.chatAssets.length>0){let G={id:`temp-context-${Date.now()}`,role:"custom",customType:"context_display_info",details:{assets:P.chatAssets.map((k)=>({id:k.id,name:k.name,type:k.type}))},timestamp:Date.now()-1};R.push(G)}R.push(O),p({messages:R,isStreaming:!0,chatAssets:[],isAtBottom:!0});let v=P.chatAssets.map((K)=>K.id),Y=P.selectedAgentId;if(!Y){$.error("No agent selected");return}try{let K=await w.api.teams[":teamId"].chat.$post({param:{teamId:j},json:{agentId:Y,textPrompt:c,assetIds:v,sessionId:P.currentSessionId||void 0,contextAssetId:F,projectId:f}});if(!K.ok)throw Error("Failed to start chat");let G=K.headers.get("x-session-id");if(G&&!P.currentSessionId)p({currentSessionId:G});let k=K.body?.getReader();if(!k)throw Error("No stream body");let U=new TextDecoder,V="";while(!0){let{done:A,value:y}=await k.read();if(A)break;V+=U.decode(y,{stream:!0});let Z=V.split(`
2
2
  `);V=Z.pop()||"";for(let C of Z){let W=C.trim();if(!W)continue;if(W.startsWith("data: ")){let M=W.slice(6);try{let Q=JSON.parse(M);if(Q.type==="session"){if(!H.getState().currentSessionId)p({currentSessionId:Q.sessionId})}else if(Q.type==="entry"){let D=Q.entry;p((_)=>{let h=_.messages.some((q)=>q.id===D.id),X=_.messages.filter((q)=>{if(D.role==="user"&&!h)return!(q.id.startsWith("temp-")&&!q.id.startsWith("temp-context-"));if(D.role==="custom"&&D.customType==="context_display_info"&&!h)return!q.id.startsWith("temp-context-");return!0}),N=X.findIndex((q)=>q.id===D.id);if(N!==-1){let q=[...X];return q[N]=D,{messages:q}}else return{messages:[...X,D]}})}else if(Q.type==="done"){if(Q.status==="failed")$.error(Q.error||"Workflow failed")}}catch(Q){console.error("Error parsing SSE line:",Q)}}}}H.getState().fetchHistorySessions(j)}catch(K){let G=K instanceof Error?K.message:"Failed to send message";$.error(G),p((k)=>({messages:k.messages.filter((U)=>U.id!==T)}))}finally{p({isStreaming:!1})}},abortActiveSession:async(j)=>{let{currentSessionId:c,isStreaming:f}=H.getState();if(!c||!f)return;try{if((await w.api.teams[":teamId"].chat.sessions[":sessionId"].abort.$post({param:{teamId:j,sessionId:c}})).ok)$.success("Agent execution stopped");else throw Error("Failed to abort agent execution")}catch(F){let P=F instanceof Error?F.message:"Failed to abort execution";$.error(P)}}}));var L=b(u(),1);function S(p){let j=p.match(/teams\/([^/]+)/);if(j)return{teamId:j[1]};let c=p.match(/projects\/([^/]+)/);if(c)return{projectId:c[1]};return{}}function t(){let[p,j]=L.useState(),c=B({select:(T)=>T.location.pathname}),{teamId:f,projectId:F}=S(c),{data:P}=z({queryKey:["projects",F,"team"],queryFn:async()=>{let T=await w.api.projects[":projectId"].team.$get({param:{projectId:F}});if(!T.ok)throw Error("failed to fetch project team");return await T.json()},enabled:!!F});return L.useEffect(()=>{if(f)j(f);else if(P?.teamId)j(P.teamId)},[f,P]),p}
3
3
  export{t as gg,g as hg,H as ig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ak as T,Bk as I,Ck as B,xk as C,yk as j,zk as v}from"./chunk-2djd6pq1.js";import{Ek as F,Gk as M,Hk as H}from"./chunk-jfjcxyhf.js";import{Ik as G}from"./chunk-2dz8nn9v.js";import{Lk as P,Mk as L,Nk as K}from"./chunk-ag35pxnb.js";import{Ok as y}from"./chunk-pmx9760x.js";import"./chunk-976v5s8y.js";var b="v1",k="gcp-vertex-credentials",g={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},m=0,S=(q,w,J)=>{let Y=new K;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",provider:q.provider,model:q.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let W=p(J),z=W?u(q,W,J?.headers):d(q,r(J),s(J),J?.headers),N=i(q,w,J),R=await J?.onPayload?.(N,q);if(R!==void 0)N=R;let x=await z.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,A=Q.content,X=()=>A.length-1;for await(let D of x){Q.responseId||=D.responseId;let V=D.candidates?.[0];if(V?.content?.parts)for(let $ of V.content.parts){if($.text!==void 0){let _=C($);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:A.length-1,content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(_)Z={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Z),Y.push({type:"thinking_start",contentIndex:X(),partial:Q});else Z={type:"text",text:""},Q.content.push(Z),Y.push({type:"text_start",contentIndex:X(),partial:Q})}if(Z.type==="thinking")Z.thinking+=$.text,Z.thinkingSignature=j(Z.thinkingSignature,$.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:$.text,partial:Q});else Z.text+=$.text,Z.textSignature=j(Z.textSignature,$.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:$.text,partial:Q})}if($.functionCall){if(Z){if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});Z=null}let _=$.functionCall.id,E={type:"toolCall",id:!_||Q.content.some((U)=>U.type==="toolCall"&&U.id===_)?`${$.functionCall.name}_${Date.now()}_${++m}`:_,name:$.functionCall.name||"",arguments:$.functionCall.args??{},...$.thoughtSignature&&{thoughtSignature:$.thoughtSignature}};Q.content.push(E),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(E.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:E,partial:Q})}}if(V?.finishReason){if(Q.stopReason=B(V.finishReason),Q.content.some(($)=>$.type==="toolCall"))Q.stopReason="toolUse"}if(D.usageMetadata)Q.usage={input:(D.usageMetadata.promptTokenCount||0)-(D.usageMetadata.cachedContentTokenCount||0),output:(D.usageMetadata.candidatesTokenCount||0)+(D.usageMetadata.thoughtsTokenCount||0),cacheRead:D.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:D.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},P(q,Q.usage)}if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");Y.push({type:"done",reason:Q.stopReason,message:Q}),Y.end()}catch(W){for(let z of Q.content)if("index"in z)delete z.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=W instanceof Error?W.message:JSON.stringify(W),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Wq=(q,w,J)=>{let Y=G(q,J,void 0);if(!J?.reasoning)return S(q,w,{...Y,thinking:{enabled:!1}});let Q=L(q,J.reasoning),W=Q==="off"?"high":Q,z=q;if(O(z)||h(z))return S(q,w,{...Y,thinking:{enabled:!0,level:e(W,z)}});return S(q,w,{...Y,thinking:{enabled:!0,budgetTokens:t(z,W,J.thinkingBudgets)}})};function d(q,w,J,Y){return new H({vertexai:!0,project:w,location:J,apiVersion:b,httpOptions:f(q,Y)})}function u(q,w,J){return new H({vertexai:!0,apiKey:w,apiVersion:b,httpOptions:f(q,J)})}function f(q,w){let J={},Y=a(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=M.COLLECTION,c(Y))J.apiVersion=""}if(q.headers||w)J.headers={...q.headers,...w};return Object.keys(J).length>0?J:void 0}function a(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function c(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function p(q){let w=q?.apiKey?.trim();if(!w||w===k||l(w))return;return w}function l(q){return/^<[^>]+>$/.test(q)}function r(q){let w=q?.project||process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT;if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function s(q){let w=q?.location||process.env.GOOGLE_CLOUD_LOCATION;if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function i(q,w,J={}){let Y=v(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let W={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:y(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:T(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)W.toolConfig={functionCallingConfig:{mode:I(J.toolChoice)}};else W.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=g[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;W.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)W.thinkingConfig=n(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");W.abortSignal=J.signal}return{model:q.id,contents:Y,config:W}}function O(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function h(q){return/gemini-3(?:\.\d+)?-flash/.test(q.id.toLowerCase())}function n(q){let w=q;if(O(w))return{thinkingLevel:F.LOW};if(h(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function e(q,w){if(O(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function t(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Wq as streamSimpleGoogleVertex,S as streamGoogleVertex};
2
+ import{Dk as C,Ek as j,Fk as v,Gk as T,Hk as I,Ik as B}from"./chunk-qksb0v3c.js";import{Kk as F,Mk as M,Nk as H}from"./chunk-1wm57c6y.js";import{Ok as G}from"./chunk-re0b7sj7.js";import{Rk as P,Sk as L,Tk as K}from"./chunk-922nnh39.js";import{Uk as y}from"./chunk-9h027f50.js";import"./chunk-0qkj838r.js";var b="v1",k="gcp-vertex-credentials",g={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},m=0,S=(q,w,J)=>{let Y=new K;return(async()=>{let Q={role:"assistant",content:[],api:"google-vertex",provider:q.provider,model:q.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let W=p(J),z=W?u(q,W,J?.headers):d(q,r(J),s(J),J?.headers),N=i(q,w,J),R=await J?.onPayload?.(N,q);if(R!==void 0)N=R;let x=await z.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,A=Q.content,X=()=>A.length-1;for await(let D of x){Q.responseId||=D.responseId;let V=D.candidates?.[0];if(V?.content?.parts)for(let $ of V.content.parts){if($.text!==void 0){let _=C($);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:A.length-1,content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(_)Z={type:"thinking",thinking:"",thinkingSignature:void 0},Q.content.push(Z),Y.push({type:"thinking_start",contentIndex:X(),partial:Q});else Z={type:"text",text:""},Q.content.push(Z),Y.push({type:"text_start",contentIndex:X(),partial:Q})}if(Z.type==="thinking")Z.thinking+=$.text,Z.thinkingSignature=j(Z.thinkingSignature,$.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:$.text,partial:Q});else Z.text+=$.text,Z.textSignature=j(Z.textSignature,$.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:$.text,partial:Q})}if($.functionCall){if(Z){if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});Z=null}let _=$.functionCall.id,E={type:"toolCall",id:!_||Q.content.some((U)=>U.type==="toolCall"&&U.id===_)?`${$.functionCall.name}_${Date.now()}_${++m}`:_,name:$.functionCall.name||"",arguments:$.functionCall.args??{},...$.thoughtSignature&&{thoughtSignature:$.thoughtSignature}};Q.content.push(E),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(E.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:E,partial:Q})}}if(V?.finishReason){if(Q.stopReason=B(V.finishReason),Q.content.some(($)=>$.type==="toolCall"))Q.stopReason="toolUse"}if(D.usageMetadata)Q.usage={input:(D.usageMetadata.promptTokenCount||0)-(D.usageMetadata.cachedContentTokenCount||0),output:(D.usageMetadata.candidatesTokenCount||0)+(D.usageMetadata.thoughtsTokenCount||0),cacheRead:D.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,totalTokens:D.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},P(q,Q.usage)}if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:X(),content:Z.text,partial:Q});else Y.push({type:"thinking_end",contentIndex:X(),content:Z.thinking,partial:Q});if(J?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");Y.push({type:"done",reason:Q.stopReason,message:Q}),Y.end()}catch(W){for(let z of Q.content)if("index"in z)delete z.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=W instanceof Error?W.message:JSON.stringify(W),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Wq=(q,w,J)=>{let Y=G(q,J,void 0);if(!J?.reasoning)return S(q,w,{...Y,thinking:{enabled:!1}});let Q=L(q,J.reasoning),W=Q==="off"?"high":Q,z=q;if(O(z)||h(z))return S(q,w,{...Y,thinking:{enabled:!0,level:e(W,z)}});return S(q,w,{...Y,thinking:{enabled:!0,budgetTokens:t(z,W,J.thinkingBudgets)}})};function d(q,w,J,Y){return new H({vertexai:!0,project:w,location:J,apiVersion:b,httpOptions:f(q,Y)})}function u(q,w,J){return new H({vertexai:!0,apiKey:w,apiVersion:b,httpOptions:f(q,J)})}function f(q,w){let J={},Y=a(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=M.COLLECTION,c(Y))J.apiVersion=""}if(q.headers||w)J.headers={...q.headers,...w};return Object.keys(J).length>0?J:void 0}function a(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function c(q){try{return new URL(q).pathname.split("/").some((J)=>/^v\d+(?:beta\d*)?$/.test(J))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(q)}}function p(q){let w=q?.apiKey?.trim();if(!w||w===k||l(w))return;return w}function l(q){return/^<[^>]+>$/.test(q)}function r(q){let w=q?.project||process.env.GOOGLE_CLOUD_PROJECT||process.env.GCLOUD_PROJECT;if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function s(q){let w=q?.location||process.env.GOOGLE_CLOUD_LOCATION;if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function i(q,w,J={}){let Y=v(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let W={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:y(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:T(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)W.toolConfig={functionCallingConfig:{mode:I(J.toolChoice)}};else W.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=g[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;W.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)W.thinkingConfig=n(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");W.abortSignal=J.signal}return{model:q.id,contents:Y,config:W}}function O(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function h(q){return/gemini-3(?:\.\d+)?-flash/.test(q.id.toLowerCase())}function n(q){let w=q;if(O(w))return{thinkingLevel:F.LOW};if(h(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function e(q,w){if(O(w))switch(q){case"minimal":case"low":return"LOW";case"medium":case"high":return"HIGH"}switch(q){case"minimal":return"MINIMAL";case"low":return"LOW";case"medium":return"MEDIUM";case"high":return"HIGH"}}function t(q,w,J){if(J?.[w]!==void 0)return J[w];if(q.id.includes("2.5-pro"))return{minimal:128,low:2048,medium:8192,high:32768}[w];if(q.id.includes("2.5-flash"))return{minimal:128,low:2048,medium:8192,high:24576}[w];return-1}export{Wq as streamSimpleGoogleVertex,S as streamGoogleVertex};
@@ -1,2 +1,2 @@
1
- import{zf as A}from"./chunk-zn9jbc6t.js";import{Tg as v,hh as w,uh as z}from"./chunk-wf4d1anc.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 lf,H as mf};
1
+ import{zf as A}from"./chunk-ry33f2qk.js";import{Fh as w,Sh as z,oh as v}from"./chunk-nyhqy6q2.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 nf,H as of};
@@ -1,2 +1,2 @@
1
- import{zf as A}from"./chunk-zn9jbc6t.js";import{Tg as v,hh as w,uh as z}from"./chunk-wf4d1anc.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/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
1
+ import{zf as A}from"./chunk-ry33f2qk.js";import{Fh as w,Sh as z,oh as v}from"./chunk-nyhqy6q2.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/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
2
  export{B as wf,H as xf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function f(b){if(b===void 0)return;let d=Array.from(b);if(d.length<=64)return b;return d.slice(0,64).join("")}
3
- export{f as qk};
3
+ export{f as wk};