@redscope-ai/redscope 1.0.0

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 (619) hide show
  1. package/README.md +224 -0
  2. package/dist/chunk-090920rk.js +288 -0
  3. package/dist/chunk-0afb2r78.js +141 -0
  4. package/dist/chunk-0d4ekx1g.js +73 -0
  5. package/dist/chunk-0g6nwbhq.js +15 -0
  6. package/dist/chunk-0qj905nt.js +18 -0
  7. package/dist/chunk-0s5btnn1.js +186 -0
  8. package/dist/chunk-0s8fars0.js +91 -0
  9. package/dist/chunk-10ev3dvh.js +312 -0
  10. package/dist/chunk-10k5jfc5.js +1295 -0
  11. package/dist/chunk-12tspwqa.js +240 -0
  12. package/dist/chunk-13qesvnw.js +17 -0
  13. package/dist/chunk-143eh1e0.js +121 -0
  14. package/dist/chunk-14p6wvsq.js +39 -0
  15. package/dist/chunk-19f3zb1m.js +342 -0
  16. package/dist/chunk-1a5cep8h.js +145 -0
  17. package/dist/chunk-1abw9kkn.js +34 -0
  18. package/dist/chunk-1aer7c78.js +118 -0
  19. package/dist/chunk-1dazz4g6.js +154 -0
  20. package/dist/chunk-1fcf4ty1.js +142 -0
  21. package/dist/chunk-1gnxhyf8.js +62 -0
  22. package/dist/chunk-1he3944e.js +8124 -0
  23. package/dist/chunk-1jpayz7y.js +952 -0
  24. package/dist/chunk-1qd6f6vk.js +269 -0
  25. package/dist/chunk-1v0kpe62.js +2547 -0
  26. package/dist/chunk-1w20m7gw.js +445 -0
  27. package/dist/chunk-1y7kp51j.js +72 -0
  28. package/dist/chunk-1ycb5sxt.js +247 -0
  29. package/dist/chunk-1zbwhcbt.js +1124 -0
  30. package/dist/chunk-20psem54.js +116 -0
  31. package/dist/chunk-23h69r5b.js +30 -0
  32. package/dist/chunk-23x86ptv.js +473 -0
  33. package/dist/chunk-24fyv3jz.js +378 -0
  34. package/dist/chunk-24kv69g3.js +97 -0
  35. package/dist/chunk-2azx8zsc.js +125 -0
  36. package/dist/chunk-2d1gwzz9.js +524 -0
  37. package/dist/chunk-2g0ytd9d.js +29058 -0
  38. package/dist/chunk-2hfp9kat.js +21 -0
  39. package/dist/chunk-2j875eq6.js +37 -0
  40. package/dist/chunk-2kcgxnvp.js +39 -0
  41. package/dist/chunk-2kz09j2s.js +23 -0
  42. package/dist/chunk-2mwnwp0n.js +17 -0
  43. package/dist/chunk-2p1cqhcn.js +921 -0
  44. package/dist/chunk-2p369q9z.js +61 -0
  45. package/dist/chunk-2rf6asgf.js +151 -0
  46. package/dist/chunk-2vr7mqx1.js +384 -0
  47. package/dist/chunk-2xcg933e.js +205 -0
  48. package/dist/chunk-2ypwckbz.js +40310 -0
  49. package/dist/chunk-30wnahyg.js +626 -0
  50. package/dist/chunk-326zehp8.js +204 -0
  51. package/dist/chunk-32s6jzgw.js +183 -0
  52. package/dist/chunk-35yzt1a7.js +202 -0
  53. package/dist/chunk-38frkej6.js +62 -0
  54. package/dist/chunk-3abaq08g.js +34 -0
  55. package/dist/chunk-3h59ttr5.js +32 -0
  56. package/dist/chunk-3nk9q8dr.js +154 -0
  57. package/dist/chunk-3prrxevm.js +224 -0
  58. package/dist/chunk-3tv8p9xw.js +127 -0
  59. package/dist/chunk-3txyekes.js +19 -0
  60. package/dist/chunk-3vfxjn7g.js +19 -0
  61. package/dist/chunk-3w9sye8h.js +81 -0
  62. package/dist/chunk-3y69j7y8.js +24 -0
  63. package/dist/chunk-3zwjpkjh.js +1603 -0
  64. package/dist/chunk-40t1d75v.js +3442 -0
  65. package/dist/chunk-470kmby4.js +318 -0
  66. package/dist/chunk-47jc141z.js +335 -0
  67. package/dist/chunk-48rz50ct.js +868 -0
  68. package/dist/chunk-49wv03ts.js +232 -0
  69. package/dist/chunk-4a189mn2.js +103 -0
  70. package/dist/chunk-4c4fmh7a.js +15 -0
  71. package/dist/chunk-4ct8dsj5.js +49 -0
  72. package/dist/chunk-4kqt1pm1.js +100 -0
  73. package/dist/chunk-4ng0xy0e.js +802 -0
  74. package/dist/chunk-4spgkgr3.js +43 -0
  75. package/dist/chunk-4tjdwtyy.js +19 -0
  76. package/dist/chunk-4tr60273.js +370 -0
  77. package/dist/chunk-4vnaeng5.js +29 -0
  78. package/dist/chunk-4wbqpeaw.js +871 -0
  79. package/dist/chunk-4wgkv3fv.js +1140 -0
  80. package/dist/chunk-4yjskjb6.js +40 -0
  81. package/dist/chunk-50m3a23z.js +35 -0
  82. package/dist/chunk-511f79az.js +182 -0
  83. package/dist/chunk-51sgztvv.js +161 -0
  84. package/dist/chunk-563fcpv1.js +290 -0
  85. package/dist/chunk-564cnq6v.js +735 -0
  86. package/dist/chunk-569r8cxc.js +31 -0
  87. package/dist/chunk-570x55d4.js +12 -0
  88. package/dist/chunk-571556cm.js +80 -0
  89. package/dist/chunk-59t4c56e.js +63 -0
  90. package/dist/chunk-5axjhkma.js +36 -0
  91. package/dist/chunk-5b188q5e.js +157 -0
  92. package/dist/chunk-5dmn1865.js +439 -0
  93. package/dist/chunk-5ks4829r.js +267 -0
  94. package/dist/chunk-5mmhfbxb.js +1078 -0
  95. package/dist/chunk-5rdt14hy.js +742 -0
  96. package/dist/chunk-5ssryexj.js +121 -0
  97. package/dist/chunk-5v95pnq4.js +15 -0
  98. package/dist/chunk-5xvjt2t9.js +68 -0
  99. package/dist/chunk-5zyq6t1q.js +118 -0
  100. package/dist/chunk-60fkafk2.js +15 -0
  101. package/dist/chunk-62fjkf5q.js +46 -0
  102. package/dist/chunk-64gazrrb.js +8067 -0
  103. package/dist/chunk-65tq2yjx.js +126 -0
  104. package/dist/chunk-65zbgg1n.js +14 -0
  105. package/dist/chunk-66v8mty3.js +264 -0
  106. package/dist/chunk-6acx5heq.js +292 -0
  107. package/dist/chunk-6hr7742d.js +61 -0
  108. package/dist/chunk-6hygvrhn.js +143 -0
  109. package/dist/chunk-6kjh280m.js +128 -0
  110. package/dist/chunk-6s0q1s5r.js +66 -0
  111. package/dist/chunk-6x35ffpx.js +690 -0
  112. package/dist/chunk-71jfy1hh.js +570 -0
  113. package/dist/chunk-71sdcaq6.js +15 -0
  114. package/dist/chunk-754qdxs5.js +92 -0
  115. package/dist/chunk-79v5bkj4.js +1176 -0
  116. package/dist/chunk-7br0w7j5.js +151 -0
  117. package/dist/chunk-7cjgrzz1.js +298 -0
  118. package/dist/chunk-7d41ks0y.js +133 -0
  119. package/dist/chunk-7f40pmtr.js +71 -0
  120. package/dist/chunk-7g15x8hm.js +131 -0
  121. package/dist/chunk-7gtnzdet.js +120 -0
  122. package/dist/chunk-7h0z4aqx.js +702 -0
  123. package/dist/chunk-7h7e5a7d.js +25 -0
  124. package/dist/chunk-7m2cznwr.js +40 -0
  125. package/dist/chunk-7nvday0n.js +252 -0
  126. package/dist/chunk-7qey87th.js +145 -0
  127. package/dist/chunk-7qx3xhv3.js +9076 -0
  128. package/dist/chunk-7tfdhkpy.js +61 -0
  129. package/dist/chunk-80m511j6.js +121 -0
  130. package/dist/chunk-80ysxfe9.js +784 -0
  131. package/dist/chunk-8375zk8t.js +17200 -0
  132. package/dist/chunk-85bpkyy9.js +412 -0
  133. package/dist/chunk-85tcn547.js +876 -0
  134. package/dist/chunk-85vqgbc8.js +13 -0
  135. package/dist/chunk-86626jb4.js +49 -0
  136. package/dist/chunk-87ms17f6.js +444 -0
  137. package/dist/chunk-87mz239c.js +118 -0
  138. package/dist/chunk-89vdzt4e.js +254 -0
  139. package/dist/chunk-89z3e99z.js +159 -0
  140. package/dist/chunk-8cwrz1dd.js +1806 -0
  141. package/dist/chunk-8gv2pjby.js +21 -0
  142. package/dist/chunk-8hdevr3s.js +140 -0
  143. package/dist/chunk-8hdsk6qc.js +710 -0
  144. package/dist/chunk-8kct9arg.js +724 -0
  145. package/dist/chunk-8kf8h7xf.js +23 -0
  146. package/dist/chunk-8qed8ymj.js +605 -0
  147. package/dist/chunk-8sdgr592.js +101 -0
  148. package/dist/chunk-8we9w8pw.js +111 -0
  149. package/dist/chunk-8xnm5637.js +72 -0
  150. package/dist/chunk-8y3q0eqy.js +67 -0
  151. package/dist/chunk-8yvsnrkr.js +3449 -0
  152. package/dist/chunk-8zz4z1q3.js +42 -0
  153. package/dist/chunk-90eyff3k.js +119 -0
  154. package/dist/chunk-92bjkrf2.js +121 -0
  155. package/dist/chunk-92zrc7c6.js +327 -0
  156. package/dist/chunk-935nrvdb.js +13 -0
  157. package/dist/chunk-94pfyv6a.js +48 -0
  158. package/dist/chunk-9568p8se.js +115 -0
  159. package/dist/chunk-96km1ywr.js +37 -0
  160. package/dist/chunk-980bg4w4.js +163 -0
  161. package/dist/chunk-9a9g5hbj.js +205 -0
  162. package/dist/chunk-9cm4725d.js +4395 -0
  163. package/dist/chunk-9ds3vzq8.js +847 -0
  164. package/dist/chunk-9ffc9n60.js +618 -0
  165. package/dist/chunk-9fstrwv2.js +184 -0
  166. package/dist/chunk-9gt0g0qe.js +153 -0
  167. package/dist/chunk-9h9k5vz3.js +2761 -0
  168. package/dist/chunk-9he8bmhy.js +17 -0
  169. package/dist/chunk-9hn8e6h1.js +12 -0
  170. package/dist/chunk-9j0n3g8e.js +179 -0
  171. package/dist/chunk-9j6pa3ft.js +251 -0
  172. package/dist/chunk-9jpg9dn7.js +122 -0
  173. package/dist/chunk-9mycnwj5.js +46 -0
  174. package/dist/chunk-9npy2c17.js +517 -0
  175. package/dist/chunk-9p6sec8n.js +34 -0
  176. package/dist/chunk-9pnym83h.js +4584 -0
  177. package/dist/chunk-9skwrnd2.js +25 -0
  178. package/dist/chunk-9tsfaqr8.js +459 -0
  179. package/dist/chunk-9tsw3cqv.js +5924 -0
  180. package/dist/chunk-9w6ckyk4.js +49 -0
  181. package/dist/chunk-a15bwzv6.js +147 -0
  182. package/dist/chunk-a9t6cp69.js +28 -0
  183. package/dist/chunk-ad2yk19p.js +102 -0
  184. package/dist/chunk-ad4cw4nw.js +336 -0
  185. package/dist/chunk-ad69fbsk.js +347 -0
  186. package/dist/chunk-ae76ded0.js +30 -0
  187. package/dist/chunk-aeysytks.js +216 -0
  188. package/dist/chunk-ag81m9bq.js +61 -0
  189. package/dist/chunk-ahx7gp6r.js +4448 -0
  190. package/dist/chunk-aj4tk4tk.js +23 -0
  191. package/dist/chunk-an82t9jc.js +104 -0
  192. package/dist/chunk-apg95qd7.js +1393 -0
  193. package/dist/chunk-aq5n2adz.js +27 -0
  194. package/dist/chunk-aw4s3a99.js +208 -0
  195. package/dist/chunk-awgdfggg.js +14 -0
  196. package/dist/chunk-ayymxgn1.js +164 -0
  197. package/dist/chunk-azbab59e.js +637 -0
  198. package/dist/chunk-azdxq2a3.js +293 -0
  199. package/dist/chunk-b0tjx3k1.js +523 -0
  200. package/dist/chunk-b5pp4g2g.js +371 -0
  201. package/dist/chunk-b5zm8dt6.js +26 -0
  202. package/dist/chunk-bcnye5a0.js +109 -0
  203. package/dist/chunk-beqz3k49.js +190 -0
  204. package/dist/chunk-bf906wpw.js +147 -0
  205. package/dist/chunk-bgan4cpf.js +13 -0
  206. package/dist/chunk-bhzp13h7.js +1178 -0
  207. package/dist/chunk-bk403kpw.js +142 -0
  208. package/dist/chunk-bmq4c135.js +489 -0
  209. package/dist/chunk-bprbeda7.js +35 -0
  210. package/dist/chunk-bst7czdd.js +888 -0
  211. package/dist/chunk-bths4xgn.js +111 -0
  212. package/dist/chunk-btjn3qby.js +13 -0
  213. package/dist/chunk-bwb1vxnt.js +120 -0
  214. package/dist/chunk-bxa6tw4m.js +643 -0
  215. package/dist/chunk-bxfjr8qb.js +27 -0
  216. package/dist/chunk-bxpzhrej.js +73 -0
  217. package/dist/chunk-bzyzrq0k.js +51 -0
  218. package/dist/chunk-c0k7b0jw.js +4265 -0
  219. package/dist/chunk-c17f0h2s.js +16 -0
  220. package/dist/chunk-c1yc761e.js +6748 -0
  221. package/dist/chunk-c5g9shkw.js +298 -0
  222. package/dist/chunk-c696122m.js +69 -0
  223. package/dist/chunk-c92b3yxx.js +109 -0
  224. package/dist/chunk-c9aqz56y.js +143 -0
  225. package/dist/chunk-cba7c5w3.js +345 -0
  226. package/dist/chunk-cbcxbbe6.js +6543 -0
  227. package/dist/chunk-cdfjb87h.js +11 -0
  228. package/dist/chunk-ce8zjt1y.js +136 -0
  229. package/dist/chunk-cep7e37k.js +22740 -0
  230. package/dist/chunk-chs5qm8d.js +258 -0
  231. package/dist/chunk-ckydq33g.js +144 -0
  232. package/dist/chunk-cnge6wpj.js +514 -0
  233. package/dist/chunk-cpnsvqf1.js +13 -0
  234. package/dist/chunk-cqqebkv4.js +32 -0
  235. package/dist/chunk-cvqpp7dk.js +627 -0
  236. package/dist/chunk-cwc33j40.js +65 -0
  237. package/dist/chunk-cypvrq2a.js +155 -0
  238. package/dist/chunk-d1ha0swn.js +475 -0
  239. package/dist/chunk-d2an0138.js +35 -0
  240. package/dist/chunk-d2tt72ck.js +343 -0
  241. package/dist/chunk-d6wvcqrw.js +9507 -0
  242. package/dist/chunk-d7ys2kka.js +991 -0
  243. package/dist/chunk-dbts5q5p.js +122 -0
  244. package/dist/chunk-dct29ggs.js +295 -0
  245. package/dist/chunk-de0qnnf7.js +1059 -0
  246. package/dist/chunk-dep72ce4.js +513 -0
  247. package/dist/chunk-dgpvgy8x.js +47 -0
  248. package/dist/chunk-dhhd7dtc.js +20 -0
  249. package/dist/chunk-dhzpmxv6.js +594 -0
  250. package/dist/chunk-djes4da7.js +413 -0
  251. package/dist/chunk-dnhv3vx7.js +166 -0
  252. package/dist/chunk-dqtvafan.js +2365 -0
  253. package/dist/chunk-dr4a3tcp.js +60 -0
  254. package/dist/chunk-dz2xk9kb.js +100 -0
  255. package/dist/chunk-dz7nc6rf.js +15 -0
  256. package/dist/chunk-e3abfxpy.js +1486 -0
  257. package/dist/chunk-e3cq9z89.js +85 -0
  258. package/dist/chunk-e3j7m7k2.js +642 -0
  259. package/dist/chunk-e4dsy4g1.js +9951 -0
  260. package/dist/chunk-e5592pnn.js +197 -0
  261. package/dist/chunk-e55hdegh.js +129 -0
  262. package/dist/chunk-e5r5r04e.js +1030 -0
  263. package/dist/chunk-e60zztbt.js +442 -0
  264. package/dist/chunk-e7qq6vn0.js +372 -0
  265. package/dist/chunk-e9aat7xw.js +80 -0
  266. package/dist/chunk-e9d5v3zs.js +143 -0
  267. package/dist/chunk-eax32zk4.js +87 -0
  268. package/dist/chunk-ebfwmbx1.js +117 -0
  269. package/dist/chunk-ec71pb8t.js +971 -0
  270. package/dist/chunk-eemjb825.js +17252 -0
  271. package/dist/chunk-ees8xdhd.js +256 -0
  272. package/dist/chunk-eewg66y1.js +112 -0
  273. package/dist/chunk-eg22v12d.js +266 -0
  274. package/dist/chunk-enzzk67f.js +313 -0
  275. package/dist/chunk-eskhp70f.js +117 -0
  276. package/dist/chunk-ewx6z4g8.js +55 -0
  277. package/dist/chunk-eyvx461k.js +76 -0
  278. package/dist/chunk-eztq2b5f.js +94 -0
  279. package/dist/chunk-f0ffwzdd.js +321 -0
  280. package/dist/chunk-f80n68mf.js +119 -0
  281. package/dist/chunk-fae2hjxp.js +99 -0
  282. package/dist/chunk-fbtfp370.js +60 -0
  283. package/dist/chunk-fc6ndtgf.js +94 -0
  284. package/dist/chunk-fdwabr8p.js +13870 -0
  285. package/dist/chunk-fejeqe61.js +785 -0
  286. package/dist/chunk-fh0d6mvk.js +168 -0
  287. package/dist/chunk-fh19zcaf.js +304 -0
  288. package/dist/chunk-fh8bd39r.js +186 -0
  289. package/dist/chunk-fj2ebbpn.js +33 -0
  290. package/dist/chunk-fjn632v7.js +194 -0
  291. package/dist/chunk-fncpkzs5.js +1389 -0
  292. package/dist/chunk-fpd1gpt8.js +332 -0
  293. package/dist/chunk-fq9snrnh.js +295 -0
  294. package/dist/chunk-fqcfzg3j.js +207 -0
  295. package/dist/chunk-ftt3vqj2.js +1919 -0
  296. package/dist/chunk-g06pm4n9.js +395 -0
  297. package/dist/chunk-g4m5pf4g.js +8 -0
  298. package/dist/chunk-g72h52y6.js +36 -0
  299. package/dist/chunk-g79ej71s.js +1627 -0
  300. package/dist/chunk-g7fwk59d.js +19 -0
  301. package/dist/chunk-g9jnkrtm.js +663 -0
  302. package/dist/chunk-g9vg5d7t.js +38 -0
  303. package/dist/chunk-ga1jkyqy.js +1636 -0
  304. package/dist/chunk-gaaap2nk.js +676 -0
  305. package/dist/chunk-gc6erq5q.js +483 -0
  306. package/dist/chunk-gjrcmf0a.js +752 -0
  307. package/dist/chunk-gmdy2w3z.js +238999 -0
  308. package/dist/chunk-gsz4yrrk.js +81 -0
  309. package/dist/chunk-gy47rjy8.js +3830 -0
  310. package/dist/chunk-h12a4f4x.js +11 -0
  311. package/dist/chunk-h1yratmg.js +725 -0
  312. package/dist/chunk-h9y0jnsy.js +155 -0
  313. package/dist/chunk-hbhs3mwy.js +133 -0
  314. package/dist/chunk-hbs8cmb4.js +8 -0
  315. package/dist/chunk-hdk0t1ht.js +940 -0
  316. package/dist/chunk-hef8dx4s.js +178 -0
  317. package/dist/chunk-hgsca8mt.js +381 -0
  318. package/dist/chunk-hhsxm2yr.js +67 -0
  319. package/dist/chunk-hj5tzzpd.js +39 -0
  320. package/dist/chunk-hjxqmtg5.js +94 -0
  321. package/dist/chunk-hn4w9pkj.js +68 -0
  322. package/dist/chunk-hnprkjgp.js +25 -0
  323. package/dist/chunk-hq3n5ex7.js +183 -0
  324. package/dist/chunk-hqjspfma.js +158 -0
  325. package/dist/chunk-hqxp6b72.js +1198 -0
  326. package/dist/chunk-hs6nrmq6.js +94 -0
  327. package/dist/chunk-hwba5xdc.js +267 -0
  328. package/dist/chunk-hy566ev3.js +430 -0
  329. package/dist/chunk-hzmzwte2.js +153 -0
  330. package/dist/chunk-hzxzvzw8.js +274 -0
  331. package/dist/chunk-j139fzgs.js +114 -0
  332. package/dist/chunk-j1mep9ck.js +62 -0
  333. package/dist/chunk-j3xveeg4.js +273 -0
  334. package/dist/chunk-j5y1s11j.js +100 -0
  335. package/dist/chunk-j9475b46.js +26 -0
  336. package/dist/chunk-j9rgqs8m.js +1192 -0
  337. package/dist/chunk-jccjaddz.js +74 -0
  338. package/dist/chunk-jdkwfy9e.js +35 -0
  339. package/dist/chunk-jdqp0r4h.js +6157 -0
  340. package/dist/chunk-jdzk4zwn.js +587 -0
  341. package/dist/chunk-jfafmkte.js +49 -0
  342. package/dist/chunk-jg3r989b.js +16 -0
  343. package/dist/chunk-jhtccjc9.js +54 -0
  344. package/dist/chunk-jj2ff1pr.js +688 -0
  345. package/dist/chunk-jmv7k0jn.js +37 -0
  346. package/dist/chunk-jmxzmwpw.js +65 -0
  347. package/dist/chunk-jnjxdqyr.js +353 -0
  348. package/dist/chunk-jsbbez9j.js +138 -0
  349. package/dist/chunk-jvpt2dc0.js +424 -0
  350. package/dist/chunk-jwd7cka0.js +34 -0
  351. package/dist/chunk-jy5er3st.js +15 -0
  352. package/dist/chunk-jyby79z5.js +121 -0
  353. package/dist/chunk-jzyr6j5n.js +332 -0
  354. package/dist/chunk-k49xc781.js +63 -0
  355. package/dist/chunk-k7dt2g4a.js +41 -0
  356. package/dist/chunk-k7hexw3v.js +969 -0
  357. package/dist/chunk-k7wwkraa.js +117 -0
  358. package/dist/chunk-kb3758f7.js +51 -0
  359. package/dist/chunk-kc67kt75.js +3119 -0
  360. package/dist/chunk-kdhmfxmh.js +3149 -0
  361. package/dist/chunk-kejdd6zc.js +51 -0
  362. package/dist/chunk-kekrjeem.js +402 -0
  363. package/dist/chunk-kez5r0zz.js +280 -0
  364. package/dist/chunk-kfsvcs5t.js +75 -0
  365. package/dist/chunk-khtvffc4.js +285 -0
  366. package/dist/chunk-kkz4w1tv.js +64 -0
  367. package/dist/chunk-kmywng0j.js +272 -0
  368. package/dist/chunk-kq6vcpdr.js +224 -0
  369. package/dist/chunk-kqzdszcc.js +37 -0
  370. package/dist/chunk-ktxpp02w.js +435 -0
  371. package/dist/chunk-kwcvhbtz.js +26 -0
  372. package/dist/chunk-kx0cm9qr.js +128 -0
  373. package/dist/chunk-kxcmqz10.js +120 -0
  374. package/dist/chunk-kxwava1g.js +14 -0
  375. package/dist/chunk-kywtr3jg.js +825 -0
  376. package/dist/chunk-kzwg923p.js +8 -0
  377. package/dist/chunk-m1eq3sgv.js +255 -0
  378. package/dist/chunk-m21h5zb4.js +119 -0
  379. package/dist/chunk-m2c3bjv1.js +111 -0
  380. package/dist/chunk-m41e19ms.js +42 -0
  381. package/dist/chunk-m7ka36ex.js +97 -0
  382. package/dist/chunk-m81w8tbm.js +259 -0
  383. package/dist/chunk-m95ggkax.js +281 -0
  384. package/dist/chunk-manx26xa.js +145 -0
  385. package/dist/chunk-mdxh3pk2.js +298 -0
  386. package/dist/chunk-mhbfkcja.js +311 -0
  387. package/dist/chunk-mjnr5erm.js +173 -0
  388. package/dist/chunk-mngvnmwp.js +135 -0
  389. package/dist/chunk-mvfqanv5.js +63 -0
  390. package/dist/chunk-mw1nesq1.js +140 -0
  391. package/dist/chunk-mx168925.js +661 -0
  392. package/dist/chunk-mxwvj18g.js +795 -0
  393. package/dist/chunk-my7r5mba.js +257 -0
  394. package/dist/chunk-myaa1kkf.js +17 -0
  395. package/dist/chunk-myypc3tn.js +46 -0
  396. package/dist/chunk-mzcnmnpq.js +3379 -0
  397. package/dist/chunk-mznav6d1.js +194 -0
  398. package/dist/chunk-n0qxskpr.js +24 -0
  399. package/dist/chunk-n6a6hgtp.js +394 -0
  400. package/dist/chunk-n6d5fgx0.js +254 -0
  401. package/dist/chunk-n6ym3n03.js +120 -0
  402. package/dist/chunk-n9g24mwe.js +104 -0
  403. package/dist/chunk-naamqdf9.js +185 -0
  404. package/dist/chunk-nb2jk7zj.js +15 -0
  405. package/dist/chunk-nbkbq9en.js +67 -0
  406. package/dist/chunk-ndttd6es.js +38 -0
  407. package/dist/chunk-nfygaaxg.js +133 -0
  408. package/dist/chunk-ngdzpszd.js +454 -0
  409. package/dist/chunk-nmfwksa4.js +1297 -0
  410. package/dist/chunk-nt837qt9.js +21 -0
  411. package/dist/chunk-nwc3v0vp.js +691 -0
  412. package/dist/chunk-nz8ha95p.js +3610 -0
  413. package/dist/chunk-nzxfj0gq.js +2007 -0
  414. package/dist/chunk-p0r8887g.js +6932 -0
  415. package/dist/chunk-p1seyqdm.js +120 -0
  416. package/dist/chunk-p425zbgw.js +726 -0
  417. package/dist/chunk-p7hamd2c.js +146 -0
  418. package/dist/chunk-pdvg91cg.js +32 -0
  419. package/dist/chunk-pecy49yr.js +14649 -0
  420. package/dist/chunk-pfxrg89f.js +547 -0
  421. package/dist/chunk-pfyw3155.js +2750 -0
  422. package/dist/chunk-pr8m11pm.js +1192 -0
  423. package/dist/chunk-ptxteaeh.js +1591 -0
  424. package/dist/chunk-pv164mac.js +394 -0
  425. package/dist/chunk-pxxhtxf5.js +10154 -0
  426. package/dist/chunk-q0e485mg.js +61 -0
  427. package/dist/chunk-q1vrhh0q.js +458 -0
  428. package/dist/chunk-q2h79ncs.js +370 -0
  429. package/dist/chunk-q3b4n194.js +56 -0
  430. package/dist/chunk-q44zc68f.js +4301 -0
  431. package/dist/chunk-q8gknbdx.js +352 -0
  432. package/dist/chunk-q8xk3kdj.js +11 -0
  433. package/dist/chunk-qak46xtp.js +119 -0
  434. package/dist/chunk-qfq7absv.js +95 -0
  435. package/dist/chunk-qfsn720k.js +151 -0
  436. package/dist/chunk-qg4811f6.js +228 -0
  437. package/dist/chunk-qgzn3qps.js +90 -0
  438. package/dist/chunk-qhaggqkt.js +113 -0
  439. package/dist/chunk-qjjp27z8.js +195 -0
  440. package/dist/chunk-qxp0nye6.js +34 -0
  441. package/dist/chunk-qy3nagaq.js +4957 -0
  442. package/dist/chunk-qz2meav1.js +1452 -0
  443. package/dist/chunk-r50hne7m.js +63 -0
  444. package/dist/chunk-r6m0vgnv.js +80 -0
  445. package/dist/chunk-r7yw38vf.js +22864 -0
  446. package/dist/chunk-r8xc618w.js +42 -0
  447. package/dist/chunk-r961r5kj.js +87 -0
  448. package/dist/chunk-r9b5xrh0.js +66 -0
  449. package/dist/chunk-rcn2pd6q.js +477 -0
  450. package/dist/chunk-rdeh8p3y.js +148 -0
  451. package/dist/chunk-rg9x1742.js +542 -0
  452. package/dist/chunk-rgyzsbs3.js +39 -0
  453. package/dist/chunk-rk2fsxtz.js +16 -0
  454. package/dist/chunk-rkchkwv9.js +40 -0
  455. package/dist/chunk-rp8whpb3.js +478 -0
  456. package/dist/chunk-rpkxdtgr.js +68 -0
  457. package/dist/chunk-rpmntgyh.js +394 -0
  458. package/dist/chunk-rpshz4dy.js +614 -0
  459. package/dist/chunk-rqd60ay5.js +133 -0
  460. package/dist/chunk-rrsjf2ea.js +229 -0
  461. package/dist/chunk-rtjk8c8e.js +173 -0
  462. package/dist/chunk-rw0y2wdf.js +1017 -0
  463. package/dist/chunk-rx5w7ess.js +663 -0
  464. package/dist/chunk-rx8t9d35.js +1947 -0
  465. package/dist/chunk-rxcazxgf.js +195 -0
  466. package/dist/chunk-rxg6q3bp.js +1413 -0
  467. package/dist/chunk-rxrb7xnd.js +71 -0
  468. package/dist/chunk-rxrzxff3.js +118 -0
  469. package/dist/chunk-ryqjc943.js +71 -0
  470. package/dist/chunk-rzk9k2rf.js +81 -0
  471. package/dist/chunk-s2qv0nht.js +119 -0
  472. package/dist/chunk-s3hafnk3.js +2285 -0
  473. package/dist/chunk-s4a496tt.js +226 -0
  474. package/dist/chunk-s4d1h3ka.js +35 -0
  475. package/dist/chunk-sm3k3ze4.js +16525 -0
  476. package/dist/chunk-sn0bja82.js +385 -0
  477. package/dist/chunk-sngjggw1.js +4227 -0
  478. package/dist/chunk-sq047n34.js +364 -0
  479. package/dist/chunk-sttwe2tw.js +8584 -0
  480. package/dist/chunk-sw8qx1r0.js +86 -0
  481. package/dist/chunk-swstah6a.js +240 -0
  482. package/dist/chunk-syrkr0mf.js +63 -0
  483. package/dist/chunk-sz206bd9.js +26 -0
  484. package/dist/chunk-t09669cj.js +333 -0
  485. package/dist/chunk-t5f8e30k.js +602 -0
  486. package/dist/chunk-t5m78mc8.js +432 -0
  487. package/dist/chunk-t5x1dqwn.js +143 -0
  488. package/dist/chunk-t877ea0w.js +168 -0
  489. package/dist/chunk-t91hb71c.js +17 -0
  490. package/dist/chunk-tb636bcf.js +942 -0
  491. package/dist/chunk-tb8sykbr.js +426 -0
  492. package/dist/chunk-tbdkekz3.js +125 -0
  493. package/dist/chunk-td2gsz7s.js +225 -0
  494. package/dist/chunk-tenvxbyh.js +20 -0
  495. package/dist/chunk-texg4qqt.js +317 -0
  496. package/dist/chunk-teymzz80.js +266 -0
  497. package/dist/chunk-tj26qpf7.js +153 -0
  498. package/dist/chunk-tk85ec4p.js +395 -0
  499. package/dist/chunk-tq205h01.js +164 -0
  500. package/dist/chunk-tqzddjzg.js +61 -0
  501. package/dist/chunk-trqrj23e.js +134 -0
  502. package/dist/chunk-tw1hfsxv.js +2477 -0
  503. package/dist/chunk-txxdfq83.js +122 -0
  504. package/dist/chunk-v0yhe582.js +31 -0
  505. package/dist/chunk-v14184xm.js +15 -0
  506. package/dist/chunk-v1h9z4hw.js +138 -0
  507. package/dist/chunk-v3ey5j7f.js +329 -0
  508. package/dist/chunk-v3nh1sfn.js +208 -0
  509. package/dist/chunk-v3x8tcc0.js +45 -0
  510. package/dist/chunk-v4nqnvqq.js +3984 -0
  511. package/dist/chunk-v4ypszbb.js +15 -0
  512. package/dist/chunk-v7wbqcx9.js +63 -0
  513. package/dist/chunk-v8r5fev3.js +341 -0
  514. package/dist/chunk-v9zg5kzx.js +2810 -0
  515. package/dist/chunk-va1wh5ss.js +24 -0
  516. package/dist/chunk-vbfswhht.js +42 -0
  517. package/dist/chunk-ve7x2tfq.js +124 -0
  518. package/dist/chunk-vfz8k89y.js +485 -0
  519. package/dist/chunk-vgm5k14x.js +35678 -0
  520. package/dist/chunk-vh9pej3c.js +247 -0
  521. package/dist/chunk-vjxqyt6f.js +3820 -0
  522. package/dist/chunk-vpb1xstn.js +178 -0
  523. package/dist/chunk-vqt79tj8.js +110 -0
  524. package/dist/chunk-vr0n9pv9.js +152 -0
  525. package/dist/chunk-vrejmja5.js +90 -0
  526. package/dist/chunk-vrxasmdw.js +449 -0
  527. package/dist/chunk-vrxb946v.js +125 -0
  528. package/dist/chunk-vv4kj0q8.js +98 -0
  529. package/dist/chunk-vvpfng7w.js +8 -0
  530. package/dist/chunk-vw6ybyew.js +2007 -0
  531. package/dist/chunk-vwenx8ke.js +17 -0
  532. package/dist/chunk-vwfa0s5a.js +155 -0
  533. package/dist/chunk-vx71j8xe.js +63 -0
  534. package/dist/chunk-vxbjzggp.js +43 -0
  535. package/dist/chunk-vxjxtz8w.js +440 -0
  536. package/dist/chunk-vy0c1bwp.js +9 -0
  537. package/dist/chunk-w3zczyse.js +14 -0
  538. package/dist/chunk-w4p5t920.js +655 -0
  539. package/dist/chunk-w68wc625.js +287 -0
  540. package/dist/chunk-w9ddp3yf.js +96 -0
  541. package/dist/chunk-wcggm5ja.js +125 -0
  542. package/dist/chunk-wgnyph3q.js +1306 -0
  543. package/dist/chunk-wjm5pc1e.js +134 -0
  544. package/dist/chunk-wnve0drm.js +131 -0
  545. package/dist/chunk-wp27ev2k.js +135 -0
  546. package/dist/chunk-wyvy8a4x.js +131 -0
  547. package/dist/chunk-x671y4dk.js +129 -0
  548. package/dist/chunk-xbj5keyy.js +22 -0
  549. package/dist/chunk-xf4fzms8.js +39 -0
  550. package/dist/chunk-xf59k3zg.js +65 -0
  551. package/dist/chunk-xgzc4w49.js +204 -0
  552. package/dist/chunk-xhj7g13b.js +2149 -0
  553. package/dist/chunk-xjp0cd00.js +56 -0
  554. package/dist/chunk-xkhnmhqs.js +74 -0
  555. package/dist/chunk-xkrkqx61.js +55 -0
  556. package/dist/chunk-xmpgmeb8.js +114 -0
  557. package/dist/chunk-xrw80zgd.js +4249 -0
  558. package/dist/chunk-xrzc96g0.js +202 -0
  559. package/dist/chunk-xt76sm44.js +318 -0
  560. package/dist/chunk-xwet3awb.js +20 -0
  561. package/dist/chunk-xyg1sk2w.js +78 -0
  562. package/dist/chunk-y0jpkqb0.js +180 -0
  563. package/dist/chunk-y1q7rt9n.js +102 -0
  564. package/dist/chunk-y67ntyek.js +258 -0
  565. package/dist/chunk-ybk37qp9.js +37 -0
  566. package/dist/chunk-yc1stfve.js +5386 -0
  567. package/dist/chunk-ychjpjef.js +62 -0
  568. package/dist/chunk-yez8fa9g.js +276 -0
  569. package/dist/chunk-ygm7xszr.js +90 -0
  570. package/dist/chunk-ym11azkj.js +37 -0
  571. package/dist/chunk-ympz2h15.js +578 -0
  572. package/dist/chunk-yqx3az3n.js +129 -0
  573. package/dist/chunk-yt3nfhcc.js +152 -0
  574. package/dist/chunk-yy8q0n8s.js +120 -0
  575. package/dist/chunk-yzb92zxv.js +8 -0
  576. package/dist/chunk-yzet6xyr.js +119 -0
  577. package/dist/chunk-yzm97qp1.js +226 -0
  578. package/dist/chunk-z0jgeax8.js +35 -0
  579. package/dist/chunk-z1r3z6w6.js +29 -0
  580. package/dist/chunk-z2dp53wn.js +17 -0
  581. package/dist/chunk-z79355gz.js +308 -0
  582. package/dist/chunk-z7e94hxz.js +251 -0
  583. package/dist/chunk-z8cqdcec.js +173 -0
  584. package/dist/chunk-z99tbg45.js +148 -0
  585. package/dist/chunk-z9nsjcht.js +37 -0
  586. package/dist/chunk-za3k6h2h.js +470 -0
  587. package/dist/chunk-zacynq5p.js +265 -0
  588. package/dist/chunk-zb0x40az.js +1785 -0
  589. package/dist/chunk-zbxtzycc.js +274 -0
  590. package/dist/chunk-zga50181.js +342 -0
  591. package/dist/chunk-zhb2pns1.js +44 -0
  592. package/dist/chunk-zkch6trx.js +231 -0
  593. package/dist/chunk-znf3z4qt.js +954 -0
  594. package/dist/chunk-zp8zwdgq.js +72 -0
  595. package/dist/chunk-ztjd8pyf.js +120 -0
  596. package/dist/chunk-ztmb7geg.js +173 -0
  597. package/dist/chunk-zvr4snzv.js +887 -0
  598. package/dist/chunk-zw62m6n3.js +34858 -0
  599. package/dist/chunk-zwwdebd0.js +65 -0
  600. package/dist/chunk-zxc6x9w8.js +340 -0
  601. package/dist/chunk-zy2e7sz0.js +8 -0
  602. package/dist/chunk-zzf074w3.js +196 -0
  603. package/dist/chunk-zzz0nwb5.js +310 -0
  604. package/dist/cli-bun.js +2 -0
  605. package/dist/cli-node.js +2 -0
  606. package/dist/cli.js +218 -0
  607. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  608. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  609. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  610. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  611. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  612. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  613. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  614. package/package.json +243 -0
  615. package/scripts/chrome-mcp-bridge-resolver.mjs +43 -0
  616. package/scripts/chrome-mcp-env.mjs +19 -0
  617. package/scripts/postinstall.cjs +339 -0
  618. package/scripts/run-parallel.mjs +10 -0
  619. package/scripts/setup-chrome-mcp.mjs +69 -0
