@cortex-agent/server 2026.10.27 → 2026.11.17

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 (258) hide show
  1. package/LICENSE +255 -21
  2. package/README.md +54 -7
  3. package/THIRD_PARTY_NOTICES.txt +1109 -278
  4. package/defaults/hooks/cortex-hook-api.mjs +2 -1
  5. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +23 -15
  6. package/dist/agent-adapter/claude/remote-mcp-proxy.js +1 -1
  7. package/dist/chunks/{anthropic-messages-M3SMXACA.js → anthropic-messages-M732OMEE.js} +1 -1
  8. package/dist/chunks/{azure-openai-responses-76YWXHSB.js → azure-openai-responses-RAKTV6JY.js} +1 -1
  9. package/dist/chunks/bedrock-converse-stream-WNUGNZ27.js +62 -0
  10. package/dist/chunks/bowser-MLGGLXTZ.js +20 -0
  11. package/dist/chunks/child-runner-MO5RT6FH.js +4 -0
  12. package/dist/chunks/chunk-2ATTYCRJ.js +4 -0
  13. package/dist/chunks/{chunk-PXS5SHOV.js → chunk-2ROGTDM2.js} +1 -1
  14. package/dist/chunks/chunk-2VVRTJQN.js +4 -0
  15. package/dist/chunks/{chunk-OZGBWAT2.js → chunk-2YTYYG4K.js} +1 -1
  16. package/dist/chunks/chunk-3CPIMAYX.js +30 -0
  17. package/dist/chunks/{chunk-FXDIR3SQ.js → chunk-3CZPBLB3.js} +1 -1
  18. package/dist/chunks/chunk-3ORG56I5.js +8 -0
  19. package/dist/chunks/{chunk-LEUENXI2.js → chunk-4YLAGSDM.js} +1 -1
  20. package/dist/chunks/{chunk-HU6UIDEJ.js → chunk-53TQNK7Z.js} +1 -1
  21. package/dist/chunks/{chunk-4U7XXM4W.js → chunk-5A6CA5TM.js} +1 -1
  22. package/dist/chunks/{chunk-PBJ5MPPX.js → chunk-5DF5WJNM.js} +1 -1
  23. package/dist/chunks/chunk-5PAW3DEU.js +50 -0
  24. package/dist/chunks/{chunk-DXBSQXJL.js → chunk-7GAYFN52.js} +1 -1
  25. package/dist/chunks/chunk-7GEBDPTT.js +4 -0
  26. package/dist/chunks/{chunk-NR6U3WIZ.js → chunk-AFTBQRPN.js} +1 -1
  27. package/dist/chunks/chunk-AVXDF7AG.js +4 -0
  28. package/dist/chunks/chunk-BDLKI2NT.js +4 -0
  29. package/dist/chunks/{chunk-P52RMIYX.js → chunk-BJGYGEZO.js} +1 -1
  30. package/dist/chunks/chunk-BUZQBTV2.js +10 -0
  31. package/dist/chunks/chunk-BZDIAI5M.js +125 -0
  32. package/dist/chunks/{chunk-A34TDMIC.js → chunk-CEGSDGYQ.js} +1 -1
  33. package/dist/chunks/{chunk-Q7CE3UIE.js → chunk-CK3P345X.js} +69 -69
  34. package/dist/chunks/{chunk-YAEVYJAR.js → chunk-EE3WT25T.js} +1 -1
  35. package/dist/chunks/chunk-ETIBCA2S.js +4 -0
  36. package/dist/chunks/{chunk-REBNWCKI.js → chunk-FP7ML72L.js} +1 -1
  37. package/dist/chunks/{chunk-H2FP6DG4.js → chunk-H4QZ2P3Z.js} +1 -1
  38. package/dist/chunks/chunk-IA6IODY3.js +4 -0
  39. package/dist/chunks/{chunk-D3NXKK2L.js → chunk-IKLTEWA3.js} +1 -1
  40. package/dist/chunks/chunk-IYVZHGUQ.js +5 -0
  41. package/dist/chunks/chunk-JJDEQ6N2.js +4 -0
  42. package/dist/chunks/chunk-JKL3AK5D.js +106 -0
  43. package/dist/chunks/chunk-KDPY2YA3.js +129 -0
  44. package/dist/chunks/{chunk-SUFW24P4.js → chunk-KUDK7GPS.js} +1 -1
  45. package/dist/chunks/chunk-LAWOWPZX.js +363 -0
  46. package/dist/chunks/chunk-LEAV3FFG.js +4 -0
  47. package/dist/chunks/chunk-LP72AF56.js +45 -0
  48. package/dist/chunks/{chunk-KENCMLRE.js → chunk-LP7T32PW.js} +1 -1
  49. package/dist/chunks/chunk-LQTFDC67.js +4 -0
  50. package/dist/chunks/{chunk-HALUQ7ZF.js → chunk-MGYYSX7Y.js} +1 -1
  51. package/dist/chunks/chunk-NNBSSISP.js +4 -0
  52. package/dist/chunks/chunk-NNTQUHLO.js +877 -0
  53. package/dist/chunks/{chunk-PFMEUFJ7.js → chunk-NRD57ICT.js} +1 -1
  54. package/dist/chunks/{chunk-QWAQHHRS.js → chunk-NXZS5PEW.js} +1 -1
  55. package/dist/chunks/chunk-OFEPDNRB.js +4 -0
  56. package/dist/chunks/{chunk-6LZK4DDH.js → chunk-P7TVR4GY.js} +1 -1
  57. package/dist/chunks/chunk-QEL6CMLE.js +4 -0
  58. package/dist/chunks/chunk-QMSSIDRQ.js +70 -0
  59. package/dist/chunks/chunk-QUXPMNFQ.js +4 -0
  60. package/dist/chunks/chunk-R52AVUQB.js +5 -0
  61. package/dist/chunks/chunk-R6CGBSTC.js +22 -0
  62. package/dist/chunks/chunk-RA2BUYI3.js +6 -0
  63. package/dist/chunks/chunk-RDW6FRF5.js +4 -0
  64. package/dist/chunks/chunk-RF4JLYBX.js +6 -0
  65. package/dist/chunks/{chunk-YPK2CAIZ.js → chunk-ROVKOIHF.js} +1 -1
  66. package/dist/chunks/chunk-RYLSRII6.js +7 -0
  67. package/dist/chunks/{chunk-XNSSUVT6.js → chunk-S3MR37DL.js} +1 -1
  68. package/dist/chunks/chunk-SAJD4EKE.js +10 -0
  69. package/dist/chunks/chunk-SFX7V5O2.js +10 -0
  70. package/dist/chunks/chunk-STCNHXPJ.js +6 -0
  71. package/dist/chunks/{chunk-FOJQXLL2.js → chunk-SY2HV3V5.js} +1 -1
  72. package/dist/chunks/chunk-T73GHMFB.js +4 -0
  73. package/dist/chunks/chunk-TKFFQNAP.js +19 -0
  74. package/dist/chunks/chunk-TMV2ZDOI.js +18 -0
  75. package/dist/chunks/chunk-TX46YMGI.js +5 -0
  76. package/dist/chunks/chunk-U23S37TT.js +6 -0
  77. package/dist/chunks/chunk-UT6DGZDO.js +4 -0
  78. package/dist/chunks/{chunk-JERCOLY3.js → chunk-V35MFAUQ.js} +4 -6
  79. package/dist/chunks/chunk-V6X7Y62J.js +7 -0
  80. package/dist/chunks/chunk-V7K3KNDM.js +4 -0
  81. package/dist/chunks/{chunk-NAA7GF6Q.js → chunk-VBN2JSER.js} +1 -1
  82. package/dist/chunks/chunk-VIMHSW6J.js +4 -0
  83. package/dist/chunks/chunk-VK5J556O.js +4 -0
  84. package/dist/chunks/chunk-VPVSKJGX.js +6 -0
  85. package/dist/chunks/chunk-VTL3Z2OP.js +23 -0
  86. package/dist/chunks/{chunk-X2GYYRVM.js → chunk-VW7TLY3P.js} +1 -1
  87. package/dist/chunks/chunk-W34AK4SK.js +65 -0
  88. package/dist/chunks/chunk-W6AKCEYF.js +8 -0
  89. package/dist/chunks/chunk-WBSE3EF3.js +27 -0
  90. package/dist/chunks/chunk-WZYS2HAK.js +4 -0
  91. package/dist/chunks/{chunk-UNVEZI57.js → chunk-XEBEWR6Y.js} +1 -1
  92. package/dist/chunks/chunk-XPPZ6Y3X.js +8 -0
  93. package/dist/chunks/chunk-XYSXL3KX.js +4 -0
  94. package/dist/chunks/chunk-YAAKL3QS.js +80 -0
  95. package/dist/chunks/chunk-YB5LUJHS.js +65 -0
  96. package/dist/chunks/chunk-Z24SBRJK.js +4 -0
  97. package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +1 -1
  98. package/dist/chunks/context-GQKWKFRM.js +4 -0
  99. package/dist/chunks/cost-OOO32GLC.js +5 -0
  100. package/dist/chunks/dist-V5FRMUFH.js +4 -0
  101. package/dist/chunks/easter-egg-3d-CZH7AYZ7.js +4 -0
  102. package/dist/chunks/{event-streams-3JSFPOTZ.js → event-streams-AVE4MSS6.js} +1 -1
  103. package/dist/chunks/execution-repo-XXL4FXC6.js +4 -0
  104. package/dist/chunks/{executions-6ARGR3IO.js → executions-BN6OLLVM.js} +1 -1
  105. package/dist/chunks/file-H572PL2Z.js +4 -0
  106. package/dist/chunks/google-generative-ai-2G4ITOZL.js +4 -0
  107. package/dist/chunks/google-vertex-PACHCMRZ.js +4 -0
  108. package/dist/chunks/init-75F4V7SK.js +4 -0
  109. package/dist/chunks/{install-cli-4IZCSDFZ.js → install-cli-ABBD7DO5.js} +1 -1
  110. package/dist/chunks/{interaction-ask-G5T3H3CG.js → interaction-ask-EE2UPR3Q.js} +1 -1
  111. package/dist/chunks/{interaction-plan-E5V42MUP.js → interaction-plan-C446T2GZ.js} +1 -1
  112. package/dist/chunks/{llama-cpp-classify-OTXZWCMW.js → llama-cpp-classify-IA2F2H7A.js} +1 -1
  113. package/dist/chunks/local-client-stop-5YOLXGYT.js +4 -0
  114. package/dist/chunks/memory-cli-5SSF6YJM.js +11 -0
  115. package/dist/chunks/{mistral-conversations-34F66L3O.js → mistral-conversations-VHP63CDS.js} +1 -1
  116. package/dist/chunks/{model-resolver-N3DTAQ2S.js → model-resolver-FVJNZ6NA.js} +1 -1
  117. package/dist/chunks/{node-PTK2HCDV.js → node-DAO3SX7O.js} +1 -1
  118. package/dist/chunks/{openai-codex-2REL6UQU.js → openai-codex-JULCKICT.js} +1 -1
  119. package/dist/chunks/{openai-codex-responses-ZBVHREB3.js → openai-codex-responses-EHJ4AZBE.js} +1 -1
  120. package/dist/chunks/{openai-completions-VVIB26SH.js → openai-completions-CRAGQFCE.js} +1 -1
  121. package/dist/chunks/{openai-decisions-2N6ZRPZC.js → openai-decisions-P5UX7BWY.js} +1 -1
  122. package/dist/chunks/{openai-responses-735XA2ZX.js → openai-responses-IZ22NVQ7.js} +1 -1
  123. package/dist/chunks/{openrouter-images-3IKETHAC.js → openrouter-images-W2JAMSRH.js} +1 -1
  124. package/dist/chunks/{pi-messages-I3E4ZFHA.js → pi-messages-MJEEQU2R.js} +1 -1
  125. package/dist/chunks/{radius-HXRZVBDB.js → radius-ZM7ZRMXF.js} +1 -1
  126. package/dist/chunks/{remote-ops-BALZYKH6.js → remote-ops-O5CR4RGA.js} +1 -1
  127. package/dist/chunks/runner-S6R3US24.js +4 -0
  128. package/dist/chunks/schedule-cli-4T4YC5V5.js +4 -0
  129. package/dist/chunks/slack-2CGM4SMY.js +4 -0
  130. package/dist/chunks/start-ui-http-3D7QNHGB.js +43 -0
  131. package/dist/chunks/subagent-OZGUOV3J.js +4 -0
  132. package/dist/chunks/{time-KEHDQT6K.js → time-P6PE52WL.js} +1 -1
  133. package/dist/chunks/tool-shims-IA2WELXJ.js +4 -0
  134. package/dist/chunks/typesafe-system-one-6ULACYD4.js +1 -1
  135. package/dist/chunks/ui-board-H4INJD6C.js +5 -0
  136. package/dist/chunks/ui-decision-6HHNROIT.js +4 -0
  137. package/dist/chunks/{ui-file-GVH53O3X.js → ui-file-6PLXHSTB.js} +1 -1
  138. package/dist/chunks/ui-view-6MDU4GXY.js +4 -0
  139. package/dist/chunks/virtual-modules-OFI7QKYH.js +4 -0
  140. package/dist/chunks/waitpoint-W5M3BE55.js +5 -0
  141. package/dist/chunks/workers-GTFP75MS.js +4 -0
  142. package/dist/client-bundle/client.mjs +44 -31
  143. package/dist/client-bundle/manifest.json +2 -2
  144. package/dist/core/pi-sdk.js +1 -1
  145. package/dist/domain/auth/cc-auth-cli.js +1 -1
  146. package/dist/domain/mcp/bundled-server.js +1 -1
  147. package/dist/domain/mcp/feishu/client.js +4 -0
  148. package/dist/entry/app.js +201 -191
  149. package/dist/entry/browser-cli.js +10 -10
  150. package/dist/entry/cli.js +1 -1
  151. package/dist/entry/cortex-cli.js +1 -1
  152. package/dist/entry/daemon.js +4 -4
  153. package/dist/entry/hook-cli.js +2 -2
  154. package/dist/entry/production-app-bootstrap.js +1 -1
  155. package/dist/entry/production-evidence-export-cli.js +1 -1
  156. package/dist/entry/signal-cli.js +2 -2
  157. package/dist/tui/index.js +41 -41
  158. package/package.json +3 -3
  159. package/vendor/pi/dist/core/extensions/loader.js +1 -1
  160. package/vendor/pi/dist/extensions/codemode/execute.js +1 -1
  161. package/vendor/pi-ai/bedrock.js +1 -1
  162. package/vendor/pi-ai/oauth-load.js +1 -1
  163. package/web/dist/assets/{board-math-css-BmiXB1z5.js → board-math-css-BgIyUG-C.js} +1 -1
  164. package/web/dist/assets/index-9lyu2S6W.css +1 -0
  165. package/web/dist/assets/index-C-hpzey7.js +532 -0
  166. package/web/dist/assets/{index-XBRXpnC5.js → index-C2eMpcuI.js} +1 -1
  167. package/web/dist/assets/pdf-worker-DdZgk2mV.js +57 -0
  168. package/web/dist/assets/pdf.worker.min-Bz_KHX45.js +55 -0
  169. package/web/dist/index.html +2 -2
  170. package/web/dist/theme.css +22 -0
  171. package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +0 -4
  172. package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +0 -58
  173. package/dist/chunks/child-runner-3GHOWGZP.js +0 -4
  174. package/dist/chunks/chunk-2ZNLUY2U.js +0 -128
  175. package/dist/chunks/chunk-3F6WW7HR.js +0 -13
  176. package/dist/chunks/chunk-3OKHUVEM.js +0 -7
  177. package/dist/chunks/chunk-3THJYAEF.js +0 -4
  178. package/dist/chunks/chunk-3YHOCPQU.js +0 -10
  179. package/dist/chunks/chunk-4LLH5OWM.js +0 -10
  180. package/dist/chunks/chunk-52T37Y47.js +0 -8
  181. package/dist/chunks/chunk-7MU2AKNM.js +0 -4
  182. package/dist/chunks/chunk-AAA3UBIS.js +0 -4
  183. package/dist/chunks/chunk-ASYQHJVQ.js +0 -9
  184. package/dist/chunks/chunk-BGVHA2D4.js +0 -4
  185. package/dist/chunks/chunk-BKHDWCRT.js +0 -79
  186. package/dist/chunks/chunk-CQLH4UVX.js +0 -4
  187. package/dist/chunks/chunk-D6UA4BZC.js +0 -19
  188. package/dist/chunks/chunk-DGMNI4AO.js +0 -4
  189. package/dist/chunks/chunk-DHSA5ACV.js +0 -125
  190. package/dist/chunks/chunk-DPQPXBTP.js +0 -68
  191. package/dist/chunks/chunk-E7ZMYIY6.js +0 -30
  192. package/dist/chunks/chunk-EQITBTJC.js +0 -10
  193. package/dist/chunks/chunk-EXJA5RIX.js +0 -357
  194. package/dist/chunks/chunk-FH74NME3.js +0 -115
  195. package/dist/chunks/chunk-FOQ7VLIL.js +0 -17
  196. package/dist/chunks/chunk-J5DVLUKY.js +0 -6
  197. package/dist/chunks/chunk-JW2HFMTF.js +0 -4
  198. package/dist/chunks/chunk-KIGMAATV.js +0 -23
  199. package/dist/chunks/chunk-KIU5FAPY.js +0 -5
  200. package/dist/chunks/chunk-KIWMQPH7.js +0 -739
  201. package/dist/chunks/chunk-LMSQZ6TQ.js +0 -4
  202. package/dist/chunks/chunk-MEPASGPP.js +0 -6
  203. package/dist/chunks/chunk-MFAEUHMV.js +0 -28
  204. package/dist/chunks/chunk-NKDMKRSB.js +0 -68
  205. package/dist/chunks/chunk-NKXV32S6.js +0 -4
  206. package/dist/chunks/chunk-NVX5IPRN.js +0 -4
  207. package/dist/chunks/chunk-O3JW2F7D.js +0 -8
  208. package/dist/chunks/chunk-OISO5JXB.js +0 -4
  209. package/dist/chunks/chunk-OPYXNSMY.js +0 -4
  210. package/dist/chunks/chunk-PZMXHA6X.js +0 -9
  211. package/dist/chunks/chunk-QEOFEETJ.js +0 -4
  212. package/dist/chunks/chunk-REPYBMQS.js +0 -4
  213. package/dist/chunks/chunk-TAWLERZA.js +0 -4
  214. package/dist/chunks/chunk-TWAEABGG.js +0 -52
  215. package/dist/chunks/chunk-TZFLHVOQ.js +0 -7
  216. package/dist/chunks/chunk-UD3NMUHR.js +0 -12
  217. package/dist/chunks/chunk-W25TB3PU.js +0 -4
  218. package/dist/chunks/chunk-W5LGYSPZ.js +0 -4
  219. package/dist/chunks/chunk-XAJLZR7C.js +0 -28
  220. package/dist/chunks/chunk-XH6FMP3N.js +0 -71
  221. package/dist/chunks/chunk-XSRZHN63.js +0 -4
  222. package/dist/chunks/chunk-YG7OEPR2.js +0 -6
  223. package/dist/chunks/chunk-YHIWOGVL.js +0 -4
  224. package/dist/chunks/chunk-YZSHTWNM.js +0 -92
  225. package/dist/chunks/chunk-Z4H3VDHI.js +0 -4
  226. package/dist/chunks/client-XOGYH5UR.js +0 -4
  227. package/dist/chunks/config-DJSQI77S-335IXHSM.js +0 -4
  228. package/dist/chunks/context-VCQH5OB6.js +0 -4
  229. package/dist/chunks/cost-PGGFI7QJ.js +0 -5
  230. package/dist/chunks/dist-PUKMZ7GW.js +0 -4
  231. package/dist/chunks/easter-egg-3d-MO4MOEVF.js +0 -4
  232. package/dist/chunks/es5-VNTQPCKX.js +0 -4
  233. package/dist/chunks/execution-repo-ZLJTBWFC.js +0 -4
  234. package/dist/chunks/file-7BN7RCAY.js +0 -4
  235. package/dist/chunks/gateway-UCRPMR75.js +0 -36
  236. package/dist/chunks/google-generative-ai-2VXWLHWI.js +0 -4
  237. package/dist/chunks/google-vertex-UA36QP2U.js +0 -4
  238. package/dist/chunks/init-HA7FAQ73.js +0 -4
  239. package/dist/chunks/local-client-stop-SQRU7ZZM.js +0 -4
  240. package/dist/chunks/memory-cli-PYOILNN5.js +0 -11
  241. package/dist/chunks/models-L5VF4I5O-XXNJYQMQ.js +0 -4
  242. package/dist/chunks/runner-PLVZDGHB.js +0 -4
  243. package/dist/chunks/schedule-cli-OLASBBYJ.js +0 -4
  244. package/dist/chunks/slack-WAGSPZUX.js +0 -4
  245. package/dist/chunks/start-ui-http-QALT7C3P.js +0 -43
  246. package/dist/chunks/subagent-E3UC7ZHC.js +0 -4
  247. package/dist/chunks/tool-shims-Q6P6UXVC.js +0 -4
  248. package/dist/chunks/ui-board-4GYW6KKW.js +0 -5
  249. package/dist/chunks/ui-decision-U2FXSEC2.js +0 -4
  250. package/dist/chunks/ui-view-O7PLANT7.js +0 -4
  251. package/dist/chunks/virtual-modules-IDC5YKZJ.js +0 -4
  252. package/dist/chunks/waitpoint-2FGQBIAC.js +0 -5
  253. package/dist/chunks/workers-XN4PSTH6.js +0 -4
  254. package/vendor/aistatus/gateway-cli.js +0 -21
  255. package/web/dist/assets/index-DqWMdMkh.css +0 -1
  256. package/web/dist/assets/index-btKNdkvc.js +0 -525
  257. package/web/dist/assets/pdf-worker-Hp15W1QJ.js +0 -57
  258. package/web/dist/assets/pdf.worker.min-DnhTvCwe.js +0 -55
@@ -0,0 +1,62 @@
1
+ import { createRequire as __cortexCreateRequire } from 'node:module';
2
+ const require = __cortexCreateRequire(import.meta.url);
3
+ const __cortexPackageRoot = new URL("../../", import.meta.url);
4
+ import{a as qg}from"./chunk-ZSV6TO7Q.js";import{$ as Zu,A as $r,Aa as st,B as ia,Ba as _t,C as qt,Ca as D,D as Lr,Da as jr,E as Yu,Ea as IP,F as M,Fa as rs,G as ge,H as Vt,I as le,J as pe,K as $g,L as yt,M as aa,N as sn,O as ca,P as ot,Q as Lg,R as an,S as Ug,T as Bg,U as Gg,V as da,W as K,X as Fg,Y as Ur,Ya as nl,Z as Qu,Za as sl,_ as Ju,a as Ku,aa as q,b as Ie,ba as Br,c as H,ca as Gr,d as V,da as el,e as Et,ea as tl,f as Dg,fa as Xe,g as na,ga as Ye,h as Be,ha as Ct,i as Mg,ia as Fr,j as tt,ja as nt,k as re,ka as te,l as rt,la as Hg,m as nn,ma as Hr,n as kr,na as zr,o as sa,oa as rl,p as x,pa as Wt,q as ie,qa as ts,r as RP,ra as qr,s as W,sa as ol,t as Pr,ta as Vr,u as br,ua as Wr,v as Nr,va as xP,w as Xu,wa as ae,x as Or,xa as zg,y as Dr,ya as ua,z as Mr,za as la}from"./chunk-TKFFQNAP.js";import{a as Og}from"./chunk-FF7UELTU.js";import{c as Tg,d as Ag}from"./chunk-SKHLZ6XY.js";import{a as Ke}from"./chunk-6R73ICDB.js";import{a as Rg,d as xg,g as Ig,i as vg,j as kg,m as Pg,n as bg,o as Ng}from"./chunk-QBKCAIJG.js";import{J as _g,o as gg,s as Sg,t as Eg,u as yg,x as Cg}from"./chunk-PZMGBKUR.js";import{d as pg}from"./chunk-D6VMBA4C.js";import{a as oa}from"./chunk-USBJFDJ6.js";import{b as wg}from"./chunk-K4NTZEDJ.js";import{d as hg}from"./chunk-6AKUD3CF.js";import"./chunk-OSEIQ7SS.js";import{b as mg}from"./chunk-CXT5IR5T.js";import{b as ju}from"./chunk-N6BTQN7R.js";import{a as oe,b as h,c as se,d as St,e as Ee,f as v}from"./chunk-WHC7AYZD.js";var os,jt,Vg=h(()=>{os={warningEmitted:!1},jt=t=>{if(t&&!os.warningEmitted){if(process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED==="true"){os.warningEmitted=!0;return}let e=parseInt(t.substring(1,t.indexOf("."))),r=22;e<r&&(os.warningEmitted=!0,process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
5
+ versions published after the first week of January 2027
6
+ will require node >=${r}. You are running node ${t}.
7
+
8
+ To continue receiving updates to AWS services, bug fixes,
9
+ and security updates please upgrade to node >=${r}.
10
+
11
+ More information can be found at: https://a.co/c895JFp`))}}});var vP,kP,Wg,jg=h(()=>{vP=()=>(t,e)=>async r=>(e.__retryLongPoll=!0,t(r)),kP={name:"longPollMiddleware",tags:["RETRY"],step:"initialize",override:!0},Wg=t=>({applyToStack:e=>{e.add(vP(),kP)}})});function Kr(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var Kg=h(()=>{});import{Readable as PP}from"node:stream";var il,Xg=h(()=>{il=t=>t?.body instanceof PP||typeof ReadableStream<"u"&&t?.body instanceof ReadableStream});var Se,cn=h(()=>{D();Se=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return ua.mutate(t);if(!t)return ua.mutate(new Uint8Array);let r=e.streamCollector(t);return ua.mutate(await r)}});function Tt(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var fa=h(()=>{});var ye,dn=h(()=>{ye=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});var Xr,ma=h(()=>{re();W();re();dn();Xr=class extends ye{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=new ie(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return V}getResponseType(){return Et}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[o,n]of r.url.searchParams.entries())e.query[o]=n;if(r.headers)for(let o in r.headers)H(r.headers,o)&&(e.headers[o]=r.headers[o].join(", "));return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let o in r.headers)H(r.headers,o)&&(e.headers[o]=r.headers[o]);return e}}setHostPrefix(e,r,o){if(this.serdeContext?.disableHostPrefix)return;let n=x.of(r.input),s=sa(r.traits??{});if(s.endpoint){let i=s.endpoint?.[0];if(typeof i=="string"){for(let[a,c]of n.structIterator()){if(!c.getMergedTraits().hostLabel)continue;let d=o[a];if(typeof d!="string")throw new Error(`@smithy/core/schema - ${a} in input must be a string as hostLabel.`);i=i.replace(`{${a}}`,d)}if(e.hostname=i+e.hostname,!na(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}resolveError(e,r,o){let n=[-3,"","Error",0,[],[],0],s;for(let i of o)for(let a of r)try{a==="*"?s=i.getSchema(e):s=i.getSchema(a+"#"+e);let c=i.getErrorCtor(s);if(c)return[s,c,"modeled"];{let d=i.getBaseException();if(d){let u=i.getErrorCtor(d);if(u)return[s,u,"synthetic"]}}}catch{}for(let i of o){let a=i.getBaseException();if(a){let c=i.getErrorCtor(a);if(c)return[a,c,"synthetic"]}}return[n,Error,"native"]}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=await import("./event-streams-AVE4MSS6.js"),o=this.resolveEventStreamMarshaller(r);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType(),compositeErrorRegistry:this.compositeErrorRegistry})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,o,n,s){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}}});var Yr,Yg=h(()=>{re();W();D();re();ma();cn();fa();Yr=class extends Xr{async serializeRequest(e,r,o){let n=r&&typeof r=="object"?r:{},s=this.serializer,i={},a={},c=await o.endpoint(),d=x.of(e?.input),u=[],l=[],m=!1,g,S=new V({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:a,body:void 0});if(c){this.updateServiceEndpoint(S,c),this.setHostPrefix(S,e,n);let E=sa(e.traits);if(E.http){S.method=E.http[0];let[C,y]=E.http[1].split("?");S.path=="/"?S.path=C:S.path+=C;let T=new URLSearchParams(y??"");for(let[w,I]of T)i[w]=I}}for(let[E,C]of d.structIterator()){let y=C.getMergedTraits()??{},T=n[E];if(T==null&&!C.isIdempotencyToken()){if(y.httpLabel&&(S.path.includes(`{${E}+}`)||S.path.includes(`{${E}}`)))throw new Error(`No value provided for input HTTP label: ${E}.`);continue}if(y.httpPayload)C.isStreaming()?C.isStructSchema()?n[E]&&(g=await this.serializeEventStream({eventStream:n[E],requestSchema:d})):g=T:(s.write(C,T),g=s.flush());else if(y.httpLabel){s.write(C,T);let w=s.flush();S.path.includes(`{${E}+}`)?S.path=S.path.replace(`{${E}+}`,w.split("/").map(Tt).join("/")):S.path.includes(`{${E}}`)&&(S.path=S.path.replace(`{${E}}`,Tt(w)))}else if(y.httpHeader)s.write(C,T),a[y.httpHeader.toLowerCase()]=String(s.flush());else if(typeof y.httpPrefixHeaders=="string")for(let w in T){if(!H(T,w))continue;let I=T[w],b=y.httpPrefixHeaders+w;s.write([C.getValueSchema(),{httpHeader:b}],I),a[b.toLowerCase()]=s.flush()}else y.httpQuery||y.httpQueryParams?this.serializeQuery(C,T,i):(m=!0,u.push(E),l.push(C))}if(m&&n){let[E,C]=(d.getName(!0)??"#Unknown").split("#"),y=d.getSchema()[6],T=[3,E,C,d.getMergedTraits(),u,l,void 0];y?T[6]=y:T.pop(),s.write(T,n),g=s.flush()}return S.headers=a,S.query=i,S.body=g,S}serializeQuery(e,r,o){let n=this.serializer,s=e.getMergedTraits();if(s.httpQueryParams){for(let i in r)if(H(r,i)&&!(i in o)){let a=r[i],c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...s,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(c,a,o)}return}if(e.isListSchema()){let i=!!e.getMergedTraits().sparse,a=[];for(let c of r){n.write([e.getValueSchema(),s],c);let d=n.flush();(i||d!==void 0)&&a.push(d)}o[s.httpQuery]=a}else n.write([e,s],r),o[s.httpQuery]=n.flush()}async deserializeResponse(e,r,o){let n=this.deserializer,s=x.of(e.output),i={};if(o.statusCode>=300){let c=await Se(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(e,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in o.headers){if(!H(o.headers,c))continue;let d=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=d}let a=await this.deserializeHttpMessage(s,r,o,i);if(a.length){let c=await Se(o.body,r);if(c.byteLength>0){let d=await n.read(s,c);for(let u of a)d[u]!=null&&(i[u]=d[u])}}else a.discardResponseBody&&await Se(o.body,r);return i.$metadata=this.deserializeMetadata(o),i}async deserializeHttpMessage(e,r,o,n,s){let i;n instanceof Set?i=s:i=n;let a=!0,c=this.deserializer,d=x.of(e),u=[];for(let[l,m]of d.structIterator()){let g=m.getMemberTraits();if(g.httpPayload){if(a=!1,m.isStreaming())m.isStructSchema()?i[l]=await this.deserializeEventStream({response:o,responseSchema:d}):i[l]=zg(o.body);else if(o.body){let E=await Se(o.body,r);E.byteLength>0&&(i[l]=await c.read(m,E))}}else if(g.httpHeader){let S=String(g.httpHeader).toLowerCase(),E=o.headers[S];if(E!=null)if(m.isListSchema()){let C=m.getValueSchema();C.getMergedTraits().httpHeader=S;let y;C.isTimestampSchema()&&C.getSchema()===4?y=Gg(E,",",2):y=da(E);let T=[];for(let w of y)T.push(await c.read(C,w.trim()));i[l]=T}else i[l]=await c.read(m,E)}else if(g.httpPrefixHeaders!==void 0){i[l]={};for(let S in o.headers)if(H(o.headers,S)&&S.startsWith(g.httpPrefixHeaders)){let E=o.headers[S],C=m.getValueSchema();C.getMergedTraits().httpHeader=S,i[l][S.slice(g.httpPrefixHeaders.length)]=await c.read(C,E)}}else g.httpResponseCode?i[l]=o.statusCode:u.push(l)}return u.discardResponseBody=a,u}}});var Kt,al=h(()=>{re();W();re();ma();cn();Kt=class extends Xr{async serializeRequest(e,r,o){let n=this.serializer,s={},i={},a=await o.endpoint(),c=x.of(e?.input),d=c.getSchema(),u,l=r&&typeof r=="object"?r:{},m=new V({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:s,headers:i,body:void 0});if(a&&(this.updateServiceEndpoint(m,a),this.setHostPrefix(m,e,l)),l){let g=c.getEventStreamMember();if(g){if(l[g]){let S={};for(let[E]of c.structIterator())E!==g&&l[E]!=null&&(S[E]=l[E]);u=await this.serializeEventStream({eventStream:l[g],requestSchema:c,initialRequest:S})}}else n.write(d,l),u=n.flush()}return m.headers=Object.assign(m.headers,i),m.query=s,m.body=u,m.method="POST",m}async deserializeResponse(e,r,o){let n=this.deserializer,s=x.of(e.output),i={};if(this.isErrorResponse(o.statusCode)){let c=await Se(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(e,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in o.headers){if(!H(o.headers,c))continue;let d=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=d}let a=s.getEventStreamMember();if(a)i[a]=await this.deserializeEventStream({response:o,responseSchema:s,initialResponseContainer:i});else{let c=await Se(o.body,r);c.byteLength>0&&Object.assign(i,await n.read(s,c))}return i.$metadata=this.deserializeMetadata(o),i}isErrorResponse(e){return e>=300}}});var Qr,cl=h(()=>{W();re();al();Qr=class extends Kt{constructor({defaultNamespace:e,errorTypeRegistries:r}){super({defaultNamespace:e,errorTypeRegistries:r})}async serializeRequest(e,r,o){let n=await super.serializeRequest(e,r,o);Object.assign(n.headers,{"content-type":this.getDefaultContentType(),"smithy-protocol":this.getSmithyProtocolHeaderValue(),accept:this.getDefaultContentType()}),nn(e.input)==="unit"?(delete n.body,delete n.headers["content-type"]):this.applyEmptyBody(n);let{service:s,operation:i}=Ie(o),a=`/service/${s}/operation/${i}`;return n.path.endsWith("/")?n.path+=a.slice(1):n.path+=a,n}isErrorResponse(e){return e!==200}}});var pa,dl=h(()=>{fa();pa=(t,e,r,o,n,s)=>{if(e!=null&&e[r]!==void 0){let i=o();if(i==null||i.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(n,s?i.split("/").map(a=>Tt(a)).join("/"):Tt(i))}else throw new Error("No value provided for input HTTP label: "+r+".");return t}});function ha(t,e){return new ns(t,e)}var ns,Qg=h(()=>{re();dl();ns=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:o,path:n}=await this.context.endpoint();this.path=n;for(let s of this.resolvePathStack)s(this.path);return new V({protocol:r,hostname:this.hostname||e,port:o,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,o,n){return this.resolvePathStack.push(s=>{this.path=pa(s,this.input,e,r,o,n)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}});function Ce(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:o,httpHeader:n,httpQuery:s}=t.getMergedTraits();return(e.httpBindings?typeof o=="string"||n?6:s||r?5:void 0:void 0)??e.timestampFormat.default}var Jr=h(()=>{});var Zr,ul=h(()=>{W();D();dn();Jr();Zr=class extends ye{settings;constructor(e){super(),this.settings=e}read(e,r){let o=x.of(e);if(o.isListSchema())return da(r).map(n=>this.read(o.getValueSchema(),n));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??ge)(r);if(o.isTimestampSchema())switch(Ce(o,this.settings)){case 5:return Ug(r);case 6:return Bg(r);case 7:return an(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(o.isStringSchema()){let n=o.getMergedTraits().mediaType,s=r;if(n)return o.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s)),(n==="application/json"||n.endsWith("+json"))&&(s=ot.from(s)),s}return o.isNumericSchema()?Number(r):o.isBigIntegerSchema()?BigInt(r):o.isBigDecimalSchema()?new K(r,"bigDecimal"):o.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??pe)((this.serdeContext?.base64Decoder??ge)(e))}}});var eo,Jg=h(()=>{W();D();dn();ul();eo=class extends ye{codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new Zr(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let o=x.of(e),n=o.getMergedTraits(),s=this.serdeContext?.utf8Encoder??pe;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(o,s(r));if(n.httpPayload){if(o.isBlobSchema()){let i=this.serdeContext?.utf8Decoder??Vt;return typeof r=="string"?i(r):r}else if(o.isStringSchema())return"byteLength"in r?s(r):r}return this.codecDeserializer.read(o,r)}}});var un,ll=h(()=>{W();D();dn();Jr();un=class extends ye{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let o=x.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${o.getName(!0)}`);switch(Ce(o,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=yt(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(o.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??le)(r);return}if(o.isListSchema()&&Array.isArray(r)){let i="";for(let a of r){this.write([o.getValueSchema(),o.getMergedTraits()],a);let c=this.flush(),d=o.getValueSchema().isTimestampSchema()?c:Lg(c);i!==""&&(i+=", "),i+=d}this.stringBuffer=i;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let n=o.getMergedTraits().mediaType,s=r;if(n&&((n==="application/json"||n.endsWith("+json"))&&(s=ot.from(s)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??le)(s.toString());return}this.stringBuffer=r;break;default:o.isIdempotencyToken()?this.stringBuffer=st():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}});var to,Zg=h(()=>{W();ll();to=class{codecSerializer;stringSerializer;buffer;constructor(e,r,o=new un(r)){this.codecSerializer=e,this.stringSerializer=o}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let o=x.of(e),n=o.getMergedTraits();if(n.httpHeader||n.httpLabel||n.httpQuery){this.stringSerializer.write(o,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}});var eS,ga,tS=h(()=>{eS=Ee(Ku()),ga=class{name;kind;values;constructor({name:e,kind:r=eS.FieldPosition.HEADER,values:o=[]}){this.name=e,this.kind=r,this.values=o}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}}});var Sa,rS=h(()=>{Sa=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}}});var Xt,Yt,oS=h(()=>{Xt=t=>(t.logger&&t.logger.constructor?.name!=="NoOpLogger"&&t.requestHandler?.updateHttpClientConfig?.(Symbol.for("logger"),t.logger),{setHttpHandler(e){t.requestHandler=e},httpHandler(){return t.requestHandler},updateHttpClientConfig(e,r){t.requestHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.requestHandler.httpHandlerConfigs()}}),Yt=t=>({requestHandler:t.httpHandler()})});function fl(t){return e=>async r=>{let o=r.request;if(V.isInstance(o)){let{body:n,headers:s}=o;if(n&&Object.keys(s).map(i=>i.toLowerCase()).indexOf(nS)===-1)try{let i=t(n);i!=null&&(o.headers={...o.headers,[nS]:String(i)})}catch{}}return e({...r,request:o})}}var nS,ml,Qt,sS=h(()=>{re();nS="content-length";ml={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Qt=t=>({applyToStack:e=>{e.add(fl(t.bodyLengthChecker),ml)}})});var ro,bP,Ea=h(()=>{ro=t=>encodeURIComponent(t).replace(/[!'()*]/g,bP),bP=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var iS,aS=h(()=>{Ea();iS=t=>t.split("/").map(ro).join("/")});function ya(t){let e=[];for(let r of Object.keys(t).sort()){let o=t[r];if(r=ro(r),Array.isArray(o))for(let n=0,s=o.length;n<s;n++)e.push(`${r}=${ro(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${ro(o)}`),e.push(n)}}return e.join("&")}var cS=h(()=>{Ea()});var He,ko=h(()=>{He=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});var ln,pl=h(()=>{ln=class{from;to;keys;constructor(e,r){this.from=e,this.to=r;let o=Object.keys(this.from),n=new Set(o);n.delete("__type"),this.keys=n}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}}});function Ca(){if(ss===void 0)try{if(typeof Buffer!="function")ss=!1;else{let t=JSON.parse(Buffer.from([123,125]));ss=t!==null&&typeof t=="object"}}catch{ss=!1}return ss}var ss,hl=h(()=>{});function fn(t,e,r){if(r?.source){let o=r.source;if(typeof e=="number")return e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER?OP(o,e)?e:new K(o,"bigDecimal"):NP(o)?new K(o,"bigDecimal"):/[eE]/.test(o)?DP(o):BigInt(o)}return e}function NP(t){let e=t.indexOf(".");if(e===-1)return!1;let r=t.search(/[eE]/);if(r===-1)return!0;let o=r-e-1;return parseInt(t.slice(r+1),10)<o}function OP(t,e){if(t===String(e)||Object.is(e,-0))return!0;if(/[eE]/.test(t))return gl(t)===gl(String(e));let r=t.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,""),o=String(e);return r===o?!0:/[eE]/.test(o)?r===gl(o):!1}function gl(t){let e=t.startsWith("-"),r=e?t.slice(1):t,o=r.search(/[eE]/),n;if(o===-1)n=r;else{let s=parseInt(r.slice(o+1),10),i=r.slice(0,o),a=i.indexOf("."),c,d;a===-1?(c=i,d=i.length):(c=i.slice(0,a)+i.slice(a+1),d=a),c=c.replace(/0+$/,"")||"0";let u=d+s;c==="0"?n="0":u<=0?n="0."+"0".repeat(-u)+c:u>=c.length?n=c+"0".repeat(u-c.length):n=c.slice(0,u)+"."+c.slice(u)}return n.includes(".")&&(n=n.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"")),(e?"-":"")+n}function DP(t){let e=t.search(/[eE]/),r=parseInt(t.slice(e+1),10),o=t.startsWith("-"),n=t.slice(o?1:0,e),s=n.indexOf("."),i,a;if(s===-1)i=n,a=r;else{i=n.slice(0,s)+n.slice(s+1);let d=n.length-s-1;a=r-d}i=i.replace(/0+$/,"")||"0";let c=BigInt(i)*10n**BigInt(a+(n.replace(".","").length-i.length));return o?-c:c}var _a=h(()=>{D()});function mn(t){let e=x.of(t),r=e.getSchema();if(Array.isArray(r)&&e.isStructSchema()){if(Sl in r)return r[Sl];let o=Ta(e,new Set);return r[Sl]=o,o}return Ta(e,new Set)}function Ta(t,e){let r=t.getSchema();if(e.has(r))return!1;if(e.add(r),t.isBigIntegerSchema()||t.isBigDecimalSchema())return!0;if(t.isStructSchema()){for(let[,o]of t.structIterator())if(Ta(o,e))return!0}else if(t.isListSchema()||t.isMapSchema()){if(Ta(t.getValueSchema(),e))return!0}else if(t.isDocumentSchema())return!0;return!1}var Sl,Aa=h(()=>{W();Sl=Symbol.for("@aws-sdk/reviver")});var dS,uS=h(()=>{cn();D();dS=(t,e)=>Se(t,e).then(r=>(e?.utf8Encoder??pe)(r))});async function Tr(t,e,r){let o;if(Ca()&&typeof t?.[Symbol.asyncIterator]=="function"){let s=await Se(t,e);typeof Buffer=="function"&&(Buffer.isBuffer(s)?o=s:o=Buffer.from(s.buffer,s.byteOffset,s.byteLength))}if(o||(o=await dS(t,e)),o.length===0)return{};let n=r&&mn(r)?fn:void 0;try{return JSON.parse(o,n)}catch(s){throw s?.name==="SyntaxError"&&Object.defineProperty(s,"$responseBodyText",{value:typeof o=="string"?o:o.toString("utf8")}),s}}var wa,lS,El,pn,hn,Ra,fS,is=h(()=>{cn();uS();hl();_a();Aa();wa=async(t,e)=>{let r=await Tr(t,e);return r.message=r.message??r.Message,r},lS=(t,e)=>Object.keys(t).find(r=>r.toLowerCase()===e.toLowerCase()),El=t=>{let e=t;return typeof e=="number"&&(e=e.toString()),e.indexOf(",")>=0&&(e=e.split(",")[0]),e.indexOf(":")>=0&&(e=e.split(":")[0]),e.indexOf("#")>=0&&(e=e.split("#")[1]),e},pn=(t,e)=>fS(t,e,["header","code","type"]),hn=(t,e,r=!1)=>fS(t,e,r?["code","header","type"]:["type","code","header"]),Ra=(t,e)=>{if(e?.__type!==void 0){let r=e.__type;return typeof r=="number"&&(r=r.toString()),r.indexOf(",")>=0&&(r=r.split(",")[0]),r.indexOf(":")>=0&&(r=r.split(":")[0]),r}},fS=({headers:t},e,r)=>{for(;r.length>0;)switch(r.shift()){case"header":let n=lS(t??{},"x-amzn-errortype");if(n!==void 0)return El(t[n]);break;case"code":let s=lS(e??{},"code");if(s&&e[s]!==void 0)return El(e[s]);break;case"type":if(e?.__type!==void 0)return El(e.__type);break}}});function Jt(t){Object.defineProperty(t,"__proto__",{value:void 0,writable:!0,enumerable:!0,configurable:!0})}var xa=h(()=>{});var oo,yl=h(()=>{Jr();W();D();ko();pl();hl();_a();Aa();is();xa();re();oo=class extends He{settings;constructor(e){super(),this.settings=e}async read(e,r){let o=mn(e)?fn:void 0,n;if(typeof r=="string"){if(r.length===0)return{};n=JSON.parse(r,o)}else if(r instanceof Uint8Array&&Ca()){if(r.byteLength===0)return{};let s=Buffer.isBuffer(r)?r:Buffer.from(r.buffer,r.byteOffset,r.byteLength);n=JSON.parse(s,o)}else n=await Tr(r,this.serdeContext,e);return this._read(e,n)}readObject(e,r){return this._read(e,r)}_read(e,r){let o=r!==null&&typeof r=="object",n=x.of(e);if(o){if(n.isStructSchema())return this._readStruct(n,r);if(Array.isArray(r)&&n.isListSchema()){let i=n.getValueSchema();if(this.needsTransform(i))for(let a=0;a<r.length;++a)r[a]=this._read(i,r[a]);return r}if(n.isMapSchema()){let i=n.getValueSchema(),a=r;if(this.needsTransform(i))for(let c in a)H(a,c)&&(c==="__proto__"&&Jt(a),a[c]=this._read(i,a[c]));return a}}if(n.isBlobSchema()&&typeof r=="string")return ge(r);let s=n.getMergedTraits().mediaType;if(n.isStringSchema()&&typeof r=="string"&&s)return s==="application/json"||s.endsWith("+json")?ot.from(r):r;if(n.isTimestampSchema()&&r!=null)switch(Ce(n,this.settings)){case 5:return aa(r);case 6:return sn(r);case 7:return ca(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(n.isBigDecimalSchema()&&r!=null){if(r instanceof K)return r;let i=r;return i.type==="bigDecimal"&&"string"in i?new K(i.string,i.type):new K(String(r),"bigDecimal")}if(n.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(n.isDocumentSchema()&&o)if(Array.isArray(r))for(let i=0;i<r.length;++i){let a=r[i];a instanceof K||(r[i]=this._read(n,a))}else{let i=r;for(let a in i){if(!H(i,a))continue;a==="__proto__"&&Jt(i);let c=i[a];c instanceof K||(i[a]=this._read(n,c))}}return r}_readStruct(e,r){let o=e.isUnionSchema(),n={},s,i=typeof r.__type=="string",{jsonName:a}=this.settings;a&&i&&(s={});let c;o&&(c=new ln(r,n));for(let[d,u]of e.structIterator()){let l=d;a&&(l=u.getMergedTraits().jsonName??l,i&&(s[l]=d)),o&&c.mark(l),r[l]!=null&&(n[d]=this._read(u,r[l]))}if(o)c.writeUnknown();else if(i)for(let d in r){if(!H(r,d))continue;let u=r[d],l=a?s[d]??d:d;l in n||(n[l]=u)}return n}needsTransform(e){return!!(e.isBlobSchema()||e.isTimestampSchema()||e.isBigIntegerSchema()||e.isBigDecimalSchema()||e.isNumericSchema()||e.isDocumentSchema()||e.isStructSchema()||e.isListSchema()||e.isMapSchema()||e.isStringSchema()&&e.getMergedTraits().mediaType)}}});var Ia,mS,pS=h(()=>{D();Ia=class t extends Uint8Array{string=null;static allocUnsafe(e){if(typeof Buffer=="function"){let r=Buffer.allocUnsafe(e);return new t(r.buffer,r.byteOffset,r.byteLength)}return new t(e)}toString(){return this.s()}valueOf(){return this.s()}includes(e,r){return typeof e=="string"?this.s().includes(e,r):Uint8Array.prototype.includes.call(this,e,r)}indexOf(e,r){return typeof e=="string"?this.s().indexOf(e,r):Uint8Array.prototype.indexOf.call(this,e,r)}lastIndexOf(e,r){if(typeof e=="string")return this.s().lastIndexOf(e,r);let o=Uint8Array.prototype.lastIndexOf;return r!==void 0?o.call(this,e,r):o.call(this,e)}startsWith(e,r){return this.s().startsWith(e,r)}endsWith(e,r){return this.s().endsWith(e,r)}match(e){return this.s().match(e)}replace(e,r){return this.s().replace(e,r)}search(e){return this.s().search(e)}split(e,r){return this.s().split(e,r)}substring(e,r){return this.s().substring(e,r)}trim(){return this.s().trim()}trimStart(){return this.s().trimStart()}trimEnd(){return this.s().trimEnd()}charAt(e){return this.s().charAt(e)}charCodeAt(e){return this.s().charCodeAt(e)}padStart(e,r){return this.s().padStart(e,r)}padEnd(e,r){return this.s().padEnd(e,r)}repeat(e){return this.s().repeat(e)}toUpperCase(){return this.s().toUpperCase()}toLowerCase(){return this.s().toLowerCase()}s(){if(this.string==null){let e=Date.now();e>mS+6e4&&(console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. It has been automatically converted to string. In a future version this will throw an error."),mS=e),this.string=pe(this)}return this.string}},mS=0});function Cl(t){return Ia.allocUnsafe(t)}var va,hS,gS,MP,$P,gn,ka,Pa,SS,LP,UP,BP,Zt,ES,no,_l=h(()=>{Jr();W();D();ko();re();pS();va=new TextEncoder,hS=123,gS=125,MP=91,$P=93,gn=34,ka=58,Pa=44,SS=92,LP=new Uint8Array([116,114,117,101]),UP=new Uint8Array([102,97,108,115,101]),BP=new Uint8Array([110,117,108,108]),Zt=new Array(128).fill(null);Zt[8]="b";Zt[9]="t";Zt[10]="n";Zt[12]="f";Zt[13]="r";Zt[34]='"';Zt[92]="\\";for(let t=0;t<32;t++)Zt[t]===null&&(Zt[t]="u00"+t.toString(16).padStart(2,"0"));ES=2048;no=class t extends He{settings;json;i=0;rootSchema;rawValue;passthrough=!1;constructor(e){super(),this.settings=e,this.json=Cl(ES)}write(e,r){this.i=0,this.rawValue=r,this.rootSchema=x.of(e),this.passthrough=this.rootSchema.isBlobSchema()||this.rootSchema.isStringSchema(),this.passthrough||this.writeValue(this.rootSchema,r,void 0)}writeDiscriminatedDocument(e,r){this.i=0,this.rootSchema=x.of(e);let o=this.rootSchema;if(o.isStructSchema()&&r!=null&&typeof r=="object"){this.writeValue(o,r,void 0);let n=`"__type":"${o.getName(!0)??"Unknown"}",`,s=n.length;this.ensure(s),this.json.copyWithin(1+s,1,this.i),va.encodeInto(n,this.json.subarray(1)),this.i+=s}else this.writeValue(o,r,void 0)}flush(){this.rootSchema=void 0;let e=this.i;this.i=0;let r=this.rawValue;if(this.rawValue=void 0,e===0)return r;let o=this.json.subarray(0,e);return this.json=Cl(ES),o}ensure(e){let{i:r,json:o}=this;if(r+e>o.length){let n=o.length*2;for(;n<r+e;)n*=2;let s=Cl(n);s.set(this.json),this.json=s}}writeAscii(e){let r=e.length;this.ensure(r);let{i:o,json:n}=this;for(let s=0;s<r;++s)n[o]=e.charCodeAt(s),o+=1;this.i=o}writeAsciiQuoted(e){let r=e.length;this.ensure(r+4);let{json:o,i:n}=this;o[n++]=gn;for(let s=0;s<r;++s)o[n++]=e.charCodeAt(s);o[n++]=gn,this.i=n}writeJsonString(e){let r=e.length;this.ensure(r*3+2),this.json[this.i++]=gn;for(let o=0;o<r;++o){let n=e.charCodeAt(o);if(n>34&&n<92)this.json[this.i++]=n;else if(n<128){let s=Zt[n];if(s!==null){this.ensure(s.length+1+(r-o-1)*3+1),this.json[this.i++]=SS;for(let i=0;i<s.length;i++)this.json[this.i++]=s.charCodeAt(i)}else this.json[this.i++]=n}else if(n>=55296&&n<=56319){let s=o+1<r?e.charCodeAt(o+1):0;if(s>=56320&&s<=57343){this.ensure(4);let{written:i}=va.encodeInto(e.substring(o,o+2),this.json.subarray(this.i));this.i+=i,++o}else this.ensure(6+(r-o-1)*3+1),this.writeUnicodeEscape(n)}else if(n>=56320&&n<=57343)this.ensure(6+(r-o-1)*3+1),this.writeUnicodeEscape(n);else{let{i:s,json:i}=this;n<2048?(i[s++]=192|n>>6,i[s++]=128|n&63):(i[s++]=224|n>>12,i[s++]=128|n>>6&63,i[s++]=128|n&63),this.i=s}}this.json[this.i++]=gn}writeUnicodeEscape(e){let{json:r,i:o}=this;r[o++]=SS,r[o++]=117;let n=e.toString(16).padStart(4,"0");for(let s=0;s<4;++s)r[o++]=n.charCodeAt(s);this.i=o}static B64=(()=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(64);for(let o=0;o<64;++o)r[o]=e.charCodeAt(o);return r})();writeBase64(e){let r=Math.ceil(e.length/3)*4;this.ensure(r+2);let o=this.json,n=t.B64,s=this.i;o[s++]=gn;let i=e.length,a=i%3,c=i-a;for(let d=0;d<c;d+=3){let u=e[d],l=e[d+1],m=e[d+2];o[s++]=n[u>>2],o[s++]=n[(u&3)<<4|l>>4],o[s++]=n[(l&15)<<2|m>>6],o[s++]=n[m&63]}if(a===2){let d=e[c],u=e[c+1];o[s++]=n[d>>2],o[s++]=n[(d&3)<<4|u>>4],o[s++]=n[(u&15)<<2],o[s++]=61}else if(a===1){let d=e[c];o[s++]=n[d>>2],o[s++]=n[(d&3)<<4],o[s++]=61,o[s++]=61}o[s++]=gn,this.i=s}writeValue(e,r,o){if(r==null){if(o?.isStructSchema()){if(r===void 0&&x.of(e).isIdempotencyToken()){this.writeAsciiQuoted(st());return}return}this.ensure(4),this.json.set(BP,this.i),this.i+=4;return}let n=x.of(e),s=typeof r=="object";if(n.isStringSchema()){let i=n.getMergedTraits().mediaType;if(i&&(i==="application/json"||i.endsWith("+json"))){this.writeJsonString(ot.from(r).toString());return}}if(this.settings.bigNumberAsString&&r!=null&&(n.isBigIntegerSchema()||n.isBigDecimalSchema())){let i=r instanceof K?r.string:String(r);this.writeAsciiQuoted(i);return}if(s){if(n.isStructSchema()){this.writeStruct(n,r);return}if(Array.isArray(r)&&(n.isListSchema()||n.isDocumentSchema())){this.writeList(n,r,n.isDocumentSchema());return}if(n.isMapSchema()){this.writeMap(n,r,!1);return}if(r instanceof Uint8Array&&(n.isBlobSchema()||n.isDocumentSchema())){this.writeBase64(r);return}if(r instanceof Date&&(n.isTimestampSchema()||n.isDocumentSchema())){this.writeTimestamp(n,r);return}if(r instanceof K){this.writeAscii(r.string);return}if(n.isDocumentSchema()){Array.isArray(r)?this.writeList(n,r,!0):this.writeMap(n,r,!0);return}let i=JSON.stringify(r);this.writeAscii(i);return}if(typeof r=="string"){if(n.isBlobSchema()){let i=(this.serdeContext?.base64Encoder??le)(r);this.writeAsciiQuoted(i);return}this.writeJsonString(r);return}if(typeof r=="number"){if(Math.abs(r)===1/0||Number.isNaN(r)){this.writeAsciiQuoted(String(r));return}let i=String(r);this.writeAscii(i);return}if(typeof r=="boolean"){this.ensure(5);let{i,json:a}=this;r?(a.set(LP,i),i+=4):(a.set(UP,i),i+=5),this.i=i;return}if(typeof r=="bigint"){this.writeAscii(r.toString());return}this.writeAscii(String(r))}writeStruct(e,r){this.ensure(2),this.json[this.i++]=hS;let o=!1,n=typeof r.__type=="string",s;n&&(s=new Set);for(let[i,a]of e.structIterator()){let c=r[i];if(c==null&&!a.isIdempotencyToken())continue;o&&(this.ensure(1),this.json[this.i++]=Pa),o=!0;let d=this.settings.jsonName?a.getMergedTraits().jsonName??i:i;s&&(s.add(i),s.add(d)),this.writeAsciiQuoted(d),this.json[this.i++]=ka,this.writeValue(a,c,e)}if(!o&&e.isUnionSchema()){let{$unknown:i}=r;if(Array.isArray(i)){let[a,c]=i;this.writeAsciiQuoted(a),this.ensure(1),this.json[this.i++]=ka,this.writeValue(15,c,e)}}else if(n)for(let i in r){if(s.has(i))continue;s.add(i);let a=r[i];o&&(this.ensure(1),this.json[this.i++]=Pa),o=!0,this.writeAsciiQuoted(i),this.ensure(1),this.json[this.i++]=ka,this.writeValue(15,a,void 0)}this.ensure(1),this.json[this.i++]=gS}writeList(e,r,o){let n=!!e.getMergedTraits().sparse,s=e.getValueSchema();if(!o&&(s.isStringSchema()||s.isNumericSchema()||s.isBooleanSchema())){let a=!1;for(let d=0;d<r.length;++d){let u=r[d];if(Number.isNaN(u)||u===1/0||u===-1/0||u==null&&!n){a=!0;break}}let c;if(!a)c=JSON.stringify(r);else{let d=[];for(let u=0;u<r.length;++u){let l=r[u];l==null&&!n||(Number.isNaN(l)||l===1/0||l===-1/0?d.push(String(l)):d.push(l))}c=JSON.stringify(d)}this.ensure(c.length*3),this.i+=va.encodeInto(c,this.json.subarray(this.i)).written;return}this.ensure(2),this.json[this.i++]=MP;let i=!1;for(let a=0;a<r.length;++a){let c=r[a];(o?c===void 0:c==null&&!n)||(i&&(this.ensure(1),this.json[this.i++]=Pa),this.writeValue(s,c,void 0),i=!0)}this.ensure(1),this.json[this.i++]=$P}writeMap(e,r,o){let n=!!e.getMergedTraits().sparse,s=e.getValueSchema();if(!o&&(s.isStringSchema()||s.isNumericSchema()||s.isBooleanSchema())){let a;for(let d in r){if(!H(r,d))continue;let u=r[d];Number.isNaN(u)||u===1/0||u===-1/0?((a??={})[d]=u,r[d]=String(u)):u===null&&!n&&((a??={})[d]=null,r[d]=void 0)}let c=JSON.stringify(r);a&&Object.assign(r,a),this.ensure(c.length*3),this.i+=va.encodeInto(c,this.json.subarray(this.i)).written;return}this.ensure(2),this.json[this.i++]=hS;let i=!0;for(let a in r){if(!H(r,a))continue;let c=r[a];(o?c===void 0:c==null&&!n)||(i||(this.ensure(1),this.json[this.i++]=Pa),i=!1,this.writeJsonString(a),this.ensure(1),this.json[this.i++]=ka,this.writeValue(s,c,void 0))}this.ensure(1),this.json[this.i++]=gS}writeTimestamp(e,r){switch(Ce(e,this.settings)){case 5:{let n=r.toISOString().replace(".000Z","Z");this.writeAsciiQuoted(n);return}case 6:{this.writeAsciiQuoted(yt(r));return}case 7:{let n=String(r.getTime()/1e3);this.writeAscii(n);return}default:{let n=String(r.getTime()/1e3);this.writeAscii(n);return}}}}});var it,Tl=h(()=>{ko();yl();_l();it=class extends He{settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new no(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new oo(this.settings);return e.setSerdeContext(this.serdeContext),e}}});var ba,yS=h(()=>{cl();W();Tl();is();ba=class extends Qr{codec=new it({timestampFormat:{useTrait:!1,default:7},jsonName:!1,bigNumberAsString:!0});serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();getShapeId(){return"smithy.protocols#rpcv2Json"}getPayloadCodec(){return this.codec}getSmithyProtocolHeaderValue(){return"rpc-v2-json"}applyEmptyBody(e){e.body||(e.body="{}")}async handleError(e,r,o,n,s){let i=Ra(o,n)??"Unknown",a={$metadata:s,$fault:o.statusCode<=500?"client":"server"},c=this.options.defaultNamespace;i.includes("#")&&([c]=i.split("#"));let d=this.compositeErrorRegistry,u=ie.for(c);d.copyFrom(u);let l;try{l=d.getSchema(i)}catch{n.Message&&(n.message=n.Message);let w=ie.for("smithy.ts.sdk.synthetic."+c);d.copyFrom(w);let I=d.getBaseException();if(I){let b=d.getErrorCtor(I);throw Object.assign(new b({name:i}),a,n)}throw Object.assign(new Error(i),a,n)}let m=x.of(l),g=d.getErrorCtor(l),S=n.message??n.Message??"Unknown",E=new g({}),C={},y=this.codec.createDeserializer();for(let[T,w]of m.structIterator())n[T]!=null&&(C[T]=y.readObject(w,n[T]));throw Object.assign(E,a,{$fault:m.getMergedTraits().error,message:S},C)}getDefaultContentType(){return"application/json"}}});var so,Al=h(()=>{Jr();W();D();D();re();ko();pl();_a();Aa();is();xa();so=class extends He{settings;constructor(e){super(),this.settings=e}async read(e,r){let o=mn(e)?fn:void 0;return this._read(e,typeof r=="string"?JSON.parse(r,o):await Tr(r,this.serdeContext,e))}readObject(e,r){return this._read(e,r)}_read(e,r){let o=r!==null&&typeof r=="object",n=x.of(e);if(o){if(n.isStructSchema()){let i=r,a=n.isUnionSchema(),c={},d,{jsonName:u}=this.settings;u&&(d={});let l;a&&(l=new ln(i,c));for(let[m,g]of n.structIterator()){let S=m;u&&(S=g.getMergedTraits().jsonName??S,d[S]=m),a&&l.mark(S),i[S]!=null&&(c[m]=this._read(g,i[S]))}if(a)l.writeUnknown();else if(typeof i.__type=="string")for(let m in i){if(!H(i,m))continue;let g=i[m],S=u?d[m]??m:m;S in c||(c[S]=g)}return c}if(Array.isArray(r)&&n.isListSchema()){let i=n.getValueSchema(),a=[];for(let c of r)a.push(this._read(i,c));return a}if(n.isMapSchema()){let i=n.getValueSchema(),a={};for(let c in r)H(r,c)&&(c==="__proto__"&&Jt(a),a[c]=this._read(i,r[c]));return a}}if(n.isBlobSchema()&&typeof r=="string")return ge(r);let s=n.getMergedTraits().mediaType;if(n.isStringSchema()&&typeof r=="string"&&s)return s==="application/json"||s.endsWith("+json")?ot.from(r):r;if(n.isTimestampSchema()&&r!=null)switch(Ce(n,this.settings)){case 5:return aa(r);case 6:return sn(r);case 7:return ca(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(n.isBigDecimalSchema()&&r!=null){if(r instanceof K)return r;let i=r;return i.type==="bigDecimal"&&"string"in i?new K(i.string,i.type):new K(String(r),"bigDecimal")}if(n.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(n.isDocumentSchema())if(o){let i=Array.isArray(r)?[]:{};for(let a in r){if(!H(r,a))continue;a==="__proto__"&&Jt(i);let c=r[a];c instanceof K?i[a]=c:i[a]=this._read(n,c)}return i}else return structuredClone(r);return r}}});var CS,Na,_S=h(()=>{D();CS="\u039D",Na=class{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,r)=>{if(r instanceof K){let o=`${CS+"nv"+this.counter++}_`+r.string;return this.values.set(`"${o}"`,r.string),o}if(typeof r=="bigint"){let o=r.toString(),n=`${CS+"b"+this.counter++}_`+o;return this.values.set(`"${n}"`,o),n}return r}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(let[r,o]of this.values)e=e.replace(r,o);return e}}});var io,wl=h(()=>{Jr();W();D();ko();_S();xa();re();io=class extends He{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,r){this.rootSchema=x.of(e),this.buffer=this._write(this.rootSchema,r)}flush(){let{rootSchema:e,useReplacer:r}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!r)return JSON.stringify(this.buffer);let o=new Na;return o.replaceInJson(JSON.stringify(this.buffer,o.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(e,r){this.write(e,r),typeof this.buffer=="object"&&(this.buffer.__type=x.of(e).getName(!0))}_write(e,r,o){let n=r!==null&&typeof r=="object",s=x.of(e);if(n){if(s.isStructSchema()){let i=r,a={},{jsonName:c}=this.settings,d;c&&(d={});let u=0;for(let[l,m]of s.structIterator()){let g=this._write(m,i[l],s);if(g!==void 0){let S=l;c&&(S=m.getMergedTraits().jsonName??l,d[l]=S),a[S]=g,u++}}if(s.isUnionSchema()&&u===0){let{$unknown:l}=i;if(Array.isArray(l)){let[m,g]=l;m==="__proto__"&&Jt(a),a[m]=this._write(15,g)}}else if(typeof i.__type=="string")for(let l in i){if(!H(i,l))continue;let m=i[l],g=c?d[l]??l:l;g in a||(a[g]=this._write(15,m))}return a}if(Array.isArray(r)&&s.isListSchema()){let i=s.getValueSchema(),a=[],c=!!s.getMergedTraits().sparse;for(let d of r)(c||d!=null)&&a.push(this._write(i,d));return a}if(s.isMapSchema()){let i=s.getValueSchema(),a={},c=!!s.getMergedTraits().sparse;for(let d in r){if(!H(r,d))continue;let u=r[d];(c||u!=null)&&(d==="__proto__"&&Jt(a),a[d]=this._write(i,u))}return a}if(r instanceof Uint8Array&&s.isBlobSchema())return s===this.rootSchema?r:(this.serdeContext?.base64Encoder??le)(r);if(r instanceof Date&&(s.isTimestampSchema()||s.isDocumentSchema()))switch(Ce(s,this.settings)){case 5:return r.toISOString().replace(".000Z","Z");case 6:return yt(r);case 7:return r.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",r),r.getTime()/1e3}r instanceof K&&(this.useReplacer=!0)}if(!(r===null&&o?.isStructSchema())){if(s.isStringSchema()){if(typeof r>"u"&&s.isIdempotencyToken())return st();let i=s.getMergedTraits().mediaType;return r!=null&&i&&(i==="application/json"||i.endsWith("+json"))?ot.from(r):r}if(typeof r=="number")return Math.abs(r)===1/0||isNaN(r)?String(r):r;if(typeof r=="string"&&s.isBlobSchema())return s===this.rootSchema?r:(this.serdeContext?.base64Encoder??le)(r);if(typeof r=="bigint"&&(this.useReplacer=!0),s.isDocumentSchema())if(n){if(r instanceof Uint8Array)return(this.serdeContext?.base64Encoder??le)(r);let i=Array.isArray(r)?[]:{};for(let a in r){if(!H(r,a))continue;let c=r[a];a==="__proto__"&&Jt(i),c instanceof K?(this.useReplacer=!0,i[a]=c):i[a]=this._write(s,c)}return i}else return structuredClone(r);return r}}}});var Sn,TS=h(()=>{ko();Al();wl();Sn=class extends He{settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new io(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new so(this.settings);return e.setSerdeContext(this.serdeContext),e}}});var at={};St(at,{AbstractRpcV2Protocol:()=>Qr,Field:()=>ga,Fields:()=>Sa,FromStringShapeDeserializer:()=>Zr,HttpBindingProtocol:()=>Yr,HttpInterceptingShapeDeserializer:()=>eo,HttpInterceptingShapeSerializer:()=>to,HttpProtocol:()=>Xr,HttpRequest:()=>V,HttpResponse:()=>Et,JsonCodec:()=>Sn,JsonCodec2:()=>it,JsonShapeDeserializer:()=>so,JsonShapeDeserializer2:()=>oo,JsonShapeSerializer:()=>io,JsonShapeSerializer2:()=>no,RequestBuilder:()=>ns,RpcProtocol:()=>Kt,SerdeContext:()=>ye,SmithyRpcV2JsonProtocol:()=>ba,ToStringShapeSerializer:()=>un,buildQueryString:()=>ya,collectBody:()=>Se,contentLengthMiddleware:()=>fl,contentLengthMiddlewareOptions:()=>ml,determineTimestampFormat:()=>Ce,escapeUri:()=>ro,escapeUriPath:()=>iS,extendedEncodeURIComponent:()=>Tt,getContentLengthPlugin:()=>Qt,getHttpHandlerExtensionConfiguration:()=>Xt,isValidHostname:()=>na,loadJsonRpcErrorCode:()=>hn,loadRestJsonErrorCode:()=>pn,loadSmithyRpcV2JsonErrorCode:()=>Ra,parseJsonBody:()=>Tr,parseJsonErrorBody:()=>wa,parseQueryString:()=>Mg,parseUrl:()=>tt,requestBuilder:()=>ha,resolveHttpHandlerRuntimeConfig:()=>Yt,resolvedPath:()=>pa});var P=h(()=>{cn();fa();Yg();ma();al();cl();Qg();dl();ul();Jg();Zg();ll();Jr();dn();tS();rS();re();re();re();oS();sS();Ea();aS();cS();re();re();yS();is();TS();wl();Al();Tl();_l();yl()});var AS,wS,RS,xS,IS,vS,kS=h(()=>{AS=["AccessDeniedException","AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],wS=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],RS=["TimeoutError","RequestTimeout","RequestTimeoutException"],xS=[500,502,503,504],IS=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],vS=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"]});function Il(t){return t.code==="ERR_HTTP2_STREAM_ERROR"&&t.message.includes("NGHTTP2_REFUSED_STREAM")}var as,Oa,Rl,xl,er,ao,Da,En=h(()=>{kS();as=t=>t?.$retryable!==void 0,Oa=t=>AS.includes(t.name),Rl=t=>t.$metadata?.clockSkewCorrected,xl=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},er=t=>t.$metadata?.httpStatusCode===429||wS.includes(t.name)||t.$retryable?.throttling==!0,ao=(t,e=0)=>t?.name!=="AbortError"&&(as(t)||Rl(t)||t.name==="InvalidSignatureException"&&t.message?.includes("Signature expired")||RS.includes(t.name)||IS.includes(t?.code||"")||vS.includes(t?.code||"")||xS.includes(t.$metadata?.httpStatusCode||0)||xl(t)||Il(t)||t.cause!==void 0&&e<=10&&ao(t.cause,e+1)),Da=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!ao(t)}return!1}});var Ma,cs,$a,yn,vl,kl,La,co,uo,ds=h(()=>{Ma=100,cs=2e4,$a=500,yn=500,vl=5,kl=10,La=1,co="amz-sdk-invocation-id",uo="amz-sdk-request"});function Pl(t,e){if(Et.isInstance(t))for(let r in t.headers){if(!H(t.headers,r))continue;let o=r.toLowerCase();if(o==="retry-after"){let n=t.headers[r],s=NaN;if(n.endsWith("GMT"))try{s=(sn(n).getTime()-Date.now())/1e3}catch(i){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(i)}else n.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?s=Number(n.match(/ GMT, ([\d.]+)$/)?.[1]):n.match(/^((\d+)|(\d+\.\d+))$/)?s=Number(n):Date.parse(n)>=Date.now()&&(s=(Date.parse(n)-Date.now())/1e3);return isNaN(s)?void 0:new Date(Date.now()+s*1e3)}else if(o==="x-amz-retry-after"){let n=t.headers[r],s=Number(n);if(isNaN(s)){e?.trace?.(`Failed to parse x-amz-retry-after=${n}`);return}return new Date(Date.now()+s)}}}function PS(t,e){return Pl(t,e)}var bl=h(()=>{re();P();D()});var Ua,Nl=h(()=>{Ua=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`)});function Ol(t){return e=>(r,o)=>async n=>{let s=await e.retryStrategy(),i=await e.maxAttempts();if(FP(s)){s=s;let a=await s.acquireInitialRetryToken((o.partition_id??"")+(o.__retryLongPoll?":longpoll":"")),c=new Error,d=0,u=0,{request:l}=n,m=V.isInstance(l);for(m&&(l.headers[co]=la());;)try{m&&(l.headers[uo]=`attempt=${d+1}; max=${i}`);let{response:g,output:S}=await r(n);return s.recordSuccess(a),S.$metadata.attempts=d+1,S.$metadata.totalRetryDelay=u,{response:g,output:S}}catch(g){let S=HP(g,e.logger);if(c=Ua(g),m&&t(l))throw(o.logger instanceof qt?console:o.logger)?.warn("An error was encountered in a non-retryable streaming request."),c;try{a=await s.refreshRetryTokenForRetry(a,S)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=d+1,c.$metadata.totalRetryDelay=u,c}d=a.getRetryCount();let E=a.getRetryDelay();u+=(a?.$retryLog?.acquisitionDelay??0)+E,E>0&&await GP(E)}}else return s=s,s?.mode&&(o.userAgent=[...o.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(r,n)}}function bS(t){let e=Ol(t);return r=>({applyToStack:o=>{o.add(e(r),Dl)}})}var GP,FP,HP,zP,Dl,Ml=h(()=>{M();P();D();En();ds();bl();Nl();GP=t=>new Promise(e=>setTimeout(e,t)),FP=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",HP=(t,e)=>{let r={error:t,errorType:zP(t)},o=Pl(t.$response,e);return o&&(r.retryAfterHint=o),r},zP=t=>er(t)?"THROTTLING":ao(t)?"TRANSIENT":Da(t)?"SERVER_ERROR":"CLIENT_ERROR",Dl={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0}});var lo,Ba=h(()=>{En();lo=class t{static setTimeoutFn=(e,r)=>setTimeout(e,r);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let r;this.updateMeasuredRate();let o=e;if(o?.errorType==="THROTTLING"||er(o?.error??e)){let i=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=i,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(i),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let s=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(s)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){let r=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(o=>t.setTimeoutFn(o,r)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+r),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let o=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(o*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var fe,Cn=h(()=>{fe=class t{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return t.v2026?50:100}static throttlingDelay(){return t.v2026?1e3:500}static cost(){return t.v2026?14:5}static throttlingCost(){return t.v2026?5:10}static modifiedCostType(){return t.v2026?"THROTTLING":"TRANSIENT"}}});var Ga,NS=h(()=>{Cn();Ga=class{x=fe.delay();computeNextBackoffDelay(e){let n=Math.random()*Math.min(this.x*2**e,2e4);return Math.floor(n)}setDelayBase(e){this.x=e}}});var us,OS=h(()=>{us=class{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,r,o,n){this.delay=e,this.count=r,this.cost=o,this.longPoll=n}getRetryCount(){return this.count}getRetryDelay(){return Math.min(2e4,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}});var _e,At,ct,Po=h(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(_e||(_e={}));At=3,ct=_e.STANDARD});var Fa,wt,ls=h(()=>{NS();OS();Po();Cn();Fa={incompatible:1,attempts:2,capacity:3},wt=class{mode=_e.STANDARD;retryBackoffStrategy;capacity=500;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>At,this.baseDelay??=fe.delay(),this.retryBackoffStrategy??=new Ga}async acquireInitialRetryToken(e){return new us(fe.delay(),0,void 0,fe.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,r){let o=await this.getMaxAttempts(),n=this.retryCode(e,r,o),s=n===0,i=e.isLongPoll?.();if(s||i){let a=r.errorType;this.retryBackoffStrategy.setDelayBase(a==="THROTTLING"?fe.throttlingDelay():this.baseDelay);let c=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),d=c;if(r.retryAfterHint instanceof Date&&(d=Math.max(c,Math.min(r.retryAfterHint.getTime()-Date.now(),c+5e3))),s){let u=this.getCapacityCost(a);this.capacity-=u;let l=new us(0,e.getRetryCount()+1,u,e.isLongPoll?.()??!1);return await new Promise(m=>setTimeout(m,d)),l.$retryLog.acquisitionDelay=d,l}else{let u=fe.v2026&&n===Fa.capacity&&i?d:0;u>0&&await new Promise(l=>setTimeout(l,u))}}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${At}`),At}}retryCode(e,r,o){let n=e.getRetryCount()+1,s=this.isRetryableError(r.errorType)?0:Fa.incompatible,i=n<o?0:Fa.attempts,a=this.capacity>=this.getCapacityCost(r.errorType)?0:Fa.capacity;return s||i||a}getCapacityCost(e){return e===fe.modifiedCostType()?fe.throttlingCost():fe.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}});var _n,$l=h(()=>{Ba();ls();Po();_n=class{mode=_e.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,r){let{rateLimiter:o}=r??{};this.rateLimiter=o??new lo,this.standardRetryStrategy=r?new wt({maxAttempts:typeof e=="number"?e:3,...r}):new wt(e)}async acquireInitialRetryToken(e){let r=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),r}async refreshRetryTokenForRetry(e,r){this.rateLimiter.updateClientSendingRate(r);let o=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,r);return await this.rateLimiter.getSendToken(),o}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}});var Ha,DS=h(()=>{ls();Cn();Ha=class extends wt{computeNextBackoffDelay;constructor(e,r=fe.delay()){super(typeof e=="function"?e:async()=>e),typeof r=="number"?this.computeNextBackoffDelay=()=>r:this.computeNextBackoffDelay=r,this.retryBackoffStrategy.computeNextBackoffDelay=o=>{let n=o+1;return this.computeNextBackoffDelay(n)}}}});var MS,$S=h(()=>{MS=(t,e)=>{let r=t,o=e?.noRetryIncrement??1,n=e?.retryCost??5,s=e?.timeoutRetryCost??10,i=t,a=l=>l.name==="TimeoutError"?s:n,c=l=>a(l)<=i;return Object.freeze({hasRetryTokens:c,retrieveRetryTokens:l=>{if(!c(l))throw new Error("No retry token available");let m=a(l);return i-=m,m},releaseRetryTokens:l=>{i+=l??o,i=Math.min(i,r)}})}});var za,Ll=h(()=>{za=(t,e)=>Math.floor(Math.min(2e4,Math.random()*2**e*t))});var qa,Ul=h(()=>{En();qa=t=>t?as(t)||Oa(t)||er(t)||ao(t):!1});var Tn,qP,Bl=h(()=>{P();D();En();Po();ds();Nl();$S();Ll();Ul();Tn=class{maxAttemptsProvider;retryDecider;delayDecider;retryQuota;mode=_e.STANDARD;constructor(e,r){this.maxAttemptsProvider=e,this.retryDecider=r?.retryDecider??qa,this.delayDecider=r?.delayDecider??za,this.retryQuota=r?.retryQuota??MS(500)}shouldRetry(e,r,o){return r<o&&this.retryDecider(e)&&this.retryQuota.hasRetryTokens(e)}async getMaxAttempts(){let e;try{e=await this.maxAttemptsProvider()}catch{e=At}return e}async retry(e,r,o){let n,s=0,i=0,a=await this.getMaxAttempts(),{request:c}=r;for(V.isInstance(c)&&(c.headers[co]=la());;)try{V.isInstance(c)&&(c.headers[uo]=`attempt=${s+1}; max=${a}`),o?.beforeRequest&&await o.beforeRequest();let{response:d,output:u}=await e(r);return o?.afterRequest&&o.afterRequest(d),this.retryQuota.releaseRetryTokens(n),u.$metadata.attempts=s+1,u.$metadata.totalRetryDelay=i,{response:d,output:u}}catch(d){let u=Ua(d);if(s++,this.shouldRetry(u,s,a)){n=this.retryQuota.retrieveRetryTokens(u);let l=this.delayDecider(er(u)?500:100,s),m=qP(u.$response),g=Math.max(m||0,l);i+=g,await new Promise(S=>setTimeout(S,g));continue}throw u.$metadata||(u.$metadata={}),u.$metadata.attempts=s,u.$metadata.totalRetryDelay=i,u}}},qP=t=>{if(!Et.isInstance(t))return;let e=Object.keys(t.headers).find(s=>s.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],o=Number(r);if(!Number.isNaN(o))return Math.min(o*1e3,2e4);let n=new Date(r);return Math.min(n.getTime()-Date.now(),2e4)}});var Va,LS=h(()=>{Ba();Po();Bl();Va=class extends Tn{rateLimiter;constructor(e,r){let{rateLimiter:o,...n}=r??{};super(e,n),this.rateLimiter=o??new lo,this.mode=_e.ADAPTIVE}async retry(e,r){return super.retry(e,r,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:o=>{this.rateLimiter.updateClientSendingRate(o)}})}}});var Wa,ja,tr,rr,Gl,Fl,or,US=h(()=>{M();$l();ls();Po();Cn();Wa="AWS_MAX_ATTEMPTS",ja="max_attempts",tr={environmentVariableSelector:t=>{let e=t[Wa];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Environment variable ${Wa} mast be a number, got "${e}"`);return r},configFileSelector:t=>{let e=t[ja];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Shared config file entry ${ja} mast be a number, got "${e}"`);return r},default:At},rr=(t,e)=>{let{retryStrategy:r,retryMode:o}=t,{defaultMaxAttempts:n=At,defaultBaseDelay:s=fe.delay()}=e??{},i=Be(t.maxAttempts??n),a=r?Promise.resolve(r):void 0,c=async()=>{let d=await i();return await Be(o)()===_e.ADAPTIVE?new _n(i,{maxAttempts:d,baseDelay:s}):new wt({maxAttempts:d,baseDelay:s})};return Object.assign(t,{maxAttempts:i,retryStrategy:()=>a??=c()})},Gl="AWS_RETRY_MODE",Fl="retry_mode",or={environmentVariableSelector:t=>t[Gl],configFileSelector:t=>t[Fl],default:ct}});var Hl,zl,BS,GS=h(()=>{P();ds();Hl=()=>t=>async e=>{let{request:r}=e;return V.isInstance(r)&&(delete r.headers[co],delete r.headers[uo]),t(e)},zl={name:"omitRetryHeadersMiddleware",tags:["RETRY","HEADERS","OMIT_RETRY_HEADERS"],relation:"before",toMiddleware:"awsAuthMiddleware",override:!0},BS=t=>({applyToStack:e=>{e.addRelativeTo(Hl(),zl)}})});var FS={};St(FS,{AdaptiveRetryStrategy:()=>_n,CONFIG_MAX_ATTEMPTS:()=>ja,CONFIG_RETRY_MODE:()=>Fl,ConfiguredRetryStrategy:()=>Ha,DEFAULT_MAX_ATTEMPTS:()=>At,DEFAULT_RETRY_DELAY_BASE:()=>Ma,DEFAULT_RETRY_MODE:()=>ct,DefaultRateLimiter:()=>lo,DeprecatedAdaptiveRetryStrategy:()=>Va,DeprecatedStandardRetryStrategy:()=>Tn,ENV_MAX_ATTEMPTS:()=>Wa,ENV_RETRY_MODE:()=>Gl,INITIAL_RETRY_TOKENS:()=>yn,INVOCATION_ID_HEADER:()=>co,MAXIMUM_RETRY_DELAY:()=>cs,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:()=>tr,NODE_RETRY_MODE_CONFIG_OPTIONS:()=>or,NO_RETRY_INCREMENT:()=>La,REQUEST_HEADER:()=>uo,RETRY_COST:()=>vl,RETRY_MODES:()=>_e,Retry:()=>fe,StandardRetryStrategy:()=>wt,THROTTLING_RETRY_DELAY_BASE:()=>$a,TIMEOUT_RETRY_COST:()=>kl,defaultDelayDecider:()=>za,defaultRetryDecider:()=>qa,getOmitRetryHeadersPlugin:()=>BS,getRetryAfterHint:()=>PS,getRetryPlugin:()=>Ar,isBrowserNetworkError:()=>xl,isClockSkewCorrectedError:()=>Rl,isClockSkewError:()=>Oa,isNodeJsHttp2TransientError:()=>Il,isRetryableByTrait:()=>as,isServerError:()=>Da,isThrottlingError:()=>er,isTransientError:()=>ao,omitRetryHeadersMiddleware:()=>Hl,omitRetryHeadersMiddlewareOptions:()=>zl,resolveRetryConfig:()=>rr,retryMiddleware:()=>VP,retryMiddlewareOptions:()=>Dl});var VP,Ar,dt=h(()=>{Xg();Ml();En();$l();DS();Ba();ls();Po();ds();Cn();LS();Bl();Ll();Ul();US();GS();Ml();bl();VP=Ol(il),Ar=bS(il)});function ut(t,e,r){t.__aws_sdk_context?t.__aws_sdk_context.features||(t.__aws_sdk_context.features={}):t.__aws_sdk_context={features:{}},t.__aws_sdk_context.features[e]=r}var ql=h(()=>{dt();fe.v2026||=typeof process=="object"&&process.env?.AWS_NEW_RETRIES_2026==="true"});function HS(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var zS=h(()=>{});function An(t){return t}var Vl,Wl,nr,qS=h(()=>{P();Vl=t=>e=>async r=>{if(!V.isInstance(r.request))return e(r);let{request:o}=r,{handlerProtocol:n=""}=t.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let s=o.hostname;o.port!=null&&(s+=`:${o.port}`),o.headers.host=s}return e(r)},Wl={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},nr=t=>({applyToStack:e=>{e.add(Vl(t),Wl)}})});var jl,Kl,sr,VS=h(()=>{jl=()=>(t,e)=>async r=>{try{let o=await t(r),{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:d}=a,u=c??e.inputFilterSensitiveLog,l=d??e.outputFilterSensitiveLog,{$metadata:m,...g}=o.output;return i?.info?.({clientName:n,commandName:s,input:u(r.input),output:l(g),metadata:m}),o}catch(o){let{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c}=a,d=c??e.inputFilterSensitiveLog;throw i?.error?.({clientName:n,commandName:s,input:d(r.input),error:o,metadata:o.$metadata}),o}},Kl={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},sr=t=>({applyToStack:e=>{e.add(jl(),Kl)}})});var Ka,Xl=h(()=>{Ka={step:"build",tags:["RECURSION_DETECTION","TRACE_CONTEXT_PROPAGATION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"}});var fo,Yl,Xa,Ql,Jl,fs,WS=h(()=>{fo={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID"),TRACEPARENT:Symbol.for("_AWS_LAMBDA_TRACEPARENT"),TRACESTATE:Symbol.for("_AWS_LAMBDA_TRACESTATE"),BAGGAGE:Symbol.for("_AWS_LAMBDA_BAGGAGE")},Yl=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");Yl||(globalThis.awslambda=globalThis.awslambda||{});Xa=class{static PROTECTED_KEYS=fo;isProtectedKey(e){return Object.values(fo).includes(e)}getRequestId(){return this.get(fo.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(fo.X_RAY_TRACE_ID)}getTenantId(){return this.get(fo.TENANT_ID)}getTraceparent(){return this.get(fo.TRACEPARENT)}getTracestate(){return this.get(fo.TRACESTATE)}getBaggage(){return this.get(fo.BAGGAGE)}},Ql=class extends Xa{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){return this.currentContext=e,r()}},Jl=class t extends Xa{als;static async create(){let e=new t,r=await import("node:async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let o=this.als.getStore();if(!o)throw new Error("No context available");o[e]=r}run(e,r){return this.als.run(e,r)}};(function(t){let e=null;async function r(o){return e||(e=(async()=>{let s=o===!0||"AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Jl.create():new Ql;return!Yl&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!Yl&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=s),s)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={InvokeStore:void 0}}}:void 0})(fs||(fs={}))});function KP(t){for(let e of Object.keys(t)){let r=e.toLowerCase();e!==r&&(r===ef||r===jS||r===KS)&&(t[r]=t[e],delete t[e])}}var WP,jP,Zl,ef,jS,KS,Ya,tf=h(()=>{WS();P();WP="AWS_LAMBDA_FUNCTION_NAME",jP="_X_AMZN_TRACE_ID",Zl="X-Amzn-Trace-Id",ef="traceparent",jS="tracestate",KS="baggage",Ya=()=>t=>async e=>{let{request:r}=e;if(!V.isInstance(r))return t(e);let o;{let n=Object.keys(r.headers??{}).find(s=>s.toLowerCase()===Zl.toLowerCase())??Zl;if(!r.headers.hasOwnProperty(n)){let s=process.env[WP],i=process.env[jP];o??=await fs.getInstanceAsync();let c=o?.getXRayTraceId()??i,d=u=>typeof u=="string"&&u.length>0;d(s)&&d(c)&&(r.headers[Zl]=c)}}if(KP(r.headers),!r.headers[ef]){let s=(o??=await fs.getInstanceAsync())?.getTraceparent?.();if(s){r.headers[ef]=s;let i=o?.getTracestate?.();i&&(r.headers[jS]=i);let a=o?.getBaggage?.();a&&(r.headers[KS]=a)}}return t(e)}});var ir,XS=h(()=>{Xl();tf();ir=t=>({applyToStack:e=>{e.add(Ya(),Ka)}})});var YS,QS=h(()=>{YS=(t,e)=>{if(!e||e.length===0)return t;let r=[];for(let o of e)for(let n of t)n.schemeId.split("#")[1]===o&&r.push(n);for(let o of t)r.find(({schemeId:n})=>n===o.schemeId)||r.push(o);return r}});function XP(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var bo,Qa=h(()=>{re();QS();bo=(t,e)=>(r,o)=>async n=>{let s=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,o,n.input)),i=t.authSchemePreference?await t.authSchemePreference():[],a=YS(s,i),c=XP(t.httpAuthSchemes),d=Ie(o),u=[];for(let l of a){let m=c.get(l.schemeId);if(!m){u.push(`HttpAuthScheme \`${l.schemeId}\` was not enabled for this service.`);continue}let g=m.identityProvider(await e.identityProviderConfigProvider(t));if(!g){u.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:S={},signingProperties:E={}}=l.propertiesExtractor?.(t,o)||{};l.identityProperties=Object.assign(l.identityProperties||{},S),l.signingProperties=Object.assign(l.signingProperties||{},E),d.selectedHttpAuthScheme={httpAuthOption:l,identity:await g(l.identityProperties),signer:m.signer};break}if(!d.selectedHttpAuthScheme)throw new Error(u.join(`
12
+ `));return r(n)}});var Ja,Rt,JS=h(()=>{Qa();Ja={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},Rt=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(bo(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Ja)}})});var Za,rf,ZS=h(()=>{Qa();Za={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"serializerMiddleware"},rf=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(bo(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Za)}})});var eE=h(()=>{Qa();JS();ZS()});var YP,QP,ms,of=h(()=>{P();re();YP=t=>e=>{throw e},QP=(t,e)=>{},ms=t=>(e,r)=>async o=>{if(!V.isInstance(o.request))return e(o);let s=Ie(r).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=s,d=await e({...o,request:await c.sign(o.request,a,i)}).catch((c.errorHandler||YP)(i));return(c.successHandler||QP)(d.response,i),d}});var ec,xt,tE=h(()=>{of();ec={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},xt=t=>({applyToStack:e=>{e.addRelativeTo(ms(t),ec)}})});var rE=h(()=>{of();tE()});var lt,oE=h(()=>{lt=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function nE(t,e,r,o,n){return async function*(i,a,...c){let d=a,u=i.startingToken??d[r],l=!0,m;for(;l;){if(d[r]=u,n&&(d[n]=d[n]??i.pageSize),i.client instanceof t)m=await JP(e,i.client,a,i.withCommand,...c);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield m;let g=u;u=ZP(m,o),l=!!(u&&(!i.stopOnSameToken||u!==g))}return void 0}}var JP,ZP,sE=h(()=>{JP=async(t,e,r,o=s=>s,...n)=>{let s=new t(r);return s=o(s)??s,await e.send(s,...n)};ZP=(t,e)=>{let r=t,o=e.split(".");for(let n of o){if(!r||typeof r!="object")return;r=r[n]}return r}});function iE(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var aE=h(()=>{});var Qe,cE=h(()=>{re();Qe=class{authSchemes=new Map;constructor(e){for(let r in e){if(!H(e,r))continue;let o=e[r];o!==void 0&&this.authSchemes.set(r,o)}}getIdentityProvider(e){return this.authSchemes.get(e)}}});var nf,wn,dE=h(()=>{P();nf=Ee(Ku()),wn=class{async sign(e,r,o){if(!o)throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");if(!o.name)throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing");if(!o.in)throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");if(!r.apiKey)throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");let n=V.clone(e);if(o.in===nf.HttpApiKeyAuthLocation.QUERY)n.query[o.name]=r.apiKey;else if(o.in===nf.HttpApiKeyAuthLocation.HEADER)n.headers[o.name]=o.scheme?`${o.scheme} ${r.apiKey}`:r.apiKey;else throw new Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `"+o.in+"`");return n}}});var Rn,uE=h(()=>{P();Rn=class{async sign(e,r,o){let n=V.clone(e);if(!r.token)throw new Error("request could not be signed with `token` since the `token` is not defined");return n.headers.Authorization=`Bearer ${r.token}`,n}}});var Oe,lE=h(()=>{Oe=class{async sign(e,r,o){return e}}});var fE=h(()=>{dE();uE();lE()});var tc,sf,ps,xn,hs,mE=h(()=>{tc=t=>function(r){return xn(r)&&r.expiration.getTime()-Date.now()<t},sf=3e5,ps=tc(3e5),xn=t=>t.expiration!==void 0,hs=(t,e,r)=>{if(t===void 0)return;let o=typeof t!="function"?async()=>Promise.resolve(t):t,n,s,i,a=!1,c=async d=>{s||(s=o(d));try{n=await s,i=!0,a=!1}finally{s=void 0}return n};return e===void 0?async d=>((!i||d?.forceRefresh)&&(n=await c(d)),n):async d=>((!i||d?.forceRefresh)&&(n=await c(d)),a?n:r(n)?(e(n)&&await c(d),n):(a=!0,n))}});var pE=h(()=>{cE();fE();mE()});var hE={};St(hE,{DefaultIdentityProviderConfig:()=>Qe,EXPIRATION_MS:()=>sf,HttpApiKeyAuthSigner:()=>wn,HttpBearerAuthSigner:()=>Rn,NoAuthSigner:()=>Oe,createIsIdentityExpiredFunction:()=>tc,createPaginator:()=>nE,doesIdentityRequireRefresh:()=>xn,getHttpAuthSchemeEndpointRuleSetPlugin:()=>Rt,getHttpAuthSchemePlugin:()=>rf,getHttpSigningPlugin:()=>xt,getSmithyContext:()=>Ie,httpAuthSchemeEndpointRuleSetMiddlewareOptions:()=>Ja,httpAuthSchemeMiddleware:()=>bo,httpAuthSchemeMiddlewareOptions:()=>Za,httpSigningMiddleware:()=>ms,httpSigningMiddlewareOptions:()=>ec,isIdentityExpired:()=>ps,memoizeIdentityProvider:()=>hs,normalizeProvider:()=>lt,requestBuilder:()=>ha,setFeature:()=>iE});var ze=h(()=>{re();eE();rE();oE();sE();P();aE();pE()});function eb(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function ar(t){let e=lt(t.userAgentAppId??gs),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let o=await e();if(!eb(o)){let n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof o!="string"?n?.warn("userAgentAppId must be a string or undefined."):o.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}var gs,af=h(()=>{ze();gs=void 0});var cf,gE=h(()=>{cf={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"}});var SE,EE,rc,df,yE,oc,nc=h(()=>{gE();SE=cf,EE="",rc=t=>{let{partitions:e}=SE;for(let o of e){let{regions:n,outputs:s}=o;for(let[i,a]of Object.entries(n))if(i===t)return{...s,...a}}for(let o of e){let{regionRegex:n,outputs:s}=o;if(new RegExp(n).test(t))return{...s}}let r=e.find(o=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},df=(t,e="")=>{SE=t,EE=e},yE=()=>{df(cf,"")},oc=()=>EE});async function CE(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&ut(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let s=await e.retryStrategy();if(typeof s.mode=="string")switch(s.mode){case _e.ADAPTIVE:ut(t,"RETRY_MODE_ADAPTIVE","F");break;case _e.STANDARD:ut(t,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){let s=t.endpointV2;switch(String(s?.url?.hostname).match(tb)&&ut(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":ut(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":ut(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":ut(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let s=n;s.accountId&&ut(t,"RESOLVED_ACCOUNT_ID","T");for(let[i,a]of Object.entries(s.$source??{}))ut(t,i,a)}}var tb,_E=h(()=>{dt();ql();tb=/\d{12}\.ddb/});var uf,sc,TE,AE,wE=h(()=>{uf="user-agent",sc="x-amz-user-agent",TE=/[^!$%&'*+\-.^_`|~\w]/g,AE=/[^!$%&'*+\-.^_`|~\w#]/g});function RE(t){let e="";for(let r in t){let o=t[r];if(e.length+o.length+1<=1024){e.length?e+=","+o:e+=o;continue}break}return e}var xE=h(()=>{});var ff,ic,mf,cr,kE=h(()=>{P();nc();_E();wE();xE();ff=t=>(e,r)=>async o=>{let{request:n}=o;if(!V.isInstance(n))return e(o);let{headers:s}=n,i=r?.userAgent?.map(ic)||[],a=(await t.defaultUserAgentProvider()).map(ic);await CE(r,t,o);let c=r;a.push(`m/${RE(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let d=t?.customUserAgent?.map(ic)||[],u=await t.userAgentAppId();u&&a.push(ic(["app",`${u}`]));let l=oc(),m=(l?[l]:[]).concat([...a,...i,...d]).join(" "),g=[...a.filter(S=>S.startsWith("aws-sdk-")),...d].join(" ");return t.runtime!=="browser"?(g&&(s[sc]=s[sc]?`${s[uf]} ${g}`:g),s[uf]=m):s[sc]=m,e({...o,request:n})},ic=t=>{let e=t[0].split("/").map(i=>i.replace(TE,"-")).join("/"),r=t[1]?.replace(AE,"-"),o=e.indexOf("/"),n=e.substring(0,o),s=e.substring(o+1);return n==="api"&&(s=s.toLowerCase()),[n,s,r].filter(i=>i&&i.length>0).reduce((i,a,c)=>{switch(c){case 0:return a;case 1:return`${i}/${a}`;default:return`${i}#${a}`}},"")},mf={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},cr=t=>({applyToStack:e=>{e.add(ff(t),mf)}})});import{versions as pf}from"node:process";var PE,bE=h(()=>{PE=()=>{let t=["deno","bun","llrt"];for(let e of t)if(pf[e])return[`md/${e}`,pf[e]];return["md/nodejs",pf.node]}});var Ss,hf=h(()=>{Ss={isCrtAvailable:!1}});var NE,OE=h(()=>{hf();NE=()=>Ss.isCrtAvailable?["md/crt-avail"]:null});import{platform as rb,release as ob}from"node:os";import{env as DE}from"node:process";var It,ME,$E=h(()=>{bE();OE();hf();It=({serviceId:t,clientVersion:e})=>{let r=PE();return async o=>{let n=[["aws-sdk-js",e],["ua","2.1"],[`os/${rb()}`,ob()],["lang/js"],r],s=NE();s&&n.push(s),t&&n.push([`api/${t}`,e]),DE.AWS_EXECUTION_ENV&&n.push([`exec-env/${DE.AWS_EXECUTION_ENV}`]);let i=await o?.userAgentAppId?.();return i?[...n,[`app/${i}`]]:[...n]}},ME=It});var gf,Sf,nb,dr,LE=h(()=>{af();gf="AWS_SDK_UA_APP_ID",Sf="sdk_ua_app_id",nb="sdk-ua-app-id",dr={environmentVariableSelector:t=>t[gf],configFileSelector:t=>t[Sf]??t[nb],default:gs}});var UE,BE=h(()=>{UE=({serviceId:t,clientVersion:e})=>async r=>{let o=await import("./bowser-MLGGLXTZ.js"),n=o.parse??o.default.parse??(()=>""),s=typeof window<"u"&&window?.navigator?.userAgent?n(window.navigator.userAgent):void 0,i=[["aws-sdk-js",e],["ua","2.1"],[`os/${s?.os?.name||"other"}`,s?.os?.version],["lang/js"],["md/browser",`${s?.browser?.name??"unknown"}_${s?.browser?.version??"unknown"}`]];t&&i.push([`api/${t}`,e]);let a=await r?.userAgentAppId?.();return a&&i.push([`app/${a}`]),i}});var GE,FE=h(()=>{GE={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux"},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari"}}});var Ef=h(()=>{ae()});var Es,yf=h(()=>{ae();Ef();Es=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!Es(r))return!1;return!0}return!(!Dg(t)||t.length<3||t.length>63||t!==t.toLowerCase()||ts(t))}});var ac,Cf=h(()=>{ac=t=>{let e=t.split(":");if(e.length<6)return null;let[r,o,n,s,i,...a]=e;if(r!=="arn"||o===""||n===""||a.join(":")==="")return null;let c=a.map(d=>d.split("/")).flat();return{partition:o,service:n,region:s,accountId:i,resourceId:c}}});var vt,HE=h(()=>{ae();yf();Cf();nc();vt={isVirtualHostableS3Bucket:Es,parseArn:ac,partition:rc};Wt.aws=vt});var zE=h(()=>{ae()});var qE,_f,VE=h(()=>{P();qE=t=>{if(typeof t.endpointProvider!="function")throw new Error("@aws-sdk/util-endpoint - endpointProvider and endpoint missing in config for this client.");let{endpoint:e}=t;return e===void 0&&(t.endpoint=async()=>_f(t.endpointProvider({Region:typeof t.region=="function"?await t.region():t.region,UseDualStack:typeof t.useDualstackEndpoint=="function"?await t.useDualstackEndpoint():t.useDualstackEndpoint,UseFIPS:typeof t.useFipsEndpoint=="function"?await t.useFipsEndpoint():t.useFipsEndpoint,Endpoint:void 0},{logger:t.logger}))),t},_f=t=>tt(t.url)});var WE=h(()=>{ae()});var jE=h(()=>{te();te()});function cc(t={}){return q({...Xe,async default(){return Tf.silence||console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly."),"us-east-1"}},{...Ye,...t})}var Tf,KE=h(()=>{te();Tf={silence:!1}});var ur,lr,XE=h(()=>{ur=t=>({setRegion(e){t.region=e},region(){return t.region}}),lr=t=>({region:t.region()})});var kt={};St(kt,{DEFAULT_UA_APP_ID:()=>gs,EndpointError:()=>rl,NODE_APP_ID_CONFIG_OPTIONS:()=>dr,NODE_REGION_CONFIG_FILE_OPTIONS:()=>Ye,NODE_REGION_CONFIG_OPTIONS:()=>Xe,REGION_ENV_NAME:()=>el,REGION_INI_NAME:()=>tl,UA_APP_ID_ENV_NAME:()=>gf,UA_APP_ID_INI_NAME:()=>Sf,awsEndpointFunctions:()=>vt,createDefaultUserAgentProvider:()=>It,createUserAgentStringParsingProvider:()=>UE,crtAvailability:()=>Ss,defaultUserAgent:()=>ME,emitWarningIfUnsupportedVersion:()=>jt,fallback:()=>GE,getAwsRegionExtensionConfiguration:()=>ur,getHostHeaderPlugin:()=>nr,getLoggerPlugin:()=>sr,getLongPollPlugin:()=>Wg,getRecursionDetectionPlugin:()=>ir,getUserAgentMiddlewareOptions:()=>mf,getUserAgentPlugin:()=>cr,getUserAgentPrefix:()=>oc,hostHeaderMiddleware:()=>Vl,hostHeaderMiddlewareOptions:()=>Wl,isIpAddress:()=>ts,isVirtualHostableS3Bucket:()=>Es,loggerMiddleware:()=>jl,loggerMiddlewareOptions:()=>Kl,parseArn:()=>ac,partition:()=>rc,recursionDetectionMiddleware:()=>Ya,recursionDetectionMiddlewareOptions:()=>Ka,resolveAwsRegionExtensionConfiguration:()=>lr,resolveDefaultAwsRegionalEndpointsConfig:()=>qE,resolveEndpoint:()=>ol,resolveHostHeaderConfig:()=>An,resolveRegionConfig:()=>Ct,resolveUserAgentConfig:()=>ar,setCredentialFeature:()=>Kr,setFeature:()=>ut,setPartitionInfo:()=>df,setTokenFeature:()=>HS,state:()=>os,stsRegionDefaultResolver:()=>cc,stsRegionWarning:()=>Tf,toEndpointV1:()=>_f,useDefaultPartitionInfo:()=>yE,userAgentMiddleware:()=>ff});var Z=h(()=>{Vg();jg();Kg();ql();zS();qS();VS();Xl();XS();tf();af();kE();$E();LE();FE();BE();HE();zE();VE();Ef();yf();Cf();nc();WE();jE();KE();XE()});var ty=se(No=>{var{HttpRequest:YE}=(P(),v(at));function sb(t){let e=t.signer,r=t.signer,o=Object.assign(t,{eventSigner:e,messageSigner:r}),n=o.eventStreamPayloadHandlerProvider(o);return Object.assign(o,{eventStreamPayloadHandler:n})}var QE=t=>(e,r)=>async o=>{let{request:n}=o;return YE.isInstance(n)?t.eventStreamPayloadHandler.handle(e,o,r):e(o)},JE={tags:["EVENT_STREAM","SIGNATURE","HANDLE"],name:"eventStreamHandlingMiddleware",relation:"after",toMiddleware:"awsAuthMiddleware",override:!0},ZE=t=>async e=>{let{request:r}=e;return YE.isInstance(r)?(r.headers={...r.headers,"content-type":"application/vnd.amazon.eventstream","x-amz-content-sha256":"STREAMING-AWS4-HMAC-SHA256-EVENTS"},t({...e,request:r})):t(e)},ey={step:"build",tags:["EVENT_STREAM","HEADER","CONTENT_TYPE","CONTENT_SHA256"],name:"eventStreamHeaderMiddleware",override:!0},ib=t=>({applyToStack:e=>{e.addRelativeTo(QE(t),JE),e.add(ZE,ey)}});No.eventStreamHandlingMiddleware=QE;No.eventStreamHandlingMiddlewareOptions=JE;No.eventStreamHeaderMiddleware=ZE;No.eventStreamHeaderMiddlewareOptions=ey;No.getEventStreamPlugin=ib;No.resolveEventStreamConfig=sb});var ry,oy,ny,sy=h(()=>{ry=t=>typeof t=="string"&&t.indexOf("arn:")===0&&t.split(":").length>=6,oy=t=>{let e=t.split(":");if(e.length<6||e[0]!=="arn")throw new Error("Malformed ARN");let[,r,o,n,s,...i]=e;return{partition:r,service:o,region:n,accountId:s,resource:i.join(":")}},ny=t=>{let{partition:e="aws",service:r,region:o,accountId:n,resource:s}=t;if([r,o,n,s].some(i=>typeof i!="string"))throw new Error("Input ARN object is invalid");return`arn:${e}:${r}:${o}:${n}:${s}`}});function iy(t){let{port:e,query:r}=t,{protocol:o,path:n,hostname:s}=t;o&&o.slice(-1)!==":"&&(o+=":"),e&&(s+=`:${e}`),n&&n.charAt(0)!=="/"&&(n=`/${n}`);let i=r?ya(r):"";i&&i[0]!=="?"&&(i=`?${i}`);let a="";if(t.username!=null||t.password!=null){let d=t.username??"",u=t.password??"";a=`${d}:${u}@`}let c="";return t.fragment&&(c=`#${t.fragment}`),`${o}//${a}${s}${n}${i}${c}`}var ay=h(()=>{P()});function cy(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var dy=h(()=>{});var uy={};St(uy,{build:()=>ny,formatUrl:()=>iy,hasOwn:()=>cy,parse:()=>oy,validate:()=>ry});var ly=h(()=>{sy();ay();dy()});var hy=se(uc=>{var{buildQueryString:ab,HttpResponse:fy}=(P(),v(at)),{streamCollector:cb}=(D(),v(_t));uc.streamCollector=cb;function my(t,e){return new Request(t,e)}function db(t=0){return new Promise((e,r)=>{t&&setTimeout(()=>{let o=new Error(`Request did not complete within ${t} ms`);o.name="TimeoutError",r(o)},t)})}var dc={supported:void 0},Af=class t{config;configProvider;static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),dc.supported===void 0&&(dc.supported=typeof Request<"u"&&"keepalive"in my("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=o??this.config.requestTimeout,s=this.config.keepAlive===!0,i=this.config.credentials,a=this.config.customFetch??fetch;if(r?.aborted){let w=py(r);return Promise.reject(w)}let c=e.path,d=ab(e.query||{});d&&(c+=`?${d}`),e.fragment&&(c+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let w=e.username??"",I=e.password??"";u=`${w}:${I}@`}let{port:l,method:m}=e,g=`${e.protocol}//${u}${e.hostname}${l?`:${l}`:""}${c}`,S=m==="GET"||m==="HEAD"?void 0:e.body,E={body:S,headers:new Headers(e.headers),method:m,credentials:i};this.config?.cache&&(E.cache=this.config.cache),S&&(E.duplex="half"),typeof AbortController<"u"&&(E.signal=r),dc.supported&&(E.keepalive=s),typeof this.config.requestInit=="function"&&Object.assign(E,this.config.requestInit(e));let C=()=>{},y=my(g,E),T=[a(y).then(w=>{let I=w.headers,b={};for(let B of I.entries())b[B[0]]=B[1];return w.body!=null?{response:new fy({headers:b,reason:w.statusText,statusCode:w.status,body:w.body})}:w.blob().then(B=>({response:new fy({headers:b,reason:w.statusText,statusCode:w.status,body:B})}))}),db(n)];return r&&T.push(new Promise((w,I)=>{let b=()=>{let F=py(r);I(F)};if(typeof r.addEventListener=="function"){let F=r;F.addEventListener("abort",b,{once:!0}),C=()=>F.removeEventListener("abort",b)}else r.onabort=b})),Promise.race(T).finally(C)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>(o[e]=r,o))}httpHandlerConfigs(){return this.config??{}}};function py(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let o=new Error(String(e));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}uc.FetchHttpHandler=Af;uc.keepAliveSupport=dc});var yy=se(ys=>{var{formatUrl:ub}=(ly(),v(uy)),{iterableToReadableStream:lb,readableStreamToIterable:fb,EventStreamCodec:mb}=(sl(),v(nl)),{HttpResponse:pb,HttpRequest:Sy}=(P(),v(at)),{fromBase64:hb,fromHex:gb}=(D(),v(_t)),{FetchHttpHandler:gy}=hy(),Ey=t=>t.protocol==="ws:"||t.protocol==="wss:",Sb=3e3,wf=class t{metadata={handlerProtocol:"websocket/h1.1"};config={};configPromise;httpHandler;sockets={};static create(e,r=new gy){return typeof e?.handle=="function"?e:new t(e,r)}constructor(e,r=new gy){this.httpHandler=r;let o=n=>(this.config={...n??{}},this.config);typeof e=="function"?(this.config={},this.configPromise=e().then(n=>o(n))):this.configPromise=Promise.resolve(o(e))}destroy(){for(let[e,r]of Object.entries(this.sockets)){for(let o of r)o.close(1e3,"Socket closed through destroy() call");delete this.sockets[e]}}async handle(e){this.config=await this.configPromise;let{logger:r}=this.config;if(!Ey(e))return r?.debug?.(`@aws-sdk - ws fetching ${e.protocol}${e.hostname}${e.path}`),this.httpHandler.handle(e);let o=ub(e);r?.debug?.(`@aws-sdk - ws connecting ${o.split("?")[0]}`);let n=new WebSocket(o);this.sockets[o]||(this.sockets[o]=[]),this.sockets[o].push(n),n.binaryType="arraybuffer";let{connectionTimeout:s=Sb}=this.config;await this.waitForReady(n,s);let{body:i}=e,a=Eb(i),c=this.connect(n,a),d=yb(c);return{response:new pb({statusCode:200,body:d})}}updateHttpClientConfig(e,r){this.configPromise=this.configPromise.then(o=>(o[e]=r,o))}httpHandlerConfigs(){return this.config??{}}removeNotUsableSockets(e){this.sockets[e]=(this.sockets[e]??[]).filter(r=>![WebSocket.CLOSING,WebSocket.CLOSED].includes(r.readyState))}waitForReady(e,r){return new Promise((o,n)=>{let s=setTimeout(()=>{this.removeNotUsableSockets(e.url),n({$metadata:{httpStatusCode:500,websocketSynthetic500Error:!0}})},r);e.onopen=()=>{clearTimeout(s),o()}})}connect(e,r){let o=[],n=null,s=null,i=d=>{n?(d.error?s(d.error):n({done:d.done,value:d.value}),n=null,s=null):o.push(d)};e.onmessage=d=>{let{data:u}=d;i(typeof u=="string"?{done:!1,value:hb(u)}:{done:!1,value:new Uint8Array(u)})},e.onerror=d=>{e.close(),i({done:!0,error:d})},e.onclose=()=>{this.removeNotUsableSockets(e.url),i({done:!0})};let a={[Symbol.asyncIterator]:()=>({async next(){if(o.length>0){let d=o.shift();if(d.error)throw d.error;return{done:d.done,value:d.value}}return new Promise((d,u)=>{n=d,s=u})}})};return(async()=>{try{for await(let d of r){if(e.readyState>=WebSocket.CLOSING)break;e.send(d)}}catch(d){i({done:!0,error:d})}finally{e.close(1e3)}})(),a}},Eb=t=>t[Symbol.asyncIterator]?t:Cb(t)?fb(t):{[Symbol.asyncIterator]:async function*(){yield t}},yb=t=>typeof ReadableStream=="function"?lb(t):t,Cb=t=>typeof ReadableStream=="function"&&t instanceof ReadableStream,_b=(t,e)=>r=>o=>{let{request:n}=o;if(Sy.isInstance(n)&&t.requestHandler.metadata?.handlerProtocol?.toLowerCase().includes("websocket")){n.protocol="wss:",n.method="GET",n.path=`${n.path}-websocket`;let{headers:s}=n;delete s["content-type"],delete s["x-amz-content-sha256"];for(let i of Object.keys(s))if(i.indexOf(e.headerPrefix)===0){let a=i.replace(e.headerPrefix,"");n.query[a]=s[i]}s["x-amz-user-agent"]&&(n.query["user-agent"]=s["x-amz-user-agent"]),n.headers={host:s.host??n.hostname}}return r(o)},Tb={name:"websocketEndpointMiddleware",tags:["WEBSOCKET","EVENT_STREAM"],relation:"after",toMiddleware:"eventStreamHeaderMiddleware",override:!0},Ab=()=>t=>async e=>{let r={...e.input},o=await t(e),n=o.output;return r.SessionId&&n.SessionId==null&&(n.SessionId=r.SessionId),o},wb={step:"initialize",name:"injectSessionIdMiddleware",tags:["WEBSOCKET","EVENT_STREAM"],override:!0},Rb=(t,e)=>({applyToStack:r=>{r.addRelativeTo(_b(t,e),Tb),r.add(Ab(),wb)}}),Rf=class{signer;constructor(e){this.signer=e.signer}presign(e,r={}){return this.signer.presign(e,r)}async sign(e,r){return Sy.isInstance(e)&&Ey(e)?{...await this.signer.presign({...e,body:""},{...r,expiresIn:60,unsignableHeaders:new Set(Object.keys(e.headers).filter(n=>n!=="host"))}),body:e.body}:this.signer.sign(e,r)}signMessage(e,r){return this.signer.signMessage(e,r)}},xb=t=>{let{signer:e}=t;return Object.assign(t,{signer:async r=>{let o=await e(r);if(Ib(o))return new Rf({signer:o});throw new Error("Expected WebsocketSignatureV4 signer, please check the client constructor.")}})},Ib=t=>!!t,xf=class extends TransformStream{constructor(e,r,o,n,s){let i=e,a=s?.();super({start(){},async transform(c,d){try{let u=new Date(Date.now()+await n()),l={":date":{type:"timestamp",value:u}},m=await r.sign({message:{body:c,headers:l},priorSignature:i},{signingDate:u,eventStreamCredentials:await a});i=m.signature;let g=o.encode({headers:{...l,":chunk-signature":{type:"binary",value:gb(m.signature)}},body:c});d.enqueue(g)}catch(u){d.error(u)}}})}},If=class{messageSigner;eventStreamCodec;systemClockOffsetProvider;credentials;constructor(e){this.messageSigner=e.messageSigner,this.eventStreamCodec=new mb(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>e.systemClockOffset??0,this.credentials=e.credentials}async handle(e,r,o={}){let n=r.request,{body:s,headers:i,query:a}=n;if(!(s instanceof ReadableStream))throw new Error("Eventstream payload must be a ReadableStream.");let c=new TransformStream;n.body=c.readable;let u=((i?.authorization??"").match(/Signature=(\w+)$/)??[])[1]??(a&&a["X-Amz-Signature"])??"";o.__staticSignature&&(u="");let l=new xf(u,await this.messageSigner(),this.eventStreamCodec,this.systemClockOffsetProvider,this.credentials);s.pipeThrough(l).pipeThrough(c);let m;try{m=await e(r)}catch(g){let S=s.cancel?.();throw S instanceof Promise&&S.catch(()=>{}),g}return m}},vb=t=>new If(t);ys.WebSocketFetchHandler=wf;ys.eventStreamPayloadHandlerProvider=vb;ys.getWebSocketPlugin=Rb;ys.resolveWebSocketConfig=xb});var lc,fc,Cy=h(()=>{P();lc=t=>Et.isInstance(t)?t.headers?.date??t.headers?.Date:void 0,fc=t=>Et.isInstance(t)?t.headers?.age??t.headers?.Age:void 0});var Cs,_y=h(()=>{Cs=t=>new Date(Date.now()+t)});var mc,Ty=h(()=>{mc=(t,e,r,o)=>{if(o!==void 0)return e;let n=Date.parse(t),s=Date.now();return r!==void 0&&s-r>9e5?e:r!==void 0?n-(r+s)/2:n-s}});var vf=h(()=>{Cy();_y();Ty()});var Ay,_s,kb,In,Te,kf,Pf=h(()=>{P();Ay=Ee(Ku());vf();_s=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},kb=t=>t.context?.[Ay.SMITHY_CONTEXT_KEY]?.eventStream?.output===!0,In=async t=>{let e=_s("context",t.context),r=_s("config",t.config),o=e.endpointV2?.properties?.authSchemes?.[0],s=await _s("signer",r.signer)(o),i=t?.signingRegion,a=t?.signingRegionSet,c=t?.signingName;return{config:r,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}},Te=class{async sign(e,r,o){if(!V.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await In(o),{config:s,signer:i}=n,{signingRegion:a,signingName:c}=n,d=o.context;if(d?.authSchemes?.length??!1){let[g,S]=d.authSchemes;g?.name==="sigv4a"&&S?.name==="sigv4"&&(a=S?.signingRegion??a,c=S?.signingName??c)}let u=await s.disableClockSkewCorrection?.()===!0;o._disableClockSkewCorrection=u;let l=u||kb(o);return o._skipClockSkewSampling=l,l||(o._preRequestSystemClockOffset=s.systemClockOffset,o._requestSentAt=Date.now()),await i.sign(e,{signingDate:u?new Date:Cs(s.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return r=>{let o=r;if(!e._skipClockSkewSampling&&!e._disableClockSkewCorrection){let n=o.ServerTime??lc(o.$response);if(n){let s=_s("config",e.config),i=e._preRequestSystemClockOffset,a=e._requestSentAt,c=fc(o.$response),d=mc(n,s.systemClockOffset,a,c);s.systemClockOffset=d,Math.abs(d)>=24e4&&(d!==i||i!==void 0&&i!==d)&&o.$metadata&&(o.$metadata.clockSkewCorrected=!0)}}throw r}}successHandler(e,r){if(r._skipClockSkewSampling||r._disableClockSkewCorrection)return;let o=lc(e);if(o){let n=_s("config",r.config),s=r._requestSentAt,i=fc(e);n.systemClockOffset=mc(o,n.systemClockOffset,s,i)}}},kf=Te});var wr,wy=h(()=>{P();vf();Pf();wr=class extends Te{async sign(e,r,o){if(!V.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let{config:n,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}=await In(o),u=(await n.sigv4aSigningRegionSet?.()??a??[i]).join(","),l=await n.disableClockSkewCorrection?.()===!0;return o._disableClockSkewCorrection=l,l||(o._preRequestSystemClockOffset=n.systemClockOffset,o._requestSentAt=Date.now()),await s.sign(e,{signingDate:l?new Date:Cs(n.systemClockOffset),signingRegion:u,signingService:c})}}});var bf,Ry=h(()=>{bf=t=>typeof t=="string"&&t.length>0?t.split(",").map(e=>e.trim()):[]});var pc,Nf=h(()=>{pc=t=>`AWS_BEARER_TOKEN_${t.replace(/[\s-]/g,"_").toUpperCase()}`});var xy,Iy,Pt,vy=h(()=>{Ry();Nf();xy="AWS_AUTH_SCHEME_PREFERENCE",Iy="auth_scheme_preference",Pt={environmentVariableSelector:(t,e)=>{if(e?.signingName&&pc(e.signingName)in t)return["httpBearerAuth"];if(xy in t)return bf(t[xy])},configFileSelector:t=>{if(Iy in t)return bf(t[Iy])},default:[]}});var Ts,As,ky=h(()=>{ze();te();Ts=t=>(t.sigv4aSigningRegionSet=lt(t.sigv4aSigningRegionSet),t),As={environmentVariableSelector(t){if(t.AWS_SIGV4A_SIGNING_REGION_SET)return t.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map(e=>e.trim());throw new Qu("AWS_SIGV4A_SIGNING_REGION_SET not set in env.",{tryNextLink:!0})},configFileSelector(t){if(t.sigv4a_signing_region_set)return(t.sigv4a_signing_region_set??"").split(",").map(e=>e.trim());throw new Qu("sigv4a_signing_region_set not set in profile.",{tryNextLink:!0})},default:void 0}});var qf=se(G=>{var{hasOwn:kn,fromUtf8:Py,fromHex:Pb,toHex:Oo,toUint8Array:ws,isArrayBuffer:bb}=(D(),v(_t)),{normalizeProvider:by}=(M(),v(Yu)),{escapeUri:hc,HttpRequest:My}=(P(),v(at)),Of=class{format(e){let r=[];for(let s in e){if(!kn(e,s))continue;let i=Py(s);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[s]))}let o=new Uint8Array(r.reduce((s,i)=>s+i.byteLength,0)),n=0;for(let s of r)o.set(s,n),n+=s.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":let s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);let i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":let a=Py(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);let d=new Uint8Array(c.buffer);return d.set(a,3),d;case"timestamp":let u=new Uint8Array(9);return u[0]=8,u.set(Df.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!Nb.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let l=new Uint8Array(17);return l[0]=9,l.set(Pb(e.value.replace(/-/g,"")),1),l}}},Ny;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(Ny||(Ny={}));var Nb=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Df=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&Oy(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Oy(e),parseInt(Oo(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function Oy(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var $y="X-Amz-Algorithm",Ly="X-Amz-Credential",Uf="X-Amz-Date",Uy="X-Amz-SignedHeaders",By="X-Amz-Expires",Bf="X-Amz-Signature",Gf="X-Amz-Security-Token",Ob="X-Amz-Region-Set",Ff="authorization",Hf=Uf.toLowerCase(),Gy="date",Fy=[Ff,Hf,Gy],Hy=Bf.toLowerCase(),Cc="x-amz-content-sha256",zy=Gf.toLowerCase(),Db="host",qy={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Vy=/^proxy-/,Wy=/^sec-/,Mb=[/^proxy-/i,/^sec-/i],gc="AWS4-HMAC-SHA256",$b="AWS4-ECDSA-P256-SHA256",jy="AWS4-HMAC-SHA256-PAYLOAD",Ky="UNSIGNED-PAYLOAD",Xy=50,zf="aws4_request",Yy=3600*24*7,Qy=({query:t={}})=>{let e=[],r={};for(let o in t){if(!kn(t,o)||o.toLowerCase()===Hy)continue;let n=hc(o);e.push(n);let s=t[o];typeof s=="string"?r[n]=`${n}=${hc(s)}`:Array.isArray(s)&&(r[n]=s.slice(0).reduce((i,a)=>i.concat([`${n}=${hc(a)}`]),[]).sort().join("&"))}return e.sort().map(o=>r[o]).filter(o=>o).join("&")},Lb=t=>Ub(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Ub=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t,_c=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:r,region:o,service:n,sha256:s,uriEscapePath:i=!0}){this.service=n,this.sha256=s,this.uriEscapePath=i,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=by(o),this.credentialProvider=by(r)}createCanonicalRequest(e,r,o){let n=Object.keys(r).sort();return`${e.method}
13
+ ${this.getCanonicalPath(e)}
14
+ ${Qy(e)}
15
+ ${n.map(s=>`${s}:${r[s]}`).join(`
16
+ `)}
17
+
18
+ ${n.join(";")}
19
+ ${o}`}async createStringToSign(e,r,o,n){let s=new this.sha256;s.update(ws(o));let i=await s.digest();return`${n}
20
+ ${e}
21
+ ${r}
22
+ ${Oo(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let s of e.split("/"))s?.length!==0&&s!=="."&&(s===".."?r.pop():r.push(s));let o=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return hc(o).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let r=Lb(e).replace(/[-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}},vn={},Sc=[],Ec=(t,e,r)=>`${t}/${e}/${r}/${zf}`,Jy=async(t,e,r,o,n)=>{let s=await Dy(t,e.secretAccessKey,e.accessKeyId),i=`${r}:${o}:${n}:${Oo(s)}:${e.sessionToken}`;if(i in vn)return vn[i];for(Sc.push(i);Sc.length>Xy;)delete vn[Sc.shift()];let a=`AWS4${e.secretAccessKey}`;for(let c of[r,o,n,zf])a=await Dy(t,a,c);return vn[i]=a},Bb=()=>{Sc.length=0,Object.keys(vn).forEach(t=>{delete vn[t]})},Dy=(t,e,r)=>{let o=new t(e);return o.update(ws(r)),o.digest()},Mf=({headers:t},e,r)=>{let o={};for(let n of Object.keys(t).sort()){if(t[n]==null)continue;let s=n.toLowerCase();(s in qy||e?.has(s)||Vy.test(s)||Wy.test(s))&&(!r||r&&!r.has(s))||(o[s]=t[n].replace(/[\r\n]/g," ").replace(/[ \t]+/g," ").replace(/^ | $/g,""))}return o},yc=async({headers:t,body:e},r)=>{for(let o in t)if(kn(t,o)&&o.toLowerCase()===Cc)return t[o];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||bb(e)){let o=new r;return o.update(ws(e)),Oo(await o.digest())}return Ky},Zy=(t,e)=>{t=t.toLowerCase();for(let r in e)if(kn(e,r)&&t===r.toLowerCase())return!0;return!1},eC=(t,e={})=>{let{headers:r,query:o={}}=My.clone(t);for(let n in r){if(!kn(r,n))continue;let s=n.toLowerCase();(s.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(s)||e.hoistableHeaders?.has(s))&&(o[n]=r[n],delete r[n])}return{...t,headers:r,query:o}},$f=t=>{t=My.clone(t);for(let e in t.headers)kn(t.headers,e)&&Fy.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},Lf=class extends _c{headerFormatter=new Of;constructor({applyChecksum:e,credentials:r,region:o,service:n,sha256:s,uriEscapePath:i=!0}){super({applyChecksum:e,credentials:r,region:o,service:n,sha256:s,uriEscapePath:i})}async presign(e,r={}){let{signingDate:o=new Date,expiresIn:n=3600,unsignableHeaders:s,unhoistableHeaders:i,signableHeaders:a,hoistableHeaders:c,signingRegion:d,signingService:u}=r,l=await this.credentialProvider();this.validateResolvedCredentials(l);let m=d??await this.regionProvider(),{longDate:g,shortDate:S}=this.formatDate(o);if(n>Yy)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let E=Ec(S,m,u??this.service),C=eC($f(e),{unhoistableHeaders:i,hoistableHeaders:c});l.sessionToken&&(C.query[Gf]=l.sessionToken),C.query[$y]=gc,C.query[Ly]=`${l.accessKeyId}/${E}`,C.query[Uf]=g,C.query[By]=n.toString(10);let y=Mf(C,s,a);return C.query[Uy]=this.getCanonicalHeaderList(y),C.query[Bf]=await this.getSignature(g,E,this.getSigningKey(l,m,S,u),this.createCanonicalRequest(C,y,await yc(e,this.sha256))),C}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:o=new Date,priorSignature:n,signingRegion:s,signingService:i,eventStreamCredentials:a}){let c=s??await this.regionProvider(),{shortDate:d,longDate:u}=this.formatDate(o),l=Ec(d,c,i??this.service),m=await yc({headers:{},body:r},this.sha256),g=new this.sha256;g.update(e);let S=Oo(await g.digest()),E=[jy,u,l,n,S,m].join(`
23
+ `);return this.signString(E,{signingDate:o,signingRegion:c,signingService:i,eventStreamCredentials:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:o,signingService:n,eventStreamCredentials:s}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:o,signingService:n,priorSignature:e.priorSignature,eventStreamCredentials:s}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:o,signingService:n,eventStreamCredentials:s}={}){let i=s??await this.credentialProvider();this.validateResolvedCredentials(i);let a=o??await this.regionProvider(),{shortDate:c}=this.formatDate(r),d=new this.sha256(await this.getSigningKey(i,a,c,n));return d.update(ws(e)),Oo(await d.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:o,unsignableHeaders:n,signingRegion:s,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let c=s??await this.regionProvider(),d=$f(e),{longDate:u,shortDate:l}=this.formatDate(r),m=Ec(l,c,i??this.service);d.headers[Hf]=u,a.sessionToken&&(d.headers[zy]=a.sessionToken);let g=await yc(d,this.sha256);!Zy(Cc,d.headers)&&this.applyChecksum&&(d.headers[Cc]=g);let S=Mf(d,n,o),E=await this.getSignature(u,m,this.getSigningKey(a,c,l,i),this.createCanonicalRequest(d,S,g));return d.headers[Ff]=`${gc} Credential=${a.accessKeyId}/${m}, SignedHeaders=${this.getCanonicalHeaderList(S)}, Signature=${E}`,d}async getSignature(e,r,o,n){let s=await this.createStringToSign(e,r,n,gc),i=new this.sha256(await o);return i.update(ws(s)),Oo(await i.digest())}getSigningKey(e,r,o,n){return Jy(this.sha256,e,o,r,n||this.service)}},Gb={SignatureV4a:null};G.ALGORITHM_IDENTIFIER=gc;G.ALGORITHM_IDENTIFIER_V4A=$b;G.ALGORITHM_QUERY_PARAM=$y;G.ALWAYS_UNSIGNABLE_HEADERS=qy;G.AMZ_DATE_HEADER=Hf;G.AMZ_DATE_QUERY_PARAM=Uf;G.AUTH_HEADER=Ff;G.CREDENTIAL_QUERY_PARAM=Ly;G.DATE_HEADER=Gy;G.EVENT_ALGORITHM_IDENTIFIER=jy;G.EXPIRES_QUERY_PARAM=By;G.GENERATED_HEADERS=Fy;G.HOST_HEADER=Db;G.KEY_TYPE_IDENTIFIER=zf;G.MAX_CACHE_SIZE=Xy;G.MAX_PRESIGNED_TTL=Yy;G.PROXY_HEADER_PATTERN=Vy;G.REGION_SET_PARAM=Ob;G.SEC_HEADER_PATTERN=Wy;G.SHA256_HEADER=Cc;G.SIGNATURE_HEADER=Hy;G.SIGNATURE_QUERY_PARAM=Bf;G.SIGNED_HEADERS_QUERY_PARAM=Uy;G.SignatureV4=Lf;G.SignatureV4Base=_c;G.TOKEN_HEADER=zy;G.TOKEN_QUERY_PARAM=Gf;G.UNSIGNABLE_PATTERNS=Mb;G.UNSIGNED_PAYLOAD=Ky;G.clearCredentialCache=Bb;G.createScope=Ec;G.getCanonicalHeaders=Mf;G.getCanonicalQuery=Qy;G.getPayloadHash=yc;G.getSigningKey=Jy;G.hasHeader=Zy;G.moveHeadersToQuery=eC;G.prepareRequest=$f;G.signatureV4aContainer=Gb});function Fb(t,{credentials:e,credentialDefaultProvider:r}){let o;return e?e?.memoized?o=e:o=hs(e,ps,xn):r?o=lt(r(Object.assign({},t,{parentClientConfig:t}))):o=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},o.memoized=!0,o}function Hb(t,e){if(e.configBound)return e;let r=async o=>e({...o,callerClientConfig:t});return r.memoized=e.memoized,r.configBound=!0,r}var Vf,Wf,tC=h(()=>{Z();ze();Vf=Ee(qf()),Wf=t=>e=>{let r=e.credentials,o=!!e.credentials,n;Object.defineProperty(e,"credentials",{set(u){u&&u!==r&&u!==n&&(o=!0),r=u;let l=Fb(e,{credentials:r,credentialDefaultProvider:e.credentialDefaultProvider}),m=Hb(e,l);if(o&&!m.attributed){let g=typeof r=="object"&&r!==null;n=async S=>{let C=await m(S);return g&&(!C.$source||Object.keys(C.$source).length===0)?Kr(C,"CREDENTIALS_CODE","e"):C},n.memoized=m.memoized,n.configBound=m.configBound,n.attributed=!0}else n=m},get(){return n},enumerable:!0,configurable:!0}),e.credentials=r;let{signingEscapePath:s=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:a}=e,c;return e.signer?c=lt(e.signer):e.regionInfoProvider?c=()=>lt(e.region)().then(async u=>[await e.regionInfoProvider(u,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},u]).then(([u,l])=>{let{signingRegion:m,signingService:g}=u;e.signingRegion=e.signingRegion||m||l,e.signingName=e.signingName||g||e.serviceId;let S={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:a,uriEscapePath:s},E=e.signerConstructor||Vf.SignatureV4;return new E(S)}):c=async u=>{u=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await lt(e.region)(),properties:{}},u);let l=u.signingRegion,m=u.signingName;e.signingRegion=e.signingRegion||l,e.signingName=e.signingName||m||e.serviceId;let g={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:a,uriEscapePath:s},S=e.signerConstructor||Vf.SignatureV4;return new S(g)},Object.assign(e,{systemClockOffset:i,signingEscapePath:s,signer:c,disableClockSkewCorrection:lt(e.disableClockSkewCorrection??t)})}});var jf=h(()=>{Pf();wy();vy();ky();tC()});var zb,qb,rC,oC=h(()=>{te();zb="AWS_DISABLE_CLOCK_SKEW_CORRECTION",qb="disable_clock_skew_correction",rC={environmentVariableSelector:t=>Ju(t,zb,Zu.ENV),configFileSelector:t=>Ju(t,qb,Zu.CONFIG),default:!1}});var nC,sC=h(()=>{te();oC();nC=q(rC)});var Tc={};St(Tc,{AWSSDKSigV4Signer:()=>kf,AwsSdkSigV4ASigner:()=>wr,AwsSdkSigV4Signer:()=>Te,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:()=>Pt,NODE_SIGV4A_CONFIG_OPTIONS:()=>As,getBearerTokenEnvKey:()=>pc,resolveAWSSDKSigV4Config:()=>Vb,resolveAwsSdkSigV4AConfig:()=>Ts,resolveAwsSdkSigV4Config:()=>fr,validateSigningProperties:()=>In});var fr,Vb,De=h(()=>{jf();Nf();jf();sC();fr=Wf(nC),Vb=fr});var Kf=se(mo=>{var{setCredentialFeature:Wb}=(Z(),v(kt)),{CredentialsProviderError:jb}=(te(),v(nt)),iC="AWS_ACCESS_KEY_ID",aC="AWS_SECRET_ACCESS_KEY",cC="AWS_SESSION_TOKEN",dC="AWS_CREDENTIAL_EXPIRATION",uC="AWS_CREDENTIAL_SCOPE",lC="AWS_ACCOUNT_ID",Kb=t=>async()=>{t?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let e=process.env[iC],r=process.env[aC],o=process.env[cC],n=process.env[dC],s=process.env[uC],i=process.env[lC];if(e&&r){let a={accessKeyId:e,secretAccessKey:r,...o&&{sessionToken:o},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...i&&{accountId:i}};return Wb(a,"CREDENTIALS_ENV_VARS","g"),a}throw new jb("Unable to find environment variable credentials.",{logger:t?.logger})};mo.ENV_ACCOUNT_ID=lC;mo.ENV_CREDENTIAL_SCOPE=uC;mo.ENV_EXPIRATION=dC;mo.ENV_KEY=iC;mo.ENV_SECRET=aC;mo.ENV_SESSION=cC;mo.fromEnv=Kb});var wc=se(ft=>{var{ProviderError:Xf,CredentialsProviderError:po,loadConfig:em}=(te(),v(nt)),Xb=oe("node:http"),{parseUrl:Yb}=(P(),v(at)),hC=t=>!!t&&typeof t=="object"&&typeof t.AccessKeyId=="string"&&typeof t.SecretAccessKey=="string"&&typeof t.Token=="string"&&typeof t.Expiration=="string",gC=t=>({accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:new Date(t.Expiration),...t.AccountId&&{accountId:t.AccountId}}),SC=1e3,EC=0,tm=({maxRetries:t=EC,timeout:e=SC})=>({maxRetries:t,timeout:e});function Is(t){return new Promise((e,r)=>{let o=Xb.request({method:"GET",...t,hostname:t.hostname?.replace(/^\[(.+)\]$/,"$1")});o.on("error",n=>{r(Object.assign(new Xf("Unable to connect to instance metadata service"),n)),o.destroy()}),o.on("timeout",()=>{r(new Xf("TimeoutError from instance metadata service")),o.destroy()}),o.on("response",n=>{let{statusCode:s=400}=n;(s<200||300<=s)&&(r(Object.assign(new Xf("Error response received from instance metadata service"),{statusCode:s})),o.destroy());let i=[];n.on("data",a=>{i.push(a)}),n.on("end",()=>{e(Buffer.concat(i)),o.destroy()})}),o.end()})}var Qf=(t,e)=>{let r=t();for(let o=0;o<e;o++)r=r.catch(t);return r},Rs="AWS_CONTAINER_CREDENTIALS_FULL_URI",Ac="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",Jf="AWS_CONTAINER_AUTHORIZATION_TOKEN",Qb=(t={})=>{let{timeout:e,maxRetries:r}=tm(t);return()=>Qf(async()=>{let o=await rN({logger:t.logger}),n=JSON.parse(await Jb(e,o));if(!hC(n))throw new po("Invalid response received from instance metadata service.",{logger:t.logger});return gC(n)},r)},Jb=async(t,e)=>(process.env[Jf]&&(e.headers={...e.headers,Authorization:process.env[Jf]}),(await Is({...e,timeout:t})).toString()),Zb="169.254.170.2",eN=new Set(["localhost","127.0.0.1"]),tN=new Set(["http:","https:"]),rN=async({logger:t})=>{if(process.env[Ac])return{hostname:Zb,path:process.env[Ac]};if(process.env[Rs]){let e;try{e=new URL(process.env[Rs])}catch{throw new po(`${process.env[Rs]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:t})}if(!e.hostname||!eN.has(e.hostname))throw new po(`${e.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:t});if(!e.protocol||!tN.has(e.protocol))throw new po(`${e.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:t});return{protocol:e.protocol,hostname:e.hostname,path:e.pathname+e.search,port:e.port?parseInt(e.port,10):void 0}}throw new po(`The container metadata credential provider cannot be used unless the ${Ac} or ${Rs} environment variable is set`,{tryNextLink:!1,logger:t})},Zf=class t extends po{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(e,r=!0){super(e,r),this.tryNextLink=r,Object.setPrototypeOf(this,t.prototype)}},xs;(function(t){t.IPv4="http://169.254.169.254",t.IPv6="http://[fd00:ec2::254]"})(xs||(xs={}));var oN="AWS_EC2_METADATA_SERVICE_ENDPOINT",nN="ec2_metadata_service_endpoint",sN={environmentVariableSelector:t=>t[oN],configFileSelector:t=>t[nN],default:void 0},Pn;(function(t){t.IPv4="IPv4",t.IPv6="IPv6"})(Pn||(Pn={}));var iN="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",aN="ec2_metadata_service_endpoint_mode",cN={environmentVariableSelector:t=>t[iN],configFileSelector:t=>t[aN],default:Pn.IPv4},yC=async()=>Yb(await dN()||await uN()),dN=async()=>em(sN)(),uN=async()=>{let t=await em(cN)();switch(t){case Pn.IPv4:return xs.IPv4;case Pn.IPv6:return xs.IPv6;default:throw new Error(`Unsupported endpoint mode: ${t}. Select from ${Object.values(Pn)}`)}},lN=300,fN=300,mN="https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html",fC=(t,e)=>{let r=lN+Math.floor(Math.random()*fN),o=new Date(Date.now()+r*1e3);e.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(o)}.
24
+ For more information, please visit: `+mN);let n=t.originalExpiration??t.expiration;return{...t,...n?{originalExpiration:n}:{},expiration:o}},pN=(t,e={})=>{let r=e?.logger||console,o;return async()=>{let n;try{n=await t(),n.expiration&&n.expiration.getTime()<Date.now()&&(n=fC(n,r))}catch(s){if(o)r.warn("Credential renew failed: ",s),n=fC(o,r);else throw s}return o=n,n}},CC="/latest/meta-data/iam/security-credentials/",hN="/latest/api/token",Yf="AWS_EC2_METADATA_V1_DISABLED",mC="ec2_metadata_v1_disabled",pC="x-aws-ec2-metadata-token",gN=(t={})=>pN(SN(t),{logger:t.logger}),SN=(t={})=>{let e=!1,{logger:r,profile:o}=t,{timeout:n,maxRetries:s}=tm(t),i=async(a,c)=>{if(e||c.headers?.[pC]==null){let l=!1,m=!1,g=await em({environmentVariableSelector:S=>{let E=S[Yf];if(m=!!E&&E!=="false",E===void 0)throw new po(`${Yf} not set in env, checking config file next.`,{logger:t.logger});return m},configFileSelector:S=>{let E=S[mC];return l=!!E&&E!=="false",l},default:!1},{profile:o})();if(t.ec2MetadataV1Disabled||g){let S=[];throw t.ec2MetadataV1Disabled&&S.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"),l&&S.push(`config file profile (${mC})`),m&&S.push(`process environment variable (${Yf})`),new Zf(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${S.join(", ")}].`)}}let u=(await Qf(async()=>{let l;try{l=await yN(c)}catch(m){throw m.statusCode===401&&(e=!1),m}return l},a)).trim();return Qf(async()=>{let l;try{l=await CN(u,c,t)}catch(m){throw m.statusCode===401&&(e=!1),m}return l},a)};return async()=>{let a=await yC();if(e)return r?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),i(s,{...a,timeout:n});{let c;try{c=(await EN({...a,timeout:n})).toString()}catch(d){if(d?.statusCode===400)throw Object.assign(d,{message:"EC2 Metadata token request returned error"});return(d.message==="TimeoutError"||[403,404,405].includes(d.statusCode))&&(e=!0),r?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),i(s,{...a,timeout:n})}return i(s,{...a,headers:{[pC]:c},timeout:n})}}},EN=async t=>Is({...t,path:hN,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),yN=async t=>(await Is({...t,path:CC})).toString(),CN=async(t,e,r)=>{let o=JSON.parse((await Is({...e,path:CC+t})).toString());if(!hC(o))throw new po("Invalid response received from instance metadata service.",{logger:r.logger});return gC(o)};ft.DEFAULT_MAX_RETRIES=EC;ft.DEFAULT_TIMEOUT=SC;ft.ENV_CMDS_AUTH_TOKEN=Jf;ft.ENV_CMDS_FULL_URI=Rs;ft.ENV_CMDS_RELATIVE_URI=Ac;ft.Endpoint=xs;ft.fromContainerMetadata=Qb;ft.fromInstanceMetadata=gN;ft.getInstanceMetadataEndpoint=yC;ft.httpRequest=Is;ft.providerConfigFromInit=tm});var bn=se(ks=>{var{hasOwn:IC}=(D(),v(_t)),{streamCollector:_N}=(D(),v(_t));ks.streamCollector=_N;var{buildQueryString:vC,HttpResponse:kC}=(P(),v(at)),Rc=oe("node:https"),{Readable:TN}=oe("node:stream"),rm=oe("node:http2");function Ic(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let o=new Error(String(e));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var AN=["ECONNRESET","EPIPE","ETIMEDOUT"],PC=t=>{let e={};for(let r in t){if(!IC(t,r))continue;let o=t[r];e[r]=Array.isArray(o)?o.join(","):o}return e},Ae={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},_C=1e3,wN=(t,e,r=0)=>{if(!r)return-1;let o=n=>{let s=Ae.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{Ae.clearTimeout(s)}):Ae.clearTimeout(s)};t.socket?i(t.socket):t.on("socket",i)};return r<2e3?(o(0),0):Ae.setTimeout(o.bind(null,_C),_C)},RN=(t,e,r=0,o,n)=>r?Ae.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1,xN=3e3,IN=(t,{keepAlive:e,keepAliveMsecs:r},o=xN)=>{if(e!==!0)return-1;let n=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",s=>{s.setKeepAlive(e,r||0)})};return o===0?(n(),0):Ae.setTimeout(n,o)},om=t=>{let e=t?.defaultSocketTimeout;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0},TC=3e3,AC=(t,e,r=0,o=!1)=>{let n;o&&t.once("response",a=>n=a);let s=a=>{let c=r-a,d=()=>{let u=Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (${o?"service default socket timeout":"configured by client requestHandler"}).`),{name:"TimeoutError"});o&&n?.destroy(u),t.destroy(),e(u)};t.socket?(t.socket.setTimeout(c,d),t.on("close",()=>t.socket?.removeListener("timeout",d))):t.setTimeout(c,d)};if(0<r&&r<6e3)return s(0),0;let i=Ae.setTimeout(s.bind(null,r===0?0:TC),TC);return o?(t.once("close",()=>Ae.clearTimeout(i)),0):i},wC=6e3;async function bC(t,e,r=wC,o=!1){let n=e.headers,s=n?n.Expect||n.expect:void 0,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(Ae.setTimeout(()=>c(!0),Math.max(wC,r)))}),new Promise(c=>{t.on("continue",()=>{Ae.clearTimeout(i),c(!0)}),t.on("response",()=>{Ae.clearTimeout(i),c(!1)}),t.on("error",()=>{Ae.clearTimeout(i),c(!1)})})])),a&&vN(t,e.body)}function vN(t,e){if(e instanceof TN){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){t.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}t.end(Buffer.from(e));return}t.end()}var kN=0,xc,RC,nm=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){if(!IC(n,c))continue;let d=n[c]?.length??0,u=s[c]?.length??0;if(d>=i&&u>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${d} and ${u} additional requests are enqueued.
25
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
26
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=n.logger,i=e.protocol==="https:";return!i&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((a,c)=>{let d,u=-1,l=-1,m=-1,g=-1,S=-1,E=()=>{Ae.clearTimeout(u),Ae.clearTimeout(l),Ae.clearTimeout(m),Ae.clearTimeout(g),Ae.clearTimeout(S)},C=async A=>{await d,E(),a(A)},y=async A=>{await d,E(),c(A)};if(r?.aborted){let A=Ic(r);y(A);return}let T=e.headers,w=T?(T.Expect??T.expect)==="100-continue":!1,I=i?n.httpsAgent:n.httpAgent;w&&!this.externalAgent&&(I=new(i?Rc.Agent:xc)({keepAlive:!1,maxSockets:1/0})),u=Ae.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(I,this.socketWarningTimestamp,s)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let b=e.query?vC(e.query):"",F;if(e.username!=null||e.password!=null){let A=e.username??"",U=e.password??"";F=`${A}:${U}`}let B=e.path;b&&(B+=`?${b}`),e.fragment&&(B+=`#${e.fragment}`);let O=e.hostname??"";O[0]==="["&&O.endsWith("]")?O=e.hostname.slice(1,-1):O=e.hostname;let Q={headers:e.headers,host:O,method:e.method,path:B,port:e.port,agent:I,auth:F},$=(i?Rc.request:RC)(Q,A=>{let U=new kC({statusCode:A.statusCode||-1,reason:A.statusMessage,headers:PC(A.headers),body:A});C({response:U})});if($.on("error",A=>{AN.includes(A.code)?y(Object.assign(A,{name:"TimeoutError"})):y(A)}),r){let A=()=>{$.destroy();let U=Ic(r);y(U)};if(typeof r.addEventListener=="function"){let U=r;U.addEventListener("abort",A,{once:!0}),$.once("close",()=>U.removeEventListener("abort",A))}else r.onabort=A}let z=o??n.requestTimeout;l=wN($,y,n.connectionTimeout),m=RN($,y,z,n.throwOnRequestTimeout,s??console);let R=n.socketTimeout===void 0?om(n):void 0;R?g=AC($,y,R,!0):g=AC($,y,n.socketTimeout);let _=Q.agent;typeof _=="object"&&"keepAlive"in _&&(S=IN($,{keepAlive:_.keepAlive,keepAliveMsecs:_.keepAliveMsecs})),d=bC($,e,z,this.externalAgent).catch(A=>(E(),c(A)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>e===Symbol.for("logger")?{...o,logger:o.logger??r}:{...o,[e]:r})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:d}=e||{},u=!0,l=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,defaultSocketTimeout:om(e),socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let m=oe("node:http"),{Agent:g,request:S}=m.default??m;return RC=S,xc=g,i instanceof xc||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new xc({keepAlive:u,maxSockets:l,...i})},httpsAgent:a instanceof Rc.Agent||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new Rc.Agent({keepAlive:u,maxSockets:l,...a}),logger:d}}},PN=new Uint16Array(1),vs=class{id=PN[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(!this.session.destroyed&&(this.refs-=1,this.refs===0&&this.session.unref(),this.refs<0))throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){this.session.closed||this.session.close()}destroy(){this.refs=0,this.session.destroyed||(this.session.setTimeout(0),this.session.destroy())}useCount(){return this.refs}},sm=class{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map(r=>new vs(r))}poll(){let e=!1;for(let r of this.sessions){if(r.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||r.useCount()<this.maxConcurrency)return r}if(e)for(let r of this.sessions)r.deref().destroyed&&this.remove(r)}offerLast(e){this.sessions.push(e)}remove(e){let r=this.sessions.indexOf(e);r>-1&&this.sessions.splice(r,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}},im=class{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}lease(e,r){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!r.isEventStream){let d=n.poll();if(d)return d.retain(),d}let s=new vs(this.connect(o)),i=s.deref();this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},d=>{if(d)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(o,s)},c=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};return i.on("goaway",a),i.on("error",c),i.on("frameError",c),i.on("close",c),r.requestTimeout&&i.setTimeout(r.requestTimeout,c),n.offerLast(s),s.retain(),s}release(e,r){r.free()}createIsolatedSession(e,r){let o=this.getUrlString(e),n=new vs(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};s.on("error",i),s.on("frameError",i),s.on("close",i);let a=r.requestTimeout??3e5;return s.setTimeout(a,i),n.retain(),n}destroy(){for(let[e,r]of this.connectionPools){for(let o of[...r])o.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let r of this.connectionPools.values())r.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[r,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[r]={sessions:n}}return e}removeFromPoolAndClose(e,r){this.connectionPools.get(e)?.remove(r),r.close()}removeFromPoolAndCheckedDestroy(e,r){this.connectionPools.get(e)?.remove(r),r.destroy()}getPool(e){if(!this.connectionPools.has(e)){let r=new sm;this.config.maxConcurrency&&r.setMaxConcurrency(this.config.maxConcurrency),this.connectionPools.set(e,r)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?rm.connect(e):rm.connect(e,this.connectOptions)}},{constants:xC}=rm,am=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new im({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(n||{})}).catch(o):r(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:r,requestTimeout:o,isEventStream:n}={}){if(!this.config){let l=await this.configProvider;this.config={...l,defaultSocketTimeout:om(l)};let{disableConcurrentStreams:m,maxConcurrentStreams:g,nodeHttp2ConnectOptions:S}=this.config;this.connectionManager.setDisableConcurrentStreams(m??!1),g&&this.connectionManager.setMaxConcurrentStreams(g),S&&this.connectionManager.setNodeHttp2ConnectOptions(S)}let{requestTimeout:s,disableConcurrentStreams:i,sessionTimeout:a}=this.config,c=i||n,d=o??s,u=d===void 0&&a===void 0?this.config.defaultSocketTimeout:void 0;return new Promise((l,m)=>{let g=!1,S,E=async U=>{await S,l(U)},C=async U=>{await S,m(U)};if(r?.aborted){g=!0;let U=Ic(r);C(U);return}let{hostname:y,method:T,port:w,protocol:I,query:b}=e,F="";if(e.username!=null||e.password!=null){let U=e.username??"",zt=e.password??"";F=`${U}:${zt}@`}let B=`${I}//${F}${y}${w?`:${w}`:""}`,O={destination:new URL(B)},Q={requestTimeout:this.config?.sessionTimeout,isEventStream:n},J=c?this.connectionManager.createIsolatedSession(O,Q):this.connectionManager.lease(O,Q),$=J.deref(),z=U=>{c&&J.destroy(),g=!0,C(U)},R=b?vC(b):"",_=e.path;R&&(_+=`?${R}`),e.fragment&&(_+=`#${e.fragment}`);let A=$.request({...e.headers,[xC.HTTP2_HEADER_PATH]:_,[xC.HTTP2_HEADER_METHOD]:T});if(d?A.setTimeout(d,()=>{A.close();let U=new Error(`Stream timed out because of no activity for ${d} ms`);U.name="TimeoutError",z(U)}):u&&(A.setTimeout(u,()=>{let U=new Error(`Stream timed out because of no activity for ${u} ms`);U.name="TimeoutError",g=!0,C(U),A.destroy(U),c&&J.destroy()}),A.once("response",()=>A.setTimeout(u))),r){let U=()=>{A.close();let zt=Ic(r);z(zt)};if(typeof r.addEventListener=="function"){let zt=r;zt.addEventListener("abort",U,{once:!0}),A.once("close",()=>zt.removeEventListener("abort",U))}else r.onabort=U}A.on("frameError",(U,zt,wP)=>{z(new Error(`Frame type id ${U} in stream id ${wP} has failed with code ${zt}.`))}),A.on("error",z),A.on("aborted",()=>{z(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${A.rstCode}.`))}),A.on("response",U=>{let zt=new kC({statusCode:U[":status"]??-1,headers:PC(U),body:A});g=!0,E({response:zt}),c&&($.close(),A.on("end",()=>{J.destroy()}))}),A.on("close",()=>{if(c?J.destroy():this.connectionManager.release(O,J),!g){let U=new Error("Unexpected error: http2 request did not get a response");$.destroyed&&(U.name="TimeoutError"),z(U)}}),S=bC(A,e,d)})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}};ks.DEFAULT_REQUEST_TIMEOUT=kN;ks.NodeHttp2Handler=am;ks.NodeHttpHandler=nm});var cm=se(OC=>{var{setCredentialFeature:bN}=(Z(),v(kt)),{CredentialsProviderError:Do}=(te(),v(nt)),{NodeHttpHandler:NN}=bn(),ON=oe("node:fs/promises"),{HttpRequest:DN}=(P(),v(at)),{sdkStreamMixin:MN,parseRfc3339DateTime:$N}=(D(),v(_t)),LN="169.254.170.2",UN="169.254.170.23",BN="[fd00:ec2::23]",GN=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===LN||t.hostname===UN||t.hostname===BN)){if(t.hostname.includes("[")){if(t.hostname==="[::1]"||t.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(t.hostname==="localhost")return;let r=t.hostname.split("."),o=n=>{let s=parseInt(n,10);return 0<=s&&s<=255};if(r[0]==="127"&&o(r[1])&&o(r[2])&&o(r[3])&&r.length===4)return}throw new Do(`URL not accepted. It must either be HTTPS or match one of the following:
27
+ - loopback CIDR 127.0.0.0/8 or [::1/128]
28
+ - ECS container host 169.254.170.2
29
+ - EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:e})}};function FN(t){return new DN({protocol:t.protocol,hostname:t.hostname,port:Number(t.port),path:t.pathname,query:Array.from(t.searchParams.entries()).reduce((e,[r,o])=>(e[r]=o,e),{}),fragment:t.hash})}async function HN(t,e){let o=await MN(t.body).transformToString();if(t.statusCode===200){let n=JSON.parse(o);if(typeof n.AccessKeyId!="string"||typeof n.SecretAccessKey!="string"||typeof n.Token!="string"||typeof n.Expiration!="string")throw new Do("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:e});return{accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,sessionToken:n.Token,expiration:$N(n.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let n={};try{n=JSON.parse(o)}catch{}throw Object.assign(new Do(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:n.Code,Message:n.Message})}throw new Do(`Server responded with status: ${t.statusCode}`,{logger:e})}var zN=(t,e,r)=>async()=>{for(let o=0;o<e;++o)try{return await t()}catch{await new Promise(s=>setTimeout(s,r))}return await t()},qN="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",VN="http://169.254.170.2",WN="AWS_CONTAINER_CREDENTIALS_FULL_URI",jN="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",KN="AWS_CONTAINER_AUTHORIZATION_TOKEN",XN=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.awsContainerCredentialsRelativeUri??process.env[qN],o=t.awsContainerCredentialsFullUri??process.env[WN],n=t.awsContainerAuthorizationToken??process.env[KN],s=t.awsContainerAuthorizationTokenFile??process.env[jN],i=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?.warn?console.warn:t.logger.warn.bind(t.logger);if(r&&o&&(i("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),i("awsContainerCredentialsRelativeUri will take precedence.")),n&&s&&(i("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),i("awsContainerAuthorizationTokenFile will take precedence.")),r)e=`${VN}${r}`;else if(o)e=o;else throw new Do(`No HTTP credential provider host provided.
30
+ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:t.logger});let a=new URL(e);GN(a,t.logger);let c=NN.create({connectionTimeout:t.timeout??1e3}),d=t.timeout??1e3,u=zN(async()=>{let l=FN(a);s?l.headers.Authorization=NC((await ON.readFile(s)).toString()):n&&(l.headers.Authorization=NC(n));try{let m=await c.handle(l,{requestTimeout:d});return HN(m.response).then(g=>bN(g,"CREDENTIALS_HTTP","z"))}catch(m){throw new Do(String(m),{logger:t.logger})}},t.maxRetries??3,t.timeout??1e3);return async()=>{try{return await u()}finally{c.destroy?.()}}},NC=t=>{if(t.includes(`\r
31
+ `))throw new Do("Authorization token contains invalid \\r\\n sequence.");return t};OC.fromHttp=XN});function YN(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function QN(t){return{schemeId:"smithy.api#noAuth"}}var DC,MC,$C,dm=h(()=>{De();M();DC=async(t,e,r)=>({operation:Ie(e).operation,region:await Be(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});MC=t=>{let e=[];return t.operation==="CreateToken"?e.push(QN(t)):e.push(YN(t)),e},$C=t=>{let e=fr(t);return Object.assign(e,{authSchemePreference:Be(t.authSchemePreference??[])})}});var LC,UC,um=h(()=>{LC=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"}),UC={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var ho,Ps=h(()=>{ho={name:"@aws-sdk/nested-clients",version:"3.997.51",description:"Nested clients for AWS SDK packages.",homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",license:"Apache-2.0",author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/sdk-for-javascript/"},repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"packages/nested-clients"},files:["./cognito-identity.d.ts","./cognito-identity.js","./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sso.d.ts","./sso.js","./sts.d.ts","./sts.js","dist-*/**"],sideEffects:!1,main:"./dist-cjs/index.js",module:"./dist-es/index.js",browser:{"./dist-es/submodules/cognito-identity/runtimeConfig":"./dist-es/submodules/cognito-identity/runtimeConfig.browser","./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sso/runtimeConfig":"./dist-es/submodules/sso/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},types:"./dist-types/index.d.ts",typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"],"*":["dist-types/ts3.4/submodules/*/index.d.ts"]}},"react-native":{},exports:{"./package.json":"./package.json","./sso-oidc":{types:"./dist-types/submodules/sso-oidc/index.d.ts",module:"./dist-es/submodules/sso-oidc/index.js",node:"./dist-cjs/submodules/sso-oidc/index.js",import:"./dist-es/submodules/sso-oidc/index.js",require:"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{types:"./dist-types/submodules/sts/index.d.ts",module:"./dist-es/submodules/sts/index.js",node:"./dist-cjs/submodules/sts/index.js",import:"./dist-es/submodules/sts/index.js",require:"./dist-cjs/submodules/sts/index.js"},"./signin":{types:"./dist-types/submodules/signin/index.d.ts",module:"./dist-es/submodules/signin/index.js",node:"./dist-cjs/submodules/signin/index.js",import:"./dist-es/submodules/signin/index.js",require:"./dist-cjs/submodules/signin/index.js"},"./cognito-identity":{types:"./dist-types/submodules/cognito-identity/index.d.ts",module:"./dist-es/submodules/cognito-identity/index.js",node:"./dist-cjs/submodules/cognito-identity/index.js",import:"./dist-es/submodules/cognito-identity/index.js",require:"./dist-cjs/submodules/cognito-identity/index.js"},"./sso":{types:"./dist-types/submodules/sso/index.d.ts",module:"./dist-es/submodules/sso/index.js",node:"./dist-cjs/submodules/sso/index.js",import:"./dist-es/submodules/sso/index.js",require:"./dist-cjs/submodules/sso/index.js"}},scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline","build:es":"premove dist-es && tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"premove dist-types && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types",lint:"node ../../scripts/validation/submodules-linter.js",prebuild:"yarn lint",test:"yarn g:vitest run","test:watch":"yarn g:vitest watch"},dependencies:{"@aws-sdk/core":"^3.978.6","@aws-sdk/signature-v4-multi-region":"^3.996.49","@aws-sdk/types":"^3.975.0","@smithy/core":"^3.37.0","@smithy/fetch-http-handler":"^5.8.0","@smithy/node-http-handler":"^4.13.0","@smithy/types":"^4.19.0",tslib:"^2.6.2"},devDependencies:{concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~7.0.2"},engines:{node:">=20.0.0"}}});var lm,BC=h(()=>{lm=Symbol("@smithy/core/cbor::tagSymbol")});var bs,fm=h(()=>{bs=(t,e)=>{let r=o=>{let n=o;return typeof n=="number"&&(n=n.toString()),n.indexOf(",")>=0&&(n=n.split(",")[0]),n.indexOf(":")>=0&&(n=n.split(":")[0]),n};if(e.__type!==void 0)return r(e.__type)}});function Oc(t){let e=t.getSchema(),r=e[GC];if(r)return r;let o=[],n=[];for(let[a,c]of t.structIterator())o.push(a),n.push(c);let s=new Array(o.length);for(let a=0;a<o.length;++a)s[a]=ZN(o[a]);let i={memberNames:o,memberSchemas:n,encodedKeys:s};return e[GC]=i,i}function ZN(t){let e;Dc?e=Buffer.from(t,"utf-8"):e=new TextEncoder().encode(t);let r=e.length,o;r<24?o=1:r<256?o=2:o=3;let n=new Uint8Array(o+r);return o===1?n[0]=96|r:o===2?(n[0]=120,n[1]=r):(n[0]=121,n[1]=r>>8,n[2]=r&255),n.set(e,o),n}function VC(t){return Dc?Buffer.allocUnsafe(t):new Uint8Array(t)}function Mn(t,e,r,o){if(e==null){if(e===void 0&&t.isIdempotencyToken()){mr(st());return}ee(1),L[N++]=246;return}if(t.isUnitSchema()){ee(1),we(5,0);return}if(typeof e=="object"){if(t.isBlobSchema()&&e instanceof Uint8Array){vc(e);return}if(t.isTimestampSchema()&&e instanceof Date){gm(e);return}if(t.isStructSchema()){tO(t,e,o);return}if(Array.isArray(e)&&(t.isListSchema()||t.isDocumentSchema())){zC(t,e,t.isDocumentSchema(),o);return}if(t.isMapSchema()){pm(t,e,!1,o);return}if(e instanceof Date){gm(e);return}if(e instanceof Uint8Array){vc(e);return}if(e instanceof K){KC(e);return}if(e[lm]){let s=e;jC(s.tag,s.value);return}if(t.isDocumentSchema()){Array.isArray(e)?zC(t,e,!0,o):pm(t,e,!0,o);return}if(t.isBigDecimalSchema()){$n(e);return}pm(t,e,!0,o);return}if(typeof e=="string"){if(t.isBlobSchema()){let s=(o?.base64Decoder??ge)(e);vc(s);return}mr(e);return}if(typeof e=="number"){ee(9),Number.isInteger(e)&&e>=-9007199254740992&&e<=9007199254740991?Mc(e):Am(e);return}if(typeof e=="boolean"){ee(1),L[N++]=224|(e?21:20);return}if(typeof e=="bigint"){bc(e);return}mr(String(e))}function tO(t,e,r){if(t.isUnionSchema()){let l=!1;for(let[m,g]of t.structIterator()){let S=e[m];if(S!=null){ee(9),we(5,1),mr(m),Mn(g,S,t,r),l=!0;break}}if(!l){let{$unknown:m}=e;Array.isArray(m)?(ee(9),we(5,1),mr(m[0]),$n(m[1])):(ee(9),we(5,0))}return}let o=Oc(t),{memberNames:n,memberSchemas:s,encodedKeys:i}=o,a=n.length,c;a<24?c=1:a<256?c=2:c=3,ee(c);let d=N;N+=c;let u=0;for(let l=0;l<a;++l){let m=e[n[l]];if(m==null&&!s[l].isIdempotencyToken())continue;let g=i[l];ee(g.length),L.set(g,N),N+=g.length,Mn(s[l],m,t,r),++u}if(typeof e.__type=="string")for(let l in e)H(e,l)&&(n.includes(l)||(mr(l),$n(e[l]),++u));c===1?L[d]=160|u:c===2?(L[d]=184,L[d+1]=u):(L[d]=185,L[d+1]=u>>8,L[d+2]=u&255)}function zC(t,e,r,o){let n=!!t.getMergedTraits().sparse,s=t.getValueSchema();if(r||n){let i=[];for(let a=0;a<e.length;++a){let c=e[a];r?c!==void 0&&i.push(c):(c!=null||n)&&i.push(c)}ee(9),we(4,i.length);for(let a=0;a<i.length;++a)Mn(s,i[a],void 0,o)}else{let i=0;for(let a=0;a<e.length;++a)e[a]!=null&&++i;ee(9),we(4,i);for(let a=0;a<e.length;++a)e[a]!=null&&Mn(s,e[a],void 0,o)}}function pm(t,e,r,o){let n=!!t.getMergedTraits().sparse,s=t.getValueSchema(),i=[];for(let a in e){if(!H(e,a))continue;let c=e[a];(r?c!==void 0:c!=null||n)&&i.push(a)}ee(9),we(5,i.length);for(let a=0;a<i.length;++a){let c=i[a];mr(c),Mn(s,e[c],void 0,o)}}function $n(t){if(t==null){ee(1),L[N++]=246;return}if(typeof t=="string"){mr(t);return}if(typeof t=="number"){ee(9),Number.isInteger(t)&&t>=-9007199254740992&&t<=9007199254740991?Mc(t):Am(t);return}if(typeof t=="boolean"){ee(1),L[N++]=224|(t?21:20);return}if(typeof t=="bigint"){bc(t);return}if(t instanceof Uint8Array){vc(t);return}if(t instanceof Date){gm(t);return}if(t instanceof K){KC(t);return}if(t[lm]){let e=t;jC(e.tag,e.value);return}if(Array.isArray(t)){ee(9),we(4,t.length);for(let e=0;e<t.length;++e)$n(t[e]);return}if(typeof t=="object"){let e=Object.keys(t);ee(9),we(5,e.length);for(let r=0;r<e.length;++r)mr(e[r]),$n(t[e[r]]);return}mr(String(t))}function ee(t){if(N+t>L.length){let e=L.length*2;for(;e<N+t;)e*=2;let r=VC(e);r.set(L.subarray(0,N)),L=r,$o=new DataView(r.buffer,r.byteOffset,r.byteLength)}}function we(t,e){if(e<24)L[N++]=t<<5|e;else if(e<256)L[N++]=t<<5|24,L[N++]=e;else if(e<65536)L[N++]=t<<5|25,L[N++]=e>>8,L[N++]=e&255;else if(e<4294967296)L[N++]=t<<5|26,$o.setUint32(N,e),N+=4;else{L[N++]=t<<5|27;let r=e/4294967296|0,o=e-r*4294967296|0;$o.setUint32(N,r),$o.setUint32(N+4,o),N+=8}}function WC(t,e){let r=Number(e);if(r<4294967296){we(t,r);return}L[N++]=t<<5|27,$o.setBigUint64(N,e),N+=8}function mr(t){let e=t.length;if(e<=23){let r=Nn.get(t);if(r){ee(r.bytes.length),L.set(r.bytes,N),N+=r.bytes.length,r.epoch=mm;return}let o=N;qC(t,e);let n=N,s=Uint8Array.prototype.slice.call(L,o,n);if(Nn.size>=FC){if(HC)return;let i=0;for(let[a,c]of Nn){if(i>=1024)break;c.epoch!==mm&&(Nn.delete(a),++i)}if(i===0){HC=!0;return}}Nn.size<FC&&Nn.set(t,{epoch:mm,bytes:s});return}qC(t,e)}function qC(t,e){if(Dc){let r=e*3;ee(r+9);let o=Buffer.byteLength(t);we(3,o),N+=L.write(t,N)}else{let r=e*3;ee(r+9);let o=N,s=eO.encodeInto(t,L.subarray(o+9)).written,i;s<24?i=1:s<256?i=2:s<65536?i=3:s<4294967296?i=5:i=9,i<9&&L.copyWithin(o+i,o+9,o+9+s),N=o,we(3,s),N+=s}}function Am(t){ee(9),L[N++]=251,$o.setFloat64(N,t),N+=8}function Mc(t){ee(9);let e=t>=0,r=e?0:1,o=e?t:-t-1;we(r,o)}function bc(t){let e=t>=0,r=e?0:1,o=e?t:-t-BigInt(1);if(o<BigInt("18446744073709551616"))ee(9),WC(r,o);else{let n=o.toString(2),s=Math.ceil(n.length/8),i=new Uint8Array(s),a=o;for(let c=s-1;c>=0;--c)i[c]=Number(a&BigInt(255)),a>>=BigInt(8);ee(s+16),L[N++]=e?194:195,we(2,s),L.set(i,N),N+=s}}function vc(t){ee(t.length+9),we(2,t.length),L.set(t,N),N+=t.length}function jC(t,e){ee(9),typeof t=="bigint"?WC(6,t):we(6,t),$n(e)}function KC(t){let e=t.string,r=BigInt(0),o=e.search(/[eE]/);o!==-1&&(r=BigInt(e.slice(o+1)),e=e.slice(0,o));let n=e.indexOf("."),s=n===-1?0:e.length-n-1,i=r-BigInt(s),a=BigInt(e.replace(".",""));ee(9),L[N++]=196,we(4,2),ee(9),i>=-0x20000000000000n&&i<=0x1fffffffffffffn?Mc(Number(i)):bc(i),bc(a)}function gm(t){ee(18),we(6,1);let e=t.getTime()/1e3;Number.isInteger(e)?Mc(e):Am(e)}var Pc,GC,Dc,eO,hm,L,$o,N,FC,Nn,mm,HC,wm=h(()=>{re();P();W();D();BC();Pc=class extends ye{write(e,r){N=0;let o=x.of(e);Mn(o,r,void 0,this.serdeContext)}flush(){let e=L.subarray(0,N);return N=0,L=VC(hm),$o=new DataView(L.buffer,L.byteOffset,L.byteLength),e}},GC=Symbol.for("@smithy/cbor-struct-cache");Dc=typeof Buffer<"u",eO=new TextEncoder,hm=2048,L=Dc?Buffer.allocUnsafe(hm):new Uint8Array(hm),$o=new DataView(L.buffer,L.byteOffset,L.byteLength),N=0,FC=2048,Nn=new Map,mm=0,HC=!1});function Je(t){if(k>=Re)throw new Error("unexpected end of CBOR payload.");let e=(ce[k]&224)>>5;if((ce[k]&31)===31&&e>=2&&e<=5)return iO(t,e);switch(e){case 0:return lO();case 1:return fO();case 2:return Gc();case 3:return Ln();case 4:return rO(t);case 5:return oO(t);case 6:return sO(t);case 7:return pO();default:throw new Error(`unexpected CBOR major type ${e}.`)}}function rO(t){let e=Bc(),r=t.isListSchema()?t.getValueSchema():t,o=Array(e);for(let n=0;n<e;++n)o[n]=Je(r);return o}function oO(t){let e=Bc();if(t.isStructSchema())return nO(t,e,k);let r=t.isMapSchema()?t.getValueSchema():t,o={};for(let n=0;n<e;++n){let s=Ln();o[s]=Je(r)}return o}function nO(t,e,r){let o=t.isUnionSchema(),n=Oc(t),{memberSchemas:s,encodedKeys:i,memberNames:a}=n,c=i.length,d={},u,l,m=0,g=!1,S=0;for(let E=0;E<e;++E){let C=JC(i,c,S);if(C>=0){S=C+1,S>=c&&(S=0);let y=Je(s[C]);y!=null&&(d[a[C]]=y)}else{let y=Ln(),T=Je(x.of(15));y==="__type"&&typeof T=="string"?g=!0:(u=y,l=T,++m)}}if(o){let E=!0;for(let C in d)if(H(d,C)){E=!1;break}E&&m===1&&(d.$unknown=[u,l])}else if(g){k=r;let E=x.of(15);for(let C=0;C<e;++C){let y=Ln(),T=Je(E);y in d||(d[y]=T)}}return d}function sO(t){let e=Uc(),r=typeof e=="bigint"?Number(e):e;if(r===1){let s=x.of(15),i=Je(s);return an(i)}if(r===2||r===3){let s=Gc(),i=BigInt(0);for(let a=0;a<s.length;++a)i=i<<BigInt(8)|BigInt(s[a]);return r===3?-i-BigInt(1):i}if(r===4){let s=x.of(15),i=Je(s),[a,c]=i,d=c<0?-1:1,u=BigInt(d)*BigInt(c),l=String(u),m=c<0?"-":"",g;if(typeof a=="number"&&Math.abs(a)<=2**28){let E=a,C="0".repeat(Math.abs(E)+1)+l;g=E===0?C:C.slice(0,C.length+E)+"."+C.slice(E),g=g.replace(/^0+/g,""),g===""&&(g="0"),g[0]==="."&&(g="0"+g),g=m+g}else{let E=BigInt(a);if(l.length===1)g=m+l+"e"+String(E);else{let C=E+BigInt(l.length-1);g=m+l[0]+"."+l.slice(1)+"e"+String(C)}}return Fg(g)}let o=x.of(15),n=Je(o);return{tag:ZC(e),value:n}}function iO(t,e){switch(e){case 3:return aO();case 2:return cO();case 4:return dO(t);case 5:return uO(t);default:throw new Error(`unexpected indefinite length for major ${e}.`)}}function aO(){k+=1;let t=[],e=0;for(;k<Re;){if(ce[k]===255){k+=1;let o=new Uint8Array(e),n=0;for(let s=0;s<t.length;++s)o.set(t[s],n),n+=t[s].length;return QC?Buffer.from(o.buffer,o.byteOffset,o.byteLength).toString("utf-8"):xm.decode(o)}let r=Gc();t.push(r),e+=r.length}throw new Error("expected break marker.")}function cO(){k+=1;let t=[],e=0;for(;k<Re;){if(ce[k]===255){k+=1;let o=new Uint8Array(e),n=0;for(let s=0;s<t.length;++s)o.set(t[s],n),n+=t[s].length;return o}let r=Gc();t.push(r),e+=r.length}throw new Error("expected break marker.")}function dO(t){k+=1;let e=t.isListSchema()?t.getValueSchema():t,r=[];for(;k<Re;){if(ce[k]===255)return k+=1,r;r.push(Je(e))}throw new Error("expected break marker.")}function uO(t){if(k+=1,t.isStructSchema()){let o=Oc(t),{memberSchemas:n,encodedKeys:s,memberNames:i}=o,a=s.length,c=t.isUnionSchema(),d={},u,l,m=0,g=0;for(;k<Re;){if(ce[k]===255){if(k+=1,c){let E=!0;for(let C in d)if(H(d,C)){E=!1;break}E&&m===1&&(d.$unknown=[u,l])}return d}let S=JC(s,a,g);if(S>=0){g=S+1,g>=a&&(g=0);let E=Je(n[S]);E!=null&&(d[i[S]]=E)}else{let E=Ln(),C=Je(x.of(15));E!=="__type"&&(u=E,l=C,++m)}}throw new Error("expected break marker.")}let e=t.isMapSchema()?t.getValueSchema():t,r={};for(;k<Re;){if(ce[k]===255)return k+=1,r;let o=Ln();r[o]=Je(e)}throw new Error("expected break marker.")}function JC(t,e,r){let o=t[r];if(k+o.length<=Re&&YC(k,o))return k+=o.length,r;for(let n=0;n<e;++n){if(n===r)continue;let s=t[n];if(k+s.length<=Re&&YC(k,s))return k+=s.length,n}return-1}function YC(t,e){let r=e.length;if(ce[t]!==e[0])return!1;for(let o=1;o<r;++o)if(ce[t+o]!==e[o])return!1;return!0}function Uc(){let t=ce[k]&31;if(t<24)return k+=1,t;switch(t){case 24:return Re-k<2&&Rr(1),k+=2,ce[k-1];case 25:return Re-k<3&&Rr(2),k+=3,go.getUint16(k-2);case 26:return Re-k<5&&Rr(4),k+=5,go.getUint32(k-4);case 27:{Re-k<9&&Rr(8),k+=9;let e=go.getUint32(k-8);return e<2097152?e*4294967296+go.getUint32(k-4):go.getBigUint64(k-8)}default:throw new Error(`unexpected minor value ${t}.`)}}function Bc(){let t=Uc();return typeof t=="bigint"?Number(t):t}function lO(){let t=Uc();return ZC(t)}function fO(){let t=Uc();return typeof t=="bigint"?BigInt(-1)-t:-1-t}function Gc(){let t=Bc();Re-k<t&&Rr(t);let e=k;return k+=t,ce.subarray(e,e+t)}function Ln(){let t=Bc();Re-k<t&&Rr(t);let e=k;return k+=t,t<24?mO(e,t):Im?ce.toString("utf-8",e,e+t):xm.decode(ce.subarray(e,e+t))}function mO(t,e){let r=e;for(let i=0;i<e;++i)r=r*31+ce[t+i]|0;let o=r>>>0&vm-1,n=XC[o];if(n!==void 0&&n.length===e){let i=!0;for(let a=0;a<e;++a)if(n.charCodeAt(a)!==ce[t+a]){i=!1;break}if(i)return Rm[o]=Ds,n}let s=Im?ce.toString("utf-8",t,t+e):xm.decode(ce.subarray(t,t+e));return Rm[o]!==Ds&&(XC[o]=s,Rm[o]=Ds),s}function pO(){let t=k,e=ce[t]&31;switch(e){case 21:return k=t+1,!0;case 20:return k=t+1,!1;case 22:return k=t+1,null;case 23:return k=t+1,null;case 25:return Re-t<3&&Rr(2),k=t+3,hO(ce[t+1],ce[t+2]);case 26:return Re-t<5&&Rr(4),k=t+5,go.getFloat32(t+1);case 27:return Re-t<9&&Rr(8),k=t+9,go.getFloat64(t+1);default:throw new Error(`unexpected minor value ${e} for major 7.`)}}function hO(t,e){let r=t>>7,o=(t&124)>>2,n=(t&3)<<8|e,s=r===0?1:-1;return o===0?n===0?0:s*(Math.pow(2,-14)*(n/1024)):o===31?n===0?s*(1/0):NaN:s*(Math.pow(2,o-15)*(1+n/1024))}function ZC(t){if(typeof t=="number")return t;let e=Number(t);return Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:t}function Rr(t){throw new Error(`CBOR: length ${t} greater than remaining buffer length.`)}function $c(t,e){if(t.isTimestampSchema()){if(typeof e=="number")return an(e);if(typeof e=="object"&&e!==null&&e.tag===1&&"value"in e)return an(e.value)}if(t.isBlobSchema()||typeof e>"u"||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="bigint"||typeof e=="symbol"||typeof e!="object"||e===null||"byteLength"in e||e instanceof Date||e instanceof K||t.isDocumentSchema())return e;if(t.isListSchema()){let o=t.getValueSchema(),n=[];for(let s of e)n.push($c(o,s));return n}let r={};if(t.isMapSchema()){let o=t.getValueSchema();for(let n in e)H(e,n)&&(r[n]=$c(o,e[n]))}else if(t.isStructSchema()){let o=t.isUnionSchema(),n;if(o){n=new Set;for(let s in e)H(e,s)&&s!=="__type"&&n.add(s)}for(let[s,i]of t.structIterator())o&&n.delete(s),e[s]!=null&&(r[s]=$c(i,e[s]));if(o&&n?.size===1){let s=!0;for(let i in r)if(H(r,i)){s=!1;break}if(s){let i=n.values().next().value;r.$unknown=[i,e[i]]}}else if(typeof e.__type=="string")for(let s in e)H(e,s)&&(s in r||(r[s]=e[s]))}return r}var Lc,QC,xm,ce,Im,go,k,Re,vm,XC,Rm,Ds,e_=h(()=>{re();P();W();D();wm();Lc=class extends ye{read(e,r){return ce=r,Im=QC&&r instanceof Buffer,go=new DataView(r.buffer,r.byteOffset,r.byteLength),k=0,Re=r.length,Ds=Ds+1&65535,Je(x.of(e))}readValue(e,r){return $c(x.of(e),r)}},QC=typeof Buffer<"u",xm=new TextDecoder,ce=new Uint8Array(0),Im=!1,go=new DataView(new ArrayBuffer(0)),k=0,Re=0,vm=2048,XC=new Array(vm),Rm=new Uint16Array(vm),Ds=0});var Fc,t_=h(()=>{P();wm();e_();Fc=class extends ye{createSerializer(){let e=new Pc;return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new Lc;return e.setSerdeContext(this.serdeContext),e}}});var Ms,r_=h(()=>{P();W();t_();fm();Ms=class extends Qr{codec=new Fc;serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();getShapeId(){return"smithy.protocols#rpcv2Cbor"}getPayloadCodec(){return this.codec}getSmithyProtocolHeaderValue(){return"rpc-v2-cbor"}applyEmptyBody(e){e.body||(this.serializer.write(15,{}),e.body=this.serializer.flush()),e.body instanceof Uint8Array&&(e.headers["content-length"]=String(e.body.byteLength))}async handleError(e,r,o,n,s){let i=bs(o,n)??"Unknown",a=["*"],{defaultNamespace:c}=this.options;a.unshift(c);let[d,u]=i.includes("#")?i.split("#"):[void 0,i];d&&a.unshift(d);let l={$metadata:s,$fault:o.statusCode<500?"client":"server"},m=[this.compositeErrorRegistry];d&&m.push(ie.for(d)),m.push(ie.for(c));let[g,S,E]=this.resolveError(u,a,m);if(E==="native"||E==="synthetic"){n.Message&&(n.message=n.Message);let I=E==="synthetic"?new S({name:u}):new Error(u);throw Object.assign(I,l,n)}let C=x.of(g),y=n.message??n.Message??"Unknown",T=new S({}),w={};for(let[I,b]of C.structIterator())w[I]=this.deserializer.readValue(b,n[I]);throw Object.assign(T,l,{$fault:C.getMergedTraits().error,message:y},w)}getDefaultContentType(){return"application/cbor"}}});var o_=h(()=>{fm();r_()});var mt,Un=h(()=>{M();W();mt=class{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,r){let o=r.getMemberSchemas(),n=Object.values(o).find(s=>!!s.getMergedTraits().httpPayload);if(n){let s=n.getMergedTraits().mediaType;return s||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":e)}else if(!r.isUnitSchema()&&Object.values(o).find(i=>{let{httpQuery:a,httpQueryParams:c,httpHeader:d,httpLabel:u,httpPrefixHeaders:l}=i.getMergedTraits();return!a&&!c&&!d&&!u&&l===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,r,o,n,s,i){let a=e;e.includes("#")&&([,a]=e.split("#"));let c={$metadata:s,$fault:o.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:i?.(this.errorRegistry,a)??this.errorRegistry.getSchema(e),errorMetadata:c}}catch{n.message=n.message??n.Message??"UnknownError";let u=this.errorRegistry,l=u.getBaseException();if(l){let S=u.getErrorCtor(l)??Error;throw this.decorateServiceException(Object.assign(new S({name:a}),c),n)}let m=n,g=m?.message??m?.Message??m?.Error?.Message??m?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(g),{name:a},c),n)}}compose(e,r,o){let n=o;r.includes("#")&&([n]=r.split("#"));let s=ie.for(n),i=ie.for("smithy.ts.sdk.synthetic."+o);e.copyFrom(s),e.copyFrom(i),this.errorRegistry=e}decorateServiceException(e,r={}){if(this.queryCompat){let o=e.Message??r.Message,n=Xu(e,r);o&&(n.message=o);let s=n.Error??{};s.Type=n.Error?.Type,s.Code=n.Error?.Code,s.Message=n.Error?.message??n.Error?.Message??o,n.Error=s;let i=n.$metadata.requestId;return i&&(n.RequestId=i),n}return Xu(e,r)}setQueryCompatError(e,r){let o=r.headers?.["x-amzn-query-error"];if(e!==void 0&&o!=null){let[n,s]=o.split(";"),i=Object.keys(e),a={Code:n,Type:s};e.Code=n,e.Type=s;for(let c=0;c<i.length;c++){let d=i[c];a[d==="message"?"Message":d]=e[d]}delete a.__type,e.Error=a}}queryCompatOutput(e,r){e.Error&&(r.Error=e.Error),e.Type&&(r.Type=e.Type),e.Code&&(r.Code=e.Code)}findQueryCompatibleError(e,r){try{return e.getSchema(r)}catch{return e.find(n=>x.of(n).getMergedTraits().awsQueryError?.[0]===r)}}}});var Hc,n_=h(()=>{o_();W();Un();Hc=class extends Ms{awsQueryCompatible;mixin;constructor({defaultNamespace:e,errorTypeRegistries:r,awsQueryCompatible:o}){super({defaultNamespace:e,errorTypeRegistries:r}),this.awsQueryCompatible=!!o,this.mixin=new mt(this.awsQueryCompatible)}async serializeRequest(e,r,o){let n=await super.serializeRequest(e,r,o);return this.awsQueryCompatible&&(n.headers["x-amzn-query-mode"]="true"),n}async handleError(e,r,o,n,s){this.awsQueryCompatible&&this.mixin.setQueryCompatError(n,o);let i=(()=>{let S=o.headers["x-amzn-query-error"];return S&&this.awsQueryCompatible?S.split(";")[0]:bs(o,n)??"Unknown"})();this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace);let{errorSchema:a,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,o,n,s,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),d=x.of(a),u=n.message??n.Message??"UnknownError",l=this.compositeErrorRegistry.getErrorCtor(a)??Error,m=new l({}),g={};for(let[S,E]of d.structIterator())n[S]!=null&&(g[S]=this.deserializer.readValue(E,n[S]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(n,g),this.mixin.decorateServiceException(Object.assign(m,c,{$fault:d.getMergedTraits().error,message:u},g),n)}}});var So,zc=h(()=>{P();W();Un();So=class extends Kt{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:e,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:e,errorTypeRegistries:r}),this.serviceTarget=o,this.codec=s??new it({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!n,this.mixin=new mt(this.awsQueryCompatible)}async serializeRequest(e,r,o){let n=await super.serializeRequest(e,r,o);return n.path.endsWith("/")||(n.path+="/"),n.headers["content-type"]=`application/x-amz-json-${this.getJsonRpcVersion()}`,n.headers["x-amz-target"]=`${this.serviceTarget}.${e.name}`,this.awsQueryCompatible&&(n.headers["x-amzn-query-mode"]="true"),(nn(e.input)==="unit"||!n.body)&&(n.body="{}"),n}getPayloadCodec(){return this.codec}async handleError(e,r,o,n,s){let{awsQueryCompatible:i}=this;i&&this.mixin.setQueryCompatError(n,o);let a=hn(o,n,i)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,a,this.options.defaultNamespace);let{errorSchema:c,errorMetadata:d}=await this.mixin.getErrorSchemaOrThrowBaseException(a,this.options.defaultNamespace,o,n,s,i?this.mixin.findQueryCompatibleError:void 0),u=x.of(c),l=n.message??n.Message??"UnknownError",m=this.compositeErrorRegistry.getErrorCtor(c)??Error,g=new m({}),S={},E=this.codec.createDeserializer();for(let[C,y]of u.structIterator())n[C]!=null&&(S[C]=E.readObject(y,n[C]));throw i&&this.mixin.queryCompatOutput(n,S),this.mixin.decorateServiceException(Object.assign(g,d,{$fault:u.getMergedTraits().error,message:l},S),n)}}});var qc,s_=h(()=>{zc();qc=class extends So{constructor({defaultNamespace:e,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:e,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s})}getShapeId(){return"aws.protocols#awsJson1_0"}getJsonRpcVersion(){return"1.0"}getDefaultContentType(){return"application/x-amz-json-1.0"}}});var Vc,i_=h(()=>{zc();Vc=class extends So{constructor({defaultNamespace:e,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:e,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}});var pr,a_=h(()=>{P();W();Un();pr=class extends Yr{serializer;deserializer;codec;mixin=new mt;constructor({defaultNamespace:e,errorTypeRegistries:r,jsonCodec:o}){super({defaultNamespace:e,errorTypeRegistries:r});let n={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=o??new it(n),this.serializer=new to(this.codec.createSerializer(),n),this.deserializer=new eo(this.codec.createDeserializer(),n)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(e){this.codec.setSerdeContext(e),super.setSerdeContext(e)}async serializeRequest(e,r,o){let n=await super.serializeRequest(e,r,o),s=x.of(e.input);if(!n.headers["content-type"]){let i=this.mixin.resolveRestContentType(this.getDefaultContentType(),s);i&&(n.headers["content-type"]=i)}return n.body==null&&n.headers["content-type"]===this.getDefaultContentType()&&(n.body="{}"),n}async deserializeResponse(e,r,o){let n=await super.deserializeResponse(e,r,o),s=x.of(e.output);for(let[i,a]of s.structIterator())a.getMemberTraits().httpPayload&&!(i in n)&&(n[i]=null);return n}async handleError(e,r,o,n,s){let i=pn(o,n)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace);let{errorSchema:a,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,o,n,s),d=x.of(a),u=n.message??n.Message??"UnknownError",l=this.compositeErrorRegistry.getErrorCtor(a)??Error,m=new l({});await this.deserializeHttpMessage(a,r,o,n);let g={},S=this.codec.createDeserializer();for(let[E,C]of d.structIterator()){let y=C.getMergedTraits().jsonName??E;g[E]=S.readObject(C,n[y])}throw this.mixin.decorateServiceException(Object.assign(m,c,{$fault:d.getMergedTraits().error,message:u},g),n)}getDefaultContentType(){return"application/json"}}});var Kc=se(jc=>{var gO=/[&<>"]/g,SO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function EO(t){return t.replace(gO,e=>SO[e])}var yO=/[&"'<>\r\n\u0085\u2028]/g,CO={"&":"&amp;",'"':"&quot;","'":"&apos;","<":"&lt;",">":"&gt;","\r":"&#x0D;","\n":"&#x0A;","\x85":"&#x85;","\u2028":"&#x2028;"};function _O(t){return t.replace(yO,e=>CO[e])}var Wc=class{value;constructor(e){this.value=e}toString(){return _O(""+this.value)}},Pm=class t{name;children;attributes={};static of(e,r,o){let n=new t(e);return r!==void 0&&n.addChildNode(new Wc(r)),o!==void 0&&n.withName(o),n}constructor(e,r=[]){this.name=e,this.children=r}withName(e){return this.name=e,this}addAttribute(e,r){return this.attributes[e]=r,this}addChildNode(e){return this.children.push(e),this}removeAttribute(e){return delete this.attributes[e],this}n(e){return this.name=e,this}c(e){return this.children.push(e),this}a(e,r){return r!=null&&(this.attributes[e]=r),this}cc(e,r,o=r){if(e[r]!=null){let n=t.of(r,e[r]).withName(o);this.c(n)}}l(e,r,o,n){e[r]!=null&&n().map(i=>{i.withName(o),this.c(i)})}lc(e,r,o,n){if(e[r]!=null){let s=n(),i=new t(o);s.map(a=>{i.c(a)}),this.c(i)}}toString(){let e=!!this.children.length,r=`<${this.name}`,o=this.attributes;for(let n of Object.keys(o)){let s=o[n];s!=null&&(r+=` ${n}="${EO(""+s)}"`)}return r+=e?`>${this.children.map(n=>n.toString()).join("")}</${this.name}>`:"/>"}};function km(t){Object.defineProperty(t,"__proto__",{value:void 0,writable:!0,enumerable:!0,configurable:!0})}function TO(t){return new bm(t).parse()}var bm=class t{x;i=0;z;constructor(e){this.x=e,this.x=e.replace(/\r\n?/g,`
32
+ `),this.z=this.x.length}parse(){let e=this,{z:r}=e;for(;e.i<r&&(e.trim(),!(e.i>=r));)if(e.isNext("<?"))e.readTo("?>"),e.trim();else if(e.isNext("<!--"))e.readTo("-->"),e.trim();else if(e.isNext("<!DOCTYPE",!1))e.skipDoctype(),e.trim();else if(e.x[e.i]==="<"){let o=e.parseTag();return{[o.tag]:o.value}}else throw new Error("@aws-sdk XML parse error: unexpected content.");throw new Error("@aws-sdk XML parse error: no root element.")}isNext(e,r=!0){let o=this;return r?o.x.startsWith(e,o.i):o.x.toLowerCase().startsWith(e.toLowerCase(),o.i)}readTo(e){let r=this,o=r.x.indexOf(e,r.i);if(o===-1)throw new Error(`@aws-sdk XML parse error: expected "${e}" not found.`);let n=r.x.slice(r.i,o);return r.i=o+e.length,n}trim(){let e=this;for(;e.i<e.z&&` \r
33
+ `.includes(e.x[e.i]);)++e.i}readAttrValue(){let e=this,r=e.x[e.i];++e.i;let o="";for(;e.i<e.z&&e.x[e.i]!==r;)o+=e.x[e.i++];return++e.i,e.decodeEntities(o)}parseTag(){let e=this;++e.i;let r="";for(;e.i<e.z&&!` \r
34
+ >/`.includes(e.x[e.i]);)r+=e.x[e.i++];let o=!1,n={};for(;e.i<e.z&&(e.trim(),!">/".includes(e.x[e.i]));){let u="";for(;e.i<e.z&&!`= \r
35
+ >/?`.includes(e.x[e.i]);)u+=e.x[e.i++];if(e.trim(),e.x[e.i]!=="=")break;++e.i,e.trim(),u==="__proto__"&&km(n),n[u]=e.readAttrValue(),o=!0}if(e.i>=e.z)throw new Error("@aws-sdk XML parse error: unexpected end of input.");if(e.x[e.i]==="/"){if(++e.i,e.i>=e.z||e.x[e.i]!==">")throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");return++e.i,{tag:r,value:o?n:""}}if(e.x[e.i]!==">")throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.");++e.i;let s=[],i=[],a=!1;for(;e.i<e.z&&!e.isNext("</");)if(e.x[e.i]==="<")e.isNext("<!--")?e.readTo("-->"):e.isNext("<![CDATA[")?(e.i+=9,s.push(e.readTo("]]>"))):e.isNext("<?")?e.readTo("?>"):(a=!0,i.push(e.parseTag()));else{let u="";for(;e.i<e.z&&e.x[e.i]!=="<";)u+=e.x[e.i++];s.push(e.decodeEntities(u))}if(!e.isNext("</"))throw new Error(`@aws-sdk XML parse error: missing closing tag </${r}>.`);e.i+=2;let c=e.readTo(">").trim();if(c!==r)throw new Error(`@aws-sdk XML parse error: mismatched tags <${r}> and </${c}>.`);if(!o&&s.length===0&&!a)return{tag:r,value:""};if(!o&&!a){let u=s.length===1?s[0]:s.join("");return u.trim()===""&&u.includes(`
36
+ `)?{tag:r,value:""}:{tag:r,value:u}}let d={};for(let u of s)u.trim()===""&&u.includes(`
37
+ `)||(d["#text"]="#text"in d?d["#text"]+u:u);for(let u of i)u.tag==="__proto__"&&km(d),u.tag in d?Array.isArray(d[u.tag])?d[u.tag].push(u.value):d[u.tag]=[d[u.tag],u.value]:d[u.tag]=u.value;for(let[u,l]of Object.entries(n))u==="__proto__"&&km(d),d[u]=l;return{tag:r,value:d}}static ENTITIES={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};skipDoctype(){let e=this;e.i+=9;let r=0;for(;e.i<e.z;){let o=e.x[e.i];if(o==="[")++r;else if(o==="]")--r;else if(o===">"&&r===0){++e.i;return}++e.i}throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.")}decodeEntities(e){return e.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g,(r,o,n,s)=>o?String.fromCharCode(parseInt(o,16)):n?String.fromCharCode(parseInt(n,10)):t.ENTITIES[s]??"")}};jc.XmlNode=Pm;jc.XmlText=Wc;jc.parseXML=TO});var hr,$s=h(()=>{hr=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});var Xc,c_=h(()=>{Xc=class{from;to;keys;constructor(e,r){this.from=e,this.to=r;let o=Object.keys(this.from),n=new Set(o);n.delete("__type"),this.keys=n}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}}});function d_(t){Object.defineProperty(t,"__proto__",{value:void 0,writable:!0,enumerable:!0,configurable:!0})}var u_=h(()=>{});var l_,Eo,Yc=h(()=>{l_=Ee(Kc());M();P();W();D();$s();c_();u_();Eo=class extends hr{settings;stringDeserializer;constructor(e){super(),this.settings=e,this.stringDeserializer=new Zr(e)}setSerdeContext(e){this.serdeContext=e,this.stringDeserializer.setSerdeContext(e)}read(e,r,o){let n=x.of(e),s=n.getMemberSchemas();if(n.isStructSchema()&&n.isMemberSchema()&&!!Object.values(s).find(d=>!!d.getMemberTraits().eventPayload)){let d={},u=Object.keys(s)[0];return s[u].isBlobSchema()?d[u]=r:d[u]=this.read(s[u],r),d}let a=(this.serdeContext?.utf8Encoder??pe)(r),c=this.parseXml(a);return this.readSchema(e,o?c[o]:c)}readSchema(e,r){let o=x.of(e);if(o.isUnitSchema())return;let n=o.getMergedTraits();if(o.isListSchema()&&!Array.isArray(r))return this.readSchema(o,[r]);if(r==null)return r;if(typeof r=="object"){let s=!!n.xmlFlattened;if(o.isListSchema()){let a=o.getValueSchema(),c=[],d=a.getMergedTraits().xmlName??"member",u=s?r:(r[0]??r)[d];if(u==null)return c;let l=Array.isArray(u)?u:[u];for(let m of l)c.push(this.readSchema(a,m));return c}let i={};if(o.isMapSchema()){let a=o.getKeySchema(),c=o.getValueSchema(),d;s?d=Array.isArray(r)?r:[r]:d=Array.isArray(r.entry)?r.entry:[r.entry];let u=a.getMergedTraits().xmlName??"key",l=c.getMergedTraits().xmlName??"value";for(let m of d){let g=m[u],S=m[l];g==="__proto__"&&d_(i),i[g]=this.readSchema(c,S)}return i}if(o.isStructSchema()){let a=o.isUnionSchema(),c;a&&(c=new Xc(r,i));for(let[d,u]of o.structIterator()){let l=u.getMergedTraits(),m=l.httpPayload?l.xmlName??u.getName():u.getMemberTraits().xmlName??d;a&&c.mark(m),r[m]!=null&&(i[d]=this.readSchema(u,r[m]))}return a&&c.writeUnknown(),i}if(o.isDocumentSchema())return r;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${o.getName(!0)}`)}return o.isListSchema()?[]:o.isMapSchema()||o.isStructSchema()?{}:this.stringDeserializer.read(o,r)}parseXml(e){if(e.length){let r;try{r=(0,l_.parseXML)(e)}catch(i){throw i&&typeof i=="object"&&Object.defineProperty(i,"$responseBodyText",{value:e}),i}let o="#text",n=Object.keys(r)[0],s=r[n];return s[o]&&(s[n]=s[o],delete s[o]),ia(s)}return{}}}});var Bn,Nm=h(()=>{P();W();D();D();$s();Bn=class extends hr{settings;buffer;constructor(e){super(),this.settings=e}write(e,r,o=""){this.buffer===void 0&&(this.buffer="");let n=x.of(e);if(o&&!o.endsWith(".")&&(o+="."),n.isBlobSchema())(typeof r=="string"||r instanceof Uint8Array)&&(this.writeKey(o),this.writeValue((this.serdeContext?.base64Encoder??le)(r)));else if(n.isBooleanSchema()||n.isNumericSchema()||n.isStringSchema())r!=null?(this.writeKey(o),this.writeValue(String(r))):n.isIdempotencyToken()&&(this.writeKey(o),this.writeValue(st()));else if(n.isBigIntegerSchema())r!=null&&(this.writeKey(o),this.writeValue(String(r)));else if(n.isBigDecimalSchema())r!=null&&(this.writeKey(o),this.writeValue(r instanceof K?r.string:String(r)));else if(n.isTimestampSchema()){if(r instanceof Date)switch(this.writeKey(o),Ce(n,this.settings)){case 5:this.writeValue(r.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(yt(r));break;case 7:this.writeValue(String(r.getTime()/1e3));break}}else if(n.isDocumentSchema())Array.isArray(r)?this.write(79,r,o):r instanceof Date?this.write(4,r,o):r instanceof Uint8Array?this.write(21,r,o):r&&typeof r=="object"?this.write(143,r,o):(this.writeKey(o),this.writeValue(String(r)));else if(n.isListSchema()){if(Array.isArray(r))if(r.length===0)this.settings.serializeEmptyLists&&(this.writeKey(o),this.writeValue(""));else{let s=n.getValueSchema(),i=this.settings.flattenLists||n.getMergedTraits().xmlFlattened,a=1;for(let c of r){if(c==null)continue;let d=s.getMergedTraits(),u=this.getKey("member",d.xmlName,d.ec2QueryName),l=i?`${o}${a}`:`${o}${u}.${a}`;this.write(s,c,l),++a}}}else if(n.isMapSchema()){if(r&&typeof r=="object"){let s=n.getKeySchema(),i=n.getValueSchema(),a=n.getMergedTraits().xmlFlattened,c=1;for(let d in r){let u=r[d];if(u==null)continue;let l=s.getMergedTraits(),m=this.getKey("key",l.xmlName,l.ec2QueryName),g=a?`${o}${c}.${m}`:`${o}entry.${c}.${m}`,S=i.getMergedTraits(),E=this.getKey("value",S.xmlName,S.ec2QueryName),C=a?`${o}${c}.${E}`:`${o}entry.${c}.${E}`;this.write(s,d,g),this.write(i,u,C),++c}}}else if(n.isStructSchema()){if(r&&typeof r=="object"){let s=!1;for(let[i,a]of n.structIterator()){if(r[i]==null&&!a.isIdempotencyToken())continue;let c=a.getMergedTraits(),d=this.getKey(i,c.xmlName,c.ec2QueryName,"struct"),u=`${o}${d}`;this.write(a,r[i],u),s=!0}if(!s&&n.isUnionSchema()){let{$unknown:i}=r;if(Array.isArray(i)){let[a,c]=i,d=`${o}${a}`;this.write(15,c,d)}}}}else if(!n.isUnitSchema())throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${n.getName(!0)}`)}flush(){if(this.buffer===void 0)throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");let e=this.buffer;return delete this.buffer,e}getKey(e,r,o,n){let{ec2:s,capitalizeKeys:i}=this.settings;if(s&&o)return o;let a=r??e;return i&&n==="struct"?a[0].toUpperCase()+a.slice(1):a}writeKey(e){e.endsWith(".")&&(e=e.slice(0,e.length-1)),this.buffer+=`&${Tt(e)}=`}writeValue(e){this.buffer+=Tt(e)}}});var yo,Om=h(()=>{P();W();Un();Yc();Nm();yo=class extends Kt{options;serializer;deserializer;mixin=new mt;constructor(e){super({defaultNamespace:e.defaultNamespace,errorTypeRegistries:e.errorTypeRegistries}),this.options=e;let r={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace,serializeEmptyLists:!0};this.serializer=new Bn(r),this.deserializer=new Eo(r)}getShapeId(){return"aws.protocols#awsQuery"}setSerdeContext(e){this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e)}getPayloadCodec(){throw new Error("AWSQuery protocol has no payload codec.")}async serializeRequest(e,r,o){let n=await super.serializeRequest(e,r,o);n.path.endsWith("/")||(n.path+="/"),n.headers["content-type"]="application/x-www-form-urlencoded",(nn(e.input)==="unit"||!n.body)&&(n.body="");let s=e.name.split("#")[1]??e.name;return n.body=`Action=${s}&Version=${this.options.version}`+n.body,n.body.endsWith("&")&&(n.body=n.body.slice(-1)),n}async deserializeResponse(e,r,o){let n=this.deserializer,s=x.of(e.output),i={};if(o.statusCode>=300){let u=await Se(o.body,r);u.byteLength>0&&Object.assign(i,await n.read(15,u)),await this.handleError(e,r,o,i,this.deserializeMetadata(o))}for(let u in o.headers){let l=o.headers[u];delete o.headers[u],o.headers[u.toLowerCase()]=l}let a=e.name.split("#")[1]??e.name,c=s.isStructSchema()&&this.useNestedResult()?a+"Result":void 0,d=await Se(o.body,r);return d.byteLength>0&&Object.assign(i,await n.read(s,d,c)),i.$metadata=this.deserializeMetadata(o),i}useNestedResult(){return!0}async handleError(e,r,o,n,s){let i=this.loadQueryErrorCode(o,n)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace);let a=this.loadQueryError(n)??{},c=this.loadQueryErrorMessage(n);a.message=c,a.Error={Type:a.Type,Code:a.Code,Message:c};let{errorSchema:d,errorMetadata:u}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,o,a,s,this.mixin.findQueryCompatibleError),l=x.of(d),m=this.compositeErrorRegistry.getErrorCtor(d)??Error,g=new m({}),S={Type:a.Error.Type,Code:a.Error.Code,Error:a.Error};for(let[E,C]of l.structIterator()){let y=C.getMergedTraits().xmlName??E,T=a[y]??n[y];S[E]=this.deserializer.readSchema(C,T)}throw this.mixin.decorateServiceException(Object.assign(g,u,{$fault:l.getMergedTraits().error,message:c},S),n)}loadQueryErrorCode(e,r){let o=(r.Errors?.[0]?.Error??r.Errors?.Error??r.Error)?.Code;if(o!==void 0)return o;if(e.statusCode==404)return"NotFound"}loadQueryError(e){return e.Errors?.[0]?.Error??e.Errors?.Error??e.Error}loadQueryErrorMessage(e){let r=this.loadQueryError(e);return r?.message??r?.Message??e.message??e.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}});var Qc,f_=h(()=>{Om();Qc=class extends yo{options;constructor(e){super(e),this.options=e;let r={capitalizeKeys:!0,flattenLists:!0,serializeEmptyLists:!1,ec2:!0};Object.assign(this.serializer.settings,r)}getShapeId(){return"aws.protocols#ec2Query"}useNestedResult(){return!1}}});var m_,p_=h(()=>{P();D();m_=(t,e)=>Se(t,e).then(r=>(e?.utf8Encoder??pe)(r))});var h_,Dm,g_,Jc,Mm=h(()=>{h_=Ee(Kc());M();p_();Dm=(t,e)=>m_(t,e).then(r=>{if(r.length){let o;try{o=(0,h_.parseXML)(r)}catch(a){throw a&&typeof a=="object"&&Object.defineProperty(a,"$responseBodyText",{value:r}),a}let n="#text",s=Object.keys(o)[0],i=o[s];return i[n]&&(i[s]=i[n],delete i[n]),ia(i)}return{}}),g_=async(t,e)=>{let r=await Dm(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r},Jc=(t,e)=>{if(e?.Error?.Code!==void 0)return e.Error.Code;if(e?.Code!==void 0)return e.Code;if(t.statusCode==404)return"NotFound"}});var Ge,Gn,$m=h(()=>{Ge=Ee(Kc());P();W();D();D();$s();Gn=class extends hr{settings;stringBuffer;byteBuffer;buffer;constructor(e){super(),this.settings=e}write(e,r){let o=x.of(e);if(o.isStringSchema()&&typeof r=="string")this.stringBuffer=r;else if(o.isBlobSchema())this.byteBuffer="byteLength"in r?r:(this.serdeContext?.base64Decoder??ge)(r);else{this.buffer=this.writeStruct(o,r,void 0);let n=o.getMergedTraits();n.httpPayload&&!n.xmlName&&this.buffer.withName(o.getName())}}flush(){if(this.byteBuffer!==void 0){let r=this.byteBuffer;return delete this.byteBuffer,r}if(this.stringBuffer!==void 0){let r=this.stringBuffer;return delete this.stringBuffer,r}let e=this.buffer;return this.settings.xmlNamespace&&(e?.attributes?.xmlns||e.addAttribute("xmlns",this.settings.xmlNamespace)),delete this.buffer,e.toString()}writeStruct(e,r,o){let n=e.getMergedTraits(),s=e.isMemberSchema()&&!n.httpPayload?e.getMemberTraits().xmlName??e.getMemberName():n.xmlName??e.getName();if(!s||!e.isStructSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${e.getName(!0)}.`);let i=Ge.XmlNode.of(s),[a,c]=this.getXmlnsAttribute(e,o);for(let[u,l]of e.structIterator()){let m=r[u];if(m!=null||l.isIdempotencyToken()){if(l.getMergedTraits().xmlAttribute){i.addAttribute(l.getMergedTraits().xmlName??u,this.writeSimple(l,m));continue}if(l.isListSchema())this.writeList(l,m,i,c);else if(l.isMapSchema())this.writeMap(l,m,i,c);else if(l.isStructSchema())i.addChildNode(this.writeStruct(l,m,c));else{let g=Ge.XmlNode.of(l.getMergedTraits().xmlName??l.getMemberName());this.writeSimpleInto(l,m,g,c),i.addChildNode(g)}}}let{$unknown:d}=r;if(d&&e.isUnionSchema()&&Array.isArray(d)&&Object.keys(r).length===1){let[u,l]=d,m=Ge.XmlNode.of(u);if(typeof l!="string")if(r instanceof Ge.XmlNode||r instanceof Ge.XmlText)i.addChildNode(r);else throw new Error("@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.");this.writeSimpleInto(0,l,m,c),i.addChildNode(m)}return c&&i.addAttribute(a,c),i}writeList(e,r,o,n){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${e.getName(!0)}`);let s=e.getMergedTraits(),i=e.getValueSchema(),a=i.getMergedTraits(),c=!!a.sparse,d=!!s.xmlFlattened,[u,l]=this.getXmlnsAttribute(e,n),m=(g,S)=>{if(i.isListSchema())this.writeList(i,Array.isArray(S)?S:[S],g,l);else if(i.isMapSchema())this.writeMap(i,S,g,l);else if(i.isStructSchema()){let E=this.writeStruct(i,S,l);g.addChildNode(E.withName(d?s.xmlName??e.getMemberName():a.xmlName??"member"))}else{let E=Ge.XmlNode.of(d?s.xmlName??e.getMemberName():a.xmlName??"member");this.writeSimpleInto(i,S,E,l),g.addChildNode(E)}};if(d)for(let g of r)(c||g!=null)&&m(o,g);else{let g=Ge.XmlNode.of(s.xmlName??e.getMemberName());l&&g.addAttribute(u,l);for(let S of r)(c||S!=null)&&m(g,S);o.addChildNode(g)}}writeMap(e,r,o,n,s=!1){if(!e.isMemberSchema())throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${e.getName(!0)}`);let i=e.getMergedTraits(),a=e.getKeySchema(),d=a.getMergedTraits().xmlName??"key",u=e.getValueSchema(),l=u.getMergedTraits(),m=l.xmlName??"value",g=!!l.sparse,S=!!i.xmlFlattened,[E,C]=this.getXmlnsAttribute(e,n),y=(T,w,I)=>{let b=Ge.XmlNode.of(d,w),[F,B]=this.getXmlnsAttribute(a,C);B&&b.addAttribute(F,B),T.addChildNode(b);let O=Ge.XmlNode.of(m);u.isListSchema()?this.writeList(u,I,O,C):u.isMapSchema()?this.writeMap(u,I,O,C,!0):u.isStructSchema()?O=this.writeStruct(u,I,C):this.writeSimpleInto(u,I,O,C),T.addChildNode(O)};if(S)for(let T in r){let w=r[T];if(g||w!=null){let I=Ge.XmlNode.of(i.xmlName??e.getMemberName());y(I,T,w),o.addChildNode(I)}}else{let T;s||(T=Ge.XmlNode.of(i.xmlName??e.getMemberName()),C&&T.addAttribute(E,C),o.addChildNode(T));for(let w in r){let I=r[w];if(g||I!=null){let b=Ge.XmlNode.of("entry");y(b,w,I),(s?o:T).addChildNode(b)}}}}writeSimple(e,r){if(r===null)throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");let o=x.of(e),n=null;if(r&&typeof r=="object")if(o.isBlobSchema())n=(this.serdeContext?.base64Encoder??le)(r);else if(o.isTimestampSchema()&&r instanceof Date)switch(Ce(o,this.settings)){case 5:n=r.toISOString().replace(".000Z","Z");break;case 6:n=yt(r);break;case 7:n=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using http date",r),n=yt(r);break}else{if(o.isBigDecimalSchema()&&r)return r instanceof K?r.string:String(r);throw o.isMapSchema()||o.isListSchema()?new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead."):new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${o.getName(!0)}`)}if((o.isBooleanSchema()||o.isNumericSchema()||o.isBigIntegerSchema()||o.isBigDecimalSchema())&&(n=String(r)),o.isStringSchema()&&(r===void 0&&o.isIdempotencyToken()?n=st():n=String(r)),n===null)throw new Error(`Unhandled schema-value pair ${o.getName(!0)}=${r}`);return n}writeSimpleInto(e,r,o,n){let s=this.writeSimple(e,r),i=x.of(e),a=new Ge.XmlText(s),[c,d]=this.getXmlnsAttribute(i,n);d&&o.addAttribute(c,d),o.addChildNode(a)}getXmlnsAttribute(e,r){let o=e.getMergedTraits(),[n,s]=o.xmlNamespace??[];return s&&s!==r?[n?`xmlns:${n}`:"xmlns",s]:[void 0,void 0]}}});var Fn,Lm=h(()=>{$s();Yc();$m();Fn=class extends hr{settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new Gn(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new Eo(this.settings);return e.setSerdeContext(this.serdeContext),e}}});var Zc,S_=h(()=>{P();W();Un();Mm();Lm();Zc=class extends Yr{codec;serializer;deserializer;mixin=new mt;constructor(e){super(e);let r={timestampFormat:{useTrait:!0,default:5},httpBindings:!0,xmlNamespace:e.xmlNamespace,serviceNamespace:e.defaultNamespace};this.codec=new Fn(r),this.serializer=new to(this.codec.createSerializer(),r),this.deserializer=new eo(this.codec.createDeserializer(),r)}getPayloadCodec(){return this.codec}getShapeId(){return"aws.protocols#restXml"}async serializeRequest(e,r,o){let n=await super.serializeRequest(e,r,o),s=x.of(e.input);if(!n.headers["content-type"]){let i=this.mixin.resolveRestContentType(this.getDefaultContentType(),s);i&&(n.headers["content-type"]=i)}return typeof n.body=="string"&&n.headers["content-type"]===this.getDefaultContentType()&&!n.body.startsWith("<?xml ")&&!this.hasUnstructuredPayloadBinding(s)&&(n.body='<?xml version="1.0" encoding="UTF-8"?>'+n.body),n}async deserializeResponse(e,r,o){return super.deserializeResponse(e,r,o)}async handleError(e,r,o,n,s){let i=Jc(o,n)??"Unknown";if(this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace),n.Error&&typeof n.Error=="object")for(let E of Object.keys(n.Error))n[E]=n.Error[E],E.toLowerCase()==="message"&&(n.message=n.Error[E]);n.RequestId&&!s.requestId&&(s.requestId=n.RequestId);let{errorSchema:a,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,o,n,s),d=x.of(a),u=n.Error?.message??n.Error?.Message??n.message??n.Message??"UnknownError",l=this.compositeErrorRegistry.getErrorCtor(a)??Error,m=new l({});await this.deserializeHttpMessage(a,r,o,n);let g={},S=this.codec.createDeserializer();for(let[E,C]of d.structIterator()){let y=C.getMergedTraits().xmlName??E,T=n.Error?.[y]??n[y];g[E]=S.readSchema(C,T)}throw this.mixin.decorateServiceException(Object.assign(m,c,{$fault:d.getMergedTraits().error,message:u},g),n)}getDefaultContentType(){return"application/xml"}hasUnstructuredPayloadBinding(e){for(let[,r]of e.structIterator())if(r.getMergedTraits().httpPayload)return!(r.isStructSchema()||r.isMapSchema()||r.isListSchema());return!1}}});var E_,y_=h(()=>{D();E_=t=>{if(t!=null)return typeof t=="object"&&"__type"in t&&delete t.__type,$g(t)}});var C_,__,T_,A_=h(()=>{C_=t=>{if(t==null)return t;if(typeof t=="number"||typeof t=="bigint"){let e=new Error(`Received number ${t} where a string was expected.`);return e.name="Warning",console.warn(e),String(t)}if(typeof t=="boolean"){let e=new Error(`Received boolean ${t} where a string was expected.`);return e.name="Warning",console.warn(e),String(t)}return t},__=t=>{if(t==null)return t;if(typeof t=="string"){let e=t.toLowerCase();if(t!==""&&e!=="false"&&e!=="true"){let r=new Error(`Received string "${t}" where a boolean was expected.`);r.name="Warning",console.warn(r)}return t!==""&&e!=="false"}return t},T_=t=>{if(t==null)return t;if(typeof t=="string"){let e=Number(t);if(e.toString()!==t){let r=new Error(`Received string "${t}" where a number was expected.`);return r.name="Warning",console.warn(r),t}return e}return t}});var w_={};St(w_,{AwsEc2QueryProtocol:()=>Qc,AwsJson1_0Protocol:()=>qc,AwsJson1_1Protocol:()=>Vc,AwsJsonRpcProtocol:()=>So,AwsQueryProtocol:()=>yo,AwsRestJsonProtocol:()=>pr,AwsRestXmlProtocol:()=>Zc,AwsSmithyRpcV2CborProtocol:()=>Hc,JsonCodec:()=>Sn,JsonCodec2:()=>it,JsonShapeDeserializer:()=>so,JsonShapeDeserializer2:()=>oo,JsonShapeSerializer:()=>io,JsonShapeSerializer2:()=>no,QueryShapeSerializer:()=>Bn,XmlCodec:()=>Fn,XmlShapeDeserializer:()=>Eo,XmlShapeSerializer:()=>Gn,_toBool:()=>__,_toNum:()=>T_,_toStr:()=>C_,awsExpectUnion:()=>E_,loadJsonRpcErrorCode:()=>hn,loadRestJsonErrorCode:()=>pn,loadRestXmlErrorCode:()=>Jc,parseJsonBody:()=>Tr,parseJsonErrorBody:()=>wa,parseXmlBody:()=>Dm,parseXmlErrorBody:()=>g_});var Hn=h(()=>{n_();s_();i_();zc();a_();P();f_();Om();Nm();S_();Lm();Yc();$m();Mm();y_();A_()});var Ls,Lo,ed,R_,k_,td,Um,x_,Bm,zn,I_,v_,AO,qe,wO,P_,b_=h(()=>{ae();Ls="ref",Lo=-1,ed=!0,R_="isSet",k_="PartitionResult",td="booleanEquals",Um="getAttr",x_={[Ls]:"Endpoint"},Bm={[Ls]:k_},zn={},I_=[{[Ls]:"Region"}],v_={conditions:[[R_,[x_]],[R_,I_],["aws.partition",I_,k_],[td,[{[Ls]:"UseFIPS"},ed]],[td,[{[Ls]:"UseDualStack"},ed]],[td,[{fn:Um,argv:[Bm,"supportsDualStack"]},ed]],[td,[{fn:Um,argv:[Bm,"supportsFIPS"]},ed]],["stringEquals",[{fn:Um,argv:[Bm,"name"]},"aws-us-gov"]]],results:[[Lo],[Lo,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Lo,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[x_,zn],["https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",zn],[Lo,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://oidc.{Region}.amazonaws.com",zn],["https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",zn],[Lo,"FIPS is enabled but this partition does not support FIPS"],["https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",zn],[Lo,"DualStack is enabled but this partition does not support DualStack"],["https://oidc.{Region}.{PartitionResult#dnsSuffix}",zn],[Lo,"Invalid Configuration: Missing Region"]]},AO=2,qe=1e8,wO=new Int32Array([-1,1,-1,0,13,3,1,4,qe+12,2,5,qe+12,3,8,6,4,7,qe+11,5,qe+9,qe+10,4,11,9,6,10,qe+8,7,qe+6,qe+7,5,12,qe+5,6,qe+4,qe+5,3,qe+1,14,4,qe+2,qe+3]),P_=Hr.from(wO,AO,v_.conditions,v_.results)});var RO,N_,O_=h(()=>{Z();ae();b_();RO=new zr({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),N_=(t,e={})=>RO.get(t,()=>qr(P_,{endpointParams:t,logger:e.logger}));Wt.aws=vt});var xe,rd=h(()=>{M();xe=class t extends Nr{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc#SSOOIDCServiceException";constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Us,Bs,Gs,Fs,Hs,zs,qs,Vs,Ws,js,Ks,Gm=h(()=>{rd();Us=class t extends xe{static shapeId="com.amazonaws.ssooidc#AccessDeniedException";name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}},Bs=class t extends xe{static shapeId="com.amazonaws.ssooidc#AuthorizationPendingException";name="AuthorizationPendingException";$fault="client";error;error_description;constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},Gs=class t extends xe{static shapeId="com.amazonaws.ssooidc#ExpiredTokenException";name="ExpiredTokenException";$fault="client";error;error_description;constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},Fs=class t extends xe{static shapeId="com.amazonaws.ssooidc#InternalServerException";name="InternalServerException";$fault="server";error;error_description;constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},Hs=class t extends xe{static shapeId="com.amazonaws.ssooidc#InvalidClientException";name="InvalidClientException";$fault="client";error;error_description;constructor(e){super({name:"InvalidClientException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},zs=class t extends xe{static shapeId="com.amazonaws.ssooidc#InvalidGrantException";name="InvalidGrantException";$fault="client";error;error_description;constructor(e){super({name:"InvalidGrantException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},qs=class t extends xe{static shapeId="com.amazonaws.ssooidc#InvalidRequestException";name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}},Vs=class t extends xe{static shapeId="com.amazonaws.ssooidc#InvalidScopeException";name="InvalidScopeException";$fault="client";error;error_description;constructor(e){super({name:"InvalidScopeException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},Ws=class t extends xe{static shapeId="com.amazonaws.ssooidc#SlowDownException";name="SlowDownException";$fault="client";error;error_description;constructor(e){super({name:"SlowDownException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},js=class t extends xe{static shapeId="com.amazonaws.ssooidc#UnauthorizedClientException";name="UnauthorizedClientException";$fault="client";error;error_description;constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}},Ks=class t extends xe{static shapeId="com.amazonaws.ssooidc#UnsupportedGrantTypeException";name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error,this.error_description=e.error_description}}});var xO,IO,vO,kO,PO,bO,NO,OO,DO,MO,$O,LO,UO,BO,GO,FO,HO,zO,qO,VO,gr,WO,jO,KO,XO,YO,de,QO,Nt,JO,ZO,Ot,eD,D_,M_,tD,$_,rD,oD,nD,he,L_,U_,pt,B_,G_,F_,H_,z_,q_,V_,W_,j_,K_,X_,Fm,sD,iD,aD,cD,Y_,Q_,J_,Hm,od=h(()=>{W();Gm();rd();xO="AccessDeniedException",IO="AuthorizationPendingException",vO="AccessToken",kO="ClientSecret",PO="CreateToken",bO="CreateTokenRequest",NO="CreateTokenResponse",OO="CodeVerifier",DO="ExpiredTokenException",MO="InvalidClientException",$O="InvalidGrantException",LO="InvalidRequestException",UO="InternalServerException",BO="InvalidScopeException",GO="IdToken",FO="RefreshToken",HO="SlowDownException",zO="UnauthorizedClientException",qO="UnsupportedGrantTypeException",VO="accessToken",gr="client",WO="clientId",jO="clientSecret",KO="codeVerifier",XO="code",YO="deviceCode",de="error",QO="expiresIn",Nt="error_description",JO="grantType",ZO="http",Ot="httpError",eD="idToken",D_="reason",M_="refreshToken",tD="redirectUri",$_="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc",rD="scope",oD="server",nD="tokenType",he="com.amazonaws.ssooidc",L_=new ie($_),U_=[-3,$_,"SSOOIDCServiceException",0,[],[]];L_.registerError(U_,xe);pt=new ie(he),B_=[-3,he,xO,{[de]:gr,[Ot]:400},[de,D_,Nt],[0,0,0]];pt.registerError(B_,Us);G_=[-3,he,IO,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(G_,Bs);F_=[-3,he,DO,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(F_,Gs);H_=[-3,he,UO,{[de]:oD,[Ot]:500},[de,Nt],[0,0]];pt.registerError(H_,Fs);z_=[-3,he,MO,{[de]:gr,[Ot]:401},[de,Nt],[0,0]];pt.registerError(z_,Hs);q_=[-3,he,$O,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(q_,zs);V_=[-3,he,LO,{[de]:gr,[Ot]:400},[de,D_,Nt],[0,0,0]];pt.registerError(V_,qs);W_=[-3,he,BO,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(W_,Vs);j_=[-3,he,HO,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(j_,Ws);K_=[-3,he,zO,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(K_,js);X_=[-3,he,qO,{[de]:gr,[Ot]:400},[de,Nt],[0,0]];pt.registerError(X_,Ks);Fm=[L_,pt],sD=[0,he,vO,8,0],iD=[0,he,kO,8,0],aD=[0,he,OO,8,0],cD=[0,he,GO,8,0],Y_=[0,he,FO,8,0],Q_=[3,he,bO,0,[WO,jO,JO,YO,XO,M_,rD,tD,KO],[0,[()=>iD,0],0,0,0,[()=>Y_,0],64,0,[()=>aD,0]],3],J_=[3,he,NO,0,[VO,nD,QO,M_,eD],[[()=>sD,0],0,1,[()=>Y_,0],[()=>cD,0]]],Hm=[9,he,PO,{[ZO]:["POST","/token",200]},()=>Q_,()=>J_]});var Z_,eT=h(()=>{De();Hn();ze();rs();M();P();D();dm();O_();od();Z_=t=>({apiVersion:"2019-06-10",base64Decoder:t?.base64Decoder??ge,base64Encoder:t?.base64Encoder??le,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??N_,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??MC,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Te},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Oe}],logger:t?.logger??new qt,protocol:t?.protocol??pr,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",errorTypeRegistries:Fm,version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:t?.serviceId??"SSO OIDC",sha256:t?.sha256??jr,urlParser:t?.urlParser??tt,utf8Decoder:t?.utf8Decoder??Vt,utf8Encoder:t?.utf8Encoder??pe})});var nd,tT,rT=h(()=>{Ps();Z();De();M();te();dt();D();nd=Ee(bn());eT();tT=t=>{Dr(process.version);let e=Fr(t),r=()=>e().then(Or),o=Z_(t);jt(process.version);let n={profile:t?.profile,logger:o.logger};return{...o,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??q(Pt,n),bodyLengthChecker:t?.bodyLengthChecker??Ur,defaultUserAgentProvider:t?.defaultUserAgentProvider??It({serviceId:o.serviceId,clientVersion:ho.version}),maxAttempts:t?.maxAttempts??q(tr,t),region:t?.region??q(Xe,{...Ye,...n}),requestHandler:nd.NodeHttpHandler.create(t?.requestHandler??r),retryMode:t?.retryMode??q({...or,default:async()=>(await r()).retryMode||ct},t),streamCollector:t?.streamCollector??nd.streamCollector,useDualstackEndpoint:t?.useDualstackEndpoint??q(Br,n),useFipsEndpoint:t?.useFipsEndpoint??q(Gr,n),userAgentAppId:t?.userAgentAppId??q(dr,n)}}});var oT,nT,sT=h(()=>{oT=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,o=t.credentials;return{setHttpAuthScheme(n){let s=e.findIndex(i=>i.schemeId===n.schemeId);s===-1?e.push(n):e.splice(s,1,n)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},nT=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var iT,aT=h(()=>{Z();M();P();sT();iT=(t,e)=>{let r=Object.assign(ur(t),Mr(t),Xt(t),oT(t));return e.forEach(o=>o.configure(r)),Object.assign(t,lr(r),$r(r),Yt(r),nT(r))}});var Xs,zm=h(()=>{Z();ze();M();te();ae();P();dt();W();dm();um();rT();aT();Xs=class extends rt{config;constructor(...[e]){let r=tT(e||{});super(r),this.initConfig=r;let o=LC(r),n=ar(o),s=rr(n),i=Ct(s),a=i,c=Vr(a),d=$C(c),u=iT(d,e?.extensions||[]);this.config=u,this.middlewareStack.use(kr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(Ar(this.config)),this.middlewareStack.use(Qt(this.config)),this.middlewareStack.use(nr(this.config)),this.middlewareStack.use(sr(this.config)),this.middlewareStack.use(ir(this.config)),this.middlewareStack.use(Rt(this.config,{httpAuthSchemeParametersProvider:DC,identityProviderConfigProvider:async l=>new Qe({"aws.auth#sigv4":l.credentials})})),this.middlewareStack.use(xt(this.config))}destroy(){super.destroy()}}});var cT,dT,uT,lT=h(()=>{M();ae();um();cT=Lr(UC,"AWSSSOOIDCService","SSOOIDCClient",Wr),dT={},uT=(t,e,r,o)=>[]});var Ys,qm=h(()=>{lT();od();Ys=class extends cT(dT,uT,"CreateToken",Hm){}});var dD,sd,fT=h(()=>{M();qm();zm();dD={CreateTokenCommand:Ys},sd=class extends Xs{};br(dD,sd)});var mT=h(()=>{qm()});var uD,lD,pT=h(()=>{uD={KMS_ACCESS_DENIED:"KMS_AccessDeniedException"},lD={KMS_DISABLED_KEY:"KMS_DisabledException",KMS_INVALID_KEY_USAGE:"KMS_InvalidKeyUsageException",KMS_INVALID_STATE:"KMS_InvalidStateException",KMS_KEY_NOT_FOUND:"KMS_NotFoundException"}});var hT=h(()=>{});var Qs={};St(Qs,{$Command:()=>Pr,AccessDeniedException:()=>Us,AccessDeniedException$:()=>B_,AccessDeniedExceptionReason:()=>uD,AuthorizationPendingException:()=>Bs,AuthorizationPendingException$:()=>G_,CreateToken$:()=>Hm,CreateTokenCommand:()=>Ys,CreateTokenRequest$:()=>Q_,CreateTokenResponse$:()=>J_,ExpiredTokenException:()=>Gs,ExpiredTokenException$:()=>F_,InternalServerException:()=>Fs,InternalServerException$:()=>H_,InvalidClientException:()=>Hs,InvalidClientException$:()=>z_,InvalidGrantException:()=>zs,InvalidGrantException$:()=>q_,InvalidRequestException:()=>qs,InvalidRequestException$:()=>V_,InvalidRequestExceptionReason:()=>lD,InvalidScopeException:()=>Vs,InvalidScopeException$:()=>W_,SSOOIDC:()=>sd,SSOOIDCClient:()=>Xs,SSOOIDCServiceException:()=>xe,SSOOIDCServiceException$:()=>U_,SlowDownException:()=>Ws,SlowDownException$:()=>j_,UnauthorizedClientException:()=>js,UnauthorizedClientException$:()=>K_,UnsupportedGrantTypeException:()=>Ks,UnsupportedGrantTypeException$:()=>X_,__Client:()=>rt,errorTypeRegistries:()=>Fm});var Js=h(()=>{zm();fT();mT();M();od();pT();Gm();hT();rd()});var yT=se(Zs=>{var{setTokenFeature:fD}=(Z(),v(kt)),{getBearerTokenEnvKey:mD}=(De(),v(Tc)),{TokenProviderError:Dt,getSSOTokenFilepath:pD,parseKnownFiles:hD,getProfileName:gD,loadSsoSessionData:SD,getSSOTokenFromFile:ED,memoize:yD,chain:CD}=(te(),v(nt)),{promises:_D}=oe("node:fs"),TD=({logger:t,signingName:e}={})=>async()=>{if(t?.debug?.("@aws-sdk/token-providers - fromEnvSigningName"),!e)throw new Dt("Please pass 'signingName' to compute environment variable key",{logger:t});let r=mD(e);if(!(r in process.env))throw new Dt(`Token not present in '${r}' environment variable`,{logger:t});let o={token:process.env[r]};return fD(o,"BEARER_SERVICE_ENV_VARS","3"),o},AD=300*1e3,Vm="To refresh this SSO session run 'aws sso login' with the corresponding profile.",wD=async(t,e={},r)=>{let{SSOOIDCClient:o}=(Js(),v(Qs)),n=i=>e.clientConfig?.[i]??e.parentClientConfig?.[i]??r?.[i];return new o(Object.assign({},e.clientConfig??{},{region:t??e.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))},RD=async(t,e,r={},o)=>{let{CreateTokenCommand:n}=(Js(),v(Qs));return(await wD(e,r,o)).send(new n({clientId:t.clientId,clientSecret:t.clientSecret,refreshToken:t.refreshToken,grantType:"refresh_token"}))},gT=t=>{if(t.expiration&&t.expiration.getTime()<Date.now())throw new Dt(`Token is expired. ${Vm}`,!1)},Uo=(t,e,r=!1)=>{if(typeof e>"u")throw new Dt(`Value not present for '${t}' in SSO Token${r?". Cannot refresh":""}. ${Vm}`,!1)},{writeFile:xD}=_D,ID=(t,e)=>{let r=pD(t),o=JSON.stringify(e,null,2);return xD(r,o)},ST=new Map,id=new Map,ET=(t={})=>async({callerClientConfig:e}={})=>{t.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await hD(t),o=gD({profile:t.profile??e?.profile}),n=r[o];if(n){if(!n.sso_session)throw new Dt(`Profile '${o}' is missing required property 'sso_session'.`)}else throw new Dt(`Profile '${o}' could not be found in shared credentials file.`,!1);let s=n.sso_session,i=id.get(s);if(i)return await i;let c=(await SD(t))[s];if(!c)throw new Dt(`Sso session '${s}' could not be found in shared credentials file.`,!1);for(let y of["sso_start_url","sso_region"])if(!c[y])throw new Dt(`Sso session '${s}' is missing required property '${y}'.`,!1);c.sso_start_url;let d=c.sso_region,u;try{u=await ED(s)}catch{throw new Dt(`The SSO session token associated with profile=${o} was not found or is invalid. ${Vm}`,!1)}Uo("accessToken",u.accessToken),Uo("expiresAt",u.expiresAt);let{accessToken:l,expiresAt:m}=u,g={token:l,expiration:new Date(m)};if(g.expiration.getTime()-Date.now()>AD)return g;let S=id.get(s);if(S)return await S;let E=ST.get(s)??0;if(Date.now()-E<30*1e3)return gT(g),g;Uo("clientId",u.clientId,!0),Uo("clientSecret",u.clientSecret,!0),Uo("refreshToken",u.refreshToken,!0);let C=(async()=>{try{ST.set(s,Date.now());let y=await RD(u,d,t,e);Uo("accessToken",y.accessToken),Uo("expiresIn",y.expiresIn);let T=new Date(Date.now()+y.expiresIn*1e3);try{await ID(s,{...u,accessToken:y.accessToken,expiresAt:T.toISOString(),refreshToken:y.refreshToken})}catch{}return{token:y.accessToken,expiration:T}}catch{return gT(g),g}})();id.set(s,C);try{return await C}finally{id.delete(s)}},vD=({token:t,logger:e})=>async()=>{if(e?.debug("@aws-sdk/token-providers - fromStatic"),!t||!t.token)throw new Dt("Please pass a valid token to fromStatic",!1);return t},kD=(t={})=>yD(CD(ET(t),async()=>{throw new Dt("Could not load token from any providers",!1)}),e=>e.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5,e=>e.expiration!==void 0);Zs.fromEnvSigningName=TD;Zs.fromSso=ET;Zs.fromStatic=vD;Zs.nodeProvider=kD});function PD(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"awsssoportal",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function bD(t){return{schemeId:"smithy.api#noAuth"}}var CT,_T,TT,Wm=h(()=>{De();M();CT=async(t,e,r)=>({operation:Ie(e).operation,region:await Be(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});_T=t=>{let e=[];return t.operation==="GetRoleCredentials"?e.push(bD(t)):e.push(PD(t)),e},TT=t=>{let e=fr(t);return Object.assign(e,{authSchemePreference:Be(t.authSchemePreference??[])})}});var AT,wT,jm=h(()=>{AT=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"awsssoportal"}),wT={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var ei,Bo,ad,RT,kT,cd,Km,xT,Xm,qn,IT,vT,ND,Ve,OD,PT,bT=h(()=>{ae();ei="ref",Bo=-1,ad=!0,RT="isSet",kT="PartitionResult",cd="booleanEquals",Km="getAttr",xT={[ei]:"Endpoint"},Xm={[ei]:kT},qn={},IT=[{[ei]:"Region"}],vT={conditions:[[RT,[xT]],[RT,IT],["aws.partition",IT,kT],[cd,[{[ei]:"UseFIPS"},ad]],[cd,[{[ei]:"UseDualStack"},ad]],[cd,[{fn:Km,argv:[Xm,"supportsDualStack"]},ad]],[cd,[{fn:Km,argv:[Xm,"supportsFIPS"]},ad]],["stringEquals",[{fn:Km,argv:[Xm,"name"]},"aws-us-gov"]]],results:[[Bo],[Bo,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Bo,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[xT,qn],["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",qn],[Bo,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://portal.sso.{Region}.amazonaws.com",qn],["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}",qn],[Bo,"FIPS is enabled but this partition does not support FIPS"],["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}",qn],[Bo,"DualStack is enabled but this partition does not support DualStack"],["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}",qn],[Bo,"Invalid Configuration: Missing Region"]]},ND=2,Ve=1e8,OD=new Int32Array([-1,1,-1,0,13,3,1,4,Ve+12,2,5,Ve+12,3,8,6,4,7,Ve+11,5,Ve+9,Ve+10,4,11,9,6,10,Ve+8,7,Ve+6,Ve+7,5,12,Ve+5,6,Ve+4,Ve+5,3,Ve+1,14,4,Ve+2,Ve+3]),PT=Hr.from(OD,ND,vT.conditions,vT.results)});var DD,NT,OT=h(()=>{Z();ae();bT();DD=new zr({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),NT=(t,e={})=>DD.get(t,()=>qr(PT,{endpointParams:t,logger:e.logger}));Wt.aws=vt});var Mt,dd=h(()=>{M();Mt=class t extends Nr{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sso#SSOServiceException";constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var ti,ri,oi,ni,Ym=h(()=>{dd();ti=class t extends Mt{static shapeId="com.amazonaws.sso#InvalidRequestException";name="InvalidRequestException";$fault="client";constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},ri=class t extends Mt{static shapeId="com.amazonaws.sso#ResourceNotFoundException";name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},oi=class t extends Mt{static shapeId="com.amazonaws.sso#TooManyRequestsException";name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},ni=class t extends Mt{static shapeId="com.amazonaws.sso#UnauthorizedException";name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}}});var MD,$D,LD,UD,BD,GD,FD,HD,zD,qD,VD,WD,jD,KD,XD,ud,ld,YD,QD,fd,JD,DT,md,ZD,eM,tM,MT,rM,oM,nM,ht,$T,LT,si,UT,BT,GT,FT,Qm,sM,iM,aM,HT,zT,qT,Jm,pd=h(()=>{W();Ym();dd();MD="AccessTokenType",$D="GetRoleCredentials",LD="GetRoleCredentialsRequest",UD="GetRoleCredentialsResponse",BD="InvalidRequestException",GD="RoleCredentials",FD="ResourceNotFoundException",HD="SecretAccessKeyType",zD="SessionTokenType",qD="TooManyRequestsException",VD="UnauthorizedException",WD="accountId",jD="accessKeyId",KD="accessToken",XD="account_id",ud="client",ld="error",YD="expiration",QD="http",fd="httpError",JD="httpHeader",DT="httpQuery",md="message",ZD="roleCredentials",eM="roleName",tM="role_name",MT="smithy.ts.sdk.synthetic.com.amazonaws.sso",rM="secretAccessKey",oM="sessionToken",nM="x-amz-sso_bearer_token",ht="com.amazonaws.sso",$T=new ie(MT),LT=[-3,MT,"SSOServiceException",0,[],[]];$T.registerError(LT,Mt);si=new ie(ht),UT=[-3,ht,BD,{[ld]:ud,[fd]:400},[md],[0]];si.registerError(UT,ti);BT=[-3,ht,FD,{[ld]:ud,[fd]:404},[md],[0]];si.registerError(BT,ri);GT=[-3,ht,qD,{[ld]:ud,[fd]:429},[md],[0]];si.registerError(GT,oi);FT=[-3,ht,VD,{[ld]:ud,[fd]:401},[md],[0]];si.registerError(FT,ni);Qm=[$T,si],sM=[0,ht,MD,8,0],iM=[0,ht,HD,8,0],aM=[0,ht,zD,8,0],HT=[3,ht,LD,0,[eM,WD,KD],[[0,{[DT]:tM}],[0,{[DT]:XD}],[()=>sM,{[JD]:nM}]],3],zT=[3,ht,UD,0,[ZD],[[()=>qT,0]]],qT=[3,ht,GD,0,[jD,rM,oM,YD],[0,[()=>iM,0],[()=>aM,0],1]],Jm=[9,ht,$D,{[QD]:["GET","/federation/credentials",200]},()=>HT,()=>zT]});var VT,WT=h(()=>{De();Hn();ze();rs();M();P();D();Wm();OT();pd();VT=t=>({apiVersion:"2019-06-10",base64Decoder:t?.base64Decoder??ge,base64Encoder:t?.base64Encoder??le,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??NT,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??_T,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Te},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Oe}],logger:t?.logger??new qt,protocol:t?.protocol??pr,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sso",errorTypeRegistries:Qm,version:"2019-06-10",serviceTarget:"SWBPortalService"},serviceId:t?.serviceId??"SSO",sha256:t?.sha256??jr,urlParser:t?.urlParser??tt,utf8Decoder:t?.utf8Decoder??Vt,utf8Encoder:t?.utf8Encoder??pe})});var hd,jT,KT=h(()=>{Ps();Z();De();M();te();dt();D();hd=Ee(bn());WT();jT=t=>{Dr(process.version);let e=Fr(t),r=()=>e().then(Or),o=VT(t);jt(process.version);let n={profile:t?.profile,logger:o.logger};return{...o,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??q(Pt,n),bodyLengthChecker:t?.bodyLengthChecker??Ur,defaultUserAgentProvider:t?.defaultUserAgentProvider??It({serviceId:o.serviceId,clientVersion:ho.version}),maxAttempts:t?.maxAttempts??q(tr,t),region:t?.region??q(Xe,{...Ye,...n}),requestHandler:hd.NodeHttpHandler.create(t?.requestHandler??r),retryMode:t?.retryMode??q({...or,default:async()=>(await r()).retryMode||ct},t),streamCollector:t?.streamCollector??hd.streamCollector,useDualstackEndpoint:t?.useDualstackEndpoint??q(Br,n),useFipsEndpoint:t?.useFipsEndpoint??q(Gr,n),userAgentAppId:t?.userAgentAppId??q(dr,n)}}});var XT,YT,QT=h(()=>{XT=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,o=t.credentials;return{setHttpAuthScheme(n){let s=e.findIndex(i=>i.schemeId===n.schemeId);s===-1?e.push(n):e.splice(s,1,n)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},YT=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var JT,ZT=h(()=>{Z();M();P();QT();JT=(t,e)=>{let r=Object.assign(ur(t),Mr(t),Xt(t),XT(t));return e.forEach(o=>o.configure(r)),Object.assign(t,lr(r),$r(r),Yt(r),YT(r))}});var ii,Zm=h(()=>{Z();ze();M();te();ae();P();dt();W();Wm();jm();KT();ZT();ii=class extends rt{config;constructor(...[e]){let r=jT(e||{});super(r),this.initConfig=r;let o=AT(r),n=ar(o),s=rr(n),i=Ct(s),a=i,c=Vr(a),d=TT(c),u=JT(d,e?.extensions||[]);this.config=u,this.middlewareStack.use(kr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(Ar(this.config)),this.middlewareStack.use(Qt(this.config)),this.middlewareStack.use(nr(this.config)),this.middlewareStack.use(sr(this.config)),this.middlewareStack.use(ir(this.config)),this.middlewareStack.use(Rt(this.config,{httpAuthSchemeParametersProvider:CT,identityProviderConfigProvider:async l=>new Qe({"aws.auth#sigv4":l.credentials})})),this.middlewareStack.use(xt(this.config))}destroy(){super.destroy()}}});var eA,tA,rA,oA=h(()=>{M();ae();jm();eA=Lr(wT,"SWBPortalService","SSOClient",Wr),tA={},rA=(t,e,r,o)=>[]});var ai,ep=h(()=>{oA();pd();ai=class extends eA(tA,rA,"GetRoleCredentials",Jm){}});var cM,gd,nA=h(()=>{M();ep();Zm();cM={GetRoleCredentialsCommand:ai},gd=class extends ii{};br(cM,gd)});var sA=h(()=>{ep()});var iA=h(()=>{});var aA={};St(aA,{$Command:()=>Pr,GetRoleCredentials$:()=>Jm,GetRoleCredentialsCommand:()=>ai,GetRoleCredentialsRequest$:()=>HT,GetRoleCredentialsResponse$:()=>zT,InvalidRequestException:()=>ti,InvalidRequestException$:()=>UT,ResourceNotFoundException:()=>ri,ResourceNotFoundException$:()=>BT,RoleCredentials$:()=>qT,SSO:()=>gd,SSOClient:()=>ii,SSOServiceException:()=>Mt,SSOServiceException$:()=>LT,TooManyRequestsException:()=>oi,TooManyRequestsException$:()=>GT,UnauthorizedException:()=>ni,UnauthorizedException$:()=>FT,__Client:()=>rt,errorTypeRegistries:()=>Qm});var cA=h(()=>{Zm();nA();sA();M();pd();Ym();iA();dd()});var dA=se(tp=>{var{GetRoleCredentialsCommand:dM,SSOClient:uM}=(cA(),v(aA));tp.GetRoleCredentialsCommand=dM;tp.SSOClient=uM});var rp=se(Sd=>{var{CredentialsProviderError:$t,getSSOTokenFromFile:lM,getProfileName:fM,parseKnownFiles:mM,loadSsoSessionData:pM}=(te(),v(nt)),{setCredentialFeature:uA}=(Z(),v(kt)),{fromSso:hM}=yT(),fA=t=>t&&(typeof t.sso_start_url=="string"||typeof t.sso_account_id=="string"||typeof t.sso_session=="string"||typeof t.sso_region=="string"||typeof t.sso_role_name=="string"),ci=!1,lA=async({ssoStartUrl:t,ssoSession:e,ssoAccountId:r,ssoRegion:o,ssoRoleName:n,ssoClient:s,clientConfig:i,parentClientConfig:a,callerClientConfig:c,profile:d,filepath:u,configFilepath:l,ignoreCache:m,logger:g})=>{let S,E="To refresh this SSO session run aws sso login with the corresponding profile.";if(e)try{let z=await hM({profile:d,filepath:u,configFilepath:l,ignoreCache:m,clientConfig:i,parentClientConfig:a,logger:g})({callerClientConfig:c});S={accessToken:z.token,expiresAt:new Date(z.expiration).toISOString()}}catch(z){throw new $t(z.message,{tryNextLink:ci,logger:g})}else try{S=await lM(t)}catch{throw new $t(`The SSO session associated with this profile is invalid. ${E}`,{tryNextLink:ci,logger:g})}if(new Date(S.expiresAt).getTime()-Date.now()<=0)throw new $t(`The SSO session associated with this profile has expired. ${E}`,{tryNextLink:ci,logger:g});let{accessToken:C}=S,{SSOClient:y,GetRoleCredentialsCommand:T}=dA(),w=s||new y(Object.assign({},i??{},{logger:i?.logger??c?.logger??a?.logger,region:i?.region??o,userAgentAppId:i?.userAgentAppId??c?.userAgentAppId??a?.userAgentAppId})),I;try{I=await w.send(new T({accountId:r,roleName:n,accessToken:C}))}catch(z){throw new $t(z,{tryNextLink:ci,logger:g})}let{roleCredentials:{accessKeyId:b,secretAccessKey:F,sessionToken:B,expiration:O,credentialScope:Q,accountId:J}={}}=I;if(!b||!F||!B||!O)throw new $t("SSO returns an invalid temporary credential.",{tryNextLink:ci,logger:g});let $={accessKeyId:b,secretAccessKey:F,sessionToken:B,expiration:new Date(O),...Q&&{credentialScope:Q},...J&&{accountId:J}};return e?uA($,"CREDENTIALS_SSO","s"):uA($,"CREDENTIALS_SSO_LEGACY","u"),$},mA=(t,e)=>{let{sso_start_url:r,sso_account_id:o,sso_region:n,sso_role_name:s}=t;if(!r||!o||!n||!s)throw new $t(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(t).join(", ")}
38
+ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:e});return t},gM=(t={})=>async({callerClientConfig:e}={})=>{t.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:r,ssoAccountId:o,ssoRegion:n,ssoRoleName:s,ssoSession:i}=t,{ssoClient:a}=t,c=fM({profile:t.profile??e?.profile});if(!r&&!o&&!n&&!s&&!i){let u=(await mM(t))[c];if(!u)throw new $t(`Profile ${c} was not found.`,{logger:t.logger});if(!fA(u))throw new $t(`Profile ${c} is not configured with SSO credentials.`,{logger:t.logger});if(u?.sso_session){let y=(await pM(t))[u.sso_session],T=` configurations in profile ${c} and sso-session ${u.sso_session}`;if(n&&n!==y.sso_region)throw new $t("Conflicting SSO region"+T,{tryNextLink:!1,logger:t.logger});if(r&&r!==y.sso_start_url)throw new $t("Conflicting SSO start_url"+T,{tryNextLink:!1,logger:t.logger});u.sso_region=y.sso_region,u.sso_start_url=y.sso_start_url}let{sso_start_url:l,sso_account_id:m,sso_region:g,sso_role_name:S,sso_session:E}=mA(u,t.logger);return lA({ssoStartUrl:l,ssoSession:E,ssoAccountId:m,ssoRegion:g,ssoRoleName:S,ssoClient:a,clientConfig:t.clientConfig,parentClientConfig:t.parentClientConfig,callerClientConfig:t.callerClientConfig,profile:c,filepath:t.filepath,configFilepath:t.configFilepath,ignoreCache:t.ignoreCache,logger:t.logger})}else{if(!r||!o||!n||!s)throw new $t('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:t.logger});return lA({ssoStartUrl:r,ssoSession:i,ssoAccountId:o,ssoRegion:n,ssoRoleName:s,ssoClient:a,clientConfig:t.clientConfig,parentClientConfig:t.parentClientConfig,callerClientConfig:t.callerClientConfig,profile:c,filepath:t.filepath,configFilepath:t.configFilepath,ignoreCache:t.ignoreCache,logger:t.logger})}};Sd.fromSSO=gM;Sd.isSsoProfile=fA;Sd.validateSsoProfile=mA});var sp=se(yd=>{var{SignatureV4:SM,signatureV4aContainer:pA}=qf(),di={CrtSignerV4:null},op="X-Amz-S3session-Token",hA=op.toLowerCase(),Ed=class extends SM{async signWithCredentials(e,r,o){let n=gA(r);e.headers[hA]=r.sessionToken;let s=this;return SA(s,n),s.signRequest(e,o??{})}async presignWithCredentials(e,r,o){let n=gA(r);return delete e.headers[hA],e.headers[op]=r.sessionToken,e.query=e.query??{},e.query[op]=r.sessionToken,SA(this,n),this.presign(e,o)}};function gA(t){return{accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,expiration:t.expiration}}function SA(t,e){let r=t.credentialProvider;t.credentialProvider=()=>(t.credentialProvider=r,Promise.resolve(e))}var np=class{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return typeof di.CrtSignerV4=="function"?"crt":typeof pA.SignatureV4a=="function"?"js":"none"}constructor(e){this.sigv4Signer=new Ed(e),this.signerOptions=e}async sign(e,r={}){return r.signingRegion==="*"?this.getSigv4aSigner().sign(e,r):this.sigv4Signer.sign(e,r)}async signWithCredentials(e,r,o={}){if(o.signingRegion==="*"){let n=this.getSigv4aSigner(),s=di.CrtSignerV4;if(s&&n instanceof s)return n.signWithCredentials(e,r,o);throw new 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,r,o)}async presign(e,r={}){if(r.signingRegion==="*"){let o=this.getSigv4aSigner(),n=di.CrtSignerV4;if(n&&o instanceof n)return o.presign(e,r);throw new 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,r)}async presignWithCredentials(e,r,o={}){if(o.signingRegion==="*")throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,r,o)}getSigv4aSigner(){if(!this.sigv4aSigner){let e=di.CrtSignerV4,r=pA.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!e&&!r)throw new 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(r&&typeof r=="function")this.sigv4aSigner=new r({...this.signerOptions});else throw new 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(!r||typeof r!="function")throw new 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 r({...this.signerOptions})}}return this.sigv4aSigner}};yd.SignatureV4MultiRegion=np;yd.SignatureV4SignWithCredentials=Ed;yd.signatureV4CrtContainer=di});var Wn,Go,ui,EA,xA,li,ve,ip,yA,CA,_A,TA,AA,ke,ap,Vn,wA,RA,EM,Y,yM,IA,vA=h(()=>{ae();Wn="ref",Go=-1,ui=!0,EA="isSet",xA="PartitionResult",li="booleanEquals",ve="stringEquals",ip="getAttr",yA="us-east-1",CA="sigv4",_A="sts",TA="https://sts.{Region}.{PartitionResult#dnsSuffix}",AA={[Wn]:"Endpoint"},ke={[Wn]:"Region"},ap={[Wn]:xA},Vn={},wA=[ke],RA={conditions:[[EA,[AA]],[EA,wA],["aws.partition",wA,xA],[li,[{[Wn]:"UseFIPS"},ui]],[li,[{[Wn]:"UseDualStack"},ui]],[ve,[ke,"aws-global"]],[li,[{[Wn]:"UseGlobalEndpoint"},ui]],[ve,[ke,"eu-central-1"]],[li,[{fn:ip,argv:[ap,"supportsDualStack"]},ui]],[li,[{fn:ip,argv:[ap,"supportsFIPS"]},ui]],[ve,[ke,"ap-south-1"]],[ve,[ke,"eu-north-1"]],[ve,[ke,"eu-west-1"]],[ve,[ke,"eu-west-2"]],[ve,[ke,"eu-west-3"]],[ve,[ke,"sa-east-1"]],[ve,[ke,yA]],[ve,[ke,"us-east-2"]],[ve,[ke,"us-west-2"]],[ve,[ke,"us-west-1"]],[ve,[ke,"ca-central-1"]],[ve,[ke,"ap-southeast-1"]],[ve,[ke,"ap-northeast-1"]],[ve,[ke,"ap-southeast-2"]],[ve,[{fn:ip,argv:[ap,"name"]},"aws-us-gov"]]],results:[[Go],["https://sts.amazonaws.com",{authSchemes:[{name:CA,signingName:_A,signingRegion:yA}]}],[TA,{authSchemes:[{name:CA,signingName:_A,signingRegion:"{Region}"}]}],[Go,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Go,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[AA,Vn],["https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Vn],[Go,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://sts.{Region}.amazonaws.com",Vn],["https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",Vn],[Go,"FIPS is enabled but this partition does not support FIPS"],["https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",Vn],[Go,"DualStack is enabled but this partition does not support DualStack"],[TA,Vn],[Go,"Invalid Configuration: Missing Region"]]},EM=2,Y=1e8,yM=new Int32Array([-1,1,-1,0,30,3,1,4,Y+14,2,5,Y+14,3,25,6,4,24,7,5,Y+1,8,6,9,Y+13,7,Y+1,10,10,Y+1,11,11,Y+1,12,12,Y+1,13,13,Y+1,14,14,Y+1,15,15,Y+1,16,16,Y+1,17,17,Y+1,18,18,Y+1,19,19,Y+1,20,20,Y+1,21,21,Y+1,22,22,Y+1,23,23,Y+1,Y+2,8,Y+11,Y+12,4,28,26,9,27,Y+10,24,Y+8,Y+9,8,29,Y+7,9,Y+6,Y+7,3,Y+3,31,4,Y+4,Y+5]),IA=Hr.from(yM,EM,RA.conditions,RA.results)});var CM,Cd,cp=h(()=>{Z();ae();vA();CM=new zr({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),Cd=(t,e={})=>CM.get(t,()=>qr(IA,{endpointParams:t,logger:e.logger}));Wt.aws=vt});function bA(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function dp(t){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function NA(t){return{schemeId:"smithy.api#noAuth"}}var kA,_M,TM,PA,AM,wM,OA,DA,up=h(()=>{De();kA=Ee(sp());M();ae();cp();_M=t=>async(e,r,o)=>{if(!o)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let n=await t(e,r,o),s=Ie(r)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!s)throw new Error(`getEndpointParameterInstructions() is not defined on '${r.commandName}'`);let i=await Hg(o,{getEndpointParameterInstructions:s},e);return Object.assign(n,i)},TM=async(t,e,r)=>({operation:Ie(e).operation,region:await Be(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),PA=_M(TM);AM=(t,e,r)=>n=>{let i=t(n).properties?.authSchemes;if(!i)return e(n);let a=[];for(let c of i){let{name:d,properties:u={},...l}=c,m=d.toLowerCase();d!==m&&console.warn(`HttpAuthScheme has been normalized with lowercasing: '${d}' to '${m}'`);let g;if(m==="sigv4a"){g="aws.auth#sigv4a";let C=i.find(y=>{let T=y.name.toLowerCase();return T!=="sigv4a"&&T.startsWith("sigv4")});if(kA.SignatureV4MultiRegion.sigv4aDependency()==="none"&&C)continue}else if(m.startsWith("sigv4"))g="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${m}'`);let S=r[g];if(!S)throw new Error(`Could not find HttpAuthOption create function for '${g}'`);let E=S(n);E.schemeId=g,E.signingProperties={...E.signingProperties||{},...l,...u},a.push(E)}return a},wM=t=>{let e=[];return t.operation==="AssumeRoleWithWebIdentity"?(e.push(NA(t)),e.push(dp(t))):(e.push(bA(t)),e.push(dp(t))),e},OA=AM(Cd,wM,{"aws.auth#sigv4":bA,"aws.auth#sigv4a":dp,"smithy.api#noAuth":NA}),DA=t=>{let e=fr(t),r=Ts(e);return Object.assign(r,{authSchemePreference:Be(t.authSchemePreference??[])})}});var MA,$A,lp=h(()=>{MA=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),$A={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"}}});var We,_d=h(()=>{M();We=class t extends Nr{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.sts#STSServiceException";constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var fi,mi,pi,hi,gi,Si,Ei,fp=h(()=>{_d();fi=class t extends We{static shapeId="com.amazonaws.sts#ExpiredTokenException";name="ExpiredTokenException";$fault="client";constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},mi=class t extends We{static shapeId="com.amazonaws.sts#MalformedPolicyDocumentException";name="MalformedPolicyDocumentException";$fault="client";constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},pi=class t extends We{static shapeId="com.amazonaws.sts#PackedPolicyTooLargeException";name="PackedPolicyTooLargeException";$fault="client";constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},hi=class t extends We{static shapeId="com.amazonaws.sts#RegionDisabledException";name="RegionDisabledException";$fault="client";constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},gi=class t extends We{static shapeId="com.amazonaws.sts#IDPRejectedClaimException";name="IDPRejectedClaimException";$fault="client";constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Si=class t extends We{static shapeId="com.amazonaws.sts#InvalidIdentityTokenException";name="InvalidIdentityTokenException";$fault="client";constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Ei=class t extends We{static shapeId="com.amazonaws.sts#IDPCommunicationErrorException";name="IDPCommunicationErrorException";$fault="client";$retryable={};constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}}});var RM,xM,IM,vM,kM,PM,mp,bM,NM,OM,DM,pp,MM,LA,$M,LM,UM,BM,GM,FM,HM,zM,UA,BA,GA,qM,VM,WM,jM,KM,XM,FA,YM,QM,HA,JM,zA,ZM,e$,hp,t$,r$,qA,VA,o$,n$,s$,i$,a$,c$,d$,u$,Fo,Ho,l$,zo,qo,Vo,f$,WA,m$,ne,jA,KA,Co,XA,YA,QA,JA,ZA,ew,tw,gp,p$,h$,Sp,rw,ow,nw,sw,Ep,iw,aw,cw,dw,g$,S$,yp,Cp,yi=h(()=>{W();fp();_d();RM="Arn",xM="AccessKeyId",IM="AssumeRole",vM="AssumedRoleId",kM="AssumeRoleRequest",PM="AssumeRoleResponse",mp="AssumedRoleUser",bM="AssumeRoleWithWebIdentity",NM="AssumeRoleWithWebIdentityRequest",OM="AssumeRoleWithWebIdentityResponse",DM="Audience",pp="Credentials",MM="ContextAssertion",LA="DurationSeconds",$M="Expiration",LM="ExternalId",UM="ExpiredTokenException",BM="IDPCommunicationErrorException",GM="IDPRejectedClaimException",FM="InvalidIdentityTokenException",HM="Key",zM="MalformedPolicyDocumentException",UA="MinimumSessionTokenSize",BA="Policy",GA="PolicyArns",qM="ProviderArn",VM="ProvidedContexts",WM="ProvidedContextsListType",jM="ProvidedContext",KM="PolicyDescriptorType",XM="ProviderId",FA="PackedPolicySize",YM="PackedPolicyTooLargeException",QM="Provider",HA="RoleArn",JM="RegionDisabledException",zA="RoleSessionName",ZM="SecretAccessKey",e$="SubjectFromWebIdentityToken",hp="SourceIdentity",t$="SerialNumber",r$="SessionToken",qA="SessionTokenSize",VA="SessionTokenUtilization",o$="Tags",n$="TokenCode",s$="TransitiveTagKeys",i$="Tag",a$="Value",c$="WebIdentityToken",d$="arn",u$="accessKeySecretType",Fo="awsQueryError",Ho="client",l$="clientTokenType",zo="error",qo="httpError",Vo="message",f$="policyDescriptorListType",WA="smithy.ts.sdk.synthetic.com.amazonaws.sts",m$="tagListType",ne="com.amazonaws.sts",jA=new ie(WA),KA=[-3,WA,"STSServiceException",0,[],[]];jA.registerError(KA,We);Co=new ie(ne),XA=[-3,ne,UM,{[Fo]:["ExpiredTokenException",400],[zo]:Ho,[qo]:400},[Vo],[0]];Co.registerError(XA,fi);YA=[-3,ne,BM,{[Fo]:["IDPCommunicationError",400],[zo]:Ho,[qo]:400},[Vo],[0]];Co.registerError(YA,Ei);QA=[-3,ne,GM,{[Fo]:["IDPRejectedClaim",403],[zo]:Ho,[qo]:403},[Vo],[0]];Co.registerError(QA,gi);JA=[-3,ne,FM,{[Fo]:["InvalidIdentityToken",400],[zo]:Ho,[qo]:400},[Vo],[0]];Co.registerError(JA,Si);ZA=[-3,ne,zM,{[Fo]:["MalformedPolicyDocument",400],[zo]:Ho,[qo]:400},[Vo],[0]];Co.registerError(ZA,mi);ew=[-3,ne,YM,{[Fo]:["PackedPolicyTooLarge",400],[zo]:Ho,[qo]:400},[Vo],[0]];Co.registerError(ew,pi);tw=[-3,ne,JM,{[Fo]:["RegionDisabledException",403],[zo]:Ho,[qo]:403},[Vo],[0]];Co.registerError(tw,hi);gp=[jA,Co],p$=[0,ne,u$,8,0],h$=[0,ne,l$,8,0],Sp=[3,ne,mp,0,[vM,RM],[0,0],2],rw=[3,ne,kM,0,[HA,zA,GA,BA,LA,o$,s$,LM,t$,n$,hp,VM,UA],[0,0,()=>dw,0,1,()=>S$,64,0,0,0,0,()=>g$,1],2],ow=[3,ne,PM,0,[pp,mp,FA,hp,VA,qA],[[()=>Ep,0],()=>Sp,1,0,1,1]],nw=[3,ne,NM,0,[HA,zA,c$,XM,GA,BA,LA,UA],[0,0,[()=>h$,0],0,()=>dw,0,1,1],3],sw=[3,ne,OM,0,[pp,e$,mp,FA,QM,DM,hp,VA,qA],[[()=>Ep,0],0,()=>Sp,1,0,0,0,1,1]],Ep=[3,ne,pp,0,[xM,ZM,r$,$M],[0,[()=>p$,0],0,4],4],iw=[3,ne,KM,0,[d$],[0]],aw=[3,ne,jM,0,[qM,MM],[0,0]],cw=[3,ne,i$,0,[HM,a$],[0,0],2],dw=[1,ne,f$,0,()=>iw],g$=[1,ne,WM,0,()=>aw],S$=[1,ne,m$,0,()=>cw],yp=[9,ne,IM,0,()=>rw,()=>ow],Cp=[9,ne,bM,0,()=>nw,()=>sw]});var uw,lw,fw=h(()=>{De();Hn();uw=Ee(sp());ze();rs();M();P();D();up();cp();yi();lw=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??ge,base64Encoder:t?.base64Encoder??le,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Cd,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??OA,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Te},{schemeId:"aws.auth#sigv4a",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4a"),signer:new wr},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Oe}],logger:t?.logger??new qt,protocol:t?.protocol??yo,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",errorTypeRegistries:gp,xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",sha256:t?.sha256??jr,signerConstructor:t?.signerConstructor??uw.SignatureV4MultiRegion,urlParser:t?.urlParser??tt,utf8Decoder:t?.utf8Decoder??Vt,utf8Encoder:t?.utf8Encoder??pe})});var Td,mw,pw=h(()=>{Ps();Z();De();ze();M();te();dt();D();Td=Ee(bn());fw();mw=t=>{Dr(process.version);let e=Fr(t),r=()=>e().then(Or),o=lw(t);jt(process.version);let n={profile:t?.profile,logger:o.logger};return{...o,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??q(Pt,n),bodyLengthChecker:t?.bodyLengthChecker??Ur,defaultUserAgentProvider:t?.defaultUserAgentProvider??It({serviceId:o.serviceId,clientVersion:ho.version}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:s=>s.getIdentityProvider("aws.auth#sigv4")||(async i=>await t.credentialDefaultProvider(i?.__config||{})()),signer:new Te},{schemeId:"aws.auth#sigv4a",identityProvider:s=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new wr},{schemeId:"smithy.api#noAuth",identityProvider:s=>s.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Oe}],maxAttempts:t?.maxAttempts??q(tr,t),region:t?.region??q(Xe,{...Ye,...n}),requestHandler:Td.NodeHttpHandler.create(t?.requestHandler??r),retryMode:t?.retryMode??q({...or,default:async()=>(await r()).retryMode||ct},t),sigv4aSigningRegionSet:t?.sigv4aSigningRegionSet??q(As,n),streamCollector:t?.streamCollector??Td.streamCollector,useDualstackEndpoint:t?.useDualstackEndpoint??q(Br,n),useFipsEndpoint:t?.useFipsEndpoint??q(Gr,n),userAgentAppId:t?.userAgentAppId??q(dr,n)}}});var hw,gw,Sw=h(()=>{hw=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,o=t.credentials;return{setHttpAuthScheme(n){let s=e.findIndex(i=>i.schemeId===n.schemeId);s===-1?e.push(n):e.splice(s,1,n)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},gw=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Ew,yw=h(()=>{Z();M();P();Sw();Ew=(t,e)=>{let r=Object.assign(ur(t),Mr(t),Xt(t),hw(t));return e.forEach(o=>o.configure(r)),Object.assign(t,lr(r),$r(r),Yt(r),gw(r))}});var _o,Ad=h(()=>{Z();ze();M();te();ae();P();dt();W();up();lp();pw();yw();_o=class extends rt{config;constructor(...[e]){let r=mw(e||{});super(r),this.initConfig=r;let o=MA(r),n=ar(o),s=rr(n),i=Ct(s),a=i,c=Vr(a),d=DA(c),u=Ew(d,e?.extensions||[]);this.config=u,this.middlewareStack.use(kr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(Ar(this.config)),this.middlewareStack.use(Qt(this.config)),this.middlewareStack.use(nr(this.config)),this.middlewareStack.use(sr(this.config)),this.middlewareStack.use(ir(this.config)),this.middlewareStack.use(Rt(this.config,{httpAuthSchemeParametersProvider:PA,identityProviderConfigProvider:async l=>new Qe({"aws.auth#sigv4":l.credentials,"aws.auth#sigv4a":l.credentials})})),this.middlewareStack.use(xt(this.config))}destroy(){super.destroy()}}});var wd,Rd,xd,_p=h(()=>{M();ae();lp();wd=Lr($A,"AWSSecurityTokenServiceV20110615","STSClient",Wr),Rd={},xd=(t,e,r,o)=>[]});var Wo,Id=h(()=>{_p();yi();Wo=class extends wd(Rd,xd,"AssumeRole",yp){}});var jo,vd=h(()=>{_p();yi();jo=class extends wd(Rd,xd,"AssumeRoleWithWebIdentity",Cp){}});var E$,kd,Cw=h(()=>{M();Id();vd();Ad();E$={AssumeRoleCommand:Wo,AssumeRoleWithWebIdentityCommand:jo},kd=class extends _o{};br(E$,kd)});var _w=h(()=>{Id();vd()});var Tw=h(()=>{});var Aw,ww,Rw,xw,Iw,vw=h(()=>{Z();Id();vd();Aw=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},ww=async(t,e,r,o={})=>{let n=typeof t=="function"?await t():t,s=typeof e=="function"?await e():e,i="",a=n??s??(i=await cc(o)());return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (credential provider clientConfig)`,`${s} (contextual client)`,`${i} (STS default: AWS_REGION, profile region, or us-east-1)`),a},Rw=(t,e)=>{let r,o;return async(n,s)=>{if(o=n,!r){let{logger:u=t?.parentClientConfig?.logger,profile:l=t?.parentClientConfig?.profile,region:m,requestHandler:g=t?.parentClientConfig?.requestHandler,credentialProviderLogger:S,userAgentAppId:E=t?.parentClientConfig?.userAgentAppId}=t,C=await ww(m,t?.parentClientConfig?.region,S,{logger:u,profile:l}),y=!Iw(g);r=new e({...t,userAgentAppId:E,profile:l,credentialDefaultProvider:()=>async()=>o,region:C,requestHandler:y?g:void 0,logger:u})}let{Credentials:i,AssumedRoleUser:a}=await r.send(new Wo(s));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${s.RoleArn}`);let c=Aw(a),d={accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,...i.CredentialScope&&{credentialScope:i.CredentialScope},...c&&{accountId:c}};return Kr(d,"CREDENTIALS_STS_ASSUME_ROLE","i"),d}},xw=(t,e)=>{let r;return async o=>{if(!r){let{logger:c=t?.parentClientConfig?.logger,profile:d=t?.parentClientConfig?.profile,region:u,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:m,userAgentAppId:g=t?.parentClientConfig?.userAgentAppId}=t,S=await ww(u,t?.parentClientConfig?.region,m,{logger:c,profile:d}),E=!Iw(l);r=new e({...t,userAgentAppId:g,profile:d,region:S,requestHandler:E?l:void 0,logger:c})}let{Credentials:n,AssumedRoleUser:s}=await r.send(new jo(o));if(!n||!n.AccessKeyId||!n.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${o.RoleArn}`);let i=Aw(s),a={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,sessionToken:n.SessionToken,expiration:n.Expiration,...n.CredentialScope&&{credentialScope:n.CredentialScope},...i&&{accountId:i}};return i&&Kr(a,"RESOLVED_ACCOUNT_ID","T"),Kr(a,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),a}},Iw=t=>t?.metadata?.handlerProtocol==="h2"});var kw,Pw,bw,y$,Nw=h(()=>{vw();Ad();kw=(t,e)=>e?class extends t{constructor(o){super(o);for(let n of e)this.middlewareStack.use(n)}}:t,Pw=(t={},e)=>Rw(t,kw(_o,e)),bw=(t={},e)=>xw(t,kw(_o,e)),y$=t=>e=>t({roleAssumer:Pw(e),roleAssumerWithWebIdentity:bw(e),...e})});var Tp={};St(Tp,{$Command:()=>Pr,AssumeRole$:()=>yp,AssumeRoleCommand:()=>Wo,AssumeRoleRequest$:()=>rw,AssumeRoleResponse$:()=>ow,AssumeRoleWithWebIdentity$:()=>Cp,AssumeRoleWithWebIdentityCommand:()=>jo,AssumeRoleWithWebIdentityRequest$:()=>nw,AssumeRoleWithWebIdentityResponse$:()=>sw,AssumedRoleUser$:()=>Sp,Credentials$:()=>Ep,ExpiredTokenException:()=>fi,ExpiredTokenException$:()=>XA,IDPCommunicationErrorException:()=>Ei,IDPCommunicationErrorException$:()=>YA,IDPRejectedClaimException:()=>gi,IDPRejectedClaimException$:()=>QA,InvalidIdentityTokenException:()=>Si,InvalidIdentityTokenException$:()=>JA,MalformedPolicyDocumentException:()=>mi,MalformedPolicyDocumentException$:()=>ZA,PackedPolicyTooLargeException:()=>pi,PackedPolicyTooLargeException$:()=>ew,PolicyDescriptorType$:()=>iw,ProvidedContext$:()=>aw,RegionDisabledException:()=>hi,RegionDisabledException$:()=>tw,STS:()=>kd,STSClient:()=>_o,STSServiceException:()=>We,STSServiceException$:()=>KA,Tag$:()=>cw,__Client:()=>rt,decorateDefaultCredentialProvider:()=>y$,errorTypeRegistries:()=>gp,getDefaultRoleAssumer:()=>Pw,getDefaultRoleAssumerWithWebIdentity:()=>bw});var Ap=h(()=>{Ad();Cw();_w();M();yi();fp();Tw();Nw();_d()});function C$(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"signin",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function _$(t){return{schemeId:"smithy.api#noAuth"}}var Ow,Dw,Mw,wp=h(()=>{De();M();Ow=async(t,e,r)=>({operation:Ie(e).operation,region:await Be(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});Dw=t=>{let e=[];return t.operation==="CreateOAuth2Token"?e.push(_$(t)):e.push(C$(t)),e},Mw=t=>{let e=fr(t);return Object.assign(e,{authSchemePreference:Be(t.authSchemePreference??[])})}});var $w,Lw,Rp=h(()=>{$w=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"signin"}),Lw={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var wo,To,Uw,jn,Bw,Kn,Gw,Ip,xr,xp,Fw,Hw,Ao,Ww,zw,Pd,Me,qw,Vw,T$,j,A$,jw,Kw=h(()=>{ae();wo="ref",To=-1,Uw=!1,jn=!0,Bw="isSet",Kn="booleanEquals",Gw="coalesce",Ip="PartitionResult",xr="stringEquals",xp="getAttr",Fw="https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}",Hw={[wo]:"Endpoint"},Ao={fn:xp,argv:[{[wo]:Ip},"name"]},Ww={[wo]:"Region"},zw={[wo]:Ip},Pd={authSchemes:[{name:"sigv4",signingName:"signin",signingRegion:"{Region}"}]},Me={},qw=[Ww],Vw={conditions:[[Bw,qw],[Kn,[{fn:Gw,argv:[{[wo]:"IsControlPlane"},Uw]},jn]],[Bw,[Hw]],["aws.partition",qw,Ip],[Kn,[{[wo]:"UseFIPS"},jn]],[xr,[Ao,"aws"]],[Kn,[{fn:Gw,argv:[{[wo]:"IsOAuthEndpoint"},Uw]},jn]],[Kn,[{[wo]:"UseDualStack"},jn]],[xr,[Ao,"aws-cn"]],[xr,[Ww,"us-gov-west-1"]],[xr,[Ao,"aws-us-gov"]],[Kn,[{fn:xp,argv:[zw,"supportsFIPS"]},jn]],[xr,[Ao,"aws-iso"]],[xr,[Ao,"aws-iso-b"]],[xr,[Ao,"aws-iso-f"]],[xr,[Ao,"aws-iso-e"]],[xr,[Ao,"aws-eusc"]],[Kn,[{fn:xp,argv:[zw,"supportsDualStack"]},jn]]],results:[[To],["https://signin.{Region}.api.aws",Pd],["https://signin.{Region}.api.amazonwebservices.com.cn",Pd],[Fw,Pd],[To,"FIPS endpoints are not supported for OAuth operations. Disable FIPS or use a non-OAuth operation."],["https://{Region}.oauth.signin.aws",Pd],["https://{Region}.signin.aws.amazon.com",Me],["https://{Region}.signin.amazonaws.cn",Me],["https://{Region}.signin.amazonaws-us-gov.com",Me],["https://{Region}.signin.c2shome.ic.gov",Me],["https://{Region}.signin.sc2shome.sgov.gov",Me],["https://{Region}.signin.csphome.hci.ic.gov",Me],["https://{Region}.signin.csphome.adc-e.uk",Me],["https://{Region}.signin.amazonaws-eusc.eu",Me],["https://signin-fips.amazonaws-us-gov.com",Me],["https://{Region}.signin-fips.amazonaws-us-gov.com",Me],["https://{Region}.signin.{PartitionResult#dnsSuffix}",Me],[To,"Invalid Configuration: FIPS and custom endpoint are not supported"],[To,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[Hw,Me],["https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Me],[To,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://signin-fips.{Region}.{PartitionResult#dnsSuffix}",Me],[To,"FIPS is enabled but this partition does not support FIPS"],[Fw,Me],[To,"DualStack is enabled but this partition does not support DualStack"],["https://signin.{Region}.{PartitionResult#dnsSuffix}",Me],[To,"Invalid Configuration: Missing Region"]]},T$=2,j=1e8,A$=new Int32Array([-1,1,-1,0,6,3,2,36,4,4,5,j+27,6,j+4,j+27,1,29,7,2,36,8,3,9,31,4,22,10,5,19,11,7,21,12,8,j+7,13,10,j+8,14,12,j+9,15,13,j+10,16,14,j+11,17,15,j+12,18,16,j+13,j+16,6,j+5,20,7,21,j+6,17,j+24,j+25,6,j+4,23,7,27,24,9,j+14,25,10,j+15,26,11,j+22,j+23,11,28,j+21,17,j+20,j+21,2,35,30,3,39,31,4,32,j+27,6,j+4,33,7,j+27,34,9,j+14,j+27,3,39,36,4,38,37,7,j+18,j+19,6,j+4,j+17,5,j+1,40,8,j+2,j+3]),jw=Hr.from(A$,T$,Vw.conditions,Vw.results)});var w$,Xw,Yw=h(()=>{Z();ae();Kw();w$=new zr({size:50,params:["Endpoint","IsControlPlane","IsOAuthEndpoint","Region","UseDualStack","UseFIPS"]}),Xw=(t,e={})=>w$.get(t,()=>qr(jw,{endpointParams:t,logger:e.logger}));Wt.aws=vt});var Lt,bd=h(()=>{M();Lt=class t extends Nr{static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.signin#SigninServiceException";constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var Ci,_i,Ti,Ai,vp=h(()=>{bd();Ci=class t extends Lt{static shapeId="com.amazonaws.signin#AccessDeniedException";name="AccessDeniedException";$fault="client";error;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error}},_i=class t extends Lt{static shapeId="com.amazonaws.signin#InternalServerException";name="InternalServerException";$fault="server";error;constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error}},Ti=class t extends Lt{static shapeId="com.amazonaws.signin#TooManyRequestsError";name="TooManyRequestsError";$fault="client";error;constructor(e){super({name:"TooManyRequestsError",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error}},Ai=class t extends Lt{static shapeId="com.amazonaws.signin#ValidationException";name="ValidationException";$fault="client";error;constructor(e){super({name:"ValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.error=e.error}}});var R$,x$,I$,v$,k$,P$,b$,N$,O$,D$,M$,$$,L$,U$,B$,Qw,kp,G$,Op,Jw,Zw,F$,Ro,Pp,H$,bp,z$,nR,Dp,eR,Pe,Od,q$,Nd,tR,sR,rR,oR,V$,W$,j$,Np,K$,$e,iR,aR,wi,cR,dR,uR,lR,Mp,X$,fR,mR,pR,hR,gR,SR,ER,yR,$p,Lp,Ri=h(()=>{W();vp();bd();R$="AccessDeniedException",x$="AccessToken",I$="CreateOAuth2Token",v$="CreateOAuth2TokenRequest",k$="CreateOAuth2TokenRequestBody",P$="CreateOAuth2TokenResponseBody",b$="CreateOAuth2TokenResponse",N$="CreateOAuth2TokenWithIAM",O$="CreateOAuth2TokenWithIAMRequest",D$="CreateOAuth2TokenWithIAMResponse",M$="InternalServerException",$$="OAuthAccessToken",L$="RefreshToken",U$="TooManyRequestsError",B$="ValidationException",Qw="accessKeyId",kp="accessToken",G$="access_token",Op="client",Jw="clientId",Zw="codeVerifier",F$="code",Ro="error",Pp="expiresIn",H$="expires_in",bp="grantType",z$="grant_type",nR="http",Dp="httpError",eR="idToken",Pe="jsonName",Od="message",q$="resource",Nd="refreshToken",tR="redirectUri",sR="smithy.ts.sdk.synthetic.com.amazonaws.signin",rR="secretAccessKey",oR="sessionToken",V$="server",W$="tokenInput",j$="tokenOutput",Np="tokenType",K$="token_type",$e="com.amazonaws.signin",iR=new ie(sR),aR=[-3,sR,"SigninServiceException",0,[],[]];iR.registerError(aR,Lt);wi=new ie($e),cR=[-3,$e,R$,{[Ro]:Op},[Ro,Od],[0,0],2];wi.registerError(cR,Ci);dR=[-3,$e,M$,{[Ro]:V$,[Dp]:500},[Ro,Od],[0,0],2];wi.registerError(dR,_i);uR=[-3,$e,U$,{[Ro]:Op,[Dp]:429},[Ro,Od],[0,0],2];wi.registerError(uR,Ti);lR=[-3,$e,B$,{[Ro]:Op,[Dp]:400},[Ro,Od],[0,0],2];wi.registerError(lR,Ai);Mp=[iR,wi],X$=[0,$e,$$,8,0],fR=[0,$e,L$,8,0],mR=[3,$e,x$,8,[Qw,rR,oR],[[0,{[Pe]:Qw}],[0,{[Pe]:rR}],[0,{[Pe]:oR}]],3],pR=[3,$e,v$,0,[W$],[[()=>hR,16]],1],hR=[3,$e,k$,0,[Jw,bp,F$,tR,Zw,Nd],[[0,{[Pe]:Jw}],[0,{[Pe]:bp}],0,[0,{[Pe]:tR}],[0,{[Pe]:Zw}],[()=>fR,{[Pe]:Nd}]],2],gR=[3,$e,b$,0,[j$],[[()=>SR,16]],1],SR=[3,$e,P$,0,[kp,Np,Pp,Nd,eR],[[()=>mR,{[Pe]:kp}],[0,{[Pe]:Np}],[1,{[Pe]:Pp}],[()=>fR,{[Pe]:Nd}],[0,{[Pe]:eR}]],4],ER=[3,$e,O$,0,[bp,q$],[[0,{[Pe]:z$}],0],2],yR=[3,$e,D$,0,[kp,Np,Pp],[[()=>X$,{[Pe]:G$}],[0,{[Pe]:K$}],[1,{[Pe]:H$}]],3],$p=[9,$e,I$,{[nR]:["POST","/v1/token",200]},()=>pR,()=>gR],Lp=[9,$e,N$,{[nR]:["POST","/v1/token?x-amz-client-auth-method=iam",200]},()=>ER,()=>yR]});var CR,_R=h(()=>{De();Hn();ze();rs();M();P();D();wp();Yw();Ri();CR=t=>({apiVersion:"2023-01-01",base64Decoder:t?.base64Decoder??ge,base64Encoder:t?.base64Encoder??le,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Xw,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??Dw,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Te},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Oe}],logger:t?.logger??new qt,protocol:t?.protocol??pr,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.signin",errorTypeRegistries:Mp,version:"2023-01-01",serviceTarget:"Signin"},serviceId:t?.serviceId??"Signin",sha256:t?.sha256??jr,urlParser:t?.urlParser??tt,utf8Decoder:t?.utf8Decoder??Vt,utf8Encoder:t?.utf8Encoder??pe})});var Dd,TR,AR=h(()=>{Ps();Z();De();M();te();dt();D();Dd=Ee(bn());_R();TR=t=>{Dr(process.version);let e=Fr(t),r=()=>e().then(Or),o=CR(t);jt(process.version);let n={profile:t?.profile,logger:o.logger};return{...o,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??q(Pt,n),bodyLengthChecker:t?.bodyLengthChecker??Ur,defaultUserAgentProvider:t?.defaultUserAgentProvider??It({serviceId:o.serviceId,clientVersion:ho.version}),maxAttempts:t?.maxAttempts??q(tr,t),region:t?.region??q(Xe,{...Ye,...n}),requestHandler:Dd.NodeHttpHandler.create(t?.requestHandler??r),retryMode:t?.retryMode??q({...or,default:async()=>(await r()).retryMode||ct},t),streamCollector:t?.streamCollector??Dd.streamCollector,useDualstackEndpoint:t?.useDualstackEndpoint??q(Br,n),useFipsEndpoint:t?.useFipsEndpoint??q(Gr,n),userAgentAppId:t?.userAgentAppId??q(dr,n)}}});var wR,RR,xR=h(()=>{wR=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,o=t.credentials;return{setHttpAuthScheme(n){let s=e.findIndex(i=>i.schemeId===n.schemeId);s===-1?e.push(n):e.splice(s,1,n)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},RR=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var IR,vR=h(()=>{Z();M();P();xR();IR=(t,e)=>{let r=Object.assign(ur(t),Mr(t),Xt(t),wR(t));return e.forEach(o=>o.configure(r)),Object.assign(t,lr(r),$r(r),Yt(r),RR(r))}});var xi,Up=h(()=>{Z();ze();M();te();ae();P();dt();W();wp();Rp();AR();vR();xi=class extends rt{config;constructor(...[e]){let r=TR(e||{});super(r),this.initConfig=r;let o=$w(r),n=ar(o),s=rr(n),i=Ct(s),a=i,c=Vr(a),d=Mw(c),u=IR(d,e?.extensions||[]);this.config=u,this.middlewareStack.use(kr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(Ar(this.config)),this.middlewareStack.use(Qt(this.config)),this.middlewareStack.use(nr(this.config)),this.middlewareStack.use(sr(this.config)),this.middlewareStack.use(ir(this.config)),this.middlewareStack.use(Rt(this.config,{httpAuthSchemeParametersProvider:Ow,identityProviderConfigProvider:async l=>new Qe({"aws.auth#sigv4":l.credentials})})),this.middlewareStack.use(xt(this.config))}destroy(){super.destroy()}}});var Md,kR,PR,$d,Bp=h(()=>{M();ae();Rp();Md=Lr(Lw,"Signin","SigninClient",Wr),kR={IsControlPlane:{type:"staticContextParams",value:!1}},PR={IsOAuthEndpoint:{type:"staticContextParams",value:!0}},$d=(t,e,r,o)=>[]});var Ii,Gp=h(()=>{Bp();Ri();Ii=class extends Md(kR,$d,"CreateOAuth2Token",$p){}});var vi,Fp=h(()=>{Bp();Ri();vi=class extends Md(PR,$d,"CreateOAuth2TokenWithIAM",Lp){}});var Y$,Ld,bR=h(()=>{M();Gp();Fp();Up();Y$={CreateOAuth2TokenCommand:Ii,CreateOAuth2TokenWithIAMCommand:vi},Ld=class extends xi{};br(Y$,Ld)});var NR=h(()=>{Gp();Fp()});var Q$,OR=h(()=>{Q$={AUTHCODE_EXPIRED:"AUTHCODE_EXPIRED",CONFLICT:"CONFLICT",INSUFFICIENT_PERMISSIONS:"INSUFFICIENT_PERMISSIONS",INVALID_REQUEST:"INVALID_REQUEST",RESOURCE_NOT_FOUND:"RESOURCE_NOT_FOUND",SERVER_ERROR:"server_error",SERVICE_QUOTA_EXCEEDED:"SERVICE_QUOTA_EXCEEDED",TOKEN_EXPIRED:"TOKEN_EXPIRED",USER_CREDENTIALS_CHANGED:"USER_CREDENTIALS_CHANGED"}});var DR=h(()=>{});var MR={};St(MR,{$Command:()=>Pr,AccessDeniedException:()=>Ci,AccessDeniedException$:()=>cR,AccessToken$:()=>mR,CreateOAuth2Token$:()=>$p,CreateOAuth2TokenCommand:()=>Ii,CreateOAuth2TokenRequest$:()=>pR,CreateOAuth2TokenRequestBody$:()=>hR,CreateOAuth2TokenResponse$:()=>gR,CreateOAuth2TokenResponseBody$:()=>SR,CreateOAuth2TokenWithIAM$:()=>Lp,CreateOAuth2TokenWithIAMCommand:()=>vi,CreateOAuth2TokenWithIAMRequest$:()=>ER,CreateOAuth2TokenWithIAMResponse$:()=>yR,InternalServerException:()=>_i,InternalServerException$:()=>dR,OAuth2ErrorCode:()=>Q$,Signin:()=>Ld,SigninClient:()=>xi,SigninServiceException:()=>Lt,SigninServiceException$:()=>aR,TooManyRequestsError:()=>Ti,TooManyRequestsError$:()=>uR,ValidationException:()=>Ai,ValidationException$:()=>lR,__Client:()=>rt,errorTypeRegistries:()=>Mp});var $R=h(()=>{Up();bR();NR();M();Ri();OR();vp();DR();bd()});var BR=se(UR=>{var{setCredentialFeature:J$}=(Z(),v(kt)),{CredentialsProviderError:xo,parseKnownFiles:Z$,getProfileName:e1}=(te(),v(nt)),{HttpRequest:t1}=(P(),v(at)),{createHash:r1,createPrivateKey:o1,createPublicKey:n1,sign:s1}=oe("node:crypto"),{promises:Hp}=oe("node:fs"),{homedir:i1}=oe("node:os"),{dirname:a1,join:LR}=oe("node:path"),zp=class t{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300*1e3;constructor(e,r,o){this.profileData=e,this.init=r,this.callerClientConfig=o}async loadCredentials(){let e=await this.loadToken();if(!e)throw new xo(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let r=e.accessToken,o=Date.now();return new Date(r.expiresAt).getTime()-o<=t.REFRESH_THRESHOLD?this.refresh(e):this.toCredentials(e.accessToken)}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}toCredentials(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken,accountId:e.accountId,expiration:new Date(e.expiresAt)}}async refresh(e){let r=await this.loadToken().catch(()=>e),o=Date.now(),n=new Date(r.accessToken.expiresAt).getTime(),s=new Date(e.accessToken.expiresAt).getTime(),i=n<=o&&s>o?e:r;if(new Date(i.accessToken.expiresAt).getTime()-Date.now()>t.REFRESH_THRESHOLD)return this.toCredentials(i.accessToken);let{SigninClient:c,CreateOAuth2TokenCommand:d}=($R(),v(MR)),{logger:u,userAgentAppId:l}=this.callerClientConfig??{},g=(y=>y?.metadata?.handlerProtocol==="h2")(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,S=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,E=new c({credentials:{accessKeyId:"",secretAccessKey:""},region:S,requestHandler:g,logger:u,userAgentAppId:l,...this.init?.clientConfig});this.createDPoPInterceptor(E.middlewareStack);let C={tokenInput:{clientId:i.clientId,refreshToken:i.refreshToken,grantType:"refresh_token"}};try{let y=await E.send(new d(C)),{accessKeyId:T,secretAccessKey:w,sessionToken:I}=y.tokenOutput?.accessToken??{},{refreshToken:b,expiresIn:F}=y.tokenOutput??{};if(!T||!w||!I||!b)throw new xo("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let B=(F??900)*1e3,O=new Date(Date.now()+B),Q={...i,accessToken:{...i.accessToken,accessKeyId:T,secretAccessKey:w,sessionToken:I,expiresAt:O.toISOString()},refreshToken:b};return await this.saveToken(Q),this.toCredentials(Q.accessToken)}catch(y){if(y.name==="AccessDeniedException"){let w=y.error,I;switch(w){case"TOKEN_EXPIRED":I="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":I="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":I="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:I=`Failed to refresh token: ${String(y)}. Please re-authenticate using \`aws login\``}throw new xo(I,{logger:this.logger,tryNextLink:!1})}if(new Date(i.accessToken.expiresAt).getTime()>Date.now())return this.logger?.warn?.(`Failed to refresh token: ${String(y)}. Using existing token until expiry.`),this.toCredentials(i.accessToken);throw new xo(`Failed to refresh token: ${String(y)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let r=await Hp.readFile(e,"utf8"),o=JSON.parse(r),n=["accessToken","clientId","refreshToken","dpopKey"].filter(s=>!o[s]);if(o.accessToken?.accountId||n.push("accountId"),n.length>0)throw new xo(`Token validation failed, missing fields: ${n.join(", ")}`,{logger:this.logger,tryNextLink:!1});return o}catch(r){throw new xo(`Failed to load token from ${e}: ${String(r)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let r=this.getTokenFilePath(),o=a1(r);try{await Hp.mkdir(o,{recursive:!0})}catch{}await Hp.writeFile(r,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??LR(i1(),".aws","login","cache"),r=Buffer.from(this.loginSession,"utf8"),o=r1("sha256").update(r).digest("hex");return LR(e,`${o}.json`)}derToRawSignature(e){let r=2;if(e[r]!==2)throw new Error("Invalid DER signature");r++;let o=e[r++],n=e.subarray(r,r+o);if(r+=o,e[r]!==2)throw new Error("Invalid DER signature");r++;let s=e[r++],i=e.subarray(r,r+s);n=n[0]===0?n.subarray(1):n,i=i[0]===0?i.subarray(1):i;let a=Buffer.concat([Buffer.alloc(32-n.length),n]),c=Buffer.concat([Buffer.alloc(32-i.length),i]);return Buffer.concat([a,c])}createDPoPInterceptor(e){e.add(r=>async o=>{if(t1.isInstance(o.request)){let n=o.request,s=`${n.protocol}//${n.hostname}${n.port?`:${n.port}`:""}${n.path}`,i=await this.generateDpop(n.method,s);n.headers={...n.headers,DPoP:i}}return r(o)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",r){let o=await this.loadToken();try{let n=o1({key:o.dpopKey,format:"pem",type:"sec1"}),i=n1(n).export({format:"der",type:"spki"}),a=-1;for(let T=0;T<i.length;T++)if(i[T]===4){a=T;break}let c=i.slice(a+1,a+33),d=i.slice(a+33,a+65),u={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:c.toString("base64url"),y:d.toString("base64url")}},l={jti:crypto.randomUUID(),htm:e,htu:r,iat:Math.floor(Date.now()/1e3)},m=Buffer.from(JSON.stringify(u)).toString("base64url"),g=Buffer.from(JSON.stringify(l)).toString("base64url"),S=`${m}.${g}`,E=s1("sha256",Buffer.from(S),n),y=this.derToRawSignature(E).toString("base64url");return`${S}.${y}`}catch(n){throw new xo(`Failed to generate Dpop proof: ${n instanceof Error?n.message:String(n)}`,{logger:this.logger,tryNextLink:!1})}}},c1=t=>async({callerClientConfig:e}={})=>{t?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let r=await Z$(t||{}),o=e1({profile:t?.profile??e?.profile}),n=r[o];if(!n?.login_session)throw new xo(`Profile ${o} does not contain login_session.`,{tryNextLink:!0,logger:t?.logger});let i=await new zp(n,t,e).loadCredentials();return J$(i,"CREDENTIALS_LOGIN","AD")};UR.fromLoginCredentials=c1});var Vp=se(GR=>{var{externalDataInterceptor:d1,CredentialsProviderError:qp,parseKnownFiles:u1,getProfileName:l1}=(te(),v(nt)),{exec:f1}=oe("node:child_process"),{promisify:m1}=oe("node:util"),{setCredentialFeature:p1}=(Z(),v(kt)),h1=(t,e,r)=>{if(e.Version!==1)throw Error(`Profile ${t} credential_process did not return Version 1.`);if(e.AccessKeyId===void 0||e.SecretAccessKey===void 0)throw Error(`Profile ${t} credential_process returned invalid credentials.`);if(e.Expiration){let s=new Date;if(new Date(e.Expiration)<s)throw Error(`Profile ${t} credential_process returned expired credentials.`)}let o=e.AccountId;!o&&r?.[t]?.aws_account_id&&(o=r[t].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},...o&&{accountId:o}};return p1(n,"CREDENTIALS_PROCESS","w"),n},g1=async(t,e,r)=>{let o=e[t];if(e[t]){let n=o.credential_process;if(n!==void 0){let s=m1(d1?.getTokenRecord?.().exec??f1);try{let{stdout:i}=await s(n),a;try{a=JSON.parse(i.trim())}catch{throw Error(`Profile ${t} credential_process returned invalid JSON.`)}return h1(t,a,e)}catch(i){throw new qp(i.message,{logger:r})}}else throw new qp(`Profile ${t} did not contain credential_process.`,{logger:r})}else throw new qp(`Profile ${t} could not be found in shared credentials file.`,{logger:r})},S1=(t={})=>async({callerClientConfig:e}={})=>{t.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let r=await u1(t);return g1(l1({profile:t.profile??e?.profile}),r,t.logger)};GR.fromProcess=S1});var jp=se(Wp=>{var{setCredentialFeature:E1}=(Z(),v(kt)),{CredentialsProviderError:y1,externalDataInterceptor:C1}=(te(),v(nt)),{readFileSync:_1}=oe("node:fs"),HR=t=>async e=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:r,roleSessionName:o,webIdentityToken:n,providerId:s,policyArns:i,policy:a,durationSeconds:c}=t,{roleAssumerWithWebIdentity:d}=t;if(!d){let{getDefaultRoleAssumerWithWebIdentity:u}=(Ap(),v(Tp));d=u({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...e?.callerClientConfig,...t.parentClientConfig}},t.clientPlugins)}return d({RoleArn:r,RoleSessionName:o??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:n,ProviderId:s,PolicyArns:i,Policy:a,DurationSeconds:c})},FR="AWS_WEB_IDENTITY_TOKEN_FILE",T1="AWS_ROLE_ARN",A1="AWS_ROLE_SESSION_NAME",w1=(t={})=>async e=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let r=t?.webIdentityTokenFile??process.env[FR],o=t?.roleArn??process.env[T1],n=t?.roleSessionName??process.env[A1];if(!r||!o)throw new y1("Web identity configuration not specified",{logger:t.logger});let s=await HR({...t,webIdentityToken:C1?.getTokenRecord?.()[r]??_1(r,{encoding:"ascii"}),roleArn:o,roleSessionName:n})(e);return r===process.env[FR]&&E1(s,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h"),s};Wp.fromTokenFile=w1;Wp.fromWebToken=HR});var XR=se(KR=>{var{CredentialsProviderError:Ud,chain:R1,getProfileName:WR,parseKnownFiles:x1}=(te(),v(nt)),{setCredentialFeature:Ir}=(Z(),v(kt)),I1=(t,e,r)=>{let o={EcsContainer:async n=>{let{fromHttp:s}=cm(),{fromContainerMetadata:i}=wc();return r?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>R1(s(n??{}),i(n))().then(Kp)},Ec2InstanceMetadata:async n=>{r?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");let{fromInstanceMetadata:s}=wc();return async()=>s(n)().then(Kp)},Environment:async n=>{r?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");let{fromEnv:s}=Kf();return async()=>s(n)().then(Kp)}};if(t in o)return o[t];throw new Ud(`Unsupported credential source in profile ${e}. Got ${t}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:r})},Kp=t=>Ir(t,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p"),v1=(t,{profile:e="default",logger:r}={})=>!!t&&typeof t=="object"&&typeof t.role_arn=="string"&&["undefined","string"].indexOf(typeof t.role_session_name)>-1&&["undefined","string"].indexOf(typeof t.external_id)>-1&&["undefined","string"].indexOf(typeof t.mfa_serial)>-1&&(k1(t,{profile:e,logger:r})||P1(t,{profile:e,logger:r})),k1=(t,{profile:e,logger:r})=>{let o=typeof t.source_profile=="string"&&typeof t.credential_source>"u";return o&&r?.debug?.(` ${e} isAssumeRoleWithSourceProfile source_profile=${t.source_profile}`),o},P1=(t,{profile:e,logger:r})=>{let o=typeof t.credential_source=="string"&&typeof t.source_profile>"u";return o&&r?.debug?.(` ${e} isCredentialSourceProfile credential_source=${t.credential_source}`),o},b1=async(t,e,r,o,n={},s)=>{r.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");let i=e[t],{source_profile:a,region:c}=i;if(!r.roleAssumer){let{getDefaultRoleAssumer:u}=(Ap(),v(Tp));r.roleAssumer=u({...r.clientConfig,credentialProviderLogger:r.logger,parentClientConfig:{...o,...r?.parentClientConfig,region:c??r?.parentClientConfig?.region??o?.region}},r.clientPlugins)}if(a&&a in n)throw new Ud(`Detected a cycle attempting to resolve credentials for profile ${WR(r)}. Profiles visited: `+Object.keys(n).join(", "),{logger:r.logger});r.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${a?`source_profile=[${a}]`:`profile=[${t}]`}`);let d=a?s(a,e,r,o,{...n,[a]:!0},zR(e[a]??{})):(await I1(i.credential_source,t,r.logger)(r))();if(zR(i))return d.then(u=>Ir(u,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));{let u={RoleArn:i.role_arn,RoleSessionName:i.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:i.external_id,DurationSeconds:parseInt(i.duration_seconds||"3600",10)},{mfa_serial:l}=i;if(l){if(!r.mfaCodeProvider)throw new Ud(`Profile ${t} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:r.logger,tryNextLink:!1});u.SerialNumber=l,u.TokenCode=await r.mfaCodeProvider(l)}let m=await d;return r.roleAssumer(m,u).then(g=>Ir(g,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},zR=t=>!t.role_arn&&!!t.credential_source,N1=t=>!!(t&&t.login_session),O1=async(t,e,r)=>{let{fromLoginCredentials:o}=BR(),n=await o({...e,profile:t})({callerClientConfig:r});return Ir(n,"CREDENTIALS_PROFILE_LOGIN","AC")},D1=t=>!!t&&typeof t=="object"&&typeof t.credential_process=="string",M1=async(t,e)=>{let{fromProcess:r}=Vp(),o=await r({...t,profile:e})();return Ir(o,"CREDENTIALS_PROFILE_PROCESS","v")},$1=async(t,e,r={},o)=>{let{fromSSO:n}=rp();return n({profile:t,logger:r.logger,parentClientConfig:r.parentClientConfig,clientConfig:r.clientConfig})({callerClientConfig:o}).then(s=>e.sso_session?Ir(s,"CREDENTIALS_PROFILE_SSO","r"):Ir(s,"CREDENTIALS_PROFILE_SSO_LEGACY","t"))},L1=t=>t&&(typeof t.sso_start_url=="string"||typeof t.sso_account_id=="string"||typeof t.sso_session=="string"||typeof t.sso_region=="string"||typeof t.sso_role_name=="string"),qR=t=>!!t&&typeof t=="object"&&typeof t.aws_access_key_id=="string"&&typeof t.aws_secret_access_key=="string"&&["undefined","string"].indexOf(typeof t.aws_session_token)>-1&&["undefined","string"].indexOf(typeof t.aws_account_id)>-1,VR=async(t,e)=>{e?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");let r={accessKeyId:t.aws_access_key_id,secretAccessKey:t.aws_secret_access_key,sessionToken:t.aws_session_token,...t.aws_credential_scope&&{credentialScope:t.aws_credential_scope},...t.aws_account_id&&{accountId:t.aws_account_id}};return Ir(r,"CREDENTIALS_PROFILE","n")},U1=t=>!!t&&typeof t=="object"&&typeof t.web_identity_token_file=="string"&&typeof t.role_arn=="string"&&["undefined","string"].indexOf(typeof t.role_session_name)>-1,B1=async(t,e,r)=>{let{fromTokenFile:o}=jp(),n=await o({webIdentityTokenFile:t.web_identity_token_file,roleArn:t.role_arn,roleSessionName:t.role_session_name,roleAssumerWithWebIdentity:e.roleAssumerWithWebIdentity,logger:e.logger,parentClientConfig:e.parentClientConfig})({callerClientConfig:r});return Ir(n,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")},jR=async(t,e,r,o,n={},s=!1)=>{let i=e[t];if(Object.keys(n).length>0&&qR(i))return VR(i,r);if(s||v1(i,{profile:t,logger:r.logger}))return b1(t,e,r,o,n,jR);if(qR(i))return VR(i,r);if(U1(i))return B1(i,r,o);if(D1(i))return M1(r,t);if(L1(i))return await $1(t,i,r,o);if(N1(i))return O1(t,r,o);throw new Ud(`Could not resolve credentials using profile: [${t}] in configuration/credentials file(s).`,{logger:r.logger})},G1=(t={})=>async({callerClientConfig:e}={})=>{t.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");let r=await x1(t);return jR(WR({profile:t.profile??e?.profile}),r,t,e)};KR.fromIni=G1});var ZR=se(Gd=>{var{ENV_KEY:F1,ENV_SECRET:H1,fromEnv:z1}=Kf(),{chain:q1,CredentialsProviderError:Bd,ENV_PROFILE:V1}=(te(),v(nt)),YR="AWS_EC2_METADATA_DISABLED",W1=async t=>{let{ENV_CMDS_FULL_URI:e,ENV_CMDS_RELATIVE_URI:r,fromContainerMetadata:o,fromInstanceMetadata:n}=wc();if(process.env[r]||process.env[e]){t.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:s}=cm();return q1(s(t),o(t))}return process.env[YR]&&process.env[YR]!=="false"?async()=>{throw new Bd("EC2 Instance Metadata Service access disabled",{logger:t.logger})}:(t.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),n(t))};function j1(t,e){let r=K1(t),o,n,s,i,a=async c=>{if(c?.forceRefresh)return i||(i=r(c).then(d=>{s=d}).finally(()=>{i=void 0})),await i,s;if(s?.expiration&&s?.expiration?.getTime()<Date.now()&&(s=void 0),o)await o;else if(!s||e?.(s))if(s)n||(n=r(c).then(d=>{s=d}).catch(()=>{}).finally(()=>{n=void 0}));else return o=r(c).then(d=>{s=d}).finally(()=>{o=void 0}),a(c);return s};return a}var K1=t=>async e=>{let r;for(let o of t)try{return await o(e)}catch(n){if(r=n,n?.tryNextLink)continue;throw n}throw r},QR=!1,X1=(t={})=>j1([async()=>{if(t.profile??process.env[V1])throw process.env[F1]&&process.env[H1]&&(QR||((t.logger?.warn&&t.logger?.constructor?.name!=="NoOpLogger"?t.logger.warn.bind(t.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
39
+ Multiple credential sources detected:
40
+ Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
41
+ This SDK will proceed with the AWS_PROFILE value.
42
+
43
+ However, a future version may change this behavior to prefer the ENV static credentials.
44
+ Please ensure that your environment only sets either the AWS_PROFILE or the
45
+ AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
46
+ `),QR=!0)),new Bd("AWS_PROFILE is set, skipping fromEnv provider.",{logger:t.logger,tryNextLink:!0});return t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),z1(t)()},async e=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:r,ssoAccountId:o,ssoRegion:n,ssoRoleName:s,ssoSession:i}=t;if(!r&&!o&&!n&&!s&&!i)throw new Bd("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:t.logger});let{fromSSO:a}=rp();return a(t)(e)},async e=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:r}=XR();return r(t)(e)},async e=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:r}=Vp();return r(t)(e)},async e=>{t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:r}=jp();return r(t)(e)},async()=>(t.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await W1(t))()),async()=>{throw new Bd("Could not load credentials from any providers",{tryNextLink:!1,logger:t.logger})}],JR),Y1=t=>t?.expiration!==void 0,JR=t=>t?.expiration!==void 0&&t.expiration.getTime()-Date.now()<3e5;Gd.credentialsTreatedAsExpired=JR;Gd.credentialsWillNeedRefresh=Y1;Gd.defaultProvider=X1});var tx=se(ex=>{var{EventStreamCodec:Q1}=(sl(),v(nl)),{Transform:J1,Readable:Z1,PassThrough:eL,pipeline:tL}=oe("node:stream"),Xp=class extends J1{priorSignature;messageSigner;eventStreamCodec;systemClockOffsetProvider;staticCredentials;constructor(e){super({autoDestroy:!0,readableObjectMode:!0,writableObjectMode:!0,...e}),this.priorSignature=e.priorSignature,this.eventStreamCodec=e.eventStreamCodec,this.messageSigner=e.messageSigner,this.systemClockOffsetProvider=e.systemClockOffsetProvider,this.staticCredentials=e.credentials?.()}async _transform(e,r,o){try{let n=new Date(Date.now()+await this.systemClockOffsetProvider()),s={":date":{type:"timestamp",value:n}},i=await this.messageSigner.sign({message:{body:e,headers:s},priorSignature:this.priorSignature},{signingDate:n,eventStreamCredentials:await this.staticCredentials});this.priorSignature=i.signature;let a=this.eventStreamCodec.encode({headers:{...s,":chunk-signature":{type:"binary",value:rL(i.signature)}},body:e});return this.push(a),o()}catch(n){o(n)}}};function rL(t){let e=Buffer.from(t,"hex");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)}var Yp=class{messageSigner;eventStreamCodec;systemClockOffsetProvider;credentials;constructor(e){this.messageSigner=e.messageSigner,this.eventStreamCodec=new Q1(e.utf8Encoder,e.utf8Decoder),this.systemClockOffsetProvider=async()=>e.systemClockOffset??0,this.credentials=e.credentials}async handle(e,r,o={}){let n=r.request,{body:s,query:i}=n;if(!(s instanceof Z1))throw new Error("Eventstream payload must be a Readable stream.");n.body=new eL({objectMode:!0});let c=n.headers?.authorization?.match(/Signature=([\w]+)$/)?.[1]??i?.["X-Amz-Signature"]??"";o.__staticSignature&&(c="");let d=new Xp({priorSignature:c,eventStreamCodec:this.eventStreamCodec,messageSigner:await this.messageSigner(),systemClockOffsetProvider:this.systemClockOffsetProvider,credentials:this.credentials}),u,l=new Promise((g,S)=>{u=()=>g(void 0),tL(s,d,n.body,E=>{E&&S(new Error(`Pipeline error in @aws-sdk/eventstream-handler-node: ${E.message}`,{cause:E}))})}),m;try{m=await Promise.race([e(r),l])}catch(g){throw n.body.end(),g}finally{u()}return m}},oL=t=>new Yp(t);ex.eventStreamPayloadHandlerProvider=oL});var sx=se(ki=>{var{setTokenFeature:nL}=(Z(),v(kt)),{getBearerTokenEnvKey:sL}=(De(),v(Tc)),{TokenProviderError:Ut,getSSOTokenFilepath:iL,parseKnownFiles:aL,getProfileName:cL,loadSsoSessionData:dL,getSSOTokenFromFile:uL,memoize:lL,chain:fL}=(te(),v(nt)),{promises:mL}=oe("node:fs"),pL=({logger:t,signingName:e}={})=>async()=>{if(t?.debug?.("@aws-sdk/token-providers - fromEnvSigningName"),!e)throw new Ut("Please pass 'signingName' to compute environment variable key",{logger:t});let r=sL(e);if(!(r in process.env))throw new Ut(`Token not present in '${r}' environment variable`,{logger:t});let o={token:process.env[r]};return nL(o,"BEARER_SERVICE_ENV_VARS","3"),o},hL=300*1e3,Qp="To refresh this SSO session run 'aws sso login' with the corresponding profile.",gL=async(t,e={},r)=>{let{SSOOIDCClient:o}=(Js(),v(Qs)),n=i=>e.clientConfig?.[i]??e.parentClientConfig?.[i]??r?.[i];return new o(Object.assign({},e.clientConfig??{},{region:t??e.clientConfig?.region,logger:n("logger"),userAgentAppId:n("userAgentAppId")}))},SL=async(t,e,r={},o)=>{let{CreateTokenCommand:n}=(Js(),v(Qs));return(await gL(e,r,o)).send(new n({clientId:t.clientId,clientSecret:t.clientSecret,refreshToken:t.refreshToken,grantType:"refresh_token"}))},rx=t=>{if(t.expiration&&t.expiration.getTime()<Date.now())throw new Ut(`Token is expired. ${Qp}`,!1)},Ko=(t,e,r=!1)=>{if(typeof e>"u")throw new Ut(`Value not present for '${t}' in SSO Token${r?". Cannot refresh":""}. ${Qp}`,!1)},{writeFile:EL}=mL,yL=(t,e)=>{let r=iL(t),o=JSON.stringify(e,null,2);return EL(r,o)},ox=new Map,nx=(t={})=>async({callerClientConfig:e}={})=>{t.logger?.debug("@aws-sdk/token-providers - fromSso");let r=await aL(t),o=cL({profile:t.profile??e?.profile}),n=r[o];if(n){if(!n.sso_session)throw new Ut(`Profile '${o}' is missing required property 'sso_session'.`)}else throw new Ut(`Profile '${o}' could not be found in shared credentials file.`,!1);let s=n.sso_session,a=(await dL(t))[s];if(!a)throw new Ut(`Sso session '${s}' could not be found in shared credentials file.`,!1);for(let S of["sso_start_url","sso_region"])if(!a[S])throw new Ut(`Sso session '${s}' is missing required property '${S}'.`,!1);a.sso_start_url;let c=a.sso_region,d;try{d=await uL(s)}catch{throw new Ut(`The SSO session token associated with profile=${o} was not found or is invalid. ${Qp}`,!1)}Ko("accessToken",d.accessToken),Ko("expiresAt",d.expiresAt);let{accessToken:u,expiresAt:l}=d,m={token:u,expiration:new Date(l)};if(m.expiration.getTime()-Date.now()>hL)return m;let g=ox.get(s)??0;if(Date.now()-g<30*1e3)return rx(m),m;Ko("clientId",d.clientId,!0),Ko("clientSecret",d.clientSecret,!0),Ko("refreshToken",d.refreshToken,!0);try{ox.set(s,Date.now());let S=await SL(d,c,t,e);Ko("accessToken",S.accessToken),Ko("expiresIn",S.expiresIn);let E=new Date(Date.now()+S.expiresIn*1e3);try{await yL(s,{...d,accessToken:S.accessToken,expiresAt:E.toISOString(),refreshToken:S.refreshToken})}catch{}return{token:S.accessToken,expiration:E}}catch{return rx(m),m}},CL=({token:t,logger:e})=>async()=>{if(e?.debug("@aws-sdk/token-providers - fromStatic"),!t||!t.token)throw new Ut("Please pass a valid token to fromStatic",!1);return t},_L=(t={})=>lL(fL(nx(t),async()=>{throw new Ut("Could not load token from any providers",!1)}),e=>e.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5,e=>e.expiration!==void 0);ki.fromEnvSigningName=pL;ki.fromSso=nx;ki.fromStatic=CL;ki.nodeProvider=_L});var gx=se(bi=>{var{hasOwn:lx}=(D(),v(_t)),{streamCollector:TL}=(D(),v(_t));bi.streamCollector=TL;var{buildQueryString:fx,HttpResponse:mx}=(P(),v(at)),Fd=oe("node:https"),{Readable:AL}=oe("node:stream"),Jp=oe("node:http2");function zd(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let o=new Error(String(e));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var wL=["ECONNRESET","EPIPE","ETIMEDOUT"],px=t=>{let e={};for(let r in t){if(!lx(t,r))continue;let o=t[r];e[r]=Array.isArray(o)?o.join(","):o}return e},be={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},ix=1e3,RL=(t,e,r=0)=>{if(!r)return-1;let o=n=>{let s=be.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{be.clearTimeout(s)}):be.clearTimeout(s)};t.socket?i(t.socket):t.on("socket",i)};return r<2e3?(o(0),0):be.setTimeout(o.bind(null,ix),ix)},xL=(t,e,r=0,o,n)=>r?be.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1,IL=3e3,vL=(t,{keepAlive:e,keepAliveMsecs:r},o=IL)=>{if(e!==!0)return-1;let n=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",s=>{s.setKeepAlive(e,r||0)})};return o===0?(n(),0):be.setTimeout(n,o)},ax=3e3,kL=(t,e,r=0)=>{let o=n=>{let s=r-n,i=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(s,i),t.on("close",()=>t.socket?.removeListener("timeout",i))):t.setTimeout(s,i)};return 0<r&&r<6e3?(o(0),0):be.setTimeout(o.bind(null,r===0?0:ax),ax)},cx=6e3;async function hx(t,e,r=cx,o=!1){let n=e.headers,s=n?n.Expect||n.expect:void 0,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(be.setTimeout(()=>c(!0),Math.max(cx,r)))}),new Promise(c=>{t.on("continue",()=>{be.clearTimeout(i),c(!0)}),t.on("response",()=>{be.clearTimeout(i),c(!1)}),t.on("error",()=>{be.clearTimeout(i),c(!1)})})])),a&&PL(t,e.body)}function PL(t,e){if(e instanceof AL){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){t.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}t.end(Buffer.from(e));return}t.end()}var bL=0,Hd,dx,Zp=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){if(!lx(n,c))continue;let d=n[c]?.length??0,u=s[c]?.length??0;if(d>=i&&u>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${d} and ${u} additional requests are enqueued.
47
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
48
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=n.logger,i=e.protocol==="https:";return!i&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((a,c)=>{let d,u=-1,l=-1,m=-1,g=-1,S=-1,E=()=>{be.clearTimeout(u),be.clearTimeout(l),be.clearTimeout(m),be.clearTimeout(g),be.clearTimeout(S)},C=async _=>{await d,E(),a(_)},y=async _=>{await d,E(),c(_)};if(r?.aborted){let _=zd(r);y(_);return}let T=e.headers,w=T?(T.Expect??T.expect)==="100-continue":!1,I=i?n.httpsAgent:n.httpAgent;w&&!this.externalAgent&&(I=new(i?Fd.Agent:Hd)({keepAlive:!1,maxSockets:1/0})),u=be.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(I,this.socketWarningTimestamp,s)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let b=e.query?fx(e.query):"",F;if(e.username!=null||e.password!=null){let _=e.username??"",A=e.password??"";F=`${_}:${A}`}let B=e.path;b&&(B+=`?${b}`),e.fragment&&(B+=`#${e.fragment}`);let O=e.hostname??"";O[0]==="["&&O.endsWith("]")?O=e.hostname.slice(1,-1):O=e.hostname;let Q={headers:e.headers,host:O,method:e.method,path:B,port:e.port,agent:I,auth:F},$=(i?Fd.request:dx)(Q,_=>{let A=new mx({statusCode:_.statusCode||-1,reason:_.statusMessage,headers:px(_.headers),body:_});C({response:A})});if($.on("error",_=>{wL.includes(_.code)?y(Object.assign(_,{name:"TimeoutError"})):y(_)}),r){let _=()=>{$.destroy();let A=zd(r);y(A)};if(typeof r.addEventListener=="function"){let A=r;A.addEventListener("abort",_,{once:!0}),$.once("close",()=>A.removeEventListener("abort",_))}else r.onabort=_}let z=o??n.requestTimeout;l=RL($,y,n.connectionTimeout),m=xL($,y,z,n.throwOnRequestTimeout,s??console),g=kL($,y,n.socketTimeout);let R=Q.agent;typeof R=="object"&&"keepAlive"in R&&(S=vL($,{keepAlive:R.keepAlive,keepAliveMsecs:R.keepAliveMsecs})),d=hx($,e,z,this.externalAgent).catch(_=>(E(),c(_)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>e===Symbol.for("logger")?{...o,logger:o.logger??r}:{...o,[e]:r})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:d}=e||{},u=!0,l=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let m=oe("node:http"),{Agent:g,request:S}=m.default??m;return dx=S,Hd=g,i instanceof Hd||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new Hd({keepAlive:u,maxSockets:l,...i})},httpsAgent:a instanceof Fd.Agent||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new Fd.Agent({keepAlive:u,maxSockets:l,...a}),logger:d}}},NL=new Uint16Array(1),Pi=class{id=NL[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(!this.session.destroyed&&(this.refs-=1,this.refs===0&&this.session.unref(),this.refs<0))throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){this.session.closed||this.session.close()}destroy(){this.refs=0,this.session.destroyed||(this.session.setTimeout(0),this.session.destroy())}useCount(){return this.refs}},eh=class{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map(r=>new Pi(r))}poll(){let e=!1;for(let r of this.sessions){if(r.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||r.useCount()<this.maxConcurrency)return r}if(e)for(let r of this.sessions)r.deref().destroyed&&this.remove(r)}offerLast(e){this.sessions.push(e)}remove(e){let r=this.sessions.indexOf(e);r>-1&&this.sessions.splice(r,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}},th=class{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}lease(e,r){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!r.isEventStream){let d=n.poll();if(d)return d.retain(),d}let s=new Pi(this.connect(o)),i=s.deref();this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},d=>{if(d)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(o,s)},c=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};return i.on("goaway",a),i.on("error",c),i.on("frameError",c),i.on("close",c),r.requestTimeout&&i.setTimeout(r.requestTimeout,c),n.offerLast(s),s.retain(),s}release(e,r){r.free()}createIsolatedSession(e,r){let o=this.getUrlString(e),n=new Pi(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};s.on("error",i),s.on("frameError",i),s.on("close",i);let a=r.requestTimeout??3e5;return s.setTimeout(a,i),n.retain(),n}destroy(){for(let[e,r]of this.connectionPools){for(let o of[...r])o.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let r of this.connectionPools.values())r.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[r,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[r]={sessions:n}}return e}removeFromPoolAndClose(e,r){this.connectionPools.get(e)?.remove(r),r.close()}removeFromPoolAndCheckedDestroy(e,r){this.connectionPools.get(e)?.remove(r),r.destroy()}getPool(e){if(!this.connectionPools.has(e)){let r=new eh;this.config.maxConcurrency&&r.setMaxConcurrency(this.config.maxConcurrency),this.connectionPools.set(e,r)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?Jp.connect(e):Jp.connect(e,this.connectOptions)}},{constants:ux}=Jp,rh=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new th({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(n||{})}).catch(o):r(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:r,requestTimeout:o,isEventStream:n}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:d,maxConcurrentStreams:u,nodeHttp2ConnectOptions:l}=this.config;this.connectionManager.setDisableConcurrentStreams(d??!1),u&&this.connectionManager.setMaxConcurrentStreams(u),l&&this.connectionManager.setNodeHttp2ConnectOptions(l)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,a=i||n,c=o??s;return new Promise((d,u)=>{let l=!1,m,g=async _=>{await m,d(_)},S=async _=>{await m,u(_)};if(r?.aborted){l=!0;let _=zd(r);S(_);return}let{hostname:E,method:C,port:y,protocol:T,query:w}=e,I="";if(e.username!=null||e.password!=null){let _=e.username??"",A=e.password??"";I=`${_}:${A}@`}let b=`${T}//${I}${E}${y?`:${y}`:""}`,F={destination:new URL(b)},B={requestTimeout:this.config?.sessionTimeout,isEventStream:n},O=a?this.connectionManager.createIsolatedSession(F,B):this.connectionManager.lease(F,B),Q=O.deref(),J=_=>{a&&O.destroy(),l=!0,S(_)},$=w?fx(w):"",z=e.path;$&&(z+=`?${$}`),e.fragment&&(z+=`#${e.fragment}`);let R=Q.request({...e.headers,[ux.HTTP2_HEADER_PATH]:z,[ux.HTTP2_HEADER_METHOD]:C});if(c&&R.setTimeout(c,()=>{R.close();let _=new Error(`Stream timed out because of no activity for ${c} ms`);_.name="TimeoutError",J(_)}),r){let _=()=>{R.close();let A=zd(r);J(A)};if(typeof r.addEventListener=="function"){let A=r;A.addEventListener("abort",_,{once:!0}),R.once("close",()=>A.removeEventListener("abort",_))}else r.onabort=_}R.on("frameError",(_,A,U)=>{J(new Error(`Frame type id ${_} in stream id ${U} has failed with code ${A}.`))}),R.on("error",J),R.on("aborted",()=>{J(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${R.rstCode}.`))}),R.on("response",_=>{let A=new mx({statusCode:_[":status"]??-1,headers:px(_),body:R});l=!0,g({response:A}),a&&(Q.close(),R.on("end",()=>{O.destroy()}))}),R.on("close",()=>{if(a?O.destroy():this.connectionManager.release(F,O),!l){let _=new Error("Unexpected error: http2 request did not get a response");Q.destroyed&&(_.name="TimeoutError"),J(_)}}),m=hx(R,e,c)})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}};bi.DEFAULT_REQUEST_TIMEOUT=bL;bi.NodeHttp2Handler=rh;bi.NodeHttpHandler=Zp});var Yk=se(f=>{var{awsEndpointFunctions:OL,emitWarningIfUnsupportedVersion:DL,createDefaultUserAgentProvider:ML,NODE_APP_ID_CONFIG_OPTIONS:$L,getAwsRegionExtensionConfiguration:LL,resolveAwsRegionExtensionConfiguration:UL,resolveUserAgentConfig:BL,resolveHostHeaderConfig:GL,getUserAgentPlugin:FL,getHostHeaderPlugin:HL,getLoggerPlugin:zL,getRecursionDetectionPlugin:qL}=(Z(),v(kt)),{resolveEventStreamConfig:VL,getEventStreamPlugin:WL}=ty(),{resolveWebSocketConfig:jL,getWebSocketPlugin:KL}=yy(),{memoizeIdentityProvider:XL,isIdentityExpired:YL,doesIdentityRequireRefresh:QL,HttpBearerAuthSigner:Px,getHttpAuthSchemeEndpointRuleSetPlugin:JL,DefaultIdentityProviderConfig:ZL,getHttpSigningPlugin:eU,createPaginator:tU}=(ze(),v(hE)),{normalizeProvider:bx,getSmithyContext:rU,ServiceException:oU,NoOpLogger:nU,emitWarningIfUnsupportedVersion:sU,loadConfigsForDefaultMode:iU,getDefaultExtensionConfiguration:aU,resolveDefaultRuntimeConfig:cU,Client:Nx,makeBuilder:dU,createAggregatedClient:uU}=(M(),v(Yu)),{Command:lU}=(M(),v(Yu));f.$Command=lU;f.__Client=Nx;var{resolveDefaultsModeConfig:fU,loadConfig:Xo,NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS:mU,NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS:pU,NODE_REGION_CONFIG_OPTIONS:hU,NODE_REGION_CONFIG_FILE_OPTIONS:gU,resolveRegionConfig:SU}=(te(),v(nt)),{BinaryDecisionDiagram:EU,EndpointCache:yU,decideEndpoint:CU,customEndpointFunctions:_U,resolveEndpointConfig:TU,getEndpointPlugin:AU}=(ae(),v(xP)),{eventStreamSerdeProvider:wU,resolveEventStreamSerdeConfig:RU}=(sl(),v(nl)),{parseUrl:xU,getHttpHandlerExtensionConfiguration:IU,resolveHttpHandlerRuntimeConfig:vU,getContentLengthPlugin:kU}=(P(),v(at)),{DEFAULT_RETRY_MODE:PU,NODE_RETRY_MODE_CONFIG_OPTIONS:bU,NODE_MAX_ATTEMPT_CONFIG_OPTIONS:NU,resolveRetryConfig:OU,getRetryPlugin:DU}=(dt(),v(FS)),{TypeRegistry:Ox,getSchemaSerdePlugin:MU}=(W(),v(RP)),{resolveAwsSdkSigV4Config:$U,AwsSdkSigV4Signer:Dx,NODE_AUTH_SCHEME_PREFERENCE_OPTIONS:LU}=(De(),v(Tc)),{defaultProvider:UU}=ZR(),{eventStreamPayloadHandlerProvider:BU}=tx(),{fromEnvSigningName:GU,nodeProvider:FU}=sx(),{toUtf8:HU,fromUtf8:zU,toBase64:qU,fromBase64:VU,calculateBodyLength:WU}=(D(),v(_t)),{streamCollector:jU,NodeHttp2Handler:KU}=gx(),{AwsRestJsonProtocol:XU}=(Hn(),v(w_)),{Sha256:YU}=(rs(),v(IP)),QU=async(t,e,r)=>({operation:rU(e).operation,region:await bx(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function JU(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function ZU(t){return{schemeId:"smithy.api#httpBearerAuth",propertiesExtractor:({profile:e,filepath:r,configFilepath:o,ignoreCache:n},s)=>({identityProperties:{profile:e,filepath:r,configFilepath:o,ignoreCache:n}})}}var eB=t=>{let e=[];switch(t.operation){default:e.push(JU(t)),e.push(ZU())}return e},tB=t=>{let e=XL(t.token,YL,QL),r=$U(t);return Object.assign(r,{authSchemePreference:bx(t.authSchemePreference??[]),token:e})},rB=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"bedrock"}),oB={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},nB="3.1126.0",sB={version:nB},Oi="ref",Yo=-1,qd=!0,Sx="isSet",Mx="PartitionResult",Vd="booleanEquals",Ex="getAttr",yx={[Oi]:"Endpoint"},Cx={[Oi]:Mx},Ni={},_x=[{[Oi]:"Region"}],Tx={conditions:[[Sx,[yx]],[Sx,_x],["aws.partition",_x,Mx],[Vd,[{[Oi]:"UseFIPS"},qd]],[Vd,[{[Oi]:"UseDualStack"},qd]],[Vd,[{fn:Ex,argv:[Cx,"supportsDualStack"]},qd]],[Vd,[{fn:Ex,argv:[Cx,"supportsFIPS"]},qd]]],results:[[Yo],[Yo,"Invalid Configuration: FIPS and custom endpoint are not supported"],[Yo,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[yx,Ni],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ni],[Yo,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",Ni],[Yo,"FIPS is enabled but this partition does not support FIPS"],["https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",Ni],[Yo,"DualStack is enabled but this partition does not support DualStack"],["https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",Ni],[Yo,"Invalid Configuration: Missing Region"]]},iB=2,Ze=1e8,aB=new Int32Array([-1,1,-1,0,12,3,1,4,Ze+11,2,5,Ze+11,3,8,6,4,7,Ze+10,5,Ze+8,Ze+9,4,10,9,6,Ze+6,Ze+7,5,11,Ze+5,6,Ze+4,Ze+5,3,Ze+1,13,4,Ze+2,Ze+3]),cB=EU.from(aB,iB,Tx.conditions,Tx.results),dB=new yU({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),uB=(t,e={})=>dB.get(t,()=>CU(cB,{endpointParams:t,logger:e.logger}));_U.aws=OL;var Le=class t extends oU{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}},Wd=class t extends Le{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},jd=class t extends Le{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,t.prototype)}},Kd=class t extends Le{name="ThrottlingException";$fault="client";constructor(e){super({name:"ThrottlingException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Xd=class t extends Le{name="ValidationException";$fault="client";constructor(e){super({name:"ValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Yd=class t extends Le{name="ConflictException";$fault="client";constructor(e){super({name:"ConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Qd=class t extends Le{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Jd=class t extends Le{name="ServiceQuotaExceededException";$fault="client";constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},Zd=class t extends Le{name="ServiceUnavailableException";$fault="server";constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e}),Object.setPrototypeOf(this,t.prototype)}},eu=class t extends Le{name="ModelErrorException";$fault="client";originalStatusCode;resourceName;constructor(e){super({name:"ModelErrorException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.originalStatusCode=e.originalStatusCode,this.resourceName=e.resourceName}},tu=class t extends Le{name="ModelNotReadyException";$fault="client";$retryable={};constructor(e){super({name:"ModelNotReadyException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},ru=class t extends Le{name="ModelTimeoutException";$fault="client";constructor(e){super({name:"ModelTimeoutException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype)}},ou=class t extends Le{name="ModelStreamErrorException";$fault="client";originalStatusCode;originalMessage;constructor(e){super({name:"ModelStreamErrorException",$fault:"client",...e}),Object.setPrototypeOf(this,t.prototype),this.originalStatusCode=e.originalStatusCode,this.originalMessage=e.originalMessage}},lB="Accept",fB="AudioBlock",mB="AccessDeniedException",pB="ApplyGuardrail",hB="AppliedGuardrailDetails",gB="ApplyGuardrailRequest",SB="ApplyGuardrailResponse",EB="AsyncInvokeMessage",yB="AsyncInvokeOutputDataConfig",CB="AsyncInvokeSummary",_B="AsyncInvokeS3OutputDataConfig",TB="AsyncInvokeSummaries",AB="AudioSource",wB="AnyToolChoice",RB="AutoToolChoice",xB="Body",IB="BidirectionalInputPayloadPart",vB="BidirectionalOutputPayloadPart",kB="Citation",PB="ContentBlocks",bB="ContentBlockDelta",NB="ContentBlockDeltaEvent",OB="ContentBlockStart",DB="ContentBlockStartEvent",MB="ContentBlockStopEvent",$B="ContentBlock",LB="CitationsConfig",UB="CitationsContentBlock",BB="CacheDetail",GB="CacheDetailsList",FB="CitationsDelta",HB="ConflictException",zB="CitationGeneratedContent",qB="CitationGeneratedContentList",VB="CitationLocation",WB="ConverseMetrics",jB="ConverseOutput",KB="CachePointBlock",XB="ConverseRequest",YB="ConverseResponse",QB="ConverseStream",JB="CitationSourceContent",ZB="CitationSourceContentDelta",eG="CitationSourceContentList",tG="CitationSourceContentListDelta",rG="ConverseStreamMetrics",oG="ConverseStreamMetadataEvent",nG="ConverseStreamOutput",sG="ConverseStreamRequest",iG="ConverseStreamResponse",aG="ConverseStreamTrace",cG="ConverseTrace",dG="CountTokensInput",uG="ConverseTokensRequest",lG="CountTokensRequest",fG="CountTokensResponse",nh="Content-Type",mG="CountTokens",pG="Citations",hG="Converse",gG="DocumentBlock",SG="DocumentContentBlocks",EG="DocumentContentBlock",yG="DocumentCharLocation",CG="DocumentChunkLocation",_G="DocumentPageLocation",TG="DocumentSource",AG="ErrorBlock",wG="GuardrailAssessment",RG="GetAsyncInvoke",xG="GetAsyncInvokeRequest",IG="GetAsyncInvokeResponse",vG="GuardrailAssessmentList",kG="GuardrailAssessmentListMap",PG="GuardrailAssessmentMap",bG="GuardrailAutomatedReasoningDifferenceScenarioList",NG="GuardrailAutomatedReasoningFinding",OG="GuardrailAutomatedReasoningFindingList",DG="GuardrailAutomatedReasoningImpossibleFinding",MG="GuardrailAutomatedReasoningInvalidFinding",$G="GuardrailAutomatedReasoningInputTextReference",LG="GuardrailAutomatedReasoningInputTextReferenceList",UG="GuardrailAutomatedReasoningLogicWarning",BG="GuardrailAutomatedReasoningNoTranslationsFinding",GG="GuardrailAutomatedReasoningPolicyAssessment",FG="GuardrailAutomatedReasoningRule",HG="GuardrailAutomatedReasoningRuleList",zG="GuardrailAutomatedReasoningScenario",qG="GuardrailAutomatedReasoningSatisfiableFinding",VG="GuardrailAutomatedReasoningStatementList",WG="GuardrailAutomatedReasoningStatementLogicContent",jG="GuardrailAutomatedReasoningStatementNaturalLanguageContent",KG="GuardrailAutomatedReasoningStatement",XG="GuardrailAutomatedReasoningTranslation",YG="GuardrailAutomatedReasoningTranslationAmbiguousFinding",QG="GuardrailAutomatedReasoningTooComplexFinding",JG="GuardrailAutomatedReasoningTranslationList",ZG="GuardrailAutomatedReasoningTranslationOption",eF="GuardrailAutomatedReasoningTranslationOptionList",tF="GuardrailAutomatedReasoningValidFinding",rF="GuardrailConfiguration",oF="GuardrailContentBlock",nF="GuardrailContentBlockList",sF="GuardrailChecksConfig",iF="GuardrailChecksContentBlock",aF="GuardrailChecksContentBlockList",cF="GuardrailConverseContentBlock",dF="GuardrailChecksContentFilterConfig",uF="GuardrailChecksContentFilterCategoryConfig",lF="GuardrailChecksContentFilterCategoryConfigList",fF="GuardrailChecksContentFilterResult",mF="GuardrailChecksContentFilterResultEntry",pF="GuardrailChecksContentFilterResultList",hF="GuardrailChecksContentFilterUsage",gF="GuardrailContentFilter",SF="GuardrailContentFilterList",EF="GuardrailContextualGroundingFilter",yF="GuardrailContextualGroundingFilters",CF="GuardrailContextualGroundingPolicyAssessment",_F="GuardrailConverseImageBlock",TF="GuardrailConverseImageSource",AF="GuardrailChecksMessage",wF="GuardrailChecksMessageList",RF="GuardrailContentPolicyAssessment",xF="GuardrailChecksPromptAttackConfig",IF="GuardrailChecksPromptAttackCategoryConfig",vF="GuardrailChecksPromptAttackCategoryConfigList",kF="GuardrailChecksPromptAttackResult",PF="GuardrailChecksPromptAttackResultEntry",bF="GuardrailChecksPromptAttackResultList",NF="GuardrailChecksPromptAttackUsage",OF="GuardrailChecksResults",DF="GuardrailChecksSensitiveInformationConfig",MF="GuardrailChecksSensitiveInformationEntityConfig",$F="GuardrailChecksSensitiveInformationEntityConfigList",LF="GuardrailChecksSensitiveInformationResult",UF="GuardrailChecksSensitiveInformationResultEntry",BF="GuardrailChecksSensitiveInformationResultList",GF="GuardrailChecksSensitiveInformationUsage",FF="GuardrailConverseTextBlock",HF="GuardrailChecksTextContent",zF="GuardrailChecksUsageResults",qF="GuardrailCustomWord",VF="GuardrailCustomWordList",WF="GuardrailCoverage",jF="GuardrailImageBlock",KF="GuardrailImageCoverage",XF="GuardrailInvocationMetrics",YF="GuardrailImageSource",QF="GuardrailManagedWord",JF="GuardrailManagedWordList",ZF="GuardrailOutputContent",eH="GuardrailOutputContentList",tH="GuardrailPiiEntityFilter",rH="GuardrailPiiEntityFilterList",oH="GuardrailRegexFilter",nH="GuardrailRegexFilterList",sH="GuardrailStreamConfiguration",iH="GuardrailSensitiveInformationPolicyAssessment",aH="GuardrailTopic",cH="GuardrailTraceAssessment",dH="GuardrailTextBlock",uH="GuardrailTextCharactersCoverage",lH="GuardrailTopicList",fH="GuardrailTopicPolicyAssessment",mH="GuardrailUsage",pH="GuardrailWordPolicyAssessment",hH="ImageBlock",gH="ImageBlockDelta",SH="ImageBlockStart",EH="InferenceConfiguration",yH="InvokeGuardrailChecks",CH="InvokeGuardrailChecksRequest",_H="InvokeGuardrailChecksResponse",TH="InvokeModel",AH="InvokeModelRequest",wH="InvokeModelResponse",RH="InvokeModelTokensRequest",xH="InvokeModelWithBidirectionalStream",IH="InvokeModelWithBidirectionalStreamInput",vH="InvokeModelWithBidirectionalStreamOutput",kH="InvokeModelWithBidirectionalStreamRequest",PH="InvokeModelWithBidirectionalStreamResponse",bH="InvokeModelWithResponseStream",NH="InvokeModelWithResponseStreamRequest",OH="InvokeModelWithResponseStreamResponse",DH="ImageSource",MH="InternalServerException",$H="JsonSchemaDefinition",LH="ListAsyncInvokes",UH="ListAsyncInvokesRequest",BH="ListAsyncInvokesResponse",GH="Message",FH="ModelErrorException",HH="ModelInputPayload",zH="ModelNotReadyException",qH="MessageStartEvent",VH="ModelStreamErrorException",WH="MessageStopEvent",jH="ModelTimeoutException",KH="Messages",XH="OutputConfig",YH="OutputFormat",QH="OutputFormatStructure",JH="PartBody",ZH="PerformanceConfiguration",e2="PayloadPart",t2="PromptRouterTrace",r2="PromptVariableMap",o2="PromptVariableValues",n2="ReasoningContentBlock",s2="ReasoningContentBlockDelta",i2="RequestMetadata",a2="RequestMetadataJson",c2="ResourceNotFoundException",d2="ResponseStream",u2="ReasoningTextBlock",l2="StartAsyncInvoke",f2="StartAsyncInvokeRequest",m2="StartAsyncInvokeResponse",p2="SystemContentBlocks",h2="SystemContentBlock",g2="S3Location",S2="ServiceQuotaExceededException",E2="SearchResultBlock",y2="SearchResultContentBlock",C2="SearchResultContentBlocks",_2="SearchResultLocation",T2="ServiceTier",A2="SpecificToolChoice",w2="SystemTool",R2="ServiceUnavailableException",x2="Tag",I2="ToolAdditionBlock",v2="ToolConfiguration",k2="ToolChoice",P2="ThrottlingException",b2="ToolInputSchema",N2="TagList",O2="ToolReference",D2="ToolRemovalBlock",M2="ToolResultBlocksDelta",$2="ToolResultBlockDelta",L2="ToolResultBlockStart",U2="ToolResultBlock",B2="ToolResultContentBlocks",G2="ToolResultContentBlock",F2="ToolSpecification",H2="TokenUsage",z2="ToolUseBlock",q2="ToolUseBlockDelta",V2="ToolUseBlockStart",W2="Tools",j2="Tool",K2="VideoBlock",X2="ValidationException",Y2="VideoSource",Q2="WebLocation",J2="X-Amzn-Bedrock-Accept",Z2="X-Amzn-Bedrock-Content-Type",$x="X-Amzn-Bedrock-GuardrailIdentifier",Lx="X-Amzn-Bedrock-GuardrailVersion",hu="X-Amzn-Bedrock-PerformanceConfig-Latency",Ux="X-Amzn-Bedrock-Request-Metadata",gu="X-Amzn-Bedrock-Service-Tier",Bx="X-Amzn-Bedrock-Trace",Io="action",e4="appliedGuardrailDetails",t4="asyncInvokeSummaries",sh="additionalModelRequestFields",Gx="additionalModelResponseFieldPaths",Fx="additionalModelResponseFields",Hx="actionReason",r4="automatedReasoningPolicy",o4="automatedReasoningPolicyUnits",n4="automatedReasoningPolicies",zx="accept",s4="any",i4="assessments",a4="audio",c4="auto",vr="bytes",qx="bucketOwner",d4="beginOffset",Jo="body",Sr="client",u4="contentBlockDelta",ih="contentBlockIndex",l4="contentBlockStart",f4="contentBlockStop",m4="citationsContent",p4="cacheDetails",ah="contentFilter",h4="claimsFalseScenario",g4="contextualGroundingPolicy",S4="contextualGroundingPolicyUnits",E4="contentIndex",y4="contentPolicy",C4="contentPolicyImageUnits",_4="contentPolicyUnits",ch="cachePoint",Vx="contradictingRules",T4="cacheReadInputTokens",dh="clientRequestToken",A4="confidenceScore",Su="contentType",Wx="claimsTrueScenario",w4="customWords",R4="cacheWriteInputTokens",Eu="category",jx="categories",x4="checks",uh="chunk",lh="citations",I4="citation",Kx="claims",Zo="content",v4="context",Xx="confidence",k4="converse",P4="delta",b4="documentChar",N4="documentChunk",fh="documentIndex",O4="documentPage",D4="differenceScenarios",en="detected",Yx="description",M4="domain",Qx="document",Fe="error",$4="endOffset",Jx="endTime",L4="effort",U4="enabled",yu="end",B4="entities",tn="format",Zx="failureMessage",G4="filterStrength",F4="findings",eI="filters",tI="guardrail",H4="guardrailArn",rI="guardrailCoverage",oI="guardrailConfig",nI="guardContent",z4="guardrailId",Ui="guardrailIdentifier",q4="guardrailOrigin",V4="guardrailOwnership",W4="guardrailProcessingLatency",Xn="guardrailVersion",sI="guarded",Bt="http",gt="httpError",ue="httpHeader",Qo="httpQuery",mh="input",Cu="invocationArn",j4="inputAssessment",iI="inferenceConfig",K4="invocationMetrics",X4="invokedModelId",Y4="invokeModel",Q4="inputSchema",ph="internalServerException",hh="inputTokens",J4="identifier",Z4="images",Yn="image",ez="impossible",tz="invalid",gh="json",rz="jsonSchema",oz="key",nz="kmsKeyId",aI="location",cI="latencyMs",dI="lastModifiedTime",_u="logicWarning",sz="latency",iz="logic",je="message",uI="modelArn",rn="modelId",az="messageIndex",cz="modelInput",dz="modelOutput",Ax="maxResults",uz="messageStart",Sh="modelStreamErrorException",lz="messageStop",fz="maxTokens",lI="modelTimeoutException",mz="managedWordLists",Tu="match",Au="messages",fI="metrics",pz="metadata",Er="name",hz="naturalLanguage",oh="nextToken",gz="noTranslations",Sz="outputs",Ez="outputAssessments",mI="outputConfig",Eh="outputDataConfig",yz="originalMessage",Cz="outputScope",pI="originalStatusCode",_z="outputTokens",Tz="options",Az="output",hI="premises",yh="promptAttack",wu="performanceConfig",Ru="performanceConfigLatency",wz="piiEntities",gI="promptRouter",SI="promptVariables",Rz="policyVersionArn",EI="qualifiers",xu="results",yI="reasoningContent",CI="redactedContent",Iu="requestMetadata",xz="resourceName",Iz="reasoningText",vz="regex",kz="regexes",Ch="role",_I="smithy.ts.sdk.synthetic.com.amazonaws.bedrockruntime",wx="sortBy",TI="sourceContent",Rx="statusEquals",_h="sensitiveInformation",Pz="sensitiveInformationPolicy",bz="sensitiveInformationPolicyFreeUnits",Nz="sensitiveInformationPolicyUnits",vu="s3Location",Oz="serverName",xx="sortOrder",Dz="s3OutputDataConfig",Mz="streamProcessingMode",AI="stopReason",$z="searchResultIndex",Lz="searchResultLocation",wI="searchResult",Uz="supportingRules",RI="severityScore",Bz="stopSequences",xI="submitTime",Ix="submitTimeAfter",vx="submitTimeBefore",vo="serviceTier",Gz="systemTool",Fz="s3Uri",Th="serviceUnavailableException",Hz="satisfiable",zz="score",qz="schema",II="server",vI="signature",Gt="source",ku="status",Bi="start",Vz="statements",Wz="stream",Pu="streaming",jz="strict",Kz="structure",Ah="system",kI="ttl",Xz="toolAddition",Yz="translationAmbiguous",wh="toolConfig",Qz="textCharacters",Jz="toolChoice",Zz="tooComplex",Rh="throttlingException",e3="textFormat",t3="topicPolicy",r3="topicPolicyUnits",o3="topP",xh="toolResult",n3="toolRemoval",s3="toolSpec",i3="totalTokens",Ih="textUnits",bu="toolUseId",vh="toolUse",a3="tags",me="text",c3="temperature",d3="threshold",kh="title",PI="total",Ph="tool",u3="tools",l3="topics",Qn="trace",Nu="translation",f3="translations",m3="truncated",Ue="type",Gi="usage",p3="untranslatedClaims",h3="untranslatedPremises",g3="uri",S3="url",E3="value",bh="validationException",y3="valid",bI="video",C3="web",_3="wordPolicy",T3="wordPolicyUnits",p="com.amazonaws.bedrockruntime",NI=Ox.for(_I),OI=[-3,_I,"BedrockRuntimeServiceException",0,[],[]];NI.registerError(OI,Le);var et=Ox.for(p),DI=[-3,p,mB,{[Fe]:Sr,[gt]:403},[je],[0]];et.registerError(DI,Wd);var MI=[-3,p,HB,{[Fe]:Sr,[gt]:400},[je],[0]];et.registerError(MI,Yd);var Fi=[-3,p,MH,{[Fe]:II,[gt]:500},[je],[0]];et.registerError(Fi,jd);var $I=[-3,p,FH,{[Fe]:Sr,[gt]:424},[je,pI,xz],[0,1,0]];et.registerError($I,eu);var LI=[-3,p,zH,{[Fe]:Sr,[gt]:429},[je],[0]];et.registerError(LI,tu);var Hi=[-3,p,VH,{[Fe]:Sr,[gt]:424},[je,pI,yz],[0,1,0]];et.registerError(Hi,ou);var Ou=[-3,p,jH,{[Fe]:Sr,[gt]:408},[je],[0]];et.registerError(Ou,ru);var UI=[-3,p,c2,{[Fe]:Sr,[gt]:404},[je],[0]];et.registerError(UI,Qd);var BI=[-3,p,S2,{[Fe]:Sr,[gt]:400},[je],[0]];et.registerError(BI,Jd);var zi=[-3,p,R2,{[Fe]:II,[gt]:503},[je],[0]];et.registerError(zi,Zd);var qi=[-3,p,P2,{[Fe]:Sr,[gt]:429},[je],[0]];et.registerError(qi,Kd);var Vi=[-3,p,X2,{[Fe]:Sr,[gt]:400},[je],[0]];et.registerError(Vi,Xd);var GI=[NI,et],FI=[0,p,EB,8,0],Du=[0,p,xB,8,21],A3=[0,p,WG,8,0],HI=[0,p,jG,8,0],w3=[0,p,HF,8,0],R3=[0,p,HH,8,15],Nh=[0,p,JH,8,21],zI=[0,p,a2,8,0],qI=[3,p,wB,0,[],[]],VI=[3,p,hB,0,[z4,Xn,H4,q4,V4],[0,0,0,64,0]],WI=[3,p,gB,0,[Ui,Xn,Gt,Zo,Cz],[[0,1],[0,1],0,[()=>W3,0],0],4],jI=[3,p,SB,0,[Gi,Io,Sz,i4,Hx,rI],[()=>Uh,0,()=>Q3,[()=>sk,0],0,()=>$h],4],KI=[3,p,_B,0,[Fz,nz,qx],[0,0,0],1],XI=[3,p,CB,0,[Cu,uI,xI,Eh,dh,ku,Zx,dI,Jx],[0,0,5,()=>Uu,0,0,[()=>FI,0],5,5],4],YI=[3,p,fB,0,[tn,Gt,Fe],[0,[()=>ck,0],[()=>$u,0]],2],QI=[3,p,RB,0,[],[]],JI=[3,p,IB,8,[vr],[[()=>Nh,0]]],ZI=[3,p,vB,8,[vr],[[()=>Nh,0]]],e0=[3,p,BB,0,[kI,hh],[0,1],2],Mu=[3,p,KB,0,[Ue,kI],[0,0],1],t0=[3,p,kB,0,[kh,Gt,TI,aI],[0,0,()=>P3,()=>Qh]],Oh=[3,p,LB,0,[U4],[2],1],r0=[3,p,UB,0,[Zo,lh],[()=>v3,()=>k3]],o0=[3,p,FB,0,[kh,Gt,TI,aI],[0,0,()=>b3,()=>Qh]],n0=[3,p,ZB,0,[me],[0]],s0=[3,p,NB,0,[P4,ih],[[()=>fk,0],1],2],i0=[3,p,DB,0,[Bi,ih],[()=>mk,1],2],a0=[3,p,MB,0,[ih],[1],1],c0=[3,p,WB,0,[cI],[1],1],d0=[3,p,XB,0,[rn,Au,Ah,iI,wh,oI,sh,SI,Gx,Iu,wu,vo,mI],[[0,1],[()=>Xh,0],[()=>Yh,0],()=>Gh,()=>Lu,()=>rv,15,[()=>ik,0],64,[()=>ak,0],()=>ji,()=>Xi,[()=>Hh,0]],1],u0=[3,p,YB,0,[Az,AI,Gi,fI,Fx,Qn,wu,vo],[[()=>pk,0],0,()=>Vh,()=>c0,15,[()=>S0,0],()=>ji,()=>Xi],4],l0=[3,p,oG,0,[Gi,fI,Qn,wu,vo],[()=>Vh,()=>f0,[()=>h0,0],()=>ji,()=>Xi],2],f0=[3,p,rG,0,[cI],[1],1],m0=[3,p,sG,0,[rn,Au,Ah,iI,wh,oI,sh,SI,Gx,Iu,wu,vo,mI],[[0,1],[()=>Xh,0],[()=>Yh,0],()=>Gh,()=>Lu,()=>Ev,15,[()=>ik,0],64,[()=>ak,0],()=>ji,()=>Xi,[()=>Hh,0]],1],p0=[3,p,iG,0,[Wz],[[()=>hk,16]]],h0=[3,p,aG,0,[tI,gI],[[()=>Lh,0],()=>zh]],g0=[3,p,uG,0,[Au,Ah,wh,sh],[[()=>Xh,0],[()=>Yh,0],()=>Lu,15]],S0=[3,p,cG,0,[tI,gI],[[()=>Lh,0],()=>zh]],E0=[3,p,lG,0,[rn,mh],[[0,1],[()=>gk,0]],2],y0=[3,p,fG,0,[hh],[1],1],Dh=[3,p,gG,0,[Er,Gt,tn,v4,lh],[0,()=>Ek,0,0,()=>Oh],2],C0=[3,p,yG,0,[fh,Bi,yu],[1,1,1]],_0=[3,p,CG,0,[fh,Bi,yu],[1,1,1]],T0=[3,p,_G,0,[fh,Bi,yu],[1,1,1]],$u=[3,p,AG,8,[je],[0]],A0=[3,p,xG,0,[Cu],[[0,1]],1],w0=[3,p,IG,0,[Cu,uI,ku,xI,Eh,dh,Zx,dI,Jx],[0,0,0,5,()=>Uu,0,[()=>FI,0],5,5],5],Mh=[3,p,wG,0,[t3,y4,_3,Pz,g4,r4,K4,e4],[()=>Tv,()=>nv,()=>Av,()=>Sv,()=>iv,[()=>k0,0],()=>fv,()=>VI]],R0=[3,p,DG,0,[Nu,Vx,_u],[[()=>Jn,0],()=>Kh,[()=>Wi,0]]],x0=[3,p,$G,0,[me],[[()=>HI,0]]],I0=[3,p,MG,0,[Nu,Vx,_u],[[()=>Jn,0],()=>Kh,[()=>Wi,0]]],Wi=[3,p,UG,0,[Ue,hI,Kx],[0,[()=>Mi,0],[()=>Mi,0]]],v0=[3,p,BG,0,[],[]],k0=[3,p,GG,0,[F4],[[()=>M3,0]]],P0=[3,p,FG,0,[J4,Rz],[0,0]],b0=[3,p,qG,0,[Nu,Wx,h4,_u],[[()=>Jn,0],[()=>Di,0],[()=>Di,0],[()=>Wi,0]]],Di=[3,p,zG,0,[Vz],[[()=>Mi,0]]],N0=[3,p,KG,0,[iz,hz],[[()=>A3,0],[()=>HI,0]]],O0=[3,p,QG,0,[],[]],Jn=[3,p,XG,0,[hI,Kx,h3,p3,Xx],[[()=>Mi,0],[()=>Mi,0],[()=>kx,0],[()=>kx,0],1]],D0=[3,p,YG,0,[Tz,D4],[[()=>L3,0],[()=>D3,0]]],M0=[3,p,ZG,0,[f3],[[()=>$3,0]]],$0=[3,p,tF,0,[Nu,Wx,Uz,_u],[[()=>Jn,0],[()=>Di,0],()=>Kh,[()=>Wi,0]]],L0=[3,p,sF,0,[ah,yh,_h],[()=>B0,()=>V0,()=>Y0]],U0=[3,p,uF,0,[Eu],[0],1],B0=[3,p,dF,0,[jx],[()=>B3],1],G0=[3,p,fF,0,[xu],[()=>G3],1],F0=[3,p,mF,0,[Eu,RI],[0,1],2],H0=[3,p,hF,0,[Ih],[1],1],z0=[3,p,AF,0,[Ch,Zo],[0,[()=>U3,0]],2],q0=[3,p,IF,0,[Eu],[0],1],V0=[3,p,xF,0,[jx],[()=>H3],1],W0=[3,p,kF,0,[xu],[()=>z3],1],j0=[3,p,PF,0,[Eu,RI],[0,1],2],K0=[3,p,NF,0,[Ih],[1],1],X0=[3,p,OF,0,[ah,yh,_h],[()=>G0,()=>W0,()=>J0]],Y0=[3,p,DF,0,[B4],[()=>q3],1],Q0=[3,p,MF,0,[Ue],[0],1],J0=[3,p,LF,0,[xu,m3],[()=>V3,2],1],Z0=[3,p,UF,0,[Ue,A4,d4,$4,az,E4],[0,1,1,1,1,1],6],ev=[3,p,GF,0,[Ih],[1],1],tv=[3,p,zF,0,[ah,yh,_h],[()=>H0,()=>K0,()=>ev]],rv=[3,p,rF,0,[Ui,Xn,Qn],[0,0,0]],ov=[3,p,gF,0,[Ue,Xx,Io,G4,en],[0,0,0,0,2],3],nv=[3,p,RF,0,[eI],[()=>j3],1],sv=[3,p,EF,0,[Ue,d3,zz,Io,en],[0,1,1,0,2],4],iv=[3,p,CF,0,[eI],[()=>K3]],av=[3,p,_F,8,[tn,Gt],[0,[()=>Tk,0]],2],cv=[3,p,FF,0,[me,EI],[0,64],1],$h=[3,p,WF,0,[Qz,Z4],[()=>Cv,()=>lv]],dv=[3,p,qF,0,[Tu,Io,en],[0,0,2],2],uv=[3,p,jF,8,[tn,Gt],[0,[()=>Ak,0]],2],lv=[3,p,KF,0,[sI,PI],[1,1]],fv=[3,p,XF,0,[W4,Gi,rI],[1,()=>Uh,()=>$h]],mv=[3,p,QF,0,[Tu,Ue,Io,en],[0,0,0,2],3],pv=[3,p,ZF,0,[me],[0]],hv=[3,p,tH,0,[Tu,Ue,Io,en],[0,0,0,2],3],gv=[3,p,oH,0,[Io,Er,Tu,vz,en],[0,0,0,0,2],1],Sv=[3,p,iH,0,[wz,kz],[()=>J3,()=>Z3],2],Ev=[3,p,sH,0,[Ui,Xn,Qn,Mz],[0,0,0,0]],yv=[3,p,dH,0,[me,EI],[0,64],1],Cv=[3,p,uH,0,[sI,PI],[1,1]],_v=[3,p,aH,0,[Er,Ue,Io,en],[0,0,0,2],3],Tv=[3,p,fH,0,[l3],[()=>eq],1],Lh=[3,p,cH,0,[dz,j4,Ez,Hx],[64,[()=>aq,0],[()=>iq,0],0]],Uh=[3,p,mH,0,[r3,_4,T3,Nz,bz,S4,C4,o4,n4],[1,1,1,1,1,1,1,1,1],6],Av=[3,p,pH,0,[w4,mz],[()=>X3,()=>Y3],2],Bh=[3,p,hH,0,[tn,Gt,Fe],[0,[()=>Zh,0],[()=>$u,0]],2],wv=[3,p,gH,0,[Gt,Fe],[[()=>Zh,0],[()=>$u,0]]],Rv=[3,p,SH,0,[tn],[0],1],Gh=[3,p,EH,0,[fz,c3,o3,Bz],[1,1,1,64]],xv=[3,p,CH,0,[Au,x4],[[()=>F3,0],()=>L0],2],Iv=[3,p,_H,0,[xu,Gi],[()=>X0,()=>tv],2],vv=[3,p,AH,0,[rn,Jo,Su,zx,Qn,Ui,Xn,Ru,vo,Iu],[[0,1],[()=>Du,16],[0,{[ue]:nh}],[0,{[ue]:lB}],[0,{[ue]:Bx}],[0,{[ue]:$x}],[0,{[ue]:Lx}],[0,{[ue]:hu}],[0,{[ue]:gu}],[()=>zI,{[ue]:Ux}]],1],kv=[3,p,wH,0,[Jo,Su,Ru,vo],[[()=>Du,16],[0,{[ue]:nh}],[0,{[ue]:hu}],[0,{[ue]:gu}]],2],Pv=[3,p,RH,0,[Jo],[[()=>Du,0]],1],bv=[3,p,kH,0,[rn,Jo],[[0,1],[()=>wk,16]],2],Nv=[3,p,PH,0,[Jo],[[()=>Rk,16]],1],Ov=[3,p,NH,0,[rn,Jo,Su,zx,Qn,Ui,Xn,Ru,vo,Iu],[[0,1],[()=>Du,16],[0,{[ue]:nh}],[0,{[ue]:J2}],[0,{[ue]:Bx}],[0,{[ue]:$x}],[0,{[ue]:Lx}],[0,{[ue]:hu}],[0,{[ue]:gu}],[()=>zI,{[ue]:Ux}]],1],Dv=[3,p,OH,0,[Jo,Su,Ru,vo],[[()=>Pk,16],[0,{[ue]:Z2}],[0,{[ue]:hu}],[0,{[ue]:gu}]],2],Mv=[3,p,$H,0,[qz,Er,Yx],[0,0,0],1],$v=[3,p,UH,0,[Ix,vx,Rx,Ax,oh,wx,xx],[[5,{[Qo]:Ix}],[5,{[Qo]:vx}],[0,{[Qo]:Rx}],[1,{[Qo]:Ax}],[0,{[Qo]:oh}],[0,{[Qo]:wx}],[0,{[Qo]:xx}]]],Lv=[3,p,BH,0,[oh,t4],[0,[()=>x3,0]]],Fh=[3,p,GH,0,[Ch,Zo],[0,[()=>N3,0]],2],Uv=[3,p,qH,0,[Ch],[0],1],Bv=[3,p,WH,0,[AI,Fx],[0,15],1],Hh=[3,p,XH,0,[e3,L4],[[()=>Gv,0],0]],Gv=[3,p,YH,0,[Ue,Kz],[0,[()=>xk,0]],2],Fv=[3,p,e2,8,[vr],[[()=>Nh,0]]],ji=[3,p,ZH,0,[sz],[0]],zh=[3,p,t2,0,[X4],[0]],Hv=[3,p,u2,8,[me,vI],[0,0],1],Ki=[3,p,g2,0,[g3,qx],[0,0],1],qh=[3,p,E2,0,[Gt,kh,Zo,lh],[0,0,()=>tq,()=>Oh],3],zv=[3,p,y2,0,[me],[0],1],qv=[3,p,_2,0,[$z,Bi,yu],[1,1,1]],Xi=[3,p,T2,0,[Ue],[0],1],Vv=[3,p,A2,0,[Er],[0],1],Wv=[3,p,f2,0,[rn,cz,Eh,dh,a3],[0,[()=>R3,0],()=>Uu,[0,4],()=>rq],3],jv=[3,p,m2,0,[Cu],[0],1],Kv=[3,p,w2,0,[Er],[0],1],Xv=[3,p,x2,0,[oz,E3],[0,0],2],Vh=[3,p,H2,0,[hh,_z,i3,T4,R4,p4],[1,1,1,1,1,()=>I3],3],Yv=[3,p,I2,0,[Ph],[()=>Wh],1],Lu=[3,p,v2,0,[u3,Jz],[()=>sq,()=>Ok],1],Wh=[3,p,O2,0,[Ue,Er,Oz],[0,0,0]],Qv=[3,p,D2,0,[Ph],[()=>Wh],1],Jv=[3,p,U2,0,[bu,Zo,ku,Ue],[0,[()=>nq,0],0,0],2],Zv=[3,p,L2,0,[bu,Ue,ku],[0,0,0],1],ek=[3,p,F2,0,[Er,Q4,Yx,jz],[0,()=>Dk,0,2],2],tk=[3,p,z2,0,[bu,Er,mh,Ue],[0,0,15,0],3],rk=[3,p,q2,0,[mh],[0],1],ok=[3,p,V2,0,[bu,Er,Ue],[0,0,0],2],jh=[3,p,K2,0,[tn,Gt],[0,()=>Lk],2],nk=[3,p,Q2,0,[S3,M4],[0,0]],x3=[1,p,TB,0,[()=>XI,0]],I3=[1,p,GB,0,()=>e0],v3=[1,p,qB,0,()=>dk],k3=[1,p,pG,0,()=>t0],P3=[1,p,eG,0,()=>uk],b3=[1,p,tG,0,()=>n0],N3=[1,p,PB,0,[()=>lk,0]],O3=[1,p,SG,0,()=>Sk],sk=[1,p,vG,0,[()=>Mh,0]],D3=[1,p,bG,0,[()=>Di,0]],M3=[1,p,OG,0,[()=>yk,0]],kx=[1,p,LG,0,[()=>x0,0]],Kh=[1,p,HG,0,()=>P0],Mi=[1,p,VG,0,[()=>N0,0]],$3=[1,p,JG,0,[()=>Jn,0]],L3=[1,p,eF,0,[()=>M0,0]],U3=[1,p,aF,0,[()=>Ck,0]],B3=[1,p,lF,0,()=>U0],G3=[1,p,pF,0,()=>F0],F3=[1,p,wF,0,[()=>z0,0]],H3=[1,p,vF,0,()=>q0],z3=[1,p,bF,0,()=>j0],q3=[1,p,$F,0,()=>Q0],V3=[1,p,BF,0,()=>Z0],W3=[1,p,nF,0,[()=>_k,0]],j3=[1,p,SF,0,()=>ov],K3=[1,p,yF,0,()=>sv],X3=[1,p,VF,0,()=>dv],Y3=[1,p,JF,0,()=>mv],Q3=[1,p,eH,0,()=>pv],J3=[1,p,rH,0,()=>hv],Z3=[1,p,nH,0,()=>gv],eq=[1,p,lH,0,()=>_v],Xh=[1,p,KH,0,[()=>Fh,0]],tq=[1,p,C2,0,()=>zv],Yh=[1,p,p2,0,[()=>bk,0]],rq=[1,p,N2,0,()=>Xv],oq=[1,p,M2,0,()=>Mk],nq=[1,p,B2,0,[()=>$k,0]],sq=[1,p,W2,0,()=>Nk],iq=[2,p,kG,0,[0,0],[()=>sk,0]],aq=[2,p,PG,0,[0,0],[()=>Mh,0]],ik=[2,p,r2,8,0,()=>Ik],ak=[2,p,i2,8,0,0],Uu=[4,p,yB,0,[Dz],[()=>KI]],ck=[4,p,AB,8,[vr,vu],[21,()=>Ki]],dk=[4,p,zB,0,[me],[0]],Qh=[4,p,VB,0,[C3,b4,O4,N4,Lz],[()=>nk,()=>C0,()=>T0,()=>_0,()=>qv]],uk=[4,p,JB,0,[me],[0]],lk=[4,p,$B,0,[me,Yn,Qx,bI,a4,vh,xh,nI,ch,yI,m4,wI,Xz,n3],[0,[()=>Bh,0],()=>Dh,()=>jh,[()=>YI,0],()=>tk,[()=>Jv,0],[()=>Jh,0],()=>Mu,[()=>vk,0],()=>r0,()=>qh,()=>Yv,()=>Qv]],fk=[4,p,bB,0,[me,vh,xh,yI,I4,Yn],[0,()=>rk,()=>oq,[()=>kk,0],()=>o0,[()=>wv,0]]],mk=[4,p,OB,0,[vh,xh,Yn],[()=>ok,()=>Zv,()=>Rv]],pk=[4,p,jB,0,[je],[[()=>Fh,0]]],hk=[4,p,nG,{[Pu]:1},[uz,l4,u4,f4,lz,pz,ph,Sh,bh,Rh,Th],[()=>Uv,()=>i0,[()=>s0,0],()=>a0,()=>Bv,[()=>l0,0],[()=>Fi,0],[()=>Hi,0],[()=>Vi,0],[()=>qi,0],[()=>zi,0]]],gk=[4,p,dG,0,[Y4,k4],[[()=>Pv,0],[()=>g0,0]]],Sk=[4,p,EG,0,[me],[0]],Ek=[4,p,TG,0,[vr,vu,me,Zo],[21,()=>Ki,0,()=>O3]],yk=[4,p,NG,0,[y3,tz,Hz,ez,Yz,Zz,gz],[[()=>$0,0],[()=>I0,0],[()=>b0,0],[()=>R0,0],[()=>D0,0],()=>O0,()=>v0]],Ck=[4,p,iF,0,[me],[[()=>w3,0]]],_k=[4,p,oF,0,[me,Yn],[()=>yv,[()=>uv,0]]],Jh=[4,p,cF,0,[me,Yn],[()=>cv,[()=>av,0]]],Tk=[4,p,TF,8,[vr],[21]],Ak=[4,p,YF,8,[vr],[21]],Zh=[4,p,DH,8,[vr,vu],[21,()=>Ki]],wk=[4,p,IH,{[Pu]:1},[uh],[[()=>JI,0]]],Rk=[4,p,vH,{[Pu]:1},[uh,ph,Sh,bh,Rh,lI,Th],[[()=>ZI,0],[()=>Fi,0],[()=>Hi,0],[()=>Vi,0],[()=>qi,0],[()=>Ou,0],[()=>zi,0]]],xk=[4,p,QH,8,[rz],[()=>Mv]],Ik=[4,p,o2,0,[me],[0]],vk=[4,p,n2,8,[Iz,CI],[[()=>Hv,0],21]],kk=[4,p,s2,8,[me,CI,vI],[0,21,0]],Pk=[4,p,d2,{[Pu]:1},[uh,ph,Sh,bh,Rh,lI,Th],[[()=>Fv,0],[()=>Fi,0],[()=>Hi,0],[()=>Vi,0],[()=>qi,0],[()=>Ou,0],[()=>zi,0]]],bk=[4,p,h2,0,[me,nI,ch],[0,[()=>Jh,0],()=>Mu]],Nk=[4,p,j2,0,[s3,Gz,ch],[()=>ek,()=>Kv,()=>Mu]],Ok=[4,p,k2,0,[c4,s4,Ph],[()=>QI,()=>qI,()=>Vv]],Dk=[4,p,b2,0,[gh],[15]],Mk=[4,p,$2,0,[me,gh],[0,15]],$k=[4,p,G2,0,[gh,me,Yn,Qx,bI,wI],[15,0,[()=>Bh,0],()=>Dh,()=>jh,()=>qh]],Lk=[4,p,Y2,0,[vr,vu],[21,()=>Ki]],Uk=[9,p,pB,{[Bt]:["POST","/guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply",200]},()=>WI,()=>jI],Bk=[9,p,hG,{[Bt]:["POST","/model/{modelId}/converse",200]},()=>d0,()=>u0],Gk=[9,p,QB,{[Bt]:["POST","/model/{modelId}/converse-stream",200]},()=>m0,()=>p0],Fk=[9,p,mG,{[Bt]:["POST","/model/{modelId}/count-tokens",200]},()=>E0,()=>y0],Hk=[9,p,RG,{[Bt]:["GET","/async-invoke/{invocationArn}",200]},()=>A0,()=>w0],zk=[9,p,yH,{[Bt]:["POST","/guardrail-checks/invoke",200]},()=>xv,()=>Iv],qk=[9,p,TH,{[Bt]:["POST","/model/{modelId}/invoke",200]},()=>vv,()=>kv],Vk=[9,p,xH,{[Bt]:["POST","/model/{modelId}/invoke-with-bidirectional-stream",200]},()=>bv,()=>Nv],Wk=[9,p,bH,{[Bt]:["POST","/model/{modelId}/invoke-with-response-stream",200]},()=>Ov,()=>Dv],jk=[9,p,LH,{[Bt]:["GET","/async-invoke",200]},()=>$v,()=>Lv],Kk=[9,p,l2,{[Bt]:["POST","/async-invoke",200]},()=>Wv,()=>jv],cq=t=>({apiVersion:"2023-09-30",base64Decoder:t?.base64Decoder??VU,base64Encoder:t?.base64Encoder??qU,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??uB,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??eB,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new Dx},{schemeId:"smithy.api#httpBearerAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#httpBearerAuth"),signer:new Px}],logger:t?.logger??new nU,protocol:t?.protocol??XU,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.bedrockruntime",errorTypeRegistries:GI,version:"2023-09-30",serviceTarget:"AmazonBedrockFrontendService"},serviceId:t?.serviceId??"Bedrock Runtime",sha256:t?.sha256??YU,urlParser:t?.urlParser??xU,utf8Decoder:t?.utf8Decoder??zU,utf8Encoder:t?.utf8Encoder??HU}),dq=t=>{sU(process.version);let e=fU(t),r=()=>e().then(iU),o=cq(t);DL(process.version);let n={profile:t?.profile,logger:o.logger,signingName:"bedrock"};return{...o,...t,runtime:"node",defaultsMode:e,authSchemePreference:t?.authSchemePreference??Xo(LU,n),bodyLengthChecker:t?.bodyLengthChecker??WU,credentialDefaultProvider:t?.credentialDefaultProvider??UU,defaultUserAgentProvider:t?.defaultUserAgentProvider??ML({serviceId:o.serviceId,clientVersion:sB.version}),eventStreamPayloadHandlerProvider:t?.eventStreamPayloadHandlerProvider??BU,eventStreamSerdeProvider:t?.eventStreamSerdeProvider??wU,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:s=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Dx},{schemeId:"smithy.api#httpBearerAuth",identityProvider:s=>s.getIdentityProvider("smithy.api#httpBearerAuth")||(async i=>{try{return await GU({signingName:"bedrock"})()}catch{return await FU(i)(i)}}),signer:new Px}],maxAttempts:t?.maxAttempts??Xo(NU,t),region:t?.region??Xo(hU,{...gU,...n}),requestHandler:KU.create(t?.requestHandler??(async()=>({...await r(),disableConcurrentStreams:!0}))),retryMode:t?.retryMode??Xo({...bU,default:async()=>(await r()).retryMode||PU},t),streamCollector:t?.streamCollector??jU,useDualstackEndpoint:t?.useDualstackEndpoint??Xo(pU,n),useFipsEndpoint:t?.useFipsEndpoint??Xo(mU,n),userAgentAppId:t?.userAgentAppId??Xo($L,n)}},uq=t=>{let e=t.httpAuthSchemes,r=t.httpAuthSchemeProvider,o=t.credentials,n=t.token;return{setHttpAuthScheme(s){let i=e.findIndex(a=>a.schemeId===s.schemeId);i===-1?e.push(s):e.splice(i,1,s)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(s){r=s},httpAuthSchemeProvider(){return r},setCredentials(s){o=s},credentials(){return o},setToken(s){n=s},token(){return n}}},lq=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials(),token:t.token()}),fq=(t,e)=>{let r=Object.assign(LL(t),aU(t),IU(t),uq(t));return e.forEach(o=>o.configure(r)),Object.assign(t,UL(r),cU(r),vU(r),lq(r))},$i=class extends Nx{config;constructor(...[e]){let r=dq(e||{});super(r),this.initConfig=r;let o=rB(r),n=BL(o),s=OU(n),i=SU(s),a=GL(i),c=TU(a),d=RU(c),u=tB(d),l=VL(u),m=jL(l),g=fq(m,e?.extensions||[]);this.config=g,this.middlewareStack.use(MU(this.config)),this.middlewareStack.use(FL(this.config)),this.middlewareStack.use(DU(this.config)),this.middlewareStack.use(kU(this.config)),this.middlewareStack.use(HL(this.config)),this.middlewareStack.use(zL(this.config)),this.middlewareStack.use(qL(this.config)),this.middlewareStack.use(JL(this.config,{httpAuthSchemeParametersProvider:QU,identityProviderConfigProvider:async S=>new ZL({"aws.auth#sigv4":S.credentials,"smithy.api#httpBearerAuth":S.token})})),this.middlewareStack.use(eU(this.config))}destroy(){super.destroy()}},Ft=dU(oB,"AmazonBedrockFrontendService","BedrockRuntimeClient",AU),Ht={},yr=(t,e,r,o)=>[],mq=(t,e,r,o)=>[WL(r),KL(r,{headerPrefix:"x-amz-bedrock-"})],nu=class extends Ft(Ht,yr,"ApplyGuardrail",Uk){},su=class extends Ft(Ht,yr,"Converse",Bk){},iu=class extends Ft(Ht,yr,"ConverseStream",Gk){},au=class extends Ft(Ht,yr,"CountTokens",Fk){},cu=class extends Ft(Ht,yr,"GetAsyncInvoke",Hk){},du=class extends Ft(Ht,yr,"InvokeGuardrailChecks",zk){},uu=class extends Ft(Ht,yr,"InvokeModel",qk){},lu=class extends Ft(Ht,mq,"InvokeModelWithBidirectionalStream",Vk){},fu=class extends Ft(Ht,yr,"InvokeModelWithResponseStream",Wk){},Li=class extends Ft(Ht,yr,"ListAsyncInvokes",jk){},mu=class extends Ft(Ht,yr,"StartAsyncInvoke",Kk){},Xk=tU($i,Li,"nextToken","nextToken","maxResults"),pq={ApplyGuardrailCommand:nu,ConverseCommand:su,ConverseStreamCommand:iu,CountTokensCommand:au,GetAsyncInvokeCommand:cu,InvokeGuardrailChecksCommand:du,InvokeModelCommand:uu,InvokeModelWithBidirectionalStreamCommand:lu,InvokeModelWithResponseStreamCommand:fu,ListAsyncInvokesCommand:Li,StartAsyncInvokeCommand:mu},hq={paginateListAsyncInvokes:Xk},pu=class extends $i{};uU(pq,pu,{paginators:hq});var gq={COMPLETED:"Completed",FAILED:"Failed",IN_PROGRESS:"InProgress"},Sq={SUBMISSION_TIME:"SubmissionTime"},Eq={ASCENDING:"Ascending",DESCENDING:"Descending"},yq={JPEG:"jpeg",PNG:"png"},Cq={GROUNDING_SOURCE:"grounding_source",GUARD_CONTENT:"guard_content",QUERY:"query"},_q={FULL:"FULL",INTERVENTIONS:"INTERVENTIONS"},Tq={INPUT:"INPUT",OUTPUT:"OUTPUT"},Aq={GUARDRAIL_INTERVENED:"GUARDRAIL_INTERVENED",NONE:"NONE"},wq={ACCOUNT_ENFORCED:"ACCOUNT_ENFORCED",ORGANIZATION_ENFORCED:"ORGANIZATION_ENFORCED",REQUEST:"REQUEST"},Rq={CROSS_ACCOUNT:"CROSS_ACCOUNT",SELF:"SELF"},xq={ALWAYS_FALSE:"ALWAYS_FALSE",ALWAYS_TRUE:"ALWAYS_TRUE"},Iq={BLOCKED:"BLOCKED",NONE:"NONE"},vq={HIGH:"HIGH",LOW:"LOW",MEDIUM:"MEDIUM",NONE:"NONE"},kq={HIGH:"HIGH",LOW:"LOW",MEDIUM:"MEDIUM",NONE:"NONE"},Pq={HATE:"HATE",INSULTS:"INSULTS",MISCONDUCT:"MISCONDUCT",PROMPT_ATTACK:"PROMPT_ATTACK",SEXUAL:"SEXUAL",VIOLENCE:"VIOLENCE"},bq={BLOCKED:"BLOCKED",NONE:"NONE"},Nq={GROUNDING:"GROUNDING",RELEVANCE:"RELEVANCE"},Oq={ANONYMIZED:"ANONYMIZED",BLOCKED:"BLOCKED",NONE:"NONE"},Dq={ADDRESS:"ADDRESS",AGE:"AGE",AWS_ACCESS_KEY:"AWS_ACCESS_KEY",AWS_SECRET_KEY:"AWS_SECRET_KEY",CA_HEALTH_NUMBER:"CA_HEALTH_NUMBER",CA_SOCIAL_INSURANCE_NUMBER:"CA_SOCIAL_INSURANCE_NUMBER",CREDIT_DEBIT_CARD_CVV:"CREDIT_DEBIT_CARD_CVV",CREDIT_DEBIT_CARD_EXPIRY:"CREDIT_DEBIT_CARD_EXPIRY",CREDIT_DEBIT_CARD_NUMBER:"CREDIT_DEBIT_CARD_NUMBER",DRIVER_ID:"DRIVER_ID",EMAIL:"EMAIL",INTERNATIONAL_BANK_ACCOUNT_NUMBER:"INTERNATIONAL_BANK_ACCOUNT_NUMBER",IP_ADDRESS:"IP_ADDRESS",LICENSE_PLATE:"LICENSE_PLATE",MAC_ADDRESS:"MAC_ADDRESS",NAME:"NAME",PASSWORD:"PASSWORD",PHONE:"PHONE",PIN:"PIN",SWIFT_CODE:"SWIFT_CODE",UK_NATIONAL_HEALTH_SERVICE_NUMBER:"UK_NATIONAL_HEALTH_SERVICE_NUMBER",UK_NATIONAL_INSURANCE_NUMBER:"UK_NATIONAL_INSURANCE_NUMBER",UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER:"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",URL:"URL",USERNAME:"USERNAME",US_BANK_ACCOUNT_NUMBER:"US_BANK_ACCOUNT_NUMBER",US_BANK_ROUTING_NUMBER:"US_BANK_ROUTING_NUMBER",US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER:"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",US_PASSPORT_NUMBER:"US_PASSPORT_NUMBER",US_SOCIAL_SECURITY_NUMBER:"US_SOCIAL_SECURITY_NUMBER",VEHICLE_IDENTIFICATION_NUMBER:"VEHICLE_IDENTIFICATION_NUMBER"},Mq={BLOCKED:"BLOCKED",NONE:"NONE"},$q={DENY:"DENY"},Lq={BLOCKED:"BLOCKED",NONE:"NONE"},Uq={PROFANITY:"PROFANITY"},Bq={HATE:"HATE",INSULTS:"INSULTS",MISCONDUCT:"MISCONDUCT",SEXUAL:"SEXUAL",VIOLENCE:"VIOLENCE"},Gq={JAILBREAK:"JAILBREAK",PROMPT_INJECTION:"PROMPT_INJECTION",PROMPT_LEAKAGE:"PROMPT_LEAKAGE"},Fq={ADDRESS:"ADDRESS",AGE:"AGE",AWS_ACCESS_KEY:"AWS_ACCESS_KEY",AWS_SECRET_KEY:"AWS_SECRET_KEY",CA_HEALTH_NUMBER:"CA_HEALTH_NUMBER",CA_SOCIAL_INSURANCE_NUMBER:"CA_SOCIAL_INSURANCE_NUMBER",CREDIT_DEBIT_CARD_CVV:"CREDIT_DEBIT_CARD_CVV",CREDIT_DEBIT_CARD_EXPIRY:"CREDIT_DEBIT_CARD_EXPIRY",CREDIT_DEBIT_CARD_NUMBER:"CREDIT_DEBIT_CARD_NUMBER",DRIVER_ID:"DRIVER_ID",EMAIL:"EMAIL",INTERNATIONAL_BANK_ACCOUNT_NUMBER:"INTERNATIONAL_BANK_ACCOUNT_NUMBER",IP_ADDRESS:"IP_ADDRESS",LICENSE_PLATE:"LICENSE_PLATE",MAC_ADDRESS:"MAC_ADDRESS",NAME:"NAME",PASSWORD:"PASSWORD",PHONE:"PHONE",PIN:"PIN",SWIFT_CODE:"SWIFT_CODE",UK_NATIONAL_HEALTH_SERVICE_NUMBER:"UK_NATIONAL_HEALTH_SERVICE_NUMBER",UK_NATIONAL_INSURANCE_NUMBER:"UK_NATIONAL_INSURANCE_NUMBER",UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER:"UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",URL:"URL",USERNAME:"USERNAME",US_BANK_ACCOUNT_NUMBER:"US_BANK_ACCOUNT_NUMBER",US_BANK_ROUTING_NUMBER:"US_BANK_ROUTING_NUMBER",US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER:"US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",US_PASSPORT_NUMBER:"US_PASSPORT_NUMBER",US_SOCIAL_SECURITY_NUMBER:"US_SOCIAL_SECURITY_NUMBER",VEHICLE_IDENTIFICATION_NUMBER:"VEHICLE_IDENTIFICATION_NUMBER"},Hq={ASSISTANT:"assistant",SYSTEM:"system",USER:"user"},zq={DISABLED:"disabled",ENABLED:"enabled",ENABLED_FULL:"enabled_full"},qq={AAC:"aac",FLAC:"flac",M4A:"m4a",MKA:"mka",MKV:"mkv",MP3:"mp3",MP4:"mp4",MPEG:"mpeg",MPGA:"mpga",OGG:"ogg",OPUS:"opus",PCM:"pcm",WAV:"wav",WEBM:"webm",X_AAC:"x-aac"},Vq={FIVE_MINUTES:"5m",ONE_HOUR:"1h"},Wq={DEFAULT:"default"},jq={CSV:"csv",DOC:"doc",DOCX:"docx",HTML:"html",MD:"md",PDF:"pdf",TXT:"txt",XLS:"xls",XLSX:"xlsx"},Kq={JPEG:"jpeg",PNG:"png"},Xq={GROUNDING_SOURCE:"grounding_source",GUARD_CONTENT:"guard_content",QUERY:"query"},Yq={GIF:"gif",JPEG:"jpeg",PNG:"png",WEBP:"webp"},Qq={FLV:"flv",MKV:"mkv",MOV:"mov",MP4:"mp4",MPEG:"mpeg",MPG:"mpg",THREE_GP:"three_gp",WEBM:"webm",WMV:"wmv"},Jq={ERROR:"error",SUCCESS:"success"},Zq={SERVER_TOOL_USE:"server_tool_use"},eV={ASSISTANT:"assistant",SYSTEM:"system",USER:"user"},tV={JSON_SCHEMA:"json_schema"},rV={OPTIMIZED:"optimized",STANDARD:"standard"},oV={DEFAULT:"default",FLEX:"flex",PRIORITY:"priority",RESERVED:"reserved"},nV={CONTENT_FILTERED:"content_filtered",END_TURN:"end_turn",GUARDRAIL_INTERVENED:"guardrail_intervened",MALFORMED_MODEL_OUTPUT:"malformed_model_output",MALFORMED_TOOL_USE:"malformed_tool_use",MAX_TOKENS:"max_tokens",MODEL_CONTEXT_WINDOW_EXCEEDED:"model_context_window_exceeded",STOP_SEQUENCE:"stop_sequence",TOOL_USE:"tool_use"},sV={ASYNC:"async",SYNC:"sync"},iV={DISABLED:"DISABLED",ENABLED:"ENABLED",ENABLED_FULL:"ENABLED_FULL"};f.AccessDeniedException=Wd;f.AccessDeniedException$=DI;f.AnyToolChoice$=qI;f.AppliedGuardrailDetails$=VI;f.ApplyGuardrail$=Uk;f.ApplyGuardrailCommand=nu;f.ApplyGuardrailRequest$=WI;f.ApplyGuardrailResponse$=jI;f.AsyncInvokeOutputDataConfig$=Uu;f.AsyncInvokeS3OutputDataConfig$=KI;f.AsyncInvokeStatus=gq;f.AsyncInvokeSummary$=XI;f.AudioBlock$=YI;f.AudioFormat=qq;f.AudioSource$=ck;f.AutoToolChoice$=QI;f.BedrockRuntime=pu;f.BedrockRuntimeClient=$i;f.BedrockRuntimeServiceException=Le;f.BedrockRuntimeServiceException$=OI;f.BidirectionalInputPayloadPart$=JI;f.BidirectionalOutputPayloadPart$=ZI;f.CacheDetail$=e0;f.CachePointBlock$=Mu;f.CachePointType=Wq;f.CacheTTL=Vq;f.Citation$=t0;f.CitationGeneratedContent$=dk;f.CitationLocation$=Qh;f.CitationSourceContent$=uk;f.CitationSourceContentDelta$=n0;f.CitationsConfig$=Oh;f.CitationsContentBlock$=r0;f.CitationsDelta$=o0;f.ConflictException=Yd;f.ConflictException$=MI;f.ContentBlock$=lk;f.ContentBlockDelta$=fk;f.ContentBlockDeltaEvent$=s0;f.ContentBlockStart$=mk;f.ContentBlockStartEvent$=i0;f.ContentBlockStopEvent$=a0;f.ConversationRole=eV;f.Converse$=Bk;f.ConverseCommand=su;f.ConverseMetrics$=c0;f.ConverseOutput$=pk;f.ConverseRequest$=d0;f.ConverseResponse$=u0;f.ConverseStream$=Gk;f.ConverseStreamCommand=iu;f.ConverseStreamMetadataEvent$=l0;f.ConverseStreamMetrics$=f0;f.ConverseStreamOutput$=hk;f.ConverseStreamRequest$=m0;f.ConverseStreamResponse$=p0;f.ConverseStreamTrace$=h0;f.ConverseTokensRequest$=g0;f.ConverseTrace$=S0;f.CountTokens$=Fk;f.CountTokensCommand=au;f.CountTokensInput$=gk;f.CountTokensRequest$=E0;f.CountTokensResponse$=y0;f.DocumentBlock$=Dh;f.DocumentCharLocation$=C0;f.DocumentChunkLocation$=_0;f.DocumentContentBlock$=Sk;f.DocumentFormat=jq;f.DocumentPageLocation$=T0;f.DocumentSource$=Ek;f.ErrorBlock$=$u;f.GetAsyncInvoke$=Hk;f.GetAsyncInvokeCommand=cu;f.GetAsyncInvokeRequest$=A0;f.GetAsyncInvokeResponse$=w0;f.GuardrailAction=Aq;f.GuardrailAssessment$=Mh;f.GuardrailAutomatedReasoningFinding$=yk;f.GuardrailAutomatedReasoningImpossibleFinding$=R0;f.GuardrailAutomatedReasoningInputTextReference$=x0;f.GuardrailAutomatedReasoningInvalidFinding$=I0;f.GuardrailAutomatedReasoningLogicWarning$=Wi;f.GuardrailAutomatedReasoningLogicWarningType=xq;f.GuardrailAutomatedReasoningNoTranslationsFinding$=v0;f.GuardrailAutomatedReasoningPolicyAssessment$=k0;f.GuardrailAutomatedReasoningRule$=P0;f.GuardrailAutomatedReasoningSatisfiableFinding$=b0;f.GuardrailAutomatedReasoningScenario$=Di;f.GuardrailAutomatedReasoningStatement$=N0;f.GuardrailAutomatedReasoningTooComplexFinding$=O0;f.GuardrailAutomatedReasoningTranslation$=Jn;f.GuardrailAutomatedReasoningTranslationAmbiguousFinding$=D0;f.GuardrailAutomatedReasoningTranslationOption$=M0;f.GuardrailAutomatedReasoningValidFinding$=$0;f.GuardrailChecksConfig$=L0;f.GuardrailChecksContentBlock$=Ck;f.GuardrailChecksContentFilterCategory=Bq;f.GuardrailChecksContentFilterCategoryConfig$=U0;f.GuardrailChecksContentFilterConfig$=B0;f.GuardrailChecksContentFilterResult$=G0;f.GuardrailChecksContentFilterResultEntry$=F0;f.GuardrailChecksContentFilterUsage$=H0;f.GuardrailChecksMessage$=z0;f.GuardrailChecksPromptAttackCategory=Gq;f.GuardrailChecksPromptAttackCategoryConfig$=q0;f.GuardrailChecksPromptAttackConfig$=V0;f.GuardrailChecksPromptAttackResult$=W0;f.GuardrailChecksPromptAttackResultEntry$=j0;f.GuardrailChecksPromptAttackUsage$=K0;f.GuardrailChecksResults$=X0;f.GuardrailChecksRole=Hq;f.GuardrailChecksSensitiveInformationConfig$=Y0;f.GuardrailChecksSensitiveInformationEntityConfig$=Q0;f.GuardrailChecksSensitiveInformationEntityType=Fq;f.GuardrailChecksSensitiveInformationResult$=J0;f.GuardrailChecksSensitiveInformationResultEntry$=Z0;f.GuardrailChecksSensitiveInformationUsage$=ev;f.GuardrailChecksUsageResults$=tv;f.GuardrailConfiguration$=rv;f.GuardrailContentBlock$=_k;f.GuardrailContentFilter$=ov;f.GuardrailContentFilterConfidence=vq;f.GuardrailContentFilterStrength=kq;f.GuardrailContentFilterType=Pq;f.GuardrailContentPolicyAction=Iq;f.GuardrailContentPolicyAssessment$=nv;f.GuardrailContentQualifier=Cq;f.GuardrailContentSource=Tq;f.GuardrailContextualGroundingFilter$=sv;f.GuardrailContextualGroundingFilterType=Nq;f.GuardrailContextualGroundingPolicyAction=bq;f.GuardrailContextualGroundingPolicyAssessment$=iv;f.GuardrailConverseContentBlock$=Jh;f.GuardrailConverseContentQualifier=Xq;f.GuardrailConverseImageBlock$=av;f.GuardrailConverseImageFormat=Kq;f.GuardrailConverseImageSource$=Tk;f.GuardrailConverseTextBlock$=cv;f.GuardrailCoverage$=$h;f.GuardrailCustomWord$=dv;f.GuardrailImageBlock$=uv;f.GuardrailImageCoverage$=lv;f.GuardrailImageFormat=yq;f.GuardrailImageSource$=Ak;f.GuardrailInvocationMetrics$=fv;f.GuardrailManagedWord$=mv;f.GuardrailManagedWordType=Uq;f.GuardrailOrigin=wq;f.GuardrailOutputContent$=pv;f.GuardrailOutputScope=_q;f.GuardrailOwnership=Rq;f.GuardrailPiiEntityFilter$=hv;f.GuardrailPiiEntityType=Dq;f.GuardrailRegexFilter$=gv;f.GuardrailSensitiveInformationPolicyAction=Oq;f.GuardrailSensitiveInformationPolicyAssessment$=Sv;f.GuardrailStreamConfiguration$=Ev;f.GuardrailStreamProcessingMode=sV;f.GuardrailTextBlock$=yv;f.GuardrailTextCharactersCoverage$=Cv;f.GuardrailTopic$=_v;f.GuardrailTopicPolicyAction=Mq;f.GuardrailTopicPolicyAssessment$=Tv;f.GuardrailTopicType=$q;f.GuardrailTrace=zq;f.GuardrailTraceAssessment$=Lh;f.GuardrailUsage$=Uh;f.GuardrailWordPolicyAction=Lq;f.GuardrailWordPolicyAssessment$=Av;f.ImageBlock$=Bh;f.ImageBlockDelta$=wv;f.ImageBlockStart$=Rv;f.ImageFormat=Yq;f.ImageSource$=Zh;f.InferenceConfiguration$=Gh;f.InternalServerException=jd;f.InternalServerException$=Fi;f.InvokeGuardrailChecks$=zk;f.InvokeGuardrailChecksCommand=du;f.InvokeGuardrailChecksRequest$=xv;f.InvokeGuardrailChecksResponse$=Iv;f.InvokeModel$=qk;f.InvokeModelCommand=uu;f.InvokeModelRequest$=vv;f.InvokeModelResponse$=kv;f.InvokeModelTokensRequest$=Pv;f.InvokeModelWithBidirectionalStream$=Vk;f.InvokeModelWithBidirectionalStreamCommand=lu;f.InvokeModelWithBidirectionalStreamInput$=wk;f.InvokeModelWithBidirectionalStreamOutput$=Rk;f.InvokeModelWithBidirectionalStreamRequest$=bv;f.InvokeModelWithBidirectionalStreamResponse$=Nv;f.InvokeModelWithResponseStream$=Wk;f.InvokeModelWithResponseStreamCommand=fu;f.InvokeModelWithResponseStreamRequest$=Ov;f.InvokeModelWithResponseStreamResponse$=Dv;f.JsonSchemaDefinition$=Mv;f.ListAsyncInvokes$=jk;f.ListAsyncInvokesCommand=Li;f.ListAsyncInvokesRequest$=$v;f.ListAsyncInvokesResponse$=Lv;f.Message$=Fh;f.MessageStartEvent$=Uv;f.MessageStopEvent$=Bv;f.ModelErrorException=eu;f.ModelErrorException$=$I;f.ModelNotReadyException=tu;f.ModelNotReadyException$=LI;f.ModelStreamErrorException=ou;f.ModelStreamErrorException$=Hi;f.ModelTimeoutException=ru;f.ModelTimeoutException$=Ou;f.OutputConfig$=Hh;f.OutputFormat$=Gv;f.OutputFormatStructure$=xk;f.OutputFormatType=tV;f.PayloadPart$=Fv;f.PerformanceConfigLatency=rV;f.PerformanceConfiguration$=ji;f.PromptRouterTrace$=zh;f.PromptVariableValues$=Ik;f.ReasoningContentBlock$=vk;f.ReasoningContentBlockDelta$=kk;f.ReasoningTextBlock$=Hv;f.ResourceNotFoundException=Qd;f.ResourceNotFoundException$=UI;f.ResponseStream$=Pk;f.S3Location$=Ki;f.SearchResultBlock$=qh;f.SearchResultContentBlock$=zv;f.SearchResultLocation$=qv;f.ServiceQuotaExceededException=Jd;f.ServiceQuotaExceededException$=BI;f.ServiceTier$=Xi;f.ServiceTierType=oV;f.ServiceUnavailableException=Zd;f.ServiceUnavailableException$=zi;f.SortAsyncInvocationBy=Sq;f.SortOrder=Eq;f.SpecificToolChoice$=Vv;f.StartAsyncInvoke$=Kk;f.StartAsyncInvokeCommand=mu;f.StartAsyncInvokeRequest$=Wv;f.StartAsyncInvokeResponse$=jv;f.StopReason=nV;f.SystemContentBlock$=bk;f.SystemTool$=Kv;f.Tag$=Xv;f.ThrottlingException=Kd;f.ThrottlingException$=qi;f.TokenUsage$=Vh;f.Tool$=Nk;f.ToolAdditionBlock$=Yv;f.ToolChoice$=Ok;f.ToolConfiguration$=Lu;f.ToolInputSchema$=Dk;f.ToolReference$=Wh;f.ToolRemovalBlock$=Qv;f.ToolResultBlock$=Jv;f.ToolResultBlockDelta$=Mk;f.ToolResultBlockStart$=Zv;f.ToolResultContentBlock$=$k;f.ToolResultStatus=Jq;f.ToolSpecification$=ek;f.ToolUseBlock$=tk;f.ToolUseBlockDelta$=rk;f.ToolUseBlockStart$=ok;f.ToolUseType=Zq;f.Trace=iV;f.ValidationException=Xd;f.ValidationException$=Vi;f.VideoBlock$=jh;f.VideoFormat=Qq;f.VideoSource$=Lk;f.WebLocation$=nk;f.errorTypeRegistries=GI;f.paginateListAsyncInvokes=Xk});var aP=se(Qi=>{var{hasOwn:rP}=(D(),v(_t)),{streamCollector:aV}=(D(),v(_t));Qi.streamCollector=aV;var{buildQueryString:oP,HttpResponse:nP}=(P(),v(at)),Bu=oe("node:https"),{Readable:cV}=oe("node:stream"),eg=oe("node:http2");function Fu(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let o=new Error(String(e));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var dV=["ECONNRESET","EPIPE","ETIMEDOUT"],sP=t=>{let e={};for(let r in t){if(!rP(t,r))continue;let o=t[r];e[r]=Array.isArray(o)?o.join(","):o}return e},Ne={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},Qk=1e3,uV=(t,e,r=0)=>{if(!r)return-1;let o=n=>{let s=Ne.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{Ne.clearTimeout(s)}):Ne.clearTimeout(s)};t.socket?i(t.socket):t.on("socket",i)};return r<2e3?(o(0),0):Ne.setTimeout(o.bind(null,Qk),Qk)},lV=(t,e,r=0,o,n)=>r?Ne.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1,fV=3e3,mV=(t,{keepAlive:e,keepAliveMsecs:r},o=fV)=>{if(e!==!0)return-1;let n=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",s=>{s.setKeepAlive(e,r||0)})};return o===0?(n(),0):Ne.setTimeout(n,o)},Jk=3e3,pV=(t,e,r=0)=>{let o=n=>{let s=r-n,i=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(s,i),t.on("close",()=>t.socket?.removeListener("timeout",i))):t.setTimeout(s,i)};return 0<r&&r<6e3?(o(0),0):Ne.setTimeout(o.bind(null,r===0?0:Jk),Jk)},Zk=6e3;async function iP(t,e,r=Zk,o=!1){let n=e.headers,s=n?n.Expect||n.expect:void 0,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(Ne.setTimeout(()=>c(!0),Math.max(Zk,r)))}),new Promise(c=>{t.on("continue",()=>{Ne.clearTimeout(i),c(!0)}),t.on("response",()=>{Ne.clearTimeout(i),c(!1)}),t.on("error",()=>{Ne.clearTimeout(i),c(!1)})})])),a&&hV(t,e.body)}function hV(t,e){if(e instanceof cV){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){t.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}t.end(Buffer.from(e));return}t.end()}var gV=0,Gu,eP,tg=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){if(!rP(n,c))continue;let d=n[c]?.length??0,u=s[c]?.length??0;if(d>=i&&u>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${d} and ${u} additional requests are enqueued.
49
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
50
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=n.logger,i=e.protocol==="https:";return!i&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((a,c)=>{let d,u=-1,l=-1,m=-1,g=-1,S=-1,E=()=>{Ne.clearTimeout(u),Ne.clearTimeout(l),Ne.clearTimeout(m),Ne.clearTimeout(g),Ne.clearTimeout(S)},C=async _=>{await d,E(),a(_)},y=async _=>{await d,E(),c(_)};if(r?.aborted){let _=Fu(r);y(_);return}let T=e.headers,w=T?(T.Expect??T.expect)==="100-continue":!1,I=i?n.httpsAgent:n.httpAgent;w&&!this.externalAgent&&(I=new(i?Bu.Agent:Gu)({keepAlive:!1,maxSockets:1/0})),u=Ne.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(I,this.socketWarningTimestamp,s)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let b=e.query?oP(e.query):"",F;if(e.username!=null||e.password!=null){let _=e.username??"",A=e.password??"";F=`${_}:${A}`}let B=e.path;b&&(B+=`?${b}`),e.fragment&&(B+=`#${e.fragment}`);let O=e.hostname??"";O[0]==="["&&O.endsWith("]")?O=e.hostname.slice(1,-1):O=e.hostname;let Q={headers:e.headers,host:O,method:e.method,path:B,port:e.port,agent:I,auth:F},$=(i?Bu.request:eP)(Q,_=>{let A=new nP({statusCode:_.statusCode||-1,reason:_.statusMessage,headers:sP(_.headers),body:_});C({response:A})});if($.on("error",_=>{dV.includes(_.code)?y(Object.assign(_,{name:"TimeoutError"})):y(_)}),r){let _=()=>{$.destroy();let A=Fu(r);y(A)};if(typeof r.addEventListener=="function"){let A=r;A.addEventListener("abort",_,{once:!0}),$.once("close",()=>A.removeEventListener("abort",_))}else r.onabort=_}let z=o??n.requestTimeout;l=uV($,y,n.connectionTimeout),m=lV($,y,z,n.throwOnRequestTimeout,s??console),g=pV($,y,n.socketTimeout);let R=Q.agent;typeof R=="object"&&"keepAlive"in R&&(S=mV($,{keepAlive:R.keepAlive,keepAliveMsecs:R.keepAliveMsecs})),d=iP($,e,z,this.externalAgent).catch(_=>(E(),c(_)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>e===Symbol.for("logger")?{...o,logger:o.logger??r}:{...o,[e]:r})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:d}=e||{},u=!0,l=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let m=oe("node:http"),{Agent:g,request:S}=m.default??m;return eP=S,Gu=g,i instanceof Gu||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new Gu({keepAlive:u,maxSockets:l,...i})},httpsAgent:a instanceof Bu.Agent||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new Bu.Agent({keepAlive:u,maxSockets:l,...a}),logger:d}}},SV=new Uint16Array(1),Yi=class{id=SV[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(!this.session.destroyed&&(this.refs-=1,this.refs===0&&this.session.unref(),this.refs<0))throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){this.session.closed||this.session.close()}destroy(){this.refs=0,this.session.destroyed||(this.session.setTimeout(0),this.session.destroy())}useCount(){return this.refs}},rg=class{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map(r=>new Yi(r))}poll(){let e=!1;for(let r of this.sessions){if(r.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||r.useCount()<this.maxConcurrency)return r}if(e)for(let r of this.sessions)r.deref().destroyed&&this.remove(r)}offerLast(e){this.sessions.push(e)}remove(e){let r=this.sessions.indexOf(e);r>-1&&this.sessions.splice(r,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}},og=class{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}lease(e,r){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!r.isEventStream){let d=n.poll();if(d)return d.retain(),d}let s=new Yi(this.connect(o)),i=s.deref();this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},d=>{if(d)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(o,s)},c=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};return i.on("goaway",a),i.on("error",c),i.on("frameError",c),i.on("close",c),r.requestTimeout&&i.setTimeout(r.requestTimeout,c),n.offerLast(s),s.retain(),s}release(e,r){r.free()}createIsolatedSession(e,r){let o=this.getUrlString(e),n=new Yi(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};s.on("error",i),s.on("frameError",i),s.on("close",i);let a=r.requestTimeout??3e5;return s.setTimeout(a,i),n.retain(),n}destroy(){for(let[e,r]of this.connectionPools){for(let o of[...r])o.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let r of this.connectionPools.values())r.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[r,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[r]={sessions:n}}return e}removeFromPoolAndClose(e,r){this.connectionPools.get(e)?.remove(r),r.close()}removeFromPoolAndCheckedDestroy(e,r){this.connectionPools.get(e)?.remove(r),r.destroy()}getPool(e){if(!this.connectionPools.has(e)){let r=new rg;this.config.maxConcurrency&&r.setMaxConcurrency(this.config.maxConcurrency),this.connectionPools.set(e,r)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?eg.connect(e):eg.connect(e,this.connectOptions)}},{constants:tP}=eg,ng=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new og({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(n||{})}).catch(o):r(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:r,requestTimeout:o,isEventStream:n}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:d,maxConcurrentStreams:u,nodeHttp2ConnectOptions:l}=this.config;this.connectionManager.setDisableConcurrentStreams(d??!1),u&&this.connectionManager.setMaxConcurrentStreams(u),l&&this.connectionManager.setNodeHttp2ConnectOptions(l)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,a=i||n,c=o??s;return new Promise((d,u)=>{let l=!1,m,g=async _=>{await m,d(_)},S=async _=>{await m,u(_)};if(r?.aborted){l=!0;let _=Fu(r);S(_);return}let{hostname:E,method:C,port:y,protocol:T,query:w}=e,I="";if(e.username!=null||e.password!=null){let _=e.username??"",A=e.password??"";I=`${_}:${A}@`}let b=`${T}//${I}${E}${y?`:${y}`:""}`,F={destination:new URL(b)},B={requestTimeout:this.config?.sessionTimeout,isEventStream:n},O=a?this.connectionManager.createIsolatedSession(F,B):this.connectionManager.lease(F,B),Q=O.deref(),J=_=>{a&&O.destroy(),l=!0,S(_)},$=w?oP(w):"",z=e.path;$&&(z+=`?${$}`),e.fragment&&(z+=`#${e.fragment}`);let R=Q.request({...e.headers,[tP.HTTP2_HEADER_PATH]:z,[tP.HTTP2_HEADER_METHOD]:C});if(c&&R.setTimeout(c,()=>{R.close();let _=new Error(`Stream timed out because of no activity for ${c} ms`);_.name="TimeoutError",J(_)}),r){let _=()=>{R.close();let A=Fu(r);J(A)};if(typeof r.addEventListener=="function"){let A=r;A.addEventListener("abort",_,{once:!0}),R.once("close",()=>A.removeEventListener("abort",_))}else r.onabort=_}R.on("frameError",(_,A,U)=>{J(new Error(`Frame type id ${_} in stream id ${U} has failed with code ${A}.`))}),R.on("error",J),R.on("aborted",()=>{J(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${R.rstCode}.`))}),R.on("response",_=>{let A=new nP({statusCode:_[":status"]??-1,headers:sP(_),body:R});l=!0,g({response:A}),a&&(Q.close(),R.on("end",()=>{O.destroy()}))}),R.on("close",()=>{if(a?O.destroy():this.connectionManager.release(F,O),!l){let _=new Error("Unexpected error: http2 request did not get a response");Q.destroyed&&(_.name="TimeoutError"),J(_)}}),m=iP(R,e,c)})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}};Qi.DEFAULT_REQUEST_TIMEOUT=gV;Qi.NodeHttp2Handler=ng;Qi.NodeHttpHandler=tg});var X=Ee(Yk(),1),ag=Ee(aP(),1);var mP=Ee(ju(),1);import*as lP from"net";import*as fP from"tls";import{once as yV}from"events";import*as cP from"net";import*as dP from"http";import{Agent as EV}from"https";var Cr=Symbol("AgentBaseInternalState"),Zn=class extends dP.Agent{constructor(e){super(e),this[Cr]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint=="boolean")return e.secureEndpoint;if(typeof e.protocol=="string")return e.protocol==="https:"}let{stack:r}=new Error;return typeof r!="string"?!1:r.split(`
51
+ `).some(o=>o.indexOf("(https.js:")!==-1||o.indexOf("node:https:")!==-1)}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let r=new cP.Socket({writable:!1});return this.sockets[e].push(r),this.totalSocketCount++,r}decrementSockets(e,r){if(!this.sockets[e]||r===null)return;let o=this.sockets[e],n=o.indexOf(r);n!==-1&&(o.splice(n,1),this.totalSocketCount--,o.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?EV.prototype.getName.call(this,e):super.getName(e)}createSocket(e,r,o){let n={...r,secureEndpoint:this.isSecureEndpoint(r)},s=this.getName(n),i=this.incrementSockets(s);Promise.resolve().then(()=>this.connect(e,n)).then(a=>{if(this.decrementSockets(s,i),typeof a.addRequest=="function")try{return a.addRequest(e,n)}catch(c){return o(c)}this[Cr].currentSocket=a,super.createSocket(e,r,o)},a=>{this.decrementSockets(s,i),o(a)})}createConnection(){let e=this[Cr].currentSocket;if(this[Cr].currentSocket=void 0,!e)throw new Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[Cr].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(e){this[Cr]&&(this[Cr].defaultPort=e)}get protocol(){return this[Cr].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(e){this[Cr]&&(this[Cr].protocol=e)}};import{URL as uP}from"url";function Hu(){return async({response:t,scheme:e})=>{if(e.toLowerCase()!=="negotiate")throw new Error(`Expected Negotiate scheme but got "${e}"`);let r;try{r=await import("kerberos")}catch{throw new Error('The "kerberos" package is required for Negotiate proxy authentication. Install it with: npm install kerberos')}let o=t.headers["proxy-authenticate"]||"",n=Array.isArray(o)?o[0]:o,s=typeof n=="string"&&n.includes(" ")?n.split(" ").slice(1).join(" "):void 0,a=await(await r.initializeClient("HTTP@proxy",{mechOID:r.GSS_MECH_OID_SPNEGO})).step(s||"");if(!a)throw new Error("Kerberos client.step() returned no token");return{headers:{"Proxy-Authorization":`Negotiate ${a}`}}}}var es=(0,mP.default)("http-proxy-agent"),Ji=class extends Zn{constructor(e,r){super(r),this.proxy=typeof e=="string"?new uP(e):e,this.proxyHeaders=r?.headers??{},es("Creating new HttpProxyAgent instance: %o",this.proxy.href),r?.negotiate?this.onProxyAuth=Hu():r?.onProxyAuth&&(this.onProxyAuth=r.onProxyAuth);let o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...r?CV(r,"headers","onProxyAuth","negotiate"):null,host:o,port:n}}addRequest(e,r){e._header=null,this.setRequestProps(e,r),super.addRequest(e,r)}setRequestProps(e,r){let{proxy:o}=this,n=r.secureEndpoint?"https:":"http:",s=e.getHeader("host")||"localhost",i=`${n}//${s}`,a=new uP(e.path,i);r.port!==80&&(a.port=String(r.port)),e.path=String(a);let c=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders};if(o.username||o.password){let d=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;c["Proxy-Authorization"]=`Basic ${Buffer.from(d).toString("base64")}`}c["Proxy-Connection"]||(c["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let d of Object.keys(c)){let u=c[d];u&&e.setHeader(d,u)}}async connect(e,r){e._header=null,e.path.includes("://")||this.setRequestProps(e,r);let o,n;es("Regenerating stored HTTP header string for request"),e._implicitHeader(),e.outputData&&e.outputData.length>0&&(es("Patching connection write() output buffer with updated header"),o=e.outputData[0].data,n=o.indexOf(`\r
52
+ \r
53
+ `)+4,e.outputData[0].data=e._header+o.substring(n),es("Output buffer: %o",e.outputData[0].data));let s;this.proxy.protocol==="https:"?(es("Creating `tls.Socket`: %o",this.connectOpts),s=fP.connect(this.connectOpts)):(es("Creating `net.Socket`: %o",this.connectOpts),s=lP.connect(this.connectOpts)),await yV(s,"connect");let i={socket:s};return e.emit("proxyConnect",i),this.emit("proxyConnect",i,e),e.emit("proxy",{proxy:this.proxy.href,socket:s}),s}};Ji.protocols=["http","https"];function CV(t,...e){let r={},o;for(o in t)e.includes(o)||(r[o]=t[o]);return r}var gP=Ee(ju(),1);import*as _r from"net";import*as Zi from"tls";import _V from"assert";import{URL as TV}from"url";var pP=Ee(ju(),1),zu=(0,pP.default)("https-proxy-agent:parse-proxy-response");function sg(t){return new Promise((e,r)=>{let o=0,n=[];function s(){let u=t.read();u?d(u):t.once("readable",s)}function i(){t.removeListener("end",a),t.removeListener("error",c),t.removeListener("readable",s)}function a(){i(),zu("onend"),r(new Error("Proxy connection ended before receiving CONNECT response"))}function c(u){i(),zu("onerror %o",u),r(u)}function d(u){n.push(u),o+=u.length;let l=Buffer.concat(n,o),m=l.indexOf(`\r
54
+ \r
55
+ `);if(m===-1){zu("have not received end of HTTP headers yet..."),s();return}let g=l.slice(0,m).toString("ascii").split(`\r
56
+ `),S=g.shift();if(!S)return t.destroy(),r(new Error("No header received from proxy CONNECT response"));let E=S.split(" "),C=+E[1],y=E.slice(2).join(" "),T={};for(let w of g){if(!w)continue;let I=w.indexOf(":");if(I===-1)return t.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${w}"`));let b=w.slice(0,I).toLowerCase(),F=w.slice(I+1).trimStart(),B=T[b];typeof B=="string"?T[b]=[B,F]:Array.isArray(B)?B.push(F):T[b]=F}zu("got proxy server response: %o %o",S,T),i(),e({connect:{statusCode:C,statusText:y,headers:T},buffered:l})}t.on("error",c),t.on("end",a),s()})}var on=(0,gP.default)("https-proxy-agent"),qu=t=>t.servername===void 0&&t.host&&!_r.isIP(t.host)?{...t,servername:t.host}:t,ea=class extends Zn{constructor(e,r){super(r),this.options={path:void 0},this.proxy=typeof e=="string"?new TV(e):e,this.proxyHeaders=r?.headers??{},on("Creating new HttpsProxyAgent instance: %o",this.proxy.href),r?.negotiate?this.onProxyAuth=Hu():r?.onProxyAuth&&(this.onProxyAuth=r.onProxyAuth);let o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),n=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?ig(r,"headers","onProxyAuth","negotiate"):null,host:o,port:n}}async connect(e,r){let{proxy:o}=this;if(!r.host)throw new TypeError('No "host" provided');let n;o.protocol==="https:"?(on("Creating `tls.Socket`: %o",this.connectOpts),n=Zi.connect(qu(this.connectOpts))):(on("Creating `net.Socket`: %o",this.connectOpts),n=_r.connect(this.connectOpts));let s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},i=_r.isIPv6(r.host)?`[${r.host}]`:r.host,a=`CONNECT ${i}:${r.port} HTTP/1.1\r
57
+ `;if(o.username||o.password){let m=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(m).toString("base64")}`}s.Host=`${i}:${r.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let m of Object.keys(s))a+=`${m}: ${s[m]}\r
58
+ `;let c=sg(n);n.write(`${a}\r
59
+ `);let{connect:d,buffered:u}=await c;if(e.emit("proxyConnect",d),this.emit("proxyConnect",d,e),e.emit("proxy",{proxy:this.proxy.href,socket:n}),d.statusCode===200)return e.once("socket",hP),r.secureEndpoint?(on("Upgrading socket connection to TLS"),Zi.connect({...ig(qu(r),"host","path","port"),socket:n})):n;if(d.statusCode===407&&this.onProxyAuth){on("Got 407 response, invoking onProxyAuth callback"),n.destroy();let m=d.headers["proxy-authenticate"]||"",g=Array.isArray(m)?m[0].split(/\s/)[0]:m.split(/\s/)[0],S=await this.onProxyAuth({response:d,scheme:g});return this._connectWithAuth(e,r,S.headers)}n.destroy();let l=new _r.Socket({writable:!1});return l.readable=!0,e.once("socket",m=>{on("Replaying proxy buffer for failed request"),_V(m.listenerCount("data")>0),m.push(u),m.push(null)}),l}async _connectWithAuth(e,r,o){let{proxy:n}=this,s;n.protocol==="https:"?s=Zi.connect(qu(this.connectOpts)):s=_r.connect(this.connectOpts);let i=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},a=_r.isIPv6(r.host)?`[${r.host}]`:r.host,c=`CONNECT ${a}:${r.port} HTTP/1.1\r
60
+ `;if(n.username||n.password){let l=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i["Proxy-Authorization"]=`Basic ${Buffer.from(l).toString("base64")}`}Object.assign(i,o),i.Host=`${a}:${r.port}`,i["Proxy-Connection"]||(i["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let l of Object.keys(i))c+=`${l}: ${i[l]}\r
61
+ `;let d=sg(s);s.write(`${c}\r
62
+ `);let{connect:u}=await d;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200)return e.once("socket",hP),r.secureEndpoint?(on("Upgrading socket connection to TLS"),Zi.connect({...ig(qu(r),"host","path","port"),socket:s})):s;throw s.destroy(),new Error(`Proxy authentication failed with status ${u.statusCode} after retry`)}};ea.protocols=["http","https"];function hP(t){setImmediate(()=>{t.resume()})}function ig(t,...e){let r={},o;for(o in t)e.includes(o)||(r[o]=t[o]);return r}var lg="<empty>",AV="thinking-binding-controls-2026-08-01",SP="[Reasoning redacted]",Vu=(t,e,r={})=>{let o=new mg,n=Cg(e);return(async()=>{let s={role:"assistant",content:[],api:"bedrock-converse-stream",provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()},i=s.content,a=r.profile||r.env?.AWS_PROFILE,c={profile:a||Ke("AWS_PROFILE",r.env),customUserAgent:NV(r.identity)},d=_P(r),u=!!Ke("AWS_PROFILE"),l=TP(t.baseUrl),m=eW(t.baseUrl,d,u);m&&(c.endpoint=t.baseUrl);let g=Ke("AWS_BEDROCK_SKIP_AUTH",r.env)==="1",S=r.bearerToken||r.apiKey||Ke("AWS_BEARER_TOKEN_BEDROCK",r.env)||void 0,E=S!==void 0&&!g;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun)){let y=t.id.match(/^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/);y?c.region=y[1]:d?c.region=d:l&&m?c.region=l:u||(c.region="us-east-1"),g&&(c.credentials={accessKeyId:"dummy-access-key",secretAccessKey:"dummy-secret-key"});let T=ZV(r.env);!g&&T&&!a&&(c.credentials=T);let w=qg(t.baseUrl,r.env);w?c.requestHandler=new ag.NodeHttpHandler({httpAgent:new Ji(w),httpsAgent:new ea(w)}):Ke("AWS_BEDROCK_FORCE_HTTP1",r.env)==="1"&&(c.requestHandler=new ag.NodeHttpHandler)}else c.region=d||(l&&m?l:void 0)||"us-east-1";E&&(c.token={token:S},c.authSchemePreference=["httpBearerAuth"]);let C;try{let y=t.compat?.supportsStrictMode??!1,T=new X.BedrockRuntimeClient(c),w=!1;r.onResponse&&$V(T,r.onResponse,t,()=>{w=!0});let I=wg(r.headers);I&&OV(T,I);let b=qV(r.cacheRetention,r.env),F=r.maxTokens??(ra(t)?t.maxTokens:void 0),B=Sg(n.messages),O=B?gg(B):void 0,Q={modelId:t.id,messages:YV(n,t,b,r.env),system:WV(O,t,b,r.env),inferenceConfig:{...F!==void 0&&{maxTokens:F},...r.temperature!==void 0&&{temperature:r.temperature}},toolConfig:QV(yg(n.messages),r.toolChoice,y),additionalModelRequestFields:rW(t,r),...r.requestMetadata!==void 0&&{requestMetadata:r.requestMetadata}},J=await r?.onPayload?.(Q,t);J!==void 0&&(Q=J);let $=new X.ConverseStreamCommand(Q),z=await T.send($,{abortSignal:r.signal});if(C=fg(z.$metadata.requestId),!w&&z.$metadata.httpStatusCode!==void 0){let R={};z.$metadata.requestId&&(R["x-amzn-requestid"]=z.$metadata.requestId),await r?.onResponse?.({status:z.$metadata.httpStatusCode,headers:R},t)}for await(let R of z.stream)if(await r.onProviderStreamEvent?.(R,t),R.messageStart){if(R.messageStart.role!==X.ConversationRole.ASSISTANT)throw new Error("Unexpected assistant message start but got user message start instead");o.push({type:"start",partial:s})}else if(R.contentBlockStart)LV(R.contentBlockStart,i,s,o);else if(R.contentBlockDelta)UV(R.contentBlockDelta,i,s,o);else if(R.contentBlockStop)GV(R.contentBlockStop,i,s,o);else if(R.messageStop){s.rawStopReason=R.messageStop.stopReason;let{stopReason:_,errorMessage:A}=JV(R.messageStop.stopReason);s.stopReason=_,A&&(s.errorMessage=A)}else if(R.metadata)BV(R.metadata,t,s);else{if(R.internalServerException)throw R.internalServerException;if(R.modelStreamErrorException)throw R.modelStreamErrorException;if(R.validationException)throw R.validationException;if(R.throttlingException)throw R.throttlingException;if(R.serviceUnavailableException)throw R.serviceUnavailableException}if(r.signal?.aborted)throw new Error("Request was aborted");if(s.stopReason==="pending")throw new Error("Bedrock stream ended without a stop reason");if(s.stopReason==="error"||s.stopReason==="aborted")throw new Error(s.errorMessage||"An unknown error occurred");for(let R of s.content)EP(R);o.push({type:"done",reason:s.stopReason,message:s}),o.end()}catch(y){for(let T of s.content)EP(T);s.stopReason=r.signal?.aborted?"aborted":"error",s.errorMessage=xV(y),s.stopReason==="error"&&kV(s,y,C),o.push({type:"error",reason:s.stopReason,error:s}),o.end()}})(),o},wV={InternalServerException:"Internal server error",ModelStreamErrorException:"Model stream error",ValidationException:"Validation error",ThrottlingException:"Throttling error",ServiceUnavailableException:"Service unavailable"},RV="https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html";function xV(t){let e=Og(t),r=!e.messageCarriesBody&&e.status!==void 0&&e.body!==void 0?`${e.status}: ${e.body}`:e.message,o=/data retention mode/i.test(r)?` See ${RV} for supported data retention modes.`:"";return t instanceof X.BedrockRuntimeServiceException?`${wV[t.name]??t.name}: ${r}${o}`:`${r}${o}`}var IV=200;function fg(t){if(typeof t!="string")return;let e=t.trim();if(!(e.length===0||e.length>IV))return e}function vV(t){if(!(!(t instanceof Error)||!t.name.endsWith("Exception")))return fg(t.name)}function kV(t,e,r){let o=e?.$metadata,n={};typeof o?.httpStatusCode=="number"&&(n.status=o.httpStatusCode);let s=vV(e);s!==void 0&&(n.errorCode=s);let i=fg(o?.requestId)??r;i!==void 0&&(n.requestId=i),Object.keys(n).length!==0&&pg(t,{type:"bedrock_response_failure",timestamp:Date.now(),details:n})}var PV=new Set(["authorization","host"]);function bV(t){let e=t.toLowerCase();return e.startsWith("x-amz-")||PV.has(e)}function NV(t){let e=t?.userAgent??"detailed";return typeof e=="object"?e.custom:e==="short"?[["pi"]]:[["pi",hg(t)]]}function OV(t,e){let r=o=>async n=>{let s=n.request;if(s&&typeof s=="object"&&"headers"in s){let i=s.headers;for(let[a,c]of Object.entries(e))bV(a)||(i[a]=c)}return o(n)};t.middlewareStack.add(r,{step:"build",name:"pi-ai-custom-headers",priority:"low"})}function DV(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.statusCode=="number"&&!!e.headers&&typeof e.headers=="object"}function MV(t){if(DV(t))return{status:t.statusCode,headers:{...t.headers}}}function $V(t,e,r,o){let n=s=>async i=>{let a=await s(i),c=MV(a.response);return c&&(o(),await e(c,r)),a};t.middlewareStack.add(n,{step:"deserialize",name:"pi-ai-response-headers"})}var Kne=(t,e,r)=>{let o={...vg(t,e,r,void 0),toolChoice:r?.toolChoice};if(!r?.reasoning)return Vu(t,e,{...o,reasoning:void 0});if(ra(t)){if(cg(t.id,t.name))return Vu(t,e,{...o,reasoning:r.reasoning,thinkingBudgets:r.thinkingBudgets});let n=Pg(o.maxTokens,t.maxTokens,r.reasoning,r.thinkingBudgets),s=Ig(t,e,n.maxTokens);return Vu(t,e,{...o,maxTokens:s,reasoning:r.reasoning,thinkingBudgets:{...r.thinkingBudgets||{},[kg(r.reasoning)]:Math.min(n.thinkingBudget,Math.max(0,s-1024))}})}return Vu(t,e,{...o,reasoning:r.reasoning,thinkingBudgets:r.thinkingBudgets})};function LV(t,e,r,o){let n=t.contentBlockIndex,s=t.start;if(s?.toolUse){let i={type:"toolCall",id:s.toolUse.toolUseId||"",name:s.toolUse.name||"",arguments:{},partialJson:"",index:n};r.content.push(i),o.push({type:"toolcall_start",contentIndex:e.length-1,partial:r})}}function UV(t,e,r,o){let n=t.contentBlockIndex,s=t.delta,i=e.findIndex(c=>c.index===n),a=e[i];if(s?.text!==void 0){if(!a){let c={type:"text",text:"",index:n};r.content.push(c),i=e.length-1,a=e[i],o.push({type:"text_start",contentIndex:i,partial:r})}a.type==="text"&&(a.text+=s.text,o.push({type:"text_delta",contentIndex:i,delta:s.text,partial:r}))}else if(s?.toolUse&&a?.type==="toolCall")a.partialJson=(a.partialJson||"")+(s.toolUse.input||""),a.arguments=Ag(a.partialJson),o.push({type:"toolcall_delta",contentIndex:i,delta:s.toolUse.input||"",partial:r});else if(s?.reasoningContent){let c=a,d=i;if(!c){let u={type:"thinking",thinking:"",thinkingSignature:"",index:n};r.content.push(u),d=e.length-1,c=e[d],o.push({type:"thinking_start",contentIndex:d,partial:r})}c?.type==="thinking"&&(s.reasoningContent.text&&(c.thinking+=s.reasoningContent.text,o.push({type:"thinking_delta",contentIndex:d,delta:s.reasoningContent.text,partial:r})),s.reasoningContent.signature&&!c.redacted&&(c.thinkingSignature=(c.thinkingSignature||"")+s.reasoningContent.signature),s.reasoningContent.redactedContent?.length&&(c.redacted||(c.redacted=!0,c.thinkingSignature="",c.thinking+=SP,o.push({type:"thinking_delta",contentIndex:d,delta:SP,partial:r})),c.redactedChunks??=[],c.redactedChunks.push(s.reasoningContent.redactedContent)))}}function yP(t){t.type!=="thinking"||!t.redactedChunks||(t.thinkingSignature=iW(t.redactedChunks),delete t.redactedChunks)}function EP(t){delete t.index,delete t.partialJson,yP(t)}function BV(t,e,r){t.usage&&(r.usage.input=t.usage.inputTokens||0,r.usage.output=t.usage.outputTokens||0,r.usage.cacheRead=t.usage.cacheReadInputTokens||0,r.usage.cacheWrite=t.usage.cacheWriteInputTokens||0,r.usage.cacheWrite1h=t.usage.cacheDetails?.reduce((o,n)=>o+(n.ttl===X.CacheTTL.ONE_HOUR?n.inputTokens??0:0),0),r.usage.totalTokens=t.usage.totalTokens||r.usage.input+r.usage.output,_g(e,r.usage))}function GV(t,e,r,o){let n=e.findIndex(i=>i.index===t.contentBlockIndex),s=e[n];if(s)switch(delete s.index,s.type){case"text":o.push({type:"text_end",contentIndex:n,content:s.text,partial:r});break;case"thinking":yP(s),o.push({type:"thinking_end",contentIndex:n,content:s.thinking,partial:r});break;case"toolCall":Object.assign(s,Tg(s.partialJson)),delete s.partialJson,o.push({type:"toolcall_end",contentIndex:n,toolCall:s,partial:r});break}}function ta(t,e){return(e?[t,e]:[t]).flatMap(o=>{let n=o.toLowerCase();return[n,n.replace(/[\s_.:]+/g,"-")]})}function cg(t,e){return ta(t,e).some(o=>o.includes("opus-4-6")||o.includes("opus-4-7")||o.includes("opus-4-8")||o.includes("opus-5")||o.includes("sonnet-4-6")||o.includes("sonnet-5")||o.includes("haiku-5")||o.includes("fable-5"))}function FV(t){return ta(t.id,t.name).some(r=>r.includes("opus-4-7")||r.includes("opus-4-8")||r.includes("opus-5")||r.includes("sonnet-5")||r.includes("haiku-5")||r.includes("fable-5"))}function HV(t){return ta(t.id,t.name).some(r=>r.includes("opus-4-7")||r.includes("opus-4-8")||r.includes("opus-5")||r.includes("sonnet-5")||r.includes("haiku-5")||r.includes("fable-5"))}function zV(t,e){if(e==="xhigh"&&FV(t))return"xhigh";let r=e?t.thinkingLevelMap?.[e]:void 0;if(typeof r=="string")return r;switch(e){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}function qV(t,e){return t||(Ke("PI_CACHE_RETENTION",e)==="long"?"long":"short")}function ra(t){let e=t.id.toLowerCase(),r=t.name?.toLowerCase()??"";return e.includes("anthropic.claude")||e.includes("anthropic/claude")||r.includes("anthropic.claude")||r.includes("anthropic/claude")||r.includes("claude")}function CP(t,e){let r=ta(t.id,t.name);return r.some(n=>n.includes("claude"))?!!(r.some(n=>n.includes("fable-5")||n.includes("opus-5")||n.includes("sonnet-5")||n.includes("haiku-5"))||r.some(n=>n.includes("-4-"))||r.some(n=>n.includes("claude-3-7-sonnet"))||r.some(n=>n.includes("claude-3-5-haiku"))):Ke("AWS_BEDROCK_FORCE_CACHE",e)==="1"}function VV(t){return ra(t)}function WV(t,e,r,o){if(!t)return;let n=[{text:oa(t)}];return r!=="none"&&CP(e,o)&&n.push({cachePoint:{type:X.CachePointType.DEFAULT,...r==="long"?{ttl:X.CacheTTL.ONE_HOUR}:{}}}),n}function jV(t){let e=t.replace(/[^a-zA-Z0-9_-]/g,"_");return e.length>64?e.slice(0,64):e}function Wu(t){let e=oa(t);return e.trim().length===0?void 0:{text:e}}function KV(t){return Wu(t)??{text:lg}}function dg(t){return Array.isArray(t)?t.map(dg):t!==null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([e])=>e.length>0).map(([e,r])=>[e,dg(r)])):t}function XV(t){let e=[];for(let r of t)if(r.type==="image")e.push({image:ug(r.mimeType,r.data)});else{let o=Wu(r.text);o&&e.push(o)}return e.length===0&&e.push({text:lg}),e}function YV(t,e,r,o){let n=[],s=Ng(Eg(t.messages),e,jV);for(let i=0;i<s.length;i++){let a=s[i];switch(a.role){case"user":{let c=[];if(typeof a.content=="string")c.push(KV(a.content));else{for(let d of a.content)switch(d.type){case"text":{let u=Wu(d.text);u&&c.push(u);break}case"image":c.push({image:ug(d.mimeType,d.data)});break;default:continue}c.length===0&&c.push({text:lg})}n.push({role:X.ConversationRole.USER,content:c});break}case"assistant":{if(a.content.length===0)continue;let c=[];for(let d of a.content)switch(d.type){case"text":{let u=Wu(d.text);if(!u)continue;c.push(u);break}case"toolCall":c.push({toolUse:{toolUseId:d.id,name:d.name,input:dg(d.arguments)}});break;case"thinking":{if(d.redacted){let l=sW(d.thinkingSignature);l?.length&&c.push({reasoningContent:{redactedContent:l}});continue}let u=oa(d.thinking);if(u.trim().length===0)continue;VV(e)?!d.thinkingSignature||d.thinkingSignature.trim().length===0?c.push({text:u}):c.push({reasoningContent:{reasoningText:{text:u,signature:d.thinkingSignature}}}):c.push({reasoningContent:{reasoningText:{text:u}}});break}default:continue}if(c.length===0)continue;n.push({role:X.ConversationRole.ASSISTANT,content:c});break}case"toolResult":{let c=[],d=[],u=i;for(;u<s.length&&s[u].role==="toolResult";){let l=s[u],m=ra(e)?bg(l):void 0;c.push({toolResult:{toolUseId:l.toolCallId,content:XV(m?.content??l.content),status:l.isError?X.ToolResultStatus.ERROR:X.ToolResultStatus.SUCCESS}}),m&&d.push({text:m.caption},...m.images.map(g=>({image:ug(g.mimeType,g.data)}))),u++}i=u-1,n.push({role:X.ConversationRole.USER,content:[...c,...d]});break}default:continue}}if(r!=="none"&&CP(e,o)&&n.length>0){let i=n[n.length-1];i.role===X.ConversationRole.USER&&i.content&&i.content.push({cachePoint:{type:X.CachePointType.DEFAULT,...r==="long"?{ttl:X.CacheTTL.ONE_HOUR}:{}}})}return n}function QV(t,e,r){if(!t?.length||e==="none")return;let o=t.map(s=>{let i=xg(s,r);return{toolSpec:{name:s.name,description:s.description,inputSchema:{json:Rg(s,i)},...i===!0?{strict:!0}:{}}}}),n;switch(e){case"auto":n={auto:{}};break;case"any":n={any:{}};break;default:e?.type==="tool"&&(n={tool:{name:e.name}})}return{tools:o,toolChoice:n}}function JV(t){switch(t){case X.StopReason.END_TURN:case X.StopReason.STOP_SEQUENCE:return{stopReason:"stop"};case X.StopReason.MAX_TOKENS:case X.StopReason.MODEL_CONTEXT_WINDOW_EXCEEDED:return{stopReason:"length"};case X.StopReason.TOOL_USE:return{stopReason:"toolUse"};default:return t?{stopReason:"error",errorMessage:`Provider stopped with: ${t}`}:{stopReason:"error"}}}function _P(t){return t.region||Ke("AWS_REGION",t.env)||Ke("AWS_DEFAULT_REGION",t.env)||void 0}function ZV(t){let e=Ke("AWS_ACCESS_KEY_ID",t),r=Ke("AWS_SECRET_ACCESS_KEY",t);if(!e||!r)return;let o=Ke("AWS_SESSION_TOKEN",t);return{accessKeyId:e,secretAccessKey:r,...o?{sessionToken:o}:{}}}function TP(t){if(t)try{let{hostname:e}=new URL(t);return e.toLowerCase().match(/^bedrock-runtime(?:-fips)?\.([a-z0-9-]+)\.amazonaws\.com(?:\.cn)?$/)?.[1]}catch{return}}function eW(t,e,r){return TP(t)?!e&&!r:!0}function tW(t,e){if(_P(e)?.toLowerCase().startsWith("us-gov-"))return!0;let o=t.id.toLowerCase();return o.startsWith("us-gov.")||o.startsWith("arn:aws-us-gov:")}function rW(t,e){if(!e.reasoning||!t.reasoning)return;if(ra(t)){let o=tW(t,e),n=o?void 0:e.thinkingDisplay??"summarized",s=!o&&HV(t),i=cg(t.id,t.name)?{thinking:{type:"adaptive",...n!==void 0?{display:n}:{},...s?{block_binding:{prefix_mismatch_behavior:"drop_block"}}:{}},output_config:{effort:zV(t,e.reasoning)},...s?{anthropic_beta:[AV]}:{}}:(()=>{let a={minimal:1024,low:2048,medium:8192,high:16384,xhigh:16384,max:16384},c=e.reasoning==="xhigh"||e.reasoning==="max"?"high":e.reasoning;return{thinking:{type:"enabled",budget_tokens:e.thinkingBudgets?.[c]??a[e.reasoning],...n!==void 0?{display:n}:{}}}})();return!cg(t.id,t.name)&&(e.interleavedThinking??!0)&&(i.anthropic_beta=["interleaved-thinking-2025-05-14"]),i}let r=ta(t.id,t.name);if(r.some(o=>o.includes("gpt-oss")))return{reasoning_effort:nW[e.reasoning]};if(r.some(o=>o.includes("gpt-"))){let o=t.thinkingLevelMap?.[e.reasoning];return{reasoning:{effort:typeof o=="string"?o:oW[e.reasoning]}}}}var oW={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},nW={minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"high",max:"high"};function ug(t,e){let r;switch(t){case"image/jpeg":case"image/jpg":r=X.ImageFormat.JPEG;break;case"image/png":r=X.ImageFormat.PNG;break;case"image/gif":r=X.ImageFormat.GIF;break;case"image/webp":r=X.ImageFormat.WEBP;break;default:throw new Error(`Unknown image type: ${t}`)}return{source:{bytes:AP(e)},format:r}}function AP(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function sW(t){if(t)try{return AP(t)}catch{return}}function iW(t){let r="";for(let o of t)for(let n=0;n<o.length;n+=32768)r+=String.fromCharCode(...o.subarray(n,n+32768));return btoa(r)}export{Vu as stream,Kne as streamSimple};