@qitqode/qitqode-android-arm64 0.2.14 → 0.2.16
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.
- package/bun +2 -2
- package/bundle/{chunk-wrzn87w0.js → chunk-098mr0zz.js} +1 -1
- package/bundle/{chunk-j15wejz0.js → chunk-0catm9vq.js} +1 -1
- package/bundle/{chunk-kdqhwa65.js → chunk-0cqs1qkh.js} +1 -1
- package/bundle/{chunk-d10qre1b.js → chunk-0f3ncvfe.js} +1 -1
- package/bundle/{chunk-583d91xq.js → chunk-0gqwvt8w.js} +2 -2
- package/bundle/chunk-0mb55ytc.js +2 -0
- package/bundle/{chunk-9zsp3qkh.js → chunk-0n2ncnwz.js} +1 -1
- package/bundle/chunk-0y0hm0m5.js +2 -0
- package/bundle/chunk-120e8yr1.js +2 -0
- package/bundle/{chunk-spcdwmy4.js → chunk-1aneepm5.js} +1 -1
- package/bundle/chunk-1dxm8yev.js +2 -0
- package/bundle/{chunk-96sra8g8.js → chunk-1jg7cybp.js} +1 -1
- package/bundle/{chunk-ngygp66y.js → chunk-1k5nfw7g.js} +1 -1
- package/bundle/{chunk-fmcg649e.js → chunk-1kksj8cn.js} +1 -1
- package/bundle/chunk-1pgpv979.js +2 -0
- package/bundle/{chunk-szfqmkj6.js → chunk-1xsjkf4c.js} +1 -1
- package/bundle/{chunk-zx63mepv.js → chunk-1yetxft4.js} +1 -1
- package/bundle/chunk-23zh9s18.js +2 -0
- package/bundle/{chunk-8qpfphdz.js → chunk-24pf9s68.js} +1 -1
- package/bundle/chunk-2a0zf12g.js +2 -0
- package/bundle/chunk-2b8x31p3.js +2 -0
- package/bundle/chunk-2cvmdss3.js +2 -0
- package/bundle/{chunk-bm8azfnt.js → chunk-2kvghwar.js} +1 -1
- package/bundle/{chunk-ch7s512a.js → chunk-2nkjwqpm.js} +1 -1
- package/bundle/chunk-2qbsg6dp.js +2 -0
- package/bundle/{chunk-9ttebtcf.js → chunk-2rvs18fx.js} +1 -1
- package/bundle/{chunk-rxt6gktt.js → chunk-2thbax1j.js} +1 -1
- package/bundle/{chunk-6y0wgz2j.js → chunk-2zxygnx4.js} +1 -1
- package/bundle/{chunk-zgwasq3p.js → chunk-36kg3v3k.js} +1 -1
- package/bundle/{chunk-1gdt9q05.js → chunk-37hh7eee.js} +1 -1
- package/bundle/chunk-39mwv068.js +2 -0
- package/bundle/{chunk-set1f1wr.js → chunk-39z0qxkt.js} +1 -1
- package/bundle/{chunk-p0852vfn.js → chunk-3dfy9k0t.js} +2 -2
- package/bundle/{chunk-et3tgx7t.js → chunk-3e26pryk.js} +1 -1
- package/bundle/{chunk-vzkdzhn0.js → chunk-3eddms0g.js} +1 -1
- package/bundle/chunk-3re79hkf.js +2 -0
- package/bundle/{chunk-sy76e7nr.js → chunk-3vjs8aht.js} +1 -1
- package/bundle/{chunk-k769v1ds.js → chunk-3z7r4c0p.js} +1 -1
- package/bundle/chunk-40pe0tde.js +11 -0
- package/bundle/{chunk-0ejx0yqx.js → chunk-47nber5v.js} +1 -1
- package/bundle/{chunk-bga4kqd1.js → chunk-491f4ab9.js} +2 -2
- package/bundle/{chunk-3152y1q9.js → chunk-4bp91rza.js} +1 -1
- package/bundle/{chunk-pdcxmr6x.js → chunk-4dy64hgp.js} +1 -1
- package/bundle/{chunk-0mztgsxp.js → chunk-4fqwg54p.js} +1 -1
- package/bundle/{chunk-2w3n0q9m.js → chunk-4gv7nsdd.js} +2 -2
- package/bundle/{chunk-2ascwm7j.js → chunk-4nw19yab.js} +1 -1
- package/bundle/chunk-51fyaa6r.js +2 -0
- package/bundle/{chunk-9znfb8f2.js → chunk-52f62kr0.js} +2 -2
- package/bundle/chunk-52n4tdeh.js +5 -0
- package/bundle/{chunk-x4jnyj09.js → chunk-543jma8r.js} +1 -1
- package/bundle/chunk-58q03ah1.js +2 -0
- package/bundle/{chunk-hrcqbadm.js → chunk-5fhy0wb0.js} +1 -1
- package/bundle/{chunk-8zpsgfb6.js → chunk-5fym1zr2.js} +1 -1
- package/bundle/{chunk-a3g8de96.js → chunk-5k5jdayv.js} +1 -1
- package/bundle/chunk-5nmqgqj2.js +2 -0
- package/bundle/{chunk-psmwrvqs.js → chunk-5t69v8jg.js} +2 -2
- package/bundle/{chunk-7w571q26.js → chunk-5vtbg7pj.js} +1 -1
- package/bundle/{chunk-g738e799.js → chunk-5xmtzs15.js} +2 -2
- package/bundle/chunk-5ydg5ny1.js +2 -0
- package/bundle/{chunk-v5me0cj9.js → chunk-5z5rk3ng.js} +1 -1
- package/bundle/{chunk-5dvy83ms.js → chunk-62mb6wxm.js} +2 -2
- package/bundle/chunk-62mytrwv.js +2 -0
- package/bundle/{chunk-edvfqxfr.js → chunk-6396bg4p.js} +1 -1
- package/bundle/chunk-63bccmze.js +2 -0
- package/bundle/{chunk-1ypzf18e.js → chunk-64x1vtdq.js} +1 -1
- package/bundle/{chunk-9mabvb06.js → chunk-6kx4atkt.js} +1 -1
- package/bundle/{chunk-dmb0ez0m.js → chunk-6r7vm4xc.js} +3 -3
- package/bundle/{chunk-tcyzj3rz.js → chunk-6rggm6tm.js} +1 -1
- package/bundle/{chunk-fp2xgnjn.js → chunk-6vpc1y3w.js} +2 -2
- package/bundle/{chunk-71jmhvef.js → chunk-6vxddv5w.js} +2 -2
- package/bundle/chunk-6ynaebaw.js +2 -0
- package/bundle/{chunk-ep4drmt9.js → chunk-700jhn67.js} +1 -1
- package/bundle/{chunk-fdmz0502.js → chunk-76jbys6j.js} +2 -2
- package/bundle/chunk-782y3dm8.js +2 -0
- package/bundle/{chunk-d7h1dp0h.js → chunk-89g9wzc2.js} +1 -1
- package/bundle/chunk-8q50bha4.js +2 -0
- package/bundle/chunk-8v6qbhm1.js +2 -0
- package/bundle/chunk-955jtenj.js +2 -0
- package/bundle/chunk-95yzwxpf.js +2 -0
- package/bundle/{chunk-2w79k0mh.js → chunk-96281xfb.js} +2 -2
- package/bundle/{chunk-bdcd2mcb.js → chunk-96657nrr.js} +2 -2
- package/bundle/chunk-99ansgsj.js +2 -0
- package/bundle/{chunk-3c73rngn.js → chunk-9dd2krfn.js} +1 -1
- package/bundle/chunk-9exxjnxc.js +2 -0
- package/bundle/{chunk-eqsank84.js → chunk-9ge1mkfs.js} +1 -1
- package/bundle/{chunk-4r7fbkcm.js → chunk-9mmaja9n.js} +1 -1
- package/bundle/{chunk-mjkwd1sz.js → chunk-9rd7q5e9.js} +1 -1
- package/bundle/{chunk-6cztstry.js → chunk-9skj2w9e.js} +2 -2
- package/bundle/{chunk-nb4xtk1n.js → chunk-9tdbts1r.js} +1 -1
- package/bundle/{chunk-sg9enzsp.js → chunk-9tfm1dk2.js} +2 -2
- package/bundle/{chunk-z6qyx227.js → chunk-9xaea8h1.js} +1 -1
- package/bundle/{chunk-meehnnv9.js → chunk-a0c6w901.js} +2 -2
- package/bundle/chunk-a2tp2f6s.js +2 -0
- package/bundle/{chunk-69htq8kq.js → chunk-a3ynq3h7.js} +1 -1
- package/bundle/chunk-a4y0wjtq.js +3 -0
- package/bundle/{chunk-6dd2dx69.js → chunk-afagt413.js} +2 -2
- package/bundle/{chunk-px69995t.js → chunk-afzx47y2.js} +1 -1
- package/bundle/chunk-ag3s3t7x.js +2 -0
- package/bundle/{chunk-n7zd97hy.js → chunk-ajdn1n77.js} +2 -2
- package/bundle/chunk-arwm1qxm.js +2 -0
- package/bundle/{chunk-adws0hhk.js → chunk-awt3q88j.js} +2 -2
- package/bundle/{chunk-qn1fhqyw.js → chunk-az2pxgx6.js} +2 -2
- package/bundle/chunk-b0gq0s8a.js +2 -0
- package/bundle/{chunk-48rg4yhk.js → chunk-b2zfr7jz.js} +2 -2
- package/bundle/{chunk-mbmaeq0a.js → chunk-b63733cw.js} +1 -1
- package/bundle/chunk-b7430vg8.js +2 -0
- package/bundle/{chunk-07b4pkk6.js → chunk-b7dw5ged.js} +1 -1
- package/bundle/{chunk-prz2fkn9.js → chunk-b83qf145.js} +1 -1
- package/bundle/{chunk-veptx3fk.js → chunk-b8w33ck9.js} +1 -1
- package/bundle/{chunk-674pexjx.js → chunk-bd21p9zz.js} +2 -2
- package/bundle/chunk-be2z0tr4.js +2 -0
- package/bundle/{chunk-x0de4z05.js → chunk-bkqemdv8.js} +2 -2
- package/bundle/chunk-bq585t67.js +2 -0
- package/bundle/chunk-bts3gw8w.js +2 -0
- package/bundle/{chunk-qz20b42s.js → chunk-c0sr83np.js} +1 -1
- package/bundle/{chunk-zh7e6kqs.js → chunk-c4tdfar1.js} +1 -1
- package/bundle/chunk-c6ege2yp.js +2 -0
- package/bundle/{chunk-00ft63qn.js → chunk-chs4bkgh.js} +1 -1
- package/bundle/{chunk-8b9z8j3z.js → chunk-cm426ssg.js} +1 -1
- package/bundle/{chunk-crqycrs4.js → chunk-d4y5hyjg.js} +2 -2
- package/bundle/chunk-de0edzjs.js +2 -0
- package/bundle/{chunk-4hvenszg.js → chunk-der5kj1b.js} +1 -1
- package/bundle/{chunk-6d4xc6br.js → chunk-dhykktcp.js} +1 -1
- package/bundle/{chunk-8jkqyf9n.js → chunk-dm7hfb7f.js} +2 -2
- package/bundle/chunk-dntnvfdz.js +2 -0
- package/bundle/{chunk-q1dmxn63.js → chunk-dptvy1zn.js} +2 -2
- package/bundle/{chunk-2k2szpze.js → chunk-dqt8rrey.js} +1 -1
- package/bundle/{chunk-ky3fhz9z.js → chunk-dr003xka.js} +1 -1
- package/bundle/chunk-dtyzk0j7.js +2 -0
- package/bundle/{chunk-qrztx1b4.js → chunk-dwza14dk.js} +2 -2
- package/bundle/chunk-e3tmbywr.js +2 -0
- package/bundle/{chunk-ej0yzstw.js → chunk-e4nap6v9.js} +2 -2
- package/bundle/{chunk-5h1s0akp.js → chunk-e7x8v549.js} +1 -1
- package/bundle/{chunk-1e75j4m1.js → chunk-e826jvr2.js} +2 -2
- package/bundle/{chunk-9z7y4x7q.js → chunk-edm4c812.js} +1 -1
- package/bundle/{chunk-ws720v4j.js → chunk-eearwfay.js} +1 -1
- package/bundle/{chunk-gkf7x1yj.js → chunk-ekavngf7.js} +1 -1
- package/bundle/chunk-em637k9q.js +2 -0
- package/bundle/{chunk-8gkz5550.js → chunk-epncmz5t.js} +1 -1
- package/bundle/chunk-eytpz91c.js +8 -0
- package/bundle/chunk-f4qcwbx0.js +2 -0
- package/bundle/{chunk-a8askx4y.js → chunk-f6gd8809.js} +1 -1
- package/bundle/{chunk-e8s4mp5n.js → chunk-fcbmedh3.js} +2 -2
- package/bundle/{chunk-4ycg2c6f.js → chunk-fg5f3a8a.js} +2 -2
- package/bundle/chunk-fj7jcv7m.js +2 -0
- package/bundle/{chunk-47jkx37s.js → chunk-ft4msj4z.js} +3 -3
- package/bundle/chunk-fyntc5hj.js +2 -0
- package/bundle/chunk-fyt4yaq7.js +2 -0
- package/bundle/chunk-g4hcxhfs.js +2 -0
- package/bundle/{chunk-c5cyt23k.js → chunk-g7twcprm.js} +2 -2
- package/bundle/{chunk-9amnqaeq.js → chunk-g8844pb4.js} +1 -1
- package/bundle/{chunk-w136zswr.js → chunk-ganwjd6s.js} +3 -3
- package/bundle/chunk-gdew108b.js +2 -0
- package/bundle/chunk-gdy74wte.js +2 -0
- package/bundle/{chunk-7a4sb6q7.js → chunk-gse0cgqc.js} +1 -1
- package/bundle/{chunk-z0dj15g9.js → chunk-gsjgbm0d.js} +1 -1
- package/bundle/{chunk-a1mbach4.js → chunk-gt10s0ks.js} +1 -1
- package/bundle/{chunk-qpk7jp6t.js → chunk-gxpx2nd8.js} +1 -1
- package/bundle/{chunk-4p9fny77.js → chunk-gxq2fwnc.js} +1 -1
- package/bundle/chunk-gz90qgcn.js +2 -0
- package/bundle/chunk-gzz78dnm.js +2 -0
- package/bundle/{chunk-840mmmzz.js → chunk-h3yazfmh.js} +4 -4
- package/bundle/{chunk-d4faz5xa.js → chunk-h429rzqp.js} +1 -1
- package/bundle/{chunk-f0dp1tf9.js → chunk-h5y0pwwc.js} +1 -1
- package/bundle/{chunk-62gefpwn.js → chunk-h6b6acrv.js} +2 -2
- package/bundle/{chunk-19rs84t8.js → chunk-h8bq75er.js} +1 -1
- package/bundle/{chunk-99df6wvm.js → chunk-ha147mdc.js} +1 -1
- package/bundle/{chunk-xdcwx384.js → chunk-ha1w0xzh.js} +1 -1
- package/bundle/{chunk-5341jv20.js → chunk-ha294vpj.js} +1 -1
- package/bundle/chunk-hfrjkgyk.js +2 -0
- package/bundle/chunk-hjpt1n6g.js +2 -0
- package/bundle/{chunk-bzh71a92.js → chunk-hvdre0mb.js} +1 -1
- package/bundle/{chunk-86sfzgnf.js → chunk-hxf2a10r.js} +1 -1
- package/bundle/{chunk-4ppw719f.js → chunk-j09qf4zh.js} +1 -1
- package/bundle/chunk-j0jayfyn.js +35 -0
- package/bundle/{chunk-ffz334ab.js → chunk-j5b0yc0f.js} +1 -1
- package/bundle/{chunk-n6pn4f3r.js → chunk-j767byd1.js} +1 -1
- package/bundle/chunk-j794z99k.js +2 -0
- package/bundle/{chunk-y1v7mf1a.js → chunk-j95mkzwg.js} +123 -123
- package/bundle/{chunk-rn3je2hv.js → chunk-jcznttek.js} +1 -1
- package/bundle/{chunk-4v29ayke.js → chunk-jgw20mxx.js} +1 -1
- package/bundle/{chunk-175720ws.js → chunk-jhdpwndc.js} +2 -2
- package/bundle/{chunk-9gxyt2ay.js → chunk-jkqa49xc.js} +2 -2
- package/bundle/{chunk-sb3cgb4v.js → chunk-jmg64erz.js} +1 -1
- package/bundle/chunk-jpw7z507.js +2 -0
- package/bundle/{chunk-3cs1qf8x.js → chunk-jr622341.js} +1 -1
- package/bundle/{chunk-qpggztkq.js → chunk-jv69hdp0.js} +2 -2
- package/bundle/chunk-jx9c90ft.js +2 -0
- package/bundle/{chunk-fpzkyzny.js → chunk-kevhkmn2.js} +2 -2
- package/bundle/{chunk-bxnsrggq.js → chunk-khpjjjsb.js} +1 -1
- package/bundle/chunk-kkfrys0w.js +2 -0
- package/bundle/chunk-kkq2vwm6.js +2 -0
- package/bundle/{chunk-qqsj69m2.js → chunk-km1tyeyy.js} +1 -1
- package/bundle/chunk-kp0w1p79.js +2 -0
- package/bundle/chunk-kr7t73tg.js +3 -0
- package/bundle/chunk-kt7q9620.js +2 -0
- package/bundle/{chunk-8a9sj8gp.js → chunk-kzcb1pt4.js} +1 -1
- package/bundle/{chunk-jwv6fda1.js → chunk-m0f6cf9n.js} +2 -2
- package/bundle/chunk-m30bgt2t.js +2 -0
- package/bundle/chunk-m318f9es.js +2 -0
- package/bundle/{chunk-1mfdmm2t.js → chunk-m5r6zq6v.js} +1 -1
- package/bundle/chunk-m6g6za7b.js +2 -0
- package/bundle/chunk-m8djypsy.js +11 -0
- package/bundle/chunk-ma0vvbvy.js +2 -0
- package/bundle/chunk-mha4n5md.js +2 -0
- package/bundle/{chunk-s9epttpy.js → chunk-mhq2a5ms.js} +1 -1
- package/bundle/chunk-mp9qhnxg.js +2 -0
- package/bundle/{chunk-gd0j16gn.js → chunk-mqdvthkm.js} +1 -1
- package/bundle/{chunk-69k7cdtv.js → chunk-mqe1qa6t.js} +2 -2
- package/bundle/{chunk-j45p2v4a.js → chunk-mz6swd88.js} +3 -3
- package/bundle/{chunk-0m4gvjcv.js → chunk-n25t4j9w.js} +2 -2
- package/bundle/{chunk-hx13a8es.js → chunk-n7ewvphw.js} +3 -3
- package/bundle/chunk-n9wre9wx.js +2 -0
- package/bundle/chunk-ncbj74tk.js +3 -0
- package/bundle/{chunk-06tgmvh6.js → chunk-ne3z7yye.js} +2 -2
- package/bundle/chunk-nnyvn2pm.js +2 -0
- package/bundle/chunk-nyhx3822.js +2 -0
- package/bundle/{chunk-zjyaze0d.js → chunk-p54bzjtv.js} +1 -1
- package/bundle/{chunk-dvp0r93q.js → chunk-p5d5qyzq.js} +1 -1
- package/bundle/{chunk-m8kjtp60.js → chunk-p6mxxem5.js} +1 -1
- package/bundle/{chunk-fd04358e.js → chunk-p76c9s6g.js} +310 -309
- package/bundle/chunk-p8etcskm.js +2 -0
- package/bundle/{chunk-b350g18y.js → chunk-pf4gwr34.js} +2 -2
- package/bundle/{chunk-wf0n1cs9.js → chunk-pf61zhms.js} +1 -1
- package/bundle/{chunk-sh03ka27.js → chunk-pfx8ts02.js} +1 -1
- package/bundle/{chunk-e611m0p4.js → chunk-phvp9h7w.js} +1 -1
- package/bundle/chunk-pv71d7f3.js +2 -0
- package/bundle/{chunk-6wmtbebc.js → chunk-pwcmc8j7.js} +1 -1
- package/bundle/{chunk-g77kddrs.js → chunk-pyt4xpze.js} +2 -2
- package/bundle/{chunk-1bq15kf0.js → chunk-q0pd8bac.js} +2 -2
- package/bundle/{chunk-yg9n2a2d.js → chunk-q12dtxep.js} +1 -1
- package/bundle/{chunk-v1axkp21.js → chunk-q2j2dm96.js} +2 -2
- package/bundle/{chunk-rx9eh3db.js → chunk-qf1hh45g.js} +3 -3
- package/bundle/{chunk-p4xqfkbh.js → chunk-qqjspfqw.js} +1 -1
- package/bundle/{chunk-9kc2th5c.js → chunk-qvnsgyfk.js} +2 -2
- package/bundle/{chunk-rqap90xh.js → chunk-qz35c4xy.js} +2 -2
- package/bundle/{chunk-bemyyen3.js → chunk-r3z77rjn.js} +1 -1
- package/bundle/{chunk-chnr7pe5.js → chunk-r7mcn9ey.js} +1 -1
- package/bundle/{chunk-nzz7gzg2.js → chunk-rmpgmjtd.js} +1 -1
- package/bundle/{chunk-k0chq88p.js → chunk-rpt3rm31.js} +1 -1
- package/bundle/chunk-rteaec1s.js +2 -0
- package/bundle/chunk-rxwcah73.js +2 -0
- package/bundle/{chunk-s0gmxpxm.js → chunk-s1gy4hnw.js} +2 -2
- package/bundle/{chunk-4s1n38ds.js → chunk-s2ma1nz3.js} +2 -2
- package/bundle/chunk-s3gjc4m0.js +2 -0
- package/bundle/{chunk-6yshpz0z.js → chunk-s5taq9jy.js} +2 -2
- package/bundle/{chunk-5mf4qrye.js → chunk-s7017cak.js} +2 -2
- package/bundle/{chunk-6pt6nqwk.js → chunk-s9bn800b.js} +1 -1
- package/bundle/{chunk-73a7ts8r.js → chunk-sa3rjs2s.js} +1 -1
- package/bundle/{chunk-wfpnv00c.js → chunk-sprbs7aj.js} +2 -2
- package/bundle/{chunk-10q04xh5.js → chunk-sq2z7keb.js} +1 -1
- package/bundle/{chunk-w8nj5ph5.js → chunk-sqrx9csx.js} +1 -1
- package/bundle/{chunk-art8gejd.js → chunk-srf4jqcj.js} +1 -1
- package/bundle/{chunk-ffyj5nsg.js → chunk-ssp3nw24.js} +2 -2
- package/bundle/{chunk-6kch0q2d.js → chunk-svnhycdw.js} +2 -2
- package/bundle/chunk-swm990q6.js +2 -0
- package/bundle/chunk-sy42ayp2.js +2 -0
- package/bundle/{chunk-5rvvfgfy.js → chunk-t3kxce69.js} +2 -2
- package/bundle/chunk-t7mvej98.js +2 -0
- package/bundle/{chunk-6j53vtzd.js → chunk-t8pmy758.js} +1 -1
- package/bundle/{chunk-v7v0krrj.js → chunk-t9srpmte.js} +1 -1
- package/bundle/{chunk-358wdvj7.js → chunk-tatecas7.js} +2 -2
- package/bundle/chunk-teagh4hx.js +2 -0
- package/bundle/{chunk-avksqxan.js → chunk-tf40p520.js} +1 -1
- package/bundle/{chunk-y5ydtbpd.js → chunk-tpgksx59.js} +1 -1
- package/bundle/{chunk-02tmc2st.js → chunk-tr4cze2c.js} +1 -1
- package/bundle/chunk-tv4cp6f9.js +2 -0
- package/bundle/chunk-tw618904.js +2 -0
- package/bundle/{chunk-zpjtse0z.js → chunk-v1bqh3m6.js} +176 -176
- package/bundle/{chunk-j46bxb1b.js → chunk-v3bfzxxg.js} +1 -1
- package/bundle/{chunk-vr13f6b5.js → chunk-v5gf0wx6.js} +2 -2
- package/bundle/{chunk-d385e2qt.js → chunk-v6mnbwtz.js} +1 -1
- package/bundle/{chunk-bq6cvf16.js → chunk-v93gr6n9.js} +2 -2
- package/bundle/chunk-vdpffam0.js +2 -0
- package/bundle/chunk-ve5w7nkb.js +2 -0
- package/bundle/chunk-vey57h4x.js +30 -0
- package/bundle/{chunk-pwq2f75j.js → chunk-vf492zs6.js} +1 -1
- package/bundle/{chunk-fkq0v5qv.js → chunk-vg9ec44m.js} +2 -2
- package/bundle/{chunk-61b81z2h.js → chunk-vh3n53qq.js} +1 -1
- package/bundle/{chunk-bmdqb48f.js → chunk-vk8gxf4y.js} +1 -1
- package/bundle/{chunk-rd08wx37.js → chunk-vr222v2n.js} +2 -2
- package/bundle/chunk-vrpca62q.js +2 -0
- package/bundle/{chunk-x3dzzq0t.js → chunk-w5fx69cw.js} +1 -1
- package/bundle/{chunk-05bkxat0.js → chunk-w9w59zjv.js} +2 -2
- package/bundle/{chunk-xmf59618.js → chunk-wbz79hns.js} +1 -1
- package/bundle/{chunk-gfvq78gy.js → chunk-wdrfzx4m.js} +1 -1
- package/bundle/{chunk-j3agzs13.js → chunk-wf18y499.js} +2 -2
- package/bundle/chunk-wvvygzz2.js +2 -0
- package/bundle/{chunk-w4fr00s7.js → chunk-wyxc99aa.js} +2 -2
- package/bundle/{chunk-5q98z8ck.js → chunk-x2mbre12.js} +2 -2
- package/bundle/{chunk-2d61z24r.js → chunk-x8rr2f15.js} +1 -1
- package/bundle/{chunk-7s9msscb.js → chunk-xpmgqa5n.js} +1 -1
- package/bundle/{chunk-rws2tsdv.js → chunk-xrwsttb7.js} +1 -1
- package/bundle/{chunk-wmj3xndt.js → chunk-xz6psr05.js} +1 -1
- package/bundle/{chunk-4xqwt6dr.js → chunk-xzshjp04.js} +2 -2
- package/bundle/chunk-y27gwnx9.js +2 -0
- package/bundle/chunk-y2ms7q84.js +2 -0
- package/bundle/{chunk-1pft3sar.js → chunk-y8bjb32m.js} +1 -1
- package/bundle/{chunk-h036zy9e.js → chunk-ya7wrt5f.js} +2 -2
- package/bundle/{chunk-ahgb3r1c.js → chunk-ycjz7y1x.js} +2 -2
- package/bundle/{chunk-10kj86va.js → chunk-ykqx1z0b.js} +1 -1
- package/bundle/chunk-yq4vck53.js +2 -0
- package/bundle/{chunk-j2snkw45.js → chunk-yxsc90ba.js} +2 -2
- package/bundle/{chunk-5cwy8y78.js → chunk-yy5qqab3.js} +2 -2
- package/bundle/{chunk-86reb44c.js → chunk-z38am71w.js} +1 -1
- package/bundle/{chunk-pwrwb7mn.js → chunk-z6mqdbj1.js} +1 -1
- package/bundle/{chunk-nyxn7npc.js → chunk-z87ew6d3.js} +1 -1
- package/bundle/{chunk-m6967jtv.js → chunk-z9k4506p.js} +2 -2
- package/bundle/{chunk-hf39qx6t.js → chunk-zezz8xfw.js} +2 -2
- package/bundle/{chunk-ffx0cr44.js → chunk-zg72kz2k.js} +2 -2
- package/bundle/chunk-zkxc41ek.js +2 -0
- package/bundle/{chunk-tz1bzrnh.js → chunk-zssy3srh.js} +1 -1
- package/bundle/{chunk-ae1g5y4r.js → chunk-zyz4na64.js} +1 -1
- package/bundle/{chunk-e18hshcg.js → chunk-zzsetq5f.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-00r3he5x.js +0 -2
- package/bundle/chunk-0ks20gz1.js +0 -2
- package/bundle/chunk-1a08ffyd.js +0 -2
- package/bundle/chunk-1r7anzk5.js +0 -2
- package/bundle/chunk-26e51217.js +0 -2
- package/bundle/chunk-2g4kxtz0.js +0 -2
- package/bundle/chunk-2jzay8a9.js +0 -2
- package/bundle/chunk-2q78bdtj.js +0 -2
- package/bundle/chunk-30rghawe.js +0 -2
- package/bundle/chunk-31a47ptm.js +0 -10
- package/bundle/chunk-33mzqyyb.js +0 -3
- package/bundle/chunk-34yk99ep.js +0 -2
- package/bundle/chunk-3dajnr1w.js +0 -2
- package/bundle/chunk-3ege6krg.js +0 -2
- package/bundle/chunk-43vpxggb.js +0 -2
- package/bundle/chunk-49y7zg15.js +0 -2
- package/bundle/chunk-5qhsfjzq.js +0 -3
- package/bundle/chunk-5xxn06g0.js +0 -2
- package/bundle/chunk-7cp30q0t.js +0 -2
- package/bundle/chunk-7xc73qb1.js +0 -2
- package/bundle/chunk-8gz8fk6r.js +0 -2
- package/bundle/chunk-8ht7cq3h.js +0 -2
- package/bundle/chunk-8qv0119d.js +0 -2
- package/bundle/chunk-9m0eawt5.js +0 -2
- package/bundle/chunk-9thgxbze.js +0 -2
- package/bundle/chunk-a32y70fe.js +0 -2
- package/bundle/chunk-avzaqy6a.js +0 -2
- package/bundle/chunk-az12tp53.js +0 -2
- package/bundle/chunk-b5dpzcc7.js +0 -2
- package/bundle/chunk-bcgtqx3g.js +0 -2
- package/bundle/chunk-bde5d507.js +0 -2
- package/bundle/chunk-bzzggc3s.js +0 -2
- package/bundle/chunk-c8qx439t.js +0 -2
- package/bundle/chunk-ckw51fn6.js +0 -2
- package/bundle/chunk-denp0wrq.js +0 -2
- package/bundle/chunk-depxzjer.js +0 -2
- package/bundle/chunk-dhvqpcf3.js +0 -2
- package/bundle/chunk-dkqqswbv.js +0 -2
- package/bundle/chunk-dn0437c1.js +0 -5
- package/bundle/chunk-e5t7jsxa.js +0 -2
- package/bundle/chunk-eb811dt2.js +0 -2
- package/bundle/chunk-fbz2xv2w.js +0 -2
- package/bundle/chunk-gbvcb4k1.js +0 -2
- package/bundle/chunk-gdtnqzbp.js +0 -2
- package/bundle/chunk-gkfvhh28.js +0 -2
- package/bundle/chunk-gnh8c49b.js +0 -2
- package/bundle/chunk-gvf6ek9f.js +0 -2
- package/bundle/chunk-gvx5hmhk.js +0 -2
- package/bundle/chunk-hham7r33.js +0 -2
- package/bundle/chunk-hsjbe5zy.js +0 -2
- package/bundle/chunk-j1bv93m4.js +0 -31
- package/bundle/chunk-jvvctqjd.js +0 -8
- package/bundle/chunk-jvx7jtm4.js +0 -3
- package/bundle/chunk-k6gdmqff.js +0 -2
- package/bundle/chunk-kzkb4648.js +0 -2
- package/bundle/chunk-m2540waa.js +0 -2
- package/bundle/chunk-mscvm1rm.js +0 -2
- package/bundle/chunk-mw3hh526.js +0 -2
- package/bundle/chunk-n3nsrk5n.js +0 -2
- package/bundle/chunk-n9nmc4q4.js +0 -2
- package/bundle/chunk-nj4as8vy.js +0 -2
- package/bundle/chunk-nrzca9yd.js +0 -2
- package/bundle/chunk-nxm6gpyv.js +0 -2
- package/bundle/chunk-pp10epga.js +0 -8
- package/bundle/chunk-qbjqkezn.js +0 -2
- package/bundle/chunk-qhtp1xvx.js +0 -2
- package/bundle/chunk-qkztgpay.js +0 -2
- package/bundle/chunk-rnf3dy0y.js +0 -2
- package/bundle/chunk-rry4kq85.js +0 -2
- package/bundle/chunk-ryfj80q6.js +0 -2
- package/bundle/chunk-snx49w8h.js +0 -2
- package/bundle/chunk-t21mdqbb.js +0 -2
- package/bundle/chunk-tn2yyqeb.js +0 -2
- package/bundle/chunk-ttebf3nt.js +0 -2
- package/bundle/chunk-twpfh0mx.js +0 -2
- package/bundle/chunk-tzf6d5qy.js +0 -2
- package/bundle/chunk-v2mq09wx.js +0 -2
- package/bundle/chunk-v59a02aj.js +0 -2
- package/bundle/chunk-vnstr4g1.js +0 -2
- package/bundle/chunk-vxr4rzt0.js +0 -2
- package/bundle/chunk-w0h9rczg.js +0 -2
- package/bundle/chunk-w214dwws.js +0 -2
- package/bundle/chunk-w8344et5.js +0 -2
- package/bundle/chunk-weyg78et.js +0 -2
- package/bundle/chunk-xchj8gna.js +0 -2
- package/bundle/chunk-y18ptwk2.js +0 -2
- package/bundle/chunk-y3dpyz2d.js +0 -2
- package/bundle/chunk-ykvgmje9.js +0 -35
- package/bundle/chunk-yvjecrjy.js +0 -2
- package/bundle/chunk-yw2x6by6.js +0 -2
- package/bundle/chunk-z0r4syk8.js +0 -2
- package/bundle/chunk-z7c00g63.js +0 -2
- package/bundle/chunk-znr0saas.js +0 -2
- package/bundle/chunk-zqqt7v17.js +0 -2
- package/bundle/chunk-zwrgh1hc.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Aq as _,Cq as yG,Dq as YG,Eq as d,Fq as IG,Gq as RG,Iq as xG,Jp as g,Lp as FG,Np as NG,Pp as wG,Qp as QG,Rp as SG,Zp as $G,cq as OG,dq as XG,gq as fG,kq as v,nq as k,oq as s,rq as CG,uq as p,vq as u}from"./chunk-1bq15kf0.js";import{Kq as l,Lq as GG,Uq as BG,Xq as c}from"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import{Lu as G}from"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-sh03ka27.js";function vG(J){var D;let L=[],q=[];for(let{role:K,content:z}of J)switch(K){case"system":{L.push({role:"system",content:z});break}case"user":{if(z.length===1&&z[0].type==="text"){L.push({role:"user",content:z[0].text});break}L.push({role:"user",content:z.map((A)=>{switch(A.type){case"text":return{type:"text",text:A.text};case"file":if(A.mediaType.startsWith("image/")){let Y=A.mediaType==="image/*"?"image/jpeg":A.mediaType;return{type:"image_url",image_url:{url:A.data instanceof URL?A.data.toString():`data:${Y};base64,${QG(A.data)}`}}}else throw new c({functionality:`file part media type ${A.mediaType}`})}})});break}case"assistant":{let A="",Y=[];for(let X of z)switch(X.type){case"text":{A+=X.text;break}case"tool-call":{Y.push({id:X.toolCallId,type:"function",function:{name:X.toolName,arguments:JSON.stringify(X.input)}});break}}L.push({role:"assistant",content:A,tool_calls:Y.length>0?Y:void 0});break}case"tool":{for(let A of z){if(A.type==="tool-approval-response")continue;let Y=A.output,X;switch(Y.type){case"text":case"error-text":X=Y.value;break;case"execution-denied":X=(D=Y.reason)!=null?D:"Tool execution denied.";break;case"content":case"json":case"error-json":X=JSON.stringify(Y.value);break}L.push({role:"tool",tool_call_id:A.toolCallId,content:X})}break}default:throw Error(`Unsupported role: ${K}`)}return{messages:L,warnings:q}}function EG(J){var D,L,q,K;let z=(L=(D=J.prompt_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.completion_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.prompt_tokens;return{inputTokens:{total:Y?J.prompt_tokens:J.prompt_tokens+z,noCache:Y?J.prompt_tokens-z:J.prompt_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.completion_tokens+A,text:J.completion_tokens,reasoning:A},raw:J}}function JG({id:J,model:D,created:L,created_at:q}){let K=L!=null?L:q;return{id:J!=null?J:void 0,modelId:D!=null?D:void 0,timestamp:K!=null?new Date(K*1000):void 0}}function WG(J){switch(J){case"stop":return"stop";case"length":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var kG=G.object({type:G.literal("web"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),allowedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),bG=G.object({type:G.literal("x"),excludedXHandles:G.array(G.string()).optional(),includedXHandles:G.array(G.string()).optional(),postFavoriteCount:G.number().int().optional(),postViewCount:G.number().int().optional(),xHandles:G.array(G.string()).optional()}),hG=G.object({type:G.literal("news"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),_G=G.object({type:G.literal("rss"),links:G.array(G.string().url()).max(1)}),mG=G.discriminatedUnion("type",[kG,bG,hG,_G]),gG=G.object({reasoningEffort:G.enum(["low","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),parallel_function_calling:G.boolean().optional(),searchParameters:G.object({mode:G.enum(["off","auto","on"]),returnCitations:G.boolean().optional(),fromDate:G.string().optional(),toDate:G.string().optional(),maxSearchResults:G.number().min(1).max(50).optional(),sources:G.array(mG).optional()}).optional()}),uG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),r=yG({errorSchema:uG,errorToMessage:(J)=>J.error.message});function dG({tools:J,toolChoice:D}){J=(J==null?void 0:J.length)?J:void 0;let L=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:L};let q=[];for(let z of J)if(z.type==="provider")L.push({type:"unsupported",feature:`provider-defined tool ${z.name}`});else q.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(D==null)return{tools:q,toolChoice:void 0,toolWarnings:L};let K=D.type;switch(K){case"auto":case"none":return{tools:q,toolChoice:K,toolWarnings:L};case"required":return{tools:q,toolChoice:"required",toolWarnings:L};case"tool":return{tools:q,toolChoice:{type:"function",function:{name:D.toolName}},toolWarnings:L};default:throw new c({functionality:`tool choice type: ${K}`})}}var cG=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,topK:K,frequencyPenalty:z,presencePenalty:A,stopSequences:Y,seed:X,responseFormat:Z,providerOptions:M,tools:E,toolChoice:F}){var B,R,N;let $=[],W=(B=await p({provider:"xai",providerOptions:M,schema:gG}))!=null?B:{};if(K!=null)$.push({type:"unsupported",feature:"topK"});if(z!=null)$.push({type:"unsupported",feature:"frequencyPenalty"});if(A!=null)$.push({type:"unsupported",feature:"presencePenalty"});if(Y!=null)$.push({type:"unsupported",feature:"stopSequences"});let{messages:H,warnings:O}=vG(J);$.push(...O);let{tools:C,toolChoice:w,toolWarnings:j}=dG({tools:E,toolChoice:F});return $.push(...j),{args:{model:this.modelId,logprobs:W.logprobs===!0||W.topLogprobs!=null?!0:void 0,top_logprobs:W.topLogprobs,max_completion_tokens:D,temperature:L,top_p:q,seed:X,reasoning_effort:W.reasoningEffort,parallel_function_calling:W.parallel_function_calling,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{name:(R=Z.name)!=null?R:"response",schema:Z.schema,strict:!0}}:{type:"json_object"}:void 0,search_parameters:W.searchParameters?{mode:W.searchParameters.mode,return_citations:W.searchParameters.returnCitations,from_date:W.searchParameters.fromDate,to_date:W.searchParameters.toDate,max_search_results:W.searchParameters.maxSearchResults,sources:(N=W.searchParameters.sources)==null?void 0:N.map((S)=>{var h;return{type:S.type,...S.type==="web"&&{country:S.country,excluded_websites:S.excludedWebsites,allowed_websites:S.allowedWebsites,safe_search:S.safeSearch},...S.type==="x"&&{excluded_x_handles:S.excludedXHandles,included_x_handles:(h=S.includedXHandles)!=null?h:S.xHandles,post_favorite_count:S.postFavoriteCount,post_view_count:S.postViewCount},...S.type==="news"&&{country:S.country,excluded_websites:S.excludedWebsites,safe_search:S.safeSearch},...S.type==="rss"&&{links:S.links}}})}:void 0,messages:H,tools:C,tool_choice:w},warnings:$}}async doGenerate(J){var D,L;let{args:q,warnings:K}=await this.getArgs(J),z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y,rawValue:X}=await u({url:z,headers:g(this.config.headers(),J.headers),body:q,failedResponseHandler:r,successfulResponseHandler:d(pG),abortSignal:J.abortSignal,fetch:this.config.fetch});if(Y.error!=null)throw new GG({message:Y.error,url:z,requestBodyValues:q,statusCode:200,responseHeaders:A,responseBody:JSON.stringify(X),isRetryable:Y.code==="The service is currently unavailable"});let Z=Y.choices[0],M=[];if(Z.message.content!=null&&Z.message.content.length>0){let E=Z.message.content,F=q.messages[q.messages.length-1];if((F==null?void 0:F.role)==="assistant"&&E===F.content)E="";if(E.length>0)M.push({type:"text",text:E})}if(Z.message.reasoning_content!=null&&Z.message.reasoning_content.length>0)M.push({type:"reasoning",text:Z.message.reasoning_content});if(Z.message.tool_calls!=null)for(let E of Z.message.tool_calls)M.push({type:"tool-call",toolCallId:E.id,toolName:E.function.name,input:E.function.arguments});if(Y.citations!=null)for(let E of Y.citations)M.push({type:"source",sourceType:"url",id:this.config.generateId(),url:E});return{content:M,finishReason:{unified:WG(Z.finish_reason),raw:(L=Z.finish_reason)!=null?L:void 0},usage:Y.usage?EG(Y.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:q},response:{...JG(Y),headers:A,body:X},warnings:K}}async doStream(J){var D;let{args:L,warnings:q}=await this.getArgs(J),K={...L,stream:!0,stream_options:{include_usage:!0}},z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y}=await u({url:z,headers:g(this.config.headers(),J.headers),body:K,failedResponseHandler:r,successfulResponseHandler:async({response:N})=>{let $=NG(N),W=N.headers.get("content-type");if(W==null?void 0:W.includes("application/json")){let H=await N.text(),O=await CG({text:H,schema:lG});if(O.success)throw new GG({message:O.value.error,url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H,isRetryable:O.value.code==="The service is currently unavailable"});throw new GG({message:"Invalid JSON response",url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H})}return YG(iG)({response:N,url:z,requestBodyValues:K})},abortSignal:J.abortSignal,fetch:this.config.fetch}),X={unified:"other",raw:void 0},Z=void 0,M=!0,E={},F={},B=void 0,R=this;return{stream:Y.pipeThrough(new TransformStream({start(N){N.enqueue({type:"stream-start",warnings:q})},transform(N,$){if(J.includeRawChunks)$.enqueue({type:"raw",rawValue:N.rawValue});if(!N.success){$.enqueue({type:"error",error:N.error});return}let W=N.value;if(M)$.enqueue({type:"response-metadata",...JG(W)}),M=!1;if(W.citations!=null)for(let w of W.citations)$.enqueue({type:"source",sourceType:"url",id:R.config.generateId(),url:w});if(W.usage!=null)Z=EG(W.usage);let H=W.choices[0];if((H==null?void 0:H.finish_reason)!=null)X={unified:WG(H.finish_reason),raw:H.finish_reason};if((H==null?void 0:H.delta)==null)return;let{delta:O,index:C}=H;if(O.content!=null&&O.content.length>0){let w=O.content;if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;let j=K.messages[K.messages.length-1];if((j==null?void 0:j.role)==="assistant"&&w===j.content)return;let y=`text-${W.id||C}`;if(E[y]==null)E[y]={type:"text",ended:!1},$.enqueue({type:"text-start",id:y});$.enqueue({type:"text-delta",id:y,delta:w})}if(O.reasoning_content!=null&&O.reasoning_content.length>0){let w=`reasoning-${W.id||C}`;if(F[w]===O.reasoning_content)return;if(F[w]=O.reasoning_content,E[w]==null)E[w]={type:"reasoning",ended:!1},B=w,$.enqueue({type:"reasoning-start",id:w});$.enqueue({type:"reasoning-delta",id:w,delta:O.reasoning_content})}if(O.tool_calls!=null){if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;for(let w of O.tool_calls){let j=w.id;$.enqueue({type:"tool-input-start",id:j,toolName:w.function.name}),$.enqueue({type:"tool-input-delta",id:j,delta:w.function.arguments}),$.enqueue({type:"tool-input-end",id:j}),$.enqueue({type:"tool-call",toolCallId:j,toolName:w.function.name,input:w.function.arguments})}}},flush(N){for(let[$,W]of Object.entries(E))if(!W.ended)N.enqueue({type:W.type==="text"?"text-end":"reasoning-end",id:$});N.enqueue({type:"finish",finishReason:X,usage:Z!=null?Z:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:K},response:{headers:A}}}},TG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({text_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),image_tokens:G.number().nullish(),cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}),pG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant"),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),index:G.number(),finish_reason:G.string().nullish()})).nullish(),object:G.literal("chat.completion").nullish(),usage:TG.nullish(),citations:G.array(G.string().url()).nullish(),code:G.string().nullish(),error:G.string().nullish()}),iG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).optional(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:TG.nullish(),citations:G.array(G.string().url()).nullish()}),lG=G.object({code:G.string(),error:G.string()}),rG=G.object({aspect_ratio:G.string().optional(),output_format:G.string().optional(),sync_mode:G.boolean().optional(),resolution:G.enum(["1k","2k"]).optional(),quality:G.enum(["low","medium","high"]).optional(),user:G.string().optional()}),aG=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxImagesPerCall=3}get provider(){return this.config.provider}async doGenerate({prompt:J,n:D,size:L,aspectRatio:q,seed:K,providerOptions:z,headers:A,abortSignal:Y,files:X,mask:Z}){var M,E,F,B,R;let N=[];if(L!=null)N.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});if(K!=null)N.push({type:"unsupported",feature:"seed"});if(Z!=null)N.push({type:"unsupported",feature:"mask"});let $=await p({provider:"xai",providerOptions:z,schema:rG}),W=X!=null&&X.length>0,H=W?X.map((I)=>SG(I)):[],O=W?"/images/edits":"/images/generations",C={model:this.modelId,prompt:J,n:D,response_format:"b64_json"};if(q!=null)C.aspect_ratio=q;if(($==null?void 0:$.output_format)!=null)C.output_format=$.output_format;if(($==null?void 0:$.sync_mode)!=null)C.sync_mode=$.sync_mode;if(($==null?void 0:$.aspect_ratio)!=null&&q==null)C.aspect_ratio=$.aspect_ratio;if(($==null?void 0:$.resolution)!=null)C.resolution=$.resolution;if(($==null?void 0:$.quality)!=null)C.quality=$.quality;if(($==null?void 0:$.user)!=null)C.user=$.user;if(H.length===1)C.image={url:H[0],type:"image_url"};else if(H.length>1)C.images=H.map((I)=>({url:I,type:"image_url"}));let w=(M=this.config.baseURL)!=null?M:"https://api.x.ai/v1",j=(B=(F=(E=this.config._internal)==null?void 0:E.currentDate)==null?void 0:F.call(E))!=null?B:new Date,{value:y,responseHeaders:S}=await u({url:`${w}${O}`,headers:g(this.config.headers(),A),body:C,failedResponseHandler:r,successfulResponseHandler:d(nG),abortSignal:Y,fetch:this.config.fetch});return{images:y.data.every((I)=>I.b64_json!=null)?y.data.map((I)=>I.b64_json):await Promise.all(y.data.map((I)=>this.downloadImage(I.url,Y))),warnings:N,response:{timestamp:j,modelId:this.modelId,headers:S},providerMetadata:{xai:{images:y.data.map((I)=>({...I.revised_prompt?{revisedPrompt:I.revised_prompt}:{}})),...((R=y.usage)==null?void 0:R.cost_in_usd_ticks)!=null?{costInUsdTicks:y.usage.cost_in_usd_ticks}:{}}}}}async downloadImage(J,D){let{value:L}=await XG({url:J,abortSignal:D,failedResponseHandler:RG(),successfulResponseHandler:IG(),fetch:this.config.fetch});return L}},nG=G.object({data:G.array(G.object({url:G.string().nullish(),b64_json:G.string().nullish(),revised_prompt:G.string().nullish()})),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish()});async function sG({prompt:J}){var D,L,q,K,z;let A=[],Y=[];for(let X of J)switch(X.role){case"system":{A.push({role:"system",content:X.content});break}case"user":{let Z=[];for(let M of X.content)switch(M.type){case"text":{Z.push({type:"input_text",text:M.text});break}case"file":{if(M.mediaType.startsWith("image/")){let E=M.mediaType==="image/*"?"image/jpeg":M.mediaType,F=M.data instanceof URL?M.data.toString():`data:${E};base64,${QG(M.data)}`;Z.push({type:"input_image",image_url:F})}else throw new c({functionality:`file part media type ${M.mediaType}`});break}default:{let E=M;Y.push({type:"other",message:"xAI Responses API does not support this content type in user messages"})}}A.push({role:"user",content:Z});break}case"assistant":{for(let Z of X.content)switch(Z.type){case"text":{let M=typeof((L=(D=Z.providerOptions)==null?void 0:D.xai)==null?void 0:L.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({role:"assistant",content:Z.text,id:M});break}case"tool-call":{if(Z.providerExecuted)break;let M=typeof((K=(q=Z.providerOptions)==null?void 0:q.xai)==null?void 0:K.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({type:"function_call",id:M!=null?M:Z.toolCallId,call_id:Z.toolCallId,name:Z.toolName,arguments:JSON.stringify(Z.input),status:"completed"});break}case"tool-result":break;case"reasoning":case"file":{Y.push({type:"other",message:`xAI Responses API does not support ${Z.type} in assistant messages`});break}default:{let M=Z;Y.push({type:"other",message:"xAI Responses API does not support this content type in assistant messages"})}}break}case"tool":{for(let Z of X.content){if(Z.type==="tool-approval-response")continue;let M=Z.output,E;switch(M.type){case"text":case"error-text":E=M.value;break;case"execution-denied":E=(z=M.reason)!=null?z:"tool execution denied";break;case"json":case"error-json":E=JSON.stringify(M.value);break;case"content":E=M.value.map((F)=>{if(F.type==="text")return F.text;return""}).join("");break;default:{let F=M;E=""}}A.push({type:"function_call_output",call_id:Z.toolCallId,output:E})}break}default:{let Z=X;Y.push({type:"other",message:"unsupported message role"})}}return{input:A,inputWarnings:Y}}function ZG(J){var D,L,q,K;let z=(L=(D=J.input_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.output_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.input_tokens;return{inputTokens:{total:Y?J.input_tokens:J.input_tokens+z,noCache:Y?J.input_tokens-z:J.input_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.output_tokens,text:J.output_tokens-A,reasoning:A},raw:J}}function o(J){switch(J){case"stop":case"completed":return"stop";case"length":case"max_output_tokens":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var KG=G.union([G.object({type:G.literal("url_citation"),url:G.string(),title:G.string().optional()}),G.object({type:G.string()})]),AG=G.object({type:G.string(),text:G.string().optional(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),jG=G.object({type:G.string(),text:G.string()}),i=G.object({name:G.string().optional(),arguments:G.string().optional(),input:G.string().optional(),call_id:G.string().optional(),id:G.string(),status:G.string(),action:G.any().optional()}),tG=G.object({name:G.string().optional(),arguments:G.string().optional(),output:G.string().optional(),error:G.string().optional(),id:G.string(),status:G.string(),server_label:G.string().optional()}),DG=G.discriminatedUnion("type",[G.object({type:G.literal("web_search_call"),...i.shape}),G.object({type:G.literal("x_search_call"),...i.shape}),G.object({type:G.literal("code_interpreter_call"),...i.shape}),G.object({type:G.literal("code_execution_call"),...i.shape}),G.object({type:G.literal("view_image_call"),...i.shape}),G.object({type:G.literal("view_x_video_call"),...i.shape}),G.object({type:G.literal("file_search_call"),id:G.string(),status:G.string(),queries:G.array(G.string()).optional(),results:G.array(G.object({file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("custom_tool_call"),...i.shape}),G.object({type:G.literal("mcp_call"),...tG.shape}),G.object({type:G.literal("message"),role:G.string(),content:G.array(AG),id:G.string(),status:G.string()}),G.object({type:G.literal("function_call"),name:G.string(),arguments:G.string(),call_id:G.string(),id:G.string()}),G.object({type:G.literal("reasoning"),id:G.string(),summary:G.array(jG),status:G.string(),encrypted_content:G.string().nullish()})]),qG=G.object({input_tokens:G.number(),output_tokens:G.number(),total_tokens:G.number().optional(),input_tokens_details:G.object({cached_tokens:G.number().optional()}).optional(),output_tokens_details:G.object({reasoning_tokens:G.number().optional()}).optional(),num_sources_used:G.number().optional(),num_server_side_tools_used:G.number().optional()}),t=G.object({id:G.string().nullish(),created_at:G.number().nullish(),model:G.string().nullish(),object:G.literal("response"),output:G.array(DG),usage:qG.nullish(),status:G.string()}),eG=G.union([G.object({type:G.literal("response.created"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.in_progress"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.output_item.added"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.output_item.done"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.content_part.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.content_part.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.output_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string(),logprobs:G.array(G.any()).optional()}),G.object({type:G.literal("response.output_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),G.object({type:G.literal("response.output_text.annotation.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),annotation_index:G.number(),annotation:KG}),G.object({type:G.literal("response.reasoning_summary_part.added"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_part.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_text.delta"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_summary_text.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),text:G.string()}),G.object({type:G.literal("response.reasoning_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string()}),G.object({type:G.literal("response.web_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.interpreting"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call_code.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.done"),item_id:G.string(),output_index:G.number(),code:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.done"),item_id:G.string(),output_index:G.number(),input:G.string()}),G.object({type:G.literal("response.function_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.function_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string()}),G.object({type:G.literal("response.mcp_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.failed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string().optional()}),G.object({type:G.literal("response.mcp_call_output.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_output.done"),item_id:G.string(),output_index:G.number(),output:G.string().optional()}),G.object({type:G.literal("response.incomplete"),response:G.object({incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("response.failed"),response:G.object({error:G.object({code:G.string().nullish(),message:G.string()}).nullish(),incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("error"),code:G.string().nullish(),message:G.string(),param:G.string().nullish()}),G.object({type:G.literal("response.done"),response:t}),G.object({type:G.literal("response.completed"),response:t})]),oG=G.object({reasoningEffort:G.enum(["low","medium","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),store:G.boolean().optional(),previousResponseId:G.string().optional(),include:G.array(G.enum(["file_search_call.results"])).nullish()}),GJ=v(()=>k(G.object({vectorStoreIds:G.array(G.string()),maxNumResults:G.number().optional()}))),JJ=v(()=>k(G.object({queries:G.array(G.string()),results:G.array(G.object({fileId:G.string(),filename:G.string(),score:G.number().min(0).max(1),text:G.string()})).nullable()}))),QJ=_({id:"xai.file_search",inputSchema:v(()=>k(G.object({}))),outputSchema:JJ}),XJ=(J)=>QJ(J),YJ=v(()=>k(G.object({serverUrl:G.string().describe("The URL of the MCP server"),serverLabel:G.string().optional().describe("A label for the MCP server"),serverDescription:G.string().optional().describe("Description of the MCP server"),allowedTools:G.array(G.string()).optional().describe("List of allowed tool names"),headers:G.record(G.string(),G.string()).optional().describe("Custom headers to send"),authorization:G.string().optional().describe("Authorization header value")}))),ZJ=v(()=>k(G.object({name:G.string(),arguments:G.string(),result:G.unknown()}))),$J=_({id:"xai.mcp",inputSchema:v(()=>k(G.object({}))),outputSchema:ZJ}),KJ=(J)=>$J(J),AJ=v(()=>k(G.object({allowedDomains:G.array(G.string()).max(5).optional(),excludedDomains:G.array(G.string()).max(5).optional(),enableImageUnderstanding:G.boolean().optional()}))),jJ=v(()=>k(G.object({query:G.string(),sources:G.array(G.object({title:G.string(),url:G.string(),snippet:G.string()}))}))),DJ=_({id:"xai.web_search",inputSchema:v(()=>k(G.object({}))),outputSchema:jJ}),qJ=(J={})=>DJ(J),zJ=v(()=>k(G.object({allowedXHandles:G.array(G.string()).max(10).optional(),excludedXHandles:G.array(G.string()).max(10).optional(),fromDate:G.string().optional(),toDate:G.string().optional(),enableImageUnderstanding:G.boolean().optional(),enableVideoUnderstanding:G.boolean().optional()}))),VJ=v(()=>k(G.object({query:G.string(),posts:G.array(G.object({author:G.string(),text:G.string(),url:G.string(),likes:G.number()}))}))),LJ=_({id:"xai.x_search",inputSchema:v(()=>k(G.object({}))),outputSchema:VJ}),UJ=(J={})=>LJ(J);async function HJ({tools:J,toolChoice:D}){let L=(J==null?void 0:J.length)?J:void 0,q=[];if(L==null)return{tools:void 0,toolChoice:void 0,toolWarnings:q};let K=[],z=new Map;for(let Y of L)if(z.set(Y.name,Y),Y.type==="provider")switch(Y.id){case"xai.web_search":{let X=await s({value:Y.args,schema:AJ});K.push({type:"web_search",allowed_domains:X.allowedDomains,excluded_domains:X.excludedDomains,enable_image_understanding:X.enableImageUnderstanding});break}case"xai.x_search":{let X=await s({value:Y.args,schema:zJ});K.push({type:"x_search",allowed_x_handles:X.allowedXHandles,excluded_x_handles:X.excludedXHandles,from_date:X.fromDate,to_date:X.toDate,enable_image_understanding:X.enableImageUnderstanding,enable_video_understanding:X.enableVideoUnderstanding});break}case"xai.code_execution":{K.push({type:"code_interpreter"});break}case"xai.view_image":{K.push({type:"view_image"});break}case"xai.view_x_video":{K.push({type:"view_x_video"});break}case"xai.file_search":{let X=await s({value:Y.args,schema:GJ});K.push({type:"file_search",vector_store_ids:X.vectorStoreIds,max_num_results:X.maxNumResults});break}case"xai.mcp":{let X=await s({value:Y.args,schema:YJ});K.push({type:"mcp",server_url:X.serverUrl,server_label:X.serverLabel,server_description:X.serverDescription,allowed_tools:X.allowedTools,headers:X.headers,authorization:X.authorization});break}default:{q.push({type:"unsupported",feature:`provider-defined tool ${Y.name}`});break}}else K.push({type:"function",name:Y.name,description:Y.description,parameters:Y.inputSchema,...Y.strict!=null?{strict:Y.strict}:{}});if(D==null)return{tools:K,toolChoice:void 0,toolWarnings:q};let A=D.type;switch(A){case"auto":case"none":return{tools:K,toolChoice:A,toolWarnings:q};case"required":return{tools:K,toolChoice:"required",toolWarnings:q};case"tool":{let Y=z.get(D.toolName);if(Y==null)return{tools:K,toolChoice:void 0,toolWarnings:q};if(Y.type==="provider")return q.push({type:"unsupported",feature:`toolChoice for server-side tool "${Y.name}"`}),{tools:K,toolChoice:void 0,toolWarnings:q};return{tools:K,toolChoice:{type:"function",name:Y.name},toolWarnings:q}}default:throw new c({functionality:`tool choice type: ${A}`})}}var MJ=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,stopSequences:K,seed:z,responseFormat:A,providerOptions:Y,tools:X,toolChoice:Z}){var M,E,F,B,R,N,$;let W=[],H=(M=await p({provider:"xai",providerOptions:Y,schema:oG}))!=null?M:{};if(K!=null)W.push({type:"unsupported",feature:"stopSequences"});let O=(E=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.web_search"))==null?void 0:E.name,C=(F=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.x_search"))==null?void 0:F.name,w=(B=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.code_execution"))==null?void 0:B.name,j=(R=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.mcp"))==null?void 0:R.name,y=(N=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.file_search"))==null?void 0:N.name,{input:S,inputWarnings:h}=await sG({prompt:J,store:!0});W.push(...h);let{tools:m,toolChoice:I,toolWarnings:P}=await HJ({tools:X,toolChoice:Z});W.push(...P);let f=H.include?[...H.include]:void 0;if(H.store===!1)if(f==null)f=["reasoning.encrypted_content"];else f=[...f,"reasoning.encrypted_content"];let U={model:this.modelId,input:S,logprobs:H.logprobs===!0||H.topLogprobs!=null?!0:void 0,top_logprobs:H.topLogprobs,max_output_tokens:D,temperature:L,top_p:q,seed:z,...(A==null?void 0:A.type)==="json"&&{text:{format:A.schema!=null?{type:"json_schema",strict:!0,name:($=A.name)!=null?$:"response",description:A.description,schema:A.schema}:{type:"json_object"}}},...H.reasoningEffort!=null&&{reasoning:{effort:H.reasoningEffort}},...H.store===!1&&{store:H.store},...f!=null&&{include:f},...H.previousResponseId!=null&&{previous_response_id:H.previousResponseId}};if(m&&m.length>0)U.tools=m;if(I!=null)U.tool_choice=I;return{args:U,warnings:W,webSearchToolName:O,xSearchToolName:C,codeExecutionToolName:w,mcpToolName:j,fileSearchToolName:y}}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M,E,F,B;let{args:R,warnings:N,webSearchToolName:$,xSearchToolName:W,codeExecutionToolName:H,mcpToolName:O,fileSearchToolName:C}=await this.getArgs(J),{responseHeaders:w,value:j,rawValue:y}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:R,failedResponseHandler:r,successfulResponseHandler:d(t),abortSignal:J.abortSignal,fetch:this.config.fetch}),S=[],h=!1,m=["web_search","web_search_with_snippets","browse_page"],I=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"];for(let P of j.output){if(P.type==="file_search_call"){let f=C!=null?C:"file_search";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:"",providerExecuted:!0}),S.push({type:"tool-result",toolCallId:P.id,toolName:f,result:{queries:(L=P.queries)!=null?L:[],results:(K=(q=P.results)==null?void 0:q.map((U)=>({fileId:U.file_id,filename:U.filename,score:U.score,text:U.text})))!=null?K:null}});continue}if(P.type==="web_search_call"||P.type==="x_search_call"||P.type==="code_interpreter_call"||P.type==="code_execution_call"||P.type==="view_image_call"||P.type==="view_x_video_call"||P.type==="custom_tool_call"||P.type==="mcp_call"){let f=(z=P.name)!=null?z:"";if(m.includes((A=P.name)!=null?A:"")||P.type==="web_search_call")f=$!=null?$:"web_search";else if(I.includes((Y=P.name)!=null?Y:"")||P.type==="x_search_call")f=W!=null?W:"x_search";else if(P.name==="code_execution"||P.type==="code_interpreter_call"||P.type==="code_execution_call")f=H!=null?H:"code_execution";else if(P.type==="mcp_call")f=(X=O!=null?O:P.name)!=null?X:"mcp";let U=P.type==="custom_tool_call"?(Z=P.input)!=null?Z:"":P.type==="mcp_call"?(M=P.arguments)!=null?M:"":(E=P.arguments)!=null?E:"";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:U,providerExecuted:!0});continue}switch(P.type){case"message":{for(let f of P.content){if(f.text)S.push({type:"text",text:f.text});if(f.annotations){for(let U of f.annotations)if(U.type==="url_citation"&&"url"in U)S.push({type:"source",sourceType:"url",id:this.config.generateId(),url:U.url,title:(F=U.title)!=null?F:U.url})}}break}case"function_call":{h=!0,S.push({type:"tool-call",toolCallId:P.call_id,toolName:P.name,input:P.arguments});break}case"reasoning":{let f=P.summary.map((U)=>U.text).filter((U)=>U&&U.length>0);if(f.length>0){let U=f.join("");if(P.encrypted_content||P.id)S.push({type:"reasoning",text:U,providerMetadata:{xai:{...P.encrypted_content&&{reasoningEncryptedContent:P.encrypted_content},...P.id&&{itemId:P.id}}}});else S.push({type:"reasoning",text:U})}break}default:break}}return{content:S,finishReason:{unified:h?"tool-calls":o(j.status),raw:(B=j.status)!=null?B:void 0},usage:j.usage?ZG(j.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:R},response:{...JG(j),headers:w,body:y},warnings:N}}async doStream(J){var D;let{args:L,warnings:q,webSearchToolName:K,xSearchToolName:z,codeExecutionToolName:A,mcpToolName:Y,fileSearchToolName:X}=await this.getArgs(J),Z={...L,stream:!0},{responseHeaders:M,value:E}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:Z,failedResponseHandler:r,successfulResponseHandler:YG(eG),abortSignal:J.abortSignal,fetch:this.config.fetch}),F={unified:"other",raw:void 0},B=!1,R=void 0,N=!0,$={},W=new Set,H={},O={},C=this;return{stream:E.pipeThrough(new TransformStream({start(w){w.enqueue({type:"stream-start",warnings:q})},transform(w,j){var y,S,h,m,I,P,f,U,x,zG,VG,LG,UG,HG,MG;if(J.includeRawChunks)j.enqueue({type:"raw",rawValue:w.rawValue});if(!w.success){j.enqueue({type:"error",error:w.error});return}let V=w.value;if(V.type==="response.created"||V.type==="response.in_progress"){if(N)j.enqueue({type:"response-metadata",...JG(V.response)}),N=!1;return}if(V.type==="response.reasoning_summary_part.added"){let Q=`reasoning-${V.item_id}`;O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}})}if(V.type==="response.reasoning_summary_text.delta"){let Q=`reasoning-${V.item_id}`;j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_summary_text.done")return;if(V.type==="response.reasoning_text.delta"){let Q=`reasoning-${V.item_id}`;if(O[V.item_id]==null)O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}});j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_text.done")return;if(V.type==="response.output_text.delta"){let Q=`text-${V.item_id}`;if($[Q]==null)$[Q]={type:"text"},j.enqueue({type:"text-start",id:Q});j.enqueue({type:"text-delta",id:Q,delta:V.delta});return}if(V.type==="response.output_text.done"){if(V.annotations){for(let Q of V.annotations)if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(y=Q.title)!=null?y:Q.url})}return}if(V.type==="response.output_text.annotation.added"){let Q=V.annotation;if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(S=Q.title)!=null?S:Q.url});return}if(V.type==="response.done"||V.type==="response.completed"||V.type==="response.incomplete"){let Q=V.response;if(Q.usage)R=ZG(Q.usage);if(V.type==="response.incomplete"){let T="incomplete_details"in Q?(h=Q.incomplete_details)==null?void 0:h.reason:void 0;F={unified:T?o(T):"other",raw:T!=null?T:"incomplete"}}else if("status"in Q&&Q.status)F={unified:B?"tool-calls":o(Q.status),raw:Q.status};return}if(V.type==="response.failed"){let Q=(m=V.response.incomplete_details)==null?void 0:m.reason;if(F={unified:Q?o(Q):"error",raw:Q!=null?Q:"error"},V.response.usage)R=ZG(V.response.usage);return}if(V.type==="error"){j.enqueue({type:"error",error:V});return}if(V.type==="response.custom_tool_call_input.delta"||V.type==="response.custom_tool_call_input.done")return;if(V.type==="response.function_call_arguments.delta"){let Q=H[V.output_index];if(Q!=null)j.enqueue({type:"tool-input-delta",id:Q.toolCallId,delta:V.delta});return}if(V.type==="response.function_call_arguments.done")return;if(V.type==="response.output_item.added"||V.type==="response.output_item.done"){let Q=V.item;if(Q.type==="reasoning"){if(V.type==="response.output_item.done"){let T=`reasoning-${Q.id}`;if(!(Q.id in O))O[Q.id]={},j.enqueue({type:"reasoning-start",id:T,providerMetadata:{xai:{...Q.id&&{itemId:Q.id}}}});j.enqueue({type:"reasoning-end",id:T,providerMetadata:{xai:{...Q.encrypted_content&&{reasoningEncryptedContent:Q.encrypted_content},...Q.id&&{itemId:Q.id}}}}),delete O[Q.id]}return}if(Q.type==="file_search_call"){let T=X!=null?X:"file_search";if(!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:T}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:""}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:T,input:"",providerExecuted:!0});if(V.type==="response.output_item.done")j.enqueue({type:"tool-result",toolCallId:Q.id,toolName:T,result:{queries:(I=Q.queries)!=null?I:[],results:(f=(P=Q.results)==null?void 0:P.map((b)=>({fileId:b.file_id,filename:b.filename,score:b.score,text:b.text})))!=null?f:null}});return}if(Q.type==="web_search_call"||Q.type==="x_search_call"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call"||Q.type==="view_image_call"||Q.type==="view_x_video_call"||Q.type==="custom_tool_call"||Q.type==="mcp_call"){let T=["web_search","web_search_with_snippets","browse_page"],b=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"],n=(U=Q.name)!=null?U:"";if(T.includes((x=Q.name)!=null?x:"")||Q.type==="web_search_call")n=K!=null?K:"web_search";else if(b.includes((zG=Q.name)!=null?zG:"")||Q.type==="x_search_call")n=z!=null?z:"x_search";else if(Q.name==="code_execution"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call")n=A!=null?A:"code_execution";else if(Q.type==="mcp_call")n=(VG=Y!=null?Y:Q.name)!=null?VG:"mcp";let PG=Q.type==="custom_tool_call"?(LG=Q.input)!=null?LG:"":Q.type==="mcp_call"?(UG=Q.arguments)!=null?UG:"":(HG=Q.arguments)!=null?HG:"";if((Q.type==="custom_tool_call"?V.type==="response.output_item.done":!W.has(Q.id))&&!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:n}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:PG}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:n,input:PG,providerExecuted:!0});return}if(Q.type==="message")for(let T of Q.content){if(T.text&&T.text.length>0){let b=`text-${Q.id}`;if($[b]==null)$[b]={type:"text"},j.enqueue({type:"text-start",id:b}),j.enqueue({type:"text-delta",id:b,delta:T.text})}if(T.annotations){for(let b of T.annotations)if(b.type==="url_citation"&&"url"in b)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:b.url,title:(MG=b.title)!=null?MG:b.url})}}else if(Q.type==="function_call"){if(V.type==="response.output_item.added")H[V.output_index]={toolName:Q.name,toolCallId:Q.call_id},j.enqueue({type:"tool-input-start",id:Q.call_id,toolName:Q.name});else if(V.type==="response.output_item.done")B=!0,H[V.output_index]=void 0,j.enqueue({type:"tool-input-end",id:Q.call_id}),j.enqueue({type:"tool-call",toolCallId:Q.call_id,toolName:Q.name,input:Q.arguments})}}},flush(w){for(let[j,y]of Object.entries($))if(y.type==="text")w.enqueue({type:"text-end",id:j});w.enqueue({type:"finish",finishReason:F,usage:R!=null?R:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:Z},response:{headers:M}}}},PJ=G.object({output:G.string().describe("the output of the code execution"),error:G.string().optional().describe("any error that occurred")}),EJ=_({id:"xai.code_execution",inputSchema:G.object({}).describe("no input parameters"),outputSchema:PJ}),WJ=(J={})=>EJ(J),BJ=G.object({description:G.string().describe("description of the image"),objects:G.array(G.string()).optional().describe("objects detected in the image")}),FJ=_({id:"xai.view_image",inputSchema:G.object({}).describe("no input parameters"),outputSchema:BJ}),NJ=(J={})=>FJ(J),wJ=G.object({transcript:G.string().optional().describe("transcript of the video"),description:G.string().describe("description of the video content"),duration:G.number().optional().describe("duration in seconds")}),SJ=_({id:"xai.view_x_video",inputSchema:G.object({}).describe("no input parameters"),outputSchema:wJ}),OJ=(J={})=>SJ(J),fJ={codeExecution:WJ,fileSearch:XJ,mcpServer:KJ,viewImage:NJ,viewXVideo:OJ,webSearch:qJ,xSearch:UJ},CJ="3.0.82",a=G.string().min(1),yJ=G.enum(["480p","720p"]),IJ=G.enum(["edit-video","extend-video","reference-to-video"]),e={pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish(),resolution:yJ.nullish()},RJ=G.object({...e,mode:G.literal("edit-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),xJ=G.object({...e,mode:G.literal("extend-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),TJ=G.object({...e,mode:G.literal("reference-to-video"),referenceImageUrls:G.array(a).min(1).max(7),videoUrl:G.undefined().optional()}),vJ=G.object({...e,mode:G.undefined().optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional()}),IQ=G.union([RJ,xJ,TJ,vJ]),kJ=G.object({mode:IJ.optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional(),...e}).passthrough(),bJ=v(()=>k(kJ)),hJ={"1280x720":"720p","854x480":"480p","640x480":"480p"};function _J(J){if((J==null?void 0:J.mode)!=null)return J.mode;if((J==null?void 0:J.videoUrl)!=null)return"edit-video";if((J==null?void 0:J.referenceImageUrls)!=null&&J.referenceImageUrls.length>0)return"reference-to-video";return}var mJ=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M;let E=(q=(L=(D=this.config._internal)==null?void 0:D.currentDate)==null?void 0:L.call(D))!=null?q:new Date,F=[],B=await p({provider:"xai",providerOptions:J.providerOptions,schema:bJ}),R=_J(B),N=R==="edit-video",$=R==="extend-video",W=R==="reference-to-video";if(J.fps!=null)F.push({type:"unsupported",feature:"fps",details:"xAI video models do not support custom FPS."});if(J.seed!=null)F.push({type:"unsupported",feature:"seed",details:"xAI video models do not support seed."});if(J.n!=null&&J.n>1)F.push({type:"unsupported",feature:"n",details:"xAI video models do not support generating multiple videos per call. Only 1 video will be generated."});if(N&&J.duration!=null)F.push({type:"unsupported",feature:"duration",details:"xAI video editing does not support custom duration."});if(N&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video editing does not support custom aspect ratio."});if(N&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video editing does not support custom resolution."});if($&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video extension does not support custom aspect ratio."});if($&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video extension does not support custom resolution."});let H={model:this.modelId,prompt:J.prompt},O=!N,C=!N&&!$,w=!N&&!$;if(O&&J.duration!=null)H.duration=J.duration;if(C&&J.aspectRatio!=null)H.aspect_ratio=J.aspectRatio;if(w&&(B==null?void 0:B.resolution)!=null)H.resolution=B.resolution;else if(w&&J.resolution!=null){let U=hJ[J.resolution];if(U!=null)H.resolution=U;else F.push({type:"unsupported",feature:"resolution",details:`Unrecognized resolution "${J.resolution}". Use providerOptions.xai.resolution with "480p" or "720p" instead.`})}if(N)H.video={url:B.videoUrl};if($)H.video={url:B.videoUrl};if(J.image!=null)if(J.image.type==="url")H.image={url:J.image.url};else{let U=typeof J.image.data==="string"?J.image.data:wG(J.image.data);H.image={url:`data:${J.image.mediaType};base64,${U}`}}if(W)H.reference_images=B.referenceImageUrls.map((U)=>({url:U}));if(B!=null){for(let[U,x]of Object.entries(B))if(!["mode","pollIntervalMs","pollTimeoutMs","resolution","videoUrl","referenceImageUrls"].includes(U))H[U]=x}let j=(K=this.config.baseURL)!=null?K:"https://api.x.ai/v1",y;if(N)y=`${j}/videos/edits`;else if($)y=`${j}/videos/extensions`;else y=`${j}/videos/generations`;let{value:S}=await u({url:y,headers:g(this.config.headers(),J.headers),body:H,failedResponseHandler:r,successfulResponseHandler:d(gJ),abortSignal:J.abortSignal,fetch:this.config.fetch}),h=S.request_id;if(!h)throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:`No request_id returned from xAI API. Response: ${JSON.stringify(S)}`});let m=(z=B==null?void 0:B.pollIntervalMs)!=null?z:5000,I=(A=B==null?void 0:B.pollTimeoutMs)!=null?A:600000,P=Date.now(),f;while(!0){if(await FG(m,{abortSignal:J.abortSignal}),Date.now()-P>I)throw new l({name:"XAI_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${I}ms`});let{value:U,responseHeaders:x}=await XG({url:`${j}/videos/${h}`,headers:g(this.config.headers(),J.headers),successfulResponseHandler:d(uJ),failedResponseHandler:r,abortSignal:J.abortSignal,fetch:this.config.fetch});if(f=x,U.status==="done"||U.status==null&&((Y=U.video)==null?void 0:Y.url)){if(((X=U.video)==null?void 0:X.respect_moderation)===!1)throw new l({name:"XAI_VIDEO_MODERATION_ERROR",message:"Video generation was blocked due to a content policy violation."});if(!((Z=U.video)==null?void 0:Z.url))throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:"Video generation completed but no video URL was returned."});return{videos:[{type:"url",url:U.video.url,mediaType:"video/mp4"}],warnings:F,response:{timestamp:E,modelId:this.modelId,headers:f},providerMetadata:{xai:{requestId:h,videoUrl:U.video.url,...U.video.duration!=null?{duration:U.video.duration}:{},...((M=U.usage)==null?void 0:M.cost_in_usd_ticks)!=null?{costInUsdTicks:U.usage.cost_in_usd_ticks}:{},...U.progress!=null?{progress:U.progress}:{}}}}}if(U.status==="expired")throw new l({name:"XAI_VIDEO_GENERATION_EXPIRED",message:"Video generation request expired."});if(U.status==="failed")throw new l({name:"XAI_VIDEO_GENERATION_FAILED",message:"Video generation failed."})}}},gJ=G.object({request_id:G.string().nullish()}),uJ=G.object({status:G.string().nullish(),video:G.object({url:G.string(),duration:G.number().nullish(),respect_moderation:G.boolean().nullish()}).nullish(),model:G.string().nullish(),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish(),progress:G.number().nullish(),error:G.object({code:G.string().nullish(),message:G.string().nullish()}).nullish()});function dJ(J={}){var D;let L=xG((D=J.baseURL)!=null?D:"https://api.x.ai/v1"),q=()=>OG({Authorization:`Bearer ${fG({apiKey:J.apiKey,environmentVariableName:"XAI_API_KEY",description:"xAI API key"})}`,...J.headers},`ai-sdk/xai/${CJ}`),K=(Z)=>{return new cG(Z,{provider:"xai.chat",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},z=(Z)=>{return new MJ(Z,{provider:"xai.responses",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},A=(Z)=>{return new aG(Z,{provider:"xai.image",baseURL:L,headers:q,fetch:J.fetch})},Y=(Z)=>{return new mJ(Z,{provider:"xai.video",baseURL:L,headers:q,fetch:J.fetch})},X=(Z)=>K(Z);return X.specificationVersion="v3",X.languageModel=K,X.chat=K,X.responses=z,X.embeddingModel=(Z)=>{throw new BG({modelId:Z,modelType:"embeddingModel"})},X.textEmbeddingModel=X.embeddingModel,X.imageModel=A,X.image=A,X.videoModel=Y,X.video=Y,X.tools=fJ,X}var RQ=dJ();export{fJ as xaiTools,RQ as xai,UJ as xSearch,qJ as webSearch,OJ as viewXVideo,NJ as viewImage,KJ as mcpServer,dJ as createXai,WJ as codeExecution,CJ as VERSION};
|
|
2
|
+
import{$r as u,Dr as $G,Ir as OG,Jr as XG,Mr as fG,Qr as v,Tr as k,Ur as s,Xr as CG,_r as p,es as _,gs as yG,hs as YG,is as d,js as IG,ks as RG,ms as xG,nr as g,pr as FG,rr as NG,tr as wG,ur as QG,vr as SG}from"./chunk-q0pd8bac.js";import{Bs as c,os as l,ps as GG,ys as BG}from"./chunk-4dy64hgp.js";import"./chunk-cqtkxwd8.js";import"./chunk-gt10s0ks.js";import{pw as G}from"./chunk-9tfm1dk2.js";import"./chunk-x2mbre12.js";import"./chunk-pfx8ts02.js";function vG(J){var D;let L=[],q=[];for(let{role:K,content:z}of J)switch(K){case"system":{L.push({role:"system",content:z});break}case"user":{if(z.length===1&&z[0].type==="text"){L.push({role:"user",content:z[0].text});break}L.push({role:"user",content:z.map((A)=>{switch(A.type){case"text":return{type:"text",text:A.text};case"file":if(A.mediaType.startsWith("image/")){let Y=A.mediaType==="image/*"?"image/jpeg":A.mediaType;return{type:"image_url",image_url:{url:A.data instanceof URL?A.data.toString():`data:${Y};base64,${QG(A.data)}`}}}else throw new c({functionality:`file part media type ${A.mediaType}`})}})});break}case"assistant":{let A="",Y=[];for(let X of z)switch(X.type){case"text":{A+=X.text;break}case"tool-call":{Y.push({id:X.toolCallId,type:"function",function:{name:X.toolName,arguments:JSON.stringify(X.input)}});break}}L.push({role:"assistant",content:A,tool_calls:Y.length>0?Y:void 0});break}case"tool":{for(let A of z){if(A.type==="tool-approval-response")continue;let Y=A.output,X;switch(Y.type){case"text":case"error-text":X=Y.value;break;case"execution-denied":X=(D=Y.reason)!=null?D:"Tool execution denied.";break;case"content":case"json":case"error-json":X=JSON.stringify(Y.value);break}L.push({role:"tool",tool_call_id:A.toolCallId,content:X})}break}default:throw Error(`Unsupported role: ${K}`)}return{messages:L,warnings:q}}function EG(J){var D,L,q,K;let z=(L=(D=J.prompt_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.completion_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.prompt_tokens;return{inputTokens:{total:Y?J.prompt_tokens:J.prompt_tokens+z,noCache:Y?J.prompt_tokens-z:J.prompt_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.completion_tokens+A,text:J.completion_tokens,reasoning:A},raw:J}}function JG({id:J,model:D,created:L,created_at:q}){let K=L!=null?L:q;return{id:J!=null?J:void 0,modelId:D!=null?D:void 0,timestamp:K!=null?new Date(K*1000):void 0}}function WG(J){switch(J){case"stop":return"stop";case"length":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var kG=G.object({type:G.literal("web"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),allowedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),bG=G.object({type:G.literal("x"),excludedXHandles:G.array(G.string()).optional(),includedXHandles:G.array(G.string()).optional(),postFavoriteCount:G.number().int().optional(),postViewCount:G.number().int().optional(),xHandles:G.array(G.string()).optional()}),hG=G.object({type:G.literal("news"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),_G=G.object({type:G.literal("rss"),links:G.array(G.string().url()).max(1)}),mG=G.discriminatedUnion("type",[kG,bG,hG,_G]),gG=G.object({reasoningEffort:G.enum(["low","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),parallel_function_calling:G.boolean().optional(),searchParameters:G.object({mode:G.enum(["off","auto","on"]),returnCitations:G.boolean().optional(),fromDate:G.string().optional(),toDate:G.string().optional(),maxSearchResults:G.number().min(1).max(50).optional(),sources:G.array(mG).optional()}).optional()}),uG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),r=yG({errorSchema:uG,errorToMessage:(J)=>J.error.message});function dG({tools:J,toolChoice:D}){J=(J==null?void 0:J.length)?J:void 0;let L=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:L};let q=[];for(let z of J)if(z.type==="provider")L.push({type:"unsupported",feature:`provider-defined tool ${z.name}`});else q.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(D==null)return{tools:q,toolChoice:void 0,toolWarnings:L};let K=D.type;switch(K){case"auto":case"none":return{tools:q,toolChoice:K,toolWarnings:L};case"required":return{tools:q,toolChoice:"required",toolWarnings:L};case"tool":return{tools:q,toolChoice:{type:"function",function:{name:D.toolName}},toolWarnings:L};default:throw new c({functionality:`tool choice type: ${K}`})}}var cG=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,topK:K,frequencyPenalty:z,presencePenalty:A,stopSequences:Y,seed:X,responseFormat:Z,providerOptions:M,tools:E,toolChoice:F}){var B,R,N;let $=[],W=(B=await p({provider:"xai",providerOptions:M,schema:gG}))!=null?B:{};if(K!=null)$.push({type:"unsupported",feature:"topK"});if(z!=null)$.push({type:"unsupported",feature:"frequencyPenalty"});if(A!=null)$.push({type:"unsupported",feature:"presencePenalty"});if(Y!=null)$.push({type:"unsupported",feature:"stopSequences"});let{messages:H,warnings:O}=vG(J);$.push(...O);let{tools:C,toolChoice:w,toolWarnings:j}=dG({tools:E,toolChoice:F});return $.push(...j),{args:{model:this.modelId,logprobs:W.logprobs===!0||W.topLogprobs!=null?!0:void 0,top_logprobs:W.topLogprobs,max_completion_tokens:D,temperature:L,top_p:q,seed:X,reasoning_effort:W.reasoningEffort,parallel_function_calling:W.parallel_function_calling,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{name:(R=Z.name)!=null?R:"response",schema:Z.schema,strict:!0}}:{type:"json_object"}:void 0,search_parameters:W.searchParameters?{mode:W.searchParameters.mode,return_citations:W.searchParameters.returnCitations,from_date:W.searchParameters.fromDate,to_date:W.searchParameters.toDate,max_search_results:W.searchParameters.maxSearchResults,sources:(N=W.searchParameters.sources)==null?void 0:N.map((S)=>{var h;return{type:S.type,...S.type==="web"&&{country:S.country,excluded_websites:S.excludedWebsites,allowed_websites:S.allowedWebsites,safe_search:S.safeSearch},...S.type==="x"&&{excluded_x_handles:S.excludedXHandles,included_x_handles:(h=S.includedXHandles)!=null?h:S.xHandles,post_favorite_count:S.postFavoriteCount,post_view_count:S.postViewCount},...S.type==="news"&&{country:S.country,excluded_websites:S.excludedWebsites,safe_search:S.safeSearch},...S.type==="rss"&&{links:S.links}}})}:void 0,messages:H,tools:C,tool_choice:w},warnings:$}}async doGenerate(J){var D,L;let{args:q,warnings:K}=await this.getArgs(J),z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y,rawValue:X}=await u({url:z,headers:g(this.config.headers(),J.headers),body:q,failedResponseHandler:r,successfulResponseHandler:d(pG),abortSignal:J.abortSignal,fetch:this.config.fetch});if(Y.error!=null)throw new GG({message:Y.error,url:z,requestBodyValues:q,statusCode:200,responseHeaders:A,responseBody:JSON.stringify(X),isRetryable:Y.code==="The service is currently unavailable"});let Z=Y.choices[0],M=[];if(Z.message.content!=null&&Z.message.content.length>0){let E=Z.message.content,F=q.messages[q.messages.length-1];if((F==null?void 0:F.role)==="assistant"&&E===F.content)E="";if(E.length>0)M.push({type:"text",text:E})}if(Z.message.reasoning_content!=null&&Z.message.reasoning_content.length>0)M.push({type:"reasoning",text:Z.message.reasoning_content});if(Z.message.tool_calls!=null)for(let E of Z.message.tool_calls)M.push({type:"tool-call",toolCallId:E.id,toolName:E.function.name,input:E.function.arguments});if(Y.citations!=null)for(let E of Y.citations)M.push({type:"source",sourceType:"url",id:this.config.generateId(),url:E});return{content:M,finishReason:{unified:WG(Z.finish_reason),raw:(L=Z.finish_reason)!=null?L:void 0},usage:Y.usage?EG(Y.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:q},response:{...JG(Y),headers:A,body:X},warnings:K}}async doStream(J){var D;let{args:L,warnings:q}=await this.getArgs(J),K={...L,stream:!0,stream_options:{include_usage:!0}},z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y}=await u({url:z,headers:g(this.config.headers(),J.headers),body:K,failedResponseHandler:r,successfulResponseHandler:async({response:N})=>{let $=NG(N),W=N.headers.get("content-type");if(W==null?void 0:W.includes("application/json")){let H=await N.text(),O=await CG({text:H,schema:lG});if(O.success)throw new GG({message:O.value.error,url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H,isRetryable:O.value.code==="The service is currently unavailable"});throw new GG({message:"Invalid JSON response",url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H})}return YG(iG)({response:N,url:z,requestBodyValues:K})},abortSignal:J.abortSignal,fetch:this.config.fetch}),X={unified:"other",raw:void 0},Z=void 0,M=!0,E={},F={},B=void 0,R=this;return{stream:Y.pipeThrough(new TransformStream({start(N){N.enqueue({type:"stream-start",warnings:q})},transform(N,$){if(J.includeRawChunks)$.enqueue({type:"raw",rawValue:N.rawValue});if(!N.success){$.enqueue({type:"error",error:N.error});return}let W=N.value;if(M)$.enqueue({type:"response-metadata",...JG(W)}),M=!1;if(W.citations!=null)for(let w of W.citations)$.enqueue({type:"source",sourceType:"url",id:R.config.generateId(),url:w});if(W.usage!=null)Z=EG(W.usage);let H=W.choices[0];if((H==null?void 0:H.finish_reason)!=null)X={unified:WG(H.finish_reason),raw:H.finish_reason};if((H==null?void 0:H.delta)==null)return;let{delta:O,index:C}=H;if(O.content!=null&&O.content.length>0){let w=O.content;if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;let j=K.messages[K.messages.length-1];if((j==null?void 0:j.role)==="assistant"&&w===j.content)return;let y=`text-${W.id||C}`;if(E[y]==null)E[y]={type:"text",ended:!1},$.enqueue({type:"text-start",id:y});$.enqueue({type:"text-delta",id:y,delta:w})}if(O.reasoning_content!=null&&O.reasoning_content.length>0){let w=`reasoning-${W.id||C}`;if(F[w]===O.reasoning_content)return;if(F[w]=O.reasoning_content,E[w]==null)E[w]={type:"reasoning",ended:!1},B=w,$.enqueue({type:"reasoning-start",id:w});$.enqueue({type:"reasoning-delta",id:w,delta:O.reasoning_content})}if(O.tool_calls!=null){if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;for(let w of O.tool_calls){let j=w.id;$.enqueue({type:"tool-input-start",id:j,toolName:w.function.name}),$.enqueue({type:"tool-input-delta",id:j,delta:w.function.arguments}),$.enqueue({type:"tool-input-end",id:j}),$.enqueue({type:"tool-call",toolCallId:j,toolName:w.function.name,input:w.function.arguments})}}},flush(N){for(let[$,W]of Object.entries(E))if(!W.ended)N.enqueue({type:W.type==="text"?"text-end":"reasoning-end",id:$});N.enqueue({type:"finish",finishReason:X,usage:Z!=null?Z:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:K},response:{headers:A}}}},TG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({text_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),image_tokens:G.number().nullish(),cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}),pG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant"),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),index:G.number(),finish_reason:G.string().nullish()})).nullish(),object:G.literal("chat.completion").nullish(),usage:TG.nullish(),citations:G.array(G.string().url()).nullish(),code:G.string().nullish(),error:G.string().nullish()}),iG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).optional(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:TG.nullish(),citations:G.array(G.string().url()).nullish()}),lG=G.object({code:G.string(),error:G.string()}),rG=G.object({aspect_ratio:G.string().optional(),output_format:G.string().optional(),sync_mode:G.boolean().optional(),resolution:G.enum(["1k","2k"]).optional(),quality:G.enum(["low","medium","high"]).optional(),user:G.string().optional()}),aG=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxImagesPerCall=3}get provider(){return this.config.provider}async doGenerate({prompt:J,n:D,size:L,aspectRatio:q,seed:K,providerOptions:z,headers:A,abortSignal:Y,files:X,mask:Z}){var M,E,F,B,R;let N=[];if(L!=null)N.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});if(K!=null)N.push({type:"unsupported",feature:"seed"});if(Z!=null)N.push({type:"unsupported",feature:"mask"});let $=await p({provider:"xai",providerOptions:z,schema:rG}),W=X!=null&&X.length>0,H=W?X.map((I)=>SG(I)):[],O=W?"/images/edits":"/images/generations",C={model:this.modelId,prompt:J,n:D,response_format:"b64_json"};if(q!=null)C.aspect_ratio=q;if(($==null?void 0:$.output_format)!=null)C.output_format=$.output_format;if(($==null?void 0:$.sync_mode)!=null)C.sync_mode=$.sync_mode;if(($==null?void 0:$.aspect_ratio)!=null&&q==null)C.aspect_ratio=$.aspect_ratio;if(($==null?void 0:$.resolution)!=null)C.resolution=$.resolution;if(($==null?void 0:$.quality)!=null)C.quality=$.quality;if(($==null?void 0:$.user)!=null)C.user=$.user;if(H.length===1)C.image={url:H[0],type:"image_url"};else if(H.length>1)C.images=H.map((I)=>({url:I,type:"image_url"}));let w=(M=this.config.baseURL)!=null?M:"https://api.x.ai/v1",j=(B=(F=(E=this.config._internal)==null?void 0:E.currentDate)==null?void 0:F.call(E))!=null?B:new Date,{value:y,responseHeaders:S}=await u({url:`${w}${O}`,headers:g(this.config.headers(),A),body:C,failedResponseHandler:r,successfulResponseHandler:d(nG),abortSignal:Y,fetch:this.config.fetch});return{images:y.data.every((I)=>I.b64_json!=null)?y.data.map((I)=>I.b64_json):await Promise.all(y.data.map((I)=>this.downloadImage(I.url,Y))),warnings:N,response:{timestamp:j,modelId:this.modelId,headers:S},providerMetadata:{xai:{images:y.data.map((I)=>({...I.revised_prompt?{revisedPrompt:I.revised_prompt}:{}})),...((R=y.usage)==null?void 0:R.cost_in_usd_ticks)!=null?{costInUsdTicks:y.usage.cost_in_usd_ticks}:{}}}}}async downloadImage(J,D){let{value:L}=await XG({url:J,abortSignal:D,failedResponseHandler:RG(),successfulResponseHandler:IG(),fetch:this.config.fetch});return L}},nG=G.object({data:G.array(G.object({url:G.string().nullish(),b64_json:G.string().nullish(),revised_prompt:G.string().nullish()})),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish()});async function sG({prompt:J}){var D,L,q,K,z;let A=[],Y=[];for(let X of J)switch(X.role){case"system":{A.push({role:"system",content:X.content});break}case"user":{let Z=[];for(let M of X.content)switch(M.type){case"text":{Z.push({type:"input_text",text:M.text});break}case"file":{if(M.mediaType.startsWith("image/")){let E=M.mediaType==="image/*"?"image/jpeg":M.mediaType,F=M.data instanceof URL?M.data.toString():`data:${E};base64,${QG(M.data)}`;Z.push({type:"input_image",image_url:F})}else throw new c({functionality:`file part media type ${M.mediaType}`});break}default:{let E=M;Y.push({type:"other",message:"xAI Responses API does not support this content type in user messages"})}}A.push({role:"user",content:Z});break}case"assistant":{for(let Z of X.content)switch(Z.type){case"text":{let M=typeof((L=(D=Z.providerOptions)==null?void 0:D.xai)==null?void 0:L.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({role:"assistant",content:Z.text,id:M});break}case"tool-call":{if(Z.providerExecuted)break;let M=typeof((K=(q=Z.providerOptions)==null?void 0:q.xai)==null?void 0:K.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({type:"function_call",id:M!=null?M:Z.toolCallId,call_id:Z.toolCallId,name:Z.toolName,arguments:JSON.stringify(Z.input),status:"completed"});break}case"tool-result":break;case"reasoning":case"file":{Y.push({type:"other",message:`xAI Responses API does not support ${Z.type} in assistant messages`});break}default:{let M=Z;Y.push({type:"other",message:"xAI Responses API does not support this content type in assistant messages"})}}break}case"tool":{for(let Z of X.content){if(Z.type==="tool-approval-response")continue;let M=Z.output,E;switch(M.type){case"text":case"error-text":E=M.value;break;case"execution-denied":E=(z=M.reason)!=null?z:"tool execution denied";break;case"json":case"error-json":E=JSON.stringify(M.value);break;case"content":E=M.value.map((F)=>{if(F.type==="text")return F.text;return""}).join("");break;default:{let F=M;E=""}}A.push({type:"function_call_output",call_id:Z.toolCallId,output:E})}break}default:{let Z=X;Y.push({type:"other",message:"unsupported message role"})}}return{input:A,inputWarnings:Y}}function ZG(J){var D,L,q,K;let z=(L=(D=J.input_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.output_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.input_tokens;return{inputTokens:{total:Y?J.input_tokens:J.input_tokens+z,noCache:Y?J.input_tokens-z:J.input_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.output_tokens,text:J.output_tokens-A,reasoning:A},raw:J}}function o(J){switch(J){case"stop":case"completed":return"stop";case"length":case"max_output_tokens":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var KG=G.union([G.object({type:G.literal("url_citation"),url:G.string(),title:G.string().optional()}),G.object({type:G.string()})]),AG=G.object({type:G.string(),text:G.string().optional(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),jG=G.object({type:G.string(),text:G.string()}),i=G.object({name:G.string().optional(),arguments:G.string().optional(),input:G.string().optional(),call_id:G.string().optional(),id:G.string(),status:G.string(),action:G.any().optional()}),tG=G.object({name:G.string().optional(),arguments:G.string().optional(),output:G.string().optional(),error:G.string().optional(),id:G.string(),status:G.string(),server_label:G.string().optional()}),DG=G.discriminatedUnion("type",[G.object({type:G.literal("web_search_call"),...i.shape}),G.object({type:G.literal("x_search_call"),...i.shape}),G.object({type:G.literal("code_interpreter_call"),...i.shape}),G.object({type:G.literal("code_execution_call"),...i.shape}),G.object({type:G.literal("view_image_call"),...i.shape}),G.object({type:G.literal("view_x_video_call"),...i.shape}),G.object({type:G.literal("file_search_call"),id:G.string(),status:G.string(),queries:G.array(G.string()).optional(),results:G.array(G.object({file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("custom_tool_call"),...i.shape}),G.object({type:G.literal("mcp_call"),...tG.shape}),G.object({type:G.literal("message"),role:G.string(),content:G.array(AG),id:G.string(),status:G.string()}),G.object({type:G.literal("function_call"),name:G.string(),arguments:G.string(),call_id:G.string(),id:G.string()}),G.object({type:G.literal("reasoning"),id:G.string(),summary:G.array(jG),status:G.string(),encrypted_content:G.string().nullish()})]),qG=G.object({input_tokens:G.number(),output_tokens:G.number(),total_tokens:G.number().optional(),input_tokens_details:G.object({cached_tokens:G.number().optional()}).optional(),output_tokens_details:G.object({reasoning_tokens:G.number().optional()}).optional(),num_sources_used:G.number().optional(),num_server_side_tools_used:G.number().optional()}),t=G.object({id:G.string().nullish(),created_at:G.number().nullish(),model:G.string().nullish(),object:G.literal("response"),output:G.array(DG),usage:qG.nullish(),status:G.string()}),eG=G.union([G.object({type:G.literal("response.created"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.in_progress"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.output_item.added"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.output_item.done"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.content_part.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.content_part.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.output_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string(),logprobs:G.array(G.any()).optional()}),G.object({type:G.literal("response.output_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),G.object({type:G.literal("response.output_text.annotation.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),annotation_index:G.number(),annotation:KG}),G.object({type:G.literal("response.reasoning_summary_part.added"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_part.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_text.delta"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_summary_text.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),text:G.string()}),G.object({type:G.literal("response.reasoning_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string()}),G.object({type:G.literal("response.web_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.interpreting"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call_code.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.done"),item_id:G.string(),output_index:G.number(),code:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.done"),item_id:G.string(),output_index:G.number(),input:G.string()}),G.object({type:G.literal("response.function_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.function_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string()}),G.object({type:G.literal("response.mcp_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.failed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string().optional()}),G.object({type:G.literal("response.mcp_call_output.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_output.done"),item_id:G.string(),output_index:G.number(),output:G.string().optional()}),G.object({type:G.literal("response.incomplete"),response:G.object({incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("response.failed"),response:G.object({error:G.object({code:G.string().nullish(),message:G.string()}).nullish(),incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("error"),code:G.string().nullish(),message:G.string(),param:G.string().nullish()}),G.object({type:G.literal("response.done"),response:t}),G.object({type:G.literal("response.completed"),response:t})]),oG=G.object({reasoningEffort:G.enum(["low","medium","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),store:G.boolean().optional(),previousResponseId:G.string().optional(),include:G.array(G.enum(["file_search_call.results"])).nullish()}),GJ=v(()=>k(G.object({vectorStoreIds:G.array(G.string()),maxNumResults:G.number().optional()}))),JJ=v(()=>k(G.object({queries:G.array(G.string()),results:G.array(G.object({fileId:G.string(),filename:G.string(),score:G.number().min(0).max(1),text:G.string()})).nullable()}))),QJ=_({id:"xai.file_search",inputSchema:v(()=>k(G.object({}))),outputSchema:JJ}),XJ=(J)=>QJ(J),YJ=v(()=>k(G.object({serverUrl:G.string().describe("The URL of the MCP server"),serverLabel:G.string().optional().describe("A label for the MCP server"),serverDescription:G.string().optional().describe("Description of the MCP server"),allowedTools:G.array(G.string()).optional().describe("List of allowed tool names"),headers:G.record(G.string(),G.string()).optional().describe("Custom headers to send"),authorization:G.string().optional().describe("Authorization header value")}))),ZJ=v(()=>k(G.object({name:G.string(),arguments:G.string(),result:G.unknown()}))),$J=_({id:"xai.mcp",inputSchema:v(()=>k(G.object({}))),outputSchema:ZJ}),KJ=(J)=>$J(J),AJ=v(()=>k(G.object({allowedDomains:G.array(G.string()).max(5).optional(),excludedDomains:G.array(G.string()).max(5).optional(),enableImageUnderstanding:G.boolean().optional()}))),jJ=v(()=>k(G.object({query:G.string(),sources:G.array(G.object({title:G.string(),url:G.string(),snippet:G.string()}))}))),DJ=_({id:"xai.web_search",inputSchema:v(()=>k(G.object({}))),outputSchema:jJ}),qJ=(J={})=>DJ(J),zJ=v(()=>k(G.object({allowedXHandles:G.array(G.string()).max(10).optional(),excludedXHandles:G.array(G.string()).max(10).optional(),fromDate:G.string().optional(),toDate:G.string().optional(),enableImageUnderstanding:G.boolean().optional(),enableVideoUnderstanding:G.boolean().optional()}))),VJ=v(()=>k(G.object({query:G.string(),posts:G.array(G.object({author:G.string(),text:G.string(),url:G.string(),likes:G.number()}))}))),LJ=_({id:"xai.x_search",inputSchema:v(()=>k(G.object({}))),outputSchema:VJ}),UJ=(J={})=>LJ(J);async function HJ({tools:J,toolChoice:D}){let L=(J==null?void 0:J.length)?J:void 0,q=[];if(L==null)return{tools:void 0,toolChoice:void 0,toolWarnings:q};let K=[],z=new Map;for(let Y of L)if(z.set(Y.name,Y),Y.type==="provider")switch(Y.id){case"xai.web_search":{let X=await s({value:Y.args,schema:AJ});K.push({type:"web_search",allowed_domains:X.allowedDomains,excluded_domains:X.excludedDomains,enable_image_understanding:X.enableImageUnderstanding});break}case"xai.x_search":{let X=await s({value:Y.args,schema:zJ});K.push({type:"x_search",allowed_x_handles:X.allowedXHandles,excluded_x_handles:X.excludedXHandles,from_date:X.fromDate,to_date:X.toDate,enable_image_understanding:X.enableImageUnderstanding,enable_video_understanding:X.enableVideoUnderstanding});break}case"xai.code_execution":{K.push({type:"code_interpreter"});break}case"xai.view_image":{K.push({type:"view_image"});break}case"xai.view_x_video":{K.push({type:"view_x_video"});break}case"xai.file_search":{let X=await s({value:Y.args,schema:GJ});K.push({type:"file_search",vector_store_ids:X.vectorStoreIds,max_num_results:X.maxNumResults});break}case"xai.mcp":{let X=await s({value:Y.args,schema:YJ});K.push({type:"mcp",server_url:X.serverUrl,server_label:X.serverLabel,server_description:X.serverDescription,allowed_tools:X.allowedTools,headers:X.headers,authorization:X.authorization});break}default:{q.push({type:"unsupported",feature:`provider-defined tool ${Y.name}`});break}}else K.push({type:"function",name:Y.name,description:Y.description,parameters:Y.inputSchema,...Y.strict!=null?{strict:Y.strict}:{}});if(D==null)return{tools:K,toolChoice:void 0,toolWarnings:q};let A=D.type;switch(A){case"auto":case"none":return{tools:K,toolChoice:A,toolWarnings:q};case"required":return{tools:K,toolChoice:"required",toolWarnings:q};case"tool":{let Y=z.get(D.toolName);if(Y==null)return{tools:K,toolChoice:void 0,toolWarnings:q};if(Y.type==="provider")return q.push({type:"unsupported",feature:`toolChoice for server-side tool "${Y.name}"`}),{tools:K,toolChoice:void 0,toolWarnings:q};return{tools:K,toolChoice:{type:"function",name:Y.name},toolWarnings:q}}default:throw new c({functionality:`tool choice type: ${A}`})}}var MJ=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,stopSequences:K,seed:z,responseFormat:A,providerOptions:Y,tools:X,toolChoice:Z}){var M,E,F,B,R,N,$;let W=[],H=(M=await p({provider:"xai",providerOptions:Y,schema:oG}))!=null?M:{};if(K!=null)W.push({type:"unsupported",feature:"stopSequences"});let O=(E=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.web_search"))==null?void 0:E.name,C=(F=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.x_search"))==null?void 0:F.name,w=(B=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.code_execution"))==null?void 0:B.name,j=(R=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.mcp"))==null?void 0:R.name,y=(N=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.file_search"))==null?void 0:N.name,{input:S,inputWarnings:h}=await sG({prompt:J,store:!0});W.push(...h);let{tools:m,toolChoice:I,toolWarnings:P}=await HJ({tools:X,toolChoice:Z});W.push(...P);let f=H.include?[...H.include]:void 0;if(H.store===!1)if(f==null)f=["reasoning.encrypted_content"];else f=[...f,"reasoning.encrypted_content"];let U={model:this.modelId,input:S,logprobs:H.logprobs===!0||H.topLogprobs!=null?!0:void 0,top_logprobs:H.topLogprobs,max_output_tokens:D,temperature:L,top_p:q,seed:z,...(A==null?void 0:A.type)==="json"&&{text:{format:A.schema!=null?{type:"json_schema",strict:!0,name:($=A.name)!=null?$:"response",description:A.description,schema:A.schema}:{type:"json_object"}}},...H.reasoningEffort!=null&&{reasoning:{effort:H.reasoningEffort}},...H.store===!1&&{store:H.store},...f!=null&&{include:f},...H.previousResponseId!=null&&{previous_response_id:H.previousResponseId}};if(m&&m.length>0)U.tools=m;if(I!=null)U.tool_choice=I;return{args:U,warnings:W,webSearchToolName:O,xSearchToolName:C,codeExecutionToolName:w,mcpToolName:j,fileSearchToolName:y}}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M,E,F,B;let{args:R,warnings:N,webSearchToolName:$,xSearchToolName:W,codeExecutionToolName:H,mcpToolName:O,fileSearchToolName:C}=await this.getArgs(J),{responseHeaders:w,value:j,rawValue:y}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:R,failedResponseHandler:r,successfulResponseHandler:d(t),abortSignal:J.abortSignal,fetch:this.config.fetch}),S=[],h=!1,m=["web_search","web_search_with_snippets","browse_page"],I=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"];for(let P of j.output){if(P.type==="file_search_call"){let f=C!=null?C:"file_search";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:"",providerExecuted:!0}),S.push({type:"tool-result",toolCallId:P.id,toolName:f,result:{queries:(L=P.queries)!=null?L:[],results:(K=(q=P.results)==null?void 0:q.map((U)=>({fileId:U.file_id,filename:U.filename,score:U.score,text:U.text})))!=null?K:null}});continue}if(P.type==="web_search_call"||P.type==="x_search_call"||P.type==="code_interpreter_call"||P.type==="code_execution_call"||P.type==="view_image_call"||P.type==="view_x_video_call"||P.type==="custom_tool_call"||P.type==="mcp_call"){let f=(z=P.name)!=null?z:"";if(m.includes((A=P.name)!=null?A:"")||P.type==="web_search_call")f=$!=null?$:"web_search";else if(I.includes((Y=P.name)!=null?Y:"")||P.type==="x_search_call")f=W!=null?W:"x_search";else if(P.name==="code_execution"||P.type==="code_interpreter_call"||P.type==="code_execution_call")f=H!=null?H:"code_execution";else if(P.type==="mcp_call")f=(X=O!=null?O:P.name)!=null?X:"mcp";let U=P.type==="custom_tool_call"?(Z=P.input)!=null?Z:"":P.type==="mcp_call"?(M=P.arguments)!=null?M:"":(E=P.arguments)!=null?E:"";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:U,providerExecuted:!0});continue}switch(P.type){case"message":{for(let f of P.content){if(f.text)S.push({type:"text",text:f.text});if(f.annotations){for(let U of f.annotations)if(U.type==="url_citation"&&"url"in U)S.push({type:"source",sourceType:"url",id:this.config.generateId(),url:U.url,title:(F=U.title)!=null?F:U.url})}}break}case"function_call":{h=!0,S.push({type:"tool-call",toolCallId:P.call_id,toolName:P.name,input:P.arguments});break}case"reasoning":{let f=P.summary.map((U)=>U.text).filter((U)=>U&&U.length>0);if(f.length>0){let U=f.join("");if(P.encrypted_content||P.id)S.push({type:"reasoning",text:U,providerMetadata:{xai:{...P.encrypted_content&&{reasoningEncryptedContent:P.encrypted_content},...P.id&&{itemId:P.id}}}});else S.push({type:"reasoning",text:U})}break}default:break}}return{content:S,finishReason:{unified:h?"tool-calls":o(j.status),raw:(B=j.status)!=null?B:void 0},usage:j.usage?ZG(j.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:R},response:{...JG(j),headers:w,body:y},warnings:N}}async doStream(J){var D;let{args:L,warnings:q,webSearchToolName:K,xSearchToolName:z,codeExecutionToolName:A,mcpToolName:Y,fileSearchToolName:X}=await this.getArgs(J),Z={...L,stream:!0},{responseHeaders:M,value:E}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:Z,failedResponseHandler:r,successfulResponseHandler:YG(eG),abortSignal:J.abortSignal,fetch:this.config.fetch}),F={unified:"other",raw:void 0},B=!1,R=void 0,N=!0,$={},W=new Set,H={},O={},C=this;return{stream:E.pipeThrough(new TransformStream({start(w){w.enqueue({type:"stream-start",warnings:q})},transform(w,j){var y,S,h,m,I,P,f,U,x,zG,VG,LG,UG,HG,MG;if(J.includeRawChunks)j.enqueue({type:"raw",rawValue:w.rawValue});if(!w.success){j.enqueue({type:"error",error:w.error});return}let V=w.value;if(V.type==="response.created"||V.type==="response.in_progress"){if(N)j.enqueue({type:"response-metadata",...JG(V.response)}),N=!1;return}if(V.type==="response.reasoning_summary_part.added"){let Q=`reasoning-${V.item_id}`;O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}})}if(V.type==="response.reasoning_summary_text.delta"){let Q=`reasoning-${V.item_id}`;j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_summary_text.done")return;if(V.type==="response.reasoning_text.delta"){let Q=`reasoning-${V.item_id}`;if(O[V.item_id]==null)O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}});j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_text.done")return;if(V.type==="response.output_text.delta"){let Q=`text-${V.item_id}`;if($[Q]==null)$[Q]={type:"text"},j.enqueue({type:"text-start",id:Q});j.enqueue({type:"text-delta",id:Q,delta:V.delta});return}if(V.type==="response.output_text.done"){if(V.annotations){for(let Q of V.annotations)if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(y=Q.title)!=null?y:Q.url})}return}if(V.type==="response.output_text.annotation.added"){let Q=V.annotation;if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(S=Q.title)!=null?S:Q.url});return}if(V.type==="response.done"||V.type==="response.completed"||V.type==="response.incomplete"){let Q=V.response;if(Q.usage)R=ZG(Q.usage);if(V.type==="response.incomplete"){let T="incomplete_details"in Q?(h=Q.incomplete_details)==null?void 0:h.reason:void 0;F={unified:T?o(T):"other",raw:T!=null?T:"incomplete"}}else if("status"in Q&&Q.status)F={unified:B?"tool-calls":o(Q.status),raw:Q.status};return}if(V.type==="response.failed"){let Q=(m=V.response.incomplete_details)==null?void 0:m.reason;if(F={unified:Q?o(Q):"error",raw:Q!=null?Q:"error"},V.response.usage)R=ZG(V.response.usage);return}if(V.type==="error"){j.enqueue({type:"error",error:V});return}if(V.type==="response.custom_tool_call_input.delta"||V.type==="response.custom_tool_call_input.done")return;if(V.type==="response.function_call_arguments.delta"){let Q=H[V.output_index];if(Q!=null)j.enqueue({type:"tool-input-delta",id:Q.toolCallId,delta:V.delta});return}if(V.type==="response.function_call_arguments.done")return;if(V.type==="response.output_item.added"||V.type==="response.output_item.done"){let Q=V.item;if(Q.type==="reasoning"){if(V.type==="response.output_item.done"){let T=`reasoning-${Q.id}`;if(!(Q.id in O))O[Q.id]={},j.enqueue({type:"reasoning-start",id:T,providerMetadata:{xai:{...Q.id&&{itemId:Q.id}}}});j.enqueue({type:"reasoning-end",id:T,providerMetadata:{xai:{...Q.encrypted_content&&{reasoningEncryptedContent:Q.encrypted_content},...Q.id&&{itemId:Q.id}}}}),delete O[Q.id]}return}if(Q.type==="file_search_call"){let T=X!=null?X:"file_search";if(!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:T}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:""}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:T,input:"",providerExecuted:!0});if(V.type==="response.output_item.done")j.enqueue({type:"tool-result",toolCallId:Q.id,toolName:T,result:{queries:(I=Q.queries)!=null?I:[],results:(f=(P=Q.results)==null?void 0:P.map((b)=>({fileId:b.file_id,filename:b.filename,score:b.score,text:b.text})))!=null?f:null}});return}if(Q.type==="web_search_call"||Q.type==="x_search_call"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call"||Q.type==="view_image_call"||Q.type==="view_x_video_call"||Q.type==="custom_tool_call"||Q.type==="mcp_call"){let T=["web_search","web_search_with_snippets","browse_page"],b=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"],n=(U=Q.name)!=null?U:"";if(T.includes((x=Q.name)!=null?x:"")||Q.type==="web_search_call")n=K!=null?K:"web_search";else if(b.includes((zG=Q.name)!=null?zG:"")||Q.type==="x_search_call")n=z!=null?z:"x_search";else if(Q.name==="code_execution"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call")n=A!=null?A:"code_execution";else if(Q.type==="mcp_call")n=(VG=Y!=null?Y:Q.name)!=null?VG:"mcp";let PG=Q.type==="custom_tool_call"?(LG=Q.input)!=null?LG:"":Q.type==="mcp_call"?(UG=Q.arguments)!=null?UG:"":(HG=Q.arguments)!=null?HG:"";if((Q.type==="custom_tool_call"?V.type==="response.output_item.done":!W.has(Q.id))&&!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:n}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:PG}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:n,input:PG,providerExecuted:!0});return}if(Q.type==="message")for(let T of Q.content){if(T.text&&T.text.length>0){let b=`text-${Q.id}`;if($[b]==null)$[b]={type:"text"},j.enqueue({type:"text-start",id:b}),j.enqueue({type:"text-delta",id:b,delta:T.text})}if(T.annotations){for(let b of T.annotations)if(b.type==="url_citation"&&"url"in b)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:b.url,title:(MG=b.title)!=null?MG:b.url})}}else if(Q.type==="function_call"){if(V.type==="response.output_item.added")H[V.output_index]={toolName:Q.name,toolCallId:Q.call_id},j.enqueue({type:"tool-input-start",id:Q.call_id,toolName:Q.name});else if(V.type==="response.output_item.done")B=!0,H[V.output_index]=void 0,j.enqueue({type:"tool-input-end",id:Q.call_id}),j.enqueue({type:"tool-call",toolCallId:Q.call_id,toolName:Q.name,input:Q.arguments})}}},flush(w){for(let[j,y]of Object.entries($))if(y.type==="text")w.enqueue({type:"text-end",id:j});w.enqueue({type:"finish",finishReason:F,usage:R!=null?R:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:Z},response:{headers:M}}}},PJ=G.object({output:G.string().describe("the output of the code execution"),error:G.string().optional().describe("any error that occurred")}),EJ=_({id:"xai.code_execution",inputSchema:G.object({}).describe("no input parameters"),outputSchema:PJ}),WJ=(J={})=>EJ(J),BJ=G.object({description:G.string().describe("description of the image"),objects:G.array(G.string()).optional().describe("objects detected in the image")}),FJ=_({id:"xai.view_image",inputSchema:G.object({}).describe("no input parameters"),outputSchema:BJ}),NJ=(J={})=>FJ(J),wJ=G.object({transcript:G.string().optional().describe("transcript of the video"),description:G.string().describe("description of the video content"),duration:G.number().optional().describe("duration in seconds")}),SJ=_({id:"xai.view_x_video",inputSchema:G.object({}).describe("no input parameters"),outputSchema:wJ}),OJ=(J={})=>SJ(J),fJ={codeExecution:WJ,fileSearch:XJ,mcpServer:KJ,viewImage:NJ,viewXVideo:OJ,webSearch:qJ,xSearch:UJ},CJ="3.0.82",a=G.string().min(1),yJ=G.enum(["480p","720p"]),IJ=G.enum(["edit-video","extend-video","reference-to-video"]),e={pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish(),resolution:yJ.nullish()},RJ=G.object({...e,mode:G.literal("edit-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),xJ=G.object({...e,mode:G.literal("extend-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),TJ=G.object({...e,mode:G.literal("reference-to-video"),referenceImageUrls:G.array(a).min(1).max(7),videoUrl:G.undefined().optional()}),vJ=G.object({...e,mode:G.undefined().optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional()}),IQ=G.union([RJ,xJ,TJ,vJ]),kJ=G.object({mode:IJ.optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional(),...e}).passthrough(),bJ=v(()=>k(kJ)),hJ={"1280x720":"720p","854x480":"480p","640x480":"480p"};function _J(J){if((J==null?void 0:J.mode)!=null)return J.mode;if((J==null?void 0:J.videoUrl)!=null)return"edit-video";if((J==null?void 0:J.referenceImageUrls)!=null&&J.referenceImageUrls.length>0)return"reference-to-video";return}var mJ=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M;let E=(q=(L=(D=this.config._internal)==null?void 0:D.currentDate)==null?void 0:L.call(D))!=null?q:new Date,F=[],B=await p({provider:"xai",providerOptions:J.providerOptions,schema:bJ}),R=_J(B),N=R==="edit-video",$=R==="extend-video",W=R==="reference-to-video";if(J.fps!=null)F.push({type:"unsupported",feature:"fps",details:"xAI video models do not support custom FPS."});if(J.seed!=null)F.push({type:"unsupported",feature:"seed",details:"xAI video models do not support seed."});if(J.n!=null&&J.n>1)F.push({type:"unsupported",feature:"n",details:"xAI video models do not support generating multiple videos per call. Only 1 video will be generated."});if(N&&J.duration!=null)F.push({type:"unsupported",feature:"duration",details:"xAI video editing does not support custom duration."});if(N&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video editing does not support custom aspect ratio."});if(N&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video editing does not support custom resolution."});if($&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video extension does not support custom aspect ratio."});if($&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video extension does not support custom resolution."});let H={model:this.modelId,prompt:J.prompt},O=!N,C=!N&&!$,w=!N&&!$;if(O&&J.duration!=null)H.duration=J.duration;if(C&&J.aspectRatio!=null)H.aspect_ratio=J.aspectRatio;if(w&&(B==null?void 0:B.resolution)!=null)H.resolution=B.resolution;else if(w&&J.resolution!=null){let U=hJ[J.resolution];if(U!=null)H.resolution=U;else F.push({type:"unsupported",feature:"resolution",details:`Unrecognized resolution "${J.resolution}". Use providerOptions.xai.resolution with "480p" or "720p" instead.`})}if(N)H.video={url:B.videoUrl};if($)H.video={url:B.videoUrl};if(J.image!=null)if(J.image.type==="url")H.image={url:J.image.url};else{let U=typeof J.image.data==="string"?J.image.data:wG(J.image.data);H.image={url:`data:${J.image.mediaType};base64,${U}`}}if(W)H.reference_images=B.referenceImageUrls.map((U)=>({url:U}));if(B!=null){for(let[U,x]of Object.entries(B))if(!["mode","pollIntervalMs","pollTimeoutMs","resolution","videoUrl","referenceImageUrls"].includes(U))H[U]=x}let j=(K=this.config.baseURL)!=null?K:"https://api.x.ai/v1",y;if(N)y=`${j}/videos/edits`;else if($)y=`${j}/videos/extensions`;else y=`${j}/videos/generations`;let{value:S}=await u({url:y,headers:g(this.config.headers(),J.headers),body:H,failedResponseHandler:r,successfulResponseHandler:d(gJ),abortSignal:J.abortSignal,fetch:this.config.fetch}),h=S.request_id;if(!h)throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:`No request_id returned from xAI API. Response: ${JSON.stringify(S)}`});let m=(z=B==null?void 0:B.pollIntervalMs)!=null?z:5000,I=(A=B==null?void 0:B.pollTimeoutMs)!=null?A:600000,P=Date.now(),f;while(!0){if(await FG(m,{abortSignal:J.abortSignal}),Date.now()-P>I)throw new l({name:"XAI_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${I}ms`});let{value:U,responseHeaders:x}=await XG({url:`${j}/videos/${h}`,headers:g(this.config.headers(),J.headers),successfulResponseHandler:d(uJ),failedResponseHandler:r,abortSignal:J.abortSignal,fetch:this.config.fetch});if(f=x,U.status==="done"||U.status==null&&((Y=U.video)==null?void 0:Y.url)){if(((X=U.video)==null?void 0:X.respect_moderation)===!1)throw new l({name:"XAI_VIDEO_MODERATION_ERROR",message:"Video generation was blocked due to a content policy violation."});if(!((Z=U.video)==null?void 0:Z.url))throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:"Video generation completed but no video URL was returned."});return{videos:[{type:"url",url:U.video.url,mediaType:"video/mp4"}],warnings:F,response:{timestamp:E,modelId:this.modelId,headers:f},providerMetadata:{xai:{requestId:h,videoUrl:U.video.url,...U.video.duration!=null?{duration:U.video.duration}:{},...((M=U.usage)==null?void 0:M.cost_in_usd_ticks)!=null?{costInUsdTicks:U.usage.cost_in_usd_ticks}:{},...U.progress!=null?{progress:U.progress}:{}}}}}if(U.status==="expired")throw new l({name:"XAI_VIDEO_GENERATION_EXPIRED",message:"Video generation request expired."});if(U.status==="failed")throw new l({name:"XAI_VIDEO_GENERATION_FAILED",message:"Video generation failed."})}}},gJ=G.object({request_id:G.string().nullish()}),uJ=G.object({status:G.string().nullish(),video:G.object({url:G.string(),duration:G.number().nullish(),respect_moderation:G.boolean().nullish()}).nullish(),model:G.string().nullish(),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish(),progress:G.number().nullish(),error:G.object({code:G.string().nullish(),message:G.string().nullish()}).nullish()});function dJ(J={}){var D;let L=xG((D=J.baseURL)!=null?D:"https://api.x.ai/v1"),q=()=>OG({Authorization:`Bearer ${fG({apiKey:J.apiKey,environmentVariableName:"XAI_API_KEY",description:"xAI API key"})}`,...J.headers},`ai-sdk/xai/${CJ}`),K=(Z)=>{return new cG(Z,{provider:"xai.chat",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},z=(Z)=>{return new MJ(Z,{provider:"xai.responses",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},A=(Z)=>{return new aG(Z,{provider:"xai.image",baseURL:L,headers:q,fetch:J.fetch})},Y=(Z)=>{return new mJ(Z,{provider:"xai.video",baseURL:L,headers:q,fetch:J.fetch})},X=(Z)=>K(Z);return X.specificationVersion="v3",X.languageModel=K,X.chat=K,X.responses=z,X.embeddingModel=(Z)=>{throw new BG({modelId:Z,modelType:"embeddingModel"})},X.textEmbeddingModel=X.embeddingModel,X.imageModel=A,X.image=A,X.videoModel=Y,X.video=Y,X.tools=fJ,X}var RQ=dJ();export{fJ as xaiTools,RQ as xai,UJ as xSearch,qJ as webSearch,OJ as viewXVideo,NJ as viewImage,KJ as mcpServer,dJ as createXai,WJ as codeExecution,CJ as VERSION};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Av as g,Bv as h,uv as a,vv as b,wv as c,xv as d,yv as e,zv as f}from"./chunk-62mb6wxm.js";import"./chunk-zg72kz2k.js";import"./chunk-kr7t73tg.js";import"./chunk-9tfm1dk2.js";import"./chunk-x2mbre12.js";import"./chunk-sprbs7aj.js";import"./chunk-qvnsgyfk.js";import"./chunk-pfx8ts02.js";export{g as redactValue,e as init,f as flush,d as file,b as enabled,h as create,a as Level,c as Default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{O as
|
|
2
|
+
import{Hf as _}from"./chunk-b2zfr7jz.js";import{$Q as r}from"./chunk-pfx8ts02.js";var O=r((e)=>{Object.defineProperty(e,"__esModule",{value:!0});e.getRegionInfo=e.resolveRegionConfig=e.NODE_REGION_CONFIG_FILE_OPTIONS=e.NODE_REGION_CONFIG_OPTIONS=e.REGION_INI_NAME=e.REGION_ENV_NAME=e.resolveEndpointsConfig=e.resolveCustomEndpointsConfig=e.nodeFipsConfigSelectors=e.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS=e.DEFAULT_USE_FIPS_ENDPOINT=e.CONFIG_USE_FIPS_ENDPOINT=e.ENV_USE_FIPS_ENDPOINT=e.nodeDualstackConfigSelectors=e.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS=e.DEFAULT_USE_DUALSTACK_ENDPOINT=e.CONFIG_USE_DUALSTACK_ENDPOINT=e.ENV_USE_DUALSTACK_ENDPOINT=void 0;var t=_();Object.defineProperty(e,"ENV_USE_DUALSTACK_ENDPOINT",{enumerable:!0,get:function(){return t.ENV_USE_DUALSTACK_ENDPOINT}});Object.defineProperty(e,"CONFIG_USE_DUALSTACK_ENDPOINT",{enumerable:!0,get:function(){return t.CONFIG_USE_DUALSTACK_ENDPOINT}});Object.defineProperty(e,"DEFAULT_USE_DUALSTACK_ENDPOINT",{enumerable:!0,get:function(){return t.DEFAULT_USE_DUALSTACK_ENDPOINT}});Object.defineProperty(e,"NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS",{enumerable:!0,get:function(){return t.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS}});Object.defineProperty(e,"nodeDualstackConfigSelectors",{enumerable:!0,get:function(){return t.nodeDualstackConfigSelectors}});Object.defineProperty(e,"ENV_USE_FIPS_ENDPOINT",{enumerable:!0,get:function(){return t.ENV_USE_FIPS_ENDPOINT}});Object.defineProperty(e,"CONFIG_USE_FIPS_ENDPOINT",{enumerable:!0,get:function(){return t.CONFIG_USE_FIPS_ENDPOINT}});Object.defineProperty(e,"DEFAULT_USE_FIPS_ENDPOINT",{enumerable:!0,get:function(){return t.DEFAULT_USE_FIPS_ENDPOINT}});Object.defineProperty(e,"NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS",{enumerable:!0,get:function(){return t.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS}});Object.defineProperty(e,"nodeFipsConfigSelectors",{enumerable:!0,get:function(){return t.nodeFipsConfigSelectors}});Object.defineProperty(e,"resolveCustomEndpointsConfig",{enumerable:!0,get:function(){return t.resolveCustomEndpointsConfig}});Object.defineProperty(e,"resolveEndpointsConfig",{enumerable:!0,get:function(){return t.resolveEndpointsConfig}});Object.defineProperty(e,"REGION_ENV_NAME",{enumerable:!0,get:function(){return t.REGION_ENV_NAME}});Object.defineProperty(e,"REGION_INI_NAME",{enumerable:!0,get:function(){return t.REGION_INI_NAME}});Object.defineProperty(e,"NODE_REGION_CONFIG_OPTIONS",{enumerable:!0,get:function(){return t.NODE_REGION_CONFIG_OPTIONS}});Object.defineProperty(e,"NODE_REGION_CONFIG_FILE_OPTIONS",{enumerable:!0,get:function(){return t.NODE_REGION_CONFIG_FILE_OPTIONS}});Object.defineProperty(e,"resolveRegionConfig",{enumerable:!0,get:function(){return t.resolveRegionConfig}});Object.defineProperty(e,"getRegionInfo",{enumerable:!0,get:function(){return t.getRegionInfo}})});var u=r((n)=>{Object.defineProperty(n,"__esModule",{value:!0});n.loadConfig=void 0;var o=_();Object.defineProperty(n,"loadConfig",{enumerable:!0,get:function(){return o.loadConfig}})});
|
|
3
|
+
export{O as oe,u as pe};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Pe as M}from"./chunk-mqe1qa6t.js";import{Se as D}from"./chunk-ganwjd6s.js";import{Te as B}from"./chunk-s1gy4hnw.js";import{Hf as d,Jf as w}from"./chunk-b2zfr7jz.js";import{_Q as n}from"./chunk-pfx8ts02.js";var R=n(D(),1),i=n(d(),1),A=n(M(),1);import N from"fs/promises";var S=n(d(),1);var _="169.254.170.2",p="169.254.170.23",u="[fd00:ec2::23]",g=(e,c)=>{if(e.protocol==="https:")return;if(e.hostname===_||e.hostname===p||e.hostname===u)return;if(e.hostname.includes("[")){if(e.hostname==="[::1]"||e.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(e.hostname==="localhost")return;let a=e.hostname.split("."),r=(t)=>{let s=parseInt(t,10);return 0<=s&&s<=255};if(a[0]==="127"&&r(a[1])&&r(a[2])&&r(a[3])&&a.length===4)return}throw new S.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
3
3
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
4
4
|
- ECS container host 169.254.170.2
|
|
5
5
|
- EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:c})};var f=n(d(),1),I=n(B(),1),P=n(w(),1),K=n(w(),1);function x(e){return new I.HttpRequest({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((c,[a,r])=>{return c[a]=r,c},{}),fragment:e.hash})}async function E(e,c){let r=await K.sdkStreamMixin(e.body).transformToString();if(e.statusCode===200){let t=JSON.parse(r);if(typeof t.AccessKeyId!=="string"||typeof t.SecretAccessKey!=="string"||typeof t.Token!=="string"||typeof t.Expiration!=="string")throw new f.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:c});return{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:P.parseRfc3339DateTime(t.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let t={};try{t=JSON.parse(r)}catch(s){}throw Object.assign(new f.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:c}),{Code:t.Code,Message:t.Message})}throw new f.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:c})}var T=(e,c,a)=>{return async()=>{for(let r=0;r<c;++r)try{return await e()}catch(t){await new Promise((s)=>setTimeout(s,a))}return await e()}};var j="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",J="http://169.254.170.2",$="AWS_CONTAINER_CREDENTIALS_FULL_URI",G="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",H="AWS_CONTAINER_AUTHORIZATION_TOKEN",k=(e={})=>{e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let c,a=e.awsContainerCredentialsRelativeUri??process.env[j],r=e.awsContainerCredentialsFullUri??process.env[$],t=e.awsContainerAuthorizationToken??process.env[H],s=e.awsContainerAuthorizationTokenFile??process.env[G],m=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?.warn?console.warn:e.logger.warn.bind(e.logger);if(a&&r)m("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),m("awsContainerCredentialsFullUri will take precedence.");if(t&&s)m("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),m("awsContainerAuthorizationToken will take precedence.");if(r)c=r;else if(a)c=`${J}${a}`;else throw new i.CredentialsProviderError(`No HTTP credential provider host provided.
|
|
6
|
-
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:e.logger});let y=new URL(c);g(y,e.logger);let C=A.NodeHttpHandler.create({connectionTimeout:e.timeout??1000}),O=e.timeout??1000,b=T(async()=>{let o=x(y);if(t)o.headers.Authorization=t;else if(s)o.headers.Authorization=(await N.readFile(s)).toString();try{let h=await C.handle(o,{requestTimeout:O});return E(h.response).then((v)=>R.setCredentialFeature(v,"CREDENTIALS_HTTP","z"))}catch(h){throw new i.CredentialsProviderError(String(h),{logger:e.logger})}},e.maxRetries??3,e.timeout??1000);return async()=>{try{return await b()}finally{C.destroy?.()}}};export{k as
|
|
6
|
+
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:e.logger});let y=new URL(c);g(y,e.logger);let C=A.NodeHttpHandler.create({connectionTimeout:e.timeout??1000}),O=e.timeout??1000,b=T(async()=>{let o=x(y);if(t)o.headers.Authorization=t;else if(s)o.headers.Authorization=(await N.readFile(s)).toString();try{let h=await C.handle(o,{requestTimeout:O});return E(h.response).then((v)=>R.setCredentialFeature(v,"CREDENTIALS_HTTP","z"))}catch(h){throw new i.CredentialsProviderError(String(h),{logger:e.logger})}},e.maxRetries??3,e.timeout??1000);return async()=>{try{return await b()}finally{C.destroy?.()}}};export{k as qe};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{H as
|
|
2
|
+
import{Ms as C}from"./chunk-yxsc90ba.js";import{spawn as E}from"child_process";async function H(z){if(process.platform==="linux"){if(await new Promise((D)=>{let A=!1,x=(j)=>{if(A)return;A=!0,D(j)};try{let j=E("xdg-open",[z],{stdio:"ignore",detached:!0});j.once("error",()=>x(!1)),j.once("spawn",()=>{j.unref(),x(!0)})}catch{x(!1)}}))return!0}try{let q=await C(z);if(!q)return!1;return q.once("error",()=>{}),!0}catch{return!1}}
|
|
3
|
+
export{H as Ch};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ah as a,Bh as b}from"./chunk-p76c9s6g.js";import"./chunk-az2pxgx6.js";import"./chunk-bd21p9zz.js";import"./chunk-p54bzjtv.js";import"./chunk-ha1w0xzh.js";import"./chunk-vr222v2n.js";import"./chunk-6vpc1y3w.js";import"./chunk-j95mkzwg.js";import"./chunk-tatecas7.js";import"./chunk-52n4tdeh.js";import"./chunk-ft4msj4z.js";import"./chunk-m8djypsy.js";import"./chunk-m0f6cf9n.js";import"./chunk-n7ewvphw.js";import"./chunk-ya7wrt5f.js";import"./chunk-wf18y499.js";import"./chunk-4bp91rza.js";import"./chunk-6vxddv5w.js";import"./chunk-dwza14dk.js";import"./chunk-vey57h4x.js";import"./chunk-40pe0tde.js";import"./chunk-d4y5hyjg.js";import"./chunk-q0pd8bac.js";import"./chunk-4dy64hgp.js";import"./chunk-cqtkxwd8.js";import"./chunk-gt10s0ks.js";import"./chunk-z9k4506p.js";import"./chunk-yxsc90ba.js";import"./chunk-vk8gxf4y.js";import"./chunk-jr622341.js";import"./chunk-xzshjp04.js";import"./chunk-pyt4xpze.js";import"./chunk-52f62kr0.js";import"./chunk-svnhycdw.js";import"./chunk-9skj2w9e.js";import"./chunk-m5r6zq6v.js";import"./chunk-vg9ec44m.js";import"./chunk-e826jvr2.js";import"./chunk-4gv7nsdd.js";import"./chunk-afagt413.js";import"./chunk-76jbys6j.js";import"./chunk-9exxjnxc.js";import"./chunk-dm7hfb7f.js";import"./chunk-s5taq9jy.js";import"./chunk-62mb6wxm.js";import"./chunk-zg72kz2k.js";import"./chunk-kr7t73tg.js";import"./chunk-9tfm1dk2.js";import"./chunk-x2mbre12.js";import"./chunk-sprbs7aj.js";import"./chunk-qvnsgyfk.js";import"./chunk-zezz8xfw.js";import"./chunk-bkqemdv8.js";import"./chunk-pfx8ts02.js";export{b as AppRuntime,a as AppLayer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$Q as y,cR as C}from"./chunk-pfx8ts02.js";var h0=y((c$)=>{c$.HttpAuthLocation=void 0;(function(h){h.HEADER="header",h.QUERY="query"})(c$.HttpAuthLocation||(c$.HttpAuthLocation={}));c$.HttpApiKeyAuthLocation=void 0;(function(h){h.HEADER="header",h.QUERY="query"})(c$.HttpApiKeyAuthLocation||(c$.HttpApiKeyAuthLocation={}));c$.EndpointURLScheme=void 0;(function(h){h.HTTP="http",h.HTTPS="https"})(c$.EndpointURLScheme||(c$.EndpointURLScheme={}));c$.AlgorithmId=void 0;(function(h){h.MD5="md5",h.CRC32="crc32",h.CRC32C="crc32c",h.SHA1="sha1",h.SHA256="sha256"})(c$.AlgorithmId||(c$.AlgorithmId={}));var F$=(h)=>{let $=[];if(h.sha256!==void 0)$.push({algorithmId:()=>c$.AlgorithmId.SHA256,checksumConstructor:()=>h.sha256});if(h.md5!=null)$.push({algorithmId:()=>c$.AlgorithmId.MD5,checksumConstructor:()=>h.md5});return{addChecksumAlgorithm(T){$.push(T)},checksumAlgorithms(){return $}}},s$=(h)=>{let $={};return h.checksumAlgorithms().forEach((T)=>{$[T.algorithmId()]=T.checksumConstructor()}),$},S$=(h)=>{return F$(h)},j$=(h)=>{return s$(h)};c$.FieldPosition=void 0;(function(h){h[h.HEADER=0]="HEADER",h[h.TRAILER=1]="TRAILER"})(c$.FieldPosition||(c$.FieldPosition={}));var C$="__smithy_context";c$.IniSectionType=void 0;(function(h){h.PROFILE="profile",h.SSO_SESSION="sso-session",h.SERVICES="services"})(c$.IniSectionType||(c$.IniSectionType={}));c$.RequestHandlerProtocol=void 0;(function(h){h.HTTP_0_9="http/0.9",h.HTTP_1_0="http/1.0",h.TDS_8_0="tds/8.0"})(c$.RequestHandlerProtocol||(c$.RequestHandlerProtocol={}));c$.SMITHY_CONTEXT_KEY=C$;c$.getDefaultClientConfiguration=S$;c$.resolveDefaultRuntimeConfig=j$});var m=y((r$)=>{var c1=h0(),p$=(h)=>h[c1.SMITHY_CONTEXT_KEY]||(h[c1.SMITHY_CONTEXT_KEY]={});class Z0{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(h){this.method=h.method||"GET",this.hostname=h.hostname||"localhost",this.port=h.port,this.query=h.query||{},this.headers=h.headers||{},this.body=h.body,this.protocol=h.protocol?h.protocol.slice(-1)!==":"?`${h.protocol}:`:h.protocol:"https:",this.path=h.path?h.path.charAt(0)!=="/"?`/${h.path}`:h.path:"/",this.username=h.username,this.password=h.password,this.fragment=h.fragment}static clone(h){let $=new Z0({...h,headers:{...h.headers}});if($.query)$.query=g$($.query);return $}static isInstance(h){if(!h)return!1;let $=h;return"method"in $&&"protocol"in $&&"hostname"in $&&"path"in $&&typeof $.query==="object"&&typeof $.headers==="object"}clone(){return Z0.clone(this)}}function g$(h){return Object.keys(h).reduce(($,T)=>{let P=h[T];return{...$,[T]:Array.isArray(P)?[...P]:P}},{})}class b1{statusCode;reason;headers;body;constructor(h){this.statusCode=h.statusCode,this.reason=h.reason,this.headers=h.headers||{},this.body=h.body}static isInstance(h){if(!h)return!1;let $=h;return typeof $.statusCode==="number"&&typeof $.headers==="object"}}var m$=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),y1=(h,$=!1)=>{if(!$)return m$.test(h);let T=h.split(".");for(let P of T)if(!y1(P))return!1;return!0};function d$(h){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(h)}var v$=(h)=>{if(typeof h==="function")return h;let $=Promise.resolve(h);return()=>$};function k1(h){let $={};if(h=h.replace(/^\?/,""),h)for(let T of h.split("&")){let[P,w=null]=T.split("=");if(P=decodeURIComponent(P),w)w=decodeURIComponent(w);if(!(P in $))$[P]=w;else if(Array.isArray($[P]))$[P].push(w);else $[P]=[$[P],w]}return $}var R0=(h)=>{if(typeof h==="string")return R0(new URL(h));let{hostname:$,pathname:T,port:P,protocol:w,search:I}=h,A;if(I)A=k1(I);return{hostname:$,port:P?parseInt(P):void 0,protocol:w,path:T,query:A}},t$=(h)=>{if(typeof h==="object"){if("url"in h){let $=R0(h.url);if(h.headers){$.headers={};for(let T in h.headers)$.headers[T.toLowerCase()]=h.headers[T].join(", ")}return $}return h}return R0(h)};r$.HttpRequest=Z0;r$.HttpResponse=b1;r$.getSmithyContext=p$;r$.isValidHostLabel=y1;r$.isValidHostname=d$;r$.normalizeProvider=v$;r$.parseQueryString=k1;r$.parseUrl=R0;r$.toEndpointV1=t$});var d1=y((GT)=>{var H0=m(),q0=(h)=>{if(typeof h==="function")return h();return h},o0=(h,$,T,P,w)=>({name:$,namespace:h,traits:T,input:P,output:w}),TT=(h)=>($,T)=>async(P)=>{let{response:w}=await $(P),{operationSchema:I}=H0.getSmithyContext(T),[,A,U,_,f,Y]=I??[];try{let M=await h.protocol.deserializeResponse(o0(A,U,_,f,Y),{...h,...T},w);return{response:w,output:M}}catch(M){if(Object.defineProperty(M,"$response",{value:w,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in M)){try{M.message+=`
|
|
3
3
|
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`}catch(G){if(!T.logger||T.logger?.constructor?.name==="NoOpLogger")console.warn("Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.");else T.logger?.warn?.("Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.")}if(typeof M.$responseBodyText<"u"){if(M.$response)M.$response.body=M.$responseBodyText}try{if(H0.HttpResponse.isInstance(w)){let{headers:G={},statusCode:V}=w,Z=Object.entries(G);M.$metadata={httpStatusCode:V,requestId:i0(/^x-[\w-]+-request-?id$/,Z),extendedRequestId:i0(/^x-[\w-]+-id-2$/,Z),cfId:i0(/^x-[\w-]+-cf-id$/,Z)}}}catch(G){}}throw M}},i0=(h,$)=>{return($.find(([T])=>{return T.match(h)})||[void 0,void 0])[1]},PT=(h)=>($,T)=>async(P)=>{let{operationSchema:w}=H0.getSmithyContext(T),[,I,A,U,_,f]=w??[],Y=T.endpointV2?async()=>H0.toEndpointV1(T.endpointV2):h.endpoint,M=await h.protocol.serializeRequest(o0(I,A,U,_,f),P.input,{...h,...T,endpoint:Y});return $({...P,request:M})},p1={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},g1={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function wT(h){return{applyToStack:($)=>{$.add(PT(h),g1),$.add(TT(h),p1),h.protocol.setSerdeContext(h)}}}class E{name;namespace;traits;static assign(h,$){return Object.assign(h,$)}static[Symbol.hasInstance](h){let $=this.prototype.isPrototypeOf(h);if(!$&&typeof h==="object"&&h!==null)return h.symbol===this.symbol;return $}getName(){return this.namespace+"#"+this.name}}class x0 extends E{static symbol=Symbol.for("@smithy/lis");name;traits;valueSchema;symbol=x0.symbol}var IT=(h,$,T,P)=>E.assign(new x0,{name:$,namespace:h,traits:T,valueSchema:P});class W0 extends E{static symbol=Symbol.for("@smithy/map");name;traits;keySchema;valueSchema;symbol=W0.symbol}var AT=(h,$,T,P,w)=>E.assign(new W0,{name:$,namespace:h,traits:T,keySchema:P,valueSchema:w});class D0 extends E{static symbol=Symbol.for("@smithy/ope");name;traits;input;output;symbol=D0.symbol}var UT=(h,$,T,P,w)=>E.assign(new D0,{name:$,namespace:h,traits:T,input:P,output:w});class w0 extends E{static symbol=Symbol.for("@smithy/str");name;traits;memberNames;memberList;symbol=w0.symbol}var _T=(h,$,T,P,w)=>E.assign(new w0,{name:$,namespace:h,traits:T,memberNames:P,memberList:w});class L0 extends w0{static symbol=Symbol.for("@smithy/err");ctor;symbol=L0.symbol}var fT=(h,$,T,P,w,I)=>E.assign(new L0,{name:$,namespace:h,traits:T,memberNames:P,memberList:w,ctor:null}),O0=[];function P0(h){if(typeof h==="object")return h;if(h=h|0,O0[h])return O0[h];let $={},T=0;for(let P of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])if((h>>T++&1)===1)$[P]=1;return O0[h]=$}var $0={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},E0=[],N0={};class B{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=B.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(h,$){this.ref=h,this.memberName=$;let T=[],P=h,w=h;this._isMemberSchema=!1;while(l0(P))T.push(P[1]),P=P[0],w=q0(P),this._isMemberSchema=!0;if(T.length>0){this.memberTraits={};for(let I=T.length-1;I>=0;--I){let A=T[I];Object.assign(this.memberTraits,P0(A))}}else this.memberTraits=0;if(w instanceof B){let I=this.memberTraits;Object.assign(this,w),this.memberTraits=Object.assign({},I,w.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=$??w.memberName;return}if(this.schema=q0(w),m1(this.schema))this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3];else this.name=this.memberName??String(w),this.traits=0;if(this._isMemberSchema&&!$)throw Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](h){let $=this.prototype.isPrototypeOf(h);if(!$&&typeof h==="object"&&h!==null)return h.symbol===this.symbol;return $}static of(h){let $=typeof h==="function"||typeof h==="object"&&h!==null;if(typeof h==="number"){if(E0[h])return E0[h]}else if(typeof h==="string"){if(N0[h])return N0[h]}else if($){if(h[$0.ns])return h[$0.ns]}let T=q0(h);if(T instanceof B)return T;if(l0(T)){let[w,I]=T;if(w instanceof B)return Object.assign(w.getMergedTraits(),P0(I)),w;throw Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(h,null,2)}.`)}let P=new B(T);if($)return h[$0.ns]=P;if(typeof T==="string")return N0[T]=P;if(typeof T==="number")return E0[T]=P;return P}getSchema(){let h=this.schema;if(Array.isArray(h)&&h[0]===0)return h[4];return h}getName(h=!1){let{name:$}=this;return!h&&$&&$.includes("#")?$.split("#")[1]:$||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let h=this.getSchema();return typeof h==="number"?h>=64&&h<128:h[0]===1}isMapSchema(){let h=this.getSchema();return typeof h==="number"?h>=128&&h<=255:h[0]===2}isStructSchema(){let h=this.getSchema();if(typeof h!=="object")return!1;let $=h[0];return $===3||$===-3||$===4}isUnionSchema(){let h=this.getSchema();if(typeof h!=="object")return!1;return h[0]===4}isBlobSchema(){let h=this.getSchema();return h===21||h===42}isTimestampSchema(){let h=this.getSchema();return typeof h==="number"&&h>=4&&h<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:h}=this.getMergedTraits();return!!h||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return P0(this.memberTraits)}getOwnTraits(){return P0(this.traits)}getKeySchema(){let[h,$]=[this.isDocumentSchema(),this.isMapSchema()];if(!h&&!$)throw Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let T=this.getSchema(),P=h?15:T[4]??0;return T0([P,0],"key")}getValueSchema(){let h=this.getSchema(),[$,T,P]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],w=typeof h==="number"?63&h:h&&typeof h==="object"&&(T||P)?h[3+h[0]]:$?15:void 0;if(w!=null)return T0([w,0],T?"value":"member");throw Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(h){let $=this.getSchema();if(this.isStructSchema()&&$[4].includes(h)){let T=$[4].indexOf(h),P=$[5][T];return T0(l0(P)?P:[P,0],h)}if(this.isDocumentSchema())return T0([15,0],h);throw Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${h}.`)}getMemberSchemas(){let h={};try{for(let[$,T]of this.structIterator())h[$]=T}catch($){}return h}getEventStreamMember(){if(this.isStructSchema()){for(let[h,$]of this.structIterator())if($.isStreaming()&&$.isStructSchema())return h}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw Error("@smithy/core/schema - cannot iterate non-struct schema.");let h=this.getSchema(),$=h[4].length,T=h[$0.it];if(T&&$===T.length){yield*T;return}T=Array($);for(let P=0;P<$;++P){let w=h[4][P],I=T0([h[5][P],0],w);yield T[P]=[w,I]}h[$0.it]=T}}function T0(h,$){if(h instanceof B)return Object.assign(h,{memberName:$,_isMemberSchema:!0});return new B(h,$)}var l0=(h)=>Array.isArray(h)&&h.length===2,m1=(h)=>Array.isArray(h)&&h.length>=5;class I0 extends E{static symbol=Symbol.for("@smithy/sim");name;schemaRef;traits;symbol=I0.symbol}var MT=(h,$,T,P)=>E.assign(new I0,{name:$,namespace:h,traits:P,schemaRef:T}),YT=(h,$,T,P)=>E.assign(new I0,{name:$,namespace:h,traits:T,schemaRef:P}),XT={BLOB:21,STREAMING_BLOB:42,BOOLEAN:2,STRING:0,NUMERIC:1,BIG_INTEGER:17,BIG_DECIMAL:19,DOCUMENT:15,TIMESTAMP_DEFAULT:4,TIMESTAMP_DATE_TIME:5,TIMESTAMP_HTTP_DATE:6,TIMESTAMP_EPOCH_SECONDS:7,LIST_MODIFIER:64,MAP_MODIFIER:128};class K{namespace;schemas;exceptions;static registries=new Map;constructor(h,$=new Map,T=new Map){this.namespace=h,this.schemas=$,this.exceptions=T}static for(h){if(!K.registries.has(h))K.registries.set(h,new K(h));return K.registries.get(h)}copyFrom(h){let{schemas:$,exceptions:T}=this;for(let[P,w]of h.schemas)if(!$.has(P))$.set(P,w);for(let[P,w]of h.exceptions)if(!T.has(P))T.set(P,w)}register(h,$){let T=this.normalizeShapeId(h);for(let P of[this,K.for(T.split("#")[0])])P.schemas.set(T,$)}getSchema(h){let $=this.normalizeShapeId(h);if(!this.schemas.has($)){if(!h.includes("#")){let T="#"+h,P=[];for(let[w,I]of this.schemas.entries())if(w.endsWith(T))P.push(I);if(P.length===1)return P[0]}throw Error(`@smithy/core/schema - schema not found for ${$}`)}return this.schemas.get($)}registerError(h,$){let T=h,P=T[1];for(let w of[this,K.for(P)])w.schemas.set(P+"#"+T[2],T),w.exceptions.set(T,$)}getErrorCtor(h){let $=h;if(this.exceptions.has($))return this.exceptions.get($);return K.for($[1]).exceptions.get($)}getBaseException(){for(let h of this.exceptions.keys())if(Array.isArray(h)){let[,$,T]=h,P=$+"#"+T;if(P.startsWith("smithy.ts.sdk.synthetic.")&&P.endsWith("ServiceException"))return h}return}find(h){for(let $ of this.schemas.values())if(h($))return $;return}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(h){if(h.includes("#"))return h;return this.namespace+"#"+h}}GT.ErrorSchema=L0;GT.ListSchema=x0;GT.MapSchema=W0;GT.NormalizedSchema=B;GT.OperationSchema=D0;GT.SCHEMA=XT;GT.Schema=E;GT.SimpleSchema=I0;GT.StructureSchema=w0;GT.TypeRegistry=K;GT.deref=q0;GT.deserializerMiddlewareOption=p1;GT.error=fT;GT.getSchemaSerdePlugin=wT;GT.isStaticSchema=m1;GT.list=IT;GT.map=AT;GT.op=UT;GT.operation=o0;GT.serializerMiddlewareOption=g1;GT.sim=MT;GT.simAdapter=YT;GT.simpleSchemaCacheN=E0;GT.simpleSchemaCacheS=N0;GT.struct=_T;GT.traitsCache=O0;GT.translateTraits=P0});var $1=y((QP)=>{var u1=m(),A0=h0(),gT=d1(),k=(h,$)=>{let T=[];if(h)T.push(h);if($)for(let P of $)T.push(P);return T},j=(h,$)=>{return`${h||"anonymous"}${$&&$.length>0?` (a.k.a. ${$.join(",")})`:""}`},U0=()=>{let h=[],$=[],T=!1,P=new Set,w=(M)=>M.sort((X,G)=>v1[G.step]-v1[X.step]||t1[G.priority||"normal"]-t1[X.priority||"normal"]),I=(M)=>{let X=!1,G=(V)=>{let Z=k(V.name,V.aliases);if(Z.includes(M)){X=!0;for(let J of Z)P.delete(J);return!1}return!0};return h=h.filter(G),$=$.filter(G),X},A=(M)=>{let X=!1,G=(V)=>{if(V.middleware===M){X=!0;for(let Z of k(V.name,V.aliases))P.delete(Z);return!1}return!0};return h=h.filter(G),$=$.filter(G),X},U=(M)=>{return h.forEach((X)=>{M.add(X.middleware,{...X})}),$.forEach((X)=>{M.addRelativeTo(X.middleware,{...X})}),M.identifyOnResolve?.(Y.identifyOnResolve()),M},_=(M)=>{let X=[];return M.before.forEach((G)=>{if(G.before.length===0&&G.after.length===0)X.push(G);else X.push(..._(G))}),X.push(M),M.after.reverse().forEach((G)=>{if(G.before.length===0&&G.after.length===0)X.push(G);else X.push(..._(G))}),X},f=(M=!1)=>{let X=[],G=[],V={};return h.forEach((J)=>{let Q={...J,before:[],after:[]};for(let R of k(Q.name,Q.aliases))V[R]=Q;X.push(Q)}),$.forEach((J)=>{let Q={...J,before:[],after:[]};for(let R of k(Q.name,Q.aliases))V[R]=Q;G.push(Q)}),G.forEach((J)=>{if(J.toMiddleware){let Q=V[J.toMiddleware];if(Q===void 0){if(M)return;throw Error(`${J.toMiddleware} is not found when adding ${j(J.name,J.aliases)} middleware ${J.relation} ${J.toMiddleware}`)}if(J.relation==="after")Q.after.push(J);if(J.relation==="before")Q.before.push(J)}}),w(X).map(_).reduce((J,Q)=>{return J.push(...Q),J},[])},Y={add:(M,X={})=>{let{name:G,override:V,aliases:Z}=X,J={step:"initialize",priority:"normal",middleware:M,...X},Q=k(G,Z);if(Q.length>0){if(Q.some((R)=>P.has(R))){if(!V)throw Error(`Duplicate middleware name '${j(G,Z)}'`);for(let R of Q){let H=h.findIndex((a)=>a.name===R||a.aliases?.some((m0)=>m0===R));if(H===-1)continue;let N=h[H];if(N.step!==J.step||J.priority!==N.priority)throw Error(`"${j(N.name,N.aliases)}" middleware with ${N.priority} priority in ${N.step} step cannot be overridden by "${j(G,Z)}" middleware with ${J.priority} priority in ${J.step} step.`);h.splice(H,1)}}for(let R of Q)P.add(R)}h.push(J)},addRelativeTo:(M,X)=>{let{name:G,override:V,aliases:Z}=X,J={middleware:M,...X},Q=k(G,Z);if(Q.length>0){if(Q.some((R)=>P.has(R))){if(!V)throw Error(`Duplicate middleware name '${j(G,Z)}'`);for(let R of Q){let H=$.findIndex((a)=>a.name===R||a.aliases?.some((m0)=>m0===R));if(H===-1)continue;let N=$[H];if(N.toMiddleware!==J.toMiddleware||N.relation!==J.relation)throw Error(`"${j(N.name,N.aliases)}" middleware ${N.relation} "${N.toMiddleware}" middleware cannot be overridden by "${j(G,Z)}" middleware ${J.relation} "${J.toMiddleware}" middleware.`);$.splice(H,1)}}for(let R of Q)P.add(R)}$.push(J)},clone:()=>U(U0()),use:(M)=>{M.applyToStack(Y)},remove:(M)=>{if(typeof M==="string")return I(M);else return A(M)},removeByTag:(M)=>{let X=!1,G=(V)=>{let{tags:Z,name:J,aliases:Q}=V;if(Z&&Z.includes(M)){let R=k(J,Q);for(let H of R)P.delete(H);return X=!0,!1}return!0};return h=h.filter(G),$=$.filter(G),X},concat:(M)=>{let X=U(U0());return X.use(M),X.identifyOnResolve(T||X.identifyOnResolve()||(M.identifyOnResolve?.()??!1)),X},applyToStack:U,identify:()=>{return f(!0).map((M)=>{let X=M.step??M.relation+" "+M.toMiddleware;return j(M.name,M.aliases)+" - "+X})},identifyOnResolve(M){if(typeof M==="boolean")T=M;return T},resolve:(M,X)=>{for(let G of f().map((V)=>V.middleware).reverse())M=G(M,X);if(T)console.log(Y.identify());return M}};return Y},v1={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},t1={high:3,normal:2,low:1},mT=(h)=>()=>{throw Error(h)},dT=(h)=>()=>Promise.reject(h),K0=()=>{let h=new WeakSet;return($,T)=>{if(typeof T==="object"&&T!==null){if(h.has(T))return"[Circular]";h.add(T)}return T}},vT=(h)=>{return new Promise(($)=>setTimeout($,h*1000))},i1={minDelay:2,maxDelay:120};QP.WaiterState=void 0;(function(h){h.ABORTED="ABORTED",h.FAILURE="FAILURE",h.SUCCESS="SUCCESS",h.RETRY="RETRY",h.TIMEOUT="TIMEOUT"})(QP.WaiterState||(QP.WaiterState={}));var tT=(h)=>{if(h.state===QP.WaiterState.ABORTED){let $=Error(`${JSON.stringify({...h,reason:"Request was aborted"},K0())}`);throw $.name="AbortError",$}else if(h.state===QP.WaiterState.TIMEOUT){let $=Error(`${JSON.stringify({...h,reason:"Waiter has timed out"},K0())}`);throw $.name="TimeoutError",$}else if(h.state!==QP.WaiterState.SUCCESS)throw Error(`${JSON.stringify(h,K0())}`);return h},rT=async({minDelay:h,maxDelay:$,maxWaitTime:T,abortController:P,client:w,abortSignal:I},A,U)=>{let _={},[f,Y]=[h*1000,$*1000],M=0,X=Date.now()+T*1000,G=Date.now()+60000,V=!1;while(!0){if(M>0){let Q=iT(f,Y,M,X);if(P?.signal?.aborted||I?.aborted)return _["AbortController signal aborted."]|=0,_["AbortController signal aborted."]+=1,{state:QP.WaiterState.ABORTED,observedResponses:_};if(Date.now()+Q>X)return{state:QP.WaiterState.TIMEOUT,observedResponses:_};await vT(Q/1000)}let{state:Z,reason:J}=await U(w,A);if(J){let Q=uT(J);_[Q]|=0,_[Q]+=1}if(Z!==QP.WaiterState.RETRY)return{state:Z,reason:J,final:J,observedResponses:_};if(M+=1,!V&&Date.now()>=G)nT(_,w),V=!0}},nT=(h={},$)=>{let T=Object.keys(h),P=0;for(let A of T){let U=h[A]|0;if(A.startsWith("403:"))P+=U}let w=$?.config?.logger,I=typeof w?.warn==="function"&&!w.constructor?.name?.includes?.("NoOpLogger")?w:console;if(P>=3||T[T.length-1]?.startsWith("403:"))I.warn("@smithy/util-waiter WARN - 403 status code encountered during waiter polling.")},uT=(h)=>{let $=h?.$response?.statusCode??h?.$metadata?.httpStatusCode;if(h?.$responseBodyText)return`${$?$+": ":""}Deserialization error for body: ${h.$responseBodyText}`;if($){if(h?.$response||h?.message)return`${$??"Unknown"}: ${h?.message}`;return`${$}: OK`}return String(h?.message??JSON.stringify(h,K0())??"Unknown")},iT=(h,$,T,P)=>{let w=Math.log($/h)/Math.log(2)+1;if(T>w)return $;let I=h*2**(T-1),A=Math.min(I,$),U=lT(h,A);if(Date.now()+U>P){let _=P-Date.now();return Math.max(0,_-500)}return U},lT=(h,$)=>h+Math.random()*($-h),oT=(h)=>{if(h.maxWaitTime<=0)throw Error("WaiterConfiguration.maxWaitTime must be greater than 0");else if(h.minDelay<=0)throw Error("WaiterConfiguration.minDelay must be greater than 0");else if(h.maxDelay<=0)throw Error("WaiterConfiguration.maxDelay must be greater than 0");else if(h.maxWaitTime<=h.minDelay)throw Error(`WaiterConfiguration.maxWaitTime [${h.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${h.minDelay}] for this waiter`);else if(h.maxDelay<h.minDelay)throw Error(`WaiterConfiguration.maxDelay [${h.maxDelay}] must be greater than WaiterConfiguration.minDelay [${h.minDelay}] for this waiter`)},r1=(h)=>{let $,T=new Promise((P)=>{if($=()=>P({state:QP.WaiterState.ABORTED}),typeof h.addEventListener==="function")h.addEventListener("abort",$);else h.onabort=$});return{clearListener(){if(typeof h.removeEventListener==="function")h.removeEventListener("abort",$)},aborted:T}},aT=async(h,$,T)=>{let P={...i1,...h};oT(P);let w=[rT(P,$,T)],I=[];if(h.abortSignal){let{aborted:A,clearListener:U}=r1(h.abortSignal);I.push(U),w.push(A)}if(h.abortController?.signal){let{aborted:A,clearListener:U}=r1(h.abortController.signal);I.push(U),w.push(A)}return Promise.race(w).then((A)=>{for(let U of I)U();return A})};class l1{config;middlewareStack=U0();initConfig;handlers;constructor(h){this.config=h;let{protocol:$,protocolSettings:T}=h;if(T){if(typeof $==="function")h.protocol=new $(T)}}send(h,$,T){let P=typeof $!=="function"?$:void 0,w=typeof $==="function"?$:T,I=P===void 0&&this.config.cacheMiddleware===!0,A;if(I){if(!this.handlers)this.handlers=new WeakMap;let U=this.handlers;if(U.has(h.constructor))A=U.get(h.constructor);else A=h.resolveMiddleware(this.middlewareStack,this.config,P),U.set(h.constructor,A)}else delete this.handlers,A=h.resolveMiddleware(this.middlewareStack,this.config,P);if(w)A(h).then((U)=>w(null,U.output),(U)=>w(U)).catch(()=>{});else return A(h).then((U)=>U.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}var a0="***SensitiveInformation***";function B0(h,$){if($==null)return $;let T=gT.NormalizedSchema.of(h);if(T.getMergedTraits().sensitive)return a0;if(T.isListSchema()){if(!!T.getValueSchema().getMergedTraits().sensitive)return a0}else if(T.isMapSchema()){if(!!T.getKeySchema().getMergedTraits().sensitive||!!T.getValueSchema().getMergedTraits().sensitive)return a0}else if(T.isStructSchema()&&typeof $==="object"){let P=$,w={};for(let[I,A]of T.structIterator())if(P[I]!=null)w[I]=B0(A,P[I]);return w}return $}class h1{middlewareStack=U0();schema;static classBuilder(){return new o1}resolveMiddlewareWithContext(h,$,T,{middlewareFn:P,clientName:w,commandName:I,inputFilterSensitiveLog:A,outputFilterSensitiveLog:U,smithyContext:_,additionalContext:f,CommandCtor:Y}){for(let J of P.bind(this)(Y,h,$,T))this.middlewareStack.use(J);let M=h.concat(this.middlewareStack),{logger:X}=$,G={logger:X,clientName:w,commandName:I,inputFilterSensitiveLog:A,outputFilterSensitiveLog:U,[A0.SMITHY_CONTEXT_KEY]:{commandInstance:this,..._},...f},{requestHandler:V}=$,Z=T??{};if(_.eventStream)Z={isEventStream:!0,...Z};return M.resolve((J)=>V.handle(J.request,Z),G)}}class o1{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(h){this._init=h}ep(h){return this._ep=h,this}m(h){return this._middlewareFn=h,this}s(h,$,T={}){return this._smithyContext={service:h,operation:$,...T},this}c(h={}){return this._additionalContext=h,this}n(h,$){return this._clientName=h,this._commandName=$,this}f(h=(T)=>T,$=(T)=>T){return this._inputFilterSensitiveLog=h,this._outputFilterSensitiveLog=$,this}ser(h){return this._serializer=h,this}de(h){return this._deserializer=h,this}sc(h){return this._operationSchema=h,this._smithyContext.operationSchema=h,this}build(){let h=this,$;return $=class extends h1{input;static getEndpointParameterInstructions(){return h._ep}constructor(...[T]){super();this.input=T??{},h._init(this),this.schema=h._operationSchema}resolveMiddleware(T,P,w){let I=h._operationSchema,A=I?.[4]??I?.input,U=I?.[5]??I?.output;return this.resolveMiddlewareWithContext(T,P,w,{CommandCtor:$,middlewareFn:h._middlewareFn,clientName:h._clientName,commandName:h._commandName,inputFilterSensitiveLog:h._inputFilterSensitiveLog??(I?B0.bind(null,A):(_)=>_),outputFilterSensitiveLog:h._outputFilterSensitiveLog??(I?B0.bind(null,U):(_)=>_),smithyContext:h._smithyContext,additionalContext:h._additionalContext})}serialize=h._serializer;deserialize=h._deserializer}}}var eT="***SensitiveInformation***",hP=(h,$,T)=>{for(let[I,A]of Object.entries(h)){let U=async function(f,Y,M){let X=new A(f);if(typeof Y==="function")this.send(X,Y);else if(typeof M==="function"){if(typeof Y!=="object")throw Error(`Expected http options but got ${typeof Y}`);this.send(X,Y||{},M)}else return this.send(X,Y)},_=(I[0].toLowerCase()+I.slice(1)).replace(/Command$/,"");$.prototype[_]=U}let{paginators:P={},waiters:w={}}=T??{};for(let[I,A]of Object.entries(P))if($.prototype[I]===void 0)$.prototype[I]=function(U={},_,...f){return A({..._,client:this},U,...f)};for(let[I,A]of Object.entries(w))if($.prototype[I]===void 0)$.prototype[I]=async function(U={},_,...f){let Y=_;if(typeof _==="number")Y={maxWaitTime:_};return A({...Y,client:this},U,...f)}};class d extends Error{$fault;$response;$retryable;$metadata;constructor(h){super(h.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=h.name,this.$fault=h.$fault,this.$metadata=h.$metadata}static isInstance(h){if(!h)return!1;let $=h;return d.prototype.isPrototypeOf($)||Boolean($.$fault)&&Boolean($.$metadata)&&($.$fault==="client"||$.$fault==="server")}static[Symbol.hasInstance](h){if(!h)return!1;let $=h;if(this===d)return d.isInstance(h);if(d.isInstance(h)){if($.name&&this.name)return this.prototype.isPrototypeOf(h)||$.name===this.name;return this.prototype.isPrototypeOf(h)}return!1}}var a1=(h,$={})=>{Object.entries($).filter(([,P])=>P!==void 0).forEach(([P,w])=>{if(h[P]==null||h[P]==="")h[P]=w});let T=h.message||h.Message||"UnknownError";return h.message=T,delete h.Message,h},e1=({output:h,parsedBody:$,exceptionCtor:T,errorCode:P})=>{let w=TP(h),I=w.httpStatusCode?w.httpStatusCode+"":void 0,A=new T({name:$?.code||$?.Code||P||I||"UnknownError",$fault:"client",$metadata:w});throw a1(A,$)},$P=(h)=>{return({output:$,parsedBody:T,errorCode:P})=>{e1({output:$,parsedBody:T,exceptionCtor:h,errorCode:P})}},TP=(h)=>({httpStatusCode:h.statusCode,requestId:h.headers["x-amzn-requestid"]??h.headers["x-amzn-request-id"]??h.headers["x-amz-request-id"],extendedRequestId:h.headers["x-amz-id-2"],cfId:h.headers["x-amz-cf-id"]}),PP=(h)=>{switch(h){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:30000};default:return{}}},n1=!1,wP=(h)=>{if(h&&!n1&&parseInt(h.substring(1,h.indexOf(".")))<16)n1=!0},hh=Object.values(A0.AlgorithmId),$h=(h)=>{let $=[];for(let T in A0.AlgorithmId){let P=A0.AlgorithmId[T];if(h[P]===void 0)continue;$.push({algorithmId:()=>P,checksumConstructor:()=>h[P]})}for(let[T,P]of Object.entries(h.checksumAlgorithms??{}))$.push({algorithmId:()=>T,checksumConstructor:()=>P});return{addChecksumAlgorithm(T){h.checksumAlgorithms=h.checksumAlgorithms??{};let P=T.algorithmId(),w=T.checksumConstructor();if(hh.includes(P))h.checksumAlgorithms[P.toUpperCase()]=w;else h.checksumAlgorithms[P]=w;$.push(T)},checksumAlgorithms(){return $}}},Th=(h)=>{let $={};return h.checksumAlgorithms().forEach((T)=>{let P=T.algorithmId();if(hh.includes(P))$[P]=T.checksumConstructor()}),$},Ph=(h)=>{return{setRetryStrategy($){h.retryStrategy=$},retryStrategy(){return h.retryStrategy}}},wh=(h)=>{let $={};return $.retryStrategy=h.retryStrategy(),$},Ih=(h)=>{return Object.assign($h(h),Ph(h))},IP=Ih,AP=(h)=>{return Object.assign(Th(h),wh(h))},UP=(h)=>Array.isArray(h)?h:[h],Ah=(h)=>{for(let T in h)if(h.hasOwnProperty(T)&&h[T]["#text"]!==void 0)h[T]=h[T]["#text"];else if(typeof h[T]==="object"&&h[T]!==null)h[T]=Ah(h[T]);return h},_P=(h)=>{return h!=null};class Uh{trace(){}debug(){}info(){}warn(){}error(){}}function _h(h,$,T){let P,w,I;if(typeof $>"u"&&typeof T>"u")P={},I=h;else if(P=h,typeof $==="function")return w=$,I=T,YP(P,w,I);else I=$;for(let A of Object.keys(I)){if(!Array.isArray(I[A])){P[A]=I[A];continue}fh(P,null,I,A)}return P}var fP=(h)=>{let $={};for(let[T,P]of Object.entries(h||{}))$[T]=[,P];return $},MP=(h,$)=>{let T={};for(let P in $)fh(T,h,$,P);return T},YP=(h,$,T)=>{return _h(h,Object.entries(T).reduce((P,[w,I])=>{if(Array.isArray(I))P[w]=I;else if(typeof I==="function")P[w]=[$,I()];else P[w]=[$,I];return P},{}))},fh=(h,$,T,P)=>{if($!==null){let A=T[P];if(typeof A==="function")A=[,A];let[U=XP,_=GP,f=P]=A;if(typeof U==="function"&&U($[f])||typeof U!=="function"&&!!U)h[P]=_($[f]);return}let[w,I]=T[P];if(typeof I==="function"){let A,U=w===void 0&&(A=I())!=null,_=typeof w==="function"&&!!w(void 0)||typeof w!=="function"&&!!w;if(U)h[P]=A;else if(_)h[P]=I()}else{let A=w===void 0&&I!=null,U=typeof w==="function"&&!!w(I)||typeof w!=="function"&&!!w;if(A||U)h[P]=I}},XP=(h)=>h!=null,GP=(h)=>h,JP=(h)=>{if(h!==h)return"NaN";switch(h){case 1/0:return"Infinity";case-1/0:return"-Infinity";default:return h}},VP=(h)=>h.toISOString().replace(".000Z","Z"),e0=(h)=>{if(h==null)return{};if(Array.isArray(h))return h.filter(($)=>$!=null).map(e0);if(typeof h==="object"){let $={};for(let T of Object.keys(h)){if(h[T]==null)continue;$[T]=e0(h[T])}return $}return h};QP.getSmithyContext=u1.getSmithyContext;QP.normalizeProvider=u1.normalizeProvider;QP.AlgorithmId=A0.AlgorithmId;QP.Client=l1;QP.Command=h1;QP.NoOpLogger=Uh;QP.SENSITIVE_STRING=eT;QP.ServiceException=d;QP._json=e0;QP.checkExceptions=tT;QP.constructStack=U0;QP.convertMap=fP;QP.createAggregatedClient=hP;QP.createWaiter=aT;QP.decorateServiceException=a1;QP.emitWarningIfUnsupportedVersion=wP;QP.getArrayIfSingleItem=UP;QP.getChecksumConfiguration=$h;QP.getDefaultClientConfiguration=IP;QP.getDefaultExtensionConfiguration=Ih;QP.getRetryConfiguration=Ph;QP.getValueFromTextNode=Ah;QP.invalidFunction=mT;QP.invalidProvider=dT;QP.isSerializableHeaderValue=_P;QP.loadConfigsForDefaultMode=PP;QP.map=_h;QP.resolveChecksumRuntimeConfig=Th;QP.resolveDefaultRuntimeConfig=AP;QP.resolveRetryRuntimeConfig=wh;QP.schemaLogFilter=B0;QP.serializeDateTime=VP;QP.serializeFloat=JP;QP.take=MP;QP.throwDefaultError=e1;QP.waiterServiceDefaults=i1;QP.withBaseException=$P});var Bh=y((lw)=>{var hw=C("os"),v=C("path"),$w=C("crypto"),Vh=C("fs/promises"),z0=h0(),F0=$1(),Tw=m();class t extends Error{name="ProviderError";tryNextLink;constructor(h,$=!0){let T,P=!0;if(typeof $==="boolean")T=void 0,P=$;else if($!=null&&typeof $==="object")T=$.logger,P=$.tryNextLink??!0;super(h);this.tryNextLink=P,Object.setPrototypeOf(this,t.prototype),T?.debug?.(`@smithy/property-provider ${P?"->":"(!)"} ${h}`)}static from(h,$=!0){return Object.assign(new this(h.message,$),h)}}class _0 extends t{name="CredentialsProviderError";constructor(h,$=!0){super(h,$);Object.setPrototypeOf(this,_0.prototype)}}class A1 extends t{name="TokenProviderError";constructor(h,$=!0){super(h,$);Object.setPrototypeOf(this,A1.prototype)}}var Qh=(...h)=>async()=>{if(h.length===0)throw new t("No providers in chain");let $;for(let T of h)try{return await T()}catch(P){if($=P,P?.tryNextLink)continue;throw P}throw $},Zh=(h)=>()=>Promise.resolve(h),U1=(h,$,T)=>{let P,w,I,A=!1,U=async()=>{if(!w)w=h();try{P=await w,I=!0,A=!1}finally{w=void 0}return P};if($===void 0)return async(_)=>{if(!I||_?.forceRefresh)P=await U();return P};return async(_)=>{if(!I||_?.forceRefresh)P=await U();if(A)return P;if(T&&!T(P))return A=!0,P;if($(P))return await U(),P;return P}},z=(h,$,T)=>{if(!($ in h))return;if(h[$]==="true")return!0;if(h[$]==="false")return!1;throw Error(`Cannot load ${T} "${$}". Expected "true" or "false", got ${h[$]}.`)},Pw=(h,$,T)=>{if(!($ in h))return;let P=parseInt(h[$],10);if(Number.isNaN(P))throw TypeError(`Cannot load ${T} '${$}'. Expected number, got '${h[$]}'.`);return P};lw.SelectorType=void 0;(function(h){h.ENV="env",h.CONFIG="shared config entry"})(lw.SelectorType||(lw.SelectorType={}));var T1={},ww=()=>{if(process&&process.geteuid)return`${process.geteuid()}`;return"DEFAULT"},f0=()=>{let{HOME:h,USERPROFILE:$,HOMEPATH:T,HOMEDRIVE:P=`C:${v.sep}`}=process.env;if(h)return h;if($)return $;if(T)return`${P}${T}`;let w=ww();if(!T1[w])T1[w]=hw.homedir();return T1[w]},Rh="AWS_PROFILE",qh="default",Oh=(h)=>h.profile||process.env[Rh]||qh,Eh=(h)=>{let T=$w.createHash("sha1").update(h).digest("hex");return v.join(f0(),".aws","sso","cache",`${T}.json`)},s0={},Iw=async(h)=>{if(s0[h])return s0[h];let $=Eh(h),T=await Vh.readFile($,"utf8");return JSON.parse(T)},p=".",Aw=(h)=>Object.entries(h).filter(([$])=>{let T=$.indexOf(p);if(T===-1)return!1;return Object.values(z0.IniSectionType).includes($.substring(0,T))}).reduce(($,[T,P])=>{let w=T.indexOf(p),I=T.substring(0,w)===z0.IniSectionType.PROFILE?T.substring(w+1):T;return $[I]=P,$},{...h.default&&{default:h.default}}),Uw="AWS_CONFIG_FILE",Nh=()=>process.env[Uw]||v.join(f0(),".aws","config"),_w="AWS_SHARED_CREDENTIALS_FILE",fw=()=>process.env[_w]||v.join(f0(),".aws","credentials"),Mw=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,Yw=["__proto__","profile __proto__"],w1=(h)=>{let $={},T,P;for(let w of h.split(/\r?\n/)){let I=w.split(/(^|\s)[;#]/)[0].trim();if(I[0]==="["&&I[I.length-1]==="]"){T=void 0,P=void 0;let U=I.substring(1,I.length-1),_=Mw.exec(U);if(_){let[,f,,Y]=_;if(Object.values(z0.IniSectionType).includes(f))T=[f,Y].join(p)}else T=U;if(Yw.includes(U))throw Error(`Found invalid profile name "${U}"`)}else if(T){let U=I.indexOf("=");if(![0,-1].includes(U)){let[_,f]=[I.substring(0,U).trim(),I.substring(U+1).trim()];if(f==="")P=_;else{if(P&&w.trimStart()===w)P=void 0;$[T]=$[T]||{};let Y=P?[P,_].join(p):_;$[T][Y]=f}}}}return $},P1={},S0={},j0=(h,$)=>{if(S0[h]!==void 0)return S0[h];if(!P1[h]||$?.ignoreCache)P1[h]=Vh.readFile(h,"utf8");return P1[h]},Mh=()=>({}),_1=async(h={})=>{let{filepath:$=fw(),configFilepath:T=Nh()}=h,P=f0(),w="~/",I=$;if($.startsWith("~/"))I=v.join(P,$.slice(2));let A=T;if(T.startsWith("~/"))A=v.join(P,T.slice(2));let U=await Promise.all([j0(A,{ignoreCache:h.ignoreCache}).then(w1).then(Aw).catch(Mh),j0(I,{ignoreCache:h.ignoreCache}).then(w1).catch(Mh)]);return{configFile:U[0],credentialsFile:U[1]}},Xw=(h)=>Object.entries(h).filter(([$])=>$.startsWith(z0.IniSectionType.SSO_SESSION+p)).reduce(($,[T,P])=>({...$,[T.substring(T.indexOf(p)+1)]:P}),{}),Gw=()=>({}),Jw=async(h={})=>j0(h.configFilepath??Nh()).then(w1).then(Xw).catch(Gw),Vw=(...h)=>{let $={};for(let T of h)for(let[P,w]of Object.entries(T))if($[P]!==void 0)Object.assign($[P],w);else $[P]=w;return $},Qw=async(h)=>{let $=await _1(h);return Vw($.configFile,$.credentialsFile)},Zw={getFileRecord(){return S0},interceptFile(h,$){S0[h]=Promise.resolve($)},getTokenRecord(){return s0},interceptToken(h,$){s0[h]=$}};function Hh(h){try{let $=new Set(Array.from(h.match(/([A-Z_]){3,}/g)??[]));return $.delete("CONFIG"),$.delete("CONFIG_PREFIX_SEPARATOR"),$.delete("ENV"),[...$].join(", ")}catch($){return h}}var Rw=(h,$)=>async()=>{try{let T=h(process.env,$);if(T===void 0)throw Error();return T}catch(T){throw new _0(T.message||`Not found in ENV: ${Hh(h.toString())}`,{logger:$?.logger})}},qw=(h,{preferredFile:$="config",...T}={})=>async()=>{let P=Oh(T),{configFile:w,credentialsFile:I}=await _1(T),A=I[P]||{},U=w[P]||{},_=$==="config"?{...A,...U}:{...U,...A};try{let Y=h(_,$==="config"?w:I);if(Y===void 0)throw Error();return Y}catch(f){throw new _0(f.message||`Not found in config files w/ profile [${P}]: ${Hh(h.toString())}`,{logger:T.logger})}},Ow=(h)=>typeof h==="function",xh=(h)=>Ow(h)?async()=>await h():Zh(h),I1=({environmentVariableSelector:h,configFileSelector:$,default:T},P={})=>{let{signingName:w,logger:I}=P;return U1(Qh(Rw(h,{signingName:w,logger:I}),qw($,P),xh(T)))},f1="AWS_USE_DUALSTACK_ENDPOINT",M1="use_dualstack_endpoint",Ew=!1,Nw={environmentVariableSelector:(h)=>z(h,f1,lw.SelectorType.ENV),configFileSelector:(h)=>z(h,M1,lw.SelectorType.CONFIG),default:!1},Hw={environmentVariableSelector:(h)=>z(h,f1,lw.SelectorType.ENV),configFileSelector:(h)=>z(h,M1,lw.SelectorType.CONFIG),default:void 0},Y1="AWS_USE_FIPS_ENDPOINT",X1="use_fips_endpoint",xw=!1,Ww={environmentVariableSelector:(h)=>z(h,Y1,lw.SelectorType.ENV),configFileSelector:(h)=>z(h,X1,lw.SelectorType.CONFIG),default:!1},Dw={environmentVariableSelector:(h)=>z(h,Y1,lw.SelectorType.ENV),configFileSelector:(h)=>z(h,X1,lw.SelectorType.CONFIG),default:void 0},Lw=(h)=>{let{tls:$,endpoint:T,urlParser:P,useDualstackEndpoint:w}=h;return Object.assign(h,{tls:$??!0,endpoint:F0.normalizeProvider(typeof T==="string"?P(T):T),isCustomEndpoint:!0,useDualstackEndpoint:F0.normalizeProvider(w??!1)})},Kw=async(h)=>{let{tls:$=!0}=h,T=await h.region();if(!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(T))throw Error("Invalid region in client config");let w=await h.useDualstackEndpoint(),I=await h.useFipsEndpoint(),{hostname:A}=await h.regionInfoProvider(T,{useDualstackEndpoint:w,useFipsEndpoint:I})??{};if(!A)throw Error("Cannot resolve hostname from client config");return h.urlParser(`${$?"https:":"http:"}//${A}`)},Bw=(h)=>{let $=F0.normalizeProvider(h.useDualstackEndpoint??!1),{endpoint:T,useFipsEndpoint:P,urlParser:w,tls:I}=h;return Object.assign(h,{tls:I??!0,endpoint:T?F0.normalizeProvider(typeof T==="string"?w(T):T):()=>Kw({...h,useDualstackEndpoint:$,useFipsEndpoint:P}),isCustomEndpoint:!!T,useDualstackEndpoint:$})},Wh="AWS_REGION",Dh="region",Lh={environmentVariableSelector:(h)=>h[Wh],configFileSelector:(h)=>h[Dh],default:()=>{throw Error("Region is missing")}},zw={preferredFile:"credentials"},Yh=new Set,Fw=(h,$=Tw.isValidHostLabel)=>{if(!Yh.has(h)&&!$(h))if(h==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw Error(`Region not accepted: region="${h}" is not a valid hostname component.`);else Yh.add(h)},Kh=(h)=>typeof h==="string"&&(h.startsWith("fips-")||h.endsWith("-fips")),sw=(h)=>Kh(h)?["fips-aws-global","aws-fips"].includes(h)?"us-east-1":h.replace(/fips-(dkr-|prod-)?|-fips/,""):h,Sw=(h)=>{let{region:$,useFipsEndpoint:T}=h;if(!$)throw Error("Region is missing");return Object.assign(h,{region:async()=>{let P=typeof $==="function"?await $():$,w=sw(P);return Fw(w),w},useFipsEndpoint:async()=>{let P=typeof $==="string"?$:await $();if(Kh(P))return!0;return typeof T!=="function"?Promise.resolve(!!T):T()}})},Xh=(h=[],{useFipsEndpoint:$,useDualstackEndpoint:T})=>h.find(({tags:P})=>$===P.includes("fips")&&T===P.includes("dualstack"))?.hostname,jw=(h,{regionHostname:$,partitionHostname:T})=>$?$:T?T.replace("{region}",h):void 0,Cw=(h,{partitionHash:$})=>Object.keys($||{}).find((T)=>$[T].regions.includes(h))??"aws",cw=(h,{signingRegion:$,regionRegex:T,useFipsEndpoint:P})=>{if($)return $;else if(P){let w=T.replace("\\\\","\\").replace(/^\^/g,"\\.").replace(/\$$/g,"\\."),I=h.match(w);if(I)return I[0].slice(1,-1)}},bw=(h,{useFipsEndpoint:$=!1,useDualstackEndpoint:T=!1,signingService:P,regionHash:w,partitionHash:I})=>{let A=Cw(h,{partitionHash:I}),U=h in w?h:I[A]?.endpoint??h,_={useFipsEndpoint:$,useDualstackEndpoint:T},f=Xh(w[U]?.variants,_),Y=Xh(I[A]?.variants,_),M=jw(U,{regionHostname:f,partitionHostname:Y});if(M===void 0)throw Error(`Endpoint resolution failed for: ${{resolvedRegion:U,useFipsEndpoint:$,useDualstackEndpoint:T}}`);let X=cw(M,{signingRegion:w[U]?.signingRegion,regionRegex:I[A].regionRegex,useFipsEndpoint:$});return{partition:A,signingService:P,hostname:M,...X&&{signingRegion:X},...w[U]?.signingService&&{signingService:w[U].signingService}}},yw="AWS_EXECUTION_ENV",Gh="AWS_REGION",Jh="AWS_DEFAULT_REGION",kw="AWS_EC2_METADATA_DISABLED",pw=["in-region","cross-region","mobile","standard","legacy"],gw="/latest/meta-data/placement/region",mw="AWS_DEFAULTS_MODE",dw="defaults_mode",vw={environmentVariableSelector:(h)=>{return h[mw]},configFileSelector:(h)=>{return h[dw]},default:"legacy"},tw=({region:h=I1(Lh),defaultsMode:$=I1(vw)}={})=>U1(async()=>{let T=typeof $==="function"?await $():$;switch(T?.toLowerCase()){case"auto":return rw(h);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(T?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw Error(`Invalid parameter for "defaultsMode", expect ${pw.join(", ")}, got ${T}`)}}),rw=async(h)=>{if(h){let $=typeof h==="function"?await h():h,T=await nw();if(!T)return"standard";if($===T)return"in-region";else return"cross-region"}return"standard"},nw=async()=>{if(process.env[yw]&&(process.env[Gh]||process.env[Jh]))return process.env[Gh]??process.env[Jh];if(!process.env[kw])try{let h=await uw();return(await iw({hostname:h.hostname,path:gw})).toString()}catch(h){}},uw=async()=>{let h=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(h){let T=new URL(h);return{hostname:T.hostname,path:T.pathname}}if(process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6")return{hostname:"fd00:ec2::254",path:"/"};return{hostname:"169.254.169.254",path:"/"}},iw=async({hostname:h,path:$})=>{let{request:T}=await import("http");return new Promise((P,w)=>{let I=T({method:"GET",hostname:h.replace(/^\[(.+)]$/,"$1"),path:$,timeout:1000,signal:AbortSignal.timeout(1000)});I.on("error",(A)=>{w(A),I.destroy()}),I.on("timeout",()=>{w(Error("TimeoutError from instance metadata service")),I.destroy()}),I.on("response",(A)=>{let{statusCode:U=400}=A;if(U<200||300<=U){w(Object.assign(Error("Error response received from instance metadata service"),{statusCode:U})),I.destroy();return}let _=[];A.on("data",(f)=>_.push(f)),A.on("end",()=>{P(Buffer.concat(_)),I.destroy()})}),I.end()})};lw.CONFIG_PREFIX_SEPARATOR=p;lw.CONFIG_USE_DUALSTACK_ENDPOINT=M1;lw.CONFIG_USE_FIPS_ENDPOINT=X1;lw.CredentialsProviderError=_0;lw.DEFAULT_PROFILE=qh;lw.DEFAULT_USE_DUALSTACK_ENDPOINT=Ew;lw.DEFAULT_USE_FIPS_ENDPOINT=xw;lw.ENV_PROFILE=Rh;lw.ENV_USE_DUALSTACK_ENDPOINT=f1;lw.ENV_USE_FIPS_ENDPOINT=Y1;lw.NODE_REGION_CONFIG_FILE_OPTIONS=zw;lw.NODE_REGION_CONFIG_OPTIONS=Lh;lw.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS=Nw;lw.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS=Ww;lw.ProviderError=t;lw.REGION_ENV_NAME=Wh;lw.REGION_INI_NAME=Dh;lw.TokenProviderError=A1;lw.booleanSelector=z;lw.chain=Qh;lw.externalDataInterceptor=Zw;lw.fromStatic=xh;lw.fromValue=Zh;lw.getHomeDir=f0;lw.getProfileName=Oh;lw.getRegionInfo=bw;lw.getSSOTokenFilepath=Eh;lw.getSSOTokenFromFile=Iw;lw.loadConfig=I1;lw.loadSharedConfigFiles=_1;lw.loadSsoSessionData=Jw;lw.memoize=U1;lw.nodeDualstackConfigSelectors=Hw;lw.nodeFipsConfigSelectors=Dw;lw.numberSelector=Pw;lw.parseKnownFiles=Qw;lw.readFile=j0;lw.resolveCustomEndpointsConfig=Lw;lw.resolveDefaultsModeConfig=tw;lw.resolveEndpointsConfig=Bw;lw.resolveRegionConfig=Sw});var lh=y((EA)=>{var V1=Bh(),F=m(),yI=$1(),Q1=h0(),zh="AWS_ENDPOINT_URL",Fh="endpoint_url",kI=(h)=>({environmentVariableSelector:($)=>{let T=h.split(" ").map((I)=>I.toUpperCase()),P=$[[zh,...T].join("_")];if(P)return P;let w=$[zh];if(w)return w;return},configFileSelector:($,T)=>{if(T&&$.services){let w=T[["services",$.services].join(V1.CONFIG_PREFIX_SEPARATOR)];if(w){let I=h.split(" ").map((U)=>U.toLowerCase()),A=w[[I.join("_"),Fh].join(V1.CONFIG_PREFIX_SEPARATOR)];if(A)return A}}let P=$[Fh];if(P)return P;return},default:void 0}),C0=async(h)=>V1.loadConfig(kI(h??""))(),pI=async(h)=>{let $=h?.Bucket||"";if(typeof h.Bucket==="string")h.Bucket=$.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"));if(tI($)){if(h.ForcePathStyle===!0)throw Error("Path-style addressing cannot be used with ARN buckets")}else if(!vI($)||$.indexOf(".")!==-1&&!String(h.Endpoint).startsWith("http:")||$.toLowerCase()!==$||$.length<3)h.ForcePathStyle=!0;if(h.DisableMultiRegionAccessPoints)h.disableMultiRegionAccessPoints=!0,h.DisableMRAP=!0;return h},gI=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,mI=/(\d+\.){3}\d+/,dI=/\.\./,vI=(h)=>gI.test(h)&&!mI.test(h)&&!dI.test(h),tI=(h)=>{let[$,T,P,,,w]=h.split(":"),I=$==="arn"&&h.split(":").length>=6,A=Boolean(I&&T&&P&&w);if(I&&!A)throw Error(`Invalid ARN: ${h} was an invalid ARN.`);return A},rI=(h,$,T,P=!1)=>{let w=async()=>{let I;if(P)I=T.clientContextParams?.[h]??T[h]??T[$];else I=T[h]??T[$];if(typeof I==="function")return I();return I};if(h==="credentialScope"||$==="CredentialScope")return async()=>{let I=typeof T.credentials==="function"?await T.credentials():T.credentials;return I?.credentialScope??I?.CredentialScope};if(h==="accountId"||$==="AccountId")return async()=>{let I=typeof T.credentials==="function"?await T.credentials():T.credentials;return I?.accountId??I?.AccountId};if(h==="endpoint"||$==="endpoint")return async()=>{if(T.isCustomEndpoint===!1)return;let I=await w();if(I&&typeof I==="object"){if("url"in I)return I.url.href;if("hostname"in I){let{protocol:A,hostname:U,port:_,path:f}=I;return`${A}//${U}${_?":"+_:""}${f}`}}return I};return w};function sh(h){return async($,T,P,w)=>{if(!P.isCustomEndpoint){let U;if(P.serviceConfiguredEndpoint)U=await P.serviceConfiguredEndpoint();else U=await h(P.serviceId);if(U)P.endpoint=()=>Promise.resolve(F.toEndpointV1(U)),P.isCustomEndpoint=!0}let I=await Sh($,T,P);if(typeof P.endpointProvider!=="function")throw Error("config.endpointProvider is not set.");let A=P.endpointProvider(I,w);if(P.isCustomEndpoint&&P.endpoint){let U=await P.endpoint();if(U?.headers){A.headers??={};for(let[_,f]of Object.entries(U.headers))A.headers[_]=Array.isArray(f)?f:[f]}}return A}}var Sh=async(h,$,T)=>{let P={},w=$?.getEndpointParameterInstructions?.()||{};for(let[I,A]of Object.entries(w))switch(A.type){case"staticContextParams":P[I]=A.value;break;case"contextParams":P[I]=h[A.name];break;case"clientContextParams":case"builtInParams":P[I]=await rI(A.name,I,T,A.type!=="builtInParams")();break;case"operationContextParams":P[I]=A.get(h);break;default:throw Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(A))}if(Object.keys(w).length===0)Object.assign(P,T);if(String(T.serviceId).toLowerCase()==="s3")await pI(P);return P};function nI(h,$,T){if(!h.__smithy_context)h.__smithy_context={features:{}};else if(!h.__smithy_context.features)h.__smithy_context.features={};h.__smithy_context.features[$]=T}function jh(h){let $=sh(h);return({config:T,instructions:P})=>{return(w,I)=>async(A)=>{if(T.isCustomEndpoint)nI(I,"ENDPOINT_OVERRIDE","N");let U=await $(A.input,{getEndpointParameterInstructions(){return P}},{...T},I);I.endpointV2=U,I.authSchemes=U.properties?.authSchemes;let _=I.authSchemes?.[0];if(_){I.signing_region=_.signingRegion,I.signing_service=_.signingName;let Y=yI.getSmithyContext(I)?.selectedHttpAuthScheme?.httpAuthOption;if(Y)Y.signingProperties=Object.assign(Y.signingProperties||{},{signing_region:_.signingRegion,signingRegion:_.signingRegion,signing_service:_.signingName,signingName:_.signingName,signingRegionSet:_.signingRegionSet},_.properties)}return w({...A})}}}var uI={name:"serializerMiddleware"},Ch={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:uI.name};function iI(h){let $=jh(h);return(T,P)=>({applyToStack:(w)=>{w.addRelativeTo($({config:T,instructions:P}),Ch)}})}function lI(h){return($)=>{let T=$.tls??!0,{endpoint:P,useDualstackEndpoint:w,useFipsEndpoint:I}=$,A=P!=null?async()=>F.toEndpointV1(await F.normalizeProvider(P)()):void 0,_=Object.assign($,{endpoint:A,tls:T,isCustomEndpoint:!!P,useDualstackEndpoint:F.normalizeProvider(w??!1),useFipsEndpoint:F.normalizeProvider(I??!1)}),f=void 0;return _.serviceConfiguredEndpoint=async()=>{if($.serviceId&&!f)f=h($.serviceId);return f},_}}class Z1{nodes;root;conditions;results;constructor(h,$,T,P){this.nodes=h,this.root=$,this.conditions=T,this.results=P}static from(h,$,T,P){return new Z1(h,$,T,P)}}class ch{capacity;data=new Map;parameters=[];constructor({size:h,params:$}){if(this.capacity=h??50,$)this.parameters=$}get(h,$){let T=this.hash(h);if(T===!1)return $();if(!this.data.has(T)){if(this.data.size>this.capacity+10){let P=this.data.keys(),w=0;while(!0){let{value:I,done:A}=P.next();if(this.data.delete(I),A||++w>10)break}}this.data.set(T,$())}return this.data.get(T)}size(){return this.data.size}hash(h){let $="",{parameters:T}=this;if(T.length===0)return!1;for(let P of T){let w=String(h[P]??"");if(w.includes("|;"))return!1;$+=w+"|;"}return $}}class q extends Error{constructor(h){super(h);this.name="EndpointError"}}var M0="endpoints";function c(h){if(typeof h!=="object"||h==null)return h;if("ref"in h)return`$${c(h.ref)}`;if("fn"in h)return`${h.fn}(${(h.argv||[]).map(c).join(", ")})`;return JSON.stringify(h,null,2)}var bh={},oI=(h,$)=>h===$;function aI(...h){for(let $ of h)if($!=null)return $;return}var eI=(h)=>{let $=h.split("."),T=[];for(let P of $){let w=P.indexOf("[");if(w!==-1){if(P.indexOf("]")!==P.length-1)throw new q(`Path: '${h}' does not end with ']'`);let I=P.slice(w+1,-1);if(Number.isNaN(parseInt(I)))throw new q(`Invalid array index: '${I}' in path: '${h}'`);if(w!==0)T.push(P.slice(0,w));T.push(I)}else T.push(P)}return T},yh=(h,$)=>eI($).reduce((T,P)=>{if(typeof T!=="object")throw new q(`Index '${P}' in '${$}' not found in '${JSON.stringify(h)}'`);else if(Array.isArray(T)){let w=parseInt(P);return T[w<0?T.length+w:w]}return T[P]},h),hA=(h)=>h!=null;function $A(h,$,T){return h?$:T}var TA=(h)=>!h,PA=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),kh=(h)=>PA.test(h)||h.startsWith("[")&&h.endsWith("]"),G1={[Q1.EndpointURLScheme.HTTP]:80,[Q1.EndpointURLScheme.HTTPS]:443},wA=(h)=>{let $=(()=>{try{if(h instanceof URL)return h;if(typeof h==="object"&&"hostname"in h){let{hostname:X,port:G,protocol:V="",path:Z="",query:J={}}=h,Q=new URL(`${V}//${X}${G?`:${G}`:""}${Z}`);return Q.search=Object.entries(J).map(([R,H])=>`${R}=${H}`).join("&"),Q}return new URL(h)}catch(X){return null}})();if(!$)return console.error(`Unable to parse ${JSON.stringify(h)} as a whatwg URL.`),null;let T=$.href,{host:P,hostname:w,pathname:I,protocol:A,search:U}=$;if(U)return null;let _=A.slice(0,-1);if(!Object.values(Q1.EndpointURLScheme).includes(_))return null;let f=kh(w),Y=T.includes(`${P}:${G1[_]}`)||typeof h==="string"&&h.includes(`${P}:${G1[_]}`),M=`${P}${Y?`:${G1[_]}`:""}`;return{scheme:_,authority:M,path:I,normalizedPath:I.endsWith("/")?I:`${I}/`,isIp:f}};function IA(h,$,T){if(T===1)return[h];if(h==="")return[""];let P=h.split($);if(T===0)return P;return P.slice(0,T-1).concat(P.slice(1).join($))}var AA=(h,$)=>h===$,UA=(h,$,T,P)=>{if(h==null||$>=T||h.length<T||/[^\u0000-\u007f]/.test(h))return null;if(!P)return h.substring($,T);return h.substring(h.length-T,h.length-$)},_A=(h)=>encodeURIComponent(h).replace(/[!*'()]/g,($)=>`%${$.charCodeAt(0).toString(16).toUpperCase()}`),fA={booleanEquals:oI,coalesce:aI,getAttr:yh,isSet:hA,isValidHostLabel:F.isValidHostLabel,ite:$A,not:TA,parseURL:wA,split:IA,stringEquals:AA,substring:UA,uriEncode:_A},ph=(h,$)=>{let T=[],{referenceRecord:P,endpointParams:w}=$,I=0;while(I<h.length){let A=h.indexOf("{",I);if(A===-1){T.push(h.slice(I));break}T.push(h.slice(I,A));let U=h.indexOf("}",A);if(U===-1){T.push(h.slice(A));break}if(h[A+1]==="{"&&h[U+1]==="}")T.push(h.slice(A+1,U)),I=U+2;let _=h.substring(A+1,U);if(_.includes("#")){let[f,Y]=_.split("#");T.push(yh(P[f]??w[f],Y))}else T.push(P[_]??w[_]);I=U+1}return T.join("")},MA=({ref:h},$)=>{return $.referenceRecord[h]??$.endpointParams[h]},Y0=(h,$,T)=>{if(typeof h==="string")return ph(h,T);else if(h.fn)return mh.callFunction(h,T);else if(h.ref)return MA(h,T);throw new q(`'${$}': ${String(h)} is not a string, function or reference.`)},gh=({fn:h,argv:$},T)=>{let P=Array($.length);for(let A=0;A<P.length;++A){let U=$[A];if(typeof U==="boolean"||typeof U==="number")P[A]=U;else P[A]=mh.evaluateExpression(U,"arg",T)}let w=h.indexOf(".");if(w!==-1){let U=bh[h.slice(0,w)]?.[h.slice(w+1)];if(typeof U==="function")return U(...P)}let I=fA[h];if(typeof I==="function")return I(...P);throw Error(`function ${h} not loaded in endpointFunctions.`)},mh={evaluateExpression:Y0,callFunction:gh},dh=(h,$)=>{let{assign:T}=h;if(T&&T in $.referenceRecord)throw new q(`'${T}' is already defined in Reference Record.`);let P=gh(h,$);$.logger?.debug?.(`${M0} evaluateCondition: ${c(h)} = ${c(P)}`);let w=P===""?!0:!!P;if(T!=null)return{result:w,toAssign:{name:T,value:P}};return{result:w}},vh=(h,$)=>Object.entries(h??{}).reduce((T,[P,w])=>{return T[P]=w.map((I)=>{let A=Y0(I,"Header value entry",$);if(typeof A!=="string")throw new q(`Header '${P}' value '${A}' is not a string`);return A}),T},{}),R1=(h,$)=>Object.entries(h).reduce((T,[P,w])=>{return T[P]=rh.getEndpointProperty(w,$),T},{}),th=(h,$)=>{if(Array.isArray(h))return h.map((T)=>th(T,$));switch(typeof h){case"string":return ph(h,$);case"object":if(h===null)throw new q(`Unexpected endpoint property: ${h}`);return rh.getEndpointProperties(h,$);case"boolean":return h;default:throw new q(`Unexpected endpoint property type: ${typeof h}`)}},rh={getEndpointProperty:th,getEndpointProperties:R1},nh=(h,$)=>{let T=Y0(h,"Endpoint URL",$);if(typeof T==="string")try{return new URL(T)}catch(P){throw console.error(`Failed to construct URL with ${T}`,P),P}throw new q(`Endpoint URL must be a string, got ${typeof T}`)},J1=1e8,YA=(h,$)=>{let{nodes:T,root:P,results:w,conditions:I}=h,A=P,U={},_={referenceRecord:U,endpointParams:$.endpointParams,logger:$.logger};while(A!==1&&A!==-1&&A<J1){let f=3*(Math.abs(A)-1),[Y,M,X]=[T[f],T[f+1],T[f+2]],[G,V,Z]=I[Y],J=dh({fn:G,assign:Z,argv:V},_);if(J.toAssign){let{name:Q,value:R}=J.toAssign;U[Q]=R}A=A>=0===J.result?M:X}if(A>=J1){let f=w[A-J1];if(f[0]===-1){let[,G]=f;throw new q(Y0(G,"Error",_))}let[Y,M,X]=f;return{url:nh(Y,_),properties:R1(M,_),headers:vh(X??{},_)}}throw new q("No matching endpoint.")},q1=(h=[],$)=>{let T={},P={...$,referenceRecord:{...$.referenceRecord}},w=!1;for(let I of h){let{result:A,toAssign:U}=dh(I,P);if(!A)return{result:A};if(U)w=!0,T[U.name]=U.value,P.referenceRecord[U.name]=U.value,$.logger?.debug?.(`${M0} assign: ${U.name} := ${c(U.value)}`)}if(w)return{result:!0,referenceRecord:T};return{result:!0}},XA=(h,$)=>{let{conditions:T,endpoint:P}=h,{result:w,referenceRecord:I}=q1(T,$);if(!w)return;let A=I?{...$,referenceRecord:{...$.referenceRecord,...I}}:$,{url:U,properties:_,headers:f}=P;$.logger?.debug?.(`${M0} Resolving endpoint from template: ${c(P)}`);let Y={url:nh(U,A)};if(f!=null)Y.headers=vh(f,A);if(_!=null)Y.properties=R1(_,A);return Y},GA=(h,$)=>{let{conditions:T,error:P}=h,{result:w,referenceRecord:I}=q1(T,$);if(!w)return;let A=I?{...$,referenceRecord:{...$.referenceRecord,...I}}:$;throw new q(Y0(P,"Error",A))},uh=(h,$)=>{for(let T of h)if(T.type==="endpoint"){let P=XA(T,$);if(P)return P}else if(T.type==="error")GA(T,$);else if(T.type==="tree"){let P=ih.evaluateTreeRule(T,$);if(P)return P}else throw new q(`Unknown endpoint rule: ${T}`);throw new q("Rules evaluation failed")},JA=(h,$)=>{let{conditions:T,rules:P}=h,{result:w,referenceRecord:I}=q1(T,$);if(!w)return;let A=I?{...$,referenceRecord:{...$.referenceRecord,...I}}:$;return ih.evaluateRules(P,A)},ih={evaluateRules:uh,evaluateTreeRule:JA},VA=(h,$)=>{let{endpointParams:T,logger:P}=$,{parameters:w,rules:I}=h;$.logger?.debug?.(`${M0} Initial EndpointParams: ${c(T)}`);for(let U in w){let _=w[U],f=T[U];if(f==null&&_.default!=null){T[U]=_.default;continue}if(_.required&&f==null)throw new q(`Missing required parameter: '${U}'`)}let A=uh(I,{endpointParams:T,logger:P,referenceRecord:{}});return $.logger?.debug?.(`${M0} Resolved endpoint: ${c(A)}`),A},QA=(h)=>{let{endpoint:$}=h;if($===void 0)h.endpoint=async()=>{throw Error("@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.")};return h},ZA=sh(C0),RA=lI(C0),qA=jh(C0),OA=iI(C0);EA.isValidHostLabel=F.isValidHostLabel;EA.middlewareEndpointToEndpointV1=F.toEndpointV1;EA.toEndpointV1=F.toEndpointV1;EA.BinaryDecisionDiagram=Z1;EA.EndpointCache=ch;EA.EndpointError=q;EA.customEndpointFunctions=bh;EA.decideEndpoint=YA;EA.endpointMiddleware=qA;EA.endpointMiddlewareOptions=Ch;EA.getEndpointFromInstructions=ZA;EA.getEndpointPlugin=OA;EA.isIpAddress=kh;EA.resolveEndpoint=VA;EA.resolveEndpointConfig=RA;EA.resolveEndpointRequiredConfig=QA;EA.resolveParams=Sh});var Ff=y((J_)=>{var H1=C("crypto"),O1=C("fs"),kA=m(),pA=lh(),D=C("stream"),P$=(h)=>typeof ArrayBuffer==="function"&&h instanceof ArrayBuffer||Object.prototype.toString.call(h)==="[object ArrayBuffer]",u=(h,$=0,T=h.byteLength-$)=>{if(!P$(h))throw TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof h} (${h})`);return Buffer.from(h,$,T)},k0=(h,$)=>{if(typeof h!=="string")throw TypeError(`The "input" argument must be of type string. Received type ${typeof h} (${h})`);return $?Buffer.from(h,$):Buffer.from(h)},gA=/^[A-Za-z0-9+/]*={0,2}$/,w$=(h)=>{if(h.length*3%4!==0)throw TypeError("Incorrect padding on base64 string.");if(!gA.exec(h))throw TypeError("Invalid base64 string.");let $=k0(h,"base64");return new Uint8Array($.buffer,$.byteOffset,$.byteLength)},p0=(h)=>{let $=k0(h,"utf8");return new Uint8Array($.buffer,$.byteOffset,$.byteLength/Uint8Array.BYTES_PER_ELEMENT)},K1=(h)=>{let $;if(typeof h==="string")$=p0(h);else $=h;if(typeof $!=="object"||typeof $.byteOffset!=="number"||typeof $.byteLength!=="number")throw Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return u($.buffer,$.byteOffset,$.byteLength).toString("base64")};function mA(h,$,T,P){return class w extends Uint8Array{static fromString(I,A="utf-8"){if(typeof I==="string"){if(A==="base64")return w.mutate(P(I));return w.mutate($(I))}throw Error(`Unsupported conversion from ${typeof I} to Uint8ArrayBlobAdapter.`)}static mutate(I){return Object.setPrototypeOf(I,w.prototype),I}transformToString(I="utf-8"){if(I==="base64")return T(this);return h(this)}}}var I$=(h)=>{if(typeof h==="string")return h;if(typeof h!=="object"||typeof h.byteOffset!=="number"||typeof h.byteLength!=="number")throw Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return u(h.buffer,h.byteOffset,h.byteLength).toString("utf8")},O=Array.from({length:256},(h,$)=>$.toString(16).padStart(2,"0"));function dA(h){if(typeof crypto<"u"&&typeof crypto.randomUUID==="function")return()=>crypto.randomUUID();return()=>{let $=new Uint8Array(16);return h($),$[6]=$[6]&15|64,$[8]=$[8]&63|128,O[$[0]]+O[$[1]]+O[$[2]]+O[$[3]]+"-"+O[$[4]]+O[$[5]]+"-"+O[$[6]]+O[$[7]]+"-"+O[$[8]]+O[$[9]]+"-"+O[$[10]]+O[$[11]]+O[$[12]]+O[$[13]]+O[$[14]]+O[$[15]]}}var vA=(h,$,T=(P)=>P)=>h,tA=(h)=>{switch(h){case"true":return!0;case"false":return!1;default:throw Error(`Unable to parse boolean value "${h}"`)}},rA=(h)=>{if(h===null||h===void 0)return;if(typeof h==="number"){if(h===0||h===1)Q0.warn(b0(`Expected boolean, got ${typeof h}: ${h}`));if(h===0)return!1;if(h===1)return!0}if(typeof h==="string"){let $=h.toLowerCase();if($==="false"||$==="true")Q0.warn(b0(`Expected boolean, got ${typeof h}: ${h}`));if($==="false")return!1;if($==="true")return!0}if(typeof h==="boolean")return h;throw TypeError(`Expected boolean, got ${typeof h}: ${h}`)},J0=(h)=>{if(h===null||h===void 0)return;if(typeof h==="string"){let $=parseFloat(h);if(!Number.isNaN($)){if(String($)!==String(h))Q0.warn(b0(`Expected number but observed string: ${h}`));return $}}if(typeof h==="number")return h;throw TypeError(`Expected number, got ${typeof h}: ${h}`)},nA=Math.ceil(340282346638528860000000000000000000000),c0=(h)=>{let $=J0(h);if($!==void 0&&!Number.isNaN($)&&$!==1/0&&$!==-1/0){if(Math.abs($)>nA)throw TypeError(`Expected 32-bit float, got ${h}`)}return $},V0=(h)=>{if(h===null||h===void 0)return;if(Number.isInteger(h)&&!Number.isNaN(h))return h;throw TypeError(`Expected integer, got ${typeof h}: ${h}`)},uA=V0,x1=(h)=>B1(h,32),W1=(h)=>B1(h,16),D1=(h)=>B1(h,8),B1=(h,$)=>{let T=V0(h);if(T!==void 0&&iA(T,$)!==T)throw TypeError(`Expected ${$}-bit integer, got ${h}`);return T},iA=(h,$)=>{switch($){case 32:return Int32Array.of(h)[0];case 16:return Int16Array.of(h)[0];case 8:return Int8Array.of(h)[0]}},lA=(h,$)=>{if(h===null||h===void 0){if($)throw TypeError(`Expected a non-null value for ${$}`);throw TypeError("Expected a non-null value")}return h},A$=(h)=>{if(h===null||h===void 0)return;if(typeof h==="object"&&!Array.isArray(h))return h;let $=Array.isArray(h)?"array":typeof h;throw TypeError(`Expected object, got ${$}: ${h}`)},oA=(h)=>{if(h===null||h===void 0)return;if(typeof h==="string")return h;if(["boolean","number","bigint"].includes(typeof h))return Q0.warn(b0(`Expected string, got ${typeof h}: ${h}`)),String(h);throw TypeError(`Expected string, got ${typeof h}: ${h}`)},aA=(h)=>{if(h===null||h===void 0)return;let $=A$(h),T=[];for(let P in $)if($[P]!=null)T.push(P);if(T.length===0)throw TypeError("Unions must have exactly one non-null member. None were found.");if(T.length>1)throw TypeError(`Unions must have exactly one non-null member. Keys ${T} were not null.`);return $},z1=(h)=>{if(typeof h=="string")return J0(o(h));return J0(h)},eA=z1,U$=(h)=>{if(typeof h=="string")return c0(o(h));return c0(h)},hU=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,o=(h)=>{let $=h.match(hU);if($===null||$[0].length!==h.length)throw TypeError("Expected real number, got implicit NaN");return parseFloat(h)},F1=(h)=>{if(typeof h=="string")return _$(h);return J0(h)},$U=F1,TU=F1,PU=(h)=>{if(typeof h=="string")return _$(h);return c0(h)},_$=(h)=>{switch(h){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw Error(`Unable to parse float value: ${h}`)}},f$=(h)=>{if(typeof h==="string")return V0(o(h));return V0(h)},wU=f$,IU=(h)=>{if(typeof h==="string")return x1(o(h));return x1(h)},i=(h)=>{if(typeof h==="string")return W1(o(h));return W1(h)},M$=(h)=>{if(typeof h==="string")return D1(o(h));return D1(h)},b0=(h)=>{return String(TypeError(h).stack||h).split(`
|
|
4
4
|
`).slice(0,5).filter(($)=>!$.includes("stackTraceWarning")).join(`
|
|
5
5
|
`)},Q0={warn:console.warn},AU=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function UU(h){let $=h.getUTCFullYear(),T=h.getUTCMonth(),P=h.getUTCDay(),w=h.getUTCDate(),I=h.getUTCHours(),A=h.getUTCMinutes(),U=h.getUTCSeconds(),_=w<10?`0${w}`:`${w}`,f=I<10?`0${I}`:`${I}`,Y=A<10?`0${A}`:`${A}`,M=U<10?`0${U}`:`${U}`;return`${AU[P]}, ${_} ${s1[T]} ${$} ${f}:${Y}:${M} GMT`}var _U=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),fU=(h)=>{if(h===null||h===void 0)return;if(typeof h!=="string")throw TypeError("RFC-3339 date-times must be expressed as strings");let $=_U.exec(h);if(!$)throw TypeError("Invalid RFC-3339 date-time value");let[T,P,w,I,A,U,_,f]=$,Y=i(l(P)),M=L(w,"month",1,12),X=L(I,"day",1,31);return X0(Y,M,X,{hours:A,minutes:U,seconds:_,fractionalMilliseconds:f})},MU=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),YU=(h)=>{if(h===null||h===void 0)return;if(typeof h!=="string")throw TypeError("RFC-3339 date-times must be expressed as strings");let $=MU.exec(h);if(!$)throw TypeError("Invalid RFC-3339 date-time value");let[T,P,w,I,A,U,_,f,Y]=$,M=i(l(P)),X=L(w,"month",1,12),G=L(I,"day",1,31),V=X0(M,X,G,{hours:A,minutes:U,seconds:_,fractionalMilliseconds:f});if(Y.toUpperCase()!="Z")V.setTime(V.getTime()-xU(Y));return V},XU=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$/),GU=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$/),JU=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})$/),VU=(h)=>{if(h===null||h===void 0)return;if(typeof h!=="string")throw TypeError("RFC-7231 date-times must be expressed as strings");let $=XU.exec(h);if($){let[T,P,w,I,A,U,_,f]=$;return X0(i(l(I)),E1(w),L(P,"day",1,31),{hours:A,minutes:U,seconds:_,fractionalMilliseconds:f})}if($=GU.exec(h),$){let[T,P,w,I,A,U,_,f]=$;return qU(X0(ZU(I),E1(w),L(P,"day",1,31),{hours:A,minutes:U,seconds:_,fractionalMilliseconds:f}))}if($=JU.exec(h),$){let[T,P,w,I,A,U,_,f]=$;return X0(i(l(f)),E1(P),L(w.trimLeft(),"day",1,31),{hours:I,minutes:A,seconds:U,fractionalMilliseconds:_})}throw TypeError("Invalid RFC-7231 date-time value")},QU=(h)=>{if(h===null||h===void 0)return;let $;if(typeof h==="number")$=h;else if(typeof h==="string")$=z1(h);else if(typeof h==="object"&&h.tag===1)$=h.value;else throw TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN($)||$===1/0||$===-1/0)throw TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round($*1000))},X0=(h,$,T,P)=>{let w=$-1;return EU(h,w,T),new Date(Date.UTC(h,w,T,L(P.hours,"hour",0,23),L(P.minutes,"minute",0,59),L(P.seconds,"seconds",0,60),HU(P.fractionalMilliseconds)))},ZU=(h)=>{let $=new Date().getUTCFullYear(),T=Math.floor($/100)*100+i(l(h));if(T<$)return T+100;return T},RU=1576800000000,qU=(h)=>{if(h.getTime()-new Date().getTime()>RU)return new Date(Date.UTC(h.getUTCFullYear()-100,h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()));return h},E1=(h)=>{let $=s1.indexOf(h);if($<0)throw TypeError(`Invalid month: ${h}`);return $+1},OU=[31,28,31,30,31,30,31,31,30,31,30,31],EU=(h,$,T)=>{let P=OU[$];if($===1&&NU(h))P=29;if(T>P)throw TypeError(`Invalid day for ${s1[$]} in ${h}: ${T}`)},NU=(h)=>{return h%4===0&&(h%100!==0||h%400===0)},L=(h,$,T,P)=>{let w=M$(l(h));if(w<T||w>P)throw TypeError(`${$} must be between ${T} and ${P}, inclusive`);return w},HU=(h)=>{if(h===null||h===void 0)return 0;return U$("0."+h)*1000},xU=(h)=>{let $=h[0],T=1;if($=="+")T=1;else if($=="-")T=-1;else throw TypeError(`Offset direction, ${$}, must be "+" or "-"`);let P=Number(h.substring(1,3)),w=Number(h.substring(4,6));return T*(P*60+w)*60*1000},l=(h)=>{let $=0;while($<h.length-1&&h.charAt($)==="0")$++;if($===0)return h;return h.slice($)},g=function($){return Object.assign(new String($),{deserializeJSON(){return JSON.parse(String($))},toString(){return String($)},toJSON(){return String($)}})};g.from=(h)=>{if(h&&typeof h==="object"&&(h instanceof g||("deserializeJSON"in h)))return h;else if(typeof h==="string"||Object.getPrototypeOf(h)===String.prototype)return g(String(h));return g(JSON.stringify(h))};g.fromObject=g.from;function WU(h){if(h.includes(",")||h.includes('"'))h=`"${h.replace(/"/g,"\\\"")}"`;return h}var S1="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",j1="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",C1="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Y$="(\\d?\\d)",X$="(\\d{4})",DU=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),LU=new RegExp(`^${S1}, ${Y$} ${j1} ${X$} ${C1} GMT$`),KU=new RegExp(`^${S1}, ${Y$}-${j1}-(\\d\\d) ${C1} GMT$`),BU=new RegExp(`^${S1} ${j1} ( [1-9]|\\d\\d) ${C1} ${X$}$`),zU=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],FU=(h)=>{if(h==null)return;let $=NaN;if(typeof h==="number")$=h;else if(typeof h==="string"){if(!/^-?\d*\.?\d+$/.test(h))throw TypeError("parseEpochTimestamp - numeric string invalid.");$=Number.parseFloat(h)}else if(typeof h==="object"&&h.tag===1)$=h.value;if(isNaN($)||Math.abs($)===1/0)throw TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round($*1000))},sU=(h)=>{if(h==null)return;if(typeof h!=="string")throw TypeError("RFC3339 timestamps must be strings");let $=DU.exec(h);if(!$)throw TypeError(`Invalid RFC3339 timestamp format ${h}`);let[,T,P,w,I,A,U,,_,f]=$;s(P,1,12),s(w,1,31),s(I,0,23),s(A,0,59),s(U,0,60);let Y=new Date(Date.UTC(Number(T),Number(P)-1,Number(w),Number(I),Number(A),Number(U),Number(_)?Math.round(parseFloat(`0.${_}`)*1000):0));if(Y.setUTCFullYear(Number(T)),f.toUpperCase()!="Z"){let[,M,X,G]=/([+-])(\d\d):(\d\d)/.exec(f)||[void 0,"+",0,0],V=M==="-"?1:-1;Y.setTime(Y.getTime()+V*(Number(X)*60*60*1000+Number(G)*60*1000))}return Y},SU=(h)=>{if(h==null)return;if(typeof h!=="string")throw TypeError("RFC7231 timestamps must be strings.");let $,T,P,w,I,A,U,_;if(_=LU.exec(h))[,$,T,P,w,I,A,U]=_;else if(_=KU.exec(h))[,$,T,P,w,I,A,U]=_,P=(Number(P)+1900).toString();else if(_=BU.exec(h))[,T,$,w,I,A,U,P]=_;if(P&&A){let f=Date.UTC(Number(P),zU.indexOf(T),Number($),Number(w),Number(I),Number(A),U?Math.round(parseFloat(`0.${U}`)*1000):0);s($,1,31),s(w,0,23),s(I,0,59),s(A,0,60);let Y=new Date(f);return Y.setUTCFullYear(Number(P)),Y}throw TypeError(`Invalid RFC7231 date-time value ${h}.`)};function s(h,$,T){let P=Number(h);if(P<$||P>T)throw Error(`Value ${P} out of range [${$}, ${T}]`)}function jU(h,$,T){if(T<=0||!Number.isInteger(T))throw Error("Invalid number of delimiters ("+T+") for splitEvery.");let P=h.split($);if(T===1)return P;let w=[],I="";for(let A=0;A<P.length;A++){if(I==="")I=P[A];else I+=$+P[A];if((A+1)%T===0)w.push(I),I=""}if(I!=="")w.push(I);return w}var CU=(h)=>{let $=h.length,T=[],P=!1,w=void 0,I=0;for(let A=0;A<$;++A){let U=h[A];switch(U){case'"':if(w!=="\\")P=!P;break;case",":if(!P)T.push(h.slice(I,A)),I=A+1;break}w=U}return T.push(h.slice(I)),T.map((A)=>{A=A.trim();let U=A.length;if(U<2)return A;if(A[0]==='"'&&A[U-1]==='"')A=A.slice(1,U-1);return A.replace(/\\"/g,'"')})},oh=/^-?\d*(\.\d+)?$/;class g0{string;type;constructor(h,$){if(this.string=h,this.type=$,!oh.test(h))throw Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](h){if(!h||typeof h!=="object")return!1;let $=h;return g0.prototype.isPrototypeOf(h)||$.type==="bigDecimal"&&oh.test($.string)}}function cU(h){return new g0(String(h),"bigDecimal")}var G$={},L1={};for(let h=0;h<256;h++){let $=h.toString(16).toLowerCase();if($.length===1)$=`0${$}`;G$[h]=$,L1[$]=h}function bU(h){if(h.length%2!==0)throw Error("Hex encoded strings must have an even number length");let $=new Uint8Array(h.length/2);for(let T=0;T<h.length;T+=2){let P=h.slice(T,T+2).toLowerCase();if(P in L1)$[T/2]=L1[P];else throw Error(`Cannot decode unrecognized sequence ${P} as hexadecimal`)}return $}function J$(h){let $="";for(let T=0;T<h.byteLength;T++)$+=G$[h[T]];return $}var yU=(h)=>{if(!h)return 0;if(typeof h==="string")return Buffer.byteLength(h);else if(typeof h.byteLength==="number")return h.byteLength;else if(typeof h.size==="number")return h.size;else if(typeof h.start==="number"&&typeof h.end==="number")return h.end+1-h.start;else if(h instanceof O1.ReadStream){if(h.path!=null)return O1.lstatSync(h.path).size;else if(typeof h.fd==="number")return O1.fstatSync(h.fd).size}throw Error(`Body Length computation failed for ${h}`)},V$=(h)=>{if(typeof h==="string")return p0(h);if(ArrayBuffer.isView(h))return new Uint8Array(h.buffer,h.byteOffset,h.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(h)},Q$=(h,$)=>(T,P)=>async(w)=>{let{response:I}=await T(w);try{let A=await $(I,h);return{response:I,output:A}}catch(A){if(Object.defineProperty(A,"$response",{value:I,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in A)){try{A.message+=`
|
|
@@ -15,4 +15,4 @@ ${M}\r
|
|
|
15
15
|
`),M.push(`\r
|
|
16
16
|
`)}M.push(null)}),M}async function lU(h,$){let T=0,P=[],w=h.getReader(),I=!1;while(!I){let{done:_,value:f}=await w.read();if(f)P.push(f),T+=f?.byteLength??0;if(T>=$)break;I=_}w.releaseLock();let A=new Uint8Array(Math.min($,T)),U=0;for(let _ of P){if(_.byteLength>A.byteLength-U){A.set(_.subarray(0,A.byteLength-U),U);break}else A.set(_,U);U+=_.length}return A}var oU=(h,$)=>{if(S(h))return lU(h,$);return new Promise((T,P)=>{let w=new aU;w.limit=$,h.pipe(w),h.on("error",(I)=>{w.end(),P(I)}),w.on("error",P),w.on("finish",function(){let I=new Uint8Array(Buffer.concat(this.buffers));T(I)})})},aU=class extends D.Writable{buffers=[];limit=1/0;bytesBuffered=0;_write($,T,P){if(this.buffers.push($),this.bytesBuffered+=$.byteLength??0,this.bytesBuffered>=this.limit){let w=this.bytesBuffered-this.limit,I=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=I.subarray(0,I.byteLength-w),this.emit("finish")}P()}},eU=(h)=>{if(typeof h==="string")return h;if(typeof h!=="object"||typeof h.byteOffset!=="number"||typeof h.byteLength!=="number")throw Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(h)},h_=(h)=>{let $=h.length/4*3;if(h.slice(-2)==="==")$-=2;else if(h.slice(-1)==="=")$--;let T=new ArrayBuffer($),P=new DataView(T);for(let w=0;w<h.length;w+=4){let I=0,A=0;for(let f=w,Y=w+3;f<=Y;f++)if(h[f]!=="="){if(!(h[f]in eh))throw TypeError(`Invalid character ${h[f]} in base64 string.`);I|=eh[h[f]]<<(Y-f)*r,A+=r}else I>>=r;let U=w/4*3;I>>=A%G0;let _=Math.floor(A/G0);for(let f=0;f<_;f++){let Y=(_-f-1)*G0;P.setUint8(U+f,(I&255<<Y)>>Y)}}return new Uint8Array(T)},$_=async(h)=>{if(typeof Blob==="function"&&h instanceof Blob||h.constructor?.name==="Blob"){if(Blob.prototype.arrayBuffer!==void 0)return new Uint8Array(await h.arrayBuffer());return T_(h)}return P_(h)};async function T_(h){let $=await w_(h),T=h_($);return new Uint8Array(T)}async function P_(h){let $=[],T=h.getReader(),P=!1,w=0;while(!P){let{done:U,value:_}=await T.read();if(_)$.push(_),w+=_.length;P=U}let I=new Uint8Array(w),A=0;for(let U of $)I.set(U,A),A+=U.length;return I}function w_(h){return new Promise(($,T)=>{let P=new FileReader;P.onloadend=()=>{if(P.readyState!==2)return T(Error("Reader aborted too early"));let w=P.result??"",I=w.indexOf(","),A=I>-1?I+1:w.length;$(w.substring(A))},P.onabort=()=>T(Error("Read aborted")),P.onerror=()=>T(P.error),P.readAsDataURL(h)})}var h$="The stream has already been transformed.",I_=(h)=>{if(!$$(h)&&!S(h)){let w=h?.__proto__?.constructor?.name||h;throw Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${w}`)}let $=!1,T=async()=>{if($)throw Error(h$);return $=!0,await $_(h)},P=(w)=>{if(typeof w.stream!=="function")throw Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
|
|
17
17
|
If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return w.stream()};return Object.assign(h,{transformToByteArray:T,transformToString:async(w)=>{let I=await T();if(w==="base64")return x$(I);else if(w==="hex")return J$(I);else if(w===void 0||w==="utf8"||w==="utf-8")return eU(I);else if(typeof TextDecoder==="function")return new TextDecoder(w).decode(I);else throw Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if($)throw Error(h$);if($=!0,$$(h))return P(h);else if(S(h))return h;else throw Error(`Cannot transform payload to web stream, got ${h}`)}})},$$=(h)=>typeof Blob==="function"&&h instanceof Blob;class K$ extends D.Writable{bufferedBytes=[];_write(h,$,T){this.bufferedBytes.push(h),T()}}var A_=(h)=>typeof ReadableStream==="function"&&h instanceof ReadableStream;async function U_(h){let $=[],T=h.getReader(),P=!1,w=0;while(!P){let{done:U,value:_}=await T.read();if(_)$.push(_),w+=_.length;P=U}let I=new Uint8Array(w),A=0;for(let U of $)I.set(U,A),A+=U.length;return I}var __=(h)=>{if(A_(h))return U_(h);return new Promise(($,T)=>{let P=new K$;h.pipe(P),h.on("error",(w)=>{P.end(),T(w)}),P.on("error",T),P.on("finish",function(){let w=new Uint8Array(Buffer.concat(this.bufferedBytes));$(w)})})},T$="The stream has already been transformed.",f_=(h)=>{if(!(h instanceof D.Readable))try{return I_(h)}catch(P){let w=h?.__proto__?.constructor?.name||h;throw Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${w}`)}let $=!1,T=async()=>{if($)throw Error(T$);return $=!0,await __(h)};return Object.assign(h,{transformToByteArray:T,transformToString:async(P)=>{let w=await T();if(P===void 0||Buffer.isEncoding(P))return u(w.buffer,w.byteOffset,w.byteLength).toString(P);else return new TextDecoder(P).decode(w)},transformToWebStream:()=>{if($)throw Error(T$);if(h.readableFlowing!==null)throw Error("The stream has been consumed by other callbacks.");if(typeof D.Readable.toWeb!=="function")throw Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return $=!0,D.Readable.toWeb(h)}})};async function M_(h){if(typeof h.stream==="function")h=h.stream();return h.tee()}async function Y_(h){if(S(h)||N$(h))return M_(h);let $=new D.PassThrough,T=new D.PassThrough;return h.pipe($),h.pipe(T),[$,T]}class B$ extends mA(I$,p0,K1,w$){}var X_=H1.getRandomValues,z$=dA(X_),G_=z$;J_.ChecksumStream=E$;J_.Hash=O$;J_.LazyJsonString=g;J_.NumericValue=g0;J_.Uint8ArrayBlobAdapter=B$;J_._parseEpochTimestamp=FU;J_._parseRfc3339DateTimeWithOffset=sU;J_._parseRfc7231DateTime=SU;J_.calculateBodyLength=yU;J_.copyDocumentWithTransform=vA;J_.createBufferedReadable=nU;J_.createChecksumStream=tU;J_.dateToUtcString=UU;J_.deserializerMiddleware=Q$;J_.deserializerMiddlewareOption=R$;J_.expectBoolean=rA;J_.expectByte=D1;J_.expectFloat32=c0;J_.expectInt=uA;J_.expectInt32=x1;J_.expectLong=V0;J_.expectNonNull=lA;J_.expectNumber=J0;J_.expectObject=A$;J_.expectShort=W1;J_.expectString=oA;J_.expectUnion=aA;J_.fromArrayBuffer=u;J_.fromBase64=w$;J_.fromHex=bU;J_.fromString=k0;J_.fromUtf8=p0;J_.generateIdempotencyToken=G_;J_.getAwsChunkedEncodingStream=iU;J_.getSerdePlugin=kU;J_.handleFloat=$U;J_.headStream=oU;J_.isArrayBuffer=P$;J_.isBlob=N$;J_.isReadableStream=S;J_.limitedParseDouble=F1;J_.limitedParseFloat=TU;J_.limitedParseFloat32=PU;J_.logger=Q0;J_.nv=cU;J_.parseBoolean=tA;J_.parseEpochTimestamp=QU;J_.parseRfc3339DateTime=fU;J_.parseRfc3339DateTimeWithOffset=YU;J_.parseRfc7231DateTime=VU;J_.quoteHeader=WU;J_.sdkStreamMixin=f_;J_.serializerMiddleware=Z$;J_.serializerMiddlewareOption=q$;J_.splitEvery=jU;J_.splitHeader=CU;J_.splitStream=Y_;J_.strictParseByte=M$;J_.strictParseDouble=z1;J_.strictParseFloat=eA;J_.strictParseFloat32=U$;J_.strictParseInt=wU;J_.strictParseInt32=IU;J_.strictParseLong=f$;J_.strictParseShort=i;J_.toBase64=K1;J_.toHex=J$;J_.toUint8Array=V$;J_.toUtf8=I$;J_.v4=z$});
|
|
18
|
-
export{h0 as
|
|
18
|
+
export{h0 as Df,m as Ef,d1 as Ff,$1 as Gf,Bh as Hf,lh as If,Ff as Jf};
|