@shumai-one/shumai 0.2.3 → 0.3.1

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 (162) hide show
  1. package/bin/{chunk-2aamsc5v.js → chunk-08dr94gp.js} +1 -1
  2. package/bin/{chunk-g21jxrt9.js → chunk-08mxv0sm.js} +2 -2
  3. package/bin/{chunk-jqh8kavv.js → chunk-0ed7h2xm.js} +1 -1
  4. package/bin/{chunk-ygz6pawn.js → chunk-0t4z17qr.js} +1 -1
  5. package/bin/{chunk-9h3ds7rn.js → chunk-1d22tysv.js} +2 -2
  6. package/bin/{chunk-0aj303as.js → chunk-1dawjfk8.js} +2 -2
  7. package/bin/chunk-1nh6xgek.js +2 -0
  8. package/bin/chunk-20y3wte3.js +2 -0
  9. package/bin/{chunk-thsbcbay.js → chunk-2ynx0den.js} +1 -1
  10. package/bin/{chunk-2aascrtb.js → chunk-31a3k77j.js} +1 -1
  11. package/bin/{chunk-srn8t0v7.js → chunk-31mjcykb.js} +2 -2
  12. package/bin/{chunk-gtrc5ka2.js → chunk-3jdef7n4.js} +1 -1
  13. package/bin/{chunk-b8js74jk.js → chunk-3rcc5s99.js} +2 -2
  14. package/bin/{chunk-t3t6021k.js → chunk-3t7mjvdv.js} +2 -2
  15. package/bin/{chunk-mzg1h07d.js → chunk-4ahve1nf.js} +1 -1
  16. package/bin/{chunk-nrwna4ha.js → chunk-4hdx2tv0.js} +1 -1
  17. package/bin/chunk-4p7xpfey.js +2 -0
  18. package/bin/{chunk-dm2w12rc.js → chunk-5e1xqaj4.js} +2 -2
  19. package/bin/chunk-5f81c951.js +1 -0
  20. package/bin/chunk-5s7c0qww.js +1 -0
  21. package/bin/{chunk-e52nga6c.js → chunk-5vqan9c4.js} +2 -2
  22. package/bin/{chunk-re0b7sj7.js → chunk-5zntjzxw.js} +1 -1
  23. package/bin/{chunk-2dsmsa6a.js → chunk-6a2eb3b5.js} +1 -1
  24. package/bin/chunk-6gy7c4d7.js +1 -0
  25. package/bin/chunk-7d4scsf6.js +1 -0
  26. package/bin/chunk-7d5kep8c.js +2 -0
  27. package/bin/{chunk-w7dn1m95.js → chunk-7eycsyk6.js} +1 -1
  28. package/bin/{chunk-e7ndw3hg.js → chunk-7jjc175m.js} +3 -3
  29. package/bin/{chunk-77r8w95d.js → chunk-7y8dng8t.js} +2 -2
  30. package/bin/{chunk-qksb0v3c.js → chunk-8m6zg15c.js} +2 -2
  31. package/bin/chunk-8n60m9x3.js +1 -0
  32. package/bin/{chunk-rtngbgpk.js → chunk-8qyke29r.js} +1 -1
  33. package/bin/chunk-8yz1expv.js +307 -0
  34. package/bin/{chunk-4qpa7b5t.js → chunk-90et6bwm.js} +1 -1
  35. package/bin/{chunk-hr97a5j5.js → chunk-9p2d0mk1.js} +1 -1
  36. package/bin/{chunk-c45rh4hk.js → chunk-a10tf0d8.js} +1 -1
  37. package/bin/{chunk-262hkppb.js → chunk-a76c5r3c.js} +2 -2
  38. package/bin/chunk-a9t667xv.js +1 -0
  39. package/bin/{chunk-ta7bfdrn.js → chunk-amsb41z5.js} +1 -1
  40. package/bin/{chunk-46ar48f9.js → chunk-arpna31w.js} +1 -1
  41. package/bin/{chunk-zzx99j8t.js → chunk-b10meywb.js} +1 -1
  42. package/bin/chunk-b1e3tec3.js +62 -0
  43. package/bin/chunk-bdjhb77e.js +2 -0
  44. package/bin/{chunk-8dqq1fk0.js → chunk-bmqw3j2d.js} +1 -1
  45. package/bin/{chunk-ybhgmvxa.js → chunk-c3fvs0bv.js} +2 -2
  46. package/bin/{chunk-fbte2rmd.js → chunk-c5my1b3k.js} +1 -1
  47. package/bin/{chunk-3rmc8nz6.js → chunk-dhekxndw.js} +1 -1
  48. package/bin/{chunk-g8th86na.js → chunk-dwaj1yn4.js} +1 -1
  49. package/bin/{chunk-cxhmr356.js → chunk-dwswqq3g.js} +1 -1
  50. package/bin/{chunk-15sefy5t.js → chunk-ejfmxjw6.js} +2 -2
  51. package/bin/chunk-er1rb6yj.js +1 -0
  52. package/bin/chunk-etces6ff.js +2 -0
  53. package/bin/{chunk-s1n39qte.js → chunk-etqpzc9e.js} +1 -1
  54. package/bin/{chunk-n4meg9wb.js → chunk-f8cn9m28.js} +1 -1
  55. package/bin/{chunk-fcvtgx1y.js → chunk-fdpjw17x.js} +1 -1
  56. package/bin/{chunk-29tx9qe2.js → chunk-g2dk56e7.js} +1 -1
  57. package/bin/{chunk-pxw97qbq.js → chunk-gn8snrnk.js} +1 -1
  58. package/bin/chunk-gqh4ttjh.js +3 -0
  59. package/bin/{chunk-14fh4s1a.js → chunk-gvn079hy.js} +2 -2
  60. package/bin/chunk-h270n69j.js +7 -0
  61. package/bin/{chunk-1xpec5r8.js → chunk-h2wsm7h3.js} +2 -2
  62. package/bin/{chunk-kfhtk3eh.js → chunk-hfp4hpca.js} +2 -2
  63. package/bin/{chunk-7we7ex0m.js → chunk-hrzm70wg.js} +1 -1
  64. package/bin/{chunk-bs0fjz3w.js → chunk-hz31j0hk.js} +2 -2
  65. package/bin/{chunk-wfx81mfv.js → chunk-j0p1peav.js} +2 -2
  66. package/bin/{chunk-s46zwr4p.js → chunk-jm6bxtzt.js} +1 -1
  67. package/bin/{chunk-9ab6k4rq.js → chunk-k20bhxed.js} +1 -1
  68. package/bin/{chunk-q09dfja5.js → chunk-k9w6mk9d.js} +2 -2
  69. package/bin/chunk-kgb16ggd.css +1 -0
  70. package/bin/{chunk-31baz5n0.js → chunk-m4py21f3.js} +1 -1
  71. package/bin/{chunk-dghtwyq1.js → chunk-mahxw48e.js} +2 -2
  72. package/bin/{chunk-ymeycphq.js → chunk-mcxsk75h.js} +3 -3
  73. package/bin/chunk-mqbxagfd.js +2 -0
  74. package/bin/{chunk-mqjzmn0e.js → chunk-na2nympm.js} +1 -1
  75. package/bin/{chunk-qwg2e3wr.js → chunk-nqh128dt.js} +2 -2
  76. package/bin/chunk-nr89225z.js +2 -0
  77. package/bin/chunk-nrf5r23d.js +1 -0
  78. package/bin/{chunk-e3s3rz2e.js → chunk-nt9tfjx6.js} +2 -2
  79. package/bin/chunk-nzy3pjjm.js +15 -0
  80. package/bin/{chunk-d3wmdjze.js → chunk-p396vw9h.js} +1 -1
  81. package/bin/{chunk-nhsqp8jc.js → chunk-p9xfyqh1.js} +2 -2
  82. package/bin/{chunk-nnkkem25.js → chunk-pgae67hk.js} +2 -2
  83. package/bin/chunk-ph11924k.js +1 -0
  84. package/bin/{chunk-yj4x7tpw.js → chunk-ph3e1bpp.js} +2 -2
  85. package/bin/{chunk-dqgv5yy1.js → chunk-pj0fgb2x.js} +1 -1
  86. package/bin/{chunk-925q4paa.js → chunk-pp072ksj.js} +1 -1
  87. package/bin/{chunk-ztmj61z9.js → chunk-q5cdjzbv.js} +1 -1
  88. package/bin/{chunk-88fg1sw7.js → chunk-qc6dmzn0.js} +2 -2
  89. package/bin/{chunk-6xg65n5y.js → chunk-qgq96tbp.js} +1 -1
  90. package/bin/{chunk-xcwbg4w9.js → chunk-qmtvy2j4.js} +2 -2
  91. package/bin/{chunk-9h027f50.js → chunk-qvgc9e08.js} +1 -1
  92. package/bin/chunk-rfh4ppaa.js +1 -0
  93. package/bin/chunk-rrhq3t4s.js +1 -0
  94. package/bin/{chunk-891h8br6.js → chunk-s05f0v9t.js} +1 -1
  95. package/bin/{chunk-wc8sc9r9.js → chunk-s7qpj715.js} +1 -1
  96. package/bin/{chunk-8wqfkm4c.js → chunk-sf6fwvrs.js} +1 -1
  97. package/bin/chunk-sr9bty78.js +1 -0
  98. package/bin/{chunk-9avkn3x1.js → chunk-ss45w8ks.js} +2 -2
  99. package/bin/{chunk-8qg47kj6.js → chunk-t2txvzkp.js} +1 -1
  100. package/bin/{chunk-bd71dp4j.js → chunk-td54rdfj.js} +1 -1
  101. package/bin/{chunk-0rxhc7ka.js → chunk-tsncwscz.js} +2 -2
  102. package/bin/chunk-vb9m47z9.js +1 -0
  103. package/bin/{chunk-3qks722n.js → chunk-ve7v8wtv.js} +2 -2
  104. package/bin/{chunk-922nnh39.js → chunk-vf066xwh.js} +1 -1
  105. package/bin/{chunk-97jzve52.js → chunk-vgb8bzcg.js} +2 -2
  106. package/bin/{chunk-js9yf457.js → chunk-vnfmh5ke.js} +2 -2
  107. package/bin/{chunk-6zascpcz.js → chunk-vt4zpasm.js} +1 -1
  108. package/bin/{chunk-j8qtab70.js → chunk-vy24ncn2.js} +1 -1
  109. package/bin/{chunk-w88219ex.js → chunk-w3a50kz8.js} +1 -1
  110. package/bin/{chunk-zemrvz79.js → chunk-w9w5301f.js} +2 -2
  111. package/bin/{chunk-fz88kkk1.js → chunk-wap08p4j.js} +2 -2
  112. package/bin/{chunk-d2vxmn9v.js → chunk-wny0qagx.js} +1 -1
  113. package/bin/{chunk-7hsgmjpa.js → chunk-wqhk76de.js} +2 -2
  114. package/bin/{chunk-5t6c3038.js → chunk-wr5byz6r.js} +1 -1
  115. package/bin/chunk-wrz9e73c.js +2 -0
  116. package/bin/{chunk-0qkj838r.js → chunk-ws07a9kv.js} +1 -1
  117. package/bin/{chunk-7b17fb36.js → chunk-x5dcgk62.js} +1 -1
  118. package/bin/{chunk-898q6x3q.js → chunk-xawwxdq9.js} +2 -2
  119. package/bin/{chunk-m4zpf9gg.js → chunk-y2nw8rbx.js} +2 -2
  120. package/bin/{chunk-hkbybhww.js → chunk-y9ttm07y.js} +1 -1
  121. package/bin/chunk-yahb7wan.js +2 -0
  122. package/bin/{chunk-5d2q46mx.js → chunk-zg0vm233.js} +1 -1
  123. package/bin/chunk-zhd2mkbr.js +1 -0
  124. package/bin/{chunk-dgat7wqv.js → chunk-zs9b0f3z.js} +2 -2
  125. package/bin/{chunk-mnfqdxms.js → chunk-zx9cv3t8.js} +1 -1
  126. package/bin/{chunk-1wm57c6y.js → chunk-zxpef55w.js} +3 -3
  127. package/bin/shumai-app.html +1 -1
  128. package/bin/shumai-app.js +293 -225
  129. package/package.json +8 -8
  130. package/prisma/migrations/20260728024147_add_agent_session_entry_columns/migration.sql +14 -0
  131. package/prisma/migrations/20260728024205_migrate_agent_session_entry_data/migration.sql +12 -0
  132. package/prisma/migrations/20260728031230_remove_agent_session_entry_legacy_entry_column/migration.sql +8 -0
  133. package/prisma/migrations/20260729073910_change_agent_session_asset_on_delete_to_set_null/migration.sql +5 -0
  134. package/prisma/migrations/20260729114346_asset_size_byte_bigint/migration.sql +2 -0
  135. package/prisma/migrations/20260729114659_ai_usage_tokens_bigint/migration.sql +5 -0
  136. package/prisma/schema.prisma +18 -12
  137. package/bin/chunk-0xbf8bcg.js +0 -2
  138. package/bin/chunk-23d3968z.js +0 -2
  139. package/bin/chunk-2a9n3dhx.js +0 -1
  140. package/bin/chunk-3hzj13pj.js +0 -1
  141. package/bin/chunk-3n1rezd0.js +0 -2
  142. package/bin/chunk-5vkf99sk.js +0 -1
  143. package/bin/chunk-6z65xd0w.js +0 -3
  144. package/bin/chunk-8tf6kgdj.js +0 -2
  145. package/bin/chunk-av71yjaa.js +0 -1
  146. package/bin/chunk-b73ktdmd.js +0 -320
  147. package/bin/chunk-carknytp.js +0 -1
  148. package/bin/chunk-chkx04mw.js +0 -1
  149. package/bin/chunk-crt1e1w1.js +0 -2
  150. package/bin/chunk-gswbc6y9.js +0 -2
  151. package/bin/chunk-hnhq0dh9.js +0 -1
  152. package/bin/chunk-j0c7d9y1.js +0 -1
  153. package/bin/chunk-jyzegph4.js +0 -1
  154. package/bin/chunk-kr06nrbx.js +0 -2
  155. package/bin/chunk-nyhqy6q2.js +0 -62
  156. package/bin/chunk-s8t74q9m.js +0 -1
  157. package/bin/chunk-se8rgwp8.js +0 -1
  158. package/bin/chunk-tm6z4hkd.css +0 -1
  159. package/bin/chunk-wckjyvtb.js +0 -5
  160. package/bin/chunk-wsyg4rwg.js +0 -2
  161. package/bin/chunk-wtjc4565.js +0 -1
  162. package/bin/chunk-y79r28gd.js +0 -1
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function z(b){if(b instanceof Error)return b.message||b.name;if(typeof b==="string")return b;return String(b)}function A(b){if(!(b instanceof Error))return{name:"ThrownValue",message:z(b)};let k=b.code;return{name:b.name||void 0,message:b.message||b.name,stack:b.stack,code:typeof k==="string"||typeof k==="number"?k:void 0}}function B(b,k,q){return{type:b,timestamp:Date.now(),error:A(k),details:q}}function C(b,k){b.diagnostics=[...b.diagnostics??[],k]}
3
- export{z as le,B as me,C as ne};
3
+ export{z as ne,B as oe,C as pe};
@@ -1,2 +1,2 @@
1
- import{Fh as n,Sh as e,mk as c,oh as r}from"./chunk-nyhqy6q2.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
- export{i as ef,l as ff,u as gf};
1
+ import{Mh as e,ih as r,ik as c,zh as n}from"./chunk-b1e3tec3.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
+ export{i as gf,l as hf,u as if};
@@ -0,0 +1 @@
1
+ import{h as RB,i as bB}from"./chunk-vt4zpasm.js";import{k as gB}from"./chunk-bmqw3j2d.js";import{o as LB,r as MB}from"./chunk-8yz1expv.js";import"./chunk-nzy3pjjm.js";import{P as NB}from"./chunk-mqbxagfd.js";import"./chunk-zhd2mkbr.js";import"./chunk-bdjhb77e.js";import{Wa as DB}from"./chunk-31mjcykb.js";import"./chunk-hfp4hpca.js";import"./chunk-3rcc5s99.js";import"./chunk-20y3wte3.js";import{Cf as kB}from"./chunk-ve7v8wtv.js";import"./chunk-7y8dng8t.js";import{jg as VB,kg as wB}from"./chunk-pgae67hk.js";import"./chunk-tsncwscz.js";import{qg as EB}from"./chunk-etces6ff.js";import{rg as $B}from"./chunk-yahb7wan.js";import"./chunk-mahxw48e.js";import"./chunk-wap08p4j.js";import{bh as PB}from"./chunk-nr89225z.js";import{Ah as TB,Gi as _B,Mh as q,Wh as p,ak as UB,eh as d,gh as XB,hh as zB,hi as ZB,ih as G,ik as yB,jh as D,kh as HB,nh as j,ph as QB,vh as qB,xh as YB}from"./chunk-b1e3tec3.js";import{Xk as KB}from"./chunk-ws07a9kv.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};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function f(b){return b.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}
3
- export{f as kc};
3
+ export{f as mc};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Wk as q,_k as M}from"./chunk-0qkj838r.js";var GG=q((xK,e)=>{var y=1000,f=y*60,x=f*60,I=x*24,CG=I*7,IG=I*365.25;e.exports=function(G,Q){Q=Q||{};var K=typeof G;if(K==="string"&&G.length>0)return _G(G);else if(K==="number"&&isFinite(G))return Q.long?yG(G):DG(G);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(G))};function _G(G){if(G=String(G),G.length>100)return;var Q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(G);if(!Q)return;var K=parseFloat(Q[1]),V=(Q[2]||"ms").toLowerCase();switch(V){case"years":case"year":case"yrs":case"yr":case"y":return K*IG;case"weeks":case"week":case"w":return K*CG;case"days":case"day":case"d":return K*I;case"hours":case"hour":case"hrs":case"hr":case"h":return K*x;case"minutes":case"minute":case"mins":case"min":case"m":return K*f;case"seconds":case"second":case"secs":case"sec":case"s":return K*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return K;default:return}}function DG(G){var Q=Math.abs(G);if(Q>=I)return Math.round(G/I)+"d";if(Q>=x)return Math.round(G/x)+"h";if(Q>=f)return Math.round(G/f)+"m";if(Q>=y)return Math.round(G/y)+"s";return G+"ms"}function yG(G){var Q=Math.abs(G);if(Q>=I)return u(G,Q,I,"day");if(Q>=x)return u(G,Q,x,"hour");if(Q>=f)return u(G,Q,f,"minute");if(Q>=y)return u(G,Q,y,"second");return G+" ms"}function u(G,Q,K,V){var Z=Q>=K*1.5;return Math.round(G/K)+" "+V+(Z?"s":"")}});var m=q((hK,KG)=>{function fG(G){K.debug=K,K.default=K,K.coerce=L,K.disable=J,K.enable=Z,K.enabled=N,K.humanize=GG(),K.destroy=v,Object.keys(G).forEach(($)=>{K[$]=G[$]}),K.names=[],K.skips=[],K.formatters={};function Q($){let w=0;for(let W=0;W<$.length;W++)w=(w<<5)-w+$.charCodeAt(W),w|=0;return K.colors[Math.abs(w)%K.colors.length]}K.selectColor=Q;function K($){let w,W=null,Y,R;function B(...X){if(!B.enabled)return;let T=B,j=Number(new Date),A=j-(w||j);if(T.diff=A,T.prev=w,T.curr=j,w=j,X[0]=K.coerce(X[0]),typeof X[0]!=="string")X.unshift("%O");let F=0;X[0]=X[0].replace(/%([a-zA-Z%])/g,(C,D)=>{if(C==="%%")return"%";F++;let s=K.formatters[D];if(typeof s==="function"){let AG=X[F];C=s.call(T,AG),X.splice(F,1),F--}return C}),K.formatArgs.call(T,X),(T.log||K.log).apply(T,X)}if(B.namespace=$,B.useColors=K.useColors(),B.color=K.selectColor($),B.extend=V,B.destroy=K.destroy,Object.defineProperty(B,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(W!==null)return W;if(Y!==K.namespaces)Y=K.namespaces,R=K.enabled($);return R},set:(X)=>{W=X}}),typeof K.init==="function")K.init(B);return B}function V($,w){let W=K(this.namespace+(typeof w>"u"?":":w)+$);return W.log=this.log,W}function Z($){K.save($),K.namespaces=$,K.names=[],K.skips=[];let w=(typeof $==="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let W of w)if(W[0]==="-")K.skips.push(W.slice(1));else K.names.push(W)}function z($,w){let W=0,Y=0,R=-1,B=0;while(W<$.length)if(Y<w.length&&(w[Y]===$[W]||w[Y]==="*"))if(w[Y]==="*")R=Y,B=W,Y++;else W++,Y++;else if(R!==-1)Y=R+1,B++,W=B;else return!1;while(Y<w.length&&w[Y]==="*")Y++;return Y===w.length}function J(){let $=[...K.names,...K.skips.map((w)=>"-"+w)].join(",");return K.enable(""),$}function N($){for(let w of K.skips)if(z($,w))return!1;for(let w of K.names)if(z($,w))return!0;return!1}function L($){if($ instanceof Error)return $.stack||$.message;return $}function v(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return K.enable(K.load()),K}KG.exports=fG});var VG=q((QG,g)=>{QG.formatArgs=hG;QG.save=vG;QG.load=bG;QG.useColors=xG;QG.storage=iG();QG.destroy=(()=>{let G=!1;return()=>{if(!G)G=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();QG.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xG(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let G;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(G=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(G[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hG(G){if(G[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+G[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;let Q="color: "+this.color;G.splice(1,0,Q,"color: inherit");let K=0,V=0;G[0].replace(/%[a-zA-Z%]/g,(Z)=>{if(Z==="%%")return;if(K++,Z==="%c")V=K}),G.splice(V,0,Q)}QG.log=console.debug||console.log||(()=>{});function vG(G){try{if(G)QG.storage.setItem("debug",G);else QG.storage.removeItem("debug")}catch(Q){}}function bG(){let G;try{G=QG.storage.getItem("debug")||QG.storage.getItem("DEBUG")}catch(Q){}if(!G&&typeof process<"u"&&"env"in process)G=process.env.DEBUG;return G}function iG(){try{return localStorage}catch(G){}}g.exports=m()(QG);var{formatters:kG}=g.exports;kG.j=function(G){try{return JSON.stringify(G)}catch(Q){return"[UnexpectedJSONParseError]: "+Q.message}}});var $G=q((bK,ZG)=>{ZG.exports=(G,Q=process.argv)=>{let K=G.startsWith("-")?"":G.length===1?"-":"--",V=Q.indexOf(K+G),Z=Q.indexOf("--");return V!==-1&&(Z===-1||V<Z)}});var JG=q((iK,zG)=>{var mG=M("os"),wG=M("tty"),O=$G(),{env:U}=process,d;if(O("no-color")||O("no-colors")||O("color=false")||O("color=never"))d=0;else if(O("color")||O("colors")||O("color=true")||O("color=always"))d=1;function rG(){if("FORCE_COLOR"in U){if(U.FORCE_COLOR==="true")return 1;if(U.FORCE_COLOR==="false")return 0;return U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}}function aG(G){if(G===0)return!1;return{level:G,hasBasic:!0,has256:G>=2,has16m:G>=3}}function oG(G,{streamIsTTY:Q,sniffFlags:K=!0}={}){let V=rG();if(V!==void 0)d=V;let Z=K?d:V;if(Z===0)return 0;if(K){if(O("color=16m")||O("color=full")||O("color=truecolor"))return 3;if(O("color=256"))return 2}if(G&&!Q&&Z===void 0)return 0;let z=Z||0;if(U.TERM==="dumb")return z;if(process.platform==="win32"){let J=mG.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in U){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((J)=>(J in U))||U.CI_NAME==="codeship")return 1;return z}if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in U){let J=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(U.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM))return 1;if("COLORTERM"in U)return 1;return z}function r(G,Q={}){let K=oG(G,{streamIsTTY:G&&G.isTTY,...Q});return aG(K)}zG.exports={supportsColor:r,stdout:r({isTTY:wG.isatty(1)}),stderr:r({isTTY:wG.isatty(2)})}});var BG=q((YG,l)=>{var tG=M("tty"),c=M("util");YG.init=ZK;YG.log=KK;YG.formatArgs=eG;YG.save=QK;YG.load=VK;YG.useColors=sG;YG.destroy=c.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");YG.colors=[6,2,3,4,5,1];try{let G=JG();if(G&&(G.stderr||G).level>=2)YG.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(G){}YG.inspectOpts=Object.keys(process.env).filter((G)=>{return/^debug_/i.test(G)}).reduce((G,Q)=>{let K=Q.substring(6).toLowerCase().replace(/_([a-z])/g,(Z,z)=>{return z.toUpperCase()}),V=process.env[Q];if(/^(yes|on|true|enabled)$/i.test(V))V=!0;else if(/^(no|off|false|disabled)$/i.test(V))V=!1;else if(V==="null")V=null;else V=Number(V);return G[K]=V,G},{});function sG(){return"colors"in YG.inspectOpts?Boolean(YG.inspectOpts.colors):tG.isatty(process.stderr.fd)}function eG(G){let{namespace:Q,useColors:K}=this;if(K){let V=this.color,Z="\x1B[3"+(V<8?V:"8;5;"+V),z=` ${Z};1m${Q} \x1B[0m`;G[0]=z+G[0].split(`
2
+ import{Yk as q,al as M}from"./chunk-ws07a9kv.js";var GG=q((xK,e)=>{var y=1000,f=y*60,x=f*60,I=x*24,CG=I*7,IG=I*365.25;e.exports=function(G,Q){Q=Q||{};var K=typeof G;if(K==="string"&&G.length>0)return _G(G);else if(K==="number"&&isFinite(G))return Q.long?yG(G):DG(G);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(G))};function _G(G){if(G=String(G),G.length>100)return;var Q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(G);if(!Q)return;var K=parseFloat(Q[1]),V=(Q[2]||"ms").toLowerCase();switch(V){case"years":case"year":case"yrs":case"yr":case"y":return K*IG;case"weeks":case"week":case"w":return K*CG;case"days":case"day":case"d":return K*I;case"hours":case"hour":case"hrs":case"hr":case"h":return K*x;case"minutes":case"minute":case"mins":case"min":case"m":return K*f;case"seconds":case"second":case"secs":case"sec":case"s":return K*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return K;default:return}}function DG(G){var Q=Math.abs(G);if(Q>=I)return Math.round(G/I)+"d";if(Q>=x)return Math.round(G/x)+"h";if(Q>=f)return Math.round(G/f)+"m";if(Q>=y)return Math.round(G/y)+"s";return G+"ms"}function yG(G){var Q=Math.abs(G);if(Q>=I)return u(G,Q,I,"day");if(Q>=x)return u(G,Q,x,"hour");if(Q>=f)return u(G,Q,f,"minute");if(Q>=y)return u(G,Q,y,"second");return G+" ms"}function u(G,Q,K,V){var Z=Q>=K*1.5;return Math.round(G/K)+" "+V+(Z?"s":"")}});var m=q((hK,KG)=>{function fG(G){K.debug=K,K.default=K,K.coerce=L,K.disable=J,K.enable=Z,K.enabled=N,K.humanize=GG(),K.destroy=v,Object.keys(G).forEach(($)=>{K[$]=G[$]}),K.names=[],K.skips=[],K.formatters={};function Q($){let w=0;for(let W=0;W<$.length;W++)w=(w<<5)-w+$.charCodeAt(W),w|=0;return K.colors[Math.abs(w)%K.colors.length]}K.selectColor=Q;function K($){let w,W=null,Y,R;function B(...X){if(!B.enabled)return;let T=B,j=Number(new Date),A=j-(w||j);if(T.diff=A,T.prev=w,T.curr=j,w=j,X[0]=K.coerce(X[0]),typeof X[0]!=="string")X.unshift("%O");let F=0;X[0]=X[0].replace(/%([a-zA-Z%])/g,(C,D)=>{if(C==="%%")return"%";F++;let s=K.formatters[D];if(typeof s==="function"){let AG=X[F];C=s.call(T,AG),X.splice(F,1),F--}return C}),K.formatArgs.call(T,X),(T.log||K.log).apply(T,X)}if(B.namespace=$,B.useColors=K.useColors(),B.color=K.selectColor($),B.extend=V,B.destroy=K.destroy,Object.defineProperty(B,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(W!==null)return W;if(Y!==K.namespaces)Y=K.namespaces,R=K.enabled($);return R},set:(X)=>{W=X}}),typeof K.init==="function")K.init(B);return B}function V($,w){let W=K(this.namespace+(typeof w>"u"?":":w)+$);return W.log=this.log,W}function Z($){K.save($),K.namespaces=$,K.names=[],K.skips=[];let w=(typeof $==="string"?$:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let W of w)if(W[0]==="-")K.skips.push(W.slice(1));else K.names.push(W)}function z($,w){let W=0,Y=0,R=-1,B=0;while(W<$.length)if(Y<w.length&&(w[Y]===$[W]||w[Y]==="*"))if(w[Y]==="*")R=Y,B=W,Y++;else W++,Y++;else if(R!==-1)Y=R+1,B++,W=B;else return!1;while(Y<w.length&&w[Y]==="*")Y++;return Y===w.length}function J(){let $=[...K.names,...K.skips.map((w)=>"-"+w)].join(",");return K.enable(""),$}function N($){for(let w of K.skips)if(z($,w))return!1;for(let w of K.names)if(z($,w))return!0;return!1}function L($){if($ instanceof Error)return $.stack||$.message;return $}function v(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return K.enable(K.load()),K}KG.exports=fG});var VG=q((QG,g)=>{QG.formatArgs=hG;QG.save=vG;QG.load=bG;QG.useColors=xG;QG.storage=iG();QG.destroy=(()=>{let G=!1;return()=>{if(!G)G=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();QG.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xG(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let G;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(G=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(G[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hG(G){if(G[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+G[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;let Q="color: "+this.color;G.splice(1,0,Q,"color: inherit");let K=0,V=0;G[0].replace(/%[a-zA-Z%]/g,(Z)=>{if(Z==="%%")return;if(K++,Z==="%c")V=K}),G.splice(V,0,Q)}QG.log=console.debug||console.log||(()=>{});function vG(G){try{if(G)QG.storage.setItem("debug",G);else QG.storage.removeItem("debug")}catch(Q){}}function bG(){let G;try{G=QG.storage.getItem("debug")||QG.storage.getItem("DEBUG")}catch(Q){}if(!G&&typeof process<"u"&&"env"in process)G=process.env.DEBUG;return G}function iG(){try{return localStorage}catch(G){}}g.exports=m()(QG);var{formatters:kG}=g.exports;kG.j=function(G){try{return JSON.stringify(G)}catch(Q){return"[UnexpectedJSONParseError]: "+Q.message}}});var $G=q((bK,ZG)=>{ZG.exports=(G,Q=process.argv)=>{let K=G.startsWith("-")?"":G.length===1?"-":"--",V=Q.indexOf(K+G),Z=Q.indexOf("--");return V!==-1&&(Z===-1||V<Z)}});var JG=q((iK,zG)=>{var mG=M("os"),wG=M("tty"),O=$G(),{env:U}=process,d;if(O("no-color")||O("no-colors")||O("color=false")||O("color=never"))d=0;else if(O("color")||O("colors")||O("color=true")||O("color=always"))d=1;function rG(){if("FORCE_COLOR"in U){if(U.FORCE_COLOR==="true")return 1;if(U.FORCE_COLOR==="false")return 0;return U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}}function aG(G){if(G===0)return!1;return{level:G,hasBasic:!0,has256:G>=2,has16m:G>=3}}function oG(G,{streamIsTTY:Q,sniffFlags:K=!0}={}){let V=rG();if(V!==void 0)d=V;let Z=K?d:V;if(Z===0)return 0;if(K){if(O("color=16m")||O("color=full")||O("color=truecolor"))return 3;if(O("color=256"))return 2}if(G&&!Q&&Z===void 0)return 0;let z=Z||0;if(U.TERM==="dumb")return z;if(process.platform==="win32"){let J=mG.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in U){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some((J)=>(J in U))||U.CI_NAME==="codeship")return 1;return z}if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in U){let J=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(U.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM))return 1;if("COLORTERM"in U)return 1;return z}function r(G,Q={}){let K=oG(G,{streamIsTTY:G&&G.isTTY,...Q});return aG(K)}zG.exports={supportsColor:r,stdout:r({isTTY:wG.isatty(1)}),stderr:r({isTTY:wG.isatty(2)})}});var BG=q((YG,l)=>{var tG=M("tty"),c=M("util");YG.init=ZK;YG.log=KK;YG.formatArgs=eG;YG.save=QK;YG.load=VK;YG.useColors=sG;YG.destroy=c.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");YG.colors=[6,2,3,4,5,1];try{let G=JG();if(G&&(G.stderr||G).level>=2)YG.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(G){}YG.inspectOpts=Object.keys(process.env).filter((G)=>{return/^debug_/i.test(G)}).reduce((G,Q)=>{let K=Q.substring(6).toLowerCase().replace(/_([a-z])/g,(Z,z)=>{return z.toUpperCase()}),V=process.env[Q];if(/^(yes|on|true|enabled)$/i.test(V))V=!0;else if(/^(no|off|false|disabled)$/i.test(V))V=!1;else if(V==="null")V=null;else V=Number(V);return G[K]=V,G},{});function sG(){return"colors"in YG.inspectOpts?Boolean(YG.inspectOpts.colors):tG.isatty(process.stderr.fd)}function eG(G){let{namespace:Q,useColors:K}=this;if(K){let V=this.color,Z="\x1B[3"+(V<8?V:"8;5;"+V),z=` ${Z};1m${Q} \x1B[0m`;G[0]=z+G[0].split(`
3
3
  `).join(`
4
4
  `+z),G.push(Z+"m+"+l.exports.humanize(this.diff)+"\x1B[0m")}else G[0]=GK()+Q+" "+G[0]}function GK(){if(YG.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function KK(...G){return process.stderr.write(c.formatWithOptions(YG.inspectOpts,...G)+`
5
5
  `)}function QK(G){if(G)process.env.DEBUG=G;else delete process.env.DEBUG}function VK(){return process.env.DEBUG}function ZK(G){G.inspectOpts={};let Q=Object.keys(YG.inspectOpts);for(let K=0;K<Q.length;K++)G.inspectOpts[Q[K]]=YG.inspectOpts[Q[K]]}l.exports=m()(YG);var{formatters:WG}=l.exports;WG.o=function(G){return this.inspectOpts.colors=this.useColors,c.inspect(G,this.inspectOpts).split(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Zb as V}from"./chunk-9avkn3x1.js";import{$b as U,_b as v,ac as x,bc as b,cc as f,dc as h}from"./chunk-m4zpf9gg.js";import{ec as I,fc as B}from"./chunk-w88219ex.js";import{hc as T}from"./chunk-2dsmsa6a.js";import{kc as C}from"./chunk-ta7bfdrn.js";import{mc as P}from"./chunk-pxw97qbq.js";import{$e as E,af as M}from"./chunk-q09dfja5.js";import{bf as y}from"./chunk-d2vxmn9v.js";import{Kk as F,Mk as K,Nk as j}from"./chunk-1wm57c6y.js";import"./chunk-0qkj838r.js";var k="v1",u="gcp-vertex-credentials",a={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},c=0,R=(q,w,J)=>{let Y=new y;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 $=n(J),D=$?l(q,$,J?.headers):p(q,t(J),o(J),J?.headers,J?.env),N=qq(q,w,J),L=await J?.onPayload?.(N,q);if(L!==void 0)N=L;let d=await D.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,O=Q.content,X=()=>O.length-1;for await(let z of d){Q.responseId||=z.responseId;let H=z.candidates?.[0];if(H?.content?.parts)for(let W of H.content.parts){if(W.text!==void 0){let _=v(W);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:O.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+=W.text,Z.thinkingSignature=U(Z.thinkingSignature,W.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:W.text,partial:Q});else Z.text+=W.text,Z.textSignature=U(Z.textSignature,W.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:W.text,partial:Q})}if(W.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 _=W.functionCall.id,S={type:"toolCall",id:!_||Q.content.some((A)=>A.type==="toolCall"&&A.id===_)?`${W.functionCall.name}_${Date.now()}_${++c}`:_,name:W.functionCall.name||"",arguments:W.functionCall.args??{},...W.thoughtSignature&&{thoughtSignature:W.thoughtSignature}};Q.content.push(S),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(S.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:S,partial:Q})}}if(H?.finishReason){if(Q.stopReason=h(H.finishReason),Q.content.some((W)=>W.type==="toolCall"))Q.stopReason="toolUse"}if(z.usageMetadata)Q.usage={input:(z.usageMetadata.promptTokenCount||0)-(z.usageMetadata.cachedContentTokenCount||0),output:(z.usageMetadata.candidatesTokenCount||0)+(z.usageMetadata.thoughtsTokenCount||0),cacheRead:z.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:z.usageMetadata.thoughtsTokenCount||0,totalTokens:z.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},E(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($){for(let D of Q.content)if("index"in D)delete D.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=B(I($)),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Hq=(q,w,J)=>{let Y=T(q,w,J,void 0);if(!J?.reasoning)return R(q,w,{...Y,thinking:{enabled:!1}});let Q=M(q,J.reasoning),$=Q==="off"?"high":Q,D=q;if(G(D)||m(D))return R(q,w,{...Y,thinking:{enabled:!0,level:Jq($,D)}});return R(q,w,{...Y,thinking:{enabled:!0,budgetTokens:Qq(D,$,J.thinkingBudgets)}})};function p(q,w,J,Y,Q){let $=i(Q);return new j({vertexai:!0,project:w,location:J,apiVersion:k,...$?{googleAuthOptions:$}:{},httpOptions:g(q,Y)})}function l(q,w,J){return new j({vertexai:!0,apiKey:w,apiVersion:k,httpOptions:g(q,J)})}function g(q,w){let J={},Y=r(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=K.COLLECTION,s(Y))J.apiVersion=""}let Q=P({...q.headers,...w});if(Q)J.headers=Q;return Object.keys(J).length>0?J:void 0}function r(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function s(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 i(q){let w=V("GOOGLE_APPLICATION_CREDENTIALS",q);return w?{keyFilename:w}:void 0}function n(q){let w=q?.apiKey?.trim();if(!w||w===u||e(w))return;return w}function e(q){return/^<[^>]+>$/.test(q)}function t(q){let w=q?.project||V("GOOGLE_CLOUD_PROJECT",q?.env)||V("GCLOUD_PROJECT",q?.env);if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function o(q){let w=q?.location||V("GOOGLE_CLOUD_LOCATION",q?.env);if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function qq(q,w,J={}){let Y=x(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let $={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:C(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:b(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)$.toolConfig={functionCallingConfig:{mode:f(J.toolChoice)}};else $.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=a[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;$.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)$.thinkingConfig=wq(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");$.abortSignal=J.signal}return{model:q.id,contents:Y,config:$}}function G(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function m(q){let w=q.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(w)||w==="gemini-flash-latest"||w==="gemini-flash-lite-latest"}function wq(q){let w=q;if(G(w))return{thinkingLevel:F.LOW};if(m(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function Jq(q,w){if(G(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 Qq(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{Hq as streamSimple,R as stream};
2
+ import{$b as V}from"./chunk-ss45w8ks.js";import{ac as v,bc as U,cc as x,dc as b,ec as f,fc as h}from"./chunk-y2nw8rbx.js";import{gc as I,hc as B}from"./chunk-w3a50kz8.js";import{jc as T}from"./chunk-6a2eb3b5.js";import{mc as C}from"./chunk-amsb41z5.js";import{oc as P}from"./chunk-gn8snrnk.js";import{bf as E,cf as M}from"./chunk-k9w6mk9d.js";import{df as y}from"./chunk-wny0qagx.js";import{Mk as F,Ok as K,Pk as j}from"./chunk-zxpef55w.js";import"./chunk-ws07a9kv.js";var k="v1",u="gcp-vertex-credentials",a={THINKING_LEVEL_UNSPECIFIED:F.THINKING_LEVEL_UNSPECIFIED,MINIMAL:F.MINIMAL,LOW:F.LOW,MEDIUM:F.MEDIUM,HIGH:F.HIGH},c=0,R=(q,w,J)=>{let Y=new y;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 $=n(J),D=$?l(q,$,J?.headers):p(q,t(J),o(J),J?.headers,J?.env),N=qq(q,w,J),L=await J?.onPayload?.(N,q);if(L!==void 0)N=L;let d=await D.models.generateContentStream(N);Y.push({type:"start",partial:Q});let Z=null,O=Q.content,X=()=>O.length-1;for await(let z of d){Q.responseId||=z.responseId;let H=z.candidates?.[0];if(H?.content?.parts)for(let W of H.content.parts){if(W.text!==void 0){let _=v(W);if(!Z||_&&Z.type!=="thinking"||!_&&Z.type!=="text"){if(Z)if(Z.type==="text")Y.push({type:"text_end",contentIndex:O.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+=W.text,Z.thinkingSignature=U(Z.thinkingSignature,W.thoughtSignature),Y.push({type:"thinking_delta",contentIndex:X(),delta:W.text,partial:Q});else Z.text+=W.text,Z.textSignature=U(Z.textSignature,W.thoughtSignature),Y.push({type:"text_delta",contentIndex:X(),delta:W.text,partial:Q})}if(W.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 _=W.functionCall.id,S={type:"toolCall",id:!_||Q.content.some((A)=>A.type==="toolCall"&&A.id===_)?`${W.functionCall.name}_${Date.now()}_${++c}`:_,name:W.functionCall.name||"",arguments:W.functionCall.args??{},...W.thoughtSignature&&{thoughtSignature:W.thoughtSignature}};Q.content.push(S),Y.push({type:"toolcall_start",contentIndex:X(),partial:Q}),Y.push({type:"toolcall_delta",contentIndex:X(),delta:JSON.stringify(S.arguments),partial:Q}),Y.push({type:"toolcall_end",contentIndex:X(),toolCall:S,partial:Q})}}if(H?.finishReason){if(Q.stopReason=h(H.finishReason),Q.content.some((W)=>W.type==="toolCall"))Q.stopReason="toolUse"}if(z.usageMetadata)Q.usage={input:(z.usageMetadata.promptTokenCount||0)-(z.usageMetadata.cachedContentTokenCount||0),output:(z.usageMetadata.candidatesTokenCount||0)+(z.usageMetadata.thoughtsTokenCount||0),cacheRead:z.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:z.usageMetadata.thoughtsTokenCount||0,totalTokens:z.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},E(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($){for(let D of Q.content)if("index"in D)delete D.index;Q.stopReason=J?.signal?.aborted?"aborted":"error",Q.errorMessage=B(I($)),Y.push({type:"error",reason:Q.stopReason,error:Q}),Y.end()}})(),Y},Hq=(q,w,J)=>{let Y=T(q,w,J,void 0);if(!J?.reasoning)return R(q,w,{...Y,thinking:{enabled:!1}});let Q=M(q,J.reasoning),$=Q==="off"?"high":Q,D=q;if(G(D)||m(D))return R(q,w,{...Y,thinking:{enabled:!0,level:Jq($,D)}});return R(q,w,{...Y,thinking:{enabled:!0,budgetTokens:Qq(D,$,J.thinkingBudgets)}})};function p(q,w,J,Y,Q){let $=i(Q);return new j({vertexai:!0,project:w,location:J,apiVersion:k,...$?{googleAuthOptions:$}:{},httpOptions:g(q,Y)})}function l(q,w,J){return new j({vertexai:!0,apiKey:w,apiVersion:k,httpOptions:g(q,J)})}function g(q,w){let J={},Y=r(q.baseUrl);if(Y){if(J.baseUrl=Y,J.baseUrlResourceScope=K.COLLECTION,s(Y))J.apiVersion=""}let Q=P({...q.headers,...w});if(Q)J.headers=Q;return Object.keys(J).length>0?J:void 0}function r(q){let w=q.trim();if(!w||w.includes("{location}"))return;return w}function s(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 i(q){let w=V("GOOGLE_APPLICATION_CREDENTIALS",q);return w?{keyFilename:w}:void 0}function n(q){let w=q?.apiKey?.trim();if(!w||w===u||e(w))return;return w}function e(q){return/^<[^>]+>$/.test(q)}function t(q){let w=q?.project||V("GOOGLE_CLOUD_PROJECT",q?.env)||V("GCLOUD_PROJECT",q?.env);if(!w)throw Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return w}function o(q){let w=q?.location||V("GOOGLE_CLOUD_LOCATION",q?.env);if(!w)throw Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return w}function qq(q,w,J={}){let Y=x(q,w),Q={};if(J.temperature!==void 0)Q.temperature=J.temperature;if(J.maxTokens!==void 0)Q.maxOutputTokens=J.maxTokens;let $={...Object.keys(Q).length>0&&Q,...w.systemPrompt&&{systemInstruction:C(w.systemPrompt)},...w.tools&&w.tools.length>0&&{tools:b(w.tools)}};if(w.tools&&w.tools.length>0&&J.toolChoice)$.toolConfig={functionCallingConfig:{mode:f(J.toolChoice)}};else $.toolConfig=void 0;if(J.thinking?.enabled&&q.reasoning){let N={includeThoughts:!0};if(J.thinking.level!==void 0)N.thinkingLevel=a[J.thinking.level];else if(J.thinking.budgetTokens!==void 0)N.thinkingBudget=J.thinking.budgetTokens;$.thinkingConfig=N}else if(q.reasoning&&J.thinking&&!J.thinking.enabled)$.thinkingConfig=wq(q);if(J.signal){if(J.signal.aborted)throw Error("Request aborted");$.abortSignal=J.signal}return{model:q.id,contents:Y,config:$}}function G(q){return/gemini-3(?:\.\d+)?-pro/.test(q.id.toLowerCase())}function m(q){let w=q.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(w)||w==="gemini-flash-latest"||w==="gemini-flash-lite-latest"}function wq(q){let w=q;if(G(w))return{thinkingLevel:F.LOW};if(m(w))return{thinkingLevel:F.MINIMAL};return{thinkingBudget:0}}function Jq(q,w){if(G(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 Qq(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{Hq as streamSimple,R as stream};