@@ -0,0 +1,3820 @@
1
+ // @bun
2
+ import {
3
+ require_dist_cjs as require_dist_cjs4,
4
+ require_dist_cjs1 as require_dist_cjs5,
5
+ require_dist_cjs2 as require_dist_cjs8,
6
+ require_dist_cjs3 as require_dist_cjs9,
7
+ require_dist_cjs4 as require_dist_cjs10
8
+ } from "./chunk-d7ys2kka.js";
9
+ import {
10
+ require_dist_cjs1 as require_dist_cjs2
11
+ } from "./chunk-4yjskjb6.js";
12
+ import {
13
+ require_dist_cjs
14
+ } from "./chunk-fh0d6mvk.js";
15
+ import {
16
+ require_dist_cjs as require_dist_cjs3
17
+ } from "./chunk-xkrkqx61.js";
18
+ import {
19
+ require_dist_cjs1 as require_dist_cjs6,
20
+ require_dist_cjs2 as require_dist_cjs7
21
+ } from "./chunk-v7wbqcx9.js";
22
+ import {
23
+ __commonJS,
24
+ __require
25
+ } from "./chunk-hhsxm2yr.js";
26
+
27
+ // node_modules/.bun/@smithy+core@3.23.17/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js
28
+ var require_endpoints = __commonJS((exports) => {
29
+ var urlParser = require_dist_cjs3();
30
+ var toEndpointV1 = (endpoint) => {
31
+ if (typeof endpoint === "object") {
32
+ if ("url" in endpoint) {
33
+ const v1Endpoint = urlParser.parseUrl(endpoint.url);
34
+ if (endpoint.headers) {
35
+ v1Endpoint.headers = {};
36
+ for (const name in endpoint.headers) {
37
+ v1Endpoint.headers[name.toLowerCase()] = endpoint.headers[name].join(", ");
38
+ }
39
+ }
40
+ return v1Endpoint;
41
+ }
42
+ return endpoint;
43
+ }
44
+ return urlParser.parseUrl(endpoint);
45
+ };
46
+ exports.toEndpointV1 = toEndpointV1;
47
+ });
48
+
49
+ // node_modules/.bun/@smithy+core@3.23.17/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js
50
+ var require_schema = __commonJS((exports) => {
51
+ var protocolHttp = require_dist_cjs();
52
+ var utilMiddleware = require_dist_cjs4();
53
+ var endpoints = require_endpoints();
54
+ var deref = (schemaRef) => {
55
+ if (typeof schemaRef === "function") {
56
+ return schemaRef();
57
+ }
58
+ return schemaRef;
59
+ };
60
+ var operation = (namespace, name, traits, input, output) => ({
61
+ name,
62
+ namespace,
63
+ traits,
64
+ input,
65
+ output
66
+ });
67
+ var schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
68
+ const { response } = await next(args);
69
+ const { operationSchema } = utilMiddleware.getSmithyContext(context);
70
+ const [, ns, n, t, i, o] = operationSchema ?? [];
71
+ try {
72
+ const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
73
+ ...config,
74
+ ...context
75
+ }, response);
76
+ return {
77
+ response,
78
+ output: parsed
79
+ };
80
+ } catch (error2) {
81
+ Object.defineProperty(error2, "$response", {
82
+ value: response,
83
+ enumerable: false,
84
+ writable: false,
85
+ configurable: false
86
+ });
87
+ if (!("$metadata" in error2)) {
88
+ const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
89
+ try {
90
+ error2.message += `
91
+ ` + hint;
92
+ } catch (e) {
93
+ if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
94
+ console.warn(hint);
95
+ } else {
96
+ context.logger?.warn?.(hint);
97
+ }
98
+ }
99
+ if (typeof error2.$responseBodyText !== "undefined") {
100
+ if (error2.$response) {
101
+ error2.$response.body = error2.$responseBodyText;
102
+ }
103
+ }
104
+ try {
105
+ if (protocolHttp.HttpResponse.isInstance(response)) {
106
+ const { headers = {} } = response;
107
+ const headerEntries = Object.entries(headers);
108
+ error2.$metadata = {
109
+ httpStatusCode: response.statusCode,
110
+ requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
111
+ extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
112
+ cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
113
+ };
114
+ }
115
+ } catch (e) {}
116
+ }
117
+ throw error2;
118
+ }
119
+ };
120
+ var findHeader = (pattern, headers) => {
121
+ return (headers.find(([k]) => {
122
+ return k.match(pattern);
123
+ }) || [undefined, undefined])[1];
124
+ };
125
+ var schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
126
+ const { operationSchema } = utilMiddleware.getSmithyContext(context);
127
+ const [, ns, n, t, i, o] = operationSchema ?? [];
128
+ const endpoint = context.endpointV2 ? async () => endpoints.toEndpointV1(context.endpointV2) : config.endpoint;
129
+ const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
130
+ ...config,
131
+ ...context,
132
+ endpoint
133
+ });
134
+ return next({
135
+ ...args,
136
+ request
137
+ });
138
+ };
139
+ var deserializerMiddlewareOption = {
140
+ name: "deserializerMiddleware",
141
+ step: "deserialize",
142
+ tags: ["DESERIALIZER"],
143
+ override: true
144
+ };
145
+ var serializerMiddlewareOption = {
146
+ name: "serializerMiddleware",
147
+ step: "serialize",
148
+ tags: ["SERIALIZER"],
149
+ override: true
150
+ };
151
+ function getSchemaSerdePlugin(config) {
152
+ return {
153
+ applyToStack: (commandStack) => {
154
+ commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
155
+ commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
156
+ config.protocol.setSerdeContext(config);
157
+ }
158
+ };
159
+ }
160
+
161
+ class Schema {
162
+ name;
163
+ namespace;
164
+ traits;
165
+ static assign(instance, values) {
166
+ const schema = Object.assign(instance, values);
167
+ return schema;
168
+ }
169
+ static [Symbol.hasInstance](lhs) {
170
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
171
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
172
+ const list2 = lhs;
173
+ return list2.symbol === this.symbol;
174
+ }
175
+ return isPrototype;
176
+ }
177
+ getName() {
178
+ return this.namespace + "#" + this.name;
179
+ }
180
+ }
181
+
182
+ class ListSchema extends Schema {
183
+ static symbol = Symbol.for("@smithy/lis");
184
+ name;
185
+ traits;
186
+ valueSchema;
187
+ symbol = ListSchema.symbol;
188
+ }
189
+ var list = (namespace, name, traits, valueSchema) => Schema.assign(new ListSchema, {
190
+ name,
191
+ namespace,
192
+ traits,
193
+ valueSchema
194
+ });
195
+
196
+ class MapSchema extends Schema {
197
+ static symbol = Symbol.for("@smithy/map");
198
+ name;
199
+ traits;
200
+ keySchema;
201
+ valueSchema;
202
+ symbol = MapSchema.symbol;
203
+ }
204
+ var map = (namespace, name, traits, keySchema, valueSchema) => Schema.assign(new MapSchema, {
205
+ name,
206
+ namespace,
207
+ traits,
208
+ keySchema,
209
+ valueSchema
210
+ });
211
+
212
+ class OperationSchema extends Schema {
213
+ static symbol = Symbol.for("@smithy/ope");
214
+ name;
215
+ traits;
216
+ input;
217
+ output;
218
+ symbol = OperationSchema.symbol;
219
+ }
220
+ var op = (namespace, name, traits, input, output) => Schema.assign(new OperationSchema, {
221
+ name,
222
+ namespace,
223
+ traits,
224
+ input,
225
+ output
226
+ });
227
+
228
+ class StructureSchema extends Schema {
229
+ static symbol = Symbol.for("@smithy/str");
230
+ name;
231
+ traits;
232
+ memberNames;
233
+ memberList;
234
+ symbol = StructureSchema.symbol;
235
+ }
236
+ var struct = (namespace, name, traits, memberNames, memberList) => Schema.assign(new StructureSchema, {
237
+ name,
238
+ namespace,
239
+ traits,
240
+ memberNames,
241
+ memberList
242
+ });
243
+
244
+ class ErrorSchema extends StructureSchema {
245
+ static symbol = Symbol.for("@smithy/err");
246
+ ctor;
247
+ symbol = ErrorSchema.symbol;
248
+ }
249
+ var error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema, {
250
+ name,
251
+ namespace,
252
+ traits,
253
+ memberNames,
254
+ memberList,
255
+ ctor: null
256
+ });
257
+ var traitsCache = [];
258
+ function translateTraits(indicator) {
259
+ if (typeof indicator === "object") {
260
+ return indicator;
261
+ }
262
+ indicator = indicator | 0;
263
+ if (traitsCache[indicator]) {
264
+ return traitsCache[indicator];
265
+ }
266
+ const traits = {};
267
+ let i = 0;
268
+ for (const trait of [
269
+ "httpLabel",
270
+ "idempotent",
271
+ "idempotencyToken",
272
+ "sensitive",
273
+ "httpPayload",
274
+ "httpResponseCode",
275
+ "httpQueryParams"
276
+ ]) {
277
+ if ((indicator >> i++ & 1) === 1) {
278
+ traits[trait] = 1;
279
+ }
280
+ }
281
+ return traitsCache[indicator] = traits;
282
+ }
283
+ var anno = {
284
+ it: Symbol.for("@smithy/nor-struct-it"),
285
+ ns: Symbol.for("@smithy/ns")
286
+ };
287
+ var simpleSchemaCacheN = [];
288
+ var simpleSchemaCacheS = {};
289
+
290
+ class NormalizedSchema {
291
+ ref;
292
+ memberName;
293
+ static symbol = Symbol.for("@smithy/nor");
294
+ symbol = NormalizedSchema.symbol;
295
+ name;
296
+ schema;
297
+ _isMemberSchema;
298
+ traits;
299
+ memberTraits;
300
+ normalizedTraits;
301
+ constructor(ref, memberName) {
302
+ this.ref = ref;
303
+ this.memberName = memberName;
304
+ const traitStack = [];
305
+ let _ref = ref;
306
+ let schema = ref;
307
+ this._isMemberSchema = false;
308
+ while (isMemberSchema(_ref)) {
309
+ traitStack.push(_ref[1]);
310
+ _ref = _ref[0];
311
+ schema = deref(_ref);
312
+ this._isMemberSchema = true;
313
+ }
314
+ if (traitStack.length > 0) {
315
+ this.memberTraits = {};
316
+ for (let i = traitStack.length - 1;i >= 0; --i) {
317
+ const traitSet = traitStack[i];
318
+ Object.assign(this.memberTraits, translateTraits(traitSet));
319
+ }
320
+ } else {
321
+ this.memberTraits = 0;
322
+ }
323
+ if (schema instanceof NormalizedSchema) {
324
+ const computedMemberTraits = this.memberTraits;
325
+ Object.assign(this, schema);
326
+ this.memberTraits = Object.assign({}, computedMemberTraits, schema.getMemberTraits(), this.getMemberTraits());
327
+ this.normalizedTraits = undefined;
328
+ this.memberName = memberName ?? schema.memberName;
329
+ return;
330
+ }
331
+ this.schema = deref(schema);
332
+ if (isStaticSchema(this.schema)) {
333
+ this.name = `${this.schema[1]}#${this.schema[2]}`;
334
+ this.traits = this.schema[3];
335
+ } else {
336
+ this.name = this.memberName ?? String(schema);
337
+ this.traits = 0;
338
+ }
339
+ if (this._isMemberSchema && !memberName) {
340
+ throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
341
+ }
342
+ }
343
+ static [Symbol.hasInstance](lhs) {
344
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
345
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
346
+ const ns = lhs;
347
+ return ns.symbol === this.symbol;
348
+ }
349
+ return isPrototype;
350
+ }
351
+ static of(ref) {
352
+ const keyAble = typeof ref === "function" || typeof ref === "object" && ref !== null;
353
+ if (typeof ref === "number") {
354
+ if (simpleSchemaCacheN[ref]) {
355
+ return simpleSchemaCacheN[ref];
356
+ }
357
+ } else if (typeof ref === "string") {
358
+ if (simpleSchemaCacheS[ref]) {
359
+ return simpleSchemaCacheS[ref];
360
+ }
361
+ } else if (keyAble) {
362
+ if (ref[anno.ns]) {
363
+ return ref[anno.ns];
364
+ }
365
+ }
366
+ const sc = deref(ref);
367
+ if (sc instanceof NormalizedSchema) {
368
+ return sc;
369
+ }
370
+ if (isMemberSchema(sc)) {
371
+ const [ns2, traits] = sc;
372
+ if (ns2 instanceof NormalizedSchema) {
373
+ Object.assign(ns2.getMergedTraits(), translateTraits(traits));
374
+ return ns2;
375
+ }
376
+ throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
377
+ }
378
+ const ns = new NormalizedSchema(sc);
379
+ if (keyAble) {
380
+ return ref[anno.ns] = ns;
381
+ }
382
+ if (typeof sc === "string") {
383
+ return simpleSchemaCacheS[sc] = ns;
384
+ }
385
+ if (typeof sc === "number") {
386
+ return simpleSchemaCacheN[sc] = ns;
387
+ }
388
+ return ns;
389
+ }
390
+ getSchema() {
391
+ const sc = this.schema;
392
+ if (Array.isArray(sc) && sc[0] === 0) {
393
+ return sc[4];
394
+ }
395
+ return sc;
396
+ }
397
+ getName(withNamespace = false) {
398
+ const { name } = this;
399
+ const short = !withNamespace && name && name.includes("#");
400
+ return short ? name.split("#")[1] : name || undefined;
401
+ }
402
+ getMemberName() {
403
+ return this.memberName;
404
+ }
405
+ isMemberSchema() {
406
+ return this._isMemberSchema;
407
+ }
408
+ isListSchema() {
409
+ const sc = this.getSchema();
410
+ return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
411
+ }
412
+ isMapSchema() {
413
+ const sc = this.getSchema();
414
+ return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
415
+ }
416
+ isStructSchema() {
417
+ const sc = this.getSchema();
418
+ if (typeof sc !== "object") {
419
+ return false;
420
+ }
421
+ const id = sc[0];
422
+ return id === 3 || id === -3 || id === 4;
423
+ }
424
+ isUnionSchema() {
425
+ const sc = this.getSchema();
426
+ if (typeof sc !== "object") {
427
+ return false;
428
+ }
429
+ return sc[0] === 4;
430
+ }
431
+ isBlobSchema() {
432
+ const sc = this.getSchema();
433
+ return sc === 21 || sc === 42;
434
+ }
435
+ isTimestampSchema() {
436
+ const sc = this.getSchema();
437
+ return typeof sc === "number" && sc >= 4 && sc <= 7;
438
+ }
439
+ isUnitSchema() {
440
+ return this.getSchema() === "unit";
441
+ }
442
+ isDocumentSchema() {
443
+ return this.getSchema() === 15;
444
+ }
445
+ isStringSchema() {
446
+ return this.getSchema() === 0;
447
+ }
448
+ isBooleanSchema() {
449
+ return this.getSchema() === 2;
450
+ }
451
+ isNumericSchema() {
452
+ return this.getSchema() === 1;
453
+ }
454
+ isBigIntegerSchema() {
455
+ return this.getSchema() === 17;
456
+ }
457
+ isBigDecimalSchema() {
458
+ return this.getSchema() === 19;
459
+ }
460
+ isStreaming() {
461
+ const { streaming } = this.getMergedTraits();
462
+ return !!streaming || this.getSchema() === 42;
463
+ }
464
+ isIdempotencyToken() {
465
+ return !!this.getMergedTraits().idempotencyToken;
466
+ }
467
+ getMergedTraits() {
468
+ return this.normalizedTraits ?? (this.normalizedTraits = {
469
+ ...this.getOwnTraits(),
470
+ ...this.getMemberTraits()
471
+ });
472
+ }
473
+ getMemberTraits() {
474
+ return translateTraits(this.memberTraits);
475
+ }
476
+ getOwnTraits() {
477
+ return translateTraits(this.traits);
478
+ }
479
+ getKeySchema() {
480
+ const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
481
+ if (!isDoc && !isMap) {
482
+ throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
483
+ }
484
+ const schema = this.getSchema();
485
+ const memberSchema = isDoc ? 15 : schema[4] ?? 0;
486
+ return member([memberSchema, 0], "key");
487
+ }
488
+ getValueSchema() {
489
+ const sc = this.getSchema();
490
+ const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
491
+ const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap || isList) ? sc[3 + sc[0]] : isDoc ? 15 : undefined;
492
+ if (memberSchema != null) {
493
+ return member([memberSchema, 0], isMap ? "value" : "member");
494
+ }
495
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
496
+ }
497
+ getMemberSchema(memberName) {
498
+ const struct2 = this.getSchema();
499
+ if (this.isStructSchema() && struct2[4].includes(memberName)) {
500
+ const i = struct2[4].indexOf(memberName);
501
+ const memberSchema = struct2[5][i];
502
+ return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
503
+ }
504
+ if (this.isDocumentSchema()) {
505
+ return member([15, 0], memberName);
506
+ }
507
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${memberName}.`);
508
+ }
509
+ getMemberSchemas() {
510
+ const buffer = {};
511
+ try {
512
+ for (const [k, v] of this.structIterator()) {
513
+ buffer[k] = v;
514
+ }
515
+ } catch (ignored) {}
516
+ return buffer;
517
+ }
518
+ getEventStreamMember() {
519
+ if (this.isStructSchema()) {
520
+ for (const [memberName, memberSchema] of this.structIterator()) {
521
+ if (memberSchema.isStreaming() && memberSchema.isStructSchema()) {
522
+ return memberName;
523
+ }
524
+ }
525
+ }
526
+ return "";
527
+ }
528
+ *structIterator() {
529
+ if (this.isUnitSchema()) {
530
+ return;
531
+ }
532
+ if (!this.isStructSchema()) {
533
+ throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
534
+ }
535
+ const struct2 = this.getSchema();
536
+ const z = struct2[4].length;
537
+ let it = struct2[anno.it];
538
+ if (it && z === it.length) {
539
+ yield* it;
540
+ return;
541
+ }
542
+ it = Array(z);
543
+ for (let i = 0;i < z; ++i) {
544
+ const k = struct2[4][i];
545
+ const v = member([struct2[5][i], 0], k);
546
+ yield it[i] = [k, v];
547
+ }
548
+ struct2[anno.it] = it;
549
+ }
550
+ }
551
+ function member(memberSchema, memberName) {
552
+ if (memberSchema instanceof NormalizedSchema) {
553
+ return Object.assign(memberSchema, {
554
+ memberName,
555
+ _isMemberSchema: true
556
+ });
557
+ }
558
+ const internalCtorAccess = NormalizedSchema;
559
+ return new internalCtorAccess(memberSchema, memberName);
560
+ }
561
+ var isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
562
+ var isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
563
+
564
+ class SimpleSchema extends Schema {
565
+ static symbol = Symbol.for("@smithy/sim");
566
+ name;
567
+ schemaRef;
568
+ traits;
569
+ symbol = SimpleSchema.symbol;
570
+ }
571
+ var sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema, {
572
+ name,
573
+ namespace,
574
+ traits,
575
+ schemaRef
576
+ });
577
+ var simAdapter = (namespace, name, traits, schemaRef) => Schema.assign(new SimpleSchema, {
578
+ name,
579
+ namespace,
580
+ traits,
581
+ schemaRef
582
+ });
583
+ var SCHEMA = {
584
+ BLOB: 21,
585
+ STREAMING_BLOB: 42,
586
+ BOOLEAN: 2,
587
+ STRING: 0,
588
+ NUMERIC: 1,
589
+ BIG_INTEGER: 17,
590
+ BIG_DECIMAL: 19,
591
+ DOCUMENT: 15,
592
+ TIMESTAMP_DEFAULT: 4,
593
+ TIMESTAMP_DATE_TIME: 5,
594
+ TIMESTAMP_HTTP_DATE: 6,
595
+ TIMESTAMP_EPOCH_SECONDS: 7,
596
+ LIST_MODIFIER: 64,
597
+ MAP_MODIFIER: 128
598
+ };
599
+
600
+ class TypeRegistry {
601
+ namespace;
602
+ schemas;
603
+ exceptions;
604
+ static registries = new Map;
605
+ constructor(namespace, schemas = new Map, exceptions = new Map) {
606
+ this.namespace = namespace;
607
+ this.schemas = schemas;
608
+ this.exceptions = exceptions;
609
+ }
610
+ static for(namespace) {
611
+ if (!TypeRegistry.registries.has(namespace)) {
612
+ TypeRegistry.registries.set(namespace, new TypeRegistry(namespace));
613
+ }
614
+ return TypeRegistry.registries.get(namespace);
615
+ }
616
+ copyFrom(other) {
617
+ const { schemas, exceptions } = this;
618
+ for (const [k, v] of other.schemas) {
619
+ if (!schemas.has(k)) {
620
+ schemas.set(k, v);
621
+ }
622
+ }
623
+ for (const [k, v] of other.exceptions) {
624
+ if (!exceptions.has(k)) {
625
+ exceptions.set(k, v);
626
+ }
627
+ }
628
+ }
629
+ register(shapeId, schema) {
630
+ const qualifiedName = this.normalizeShapeId(shapeId);
631
+ for (const r of [this, TypeRegistry.for(qualifiedName.split("#")[0])]) {
632
+ r.schemas.set(qualifiedName, schema);
633
+ }
634
+ }
635
+ getSchema(shapeId) {
636
+ const id = this.normalizeShapeId(shapeId);
637
+ if (!this.schemas.has(id)) {
638
+ throw new Error(`@smithy/core/schema - schema not found for ${id}`);
639
+ }
640
+ return this.schemas.get(id);
641
+ }
642
+ registerError(es, ctor) {
643
+ const $error2 = es;
644
+ const ns = $error2[1];
645
+ for (const r of [this, TypeRegistry.for(ns)]) {
646
+ r.schemas.set(ns + "#" + $error2[2], $error2);
647
+ r.exceptions.set($error2, ctor);
648
+ }
649
+ }
650
+ getErrorCtor(es) {
651
+ const $error2 = es;
652
+ if (this.exceptions.has($error2)) {
653
+ return this.exceptions.get($error2);
654
+ }
655
+ const registry = TypeRegistry.for($error2[1]);
656
+ return registry.exceptions.get($error2);
657
+ }
658
+ getBaseException() {
659
+ for (const exceptionKey of this.exceptions.keys()) {
660
+ if (Array.isArray(exceptionKey)) {
661
+ const [, ns, name] = exceptionKey;
662
+ const id = ns + "#" + name;
663
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
664
+ return exceptionKey;
665
+ }
666
+ }
667
+ }
668
+ return;
669
+ }
670
+ find(predicate) {
671
+ for (const schema of this.schemas.values()) {
672
+ if (predicate(schema)) {
673
+ return schema;
674
+ }
675
+ }
676
+ return;
677
+ }
678
+ clear() {
679
+ this.schemas.clear();
680
+ this.exceptions.clear();
681
+ }
682
+ normalizeShapeId(shapeId) {
683
+ if (shapeId.includes("#")) {
684
+ return shapeId;
685
+ }
686
+ return this.namespace + "#" + shapeId;
687
+ }
688
+ }
689
+ exports.ErrorSchema = ErrorSchema;
690
+ exports.ListSchema = ListSchema;
691
+ exports.MapSchema = MapSchema;
692
+ exports.NormalizedSchema = NormalizedSchema;
693
+ exports.OperationSchema = OperationSchema;
694
+ exports.SCHEMA = SCHEMA;
695
+ exports.Schema = Schema;
696
+ exports.SimpleSchema = SimpleSchema;
697
+ exports.StructureSchema = StructureSchema;
698
+ exports.TypeRegistry = TypeRegistry;
699
+ exports.deref = deref;
700
+ exports.deserializerMiddlewareOption = deserializerMiddlewareOption;
701
+ exports.error = error;
702
+ exports.getSchemaSerdePlugin = getSchemaSerdePlugin;
703
+ exports.isStaticSchema = isStaticSchema;
704
+ exports.list = list;
705
+ exports.map = map;
706
+ exports.op = op;
707
+ exports.operation = operation;
708
+ exports.serializerMiddlewareOption = serializerMiddlewareOption;
709
+ exports.sim = sim;
710
+ exports.simAdapter = simAdapter;
711
+ exports.simpleSchemaCacheN = simpleSchemaCacheN;
712
+ exports.simpleSchemaCacheS = simpleSchemaCacheS;
713
+ exports.struct = struct;
714
+ exports.traitsCache = traitsCache;
715
+ exports.translateTraits = translateTraits;
716
+ });
717
+
718
+ // node_modules/.bun/@smithy+node-http-handler@4.6.1/node_modules/@smithy/node-http-handler/dist-cjs/index.js
719
+ var require_dist_cjs11 = __commonJS((exports) => {
720
+ var protocolHttp = require_dist_cjs();
721
+ var querystringBuilder = require_dist_cjs2();
722
+ var node_https = __require("https");
723
+ var node_stream = __require("stream");
724
+ var http2 = __require("http2");
725
+ function buildAbortError(abortSignal) {
726
+ const reason = abortSignal && typeof abortSignal === "object" && "reason" in abortSignal ? abortSignal.reason : undefined;
727
+ if (reason) {
728
+ if (reason instanceof Error) {
729
+ const abortError3 = new Error("Request aborted");
730
+ abortError3.name = "AbortError";
731
+ abortError3.cause = reason;
732
+ return abortError3;
733
+ }
734
+ const abortError2 = new Error(String(reason));
735
+ abortError2.name = "AbortError";
736
+ return abortError2;
737
+ }
738
+ const abortError = new Error("Request aborted");
739
+ abortError.name = "AbortError";
740
+ return abortError;
741
+ }
742
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
743
+ var getTransformedHeaders = (headers) => {
744
+ const transformedHeaders = {};
745
+ for (const name of Object.keys(headers)) {
746
+ const headerValues = headers[name];
747
+ transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
748
+ }
749
+ return transformedHeaders;
750
+ };
751
+ var timing = {
752
+ setTimeout: (cb, ms) => setTimeout(cb, ms),
753
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId)
754
+ };
755
+ var DEFER_EVENT_LISTENER_TIME$2 = 1000;
756
+ var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
757
+ if (!timeoutInMs) {
758
+ return -1;
759
+ }
760
+ const registerTimeout = (offset) => {
761
+ const timeoutId = timing.setTimeout(() => {
762
+ request.destroy();
763
+ reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${timeoutInMs} ms.`), {
764
+ name: "TimeoutError"
765
+ }));
766
+ }, timeoutInMs - offset);
767
+ const doWithSocket = (socket) => {
768
+ if (socket?.connecting) {
769
+ socket.on("connect", () => {
770
+ timing.clearTimeout(timeoutId);
771
+ });
772
+ } else {
773
+ timing.clearTimeout(timeoutId);
774
+ }
775
+ };
776
+ if (request.socket) {
777
+ doWithSocket(request.socket);
778
+ } else {
779
+ request.on("socket", doWithSocket);
780
+ }
781
+ };
782
+ if (timeoutInMs < 2000) {
783
+ registerTimeout(0);
784
+ return 0;
785
+ }
786
+ return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME$2), DEFER_EVENT_LISTENER_TIME$2);
787
+ };
788
+ var setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
789
+ if (timeoutInMs) {
790
+ return timing.setTimeout(() => {
791
+ let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
792
+ if (throwOnRequestTimeout) {
793
+ const error = Object.assign(new Error(msg), {
794
+ name: "TimeoutError",
795
+ code: "ETIMEDOUT"
796
+ });
797
+ req.destroy(error);
798
+ reject(error);
799
+ } else {
800
+ msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
801
+ logger?.warn?.(msg);
802
+ }
803
+ }, timeoutInMs);
804
+ }
805
+ return -1;
806
+ };
807
+ var DEFER_EVENT_LISTENER_TIME$1 = 3000;
808
+ var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME$1) => {
809
+ if (keepAlive !== true) {
810
+ return -1;
811
+ }
812
+ const registerListener = () => {
813
+ if (request.socket) {
814
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
815
+ } else {
816
+ request.on("socket", (socket) => {
817
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
818
+ });
819
+ }
820
+ };
821
+ if (deferTimeMs === 0) {
822
+ registerListener();
823
+ return 0;
824
+ }
825
+ return timing.setTimeout(registerListener, deferTimeMs);
826
+ };
827
+ var DEFER_EVENT_LISTENER_TIME = 3000;
828
+ var setSocketTimeout = (request, reject, timeoutInMs = 0) => {
829
+ const registerTimeout = (offset) => {
830
+ const timeout = timeoutInMs - offset;
831
+ const onTimeout = () => {
832
+ request.destroy();
833
+ reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (configured by client requestHandler).`), { name: "TimeoutError" }));
834
+ };
835
+ if (request.socket) {
836
+ request.socket.setTimeout(timeout, onTimeout);
837
+ request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
838
+ } else {
839
+ request.setTimeout(timeout, onTimeout);
840
+ }
841
+ };
842
+ if (0 < timeoutInMs && timeoutInMs < 6000) {
843
+ registerTimeout(0);
844
+ return 0;
845
+ }
846
+ return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
847
+ };
848
+ var MIN_WAIT_TIME = 6000;
849
+ async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
850
+ const headers = request.headers ?? {};
851
+ const expect = headers.Expect || headers.expect;
852
+ let timeoutId = -1;
853
+ let sendBody = true;
854
+ if (!externalAgent && expect === "100-continue") {
855
+ sendBody = await Promise.race([
856
+ new Promise((resolve) => {
857
+ timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
858
+ }),
859
+ new Promise((resolve) => {
860
+ httpRequest.on("continue", () => {
861
+ timing.clearTimeout(timeoutId);
862
+ resolve(true);
863
+ });
864
+ httpRequest.on("response", () => {
865
+ timing.clearTimeout(timeoutId);
866
+ resolve(false);
867
+ });
868
+ httpRequest.on("error", () => {
869
+ timing.clearTimeout(timeoutId);
870
+ resolve(false);
871
+ });
872
+ })
873
+ ]);
874
+ }
875
+ if (sendBody) {
876
+ writeBody(httpRequest, request.body);
877
+ }
878
+ }
879
+ function writeBody(httpRequest, body) {
880
+ if (body instanceof node_stream.Readable) {
881
+ body.pipe(httpRequest);
882
+ return;
883
+ }
884
+ if (body) {
885
+ const isBuffer = Buffer.isBuffer(body);
886
+ const isString = typeof body === "string";
887
+ if (isBuffer || isString) {
888
+ if (isBuffer && body.byteLength === 0) {
889
+ httpRequest.end();
890
+ } else {
891
+ httpRequest.end(body);
892
+ }
893
+ return;
894
+ }
895
+ const uint8 = body;
896
+ if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
897
+ httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
898
+ return;
899
+ }
900
+ httpRequest.end(Buffer.from(body));
901
+ return;
902
+ }
903
+ httpRequest.end();
904
+ }
905
+ var DEFAULT_REQUEST_TIMEOUT = 0;
906
+ var hAgent = undefined;
907
+ var hRequest = undefined;
908
+
909
+ class NodeHttpHandler {
910
+ config;
911
+ configProvider;
912
+ socketWarningTimestamp = 0;
913
+ externalAgent = false;
914
+ metadata = { handlerProtocol: "http/1.1" };
915
+ static create(instanceOrOptions) {
916
+ if (typeof instanceOrOptions?.handle === "function") {
917
+ return instanceOrOptions;
918
+ }
919
+ return new NodeHttpHandler(instanceOrOptions);
920
+ }
921
+ static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
922
+ const { sockets, requests, maxSockets } = agent;
923
+ if (typeof maxSockets !== "number" || maxSockets === Infinity) {
924
+ return socketWarningTimestamp;
925
+ }
926
+ const interval = 15000;
927
+ if (Date.now() - interval < socketWarningTimestamp) {
928
+ return socketWarningTimestamp;
929
+ }
930
+ if (sockets && requests) {
931
+ for (const origin in sockets) {
932
+ const socketsInUse = sockets[origin]?.length ?? 0;
933
+ const requestsEnqueued = requests[origin]?.length ?? 0;
934
+ if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
935
+ logger?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
936
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
937
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
938
+ return Date.now();
939
+ }
940
+ }
941
+ }
942
+ return socketWarningTimestamp;
943
+ }
944
+ constructor(options) {
945
+ this.configProvider = new Promise((resolve, reject) => {
946
+ if (typeof options === "function") {
947
+ options().then((_options) => {
948
+ resolve(this.resolveDefaultConfig(_options));
949
+ }).catch(reject);
950
+ } else {
951
+ resolve(this.resolveDefaultConfig(options));
952
+ }
953
+ });
954
+ }
955
+ destroy() {
956
+ this.config?.httpAgent?.destroy();
957
+ this.config?.httpsAgent?.destroy();
958
+ }
959
+ async handle(request, { abortSignal, requestTimeout } = {}) {
960
+ if (!this.config) {
961
+ this.config = await this.configProvider;
962
+ }
963
+ const config = this.config;
964
+ const isSSL = request.protocol === "https:";
965
+ if (!isSSL && !this.config.httpAgent) {
966
+ this.config.httpAgent = await this.config.httpAgentProvider();
967
+ }
968
+ return new Promise((_resolve, _reject) => {
969
+ let writeRequestBodyPromise = undefined;
970
+ const timeouts = [];
971
+ const resolve = async (arg) => {
972
+ await writeRequestBodyPromise;
973
+ timeouts.forEach(timing.clearTimeout);
974
+ _resolve(arg);
975
+ };
976
+ const reject = async (arg) => {
977
+ await writeRequestBodyPromise;
978
+ timeouts.forEach(timing.clearTimeout);
979
+ _reject(arg);
980
+ };
981
+ if (abortSignal?.aborted) {
982
+ const abortError = buildAbortError(abortSignal);
983
+ reject(abortError);
984
+ return;
985
+ }
986
+ const headers = request.headers ?? {};
987
+ const expectContinue = (headers.Expect ?? headers.expect) === "100-continue";
988
+ let agent = isSSL ? config.httpsAgent : config.httpAgent;
989
+ if (expectContinue && !this.externalAgent) {
990
+ agent = new (isSSL ? node_https.Agent : hAgent)({
991
+ keepAlive: false,
992
+ maxSockets: Infinity
993
+ });
994
+ }
995
+ timeouts.push(timing.setTimeout(() => {
996
+ this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, config.logger);
997
+ }, config.socketAcquisitionWarningTimeout ?? (config.requestTimeout ?? 2000) + (config.connectionTimeout ?? 1000)));
998
+ const queryString = querystringBuilder.buildQueryString(request.query || {});
999
+ let auth = undefined;
1000
+ if (request.username != null || request.password != null) {
1001
+ const username = request.username ?? "";
1002
+ const password = request.password ?? "";
1003
+ auth = `${username}:${password}`;
1004
+ }
1005
+ let path = request.path;
1006
+ if (queryString) {
1007
+ path += `?${queryString}`;
1008
+ }
1009
+ if (request.fragment) {
1010
+ path += `#${request.fragment}`;
1011
+ }
1012
+ let hostname = request.hostname ?? "";
1013
+ if (hostname[0] === "[" && hostname.endsWith("]")) {
1014
+ hostname = request.hostname.slice(1, -1);
1015
+ } else {
1016
+ hostname = request.hostname;
1017
+ }
1018
+ const nodeHttpsOptions = {
1019
+ headers: request.headers,
1020
+ host: hostname,
1021
+ method: request.method,
1022
+ path,
1023
+ port: request.port,
1024
+ agent,
1025
+ auth
1026
+ };
1027
+ const requestFunc = isSSL ? node_https.request : hRequest;
1028
+ const req = requestFunc(nodeHttpsOptions, (res) => {
1029
+ const httpResponse = new protocolHttp.HttpResponse({
1030
+ statusCode: res.statusCode || -1,
1031
+ reason: res.statusMessage,
1032
+ headers: getTransformedHeaders(res.headers),
1033
+ body: res
1034
+ });
1035
+ resolve({ response: httpResponse });
1036
+ });
1037
+ req.on("error", (err) => {
1038
+ if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
1039
+ reject(Object.assign(err, { name: "TimeoutError" }));
1040
+ } else {
1041
+ reject(err);
1042
+ }
1043
+ });
1044
+ if (abortSignal) {
1045
+ const onAbort = () => {
1046
+ req.destroy();
1047
+ const abortError = buildAbortError(abortSignal);
1048
+ reject(abortError);
1049
+ };
1050
+ if (typeof abortSignal.addEventListener === "function") {
1051
+ const signal = abortSignal;
1052
+ signal.addEventListener("abort", onAbort, { once: true });
1053
+ req.once("close", () => signal.removeEventListener("abort", onAbort));
1054
+ } else {
1055
+ abortSignal.onabort = onAbort;
1056
+ }
1057
+ }
1058
+ const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
1059
+ timeouts.push(setConnectionTimeout(req, reject, config.connectionTimeout));
1060
+ timeouts.push(setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, config.logger ?? console));
1061
+ timeouts.push(setSocketTimeout(req, reject, config.socketTimeout));
1062
+ const httpAgent = nodeHttpsOptions.agent;
1063
+ if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
1064
+ timeouts.push(setSocketKeepAlive(req, {
1065
+ keepAlive: httpAgent.keepAlive,
1066
+ keepAliveMsecs: httpAgent.keepAliveMsecs
1067
+ }));
1068
+ }
1069
+ writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout, this.externalAgent).catch((e) => {
1070
+ timeouts.forEach(timing.clearTimeout);
1071
+ return _reject(e);
1072
+ });
1073
+ });
1074
+ }
1075
+ updateHttpClientConfig(key, value) {
1076
+ this.config = undefined;
1077
+ this.configProvider = this.configProvider.then((config) => {
1078
+ return {
1079
+ ...config,
1080
+ [key]: value
1081
+ };
1082
+ });
1083
+ }
1084
+ httpHandlerConfigs() {
1085
+ return this.config ?? {};
1086
+ }
1087
+ resolveDefaultConfig(options) {
1088
+ const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger } = options || {};
1089
+ const keepAlive = true;
1090
+ const maxSockets = 50;
1091
+ return {
1092
+ connectionTimeout,
1093
+ requestTimeout,
1094
+ socketTimeout,
1095
+ socketAcquisitionWarningTimeout,
1096
+ throwOnRequestTimeout,
1097
+ httpAgentProvider: async () => {
1098
+ const { Agent, request } = await import("http");
1099
+ hRequest = request;
1100
+ hAgent = Agent;
1101
+ if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
1102
+ this.externalAgent = true;
1103
+ return httpAgent;
1104
+ }
1105
+ return new hAgent({ keepAlive, maxSockets, ...httpAgent });
1106
+ },
1107
+ httpsAgent: (() => {
1108
+ if (httpsAgent instanceof node_https.Agent || typeof httpsAgent?.destroy === "function") {
1109
+ this.externalAgent = true;
1110
+ return httpsAgent;
1111
+ }
1112
+ return new node_https.Agent({ keepAlive, maxSockets, ...httpsAgent });
1113
+ })(),
1114
+ logger
1115
+ };
1116
+ }
1117
+ }
1118
+ var ids = new Uint16Array(1);
1119
+
1120
+ class ClientHttp2SessionRef {
1121
+ id = ids[0]++;
1122
+ total = 0;
1123
+ max = 0;
1124
+ session;
1125
+ refs = 0;
1126
+ constructor(session) {
1127
+ session.unref();
1128
+ this.session = session;
1129
+ }
1130
+ retain() {
1131
+ if (this.session.destroyed) {
1132
+ throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");
1133
+ }
1134
+ this.refs += 1;
1135
+ this.total += 1;
1136
+ this.max = Math.max(this.refs, this.max);
1137
+ this.session.ref();
1138
+ }
1139
+ free() {
1140
+ if (this.session.destroyed) {
1141
+ return;
1142
+ }
1143
+ this.refs -= 1;
1144
+ if (this.refs === 0) {
1145
+ this.session.unref();
1146
+ }
1147
+ if (this.refs < 0) {
1148
+ throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.");
1149
+ }
1150
+ }
1151
+ deref() {
1152
+ return this.session;
1153
+ }
1154
+ close() {
1155
+ if (!this.session.closed) {
1156
+ this.session.close();
1157
+ }
1158
+ }
1159
+ destroy() {
1160
+ this.refs = 0;
1161
+ if (!this.session.destroyed) {
1162
+ this.session.destroy();
1163
+ }
1164
+ }
1165
+ useCount() {
1166
+ return this.refs;
1167
+ }
1168
+ }
1169
+
1170
+ class NodeHttp2ConnectionPool {
1171
+ sessions = [];
1172
+ maxConcurrency = 0;
1173
+ constructor(sessions) {
1174
+ this.sessions = (sessions ?? []).map((session) => new ClientHttp2SessionRef(session));
1175
+ }
1176
+ poll() {
1177
+ let cleanup = false;
1178
+ for (const session of this.sessions) {
1179
+ if (session.deref().destroyed) {
1180
+ cleanup = true;
1181
+ continue;
1182
+ }
1183
+ if (!this.maxConcurrency || session.useCount() < this.maxConcurrency) {
1184
+ return session;
1185
+ }
1186
+ }
1187
+ if (cleanup) {
1188
+ for (const session of this.sessions) {
1189
+ if (session.deref().destroyed) {
1190
+ this.remove(session);
1191
+ }
1192
+ }
1193
+ }
1194
+ }
1195
+ offerLast(ref) {
1196
+ this.sessions.push(ref);
1197
+ }
1198
+ remove(ref) {
1199
+ const ix = this.sessions.indexOf(ref);
1200
+ if (ix > -1) {
1201
+ this.sessions.splice(ix, 1);
1202
+ }
1203
+ }
1204
+ [Symbol.iterator]() {
1205
+ return this.sessions[Symbol.iterator]();
1206
+ }
1207
+ setMaxConcurrency(maxConcurrency) {
1208
+ this.maxConcurrency = maxConcurrency;
1209
+ }
1210
+ destroy(ref) {
1211
+ this.remove(ref);
1212
+ ref.destroy();
1213
+ }
1214
+ }
1215
+
1216
+ class NodeHttp2ConnectionManager {
1217
+ config;
1218
+ connectionPools = new Map;
1219
+ constructor(config) {
1220
+ this.config = config;
1221
+ if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
1222
+ throw new RangeError("maxConcurrency must be greater than zero.");
1223
+ }
1224
+ }
1225
+ lease(requestContext, connectionConfiguration) {
1226
+ const url = this.getUrlString(requestContext);
1227
+ const pool = this.getPool(url);
1228
+ if (!this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
1229
+ const available = pool.poll();
1230
+ if (available) {
1231
+ available.retain();
1232
+ return available;
1233
+ }
1234
+ }
1235
+ const ref = new ClientHttp2SessionRef(http2.connect(url));
1236
+ const session = ref.deref();
1237
+ if (this.config.maxConcurrency) {
1238
+ session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
1239
+ if (err) {
1240
+ throw new Error("Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString());
1241
+ }
1242
+ });
1243
+ }
1244
+ const graceful = () => {
1245
+ this.removeFromPoolAndClose(url, ref);
1246
+ };
1247
+ const ensureDestroyed = () => {
1248
+ this.removeFromPoolAndCheckedDestroy(url, ref);
1249
+ };
1250
+ session.on("goaway", graceful);
1251
+ session.on("error", ensureDestroyed);
1252
+ session.on("frameError", ensureDestroyed);
1253
+ session.on("close", ensureDestroyed);
1254
+ if (connectionConfiguration.requestTimeout) {
1255
+ session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
1256
+ }
1257
+ pool.offerLast(ref);
1258
+ ref.retain();
1259
+ return ref;
1260
+ }
1261
+ release(_requestContext, ref) {
1262
+ ref.free();
1263
+ }
1264
+ createIsolatedSession(requestContext, connectionConfiguration) {
1265
+ const url = this.getUrlString(requestContext);
1266
+ const ref = new ClientHttp2SessionRef(http2.connect(url));
1267
+ const session = ref.deref();
1268
+ session.settings({ maxConcurrentStreams: 1 });
1269
+ const ensureDestroyed = () => {
1270
+ ref.destroy();
1271
+ };
1272
+ session.on("error", ensureDestroyed);
1273
+ session.on("frameError", ensureDestroyed);
1274
+ session.on("close", ensureDestroyed);
1275
+ if (connectionConfiguration.requestTimeout) {
1276
+ session.setTimeout(connectionConfiguration.requestTimeout, ensureDestroyed);
1277
+ }
1278
+ ref.retain();
1279
+ return ref;
1280
+ }
1281
+ destroy() {
1282
+ for (const [url, connectionPool] of this.connectionPools) {
1283
+ for (const session of [...connectionPool]) {
1284
+ session.destroy();
1285
+ }
1286
+ this.connectionPools.delete(url);
1287
+ }
1288
+ }
1289
+ setMaxConcurrentStreams(maxConcurrentStreams) {
1290
+ if (maxConcurrentStreams && maxConcurrentStreams <= 0) {
1291
+ throw new RangeError("maxConcurrentStreams must be greater than zero.");
1292
+ }
1293
+ this.config.maxConcurrency = maxConcurrentStreams;
1294
+ for (const pool of this.connectionPools.values()) {
1295
+ pool.setMaxConcurrency(maxConcurrentStreams);
1296
+ }
1297
+ }
1298
+ setDisableConcurrentStreams(disableConcurrentStreams) {
1299
+ this.config.disableConcurrency = disableConcurrentStreams;
1300
+ }
1301
+ debug() {
1302
+ const pools = {};
1303
+ for (const [url, pool] of this.connectionPools) {
1304
+ const sessions = [];
1305
+ for (const ref of pool) {
1306
+ sessions.push({
1307
+ id: ref.id,
1308
+ active: ref.useCount(),
1309
+ maxConcurrent: ref.max,
1310
+ totalRequests: ref.total
1311
+ });
1312
+ }
1313
+ pools[url] = { sessions };
1314
+ }
1315
+ return pools;
1316
+ }
1317
+ removeFromPoolAndClose(authority, ref) {
1318
+ this.connectionPools.get(authority)?.remove(ref);
1319
+ ref.close();
1320
+ }
1321
+ removeFromPoolAndCheckedDestroy(authority, ref) {
1322
+ this.connectionPools.get(authority)?.remove(ref);
1323
+ ref.destroy();
1324
+ }
1325
+ getPool(url) {
1326
+ if (!this.connectionPools.has(url)) {
1327
+ const pool = new NodeHttp2ConnectionPool;
1328
+ if (this.config.maxConcurrency) {
1329
+ pool.setMaxConcurrency(this.config.maxConcurrency);
1330
+ }
1331
+ this.connectionPools.set(url, pool);
1332
+ }
1333
+ return this.connectionPools.get(url);
1334
+ }
1335
+ getUrlString(request) {
1336
+ return request.destination.toString();
1337
+ }
1338
+ }
1339
+
1340
+ class NodeHttp2Handler {
1341
+ config;
1342
+ configProvider;
1343
+ metadata = { handlerProtocol: "h2" };
1344
+ connectionManager = new NodeHttp2ConnectionManager({});
1345
+ static create(instanceOrOptions) {
1346
+ if (typeof instanceOrOptions?.handle === "function") {
1347
+ return instanceOrOptions;
1348
+ }
1349
+ return new NodeHttp2Handler(instanceOrOptions);
1350
+ }
1351
+ constructor(options) {
1352
+ this.configProvider = new Promise((resolve, reject) => {
1353
+ if (typeof options === "function") {
1354
+ options().then((opts) => {
1355
+ resolve(opts || {});
1356
+ }).catch(reject);
1357
+ } else {
1358
+ resolve(options || {});
1359
+ }
1360
+ });
1361
+ }
1362
+ destroy() {
1363
+ this.connectionManager.destroy();
1364
+ }
1365
+ async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
1366
+ if (!this.config) {
1367
+ this.config = await this.configProvider;
1368
+ const { disableConcurrentStreams: disableConcurrentStreams2, maxConcurrentStreams } = this.config;
1369
+ this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams2 ?? false);
1370
+ if (maxConcurrentStreams) {
1371
+ this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
1372
+ }
1373
+ }
1374
+ const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
1375
+ const useIsolatedSession = disableConcurrentStreams || isEventStream;
1376
+ const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
1377
+ return new Promise((_resolve, _reject) => {
1378
+ let fulfilled = false;
1379
+ let writeRequestBodyPromise = undefined;
1380
+ const resolve = async (arg) => {
1381
+ await writeRequestBodyPromise;
1382
+ _resolve(arg);
1383
+ };
1384
+ const reject = async (arg) => {
1385
+ await writeRequestBodyPromise;
1386
+ _reject(arg);
1387
+ };
1388
+ if (abortSignal?.aborted) {
1389
+ fulfilled = true;
1390
+ const abortError = buildAbortError(abortSignal);
1391
+ reject(abortError);
1392
+ return;
1393
+ }
1394
+ const { hostname, method, port, protocol, query } = request;
1395
+ let auth = "";
1396
+ if (request.username != null || request.password != null) {
1397
+ const username = request.username ?? "";
1398
+ const password = request.password ?? "";
1399
+ auth = `${username}:${password}@`;
1400
+ }
1401
+ const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
1402
+ const requestContext = { destination: new URL(authority) };
1403
+ const connectConfig = {
1404
+ requestTimeout: this.config?.sessionTimeout,
1405
+ isEventStream
1406
+ };
1407
+ const ref = useIsolatedSession ? this.connectionManager.createIsolatedSession(requestContext, connectConfig) : this.connectionManager.lease(requestContext, connectConfig);
1408
+ const session = ref.deref();
1409
+ const rejectWithDestroy = (err) => {
1410
+ if (useIsolatedSession) {
1411
+ ref.destroy();
1412
+ }
1413
+ fulfilled = true;
1414
+ reject(err);
1415
+ };
1416
+ const queryString = querystringBuilder.buildQueryString(query ?? {});
1417
+ let path = request.path;
1418
+ if (queryString) {
1419
+ path += `?${queryString}`;
1420
+ }
1421
+ if (request.fragment) {
1422
+ path += `#${request.fragment}`;
1423
+ }
1424
+ const clientHttp2Stream = session.request({
1425
+ ...request.headers,
1426
+ [http2.constants.HTTP2_HEADER_PATH]: path,
1427
+ [http2.constants.HTTP2_HEADER_METHOD]: method
1428
+ });
1429
+ if (effectiveRequestTimeout) {
1430
+ clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
1431
+ clientHttp2Stream.close();
1432
+ const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
1433
+ timeoutError.name = "TimeoutError";
1434
+ rejectWithDestroy(timeoutError);
1435
+ });
1436
+ }
1437
+ if (abortSignal) {
1438
+ const onAbort = () => {
1439
+ clientHttp2Stream.close();
1440
+ const abortError = buildAbortError(abortSignal);
1441
+ rejectWithDestroy(abortError);
1442
+ };
1443
+ if (typeof abortSignal.addEventListener === "function") {
1444
+ const signal = abortSignal;
1445
+ signal.addEventListener("abort", onAbort, { once: true });
1446
+ clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
1447
+ } else {
1448
+ abortSignal.onabort = onAbort;
1449
+ }
1450
+ }
1451
+ clientHttp2Stream.on("frameError", (type, code, id) => {
1452
+ rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
1453
+ });
1454
+ clientHttp2Stream.on("error", rejectWithDestroy);
1455
+ clientHttp2Stream.on("aborted", () => {
1456
+ rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
1457
+ });
1458
+ clientHttp2Stream.on("response", (headers) => {
1459
+ const httpResponse = new protocolHttp.HttpResponse({
1460
+ statusCode: headers[":status"] ?? -1,
1461
+ headers: getTransformedHeaders(headers),
1462
+ body: clientHttp2Stream
1463
+ });
1464
+ fulfilled = true;
1465
+ resolve({ response: httpResponse });
1466
+ if (useIsolatedSession) {
1467
+ session.close();
1468
+ }
1469
+ });
1470
+ clientHttp2Stream.on("close", () => {
1471
+ if (useIsolatedSession) {
1472
+ ref.destroy();
1473
+ } else {
1474
+ this.connectionManager.release(requestContext, ref);
1475
+ }
1476
+ if (!fulfilled) {
1477
+ rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"));
1478
+ }
1479
+ });
1480
+ writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
1481
+ });
1482
+ }
1483
+ updateHttpClientConfig(key, value) {
1484
+ this.config = undefined;
1485
+ this.configProvider = this.configProvider.then((config) => {
1486
+ return {
1487
+ ...config,
1488
+ [key]: value
1489
+ };
1490
+ });
1491
+ }
1492
+ httpHandlerConfigs() {
1493
+ return this.config ?? {};
1494
+ }
1495
+ }
1496
+
1497
+ class Collector extends node_stream.Writable {
1498
+ bufferedBytes = [];
1499
+ _write(chunk, encoding, callback) {
1500
+ this.bufferedBytes.push(chunk);
1501
+ callback();
1502
+ }
1503
+ }
1504
+ var streamCollector = (stream) => {
1505
+ if (isReadableStreamInstance(stream)) {
1506
+ return collectReadableStream(stream);
1507
+ }
1508
+ return new Promise((resolve, reject) => {
1509
+ const collector = new Collector;
1510
+ stream.pipe(collector);
1511
+ stream.on("error", (err) => {
1512
+ collector.end();
1513
+ reject(err);
1514
+ });
1515
+ collector.on("error", reject);
1516
+ collector.on("finish", function() {
1517
+ const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
1518
+ resolve(bytes);
1519
+ });
1520
+ });
1521
+ };
1522
+ var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
1523
+ async function collectReadableStream(stream) {
1524
+ const chunks = [];
1525
+ const reader = stream.getReader();
1526
+ let isDone = false;
1527
+ let length = 0;
1528
+ while (!isDone) {
1529
+ const { done, value } = await reader.read();
1530
+ if (value) {
1531
+ chunks.push(value);
1532
+ length += value.length;
1533
+ }
1534
+ isDone = done;
1535
+ }
1536
+ const collected = new Uint8Array(length);
1537
+ let offset = 0;
1538
+ for (const chunk of chunks) {
1539
+ collected.set(chunk, offset);
1540
+ offset += chunk.length;
1541
+ }
1542
+ return collected;
1543
+ }
1544
+ exports.DEFAULT_REQUEST_TIMEOUT = DEFAULT_REQUEST_TIMEOUT;
1545
+ exports.NodeHttp2Handler = NodeHttp2Handler;
1546
+ exports.NodeHttpHandler = NodeHttpHandler;
1547
+ exports.streamCollector = streamCollector;
1548
+ });
1549
+
1550
+ // node_modules/.bun/@smithy+core@3.23.17/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js
1551
+ var require_serde = __commonJS((exports) => {
1552
+ var uuid = require_dist_cjs5();
1553
+ var copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
1554
+ var parseBoolean = (value) => {
1555
+ switch (value) {
1556
+ case "true":
1557
+ return true;
1558
+ case "false":
1559
+ return false;
1560
+ default:
1561
+ throw new Error(`Unable to parse boolean value "${value}"`);
1562
+ }
1563
+ };
1564
+ var expectBoolean = (value) => {
1565
+ if (value === null || value === undefined) {
1566
+ return;
1567
+ }
1568
+ if (typeof value === "number") {
1569
+ if (value === 0 || value === 1) {
1570
+ logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
1571
+ }
1572
+ if (value === 0) {
1573
+ return false;
1574
+ }
1575
+ if (value === 1) {
1576
+ return true;
1577
+ }
1578
+ }
1579
+ if (typeof value === "string") {
1580
+ const lower = value.toLowerCase();
1581
+ if (lower === "false" || lower === "true") {
1582
+ logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
1583
+ }
1584
+ if (lower === "false") {
1585
+ return false;
1586
+ }
1587
+ if (lower === "true") {
1588
+ return true;
1589
+ }
1590
+ }
1591
+ if (typeof value === "boolean") {
1592
+ return value;
1593
+ }
1594
+ throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`);
1595
+ };
1596
+ var expectNumber = (value) => {
1597
+ if (value === null || value === undefined) {
1598
+ return;
1599
+ }
1600
+ if (typeof value === "string") {
1601
+ const parsed = parseFloat(value);
1602
+ if (!Number.isNaN(parsed)) {
1603
+ if (String(parsed) !== String(value)) {
1604
+ logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
1605
+ }
1606
+ return parsed;
1607
+ }
1608
+ }
1609
+ if (typeof value === "number") {
1610
+ return value;
1611
+ }
1612
+ throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
1613
+ };
1614
+ var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
1615
+ var expectFloat32 = (value) => {
1616
+ const expected = expectNumber(value);
1617
+ if (expected !== undefined && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
1618
+ if (Math.abs(expected) > MAX_FLOAT) {
1619
+ throw new TypeError(`Expected 32-bit float, got ${value}`);
1620
+ }
1621
+ }
1622
+ return expected;
1623
+ };
1624
+ var expectLong = (value) => {
1625
+ if (value === null || value === undefined) {
1626
+ return;
1627
+ }
1628
+ if (Number.isInteger(value) && !Number.isNaN(value)) {
1629
+ return value;
1630
+ }
1631
+ throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
1632
+ };
1633
+ var expectInt = expectLong;
1634
+ var expectInt32 = (value) => expectSizedInt(value, 32);
1635
+ var expectShort = (value) => expectSizedInt(value, 16);
1636
+ var expectByte = (value) => expectSizedInt(value, 8);
1637
+ var expectSizedInt = (value, size) => {
1638
+ const expected = expectLong(value);
1639
+ if (expected !== undefined && castInt(expected, size) !== expected) {
1640
+ throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
1641
+ }
1642
+ return expected;
1643
+ };
1644
+ var castInt = (value, size) => {
1645
+ switch (size) {
1646
+ case 32:
1647
+ return Int32Array.of(value)[0];
1648
+ case 16:
1649
+ return Int16Array.of(value)[0];
1650
+ case 8:
1651
+ return Int8Array.of(value)[0];
1652
+ }
1653
+ };
1654
+ var expectNonNull = (value, location) => {
1655
+ if (value === null || value === undefined) {
1656
+ if (location) {
1657
+ throw new TypeError(`Expected a non-null value for ${location}`);
1658
+ }
1659
+ throw new TypeError("Expected a non-null value");
1660
+ }
1661
+ return value;
1662
+ };
1663
+ var expectObject = (value) => {
1664
+ if (value === null || value === undefined) {
1665
+ return;
1666
+ }
1667
+ if (typeof value === "object" && !Array.isArray(value)) {
1668
+ return value;
1669
+ }
1670
+ const receivedType = Array.isArray(value) ? "array" : typeof value;
1671
+ throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
1672
+ };
1673
+ var expectString = (value) => {
1674
+ if (value === null || value === undefined) {
1675
+ return;
1676
+ }
1677
+ if (typeof value === "string") {
1678
+ return value;
1679
+ }
1680
+ if (["boolean", "number", "bigint"].includes(typeof value)) {
1681
+ logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
1682
+ return String(value);
1683
+ }
1684
+ throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
1685
+ };
1686
+ var expectUnion = (value) => {
1687
+ if (value === null || value === undefined) {
1688
+ return;
1689
+ }
1690
+ const asObject = expectObject(value);
1691
+ const setKeys = [];
1692
+ for (const k in asObject) {
1693
+ if (asObject[k] != null) {
1694
+ setKeys.push(k);
1695
+ }
1696
+ }
1697
+ if (setKeys.length === 0) {
1698
+ throw new TypeError(`Unions must have exactly one non-null member. None were found.`);
1699
+ }
1700
+ if (setKeys.length > 1) {
1701
+ throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`);
1702
+ }
1703
+ return asObject;
1704
+ };
1705
+ var strictParseDouble = (value) => {
1706
+ if (typeof value == "string") {
1707
+ return expectNumber(parseNumber(value));
1708
+ }
1709
+ return expectNumber(value);
1710
+ };
1711
+ var strictParseFloat = strictParseDouble;
1712
+ var strictParseFloat32 = (value) => {
1713
+ if (typeof value == "string") {
1714
+ return expectFloat32(parseNumber(value));
1715
+ }
1716
+ return expectFloat32(value);
1717
+ };
1718
+ var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
1719
+ var parseNumber = (value) => {
1720
+ const matches = value.match(NUMBER_REGEX);
1721
+ if (matches === null || matches[0].length !== value.length) {
1722
+ throw new TypeError(`Expected real number, got implicit NaN`);
1723
+ }
1724
+ return parseFloat(value);
1725
+ };
1726
+ var limitedParseDouble = (value) => {
1727
+ if (typeof value == "string") {
1728
+ return parseFloatString(value);
1729
+ }
1730
+ return expectNumber(value);
1731
+ };
1732
+ var handleFloat = limitedParseDouble;
1733
+ var limitedParseFloat = limitedParseDouble;
1734
+ var limitedParseFloat32 = (value) => {
1735
+ if (typeof value == "string") {
1736
+ return parseFloatString(value);
1737
+ }
1738
+ return expectFloat32(value);
1739
+ };
1740
+ var parseFloatString = (value) => {
1741
+ switch (value) {
1742
+ case "NaN":
1743
+ return NaN;
1744
+ case "Infinity":
1745
+ return Infinity;
1746
+ case "-Infinity":
1747
+ return -Infinity;
1748
+ default:
1749
+ throw new Error(`Unable to parse float value: ${value}`);
1750
+ }
1751
+ };
1752
+ var strictParseLong = (value) => {
1753
+ if (typeof value === "string") {
1754
+ return expectLong(parseNumber(value));
1755
+ }
1756
+ return expectLong(value);
1757
+ };
1758
+ var strictParseInt = strictParseLong;
1759
+ var strictParseInt32 = (value) => {
1760
+ if (typeof value === "string") {
1761
+ return expectInt32(parseNumber(value));
1762
+ }
1763
+ return expectInt32(value);
1764
+ };
1765
+ var strictParseShort = (value) => {
1766
+ if (typeof value === "string") {
1767
+ return expectShort(parseNumber(value));
1768
+ }
1769
+ return expectShort(value);
1770
+ };
1771
+ var strictParseByte = (value) => {
1772
+ if (typeof value === "string") {
1773
+ return expectByte(parseNumber(value));
1774
+ }
1775
+ return expectByte(value);
1776
+ };
1777
+ var stackTraceWarning = (message) => {
1778
+ return String(new TypeError(message).stack || message).split(`
1779
+ `).slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join(`
1780
+ `);
1781
+ };
1782
+ var logger = {
1783
+ warn: console.warn
1784
+ };
1785
+ var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
1786
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1787
+ function dateToUtcString(date2) {
1788
+ const year2 = date2.getUTCFullYear();
1789
+ const month = date2.getUTCMonth();
1790
+ const dayOfWeek = date2.getUTCDay();
1791
+ const dayOfMonthInt = date2.getUTCDate();
1792
+ const hoursInt = date2.getUTCHours();
1793
+ const minutesInt = date2.getUTCMinutes();
1794
+ const secondsInt = date2.getUTCSeconds();
1795
+ const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`;
1796
+ const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`;
1797
+ const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`;
1798
+ const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`;
1799
+ return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year2} ${hoursString}:${minutesString}:${secondsString} GMT`;
1800
+ }
1801
+ var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
1802
+ var parseRfc3339DateTime = (value) => {
1803
+ if (value === null || value === undefined) {
1804
+ return;
1805
+ }
1806
+ if (typeof value !== "string") {
1807
+ throw new TypeError("RFC-3339 date-times must be expressed as strings");
1808
+ }
1809
+ const match = RFC3339.exec(value);
1810
+ if (!match) {
1811
+ throw new TypeError("Invalid RFC-3339 date-time value");
1812
+ }
1813
+ const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match;
1814
+ const year2 = strictParseShort(stripLeadingZeroes(yearStr));
1815
+ const month = parseDateValue(monthStr, "month", 1, 12);
1816
+ const day = parseDateValue(dayStr, "day", 1, 31);
1817
+ return buildDate(year2, month, day, { hours, minutes, seconds, fractionalMilliseconds });
1818
+ };
1819
+ var RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
1820
+ var parseRfc3339DateTimeWithOffset = (value) => {
1821
+ if (value === null || value === undefined) {
1822
+ return;
1823
+ }
1824
+ if (typeof value !== "string") {
1825
+ throw new TypeError("RFC-3339 date-times must be expressed as strings");
1826
+ }
1827
+ const match = RFC3339_WITH_OFFSET$1.exec(value);
1828
+ if (!match) {
1829
+ throw new TypeError("Invalid RFC-3339 date-time value");
1830
+ }
1831
+ const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match;
1832
+ const year2 = strictParseShort(stripLeadingZeroes(yearStr));
1833
+ const month = parseDateValue(monthStr, "month", 1, 12);
1834
+ const day = parseDateValue(dayStr, "day", 1, 31);
1835
+ const date2 = buildDate(year2, month, day, { hours, minutes, seconds, fractionalMilliseconds });
1836
+ if (offsetStr.toUpperCase() != "Z") {
1837
+ date2.setTime(date2.getTime() - parseOffsetToMilliseconds(offsetStr));
1838
+ }
1839
+ return date2;
1840
+ };
1841
+ var IMF_FIXDATE$1 = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
1842
+ var RFC_850_DATE$1 = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
1843
+ var ASC_TIME$1 = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
1844
+ var parseRfc7231DateTime = (value) => {
1845
+ if (value === null || value === undefined) {
1846
+ return;
1847
+ }
1848
+ if (typeof value !== "string") {
1849
+ throw new TypeError("RFC-7231 date-times must be expressed as strings");
1850
+ }
1851
+ let match = IMF_FIXDATE$1.exec(value);
1852
+ if (match) {
1853
+ const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
1854
+ return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
1855
+ }
1856
+ match = RFC_850_DATE$1.exec(value);
1857
+ if (match) {
1858
+ const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
1859
+ return adjustRfc850Year(buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
1860
+ hours,
1861
+ minutes,
1862
+ seconds,
1863
+ fractionalMilliseconds
1864
+ }));
1865
+ }
1866
+ match = ASC_TIME$1.exec(value);
1867
+ if (match) {
1868
+ const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match;
1869
+ return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
1870
+ }
1871
+ throw new TypeError("Invalid RFC-7231 date-time value");
1872
+ };
1873
+ var parseEpochTimestamp = (value) => {
1874
+ if (value === null || value === undefined) {
1875
+ return;
1876
+ }
1877
+ let valueAsDouble;
1878
+ if (typeof value === "number") {
1879
+ valueAsDouble = value;
1880
+ } else if (typeof value === "string") {
1881
+ valueAsDouble = strictParseDouble(value);
1882
+ } else if (typeof value === "object" && value.tag === 1) {
1883
+ valueAsDouble = value.value;
1884
+ } else {
1885
+ throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");
1886
+ }
1887
+ if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) {
1888
+ throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");
1889
+ }
1890
+ return new Date(Math.round(valueAsDouble * 1000));
1891
+ };
1892
+ var buildDate = (year2, month, day, time2) => {
1893
+ const adjustedMonth = month - 1;
1894
+ validateDayOfMonth(year2, adjustedMonth, day);
1895
+ return new Date(Date.UTC(year2, adjustedMonth, day, parseDateValue(time2.hours, "hour", 0, 23), parseDateValue(time2.minutes, "minute", 0, 59), parseDateValue(time2.seconds, "seconds", 0, 60), parseMilliseconds(time2.fractionalMilliseconds)));
1896
+ };
1897
+ var parseTwoDigitYear = (value) => {
1898
+ const thisYear = new Date().getUTCFullYear();
1899
+ const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value));
1900
+ if (valueInThisCentury < thisYear) {
1901
+ return valueInThisCentury + 100;
1902
+ }
1903
+ return valueInThisCentury;
1904
+ };
1905
+ var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1000;
1906
+ var adjustRfc850Year = (input) => {
1907
+ if (input.getTime() - new Date().getTime() > FIFTY_YEARS_IN_MILLIS) {
1908
+ return new Date(Date.UTC(input.getUTCFullYear() - 100, input.getUTCMonth(), input.getUTCDate(), input.getUTCHours(), input.getUTCMinutes(), input.getUTCSeconds(), input.getUTCMilliseconds()));
1909
+ }
1910
+ return input;
1911
+ };
1912
+ var parseMonthByShortName = (value) => {
1913
+ const monthIdx = MONTHS.indexOf(value);
1914
+ if (monthIdx < 0) {
1915
+ throw new TypeError(`Invalid month: ${value}`);
1916
+ }
1917
+ return monthIdx + 1;
1918
+ };
1919
+ var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1920
+ var validateDayOfMonth = (year2, month, day) => {
1921
+ let maxDays = DAYS_IN_MONTH[month];
1922
+ if (month === 1 && isLeapYear(year2)) {
1923
+ maxDays = 29;
1924
+ }
1925
+ if (day > maxDays) {
1926
+ throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year2}: ${day}`);
1927
+ }
1928
+ };
1929
+ var isLeapYear = (year2) => {
1930
+ return year2 % 4 === 0 && (year2 % 100 !== 0 || year2 % 400 === 0);
1931
+ };
1932
+ var parseDateValue = (value, type, lower, upper) => {
1933
+ const dateVal = strictParseByte(stripLeadingZeroes(value));
1934
+ if (dateVal < lower || dateVal > upper) {
1935
+ throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);
1936
+ }
1937
+ return dateVal;
1938
+ };
1939
+ var parseMilliseconds = (value) => {
1940
+ if (value === null || value === undefined) {
1941
+ return 0;
1942
+ }
1943
+ return strictParseFloat32("0." + value) * 1000;
1944
+ };
1945
+ var parseOffsetToMilliseconds = (value) => {
1946
+ const directionStr = value[0];
1947
+ let direction = 1;
1948
+ if (directionStr == "+") {
1949
+ direction = 1;
1950
+ } else if (directionStr == "-") {
1951
+ direction = -1;
1952
+ } else {
1953
+ throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`);
1954
+ }
1955
+ const hour = Number(value.substring(1, 3));
1956
+ const minute = Number(value.substring(4, 6));
1957
+ return direction * (hour * 60 + minute) * 60 * 1000;
1958
+ };
1959
+ var stripLeadingZeroes = (value) => {
1960
+ let idx = 0;
1961
+ while (idx < value.length - 1 && value.charAt(idx) === "0") {
1962
+ idx++;
1963
+ }
1964
+ if (idx === 0) {
1965
+ return value;
1966
+ }
1967
+ return value.slice(idx);
1968
+ };
1969
+ var LazyJsonString = function LazyJsonString2(val) {
1970
+ const str = Object.assign(new String(val), {
1971
+ deserializeJSON() {
1972
+ return JSON.parse(String(val));
1973
+ },
1974
+ toString() {
1975
+ return String(val);
1976
+ },
1977
+ toJSON() {
1978
+ return String(val);
1979
+ }
1980
+ });
1981
+ return str;
1982
+ };
1983
+ LazyJsonString.from = (object) => {
1984
+ if (object && typeof object === "object" && (object instanceof LazyJsonString || ("deserializeJSON" in object))) {
1985
+ return object;
1986
+ } else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
1987
+ return LazyJsonString(String(object));
1988
+ }
1989
+ return LazyJsonString(JSON.stringify(object));
1990
+ };
1991
+ LazyJsonString.fromObject = LazyJsonString.from;
1992
+ function quoteHeader(part) {
1993
+ if (part.includes(",") || part.includes('"')) {
1994
+ part = `"${part.replace(/"/g, "\\\"")}"`;
1995
+ }
1996
+ return part;
1997
+ }
1998
+ var ddd = `(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?`;
1999
+ var mmm = `(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)`;
2000
+ var time = `(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?`;
2001
+ var date = `(\\d?\\d)`;
2002
+ var year = `(\\d{4})`;
2003
+ var RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/);
2004
+ var IMF_FIXDATE = new RegExp(`^${ddd}, ${date} ${mmm} ${year} ${time} GMT$`);
2005
+ var RFC_850_DATE = new RegExp(`^${ddd}, ${date}-${mmm}-(\\d\\d) ${time} GMT$`);
2006
+ var ASC_TIME = new RegExp(`^${ddd} ${mmm} ( [1-9]|\\d\\d) ${time} ${year}$`);
2007
+ var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2008
+ var _parseEpochTimestamp = (value) => {
2009
+ if (value == null) {
2010
+ return;
2011
+ }
2012
+ let num = NaN;
2013
+ if (typeof value === "number") {
2014
+ num = value;
2015
+ } else if (typeof value === "string") {
2016
+ if (!/^-?\d*\.?\d+$/.test(value)) {
2017
+ throw new TypeError(`parseEpochTimestamp - numeric string invalid.`);
2018
+ }
2019
+ num = Number.parseFloat(value);
2020
+ } else if (typeof value === "object" && value.tag === 1) {
2021
+ num = value.value;
2022
+ }
2023
+ if (isNaN(num) || Math.abs(num) === Infinity) {
2024
+ throw new TypeError("Epoch timestamps must be valid finite numbers.");
2025
+ }
2026
+ return new Date(Math.round(num * 1000));
2027
+ };
2028
+ var _parseRfc3339DateTimeWithOffset = (value) => {
2029
+ if (value == null) {
2030
+ return;
2031
+ }
2032
+ if (typeof value !== "string") {
2033
+ throw new TypeError("RFC3339 timestamps must be strings");
2034
+ }
2035
+ const matches = RFC3339_WITH_OFFSET.exec(value);
2036
+ if (!matches) {
2037
+ throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);
2038
+ }
2039
+ const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms, offsetStr] = matches;
2040
+ range(monthStr, 1, 12);
2041
+ range(dayStr, 1, 31);
2042
+ range(hours, 0, 23);
2043
+ range(minutes, 0, 59);
2044
+ range(seconds, 0, 60);
2045
+ const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms) ? Math.round(parseFloat(`0.${ms}`) * 1000) : 0));
2046
+ date2.setUTCFullYear(Number(yearStr));
2047
+ if (offsetStr.toUpperCase() != "Z") {
2048
+ const [, sign, offsetH, offsetM] = /([+-])(\d\d):(\d\d)/.exec(offsetStr) || [undefined, "+", 0, 0];
2049
+ const scalar = sign === "-" ? 1 : -1;
2050
+ date2.setTime(date2.getTime() + scalar * (Number(offsetH) * 60 * 60 * 1000 + Number(offsetM) * 60 * 1000));
2051
+ }
2052
+ return date2;
2053
+ };
2054
+ var _parseRfc7231DateTime = (value) => {
2055
+ if (value == null) {
2056
+ return;
2057
+ }
2058
+ if (typeof value !== "string") {
2059
+ throw new TypeError("RFC7231 timestamps must be strings.");
2060
+ }
2061
+ let day;
2062
+ let month;
2063
+ let year2;
2064
+ let hour;
2065
+ let minute;
2066
+ let second;
2067
+ let fraction;
2068
+ let matches;
2069
+ if (matches = IMF_FIXDATE.exec(value)) {
2070
+ [, day, month, year2, hour, minute, second, fraction] = matches;
2071
+ } else if (matches = RFC_850_DATE.exec(value)) {
2072
+ [, day, month, year2, hour, minute, second, fraction] = matches;
2073
+ year2 = (Number(year2) + 1900).toString();
2074
+ } else if (matches = ASC_TIME.exec(value)) {
2075
+ [, month, day, hour, minute, second, fraction, year2] = matches;
2076
+ }
2077
+ if (year2 && second) {
2078
+ const timestamp = Date.UTC(Number(year2), months.indexOf(month), Number(day), Number(hour), Number(minute), Number(second), fraction ? Math.round(parseFloat(`0.${fraction}`) * 1000) : 0);
2079
+ range(day, 1, 31);
2080
+ range(hour, 0, 23);
2081
+ range(minute, 0, 59);
2082
+ range(second, 0, 60);
2083
+ const date2 = new Date(timestamp);
2084
+ date2.setUTCFullYear(Number(year2));
2085
+ return date2;
2086
+ }
2087
+ throw new TypeError(`Invalid RFC7231 date-time value ${value}.`);
2088
+ };
2089
+ function range(v, min, max) {
2090
+ const _v = Number(v);
2091
+ if (_v < min || _v > max) {
2092
+ throw new Error(`Value ${_v} out of range [${min}, ${max}]`);
2093
+ }
2094
+ }
2095
+ function splitEvery(value, delimiter, numDelimiters) {
2096
+ if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) {
2097
+ throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery.");
2098
+ }
2099
+ const segments = value.split(delimiter);
2100
+ if (numDelimiters === 1) {
2101
+ return segments;
2102
+ }
2103
+ const compoundSegments = [];
2104
+ let currentSegment = "";
2105
+ for (let i = 0;i < segments.length; i++) {
2106
+ if (currentSegment === "") {
2107
+ currentSegment = segments[i];
2108
+ } else {
2109
+ currentSegment += delimiter + segments[i];
2110
+ }
2111
+ if ((i + 1) % numDelimiters === 0) {
2112
+ compoundSegments.push(currentSegment);
2113
+ currentSegment = "";
2114
+ }
2115
+ }
2116
+ if (currentSegment !== "") {
2117
+ compoundSegments.push(currentSegment);
2118
+ }
2119
+ return compoundSegments;
2120
+ }
2121
+ var splitHeader = (value) => {
2122
+ const z = value.length;
2123
+ const values = [];
2124
+ let withinQuotes = false;
2125
+ let prevChar = undefined;
2126
+ let anchor = 0;
2127
+ for (let i = 0;i < z; ++i) {
2128
+ const char = value[i];
2129
+ switch (char) {
2130
+ case `"`:
2131
+ if (prevChar !== "\\") {
2132
+ withinQuotes = !withinQuotes;
2133
+ }
2134
+ break;
2135
+ case ",":
2136
+ if (!withinQuotes) {
2137
+ values.push(value.slice(anchor, i));
2138
+ anchor = i + 1;
2139
+ }
2140
+ break;
2141
+ }
2142
+ prevChar = char;
2143
+ }
2144
+ values.push(value.slice(anchor));
2145
+ return values.map((v) => {
2146
+ v = v.trim();
2147
+ const z2 = v.length;
2148
+ if (z2 < 2) {
2149
+ return v;
2150
+ }
2151
+ if (v[0] === `"` && v[z2 - 1] === `"`) {
2152
+ v = v.slice(1, z2 - 1);
2153
+ }
2154
+ return v.replace(/\\"/g, '"');
2155
+ });
2156
+ };
2157
+ var format = /^-?\d*(\.\d+)?$/;
2158
+
2159
+ class NumericValue {
2160
+ string;
2161
+ type;
2162
+ constructor(string, type) {
2163
+ this.string = string;
2164
+ this.type = type;
2165
+ if (!format.test(string)) {
2166
+ throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
2167
+ }
2168
+ }
2169
+ toString() {
2170
+ return this.string;
2171
+ }
2172
+ static [Symbol.hasInstance](object) {
2173
+ if (!object || typeof object !== "object") {
2174
+ return false;
2175
+ }
2176
+ const _nv = object;
2177
+ return NumericValue.prototype.isPrototypeOf(object) || _nv.type === "bigDecimal" && format.test(_nv.string);
2178
+ }
2179
+ }
2180
+ function nv(input) {
2181
+ return new NumericValue(String(input), "bigDecimal");
2182
+ }
2183
+ exports.generateIdempotencyToken = uuid.v4;
2184
+ exports.LazyJsonString = LazyJsonString;
2185
+ exports.NumericValue = NumericValue;
2186
+ exports._parseEpochTimestamp = _parseEpochTimestamp;
2187
+ exports._parseRfc3339DateTimeWithOffset = _parseRfc3339DateTimeWithOffset;
2188
+ exports._parseRfc7231DateTime = _parseRfc7231DateTime;
2189
+ exports.copyDocumentWithTransform = copyDocumentWithTransform;
2190
+ exports.dateToUtcString = dateToUtcString;
2191
+ exports.expectBoolean = expectBoolean;
2192
+ exports.expectByte = expectByte;
2193
+ exports.expectFloat32 = expectFloat32;
2194
+ exports.expectInt = expectInt;
2195
+ exports.expectInt32 = expectInt32;
2196
+ exports.expectLong = expectLong;
2197
+ exports.expectNonNull = expectNonNull;
2198
+ exports.expectNumber = expectNumber;
2199
+ exports.expectObject = expectObject;
2200
+ exports.expectShort = expectShort;
2201
+ exports.expectString = expectString;
2202
+ exports.expectUnion = expectUnion;
2203
+ exports.handleFloat = handleFloat;
2204
+ exports.limitedParseDouble = limitedParseDouble;
2205
+ exports.limitedParseFloat = limitedParseFloat;
2206
+ exports.limitedParseFloat32 = limitedParseFloat32;
2207
+ exports.logger = logger;
2208
+ exports.nv = nv;
2209
+ exports.parseBoolean = parseBoolean;
2210
+ exports.parseEpochTimestamp = parseEpochTimestamp;
2211
+ exports.parseRfc3339DateTime = parseRfc3339DateTime;
2212
+ exports.parseRfc3339DateTimeWithOffset = parseRfc3339DateTimeWithOffset;
2213
+ exports.parseRfc7231DateTime = parseRfc7231DateTime;
2214
+ exports.quoteHeader = quoteHeader;
2215
+ exports.splitEvery = splitEvery;
2216
+ exports.splitHeader = splitHeader;
2217
+ exports.strictParseByte = strictParseByte;
2218
+ exports.strictParseDouble = strictParseDouble;
2219
+ exports.strictParseFloat = strictParseFloat;
2220
+ exports.strictParseFloat32 = strictParseFloat32;
2221
+ exports.strictParseInt = strictParseInt;
2222
+ exports.strictParseInt32 = strictParseInt32;
2223
+ exports.strictParseLong = strictParseLong;
2224
+ exports.strictParseShort = strictParseShort;
2225
+ });
2226
+
2227
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.js
2228
+ var require_ChecksumStream = __commonJS((exports) => {
2229
+ Object.defineProperty(exports, "__esModule", { value: true });
2230
+ exports.ChecksumStream = undefined;
2231
+ var util_base64_1 = require_dist_cjs8();
2232
+ var stream_1 = __require("stream");
2233
+
2234
+ class ChecksumStream extends stream_1.Duplex {
2235
+ expectedChecksum;
2236
+ checksumSourceLocation;
2237
+ checksum;
2238
+ source;
2239
+ base64Encoder;
2240
+ pendingCallback = null;
2241
+ constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) {
2242
+ super();
2243
+ if (typeof source.pipe === "function") {
2244
+ this.source = source;
2245
+ } else {
2246
+ throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
2247
+ }
2248
+ this.base64Encoder = base64Encoder ?? util_base64_1.toBase64;
2249
+ this.expectedChecksum = expectedChecksum;
2250
+ this.checksum = checksum;
2251
+ this.checksumSourceLocation = checksumSourceLocation;
2252
+ this.source.pipe(this);
2253
+ }
2254
+ _read(size) {
2255
+ if (this.pendingCallback) {
2256
+ const callback = this.pendingCallback;
2257
+ this.pendingCallback = null;
2258
+ callback();
2259
+ }
2260
+ }
2261
+ _write(chunk, encoding, callback) {
2262
+ try {
2263
+ this.checksum.update(chunk);
2264
+ const canPushMore = this.push(chunk);
2265
+ if (!canPushMore) {
2266
+ this.pendingCallback = callback;
2267
+ return;
2268
+ }
2269
+ } catch (e) {
2270
+ return callback(e);
2271
+ }
2272
+ return callback();
2273
+ }
2274
+ async _final(callback) {
2275
+ try {
2276
+ const digest = await this.checksum.digest();
2277
+ const received = this.base64Encoder(digest);
2278
+ if (this.expectedChecksum !== received) {
2279
+ return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}"` + ` in response header "${this.checksumSourceLocation}".`));
2280
+ }
2281
+ } catch (e) {
2282
+ return callback(e);
2283
+ }
2284
+ this.push(null);
2285
+ return callback();
2286
+ }
2287
+ }
2288
+ exports.ChecksumStream = ChecksumStream;
2289
+ });
2290
+
2291
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js
2292
+ var require_stream_type_check = __commonJS((exports) => {
2293
+ Object.defineProperty(exports, "__esModule", { value: true });
2294
+ exports.isBlob = exports.isReadableStream = undefined;
2295
+ var isReadableStream = (stream) => typeof ReadableStream === "function" && (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
2296
+ exports.isReadableStream = isReadableStream;
2297
+ var isBlob = (blob) => {
2298
+ return typeof Blob === "function" && (blob?.constructor?.name === Blob.name || blob instanceof Blob);
2299
+ };
2300
+ exports.isBlob = isBlob;
2301
+ });
2302
+
2303
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.browser.js
2304
+ var require_ChecksumStream_browser = __commonJS((exports) => {
2305
+ Object.defineProperty(exports, "__esModule", { value: true });
2306
+ exports.ChecksumStream = undefined;
2307
+ var ReadableStreamRef = typeof ReadableStream === "function" ? ReadableStream : function() {};
2308
+
2309
+ class ChecksumStream extends ReadableStreamRef {
2310
+ }
2311
+ exports.ChecksumStream = ChecksumStream;
2312
+ });
2313
+
2314
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.browser.js
2315
+ var require_createChecksumStream_browser = __commonJS((exports) => {
2316
+ Object.defineProperty(exports, "__esModule", { value: true });
2317
+ exports.createChecksumStream = undefined;
2318
+ var util_base64_1 = require_dist_cjs8();
2319
+ var stream_type_check_1 = require_stream_type_check();
2320
+ var ChecksumStream_browser_1 = require_ChecksumStream_browser();
2321
+ var createChecksumStream = ({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) => {
2322
+ if (!(0, stream_type_check_1.isReadableStream)(source)) {
2323
+ throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
2324
+ }
2325
+ const encoder = base64Encoder ?? util_base64_1.toBase64;
2326
+ if (typeof TransformStream !== "function") {
2327
+ throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");
2328
+ }
2329
+ const transform = new TransformStream({
2330
+ start() {},
2331
+ async transform(chunk, controller) {
2332
+ checksum.update(chunk);
2333
+ controller.enqueue(chunk);
2334
+ },
2335
+ async flush(controller) {
2336
+ const digest = await checksum.digest();
2337
+ const received = encoder(digest);
2338
+ if (expectedChecksum !== received) {
2339
+ const error = new Error(`Checksum mismatch: expected "${expectedChecksum}" but received "${received}"` + ` in response header "${checksumSourceLocation}".`);
2340
+ controller.error(error);
2341
+ } else {
2342
+ controller.terminate();
2343
+ }
2344
+ }
2345
+ });
2346
+ source.pipeThrough(transform);
2347
+ const readable = transform.readable;
2348
+ Object.setPrototypeOf(readable, ChecksumStream_browser_1.ChecksumStream.prototype);
2349
+ return readable;
2350
+ };
2351
+ exports.createChecksumStream = createChecksumStream;
2352
+ });
2353
+
2354
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.js
2355
+ var require_createChecksumStream = __commonJS((exports) => {
2356
+ Object.defineProperty(exports, "__esModule", { value: true });
2357
+ exports.createChecksumStream = createChecksumStream;
2358
+ var stream_type_check_1 = require_stream_type_check();
2359
+ var ChecksumStream_1 = require_ChecksumStream();
2360
+ var createChecksumStream_browser_1 = require_createChecksumStream_browser();
2361
+ function createChecksumStream(init) {
2362
+ if (typeof ReadableStream === "function" && (0, stream_type_check_1.isReadableStream)(init.source)) {
2363
+ return (0, createChecksumStream_browser_1.createChecksumStream)(init);
2364
+ }
2365
+ return new ChecksumStream_1.ChecksumStream(init);
2366
+ }
2367
+ });
2368
+
2369
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/ByteArrayCollector.js
2370
+ var require_ByteArrayCollector = __commonJS((exports) => {
2371
+ Object.defineProperty(exports, "__esModule", { value: true });
2372
+ exports.ByteArrayCollector = undefined;
2373
+
2374
+ class ByteArrayCollector {
2375
+ allocByteArray;
2376
+ byteLength = 0;
2377
+ byteArrays = [];
2378
+ constructor(allocByteArray) {
2379
+ this.allocByteArray = allocByteArray;
2380
+ }
2381
+ push(byteArray) {
2382
+ this.byteArrays.push(byteArray);
2383
+ this.byteLength += byteArray.byteLength;
2384
+ }
2385
+ flush() {
2386
+ if (this.byteArrays.length === 1) {
2387
+ const bytes = this.byteArrays[0];
2388
+ this.reset();
2389
+ return bytes;
2390
+ }
2391
+ const aggregation = this.allocByteArray(this.byteLength);
2392
+ let cursor = 0;
2393
+ for (let i = 0;i < this.byteArrays.length; ++i) {
2394
+ const bytes = this.byteArrays[i];
2395
+ aggregation.set(bytes, cursor);
2396
+ cursor += bytes.byteLength;
2397
+ }
2398
+ this.reset();
2399
+ return aggregation;
2400
+ }
2401
+ reset() {
2402
+ this.byteArrays = [];
2403
+ this.byteLength = 0;
2404
+ }
2405
+ }
2406
+ exports.ByteArrayCollector = ByteArrayCollector;
2407
+ });
2408
+
2409
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/createBufferedReadableStream.js
2410
+ var require_createBufferedReadableStream = __commonJS((exports) => {
2411
+ Object.defineProperty(exports, "__esModule", { value: true });
2412
+ exports.createBufferedReadable = undefined;
2413
+ exports.createBufferedReadableStream = createBufferedReadableStream;
2414
+ exports.merge = merge;
2415
+ exports.flush = flush;
2416
+ exports.sizeOf = sizeOf;
2417
+ exports.modeOf = modeOf;
2418
+ var ByteArrayCollector_1 = require_ByteArrayCollector();
2419
+ function createBufferedReadableStream(upstream, size, logger) {
2420
+ const reader = upstream.getReader();
2421
+ let streamBufferingLoggedWarning = false;
2422
+ let bytesSeen = 0;
2423
+ const buffers = ["", new ByteArrayCollector_1.ByteArrayCollector((size2) => new Uint8Array(size2))];
2424
+ let mode = -1;
2425
+ const pull = async (controller) => {
2426
+ const { value, done } = await reader.read();
2427
+ const chunk = value;
2428
+ if (done) {
2429
+ if (mode !== -1) {
2430
+ const remainder = flush(buffers, mode);
2431
+ if (sizeOf(remainder) > 0) {
2432
+ controller.enqueue(remainder);
2433
+ }
2434
+ }
2435
+ controller.close();
2436
+ } else {
2437
+ const chunkMode = modeOf(chunk, false);
2438
+ if (mode !== chunkMode) {
2439
+ if (mode >= 0) {
2440
+ controller.enqueue(flush(buffers, mode));
2441
+ }
2442
+ mode = chunkMode;
2443
+ }
2444
+ if (mode === -1) {
2445
+ controller.enqueue(chunk);
2446
+ return;
2447
+ }
2448
+ const chunkSize = sizeOf(chunk);
2449
+ bytesSeen += chunkSize;
2450
+ const bufferSize = sizeOf(buffers[mode]);
2451
+ if (chunkSize >= size && bufferSize === 0) {
2452
+ controller.enqueue(chunk);
2453
+ } else {
2454
+ const newSize = merge(buffers, mode, chunk);
2455
+ if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
2456
+ streamBufferingLoggedWarning = true;
2457
+ logger?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
2458
+ }
2459
+ if (newSize >= size) {
2460
+ controller.enqueue(flush(buffers, mode));
2461
+ } else {
2462
+ await pull(controller);
2463
+ }
2464
+ }
2465
+ }
2466
+ };
2467
+ return new ReadableStream({
2468
+ pull
2469
+ });
2470
+ }
2471
+ exports.createBufferedReadable = createBufferedReadableStream;
2472
+ function merge(buffers, mode, chunk) {
2473
+ switch (mode) {
2474
+ case 0:
2475
+ buffers[0] += chunk;
2476
+ return sizeOf(buffers[0]);
2477
+ case 1:
2478
+ case 2:
2479
+ buffers[mode].push(chunk);
2480
+ return sizeOf(buffers[mode]);
2481
+ }
2482
+ }
2483
+ function flush(buffers, mode) {
2484
+ switch (mode) {
2485
+ case 0:
2486
+ const s = buffers[0];
2487
+ buffers[0] = "";
2488
+ return s;
2489
+ case 1:
2490
+ case 2:
2491
+ return buffers[mode].flush();
2492
+ }
2493
+ throw new Error(`@smithy/util-stream - invalid index ${mode} given to flush()`);
2494
+ }
2495
+ function sizeOf(chunk) {
2496
+ return chunk?.byteLength ?? chunk?.length ?? 0;
2497
+ }
2498
+ function modeOf(chunk, allowBuffer = true) {
2499
+ if (allowBuffer && typeof Buffer !== "undefined" && chunk instanceof Buffer) {
2500
+ return 2;
2501
+ }
2502
+ if (chunk instanceof Uint8Array) {
2503
+ return 1;
2504
+ }
2505
+ if (typeof chunk === "string") {
2506
+ return 0;
2507
+ }
2508
+ return -1;
2509
+ }
2510
+ });
2511
+
2512
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/createBufferedReadable.js
2513
+ var require_createBufferedReadable = __commonJS((exports) => {
2514
+ Object.defineProperty(exports, "__esModule", { value: true });
2515
+ exports.createBufferedReadable = createBufferedReadable;
2516
+ var node_stream_1 = __require("stream");
2517
+ var ByteArrayCollector_1 = require_ByteArrayCollector();
2518
+ var createBufferedReadableStream_1 = require_createBufferedReadableStream();
2519
+ var stream_type_check_1 = require_stream_type_check();
2520
+ function createBufferedReadable(upstream, size, logger) {
2521
+ if ((0, stream_type_check_1.isReadableStream)(upstream)) {
2522
+ return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size, logger);
2523
+ }
2524
+ const downstream = new node_stream_1.Readable({ read() {} });
2525
+ let streamBufferingLoggedWarning = false;
2526
+ let bytesSeen = 0;
2527
+ const buffers = [
2528
+ "",
2529
+ new ByteArrayCollector_1.ByteArrayCollector((size2) => new Uint8Array(size2)),
2530
+ new ByteArrayCollector_1.ByteArrayCollector((size2) => Buffer.from(new Uint8Array(size2)))
2531
+ ];
2532
+ let mode = -1;
2533
+ upstream.on("data", (chunk) => {
2534
+ const chunkMode = (0, createBufferedReadableStream_1.modeOf)(chunk, true);
2535
+ if (mode !== chunkMode) {
2536
+ if (mode >= 0) {
2537
+ downstream.push((0, createBufferedReadableStream_1.flush)(buffers, mode));
2538
+ }
2539
+ mode = chunkMode;
2540
+ }
2541
+ if (mode === -1) {
2542
+ downstream.push(chunk);
2543
+ return;
2544
+ }
2545
+ const chunkSize = (0, createBufferedReadableStream_1.sizeOf)(chunk);
2546
+ bytesSeen += chunkSize;
2547
+ const bufferSize = (0, createBufferedReadableStream_1.sizeOf)(buffers[mode]);
2548
+ if (chunkSize >= size && bufferSize === 0) {
2549
+ downstream.push(chunk);
2550
+ } else {
2551
+ const newSize = (0, createBufferedReadableStream_1.merge)(buffers, mode, chunk);
2552
+ if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
2553
+ streamBufferingLoggedWarning = true;
2554
+ logger?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
2555
+ }
2556
+ if (newSize >= size) {
2557
+ downstream.push((0, createBufferedReadableStream_1.flush)(buffers, mode));
2558
+ }
2559
+ }
2560
+ });
2561
+ upstream.on("end", () => {
2562
+ if (mode !== -1) {
2563
+ const remainder = (0, createBufferedReadableStream_1.flush)(buffers, mode);
2564
+ if ((0, createBufferedReadableStream_1.sizeOf)(remainder) > 0) {
2565
+ downstream.push(remainder);
2566
+ }
2567
+ }
2568
+ downstream.push(null);
2569
+ });
2570
+ return downstream;
2571
+ }
2572
+ });
2573
+
2574
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.browser.js
2575
+ var require_getAwsChunkedEncodingStream_browser = __commonJS((exports) => {
2576
+ Object.defineProperty(exports, "__esModule", { value: true });
2577
+ exports.getAwsChunkedEncodingStream = undefined;
2578
+ var getAwsChunkedEncodingStream = (readableStream, options) => {
2579
+ const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options;
2580
+ const checksumRequired = base64Encoder !== undefined && bodyLengthChecker !== undefined && checksumAlgorithmFn !== undefined && checksumLocationName !== undefined && streamHasher !== undefined;
2581
+ const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : undefined;
2582
+ const reader = readableStream.getReader();
2583
+ return new ReadableStream({
2584
+ async pull(controller) {
2585
+ const { value, done } = await reader.read();
2586
+ if (done) {
2587
+ controller.enqueue(`0\r
2588
+ `);
2589
+ if (checksumRequired) {
2590
+ const checksum = base64Encoder(await digest);
2591
+ controller.enqueue(`${checksumLocationName}:${checksum}\r
2592
+ `);
2593
+ controller.enqueue(`\r
2594
+ `);
2595
+ }
2596
+ controller.close();
2597
+ } else {
2598
+ controller.enqueue(`${(bodyLengthChecker(value) || 0).toString(16)}\r
2599
+ ${value}\r
2600
+ `);
2601
+ }
2602
+ }
2603
+ });
2604
+ };
2605
+ exports.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream;
2606
+ });
2607
+
2608
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js
2609
+ var require_getAwsChunkedEncodingStream = __commonJS((exports) => {
2610
+ Object.defineProperty(exports, "__esModule", { value: true });
2611
+ exports.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream;
2612
+ var node_stream_1 = __require("stream");
2613
+ var getAwsChunkedEncodingStream_browser_1 = require_getAwsChunkedEncodingStream_browser();
2614
+ var stream_type_check_1 = require_stream_type_check();
2615
+ function getAwsChunkedEncodingStream(stream, options) {
2616
+ const readable = stream;
2617
+ const readableStream = stream;
2618
+ if ((0, stream_type_check_1.isReadableStream)(readableStream)) {
2619
+ return (0, getAwsChunkedEncodingStream_browser_1.getAwsChunkedEncodingStream)(readableStream, options);
2620
+ }
2621
+ const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options;
2622
+ const checksumRequired = base64Encoder !== undefined && checksumAlgorithmFn !== undefined && checksumLocationName !== undefined && streamHasher !== undefined;
2623
+ const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readable) : undefined;
2624
+ const awsChunkedEncodingStream = new node_stream_1.Readable({
2625
+ read: () => {}
2626
+ });
2627
+ readable.on("data", (data) => {
2628
+ const length = bodyLengthChecker(data) || 0;
2629
+ if (length === 0) {
2630
+ return;
2631
+ }
2632
+ awsChunkedEncodingStream.push(`${length.toString(16)}\r
2633
+ `);
2634
+ awsChunkedEncodingStream.push(data);
2635
+ awsChunkedEncodingStream.push(`\r
2636
+ `);
2637
+ });
2638
+ readable.on("end", async () => {
2639
+ awsChunkedEncodingStream.push(`0\r
2640
+ `);
2641
+ if (checksumRequired) {
2642
+ const checksum = base64Encoder(await digest);
2643
+ awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r
2644
+ `);
2645
+ awsChunkedEncodingStream.push(`\r
2646
+ `);
2647
+ }
2648
+ awsChunkedEncodingStream.push(null);
2649
+ });
2650
+ return awsChunkedEncodingStream;
2651
+ }
2652
+ });
2653
+
2654
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js
2655
+ var require_headStream_browser = __commonJS((exports) => {
2656
+ Object.defineProperty(exports, "__esModule", { value: true });
2657
+ exports.headStream = headStream;
2658
+ async function headStream(stream, bytes) {
2659
+ let byteLengthCounter = 0;
2660
+ const chunks = [];
2661
+ const reader = stream.getReader();
2662
+ let isDone = false;
2663
+ while (!isDone) {
2664
+ const { done, value } = await reader.read();
2665
+ if (value) {
2666
+ chunks.push(value);
2667
+ byteLengthCounter += value?.byteLength ?? 0;
2668
+ }
2669
+ if (byteLengthCounter >= bytes) {
2670
+ break;
2671
+ }
2672
+ isDone = done;
2673
+ }
2674
+ reader.releaseLock();
2675
+ const collected = new Uint8Array(Math.min(bytes, byteLengthCounter));
2676
+ let offset = 0;
2677
+ for (const chunk of chunks) {
2678
+ if (chunk.byteLength > collected.byteLength - offset) {
2679
+ collected.set(chunk.subarray(0, collected.byteLength - offset), offset);
2680
+ break;
2681
+ } else {
2682
+ collected.set(chunk, offset);
2683
+ }
2684
+ offset += chunk.length;
2685
+ }
2686
+ return collected;
2687
+ }
2688
+ });
2689
+
2690
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/headStream.js
2691
+ var require_headStream = __commonJS((exports) => {
2692
+ Object.defineProperty(exports, "__esModule", { value: true });
2693
+ exports.headStream = undefined;
2694
+ var stream_1 = __require("stream");
2695
+ var headStream_browser_1 = require_headStream_browser();
2696
+ var stream_type_check_1 = require_stream_type_check();
2697
+ var headStream = (stream, bytes) => {
2698
+ if ((0, stream_type_check_1.isReadableStream)(stream)) {
2699
+ return (0, headStream_browser_1.headStream)(stream, bytes);
2700
+ }
2701
+ return new Promise((resolve, reject) => {
2702
+ const collector = new Collector;
2703
+ collector.limit = bytes;
2704
+ stream.pipe(collector);
2705
+ stream.on("error", (err) => {
2706
+ collector.end();
2707
+ reject(err);
2708
+ });
2709
+ collector.on("error", reject);
2710
+ collector.on("finish", function() {
2711
+ const bytes2 = new Uint8Array(Buffer.concat(this.buffers));
2712
+ resolve(bytes2);
2713
+ });
2714
+ });
2715
+ };
2716
+ exports.headStream = headStream;
2717
+
2718
+ class Collector extends stream_1.Writable {
2719
+ buffers = [];
2720
+ limit = Infinity;
2721
+ bytesBuffered = 0;
2722
+ _write(chunk, encoding, callback) {
2723
+ this.buffers.push(chunk);
2724
+ this.bytesBuffered += chunk.byteLength ?? 0;
2725
+ if (this.bytesBuffered >= this.limit) {
2726
+ const excess = this.bytesBuffered - this.limit;
2727
+ const tailBuffer = this.buffers[this.buffers.length - 1];
2728
+ this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess);
2729
+ this.emit("finish");
2730
+ }
2731
+ callback();
2732
+ }
2733
+ }
2734
+ });
2735
+
2736
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js
2737
+ var require_sdk_stream_mixin_browser = __commonJS((exports) => {
2738
+ Object.defineProperty(exports, "__esModule", { value: true });
2739
+ exports.sdkStreamMixin = undefined;
2740
+ var fetch_http_handler_1 = require_dist_cjs9();
2741
+ var util_base64_1 = require_dist_cjs8();
2742
+ var util_hex_encoding_1 = require_dist_cjs10();
2743
+ var util_utf8_1 = require_dist_cjs7();
2744
+ var stream_type_check_1 = require_stream_type_check();
2745
+ var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
2746
+ var sdkStreamMixin = (stream) => {
2747
+ if (!isBlobInstance(stream) && !(0, stream_type_check_1.isReadableStream)(stream)) {
2748
+ const name = stream?.__proto__?.constructor?.name || stream;
2749
+ throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`);
2750
+ }
2751
+ let transformed = false;
2752
+ const transformToByteArray = async () => {
2753
+ if (transformed) {
2754
+ throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
2755
+ }
2756
+ transformed = true;
2757
+ return await (0, fetch_http_handler_1.streamCollector)(stream);
2758
+ };
2759
+ const blobToWebStream = (blob) => {
2760
+ if (typeof blob.stream !== "function") {
2761
+ throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
2762
+ ` + "If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");
2763
+ }
2764
+ return blob.stream();
2765
+ };
2766
+ return Object.assign(stream, {
2767
+ transformToByteArray,
2768
+ transformToString: async (encoding) => {
2769
+ const buf = await transformToByteArray();
2770
+ if (encoding === "base64") {
2771
+ return (0, util_base64_1.toBase64)(buf);
2772
+ } else if (encoding === "hex") {
2773
+ return (0, util_hex_encoding_1.toHex)(buf);
2774
+ } else if (encoding === undefined || encoding === "utf8" || encoding === "utf-8") {
2775
+ return (0, util_utf8_1.toUtf8)(buf);
2776
+ } else if (typeof TextDecoder === "function") {
2777
+ return new TextDecoder(encoding).decode(buf);
2778
+ } else {
2779
+ throw new Error("TextDecoder is not available, please make sure polyfill is provided.");
2780
+ }
2781
+ },
2782
+ transformToWebStream: () => {
2783
+ if (transformed) {
2784
+ throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
2785
+ }
2786
+ transformed = true;
2787
+ if (isBlobInstance(stream)) {
2788
+ return blobToWebStream(stream);
2789
+ } else if ((0, stream_type_check_1.isReadableStream)(stream)) {
2790
+ return stream;
2791
+ } else {
2792
+ throw new Error(`Cannot transform payload to web stream, got ${stream}`);
2793
+ }
2794
+ }
2795
+ });
2796
+ };
2797
+ exports.sdkStreamMixin = sdkStreamMixin;
2798
+ var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
2799
+ });
2800
+
2801
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js
2802
+ var require_sdk_stream_mixin = __commonJS((exports) => {
2803
+ Object.defineProperty(exports, "__esModule", { value: true });
2804
+ exports.sdkStreamMixin = undefined;
2805
+ var node_http_handler_1 = require_dist_cjs11();
2806
+ var util_buffer_from_1 = require_dist_cjs6();
2807
+ var stream_1 = __require("stream");
2808
+ var sdk_stream_mixin_browser_1 = require_sdk_stream_mixin_browser();
2809
+ var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
2810
+ var sdkStreamMixin = (stream) => {
2811
+ if (!(stream instanceof stream_1.Readable)) {
2812
+ try {
2813
+ return (0, sdk_stream_mixin_browser_1.sdkStreamMixin)(stream);
2814
+ } catch (e) {
2815
+ const name = stream?.__proto__?.constructor?.name || stream;
2816
+ throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
2817
+ }
2818
+ }
2819
+ let transformed = false;
2820
+ const transformToByteArray = async () => {
2821
+ if (transformed) {
2822
+ throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
2823
+ }
2824
+ transformed = true;
2825
+ return await (0, node_http_handler_1.streamCollector)(stream);
2826
+ };
2827
+ return Object.assign(stream, {
2828
+ transformToByteArray,
2829
+ transformToString: async (encoding) => {
2830
+ const buf = await transformToByteArray();
2831
+ if (encoding === undefined || Buffer.isEncoding(encoding)) {
2832
+ return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding);
2833
+ } else {
2834
+ const decoder = new TextDecoder(encoding);
2835
+ return decoder.decode(buf);
2836
+ }
2837
+ },
2838
+ transformToWebStream: () => {
2839
+ if (transformed) {
2840
+ throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
2841
+ }
2842
+ if (stream.readableFlowing !== null) {
2843
+ throw new Error("The stream has been consumed by other callbacks.");
2844
+ }
2845
+ if (typeof stream_1.Readable.toWeb !== "function") {
2846
+ throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
2847
+ }
2848
+ transformed = true;
2849
+ return stream_1.Readable.toWeb(stream);
2850
+ }
2851
+ });
2852
+ };
2853
+ exports.sdkStreamMixin = sdkStreamMixin;
2854
+ });
2855
+
2856
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js
2857
+ var require_splitStream_browser = __commonJS((exports) => {
2858
+ Object.defineProperty(exports, "__esModule", { value: true });
2859
+ exports.splitStream = splitStream;
2860
+ async function splitStream(stream) {
2861
+ if (typeof stream.stream === "function") {
2862
+ stream = stream.stream();
2863
+ }
2864
+ const readableStream = stream;
2865
+ return readableStream.tee();
2866
+ }
2867
+ });
2868
+
2869
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/splitStream.js
2870
+ var require_splitStream = __commonJS((exports) => {
2871
+ Object.defineProperty(exports, "__esModule", { value: true });
2872
+ exports.splitStream = splitStream;
2873
+ var stream_1 = __require("stream");
2874
+ var splitStream_browser_1 = require_splitStream_browser();
2875
+ var stream_type_check_1 = require_stream_type_check();
2876
+ async function splitStream(stream) {
2877
+ if ((0, stream_type_check_1.isReadableStream)(stream) || (0, stream_type_check_1.isBlob)(stream)) {
2878
+ return (0, splitStream_browser_1.splitStream)(stream);
2879
+ }
2880
+ const stream1 = new stream_1.PassThrough;
2881
+ const stream2 = new stream_1.PassThrough;
2882
+ stream.pipe(stream1);
2883
+ stream.pipe(stream2);
2884
+ return [stream1, stream2];
2885
+ }
2886
+ });
2887
+
2888
+ // node_modules/.bun/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-cjs/index.js
2889
+ var require_dist_cjs12 = __commonJS((exports) => {
2890
+ var utilBase64 = require_dist_cjs8();
2891
+ var utilUtf8 = require_dist_cjs7();
2892
+ var ChecksumStream = require_ChecksumStream();
2893
+ var createChecksumStream = require_createChecksumStream();
2894
+ var createBufferedReadable = require_createBufferedReadable();
2895
+ var getAwsChunkedEncodingStream = require_getAwsChunkedEncodingStream();
2896
+ var headStream = require_headStream();
2897
+ var sdkStreamMixin = require_sdk_stream_mixin();
2898
+ var splitStream = require_splitStream();
2899
+ var streamTypeCheck = require_stream_type_check();
2900
+
2901
+ class Uint8ArrayBlobAdapter extends Uint8Array {
2902
+ static fromString(source, encoding = "utf-8") {
2903
+ if (typeof source === "string") {
2904
+ if (encoding === "base64") {
2905
+ return Uint8ArrayBlobAdapter.mutate(utilBase64.fromBase64(source));
2906
+ }
2907
+ return Uint8ArrayBlobAdapter.mutate(utilUtf8.fromUtf8(source));
2908
+ }
2909
+ throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
2910
+ }
2911
+ static mutate(source) {
2912
+ Object.setPrototypeOf(source, Uint8ArrayBlobAdapter.prototype);
2913
+ return source;
2914
+ }
2915
+ transformToString(encoding = "utf-8") {
2916
+ if (encoding === "base64") {
2917
+ return utilBase64.toBase64(this);
2918
+ }
2919
+ return utilUtf8.toUtf8(this);
2920
+ }
2921
+ }
2922
+ exports.isBlob = streamTypeCheck.isBlob;
2923
+ exports.isReadableStream = streamTypeCheck.isReadableStream;
2924
+ exports.Uint8ArrayBlobAdapter = Uint8ArrayBlobAdapter;
2925
+ Object.prototype.hasOwnProperty.call(ChecksumStream, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2926
+ enumerable: true,
2927
+ value: ChecksumStream["__proto__"]
2928
+ });
2929
+ Object.keys(ChecksumStream).forEach(function(k) {
2930
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2931
+ exports[k] = ChecksumStream[k];
2932
+ });
2933
+ Object.prototype.hasOwnProperty.call(createChecksumStream, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2934
+ enumerable: true,
2935
+ value: createChecksumStream["__proto__"]
2936
+ });
2937
+ Object.keys(createChecksumStream).forEach(function(k) {
2938
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2939
+ exports[k] = createChecksumStream[k];
2940
+ });
2941
+ Object.prototype.hasOwnProperty.call(createBufferedReadable, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2942
+ enumerable: true,
2943
+ value: createBufferedReadable["__proto__"]
2944
+ });
2945
+ Object.keys(createBufferedReadable).forEach(function(k) {
2946
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2947
+ exports[k] = createBufferedReadable[k];
2948
+ });
2949
+ Object.prototype.hasOwnProperty.call(getAwsChunkedEncodingStream, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2950
+ enumerable: true,
2951
+ value: getAwsChunkedEncodingStream["__proto__"]
2952
+ });
2953
+ Object.keys(getAwsChunkedEncodingStream).forEach(function(k) {
2954
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2955
+ exports[k] = getAwsChunkedEncodingStream[k];
2956
+ });
2957
+ Object.prototype.hasOwnProperty.call(headStream, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2958
+ enumerable: true,
2959
+ value: headStream["__proto__"]
2960
+ });
2961
+ Object.keys(headStream).forEach(function(k) {
2962
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2963
+ exports[k] = headStream[k];
2964
+ });
2965
+ Object.prototype.hasOwnProperty.call(sdkStreamMixin, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2966
+ enumerable: true,
2967
+ value: sdkStreamMixin["__proto__"]
2968
+ });
2969
+ Object.keys(sdkStreamMixin).forEach(function(k) {
2970
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2971
+ exports[k] = sdkStreamMixin[k];
2972
+ });
2973
+ Object.prototype.hasOwnProperty.call(splitStream, "__proto__") && !Object.prototype.hasOwnProperty.call(exports, "__proto__") && Object.defineProperty(exports, "__proto__", {
2974
+ enumerable: true,
2975
+ value: splitStream["__proto__"]
2976
+ });
2977
+ Object.keys(splitStream).forEach(function(k) {
2978
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
2979
+ exports[k] = splitStream[k];
2980
+ });
2981
+ });
2982
+
2983
+ // node_modules/.bun/@smithy+core@3.23.17/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js
2984
+ var require_protocols = __commonJS((exports) => {
2985
+ var utilStream = require_dist_cjs12();
2986
+ var schema = require_schema();
2987
+ var serde = require_serde();
2988
+ var protocolHttp = require_dist_cjs();
2989
+ var utilBase64 = require_dist_cjs8();
2990
+ var utilUtf8 = require_dist_cjs7();
2991
+ var collectBody = async (streamBody = new Uint8Array, context) => {
2992
+ if (streamBody instanceof Uint8Array) {
2993
+ return utilStream.Uint8ArrayBlobAdapter.mutate(streamBody);
2994
+ }
2995
+ if (!streamBody) {
2996
+ return utilStream.Uint8ArrayBlobAdapter.mutate(new Uint8Array);
2997
+ }
2998
+ const fromContext = context.streamCollector(streamBody);
2999
+ return utilStream.Uint8ArrayBlobAdapter.mutate(await fromContext);
3000
+ };
3001
+ function extendedEncodeURIComponent(str) {
3002
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
3003
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
3004
+ });
3005
+ }
3006
+
3007
+ class SerdeContext {
3008
+ serdeContext;
3009
+ setSerdeContext(serdeContext) {
3010
+ this.serdeContext = serdeContext;
3011
+ }
3012
+ }
3013
+
3014
+ class HttpProtocol extends SerdeContext {
3015
+ options;
3016
+ compositeErrorRegistry;
3017
+ constructor(options) {
3018
+ super();
3019
+ this.options = options;
3020
+ this.compositeErrorRegistry = schema.TypeRegistry.for(options.defaultNamespace);
3021
+ for (const etr of options.errorTypeRegistries ?? []) {
3022
+ this.compositeErrorRegistry.copyFrom(etr);
3023
+ }
3024
+ }
3025
+ getRequestType() {
3026
+ return protocolHttp.HttpRequest;
3027
+ }
3028
+ getResponseType() {
3029
+ return protocolHttp.HttpResponse;
3030
+ }
3031
+ setSerdeContext(serdeContext) {
3032
+ this.serdeContext = serdeContext;
3033
+ this.serializer.setSerdeContext(serdeContext);
3034
+ this.deserializer.setSerdeContext(serdeContext);
3035
+ if (this.getPayloadCodec()) {
3036
+ this.getPayloadCodec().setSerdeContext(serdeContext);
3037
+ }
3038
+ }
3039
+ updateServiceEndpoint(request, endpoint) {
3040
+ if ("url" in endpoint) {
3041
+ request.protocol = endpoint.url.protocol;
3042
+ request.hostname = endpoint.url.hostname;
3043
+ request.port = endpoint.url.port ? Number(endpoint.url.port) : undefined;
3044
+ request.path = endpoint.url.pathname;
3045
+ request.fragment = endpoint.url.hash || undefined;
3046
+ request.username = endpoint.url.username || undefined;
3047
+ request.password = endpoint.url.password || undefined;
3048
+ if (!request.query) {
3049
+ request.query = {};
3050
+ }
3051
+ for (const [k, v] of endpoint.url.searchParams.entries()) {
3052
+ request.query[k] = v;
3053
+ }
3054
+ if (endpoint.headers) {
3055
+ for (const name in endpoint.headers) {
3056
+ request.headers[name] = endpoint.headers[name].join(", ");
3057
+ }
3058
+ }
3059
+ return request;
3060
+ } else {
3061
+ request.protocol = endpoint.protocol;
3062
+ request.hostname = endpoint.hostname;
3063
+ request.port = endpoint.port ? Number(endpoint.port) : undefined;
3064
+ request.path = endpoint.path;
3065
+ request.query = {
3066
+ ...endpoint.query
3067
+ };
3068
+ if (endpoint.headers) {
3069
+ for (const name in endpoint.headers) {
3070
+ request.headers[name] = endpoint.headers[name];
3071
+ }
3072
+ }
3073
+ return request;
3074
+ }
3075
+ }
3076
+ setHostPrefix(request, operationSchema, input) {
3077
+ if (this.serdeContext?.disableHostPrefix) {
3078
+ return;
3079
+ }
3080
+ const inputNs = schema.NormalizedSchema.of(operationSchema.input);
3081
+ const opTraits = schema.translateTraits(operationSchema.traits ?? {});
3082
+ if (opTraits.endpoint) {
3083
+ let hostPrefix = opTraits.endpoint?.[0];
3084
+ if (typeof hostPrefix === "string") {
3085
+ for (const [name, member] of inputNs.structIterator()) {
3086
+ if (!member.getMergedTraits().hostLabel) {
3087
+ continue;
3088
+ }
3089
+ const replacement = input[name];
3090
+ if (typeof replacement !== "string") {
3091
+ throw new Error(`@smithy/core/schema - ${name} in input must be a string as hostLabel.`);
3092
+ }
3093
+ hostPrefix = hostPrefix.replace(`{${name}}`, replacement);
3094
+ }
3095
+ request.hostname = hostPrefix + request.hostname;
3096
+ }
3097
+ }
3098
+ }
3099
+ deserializeMetadata(output) {
3100
+ return {
3101
+ httpStatusCode: output.statusCode,
3102
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
3103
+ extendedRequestId: output.headers["x-amz-id-2"],
3104
+ cfId: output.headers["x-amz-cf-id"]
3105
+ };
3106
+ }
3107
+ async serializeEventStream({ eventStream, requestSchema, initialRequest }) {
3108
+ const eventStreamSerde = await this.loadEventStreamCapability();
3109
+ return eventStreamSerde.serializeEventStream({
3110
+ eventStream,
3111
+ requestSchema,
3112
+ initialRequest
3113
+ });
3114
+ }
3115
+ async deserializeEventStream({ response, responseSchema, initialResponseContainer }) {
3116
+ const eventStreamSerde = await this.loadEventStreamCapability();
3117
+ return eventStreamSerde.deserializeEventStream({
3118
+ response,
3119
+ responseSchema,
3120
+ initialResponseContainer
3121
+ });
3122
+ }
3123
+ async loadEventStreamCapability() {
3124
+ const { EventStreamSerde } = await import("./chunk-eg22v12d.js");
3125
+ return new EventStreamSerde({
3126
+ marshaller: this.getEventStreamMarshaller(),
3127
+ serializer: this.serializer,
3128
+ deserializer: this.deserializer,
3129
+ serdeContext: this.serdeContext,
3130
+ defaultContentType: this.getDefaultContentType()
3131
+ });
3132
+ }
3133
+ getDefaultContentType() {
3134
+ throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`);
3135
+ }
3136
+ async deserializeHttpMessage(schema2, context, response, arg4, arg5) {
3137
+ return [];
3138
+ }
3139
+ getEventStreamMarshaller() {
3140
+ const context = this.serdeContext;
3141
+ if (!context.eventStreamMarshaller) {
3142
+ throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
3143
+ }
3144
+ return context.eventStreamMarshaller;
3145
+ }
3146
+ }
3147
+
3148
+ class HttpBindingProtocol extends HttpProtocol {
3149
+ async serializeRequest(operationSchema, _input, context) {
3150
+ const input = _input && typeof _input === "object" ? _input : {};
3151
+ const serializer = this.serializer;
3152
+ const query = {};
3153
+ const headers = {};
3154
+ const endpoint = await context.endpoint();
3155
+ const ns = schema.NormalizedSchema.of(operationSchema?.input);
3156
+ const payloadMemberNames = [];
3157
+ const payloadMemberSchemas = [];
3158
+ let hasNonHttpBindingMember = false;
3159
+ let payload;
3160
+ const request = new protocolHttp.HttpRequest({
3161
+ protocol: "",
3162
+ hostname: "",
3163
+ port: undefined,
3164
+ path: "",
3165
+ fragment: undefined,
3166
+ query,
3167
+ headers,
3168
+ body: undefined
3169
+ });
3170
+ if (endpoint) {
3171
+ this.updateServiceEndpoint(request, endpoint);
3172
+ this.setHostPrefix(request, operationSchema, input);
3173
+ const opTraits = schema.translateTraits(operationSchema.traits);
3174
+ if (opTraits.http) {
3175
+ request.method = opTraits.http[0];
3176
+ const [path, search] = opTraits.http[1].split("?");
3177
+ if (request.path == "/") {
3178
+ request.path = path;
3179
+ } else {
3180
+ request.path += path;
3181
+ }
3182
+ const traitSearchParams = new URLSearchParams(search ?? "");
3183
+ for (const [key, value] of traitSearchParams) {
3184
+ query[key] = value;
3185
+ }
3186
+ }
3187
+ }
3188
+ for (const [memberName, memberNs] of ns.structIterator()) {
3189
+ const memberTraits = memberNs.getMergedTraits() ?? {};
3190
+ const inputMemberValue = input[memberName];
3191
+ if (inputMemberValue == null && !memberNs.isIdempotencyToken()) {
3192
+ if (memberTraits.httpLabel) {
3193
+ if (request.path.includes(`{${memberName}+}`) || request.path.includes(`{${memberName}}`)) {
3194
+ throw new Error(`No value provided for input HTTP label: ${memberName}.`);
3195
+ }
3196
+ }
3197
+ continue;
3198
+ }
3199
+ if (memberTraits.httpPayload) {
3200
+ const isStreaming = memberNs.isStreaming();
3201
+ if (isStreaming) {
3202
+ const isEventStream = memberNs.isStructSchema();
3203
+ if (isEventStream) {
3204
+ if (input[memberName]) {
3205
+ payload = await this.serializeEventStream({
3206
+ eventStream: input[memberName],
3207
+ requestSchema: ns
3208
+ });
3209
+ }
3210
+ } else {
3211
+ payload = inputMemberValue;
3212
+ }
3213
+ } else {
3214
+ serializer.write(memberNs, inputMemberValue);
3215
+ payload = serializer.flush();
3216
+ }
3217
+ } else if (memberTraits.httpLabel) {
3218
+ serializer.write(memberNs, inputMemberValue);
3219
+ const replacement = serializer.flush();
3220
+ if (request.path.includes(`{${memberName}+}`)) {
3221
+ request.path = request.path.replace(`{${memberName}+}`, replacement.split("/").map(extendedEncodeURIComponent).join("/"));
3222
+ } else if (request.path.includes(`{${memberName}}`)) {
3223
+ request.path = request.path.replace(`{${memberName}}`, extendedEncodeURIComponent(replacement));
3224
+ }
3225
+ } else if (memberTraits.httpHeader) {
3226
+ serializer.write(memberNs, inputMemberValue);
3227
+ headers[memberTraits.httpHeader.toLowerCase()] = String(serializer.flush());
3228
+ } else if (typeof memberTraits.httpPrefixHeaders === "string") {
3229
+ for (const key in inputMemberValue) {
3230
+ const val = inputMemberValue[key];
3231
+ const amalgam = memberTraits.httpPrefixHeaders + key;
3232
+ serializer.write([memberNs.getValueSchema(), { httpHeader: amalgam }], val);
3233
+ headers[amalgam.toLowerCase()] = serializer.flush();
3234
+ }
3235
+ } else if (memberTraits.httpQuery || memberTraits.httpQueryParams) {
3236
+ this.serializeQuery(memberNs, inputMemberValue, query);
3237
+ } else {
3238
+ hasNonHttpBindingMember = true;
3239
+ payloadMemberNames.push(memberName);
3240
+ payloadMemberSchemas.push(memberNs);
3241
+ }
3242
+ }
3243
+ if (hasNonHttpBindingMember && input) {
3244
+ const [namespace, name] = (ns.getName(true) ?? "#Unknown").split("#");
3245
+ const requiredMembers = ns.getSchema()[6];
3246
+ const payloadSchema = [
3247
+ 3,
3248
+ namespace,
3249
+ name,
3250
+ ns.getMergedTraits(),
3251
+ payloadMemberNames,
3252
+ payloadMemberSchemas,
3253
+ undefined
3254
+ ];
3255
+ if (requiredMembers) {
3256
+ payloadSchema[6] = requiredMembers;
3257
+ } else {
3258
+ payloadSchema.pop();
3259
+ }
3260
+ serializer.write(payloadSchema, input);
3261
+ payload = serializer.flush();
3262
+ }
3263
+ request.headers = headers;
3264
+ request.query = query;
3265
+ request.body = payload;
3266
+ return request;
3267
+ }
3268
+ serializeQuery(ns, data, query) {
3269
+ const serializer = this.serializer;
3270
+ const traits = ns.getMergedTraits();
3271
+ if (traits.httpQueryParams) {
3272
+ for (const key in data) {
3273
+ if (!(key in query)) {
3274
+ const val = data[key];
3275
+ const valueSchema = ns.getValueSchema();
3276
+ Object.assign(valueSchema.getMergedTraits(), {
3277
+ ...traits,
3278
+ httpQuery: key,
3279
+ httpQueryParams: undefined
3280
+ });
3281
+ this.serializeQuery(valueSchema, val, query);
3282
+ }
3283
+ }
3284
+ return;
3285
+ }
3286
+ if (ns.isListSchema()) {
3287
+ const sparse = !!ns.getMergedTraits().sparse;
3288
+ const buffer = [];
3289
+ for (const item of data) {
3290
+ serializer.write([ns.getValueSchema(), traits], item);
3291
+ const serializable = serializer.flush();
3292
+ if (sparse || serializable !== undefined) {
3293
+ buffer.push(serializable);
3294
+ }
3295
+ }
3296
+ query[traits.httpQuery] = buffer;
3297
+ } else {
3298
+ serializer.write([ns, traits], data);
3299
+ query[traits.httpQuery] = serializer.flush();
3300
+ }
3301
+ }
3302
+ async deserializeResponse(operationSchema, context, response) {
3303
+ const deserializer = this.deserializer;
3304
+ const ns = schema.NormalizedSchema.of(operationSchema.output);
3305
+ const dataObject = {};
3306
+ if (response.statusCode >= 300) {
3307
+ const bytes = await collectBody(response.body, context);
3308
+ if (bytes.byteLength > 0) {
3309
+ Object.assign(dataObject, await deserializer.read(15, bytes));
3310
+ }
3311
+ await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
3312
+ throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
3313
+ }
3314
+ for (const header in response.headers) {
3315
+ const value = response.headers[header];
3316
+ delete response.headers[header];
3317
+ response.headers[header.toLowerCase()] = value;
3318
+ }
3319
+ const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, dataObject);
3320
+ if (nonHttpBindingMembers.length) {
3321
+ const bytes = await collectBody(response.body, context);
3322
+ if (bytes.byteLength > 0) {
3323
+ const dataFromBody = await deserializer.read(ns, bytes);
3324
+ for (const member of nonHttpBindingMembers) {
3325
+ if (dataFromBody[member] != null) {
3326
+ dataObject[member] = dataFromBody[member];
3327
+ }
3328
+ }
3329
+ }
3330
+ } else if (nonHttpBindingMembers.discardResponseBody) {
3331
+ await collectBody(response.body, context);
3332
+ }
3333
+ dataObject.$metadata = this.deserializeMetadata(response);
3334
+ return dataObject;
3335
+ }
3336
+ async deserializeHttpMessage(schema$1, context, response, arg4, arg5) {
3337
+ let dataObject;
3338
+ if (arg4 instanceof Set) {
3339
+ dataObject = arg5;
3340
+ } else {
3341
+ dataObject = arg4;
3342
+ }
3343
+ let discardResponseBody = true;
3344
+ const deserializer = this.deserializer;
3345
+ const ns = schema.NormalizedSchema.of(schema$1);
3346
+ const nonHttpBindingMembers = [];
3347
+ for (const [memberName, memberSchema] of ns.structIterator()) {
3348
+ const memberTraits = memberSchema.getMemberTraits();
3349
+ if (memberTraits.httpPayload) {
3350
+ discardResponseBody = false;
3351
+ const isStreaming = memberSchema.isStreaming();
3352
+ if (isStreaming) {
3353
+ const isEventStream = memberSchema.isStructSchema();
3354
+ if (isEventStream) {
3355
+ dataObject[memberName] = await this.deserializeEventStream({
3356
+ response,
3357
+ responseSchema: ns
3358
+ });
3359
+ } else {
3360
+ dataObject[memberName] = utilStream.sdkStreamMixin(response.body);
3361
+ }
3362
+ } else if (response.body) {
3363
+ const bytes = await collectBody(response.body, context);
3364
+ if (bytes.byteLength > 0) {
3365
+ dataObject[memberName] = await deserializer.read(memberSchema, bytes);
3366
+ }
3367
+ }
3368
+ } else if (memberTraits.httpHeader) {
3369
+ const key = String(memberTraits.httpHeader).toLowerCase();
3370
+ const value = response.headers[key];
3371
+ if (value != null) {
3372
+ if (memberSchema.isListSchema()) {
3373
+ const headerListValueSchema = memberSchema.getValueSchema();
3374
+ headerListValueSchema.getMergedTraits().httpHeader = key;
3375
+ let sections;
3376
+ if (headerListValueSchema.isTimestampSchema() && headerListValueSchema.getSchema() === 4) {
3377
+ sections = serde.splitEvery(value, ",", 2);
3378
+ } else {
3379
+ sections = serde.splitHeader(value);
3380
+ }
3381
+ const list = [];
3382
+ for (const section of sections) {
3383
+ list.push(await deserializer.read(headerListValueSchema, section.trim()));
3384
+ }
3385
+ dataObject[memberName] = list;
3386
+ } else {
3387
+ dataObject[memberName] = await deserializer.read(memberSchema, value);
3388
+ }
3389
+ }
3390
+ } else if (memberTraits.httpPrefixHeaders !== undefined) {
3391
+ dataObject[memberName] = {};
3392
+ for (const header in response.headers) {
3393
+ if (header.startsWith(memberTraits.httpPrefixHeaders)) {
3394
+ const value = response.headers[header];
3395
+ const valueSchema = memberSchema.getValueSchema();
3396
+ valueSchema.getMergedTraits().httpHeader = header;
3397
+ dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read(valueSchema, value);
3398
+ }
3399
+ }
3400
+ } else if (memberTraits.httpResponseCode) {
3401
+ dataObject[memberName] = response.statusCode;
3402
+ } else {
3403
+ nonHttpBindingMembers.push(memberName);
3404
+ }
3405
+ }
3406
+ nonHttpBindingMembers.discardResponseBody = discardResponseBody;
3407
+ return nonHttpBindingMembers;
3408
+ }
3409
+ }
3410
+
3411
+ class RpcProtocol extends HttpProtocol {
3412
+ async serializeRequest(operationSchema, _input, context) {
3413
+ const serializer = this.serializer;
3414
+ const query = {};
3415
+ const headers = {};
3416
+ const endpoint = await context.endpoint();
3417
+ const ns = schema.NormalizedSchema.of(operationSchema?.input);
3418
+ const schema$1 = ns.getSchema();
3419
+ let payload;
3420
+ const input = _input && typeof _input === "object" ? _input : {};
3421
+ const request = new protocolHttp.HttpRequest({
3422
+ protocol: "",
3423
+ hostname: "",
3424
+ port: undefined,
3425
+ path: "/",
3426
+ fragment: undefined,
3427
+ query,
3428
+ headers,
3429
+ body: undefined
3430
+ });
3431
+ if (endpoint) {
3432
+ this.updateServiceEndpoint(request, endpoint);
3433
+ this.setHostPrefix(request, operationSchema, input);
3434
+ }
3435
+ if (input) {
3436
+ const eventStreamMember = ns.getEventStreamMember();
3437
+ if (eventStreamMember) {
3438
+ if (input[eventStreamMember]) {
3439
+ const initialRequest = {};
3440
+ for (const [memberName, memberSchema] of ns.structIterator()) {
3441
+ if (memberName !== eventStreamMember && input[memberName]) {
3442
+ serializer.write(memberSchema, input[memberName]);
3443
+ initialRequest[memberName] = serializer.flush();
3444
+ }
3445
+ }
3446
+ payload = await this.serializeEventStream({
3447
+ eventStream: input[eventStreamMember],
3448
+ requestSchema: ns,
3449
+ initialRequest
3450
+ });
3451
+ }
3452
+ } else {
3453
+ serializer.write(schema$1, input);
3454
+ payload = serializer.flush();
3455
+ }
3456
+ }
3457
+ request.headers = Object.assign(request.headers, headers);
3458
+ request.query = query;
3459
+ request.body = payload;
3460
+ request.method = "POST";
3461
+ return request;
3462
+ }
3463
+ async deserializeResponse(operationSchema, context, response) {
3464
+ const deserializer = this.deserializer;
3465
+ const ns = schema.NormalizedSchema.of(operationSchema.output);
3466
+ const dataObject = {};
3467
+ if (response.statusCode >= 300) {
3468
+ const bytes = await collectBody(response.body, context);
3469
+ if (bytes.byteLength > 0) {
3470
+ Object.assign(dataObject, await deserializer.read(15, bytes));
3471
+ }
3472
+ await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
3473
+ throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
3474
+ }
3475
+ for (const header in response.headers) {
3476
+ const value = response.headers[header];
3477
+ delete response.headers[header];
3478
+ response.headers[header.toLowerCase()] = value;
3479
+ }
3480
+ const eventStreamMember = ns.getEventStreamMember();
3481
+ if (eventStreamMember) {
3482
+ dataObject[eventStreamMember] = await this.deserializeEventStream({
3483
+ response,
3484
+ responseSchema: ns,
3485
+ initialResponseContainer: dataObject
3486
+ });
3487
+ } else {
3488
+ const bytes = await collectBody(response.body, context);
3489
+ if (bytes.byteLength > 0) {
3490
+ Object.assign(dataObject, await deserializer.read(ns, bytes));
3491
+ }
3492
+ }
3493
+ dataObject.$metadata = this.deserializeMetadata(response);
3494
+ return dataObject;
3495
+ }
3496
+ }
3497
+ var resolvedPath = (resolvedPath2, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
3498
+ if (input != null && input[memberName] !== undefined) {
3499
+ const labelValue = labelValueProvider();
3500
+ if (labelValue == null || labelValue.length <= 0) {
3501
+ throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
3502
+ }
3503
+ resolvedPath2 = resolvedPath2.replace(uriLabel, isGreedyLabel ? labelValue.split("/").map((segment) => extendedEncodeURIComponent(segment)).join("/") : extendedEncodeURIComponent(labelValue));
3504
+ } else {
3505
+ throw new Error("No value provided for input HTTP label: " + memberName + ".");
3506
+ }
3507
+ return resolvedPath2;
3508
+ };
3509
+ function requestBuilder(input, context) {
3510
+ return new RequestBuilder(input, context);
3511
+ }
3512
+
3513
+ class RequestBuilder {
3514
+ input;
3515
+ context;
3516
+ query = {};
3517
+ method = "";
3518
+ headers = {};
3519
+ path = "";
3520
+ body = null;
3521
+ hostname = "";
3522
+ resolvePathStack = [];
3523
+ constructor(input, context) {
3524
+ this.input = input;
3525
+ this.context = context;
3526
+ }
3527
+ async build() {
3528
+ const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();
3529
+ this.path = basePath;
3530
+ for (const resolvePath of this.resolvePathStack) {
3531
+ resolvePath(this.path);
3532
+ }
3533
+ return new protocolHttp.HttpRequest({
3534
+ protocol,
3535
+ hostname: this.hostname || hostname,
3536
+ port,
3537
+ method: this.method,
3538
+ path: this.path,
3539
+ query: this.query,
3540
+ body: this.body,
3541
+ headers: this.headers
3542
+ });
3543
+ }
3544
+ hn(hostname) {
3545
+ this.hostname = hostname;
3546
+ return this;
3547
+ }
3548
+ bp(uriLabel) {
3549
+ this.resolvePathStack.push((basePath) => {
3550
+ this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
3551
+ });
3552
+ return this;
3553
+ }
3554
+ p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
3555
+ this.resolvePathStack.push((path) => {
3556
+ this.path = resolvedPath(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
3557
+ });
3558
+ return this;
3559
+ }
3560
+ h(headers) {
3561
+ this.headers = headers;
3562
+ return this;
3563
+ }
3564
+ q(query) {
3565
+ this.query = query;
3566
+ return this;
3567
+ }
3568
+ b(body) {
3569
+ this.body = body;
3570
+ return this;
3571
+ }
3572
+ m(method) {
3573
+ this.method = method;
3574
+ return this;
3575
+ }
3576
+ }
3577
+ function determineTimestampFormat(ns, settings) {
3578
+ if (settings.timestampFormat.useTrait) {
3579
+ if (ns.isTimestampSchema() && (ns.getSchema() === 5 || ns.getSchema() === 6 || ns.getSchema() === 7)) {
3580
+ return ns.getSchema();
3581
+ }
3582
+ }
3583
+ const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
3584
+ const bindingFormat = settings.httpBindings ? typeof httpPrefixHeaders === "string" || Boolean(httpHeader) ? 6 : Boolean(httpQuery) || Boolean(httpLabel) ? 5 : undefined : undefined;
3585
+ return bindingFormat ?? settings.timestampFormat.default;
3586
+ }
3587
+
3588
+ class FromStringShapeDeserializer extends SerdeContext {
3589
+ settings;
3590
+ constructor(settings) {
3591
+ super();
3592
+ this.settings = settings;
3593
+ }
3594
+ read(_schema, data) {
3595
+ const ns = schema.NormalizedSchema.of(_schema);
3596
+ if (ns.isListSchema()) {
3597
+ return serde.splitHeader(data).map((item) => this.read(ns.getValueSchema(), item));
3598
+ }
3599
+ if (ns.isBlobSchema()) {
3600
+ return (this.serdeContext?.base64Decoder ?? utilBase64.fromBase64)(data);
3601
+ }
3602
+ if (ns.isTimestampSchema()) {
3603
+ const format = determineTimestampFormat(ns, this.settings);
3604
+ switch (format) {
3605
+ case 5:
3606
+ return serde._parseRfc3339DateTimeWithOffset(data);
3607
+ case 6:
3608
+ return serde._parseRfc7231DateTime(data);
3609
+ case 7:
3610
+ return serde._parseEpochTimestamp(data);
3611
+ default:
3612
+ console.warn("Missing timestamp format, parsing value with Date constructor:", data);
3613
+ return new Date(data);
3614
+ }
3615
+ }
3616
+ if (ns.isStringSchema()) {
3617
+ const mediaType = ns.getMergedTraits().mediaType;
3618
+ let intermediateValue = data;
3619
+ if (mediaType) {
3620
+ if (ns.getMergedTraits().httpHeader) {
3621
+ intermediateValue = this.base64ToUtf8(intermediateValue);
3622
+ }
3623
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
3624
+ if (isJson) {
3625
+ intermediateValue = serde.LazyJsonString.from(intermediateValue);
3626
+ }
3627
+ return intermediateValue;
3628
+ }
3629
+ }
3630
+ if (ns.isNumericSchema()) {
3631
+ return Number(data);
3632
+ }
3633
+ if (ns.isBigIntegerSchema()) {
3634
+ return BigInt(data);
3635
+ }
3636
+ if (ns.isBigDecimalSchema()) {
3637
+ return new serde.NumericValue(data, "bigDecimal");
3638
+ }
3639
+ if (ns.isBooleanSchema()) {
3640
+ return String(data).toLowerCase() === "true";
3641
+ }
3642
+ return data;
3643
+ }
3644
+ base64ToUtf8(base64String) {
3645
+ return (this.serdeContext?.utf8Encoder ?? utilUtf8.toUtf8)((this.serdeContext?.base64Decoder ?? utilBase64.fromBase64)(base64String));
3646
+ }
3647
+ }
3648
+
3649
+ class HttpInterceptingShapeDeserializer extends SerdeContext {
3650
+ codecDeserializer;
3651
+ stringDeserializer;
3652
+ constructor(codecDeserializer, codecSettings) {
3653
+ super();
3654
+ this.codecDeserializer = codecDeserializer;
3655
+ this.stringDeserializer = new FromStringShapeDeserializer(codecSettings);
3656
+ }
3657
+ setSerdeContext(serdeContext) {
3658
+ this.stringDeserializer.setSerdeContext(serdeContext);
3659
+ this.codecDeserializer.setSerdeContext(serdeContext);
3660
+ this.serdeContext = serdeContext;
3661
+ }
3662
+ read(schema$1, data) {
3663
+ const ns = schema.NormalizedSchema.of(schema$1);
3664
+ const traits = ns.getMergedTraits();
3665
+ const toString = this.serdeContext?.utf8Encoder ?? utilUtf8.toUtf8;
3666
+ if (traits.httpHeader || traits.httpResponseCode) {
3667
+ return this.stringDeserializer.read(ns, toString(data));
3668
+ }
3669
+ if (traits.httpPayload) {
3670
+ if (ns.isBlobSchema()) {
3671
+ const toBytes = this.serdeContext?.utf8Decoder ?? utilUtf8.fromUtf8;
3672
+ if (typeof data === "string") {
3673
+ return toBytes(data);
3674
+ }
3675
+ return data;
3676
+ } else if (ns.isStringSchema()) {
3677
+ if ("byteLength" in data) {
3678
+ return toString(data);
3679
+ }
3680
+ return data;
3681
+ }
3682
+ }
3683
+ return this.codecDeserializer.read(ns, data);
3684
+ }
3685
+ }
3686
+
3687
+ class ToStringShapeSerializer extends SerdeContext {
3688
+ settings;
3689
+ stringBuffer = "";
3690
+ constructor(settings) {
3691
+ super();
3692
+ this.settings = settings;
3693
+ }
3694
+ write(schema$1, value) {
3695
+ const ns = schema.NormalizedSchema.of(schema$1);
3696
+ switch (typeof value) {
3697
+ case "object":
3698
+ if (value === null) {
3699
+ this.stringBuffer = "null";
3700
+ return;
3701
+ }
3702
+ if (ns.isTimestampSchema()) {
3703
+ if (!(value instanceof Date)) {
3704
+ throw new Error(`@smithy/core/protocols - received non-Date value ${value} when schema expected Date in ${ns.getName(true)}`);
3705
+ }
3706
+ const format = determineTimestampFormat(ns, this.settings);
3707
+ switch (format) {
3708
+ case 5:
3709
+ this.stringBuffer = value.toISOString().replace(".000Z", "Z");
3710
+ break;
3711
+ case 6:
3712
+ this.stringBuffer = serde.dateToUtcString(value);
3713
+ break;
3714
+ case 7:
3715
+ this.stringBuffer = String(value.getTime() / 1000);
3716
+ break;
3717
+ default:
3718
+ console.warn("Missing timestamp format, using epoch seconds", value);
3719
+ this.stringBuffer = String(value.getTime() / 1000);
3720
+ }
3721
+ return;
3722
+ }
3723
+ if (ns.isBlobSchema() && "byteLength" in value) {
3724
+ this.stringBuffer = (this.serdeContext?.base64Encoder ?? utilBase64.toBase64)(value);
3725
+ return;
3726
+ }
3727
+ if (ns.isListSchema() && Array.isArray(value)) {
3728
+ let buffer = "";
3729
+ for (const item of value) {
3730
+ this.write([ns.getValueSchema(), ns.getMergedTraits()], item);
3731
+ const headerItem = this.flush();
3732
+ const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : serde.quoteHeader(headerItem);
3733
+ if (buffer !== "") {
3734
+ buffer += ", ";
3735
+ }
3736
+ buffer += serialized;
3737
+ }
3738
+ this.stringBuffer = buffer;
3739
+ return;
3740
+ }
3741
+ this.stringBuffer = JSON.stringify(value, null, 2);
3742
+ break;
3743
+ case "string":
3744
+ const mediaType = ns.getMergedTraits().mediaType;
3745
+ let intermediateValue = value;
3746
+ if (mediaType) {
3747
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
3748
+ if (isJson) {
3749
+ intermediateValue = serde.LazyJsonString.from(intermediateValue);
3750
+ }
3751
+ if (ns.getMergedTraits().httpHeader) {
3752
+ this.stringBuffer = (this.serdeContext?.base64Encoder ?? utilBase64.toBase64)(intermediateValue.toString());
3753
+ return;
3754
+ }
3755
+ }
3756
+ this.stringBuffer = value;
3757
+ break;
3758
+ default:
3759
+ if (ns.isIdempotencyToken()) {
3760
+ this.stringBuffer = serde.generateIdempotencyToken();
3761
+ } else {
3762
+ this.stringBuffer = String(value);
3763
+ }
3764
+ }
3765
+ }
3766
+ flush() {
3767
+ const buffer = this.stringBuffer;
3768
+ this.stringBuffer = "";
3769
+ return buffer;
3770
+ }
3771
+ }
3772
+
3773
+ class HttpInterceptingShapeSerializer {
3774
+ codecSerializer;
3775
+ stringSerializer;
3776
+ buffer;
3777
+ constructor(codecSerializer, codecSettings, stringSerializer = new ToStringShapeSerializer(codecSettings)) {
3778
+ this.codecSerializer = codecSerializer;
3779
+ this.stringSerializer = stringSerializer;
3780
+ }
3781
+ setSerdeContext(serdeContext) {
3782
+ this.codecSerializer.setSerdeContext(serdeContext);
3783
+ this.stringSerializer.setSerdeContext(serdeContext);
3784
+ }
3785
+ write(schema$1, value) {
3786
+ const ns = schema.NormalizedSchema.of(schema$1);
3787
+ const traits = ns.getMergedTraits();
3788
+ if (traits.httpHeader || traits.httpLabel || traits.httpQuery) {
3789
+ this.stringSerializer.write(ns, value);
3790
+ this.buffer = this.stringSerializer.flush();
3791
+ return;
3792
+ }
3793
+ return this.codecSerializer.write(ns, value);
3794
+ }
3795
+ flush() {
3796
+ if (this.buffer !== undefined) {
3797
+ const buffer = this.buffer;
3798
+ this.buffer = undefined;
3799
+ return buffer;
3800
+ }
3801
+ return this.codecSerializer.flush();
3802
+ }
3803
+ }
3804
+ exports.FromStringShapeDeserializer = FromStringShapeDeserializer;
3805
+ exports.HttpBindingProtocol = HttpBindingProtocol;
3806
+ exports.HttpInterceptingShapeDeserializer = HttpInterceptingShapeDeserializer;
3807
+ exports.HttpInterceptingShapeSerializer = HttpInterceptingShapeSerializer;
3808
+ exports.HttpProtocol = HttpProtocol;
3809
+ exports.RequestBuilder = RequestBuilder;
3810
+ exports.RpcProtocol = RpcProtocol;
3811
+ exports.SerdeContext = SerdeContext;
3812
+ exports.ToStringShapeSerializer = ToStringShapeSerializer;
3813
+ exports.collectBody = collectBody;
3814
+ exports.determineTimestampFormat = determineTimestampFormat;
3815
+ exports.extendedEncodeURIComponent = extendedEncodeURIComponent;
3816
+ exports.requestBuilder = requestBuilder;
3817
+ exports.resolvedPath = resolvedPath;
3818
+ });
3819
+
3820
+ export { require_dist_cjs11 as require_dist_cjs, require_endpoints, require_schema, require_serde, require_dist_cjs12 as require_dist_cjs1, require_protocols };