@shumai-one/shumai 0.3.6 → 0.3.7

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 (135) hide show
  1. package/bin/{chunk-gg1gwjtn.js → chunk-0jkqmbcx.js} +1 -1
  2. package/bin/{chunk-t5561vz5.js → chunk-0t8q76ac.js} +1 -1
  3. package/bin/chunk-0xern7e4.js +1 -0
  4. package/bin/{chunk-9p5n3m2z.js → chunk-0ycwr0kb.js} +1 -1
  5. package/bin/{chunk-55myfmhy.js → chunk-0yngn45x.js} +2 -2
  6. package/bin/{chunk-jtd7rydv.js → chunk-1khzycf9.js} +1 -1
  7. package/bin/{chunk-fwbrcfaq.js → chunk-1sqz0va1.js} +2 -2
  8. package/bin/{chunk-w4ycztv5.js → chunk-1xzc6z02.js} +1 -1
  9. package/bin/{chunk-y1t47c7f.js → chunk-2086rsb2.js} +1 -1
  10. package/bin/{chunk-5wrakb8p.js → chunk-260wywfb.js} +1 -1
  11. package/bin/{chunk-6edadcpn.js → chunk-2mqqghrz.js} +2 -2
  12. package/bin/{chunk-ghz19a7t.js → chunk-2xmsrq7f.js} +2 -2
  13. package/bin/{chunk-nh8azwsx.js → chunk-38g3s1f3.js} +2 -2
  14. package/bin/{chunk-0jesq6sm.js → chunk-3dx0p1ge.js} +1 -1
  15. package/bin/{chunk-ce50f746.js → chunk-3kqdgddm.js} +2 -2
  16. package/bin/{chunk-z0tbq08w.js → chunk-3xzgddev.js} +1 -1
  17. package/bin/{chunk-1b7shyfp.js → chunk-48nzw50r.js} +1 -1
  18. package/bin/{chunk-w16jgdfx.js → chunk-4bn9eb9h.js} +1 -1
  19. package/bin/chunk-4egayx81.js +2 -0
  20. package/bin/{chunk-ef5v7gta.js → chunk-4rbzswqs.js} +2 -2
  21. package/bin/{chunk-crdvxq38.js → chunk-503qq6sa.js} +2 -2
  22. package/bin/{chunk-d8bpqbdw.js → chunk-50keqtz9.js} +1 -1
  23. package/bin/{chunk-mmrtjcst.js → chunk-5gtew41y.js} +1 -1
  24. package/bin/chunk-60hpa5kf.js +3 -0
  25. package/bin/{chunk-4a9sdfyp.js → chunk-69tt1pvr.js} +2 -2
  26. package/bin/{chunk-rmm6y799.js → chunk-6fv38qdc.js} +2 -2
  27. package/bin/{chunk-vgr9db5g.js → chunk-6v39c8eg.js} +2 -2
  28. package/bin/{chunk-kaxwma6y.js → chunk-6zs49mef.js} +1 -1
  29. package/bin/{chunk-y8vw7zv1.js → chunk-7872prvg.js} +1 -1
  30. package/bin/{chunk-kk0gx8eg.js → chunk-7hnw6y6d.js} +2 -2
  31. package/bin/{chunk-47093mwk.js → chunk-7k3ccca6.js} +1 -1
  32. package/bin/chunk-815ezj20.js +1 -0
  33. package/bin/{chunk-ew4cxkcc.js → chunk-81tb4v5v.js} +2 -2
  34. package/bin/{chunk-ym47952x.js → chunk-83k0wa5k.js} +2 -2
  35. package/bin/{chunk-8js9m1j7.js → chunk-85eg9xqx.js} +1 -1
  36. package/bin/{chunk-vqgz25av.js → chunk-86aagej8.js} +1 -1
  37. package/bin/{chunk-f44d9fpd.js → chunk-87wqbn4g.js} +2 -2
  38. package/bin/chunk-8y1v9dm9.js +2 -0
  39. package/bin/{chunk-20wtz3kc.js → chunk-98j2z6he.js} +3 -3
  40. package/bin/chunk-9gq9782d.js +1 -0
  41. package/bin/{chunk-y0yrmcf3.js → chunk-9gzy30zm.js} +2 -2
  42. package/bin/{chunk-0sajh8fw.js → chunk-9nyhmtp9.js} +2 -2
  43. package/bin/{chunk-7b60a9sy.js → chunk-9s02m95j.js} +2 -2
  44. package/bin/{chunk-c9bpf8gp.js → chunk-9xhnmnnb.js} +2 -2
  45. package/bin/{chunk-hcvpb1hw.js → chunk-a0k1b4sq.js} +1 -1
  46. package/bin/{chunk-7fm1hznx.js → chunk-af6wbhkv.js} +2 -2
  47. package/bin/{chunk-sx7kparv.js → chunk-b3jh3hf1.js} +2 -2
  48. package/bin/{chunk-74zstxav.js → chunk-b8v7jvkb.js} +2 -2
  49. package/bin/{chunk-9tnfhrnh.js → chunk-bancgvrc.js} +2 -2
  50. package/bin/{chunk-a5fw02xq.js → chunk-br5xkaf7.js} +3 -3
  51. package/bin/chunk-bv88se28.css +1 -0
  52. package/bin/{chunk-nh31ma8d.js → chunk-cqq8e3hc.js} +2 -2
  53. package/bin/{chunk-mgbqjbfc.js → chunk-dej1gq35.js} +1 -1
  54. package/bin/{chunk-mhj0pqq3.js → chunk-dv1zpd2p.js} +2 -2
  55. package/bin/{chunk-0jr6q4j4.js → chunk-eetrc0j1.js} +2 -2
  56. package/bin/{chunk-6awkqp09.js → chunk-esrtafz0.js} +1 -1
  57. package/bin/chunk-eztggp8r.js +1 -0
  58. package/bin/{chunk-n198tewr.js → chunk-f2j2cqd1.js} +2 -2
  59. package/bin/{chunk-1f8rr3ef.js → chunk-fcs4v6jq.js} +2 -2
  60. package/bin/{chunk-dfzmqx1v.js → chunk-ftc48rbb.js} +3 -3
  61. package/bin/{chunk-pm64et9d.js → chunk-g60v3jc1.js} +1 -1
  62. package/bin/chunk-gf5ds9r9.js +2 -0
  63. package/bin/{chunk-f2eh802w.js → chunk-gjdmnfms.js} +1 -1
  64. package/bin/{chunk-gra3617w.js → chunk-gjn3w26y.js} +2 -2
  65. package/bin/{chunk-8jdgzy22.js → chunk-h9emz0zb.js} +2 -2
  66. package/bin/{chunk-3egeywt8.js → chunk-h9k2atte.js} +1 -1
  67. package/bin/{chunk-fzaw1e34.js → chunk-hqkmdp31.js} +2 -2
  68. package/bin/{chunk-9annjnj2.js → chunk-jszpvg8e.js} +2 -2
  69. package/bin/{chunk-snexx7ks.js → chunk-k48y9e5s.js} +1 -1
  70. package/bin/{chunk-d2qp8g98.js → chunk-karn564z.js} +2 -2
  71. package/bin/{chunk-fdm1yc29.js → chunk-kkq4wvnc.js} +1 -1
  72. package/bin/{chunk-aeg4kya9.js → chunk-kpn9d97x.js} +1 -1
  73. package/bin/chunk-ksx113sp.js +1 -0
  74. package/bin/chunk-m6a4rzdt.js +62 -0
  75. package/bin/chunk-mw8f8ngt.js +7 -0
  76. package/bin/{chunk-w98wvk17.js → chunk-n4gghgrj.js} +2 -2
  77. package/bin/{chunk-hqbzjzsm.js → chunk-n76r6s9k.js} +2 -2
  78. package/bin/{chunk-g70eyttc.js → chunk-nvjp2rnh.js} +2 -2
  79. package/bin/{chunk-29nhtrfv.js → chunk-p4c4z0f2.js} +1 -1
  80. package/bin/{chunk-ex4qa7gv.js → chunk-ptw49k86.js} +1 -1
  81. package/bin/{chunk-tqxmj05h.js → chunk-qcqw7wnv.js} +2 -2
  82. package/bin/{chunk-z0zevgb6.js → chunk-qdycy714.js} +1 -1
  83. package/bin/{chunk-gewh7p42.js → chunk-qh9rz2ee.js} +2 -2
  84. package/bin/{chunk-mxee09jk.js → chunk-qmpph1gt.js} +2 -2
  85. package/bin/{chunk-dmjzrdan.js → chunk-qy93r7tm.js} +2 -2
  86. package/bin/{chunk-j1awxx51.js → chunk-r5dv0rfv.js} +2 -2
  87. package/bin/{chunk-gct52xks.js → chunk-rfyaphas.js} +2 -2
  88. package/bin/chunk-rvspnthy.js +1 -0
  89. package/bin/{chunk-9hsfjqgq.js → chunk-s0hgykza.js} +2 -2
  90. package/bin/chunk-sjjndwt4.js +2 -0
  91. package/bin/{chunk-8g0mhzsg.js → chunk-t3tp9trj.js} +2 -2
  92. package/bin/{chunk-1fq10abj.js → chunk-t9t9evan.js} +2 -2
  93. package/bin/{chunk-vw1rhgjs.js → chunk-tpp9qf5m.js} +2 -2
  94. package/bin/chunk-tvg9gvqs.js +1 -0
  95. package/bin/{chunk-yzra1x8f.js → chunk-tzt4c1dm.js} +2 -2
  96. package/bin/{chunk-js0genbf.js → chunk-v8w2nxew.js} +1 -1
  97. package/bin/{chunk-z2ef8zpz.js → chunk-v98e3gex.js} +1 -1
  98. package/bin/{chunk-89kqtj7x.js → chunk-vxpnp4xg.js} +2 -2
  99. package/bin/{chunk-4ajat3xv.js → chunk-x3ynjbt5.js} +14 -14
  100. package/bin/{chunk-800vdz5n.js → chunk-x6532q76.js} +1 -1
  101. package/bin/chunk-xp4dcyk3.js +1 -0
  102. package/bin/chunk-y8aehqr8.js +2 -0
  103. package/bin/{chunk-n9cjmkky.js → chunk-ytzk81tr.js} +1 -1
  104. package/bin/chunk-yvxt48r4.js +1 -0
  105. package/bin/{chunk-q7xfrtnj.js → chunk-zg60j9x2.js} +1 -1
  106. package/bin/{chunk-bq2aq6v8.js → chunk-zjj9qj6y.js} +2 -2
  107. package/bin/{chunk-gx5rjm9m.js → chunk-zqg4f56h.js} +1 -1
  108. package/bin/{chunk-thj4cpev.js → chunk-zwgf211t.js} +2 -2
  109. package/bin/shumai-app.html +1 -1
  110. package/bin/shumai-app.js +240 -245
  111. package/package.json +7 -7
  112. package/prisma/migrations/20260813022501_backfill_autofill_source_in_config/migration.sql +8 -0
  113. package/prisma/migrations/20260813022502_drop_legacy_autofill_columns/migration.sql +12 -0
  114. package/prisma/migrations/20260813122613_add_network_sandbox_enabled_column/migration.sql +2 -0
  115. package/prisma/migrations/20260813122618_migrate_legacy_sandboxes_enabled/migration.sql +2 -0
  116. package/prisma/schema.prisma +8 -9
  117. package/bin/chunk-1hn9v6hv.js +0 -2
  118. package/bin/chunk-2882s5sp.js +0 -1
  119. package/bin/chunk-3htn4m2d.js +0 -7
  120. package/bin/chunk-6bztpk7h.js +0 -1
  121. package/bin/chunk-76hs7g0x.js +0 -2
  122. package/bin/chunk-e5s7202g.js +0 -2
  123. package/bin/chunk-f5zg7b38.js +0 -1
  124. package/bin/chunk-gh64hag9.js +0 -2
  125. package/bin/chunk-h0p8yew4.js +0 -1
  126. package/bin/chunk-hgngnc1k.js +0 -1
  127. package/bin/chunk-jt4yh37q.js +0 -62
  128. package/bin/chunk-k0xpskyq.js +0 -1
  129. package/bin/chunk-nhc72y4x.js +0 -2
  130. package/bin/chunk-px6q3jpz.js +0 -1
  131. package/bin/chunk-sx3by19j.js +0 -1
  132. package/bin/chunk-vz75bqvx.js +0 -2
  133. package/bin/chunk-wa8k9fwx.js +0 -1
  134. package/bin/chunk-z3p3qz9d.js +0 -3
  135. package/bin/chunk-zv85aqwb.css +0 -1
