@shumai-one/shumai 0.5.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/bin/{chunk-hsx4pns6.js → chunk-0502p2k7.js} +1 -1
  2. package/bin/chunk-0b0t6y8h.js +11 -0
  3. package/bin/{chunk-rh8dy99a.js → chunk-0tvnfy4k.js} +2 -2
  4. package/bin/{chunk-fpjvr3qw.js → chunk-16n160h1.js} +1 -1
  5. package/bin/{chunk-wbmqbpgm.js → chunk-1eqw2dpx.js} +2 -2
  6. package/bin/chunk-1vt9ss7d.js +2 -0
  7. package/bin/chunk-2cpsfc87.js +1 -0
  8. package/bin/{chunk-nmd1901j.js → chunk-2w0d9veg.js} +1 -1
  9. package/bin/{chunk-zzbn0b6c.js → chunk-2xp9prpq.js} +1 -1
  10. package/bin/chunk-3gqs15zq.js +2 -0
  11. package/bin/{chunk-929abwgr.js → chunk-3j82q2gj.js} +1 -1
  12. package/bin/{chunk-5bpvwv66.js → chunk-3me1v3z5.js} +2 -2
  13. package/bin/chunk-3pw7z25v.js +3 -0
  14. package/bin/{chunk-vsnq4381.js → chunk-3tx9v8kj.js} +1 -1
  15. package/bin/chunk-3wdtp4ht.js +1 -0
  16. package/bin/chunk-57axjy7y.js +1 -0
  17. package/bin/{chunk-6pwf7qa6.js → chunk-5aqthcm6.js} +2 -2
  18. package/bin/{chunk-scvepfv8.js → chunk-5gq4q1bb.js} +1 -1
  19. package/bin/{chunk-zq5j9wsc.js → chunk-5r1br11d.js} +1 -1
  20. package/bin/chunk-61hrdg0g.js +1 -0
  21. package/bin/chunk-6aa4xmnw.js +2 -0
  22. package/bin/{chunk-y5h5d5gx.js → chunk-6mrgtn78.js} +7 -7
  23. package/bin/chunk-6s55r0z9.js +1 -0
  24. package/bin/chunk-6vkfzzvt.js +5 -0
  25. package/bin/chunk-7dprpnm6.js +2 -0
  26. package/bin/chunk-7rycq6wb.js +129 -0
  27. package/bin/{chunk-26am2rzm.js → chunk-895gzdtp.js} +2 -2
  28. package/bin/chunk-8d1p8qpv.js +1 -0
  29. package/bin/chunk-8qdtvfx3.css +1 -0
  30. package/bin/chunk-8r3k84dh.js +2 -0
  31. package/bin/{chunk-24da4wg9.js → chunk-99sarrvt.js} +1 -1
  32. package/bin/{chunk-5y3kx4kk.js → chunk-9s0k533c.js} +1 -1
  33. package/bin/{chunk-b6dbqs39.js → chunk-acmr8v0d.js} +1 -1
  34. package/bin/{chunk-tqdde9bj.js → chunk-agcnbjxk.js} +1 -1
  35. package/bin/{chunk-y6xyc4wp.js → chunk-ahgq10a7.js} +2 -2
  36. package/bin/{chunk-b3tkvdfk.js → chunk-am6dg0a5.js} +2 -2
  37. package/bin/chunk-b21z62fj.js +1 -0
  38. package/bin/{chunk-zsg61vr0.js → chunk-b7qs7hxg.js} +2 -2
  39. package/bin/{chunk-8ts3xkme.js → chunk-b9d8xdhb.js} +1 -1
  40. package/bin/{chunk-rq2h2bwt.js → chunk-bg6waaf9.js} +2 -2
  41. package/bin/{chunk-sbyyn9yw.js → chunk-bs6saf4d.js} +2 -2
  42. package/bin/{chunk-b88tdt79.js → chunk-bv589v2m.js} +2 -2
  43. package/bin/{chunk-qjdvs1s5.js → chunk-c60j1b4w.js} +1 -1
  44. package/bin/{chunk-q7t5zs7n.js → chunk-c6f8x05m.js} +2 -2
  45. package/bin/chunk-c8kjpmfe.js +2 -0
  46. package/bin/chunk-c9xyejnk.js +2 -0
  47. package/bin/{chunk-srv5kvm4.js → chunk-cb9peqy5.js} +1 -1
  48. package/bin/chunk-ckczqmrz.js +5 -0
  49. package/bin/chunk-cr33cs6j.js +2 -0
  50. package/bin/chunk-cxet91kt.js +2 -0
  51. package/bin/{chunk-hy5ncvpf.js → chunk-d18v5vmp.js} +2 -2
  52. package/bin/{chunk-xdrpahym.js → chunk-d4hk62q2.js} +4 -4
  53. package/bin/{chunk-j420aqk8.js → chunk-d7e351jd.js} +3 -3
  54. package/bin/{chunk-ppb4aj0y.js → chunk-dfecgpce.js} +12 -12
  55. package/bin/chunk-ebcfbn00.js +2 -0
  56. package/bin/chunk-f0b4a9y3.js +2 -0
  57. package/bin/{chunk-2pt9h882.js → chunk-fkn6f4qt.js} +3 -3
  58. package/bin/chunk-fre31bhw.js +2 -0
  59. package/bin/{chunk-fxg81vtx.js → chunk-fxtzy5f5.js} +2 -2
  60. package/bin/{chunk-k3ds96cb.js → chunk-g78vapcm.js} +2 -2
  61. package/bin/{chunk-q4qqmes7.js → chunk-gdpfwxea.js} +2 -2
  62. package/bin/chunk-gwqqq0b1.js +32 -0
  63. package/bin/chunk-h3cwf9aw.js +2 -0
  64. package/bin/{chunk-cvfznrnt.js → chunk-h4ty530v.js} +5 -5
  65. package/bin/{chunk-p7zw53ep.js → chunk-h58yfx7w.js} +1 -1
  66. package/bin/chunk-h6f2gyt5.js +3 -0
  67. package/bin/chunk-h9ngpxyd.js +1 -0
  68. package/bin/chunk-hbr17jvr.js +13 -0
  69. package/bin/{chunk-4bc3gqmn.js → chunk-hc0xbmtt.js} +2 -2
  70. package/bin/{chunk-68xsb3t8.js → chunk-ht5rht98.js} +2 -2
  71. package/bin/{chunk-hn2g40r6.js → chunk-hzv1mhr5.js} +1 -1
  72. package/bin/{chunk-909h3qzp.js → chunk-j9t7tvt5.js} +2 -2
  73. package/bin/{chunk-m41tbrvt.js → chunk-jb8vbeb0.js} +2 -2
  74. package/bin/{chunk-wperd2h9.js → chunk-jq3pq545.js} +2 -2
  75. package/bin/{chunk-9ca8a5f2.js → chunk-jvt8q0eg.js} +1 -1
  76. package/bin/chunk-jzgtthsj.js +3 -0
  77. package/bin/chunk-jzjhg7ng.js +1 -0
  78. package/bin/{chunk-gvcjqcjf.js → chunk-k547syp2.js} +1 -1
  79. package/bin/chunk-k7sjpke6.js +2 -0
  80. package/bin/chunk-k8ct1qgv.js +3 -0
  81. package/bin/chunk-k9q4nn8b.js +11 -0
  82. package/bin/{chunk-s9sf37dv.js → chunk-keetdtxb.js} +2 -2
  83. package/bin/chunk-kjjw8mbg.js +1 -0
  84. package/bin/{chunk-pwq6dbb5.js → chunk-kywdke0y.js} +5 -5
  85. package/bin/chunk-mey80kv9.js +54 -0
  86. package/bin/chunk-n412a1hp.js +20 -0
  87. package/bin/chunk-nfncawpm.js +12 -0
  88. package/bin/chunk-nvwt8atc.js +1 -0
  89. package/bin/chunk-p1d500sf.js +211 -0
  90. package/bin/{chunk-9fyb95r5.js → chunk-p1ed0pa6.js} +1 -1
  91. package/bin/chunk-q0vs124k.js +2 -0
  92. package/bin/{chunk-fsr83nb1.js → chunk-q5795f3s.js} +1 -1
  93. package/bin/{chunk-b5r0be06.js → chunk-q5j3b0h5.js} +2 -2
  94. package/bin/chunk-qd7pvaxb.js +2 -0
  95. package/bin/{chunk-s0vfj06y.js → chunk-qhpt7170.js} +1 -1
  96. package/bin/{chunk-40tmh04g.js → chunk-qqj2m1b1.js} +2 -2
  97. package/bin/chunk-qt78vs3g.js +2 -0
  98. package/bin/{chunk-fnkkwna8.js → chunk-r5g84kj4.js} +3 -3
  99. package/bin/{chunk-59ayg5am.js → chunk-r9gp9yqw.js} +1 -1
  100. package/bin/chunk-ra6mdjr0.js +1 -0
  101. package/bin/{chunk-jt6v15wx.js → chunk-ryfvaz6v.js} +2 -2
  102. package/bin/{chunk-xbw7ffrz.js → chunk-s01p4w8d.js} +2 -2
  103. package/bin/{chunk-qcpeefhr.js → chunk-s22eapcc.js} +1 -1
  104. package/bin/chunk-sbg86tch.js +2 -0
  105. package/bin/chunk-sbqy6m8t.js +1 -0
  106. package/bin/{chunk-ncv8v6mj.js → chunk-sd6w0z6a.js} +2 -2
  107. package/bin/chunk-sdp9w627.js +14 -0
  108. package/bin/chunk-sn0nypvd.js +42 -0
  109. package/bin/chunk-sv92vkyh.js +2 -0
  110. package/bin/{chunk-mzme3m82.js → chunk-swz6v48q.js} +1 -1
  111. package/bin/{chunk-a8bymrv1.js → chunk-t6cn018t.js} +2 -2
  112. package/bin/{chunk-4nkwe7dz.js → chunk-ts4d1mxf.js} +2 -2
  113. package/bin/{chunk-cdk8vqeg.js → chunk-w4ydfy9d.js} +2 -2
  114. package/bin/chunk-wkdkc12e.js +4 -0
  115. package/bin/chunk-wsprap60.js +3 -0
  116. package/bin/chunk-xgnvktq6.js +10 -0
  117. package/bin/{chunk-2rrcdhkj.js → chunk-xjw3mpvx.js} +1 -1
  118. package/bin/{chunk-qqapw198.js → chunk-xsfy8hz3.js} +1 -1
  119. package/bin/chunk-xznq2axj.js +1 -0
  120. package/bin/chunk-y4v08wq7.js +1 -0
  121. package/bin/chunk-yncvy335.js +3 -0
  122. package/bin/chunk-ytzddcj2.js +1 -0
  123. package/bin/{chunk-03zkxckm.js → chunk-zxqasmvz.js} +1 -1
  124. package/bin/shumai-app.html +1 -1
  125. package/bin/shumai-app.js +466 -458
  126. package/package.json +8 -11
  127. package/bin/chunk-04nqnkzs.js +0 -4
  128. package/bin/chunk-157axqz1.js +0 -1
  129. package/bin/chunk-1tesbv8w.js +0 -2
  130. package/bin/chunk-24nx3krz.js +0 -2
  131. package/bin/chunk-2w2bknn2.js +0 -10
  132. package/bin/chunk-3ahax79y.js +0 -11
  133. package/bin/chunk-3fjgf7eb.js +0 -3
  134. package/bin/chunk-3wcvema0.js +0 -32
  135. package/bin/chunk-45p7d22e.js +0 -2
  136. package/bin/chunk-461gcgrs.js +0 -2
  137. package/bin/chunk-5ebb2pdf.js +0 -5
  138. package/bin/chunk-6hs63sva.js +0 -42
  139. package/bin/chunk-6sq6dfa1.js +0 -3
  140. package/bin/chunk-87secbzy.js +0 -1
  141. package/bin/chunk-8pykp70z.js +0 -1
  142. package/bin/chunk-axeq2pq5.js +0 -2
  143. package/bin/chunk-bcyvxp1c.js +0 -12
  144. package/bin/chunk-bn0taqr3.js +0 -3
  145. package/bin/chunk-cb37q6t0.js +0 -1
  146. package/bin/chunk-cfqny70c.js +0 -3
  147. package/bin/chunk-cqnected.js +0 -2
  148. package/bin/chunk-d1q1tn36.js +0 -1
  149. package/bin/chunk-d1rjpbgv.js +0 -2
  150. package/bin/chunk-eshwjf91.js +0 -2
  151. package/bin/chunk-fa9yq17g.js +0 -129
  152. package/bin/chunk-fznchvm7.js +0 -1
  153. package/bin/chunk-g2z0c39g.js +0 -1
  154. package/bin/chunk-gnt9gewm.js +0 -2
  155. package/bin/chunk-hbnpx0a5.js +0 -1
  156. package/bin/chunk-hgy9rqt1.js +0 -1
  157. package/bin/chunk-hk659cg2.css +0 -1
  158. package/bin/chunk-k97axrc4.js +0 -13
  159. package/bin/chunk-m9f21ye9.js +0 -1
  160. package/bin/chunk-md7pgk86.js +0 -2
  161. package/bin/chunk-me3zmpj5.js +0 -14
  162. package/bin/chunk-mg6sybt0.js +0 -1
  163. package/bin/chunk-n08h1jgx.js +0 -2
  164. package/bin/chunk-np39aknv.js +0 -2
  165. package/bin/chunk-q1gfypy3.js +0 -2
  166. package/bin/chunk-qx553512.js +0 -211
  167. package/bin/chunk-r3s1x5wp.js +0 -1
  168. package/bin/chunk-s6g2mzpn.js +0 -2
  169. package/bin/chunk-sjbvt3wa.js +0 -2
  170. package/bin/chunk-srmx5z3v.js +0 -3
  171. package/bin/chunk-t1h12r3q.js +0 -54
  172. package/bin/chunk-t6myw0jf.js +0 -2
  173. package/bin/chunk-t8jfp3vx.js +0 -1
  174. package/bin/chunk-v5hz09a1.js +0 -3
  175. package/bin/chunk-vk9ecq8n.js +0 -2
  176. package/bin/chunk-w4adkd0a.js +0 -20
  177. package/bin/chunk-xfmnfcv2.js +0 -5
  178. package/bin/chunk-xhngtwn9.js +0 -1
  179. package/bin/chunk-xjnehexk.js +0 -2
  180. package/bin/chunk-xzb0t8mx.js +0 -1
  181. package/bin/chunk-zpk87b33.js +0 -11
  182. package/bin/chunk-zts21ft7.js +0 -1
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Ko}from"./chunk-4bc3gqmn.js";import{Dt}from"./chunk-3ahax79y.js";import{Ge,Xt,qt}from"./chunk-y5h5d5gx.js";import{H}from"./chunk-a8bymrv1.js";var N=H(Dt()),c=H(Ge()),w=H(Ko());import L from"fs/promises";var l=H(Ge());var O="169.254.170.2",y="169.254.170.23",v="[fd00:ec2::23]",A=(e,o)=>{if(e.protocol==="https:")return;if(e.hostname===O||e.hostname===y||e.hostname===v)return;if(e.hostname.includes("[")){if(e.hostname==="[::1]"||e.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(e.hostname==="localhost")return;let n=e.hostname.split("."),r=(t)=>{let s=parseInt(t,10);return 0<=s&&s<=255};if(n[0]==="127"&&r(n[1])&&r(n[2])&&r(n[3])&&n.length===4)return}throw new l.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
2
+ import{Ko}from"./chunk-hc0xbmtt.js";import{Ot}from"./chunk-k9q4nn8b.js";import{Ge,er,Ht}from"./chunk-6mrgtn78.js";import{H}from"./chunk-t6cn018t.js";var N=H(Ot()),c=H(Ge()),w=H(Ko());import L from"fs/promises";var l=H(Ge());var O="169.254.170.2",y="169.254.170.23",v="[fd00:ec2::23]",A=(e,o)=>{if(e.protocol==="https:")return;if(e.hostname===O||e.hostname===y||e.hostname===v)return;if(e.hostname.includes("[")){if(e.hostname==="[::1]"||e.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(e.hostname==="localhost")return;let n=e.hostname.split("."),r=(t)=>{let s=parseInt(t,10);return 0<=s&&s<=255};if(n[0]==="127"&&r(n[1])&&r(n[2])&&r(n[3])&&n.length===4)return}throw new l.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
3
3
  - loopback CIDR 127.0.0.0/8 or [::1/128]
4
4
  - ECS container host 169.254.170.2
5
- - EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:o})};var i=H(Ge()),C=H(qt()),p=H(Xt()),_=H(Xt());function f(e){return new C.HttpRequest({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((o,[n,r])=>(o[n]=r,o),{}),fragment:e.hash})}async function I(e,o){let r=await _.sdkStreamMixin(e.body).transformToString();if(e.statusCode===200){let t=JSON.parse(r);if(typeof t.AccessKeyId!=="string"||typeof t.SecretAccessKey!=="string"||typeof t.Token!=="string"||typeof t.Expiration!=="string")throw new i.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:o});return{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:p.parseRfc3339DateTime(t.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let t={};try{t=JSON.parse(r)}catch(s){}throw Object.assign(new i.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:o}),{Code:t.Code,Message:t.Message})}throw new i.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:o})}var u=(e,o,n)=>async()=>{for(let r=0;r<o;++r)try{return await e()}catch(t){await new Promise((s)=>setTimeout(s,n))}return await e()};var U="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",k="http://169.254.170.2",K="AWS_CONTAINER_CREDENTIALS_FULL_URI",P="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",F="AWS_CONTAINER_AUTHORIZATION_TOKEN",x=(e={})=>{e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let o,n=e.awsContainerCredentialsRelativeUri??process.env[U],r=e.awsContainerCredentialsFullUri??process.env[K],t=e.awsContainerAuthorizationToken??process.env[F],s=e.awsContainerAuthorizationTokenFile??process.env[P],a=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?.warn?console.warn:e.logger.warn.bind(e.logger);if(n&&r)a("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),a("awsContainerCredentialsRelativeUri will take precedence.");if(t&&s)a("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),a("awsContainerAuthorizationTokenFile will take precedence.");if(n)o=`${k}${n}`;else if(r)o=r;else throw new c.CredentialsProviderError(`No HTTP credential provider host provided.
5
+ - EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:o})};var i=H(Ge()),C=H(Ht()),p=H(er()),_=H(er());function f(e){return new C.HttpRequest({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((o,[n,r])=>(o[n]=r,o),{}),fragment:e.hash})}async function I(e,o){let r=await _.sdkStreamMixin(e.body).transformToString();if(e.statusCode===200){let t=JSON.parse(r);if(typeof t.AccessKeyId!=="string"||typeof t.SecretAccessKey!=="string"||typeof t.Token!=="string"||typeof t.Expiration!=="string")throw new i.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:o});return{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:p.parseRfc3339DateTime(t.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let t={};try{t=JSON.parse(r)}catch(s){}throw Object.assign(new i.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:o}),{Code:t.Code,Message:t.Message})}throw new i.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:o})}var u=(e,o,n)=>async()=>{for(let r=0;r<o;++r)try{return await e()}catch(t){await new Promise((s)=>setTimeout(s,n))}return await e()};var U="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",k="http://169.254.170.2",K="AWS_CONTAINER_CREDENTIALS_FULL_URI",P="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",F="AWS_CONTAINER_AUTHORIZATION_TOKEN",x=(e={})=>{e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let o,n=e.awsContainerCredentialsRelativeUri??process.env[U],r=e.awsContainerCredentialsFullUri??process.env[K],t=e.awsContainerAuthorizationToken??process.env[F],s=e.awsContainerAuthorizationTokenFile??process.env[P],a=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?.warn?console.warn:e.logger.warn.bind(e.logger);if(n&&r)a("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),a("awsContainerCredentialsRelativeUri will take precedence.");if(t&&s)a("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),a("awsContainerAuthorizationTokenFile will take precedence.");if(n)o=`${k}${n}`;else if(r)o=r;else throw new c.CredentialsProviderError(`No HTTP credential provider host provided.
6
6
  Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:e.logger});let T=new URL(o);A(T,e.logger);let h=w.NodeHttpHandler.create({connectionTimeout:e.timeout??1000}),R=e.timeout??1000,g=u(async()=>{let d=f(T);if(s)d.headers.Authorization=E((await L.readFile(s)).toString());else if(t)d.headers.Authorization=E(t);try{let m=await h.handle(d,{requestTimeout:R});return I(m.response).then((S)=>N.setCredentialFeature(S,"CREDENTIALS_HTTP","z"))}catch(m){throw new c.CredentialsProviderError(String(m),{logger:e.logger})}},e.maxRetries??3,e.timeout??1000);return async()=>{try{return await g()}finally{h.destroy?.()}}},E=(e)=>{if(e.includes(`\r
7
7
  `))throw new c.CredentialsProviderError("Authorization token contains invalid \\r\\n sequence.");return e};export{x as fromHttp};
