@bkm016/basalt 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +16 -22
  2. package/chunk-06hdzq5n.js +2 -0
  3. package/chunk-09rj27b2.js +2 -0
  4. package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
  5. package/{chunk-vgvq3q12.js → chunk-10xzzn07.js} +2 -2
  6. package/{chunk-6qertm2t.js → chunk-1qpces5a.js} +1 -1
  7. package/{chunk-nt2gntad.js → chunk-1zdwrgd4.js} +1 -1
  8. package/{chunk-sh74qzvt.js → chunk-27gntzs5.js} +4 -4
  9. package/{chunk-1v7st27a.js → chunk-2esbgxps.js} +14 -14
  10. package/{chunk-exnn1867.js → chunk-362g64pd.js} +1 -1
  11. package/{chunk-1aspj1hn.js → chunk-3cjsd292.js} +2 -2
  12. package/chunk-5c9j8qe4.js +478 -0
  13. package/{chunk-8dxzqwq3.js → chunk-5j1krv9v.js} +1 -1
  14. package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
  15. package/{chunk-1b7gbe8g.js → chunk-75m78j7x.js} +2 -2
  16. package/{chunk-kfq8wyd3.js → chunk-8296hw9m.js} +1 -1
  17. package/{chunk-szat3vp4.js → chunk-8d46jtbj.js} +2 -2
  18. package/{chunk-qczbfccb.js → chunk-8tjad3r0.js} +4 -4
  19. package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
  20. package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
  21. package/{chunk-xysny0ve.js → chunk-aefadsy6.js} +2 -2
  22. package/{chunk-jhd54p1b.js → chunk-bannb9xm.js} +1 -1
  23. package/{chunk-a3tqx584.js → chunk-c7x1zq39.js} +1 -1
  24. package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
  25. package/{chunk-x3dnb9sz.js → chunk-d2j735sd.js} +2 -2
  26. package/{chunk-yskm0hsy.js → chunk-d8gtbw9g.js} +1 -1
  27. package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
  28. package/{chunk-h6sw8fbt.js → chunk-fm0k0qtz.js} +1 -1
  29. package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
  30. package/{chunk-45cz26ap.js → chunk-gp7y0fja.js} +13 -13
  31. package/{chunk-2bb01ddq.js → chunk-gzxnene8.js} +1 -1
  32. package/{chunk-a8nyk4k9.js → chunk-hwr56pfj.js} +1 -1
  33. package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
  34. package/{chunk-kf8hq21a.js → chunk-k23t7vhs.js} +5 -5
  35. package/{chunk-bhqyxyap.js → chunk-k506w58v.js} +1 -1
  36. package/{chunk-44ek81ad.js → chunk-k6w6y71k.js} +2 -2
  37. package/chunk-m40gxwq4.js +5 -0
  38. package/chunk-m8vkwdgr.js +5 -0
  39. package/{chunk-f7egr55n.js → chunk-mvfsxdx6.js} +13 -13
  40. package/{chunk-pvncysbb.js → chunk-nbb9trwz.js} +1 -1
  41. package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
  42. package/chunk-pmqtkqsf.js +2 -0
  43. package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
  44. package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
  45. package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
  46. package/{chunk-3m7qwfm3.js → chunk-rtzqqngy.js} +3 -3
  47. package/{chunk-6e49xsf5.js → chunk-shadcb9z.js} +2 -2
  48. package/{chunk-0qqb6v41.js → chunk-shhrr741.js} +120 -120
  49. package/{chunk-cv5wsd9m.js → chunk-t6zs4kw0.js} +2 -2
  50. package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
  51. package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
  52. package/{chunk-s37s3k24.js → chunk-x1xss1d7.js} +2 -2
  53. package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
  54. package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
  55. package/{chunk-0yytz0r1.js → chunk-y0m980k3.js} +5 -5
  56. package/{chunk-dhm42y04.js → chunk-y58ygzn9.js} +3 -3
  57. package/{chunk-2wkaw73s.js → chunk-y648fzx0.js} +5 -5
  58. package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
  59. package/{chunk-pmc3y1z8.js → chunk-ykens1hy.js} +1 -1
  60. package/{chunk-q8zx3kt6.js → chunk-z55bmysw.js} +1 -1
  61. package/{chunk-qx0m82rw.js → chunk-zmsgwr3s.js} +1 -1
  62. package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
  63. package/compiled.js +5 -5
  64. package/package.json +1 -1
  65. package/ui-test-worker.js +63 -63
  66. package/web/chunk-0sewdyz1.js +1 -0
  67. package/web/{chunk-xbty0rv7.js → chunk-1z5p7a1h.js} +1 -1
  68. package/web/chunk-21ke27j6.js +1 -0
  69. package/web/{chunk-2msj52w6.js → chunk-24k0r5aq.js} +1 -1
  70. package/web/{chunk-a5x2zveg.js → chunk-284a17k8.js} +1 -1
  71. package/web/{chunk-ca682sm6.js → chunk-2pjdtesn.js} +14 -14
  72. package/web/{chunk-z7dcbxws.js → chunk-3mvr2gwh.js} +1 -1
  73. package/web/chunk-3t3zwx9j.js +1 -0
  74. package/web/{chunk-e6jxqbv7.js → chunk-3z93efr4.js} +1 -1
  75. package/web/{chunk-05w4fyzc.js → chunk-43jqvsrg.js} +1 -1
  76. package/web/{chunk-jwzd9tzk.js → chunk-4bry4xds.js} +2 -2
  77. package/web/{chunk-4ks96e4r.js → chunk-5e7ygjdn.js} +1 -1
  78. package/web/{chunk-qefasa1j.js → chunk-5jbf7n5q.js} +1 -1
  79. package/web/{chunk-e32y85kx.js → chunk-5rx8rtsa.js} +1 -1
  80. package/web/chunk-5xc9d5ft.js +1 -0
  81. package/web/{chunk-a1z5qx1r.js → chunk-693m9kt7.js} +3 -3
  82. package/web/{chunk-70qwwwak.js → chunk-6qejm5s2.js} +1 -1
  83. package/web/{chunk-kdyjnwdx.js → chunk-8ah6ce1b.js} +2 -2
  84. package/web/{chunk-5vw9rs4r.js → chunk-8e43yaq3.js} +3 -3
  85. package/web/{chunk-qnaqf0cr.js → chunk-8wye0wbb.js} +1 -1
  86. package/web/{chunk-45fzdcgz.js → chunk-986z0p48.js} +5 -5
  87. package/web/{chunk-y0m8hrwz.js → chunk-9dd1c37b.js} +77 -77
  88. package/web/{chunk-9yakxvjb.js → chunk-9re6yttj.js} +2 -2
  89. package/web/{chunk-2scce33n.js → chunk-abbvjt4e.js} +1 -1
  90. package/web/{chunk-b4wbk7vc.js → chunk-agmkx996.js} +3 -3
  91. package/web/{chunk-hev4hq89.js → chunk-anbn2ttv.js} +2 -2
  92. package/web/chunk-aqm3spxt.js +1139 -0
  93. package/web/{chunk-fk0dh93x.js → chunk-avwpjsxw.js} +5 -5
  94. package/web/chunk-b470hvpk.js +1 -0
  95. package/web/{chunk-9dxjafp2.js → chunk-bt1m87ck.js} +2 -2
  96. package/web/chunk-cqp1d4p0.js +1 -0
  97. package/web/{chunk-ss1bcb0n.js → chunk-ctcrk3qn.js} +2 -2
  98. package/web/{chunk-pf2ab8p8.js → chunk-ctd8bfg2.js} +1 -1
  99. package/web/{chunk-q5ke7a33.js → chunk-cwvtraca.js} +1 -1
  100. package/web/{chunk-yd46jhqv.js → chunk-dk90px7g.js} +1 -1
  101. package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
  102. package/web/{chunk-fscafg24.js → chunk-dt8ss97f.js} +5 -5
  103. package/web/{chunk-9p12mgs6.js → chunk-ezkqa7we.js} +1 -1
  104. package/web/{chunk-f26smjjf.js → chunk-f078k1ej.js} +1 -1
  105. package/web/chunk-fekjj24p.css +1 -0
  106. package/web/{chunk-a3verqw9.js → chunk-fqj9kry9.js} +5 -5
  107. package/web/chunk-frjfamx7.js +8 -0
  108. package/web/{chunk-g4azyef7.js → chunk-fy8ey195.js} +1 -1
  109. package/web/{chunk-wptv8atc.js → chunk-g8ee1csm.js} +1 -1
  110. package/web/{chunk-w880psmw.js → chunk-h31p43qa.js} +1 -1
  111. package/web/chunk-h5p5jsrw.js +1 -0
  112. package/web/chunk-h9fmr6ch.js +1 -0
  113. package/web/{chunk-qh7265qw.js → chunk-jf2ehmvp.js} +2 -2
  114. package/web/{chunk-fz06t6km.js → chunk-jmnaq7c1.js} +1 -1
  115. package/web/chunk-jq0pw0k2.js +1 -0
  116. package/web/{chunk-p3b9crsa.js → chunk-jvj66qhs.js} +2 -2
  117. package/web/{chunk-xjxv8dg8.js → chunk-jzmzhj8z.js} +4 -4
  118. package/web/chunk-k4cfnvyq.js +1 -0
  119. package/web/{chunk-dt462hk9.js → chunk-kgerjbn4.js} +1 -1
  120. package/web/{chunk-bc78qf1m.js → chunk-kww4azv5.js} +5 -5
  121. package/web/chunk-m29dhjkh.js +1 -0
  122. package/web/chunk-mj6tee5h.js +1 -0
  123. package/web/{chunk-jrcyc9s9.js → chunk-mjpjkyd1.js} +1 -1
  124. package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
  125. package/web/{chunk-fm2ybfj5.js → chunk-pk3ap3wh.js} +4 -4
  126. package/web/{chunk-bgnnrpna.js → chunk-q1pkntc6.js} +4 -4
  127. package/web/{chunk-taynqrgq.js → chunk-qryrg2pq.js} +2 -2
  128. package/web/{chunk-gqw3f02j.js → chunk-r92sbgwv.js} +5 -5
  129. package/web/{chunk-0vt9fg48.js → chunk-raqqscwa.js} +2 -2
  130. package/web/{chunk-3jhyzmnf.js → chunk-rc2vq9wz.js} +3 -3
  131. package/web/{chunk-2ps6mepk.js → chunk-rkj743fg.js} +3 -3
  132. package/web/{chunk-e53wfgb8.js → chunk-rrws61wf.js} +1 -1
  133. package/web/{chunk-9an7cjd9.js → chunk-s3hwejnr.js} +2 -2
  134. package/web/{chunk-dzwxgqgm.js → chunk-s3rdx28k.js} +2 -2
  135. package/web/{chunk-2m12wyrb.js → chunk-shbw6wg8.js} +1 -1
  136. package/web/chunk-szcy5z56.js +1 -0
  137. package/web/{chunk-tmvakq7n.js → chunk-t1xk6hca.js} +4 -4
  138. package/web/chunk-t2hhdg9r.js +1 -0
  139. package/web/chunk-tj4cmkwe.js +1 -0
  140. package/web/{chunk-bjkc94mv.js → chunk-tn1xzmgx.js} +1 -1
  141. package/web/{chunk-4v8en1yw.js → chunk-tnv7z83q.js} +1 -1
  142. package/web/chunk-v2b5q0n5.js +1 -0
  143. package/web/{chunk-3ee04tmm.js → chunk-vj6kstpp.js} +5 -5
  144. package/web/{chunk-b1pe46zz.js → chunk-vjqmnkh2.js} +1 -1
  145. package/web/{chunk-qd8bxxdj.js → chunk-vkc149rb.js} +1 -1
  146. package/web/{chunk-v28fx2nd.js → chunk-vny496ba.js} +1 -1
  147. package/web/{chunk-rpmpttbk.js → chunk-vz5ck6x9.js} +1 -1
  148. package/web/{chunk-y49fhfda.js → chunk-xa88zgkr.js} +1 -1
  149. package/web/{chunk-q0p5xqe1.js → chunk-xdcs8qz3.js} +4 -4
  150. package/web/chunk-y5x74t89.js +1 -0
  151. package/web/{chunk-xrxne80b.js → chunk-yen2kkn2.js} +1 -1
  152. package/web/{chunk-bj90t5gh.js → chunk-yjv2c45j.js} +4 -4
  153. package/web/chunk-yx3dh5hg.js +1 -0
  154. package/web/chunk-yz4fmtk2.js +1 -0
  155. package/web/{chunk-8p4tc9f4.js → chunk-z24vs8q9.js} +3 -3
  156. package/web/chunk-z5j6x6j8.js +2 -0
  157. package/web/chunk-z5stjrhc.js +1 -0
  158. package/web/{chunk-90kp4pnz.js → chunk-z760wagr.js} +1 -1
  159. package/web/{chunk-tqmwd9qp.js → chunk-znvnb9dh.js} +1 -1
  160. package/web/{chunk-22a4ety5.js → chunk-zrzq29e6.js} +1 -1
  161. package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
  162. package/web/icon.svg +13 -13
  163. package/web/index.html +2 -2
  164. package/web/install.sh +0 -0
  165. package/web/sw.js +9 -0
  166. package/worker.js +1 -1
  167. package/chunk-09vr609h.js +0 -2
  168. package/chunk-58vz2qsq.js +0 -2
  169. package/chunk-c25s4w6a.js +0 -5
  170. package/chunk-t057xfrt.js +0 -5
  171. package/chunk-wjd9fr23.js +0 -2
  172. package/chunk-zef13k3h.js +0 -471
  173. package/web/chunk-2pver6r4.js +0 -1
  174. package/web/chunk-37ajk6zg.js +0 -2
  175. package/web/chunk-4wkm9fda.js +0 -1
  176. package/web/chunk-amzgyy1k.js +0 -1
  177. package/web/chunk-cff5hcm8.js +0 -8
  178. package/web/chunk-esp1mmgr.js +0 -1
  179. package/web/chunk-ew3cgdtd.js +0 -1
  180. package/web/chunk-gjq1pxw3.js +0 -1
  181. package/web/chunk-h5ejbf6e.js +0 -1
  182. package/web/chunk-jjh5jvva.js +0 -1
  183. package/web/chunk-k5btcvbg.js +0 -1
  184. package/web/chunk-kpvgecwy.js +0 -1
  185. package/web/chunk-kq40ss39.js +0 -1
  186. package/web/chunk-q7dsnvpf.js +0 -1
  187. package/web/chunk-rg426vkf.js +0 -1
  188. package/web/chunk-ry9256r7.js +0 -1
  189. package/web/chunk-scpwc9ev.js +0 -1
  190. package/web/chunk-ssy07dd2.js +0 -1
  191. package/web/chunk-tgpbhzn9.js +0 -1
  192. package/web/chunk-vt40e1kp.js +0 -1136
  193. package/web/chunk-w53rba6g.js +0 -1
  194. package/web/chunk-w86n42dy.js +0 -1
  195. package/web/chunk-wtawdeej.css +0 -1
  196. package/web/chunk-zde7mj43.js +0 -1
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{F}from"./chunk-c25s4w6a.js";import{_}from"./chunk-hat3s3pr.js";import{z,he}from"./chunk-dakrpbe6.js";import{M,qt,Te}from"./chunk-6e49xsf5.js";class u 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 k(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new u(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,...s?.error===void 0?{}:{error:s.error},...s?{}:{body: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;Te(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function w(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"pending",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return 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=F(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*b(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{F}from"./chunk-m8vkwdgr.js";import{_}from"./chunk-pxsrqrd0.js";import{z,fe}from"./chunk-x4874m8e.js";import{M,qt,Te}from"./chunk-shadcb9z.js";class u 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 k(r,t,n,e){let s=x(e),a=typeof s?.error?.code==="string"?s.error.code:void 0;return new u(y(n,e,s),a,{version:1,provider:r.provider,model:r.id,url:t.toString(),status:n.status,statusText:n.statusText,...s?.error===void 0?{}:{error:s.error},...s?{}:{body: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;Te(r,{type:"pi_messages_rewrite",timestamp:Date.now(),details:{...t}})}function w(r){let t={role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:h(),stopReason:"pending",timestamp:Date.now()},n=new Map;return(e)=>{switch(e.type){case"done":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return l(t,e.rewrite),{type:"done",reason:e.reason,message:t};case"error":if(Object.assign(t,{stopReason:e.reason,usage:e.usage,errorMessage:e.errorMessage,responseId:e.responseId}),e.providerThinkingLevel!==void 0)t.providerThinkingLevel=e.providerThinkingLevel;return 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=F(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*b(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 I(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 u)Te(s,qt("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return _("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var T=(r,t,n)=>{let e=new M,s=w(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(n?.fetch??globalThis.fetch)(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...he(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:z(i.headers)},r),!i.ok){let d=await i.text();throw k(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of b(i.body)){await n?.onProviderStreamEvent?.(d,r);let g=s(d);if(e.push(g),g.type==="done"||g.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(I(r,a,n?.signal?.aborted??!1))}})(),e},C=(r,t,n)=>{let e=n;return T(r,t,{...n,reasoning:n?.reasoning,toolChoice:n?.toolChoice,debug:e?.debug})};export{u as PiMessagesResponseError,T as stream,C as streamSimple};
8
+ `).find((n)=>n.startsWith("data:"))?.slice(5).trim();return t&&t!=="[DONE]"?JSON.parse(t):void 0}function I(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 u)Te(s,qt("pi_messages_response_failure",t,t.diagnosticDetails));return{type:"error",reason:e,error:s}}function E(r,t){if(r)return r;return _("PI_CACHE_RETENTION",t)==="long"?"long":void 0}var T=(r,t,n)=>{let e=new M,s=w(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(n?.fetch??globalThis.fetch)(o,{method:"POST",headers:{authorization:`Bearer ${a}`,accept:"text/event-stream","content-type":"application/json",...fe(n?.headers)},body:JSON.stringify(c),signal:n?.signal});if(await n?.onResponse?.({status:i.status,headers:z(i.headers)},r),!i.ok){let d=await i.text();throw k(r,o,i,d)}if(!i.body)throw Error(`${r.provider} response has no body`);for await(let d of b(i.body)){await n?.onProviderStreamEvent?.(d,r);let g=s(d);if(e.push(g),g.type==="done"||g.type==="error")return}throw Error(`${r.provider} stream ended without a terminal event`)}catch(a){e.push(I(r,a,n?.signal?.aborted??!1))}})(),e},C=(r,t,n)=>{let e=n;return T(r,t,{...n,reasoning:n?.reasoning,toolChoice:n?.toolChoice,debug:e?.debug})};export{u as PiMessagesResponseError,T as stream,C as streamSimple};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{L}from"./chunk-0hbjv3y6.js";import{b}from"./chunk-k7w7ac9q.js";import{i}from"./chunk-qnr1f5pj.js";var _=i(L()),N=i(b()),Nr="AWS_ACCESS_KEY_ID",Dr="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",Rn=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[Nr],E=process.env[Dr],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{Nr,Dr,Rn};
2
+ import{L}from"./chunk-jwdb0ccj.js";import{b}from"./chunk-981f9dw8.js";import{i}from"./chunk-0y7ne3d0.js";var _=i(L()),N=i(b()),Nr="AWS_ACCESS_KEY_ID",Dr="AWS_SECRET_ACCESS_KEY",S="AWS_SESSION_TOKEN",C="AWS_CREDENTIAL_EXPIRATION",A="AWS_CREDENTIAL_SCOPE",p="AWS_ACCOUNT_ID",Rn=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[Nr],E=process.env[Dr],r=process.env[S],n=process.env[C],s=process.env[A],t=process.env[p];if(o&&E){let c={accessKeyId:o,secretAccessKey:E,...r&&{sessionToken:r},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...t&&{accountId:t}};return _.setCredentialFeature(c,"CREDENTIALS_ENV_VARS","g"),c}throw new N.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{Nr,Dr,Rn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{L}from"./chunk-0hbjv3y6.js";import{b}from"./chunk-k7w7ac9q.js";import{i}from"./chunk-qnr1f5pj.js";var d=i(b());var t=i(b());import{exec as w}from"child_process";import{promisify as P}from"util";var p=i(L()),f=(r,e,o)=>{if(e.Version!==1)throw Error(`Profile ${r} credential_process did not return Version 1.`);if(e.AccessKeyId===void 0||e.SecretAccessKey===void 0)throw Error(`Profile ${r} credential_process returned invalid credentials.`);if(e.Expiration){let l=new Date;if(new Date(e.Expiration)<l)throw Error(`Profile ${r} credential_process returned expired credentials.`)}let s=e.AccountId;if(!s&&o?.[r]?.aws_account_id)s=o[r].aws_account_id;let n={accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,...e.SessionToken&&{sessionToken:e.SessionToken},...e.Expiration&&{expiration:new Date(e.Expiration)},...e.CredentialScope&&{credentialScope:e.CredentialScope},...s&&{accountId:s}};return p.setCredentialFeature(n,"CREDENTIALS_PROCESS","w"),n};var u=async(r,e,o)=>{let s=e[r];if(e[r]){let n=s.credential_process;if(n!==void 0){let l=P(t.externalDataInterceptor?.getTokenRecord?.().exec??w);try{let{stdout:c}=await l(n),a;try{a=JSON.parse(c.trim())}catch{throw Error(`Profile ${r} credential_process returned invalid JSON.`)}return f(r,a,e)}catch(c){throw new t.CredentialsProviderError(c.message,{logger:o})}}else throw new t.CredentialsProviderError(`Profile ${r} did not contain credential_process.`,{logger:o})}else throw new t.CredentialsProviderError(`Profile ${r} could not be found in shared credentials file.`,{logger:o})};var m=(r={})=>async({callerClientConfig:e}={})=>{r.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let o=await d.parseKnownFiles(r);return u(d.getProfileName({profile:r.profile??e?.profile}),o,r.logger)};export{m as fromProcess};
2
+ import{L}from"./chunk-jwdb0ccj.js";import{b}from"./chunk-981f9dw8.js";import{i}from"./chunk-0y7ne3d0.js";var d=i(b());var t=i(b());import{exec as w}from"child_process";import{promisify as P}from"util";var p=i(L()),f=(r,e,o)=>{if(e.Version!==1)throw Error(`Profile ${r} credential_process did not return Version 1.`);if(e.AccessKeyId===void 0||e.SecretAccessKey===void 0)throw Error(`Profile ${r} credential_process returned invalid credentials.`);if(e.Expiration){let l=new Date;if(new Date(e.Expiration)<l)throw Error(`Profile ${r} credential_process returned expired credentials.`)}let s=e.AccountId;if(!s&&o?.[r]?.aws_account_id)s=o[r].aws_account_id;let n={accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,...e.SessionToken&&{sessionToken:e.SessionToken},...e.Expiration&&{expiration:new Date(e.Expiration)},...e.CredentialScope&&{credentialScope:e.CredentialScope},...s&&{accountId:s}};return p.setCredentialFeature(n,"CREDENTIALS_PROCESS","w"),n};var u=async(r,e,o)=>{let s=e[r];if(e[r]){let n=s.credential_process;if(n!==void 0){let l=P(t.externalDataInterceptor?.getTokenRecord?.().exec??w);try{let{stdout:c}=await l(n),a;try{a=JSON.parse(c.trim())}catch{throw Error(`Profile ${r} credential_process returned invalid JSON.`)}return f(r,a,e)}catch(c){throw new t.CredentialsProviderError(c.message,{logger:o})}}else throw new t.CredentialsProviderError(`Profile ${r} did not contain credential_process.`,{logger:o})}else throw new t.CredentialsProviderError(`Profile ${r} could not be found in shared credentials file.`,{logger:o})};var m=(r={})=>async({callerClientConfig:e}={})=>{r.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let o=await d.parseKnownFiles(r);return u(d.getProfileName({profile:r.profile??e?.profile}),o,r.logger)};export{m as fromProcess};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{F}from"./chunk-c25s4w6a.js";import{Ze}from"./chunk-g2t6t8fk.js";import{de,Mr,Lr,ce,Jt,me}from"./chunk-1aspj1hn.js";import{g}from"./chunk-n6e43rvk.js";import{N,Me,re,ye,Q}from"./chunk-qczbfccb.js";function j(a,o){let l={v:1,id:a};if(o)l.phase=o;return JSON.stringify(l)}function E(a){if(!a)return;if(a.startsWith("{"))try{let o=JSON.parse(a);if(o.v===1&&typeof o.id==="string"){if(o.phase==="commentary"||o.phase==="final_answer")return{id:o.id,phase:o.phase};return{id:o.id}}}catch{}return{id:a}}function W(a,o){let l=o.filter((c)=>c.type==="text").map((c)=>c.text).join(`
3
- `),d=o.filter((c)=>c.type==="image"),u=l.length>0;if(d.length===0||!a.input.includes("image"))return g(u?l:d.length>0?"(see attached image)":"(no tool output)");let p=[];if(u)p.push({type:"input_text",text:g(l)});for(let c of d)p.push({type:"input_image",detail:"auto",image_url:`data:${c.mimeType};base64,${c.data}`});return p}function at(a,o,l,d){let u=re(o,d?.supportsMidConvoSystemMessages),p=[],c=(n)=>{let s=n.replace(/[^a-zA-Z0-9_-]/g,"_");return(s.length>64?s.slice(0,64):s).replace(/_+$/,"")},b=(n)=>{let s=`fc_${Ze(n)}`;return s.length>64?s.slice(0,64):s},k=(n,s,i)=>{if(!l.has(a.provider))return c(n);if(!n.includes("|"))return c(n);let[r,_]=n.split("|"),y=c(r),x=i.provider!==a.provider||i.api!==a.api?b(_):c(_);if(!x.startsWith("fc_"))x=c(`fc_${x}`);return`${y}|${x}`},m=me(u.messages,a,k),I=ye(u.messages,(d?.supportsAdditionalTools??!1)||(d?.supportsToolSearch??!1)),v=(n,s)=>{let i=I.anchorsAdditions?n.toolsAdded??[]:[];if(i.length===0)return;if(d?.supportsAdditionalTools){p.push({type:"additional_tools",role:"developer",tools:Je(i,d.toolOptions)});return}if(!d?.supportsToolSearch)return;let r=i.map((y)=>y.name),_=`pi_tool_load_${Ze(`${s}:${r.join(",")}`)}`;p.push({type:"tool_search_call",call_id:_,execution:"client",status:"completed",arguments:{query:r.join(" "),limit:r.length}}),p.push({type:"tool_search_output",call_id:_,execution:"client",status:"completed",tools:Je(i,{...d.toolOptions,toolSearchResult:!0})})},C=d?.includeSystemPrompt??!0,w=a.compat,M=a.reasoning&&w?.supportsDeveloperRole!==!1?"developer":"system",t=0,e=0;for(let n of m){let s=e++===0&&n.role==="system";if(n.role==="system"){if(!s)v(n,`system:${t}`);if(!s||C){let i=s?N(n):Me(n);if(i.length>0)p.push({role:M,content:g(i)})}}else if(n.role==="user")if(typeof n.content==="string")p.push({role:"user",content:[{type:"input_text",text:g(n.content)}]});else{let i=n.content.map((r)=>{if(r.type==="text")return{type:"input_text",text:g(r.text)};return{type:"input_image",detail:"auto",image_url:`data:${r.mimeType};base64,${r.data}`}});if(i.length===0)continue;p.push({role:"user",content:i})}else if(n.role==="assistant"){let i=[],r=n,_=r.provider===a.provider&&r.api===a.api,y=_&&r.model===a.id,P=_&&r.model!==a.id,x=0;for(let S of n.content)if(S.type==="thinking"){if(S.thinkingSignature){let f=JSON.parse(S.thinkingSignature);i.push(f)}}else if(S.type==="text"){let f=S,T=E(f.textSignature),J=x===0?`msg_pi_${t}`:`msg_pi_${t}_${x}`;x++;let h=T?.id;if(!h)h=J;else if(h.length>64)h=`msg_${Ze(h)}`;i.push({type:"message",role:"assistant",content:[{type:"output_text",text:g(f.text),annotations:[]}],status:"completed",id:h,phase:T?.phase})}else if(S.type==="toolCall"){let f=S,[T,J]=f.id.split("|"),h=d?.grammarToolInputProperties?.get(f.name),R=J,A=h===void 0?"fc_":"ctc_";if(P||!R?.startsWith(A))R=void 0;if(h!==void 0)i.push({type:"custom_tool_call",id:R,call_id:T,name:f.name,input:g(Mr(f.name,f.arguments,h)),...y&&f.namespace!==void 0?{namespace:f.namespace}:{}});else i.push({type:"function_call",id:R,call_id:T,name:f.name,arguments:JSON.stringify(f.arguments),...y&&f.namespace!==void 0?{namespace:f.namespace}:{}})}if(i.length===0)continue;p.push(...i)}else if(n.role==="toolResult"){let[i]=n.toolCallId.split("|"),r=W(a,n.content);if(d?.grammarToolInputProperties?.has(n.toolName))p.push({type:"custom_tool_call_output",call_id:i,output:r});else p.push({type:"function_call_output",call_id:i,output:r})}if(!s)t++}return p}function Je(a,o){let l=o?.strict===void 0?!1:o.strict,d=o?.supportsStrictMode??!0,u=o?.supportsOpenAIGrammarTools??!1;return a.map((p)=>{let c=Jt(p,u);if(c)return{type:"custom",name:p.name,description:p.description,format:{type:"grammar",syntax:c.format,definition:c.definition},...o?.toolSearchResult?{defer_loading:!0}:{}};let k=ce(p,d)??l,m={type:"function",name:p.name,description:p.description,parameters:de(p,k===!0),...o?.toolSearchResult?{defer_loading:!0}:{}};if(d)m.strict=k;return m})}function z(a){let o=a.customInput?.property;if(o===void 0)return"";let l=a.arguments[o];return typeof l==="string"?l:""}function O(a,o,l){let d=a.customInput;if(!d)return;let u=Lr(d.jsonBuffer,d.property,o,l);return a.arguments={[d.property]:o},u}async function lt(a,o,l,d,u){let p=!1,c=new Map,b=new Map,k=(t)=>{if(t.type==="message"&&t.phase==="final_answer")o.stopReason="stop"},m=(t,e)=>{let n=c.get(t);return n?.type===e?n:void 0},I=(t,e)=>{if(e===void 0)return;l.push({type:"toolcall_delta",contentIndex:t.contentIndex,delta:e,partial:o})},v=(t,e)=>{if(e.type==="reasoning"){let n={type:"thinking",thinking:""};o.content.push(n);let s={type:"thinking",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"thinking_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="message"){k(e);let n={type:"text",text:""};o.content.push(n);let s={type:"text",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"text_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="function_call"){let n={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{},...e.namespace!==void 0?{namespace:e.namespace}:{},partialJson:e.arguments||""};o.content.push(n);let s={type:"toolCall",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"toolcall_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="custom_tool_call"){let n=u?.grammarToolInputProperties?.get(e.name)??"input",s=e.input||"",i={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{[n]:s},...e.namespace!==void 0?{namespace:e.namespace}:{},customInput:{property:n,jsonBuffer:{input:"",started:!1,closed:!1}}};o.content.push(i);let r={type:"toolCall",block:i,contentIndex:o.content.length-1};return c.set(t,r),l.push({type:"toolcall_start",contentIndex:r.contentIndex,partial:o}),r}return},C=(t,e)=>c.get(t)??v(t,e),w=(t)=>{for(let e of t){if(e.type!=="reasoning"||!e.encrypted_content)continue;let n=b.get(e.id);if(!n?.thinkingSignature)continue;let s=JSON.parse(n.thinkingSignature);if(s.encrypted_content)continue;n.thinkingSignature=JSON.stringify({...s,encrypted_content:e.encrypted_content})}},M=(t)=>{if(p=!0,w(t.output??[]),t?.id)o.responseId=t.id;if(t?.usage){let r=t.usage.input_tokens_details,_=r?.cached_tokens||0,y=r?.cache_write_tokens||0;o.usage={input:Math.max(0,(t.usage.input_tokens||0)-_-y),output:t.usage.output_tokens||0,cacheRead:_,cacheWrite:y,reasoning:t.usage.output_tokens_details?.reasoning_tokens||0,totalTokens:t.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(Q(d,o.usage),u?.applyServiceTierPricing){let r=u.resolveServiceTier?u.resolveServiceTier(t?.service_tier,u.serviceTier):t?.service_tier??u.serviceTier;u.applyServiceTierPricing(o.usage,r)}let e=t?.status,n=t?.incomplete_details,s=typeof n?.reason==="string"?n.reason:void 0;o.rawStopReason=s?`${e}.${s}`:e;let i=B(e,s);if(o.stopReason=i.stopReason,i.errorMessage===void 0)delete o.errorMessage;else o.errorMessage=i.errorMessage;if(o.content.some((r)=>r.type==="toolCall")&&o.stopReason==="stop")o.stopReason="toolUse"};for await(let t of a)if(await u?.onProviderStreamEvent?.(t,d),t.type==="response.created")o.responseId=t.response.id;else if(t.type==="response.output_item.added")v(t.output_index,t.item);else if(t.type==="response.reasoning_summary_text.delta"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=t.delta,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:t.delta,partial:o})}else if(t.type==="response.reasoning_summary_part.done"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=`
2
+ import{F}from"./chunk-m8vkwdgr.js";import{Ze}from"./chunk-g2t6t8fk.js";import{me,Mr,Lr,ce,Jt,he}from"./chunk-3cjsd292.js";import{g}from"./chunk-n6e43rvk.js";import{N,Me,re,ye,Q}from"./chunk-8tjad3r0.js";function j(a,o){let l={v:1,id:a};if(o)l.phase=o;return JSON.stringify(l)}function E(a){if(!a)return;if(a.startsWith("{"))try{let o=JSON.parse(a);if(o.v===1&&typeof o.id==="string"){if(o.phase==="commentary"||o.phase==="final_answer")return{id:o.id,phase:o.phase};return{id:o.id}}}catch{}return{id:a}}function W(a,o){let l=o.filter((c)=>c.type==="text").map((c)=>c.text).join(`
3
+ `),d=o.filter((c)=>c.type==="image"),u=l.length>0;if(d.length===0||!a.input.includes("image"))return g(u?l:d.length>0?"(see attached image)":"(no tool output)");let p=[];if(u)p.push({type:"input_text",text:g(l)});for(let c of d)p.push({type:"input_image",detail:"auto",image_url:`data:${c.mimeType};base64,${c.data}`});return p}function at(a,o,l,d){let u=re(o,d?.supportsMidConvoSystemMessages),p=[],c=(n)=>{let s=n.replace(/[^a-zA-Z0-9_-]/g,"_");return(s.length>64?s.slice(0,64):s).replace(/_+$/,"")},b=(n)=>{let s=`fc_${Ze(n)}`;return s.length>64?s.slice(0,64):s},k=(n,s,i)=>{if(!l.has(a.provider))return c(n);if(!n.includes("|"))return c(n);let[r,_]=n.split("|"),y=c(r),x=i.provider!==a.provider||i.api!==a.api?b(_):c(_);if(!x.startsWith("fc_"))x=c(`fc_${x}`);return`${y}|${x}`},m=he(u.messages,a,k),I=ye(u.messages,(d?.supportsAdditionalTools??!1)||(d?.supportsToolSearch??!1)),v=(n,s)=>{let i=I.anchorsAdditions?n.toolsAdded??[]:[];if(i.length===0)return;if(d?.supportsAdditionalTools){p.push({type:"additional_tools",role:"developer",tools:Je(i,d.toolOptions)});return}if(!d?.supportsToolSearch)return;let r=i.map((y)=>y.name),_=`pi_tool_load_${Ze(`${s}:${r.join(",")}`)}`;p.push({type:"tool_search_call",call_id:_,execution:"client",status:"completed",arguments:{query:r.join(" "),limit:r.length}}),p.push({type:"tool_search_output",call_id:_,execution:"client",status:"completed",tools:Je(i,{...d.toolOptions,toolSearchResult:!0})})},C=d?.includeSystemPrompt??!0,w=a.compat,M=a.reasoning&&w?.supportsDeveloperRole!==!1?"developer":"system",t=0,e=0;for(let n of m){let s=e++===0&&n.role==="system";if(n.role==="system"){if(!s)v(n,`system:${t}`);if(!s||C){let i=s?N(n):Me(n);if(i.length>0)p.push({role:M,content:g(i)})}}else if(n.role==="user")if(typeof n.content==="string")p.push({role:"user",content:[{type:"input_text",text:g(n.content)}]});else{let i=n.content.map((r)=>{if(r.type==="text")return{type:"input_text",text:g(r.text)};return{type:"input_image",detail:"auto",image_url:`data:${r.mimeType};base64,${r.data}`}});if(i.length===0)continue;p.push({role:"user",content:i})}else if(n.role==="assistant"){let i=[],r=n,_=r.provider===a.provider&&r.api===a.api,y=_&&r.model===a.id,P=_&&r.model!==a.id,x=0;for(let S of n.content)if(S.type==="thinking"){if(S.thinkingSignature){let f=JSON.parse(S.thinkingSignature);i.push(f)}}else if(S.type==="text"){let f=S,T=E(f.textSignature),J=x===0?`msg_pi_${t}`:`msg_pi_${t}_${x}`;x++;let h=T?.id;if(!h)h=J;else if(h.length>64)h=`msg_${Ze(h)}`;i.push({type:"message",role:"assistant",content:[{type:"output_text",text:g(f.text),annotations:[]}],status:"completed",id:h,phase:T?.phase})}else if(S.type==="toolCall"){let f=S,[T,J]=f.id.split("|"),h=d?.grammarToolInputProperties?.get(f.name),R=J,A=h===void 0?"fc_":"ctc_";if(P||!R?.startsWith(A))R=void 0;if(h!==void 0)i.push({type:"custom_tool_call",id:R,call_id:T,name:f.name,input:g(Mr(f.name,f.arguments,h)),...y&&f.namespace!==void 0?{namespace:f.namespace}:{}});else i.push({type:"function_call",id:R,call_id:T,name:f.name,arguments:JSON.stringify(f.arguments),...y&&f.namespace!==void 0?{namespace:f.namespace}:{}})}if(i.length===0)continue;p.push(...i)}else if(n.role==="toolResult"){let[i]=n.toolCallId.split("|"),r=W(a,n.content);if(d?.grammarToolInputProperties?.has(n.toolName))p.push({type:"custom_tool_call_output",call_id:i,output:r});else p.push({type:"function_call_output",call_id:i,output:r})}if(!s)t++}return p}function Je(a,o){let l=o?.strict===void 0?!1:o.strict,d=o?.supportsStrictMode??!0,u=o?.supportsOpenAIGrammarTools??!1;return a.map((p)=>{let c=Jt(p,u);if(c)return{type:"custom",name:p.name,description:p.description,format:{type:"grammar",syntax:c.format,definition:c.definition},...o?.toolSearchResult?{defer_loading:!0}:{}};let k=ce(p,d)??l,m={type:"function",name:p.name,description:p.description,parameters:me(p,k===!0),...o?.toolSearchResult?{defer_loading:!0}:{}};if(d)m.strict=k;return m})}function z(a){let o=a.customInput?.property;if(o===void 0)return"";let l=a.arguments[o];return typeof l==="string"?l:""}function O(a,o,l){let d=a.customInput;if(!d)return;let u=Lr(d.jsonBuffer,d.property,o,l);return a.arguments={[d.property]:o},u}async function lt(a,o,l,d,u){let p=!1,c=new Map,b=new Map,k=(t)=>{if(t.type==="message"&&t.phase==="final_answer")o.stopReason="stop"},m=(t,e)=>{let n=c.get(t);return n?.type===e?n:void 0},I=(t,e)=>{if(e===void 0)return;l.push({type:"toolcall_delta",contentIndex:t.contentIndex,delta:e,partial:o})},v=(t,e)=>{if(e.type==="reasoning"){let n={type:"thinking",thinking:""};o.content.push(n);let s={type:"thinking",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"thinking_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="message"){k(e);let n={type:"text",text:""};o.content.push(n);let s={type:"text",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"text_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="function_call"){let n={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{},...e.namespace!==void 0?{namespace:e.namespace}:{},partialJson:e.arguments||""};o.content.push(n);let s={type:"toolCall",block:n,contentIndex:o.content.length-1};return c.set(t,s),l.push({type:"toolcall_start",contentIndex:s.contentIndex,partial:o}),s}if(e.type==="custom_tool_call"){let n=u?.grammarToolInputProperties?.get(e.name)??"input",s=e.input||"",i={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{[n]:s},...e.namespace!==void 0?{namespace:e.namespace}:{},customInput:{property:n,jsonBuffer:{input:"",started:!1,closed:!1}}};o.content.push(i);let r={type:"toolCall",block:i,contentIndex:o.content.length-1};return c.set(t,r),l.push({type:"toolcall_start",contentIndex:r.contentIndex,partial:o}),r}return},C=(t,e)=>c.get(t)??v(t,e),w=(t)=>{for(let e of t){if(e.type!=="reasoning"||!e.encrypted_content)continue;let n=b.get(e.id);if(!n?.thinkingSignature)continue;let s=JSON.parse(n.thinkingSignature);if(s.encrypted_content)continue;n.thinkingSignature=JSON.stringify({...s,encrypted_content:e.encrypted_content})}},M=(t)=>{if(p=!0,w(t.output??[]),t?.id)o.responseId=t.id;if(t?.usage){let r=t.usage.input_tokens_details,_=r?.cached_tokens||0,y=r?.cache_write_tokens||0;o.usage={input:Math.max(0,(t.usage.input_tokens||0)-_-y),output:t.usage.output_tokens||0,cacheRead:_,cacheWrite:y,reasoning:t.usage.output_tokens_details?.reasoning_tokens||0,totalTokens:t.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if(Q(d,o.usage),u?.applyServiceTierPricing){let r=u.resolveServiceTier?u.resolveServiceTier(t?.service_tier,u.serviceTier):t?.service_tier??u.serviceTier;u.applyServiceTierPricing(o.usage,r)}let e=t?.status,n=t?.incomplete_details,s=typeof n?.reason==="string"?n.reason:void 0;o.rawStopReason=s?`${e}.${s}`:e;let i=B(e,s);if(o.stopReason=i.stopReason,i.errorMessage===void 0)delete o.errorMessage;else o.errorMessage=i.errorMessage;if(o.content.some((r)=>r.type==="toolCall")&&o.stopReason==="stop")o.stopReason="toolUse"};for await(let t of a)if(await u?.onProviderStreamEvent?.(t,d),t.type==="response.created")o.responseId=t.response.id;else if(t.type==="response.output_item.added")v(t.output_index,t.item);else if(t.type==="response.reasoning_summary_text.delta"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=t.delta,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:t.delta,partial:o})}else if(t.type==="response.reasoning_summary_part.done"){let e=m(t.output_index,"thinking");if(!e)continue;e.block.thinking+=`
4
4
 
5
5
  `,l.push({type:"thinking_delta",contentIndex:e.contentIndex,delta:`
6
6
 
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function z(r){let e={};for(let[n,o]of r.entries())e[n]=o;return e}function he(...r){let e=new Map;for(let n of r)for(let[o,t]of Object.entries(n??{})){let s=o.toLowerCase();if(e.delete(s),t!==null)e.set(s,[o,t])}return e.size>0?Object.fromEntries(e.values()):void 0}
3
- export{z,he};
2
+ function z(r){let e={};for(let[n,o]of r.entries())e[n]=o;return e}function fe(...r){let e=new Map;for(let n of r)for(let[o,t]of Object.entries(n??{})){let s=o.toLowerCase();if(e.delete(s),t!==null)e.set(s,[o,t])}return e.size>0?Object.fromEntries(e.values()):void 0}
3
+ export{z,fe};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{zo,Ue,ot}from"./chunk-rm3kcxq9.js";import{Fe}from"./chunk-t057xfrt.js";import{qe,ve,L}from"./chunk-0hbjv3y6.js";import{be,Y,b,Se,X,Qe,B}from"./chunk-k7w7ac9q.js";import{t}from"./chunk-qnr1f5pj.js";var fe=t(function(Dt){var{SignatureV4:kt,signatureV4aContainer:de}=zo(),O={CrtSignerV4:null},ge="X-Amz-S3session-Token".toLowerCase();class Z extends kt{async signWithCredentials(e,s,n){let r=pe(s);e.headers[ge]=s.sessionToken;let o=this;return he(o,r),o.signRequest(e,n??{})}async presignWithCredentials(e,s,n){let r=pe(s);return delete e.headers[ge],e.headers["X-Amz-S3session-Token"]=s.sessionToken,e.query=e.query??{},e.query["X-Amz-S3session-Token"]=s.sessionToken,he(this,r),this.presign(e,n)}}function pe(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function he(e,s){let n=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=n,Promise.resolve(s))}class me{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof O.CrtSignerV4==="function")return"crt";else if(typeof de.SignatureV4a==="function")return"js";return"none"}constructor(e){this.sigv4Signer=new Z(e),this.signerOptions=e}async sign(e,s={}){if(s.signingRegion==="*")return this.getSigv4aSigner().sign(e,s);return this.sigv4Signer.sign(e,s)}async signWithCredentials(e,s,n={}){if(n.signingRegion==="*"){let r=this.getSigv4aSigner(),o=O.CrtSignerV4;if(o&&r instanceof o)return r.signWithCredentials(e,s,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,s,n)}async presign(e,s={}){if(s.signingRegion==="*"){let n=this.getSigv4aSigner(),r=O.CrtSignerV4;if(r&&n instanceof r)return n.presign(e,s);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,s)}async presignWithCredentials(e,s,n={}){if(n.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,s,n)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=O.CrtSignerV4,s=de.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!s)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(s&&typeof s==="function")this.sigv4aSigner=new s({...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(!s||typeof s!=="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 s({...this.signerOptions})}}return this.sigv4aSigner}}Dt.SignatureV4MultiRegion=me;Dt.SignatureV4SignWithCredentials=Z;Dt.signatureV4CrtContainer=O});var{awsEndpointFunctions:Nt,emitWarningIfUnsupportedVersion:Wt,createDefaultUserAgentProvider:Ht,NODE_APP_ID_CONFIG_OPTIONS:Ut,getAwsRegionExtensionConfiguration:qt,resolveAwsRegionExtensionConfiguration:Ft,resolveUserAgentConfig:Vt,resolveHostHeaderConfig:Lt,getUserAgentPlugin:Kt,getHostHeaderPlugin:Mt,getLoggerPlugin:jt,getRecursionDetectionPlugin:zt,setCredentialFeature:se,stsRegionDefaultResolver:Gt}=L(),{NoAuthSigner:_e,getHttpAuthSchemeEndpointRuleSetPlugin:Yt,DefaultIdentityProviderConfig:Qt,getHttpSigningPlugin:Bt}=ve(),{normalizeProvider:xe,getSmithyContext:Te,ServiceException:Jt,NoOpLogger:Xt,emitWarningIfUnsupportedVersion:Zt,loadConfigsForDefaultMode:es,getDefaultExtensionConfiguration:ts,resolveDefaultRuntimeConfig:ss,Client:ke,makeBuilder:ns,createAggregatedClient:os}=Y(),{Command:rs}=Y();var io=rs,ao=ke;var{resolveDefaultsModeConfig:is,loadConfig:y,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:as,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:cs,NODE_REGION_CONFIG_OPTIONS:us,NODE_REGION_CONFIG_FILE_OPTIONS:ls,resolveRegionConfig:ds}=b(),{BinaryDecisionDiagram:gs,EndpointCache:ps,decideEndpoint:hs,customEndpointFunctions:ms,resolveParams:Ss,resolveEndpointConfig:vs,getEndpointPlugin:fs}=Se(),{parseUrl:Ps,getHttpHandlerExtensionConfiguration:ys,resolveHttpHandlerRuntimeConfig:Es,getContentLengthPlugin:As}=B(),{DEFAULT_RETRY_MODE:Is,NODE_RETRY_MODE_CONFIG_OPTIONS:ws,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:Rs,resolveRetryConfig:Cs,getRetryPlugin:_s}=qe(),{TypeRegistry:De,getSchemaSerdePlugin:xs}=be(),{resolveAwsSdkSigV4Config:Ts,resolveAwsSdkSigV4AConfig:ks,AwsSdkSigV4Signer:Oe,AwsSdkSigV4ASigner:$e,NODE_SIGV4A_CONFIG_OPTIONS:Ds,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:bs}=Ue(),{SignatureV4MultiRegion:Ne}=fe(),{toUtf8:Os,fromUtf8:$s,toBase64:Ns,fromBase64:Ws,calculateBodyLength:Hs}=X(),{streamCollector:Us,NodeHttpHandler:qs}=Fe(),{AwsQueryProtocol:Fs}=ot(),{Sha256:Vs}=Qe(),D="ref",I=-1,N=!0,Pe="isSet",We="PartitionResult",W="booleanEquals",l="stringEquals",ee="getAttr",ye="us-east-1",Ee="sigv4",Ae="sts",Ie="https://sts.{Region}.{PartitionResult#dnsSuffix}",we={[D]:"Endpoint"},d={[D]:"Region"},te={[D]:We},k={},Re=[d],Ce={conditions:[[Pe,[we]],[Pe,Re],["aws.partition",Re,We],[W,[{[D]:"UseFIPS"},N]],[W,[{[D]:"UseDualStack"},N]],[l,[d,"aws-global"]],[W,[{[D]:"UseGlobalEndpoint"},N]],[l,[d,"eu-central-1"]],[W,[{fn:ee,argv:[te,"supportsDualStack"]},N]],[W,[{fn:ee,argv:[te,"supportsFIPS"]},N]],[l,[d,"ap-south-1"]],[l,[d,"eu-north-1"]],[l,[d,"eu-west-1"]],[l,[d,"eu-west-2"]],[l,[d,"eu-west-3"]],[l,[d,"sa-east-1"]],[l,[d,ye]],[l,[d,"us-east-2"]],[l,[d,"us-west-2"]],[l,[d,"us-west-1"]],[l,[d,"ca-central-1"]],[l,[d,"ap-southeast-1"]],[l,[d,"ap-northeast-1"]],[l,[d,"ap-southeast-2"]],[l,[{fn:ee,argv:[te,"name"]},"aws-us-gov"]]],results:[[I],["https://sts.amazonaws.com",{authSchemes:[{name:Ee,signingName:Ae,signingRegion:ye}]}],[Ie,{authSchemes:[{name:Ee,signingName:Ae,signingRegion:"{Region}"}]}],[I,"Invalid Configuration: FIPS and custom endpoint are not supported"],[I,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[we,k],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",k],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",k],[I,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"DualStack is enabled but this partition does not support DualStack"],[Ie,k],[I,"Invalid Configuration: Missing Region"]]},Ls=2,i=1e8,Ks=new Int32Array([-1,1,-1,0,30,3,1,4,i+14,2,5,i+14,3,25,6,4,24,7,5,i+1,8,6,9,i+13,7,i+1,10,10,i+1,11,11,i+1,12,12,i+1,13,13,i+1,14,14,i+1,15,15,i+1,16,16,i+1,17,17,i+1,18,18,i+1,19,19,i+1,20,20,i+1,21,21,i+1,22,22,i+1,23,23,i+1,i+2,8,i+11,i+12,4,28,26,9,27,i+10,24,i+8,i+9,8,29,i+7,9,i+6,i+7,3,i+3,31,4,i+4,i+5]),Ms=gs.from(Ks,Ls,Ce.conditions,Ce.results),js=new ps({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),He=(e,s={})=>js.get(e,()=>hs(Ms,{endpointParams:e,logger:s.logger}));ms.aws=Nt;var zs=(e)=>async(s,n,r)=>{if(!r)throw Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let o=await e(s,n,r),u=Te(n)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!u)throw Error(`getEndpointParameterInstructions() is not defined on '${n.commandName}'`);let a=await Ss(r,{getEndpointParameterInstructions:u},s);return Object.assign(o,a)},Gs=async(e,s,n)=>({operation:Te(s).operation,region:await xe(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),Ys=zs(Gs);function Ve(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(s,n)=>({signingProperties:{config:s,context:n}})}}function ne(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(s,n)=>({signingProperties:{config:s,context:n}})}}function Le(e){return{schemeId:"smithy.api#noAuth"}}var Qs=(e,s,n)=>(o)=>{let a=e(o).properties?.authSchemes;if(!a)return s(o);let g=[];for(let S of a){let{name:p,properties:v={},...A}=S,f=p.toLowerCase();if(p!==f)console.warn(`HttpAuthScheme has been normalized with lowercasing: '${p}' to '${f}'`);let m;if(f==="sigv4a"){m="aws.auth#sigv4a";let Q=a.find((J)=>{let le=J.name.toLowerCase();return le!=="sigv4a"&&le.startsWith("sigv4")});if(Ne.sigv4aDependency()==="none"&&Q)continue}else if(f.startsWith("sigv4"))m="aws.auth#sigv4";else throw Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${f}'`);let T=n[m];if(!T)throw Error(`Could not find HttpAuthOption create function for '${m}'`);let P=T(o);P.schemeId=m,P.signingProperties={...P.signingProperties||{},...A,...v},g.push(P)}return g},Bs=(e)=>{let s=[];switch(e.operation){case"AssumeRoleWithWebIdentity":{s.push(Le()),s.push(ne(e));break}default:s.push(Ve(e)),s.push(ne(e))}return s},Js=Qs(He,Bs,{"aws.auth#sigv4":Ve,"aws.auth#sigv4a":ne,"smithy.api#noAuth":Le}),Xs=(e)=>{let s=Ts(e),n=ks(s);return Object.assign(n,{authSchemePreference:xe(e.authSchemePreference??[])})},Zs=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,defaultSigningName:"sts"}),en={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},tn="3.997.47",sn={version:tn};class h extends Jt{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sts#STSServiceException";constructor(e){super(e);Object.setPrototypeOf(this,h.prototype)}}class U extends h{static shapeId="com.amazonaws.sts#ExpiredTokenException";name="ExpiredTokenException";$fault="client";constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,U.prototype)}}class q extends h{static shapeId="com.amazonaws.sts#MalformedPolicyDocumentException";name="MalformedPolicyDocumentException";$fault="client";constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e});Object.setPrototypeOf(this,q.prototype)}}class F extends h{static shapeId="com.amazonaws.sts#PackedPolicyTooLargeException";name="PackedPolicyTooLargeException";$fault="client";constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e});Object.setPrototypeOf(this,F.prototype)}}class V extends h{static shapeId="com.amazonaws.sts#RegionDisabledException";name="RegionDisabledException";$fault="client";constructor(e){super({name:"RegionDisabledException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype)}}class K extends h{static shapeId="com.amazonaws.sts#IDPRejectedClaimException";name="IDPRejectedClaimException";$fault="client";constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype)}}class M extends h{static shapeId="com.amazonaws.sts#InvalidIdentityTokenException";name="InvalidIdentityTokenException";$fault="client";constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e});Object.setPrototypeOf(this,M.prototype)}}class j extends h{static shapeId="com.amazonaws.sts#IDPCommunicationErrorException";name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e});Object.setPrototypeOf(this,j.prototype)}}var nn="Arn",on="AccessKeyId",rn="AssumeRole",an="AssumedRoleId",cn="AssumeRoleRequest",un="AssumeRoleResponse",oe="AssumedRoleUser",ln="AssumeRoleWithWebIdentity",dn="AssumeRoleWithWebIdentityRequest",gn="AssumeRoleWithWebIdentityResponse",pn="Audience",re="Credentials",hn="ContextAssertion",Ke="DurationSeconds",mn="Expiration",Sn="ExternalId",vn="ExpiredTokenException",fn="IDPCommunicationErrorException",Pn="IDPRejectedClaimException",yn="InvalidIdentityTokenException",En="Key",An="MalformedPolicyDocumentException",Me="MinimumSessionTokenSize",je="Policy",ze="PolicyArns",In="ProviderArn",wn="ProvidedContexts",Rn="ProvidedContextsListType",Cn="ProvidedContext",_n="PolicyDescriptorType",xn="ProviderId",Ge="PackedPolicySize",Tn="PackedPolicyTooLargeException",kn="Provider",Ye="RoleArn",Dn="RegionDisabledException",Be="RoleSessionName",bn="SecretAccessKey",On="SubjectFromWebIdentityToken",ie="SourceIdentity",$n="SerialNumber",Nn="SessionToken",Je="SessionTokenSize",Xe="SessionTokenUtilization",Wn="Tags",Hn="TokenCode",Un="TransitiveTagKeys",qn="Tag",Fn="Value",Vn="WebIdentityToken",Ln="arn",Kn="accessKeySecretType",w="awsQueryError",R="client",Mn="clientTokenType",C="error",_="httpError",x="message",jn="policyDescriptorListType",Ze="smithy.ts.sdk.synthetic.com.amazonaws.sts",zn="tagListType",c="com.amazonaws.sts",et=new De(Ze),tt=[-3,Ze,"STSServiceException",0,[],[]];et.registerError(tt,h);var E=new De(c),st=[-3,c,vn,{[w]:["ExpiredTokenException",400],[C]:R,[_]:400},[x],[0]];E.registerError(st,U);var nt=[-3,c,fn,{[w]:["IDPCommunicationError",400],[C]:R,[_]:400},[x],[0]];E.registerError(nt,j);var rt=[-3,c,Pn,{[w]:["IDPRejectedClaim",403],[C]:R,[_]:403},[x],[0]];E.registerError(rt,K);var it=[-3,c,yn,{[w]:["InvalidIdentityToken",400],[C]:R,[_]:400},[x],[0]];E.registerError(it,M);var at=[-3,c,An,{[w]:["MalformedPolicyDocument",400],[C]:R,[_]:400},[x],[0]];E.registerError(at,q);var ct=[-3,c,Tn,{[w]:["PackedPolicyTooLarge",400],[C]:R,[_]:400},[x],[0]];E.registerError(ct,F);var ut=[-3,c,Dn,{[w]:["RegionDisabledException",403],[C]:R,[_]:403},[x],[0]];E.registerError(ut,V);var lt=[et,E],Gn=[0,c,Kn,8,0],Yn=[0,c,Mn,8,0],ae=[3,c,oe,0,[an,nn],[0,0],2],dt=[3,c,cn,0,[Ye,Be,ze,je,Ke,Wn,Un,Sn,$n,Hn,ie,wn,Me],[0,0,()=>ft,0,1,()=>Bn,64,0,0,0,0,()=>Qn,1],2],gt=[3,c,un,0,[re,oe,Ge,ie,Xe,Je],[[()=>ce,0],()=>ae,1,0,1,1]],pt=[3,c,dn,0,[Ye,Be,Vn,xn,ze,je,Ke,Me],[0,0,[()=>Yn,0],0,()=>ft,0,1,1],3],ht=[3,c,gn,0,[re,On,oe,Ge,kn,pn,ie,Xe,Je],[[()=>ce,0],0,()=>ae,1,0,0,0,1,1]],ce=[3,c,re,0,[on,bn,Nn,mn],[0,[()=>Gn,0],0,4],4],mt=[3,c,_n,0,[Ln],[0]],St=[3,c,Cn,0,[In,hn],[0,0]],vt=[3,c,qn,0,[En,Fn],[0,0],2],ft=[1,c,jn,0,()=>mt],Qn=[1,c,Rn,0,()=>St],Bn=[1,c,zn,0,()=>vt],Pt=[9,c,rn,0,()=>dt,()=>gt],yt=[9,c,ln,0,()=>pt,()=>ht],Jn=(e)=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??Ws,base64Encoder:e?.base64Encoder??Ns,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??He,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Js,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(s)=>s.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],logger:e?.logger??new Xt,protocol:e?.protocol??Fs,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:lt,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:e?.serviceId??"STS",sha256:e?.sha256??Vs,signerConstructor:e?.signerConstructor??Ne,urlParser:e?.urlParser??Ps,utf8Decoder:e?.utf8Decoder??$s,utf8Encoder:e?.utf8Encoder??Os}),Xn=(e)=>{Zt(process.version);let s=is(e),n=()=>s().then(es),r=Jn(e);Wt(process.version);let o={profile:e?.profile,logger:r.logger};return{...r,...e,runtime:"node",defaultsMode:s,authSchemePreference:e?.authSchemePreference??y(bs,o),bodyLengthChecker:e?.bodyLengthChecker??Hs,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ht({serviceId:r.serviceId,clientVersion:sn.version}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4")||(async(a)=>await e.credentialDefaultProvider(a?.__config||{})()),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(u)=>u.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],maxAttempts:e?.maxAttempts??y(Rs,e),region:e?.region??y(us,{...ls,...o}),requestHandler:qs.create(e?.requestHandler??n),retryMode:e?.retryMode??y({...ws,default:async()=>(await n()).retryMode||Is},e),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??y(Ds,o),streamCollector:e?.streamCollector??Us,useDualstackEndpoint:e?.useDualstackEndpoint??y(cs,o),useFipsEndpoint:e?.useFipsEndpoint??y(as,o),userAgentAppId:e?.userAgentAppId??y(Ut,o)}},Zn=(e)=>{let{httpAuthSchemes:s,httpAuthSchemeProvider:n,credentials:r}=e;return{setHttpAuthScheme(o){let u=s.findIndex((a)=>a.schemeId===o.schemeId);if(u===-1)s.push(o);else s.splice(u,1,o)},httpAuthSchemes(){return s},setHttpAuthSchemeProvider(o){n=o},httpAuthSchemeProvider(){return n},setCredentials(o){r=o},credentials(){return r}}},eo=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),to=(e,s)=>{let n=Object.assign(qt(e),ts(e),ys(e),Zn(e));return s.forEach((r)=>r.configure(n)),Object.assign(e,Ft(n),ss(n),Es(n),eo(n))};class H extends ke{config;constructor(...[e]){let s=Xn(e||{});super(s);this.initConfig=s;let n=Zs(s),r=Vt(n),o=Cs(r),u=ds(o),a=Lt(u),g=vs(a),S=Xs(g),p=to(S,e?.extensions||[]);this.config=p,this.middlewareStack.use(xs(this.config)),this.middlewareStack.use(Kt(this.config)),this.middlewareStack.use(_s(this.config)),this.middlewareStack.use(As(this.config)),this.middlewareStack.use(Mt(this.config)),this.middlewareStack.use(jt(this.config)),this.middlewareStack.use(zt(this.config)),this.middlewareStack.use(Yt(this.config,{httpAuthSchemeParametersProvider:Ys,identityProviderConfigProvider:async(v)=>new Qt({"aws.auth#sigv4":v.credentials,"aws.auth#sigv4a":v.credentials})})),this.middlewareStack.use(Bt(this.config))}destroy(){super.destroy()}}var Et=ns(en,"AWSSecurityTokenServiceV20110615","STSClient",fs),At={},It=(e,s,n,r)=>[];class z extends Et(At,It,"AssumeRole",Pt){}class G extends Et(At,It,"AssumeRoleWithWebIdentity",yt){}var so={AssumeRoleCommand:z,AssumeRoleWithWebIdentityCommand:G};class ue extends H{}os(so,ue);var wt=(e)=>{if(typeof e?.Arn==="string"){let s=e.Arn.split(":");if(s.length>4&&s[4]!=="")return s[4]}return},Rt=async(e,s,n,r={})=>{let o=typeof e==="function"?await e():e,u=typeof s==="function"?await s():s,a="",g=o??u??(a=await Gt(r)());return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${o} (credential provider clientConfig)`,`${u} (contextual client)`,`${a} (STS default: AWS_REGION, profile region, or us-east-1)`),g},no=(e,s)=>{let n,r;return async(o,u)=>{if(r=o,!n){let{logger:v=e?.parentClientConfig?.logger,profile:A=e?.parentClientConfig?.profile,region:f,requestHandler:m=e?.parentClientConfig?.requestHandler,credentialProviderLogger:T,userAgentAppId:P=e?.parentClientConfig?.userAgentAppId}=e,Q=await Rt(f,e?.parentClientConfig?.region,T,{logger:v,profile:A}),J=!Ct(m);n=new s({...e,userAgentAppId:P,profile:A,credentialDefaultProvider:()=>async()=>r,region:Q,requestHandler:J?m:void 0,logger:v})}let{Credentials:a,AssumedRoleUser:g}=await n.send(new z(u));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw Error(`Invalid response from STS.assumeRole call with role ${u.RoleArn}`);let S=wt(g),p={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...S&&{accountId:S}};return se(p,"CREDENTIALS_STS_ASSUME_ROLE","i"),p}},oo=(e,s)=>{let n;return async(r)=>{if(!n){let{logger:S=e?.parentClientConfig?.logger,profile:p=e?.parentClientConfig?.profile,region:v,requestHandler:A=e?.parentClientConfig?.requestHandler,credentialProviderLogger:f,userAgentAppId:m=e?.parentClientConfig?.userAgentAppId}=e,T=await Rt(v,e?.parentClientConfig?.region,f,{logger:S,profile:p}),P=!Ct(A);n=new s({...e,userAgentAppId:m,profile:p,region:T,requestHandler:P?A:void 0,logger:S})}let{Credentials:o,AssumedRoleUser:u}=await n.send(new G(r));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${r.RoleArn}`);let a=wt(u),g={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}};if(a)se(g,"RESOLVED_ACCOUNT_ID","T");return se(g,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),g}},Ct=(e)=>e?.metadata?.handlerProtocol==="h2",_t=(e,s)=>{if(!s)return e;else return class extends e{constructor(r){super(r);for(let o of s)this.middlewareStack.use(o)}}},xt=(e={},s)=>no(e,_t(H,s)),Tt=(e={},s)=>oo(e,_t(H,s)),ro=(e)=>(s)=>e({roleAssumer:xt(s),roleAssumerWithWebIdentity:Tt(s),...s});var co=Pt,uo=z,lo=dt,go=gt,po=yt,ho=G,mo=pt,So=ht,vo=ae,fo=ce,Po=U,yo=st,Eo=j,Ao=nt,Io=K,wo=rt,Ro=M,Co=it,_o=q,xo=at,To=F,ko=ct,Do=mt,bo=St,Oo=V,$o=ut,No=ue,Wo=H,Ho=h,Uo=tt,qo=vt,Fo=ro,Vo=lt,Lo=xt,Ko=Tt;export{io as $Command,ao as __Client,co as AssumeRole$,uo as AssumeRoleCommand,lo as AssumeRoleRequest$,go as AssumeRoleResponse$,po as AssumeRoleWithWebIdentity$,ho as AssumeRoleWithWebIdentityCommand,mo as AssumeRoleWithWebIdentityRequest$,So as AssumeRoleWithWebIdentityResponse$,vo as AssumedRoleUser$,fo as Credentials$,Po as ExpiredTokenException,yo as ExpiredTokenException$,Eo as IDPCommunicationErrorException,Ao as IDPCommunicationErrorException$,Io as IDPRejectedClaimException,wo as IDPRejectedClaimException$,Ro as InvalidIdentityTokenException,Co as InvalidIdentityTokenException$,_o as MalformedPolicyDocumentException,xo as MalformedPolicyDocumentException$,To as PackedPolicyTooLargeException,ko as PackedPolicyTooLargeException$,Do as PolicyDescriptorType$,bo as ProvidedContext$,Oo as RegionDisabledException,$o as RegionDisabledException$,No as STS,Wo as STSClient,Ho as STSServiceException,Uo as STSServiceException$,qo as Tag$,Fo as decorateDefaultCredentialProvider,Vo as errorTypeRegistries,Lo as getDefaultRoleAssumer,Ko as getDefaultRoleAssumerWithWebIdentity};
2
+ import{jo,Ue,ot}from"./chunk-fjtvjrkg.js";import{Fe}from"./chunk-m40gxwq4.js";import{qe,ve,L}from"./chunk-jwdb0ccj.js";import{be,Y,b,Se,X,Qe,B}from"./chunk-981f9dw8.js";import{r}from"./chunk-0y7ne3d0.js";var fe=r(function(Dt){var{SignatureV4:kt,signatureV4aContainer:de}=jo(),O={CrtSignerV4:null},ge="X-Amz-S3session-Token".toLowerCase();class Z extends kt{async signWithCredentials(e,t,s){let o=pe(t);e.headers[ge]=t.sessionToken;let n=this;return he(n,o),n.signRequest(e,s??{})}async presignWithCredentials(e,t,s){let o=pe(t);return delete e.headers[ge],e.headers["X-Amz-S3session-Token"]=t.sessionToken,e.query=e.query??{},e.query["X-Amz-S3session-Token"]=t.sessionToken,he(this,o),this.presign(e,s)}}function pe(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function he(e,t){let s=e.credentialProvider;e.credentialProvider=()=>(e.credentialProvider=s,Promise.resolve(t))}class me{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof O.CrtSignerV4==="function")return"crt";else if(typeof de.SignatureV4a==="function")return"js";return"none"}constructor(e){this.sigv4Signer=new Z(e),this.signerOptions=e}async sign(e,t={}){if(t.signingRegion==="*")return this.getSigv4aSigner().sign(e,t);return this.sigv4Signer.sign(e,t)}async signWithCredentials(e,t,s={}){if(s.signingRegion==="*"){let o=this.getSigv4aSigner(),n=O.CrtSignerV4;if(n&&o instanceof n)return o.signWithCredentials(e,t,s);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,t,s)}async presign(e,t={}){if(t.signingRegion==="*"){let s=this.getSigv4aSigner(),o=O.CrtSignerV4;if(o&&s instanceof o)return s.presign(e,t);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,t)}async presignWithCredentials(e,t,s={}){if(s.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,t,s)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=O.CrtSignerV4,t=de.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!t)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(t&&typeof t==="function")this.sigv4aSigner=new t({...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(!t||typeof t!=="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 t({...this.signerOptions})}}return this.sigv4aSigner}}Dt.SignatureV4MultiRegion=me;Dt.SignatureV4SignWithCredentials=Z;Dt.signatureV4CrtContainer=O});var{awsEndpointFunctions:Nt,emitWarningIfUnsupportedVersion:Wt,createDefaultUserAgentProvider:Ht,NODE_APP_ID_CONFIG_OPTIONS:Ut,getAwsRegionExtensionConfiguration:qt,resolveAwsRegionExtensionConfiguration:Ft,resolveUserAgentConfig:Vt,resolveHostHeaderConfig:Lt,getUserAgentPlugin:Kt,getHostHeaderPlugin:Mt,getLoggerPlugin:jt,getRecursionDetectionPlugin:zt,setCredentialFeature:se,stsRegionDefaultResolver:Gt}=L(),{NoAuthSigner:_e,getHttpAuthSchemeEndpointRuleSetPlugin:Yt,DefaultIdentityProviderConfig:Qt,getHttpSigningPlugin:Bt}=ve(),{normalizeProvider:xe,getSmithyContext:Te,ServiceException:Jt,NoOpLogger:Xt,emitWarningIfUnsupportedVersion:Zt,loadConfigsForDefaultMode:es,getDefaultExtensionConfiguration:ts,resolveDefaultRuntimeConfig:ss,Client:ke,makeBuilder:ns,createAggregatedClient:os}=Y(),{Command:rs}=Y();var io=rs,ao=ke;var{resolveDefaultsModeConfig:is,loadConfig:y,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:as,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:cs,NODE_REGION_CONFIG_OPTIONS:us,NODE_REGION_CONFIG_FILE_OPTIONS:ls,resolveRegionConfig:ds}=b(),{BinaryDecisionDiagram:gs,EndpointCache:ps,decideEndpoint:hs,customEndpointFunctions:ms,resolveParams:Ss,resolveEndpointConfig:vs,getEndpointPlugin:fs}=Se(),{parseUrl:Ps,getHttpHandlerExtensionConfiguration:ys,resolveHttpHandlerRuntimeConfig:Es,getContentLengthPlugin:As}=B(),{DEFAULT_RETRY_MODE:Is,NODE_RETRY_MODE_CONFIG_OPTIONS:ws,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:Rs,resolveRetryConfig:Cs,getRetryPlugin:_s}=qe(),{TypeRegistry:De,getSchemaSerdePlugin:xs}=be(),{resolveAwsSdkSigV4Config:Ts,resolveAwsSdkSigV4AConfig:ks,AwsSdkSigV4Signer:Oe,AwsSdkSigV4ASigner:$e,NODE_SIGV4A_CONFIG_OPTIONS:Ds,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:bs}=Ue(),{SignatureV4MultiRegion:Ne}=fe(),{toUtf8:Os,fromUtf8:$s,toBase64:Ns,fromBase64:Ws,calculateBodyLength:Hs}=X(),{streamCollector:Us,NodeHttpHandler:qs}=Fe(),{AwsQueryProtocol:Fs}=ot(),{Sha256:Vs}=Qe(),D="ref",I=-1,N=!0,Pe="isSet",We="PartitionResult",W="booleanEquals",l="stringEquals",ee="getAttr",ye="us-east-1",Ee="sigv4",Ae="sts",Ie="https://sts.{Region}.{PartitionResult#dnsSuffix}",we={[D]:"Endpoint"},d={[D]:"Region"},te={[D]:We},k={},Re=[d],Ce={conditions:[[Pe,[we]],[Pe,Re],["aws.partition",Re,We],[W,[{[D]:"UseFIPS"},N]],[W,[{[D]:"UseDualStack"},N]],[l,[d,"aws-global"]],[W,[{[D]:"UseGlobalEndpoint"},N]],[l,[d,"eu-central-1"]],[W,[{fn:ee,argv:[te,"supportsDualStack"]},N]],[W,[{fn:ee,argv:[te,"supportsFIPS"]},N]],[l,[d,"ap-south-1"]],[l,[d,"eu-north-1"]],[l,[d,"eu-west-1"]],[l,[d,"eu-west-2"]],[l,[d,"eu-west-3"]],[l,[d,"sa-east-1"]],[l,[d,ye]],[l,[d,"us-east-2"]],[l,[d,"us-west-2"]],[l,[d,"us-west-1"]],[l,[d,"ca-central-1"]],[l,[d,"ap-southeast-1"]],[l,[d,"ap-northeast-1"]],[l,[d,"ap-southeast-2"]],[l,[{fn:ee,argv:[te,"name"]},"aws-us-gov"]]],results:[[I],["https://sts.amazonaws.com",{authSchemes:[{name:Ee,signingName:Ae,signingRegion:ye}]}],[Ie,{authSchemes:[{name:Ee,signingName:Ae,signingRegion:"{Region}"}]}],[I,"Invalid Configuration: FIPS and custom endpoint are not supported"],[I,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[we,k],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",k],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",k],[I,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",k],[I,"DualStack is enabled but this partition does not support DualStack"],[Ie,k],[I,"Invalid Configuration: Missing Region"]]},Ls=2,i=1e8,Ks=new Int32Array([-1,1,-1,0,30,3,1,4,i+14,2,5,i+14,3,25,6,4,24,7,5,i+1,8,6,9,i+13,7,i+1,10,10,i+1,11,11,i+1,12,12,i+1,13,13,i+1,14,14,i+1,15,15,i+1,16,16,i+1,17,17,i+1,18,18,i+1,19,19,i+1,20,20,i+1,21,21,i+1,22,22,i+1,23,23,i+1,i+2,8,i+11,i+12,4,28,26,9,27,i+10,24,i+8,i+9,8,29,i+7,9,i+6,i+7,3,i+3,31,4,i+4,i+5]),Ms=gs.from(Ks,Ls,Ce.conditions,Ce.results),js=new ps({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),He=(e,t={})=>js.get(e,()=>hs(Ms,{endpointParams:e,logger:t.logger}));ms.aws=Nt;var zs=(e)=>async(t,s,o)=>{if(!o)throw Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let n=await e(t,s,o),u=Te(s)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!u)throw Error(`getEndpointParameterInstructions() is not defined on '${s.commandName}'`);let a=await Ss(o,{getEndpointParameterInstructions:u},t);return Object.assign(n,a)},Gs=async(e,t,s)=>({operation:Te(t).operation,region:await xe(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),Ys=zs(Gs);function Ve(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function ne(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:e.region},propertiesExtractor:(t,s)=>({signingProperties:{config:t,context:s}})}}function Le(e){return{schemeId:"smithy.api#noAuth"}}var Qs=(e,t,s)=>(n)=>{let a=e(n).properties?.authSchemes;if(!a)return t(n);let g=[];for(let S of a){let{name:p,properties:v={},...A}=S,f=p.toLowerCase();if(p!==f)console.warn(`HttpAuthScheme has been normalized with lowercasing: '${p}' to '${f}'`);let m;if(f==="sigv4a"){m="aws.auth#sigv4a";let Q=a.find((J)=>{let le=J.name.toLowerCase();return le!=="sigv4a"&&le.startsWith("sigv4")});if(Ne.sigv4aDependency()==="none"&&Q)continue}else if(f.startsWith("sigv4"))m="aws.auth#sigv4";else throw Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${f}'`);let T=s[m];if(!T)throw Error(`Could not find HttpAuthOption create function for '${m}'`);let P=T(n);P.schemeId=m,P.signingProperties={...P.signingProperties||{},...A,...v},g.push(P)}return g},Bs=(e)=>{let t=[];switch(e.operation){case"AssumeRoleWithWebIdentity":{t.push(Le()),t.push(ne(e));break}default:t.push(Ve(e)),t.push(ne(e))}return t},Js=Qs(He,Bs,{"aws.auth#sigv4":Ve,"aws.auth#sigv4a":ne,"smithy.api#noAuth":Le}),Xs=(e)=>{let t=Ts(e),s=ks(t);return Object.assign(s,{authSchemePreference:xe(e.authSchemePreference??[])})},Zs=(e)=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,defaultSigningName:"sts"}),en={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},tn="3.997.47",sn={version:tn};class h extends Jt{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sts#STSServiceException";constructor(e){super(e);Object.setPrototypeOf(this,h.prototype)}}class U extends h{static shapeId="com.amazonaws.sts#ExpiredTokenException";name="ExpiredTokenException";$fault="client";constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e});Object.setPrototypeOf(this,U.prototype)}}class q extends h{static shapeId="com.amazonaws.sts#MalformedPolicyDocumentException";name="MalformedPolicyDocumentException";$fault="client";constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e});Object.setPrototypeOf(this,q.prototype)}}class F extends h{static shapeId="com.amazonaws.sts#PackedPolicyTooLargeException";name="PackedPolicyTooLargeException";$fault="client";constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e});Object.setPrototypeOf(this,F.prototype)}}class V extends h{static shapeId="com.amazonaws.sts#RegionDisabledException";name="RegionDisabledException";$fault="client";constructor(e){super({name:"RegionDisabledException",$fault:"client",...e});Object.setPrototypeOf(this,V.prototype)}}class K extends h{static shapeId="com.amazonaws.sts#IDPRejectedClaimException";name="IDPRejectedClaimException";$fault="client";constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e});Object.setPrototypeOf(this,K.prototype)}}class M extends h{static shapeId="com.amazonaws.sts#InvalidIdentityTokenException";name="InvalidIdentityTokenException";$fault="client";constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e});Object.setPrototypeOf(this,M.prototype)}}class j extends h{static shapeId="com.amazonaws.sts#IDPCommunicationErrorException";name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e});Object.setPrototypeOf(this,j.prototype)}}var nn="Arn",on="AccessKeyId",rn="AssumeRole",an="AssumedRoleId",cn="AssumeRoleRequest",un="AssumeRoleResponse",oe="AssumedRoleUser",ln="AssumeRoleWithWebIdentity",dn="AssumeRoleWithWebIdentityRequest",gn="AssumeRoleWithWebIdentityResponse",pn="Audience",re="Credentials",hn="ContextAssertion",Ke="DurationSeconds",mn="Expiration",Sn="ExternalId",vn="ExpiredTokenException",fn="IDPCommunicationErrorException",Pn="IDPRejectedClaimException",yn="InvalidIdentityTokenException",En="Key",An="MalformedPolicyDocumentException",Me="MinimumSessionTokenSize",je="Policy",ze="PolicyArns",In="ProviderArn",wn="ProvidedContexts",Rn="ProvidedContextsListType",Cn="ProvidedContext",_n="PolicyDescriptorType",xn="ProviderId",Ge="PackedPolicySize",Tn="PackedPolicyTooLargeException",kn="Provider",Ye="RoleArn",Dn="RegionDisabledException",Be="RoleSessionName",bn="SecretAccessKey",On="SubjectFromWebIdentityToken",ie="SourceIdentity",$n="SerialNumber",Nn="SessionToken",Je="SessionTokenSize",Xe="SessionTokenUtilization",Wn="Tags",Hn="TokenCode",Un="TransitiveTagKeys",qn="Tag",Fn="Value",Vn="WebIdentityToken",Ln="arn",Kn="accessKeySecretType",w="awsQueryError",R="client",Mn="clientTokenType",C="error",_="httpError",x="message",jn="policyDescriptorListType",Ze="smithy.ts.sdk.synthetic.com.amazonaws.sts",zn="tagListType",c="com.amazonaws.sts",et=new De(Ze),tt=[-3,Ze,"STSServiceException",0,[],[]];et.registerError(tt,h);var E=new De(c),st=[-3,c,vn,{[w]:["ExpiredTokenException",400],[C]:R,[_]:400},[x],[0]];E.registerError(st,U);var nt=[-3,c,fn,{[w]:["IDPCommunicationError",400],[C]:R,[_]:400},[x],[0]];E.registerError(nt,j);var rt=[-3,c,Pn,{[w]:["IDPRejectedClaim",403],[C]:R,[_]:403},[x],[0]];E.registerError(rt,K);var it=[-3,c,yn,{[w]:["InvalidIdentityToken",400],[C]:R,[_]:400},[x],[0]];E.registerError(it,M);var at=[-3,c,An,{[w]:["MalformedPolicyDocument",400],[C]:R,[_]:400},[x],[0]];E.registerError(at,q);var ct=[-3,c,Tn,{[w]:["PackedPolicyTooLarge",400],[C]:R,[_]:400},[x],[0]];E.registerError(ct,F);var ut=[-3,c,Dn,{[w]:["RegionDisabledException",403],[C]:R,[_]:403},[x],[0]];E.registerError(ut,V);var lt=[et,E],Gn=[0,c,Kn,8,0],Yn=[0,c,Mn,8,0],ae=[3,c,oe,0,[an,nn],[0,0],2],dt=[3,c,cn,0,[Ye,Be,ze,je,Ke,Wn,Un,Sn,$n,Hn,ie,wn,Me],[0,0,()=>ft,0,1,()=>Bn,64,0,0,0,0,()=>Qn,1],2],gt=[3,c,un,0,[re,oe,Ge,ie,Xe,Je],[[()=>ce,0],()=>ae,1,0,1,1]],pt=[3,c,dn,0,[Ye,Be,Vn,xn,ze,je,Ke,Me],[0,0,[()=>Yn,0],0,()=>ft,0,1,1],3],ht=[3,c,gn,0,[re,On,oe,Ge,kn,pn,ie,Xe,Je],[[()=>ce,0],0,()=>ae,1,0,0,0,1,1]],ce=[3,c,re,0,[on,bn,Nn,mn],[0,[()=>Gn,0],0,4],4],mt=[3,c,_n,0,[Ln],[0]],St=[3,c,Cn,0,[In,hn],[0,0]],vt=[3,c,qn,0,[En,Fn],[0,0],2],ft=[1,c,jn,0,()=>mt],Qn=[1,c,Rn,0,()=>St],Bn=[1,c,zn,0,()=>vt],Pt=[9,c,rn,0,()=>dt,()=>gt],yt=[9,c,ln,0,()=>pt,()=>ht],Jn=(e)=>({apiVersion:"2011-06-15",base64Decoder:e?.base64Decoder??Ws,base64Encoder:e?.base64Encoder??Ns,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??He,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Js,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(t)=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(t)=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],logger:e?.logger??new Xt,protocol:e?.protocol??Fs,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:lt,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:e?.serviceId??"STS",sha256:e?.sha256??Vs,signerConstructor:e?.signerConstructor??Ne,urlParser:e?.urlParser??Ps,utf8Decoder:e?.utf8Decoder??$s,utf8Encoder:e?.utf8Encoder??Os}),Xn=(e)=>{Zt(process.version);let t=is(e),s=()=>t().then(es),o=Jn(e);Wt(process.version);let n={profile:e?.profile,logger:o.logger};return{...o,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??y(bs,n),bodyLengthChecker:e?.bodyLengthChecker??Hs,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ht({serviceId:o.serviceId,clientVersion:sn.version}),httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4")||(async(a)=>await e.credentialDefaultProvider(a?.__config||{})()),signer:new Oe},{schemeId:"aws.auth#sigv4a",identityProvider:(u)=>u.getIdentityProvider("aws.auth#sigv4a"),signer:new $e},{schemeId:"smithy.api#noAuth",identityProvider:(u)=>u.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _e}],maxAttempts:e?.maxAttempts??y(Rs,e),region:e?.region??y(us,{...ls,...n}),requestHandler:qs.create(e?.requestHandler??s),retryMode:e?.retryMode??y({...ws,default:async()=>(await s()).retryMode||Is},e),sigv4aSigningRegionSet:e?.sigv4aSigningRegionSet??y(Ds,n),streamCollector:e?.streamCollector??Us,useDualstackEndpoint:e?.useDualstackEndpoint??y(cs,n),useFipsEndpoint:e?.useFipsEndpoint??y(as,n),userAgentAppId:e?.userAgentAppId??y(Ut,n)}},Zn=(e)=>{let{httpAuthSchemes:t,httpAuthSchemeProvider:s,credentials:o}=e;return{setHttpAuthScheme(n){let u=t.findIndex((a)=>a.schemeId===n.schemeId);if(u===-1)t.push(n);else t.splice(u,1,n)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(n){s=n},httpAuthSchemeProvider(){return s},setCredentials(n){o=n},credentials(){return o}}},eo=(e)=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),to=(e,t)=>{let s=Object.assign(qt(e),ts(e),ys(e),Zn(e));return t.forEach((o)=>o.configure(s)),Object.assign(e,Ft(s),ss(s),Es(s),eo(s))};class H extends ke{config;constructor(...[e]){let t=Xn(e||{});super(t);this.initConfig=t;let s=Zs(t),o=Vt(s),n=Cs(o),u=ds(n),a=Lt(u),g=vs(a),S=Xs(g),p=to(S,e?.extensions||[]);this.config=p,this.middlewareStack.use(xs(this.config)),this.middlewareStack.use(Kt(this.config)),this.middlewareStack.use(_s(this.config)),this.middlewareStack.use(As(this.config)),this.middlewareStack.use(Mt(this.config)),this.middlewareStack.use(jt(this.config)),this.middlewareStack.use(zt(this.config)),this.middlewareStack.use(Yt(this.config,{httpAuthSchemeParametersProvider:Ys,identityProviderConfigProvider:async(v)=>new Qt({"aws.auth#sigv4":v.credentials,"aws.auth#sigv4a":v.credentials})})),this.middlewareStack.use(Bt(this.config))}destroy(){super.destroy()}}var Et=ns(en,"AWSSecurityTokenServiceV20110615","STSClient",fs),At={},It=(e,t,s,o)=>[];class z extends Et(At,It,"AssumeRole",Pt){}class G extends Et(At,It,"AssumeRoleWithWebIdentity",yt){}var so={AssumeRoleCommand:z,AssumeRoleWithWebIdentityCommand:G};class ue extends H{}os(so,ue);var wt=(e)=>{if(typeof e?.Arn==="string"){let t=e.Arn.split(":");if(t.length>4&&t[4]!=="")return t[4]}return},Rt=async(e,t,s,o={})=>{let n=typeof e==="function"?await e():e,u=typeof t==="function"?await t():t,a="",g=n??u??(a=await Gt(o)());return s?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (credential provider clientConfig)`,`${u} (contextual client)`,`${a} (STS default: AWS_REGION, profile region, or us-east-1)`),g},no=(e,t)=>{let s,o;return async(n,u)=>{if(o=n,!s){let{logger:v=e?.parentClientConfig?.logger,profile:A=e?.parentClientConfig?.profile,region:f,requestHandler:m=e?.parentClientConfig?.requestHandler,credentialProviderLogger:T,userAgentAppId:P=e?.parentClientConfig?.userAgentAppId}=e,Q=await Rt(f,e?.parentClientConfig?.region,T,{logger:v,profile:A}),J=!Ct(m);s=new t({...e,userAgentAppId:P,profile:A,credentialDefaultProvider:()=>async()=>o,region:Q,requestHandler:J?m:void 0,logger:v})}let{Credentials:a,AssumedRoleUser:g}=await s.send(new z(u));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw Error(`Invalid response from STS.assumeRole call with role ${u.RoleArn}`);let S=wt(g),p={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...S&&{accountId:S}};return se(p,"CREDENTIALS_STS_ASSUME_ROLE","i"),p}},oo=(e,t)=>{let s;return async(o)=>{if(!s){let{logger:S=e?.parentClientConfig?.logger,profile:p=e?.parentClientConfig?.profile,region:v,requestHandler:A=e?.parentClientConfig?.requestHandler,credentialProviderLogger:f,userAgentAppId:m=e?.parentClientConfig?.userAgentAppId}=e,T=await Rt(v,e?.parentClientConfig?.region,f,{logger:S,profile:p}),P=!Ct(A);s=new t({...e,userAgentAppId:m,profile:p,region:T,requestHandler:P?A:void 0,logger:S})}let{Credentials:n,AssumedRoleUser:u}=await s.send(new G(o));if(!n||!n.AccessKeyId||!n.SecretAccessKey)throw Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${o.RoleArn}`);let a=wt(u),g={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,sessionToken:n.SessionToken,expiration:n.Expiration,...n.CredentialScope&&{credentialScope:n.CredentialScope},...a&&{accountId:a}};if(a)se(g,"RESOLVED_ACCOUNT_ID","T");return se(g,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),g}},Ct=(e)=>e?.metadata?.handlerProtocol==="h2",_t=(e,t)=>{if(!t)return e;else return class extends e{constructor(o){super(o);for(let n of t)this.middlewareStack.use(n)}}},xt=(e={},t)=>no(e,_t(H,t)),Tt=(e={},t)=>oo(e,_t(H,t)),ro=(e)=>(t)=>e({roleAssumer:xt(t),roleAssumerWithWebIdentity:Tt(t),...t});var co=Pt,uo=z,lo=dt,go=gt,po=yt,ho=G,mo=pt,So=ht,vo=ae,fo=ce,Po=U,yo=st,Eo=j,Ao=nt,Io=K,wo=rt,Ro=M,Co=it,_o=q,xo=at,To=F,ko=ct,Do=mt,bo=St,Oo=V,$o=ut,No=ue,Wo=H,Ho=h,Uo=tt,qo=vt,Fo=ro,Vo=lt,Lo=xt,Ko=Tt;export{io as $Command,ao as __Client,co as AssumeRole$,uo as AssumeRoleCommand,lo as AssumeRoleRequest$,go as AssumeRoleResponse$,po as AssumeRoleWithWebIdentity$,ho as AssumeRoleWithWebIdentityCommand,mo as AssumeRoleWithWebIdentityRequest$,So as AssumeRoleWithWebIdentityResponse$,vo as AssumedRoleUser$,fo as Credentials$,Po as ExpiredTokenException,yo as ExpiredTokenException$,Eo as IDPCommunicationErrorException,Ao as IDPCommunicationErrorException$,Io as IDPRejectedClaimException,wo as IDPRejectedClaimException$,Ro as InvalidIdentityTokenException,Co as InvalidIdentityTokenException$,_o as MalformedPolicyDocumentException,xo as MalformedPolicyDocumentException$,To as PackedPolicyTooLargeException,ko as PackedPolicyTooLargeException$,Do as PolicyDescriptorType$,bo as ProvidedContext$,Oo as RegionDisabledException,$o as RegionDisabledException$,No as STS,Wo as STSClient,Ho as STSServiceException,Uo as STSServiceException$,qo as Tag$,Fo as decorateDefaultCredentialProvider,Vo as errorTypeRegistries,Lo as getDefaultRoleAssumer,Ko as getDefaultRoleAssumerWithWebIdentity};