@@ -1 +1 @@
1
- import{c as d,d as x,e as r,f as D,g as G,h as M}from"./chunk-sx7kparv.js";import{oa as m}from"./chunk-vw1rhgjs.js";import{cb as p}from"./chunk-ef5v7gta.js";import"./chunk-gct52xks.js";import"./chunk-d2qp8g98.js";import{Df as I}from"./chunk-1fq10abj.js";import{Qf as g}from"./chunk-9hsfjqgq.js";import{Cg as u}from"./chunk-4a9sdfyp.js";import{Dg as f}from"./chunk-n198tewr.js";import{rh as b}from"./chunk-w98wvk17.js";import{$h as N,Ak as P,Bk as T,Dh as R,Di as C,Ek as Y,Fh as k,Kh as v,Ph as L,gj as S,ki as h,vh as o,wh as y,xh as q,yh as K,zi as z,zk as F}from"./chunk-jt4yh37q.js";import{Il as t}from"./chunk-mgbqjbfc.js";var Z=t(o(),1);var s=(X)=>{if(!X)return"??";return X.split(" ").map((_)=>_[0]).slice(0,2).join("").toUpperCase()};function e(){let{projectId:X}=qq.useParams(),{teamId:_,ensureTeamIdForProject:E}=b(),j=v();Z.useEffect(()=>{E(X)},[X,E]);let{data:O}=R(I(X)),W=O?.rootFolder,[n,i]=Z.useState(240),{fileListLeftSidebarCollapsed:A,setFileListLeftSidebarCollapsed:c}=u(),{data:B,isLoading:a,fetchNextPage:Q,hasNextPage:V,isFetchingNextPage:U}=k({queryKey:["collections",X],queryFn:async({pageParam:J})=>{let $=await N.api.projects[":projectId"].collections.$get({param:{projectId:X},query:{first:"20",after:J}});if(!$.ok)throw Error("Failed to fetch collections");return await $.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!X}),{ref:l,inView:H}=f();Z.useEffect(()=>{if(H&&V&&!U)Q()},[H,V,U,Q]);let w=Z.useMemo(()=>B?.pages.flatMap((J)=>J.data)||[],[B]);if(!_||!W||!O)return q(g,{});return q("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!A&&q("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>c(!0)}),!A&&K(y,{children:[q("div",{className:"bg-background",style:{width:n},children:q(m,{teamId:_,projectId:X,projectName:O.name??"",rootFolderId:W})}),q(p,{onResize:(J)=>{i(($)=>Math.max(180,Math.min(400,$+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[q("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-5 w-5 text-primary"}),q("h1",{className:"font-bold text-lg text-foreground",children:Y.all_collections()})]})}),q("div",{className:"flex-1 overflow-y-auto p-6",children:a?q("div",{className:"flex justify-center items-center h-64",children:q("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[q(S,{className:"h-10 w-10 text-muted-foreground/50"}),q("p",{children:Y.no_collections_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(d,{children:[q(x,{children:K(D,{className:"hover:bg-transparent bg-muted/20",children:[q(G,{className:"font-semibold px-4 py-3",children:Y.collection_name()}),q(G,{className:"font-semibold px-4 py-3",children:Y.creator()}),q(G,{className:"font-semibold px-4 py-3 w-[200px]",children:Y.created_date()})]})}),q(r,{children:w.map((J)=>K(D,{className:"hover:bg-muted/10 transition-colors cursor-pointer",onClick:()=>j({to:"/projects/$projectId/collections/$collectionId",params:{projectId:X,collectionId:J.id}}),children:[q(M,{className:"font-medium px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-4 w-4 text-primary shrink-0"}),q("span",{className:"text-foreground font-semibold hover:underline",children:J.name})]})}),q(M,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(F,{className:"h-6 w-6",children:[J.creator?.image&&q(P,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),q(T,{className:"text-[10px]",children:s(J.creator?.name)})]}),q("span",{className:"text-sm font-medium text-foreground truncate max-w-[200px]",children:J.creator?.name||Y.unknown()})]})}),q(M,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[q(C,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),q("span",{children:new Date(J.createdAt).toLocaleDateString()})]})})]},J.id))})]}),q("div",{ref:l,className:"h-10 w-full flex items-center justify-center",children:U&&q(h,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var qq=L("/projects/$projectId/collections/")({component:e});export{qq as Route};
1
+ import{a as d,b as x,c as r,d as D,e as G,f as M}from"./chunk-b3jh3hf1.js";import{qa as m}from"./chunk-tpp9qf5m.js";import{eb as p}from"./chunk-4rbzswqs.js";import"./chunk-rfyaphas.js";import"./chunk-karn564z.js";import{Ff as I}from"./chunk-t9t9evan.js";import{Sf as g}from"./chunk-s0hgykza.js";import{Eg as u}from"./chunk-69tt1pvr.js";import{Fg as f}from"./chunk-f2j2cqd1.js";import{th as b}from"./chunk-n4gghgrj.js";import{Ah as K,Di as z,Dk as F,Ek as P,Fh as R,Fk as T,Hh as k,Hi as C,Ik as Y,Mh as v,Rh as L,bi as N,kj as S,ni as h,xh as o,yh as y,zh as q}from"./chunk-m6a4rzdt.js";import{Nl as t}from"./chunk-dej1gq35.js";var Z=t(o(),1);var s=(X)=>{if(!X)return"??";return X.split(" ").map((_)=>_[0]).slice(0,2).join("").toUpperCase()};function e(){let{projectId:X}=qq.useParams(),{teamId:_,ensureTeamIdForProject:E}=b(),j=v();Z.useEffect(()=>{E(X)},[X,E]);let{data:O}=R(I(X)),W=O?.rootFolder,[n,i]=Z.useState(240),{fileListLeftSidebarCollapsed:A,setFileListLeftSidebarCollapsed:c}=u(),{data:B,isLoading:a,fetchNextPage:Q,hasNextPage:V,isFetchingNextPage:U}=k({queryKey:["collections",X],queryFn:async({pageParam:J})=>{let $=await N.api.projects[":projectId"].collections.$get({param:{projectId:X},query:{first:"20",after:J}});if(!$.ok)throw Error("Failed to fetch collections");return await $.json()},initialPageParam:"",getNextPageParam:(J)=>J.pageInfo?.cursor||void 0,enabled:!!X}),{ref:l,inView:H}=f();Z.useEffect(()=>{if(H&&V&&!U)Q()},[H,V,U,Q]);let w=Z.useMemo(()=>B?.pages.flatMap((J)=>J.data)||[],[B]);if(!_||!W||!O)return q(g,{});return q("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:K("div",{className:"flex flex-1 overflow-hidden relative",children:[!A&&q("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>c(!0)}),!A&&K(y,{children:[q("div",{className:"bg-background",style:{width:n},children:q(m,{teamId:_,projectId:X,projectName:O.name??"",rootFolderId:W})}),q(p,{onResize:(J)=>{i(($)=>Math.max(180,Math.min(400,$+J)))},className:"hidden md:block"})]}),K("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[q("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-5 w-5 text-primary"}),q("h1",{className:"font-bold text-lg text-foreground",children:Y.all_collections()})]})}),q("div",{className:"flex-1 overflow-y-auto p-6",children:a?q("div",{className:"flex justify-center items-center h-64",children:q("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):w.length===0?K("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[q(S,{className:"h-10 w-10 text-muted-foreground/50"}),q("p",{children:Y.no_collections_yet()})]}):K("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[K(d,{children:[q(x,{children:K(D,{className:"hover:bg-transparent bg-muted/20",children:[q(G,{className:"font-semibold px-4 py-3",children:Y.collection_name()}),q(G,{className:"font-semibold px-4 py-3",children:Y.creator()}),q(G,{className:"font-semibold px-4 py-3 w-[200px]",children:Y.created_date()})]})}),q(r,{children:w.map((J)=>K(D,{className:"hover:bg-muted/10 transition-colors cursor-pointer",onClick:()=>j({to:"/projects/$projectId/collections/$collectionId",params:{projectId:X,collectionId:J.id}}),children:[q(M,{className:"font-medium px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[q(z,{className:"h-4 w-4 text-primary shrink-0"}),q("span",{className:"text-foreground font-semibold hover:underline",children:J.name})]})}),q(M,{className:"px-4 py-3.5",children:K("div",{className:"flex items-center gap-2",children:[K(F,{className:"h-6 w-6",children:[J.creator?.image&&q(P,{src:J.creator.image,alt:J.creator.name,className:"object-cover"}),q(T,{className:"text-[10px]",children:s(J.creator?.name)})]}),q("span",{className:"text-sm font-medium text-foreground truncate max-w-[200px]",children:J.creator?.name||Y.unknown()})]})}),q(M,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:K("div",{className:"flex items-center gap-2",children:[q(C,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),q("span",{children:new Date(J.createdAt).toLocaleDateString()})]})})]},J.id))})]}),q("div",{ref:l,className:"h-10 w-full flex items-center justify-center",children:U&&q(h,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var qq=L("/projects/$projectId/collections/")({component:e});export{qq as Route};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Nl as G}from"./chunk-mgbqjbfc.js";var q=null;function H(k){if(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)return;if(q===null){q=new Map;try{let{readFileSync:w}=G("fs"),D=w("/proc/self/environ","utf-8");for(let z of D.split("\x00")){let A=z.indexOf("=");if(A>0)q.set(z.slice(0,A),z.slice(A+1))}}catch{}}return q.get(k)}function I(k,w){return w?.[k]||(typeof process<"u"?process.env[k]:void 0)||H(k)||void 0}
3
- export{I as Xk};
2
+ import{Sl as G}from"./chunk-dej1gq35.js";var q=null;function H(k){if(typeof process>"u"||!process.versions?.bun||Object.keys(process.env).length>0)return;if(q===null){q=new Map;try{let{readFileSync:w}=G("fs"),D=w("/proc/self/environ","utf-8");for(let z of D.split("\x00")){let A=z.indexOf("=");if(A>0)q.set(z.slice(0,A),z.slice(A+1))}}catch{}}return q.get(k)}function I(k,w){return w?.[k]||(typeof process<"u"?process.env[k]:void 0)||H(k)||void 0}
3
+ export{I as al};
@@ -1,2 +1,2 @@
1
- import{Qf as A}from"./chunk-9hsfjqgq.js";import{$h as z,Oh as w,xh as v}from"./chunk-jt4yh37q.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/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
- export{B as Bf,H as Cf};
1
+ import{Sf as A}from"./chunk-s0hgykza.js";import{Qh as w,bi as z,zh as v}from"./chunk-m6a4rzdt.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/")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
2
+ export{B as Df,H as Ef};
@@ -21,4 +21,4 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
21
21
  new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
22
22
 
23
23
  https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
24
- `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as Uk,b3 as Vk};
24
+ `);this.baseURL=z.baseURL,this.timeout=z.timeout??x2.DEFAULT_TIMEOUT,this.logger=z.logger??console;let N="warn";this.logLevel=N,this.logLevel=Z2(z.logLevel,"ClientOptions.logLevel",this)??Z2(a("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??N,this.fetchOptions=z.fetchOptions,this.maxRetries=z.maxRetries??2,this.fetch=z.fetch??b2(),E(this,m0,g2,"f"),this._options=z,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Y,this.project=$,this.webhookSecret=G}withOptions(X){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...X})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:X,nulls:Z}){return}async authHeaders(X){return V([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(X){return n2(X)}getUserAgent(){return`${this.constructor.name}/JS ${NX}`}defaultIdempotencyKey(){return`stainless-node-retry-${u0()}`}makeStatusError(X,Z,Y,$){return f.generate(X,Z,Y,$)}async _callApiKey(){let X=this._options.apiKey;if(typeof X!=="function")return!1;let Z;try{Z=await X()}catch(Y){if(Y instanceof U)throw Y;throw new U(`Failed to get token from 'apiKey' function: ${Y.message}`,{cause:Y})}if(typeof Z!=="string"||!Z)throw new U(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(X,Z,Y){let $=!K(this,O2,"m",y3).call(this)&&Y||this.baseURL,G=C2(X)?new URL(X):new URL($+($.endsWith("/")&&X.startsWith("/")?X.slice(1):X)),W=this.defaultQuery();if(!D2(W))Z={...W,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))G.search=this.stringifyQuery(Z);return G.toString()}async prepareOptions(X){await this._callApiKey()}async prepareRequest(X,{url:Z,options:Y}){}get(X,Z){return this.methodRequest("get",X,Z)}post(X,Z){return this.methodRequest("post",X,Z)}patch(X,Z){return this.methodRequest("patch",X,Z)}put(X,Z){return this.methodRequest("put",X,Z)}delete(X,Z){return this.methodRequest("delete",X,Z)}methodRequest(X,Z,Y){return this.request(Promise.resolve(Y).then(($)=>{return{method:X,path:Z,...$}}))}request(X,Z=null){return new xX(this,this.makeRequest(X,Z,void 0))}async makeRequest(X,Z,Y){let $=await X,G=$.maxRetries??this.maxRetries;if(Z==null)Z=G;await this.prepareOptions($);let{req:W,url:z,timeout:N}=await this.buildRequest($,{retryCount:G-Z});await this.prepareRequest(W,{url:z,options:$});let w="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),F=Y===void 0?"":`, retryOf: ${Y}`,M=Date.now();if(S(this).debug(`[${w}] sending request`,GX({retryOfRequestLogID:Y,method:$.method,url:z,options:$,headers:W.headers})),$.signal?.aborted)throw new I;let H=new AbortController,B=await this.fetchWithTimeout(z,W,N,H).catch(wZ),q=Date.now();if(B instanceof globalThis.Error){let C=`retrying, ${Z} attempts remaining`;if($.signal?.aborted)throw new I;let P=VZ(B)||/timed? ?out/i.test(String(B)+("cause"in B?String(B.cause):""));if(Z)return S(this).info(`[${w}] connection ${P?"timed out":"failed"} - ${C}`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (${C})`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),this.retryRequest($,Z,Y??w);if(S(this).info(`[${w}] connection ${P?"timed out":"failed"} - error; no more retries left`),S(this).debug(`[${w}] connection ${P?"timed out":"failed"} (error; no more retries left)`,GX({retryOfRequestLogID:Y,url:z,durationMs:q-M,message:B.message})),P)throw new OX;throw new LX({cause:B})}let T=[...B.headers.entries()].filter(([C])=>C==="x-request-id").map(([C,P])=>", "+C+": "+JSON.stringify(P)).join(""),D=`[${w}${F}${T}] ${W.method} ${z} ${B.ok?"succeeded":"failed"} with status ${B.status} in ${q-M}ms`;if(!B.ok){let C=await this.shouldRetry(B);if(Z&&C){let j=`retrying, ${Z} attempts remaining`;return await v2(B.body),S(this).info(`${D} - ${j}`),S(this).debug(`[${w}] response error (${j})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),this.retryRequest($,Z,Y??w,B.headers)}let P=C?"error; no more retries left":"error; not retryable";S(this).info(`${D} - ${P}`);let x=await B.text().catch((j)=>wZ(j).message),_=S2(x),R=_?void 0:x;throw S(this).debug(`[${w}] response error (${P})`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,message:R,durationMs:Date.now()-M})),this.makeStatusError(B.status,_,R,B.headers)}return S(this).info(D),S(this).debug(`[${w}] response start`,GX({retryOfRequestLogID:Y,url:B.url,status:B.status,headers:B.headers,durationMs:q-M})),{response:B,options:$,controller:H,requestLogID:w,retryOfRequestLogID:Y,startTime:M}}getAPIList(X,Z,Y){return this.requestAPIList(Z,Y&&"then"in Y?Y.then(($)=>({method:"get",path:X,...$})):{method:"get",path:X,...Y})}requestAPIList(X,Z){let Y=this.makeRequest(Z,null,void 0);return new q0(this,Y,X)}async fetchWithTimeout(X,Z,Y,$){let{signal:G,method:W,...z}=Z||{},N=this._makeAbort($);if(G)G.addEventListener("abort",N,{once:!0});let w=setTimeout(N,Y),F=globalThis.ReadableStream&&z.body instanceof globalThis.ReadableStream||typeof z.body==="object"&&z.body!==null&&Symbol.asyncIterator in z.body,M={signal:$.signal,...F?{duplex:"half"}:{},method:"GET",...z};if(W)M.method=W.toUpperCase();try{return await this.fetch.call(void 0,X,M)}finally{clearTimeout(w)}}async shouldRetry(X){let Z=X.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(X.status===408)return!0;if(X.status===409)return!0;if(X.status===429)return!0;if(X.status>=500)return!0;return!1}async retryRequest(X,Z,Y,$){let G,W=$?.get("retry-after-ms");if(W){let N=parseFloat(W);if(!Number.isNaN(N))G=N}let z=$?.get("retry-after");if(z&&!G){let N=parseFloat(z);if(!Number.isNaN(N))G=N*1000;else G=Date.parse(z)-Date.now()}if(G===void 0){let N=X.maxRetries??this.maxRetries;G=this.calculateDefaultRetryTimeoutMillis(Z,N)}return await s(G),this.makeRequest(X,Z-1,Y)}calculateDefaultRetryTimeoutMillis(X,Z){let G=Z-X,W=Math.min(0.5*Math.pow(2,G),8),z=1-Math.random()*0.25;return W*z*1000}async buildRequest(X,{retryCount:Z=0}={}){let Y={...X},{method:$,path:G,query:W,defaultBaseURL:z}=Y,N=this.buildURL(G,W,z);if("timeout"in Y)R2("timeout",Y.timeout);Y.timeout=Y.timeout??this.timeout;let{bodyHeaders:w,body:F}=this.buildBody({options:Y}),M=await this.buildHeaders({options:X,method:$,bodyHeaders:w,retryCount:Z});return{req:{method:$,headers:M,...Y.signal&&{signal:Y.signal},...globalThis.ReadableStream&&F instanceof globalThis.ReadableStream&&{duplex:"half"},...F&&{body:F},...this.fetchOptions??{},...Y.fetchOptions??{}},url:N,timeout:Y.timeout}}async buildHeaders({options:X,method:Z,bodyHeaders:Y,retryCount:$}){let G={};if(this.idempotencyHeader&&Z!=="get"){if(!X.idempotencyKey)X.idempotencyKey=this.defaultIdempotencyKey();G[this.idempotencyHeader]=X.idempotencyKey}let W=V([G,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String($),...X.timeout?{"X-Stainless-Timeout":String(Math.trunc(X.timeout/1000))}:{},...y2(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(X),this._options.defaultHeaders,Y,X.headers]);return this.validateHeaders(W),W.values}_makeAbort(X){return()=>X.abort()}buildBody({options:{body:X,headers:Z}}){if(!X)return{bodyHeaders:void 0,body:void 0};let Y=V([Z]);if(ArrayBuffer.isView(X)||X instanceof ArrayBuffer||X instanceof DataView||typeof X==="string"&&Y.values.has("content-type")||globalThis.Blob&&X instanceof globalThis.Blob||X instanceof FormData||X instanceof URLSearchParams||globalThis.ReadableStream&&X instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:X};else if(typeof X==="object"&&((Symbol.asyncIterator in X)||(Symbol.iterator in X)&&("next"in X)&&typeof X.next==="function"))return{bodyHeaders:void 0,body:w0(X)};else if(typeof X==="object"&&Y.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(X)};else return K(this,m0,"f").call(this,{body:X,headers:Y})}}x2=L,m0=new WeakMap,O2=new WeakSet,y3=function(){return this.baseURL!=="https://api.openai.com/v1"};L.OpenAI=x2;L.DEFAULT_TIMEOUT=600000;L.OpenAIError=U;L.APIError=f;L.APIConnectionError=LX;L.APIConnectionTimeoutError=OX;L.APIUserAbortError=I;L.NotFoundError=TZ;L.ConflictError=MZ;L.RateLimitError=qZ;L.BadRequestError=HZ;L.AuthenticationError=UZ;L.InternalServerError=LZ;L.PermissionDeniedError=FZ;L.UnprocessableEntityError=EZ;L.InvalidWebhookSignatureError=$X;L.toFile=O0;L.Completions=sX;L.Chat=CX;L.Embeddings=oX;L.Files=XZ;L.Images=GZ;L.Audio=QX;L.Moderations=KZ;L.Models=WZ;L.FineTuning=ZX;L.Graders=bX;L.VectorStores=qX;L.Webhooks=NZ;L.Beta=XX;L.Batches=nX;L.Uploads=vX;L.Responses=MX;L.Realtime=FX;L.Conversations=IX;L.Evals=yX;L.Containers=jX;L.Skills=EX;L.Videos=QZ;class b3 extends L{constructor({baseURL:X=a("OPENAI_BASE_URL"),apiKey:Z=a("AZURE_OPENAI_API_KEY"),apiVersion:Y=a("OPENAI_API_VERSION"),endpoint:$,deployment:G,azureADTokenProvider:W,dangerouslyAllowBrowser:z,...N}={}){if(!Y)throw new U("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof W==="function")z=!0;if(!W&&!Z)throw new U("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(W&&Z)throw new U("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(N.defaultQuery={...N.defaultQuery,"api-version":Y},!X){if(!$)$=process.env.AZURE_OPENAI_ENDPOINT;if(!$)throw new U("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");X=`${$}/openai`}else if($)throw new U("baseURL and endpoint are mutually exclusive");super({apiKey:W??Z,baseURL:X,...N,...z!==void 0?{dangerouslyAllowBrowser:z}:{}});this.apiVersion="",this.apiVersion=Y,this.deploymentName=G}async buildRequest(X,Z={}){if(J8.has(X.path)&&X.method==="post"&&X.body!==void 0){if(!gX(X.body))throw Error("Expected request body to be an object");let Y=this.deploymentName||X.body.model||X.__metadata?.model;if(Y!==void 0&&!this.baseURL.includes("/deployments"))X.path=`/deployments/${Y}${X.path}`}return super.buildRequest(X,Z)}async authHeaders(X){if(typeof this._options.apiKey==="string")return V([{"api-key":this.apiKey}]);return super.authHeaders(X)}}var J8=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"]);export{L as Zk,b3 as _k};
@@ -1,2 +1,2 @@
1
- import{hk as o,wk as l,xh as e,yh as d,yk as n}from"./chunk-jt4yh37q.js";function u({...t}){return e(o.Root,{"data-slot":"alert-dialog",...t})}function s({...t}){return e(o.Portal,{"data-slot":"alert-dialog-portal",...t})}function g({className:t,...a}){return e(o.Overlay,{"data-slot":"alert-dialog-overlay",className:l("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",t),...a})}function f({className:t,size:a="default",...i}){return d(s,{children:[e(g,{}),e(o.Content,{"data-slot":"alert-dialog-content","data-size":a,className:l("group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",t),...i})]})}function P({className:t,...a}){return e("div",{"data-slot":"alert-dialog-header",className:l("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...a})}function A({className:t,...a}){return e("div",{"data-slot":"alert-dialog-footer",className:l("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...a})}function D({className:t,...a}){return e(o.Title,{"data-slot":"alert-dialog-title",className:l("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...a})}function v({className:t,...a}){return e(o.Description,{"data-slot":"alert-dialog-description",className:l("text-sm text-muted-foreground",t),...a})}function z({className:t,variant:a="default",size:i="default",...r}){return e(n,{variant:a,size:i,asChild:!0,children:e(o.Action,{"data-slot":"alert-dialog-action",className:l(t),...r})})}function C({className:t,variant:a="outline",size:i="default",...r}){return e(n,{variant:a,size:i,asChild:!0,children:e(o.Cancel,{"data-slot":"alert-dialog-cancel",className:l(t),...r})})}
2
- export{u as ib,f as jb,P as kb,A as lb,D as mb,v as nb,z as ob,C as pb};
1
+ import{Ah as d,Ak as l,Ck as n,lk as o,zh as e}from"./chunk-m6a4rzdt.js";function u({...t}){return e(o.Root,{"data-slot":"alert-dialog",...t})}function s({...t}){return e(o.Portal,{"data-slot":"alert-dialog-portal",...t})}function g({className:t,...a}){return e(o.Overlay,{"data-slot":"alert-dialog-overlay",className:l("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",t),...a})}function f({className:t,size:a="default",...i}){return d(s,{children:[e(g,{}),e(o.Content,{"data-slot":"alert-dialog-content","data-size":a,className:l("group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",t),...i})]})}function P({className:t,...a}){return e("div",{"data-slot":"alert-dialog-header",className:l("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...a})}function A({className:t,...a}){return e("div",{"data-slot":"alert-dialog-footer",className:l("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...a})}function D({className:t,...a}){return e(o.Title,{"data-slot":"alert-dialog-title",className:l("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...a})}function v({className:t,...a}){return e(o.Description,{"data-slot":"alert-dialog-description",className:l("text-sm text-muted-foreground",t),...a})}function z({className:t,variant:a="default",size:i="default",...r}){return e(n,{variant:a,size:i,asChild:!0,children:e(o.Action,{"data-slot":"alert-dialog-action",className:l(t),...r})})}function C({className:t,variant:a="outline",size:i="default",...r}){return e(n,{variant:a,size:i,asChild:!0,children:e(o.Cancel,{"data-slot":"alert-dialog-cancel",className:l(t),...r})})}
2
+ export{u as kb,f as lb,P as mb,A as nb,D as ob,v as pb,z as qb,C as rb};
@@ -1 +1 @@
1
- import{j as z1,k as y1}from"./chunk-hqbzjzsm.js";import{m as w1}from"./chunk-e5s7202g.js";import{q as iz,t as tz}from"./chunk-4ajat3xv.js";import"./chunk-mhj0pqq3.js";import{H as rz,R as sz}from"./chunk-76hs7g0x.js";import"./chunk-0sajh8fw.js";import"./chunk-ym47952x.js";import"./chunk-nhc72y4x.js";import{cb as ez}from"./chunk-ef5v7gta.js";import"./chunk-gct52xks.js";import"./chunk-ce50f746.js";import{ib as mz,jb as Iz,kb as uz,lb as dz,mb as lz,nb as nz,ob as oz,pb as az}from"./chunk-d2qp8g98.js";import{Rf as cz}from"./chunk-9hsfjqgq.js";import"./chunk-mxee09jk.js";import{vg as vz,wg as Cz}from"./chunk-0jr6q4j4.js";import"./chunk-f44d9fpd.js";import{Cg as Rz}from"./chunk-4a9sdfyp.js";import{Dg as Ez}from"./chunk-n198tewr.js";import"./chunk-ghz19a7t.js";import"./chunk-7fm1hznx.js";import"./chunk-6edadcpn.js";import{rh as Az}from"./chunk-w98wvk17.js";import{$h as T,Ch as f,Eh as d,Ek as U,Fk as Dz,Gk as Sz,Hk as fz,Ik as pz,Jk as jz,Kh as gz,Kk as Fz,Mh as Oz,Ph as xz,Wi as Vz,Zh as p,ki as A,th as zz,vh as bz,wh as Lz,wk as qz,xh as y,xi as Pz,yh as _,yk as yz,zh as Mz}from"./chunk-jt4yh37q.js";import{Il as kz}from"./chunk-mgbqjbfc.js";var B=kz(bz(),1);var R1=({item:X})=>{if(X.preview?.thumbnailUrl)return y("img",{src:X.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(X.preview?.proxyType==="audio"||X.proxyType==="audio")return y("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:y(Pz,{className:"w-5 h-5 text-muted-foreground"})});return y("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:y(Vz,{className:"w-5 h-5 text-muted-foreground"})})},hz=({projectId:X,currentAssetId:G,parentFolderId:b,initialFiles:W,initialNextCursor:E})=>{let{ref:Y,inView:h}=Ez({threshold:0,rootMargin:"200px"}),O=B.useRef(null),N=B.useRef(!1),[$,P]=B.useState(W),[J,v]=B.useState(E),[R,j]=B.useState(!!E),[L,V]=B.useState(!1);return B.useEffect(()=>{P(W),v(E),j(!!E),N.current=!1},[W,E]),B.useEffect(()=>{(async()=>{if(!J||L||!h||!R)return;V(!0);try{let H=await T.api.folders[":folderId"].search.$post({param:{folderId:b},json:{assetType:"file",after:J,first:200,recursively:!1,conditions:[]}});if(!H.ok)throw Error("Failed to fetch next page");let C=await H.json(),M=C.data||[];P((l)=>[...l,...M]),v(C.pageInfo?.cursor||void 0),j(!!C.pageInfo?.cursor&&M.length>0)}catch(H){console.error("Error fetching next page:",H)}finally{V(!1)}})()},[h,J,R,L,b]),B.useEffect(()=>{N.current=!1},[G]),B.useEffect(()=>{if($.some((H)=>H?.id===G)&&O.current&&!N.current)O.current.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}),N.current=!0},[$,G]),y("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:_("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:[$.map((k)=>{if(!k)return null;let H=k.id===G;return y("div",{ref:k.id===G?O:null,className:"flex-shrink-0",children:y(Oz,{to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:k.id},search:{version:void 0},className:qz("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",H?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:y(R1,{item:k})})},k.id)}),R&&y("div",{ref:Y,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&&y(A,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var K=kz(bz(),1);function C1(){let{projectId:X,fileId:G}=Nz.useParams(),b=Nz.useSearch(),W=b.version,E=b.start,Y=W||G,h=b.cmpLeft,O=b.cmpRight,N=b.cmpActive??"left",$=!!b.compare&&!!h&&!!O,P=K.useRef(null),{teamId:J,ensureTeamIdForProject:v}=Az(),[R,j]=K.useState(360),[L,V]=K.useState([]),{fileViewRightSidebarCollapsed:k}=Rz(),{isChatbotOpen:H}=Cz(),[C,M]=K.useState(0),[l,F]=K.useState(null),[wz,K1]=K.useState(null),[X1,G1]=K.useState(void 0),[D,n]=K.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),J1=T.api.files[":fileId"].metadata.$patch,{mutate:Y1}=d({mutationFn:async(z)=>{let w=await J1(z);if(!w.ok)throw Error("Failed to patch metadata");return await w.json()}}),S=Mz(),{members:Z1,fetchMembers:Kz}=sz();K.useEffect(()=>{v(X)},[X,v]),K.useEffect(()=>{if(J)Kz(J,!0)},[J,Kz]);let{data:Xz,isLoading:_1,isError:U1,isFetching:W1}=f({queryKey:["files",G],queryFn:async()=>{let z=await T.api.files[":fileId"].$get({param:{fileId:G}});if(!z.ok)throw Error("Failed to fetch stack");return await z.json()},enabled:!!J,placeholderData:zz}),{data:B1,isLoading:$1,isError:H1,isFetching:Q1}=f({queryKey:["files",W],queryFn:async()=>{let z=await T.api.files[":fileId"].$get({param:{fileId:W}});if(!z.ok)throw Error("Failed to fetch version");return await z.json()},enabled:!!J&&!!W,placeholderData:zz}),{data:T1}=f({queryKey:["version_stacks",G,"versions"],queryFn:async()=>{let z=await T.api.version_stacks[":stackId"].versions.$get({param:{stackId:G}});if(!z.ok)throw Error("Failed to fetch versions");return await z.json()},enabled:!!X&&!!G&&(!!W||$)}),{data:g}=f({queryKey:["projects",X],queryFn:async()=>{let z=await T.api.projects[":projectId"].$get({param:{projectId:X}});if(!z.ok)throw Error("Failed to fetch project");return await z.json()}}),x=gz(),{setProjectState:Gz,clearProjectState:Jz}=vz(),k1=_1||!!W&&$1,b1=U1||!!W&&H1,O1=W1||!!W&&Q1,Z=B1||Xz,q=W?T1:Xz?.versionStack?.versions,Q=Z?.ancestorFolders?.[0]?.id??g?.rootFolder??"",[o,c]=K.useState(!1),[m,Yz]=K.useState(""),a=K.useRef(null),r=K.useRef(!1),[P1,s]=K.useState(!1),V1=T.api.files[":fileId"].$put,{mutate:q1,isPending:Zz}=d({mutationFn:async(z)=>{let w=await V1(z);if(!w.ok)throw Error("Failed to rename file");return await w.json()},onSuccess:()=>{S.invalidateQueries({queryKey:["files"]}),S.invalidateQueries({queryKey:["version_stacks"]}),p.success(U.renamed_successfully?.()||"Renamed successfully"),c(!1)},onError:()=>{p.error(U.failed_to_rename?.()||"Failed to rename")}}),E1=T.api.files.$delete,{mutate:h1,isPending:_z}=d({mutationFn:async(z)=>{if(!(await E1(z)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(S.invalidateQueries({queryKey:["files"]}),S.invalidateQueries({queryKey:["version_stacks"]}),p.success(U.deleted?.()||"Deleted"),s(!1),Q&&Q!==g?.rootFolder)x({to:"/projects/$projectId/folders/$folderId",params:{projectId:X,folderId:Q}});else x({to:"/projects/$projectId",params:{projectId:X}})},onError:()=>{p.error(U.failed_to_delete?.()||"Failed to delete")}}),N1=(z)=>{if(z?.preventDefault(),!m.trim()||!Y)return;q1({param:{fileId:Y},json:{name:m.trim()}})},L1=()=>{if(!Y)return;h1({json:{ids:[Y]}})};K.useEffect(()=>{if(Z&&g&&J)Gz({teamId:J,projectId:X,projectName:g.name??"",ancestorFolders:Z.ancestorFolders??[],currentAsset:{name:Z.name,type:"file",version:q?q.find((z)=>z.id===Y)?.version??q.length:void 0,proxyType:Z.proxyType},isRootFolder:!1,fileId:G,downloadInfo:{originalKey:Z.media?.original?.key,videoTranscodes:Z.media?.videoTranscodes?.map((z)=>({key:z.key,width:z.width,height:z.height}))},versions:q,compareMode:$,canCompareVersions:(q?.length??0)>=2,onCompareVersions:()=>{let z=iz(q);if(!z)return;x({to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:G},search:(w)=>({...w,version:void 0,compare:!0,cmpLeft:z.left.id,cmpRight:z.right.id,cmpActive:"left"})})},onFolderClick:(z)=>{x({to:"/projects/$projectId/folders/$folderId",params:{projectId:X,folderId:z}})},onRename:()=>{r.current=!1,Yz(Z?.name??""),c(!0)},onDelete:()=>{s(!0)}});return()=>Jz()},[J,X,g,Z,q,Y,G,$,Gz,Jz,x]),K.useEffect(()=>{if(!o)return;let z=setTimeout(()=>{r.current=!0},1000);return()=>clearTimeout(z)},[o]);let M1=()=>{if(r.current)return;setTimeout(()=>{if(a.current)rz(a.current)},0)};if(K.useEffect(()=>{if(!Q||!Y)return;if(D.folderId===Q)return;let z=!0;return(async()=>{try{let I="",Bz=!1,$z=[],Hz=void 0;for(let Qz=0;Qz<5;Qz++){let Tz=await T.api.folders[":folderId"].search.$post({param:{folderId:Q},json:{assetType:"file",after:I,first:200,recursively:!1,conditions:[]}});if(!Tz.ok)throw Error("Failed to search parent folder for carousel");let u=await Tz.json(),e=u.data||[];if($z.push(...e),e.some((v1)=>v1.id===Y)){Bz=!0,Hz=u.pageInfo?.cursor||void 0;break}if(!u.pageInfo?.cursor||e.length<200)break;I=u.pageInfo.cursor}if(z)if(Bz)n({show:!0,files:$z,nextCursor:Hz,folderId:Q});else n({show:!1,files:[],nextCursor:void 0,folderId:Q})}catch(I){if(console.error(I),z)n({show:!1,files:[],nextCursor:void 0,folderId:Q})}})(),()=>{z=!1}},[Q,Y,D.folderId]),K.useEffect(()=>{M(0),F(null),V([])},[Z?.id]),K.useEffect(()=>{F(null),V([])},[wz?.id]),k1&&!Z)return y(cz,{});if(b1||!Z||!g||!J)return y("div",{children:U.file_not_found()});let i=$?wz:Z,Uz=i?.id??Y,g1=(z,w)=>{if(!J)return;Y1({param:{fileId:Uz},json:[{key:z,value:w}]},{onSuccess:()=>{S.invalidateQueries({queryKey:["files",Uz]})}})},t=(z)=>{x({to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:G},search:(w)=>({...w,...z})})},x1=()=>{t({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?h:O})},A1=(z)=>{F(z.id||null);let w=z.annotations;if(w&&w.length>0)V(w);else V([]);if($){if(z.second!==null&&z.second!==void 0)G1({second:z.second,nonce:Date.now()});return}if(z.second!==null&&z.second!==void 0)P.current?.seekTo(z.second),P.current?.pause();else if(w&&w.length>0)P.current?.pause()},Wz=()=>{V([]),F(null)};return _("div",{className:"h-full flex flex-1 flex-col bg-background",children:[_("div",{className:"h-full flex flex-1 overflow-hidden",children:[_("div",{className:"flex-1 relative",children:[O1&&!$&&y("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:y(A,{className:"h-8 w-8 animate-spin text-foreground"})}),$&&h&&O?y(y1,{versions:q??[],leftId:h,rightId:O,activeSide:N,annotations:L,seekRequest:X1,onActiveSideChange:(z)=>t({cmpActive:z}),onSwitchVersion:(z,w)=>t(z==="left"?{cmpLeft:w}:{cmpRight:w}),onExit:x1,onActiveAssetChange:K1,onPlay:Wz,onTimeUpdate:M}):y(z1,{file:Z,mediaControllerRef:P,onPlay:Wz,onTimeUpdate:M,annotations:L,startTime:E,children:D.show&&y(hz,{projectId:X,currentAssetId:Y,parentFolderId:Q,initialFiles:D.files,initialNextCursor:D.nextCursor})})]}),(!k||H)&&_(Lz,{children:[y(ez,{onResize:(z)=>{j((w)=>Math.max(300,Math.min(600,w-z)))},className:"hidden md:block"}),y("div",{style:{width:R},className:"flex-shrink-0 bg-background flex flex-col",children:H?y(w1,{projectId:X,contextAssetId:Y}):y(tz,{teamId:J,projectId:X,file:i,onSaveField:g1,members:Z1,onCommentSelect:A1,currentTime:C,onTyping:()=>{if($)return;P.current?.pause()},selectedCommentId:l,hideAnnotationControl:i?.proxyType==="audio"})})]})]}),y(Sz,{open:o,onOpenChange:c,children:y(fz,{children:_("form",{onSubmit:N1,children:[y(pz,{children:y(Fz,{children:U.rename()})}),y("div",{className:"py-4",children:y(Dz,{ref:a,value:m,onChange:(z)=>Yz(z.target.value),placeholder:U.enter_new_name?.()||"Enter new name",onFocus:M1,autoFocus:!0})}),_(jz,{children:[y(yz,{type:"button",variant:"outline",onClick:()=>c(!1),children:U.cancel()}),_(yz,{type:"submit",disabled:Zz||!m.trim(),children:[Zz&&y(A,{className:"mr-2 h-4 w-4 animate-spin"}),U.save()]})]})]})})}),y(mz,{open:P1,onOpenChange:s,children:_(Iz,{children:[_(uz,{children:[y(lz,{children:U.delete_asset_title?.()||"Delete Asset?"}),y(nz,{children:U.delete_asset_description?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),_(dz,{children:[y(az,{children:U.cancel()}),_(oz,{onClick:L1,disabled:_z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[_z&&y(A,{className:"mr-2 h-4 w-4 animate-spin"}),U.delete()]})]})]})})]})}var Nz=xz("/projects/$projectId/files/$fileId")({component:C1});export{Nz as Route};
1
+ import{h as z1,i as y1}from"./chunk-n76r6s9k.js";import{k as w1}from"./chunk-sjjndwt4.js";import{o as iz,r as tz}from"./chunk-x3ynjbt5.js";import"./chunk-dv1zpd2p.js";import{F as rz,Q as sz}from"./chunk-y8aehqr8.js";import"./chunk-9nyhmtp9.js";import"./chunk-83k0wa5k.js";import"./chunk-8y1v9dm9.js";import{eb as ez}from"./chunk-4rbzswqs.js";import"./chunk-rfyaphas.js";import"./chunk-3kqdgddm.js";import{kb as mz,lb as Iz,mb as uz,nb as dz,ob as lz,pb as nz,qb as oz,rb as az}from"./chunk-karn564z.js";import{Tf as cz}from"./chunk-s0hgykza.js";import"./chunk-qmpph1gt.js";import{xg as vz,yg as Cz}from"./chunk-eetrc0j1.js";import"./chunk-87wqbn4g.js";import{Eg as Rz}from"./chunk-69tt1pvr.js";import{Fg as Ez}from"./chunk-f2j2cqd1.js";import"./chunk-2xmsrq7f.js";import"./chunk-af6wbhkv.js";import"./chunk-2mqqghrz.js";import{th as Az}from"./chunk-n4gghgrj.js";import{$h as p,Ah as _,Ai as Pz,Ak as qz,Bh as Mz,Ck as yz,Eh as f,Gh as d,Ik as U,Jk as Dz,Kk as Sz,Mh as gz,Mk as fz,Nk as pz,Oh as Oz,Ok as jz,Pk as Fz,Rh as xz,_i as Vz,bi as T,ni as A,vh as zz,xh as bz,yh as Lz,zh as y}from"./chunk-m6a4rzdt.js";import{Nl as kz}from"./chunk-dej1gq35.js";var B=kz(bz(),1);var R1=({item:X})=>{if(X.preview?.thumbnailUrl)return y("img",{src:X.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(X.preview?.proxyType==="audio"||X.proxyType==="audio")return y("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:y(Pz,{className:"w-5 h-5 text-muted-foreground"})});return y("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:y(Vz,{className:"w-5 h-5 text-muted-foreground"})})},hz=({projectId:X,currentAssetId:G,parentFolderId:b,initialFiles:W,initialNextCursor:E})=>{let{ref:Y,inView:h}=Ez({threshold:0,rootMargin:"200px"}),O=B.useRef(null),N=B.useRef(!1),[$,P]=B.useState(W),[J,v]=B.useState(E),[R,j]=B.useState(!!E),[L,V]=B.useState(!1);return B.useEffect(()=>{P(W),v(E),j(!!E),N.current=!1},[W,E]),B.useEffect(()=>{(async()=>{if(!J||L||!h||!R)return;V(!0);try{let H=await T.api.folders[":folderId"].search.$post({param:{folderId:b},json:{assetType:"file",after:J,first:200,recursively:!1,conditions:[]}});if(!H.ok)throw Error("Failed to fetch next page");let C=await H.json(),M=C.data||[];P((l)=>[...l,...M]),v(C.pageInfo?.cursor||void 0),j(!!C.pageInfo?.cursor&&M.length>0)}catch(H){console.error("Error fetching next page:",H)}finally{V(!1)}})()},[h,J,R,L,b]),B.useEffect(()=>{N.current=!1},[G]),B.useEffect(()=>{if($.some((H)=>H?.id===G)&&O.current&&!N.current)O.current.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}),N.current=!0},[$,G]),y("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:_("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:[$.map((k)=>{if(!k)return null;let H=k.id===G;return y("div",{ref:k.id===G?O:null,className:"flex-shrink-0",children:y(Oz,{to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:k.id},search:{version:void 0},className:qz("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block",H?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:y(R1,{item:k})})},k.id)}),R&&y("div",{ref:Y,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&&y(A,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};var K=kz(bz(),1);function C1(){let{projectId:X,fileId:G}=Nz.useParams(),b=Nz.useSearch(),W=b.version,E=b.start,Y=W||G,h=b.cmpLeft,O=b.cmpRight,N=b.cmpActive??"left",$=!!b.compare&&!!h&&!!O,P=K.useRef(null),{teamId:J,ensureTeamIdForProject:v}=Az(),[R,j]=K.useState(360),[L,V]=K.useState([]),{fileViewRightSidebarCollapsed:k}=Rz(),{isChatbotOpen:H}=Cz(),[C,M]=K.useState(0),[l,F]=K.useState(null),[wz,K1]=K.useState(null),[X1,G1]=K.useState(void 0),[D,n]=K.useState({show:!1,files:[],nextCursor:void 0,folderId:void 0}),J1=T.api.files[":fileId"].metadata.$patch,{mutate:Y1}=d({mutationFn:async(z)=>{let w=await J1(z);if(!w.ok)throw Error("Failed to patch metadata");return await w.json()}}),S=Mz(),{members:Z1,fetchMembers:Kz}=sz();K.useEffect(()=>{v(X)},[X,v]),K.useEffect(()=>{if(J)Kz(J,!0)},[J,Kz]);let{data:Xz,isLoading:_1,isError:U1,isFetching:W1}=f({queryKey:["files",G],queryFn:async()=>{let z=await T.api.files[":fileId"].$get({param:{fileId:G}});if(!z.ok)throw Error("Failed to fetch stack");return await z.json()},enabled:!!J,placeholderData:zz}),{data:B1,isLoading:$1,isError:H1,isFetching:Q1}=f({queryKey:["files",W],queryFn:async()=>{let z=await T.api.files[":fileId"].$get({param:{fileId:W}});if(!z.ok)throw Error("Failed to fetch version");return await z.json()},enabled:!!J&&!!W,placeholderData:zz}),{data:T1}=f({queryKey:["version_stacks",G,"versions"],queryFn:async()=>{let z=await T.api.version_stacks[":stackId"].versions.$get({param:{stackId:G}});if(!z.ok)throw Error("Failed to fetch versions");return await z.json()},enabled:!!X&&!!G&&(!!W||$)}),{data:g}=f({queryKey:["projects",X],queryFn:async()=>{let z=await T.api.projects[":projectId"].$get({param:{projectId:X}});if(!z.ok)throw Error("Failed to fetch project");return await z.json()}}),x=gz(),{setProjectState:Gz,clearProjectState:Jz}=vz(),k1=_1||!!W&&$1,b1=U1||!!W&&H1,O1=W1||!!W&&Q1,Z=B1||Xz,q=W?T1:Xz?.versionStack?.versions,Q=Z?.ancestorFolders?.[0]?.id??g?.rootFolder??"",[o,c]=K.useState(!1),[m,Yz]=K.useState(""),a=K.useRef(null),r=K.useRef(!1),[P1,s]=K.useState(!1),V1=T.api.files[":fileId"].$put,{mutate:q1,isPending:Zz}=d({mutationFn:async(z)=>{let w=await V1(z);if(!w.ok)throw Error("Failed to rename file");return await w.json()},onSuccess:()=>{S.invalidateQueries({queryKey:["files"]}),S.invalidateQueries({queryKey:["version_stacks"]}),p.success(U.renamed_successfully?.()||"Renamed successfully"),c(!1)},onError:()=>{p.error(U.failed_to_rename?.()||"Failed to rename")}}),E1=T.api.files.$delete,{mutate:h1,isPending:_z}=d({mutationFn:async(z)=>{if(!(await E1(z)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(S.invalidateQueries({queryKey:["files"]}),S.invalidateQueries({queryKey:["version_stacks"]}),p.success(U.deleted?.()||"Deleted"),s(!1),Q&&Q!==g?.rootFolder)x({to:"/projects/$projectId/folders/$folderId",params:{projectId:X,folderId:Q}});else x({to:"/projects/$projectId",params:{projectId:X}})},onError:()=>{p.error(U.failed_to_delete?.()||"Failed to delete")}}),N1=(z)=>{if(z?.preventDefault(),!m.trim()||!Y)return;q1({param:{fileId:Y},json:{name:m.trim()}})},L1=()=>{if(!Y)return;h1({json:{ids:[Y]}})};K.useEffect(()=>{if(Z&&g&&J)Gz({teamId:J,projectId:X,projectName:g.name??"",ancestorFolders:Z.ancestorFolders??[],currentAsset:{name:Z.name,type:"file",version:q?q.find((z)=>z.id===Y)?.version??q.length:void 0,proxyType:Z.proxyType},isRootFolder:!1,fileId:G,downloadInfo:{originalKey:Z.media?.original?.key,videoTranscodes:Z.media?.videoTranscodes?.map((z)=>({key:z.key,width:z.width,height:z.height}))},versions:q,compareMode:$,canCompareVersions:(q?.length??0)>=2,onCompareVersions:()=>{let z=iz(q);if(!z)return;x({to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:G},search:(w)=>({...w,version:void 0,compare:!0,cmpLeft:z.left.id,cmpRight:z.right.id,cmpActive:"left"})})},onFolderClick:(z)=>{x({to:"/projects/$projectId/folders/$folderId",params:{projectId:X,folderId:z}})},onRename:()=>{r.current=!1,Yz(Z?.name??""),c(!0)},onDelete:()=>{s(!0)}});return()=>Jz()},[J,X,g,Z,q,Y,G,$,Gz,Jz,x]),K.useEffect(()=>{if(!o)return;let z=setTimeout(()=>{r.current=!0},1000);return()=>clearTimeout(z)},[o]);let M1=()=>{if(r.current)return;setTimeout(()=>{if(a.current)rz(a.current)},0)};if(K.useEffect(()=>{if(!Q||!Y)return;if(D.folderId===Q)return;let z=!0;return(async()=>{try{let I="",Bz=!1,$z=[],Hz=void 0;for(let Qz=0;Qz<5;Qz++){let Tz=await T.api.folders[":folderId"].search.$post({param:{folderId:Q},json:{assetType:"file",after:I,first:200,recursively:!1,conditions:[]}});if(!Tz.ok)throw Error("Failed to search parent folder for carousel");let u=await Tz.json(),e=u.data||[];if($z.push(...e),e.some((v1)=>v1.id===Y)){Bz=!0,Hz=u.pageInfo?.cursor||void 0;break}if(!u.pageInfo?.cursor||e.length<200)break;I=u.pageInfo.cursor}if(z)if(Bz)n({show:!0,files:$z,nextCursor:Hz,folderId:Q});else n({show:!1,files:[],nextCursor:void 0,folderId:Q})}catch(I){if(console.error(I),z)n({show:!1,files:[],nextCursor:void 0,folderId:Q})}})(),()=>{z=!1}},[Q,Y,D.folderId]),K.useEffect(()=>{M(0),F(null),V([])},[Z?.id]),K.useEffect(()=>{F(null),V([])},[wz?.id]),k1&&!Z)return y(cz,{});if(b1||!Z||!g||!J)return y("div",{children:U.file_not_found()});let i=$?wz:Z,Uz=i?.id??Y,g1=(z,w)=>{if(!J)return;Y1({param:{fileId:Uz},json:[{key:z,value:w}]},{onSuccess:()=>{S.invalidateQueries({queryKey:["files",Uz]})}})},t=(z)=>{x({to:"/projects/$projectId/files/$fileId",params:{projectId:X,fileId:G},search:(w)=>({...w,...z})})},x1=()=>{t({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:N==="left"?h:O})},A1=(z)=>{F(z.id||null);let w=z.annotations;if(w&&w.length>0)V(w);else V([]);if($){if(z.second!==null&&z.second!==void 0)G1({second:z.second,nonce:Date.now()});return}if(z.second!==null&&z.second!==void 0)P.current?.seekTo(z.second),P.current?.pause();else if(w&&w.length>0)P.current?.pause()},Wz=()=>{V([]),F(null)};return _("div",{className:"h-full flex flex-1 flex-col bg-background",children:[_("div",{className:"h-full flex flex-1 overflow-hidden",children:[_("div",{className:"flex-1 relative",children:[O1&&!$&&y("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:y(A,{className:"h-8 w-8 animate-spin text-foreground"})}),$&&h&&O?y(y1,{versions:q??[],leftId:h,rightId:O,activeSide:N,annotations:L,seekRequest:X1,onActiveSideChange:(z)=>t({cmpActive:z}),onSwitchVersion:(z,w)=>t(z==="left"?{cmpLeft:w}:{cmpRight:w}),onExit:x1,onActiveAssetChange:K1,onPlay:Wz,onTimeUpdate:M}):y(z1,{file:Z,mediaControllerRef:P,onPlay:Wz,onTimeUpdate:M,annotations:L,startTime:E,children:D.show&&y(hz,{projectId:X,currentAssetId:Y,parentFolderId:Q,initialFiles:D.files,initialNextCursor:D.nextCursor})})]}),(!k||H)&&_(Lz,{children:[y(ez,{onResize:(z)=>{j((w)=>Math.max(300,Math.min(600,w-z)))},className:"hidden md:block"}),y("div",{style:{width:R},className:"flex-shrink-0 bg-background flex flex-col",children:H?y(w1,{projectId:X,contextAssetId:Y}):y(tz,{teamId:J,projectId:X,file:i,onSaveField:g1,members:Z1,onCommentSelect:A1,currentTime:C,onTyping:()=>{if($)return;P.current?.pause()},selectedCommentId:l,hideAnnotationControl:i?.proxyType==="audio"})})]})]}),y(Sz,{open:o,onOpenChange:c,children:y(fz,{children:_("form",{onSubmit:N1,children:[y(pz,{children:y(Fz,{children:U.rename()})}),y("div",{className:"py-4",children:y(Dz,{ref:a,value:m,onChange:(z)=>Yz(z.target.value),placeholder:U.enter_new_name?.()||"Enter new name",onFocus:M1,autoFocus:!0})}),_(jz,{children:[y(yz,{type:"button",variant:"outline",onClick:()=>c(!1),children:U.cancel()}),_(yz,{type:"submit",disabled:Zz||!m.trim(),children:[Zz&&y(A,{className:"mr-2 h-4 w-4 animate-spin"}),U.save()]})]})]})})}),y(mz,{open:P1,onOpenChange:s,children:_(Iz,{children:[_(uz,{children:[y(lz,{children:U.delete_asset_title?.()||"Delete Asset?"}),y(nz,{children:U.delete_asset_description?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),_(dz,{children:[y(az,{children:U.cancel()}),_(oz,{onClick:L1,disabled:_z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[_z&&y(A,{className:"mr-2 h-4 w-4 animate-spin"}),U.delete()]})]})]})})]})}var Nz=xz("/projects/$projectId/files/$fileId")({component:C1});export{Nz as Route};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{He as GJ,Ie as zJ}from"./chunk-jtd7rydv.js";import{Mk as OJ}from"./chunk-z0tbq08w.js";import{Pk as n,Qk as WJ,Rk as r}from"./chunk-nh31ma8d.js";import{Sk as jJ}from"./chunk-w4ycztv5.js";import"./chunk-pm64et9d.js";import{Xk as p}from"./chunk-fzaw1e34.js";import"./chunk-yzra1x8f.js";import{kl as KJ,ll as _J}from"./chunk-z0zevgb6.js";import{ql as a,sl as LJ}from"./chunk-29nhtrfv.js";import"./chunk-800vdz5n.js";import{wl as i}from"./chunk-f2eh802w.js";import{Dl as DJ}from"./chunk-ew4cxkcc.js";import{El as YJ,Fl as y,Gl as NJ,Hl as VJ}from"./chunk-hcvpb1hw.js";import"./chunk-mgbqjbfc.js";function o(J){let Q=J.filter((F)=>F!==void 0);if(Q.length===0)return{cleanup:()=>{}};if(Q.length===1)return{signal:Q[0],cleanup:()=>{}};let Z=new AbortController,$=[],X=(F)=>{if(!Z.signal.aborted)Z.abort(F.reason)};for(let F of Q){if(F.aborted){X(F);break}let Y=()=>X(F);F.addEventListener("abort",Y,{once:!0}),$.push({signal:F,listener:Y})}return{signal:Z.signal,cleanup:()=>{for(let{signal:F,listener:Y}of $)F.removeEventListener("abort",Y)}}}var fJ={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function c(J,Q){let Z=J.toLowerCase(),$=J.toUpperCase();return Q?.[Z]||Q?.[$]||p(Z)||p($)||""}function SJ(J){if(J instanceof URL)return J;try{return new URL(J)}catch{return}}function TJ(J,Q,Z){let $=c("no_proxy",Z).toLowerCase();if(!$)return!0;if($==="*")return!1;return $.split(/[,\s]/).every((X)=>{if(!X)return!0;let F=X.match(/^(.+):(\d+)$/),Y=F?F[1]:X,G=F?Number.parseInt(F[2],10):0;if(G&&G!==Q)return!0;if(!/^[.*]/.test(Y))return J!==Y;if(Y.startsWith("*"))Y=Y.slice(1);return!J.endsWith(Y)})}function hJ(J,Q){let Z=SJ(J);if(!Z?.protocol||!Z.host)return"";let $=Z.protocol.split(":",1)[0],X=Z.host.replace(/:\d*$/,""),F=Number.parseInt(Z.port,10)||fJ[$]||0;if(!TJ(X,F,Q))return"";let Y=c(`${$}_proxy`,Q)||c("all_proxy",Q);if(Y&&!Y.includes("://"))Y=`${$}://${Y}`;return Y}var xJ="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function e(J,Q){let Z=hJ(J,Q);if(!Z)return;let $;try{$=new URL(Z)}catch(X){throw Error(`Invalid proxy URL ${JSON.stringify(Z)}: ${X instanceof Error?X.message:String(X)}`)}if($.protocol!=="http:"&&$.protocol!=="https:")throw Error(`${xJ} Got ${$.protocol}`);return $}function bJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var I=bJ(),kJ="https://chatgpt.com/backend-api",IJ="https://api.openai.com/auth",gJ=0,JJ=1000,vJ=60000,yJ=15000,mJ=3,BJ=new Set(["openai","openai-codex","opencode"]),uJ=1009,pJ="websocket_connection_limit_reached",cJ="previous_response_not_found",lJ=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function dJ(J){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(J)}function iJ(J,Q){if(J===429&&dJ(Q))return!1;if(J===429||J===500||J===502||J===503||J===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(Q)}function aJ(J){let Q=J.get("retry-after-ms");if(Q!==null){let F=Number(Q);if(Number.isFinite(F))return Math.max(0,F)}let Z=J.get("retry-after");if(!Z)return;let $=Number(Z);if(Number.isFinite($))return Math.max(0,$*1000);let X=Date.parse(Z);if(!Number.isNaN(X))return Math.max(0,X-Date.now());return}class t extends Error{}function nJ(J,Q){let Z=Q?.maxRetryDelayMs??vJ;if(Z>0&&J>Z)throw new t(`Server requested ${Math.ceil(J/1000)}s retry delay (max: ${Math.ceil(Z/1000)}s)`);return J}function QJ(J,Q){return new Promise((Z,$)=>{if(Q?.aborted){$(Error("Request was aborted"));return}let X=setTimeout(Z,J);Q?.addEventListener("abort",()=>{clearTimeout(X),$(Error("Request was aborted"))})})}function ZJ(J){if(J===void 0)return;if(!Number.isFinite(J)||J<0)throw Error(`Invalid timeoutMs: ${String(J)}`);return Math.floor(J)}function rJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function tJ(J){let Q=rJ();if(!Q||typeof Q.zstdCompressSync!=="function")return null;try{let Z=Q.zstdCompressSync(J,{params:{[Q.constants.ZSTD_c_compressionLevel]:mJ}});return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength)}catch{return null}}var sJ=(J,Q,Z)=>{let $=new YJ;return(async()=>{let X={role:"assistant",content:[],api:"openai-codex-responses",provider:J.provider,model:J.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 F=Z?.apiKey;if(!F)throw Error(`No API key for provider: ${J.provider}`);let Y=UQ(F),G=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1),N=Z?.cacheRetention==="none"?void 0:Z?.sessionId,V=jJ(N),K=oJ(J,Q,Z,V,G),D=await Z?.onPayload?.(K,J);if(D!==void 0)K=D;let R=V||zJ(),z=CQ(J.headers,Z?.headers,Y,F,V),A=MQ(J.headers,Z?.headers,Y,F,R),j=JSON.stringify(K),_=ZJ(Z?.timeoutMs),U=ZJ(Z?.websocketConnectTimeoutMs),L=Z?.transport||"auto",W=!1,O=L!=="sse"&&EJ(N);if(O)$J(N);if(L!=="sse"&&!O){let B=!1,H=!1,M=!1;while(!0){B=!1;try{if(await wQ(JQ(J.baseUrl),K,A,X,$,J,()=>{if(B=!0,!W)W=!0,$.push({type:"start",partial:X})},_,U,N,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end();return}catch(w){let x=Z?.signal?.aborted,b=!B&&$Q(w),S=FQ(w);if(!x&&S&&!M){M=!0;continue}if(!x&&b&&!H){H=!0;continue}if(x||ZQ(w)&&!b)throw w;if(VJ(X,NJ("provider_transport_failure",w,{configuredTransport:L,fallbackTransport:B?void 0:"sse",eventsEmitted:B,phase:B?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(j).byteLength})),KQ(N,w),B)throw w;$J(N);break}}}let C=tJ(j);if(C)z.set("content-encoding","zstd");let f=C??j,q,h,u=Z?.maxRetries??gJ;for(let B=0;B<=u;B++){if(Z?.signal?.aborted)throw Error("Request was aborted");try{let H=_!==void 0&&_>0?AbortSignal.timeout(_):void 0,M=o([Z?.signal,H]);try{q=await fetch(qJ(J.baseUrl),{method:"POST",headers:z,body:f,signal:M.signal})}catch(S){if(H?.aborted&&!Z?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${_}ms`);throw S}finally{M.cleanup()}if(await Z?.onResponse?.({status:q.status,headers:i(q.headers)},J),q.ok)break;let w=await q.text();if(B<u&&iJ(q.status,w)){let S=aJ(q.headers),MJ=S===void 0?JJ*2**B:nJ(S,Z);await QJ(MJ,Z?.signal);continue}let x=new Response(w,{status:q.status,statusText:q.statusText}),b=await PQ(x);throw Error(b.friendlyMessage||b.message)}catch(H){if(H instanceof Error){if(H.name==="AbortError"||H.message==="Request was aborted")throw Error("Request was aborted")}if(h=H instanceof Error?H:Error(String(H)),B<u&&!(h instanceof t)&&!h.message.includes("usage limit")){let M=JJ*2**B;await QJ(M,Z?.signal);continue}throw h}}if(!q?.ok)throw h??Error("Failed after retries");if(!q.body)throw Error("No response body");if(!W)W=!0,$.push({type:"start",partial:X});if(await QQ(q,X,$,J,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end()}catch(F){for(let Y of X.content)delete Y.partialJson,delete Y.customInput;X.stopReason=Z?.signal?.aborted?"aborted":"error",X.errorMessage=_J(KJ(F)),$.push({type:"error",reason:X.stopReason,error:X}),$.end()}})(),$},iQ=(J,Q,Z)=>{let $=Z?.apiKey;if(!$)throw Error(`No API key for provider: ${J.provider}`);let X=LJ(J,Q,Z,$),F=Z?.reasoning?DJ(J,Z.reasoning):void 0;return sJ(J,Q,{...X,reasoningEffort:F==="off"?void 0:F})};function oJ(J,Q,Z,$,X=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1)){let F=J.compat?.supportsStrictMode??!0,Y=J.compat?.supportsOpenAIGrammarTools??!1,G=OJ(Q,J.compat?.supportsToolSearch??!1),N=n(J,Q,BJ,{includeSystemPrompt:!1,grammarToolInputProperties:X,deferredTools:G.deferred,toolOptions:{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y}}),V={model:J.id,store:!1,stream:!0,instructions:Q.systemPrompt||"You are a helpful assistant.",input:N,text:{verbosity:Z?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:$,tool_choice:Z?.toolChoice??"auto",parallel_tool_calls:!0};if(Z?.temperature!==void 0)V.temperature=Z.temperature;if(Z?.serviceTier!==void 0)V.service_tier=Z.serviceTier;if(G.immediate.length>0)V.tools=WJ(G.immediate,{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y});if(Z?.reasoningEffort!==void 0){let K=Z.reasoningEffort==="none"?J.thinkingLevelMap?.off??"none":J.thinkingLevelMap?.[Z.reasoningEffort]??Z.reasoningEffort;if(K!==null)V.reasoning={effort:K,summary:Z.reasoningSummary??"auto"}}return V}function eJ(J,Q){switch(Q){case"flex":return 0.5;case"priority":return J.id==="gpt-5.5"?2.5:2;default:return 1}}function RJ(J,Q,Z){let $=eJ(Z,Q);if($===1)return;J.cost.input*=$,J.cost.output*=$,J.cost.cacheRead*=$,J.cost.cacheWrite*=$,J.cost.total=J.cost.input+J.cost.output+J.cost.cacheRead+J.cost.cacheWrite}function AJ(J,Q){if(J==="default"&&(Q==="flex"||Q==="priority"))return Q;return J??Q}function qJ(J){let Z=(J&&J.trim().length>0?J:kJ).replace(/\/+$/,"");if(Z.endsWith("/codex/responses"))return Z;if(Z.endsWith("/codex"))return`${Z}/responses`;return`${Z}/codex/responses`}function JQ(J){let Q=new URL(qJ(J));if(Q.protocol==="https:")Q.protocol="wss:";if(Q.protocol==="http:")Q.protocol="ws:";return Q.toString()}async function QQ(J,Q,Z,$,X,F){await r(HJ(NQ(J,F?.signal)),Q,Z,$,{serviceTier:F?.serviceTier,grammarToolInputProperties:X,resolveServiceTier:AJ,applyServiceTierPricing:(Y,G)=>RJ(Y,G,$)})}class T extends Error{code;payload;constructor(J,Q){super(J);this.name="CodexApiError",this.code=Q?.code,this.payload=Q?.payload,this.cause=Q?.cause}}class m extends Error{payload;constructor(J,Q){super(J);this.name="CodexProtocolError",this.payload=Q?.payload,this.cause=Q?.cause}}function ZQ(J){return J instanceof T||J instanceof m}function $Q(J){return J instanceof T&&J.code===pJ}function FQ(J){return J instanceof T&&J.code===cJ}function XQ(J){let Q=J.error&&typeof J.error==="object"?J.error:void 0;return{code:typeof J.code==="string"?J.code:typeof Q?.code==="string"?Q.code:void 0,message:typeof J.message==="string"?J.message:typeof Q?.message==="string"?Q.message:void 0}}async function*HJ(J){for await(let Q of J){let Z=typeof Q.type==="string"?Q.type:void 0;if(!Z)continue;if(Z==="error"){let{code:$,message:X}=XQ(Q);throw new T(`Codex error: ${X||$||JSON.stringify(Q)}`,{code:$,payload:Q})}if(Z==="response.failed"){let $=Q.response,X=$?.error?.code,F=$?.error?.message;throw new T(F||"Codex response failed",{code:X,payload:Q})}if(Z==="response.done"||Z==="response.completed"||Z==="response.incomplete"){let $=Q.response,X=$?{...$,status:YQ($.status)}:$;yield{...Q,type:"response.completed",response:X};return}yield Q}}function YQ(J){if(typeof J!=="string")return;return lJ.has(J)?J:void 0}async function*NQ(J,Q){if(!J.body)return;let Z=J.body.getReader(),$=new TextDecoder,X="",F=()=>{Z.cancel().catch(()=>{})};Q?.addEventListener("abort",F,{once:!0});try{while(!0){if(Q?.aborted)throw Error("Request was aborted");let{done:Y,value:G}=await Z.read();if(Q?.aborted)throw Error("Request was aborted");if(Y)break;X+=$.decode(G,{stream:!0});let N=X.indexOf(`
2
+ import{Je as GJ,Ke as zJ}from"./chunk-1khzycf9.js";import{Rk as OJ}from"./chunk-3xzgddev.js";import{Uk as n,Vk as WJ,Wk as r}from"./chunk-cqq8e3hc.js";import{Xk as jJ}from"./chunk-1xzc6z02.js";import"./chunk-g60v3jc1.js";import{al as p}from"./chunk-hqkmdp31.js";import"./chunk-tzt4c1dm.js";import{pl as KJ,ql as _J}from"./chunk-qdycy714.js";import{vl as a,xl as LJ}from"./chunk-p4c4z0f2.js";import"./chunk-x6532q76.js";import{Bl as i}from"./chunk-gjdmnfms.js";import{Il as DJ}from"./chunk-81tb4v5v.js";import{Jl as YJ,Kl as y,Ll as NJ,Ml as VJ}from"./chunk-a0k1b4sq.js";import"./chunk-dej1gq35.js";function o(J){let Q=J.filter((F)=>F!==void 0);if(Q.length===0)return{cleanup:()=>{}};if(Q.length===1)return{signal:Q[0],cleanup:()=>{}};let Z=new AbortController,$=[],X=(F)=>{if(!Z.signal.aborted)Z.abort(F.reason)};for(let F of Q){if(F.aborted){X(F);break}let Y=()=>X(F);F.addEventListener("abort",Y,{once:!0}),$.push({signal:F,listener:Y})}return{signal:Z.signal,cleanup:()=>{for(let{signal:F,listener:Y}of $)F.removeEventListener("abort",Y)}}}var fJ={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function c(J,Q){let Z=J.toLowerCase(),$=J.toUpperCase();return Q?.[Z]||Q?.[$]||p(Z)||p($)||""}function SJ(J){if(J instanceof URL)return J;try{return new URL(J)}catch{return}}function TJ(J,Q,Z){let $=c("no_proxy",Z).toLowerCase();if(!$)return!0;if($==="*")return!1;return $.split(/[,\s]/).every((X)=>{if(!X)return!0;let F=X.match(/^(.+):(\d+)$/),Y=F?F[1]:X,G=F?Number.parseInt(F[2],10):0;if(G&&G!==Q)return!0;if(!/^[.*]/.test(Y))return J!==Y;if(Y.startsWith("*"))Y=Y.slice(1);return!J.endsWith(Y)})}function hJ(J,Q){let Z=SJ(J);if(!Z?.protocol||!Z.host)return"";let $=Z.protocol.split(":",1)[0],X=Z.host.replace(/:\d*$/,""),F=Number.parseInt(Z.port,10)||fJ[$]||0;if(!TJ(X,F,Q))return"";let Y=c(`${$}_proxy`,Q)||c("all_proxy",Q);if(Y&&!Y.includes("://"))Y=`${$}://${Y}`;return Y}var xJ="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function e(J,Q){let Z=hJ(J,Q);if(!Z)return;let $;try{$=new URL(Z)}catch(X){throw Error(`Invalid proxy URL ${JSON.stringify(Z)}: ${X instanceof Error?X.message:String(X)}`)}if($.protocol!=="http:"&&$.protocol!=="https:")throw Error(`${xJ} Got ${$.protocol}`);return $}function bJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var I=bJ(),kJ="https://chatgpt.com/backend-api",IJ="https://api.openai.com/auth",gJ=0,JJ=1000,vJ=60000,yJ=15000,mJ=3,BJ=new Set(["openai","openai-codex","opencode"]),uJ=1009,pJ="websocket_connection_limit_reached",cJ="previous_response_not_found",lJ=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function dJ(J){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(J)}function iJ(J,Q){if(J===429&&dJ(Q))return!1;if(J===429||J===500||J===502||J===503||J===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(Q)}function aJ(J){let Q=J.get("retry-after-ms");if(Q!==null){let F=Number(Q);if(Number.isFinite(F))return Math.max(0,F)}let Z=J.get("retry-after");if(!Z)return;let $=Number(Z);if(Number.isFinite($))return Math.max(0,$*1000);let X=Date.parse(Z);if(!Number.isNaN(X))return Math.max(0,X-Date.now());return}class t extends Error{}function nJ(J,Q){let Z=Q?.maxRetryDelayMs??vJ;if(Z>0&&J>Z)throw new t(`Server requested ${Math.ceil(J/1000)}s retry delay (max: ${Math.ceil(Z/1000)}s)`);return J}function QJ(J,Q){return new Promise((Z,$)=>{if(Q?.aborted){$(Error("Request was aborted"));return}let X=setTimeout(Z,J);Q?.addEventListener("abort",()=>{clearTimeout(X),$(Error("Request was aborted"))})})}function ZJ(J){if(J===void 0)return;if(!Number.isFinite(J)||J<0)throw Error(`Invalid timeoutMs: ${String(J)}`);return Math.floor(J)}function rJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function tJ(J){let Q=rJ();if(!Q||typeof Q.zstdCompressSync!=="function")return null;try{let Z=Q.zstdCompressSync(J,{params:{[Q.constants.ZSTD_c_compressionLevel]:mJ}});return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength)}catch{return null}}var sJ=(J,Q,Z)=>{let $=new YJ;return(async()=>{let X={role:"assistant",content:[],api:"openai-codex-responses",provider:J.provider,model:J.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 F=Z?.apiKey;if(!F)throw Error(`No API key for provider: ${J.provider}`);let Y=UQ(F),G=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1),N=Z?.cacheRetention==="none"?void 0:Z?.sessionId,V=jJ(N),K=oJ(J,Q,Z,V,G),D=await Z?.onPayload?.(K,J);if(D!==void 0)K=D;let R=V||zJ(),z=CQ(J.headers,Z?.headers,Y,F,V),A=MQ(J.headers,Z?.headers,Y,F,R),j=JSON.stringify(K),_=ZJ(Z?.timeoutMs),U=ZJ(Z?.websocketConnectTimeoutMs),L=Z?.transport||"auto",W=!1,O=L!=="sse"&&EJ(N);if(O)$J(N);if(L!=="sse"&&!O){let B=!1,H=!1,M=!1;while(!0){B=!1;try{if(await wQ(JQ(J.baseUrl),K,A,X,$,J,()=>{if(B=!0,!W)W=!0,$.push({type:"start",partial:X})},_,U,N,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end();return}catch(w){let x=Z?.signal?.aborted,b=!B&&$Q(w),S=FQ(w);if(!x&&S&&!M){M=!0;continue}if(!x&&b&&!H){H=!0;continue}if(x||ZQ(w)&&!b)throw w;if(VJ(X,NJ("provider_transport_failure",w,{configuredTransport:L,fallbackTransport:B?void 0:"sse",eventsEmitted:B,phase:B?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(j).byteLength})),KQ(N,w),B)throw w;$J(N);break}}}let C=tJ(j);if(C)z.set("content-encoding","zstd");let f=C??j,q,h,u=Z?.maxRetries??gJ;for(let B=0;B<=u;B++){if(Z?.signal?.aborted)throw Error("Request was aborted");try{let H=_!==void 0&&_>0?AbortSignal.timeout(_):void 0,M=o([Z?.signal,H]);try{q=await fetch(qJ(J.baseUrl),{method:"POST",headers:z,body:f,signal:M.signal})}catch(S){if(H?.aborted&&!Z?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${_}ms`);throw S}finally{M.cleanup()}if(await Z?.onResponse?.({status:q.status,headers:i(q.headers)},J),q.ok)break;let w=await q.text();if(B<u&&iJ(q.status,w)){let S=aJ(q.headers),MJ=S===void 0?JJ*2**B:nJ(S,Z);await QJ(MJ,Z?.signal);continue}let x=new Response(w,{status:q.status,statusText:q.statusText}),b=await PQ(x);throw Error(b.friendlyMessage||b.message)}catch(H){if(H instanceof Error){if(H.name==="AbortError"||H.message==="Request was aborted")throw Error("Request was aborted")}if(h=H instanceof Error?H:Error(String(H)),B<u&&!(h instanceof t)&&!h.message.includes("usage limit")){let M=JJ*2**B;await QJ(M,Z?.signal);continue}throw h}}if(!q?.ok)throw h??Error("Failed after retries");if(!q.body)throw Error("No response body");if(!W)W=!0,$.push({type:"start",partial:X});if(await QQ(q,X,$,J,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end()}catch(F){for(let Y of X.content)delete Y.partialJson,delete Y.customInput;X.stopReason=Z?.signal?.aborted?"aborted":"error",X.errorMessage=_J(KJ(F)),$.push({type:"error",reason:X.stopReason,error:X}),$.end()}})(),$},iQ=(J,Q,Z)=>{let $=Z?.apiKey;if(!$)throw Error(`No API key for provider: ${J.provider}`);let X=LJ(J,Q,Z,$),F=Z?.reasoning?DJ(J,Z.reasoning):void 0;return sJ(J,Q,{...X,reasoningEffort:F==="off"?void 0:F})};function oJ(J,Q,Z,$,X=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1)){let F=J.compat?.supportsStrictMode??!0,Y=J.compat?.supportsOpenAIGrammarTools??!1,G=OJ(Q,J.compat?.supportsToolSearch??!1),N=n(J,Q,BJ,{includeSystemPrompt:!1,grammarToolInputProperties:X,deferredTools:G.deferred,toolOptions:{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y}}),V={model:J.id,store:!1,stream:!0,instructions:Q.systemPrompt||"You are a helpful assistant.",input:N,text:{verbosity:Z?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:$,tool_choice:Z?.toolChoice??"auto",parallel_tool_calls:!0};if(Z?.temperature!==void 0)V.temperature=Z.temperature;if(Z?.serviceTier!==void 0)V.service_tier=Z.serviceTier;if(G.immediate.length>0)V.tools=WJ(G.immediate,{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y});if(Z?.reasoningEffort!==void 0){let K=Z.reasoningEffort==="none"?J.thinkingLevelMap?.off??"none":J.thinkingLevelMap?.[Z.reasoningEffort]??Z.reasoningEffort;if(K!==null)V.reasoning={effort:K,summary:Z.reasoningSummary??"auto"}}return V}function eJ(J,Q){switch(Q){case"flex":return 0.5;case"priority":return J.id==="gpt-5.5"?2.5:2;default:return 1}}function RJ(J,Q,Z){let $=eJ(Z,Q);if($===1)return;J.cost.input*=$,J.cost.output*=$,J.cost.cacheRead*=$,J.cost.cacheWrite*=$,J.cost.total=J.cost.input+J.cost.output+J.cost.cacheRead+J.cost.cacheWrite}function AJ(J,Q){if(J==="default"&&(Q==="flex"||Q==="priority"))return Q;return J??Q}function qJ(J){let Z=(J&&J.trim().length>0?J:kJ).replace(/\/+$/,"");if(Z.endsWith("/codex/responses"))return Z;if(Z.endsWith("/codex"))return`${Z}/responses`;return`${Z}/codex/responses`}function JQ(J){let Q=new URL(qJ(J));if(Q.protocol==="https:")Q.protocol="wss:";if(Q.protocol==="http:")Q.protocol="ws:";return Q.toString()}async function QQ(J,Q,Z,$,X,F){await r(HJ(NQ(J,F?.signal)),Q,Z,$,{serviceTier:F?.serviceTier,grammarToolInputProperties:X,resolveServiceTier:AJ,applyServiceTierPricing:(Y,G)=>RJ(Y,G,$)})}class T extends Error{code;payload;constructor(J,Q){super(J);this.name="CodexApiError",this.code=Q?.code,this.payload=Q?.payload,this.cause=Q?.cause}}class m extends Error{payload;constructor(J,Q){super(J);this.name="CodexProtocolError",this.payload=Q?.payload,this.cause=Q?.cause}}function ZQ(J){return J instanceof T||J instanceof m}function $Q(J){return J instanceof T&&J.code===pJ}function FQ(J){return J instanceof T&&J.code===cJ}function XQ(J){let Q=J.error&&typeof J.error==="object"?J.error:void 0;return{code:typeof J.code==="string"?J.code:typeof Q?.code==="string"?Q.code:void 0,message:typeof J.message==="string"?J.message:typeof Q?.message==="string"?Q.message:void 0}}async function*HJ(J){for await(let Q of J){let Z=typeof Q.type==="string"?Q.type:void 0;if(!Z)continue;if(Z==="error"){let{code:$,message:X}=XQ(Q);throw new T(`Codex error: ${X||$||JSON.stringify(Q)}`,{code:$,payload:Q})}if(Z==="response.failed"){let $=Q.response,X=$?.error?.code,F=$?.error?.message;throw new T(F||"Codex response failed",{code:X,payload:Q})}if(Z==="response.done"||Z==="response.completed"||Z==="response.incomplete"){let $=Q.response,X=$?{...$,status:YQ($.status)}:$;yield{...Q,type:"response.completed",response:X};return}yield Q}}function YQ(J){if(typeof J!=="string")return;return lJ.has(J)?J:void 0}async function*NQ(J,Q){if(!J.body)return;let Z=J.body.getReader(),$=new TextDecoder,X="",F=()=>{Z.cancel().catch(()=>{})};Q?.addEventListener("abort",F,{once:!0});try{while(!0){if(Q?.aborted)throw Error("Request was aborted");let{done:Y,value:G}=await Z.read();if(Q?.aborted)throw Error("Request was aborted");if(Y)break;X+=$.decode(G,{stream:!0});let N=X.indexOf(`
3
3
 
4
4
  `);while(N!==-1){let V=X.slice(0,N);X=X.slice(N+2);let K=V.split(`
5
5
  `).filter((D)=>D.startsWith("data:")).map((D)=>D.slice(5).trim());if(K.length>0){let D=K.join(`
@@ -0,0 +1 @@
1
+ import{j as g}from"./chunk-zwgf211t.js";import"./chunk-sjjndwt4.js";import"./chunk-qcqw7wnv.js";import"./chunk-x3ynjbt5.js";import"./chunk-dv1zpd2p.js";import"./chunk-mw8f8ngt.js";import"./chunk-y8aehqr8.js";import"./chunk-9nyhmtp9.js";import"./chunk-r5dv0rfv.js";import"./chunk-83k0wa5k.js";import"./chunk-8y1v9dm9.js";import"./chunk-tpp9qf5m.js";import"./chunk-4rbzswqs.js";import"./chunk-rfyaphas.js";import"./chunk-0yngn45x.js";import"./chunk-5gtew41y.js";import"./chunk-3kqdgddm.js";import"./chunk-karn564z.js";import{Qf as x}from"./chunk-vxpnp4xg.js";import{Sf as f}from"./chunk-s0hgykza.js";import"./chunk-38g3s1f3.js";import"./chunk-qmpph1gt.js";import"./chunk-zjj9qj6y.js";import"./chunk-eetrc0j1.js";import"./chunk-9s02m95j.js";import"./chunk-87wqbn4g.js";import"./chunk-69tt1pvr.js";import"./chunk-f2j2cqd1.js";import"./chunk-2xmsrq7f.js";import"./chunk-af6wbhkv.js";import"./chunk-2mqqghrz.js";import{th as p}from"./chunk-n4gghgrj.js";import{Eh as r,Fh as o,Rh as c,bi as h,xh as v,zh as a}from"./chunk-m6a4rzdt.js";import{Nl as w}from"./chunk-dej1gq35.js";var b=w(v(),1);function d(){let{projectId:e}=y.useParams(),{teamId:s,ensureTeamIdForProject:n}=p();b.useEffect(()=>{n(e)},[e,n]);let{data:i}=o(x(e)),t=i?.rootFolder,{data:m}=r({queryKey:["folders",t],queryFn:async()=>{let l=await h.api.folders[":folderId"].$get({param:{folderId:t}});if(!l.ok)throw Error("failed to fetch folder");return await l.json()},enabled:!!t});if(!s||!t||!m)return a(f,{});return a(g,{teamId:s,projectId:e,projectName:i.name??"",assetId:t,rootFolderId:t})}var y=c("/projects/$projectId/")({component:d});export{y as Route};