@@ -0,0 +1 @@
1
+ import{m,_,u,E,L,t,o,G,Ta,Z,B,Pe,xn,ze,g,O,ar,C,S,Re,ht,Kc,Wc,Cb,vd,Oa,Cv,Kh,Zo,sI,Kn,nt,ot,st,it,at,lt,ct,ut,de,ce,me,He,ue,z,gt,Nt,M,mn,Vr,Gt,dr,br,Bo,fe,pf}from"./chunk-p1d500sf.js";import"./chunk-c8kjpmfe.js";import"./chunk-qt78vs3g.js";import{zr}from"./chunk-cxet91kt.js";import"./chunk-xgnvktq6.js";import{Mi}from"./chunk-keetdtxb.js";import{ts,Yl,ns,Is}from"./chunk-7rycq6wb.js";import{Vl,Ql}from"./chunk-f0b4a9y3.js";import"./chunk-fkn6f4qt.js";import{Ri}from"./chunk-6vkfzzvt.js";import{Mr}from"./chunk-5aqthcm6.js";import"./chunk-1vt9ss7d.js";import"./chunk-agcnbjxk.js";import"./chunk-zxqasmvz.js";import"./chunk-ts4d1mxf.js";import"./chunk-xsfy8hz3.js";import"./chunk-b7qs7hxg.js";import"./chunk-ht5rht98.js";E();var Dt=({item:n})=>{if(n.preview?.thumbnailUrl)return t("img",{src:n.preview.thumbnailUrl,alt:"Preview",className:"w-full h-full object-cover"});if(n.preview?.proxyType==="audio"||n.proxyType==="audio")return t("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:t(ts,{className:"w-5 h-5 text-muted-foreground"})});return t("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:t(ar,{className:"w-5 h-5 text-muted-foreground"})})},Ne=({projectId:n,currentAssetId:s,parentFolderId:k,initialFiles:p,initialNextCursor:A,isLoading:a=!1})=>{let{ref:N,inView:D}=Nt({threshold:0,rootMargin:"200px"}),R=_(null),l=_(!0),[c,y]=u(p),[V,X]=u(A),[Q,U]=u(!!A),[h,Y]=u(!1);return m(()=>{y(p),X(A),U(!!A),l.current=!0},[p,A]),m(()=>{(async()=>{if(!V||h||!D||!Q)return;Y(!0);try{let I=await g.api.folders[":folderId"].search.$post({param:{folderId:k},json:{assetType:"file",after:V,first:200,recursively:!1,conditions:[]}});if(!I.ok)throw Error("Failed to fetch next page");let P=await I.json(),q=P.data||[];y((ee)=>[...ee,...q]),X(P.pageInfo?.cursor||void 0),U(!!P.pageInfo?.cursor&&q.length>0)}catch(I){console.error("Error fetching next page:",I)}finally{Y(!1)}})()},[D,V,Q,h,k]),m(()=>{if(c.some((I)=>I?.id===s)&&R.current)if(l.current)R.current.scrollIntoView({block:"center",inline:"center",behavior:"auto"}),l.current=!1;else R.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},[c,s]),t("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:o("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:[a&&c.length===0?Array.from({length:6}).map((f,I)=>t(fe,{className:"w-[52px] h-[52px] rounded-lg shrink-0","data-testid":"carousel-skeleton-item"},I)):c.map((f)=>{if(!f)return null;let I=f.id===s;return t("div",{ref:f.id===s?R:null,className:"flex-shrink-0",children:o(xn,{to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:f.id},search:{version:void 0},className:C("rounded-lg border overflow-hidden flex items-center justify-center transition-all bg-muted/30 block relative",I?"w-[62px] h-[62px] opacity-100":"w-[52px] h-[52px] opacity-60 hover:opacity-100"),children:[t(Dt,{item:f}),f.agent&&t("span",{className:"absolute top-1 right-1 z-10 pointer-events-none select-none rounded bg-black/60 px-1 py-0.5 text-[10px] font-medium leading-none text-white",title:f.agent.name,"data-testid":"carousel-agent-badge",children:"AI"})]})},f.id)}),!a&&Q&&t("div",{ref:N,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:h&&t(O,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})})};E();function St(){let{projectId:n,fileId:s}=Le.useParams(),k=Le.useSearch(),{version:p,start:A}=k,a=p||s,{cmpLeft:N,cmpRight:D}=k,R=k.cmpActive??"left",l=!!k.compare&&!!N&&!!D,c=_(null),{teamId:y,ensureTeamIdForProject:V}=gt(),[X,Q]=u(360),[U,h]=u([]),{fileViewRightSidebarCollapsed:Y}=Gt(),{isChatbotOpen:f}=dr(),I=br((e)=>Boolean(e.metadata["appearance.hideAgent"])),[P,q]=u(0),[ee,T]=u(null),[ve,Ee]=u(null),[Ve,we]=u(void 0),[W,Fe]=u({show:!0,files:[],nextCursor:void 0,folderId:void 0}),[qe,re]=u(!0),_e=g.api.files[":fileId"].metadata.$patch,{mutate:Ke}=B({mutationFn:async(e)=>{let r=await _e(e);if(!r.ok)throw Error("Failed to patch metadata");return await r.json()}}),J=G(),{members:Oe,fetchProjectMembers:ke}=Vr(),Qe=Bo();m(()=>{V(n)},[n,V]),m(()=>{if(n)ke(n,!0)},[n,ke]),m(()=>{if(n&&s)g.api.projects[":projectId"].recents.view.$post({param:{projectId:n},json:{assetId:s}}).catch(()=>{})},[n,s]);let{data:be,isLoading:Be,isError:Ue,isFetching:We}=Z({queryKey:["files",s],queryFn:async()=>{let e=await g.api.files[":fileId"].$get({param:{fileId:s}});if(!e.ok)throw Error("Failed to fetch stack");return await e.json()},enabled:!!y,placeholderData:Ta}),{data:Ge,isLoading:Je,isError:Xe,isFetching:Ye}=Z({queryKey:["files",p],queryFn:async()=>{let e=await g.api.files[":fileId"].$get({param:{fileId:p}});if(!e.ok)throw Error("Failed to fetch version");return await e.json()},enabled:!!y&&!!p,placeholderData:Ta}),{data:Ze}=Z({queryKey:["version_stacks",s,"versions"],queryFn:async()=>{let e=await g.api.version_stacks[":stackId"].versions.$get({param:{stackId:s}});if(!e.ok)throw Error("Failed to fetch versions");return await e.json()},enabled:!!n&&!!s&&(!!p||l)}),{data:x}=Z({queryKey:["projects",n],queryFn:async()=>{let e=await g.api.projects[":projectId"].$get({param:{projectId:n}});if(!e.ok)throw Error("Failed to fetch project");return await e.json()}}),v=Pe(),{setProjectState:Ae,clearProjectState:xe}=mn(),et=Be||!!p&&Je,tt=Ue||!!p&&Xe,rt=We||!!p&&Ye,i=Ge||be,b=p?Ze:be?.versionStack?.versions,d=i?.ancestorFolders?.[0]?.id??x?.rootFolder??"",[se,te]=u(!1),[oe,je]=u(""),ie=_(null),ae=_(!1),[dt,le]=u(!1),ft=g.api.files[":fileId"].$put,{mutate:mt,mutateAsync:pt,isPending:Ce}=B({mutationFn:async(e)=>{let r=await ft(e);if(!r.ok)throw Error("Failed to rename file");return await r.json()},onSuccess:()=>{J.invalidateQueries({queryKey:["files"]}),J.invalidateQueries({queryKey:["version_stacks"]}),M.success(sI?.()||"Renamed successfully"),te(!1)},onError:()=>{M.error(Cv?.()||"Failed to rename")}}),It=g.api.files.$delete,{mutate:yt,mutateAsync:vt,isPending:De}=B({mutationFn:async(e)=>{if(!(await It(e)).ok)throw Error("Failed to delete file")},onSuccess:()=>{if(J.invalidateQueries({queryKey:["files"]}),J.invalidateQueries({queryKey:["version_stacks"]}),M.success(Cb?.()||"Deleted"),le(!1),d&&d!==x?.rootFolder)v({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:d}});else v({to:"/projects/$projectId",params:{projectId:n}})},onError:()=>{M.error(Oa?.()||"Failed to delete")}}),wt=(e)=>{if(e?.preventDefault(),!oe.trim()||!a)return;mt({param:{fileId:a},json:{name:oe.trim()}})},Ft=()=>{if(!a)return;yt({json:{ids:[a]}})};m(()=>{if(i&&x&&y)Ae({teamId:y,projectId:n,projectName:x.name??"",ancestorFolders:i.ancestorFolders??[],currentAsset:{id:a||s,name:i.name,type:"file",version:b?b.find((e)=>e.id===a)?.version??b.length:void 0,proxyType:i.proxyType},isRootFolder:!1,fileId:s,downloadInfo:{originalKey:i.media?.original?.key,videoTranscodes:i.media?.videoTranscodes?.map((e)=>({key:e.key,width:e.width,height:e.height,resolution:e.resolution,hdr:e.hdr}))},versions:b,compareMode:l,canCompareVersions:(b?.length??0)>=2,onCompareVersions:()=>{let e=Yl(b);if(!e)return;v({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,version:void 0,compare:!0,cmpLeft:e.left.id,cmpRight:e.right.id,cmpActive:"left"})})},onFolderClick:(e)=>{v({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:e}})},onRename:()=>{ae.current=!1,je(i?.name??""),te(!0)},onDelete:()=>{le(!0)}});return()=>xe()},[y,n,x,i,b,a,s,l,Ae,xe,v]),m(()=>{if(!se)return;let e=setTimeout(()=>{ae.current=!0},1000);return()=>clearTimeout(e)},[se]);let kt=()=>{if(ae.current)return;setTimeout(()=>{if(ie.current)Is(ie.current)},0)};if(m(()=>{if(!d||!a)return;if(W.folderId===d){re(!1);return}re(!0);let e=!0;return(async()=>{try{let w="",F=!1,j=[],ge=void 0;for(let he=0;he<5;he++){let Ie=await g.api.folders[":folderId"].search.$post({param:{folderId:d},json:{assetType:"file",after:w,first:200,recursively:!1,conditions:[]}});if(!Ie.ok)throw Error("Failed to search parent folder for carousel");let H=await Ie.json(),ye=H.data||[];if(j.push(...ye),ye.some((ne)=>ne.id===a)){if(F=!0,ge=H.pageInfo?.cursor||void 0,H.pageInfo?.cursor)try{let ne=await g.api.folders[":folderId"].search.$post({param:{folderId:d},json:{assetType:"file",after:H.pageInfo.cursor,first:200,recursively:!1,conditions:[]}});if(ne.ok){let Me=await ne.json(),Ct=Me.data||[];j.push(...Ct),ge=Me.pageInfo?.cursor||void 0}}catch{}break}if(!H.pageInfo?.cursor||ye.length<200)break;w=H.pageInfo.cursor}if(e)Fe({show:!0,files:F?j:i?[i]:[],nextCursor:F?ge:void 0,folderId:d})}catch(w){if(console.error(w),e)Fe({show:!0,files:i?[i]:[],nextCursor:void 0,folderId:d})}finally{if(e)re(!1)}})(),()=>{e=!1}},[d,a,W.folderId,i]),m(()=>{q(0),T(null),h([])},[i?.id]),m(()=>{T(null),h([])},[ve?.id]),m(()=>{zr.getState().reset(),zr.getState().setIsDrawing(!1),h([]),T(null)},[a]),et&&!i)return t(pf,{});if(tt||!i||!x||!y)return t("div",{children:Kh()});let K=l?ve:i,Se=K?.id??a,Te=(e,r)=>{if(!y)return;Ke({param:{fileId:Se},json:[{key:e,value:r}]},{onSuccess:()=>{J.invalidateQueries({queryKey:["files",Se]})}})},pe=(e)=>{v({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,...e})})},bt=()=>{pe({compare:void 0,cmpLeft:void 0,cmpRight:void 0,cmpActive:void 0,version:R==="left"?N:D})},At=(e)=>{T(e.id||null);let r=e.annotations;if(r&&r.length>0)h(r);else h([]);if(l){if(e.second!==null&&e.second!==void 0)we({second:e.second,nonce:Date.now()});return}if(e.second!==null&&e.second!==void 0)c.current?.seekTo(e.second),c.current?.pause();else if(r&&r.length>0)c.current?.pause()},xt=(e)=>{T(e.id||null);let w=e.details,F=w?.annotations;if(F&&F.length>0)h(F);else h([]);let j=w?.position?.type==="time"?w.position.seconds:w?.position?.type==="page"?w.position.page:void 0;if(l){if(j!==void 0)we({second:j,nonce:Date.now()});return}if(j!==void 0)c.current?.seekTo(j),c.current?.pause();else if(F&&F.length>0)c.current?.pause()},$e=()=>{h([]),T(null)},jt=()=>{h([]),T(null)};if(Qe&&!l)return t(Vl,{projectId:n,teamId:y,fileId:s,file:i,projectInfo:x,ancestorFolders:i.ancestorFolders??[],parentFolderId:d,versions:b,activeFileId:a,startTime:A,siblingFiles:W.files,onNavigateToFile:(e)=>{v({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:e}})},onNavigateBack:()=>{if(d&&d!==x?.rootFolder)v({to:"/projects/$projectId/folders/$folderId",params:{projectId:n,folderId:d}});else v({to:"/projects/$projectId",params:{projectId:n}})},onSelectVersion:(e)=>{v({to:"/projects/$projectId/files/$fileId",params:{projectId:n,fileId:s},search:(r)=>({...r,version:e})})},onRenameFile:async(e)=>{await pt({param:{fileId:a},json:{name:e}})},onDeleteFile:async()=>{await vt({json:{ids:[a]}})},onSaveField:Te});return o("div",{className:"h-full flex flex-1 flex-col bg-background",children:[o("div",{className:"h-full flex flex-1 overflow-hidden",children:[o("div",{className:"flex-1 relative",children:[rt&&!l&&t("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/50",children:t(O,{className:"h-8 w-8 animate-spin text-foreground"})}),l&&N&&D?t(Ql,{versions:b??[],leftId:N,rightId:D,activeSide:R,annotations:U,seekRequest:Ve,onActiveSideChange:(e)=>pe({cmpActive:e}),onSwitchVersion:(e,r)=>pe(e==="left"?{cmpLeft:r}:{cmpRight:r}),onExit:bt,onActiveAssetChange:Ee,onPlay:$e,onTimeUpdate:q}):t(ns,{file:i,mediaControllerRef:c,onPlay:$e,onTimeUpdate:q,onSeek:jt,annotations:U,startTime:A,children:t(Ne,{projectId:n,currentAssetId:a,parentFolderId:d,initialFiles:W.files,initialNextCursor:W.nextCursor,isLoading:qe})})]}),(!Y||f&&!I)&&o(L,{children:[t(Mr,{onResize:(e)=>{Q((r)=>Math.max(300,Math.min(600,r-e)))},className:"hidden md:block"}),t("div",{style:{width:X},className:"flex-shrink-0 bg-background flex flex-col",children:f&&!I?t(Mi,{projectId:n,contextAssetId:a,file:K,currentTime:P,frameRate:K?.media?.metadata?.frameRate||30,startTimecode:K?.media?.metadata?.startTimecode,onTyping:()=>{if(l)return;c.current?.pause()},onSelectMessage:xt,selectedMessageId:ee}):t(Ri,{teamId:y,projectId:n,file:K,onSaveField:Te,members:Oe,onCommentSelect:At,currentTime:P,onTyping:()=>{if(l)return;c.current?.pause()},selectedCommentId:ee,hideAnnotationControl:K?.proxyType==="audio"})})]})]}),t(de,{open:se,onOpenChange:te,children:t(ce,{children:o("form",{onSubmit:wt,children:[t(me,{children:t(ue,{children:Zo()})}),t("div",{className:"py-4",children:t(z,{ref:ie,value:oe,onChange:(e)=>je(e.target.value),placeholder:vd?.()||"Enter new name",onFocus:kt,autoFocus:!0})}),o(He,{children:[t(S,{type:"button",variant:"outline",onClick:()=>te(!1),children:Re()}),o(S,{type:"submit",disabled:Ce||!oe.trim(),children:[Ce&&t(O,{className:"mr-2 h-4 w-4 animate-spin"}),Kn()]})]})]})})}),t(nt,{open:dt,onOpenChange:le,children:o(ot,{children:[o(st,{children:[t(at,{children:Wc?.()||"Delete Asset?"}),t(lt,{children:Kc?.()||"Deleted items can be recovered for 30 days before being permanently deleted."})]}),o(it,{children:[t(ut,{children:Re()}),o(ct,{onClick:Ft,disabled:De,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[De&&t(O,{className:"mr-2 h-4 w-4 animate-spin"}),ht()]})]})]})})]})}var Le=ze("/projects/$projectId/files/$fileId")({component:St});export{Le as Route};