@shumai-one/shumai 0.6.3 → 0.6.4

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 (188) hide show
  1. package/bin/{chunk-y3haqtr8.js → chunk-01vx2chc.js} +2 -2
  2. package/bin/chunk-0epkrexd.js +2 -0
  3. package/bin/chunk-0h5239kt.js +2 -0
  4. package/bin/{chunk-tfrevef9.js → chunk-0jnstdgf.js} +1 -1
  5. package/bin/{chunk-w6g84d59.js → chunk-0njsjy6x.js} +4 -4
  6. package/bin/{chunk-f8hgy69t.js → chunk-13rq2gtr.js} +2 -2
  7. package/bin/chunk-1aqs9sdh.js +3 -0
  8. package/bin/{chunk-09mj32d7.js → chunk-22jbsrka.js} +1 -1
  9. package/bin/chunk-2qknebmd.js +1 -0
  10. package/bin/{chunk-bd3v8mp1.js → chunk-2qzmh3ae.js} +4 -4
  11. package/bin/{chunk-p2vsdnd1.js → chunk-2tt0b8ym.js} +2 -2
  12. package/bin/{chunk-3s2ga6mt.js → chunk-2zm7czk6.js} +1 -1
  13. package/bin/{chunk-vmwys2ch.js → chunk-396tfwdx.js} +1 -1
  14. package/bin/chunk-3mx4trvh.js +10 -0
  15. package/bin/{chunk-j2txsbxz.js → chunk-45pb3kzz.js} +2 -2
  16. package/bin/{chunk-dkhdn92k.js → chunk-47fmhzwv.js} +2 -2
  17. package/bin/chunk-4awk4xhq.js +2 -0
  18. package/bin/{chunk-5ddg5ezb.js → chunk-4b2x2qba.js} +21 -21
  19. package/bin/{chunk-9x42vgeq.js → chunk-4rjy7ybr.js} +8 -8
  20. package/bin/{chunk-enax4303.js → chunk-598x693h.js} +2 -2
  21. package/bin/chunk-5c7ztqs7.js +1 -0
  22. package/bin/{chunk-4p31kxjh.js → chunk-65dh7x4c.js} +2 -2
  23. package/bin/{chunk-s74g9vsk.js → chunk-66e2vrky.js} +1 -1
  24. package/bin/{chunk-q8xr1a8j.js → chunk-6j3beg6n.js} +2 -2
  25. package/bin/{chunk-95b4mwyq.js → chunk-6ke13k69.js} +1 -1
  26. package/bin/{chunk-a859y4e1.js → chunk-6rqakmg0.js} +2 -2
  27. package/bin/{chunk-yb4mzqrd.js → chunk-6ty4tfmf.js} +3 -3
  28. package/bin/chunk-7e9ws6dh.js +129 -0
  29. package/bin/chunk-7mdddkfc.js +1 -0
  30. package/bin/{chunk-qvp24w0q.js → chunk-7q4mgd5x.js} +2 -2
  31. package/bin/chunk-7yv7shad.js +1 -0
  32. package/bin/{chunk-25npafhz.js → chunk-81b8rfv7.js} +2 -2
  33. package/bin/{chunk-etrm28sy.js → chunk-8a7ymmd4.js} +2 -2
  34. package/bin/chunk-8ac9at5y.js +2 -0
  35. package/bin/{chunk-sz19nn1x.js → chunk-8zcfgz9c.js} +1 -1
  36. package/bin/{chunk-te484xtb.js → chunk-955kf5kc.js} +3 -3
  37. package/bin/{chunk-h2bphev9.js → chunk-978rm9a9.js} +2 -2
  38. package/bin/{chunk-jt02kpfc.js → chunk-9qzbrp4d.js} +2 -2
  39. package/bin/{chunk-20bamhwa.js → chunk-a283dh05.js} +2 -2
  40. package/bin/chunk-aa2a06cc.js +1 -0
  41. package/bin/{chunk-esj0kwe5.js → chunk-ajr1w3vq.js} +6 -6
  42. package/bin/chunk-akafypge.js +218 -0
  43. package/bin/chunk-amk373q2.js +2 -0
  44. package/bin/{chunk-mn71dffh.js → chunk-apq2gvvp.js} +2 -2
  45. package/bin/chunk-av2w1sez.js +2 -0
  46. package/bin/{chunk-atpt99h4.js → chunk-b6kmj34z.js} +12 -12
  47. package/bin/chunk-bkzaw9p8.js +1 -0
  48. package/bin/{chunk-pq6kdp83.js → chunk-bssb9tar.js} +3 -3
  49. package/bin/chunk-bwvj1aqc.js +1 -0
  50. package/bin/chunk-by9esjn7.js +3 -0
  51. package/bin/chunk-bywk8mbc.js +2 -0
  52. package/bin/{chunk-r6t0j0jx.js → chunk-c61g9hfa.js} +4 -4
  53. package/bin/{chunk-mn0kt3p6.js → chunk-cdcgjh8k.js} +1 -1
  54. package/bin/{chunk-atdfqdkj.js → chunk-d277evce.js} +4 -4
  55. package/bin/{chunk-9405hzv2.js → chunk-d3brvxh7.js} +2 -2
  56. package/bin/{chunk-4vjgdj0h.js → chunk-dcb1nzf1.js} +1 -1
  57. package/bin/{chunk-q5x0yywj.js → chunk-dfbzatq9.js} +2 -2
  58. package/bin/chunk-e0bckx12.js +2 -0
  59. package/bin/{chunk-wgvgtttc.js → chunk-e2p4s2pj.js} +3 -3
  60. package/bin/chunk-e8zzg57c.js +2 -0
  61. package/bin/{chunk-npeapp7e.js → chunk-edfaqwaq.js} +2 -2
  62. package/bin/{chunk-6nqqe7w9.js → chunk-ehgrp0f9.js} +1 -1
  63. package/bin/chunk-evs2aaav.js +12 -0
  64. package/bin/{chunk-cp96e9pq.js → chunk-f5bhcjhw.js} +1 -1
  65. package/bin/{chunk-34f64q0q.js → chunk-fb9dedm2.js} +2 -2
  66. package/bin/{chunk-zx1c4vm5.js → chunk-ff0mh9p3.js} +31 -31
  67. package/bin/chunk-fpfby5tz.js +1 -0
  68. package/bin/{chunk-eyjfhdp9.js → chunk-gd3b5akr.js} +2 -2
  69. package/bin/{chunk-3hgrw1m0.js → chunk-gm1fy3hm.js} +5 -5
  70. package/bin/{chunk-ezjxx44x.js → chunk-gqkjx7rz.js} +3 -3
  71. package/bin/{chunk-1y6h4vge.js → chunk-h7f5370s.js} +1 -1
  72. package/bin/chunk-hcyhsn8e.js +2 -0
  73. package/bin/{chunk-erfkd3z9.js → chunk-jxm0gzmf.js} +2 -2
  74. package/bin/{chunk-09mpcg9x.js → chunk-k3ggy3xk.js} +2 -2
  75. package/bin/{chunk-0a298n62.js → chunk-k9vjs21p.js} +2 -2
  76. package/bin/chunk-ka40gv72.js +1 -0
  77. package/bin/chunk-km70p970.js +2 -0
  78. package/bin/{chunk-vnmggrd6.js → chunk-m6v8rb39.js} +8 -8
  79. package/bin/{chunk-bbxwyhz3.js → chunk-m8spagwp.js} +3 -3
  80. package/bin/{chunk-addssm8d.js → chunk-mfh7mg5b.js} +1 -1
  81. package/bin/chunk-n0cn0218.js +2 -0
  82. package/bin/chunk-n54ftsdx.js +2 -0
  83. package/bin/{chunk-v0yevesp.js → chunk-n7cvj15k.js} +5 -5
  84. package/bin/chunk-na5fh7er.js +2 -0
  85. package/bin/chunk-neazdbxy.js +1 -0
  86. package/bin/chunk-nk24qw3m.js +1 -0
  87. package/bin/{chunk-7mawxsk3.js → chunk-nsbbseff.js} +2 -2
  88. package/bin/chunk-nseef85h.js +1 -0
  89. package/bin/chunk-p35ztj2z.js +3 -0
  90. package/bin/chunk-pcjc9ygv.js +2 -0
  91. package/bin/{chunk-brgns7hv.js → chunk-pemmtd8q.js} +1 -1
  92. package/bin/{chunk-7jz3cmq6.js → chunk-pzrqnnpg.js} +1 -1
  93. package/bin/{chunk-a74g6h8a.js → chunk-q43m934j.js} +2 -2
  94. package/bin/{chunk-6f3zhq64.js → chunk-q57m34h0.js} +3 -3
  95. package/bin/chunk-q5k72jz9.js +3 -0
  96. package/bin/chunk-q9fsxakd.js +2 -0
  97. package/bin/chunk-qadpe0ct.js +2 -0
  98. package/bin/chunk-qeypjv4f.css +1 -0
  99. package/bin/chunk-qw92z3wf.js +2 -0
  100. package/bin/chunk-r0byfq1t.js +1 -0
  101. package/bin/chunk-r0q88qw3.js +2 -0
  102. package/bin/chunk-rjhczkh3.js +2 -0
  103. package/bin/{chunk-19zbh4fr.js → chunk-s0wxbybf.js} +1 -1
  104. package/bin/{chunk-d55138xx.js → chunk-s4hkcw24.js} +2 -2
  105. package/bin/chunk-szta50g1.js +1 -0
  106. package/bin/chunk-t6cb99gp.js +2 -0
  107. package/bin/chunk-tcr080b9.js +1 -0
  108. package/bin/{chunk-s6pk2zyg.js → chunk-v4nqx084.js} +5 -5
  109. package/bin/{chunk-gyv3yrhj.js → chunk-v7jzc3ye.js} +1 -1
  110. package/bin/{chunk-hsyfrzdd.js → chunk-vbe8wred.js} +1 -1
  111. package/bin/{chunk-sz5zawfw.js → chunk-vf9s8b5t.js} +2 -2
  112. package/bin/{chunk-e55sgg8t.js → chunk-vk3eqr65.js} +1 -1
  113. package/bin/{chunk-vv0m0m2f.js → chunk-vm9bbk97.js} +4 -4
  114. package/bin/{chunk-1e1q1hyg.js → chunk-w4gqg27w.js} +2 -2
  115. package/bin/{chunk-z0de127n.js → chunk-w6ym7tsd.js} +4 -4
  116. package/bin/{chunk-3vpz5nat.js → chunk-ways29d1.js} +1 -1
  117. package/bin/chunk-wesg7tg9.js +1 -0
  118. package/bin/chunk-wmrrapwv.js +2 -0
  119. package/bin/chunk-wnwsjgj8.js +2 -0
  120. package/bin/{chunk-zkvezz89.js → chunk-wrb4xq9v.js} +1 -1
  121. package/bin/{chunk-7kah3zb5.js → chunk-wzrzc07t.js} +2 -2
  122. package/bin/chunk-xd1axsdv.js +2 -0
  123. package/bin/{chunk-k7vbk8v4.js → chunk-xk0jmx4s.js} +2 -2
  124. package/bin/{chunk-jc7dycy6.js → chunk-y545vfn0.js} +1 -1
  125. package/bin/{chunk-1ja2zw4w.js → chunk-y6h885fs.js} +1 -1
  126. package/bin/{chunk-0rgbxp24.js → chunk-yncmfr39.js} +2 -2
  127. package/bin/{chunk-7546ptwg.js → chunk-yxnz4ypt.js} +8 -8
  128. package/bin/chunk-zc1asygg.js +2 -0
  129. package/bin/{chunk-hg3rkp41.js → chunk-zc7wzcvh.js} +7 -7
  130. package/bin/chunk-zdvhh8mk.js +2 -0
  131. package/bin/{chunk-femnbfkj.js → chunk-zg0b902x.js} +2 -2
  132. package/bin/{chunk-ddmf9gqv.js → chunk-zhq7a7hs.js} +2 -2
  133. package/bin/{chunk-dygj751y.js → chunk-zmnvskn7.js} +11 -11
  134. package/bin/shumai-app.html +1 -1
  135. package/bin/shumai-app.js +470 -389
  136. package/package.json +7 -7
  137. package/prisma/migrations/20261102032402_add_archive_storage/migration.sql +25 -0
  138. package/prisma/schema.prisma +12 -6
  139. package/bin/chunk-02b5bcmc.js +0 -1
  140. package/bin/chunk-1tar0x8s.js +0 -7
  141. package/bin/chunk-20w1w9x7.js +0 -2
  142. package/bin/chunk-2qgagdb7.js +0 -1
  143. package/bin/chunk-2t6g3pny.js +0 -3
  144. package/bin/chunk-50pfmxt1.js +0 -2
  145. package/bin/chunk-5ngftxjb.js +0 -218
  146. package/bin/chunk-6t525bmg.js +0 -1
  147. package/bin/chunk-88jg9dq5.js +0 -2
  148. package/bin/chunk-8qdtvfx3.css +0 -1
  149. package/bin/chunk-8ww98y1m.js +0 -2
  150. package/bin/chunk-9vxmgvc8.js +0 -2
  151. package/bin/chunk-ajq9sxg0.js +0 -129
  152. package/bin/chunk-amp9h878.js +0 -2
  153. package/bin/chunk-awshe30f.js +0 -1
  154. package/bin/chunk-b3t7gbhm.js +0 -2
  155. package/bin/chunk-c02727j9.js +0 -2
  156. package/bin/chunk-c1wvs81k.js +0 -2
  157. package/bin/chunk-c8frmqsk.js +0 -2
  158. package/bin/chunk-cagzye3j.js +0 -2
  159. package/bin/chunk-djb65frk.js +0 -1
  160. package/bin/chunk-dx9f5wab.js +0 -1
  161. package/bin/chunk-ex3174e3.js +0 -2
  162. package/bin/chunk-f4xnx4n6.js +0 -1
  163. package/bin/chunk-fakph5jp.js +0 -1
  164. package/bin/chunk-ffjdkdcv.js +0 -2
  165. package/bin/chunk-gd016e9p.js +0 -2
  166. package/bin/chunk-h3atwgx2.js +0 -1
  167. package/bin/chunk-h7xny3de.js +0 -2
  168. package/bin/chunk-hpzk9k55.js +0 -1
  169. package/bin/chunk-hvyy8vct.js +0 -3
  170. package/bin/chunk-j2s311yc.js +0 -3
  171. package/bin/chunk-j6x53e33.js +0 -1
  172. package/bin/chunk-jacanzp7.js +0 -1
  173. package/bin/chunk-pdw77q09.js +0 -2
  174. package/bin/chunk-ptcz4ed3.js +0 -2
  175. package/bin/chunk-q1fzgqsv.js +0 -2
  176. package/bin/chunk-q4ny4hpt.js +0 -2
  177. package/bin/chunk-q8ysc5ex.js +0 -1
  178. package/bin/chunk-qm50g4n5.js +0 -10
  179. package/bin/chunk-s1j4v33x.js +0 -2
  180. package/bin/chunk-t68y25gf.js +0 -1
  181. package/bin/chunk-thpw6tcj.js +0 -2
  182. package/bin/chunk-vj4gamdn.js +0 -2
  183. package/bin/chunk-xy9qpn6b.js +0 -1
  184. package/bin/chunk-y5dv67mg.js +0 -2
  185. package/bin/chunk-z8t6e0ee.js +0 -1
  186. package/bin/chunk-zfg4yy3c.js +0 -2
  187. package/bin/chunk-zrrnvdxq.js +0 -3
  188. package/bin/chunk-zzqse5qc.js +0 -2
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{Cn}from"./chunk-z0de127n.js";import{kr}from"./chunk-k7vbk8v4.js";import{Qn,Fa}from"./chunk-hvyy8vct.js";import{Xu,Ic,hr}from"./chunk-1e1q1hyg.js";class g extends Error{code;diagnosticDetails;constructor(r,t,n){super(r);this.name="PiMessagesResponseError",this.code=t,this.diagnosticDetails=n}}function x(r){try{let t=JSON.parse(r),n=t?.error;return t&&typeof n==="object"&&n!==null&&!Array.isArray(n)?t:void 0}catch{return}}function m(r){return r.length>8192?`${r.slice(0,8192)}\u2026`:r}function y(r,t,n){let e=typeof n?.error?.message==="string"?n.error.message:void 0,s=typeof n?.error?.code==="string"?n.error.code:void 0,a=e??t,o=s?` (${s})`:"";return`${r.status} ${r.statusText}: ${a}${o}`}function w(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new g(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,error:s?.error,body:s?void 0:m(e),timestampMs:Date.now()})}function h(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}function l(r,t){if(!t)return;Ic(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function b(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"stop",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":return Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":return Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),l(t,e.rewrite),{type:"error",reason:e.reason,error:t};case"start":break;case"text_start":t.content[e.contentIndex]={type:"text",text:""};break;case"text_delta":t.content[e.contentIndex].text+=e.delta;break;case"text_end":Object.assign(t.content[e.contentIndex],{text:e.content,textSignature:e.contentSignature});break;case"thinking_start":t.content[e.contentIndex]={type:"thinking",thinking:""};break;case"thinking_delta":t.content[e.contentIndex].thinking+=e.delta;break;case"thinking_end":Object.assign(t.content[e.contentIndex],{thinking:e.content,thinkingSignature:e.contentSignature,redacted:e.redacted});break;case"toolcall_start":t.content[e.contentIndex]={type:"toolCall",id:e.id,name:e.toolName,arguments:{}},n.set(e.contentIndex,"");break;case"toolcall_delta":{let s=`${n.get(e.contentIndex)??""}${e.delta}`;n.set(e.contentIndex,s),t.content[e.contentIndex].arguments=Cn(s);break}case"toolcall_end":return Object.assign(t.content[e.contentIndex],e.toolCall),n.delete(e.contentIndex),{type:"toolcall_end",contentIndex:e.contentIndex,toolCall:t.content[e.contentIndex],partial:t}}return{...e,partial:t}}}async function*I(r){let t=new TextDecoder,n=r.getReader(),e="";try{while(!0){let{done:s,value:a}=await n.read();e+=s?t.decode():t.decode(a,{stream:!0}),e=e.replace(/\r\n/g,`
2
+ import{In}from"./chunk-w6ym7tsd.js";import{Mr}from"./chunk-xk0jmx4s.js";import{Gn,Ga}from"./chunk-1aqs9sdh.js";import{md,zc,hr}from"./chunk-w4gqg27w.js";class g extends Error{code;diagnosticDetails;constructor(r,t,n){super(r);this.name="PiMessagesResponseError",this.code=t,this.diagnosticDetails=n}}function x(r){try{let t=JSON.parse(r),n=t?.error;return t&&typeof n==="object"&&n!==null&&!Array.isArray(n)?t:void 0}catch{return}}function m(r){return r.length>8192?`${r.slice(0,8192)}\u2026`:r}function y(r,t,n){let e=typeof n?.error?.message==="string"?n.error.message:void 0,s=typeof n?.error?.code==="string"?n.error.code:void 0,a=e??t,o=s?` (${s})`:"";return`${r.status} ${r.statusText}: ${a}${o}`}function w(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new g(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,error:s?.error,body:s?void 0:m(e),timestampMs:Date.now()})}function h(){return{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}function l(r,t){if(!t)return;zc(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function b(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"stop",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":return Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":return Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),l(t,e.rewrite),{type:"error",reason:e.reason,error:t};case"start":break;case"text_start":t.content[e.contentIndex]={type:"text",text:""};break;case"text_delta":t.content[e.contentIndex].text+=e.delta;break;case"text_end":Object.assign(t.content[e.contentIndex],{text:e.content,textSignature:e.contentSignature});break;case"thinking_start":t.content[e.contentIndex]={type:"thinking",thinking:""};break;case"thinking_delta":t.content[e.contentIndex].thinking+=e.delta;break;case"thinking_end":Object.assign(t.content[e.contentIndex],{thinking:e.content,thinkingSignature:e.contentSignature,redacted:e.redacted});break;case"toolcall_start":t.content[e.contentIndex]={type:"toolCall",id:e.id,name:e.toolName,arguments:{}},n.set(e.contentIndex,"");break;case"toolcall_delta":{let s=`${n.get(e.contentIndex)??""}${e.delta}`;n.set(e.contentIndex,s),t.content[e.contentIndex].arguments=In(s);break}case"toolcall_end":return Object.assign(t.content[e.contentIndex],e.toolCall),n.delete(e.contentIndex),{type:"toolcall_end",contentIndex:e.contentIndex,toolCall:t.content[e.contentIndex],partial:t}}return{...e,partial:t}}}async function*I(r){let t=new TextDecoder,n=r.getReader(),e="";try{while(!0){let{done:s,value:a}=await n.read();e+=s?t.decode():t.decode(a,{stream:!0}),e=e.replace(/\r\n/g,`
3
3
  `);let o=e.indexOf(`
4
4
 
5
5
  `);while(o!==-1){let c=f(e.slice(0,o));if(c)yield c;e=e.slice(o+2),o=e.indexOf(`
6
6
 
7
7
  `)}if(s)break}if(e.trim()){let s=f(e);if(s)yield s}}finally{n.releaseLock()}}function f(r){let t=r.split(`
8
- `).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function k(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof g)Ic(s,Xu("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return kr("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var R=(r,t,n)=>{let e=new hr,s=b(r);return(async()=>{try{let a=n?.apiKey;if(!a)throw Error(`No API key provided for provider "${r.provider}"`);let o=new URL(`${r.baseUrl.replace(/\/+$/u,"")}/messages`);if(n?.debug)o.searchParams.set("debug","1");let c={model:r.id,context:t,options:{temperature:n?.temperature,maxTokens:n?.maxTokens,reasoning:n?.reasoning,cacheRetention:E(n?.cacheRetention,n?.env),sessionId:n?.sessionId,toolChoice:n?.toolChoice}},p=await n?.onPayload?.(c,r);if(p!==void 0)c=p;let i=await fetch(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...Fa(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:Qn(i.headers)},r),!i.ok){let d=await i.text();throw w(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of I(i.body)){let u=s(d);if(e.push(u),u.type==="done"||u.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(k(r,a,n?.signal?.aborted??!1))}})(),e},P=(r,t,n)=>{let e=n;return R(r,t,{...n,reasoning:n?.reasoning,toolChoice:e?.toolChoice,debug:e?.debug})};export{g as PiMessagesResponseError,R as stream,P as streamSimple};
8
+ `).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function k(r,t,n){let e=n?"aborted":"error",s={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:e,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()};if(!n&&t instanceof g)zc(s,md("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return Mr("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var R=(r,t,n)=>{let e=new hr,s=b(r);return(async()=>{try{let a=n?.apiKey;if(!a)throw Error(`No API key provided for provider "${r.provider}"`);let o=new URL(`${r.baseUrl.replace(/\/+$/u,"")}/messages`);if(n?.debug)o.searchParams.set("debug","1");let c={model:r.id,context:t,options:{temperature:n?.temperature,maxTokens:n?.maxTokens,reasoning:n?.reasoning,cacheRetention:E(n?.cacheRetention,n?.env),sessionId:n?.sessionId,toolChoice:n?.toolChoice}},p=await n?.onPayload?.(c,r);if(p!==void 0)c=p;let i=await fetch(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...Ga(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:Gn(i.headers)},r),!i.ok){let d=await i.text();throw w(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of I(i.body)){let u=s(d);if(e.push(u),u.type==="done"||u.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(k(r,a,n?.signal?.aborted??!1))}})(),e},P=(r,t,n)=>{let e=n;return R(r,t,{...n,reasoning:n?.reasoning,toolChoice:e?.toolChoice,debug:e?.debug})};export{g as PiMessagesResponseError,R as stream,P as streamSimple};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Xd}from"./chunk-v0yevesp.js";import{kr}from"./chunk-k7vbk8v4.js";import"./chunk-z0de127n.js";import{$i,Hi,Qi}from"./chunk-3hgrw1m0.js";import{Bs}from"./chunk-j2s311yc.js";import{no,oo}from"./chunk-eyjfhdp9.js";import{Us}from"./chunk-jt02kpfc.js";import{Qn}from"./chunk-hvyy8vct.js";import{Co,Xr}from"./chunk-erfkd3z9.js";import{bn}from"./chunk-h2bphev9.js";import{hr}from"./chunk-1e1q1hyg.js";var d="v1",A=new Set(["openai","openai-codex","opencode","azure-openai-responses"]),E=16;function R(r){let a=new Map;if(!r)return a;for(let e of r.split(",")){let n=e.trim();if(!n)continue;let[s,t]=n.split("=",2);if(!s||!t)continue;a.set(s.trim(),t.trim())}return a}function h(r,a){if(a?.azureDeploymentName)return a.azureDeploymentName;return R(kr("AZURE_OPENAI_DEPLOYMENT_NAME_MAP",a?.env)).get(r.id)||r.id}function g(r){return oo(no(r),"Azure OpenAI API error")}var y=(r,a,e)=>{let n=new hr;return(async()=>{let s=h(r,e),t={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.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 o=e?.apiKey;if(!o)throw Error(`No API key for provider: ${r.provider}`);let i=O(r,o,e),m=Co(a.tools,r.compat?.supportsOpenAIGrammarTools??!1),p=U(r,a,e,s,m),u=await e?.onPayload?.(p,r);if(u!==void 0)p=u;let f={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:l,response:c}=await Us(()=>i.responses.create(p,f).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:c.status,headers:Qn(c.headers)},r),n.push({type:"start",partial:t}),await Qi(l,t,n,r,{grammarToolInputProperties:m}),e?.signal?.aborted)throw Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw Error("An unknown error occurred");n.push({type:"done",reason:t.stopReason,message:t}),n.end()}catch(o){for(let i of t.content)delete i.index,delete i.partialJson,delete i.customInput;t.stopReason=e?.signal?.aborted?"aborted":"error",t.errorMessage=g(o),n.push({type:"error",reason:t.stopReason,error:t}),n.end()}})(),n},B=(r,a,e)=>{let n=e?.apiKey;if(!n)throw Error(`No API key for provider: ${r.provider}`);let s=Xr(r,a,e,n),t=e?.reasoning?bn(r,e.reasoning):void 0;return y(r,a,{...s,reasoningEffort:t==="off"?void 0:t})};function _(r){let a=r.trim().replace(/\/+$/,""),e;try{e=new URL(a)}catch{throw Error(`Invalid Azure OpenAI base URL: ${r}`)}let n=e.hostname.endsWith(".openai.azure.com")||e.hostname.endsWith(".cognitiveservices.azure.com")||e.hostname.endsWith(".ai.azure.com"),s=e.pathname.replace(/\/+$/,"");if(n&&(s===""||s==="/"||s==="/openai"||s==="/openai/v1/responses"))e.pathname="/openai/v1",e.search="";return e.toString().replace(/\/+$/,"")}function I(r){return`https://${r}.openai.azure.com/openai/v1`}function v(r,a){let e=a?.azureApiVersion||kr("AZURE_OPENAI_API_VERSION",a?.env)||d,n=a?.azureBaseUrl?.trim()||kr("AZURE_OPENAI_BASE_URL",a?.env)?.trim()||void 0,s=a?.azureResourceName||kr("AZURE_OPENAI_RESOURCE_NAME",a?.env),t=n;if(!t&&s)t=I(s);if(!t&&r.baseUrl)t=r.baseUrl;if(!t)throw Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:_(t),apiVersion:e}}function O(r,a,e){let n={...r.headers};if(e?.headers)Object.assign(n,e.headers);let{baseUrl:s,apiVersion:t}=v(r,e);return new Xd({apiKey:a,apiVersion:t,dangerouslyAllowBrowser:!0,defaultHeaders:n,baseURL:s})}function U(r,a,e,n,s=Co(a.tools,r.compat?.supportsOpenAIGrammarTools??!1)){let t=$i(r,a,A,{grammarToolInputProperties:s}),o={model:n,input:t,stream:!0,prompt_cache_key:Bs(e?.sessionId),store:!1};if(e?.maxTokens)o.max_output_tokens=Math.max(e.maxTokens,E);if(e?.temperature!==void 0)o.temperature=e?.temperature;if(a.tools&&a.tools.length>0)o.tools=Hi(a.tools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1});if(r.reasoning){if(e?.reasoningEffort||e?.reasoningSummary){let i=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:"medium";o.reasoning={effort:i,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else if(r.thinkingLevelMap?.off!==null)o.reasoning={effort:r.thinkingLevelMap?.off??"none"}}return o}export{y as stream,B as streamSimple};
2
+ import{vf}from"./chunk-n7cvj15k.js";import{Mr}from"./chunk-xk0jmx4s.js";import"./chunk-w6ym7tsd.js";import{Ji,Yi,Xi}from"./chunk-gm1fy3hm.js";import{Qs}from"./chunk-by9esjn7.js";import{io,ao}from"./chunk-gd3b5akr.js";import{Gs}from"./chunk-9qzbrp4d.js";import{Gn}from"./chunk-1aqs9sdh.js";import{Ro,tn}from"./chunk-jxm0gzmf.js";import{En}from"./chunk-978rm9a9.js";import{hr}from"./chunk-w4gqg27w.js";var d="v1",A=new Set(["openai","openai-codex","opencode","azure-openai-responses"]),E=16;function R(r){let a=new Map;if(!r)return a;for(let e of r.split(",")){let n=e.trim();if(!n)continue;let[s,t]=n.split("=",2);if(!s||!t)continue;a.set(s.trim(),t.trim())}return a}function h(r,a){if(a?.azureDeploymentName)return a.azureDeploymentName;return R(Mr("AZURE_OPENAI_DEPLOYMENT_NAME_MAP",a?.env)).get(r.id)||r.id}function g(r){return ao(io(r),"Azure OpenAI API error")}var y=(r,a,e)=>{let n=new hr;return(async()=>{let s=h(r,e),t={role:"assistant",content:[],api:"azure-openai-responses",provider:r.provider,model:r.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 o=e?.apiKey;if(!o)throw Error(`No API key for provider: ${r.provider}`);let i=O(r,o,e),m=Ro(a.tools,r.compat?.supportsOpenAIGrammarTools??!1),p=U(r,a,e,s,m),u=await e?.onPayload?.(p,r);if(u!==void 0)p=u;let f={...e?.signal?{signal:e.signal}:{},...e?.timeoutMs!==void 0?{timeout:e.timeoutMs}:{},maxRetries:0},{data:l,response:c}=await Gs(()=>i.responses.create(p,f).withResponse(),{maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,signal:e?.signal});if(await e?.onResponse?.({status:c.status,headers:Gn(c.headers)},r),n.push({type:"start",partial:t}),await Xi(l,t,n,r,{grammarToolInputProperties:m}),e?.signal?.aborted)throw Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw Error("An unknown error occurred");n.push({type:"done",reason:t.stopReason,message:t}),n.end()}catch(o){for(let i of t.content)delete i.index,delete i.partialJson,delete i.customInput;t.stopReason=e?.signal?.aborted?"aborted":"error",t.errorMessage=g(o),n.push({type:"error",reason:t.stopReason,error:t}),n.end()}})(),n},B=(r,a,e)=>{let n=e?.apiKey;if(!n)throw Error(`No API key for provider: ${r.provider}`);let s=tn(r,a,e,n),t=e?.reasoning?En(r,e.reasoning):void 0;return y(r,a,{...s,reasoningEffort:t==="off"?void 0:t})};function _(r){let a=r.trim().replace(/\/+$/,""),e;try{e=new URL(a)}catch{throw Error(`Invalid Azure OpenAI base URL: ${r}`)}let n=e.hostname.endsWith(".openai.azure.com")||e.hostname.endsWith(".cognitiveservices.azure.com")||e.hostname.endsWith(".ai.azure.com"),s=e.pathname.replace(/\/+$/,"");if(n&&(s===""||s==="/"||s==="/openai"||s==="/openai/v1/responses"))e.pathname="/openai/v1",e.search="";return e.toString().replace(/\/+$/,"")}function I(r){return`https://${r}.openai.azure.com/openai/v1`}function v(r,a){let e=a?.azureApiVersion||Mr("AZURE_OPENAI_API_VERSION",a?.env)||d,n=a?.azureBaseUrl?.trim()||Mr("AZURE_OPENAI_BASE_URL",a?.env)?.trim()||void 0,s=a?.azureResourceName||Mr("AZURE_OPENAI_RESOURCE_NAME",a?.env),t=n;if(!t&&s)t=I(s);if(!t&&r.baseUrl)t=r.baseUrl;if(!t)throw Error("Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME, or pass azureBaseUrl, azureResourceName, or model.baseUrl.");return{baseUrl:_(t),apiVersion:e}}function O(r,a,e){let n={...r.headers};if(e?.headers)Object.assign(n,e.headers);let{baseUrl:s,apiVersion:t}=v(r,e);return new vf({apiKey:a,apiVersion:t,dangerouslyAllowBrowser:!0,defaultHeaders:n,baseURL:s})}function U(r,a,e,n,s=Ro(a.tools,r.compat?.supportsOpenAIGrammarTools??!1)){let t=Ji(r,a,A,{grammarToolInputProperties:s}),o={model:n,input:t,stream:!0,prompt_cache_key:Qs(e?.sessionId),store:!1};if(e?.maxTokens)o.max_output_tokens=Math.max(e.maxTokens,E);if(e?.temperature!==void 0)o.temperature=e?.temperature;if(a.tools&&a.tools.length>0)o.tools=Yi(a.tools,{supportsStrictMode:r.compat?.supportsStrictMode??!0,supportsOpenAIGrammarTools:r.compat?.supportsOpenAIGrammarTools??!1});if(r.reasoning){if(e?.reasoningEffort||e?.reasoningSummary){let i=e?.reasoningEffort?r.thinkingLevelMap?.[e.reasoningEffort]??e.reasoningEffort:"medium";o.reasoning={effort:i,summary:e?.reasoningSummary||"auto"},o.include=["reasoning.encrypted_content"]}else if(r.thinkingLevelMap?.off!==null)o.reasoning={effort:r.thinkingLevelMap?.off??"none"}}return o}export{y as stream,B as streamSimple};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Or}from"./chunk-zrrnvdxq.js";import{ho,Bu}from"./chunk-bd3v8mp1.js";var a=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},c=class{#e;#t=new l;#r;#n;constructor(e){this.#e={...e}}async init(){if(this.#r=this.#e.database,this.#n=new u(this.#r),this.#e.onCreateConnection)await this.#e.onCreateConnection(this.#n)}async acquireConnection(){return await this.#t.lock(),this.#n}async beginTransaction(e){await e.executeQuery(Or.raw("begin"))}async commitTransaction(e){await e.executeQuery(Or.raw("commit"))}async rollbackTransaction(e){await e.executeQuery(Or.raw("rollback"))}async releaseConnection(){this.#t.unlock()}async destroy(){this.#r?.close()}},u=class{#e;constructor(e){this.#e=e}executeQuery(e){let{sql:s,parameters:i}=e,t=this.#e.prepare(s),n=i;if(t.columnNames.length>0)return Promise.resolve({rows:t.all(...n)});let{changes:o,lastInsertRowid:r}=t.run(...n);return Promise.resolve({rows:[],numAffectedRows:BigInt(o),insertId:typeof r==="bigint"?r:BigInt(r)})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},l=class{#e;#t;async lock(){while(this.#e!==void 0)await this.#e;this.#e=new Promise((e)=>{this.#t=e})}unlock(){let e=this.#t;this.#e=void 0,this.#t=void 0,e?.()}},p=class extends ho{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},y=class{#e;constructor(e){this.#e={...e}}createDriver(){return new c(this.#e)}createQueryCompiler(){return new p}createAdapter(){return new a}createIntrospector(e){return Bu(e)}};export{y as BunSqliteDialect};
2
+ import{Nr}from"./chunk-p35ztj2z.js";import{vo,ed}from"./chunk-2qzmh3ae.js";var a=class{get supportsCreateIfNotExists(){return!0}get supportsTransactionalDdl(){return!1}get supportsReturning(){return!0}async acquireMigrationLock(){}async releaseMigrationLock(){}get supportsOutput(){return!0}},c=class{#e;#t=new l;#r;#n;constructor(e){this.#e={...e}}async init(){if(this.#r=this.#e.database,this.#n=new u(this.#r),this.#e.onCreateConnection)await this.#e.onCreateConnection(this.#n)}async acquireConnection(){return await this.#t.lock(),this.#n}async beginTransaction(e){await e.executeQuery(Nr.raw("begin"))}async commitTransaction(e){await e.executeQuery(Nr.raw("commit"))}async rollbackTransaction(e){await e.executeQuery(Nr.raw("rollback"))}async releaseConnection(){this.#t.unlock()}async destroy(){this.#r?.close()}},u=class{#e;constructor(e){this.#e=e}executeQuery(e){let{sql:s,parameters:i}=e,t=this.#e.prepare(s),n=i;if(t.columnNames.length>0)return Promise.resolve({rows:t.all(...n)});let{changes:o,lastInsertRowid:r}=t.run(...n);return Promise.resolve({rows:[],numAffectedRows:BigInt(o),insertId:typeof r==="bigint"?r:BigInt(r)})}async*streamQuery(){throw Error("Streaming query is not supported by SQLite driver.")}},l=class{#e;#t;async lock(){while(this.#e!==void 0)await this.#e;this.#e=new Promise((e)=>{this.#t=e})}unlock(){let e=this.#t;this.#e=void 0,this.#t=void 0,e?.()}},p=class extends vo{getCurrentParameterPlaceholder(){return"?"}getLeftIdentifierWrapper(){return'"'}getRightIdentifierWrapper(){return'"'}getAutoIncrement(){return"autoincrement"}},y=class{#e;constructor(e){this.#e={...e}}createDriver(){return new c(this.#e)}createQueryCompiler(){return new p}createAdapter(){return new a}createIntrospector(e){return ed(e)}};export{y as BunSqliteDialect};
@@ -0,0 +1,10 @@
1
+ import{Y,G,S,Q,M,w,L,W,a,g,X,R,j,al,Be,dr,xr,Ql,Ue,Ke,N,Fn,Ln,Zn,Bn,$e,He,Qe,Fw,gC,ZC,$h,WT,KR,tM,rM,RP,Ft,Ca,wt,Et,xt,qi,yn,cr,Te}from"./chunk-akafypge.js";import{fs,so,dn,Cl}from"./chunk-d3brvxh7.js";import{Nu}from"./chunk-na5fh7er.js";var Ct=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],hf=j("arrow-left",Ct);var Mt=[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]],Le=j("brush",Mt);var At=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],Se=j("redo",At);var It=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],Pe=j("undo",It);L();var Rt=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#a855f7","#ec4899","#000000","#ffffff"],Qi=Y(({projectId:h,onSendMessage:Fe,replyingTo:c,onCancelReply:ne,placeholder:_e,initialText:H="",value:E,onChangeText:I,disabled:pe=!1,allowMentions:ze,disableMentions:je=!1,allowAttachments:Oe=!0,workspaceAssets:x,onRemoveWorkspaceAsset:fe,allowMarkup:qe,hideAnnotationControl:We=!1,canMarkup:Ve=!0,markupDisabledTooltip:Xe,allowTimestamp:Ge=!0,currentTime:u,frameRate:m,startTimecode:ge,formatTimestamp:v,bottomLeftExtra:Je,isStreaming:oe=!1,onAbort:Ye,onTyping:D},Ze)=>{let[p,T]=w([]),[re,O]=w(null),[f,et]=w(!0),P=ze??!je,tt=qe??!We,F=Ge,{videoTimeDisplayMode:q}=cr(),nt=Q(()=>{if(u===void 0)return"";if(v)return v(u);if(!m)return"";let e=Math.round(u*m);return so(e,m,q,ge)},[u,m,q,ge,v]),{teamId:K,ensureTeamIdForProject:be}=Ft(),{members:he,loading:xe,fetchMembers:ot,fetchProjectMembers:rt}=yn();S(()=>{if(h&&!K)be(h)},[h,K,be]);let{isDrawing:at,setIsDrawing:U,currentTool:V,setTool:J,currentColor:ve,setColor:st,undo:lt,redo:it,history:ct,historyIndex:ye,annotations:ae,reset:we}=dn(),[se,y]=w(!1),[le,dt]=w(""),[_,z]=w(0),[b,Ne]=w({bots:!1,users:!1}),[ie,k]=w(!1),ut=Q(()=>{if(!f||!F||u===void 0||!v&&!m||ie)return"";if(q==="timecode")return"pl-[120px]";return"pl-[85px]"},[f,F,u,m,ie,q,v]),r=M(null),Z=M(null),C=M(null),ke=M(null),A=M(!1),{mutateAsync:Ce}=X({mutationFn:async({projectId:e,data:t})=>{let n=await R.api.projects[":projectId"].attachments.$post({param:{projectId:e},json:t});if(!n.ok)throw Error("Failed to create attachment");return await n.json()}});S(()=>{if(E!==void 0&&r.current){if(A.current){A.current=!1;return}if(r.current.innerText!==E)r.current.innerText=E,k(!!E.trim())}else if(H&&r.current){r.current.innerText=H,k(!!H.trim()),r.current.focus();let e=document.createRange(),t=window.getSelection();e.selectNodeContents(r.current),e.collapse(!1),t?.removeAllRanges(),t?.addRange(e)}},[E,H]);let ce=M(null),Me=G((e)=>{if(!r.current)return;let t=document.createElement("span");t.contentEditable="false",t.dataset.type="mention",t.dataset.id=e.id,t.className="inline-block bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 px-1.5 py-0.5 rounded-md text-sm font-medium align-middle select-none mx-0.5",t.innerText=`@${e.name}`;let n=document.createTextNode(" ");r.current.appendChild(t),r.current.appendChild(n);let s=document.createRange(),l=window.getSelection();s.setStartAfter(n),s.collapse(!0),l?.removeAllRanges(),l?.addRange(s),k(!0);let o=r.current.innerText||"";A.current=!0,I?.(o),D?.(),r.current.focus()},[I,D]);S(()=>{if(c&&r.current){if(c.id!==ce.current){if(ce.current=c.id,P&&c.creator?.id&&c.creator?.name){let n=r.current.querySelectorAll('span[data-type="mention"]');if(!Array.from(n).some((l)=>l.dataset.id===c.creator.id)){Me({id:c.creator.id,name:c.creator.name});return}}}r.current.focus();let e=document.createRange(),t=window.getSelection();e.selectNodeContents(r.current),e.collapse(!1),t?.removeAllRanges(),t?.addRange(e)}else if(!c)ce.current=null},[c,P,Me]),S(()=>()=>{U(!1)},[U]);let B=he.filter((e)=>e.type==="agent"&&e.name?.toLowerCase().startsWith(le.toLowerCase())).map((e)=>({type:"user",data:e})),ee=he.filter((e)=>e.type!=="agent"&&e.name?.toLowerCase().startsWith(le.toLowerCase())).map((e)=>({type:"user",data:e})),te=[...b.bots?[]:B,...b.users?[]:ee];S(()=>{z(0)},[le,se,b]),S(()=>{ke.current?.querySelector(`[data-index="${_}"]`)?.scrollIntoView({block:"nearest"})},[_]);let Ae=(e)=>e.split(" ").map((t)=>t[0]).slice(0,2).join("").toUpperCase(),Ee=()=>{if(!r.current)return;let e=r.current.innerText||"";if(k(!!e.trim()),A.current=!0,I?.(e),D?.(),!P){y(!1),C.current=null;return}let t=window.getSelection();if(!t||t.rangeCount===0)return;let n=t.getRangeAt(0),{startContainer:s,startOffset:l}=n;if(s.nodeType===Node.TEXT_NODE){let i=(s.textContent||"").slice(0,l),d=i.lastIndexOf("@");if(d!==-1){let Nt=d===0,kt=i[d-1];if(Nt||/\s/.test(kt)){let De=i.slice(d+1);if(!/\s/.test(De)){if(dt(De),y(!0),h)rt(h,!0,!0);else if(K)ot(K,!0,!0);let me=document.createRange();me.setStart(s,d),me.setEnd(s,l),C.current=me;return}}}}y(!1),C.current=null},de=(e)=>{if(!C.current||!r.current)return;let t=C.current;t.deleteContents();let n=document.createElement("span");n.contentEditable="false",n.dataset.type="mention",n.dataset.id=e.data.id,n.className="inline-block bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 px-1.5 py-0.5 rounded-md text-sm font-medium align-middle select-none mx-0.5",n.innerText=`@${e.data.name}`,t.insertNode(n);let s=document.createTextNode(" ");n.after(s);let l=document.createRange(),o=window.getSelection();l.setStartAfter(s),l.collapse(!0),o?.removeAllRanges(),o?.addRange(l),y(!1),C.current=null,k(!0);let i=r.current.innerText||"";A.current=!0,I?.(i),D?.(),r.current.focus()},mt=(e)=>{e.preventDefault();let t=e.clipboardData.getData("text/plain");if(!t)return;let n=window.getSelection();if(!n||n.rangeCount===0||!r.current?.contains(n.anchorNode)){if(r.current){r.current.focus();let l=document.createRange();l.selectNodeContents(r.current),l.collapse(!1),n=window.getSelection(),n?.removeAllRanges(),n?.addRange(l)}}if(!(typeof document.execCommand==="function"&&document.queryCommandSupported?.("insertText")&&document.execCommand("insertText",!1,t))){let l=window.getSelection();if(l&&l.rangeCount>0){let o=l.getRangeAt(0);o.deleteContents();let i=document.createTextNode(t);o.insertNode(i),o.setStartAfter(i),o.collapse(!0),l.removeAllRanges(),l.addRange(o)}else if(r.current)r.current.innerText+=t}Ee()},pt=(e)=>{if(e.nativeEvent.isComposing)return;if(se&&P&&te.length>0){if(e.key==="ArrowUp"){e.preventDefault(),z((t)=>t>0?t-1:te.length-1);return}if(e.key==="ArrowDown"){e.preventDefault(),z((t)=>t<te.length-1?t+1:0);return}if(e.key==="Enter"||e.key==="Tab"){e.preventDefault(),de(te[_]);return}if(e.key==="Escape"){e.preventDefault(),y(!1);return}}if(e.key==="Enter"&&!e.shiftKey)e.preventDefault(),Ie()},ft=G(async(e)=>{if(!e.target.files)return;let t=Array.from(e.target.files);for(let n of t){let s=`${Date.now()}-${n.name}`,l={id:s,file:n,progress:0};T((o)=>[...o,l]);try{let o=await Ce({projectId:h,data:{fileName:n.name,contentType:n.type,size:n.size}});if(o.uploadUrl&&o.id)await fetch(o.uploadUrl,{method:"PUT",body:n,headers:{"Content-Type":n.type}}),T((i)=>i.map((d)=>d.id===s?{...d,progress:100,attachmentId:o.id}:d))}catch(o){T((i)=>i.map((d)=>d.id===s?{...d,error:o instanceof Error?o.message:"Upload failed"}:d))}}if(Z.current)Z.current.value=""},[h,Ce]),gt=(e)=>{T((t)=>t.filter((n)=>n.id!==e))},Ie=()=>{if(!r.current)return;if(p.some((o)=>!o.attachmentId&&!o.error))return;let t=p.map((o)=>o.attachmentId).filter((o)=>!!o),n=p.filter((o)=>!o.error&&!!o.attachmentId).map((o)=>({id:o.attachmentId,name:o.file.name,type:o.file.type,url:o.file.type.startsWith("image/")||qi(o.file.name)?URL.createObjectURL(o.file):void 0})),s="";r.current.childNodes.forEach((o)=>{if(o.nodeType===Node.TEXT_NODE)s+=o.textContent;else if(o.nodeType===Node.ELEMENT_NODE){let i=o;if(i.dataset.type==="mention")s+=`<@${i.dataset.id}>`;else if(i.tagName==="BR")s+=`
2
+ `;else if(i.tagName==="DIV"||i.tagName==="P")s+=`
3
+ `+i.innerText;else s+=i.innerText}}),s=s.trim();let l=(x?.length??0)>0;if(!s&&t.length===0&&ae.length===0&&!l)return;if(Fe(s,t,ae,c?.id,F&&f?u:void 0,n),r.current.innerHTML="",k(!1),A.current=!0,I?.(""),T([]),O(null),U(!1),we(),y(!1),ne)ne()},ue=p.some((e)=>!e.attachmentId&&!e.error),bt=p.some((e)=>!!e.attachmentId),ht=(x?.length??0)>0,vt=pe||oe,Re=(ie||bt||ae.length>0||ht)&&!vt,yt=x&&x.length>0||p.length>0||!!c;return g("div",{ref:Ze,className:"relative flex flex-col w-full border border-foreground/35 rounded-3xl shadow-sm transition-all duration-200 bg-background",children:[a("style",{children:`
4
+ [contenteditable]:empty:before {
5
+ content: attr(data-placeholder);
6
+ color: #9ca3af;
7
+ cursor: text;
8
+ }
9
+ `}),se&&P&&(xe||B.length>0||ee.length>0)&&a("div",{onMouseDown:(e)=>e.preventDefault(),className:"absolute bottom-full left-4 mb-2 w-64 rounded-xl shadow-lg border border-border overflow-hidden z-20 bg-popover text-popover-foreground animate-in fade-in slide-in-from-bottom-2 duration-200",children:a("div",{ref:ke,className:"h-64 overflow-y-auto",children:xe?g("div",{className:"p-2 space-y-4 animate-pulse",children:[g("div",{className:"space-y-2",children:[a("div",{className:"px-3 py-1.5 bg-muted/50 border-b border-border",children:a(Te,{className:"h-3 w-16"})}),g("div",{className:"flex items-center gap-2 px-3 py-2",children:[a(Te,{className:"w-6 h-6 rounded-full"}),a(Te,{className:"h-4 w-28"})]}),g("div",{className:"flex items-center gap-2 px-3 py-2",children:[a(Te,{className:"w-6 h-6 rounded-full"}),a(Te,{className:"h-4 w-20"})]})]}),g("div",{className:"space-y-2",children:[a("div",{className:"px-3 py-1.5 bg-muted/50 border-b border-border",children:a(Te,{className:"h-3 w-16"})}),g("div",{className:"flex items-center gap-2 px-3 py-2",children:[a(Te,{className:"w-6 h-6 rounded-full"}),a(Te,{className:"h-4 w-32"})]}),g("div",{className:"flex items-center gap-2 px-3 py-2",children:[a(Te,{className:"w-6 h-6 rounded-full"}),a(Te,{className:"h-4 w-24"})]})]})]}):g(W,{children:[B.length>0&&g(W,{children:[g("button",{type:"button",onMouseDown:(e)=>e.preventDefault(),onClick:(e)=>{e.preventDefault(),e.stopPropagation(),Ne((t)=>({...t,bots:!t.bots})),r.current?.focus()},className:"w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border flex items-center justify-between hover:bg-muted transition-colors cursor-pointer select-none",children:[a("span",{children:"Agents"}),a(Be,{className:`w-3 h-3 transition-transform ${b.bots?"-rotate-90":""}`})]}),!b.bots&&B.map((e,t)=>{let n=t;return g("button",{type:"button","data-index":n,onMouseDown:(s)=>s.preventDefault(),onClick:()=>de(e),onMouseEnter:()=>z(n),className:`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left cursor-pointer ${n===_?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,children:[g($e,{className:"w-6 h-6",children:[e.type==="user"&&e.data.image&&a(He,{src:e.data.image,alt:e.data.name,className:"object-cover"}),a(Qe,{className:"text-[10px] bg-purple-400 text-black font-semibold",children:Ae(e.data.name)})]}),a("span",{className:"text-sm",children:e.data.name})]},e.data.id)})]}),ee.length>0&&g(W,{children:[g("button",{type:"button",onMouseDown:(e)=>e.preventDefault(),onClick:(e)=>{e.preventDefault(),e.stopPropagation(),Ne((t)=>({...t,users:!t.users})),r.current?.focus()},className:"w-full text-xs font-semibold text-muted-foreground px-3 py-2 bg-muted/50 border-b border-border flex items-center justify-between hover:bg-muted transition-colors cursor-pointer select-none",children:[a("span",{children:"Members"}),a(Be,{className:`w-3 h-3 transition-transform ${b.users?"-rotate-90":""}`})]}),!b.users&&ee.map((e,t)=>{let n=b.bots?0:B.length,s=t+n;return g("button",{type:"button","data-index":s,onMouseDown:(l)=>l.preventDefault(),onClick:()=>de(e),onMouseEnter:()=>z(s),className:`w-full flex items-center gap-2 px-3 py-2 transition-colors text-left cursor-pointer ${s===_?"bg-accent text-accent-foreground":"hover:bg-accent/50"}`,children:[g($e,{className:"w-6 h-6",children:[e.type==="user"&&e.data.image&&a(He,{src:e.data.image,alt:e.data.name,className:"object-cover"}),a(Qe,{className:"text-[10px] bg-purple-400 text-black font-semibold",children:Ae(e.data.name)})]}),a("span",{className:"text-sm",children:e.data.name})]},e.data.id)})]})]})})}),yt&&g("div",{className:"flex flex-col gap-2 p-3 pb-0 animate-in fade-in slide-in-from-bottom-2 duration-200",children:[x&&x.length>0&&a("div",{className:"flex flex-col gap-1.5 min-h-0 max-h-[160px] overflow-y-auto border border-border/60 rounded-lg bg-muted/20 p-2.5 divide-y divide-border/50",children:x.map((e)=>g("div",{className:"flex items-center justify-between py-1 text-xs group",children:[g("div",{className:"flex items-baseline gap-1.5 min-w-0 pr-2",children:[a("span",{className:"truncate font-medium text-foreground",children:e.name}),a("span",{className:"text-[9px] text-muted-foreground uppercase flex-shrink-0",children:e.type})]}),fe&&a("button",{onClick:()=>fe(e.id),className:"text-muted-foreground hover:text-destructive transition-colors p-0.5 cursor-pointer",title:KR?.()||"Remove from context",children:a(Ue,{className:"h-3.5 w-3.5"})})]},e.id))}),c&&g("div",{className:"flex items-center justify-between bg-muted p-2 px-3 rounded-lg border border-border",children:[a("div",{className:"text-xs text-muted-foreground truncate mr-2",children:rM({message:c.message||""})}),a("button",{onClick:ne,className:"text-muted-foreground hover:text-foreground p-1 rounded-full hover:bg-muted-foreground/10 shrink-0",children:a(Ke,{className:"w-3.5 h-3.5"})})]}),p.length>0&&a("div",{className:"flex gap-3 overflow-x-auto py-2 px-1 scrollbar-hide",children:p.map((e)=>g("div",{className:"relative group flex-shrink-0",children:[g("div",{className:"w-16 h-16 rounded-lg border border-gray-200 overflow-hidden bg-gray-50 flex items-center justify-center",children:[e.file.type.startsWith("image/")?a("img",{src:URL.createObjectURL(e.file),alt:"preview",onClick:()=>O(e.file),className:`w-full h-full object-cover ${!e.attachmentId?"opacity-50":""}`}):a(xr,{className:"w-8 h-8 text-gray-400"}),ue&&!e.attachmentId&&!e.error&&a("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:a(Cl,{progress:e.progress,className:"w-10 h-10"})})]}),a("button",{onClick:()=>gt(e.id),className:"absolute -top-1.5 -right-1.5 bg-gray-500 text-white rounded-full p-0.5 shadow-md opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500 z-10 cursor-pointer",children:a(Ke,{className:"w-3 h-3"})}),a("span",{className:"text-[10px] text-gray-500 mt-1 block max-w-[4rem] truncate text-center",children:e.file.name})]},e.id))})]}),g("div",{onClick:()=>r.current?.focus(),className:"w-full px-4 pt-1 pb-1 cursor-text flow-root max-h-60 overflow-y-auto",children:[F&&f&&u!==void 0&&(m!==void 0||v!==void 0)&&a("div",{onClick:(e)=>{e.stopPropagation(),r.current?.focus()},className:"float-left select-none bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300 px-2.5 py-0.5 mt-3 mr-2 rounded-sm text-xs font-mono font-bold flex items-center gap-1 cursor-text",children:nt}),a("div",{ref:r,contentEditable:!pe&&!oe,suppressContentEditableWarning:!0,onInput:Ee,onKeyDown:pt,onPaste:mt,"data-placeholder":_e||(c?tM():WT()),className:`bg-transparent border-none focus:ring-0 resize-none min-h-[40px] leading-relaxed py-2 focus:outline-none block whitespace-pre-wrap break-words ${ut}`})]}),g("div",{className:"flex justify-between items-center px-2 pb-2",children:[at?g("div",{className:"flex items-center gap-2 overflow-x-auto scrollbar-hide w-full mr-2",children:[a(N,{onClick:()=>{U(!1),we()},variant:"ghost",size:"icon",className:"p-2 rounded-full cursor-pointer text-gray-500 hover:text-gray-700 hover:bg-gray-100 mr-2",title:"Back",children:a(hf,{className:"w-4 h-4"})}),a("div",{className:"h-4 w-px bg-gray-300 mx-1"}),a("button",{onClick:()=>J("arrow"),className:`p-1.5 rounded hover:bg-gray-100 ${V==="arrow"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Arrow",children:a(al,{size:16,className:"rotate-45"})}),a("button",{onClick:()=>J("line"),className:`p-1.5 rounded hover:bg-gray-100 ${V==="line"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Line",children:a(fs,{size:16,className:"-rotate-45"})}),a("button",{onClick:()=>J("box"),className:`p-1.5 rounded hover:bg-gray-100 ${V==="box"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Box",children:a(Nu,{size:16})}),a("button",{onClick:()=>J("freehand"),className:`p-1.5 rounded hover:bg-gray-100 ${V==="freehand"?"text-blue-500 bg-blue-50":"text-gray-500"}`,title:"Freehand",children:a(Le,{size:16})}),a("div",{className:"h-4 w-px bg-gray-300 mx-1"}),g(wt,{children:[a(Et,{asChild:!0,children:g("button",{className:"flex items-center gap-1 p-1 rounded hover:bg-gray-100",children:[a("div",{className:"w-4 h-4 rounded-full border border-gray-200",style:{backgroundColor:ve}}),a(Be,{size:12,className:"text-gray-500"})]})}),a(xt,{className:"w-auto p-2",align:"center",side:"top",children:a("div",{className:"flex items-center gap-1",children:Rt.map((e)=>a("button",{onClick:()=>st(e),className:`w-6 h-6 rounded-full border border-gray-200 transition-transform hover:scale-110 ${ve===e?"ring-2 ring-blue-500 ring-offset-1":""}`,style:{backgroundColor:e}},e))})})]}),a("div",{className:"h-4 w-px bg-gray-300 mx-1"}),a("button",{onClick:lt,disabled:ye<=0,className:"p-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-500",children:a(Pe,{size:16})}),a("button",{onClick:it,disabled:ye>=ct.length-1,className:"p-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-500",children:a(Se,{size:16})})]}):g("div",{className:"flex items-center gap-1.5 min-w-0 max-w-[80%]",children:[Je,Oe&&g(W,{children:[a("input",{type:"file",ref:Z,className:"hidden",multiple:!0,onChange:ft}),a(N,{onClick:()=>Z.current?.click(),className:"p-2 rounded-full cursor-pointer shrink-0",variant:"ghost",size:"icon",title:Fw(),children:a(Ql,{className:"w-4 h-4"})})]}),F&&u!==void 0&&(m!==void 0||v!==void 0)&&a(N,{onClick:()=>et(!f),variant:f?"secondary":"ghost",size:"icon",className:`p-2 rounded-full cursor-pointer shrink-0 ${f?"text-blue-600 bg-blue-50 dark:bg-blue-900/20":""}`,title:f?gC():ZC(),children:a(dr,{className:"w-4 h-4"})}),tt&&(Ve?a(N,{onClick:()=>{D?.(),U(!0)},variant:"ghost",size:"icon",className:"p-2 rounded-full cursor-pointer shrink-0",title:RP(),children:a(Ca,{className:"w-4 h-4"})}):a(Fn,{children:g(Ln,{children:[a(Zn,{asChild:!0,children:a("span",{className:"inline-block cursor-not-allowed shrink-0",children:a(N,{disabled:!0,variant:"ghost",size:"icon",className:"p-2 rounded-full opacity-40 cursor-not-allowed pointer-events-none",children:a(Ca,{className:"w-4 h-4"})})})}),a(Bn,{side:"top",children:a("p",{className:"text-xs",children:Xe||$h()})})]})}))]}),oe?a("button",{onClick:Ye,className:"p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 shadow-sm bg-destructive text-destructive-foreground hover:bg-destructive/90 transform hover:-translate-y-0.5 cursor-pointer",title:"Stop generation",children:a("div",{className:"h-4 w-4 flex items-center justify-center",children:a("div",{className:"h-3 w-3 rounded-[2px] bg-white"})})}):a("button",{onClick:Ie,disabled:!Re||ue,className:`p-2 rounded-full transition-all duration-200 flex items-center justify-center shrink-0 ${Re&&!ue?"bg-blue-600 text-white shadow-md hover:bg-blue-700 hover:shadow-lg transform hover:-translate-y-0.5 cursor-pointer":"bg-gray-400 cursor-not-allowed opacity-50"}`,children:a(al,{className:"w-4 h-4"})})]}),re&&g("div",{className:"fixed inset-0 z-[100] bg-black/95 flex flex-col items-center justify-center p-4 animate-in fade-in duration-200",onClick:()=>O(null),children:[a("button",{className:"absolute top-4 right-4 text-white/70 hover:text-white hover:bg-white/20 rounded-full p-2 transition-colors z-50",children:a(Ke,{className:"w-8 h-8"})}),a("div",{className:"w-full h-full flex items-center justify-center p-2",children:a("img",{src:URL.createObjectURL(re),alt:"Enlarged view",className:"max-w-full max-h-[85vh] object-contain rounded shadow-2xl cursor-zoom-out",onClick:(e)=>{e.stopPropagation(),O(null)}})}),a("div",{className:"absolute bottom-6 text-white text-sm font-medium bg-black/50 px-4 py-2 rounded-full backdrop-blur-sm",children:re.name})]})]})});Qi.displayName="ChatInput";
10
+ export{hf,Qi};
@@ -1,2 +1,2 @@
1
- import{z}from"./chunk-5ngftxjb.js";var a=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ll=z("save",a);
2
- export{ll};
1
+ import{j}from"./chunk-akafypge.js";var a=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],vl=j("save",a);
2
+ export{vl};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Um}from"./chunk-s6pk2zyg.js";import{Z}from"./chunk-4p31kxjh.js";var El=Z(function(d){var{SignatureV4:l,signatureV4aContainer:o}=Um(),r={CrtSignerV4:null},g="X-Amz-S3session-Token".toLowerCase();class a extends l{async signWithCredentials(e,i,n){let s=c(i);e.headers[g]=i.sessionToken;let t=this;return u(t,s),t.signRequest(e,n??{})}async presignWithCredentials(e,i,n){let s=c(i);return delete e.headers[g],e.headers["X-Amz-S3session-Token"]=i.sessionToken,e.query=e.query??{},e.query["X-Amz-S3session-Token"]=i.sessionToken,u(this,s),this.presign(e,n)}}function c(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function u(e,i){let n=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=n,Promise.resolve(i))}class h{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof r.CrtSignerV4==="function")return"crt";else if(typeof o.SignatureV4a==="function")return"js";return"none"}constructor(e){this.sigv4Signer=new a(e),this.signerOptions=e}async sign(e,i={}){if(i.signingRegion==="*")return this.getSigv4aSigner().sign(e,i);return this.sigv4Signer.sign(e,i)}async signWithCredentials(e,i,n={}){if(n.signingRegion==="*"){let s=this.getSigv4aSigner(),t=r.CrtSignerV4;if(t&&s instanceof t)return s.signWithCredentials(e,i,n);else throw Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.signWithCredentials(e,i,n)}async presign(e,i={}){if(i.signingRegion==="*"){let n=this.getSigv4aSigner(),s=r.CrtSignerV4;if(s&&n instanceof s)return n.presign(e,i);else throw Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.presign(e,i)}async presignWithCredentials(e,i,n={}){if(n.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,i,n)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=r.CrtSignerV4,i=o.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!i)throw Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");if(e&&typeof e==="function")this.sigv4aSigner=new e({...this.signerOptions,signingAlgorithm:1});else if(i&&typeof i==="function")this.sigv4aSigner=new i({...this.signerOptions});else throw Error("Available SigV4a implementation is not a valid constructor. Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a.For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}else{if(!i||typeof i!=="function")throw Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");this.sigv4aSigner=new i({...this.signerOptions})}}return this.sigv4aSigner}}d.SignatureV4MultiRegion=h;d.SignatureV4SignWithCredentials=a;d.signatureV4CrtContainer=r});
3
- export{El};
2
+ import{uh}from"./chunk-v4nqx084.js";import{Z}from"./chunk-65dh7x4c.js";var Fl=Z(function(d){var{SignatureV4:l,signatureV4aContainer:o}=uh(),r={CrtSignerV4:null},g="X-Amz-S3session-Token".toLowerCase();class a extends l{async signWithCredentials(e,i,n){let s=c(i);e.headers[g]=i.sessionToken;let t=this;return u(t,s),t.signRequest(e,n??{})}async presignWithCredentials(e,i,n){let s=c(i);return delete e.headers[g],e.headers["X-Amz-S3session-Token"]=i.sessionToken,e.query=e.query??{},e.query["X-Amz-S3session-Token"]=i.sessionToken,u(this,s),this.presign(e,n)}}function c(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function u(e,i){let n=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=n,Promise.resolve(i))}class h{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof r.CrtSignerV4==="function")return"crt";else if(typeof o.SignatureV4a==="function")return"js";return"none"}constructor(e){this.sigv4Signer=new a(e),this.signerOptions=e}async sign(e,i={}){if(i.signingRegion==="*")return this.getSigv4aSigner().sign(e,i);return this.sigv4Signer.sign(e,i)}async signWithCredentials(e,i,n={}){if(n.signingRegion==="*"){let s=this.getSigv4aSigner(),t=r.CrtSignerV4;if(t&&s instanceof t)return s.signWithCredentials(e,i,n);else throw Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.signWithCredentials(e,i,n)}async presign(e,i={}){if(i.signingRegion==="*"){let n=this.getSigv4aSigner(),s=r.CrtSignerV4;if(s&&n instanceof s)return n.presign(e,i);else throw Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.presign(e,i)}async presignWithCredentials(e,i,n={}){if(n.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,i,n)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=r.CrtSignerV4,i=o.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!i)throw Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");if(e&&typeof e==="function")this.sigv4aSigner=new e({...this.signerOptions,signingAlgorithm:1});else if(i&&typeof i==="function")this.sigv4aSigner=new i({...this.signerOptions});else throw Error("Available SigV4a implementation is not a valid constructor. Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a.For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}else{if(!i||typeof i!=="function")throw Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");this.sigv4aSigner=new i({...this.signerOptions})}}return this.sigv4aSigner}}d.SignatureV4MultiRegion=h;d.SignatureV4SignWithCredentials=a;d.signatureV4CrtContainer=r});
3
+ export{Fl};
@@ -0,0 +1,2 @@
1
+ import{j}from"./chunk-akafypge.js";var o=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],Tu=j("arrow-up-narrow-wide",o);
2
+ export{Tu};