gemi 0.203.0 → 0.204.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/Agent.d.ts +20 -1
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +5 -0
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +52 -55
- package/dist/ai/index.js.map +3 -13
- package/dist/ai/providers/request.d.ts +1 -0
- package/dist/ai/providers/request.d.ts.map +1 -1
- package/dist/ai/testing/Fingerprints.d.ts +106 -0
- package/dist/ai/testing/Fingerprints.d.ts.map +1 -0
- package/dist/ai/testing/RecordingProvider.d.ts +258 -0
- package/dist/ai/testing/RecordingProvider.d.ts.map +1 -0
- package/dist/ai/testing/index.d.ts +4 -0
- package/dist/ai/testing/index.d.ts.map +1 -0
- package/dist/ai/testing/index.js +6 -0
- package/dist/ai/testing/index.js.map +12 -0
- package/dist/ai/testing/pinClock.d.ts +19 -0
- package/dist/ai/testing/pinClock.d.ts.map +1 -0
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +1 -1
- package/dist/{chunk-dj9nspcw.js → chunk-0hfzzb3k.js} +3 -3
- package/dist/{chunk-dj9nspcw.js.map → chunk-0hfzzb3k.js.map} +1 -1
- package/dist/chunk-0pgk811s.js +4 -0
- package/dist/{chunk-3e19n0f2.js.map → chunk-0pgk811s.js.map} +2 -2
- package/dist/{chunk-2fbsd1b0.js → chunk-0shq2d31.js} +2 -2
- package/dist/{chunk-2fbsd1b0.js.map → chunk-0shq2d31.js.map} +1 -1
- package/dist/{chunk-wfwpjx25.js → chunk-0t1d9s34.js} +3 -3
- package/dist/{chunk-wfwpjx25.js.map → chunk-0t1d9s34.js.map} +1 -1
- package/dist/{chunk-hergje99.js → chunk-1e82gfk9.js} +3 -3
- package/dist/{chunk-hergje99.js.map → chunk-1e82gfk9.js.map} +1 -1
- package/dist/{chunk-95re1b2y.js → chunk-1kehwa3s.js} +1 -1
- package/dist/chunk-1x60thpm.js +8 -0
- package/dist/chunk-1x60thpm.js.map +19 -0
- package/dist/{chunk-px2a83jv.js → chunk-2ngdhbz7.js} +2 -2
- package/dist/{chunk-px2a83jv.js.map → chunk-2ngdhbz7.js.map} +1 -1
- package/dist/{chunk-5dhp90cx.js → chunk-2t1eyzvq.js} +2 -2
- package/dist/{chunk-5dhp90cx.js.map → chunk-2t1eyzvq.js.map} +1 -1
- package/dist/{chunk-ggmznkqs.js → chunk-39hed4yr.js} +3 -3
- package/dist/{chunk-ggmznkqs.js.map → chunk-39hed4yr.js.map} +1 -1
- package/dist/{chunk-tgbj942e.js → chunk-3gkxnfef.js} +3 -3
- package/dist/{chunk-tgbj942e.js.map → chunk-3gkxnfef.js.map} +1 -1
- package/dist/{chunk-k3m1wr1c.js → chunk-3xzhbkya.js} +3 -3
- package/dist/{chunk-k3m1wr1c.js.map → chunk-3xzhbkya.js.map} +1 -1
- package/dist/{chunk-95cs3r49.js → chunk-4c0rb2ng.js} +2 -2
- package/dist/{chunk-95cs3r49.js.map → chunk-4c0rb2ng.js.map} +1 -1
- package/dist/chunk-4ex4s616.js +4 -0
- package/dist/{chunk-tkskgvhc.js.map → chunk-4ex4s616.js.map} +2 -2
- package/dist/{chunk-n5g9a48h.js → chunk-4m8t67px.js} +2 -2
- package/dist/{chunk-n5g9a48h.js.map → chunk-4m8t67px.js.map} +1 -1
- package/dist/{chunk-1hpedme7.js → chunk-4v5c4mes.js} +2 -2
- package/dist/{chunk-1hpedme7.js.map → chunk-4v5c4mes.js.map} +1 -1
- package/dist/{chunk-g5j5hx6a.js → chunk-5gvc03cv.js} +3 -3
- package/dist/{chunk-g5j5hx6a.js.map → chunk-5gvc03cv.js.map} +1 -1
- package/dist/{chunk-r842yxd9.js → chunk-5km0np8s.js} +2 -2
- package/dist/{chunk-r842yxd9.js.map → chunk-5km0np8s.js.map} +1 -1
- package/dist/{chunk-m3xvm2va.js → chunk-6bfj0mbp.js} +3 -3
- package/dist/{chunk-m3xvm2va.js.map → chunk-6bfj0mbp.js.map} +1 -1
- package/dist/chunk-6g1xac70.js +7 -0
- package/dist/chunk-6g1xac70.js.map +10 -0
- package/dist/{chunk-kmpxda7j.js → chunk-6w6q9mxe.js} +3 -3
- package/dist/{chunk-kmpxda7j.js.map → chunk-6w6q9mxe.js.map} +2 -2
- package/dist/chunk-733e6v7b.js +6 -0
- package/dist/{chunk-z97tptd1.js.map → chunk-733e6v7b.js.map} +2 -2
- package/dist/{chunk-dyb649h3.js → chunk-77x9vxht.js} +3 -3
- package/dist/{chunk-dyb649h3.js.map → chunk-77x9vxht.js.map} +1 -1
- package/dist/{chunk-5q2tt76t.js → chunk-7gxmf9rg.js} +2 -2
- package/dist/{chunk-5q2tt76t.js.map → chunk-7gxmf9rg.js.map} +1 -1
- package/dist/{chunk-vyp7d7xz.js → chunk-8jfnn7v6.js} +2 -2
- package/dist/{chunk-vyp7d7xz.js.map → chunk-8jfnn7v6.js.map} +1 -1
- package/dist/{chunk-zvhks9s7.js → chunk-8pw4zjnx.js} +1 -1
- package/dist/{chunk-9q5xhb64.js → chunk-9bjggtdt.js} +2 -2
- package/dist/{chunk-9q5xhb64.js.map → chunk-9bjggtdt.js.map} +1 -1
- package/dist/{chunk-rwe4bgt3.js → chunk-9hqnecjt.js} +2 -2
- package/dist/{chunk-rwe4bgt3.js.map → chunk-9hqnecjt.js.map} +1 -1
- package/dist/{chunk-s0z61m9j.js → chunk-9m7c4mws.js} +2 -2
- package/dist/{chunk-s0z61m9j.js.map → chunk-9m7c4mws.js.map} +1 -1
- package/dist/{chunk-r02em4jv.js → chunk-b1mdan5a.js} +2 -2
- package/dist/{chunk-r02em4jv.js.map → chunk-b1mdan5a.js.map} +1 -1
- package/dist/chunk-b9czfrxm.js +24 -0
- package/dist/{chunk-70qqpvd9.js.map → chunk-b9czfrxm.js.map} +2 -2
- package/dist/{chunk-7txst143.js → chunk-bq4pgzcd.js} +2 -2
- package/dist/{chunk-7txst143.js.map → chunk-bq4pgzcd.js.map} +1 -1
- package/dist/chunk-c7nbzryd.js +9 -0
- package/dist/chunk-c7nbzryd.js.map +10 -0
- package/dist/{chunk-pp34d463.js → chunk-cdgnwzwf.js} +2 -2
- package/dist/{chunk-pp34d463.js.map → chunk-cdgnwzwf.js.map} +1 -1
- package/dist/chunk-cf7xc02m.js +5 -0
- package/dist/{chunk-9mhr0kwd.js.map → chunk-cf7xc02m.js.map} +1 -1
- package/dist/{chunk-2nw8rf5y.js → chunk-cq7hk8v9.js} +2 -2
- package/dist/{chunk-2nw8rf5y.js.map → chunk-cq7hk8v9.js.map} +1 -1
- package/dist/{chunk-8m9kgynj.js → chunk-crqbzfd5.js} +2 -2
- package/dist/{chunk-8m9kgynj.js.map → chunk-crqbzfd5.js.map} +1 -1
- package/dist/{chunk-vee6v6qf.js → chunk-d3k38gk1.js} +3 -3
- package/dist/{chunk-vee6v6qf.js.map → chunk-d3k38gk1.js.map} +1 -1
- package/dist/{chunk-41fqkygr.js → chunk-d5d3a8bm.js} +3 -3
- package/dist/{chunk-41fqkygr.js.map → chunk-d5d3a8bm.js.map} +1 -1
- package/dist/chunk-d7kknkmq.js +13 -0
- package/dist/{chunk-4fw84bh6.js.map → chunk-d7kknkmq.js.map} +3 -4
- package/dist/{chunk-ke7d7j2y.js → chunk-dk1xxtgk.js} +2 -2
- package/dist/{chunk-ke7d7j2y.js.map → chunk-dk1xxtgk.js.map} +1 -1
- package/dist/{chunk-nqg7hdy8.js → chunk-e3ehv27z.js} +3 -3
- package/dist/{chunk-nqg7hdy8.js.map → chunk-e3ehv27z.js.map} +1 -1
- package/dist/{chunk-se58ty45.js → chunk-e5mqjren.js} +4 -4
- package/dist/{chunk-se58ty45.js.map → chunk-e5mqjren.js.map} +2 -2
- package/dist/{chunk-t91x2k88.js → chunk-efnerp0c.js} +2 -2
- package/dist/{chunk-t91x2k88.js.map → chunk-efnerp0c.js.map} +1 -1
- package/dist/{chunk-ys4q1jg2.js → chunk-ek0dvbck.js} +3 -3
- package/dist/{chunk-ys4q1jg2.js.map → chunk-ek0dvbck.js.map} +1 -1
- package/dist/{chunk-a4twd6qh.js → chunk-ezvtkbp9.js} +2 -2
- package/dist/{chunk-a4twd6qh.js.map → chunk-ezvtkbp9.js.map} +1 -1
- package/dist/{chunk-h19qtrg9.js → chunk-f52maa9b.js} +2 -2
- package/dist/{chunk-h19qtrg9.js.map → chunk-f52maa9b.js.map} +1 -1
- package/dist/{chunk-nfbf388w.js → chunk-f9c8bnzx.js} +3 -3
- package/dist/{chunk-nfbf388w.js.map → chunk-f9c8bnzx.js.map} +2 -2
- package/dist/{chunk-bwg7genv.js → chunk-fq5b1k4n.js} +2 -2
- package/dist/{chunk-bwg7genv.js.map → chunk-fq5b1k4n.js.map} +1 -1
- package/dist/{chunk-dvw8cr6n.js → chunk-gc9g7c4p.js} +3 -3
- package/dist/{chunk-dvw8cr6n.js.map → chunk-gc9g7c4p.js.map} +1 -1
- package/dist/{chunk-sq5ytcpd.js → chunk-jeq8wvj6.js} +2 -2
- package/dist/{chunk-sq5ytcpd.js.map → chunk-jeq8wvj6.js.map} +1 -1
- package/dist/{chunk-vw57atx4.js → chunk-jma5d7zd.js} +3 -3
- package/dist/{chunk-vw57atx4.js.map → chunk-jma5d7zd.js.map} +1 -1
- package/dist/{chunk-nsxw6v2b.js → chunk-jmsfkzav.js} +2 -2
- package/dist/{chunk-nsxw6v2b.js.map → chunk-jmsfkzav.js.map} +1 -1
- package/dist/chunk-js9rm7g0.js +4 -0
- package/dist/{chunk-02s440vh.js.map → chunk-js9rm7g0.js.map} +2 -2
- package/dist/{chunk-6t9n4qdm.js → chunk-k1gt7fgy.js} +3 -3
- package/dist/{chunk-6t9n4qdm.js.map → chunk-k1gt7fgy.js.map} +1 -1
- package/dist/{chunk-cbmne0wt.js → chunk-k62338g2.js} +2 -2
- package/dist/{chunk-cbmne0wt.js.map → chunk-k62338g2.js.map} +1 -1
- package/dist/{chunk-05k9201j.js → chunk-k9882kqg.js} +2 -2
- package/dist/{chunk-05k9201j.js.map → chunk-k9882kqg.js.map} +1 -1
- package/dist/{chunk-bzaespn5.js → chunk-n26atakz.js} +3 -3
- package/dist/{chunk-bzaespn5.js.map → chunk-n26atakz.js.map} +1 -1
- package/dist/{chunk-vbdy4k14.js → chunk-n3kg99yw.js} +3 -3
- package/dist/{chunk-vbdy4k14.js.map → chunk-n3kg99yw.js.map} +1 -1
- package/dist/{chunk-c6v3sjvh.js → chunk-n5k42dh7.js} +3 -3
- package/dist/{chunk-c6v3sjvh.js.map → chunk-n5k42dh7.js.map} +1 -1
- package/dist/chunk-p2nqksdq.js +10 -0
- package/dist/{chunk-ht5mq6ev.js.map → chunk-p2nqksdq.js.map} +2 -2
- package/dist/{chunk-mvd4mc8p.js → chunk-p9pwskv6.js} +2 -2
- package/dist/{chunk-mvd4mc8p.js.map → chunk-p9pwskv6.js.map} +1 -1
- package/dist/{chunk-14dtbk7d.js → chunk-phvvxv1a.js} +3 -3
- package/dist/{chunk-14dtbk7d.js.map → chunk-phvvxv1a.js.map} +1 -1
- package/dist/chunk-pq15dt8j.js +46 -0
- package/dist/chunk-pq15dt8j.js.map +27 -0
- package/dist/{chunk-q05648ac.js → chunk-ptpzh61m.js} +3 -3
- package/dist/{chunk-q05648ac.js.map → chunk-ptpzh61m.js.map} +1 -1
- package/dist/{chunk-nkasdjx2.js → chunk-qcrj4t72.js} +3 -3
- package/dist/{chunk-nkasdjx2.js.map → chunk-qcrj4t72.js.map} +1 -1
- package/dist/{chunk-bfhcx1ca.js → chunk-re9ac4tc.js} +27 -27
- package/dist/{chunk-bfhcx1ca.js.map → chunk-re9ac4tc.js.map} +7 -6
- package/dist/{chunk-q093ph67.js → chunk-rr8bzm6k.js} +2 -2
- package/dist/{chunk-q093ph67.js.map → chunk-rr8bzm6k.js.map} +1 -1
- package/dist/{chunk-gm34n6da.js → chunk-s5hdrpam.js} +3 -3
- package/dist/{chunk-gm34n6da.js.map → chunk-s5hdrpam.js.map} +1 -1
- package/dist/{chunk-k0220nam.js → chunk-s6bq91cm.js} +2 -2
- package/dist/{chunk-k0220nam.js.map → chunk-s6bq91cm.js.map} +1 -1
- package/dist/{chunk-gz2ekvd6.js → chunk-s6wj8e56.js} +2 -2
- package/dist/{chunk-gz2ekvd6.js.map → chunk-s6wj8e56.js.map} +2 -2
- package/dist/{chunk-vt0vybw8.js → chunk-vsd5h2d9.js} +3 -3
- package/dist/{chunk-vt0vybw8.js.map → chunk-vsd5h2d9.js.map} +1 -1
- package/dist/{chunk-a1cwr0wh.js → chunk-w3mc696j.js} +2 -2
- package/dist/{chunk-a1cwr0wh.js.map → chunk-w3mc696j.js.map} +1 -1
- package/dist/{chunk-811qpkzd.js → chunk-wn4j741t.js} +2 -2
- package/dist/{chunk-811qpkzd.js.map → chunk-wn4j741t.js.map} +1 -1
- package/dist/{chunk-xmy09pr9.js → chunk-wxyxnbh6.js} +4 -4
- package/dist/{chunk-xmy09pr9.js.map → chunk-wxyxnbh6.js.map} +1 -1
- package/dist/{chunk-tp37k8c0.js → chunk-x244kqcc.js} +2 -2
- package/dist/{chunk-tp37k8c0.js.map → chunk-x244kqcc.js.map} +1 -1
- package/dist/chunk-x26jb60f.js +4 -0
- package/dist/{chunk-z7wchajg.js.map → chunk-x26jb60f.js.map} +2 -2
- package/dist/{chunk-4ehzm7p1.js → chunk-xvk6aqd7.js} +3 -3
- package/dist/{chunk-4ehzm7p1.js.map → chunk-xvk6aqd7.js.map} +1 -1
- package/dist/chunk-xwqdh388.js +5 -0
- package/dist/chunk-xwqdh388.js.map +13 -0
- package/dist/{chunk-56b6m0d4.js → chunk-y45whafz.js} +2 -2
- package/dist/{chunk-56b6m0d4.js.map → chunk-y45whafz.js.map} +1 -1
- package/dist/{chunk-q8a7ncvs.js → chunk-y5kfqq4f.js} +2 -2
- package/dist/{chunk-q8a7ncvs.js.map → chunk-y5kfqq4f.js.map} +1 -1
- package/dist/chunk-ybcdxrqx.js +4 -0
- package/dist/{chunk-wqphnrej.js.map → chunk-ybcdxrqx.js.map} +2 -2
- package/dist/{chunk-7nmbzdys.js → chunk-yrbvfda9.js} +1 -1
- package/dist/{chunk-wc3q88a2.js → chunk-yykrvrpt.js} +1 -1
- package/dist/{chunk-fxvqtwte.js → chunk-zk1vwwv6.js} +2 -2
- package/dist/{chunk-fxvqtwte.js.map → chunk-zk1vwwv6.js.map} +1 -1
- package/dist/chunks/{RealtimeClient-BnNSz8AK.js → RealtimeClient-CLXePUcE.js} +2 -2
- package/dist/chunks/{RealtimeClient-BnNSz8AK.js.map → RealtimeClient-CLXePUcE.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-CoQ-vnvy.js → ThemeProvider-COjYIalw.js} +74 -1273
- package/dist/chunks/ThemeProvider-COjYIalw.js.map +1 -0
- package/dist/chunks/{fetchFileRequest-Bhp0oJ0T.js → fetchFileRequest-BaufNZpI.js} +2 -2
- package/dist/chunks/{fetchFileRequest-Bhp0oJ0T.js.map → fetchFileRequest-BaufNZpI.js.map} +1 -1
- package/dist/chunks/{live-Dt8sq9W4.js → live-Dz_rk7fm.js} +4 -15
- package/dist/chunks/{live-Dt8sq9W4.js.map → live-Dz_rk7fm.js.map} +1 -1
- package/dist/chunks/{mutationExtras-ChOGPZlY.js → mutationExtras-DtSw6BcX.js} +2 -2
- package/dist/chunks/{mutationExtras-ChOGPZlY.js.map → mutationExtras-DtSw6BcX.js.map} +1 -1
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/{subscriptionStream-DDl_H-QM.js → subscriptionStream-CqhJOfPn.js} +2 -2
- package/dist/chunks/{subscriptionStream-DDl_H-QM.js.map → subscriptionStream-CqhJOfPn.js.map} +1 -1
- package/dist/chunks/urlpattern-polyfill-Cc7YrzJf.js +913 -0
- package/dist/chunks/urlpattern-polyfill-Cc7YrzJf.js.map +1 -0
- package/dist/client/ClientRouter.d.ts +1 -1
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/ClientRouterContext.d.ts +1 -1
- package/dist/client/ClientRouterContext.d.ts.map +1 -1
- package/dist/client/browserHistory.d.ts +13 -0
- package/dist/client/browserHistory.d.ts.map +1 -0
- package/dist/client/index.js +9 -6
- package/dist/client/index.js.map +1 -1
- package/dist/client/init.d.ts.map +1 -1
- package/dist/client/scrollRestoration.d.ts +1 -1
- package/dist/client/scrollRestoration.d.ts.map +1 -1
- package/dist/client/urlPattern.d.ts +30 -0
- package/dist/client/urlPattern.d.ts.map +1 -0
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/DB.d.ts +10 -0
- package/dist/facades/DB.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +2 -2
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/Model.d.ts.map +1 -1
- package/dist/orm/context.d.ts +54 -0
- package/dist/orm/context.d.ts.map +1 -1
- package/dist/orm/index.d.ts +1 -1
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +4 -4
- package/dist/orm/index.js.map +3 -3
- package/dist/probe/index.js +2 -2
- package/dist/probe/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +2 -2
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts +1 -0
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +234 -2
- package/dist/testing/index.js.map +1 -1
- package/dist/vitest/index.js +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-02s440vh.js +0 -4
- package/dist/chunk-3e19n0f2.js +0 -4
- package/dist/chunk-4fw84bh6.js +0 -15
- package/dist/chunk-70qqpvd9.js +0 -24
- package/dist/chunk-9mhr0kwd.js +0 -5
- package/dist/chunk-ht5mq6ev.js +0 -10
- package/dist/chunk-rczmh97n.js +0 -9
- package/dist/chunk-rczmh97n.js.map +0 -10
- package/dist/chunk-tkskgvhc.js +0 -4
- package/dist/chunk-v325k8qj.js +0 -46
- package/dist/chunk-v325k8qj.js.map +0 -31
- package/dist/chunk-wqphnrej.js +0 -4
- package/dist/chunk-z7wchajg.js +0 -4
- package/dist/chunk-z97tptd1.js +0 -6
- package/dist/chunks/ThemeProvider-CoQ-vnvy.js.map +0 -1
- /package/dist/{chunk-95re1b2y.js.map → chunk-1kehwa3s.js.map} +0 -0
- /package/dist/{chunk-zvhks9s7.js.map → chunk-8pw4zjnx.js.map} +0 -0
- /package/dist/{chunk-7nmbzdys.js.map → chunk-yrbvfda9.js.map} +0 -0
- /package/dist/{chunk-wc3q88a2.js.map → chunk-yykrvrpt.js.map} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../ai/Schema.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * The schema layer for tool inputs, tool outputs and structured final answers.\n *\n * Two things have to come out of one declaration: a TypeScript type, so\n * `execute(input)` is typed at the call site and the result is typed in the\n * browser, and a JSON Schema, because that is what the model is actually shown.\n * A phantom `Schema<T>` gives the first and nothing of the second, and a\n * hand-written JSON Schema next to a hand-written type gives both and lets them\n * drift. So the builder below is the single source, and `Infer` reads the type\n * back off it.\n *\n * Everything here is deliberately narrower than JSON Schema. OpenAI's strict\n * structured output only accepts a subset — every property listed in\n * `required`, `additionalProperties: false` on every object, no patterns, no\n * `oneOf` at the root — and a builder that cannot express the rejected parts is\n * better than one that lets you write a schema the API refuses at runtime.\n *\n * `json()` is the one deliberate hole in that, for the formats strict mode\n * cannot describe at all: a record with arbitrary keys, a mixed-type tuple. It\n * does not widen the subset — it turns strict mode off for the schema containing\n * it, which `supportsStrict` reads back off the tree so that no caller has to\n * remember to.\n *\n * A document that nests into itself is NOT one of those: strict mode accepts\n * `$defs` + `$ref`, and `recursive()` emits exactly that (#745).\n */\n\nexport type JSONSchema = {\n type?: string | string[];\n description?: string;\n enum?: readonly (string | number)[];\n const?: string | number | boolean;\n properties?: Record<string, JSONSchema>;\n required?: readonly string[];\n additionalProperties?: false;\n items?: JSONSchema;\n anyOf?: readonly JSONSchema[];\n /**\n * `#/$defs/<name>`, pointing at an entry of the root's `$defs`. Emitted by\n * `s.recursive` and never with a sibling keyword: OpenAI's strict mode\n * refuses `{ $ref, description }`, so a described or nullable reference is\n * wrapped in an `anyOf` instead.\n */\n $ref?: string;\n /** Only ever on the root: every `s.recursive` the schema reaches, by name. */\n $defs?: Record<string, JSONSchema>;\n};\n\n/**\n * Any value JSON can carry. The default output type of `json()`, and the\n * annotation an app reaches for when it hands one of those values on.\n */\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonValue[]\n | { [key: string]: JsonValue };\n\ndeclare const OUTPUT: unique symbol;\ndeclare const OPTIONAL: unique symbol;\n\n/**\n * `T` is carried in a phantom property rather than a real one: it exists only\n * for inference, and a real field would show up on the object the app writes.\n */\nexport interface Schema<T> {\n readonly [OUTPUT]: T;\n /** The JSON Schema handed to the provider. */\n toJSONSchema(): JSONSchema;\n /**\n * Parses a value coming back from the model. Tool arguments arrive as a JSON\n * string the model generated, so they are untrusted in exactly the way a\n * request body is: shape-checked before `execute` ever sees them.\n */\n parse(value: unknown): T;\n safeParse(value: unknown): { ok: true; value: T } | { ok: false; errors: string[] };\n}\n\n/**\n * A schema whose key may be left out of the object containing it.\n *\n * Marked with a property rather than detected from the output type, because\n * `undefined extends T` — the obvious test — is true of *everything* when\n * `strictNullChecks` is off, which is how this package and plenty of apps\n * compile. That version made every field of every tool optional, and did it\n * quietly: the JSON Schema was still right, so only the TypeScript types lied.\n */\nexport interface OptionalSchema<T> extends Schema<T | undefined> {\n readonly [OPTIONAL]: true;\n}\n\nexport type AnySchema = Schema<any>;\n\nexport type Infer<S> = S extends Schema<infer T> ? T : never;\n\n/**\n * Collapses a type into one flat object.\n *\n * `ShapeOutput` builds its result as an intersection of two mapped types, one\n * required and one optional, and that intersection is what every hover, every\n * error message and every type assertion would otherwise show. The difference\n * is between an app reading `{ command: string; cwd?: string }` and reading two\n * mapped types joined by an ampersand.\n *\n * It also drops `readonly`, which the mapped types copy from the shape literal\n * — `s.object({ ... })` infers that literal as `const` to keep the keys, and a\n * tool has no reason to receive an immutable input because of how its schema\n * was written down.\n */\ntype Flatten<T> = { -readonly [K in keyof T]: T[K] };\n\ntype ShapeOutput<S extends Record<string, AnySchema>> = Flatten<\n {\n [K in keyof S as S[K] extends OptionalSchema<any> ? never : K]: Infer<S[K]>;\n } & {\n [K in keyof S as S[K] extends OptionalSchema<any> ? K : never]?: Infer<S[K]>;\n }\n>;\n\ninterface SchemaBuilder<T> extends Schema<T> {\n /**\n * The description is not documentation — it is the only prose the model gets\n * about a field, and it is the difference between a tool that is called\n * correctly and one that is not.\n */\n describe(description: string): this;\n /**\n * Strict mode has no notion of an omitted key: every property must appear in\n * `required`. So `optional()` emits a nullable union and the model is told to\n * send `null`, while the TypeScript type says `| undefined` and the parsed\n * value drops the key. The asymmetry is the point — it is what lets an app\n * write ordinary optional fields against an API that forbids them.\n */\n optional(): OptionalSchemaBuilder<T>;\n nullable(): SchemaBuilder<T | null>;\n /**\n * `safeParse` with the failures as structured issues rather than sentences:\n * each one names the path it is about, a JSON Schema keyword as its `code`\n * and the keyword's argument in `params`. For an app that validates a value\n * against a schema itself — a form, a stored record — and wants to word or\n * group the problems per field. All failures are reported, not the first.\n */\n validate(value: unknown): { ok: true; value: T } | { ok: false; issues: SchemaIssue[] };\n}\n\n/**\n * One reason a value failed `validate`.\n *\n * `code` is the JSON Schema keyword the value broke — the same names Ajv puts\n * on its `keyword` — so a mapping written against one reads the other:\n *\n * - `required`: the key is missing (`path` ends in it).\n * - `type`: the wrong kind of value, an integer that isn't whole, or a value\n * that isn't JSON at all.\n * - `const`, `enum`: a literal or a choice that didn't match (`params.allowedValues`).\n * - `minLength`, `maxLength`, `minimum`, `maximum`, `exclusiveMinimum`,\n * `exclusiveMaximum`, `minItems`, `maxItems`: `params.limit` is the bound.\n * - `format`: `params.format` names the format the string failed.\n * - `anyOf`: no union member matched; `message` names the closest one's problems.\n * - `additionalProperties`: a key the object doesn't declare, reported only by\n * a schema built with `s.fromJSONSchema(schema, { unknownKeys: \"error\" })`.\n * `path` ends in the key (Ajv's `instancePath` stops at the object), and\n * `params.additionalProperty` is the key, as in Ajv.\n *\n * `message` is the sentence `safeParse` reports for it, without the path.\n */\nexport type SchemaIssueCode =\n | \"required\"\n | \"type\"\n | \"const\"\n | \"enum\"\n | \"anyOf\"\n | \"minLength\"\n | \"maxLength\"\n | \"minimum\"\n | \"maximum\"\n | \"exclusiveMinimum\"\n | \"exclusiveMaximum\"\n | \"minItems\"\n | \"maxItems\"\n | \"format\"\n | \"additionalProperties\";\n\nexport type SchemaIssue = {\n /** Keys and array indices from the root, `[]` for the root itself. */\n path: (string | number)[];\n code: SchemaIssueCode;\n message: string;\n params: Record<string, unknown>;\n};\n\ninterface OptionalSchemaBuilder<T> extends SchemaBuilder<T | undefined>, OptionalSchema<T> {}\n\n// --- the runtime ---------------------------------------------------------\n\n/**\n * What a builder actually is. `optional` and `nullable` are flags rather than\n * wrapper nodes so that `.nullable().optional()` cannot nest into something\n * whose emitted shape depends on which order they were called in.\n */\ntype Definition = {\n node: SchemaNode;\n description?: string;\n optional: boolean;\n nullable: boolean;\n};\n\n/**\n * The constraints `s.fromJSONSchema` can carry over from a JSON Schema. None of\n * the builders set them; they exist so that a schema read from data validates\n * what it says it does.\n *\n * They are CHECKED, NOT EMITTED as keywords. Strict structured output refuses\n * most of them (`minLength`, `maxLength`, `minimum` on Anthropic; any `format`\n * outside a short list on both), so the model is told them in the field's\n * description instead, and `parse` enforces them — a model that ignores the\n * prose gets an `invalid_tool_input` it can correct, the same as a wrong type.\n */\ntype StringChecks = {\n minLength?: number;\n maxLength?: number;\n format?: { name: string; test: (value: string) => boolean };\n};\n\ntype NumberChecks = {\n integer?: boolean;\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: number;\n exclusiveMaximum?: number;\n};\n\ntype ArrayChecks = { minItems?: number; maxItems?: number };\n\ntype SchemaNode =\n | { kind: \"string\"; checks?: StringChecks }\n | { kind: \"number\"; checks?: NumberChecks }\n | { kind: \"boolean\" }\n | { kind: \"literal\"; value: string | number | boolean }\n | { kind: \"enum\"; values: readonly string[]; checks?: StringChecks }\n /**\n * `unknownKeys` is what parsing does with a key `shape` doesn't declare:\n * absent is \"strip\", the default and the only thing the builders make. Only\n * `s.fromJSONSchema` sets the others. Emission ignores it: every object is\n * sent with `additionalProperties: false` either way.\n */\n | { kind: \"object\"; shape: Record<string, Definition>; unknownKeys?: \"error\" | \"passthrough\" }\n | { kind: \"array\"; item: Definition; checks?: ArrayChecks }\n | { kind: \"union\"; members: readonly Definition[] }\n /** Constrains nothing. The node strict mode has no spelling for. */\n | { kind: \"json\" }\n /**\n * A use of an `s.recursive` schema — its `self`, or the builder it returned.\n * Emitted as a `$ref` into the root's `$defs`, read by following the cell.\n */\n | { kind: \"ref\"; cell: RecursiveCell };\n\n/**\n * One `s.recursive` declaration. `definition` is filled in once the callback\n * returns; until then `self` is a reference to something that does not exist\n * yet, which is the whole trick.\n *\n * `active` is the set of values being read through this cell right now, the\n * cycle guard for a JavaScript value that contains itself (a tool output an app\n * built). Per cell rather than global, so that one value read through two\n * different recursive schemas in a row is not mistaken for a cycle.\n */\ntype RecursiveCell = {\n name: string;\n definition?: Definition;\n active: Set<object>;\n};\n\nfunction bodyOf(cell: RecursiveCell): Definition {\n if (!cell.definition) {\n throw new Error(\n `gemi/ai: the recursive schema \"${cell.name}\" was used before its definition returned; \\`self\\` can be nested into the schema, but not parsed or emitted inside the callback`,\n );\n }\n return cell.definition;\n}\n\ntype ParseResult = { ok: true; value: unknown } | { ok: false; errors: string[] };\n\ntype Path = (string | number)[];\n\n/** The public interface with the phantoms and the generic taken off. */\ninterface RuntimeSchema {\n toJSONSchema(): JSONSchema;\n parse(value: unknown): unknown;\n safeParse(value: unknown): ParseResult;\n validate(value: unknown): { ok: true; value: unknown } | { ok: false; issues: SchemaIssue[] };\n describe(description: string): RuntimeSchema;\n optional(): RuntimeSchema;\n nullable(): RuntimeSchema;\n}\n\n/**\n * Definitions hang off the builders here rather than on the builders\n * themselves: a property, however obscurely named, is a property an app can\n * see, serialise or accidentally depend on, and `Schema<T>` promises exactly\n * three methods.\n */\nconst definitions = new WeakMap<object, Definition>();\n\n/**\n * Whether `value` is a schema built with `s`. How `HttpRequest` tells an `s`\n * body schema from a map of rules (#711), without a property on the builder.\n */\nexport function isSchema(value: unknown): value is SchemaBuilder<unknown> {\n return typeof value === \"object\" && value !== null && definitions.has(value);\n}\n\nfunction definitionOf(schema: AnySchema): Definition {\n const definition = definitions.get(schema);\n if (!definition) {\n throw new Error(\"gemi/ai: expected a schema built with `s`, got a foreign object\");\n }\n return definition;\n}\n\n// --- emitting ------------------------------------------------------------\n\n/**\n * What one `toJSONSchema()` call collects on its way down: the `$defs` the\n * root will carry, and which cell owns each name in them.\n */\ntype EmitContext = {\n defs: Record<string, JSONSchema>;\n cells: Map<string, RecursiveCell>;\n};\n\n/**\n * The schema as the provider sees it: the tree, plus `$defs` at the root when\n * an `s.recursive` is anywhere in it.\n *\n * A recursive schema used AS the root is inlined there, and its `$defs` entry\n * is a second copy of the same body. Pointing the root at itself with\n * `\"$ref\": \"#\"` would be shorter, and OpenAI accepts it, but `#` means \"the\n * whole document\" — and a document that gets merged into (MCP's\n * `combineSchemas` adds properties to an input's root) would then demand the\n * merged-in fields at every level of the tree.\n */\nfunction emitRoot(definition: Definition): JSONSchema {\n const context: EmitContext = { defs: {}, cells: new Map() };\n let root = definition;\n if (definition.node.kind === \"ref\") {\n const body = bodyOf(definition.node.cell);\n root = {\n ...body,\n ...(definition.description ? { description: definition.description } : {}),\n optional: definition.optional,\n nullable: definition.nullable || body.nullable,\n };\n }\n const schema = emit(root, context);\n return Object.keys(context.defs).length > 0 ? { ...schema, $defs: context.defs } : schema;\n}\n\nfunction emit(definition: Definition, context: EmitContext): JSONSchema {\n // A `json` node already admits every value there is, null included, so\n // widening it would only add an `anyOf` for the model to read past — and one\n // whose second branch is a strictly narrower repeat of its first.\n const widen = (definition.optional || definition.nullable) && definition.node.kind !== \"json\";\n let body = allowNull(emitNode(definition.node, context), widen);\n const description = [definition.description, hint(definition.node)].filter(Boolean).join(\" \");\n // `$ref` takes no siblings under strict mode, so a described reference\n // becomes a one-member `anyOf` that can carry the description beside it.\n if (description && body.$ref !== undefined) body = { anyOf: [body] };\n return description ? { description, ...body } : body;\n}\n\n/**\n * The checks a node carries, in words, for the description — the one place a\n * strict-mode provider lets them through. See `StringChecks`.\n */\nfunction hint(node: SchemaNode): string {\n const said: string[] = [];\n if (node.kind === \"string\" || node.kind === \"enum\") {\n const checks = node.checks;\n if (checks?.format) said.push(`Format: ${checks.format.name}.`);\n if (checks?.minLength !== undefined) said.push(`At least ${checks.minLength} characters.`);\n if (checks?.maxLength !== undefined) said.push(`At most ${checks.maxLength} characters.`);\n } else if (node.kind === \"number\") {\n const checks = node.checks;\n if (checks?.minimum !== undefined) said.push(`Minimum ${checks.minimum}.`);\n if (checks?.exclusiveMinimum !== undefined) {\n said.push(`Greater than ${checks.exclusiveMinimum}.`);\n }\n if (checks?.maximum !== undefined) said.push(`Maximum ${checks.maximum}.`);\n if (checks?.exclusiveMaximum !== undefined) said.push(`Less than ${checks.exclusiveMaximum}.`);\n } else if (node.kind === \"array\") {\n const checks = node.checks;\n if (checks?.minItems !== undefined) said.push(`At least ${checks.minItems} items.`);\n if (checks?.maxItems !== undefined) said.push(`At most ${checks.maxItems} items.`);\n }\n // A `ref` says nothing of its own: its body's hints are in its `$defs` entry.\n return said.join(\" \");\n}\n\nfunction emitNode(node: SchemaNode, context: EmitContext): JSONSchema {\n switch (node.kind) {\n case \"string\":\n return { type: \"string\" };\n case \"number\":\n // `integer` is in the strict subset of every provider gemi speaks to.\n return { type: node.checks?.integer ? \"integer\" : \"number\" };\n case \"boolean\":\n return { type: \"boolean\" };\n // `const` rather than a one-member `enum`, because a boolean literal has no\n // `enum` form and one branch that works for all three beats two that\n // disagree about what a literal is.\n case \"literal\":\n return { type: typeof node.value, const: node.value };\n case \"enum\":\n return { type: \"string\", enum: node.values };\n case \"array\":\n return { type: \"array\", items: emit(node.item, context) };\n case \"object\":\n return {\n type: \"object\",\n properties: Object.fromEntries(\n Object.entries(node.shape).map(([key, child]) => [key, emit(child, context)]),\n ),\n // Every declared property, optional ones included. This is the whole of\n // strict mode's bargain: the model is never allowed to omit a key, so\n // \"may be absent\" has to be spelled as \"may be null\" instead.\n required: Object.keys(node.shape),\n additionalProperties: false,\n };\n case \"union\":\n return { anyOf: node.members.map((member) => emit(member, context)) };\n // The empty schema, which is JSON Schema's own way of saying \"any value\" —\n // no `type` listing all seven, which reads as a constraint the model then\n // has to check itself. What the field actually is gets said in\n // `description`, the one channel a model reads either way.\n case \"json\":\n return {};\n case \"ref\": {\n const { cell } = node;\n const owner = context.cells.get(cell.name);\n if (owner && owner !== cell) {\n throw new Error(\n `gemi/ai: two different recursive schemas are named \"${cell.name}\" in one schema; give each s.recursive(...) its own name`,\n );\n }\n if (!owner) {\n // Claimed BEFORE the body is emitted: the body refers to itself, and\n // that inner reference has to find the name taken and stop here.\n context.cells.set(cell.name, cell);\n context.defs[cell.name] = {};\n context.defs[cell.name] = emit(bodyOf(cell), context);\n }\n return { $ref: `#/$defs/${cell.name}` };\n }\n }\n}\n\n/**\n * Widens a schema to admit `null` — for a `nullable()` field, and for the null\n * an `optional()` field tells the model to send in place of omitting the key.\n */\nfunction allowNull(base: JSONSchema, on: boolean): JSONSchema {\n if (!on) return base;\n // A union is already a list of alternatives; appending to it is flatter than\n // nesting an `anyOf` inside an `anyOf`, and reads the same to the model.\n if (base.anyOf) return { ...base, anyOf: [...base.anyOf, { type: \"null\" }] };\n // `enum` and `const` cannot carry the null themselves — `enum` here is\n // strings and numbers by declaration — so those get wrapped rather than\n // widened.\n if (base.enum || base.const !== undefined) return { anyOf: [base, { type: \"null\" }] };\n if (typeof base.type === \"string\") return { ...base, type: [base.type, \"null\"] };\n return { anyOf: [base, { type: \"null\" }] };\n}\n\n// --- parsing -------------------------------------------------------------\n\nfunction typeName(value: unknown): string {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"array\";\n return typeof value;\n}\n\n/**\n * What the value looked like. For a literal or an enum the *type* is usually\n * right and the value is wrong, and \"expected \\\"refund\\\", got string\" tells\n * whoever is reading the failed tool call nothing they did not know.\n */\nfunction saw(node: SchemaNode, value: unknown): string {\n if (typeof value === \"number\" && !Number.isFinite(value)) return String(value);\n if (node.kind === \"literal\" || node.kind === \"enum\") {\n const primitive =\n typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n if (primitive) return JSON.stringify(value);\n }\n return typeName(value);\n}\n\nfunction wanted(definition: Definition): string {\n const node = definition.node;\n const base = (() => {\n switch (node.kind) {\n case \"number\":\n return node.checks?.integer ? \"integer\" : \"number\";\n case \"string\":\n case \"boolean\":\n return node.kind;\n case \"literal\":\n return JSON.stringify(node.value);\n case \"enum\":\n return `one of ${node.values.map((v) => JSON.stringify(v)).join(\" | \")}`;\n case \"array\":\n return \"array\";\n case \"object\":\n return \"object\";\n case \"union\":\n return \"one of the variants\";\n case \"json\":\n return \"a JSON value\";\n case \"ref\":\n return wanted({ ...bodyOf(node.cell), optional: false, nullable: false });\n }\n })();\n return definition.optional || definition.nullable ? `${base} or null` : base;\n}\n\n/** `orders[2].total` — keys joined with dots, indices in brackets. */\nfunction formatPath(path: Path): string {\n let out = \"\";\n for (const segment of path) {\n out += typeof segment === \"number\" ? `[${segment}]` : out ? `.${segment}` : segment;\n }\n return out;\n}\n\n/** `orders[2].total: ` — empty at the root, where a prefix would be noise. */\nfunction at(path: Path): string {\n const text = formatPath(path);\n return text ? `${text}: ` : \"\";\n}\n\n/** The sentence `safeParse` reports for an issue. */\nfunction render(issue: SchemaIssue): string {\n return `${at(issue.path)}${issue.message}`;\n}\n\n/**\n * How well a value matches, used only to pick which union variant to blame.\n * A literal or an enum hit counts for far more than an ordinary field, because\n * that is what a discriminated union turns on: the variant whose `kind` matched\n * is the one the model meant, whatever else it got wrong.\n */\nfunction score(definition: Definition, value: unknown): number {\n if (value === null || value === undefined) {\n return definition.optional || definition.nullable ? 1 : 0;\n }\n const node = definition.node;\n switch (node.kind) {\n case \"string\":\n return typeof value === \"string\" ? 1 : 0;\n case \"number\":\n return typeof value === \"number\" ? 1 : 0;\n case \"boolean\":\n return typeof value === \"boolean\" ? 1 : 0;\n case \"literal\":\n return value === node.value ? 10 : 0;\n case \"enum\":\n return typeof value === \"string\" && node.values.includes(value) ? 10 : 0;\n case \"array\":\n return Array.isArray(value) ? 1 : 0;\n case \"object\": {\n if (typeof value !== \"object\" || Array.isArray(value)) return 0;\n const source = value as Record<string, unknown>;\n let total = 1;\n for (const [key, child] of Object.entries(node.shape)) {\n total += score(child, source[key]);\n }\n return total;\n }\n case \"union\":\n return node.members.reduce((best, member) => Math.max(best, score(member, value)), 0);\n // Matches, because it matches everything — but at the score of a plain\n // scalar, so a sibling variant that pinned its discriminant still wins the\n // blame.\n //\n // Reached only when no member parsed, which for a `json` member means the\n // value is not JSON at all: a function, a bigint, a cycle. Then this is\n // what makes the report name the reason the value was refused rather than\n // the discriminant of a variant the model was never aiming at.\n case \"json\":\n return 1;\n case \"ref\":\n return through(\n node.cell,\n value,\n () => 1,\n () => score(bodyOf(node.cell), value),\n );\n }\n}\n\n/**\n * Runs `walk` with `value` marked as being read through `cell`, or `cycle` when\n * it already is. A value can only meet the same cell again further down by\n * containing itself — `s.recursive` refuses a body that reaches `self` without\n * an object or array in between — so this is exactly the cycle guard, and a\n * value that merely appears twice side by side is read twice.\n */\nfunction through<R>(cell: RecursiveCell, value: unknown, cycle: () => R, walk: () => R): R {\n if (typeof value !== \"object\" || value === null) return walk();\n if (cell.active.has(value)) return cycle();\n cell.active.add(value);\n try {\n return walk();\n } finally {\n cell.active.delete(value);\n }\n}\n\n/** `drop` is a key that should not appear in the parsed object at all. */\ntype Reading = { drop: boolean; value: unknown };\n\nfunction read(definition: Definition, value: unknown, path: Path, issues: SchemaIssue[]): Reading {\n // `optional` is checked before `nullable`, so a schema that is both treats\n // null as \"absent\". They are not distinguishable on the wire: strict mode\n // gives the model one spelling for \"nothing\", and pretending otherwise would\n // mean `.nullable().optional()` silently kept a key the type says is\n // optional. What that trades away is the ability to say \"present and null\" on\n // a field that may also be absent — a distinction no model can express here.\n if (definition.optional && (value === null || value === undefined)) {\n return { drop: true, value: undefined };\n }\n if (definition.nullable && value === null) return { drop: false, value: null };\n return { drop: false, value: readNode(definition, value, path, issues) };\n}\n\nfunction readNode(\n definition: Definition,\n value: unknown,\n path: Path,\n issues: SchemaIssue[],\n): unknown {\n const node = definition.node;\n const fail = () => {\n const code: SchemaIssueCode =\n value === undefined\n ? \"required\"\n : node.kind === \"literal\"\n ? \"const\"\n : node.kind === \"enum\" && typeof value === \"string\"\n ? \"enum\"\n : \"type\";\n const params =\n code === \"const\"\n ? { allowedValue: (node as { value: unknown }).value }\n : code === \"enum\"\n ? { allowedValues: (node as { values: readonly string[] }).values }\n : {};\n issues.push({\n path,\n code,\n message: `expected ${wanted(definition)}, got ${saw(node, value)}`,\n params,\n });\n return undefined;\n };\n\n switch (node.kind) {\n case \"string\":\n if (typeof value !== \"string\") return fail();\n checkString(node.checks, value, path, issues);\n return value;\n case \"number\":\n // NaN and Infinity do not survive `JSON.stringify`, so a tool that\n // returns one produces a body the provider cannot be sent.\n if (typeof value !== \"number\" || !Number.isFinite(value)) return fail();\n if (node.checks?.integer && !Number.isInteger(value)) return fail();\n checkNumber(node.checks, value, path, issues);\n return value;\n case \"boolean\":\n return typeof value === \"boolean\" ? value : fail();\n case \"literal\":\n return value === node.value ? value : fail();\n case \"enum\":\n if (typeof value !== \"string\" || !node.values.includes(value)) return fail();\n checkString(node.checks, value, path, issues);\n return value;\n case \"array\": {\n if (!Array.isArray(value)) return fail();\n const items = value.map((item, index) => {\n const element = read(node.item, item, [...path, index], issues);\n return element.drop ? undefined : element.value;\n });\n const { minItems, maxItems } = node.checks ?? {};\n if (minItems !== undefined && value.length < minItems) {\n issues.push({\n path,\n code: \"minItems\",\n message: `expected at least ${minItems} items, got ${value.length}`,\n params: { limit: minItems },\n });\n }\n if (maxItems !== undefined && value.length > maxItems) {\n issues.push({\n path,\n code: \"maxItems\",\n message: `expected at most ${maxItems} items, got ${value.length}`,\n params: { limit: maxItems },\n });\n }\n return items;\n }\n case \"object\": {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return fail();\n const source = value as Record<string, unknown>;\n const output: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(node.shape)) {\n const element = read(child, source[key], [...path, key], issues);\n if (!element.drop) output[key] = element.value;\n }\n // By default unknown keys are DROPPED, not rejected. `additionalProperties:\n // false` has already told the model not to send them, so one arriving\n // anyway is a slip rather than an attack, and failing a whole tool call\n // over a stray field costs a turn to fix nothing. Dropping is also what\n // keeps `execute` from ever seeing a field its input type says cannot be\n // there.\n //\n // A schema read from data can ask otherwise (#753): a form submission\n // with a field the form doesn't have is a bot or a stale page, and\n // dropping it loses what the visitor typed without telling them.\n if (node.unknownKeys) {\n for (const key of Object.keys(source)) {\n // `undefined` is absent, the same as for `required`: JSON cannot\n // carry it, and `JSON.stringify` leaves the key out.\n if (Object.hasOwn(node.shape, key) || source[key] === undefined) continue;\n if (node.unknownKeys === \"error\") {\n issues.push({\n path: [...path, key],\n code: \"additionalProperties\",\n message: \"unknown key\",\n params: { additionalProperty: key },\n });\n continue;\n }\n // Kept as it came, checked only for being JSON — there is no schema\n // to read it with. Defined rather than assigned, so that a\n // `__proto__` key from `JSON.parse` stays a key instead of setting\n // the output's prototype.\n checkJson(source[key], [...path, key], issues, new Set());\n Object.defineProperty(output, key, {\n value: source[key],\n enumerable: true,\n writable: true,\n configurable: true,\n });\n }\n }\n return output;\n }\n case \"union\": {\n let best: { issues: SchemaIssue[]; score: number } | undefined;\n for (const member of node.members) {\n const attempt: SchemaIssue[] = [];\n const element = read(member, value, path, attempt);\n if (attempt.length === 0) return element.drop ? undefined : element.value;\n const points = score(member, value);\n if (!best || points > best.score) best = { issues: attempt, score: points };\n }\n // \"no match\" is useless when one field of a five-field variant was wrong.\n // Naming the closest variant and why it stopped is the difference between\n // a debuggable bad tool call and a shrug.\n issues.push({\n path,\n code: \"anyOf\",\n message: `no matching variant; closest: ${best!.issues.map(render).join(\"; \")}`,\n params: { closest: best!.issues },\n });\n return undefined;\n }\n // Passed through by reference, not rebuilt. Two reasons beyond the obvious\n // one: a rebuild would turn a `Date` into `{}` by copying own properties\n // that a `toJSON` was going to replace anyway, and the agent loop signs the\n // *parsed* input and later verifies the signature against it — a parse that\n // is exactly the identity cannot disagree with itself.\n case \"json\":\n if (value === undefined) return fail();\n checkJson(value, path, issues, new Set());\n return value;\n // The reference's own `optional`/`nullable` were settled by `read` above;\n // the body's are its own business, settled by the `read` below.\n case \"ref\":\n return through(\n node.cell,\n value,\n () => {\n issues.push({\n path,\n code: \"type\",\n message: \"expected a finite tree, got a circular reference\",\n params: {},\n });\n return undefined;\n },\n () => read(bodyOf(node.cell), value, path, issues).value,\n );\n }\n}\n\n/**\n * Length in code points, not UTF-16 units — what JSON Schema (and Ajv) count,\n * so an emoji is one character against a `maxLength` either way.\n */\nfunction length(value: string): number {\n let count = 0;\n for (const _ of value) count++;\n return count;\n}\n\nfunction checkString(\n checks: StringChecks | undefined,\n value: string,\n path: Path,\n issues: SchemaIssue[],\n): void {\n if (!checks) return;\n const { minLength, maxLength, format } = checks;\n if (minLength !== undefined || maxLength !== undefined) {\n const size = length(value);\n if (minLength !== undefined && size < minLength) {\n issues.push({\n path,\n code: \"minLength\",\n message: `expected at least ${minLength} characters, got ${size}`,\n params: { limit: minLength },\n });\n }\n if (maxLength !== undefined && size > maxLength) {\n issues.push({\n path,\n code: \"maxLength\",\n message: `expected at most ${maxLength} characters, got ${size}`,\n params: { limit: maxLength },\n });\n }\n }\n if (format) {\n let ok = false;\n try {\n ok = format.test(value) === true;\n } catch {\n // A check that throws has not said yes.\n }\n if (!ok) {\n issues.push({\n path,\n code: \"format\",\n message: `expected a string in format \"${format.name}\"`,\n params: { format: format.name },\n });\n }\n }\n}\n\nfunction checkNumber(\n checks: NumberChecks | undefined,\n value: number,\n path: Path,\n issues: SchemaIssue[],\n): void {\n if (!checks) return;\n const bound = (\n code: SchemaIssueCode,\n limit: number | undefined,\n passes: (limit: number) => boolean,\n words: string,\n ) => {\n if (limit === undefined || passes(limit)) return;\n issues.push({\n path,\n code,\n message: `expected ${words} ${limit}, got ${value}`,\n params: { limit },\n });\n };\n bound(\"minimum\", checks.minimum, (limit) => value >= limit, \"at least\");\n bound(\"exclusiveMinimum\", checks.exclusiveMinimum, (limit) => value > limit, \"more than\");\n bound(\"maximum\", checks.maximum, (limit) => value <= limit, \"at most\");\n bound(\"exclusiveMaximum\", checks.exclusiveMaximum, (limit) => value < limit, \"less than\");\n}\n\n/**\n * Checks that a value is JSON, which is the only check a `json()` node makes.\n *\n * Tool arguments arrive through `JSON.parse`, so this never fires on model\n * input. It fires on a tool *output* or a structured answer an app built, where\n * a `bigint` or a cycle throws inside `JSON.stringify` and a function or a\n * `symbol` is dropped without a word — one turn later, with the provider's\n * request body to debug instead of the value.\n *\n * `undefined` and non-plain objects are deliberately allowed below the root:\n * `JSON.stringify` drops an `undefined` property, writes `null` for an\n * `undefined` element, and calls `toJSON` where there is one. Those are JSON's\n * own answers, and rejecting a `Date` to catch a `Map` is a bad trade.\n *\n * `toJSON` is honoured rather than assumed harmless: the walk checks what it\n * returns and never the object behind it, because that is all `JSON.stringify`\n * will look at.\n */\nfunction checkJson(\n value: unknown,\n path: Path,\n issues: SchemaIssue[],\n seen: Set<object>,\n // False for the value a `toJSON` just returned: `JSON.stringify` applies\n // `toJSON` once per position, and re-applying it is how a pair of them\n // returning each other became an infinite loop.\n applyToJSON = true,\n): void {\n const reject = (what: string) => {\n issues.push({ path, code: \"type\", message: `expected a JSON value, got ${what}`, params: {} });\n };\n\n switch (typeof value) {\n case \"undefined\":\n case \"string\":\n case \"boolean\":\n return;\n case \"number\":\n if (!Number.isFinite(value)) reject(String(value));\n return;\n case \"bigint\":\n return reject(\"a bigint\");\n case \"function\":\n return reject(\"a function\");\n case \"symbol\":\n return reject(\"a symbol\");\n }\n\n if (value === null) return;\n const object = value as object;\n\n // The cycle guard comes FIRST, above `toJSON`, and that ordering is the whole\n // of it: a `toJSON` is arbitrary code that can hand back another object with a\n // `toJSON` of its own, so two of them returning each other is a cycle that\n // `seen` catches and an identity test cannot. Below the guard, that pair hung\n // `safeParse` forever — and a `toJSON` returning a fresh object each time threw\n // `RangeError` out of a function documented to return `{ ok: false, errors }`.\n if (seen.has(object)) return reject(\"a circular reference\");\n seen.add(object);\n try {\n // `JSON.stringify` asks `toJSON` what to write and never looks at the object\n // itself, so that answer is what has to be checked. Without this the walk\n // descended into the wrapper's own fields and refused values `stringify`\n // serializes without complaint — a `toJSON` returning a string off a `bigint`\n // field being the archetype, since writing a `toJSON` is exactly what one\n // does about a field JSON cannot carry. `Date` passed only by having no own\n // enumerable properties to trip over.\n const toJSON = applyToJSON ? (object as { toJSON?: unknown }).toJSON : undefined;\n if (typeof toJSON === \"function\") {\n let replaced: unknown;\n try {\n replaced = (toJSON as (key?: string) => unknown).call(object);\n } catch {\n return reject(\"a toJSON that threw\");\n }\n // `JSON.stringify` applies `toJSON` once per value position, not until it\n // stops changing, so the replacement is checked with it switched off here\n // — its nested values get their own.\n if (replaced === undefined) return reject(\"a toJSON that returns undefined\");\n return checkJson(replaced, path, issues, seen, false);\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => checkJson(item, [...path, index], issues, seen));\n } else {\n for (const [key, child] of Object.entries(object)) {\n checkJson(child, [...path, key], issues, seen);\n }\n }\n } finally {\n // Removed rather than left in: `seen` is the path currently being walked, and\n // keeping it would call the same object appearing twice side by side — which\n // `JSON.stringify` writes out twice quite happily — a cycle. In a `finally`\n // so the `toJSON` returns above cannot leave it marked.\n seen.delete(object);\n }\n}\n\n/**\n * The one cast in this file, and the reason it has to exist: `OUTPUT` and\n * `OPTIONAL` are `declare const` unique symbols. They have no runtime\n * counterpart — they are inference channels — so no object that can actually be\n * constructed satisfies `Schema<T>` structurally. Funnelling every builder\n * through here means the lie is told once, in one place, and everything else in\n * the module is checked against the real declarations.\n */\nfunction make<T>(definition: Definition): SchemaBuilder<T> {\n return build(definition) as unknown as SchemaBuilder<T>;\n}\n\n/**\n * Builders are immutable: `describe`, `optional` and `nullable` each build a\n * fresh one from a copied definition. Mutating in place is the obvious\n * implementation and it is wrong — `const id = s.string()` reused in two\n * objects, described in one of them, would carry that description into the\n * other, and the only symptom is a model being told the wrong thing about a\n * field somewhere else.\n */\nfunction build(definition: Definition): RuntimeSchema {\n const runtime: RuntimeSchema = {\n toJSONSchema: () => emitRoot(definition),\n parse(value) {\n const issues: SchemaIssue[] = [];\n const result = read(definition, value, [], issues);\n if (issues.length > 0) throw new Error(issues.map(render).join(\"; \"));\n return result.drop ? undefined : result.value;\n },\n safeParse(value) {\n const issues: SchemaIssue[] = [];\n const result = read(definition, value, [], issues);\n if (issues.length > 0) return { ok: false, errors: issues.map(render) };\n return { ok: true, value: result.drop ? undefined : result.value };\n },\n validate(value) {\n const issues: SchemaIssue[] = [];\n const result = read(definition, value, [], issues);\n if (issues.length > 0) return { ok: false, issues };\n return { ok: true, value: result.drop ? undefined : result.value };\n },\n describe: (description) => build({ ...definition, description }),\n optional: () => build({ ...definition, optional: true }),\n // Clearing `optional` is not tidiness. `nullable()` returns a\n // `SchemaBuilder`, not an `OptionalSchemaBuilder`, so the key it describes\n // is required again in `ShapeOutput` — and a parse that still dropped it\n // would hand back an object missing a key its own type declares.\n nullable: () => build({ ...definition, nullable: true, optional: false }),\n };\n definitions.set(runtime, definition);\n return runtime;\n}\n\nfunction leaf(node: SchemaNode): Definition {\n return { node, optional: false, nullable: false };\n}\n\n// --- reading a JSON Schema ---------------------------------------------------\n\n/**\n * How `s.fromJSONSchema` checks a `format`. `true` accepts any string (a format\n * that is only a hint, like `markdown`); a `RegExp` or a function decides.\n */\nexport type JSONSchemaFormat = true | RegExp | ((value: string) => boolean);\n\nexport type FromJSONSchemaOptions = {\n /**\n * The formats the schema may name. A `format` not listed here is refused, not\n * ignored: gemi ships no format checks of its own, and a format that quietly\n * checked nothing would be a constraint that only looks enforced.\n */\n formats?: Record<string, JSONSchemaFormat>;\n /**\n * Keywords to skip as annotations, on top of the ones always skipped:\n * `title`, `$schema`, `$id`, `$comment`, `examples`, `default`,\n * `deprecated`, `readOnly`, `writeOnly`, and every `x-` keyword.\n */\n ignoreKeywords?: readonly string[];\n /**\n * What `parse`, `safeParse` and `validate` do with a key an object of the\n * schema doesn't declare, at every depth:\n *\n * - `\"strip\"` (the default): drop it from the parsed value, silently.\n * - `\"error\"`: fail with an `additionalProperties` issue whose `path` ends in\n * the key and whose `params.additionalProperty` is the key.\n * - `\"passthrough\"`: keep it in the parsed value as it came (it is only\n * checked for being JSON).\n *\n * Every object is closed in `s`, so this applies whether or not the object\n * says `additionalProperties: false`, and the emitted schema still says\n * `additionalProperties: false` (strict mode requires it). It applies to\n * this schema's objects only: an `s.object` it is nested into keeps\n * stripping.\n */\n unknownKeys?: \"strip\" | \"error\" | \"passthrough\";\n};\n\nconst UNKNOWN_KEYS = [\"strip\", \"error\", \"passthrough\"] as const;\n\n/**\n * Thrown by `s.fromJSONSchema` for a schema outside the subset `s` models.\n * `problems` lists every one found, each starting with the path into the\n * schema (`properties.price.type: ...`), so a schema written by a user or a\n * model can be sent back with all of them at once.\n */\nexport class JSONSchemaError extends Error {\n readonly problems: string[];\n constructor(problems: string[]) {\n super(\n `gemi/ai: s.fromJSONSchema cannot model this schema:\\n${problems.map((p) => `- ${p}`).join(\"\\n\")}`,\n );\n this.name = \"JSONSchemaError\";\n this.problems = problems;\n }\n}\n\nconst ANNOTATIONS = new Set([\n \"title\",\n \"$schema\",\n \"$id\",\n \"$comment\",\n \"examples\",\n \"default\",\n \"deprecated\",\n \"readOnly\",\n \"writeOnly\",\n]);\n\n/** The keywords each type may carry, beyond `type`, `description`, `enum` and `const`. */\nconst KEYWORDS: Record<string, readonly string[]> = {\n string: [\"minLength\", \"maxLength\", \"format\"],\n number: [\"minimum\", \"maximum\", \"exclusiveMinimum\", \"exclusiveMaximum\"],\n integer: [\"minimum\", \"maximum\", \"exclusiveMinimum\", \"exclusiveMaximum\"],\n boolean: [],\n object: [\"properties\", \"required\", \"additionalProperties\"],\n array: [\"items\", \"minItems\", \"maxItems\"],\n};\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Reads a JSON Schema into a definition, collecting every problem rather than\n * stopping at the first. Returns `undefined` where a node could not be read;\n * the caller throws once the walk is done.\n */\nfunction fromJSON(\n schema: unknown,\n options: FromJSONSchemaOptions,\n where: string,\n problems: string[],\n): Definition | undefined {\n const problem = (message: string, at = where) => {\n problems.push(at ? `${at}: ${message}` : message);\n return undefined;\n };\n const child = (key: string) => (where ? `${where}.${key}` : key);\n if (!isPlainObject(schema)) return problem(\"expected a schema object\");\n\n const ignored = new Set(options.ignoreKeywords ?? []);\n const skip = (key: string) => ANNOTATIONS.has(key) || key.startsWith(\"x-\") || ignored.has(key);\n\n // `type: [T, \"null\"]`, `enum` with a null in it and an `anyOf` with a\n // `{ type: \"null\" }` member all mean the same: T, nullable.\n let nullable = false;\n let type = schema.type;\n if (Array.isArray(type)) {\n const rest = type.filter((t) => t !== \"null\");\n if (rest.length !== 1) {\n return problem(\n `type ${JSON.stringify(type)} is not supported; only one type, optionally with \"null\". Use anyOf for alternatives`,\n child(\"type\"),\n );\n }\n nullable = rest.length < type.length;\n type = rest[0];\n }\n if (type !== undefined && (typeof type !== \"string\" || !(type in KEYWORDS))) {\n return problem(\n `type ${JSON.stringify(type)} is not supported; expected one of ${Object.keys(KEYWORDS).join(\", \")}`,\n child(\"type\"),\n );\n }\n\n const allowed = new Set([\n \"type\",\n \"description\",\n \"enum\",\n \"const\",\n \"anyOf\",\n ...(type ? KEYWORDS[type as string] : []),\n ]);\n let unknown = false;\n for (const key of Object.keys(schema)) {\n if (allowed.has(key) || skip(key)) continue;\n unknown = true;\n const owner = Object.entries(KEYWORDS).find(([, keys]) => keys.includes(key));\n problem(\n owner && owner[0] !== type\n ? `\"${key}\" applies to type ${owner[0]}, and this schema is ${type ? `type ${type}` : \"untyped\"}`\n : `\"${key}\" is not supported by s.fromJSONSchema`,\n child(key),\n );\n }\n if (unknown) return undefined;\n\n if (schema.description !== undefined && typeof schema.description !== \"string\") {\n return problem(\"expected a string\", child(\"description\"));\n }\n const description = schema.description as string | undefined;\n const finish = (node: SchemaNode): Definition => ({\n node,\n optional: false,\n nullable,\n ...(description ? { description } : {}),\n });\n\n if (schema.anyOf !== undefined) {\n if (type !== undefined || schema.enum !== undefined || schema.const !== undefined) {\n return problem(\"anyOf cannot be combined with type, enum or const here\", child(\"anyOf\"));\n }\n if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {\n return problem(\"expected a non-empty array\", child(\"anyOf\"));\n }\n const members: Definition[] = [];\n let failed = false;\n schema.anyOf.forEach((member, index) => {\n if (isPlainObject(member) && member.type === \"null\" && Object.keys(member).length === 1) {\n nullable = true;\n return;\n }\n const read = fromJSON(member, options, child(`anyOf[${index}]`), problems);\n if (read) members.push(read);\n else failed = true;\n });\n if (failed) return undefined;\n if (members.length === 0) return problem(\"anyOf has only null in it\", child(\"anyOf\"));\n if (members.length === 1) {\n const only = members[0]!;\n return {\n ...only,\n nullable: only.nullable || nullable,\n ...(description ? { description } : {}),\n };\n }\n return finish({ kind: \"union\", members });\n }\n\n if (schema.const !== undefined) {\n const value = schema.const;\n if (typeof value !== \"string\" && typeof value !== \"number\" && typeof value !== \"boolean\") {\n return problem(\"only a string, number or boolean const is supported\", child(\"const\"));\n }\n if (type !== undefined && typeof value !== (type === \"integer\" ? \"number\" : type)) {\n return problem(`const ${JSON.stringify(value)} is not of type ${type}`, child(\"const\"));\n }\n return finish({ kind: \"literal\", value });\n }\n\n let stringChecks: StringChecks | undefined;\n if (type === \"string\") {\n stringChecks = readStringChecks(schema, options, child, problems);\n if (stringChecks === null) return undefined;\n }\n\n if (schema.enum !== undefined) {\n if (!Array.isArray(schema.enum) || schema.enum.length === 0) {\n return problem(\"expected a non-empty array\", child(\"enum\"));\n }\n const values = schema.enum.filter((value) => value !== null);\n if (values.length < schema.enum.length) nullable = true;\n const bad = values.find(\n (value) =>\n !(typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") ||\n (type !== undefined && typeof value !== (type === \"integer\" ? \"number\" : type)),\n );\n if (bad !== undefined || values.length === 0) {\n return problem(\n type\n ? `every value must be of type ${type}${values.length === 0 ? \", and there must be one\" : `; ${JSON.stringify(bad)} is not`}`\n : \"only strings, numbers and booleans are supported\",\n child(\"enum\"),\n );\n }\n if (values.every((value) => typeof value === \"string\")) {\n return finish({\n kind: \"enum\",\n values: [...new Set(values as string[])],\n ...(stringChecks ? { checks: stringChecks } : {}),\n });\n }\n const literals = [...new Set(values as (string | number | boolean)[])];\n if (literals.length === 1) return finish({ kind: \"literal\", value: literals[0]! });\n return finish({\n kind: \"union\",\n members: literals.map((value) => leaf({ kind: \"literal\", value })),\n });\n }\n\n switch (type) {\n case undefined:\n return problem(\"a schema needs a type, an enum, a const or an anyOf\");\n case \"string\":\n return finish({ kind: \"string\", ...(stringChecks ? { checks: stringChecks } : {}) });\n case \"number\":\n case \"integer\": {\n const checks: NumberChecks = type === \"integer\" ? { integer: true } : {};\n let failed = false;\n for (const key of KEYWORDS.number!) {\n const value = schema[key];\n if (value === undefined) continue;\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n problem(\"expected a number\", child(key));\n failed = true;\n continue;\n }\n checks[key as \"minimum\"] = value;\n }\n if (failed) return undefined;\n return finish({ kind: \"number\", ...(Object.keys(checks).length > 0 ? { checks } : {}) });\n }\n case \"boolean\":\n return finish({ kind: \"boolean\" });\n case \"array\": {\n if (!isPlainObject(schema.items)) {\n return problem(\n 'an array needs \"items\" to be one schema (tuples are not supported)',\n child(\"items\"),\n );\n }\n const checks: ArrayChecks = {};\n let failed = false;\n for (const key of [\"minItems\", \"maxItems\"] as const) {\n const value = schema[key];\n if (value === undefined) continue;\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < 0) {\n problem(\"expected a non-negative integer\", child(key));\n failed = true;\n continue;\n }\n checks[key] = value;\n }\n const item = fromJSON(schema.items, options, child(\"items\"), problems);\n if (!item || failed) return undefined;\n return finish({ kind: \"array\", item, ...(Object.keys(checks).length > 0 ? { checks } : {}) });\n }\n case \"object\": {\n const properties = schema.properties ?? {};\n if (!isPlainObject(properties)) return problem(\"expected an object\", child(\"properties\"));\n if (schema.additionalProperties !== undefined && schema.additionalProperties !== false) {\n return problem(\n \"only false is supported; a record with arbitrary keys has no strict-mode form (use s.json())\",\n child(\"additionalProperties\"),\n );\n }\n const required = schema.required ?? [];\n if (!Array.isArray(required) || !required.every((key) => typeof key === \"string\")) {\n return problem(\"expected an array of property names\", child(\"required\"));\n }\n const missing = required.filter((key) => !Object.hasOwn(properties, key));\n if (missing.length > 0) {\n return problem(\n `lists properties the schema doesn't have: ${missing.join(\", \")}`,\n child(\"required\"),\n );\n }\n const shape: Record<string, Definition> = {};\n let failed = false;\n for (const [key, value] of Object.entries(properties)) {\n const read = fromJSON(value, options, child(`properties.${key}`), problems);\n if (!read) {\n failed = true;\n continue;\n }\n // Not in `required` is \"may be left out\", which is `optional()`: the\n // model is told to send null, and a parse drops the key.\n shape[key] = required.includes(key) ? read : { ...read, optional: true };\n }\n if (failed) return undefined;\n const unknownKeys = options.unknownKeys;\n return finish({\n kind: \"object\",\n shape,\n ...(unknownKeys === \"error\" || unknownKeys === \"passthrough\" ? { unknownKeys } : {}),\n });\n }\n }\n return undefined;\n}\n\n/** `null` when a problem was reported. */\nfunction readStringChecks(\n schema: Record<string, unknown>,\n options: FromJSONSchemaOptions,\n child: (key: string) => string,\n problems: string[],\n): StringChecks | undefined | null {\n const checks: StringChecks = {};\n let failed = false;\n for (const key of [\"minLength\", \"maxLength\"] as const) {\n const value = schema[key];\n if (value === undefined) continue;\n if (typeof value !== \"number\" || !Number.isInteger(value) || value < 0) {\n problems.push(`${child(key)}: expected a non-negative integer`);\n failed = true;\n continue;\n }\n checks[key] = value;\n }\n if (schema.format !== undefined) {\n const name = schema.format;\n const format = typeof name === \"string\" ? options.formats?.[name] : undefined;\n if (typeof name !== \"string\") {\n problems.push(`${child(\"format\")}: expected a string`);\n failed = true;\n } else if (!format || !Object.hasOwn(options.formats!, name)) {\n problems.push(\n `${child(\"format\")}: unknown format ${JSON.stringify(name)}; pass a check for it in the formats option`,\n );\n failed = true;\n } else {\n checks.format = { name, test: formatTest(format) };\n }\n }\n if (failed) return null;\n return Object.keys(checks).length > 0 ? checks : undefined;\n}\n\nfunction formatTest(format: JSONSchemaFormat): (value: string) => boolean {\n if (format === true) return () => true;\n if (format instanceof RegExp) {\n // A `g` or `y` regex keeps `lastIndex` between calls, so the second value\n // tested would start halfway in. Reset it every time.\n return (value) => {\n format.lastIndex = 0;\n return format.test(value);\n };\n }\n return format;\n}\n\nexport const s: {\n string(): SchemaBuilder<string>;\n number(): SchemaBuilder<number>;\n boolean(): SchemaBuilder<boolean>;\n literal<const L extends string | number | boolean>(value: L): SchemaBuilder<L>;\n /** Modelled as a JSON Schema `enum`, which strict mode does support. */\n enum<const L extends readonly [string, ...string[]]>(values: L): SchemaBuilder<L[number]>;\n object<const S extends Record<string, AnySchema>>(shape: S): SchemaBuilder<ShapeOutput<S>>;\n array<const S extends AnySchema>(item: S): SchemaBuilder<Infer<S>[]>;\n /**\n * `anyOf` of object schemas, discriminated by a literal member. Left in\n * because tool outputs are frequently a success/failure pair, and modelling\n * that as one object with everything optional is worse for the model.\n */\n union<const S extends readonly [AnySchema, AnySchema, ...AnySchema[]]>(\n members: S,\n ): SchemaBuilder<Infer<S[number]>>;\n /**\n * Any JSON value, constrained by nothing — for a format the rest of this\n * builder cannot describe: a record with arbitrary keys, a mixed-type tuple,\n * a document whose shape is not known in advance. (A document that nests\n * into itself has a strict spelling: `s.recursive`.)\n *\n * A schema containing one cannot be sent under strict mode, so a tool whose\n * input uses it is sent with `strict: false` automatically. That is not an\n * option to pass anywhere; it is read back off the schema by\n * `supportsStrict`. The rest of the tool is unaffected, and so is streaming:\n * partial arguments are parsed from the raw text, never through a schema.\n *\n * `T` is an assertion, not a guarantee. The emitted schema constrains\n * nothing, so nothing checks the model's output against `T` — only that it is\n * JSON. Validate it in `execute` and hand the model back an error it can fix,\n * the way it would any other bad argument. `describe()` is where you tell it\n * the format; with no constraints to read, that prose is all it gets.\n *\n * TWO CALL SIGNATURES, NOT A DEFAULT TYPE PARAMETER, and that is load-bearing.\n * Written `json<T = JsonValue>()`, the default lost to the surrounding\n * contextual type in the position this is actually used: `s.object`'s shape is\n * constrained to `Record<string, AnySchema>` — `Schema<any>` — which supplies\n * `any` as an inference candidate, and a candidate beats a default. So\n * `s.object({ definition: s.json() })` inferred `{ definition: any }`, which is\n * type checking switched off around exactly the field this exists for, and the\n * opposite of what the default was written to prevent. An overload with no type\n * parameter has nothing to infer, so `s.json()` is `JsonValue` wherever it is\n * written.\n *\n * `ai:generate-client` maps it to the native `JSONValue` and says nothing about\n * it. `JsonValue` is a union of every JSON shape, so it used to reach the\n * generator's \"a union that is not told apart by one string member\" warning —\n * true, and a misdescription of a field that is free-form on purpose. The\n * extractor recognises it now.\n */\n json(): SchemaBuilder<JsonValue>;\n json<T>(): SchemaBuilder<T>;\n /**\n * A schema that contains itself — a tree of UI nodes, a comment thread, a\n * folder listing — and stays strict-mode safe, unlike `s.json()`.\n *\n * ```ts\n * type Node = { tag: string; text?: string; children: Node[] };\n *\n * const node = s.recursive<Node>(\"Node\", (self) =>\n * s.object({\n * tag: s.enum([\"section\", \"heading\", \"text\"]),\n * text: s.string().optional(),\n * children: s.array(self),\n * }),\n * );\n * const output = s.object({ title: s.string(), root: node });\n * ```\n *\n * Emitted the way OpenAI's strict structured output spells recursion: the\n * body once under the root's `$defs[name]`, and `{ \"$ref\": \"#/$defs/<name>\" }`\n * wherever it is used. Used as the root itself, the body is also inlined at\n * the root, since a tool's parameters and an agent's output must be an\n * object there. `parse`, `safeParse` and `validate` follow the reference to\n * any depth.\n *\n * `T` has to be written out: TypeScript cannot infer a type from a value\n * that mentions itself. The callback's schema is checked against it, so a\n * field the type has and the schema lacks (or the reverse) is a type error.\n *\n * Rules, each an error when the schema is built:\n *\n * - `name` is the `$defs` key: letters, digits, `_` and `-`. Two different\n * recursive schemas in one tool or output need different names.\n * - `self` must be nested inside an `s.object` field or an `s.array` — a\n * body that is `self` again through a union describes no finite value.\n * - The body cannot be `optional()`; make the uses optional instead\n * (`children: s.array(self).optional()`, `next: self.optional()`).\n *\n * Strict mode limits the rest as usual: every node of the body is in the\n * strict subset or the whole schema is sent non-strict (`supportsStrict`).\n */\n recursive<T>(name: string, define: (self: SchemaBuilder<T>) => Schema<T>): SchemaBuilder<T>;\n /**\n * A schema read from a JSON Schema at runtime — for a shape that comes from\n * data rather than code, like a collection whose items a user defined.\n *\n * Only the subset `s` itself models is accepted, so the result stays\n * strict-mode safe and can be a tool's `inputSchema` like any other:\n *\n * - `type`: `string`, `number`, `integer`, `boolean`, `object`, `array`,\n * or one of them with `\"null\"` (`[\"string\", \"null\"]`).\n * - `enum` (strings become `s.enum`, numbers and booleans a union of\n * literals; a `null` in it makes the field nullable), `const`, `anyOf`.\n * - strings: `minLength`, `maxLength`, `format` (checked with\n * `options.formats`). Numbers: `minimum`, `maximum`, `exclusiveMinimum`,\n * `exclusiveMaximum`. Arrays: `items` (one schema), `minItems`, `maxItems`.\n * - objects: `properties`, `required`, `additionalProperties: false`. A\n * property not in `required` is `optional()`.\n * - `description`; annotations (`title`, `default`, `examples`, `$schema`,\n * `x-*`, … and `options.ignoreKeywords`) are skipped.\n *\n * Anything else — `pattern`, `oneOf`, `allOf`, `$ref`, a tuple, an open\n * `additionalProperties`, an unknown `format` — throws a `JSONSchemaError`\n * listing every problem with its path.\n *\n * The length, range, item-count and format constraints are enforced by\n * `parse`/`safeParse`/`validate` and told to the model in the field's\n * description, because strict structured output does not accept them as\n * keywords. By default an unknown key in an object is dropped from the\n * parsed value rather than reported; pass `unknownKeys: \"error\"` to report\n * it as an `additionalProperties` issue (as Ajv does), or `\"passthrough\"`\n * to keep it.\n *\n * The output type is `JsonValue` (or the `T` you assert). Validate a value\n * with `.validate(value)` for per-path issues, or `.safeParse(value)`.\n */\n fromJSONSchema(schema: unknown, options?: FromJSONSchemaOptions): SchemaBuilder<JsonValue>;\n fromJSONSchema<T>(schema: unknown, options?: FromJSONSchemaOptions): SchemaBuilder<T>;\n} = {\n string: () => make<string>(leaf({ kind: \"string\" })),\n number: () => make<number>(leaf({ kind: \"number\" })),\n boolean: () => make<boolean>(leaf({ kind: \"boolean\" })),\n literal: (value) => make<typeof value>(leaf({ kind: \"literal\", value })),\n enum: (values) => make<(typeof values)[number]>(leaf({ kind: \"enum\", values })),\n object: (shape) =>\n make<ShapeOutput<typeof shape>>(\n leaf({\n kind: \"object\",\n shape: Object.fromEntries(\n Object.entries(shape).map(([key, child]) => [key, definitionOf(child)]),\n ),\n }),\n ),\n array: (item) => make<Infer<typeof item>[]>(leaf({ kind: \"array\", item: definitionOf(item) })),\n // A union is legal wherever a property is, but not as the root of a tool's\n // input or an agent's structured output: the provider wants an object there.\n // `s` cannot know where a schema will be used, so `AgentTool.create` and\n // `Agent.create` are what reject it at the root.\n union: (members) =>\n make<Infer<(typeof members)[number]>>(\n leaf({ kind: \"union\", members: members.map(definitionOf) }),\n ),\n json: <T>() => make<T>(leaf({ kind: \"json\" })),\n recursive,\n fromJSONSchema: <T>(schema: unknown, options: FromJSONSchemaOptions = {}) => {\n const problems: string[] = [];\n if (\n options.unknownKeys !== undefined &&\n !(UNKNOWN_KEYS as readonly unknown[]).includes(options.unknownKeys)\n ) {\n throw new Error(\n `gemi/ai: s.fromJSONSchema's unknownKeys option must be one of ${UNKNOWN_KEYS.map((v) => JSON.stringify(v)).join(\", \")}, got ${JSON.stringify(options.unknownKeys)}`,\n );\n }\n const definition = fromJSON(schema, options, \"\", problems);\n if (!definition || problems.length > 0) {\n throw new JSONSchemaError(problems.length > 0 ? problems : [\"unreadable schema\"]);\n }\n return make<T>(definition);\n },\n};\n\n/**\n * Whether a schema can be sent under a provider's strict mode.\n *\n * False exactly when a `json()` node is somewhere inside it. Strict mode's\n * bargain is that every node constrains its value; an unconstrained one has no\n * spelling there, and sending it anyway is a 400 naming a path.\n *\n * Derived from the tree rather than declared alongside it, because the two\n * would drift: a field added to a tool's input a year from now would need\n * whoever adds it to know that a flag somewhere else describes it. Adding the\n * field is the whole of turning strict off.\n */\nexport function supportsStrict(schema: AnySchema): boolean {\n const definition = definitions.get(schema);\n if (definition) return strictNode(definition.node);\n // A schema built by hand rather than with `s`: `questionSchema` in\n // `ai/Agent.ts`, and the merged one `services/mcp` casts together.\n //\n // Answering `true` here was wrong, and not harmlessly. `McpRegistry`'s\n // `combineSchemas` spreads `meta.input.toJSONSchema()` into its own object,\n // so an `s.json()` field an app declared on an `mcp` route survives into the\n // emitted schema while the *tree* that would have reported it is discarded.\n // Every MCP-projected tool was therefore sent `strict: true` with an empty\n // subschema inside it — a 400 on every turn, from the one path this function\n // exists to get right.\n //\n // So the emitted schema is read instead. It is the same question asked of the\n // artifact rather than the source, which is the only thing a foreign schema\n // has to offer.\n return strictJSONSchema(schema.toJSONSchema());\n}\n\n/**\n * Whether an already-emitted JSON Schema constrains every value it describes.\n *\n * Only for schemas with no definition tree. It answers a narrower question than\n * `strictNode` — it cannot see optionality or a builder's intent, just whether\n * some node says nothing about its value — but that is exactly the property\n * strict mode rejects, and it is visible in the artifact.\n */\nfunction strictJSONSchema(schema: JSONSchema): boolean {\n // `description` is prose, not a constraint. A node carrying only that — which\n // is what `s.json().describe(...)` emits — says nothing about its value.\n const constrained =\n schema.$ref !== undefined ||\n schema.type !== undefined ||\n schema.enum !== undefined ||\n schema.const !== undefined ||\n schema.anyOf !== undefined ||\n schema.properties !== undefined ||\n schema.items !== undefined;\n if (!constrained) return false;\n\n for (const child of Object.values(schema.properties ?? {})) {\n if (!strictJSONSchema(child)) return false;\n }\n if (schema.items && !strictJSONSchema(schema.items)) return false;\n for (const member of schema.anyOf ?? []) {\n if (!strictJSONSchema(member)) return false;\n }\n // A `$ref` is answered for by the `$defs` entry it points at, which is\n // checked here once rather than followed — following it is a cycle.\n for (const definition of Object.values(schema.$defs ?? {})) {\n if (!strictJSONSchema(definition)) return false;\n }\n return true;\n}\n\n/**\n * Enumerated rather than defaulted, so that a node kind added later cannot\n * inherit \"strict\" by omission — which is the failure that shows up as a 400\n * from the provider rather than as a type error here.\n *\n * The one cycle in a definition tree is an `s.recursive` reaching itself, so\n * `seen` holds the cells already being answered for: a body that is strict\n * apart from its references to itself is strict.\n */\nfunction strictNode(node: SchemaNode, seen = new Set<RecursiveCell>()): boolean {\n switch (node.kind) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"literal\":\n case \"enum\":\n return true;\n case \"object\":\n return Object.values(node.shape).every((child) => strictNode(child.node, seen));\n case \"array\":\n return strictNode(node.item.node, seen);\n case \"union\":\n return node.members.every((member) => strictNode(member.node, seen));\n case \"json\":\n return false;\n case \"ref\":\n if (seen.has(node.cell)) return true;\n seen.add(node.cell);\n return strictNode(bodyOf(node.cell).node, seen);\n }\n}\n\n/**\n * Whether `definition` can reach `cell` without an object property or an\n * array item in between — through a union member, or another recursive\n * schema's body. Such a schema describes no finite value (`Self = Self |\n * string` is just `string`), and reading one would recurse forever on a\n * primitive, where no object is there to catch the cycle with.\n */\nfunction reachesUnguarded(\n definition: Definition,\n cell: RecursiveCell,\n seen = new Set<RecursiveCell>(),\n): boolean {\n const node = definition.node;\n if (node.kind === \"union\") {\n return node.members.some((member) => reachesUnguarded(member, cell, seen));\n }\n if (node.kind !== \"ref\") return false;\n if (node.cell === cell) return true;\n if (seen.has(node.cell) || !node.cell.definition) return false;\n seen.add(node.cell);\n return reachesUnguarded(node.cell.definition, cell, seen);\n}\n\nconst RECURSIVE_NAME = /^[A-Za-z_][A-Za-z0-9_-]{0,63}$/;\n\nfunction recursive<T>(\n name: string,\n define: (self: SchemaBuilder<T>) => Schema<T>,\n): SchemaBuilder<T> {\n if (typeof name !== \"string\" || !RECURSIVE_NAME.test(name)) {\n throw new Error(\n `gemi/ai: s.recursive needs a name of letters, digits, \"_\" and \"-\" (starting with a letter or \"_\", at most 64), got ${JSON.stringify(name)}`,\n );\n }\n const cell: RecursiveCell = { name, active: new Set() };\n const reference = (): Definition => leaf({ kind: \"ref\", cell });\n const body = definitionOf(define(make<T>(reference())));\n if (body.optional) {\n throw new Error(\n `gemi/ai: the recursive schema \"${name}\" is optional() as a whole; mark the places that use it optional instead`,\n );\n }\n if (reachesUnguarded(body, cell)) {\n throw new Error(\n `gemi/ai: the recursive schema \"${name}\" refers to itself outside any object or array, so it describes no finite value; nest \\`self\\` in an s.object(...) field or an s.array(...)`,\n );\n }\n cell.definition = body;\n return make<T>(reference());\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAmRA,SAAS,CAAM,CAAC,EAAiC,CAC/C,GAAI,CAAC,EAAK,WACR,MAAU,MACR,kCAAkC,EAAK,sIACzC,EAEF,OAAO,EAAK,WAwBd,IAAM,EAAc,IAAI,QAMjB,SAAS,EAAQ,CAAC,EAAiD,CACxE,OAAO,OAAO,IAAU,UAAY,IAAU,MAAQ,EAAY,IAAI,CAAK,EAG7E,SAAS,CAAY,CAAC,EAA+B,CACnD,IAAM,EAAa,EAAY,IAAI,CAAM,EACzC,GAAI,CAAC,EACH,MAAU,MAAM,iEAAiE,EAEnF,OAAO,EAyBT,SAAS,CAAQ,CAAC,EAAoC,CACpD,IAAM,EAAuB,CAAE,KAAM,CAAC,EAAG,MAAO,IAAI,GAAM,EACtD,EAAO,EACX,GAAI,EAAW,KAAK,OAAS,MAAO,CAClC,IAAM,EAAO,EAAO,EAAW,KAAK,IAAI,EACxC,EAAO,IACF,KACC,EAAW,YAAc,CAAE,YAAa,EAAW,WAAY,EAAI,CAAC,EACxE,SAAU,EAAW,SACrB,SAAU,EAAW,UAAY,EAAK,QACxC,EAEF,IAAM,EAAS,EAAK,EAAM,CAAO,EACjC,OAAO,OAAO,KAAK,EAAQ,IAAI,EAAE,OAAS,EAAI,IAAK,EAAQ,MAAO,EAAQ,IAAK,EAAI,EAGrF,SAAS,CAAI,CAAC,EAAwB,EAAkC,CAItE,IAAM,GAAS,EAAW,UAAY,EAAW,WAAa,EAAW,KAAK,OAAS,OACnF,EAAO,EAAU,EAAS,EAAW,KAAM,CAAO,EAAG,CAAK,EACxD,EAAc,CAAC,EAAW,YAAa,EAAK,EAAW,IAAI,CAAC,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAG5F,GAAI,GAAe,EAAK,OAAS,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AAM,EAAsB,CAAE,OAAM,OAAQ,IAAI,GAAM,EAChD,EAAY,IAAkB,EAAK,CAAE,KAAM,MAAO,MAAK,CAAC,EACxD,EAAO,EAAa,EAAO,EAAQ,EAAU,CAAC,CAAC,CAAC,EACtD,GAAI,EAAK,SACP,MAAU,MACR,kCAAkC,2EACpC,EAEF,GAAI,EAAiB,EAAM,CAAI,EAC7B,MAAU,MACR,kCAAkC,8IACpC,EAGF,OADA,EAAK,WAAa,EACX,EAAQ,EAAU,CAAC",
|
|
8
|
+
"debugId": "9FD1948884F529CB64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Q as ye}from"./chunk-
|
|
2
|
+
import{Q as ye}from"./chunk-0shq2d31.js";import{S as Ze,T as Te}from"./chunk-77x9vxht.js";import{U as en}from"./chunk-qcrj4t72.js";import{W as At}from"./chunk-d5d3a8bm.js";import{ya as Hi}from"./chunk-6bfj0mbp.js";import{Dm as _,Gm as D}from"./chunk-k9882kqg.js";var Rt=_((Gs)=>{var Pt=At(),Xs=(e)=>e[Pt.SMITHY_CONTEXT_KEY]||(e[Pt.SMITHY_CONTEXT_KEY]={}),Zs=(e)=>{if(typeof e==="function")return e;let t=Promise.resolve(e);return()=>t};Gs.getSmithyContext=Xs;Gs.normalizeProvider=Zs});var It=_((rn)=>{var Ut=en(),tn=(e)=>{if(typeof e==="object"){if("url"in e){let t=Ut.parseUrl(e.url);if(e.headers){t.headers={};for(let[r,s]of Object.entries(e.headers))t.headers[r.toLowerCase()]=s.join(", ")}return t}return e}return Ut.parseUrl(e)};rn.toEndpointV1=tn});var Qe=_((wn)=>{var nn=ye(),Dt=Rt(),on=It(),de=(e)=>{if(typeof e==="function")return e();return e},Ye=(e,t,r,s,n)=>({name:t,namespace:e,traits:r,input:s,output:n}),cn=(e)=>(t,r)=>async(s)=>{let{response:n}=await t(s),{operationSchema:o}=Dt.getSmithyContext(r),[,i,c,a,l,d]=o??[];try{let f=await e.protocol.deserializeResponse(Ye(i,c,a,l,d),{...e,...r},n);return{response:n,output:f}}catch(f){if(Object.defineProperty(f,"$response",{value:n,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in f)){try{f.message+=`
|
|
3
3
|
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`}catch(h){if(!r.logger||r.logger?.constructor?.name==="NoOpLogger")console.warn("Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.");else r.logger?.warn?.("Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.")}if(typeof f.$responseBodyText<"u"){if(f.$response)f.$response.body=f.$responseBodyText}try{if(nn.HttpResponse.isInstance(n)){let{headers:h={}}=n,p=Object.entries(h);f.$metadata={httpStatusCode:n.statusCode,requestId:Je(/^x-[\w-]+-request-?id$/,p),extendedRequestId:Je(/^x-[\w-]+-id-2$/,p),cfId:Je(/^x-[\w-]+-cf-id$/,p)}}}catch(h){}}throw f}},Je=(e,t)=>{return(t.find(([r])=>{return r.match(e)})||[void 0,void 0])[1]},an=(e)=>(t,r)=>async(s)=>{let{operationSchema:n}=Dt.getSmithyContext(r),[,o,i,c,a,l]=n??[],d=r.endpointV2?async()=>on.toEndpointV1(r.endpointV2):e.endpoint,f=await e.protocol.serializeRequest(Ye(o,i,c,a,l),s.input,{...e,...r,endpoint:d});return t({...s,request:f})},Bt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Lt={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function fn(e){return{applyToStack:(t)=>{t.add(an(e),Lt),t.add(cn(e),Bt),e.protocol.setSerdeContext(e)}}}class A{name;namespace;traits;static assign(e,t){return Object.assign(e,t)}static[Symbol.hasInstance](e){let t=this.prototype.isPrototypeOf(e);if(!t&&typeof e==="object"&&e!==null)return e.symbol===this.symbol;return t}getName(){return this.namespace+"#"+this.name}}class be extends A{static symbol=Symbol.for("@smithy/lis");name;traits;valueSchema;symbol=be.symbol}var un=(e,t,r,s)=>A.assign(new be,{name:t,namespace:e,traits:r,valueSchema:s});class we extends A{static symbol=Symbol.for("@smithy/map");name;traits;keySchema;valueSchema;symbol=we.symbol}var hn=(e,t,r,s,n)=>A.assign(new we,{name:t,namespace:e,traits:r,keySchema:s,valueSchema:n});class ge extends A{static symbol=Symbol.for("@smithy/ope");name;traits;input;output;symbol=ge.symbol}var dn=(e,t,r,s,n)=>A.assign(new ge,{name:t,namespace:e,traits:r,input:s,output:n});class re extends A{static symbol=Symbol.for("@smithy/str");name;traits;memberNames;memberList;symbol=re.symbol}var ln=(e,t,r,s,n)=>A.assign(new re,{name:t,namespace:e,traits:r,memberNames:s,memberList:n});class _e extends re{static symbol=Symbol.for("@smithy/err");ctor;symbol=_e.symbol}var pn=(e,t,r,s,n,o)=>A.assign(new _e,{name:t,namespace:e,traits:r,memberNames:s,memberList:n,ctor:null}),le=[];function te(e){if(typeof e==="object")return e;if(e=e|0,le[e])return le[e];let t={},r=0;for(let s of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])if((e>>r++&1)===1)t[s]=1;return le[e]=t}var K={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},pe=[],me={};class q{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=q.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;let r=[],s=e,n=e;this._isMemberSchema=!1;while(ve(s))r.push(s[1]),s=s[0],n=de(s),this._isMemberSchema=!0;if(r.length>0){this.memberTraits={};for(let o=r.length-1;o>=0;--o){let i=r[o];Object.assign(this.memberTraits,te(i))}}else this.memberTraits=0;if(n instanceof q){let o=this.memberTraits;Object.assign(this,n),this.memberTraits=Object.assign({},o,n.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??n.memberName;return}if(this.schema=de(n),Nt(this.schema))this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3];else this.name=this.memberName??String(n),this.traits=0;if(this._isMemberSchema&&!t)throw Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let t=this.prototype.isPrototypeOf(e);if(!t&&typeof e==="object"&&e!==null)return e.symbol===this.symbol;return t}static of(e){let t=typeof e==="function"||typeof e==="object"&&e!==null;if(typeof e==="number"){if(pe[e])return pe[e]}else if(typeof e==="string"){if(me[e])return me[e]}else if(t){if(e[K.ns])return e[K.ns]}let r=de(e);if(r instanceof q)return r;if(ve(r)){let[n,o]=r;if(n instanceof q)return Object.assign(n.getMergedTraits(),te(o)),n;throw Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let s=new q(r);if(t)return e[K.ns]=s;if(typeof r==="string")return me[r]=s;if(typeof r==="number")return pe[r]=s;return s}getSchema(){let e=this.schema;if(Array.isArray(e)&&e[0]===0)return e[4];return e}getName(e=!1){let{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e==="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e==="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!=="object")return!1;let t=e[0];return t===3||t===-3||t===4}isUnionSchema(){let e=this.getSchema();if(typeof e!=="object")return!1;return e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e==="number"&&e>=4&&e<=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:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return te(this.memberTraits)}getOwnTraits(){return te(this.traits)}getKeySchema(){let[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let r=this.getSchema(),s=e?15:r[4]??0;return ee([s,0],"key")}getValueSchema(){let e=this.getSchema(),[t,r,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],n=typeof e==="number"?63&e:e&&typeof e==="object"&&(r||s)?e[3+e[0]]:t?15:void 0;if(n!=null)return ee([n,0],r?"value":"member");throw Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){let r=t[4].indexOf(e),s=t[5][r];return ee(ve(s)?s:[s,0],e)}if(this.isDocumentSchema())return ee([15,0],e);throw Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[t,r]of this.structIterator())e[t]=r}catch(t){}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),t=e[4].length,r=e[K.it];if(r&&t===r.length){yield*r;return}r=Array(t);for(let s=0;s<t;++s){let n=e[4][s],o=ee([e[5][s],0],n);yield r[s]=[n,o]}e[K.it]=r}}function ee(e,t){if(e instanceof q)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new q(e,t)}var ve=(e)=>Array.isArray(e)&&e.length===2,Nt=(e)=>Array.isArray(e)&&e.length>=5;class se extends A{static symbol=Symbol.for("@smithy/sim");name;schemaRef;traits;symbol=se.symbol}var mn=(e,t,r,s)=>A.assign(new se,{name:t,namespace:e,traits:s,schemaRef:r}),yn=(e,t,r,s)=>A.assign(new se,{name:t,namespace:e,traits:r,schemaRef:s}),bn={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 N{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,r=new Map){this.namespace=e,this.schemas=t,this.exceptions=r}static for(e){if(!N.registries.has(e))N.registries.set(e,new N(e));return N.registries.get(e)}copyFrom(e){let{schemas:t,exceptions:r}=this;for(let[s,n]of e.schemas)if(!t.has(s))t.set(s,n);for(let[s,n]of e.exceptions)if(!r.has(s))r.set(s,n)}register(e,t){let r=this.normalizeShapeId(e);for(let s of[this,N.for(r.split("#")[0])])s.schemas.set(r,t)}getSchema(e){let t=this.normalizeShapeId(e);if(!this.schemas.has(t))throw Error(`@smithy/core/schema - schema not found for ${t}`);return this.schemas.get(t)}registerError(e,t){let r=e,s=r[1];for(let n of[this,N.for(s)])n.schemas.set(s+"#"+r[2],r),n.exceptions.set(r,t)}getErrorCtor(e){let t=e;if(this.exceptions.has(t))return this.exceptions.get(t);return N.for(t[1]).exceptions.get(t)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,t,r]=e,s=t+"#"+r;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}return}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){if(e.includes("#"))return e;return this.namespace+"#"+e}}wn.ErrorSchema=_e;wn.ListSchema=be;wn.MapSchema=we;wn.NormalizedSchema=q;wn.OperationSchema=ge;wn.SCHEMA=bn;wn.Schema=A;wn.SimpleSchema=se;wn.StructureSchema=re;wn.TypeRegistry=N;wn.deref=de;wn.deserializerMiddlewareOption=Bt;wn.error=pn;wn.getSchemaSerdePlugin=fn;wn.isStaticSchema=Nt;wn.list=un;wn.map=hn;wn.op=dn;wn.operation=Ye;wn.serializerMiddlewareOption=Lt;wn.sim=mn;wn.simAdapter=yn;wn.simpleSchemaCacheN=pe;wn.simpleSchemaCacheS=me;wn.struct=ln;wn.traitsCache=le;wn.translateTraits=te});var Ct=_((vn)=>{var W=(e,t)=>{let r=[];if(e)r.push(e);if(t)for(let s of t)r.push(s);return r},z=(e,t)=>{return`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`},Xe=()=>{let e=[],t=[],r=!1,s=new Set,n=(f)=>f.sort((u,h)=>qt[h.step]-qt[u.step]||jt[h.priority||"normal"]-jt[u.priority||"normal"]),o=(f)=>{let u=!1,h=(p)=>{let b=W(p.name,p.aliases);if(b.includes(f)){u=!0;for(let y of b)s.delete(y);return!1}return!0};return e=e.filter(h),t=t.filter(h),u},i=(f)=>{let u=!1,h=(p)=>{if(p.middleware===f){u=!0;for(let b of W(p.name,p.aliases))s.delete(b);return!1}return!0};return e=e.filter(h),t=t.filter(h),u},c=(f)=>{return e.forEach((u)=>{f.add(u.middleware,{...u})}),t.forEach((u)=>{f.addRelativeTo(u.middleware,{...u})}),f.identifyOnResolve?.(d.identifyOnResolve()),f},a=(f)=>{let u=[];return f.before.forEach((h)=>{if(h.before.length===0&&h.after.length===0)u.push(h);else u.push(...a(h))}),u.push(f),f.after.reverse().forEach((h)=>{if(h.before.length===0&&h.after.length===0)u.push(h);else u.push(...a(h))}),u},l=(f=!1)=>{let u=[],h=[],p={};return e.forEach((y)=>{let m={...y,before:[],after:[]};for(let w of W(m.name,m.aliases))p[w]=m;u.push(m)}),t.forEach((y)=>{let m={...y,before:[],after:[]};for(let w of W(m.name,m.aliases))p[w]=m;h.push(m)}),h.forEach((y)=>{if(y.toMiddleware){let m=p[y.toMiddleware];if(m===void 0){if(f)return;throw Error(`${y.toMiddleware} is not found when adding ${z(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}if(y.relation==="after")m.after.push(y);if(y.relation==="before")m.before.push(y)}}),n(u).map(a).reduce((y,m)=>{return y.push(...m),y},[])},d={add:(f,u={})=>{let{name:h,override:p,aliases:b}=u,y={step:"initialize",priority:"normal",middleware:f,...u},m=W(h,b);if(m.length>0){if(m.some((w)=>s.has(w))){if(!p)throw Error(`Duplicate middleware name '${z(h,b)}'`);for(let w of m){let S=e.findIndex((O)=>O.name===w||O.aliases?.some((I)=>I===w));if(S===-1)continue;let g=e[S];if(g.step!==y.step||y.priority!==g.priority)throw Error(`"${z(g.name,g.aliases)}" middleware with ${g.priority} priority in ${g.step} step cannot be overridden by "${z(h,b)}" middleware with ${y.priority} priority in ${y.step} step.`);e.splice(S,1)}}for(let w of m)s.add(w)}e.push(y)},addRelativeTo:(f,u)=>{let{name:h,override:p,aliases:b}=u,y={middleware:f,...u},m=W(h,b);if(m.length>0){if(m.some((w)=>s.has(w))){if(!p)throw Error(`Duplicate middleware name '${z(h,b)}'`);for(let w of m){let S=t.findIndex((O)=>O.name===w||O.aliases?.some((I)=>I===w));if(S===-1)continue;let g=t[S];if(g.toMiddleware!==y.toMiddleware||g.relation!==y.relation)throw Error(`"${z(g.name,g.aliases)}" middleware ${g.relation} "${g.toMiddleware}" middleware cannot be overridden by "${z(h,b)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);t.splice(S,1)}}for(let w of m)s.add(w)}t.push(y)},clone:()=>c(Xe()),use:(f)=>{f.applyToStack(d)},remove:(f)=>{if(typeof f==="string")return o(f);else return i(f)},removeByTag:(f)=>{let u=!1,h=(p)=>{let{tags:b,name:y,aliases:m}=p;if(b&&b.includes(f)){let w=W(y,m);for(let S of w)s.delete(S);return u=!0,!1}return!0};return e=e.filter(h),t=t.filter(h),u},concat:(f)=>{let u=c(Xe());return u.use(f),u.identifyOnResolve(r||u.identifyOnResolve()||(f.identifyOnResolve?.()??!1)),u},applyToStack:c,identify:()=>{return l(!0).map((f)=>{let u=f.step??f.relation+" "+f.toMiddleware;return z(f.name,f.aliases)+" - "+u})},identifyOnResolve(f){if(typeof f==="boolean")r=f;return r},resolve:(f,u)=>{for(let h of l().map((p)=>p.middleware).reverse())f=h(f,u);if(r)console.log(d.identify());return f}};return d},qt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},jt={high:3,normal:2,low:1};vn.constructStack=Xe});var zt=_((Ft)=>{Object.defineProperty(Ft,"__esModule",{value:!0});Ft.fromBase64=void 0;var Qn=Ze(),Xn=/^[A-Za-z0-9+/]*={0,2}$/,Zn=(e)=>{if(e.length*3%4!==0)throw TypeError("Incorrect padding on base64 string.");if(!Xn.exec(e))throw TypeError("Invalid base64 string.");let t=(0,Qn.fromString)(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)};Ft.fromBase64=Zn});var Jt=_((Wt)=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.toBase64=void 0;var Gn=Ze(),Vn=Te(),Kn=(e)=>{let t;if(typeof e==="string")t=(0,Vn.fromUtf8)(e);else t=e;if(typeof t!=="object"||typeof t.byteOffset!=="number"||typeof t.byteLength!=="number")throw Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return(0,Gn.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("base64")};Wt.toBase64=Kn});var k=_((j)=>{var Ee=zt(),Se=Jt();Object.prototype.hasOwnProperty.call(Ee,"__proto__")&&!Object.prototype.hasOwnProperty.call(j,"__proto__")&&Object.defineProperty(j,"__proto__",{enumerable:!0,value:Ee.__proto__});Object.keys(Ee).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(j,e))j[e]=Ee[e]});Object.prototype.hasOwnProperty.call(Se,"__proto__")&&!Object.prototype.hasOwnProperty.call(j,"__proto__")&&Object.defineProperty(j,"__proto__",{enumerable:!0,value:Se.__proto__});Object.keys(Se).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(j,e))j[e]=Se[e]})});var Ge=_((Yt)=>{Object.defineProperty(Yt,"__esModule",{value:!0});Yt.ChecksumStream=void 0;var eo=k(),to=D("stream");class vt extends to.Duplex{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;pendingCallback=null;constructor({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:s,base64Encoder:n}){super();if(typeof r.pipe==="function")this.source=r;else throw Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);this.base64Encoder=n??eo.toBase64,this.expectedChecksum=e,this.checksum=t,this.checksumSourceLocation=s,this.source.pipe(this)}_read(e){if(this.pendingCallback){let t=this.pendingCallback;this.pendingCallback=null,t()}}_write(e,t,r){try{if(this.checksum.update(e),!this.push(e)){this.pendingCallback=r;return}}catch(s){return r(s)}return r()}async _final(e){try{let t=await this.checksum.digest(),r=this.base64Encoder(t);if(this.expectedChecksum!==r)return e(Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`))}catch(t){return e(t)}return this.push(null),e()}}Yt.ChecksumStream=vt});var C=_((Xt)=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.isBlob=Xt.isReadableStream=void 0;var ro=(e)=>typeof ReadableStream==="function"&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream);Xt.isReadableStream=ro;var so=(e)=>{return typeof Blob==="function"&&(e?.constructor?.name===Blob.name||e instanceof Blob)};Xt.isBlob=so});var er=_((Vt)=>{Object.defineProperty(Vt,"__esModule",{value:!0});Vt.ChecksumStream=void 0;var oo=typeof ReadableStream==="function"?ReadableStream:function(){};class Gt extends oo{}Vt.ChecksumStream=Gt});var sr=_((tr)=>{Object.defineProperty(tr,"__esModule",{value:!0});tr.createChecksumStream=void 0;var io=k(),co=C(),ao=er(),fo=({expectedChecksum:e,checksum:t,source:r,checksumSourceLocation:s,base64Encoder:n})=>{if(!(0,co.isReadableStream)(r))throw Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let o=n??io.toBase64;if(typeof TransformStream!=="function")throw Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let i=new TransformStream({start(){},async transform(a,l){t.update(a),l.enqueue(a)},async flush(a){let l=await t.digest(),d=o(l);if(e!==d){let f=Error(`Checksum mismatch: expected "${e}" but received "${d}" in response header "${s}".`);a.error(f)}else a.terminate()}});r.pipeThrough(i);let c=i.readable;return Object.setPrototypeOf(c,ao.ChecksumStream.prototype),c};tr.createChecksumStream=fo});var or=_((nr)=>{Object.defineProperty(nr,"__esModule",{value:!0});nr.createChecksumStream=po;var uo=C(),ho=Ge(),lo=sr();function po(e){if(typeof ReadableStream==="function"&&(0,uo.isReadableStream)(e.source))return(0,lo.createChecksumStream)(e);return new ho.ChecksumStream(e)}});var Ve=_((cr)=>{Object.defineProperty(cr,"__esModule",{value:!0});cr.ByteArrayCollector=void 0;class ir{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(this.byteArrays.length===1){let r=this.byteArrays[0];return this.reset(),r}let e=this.allocByteArray(this.byteLength),t=0;for(let r=0;r<this.byteArrays.length;++r){let s=this.byteArrays[r];e.set(s,t),t+=s.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}cr.ByteArrayCollector=ir});var pr=_((dr)=>{Object.defineProperty(dr,"__esModule",{value:!0});dr.createBufferedReadable=void 0;dr.createBufferedReadableStream=fr;dr.merge=ur;dr.flush=xe;dr.sizeOf=Y;dr.modeOf=hr;var yo=Ve();function fr(e,t,r){let s=e.getReader(),n=!1,o=0,i=["",new yo.ByteArrayCollector((l)=>new Uint8Array(l))],c=-1,a=async(l)=>{let{value:d,done:f}=await s.read(),u=d;if(f){if(c!==-1){let h=xe(i,c);if(Y(h)>0)l.enqueue(h)}l.close()}else{let h=hr(u,!1);if(c!==h){if(c>=0)l.enqueue(xe(i,c));c=h}if(c===-1){l.enqueue(u);return}let p=Y(u);o+=p;let b=Y(i[c]);if(p>=t&&b===0)l.enqueue(u);else{let y=ur(i,c,u);if(!n&&o>t*2)n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${p} is below threshold of ${t}, automatically buffering.`);if(y>=t)l.enqueue(xe(i,c));else await a(l)}}};return new ReadableStream({pull:a})}dr.createBufferedReadable=fr;function ur(e,t,r){switch(t){case 0:return e[0]+=r,Y(e[0]);case 1:case 2:return e[t].push(r),Y(e[t])}}function xe(e,t){switch(t){case 0:let r=e[0];return e[0]="",r;case 1:case 2:return e[t].flush()}throw Error(`@smithy/util-stream - invalid index ${t} given to flush()`)}function Y(e){return e?.byteLength??e?.length??0}function hr(e,t=!0){if(t&&typeof Buffer<"u"&&e instanceof Buffer)return 2;if(e instanceof Uint8Array)return 1;if(typeof e==="string")return 0;return-1}});var br=_((yr)=>{Object.defineProperty(yr,"__esModule",{value:!0});yr.createBufferedReadable=xo;var Eo=D("stream"),mr=Ve(),F=pr(),So=C();function xo(e,t,r){if((0,So.isReadableStream)(e))return(0,F.createBufferedReadableStream)(e,t,r);let s=new Eo.Readable({read(){}}),n=!1,o=0,i=["",new mr.ByteArrayCollector((a)=>new Uint8Array(a)),new mr.ByteArrayCollector((a)=>Buffer.from(new Uint8Array(a)))],c=-1;return e.on("data",(a)=>{let l=(0,F.modeOf)(a,!0);if(c!==l){if(c>=0)s.push((0,F.flush)(i,c));c=l}if(c===-1){s.push(a);return}let d=(0,F.sizeOf)(a);o+=d;let f=(0,F.sizeOf)(i[c]);if(d>=t&&f===0)s.push(a);else{let u=(0,F.merge)(i,c,a);if(!n&&o>t*2)n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${d} is below threshold of ${t}, automatically buffering.`);if(u>=t)s.push((0,F.flush)(i,c))}}),e.on("end",()=>{if(c!==-1){let a=(0,F.flush)(i,c);if((0,F.sizeOf)(a)>0)s.push(a)}s.push(null)}),s}});var _r=_((wr)=>{Object.defineProperty(wr,"__esModule",{value:!0});wr.getAwsChunkedEncodingStream=void 0;var Oo=(e,t)=>{let{base64Encoder:r,bodyLengthChecker:s,checksumAlgorithmFn:n,checksumLocationName:o,streamHasher:i}=t,c=r!==void 0&&s!==void 0&&n!==void 0&&o!==void 0&&i!==void 0,a=c?i(n,e):void 0,l=e.getReader();return new ReadableStream({async pull(d){let{value:f,done:u}=await l.read();if(u){if(d.enqueue(`0\r
|
|
4
4
|
`),c){let h=r(await a);d.enqueue(`${o}:${h}\r
|
|
5
5
|
`),d.enqueue(`\r
|
|
@@ -15,7 +15,7 @@ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-confi
|
|
|
15
15
|
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.configProvider=new Promise((t,r)=>{if(typeof e==="function")e().then((s)=>{t(this.resolveDefaultConfig(s))}).catch(r);else t(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t,requestTimeout:r}={}){if(!this.config)this.config=await this.configProvider;let s=this.config,n=e.protocol==="https:";if(!n&&!this.config.httpAgent)this.config.httpAgent=await this.config.httpAgentProvider();return new Promise((o,i)=>{let c=void 0,a=[],l=async(E)=>{await c,a.forEach(P.clearTimeout),o(E)},d=async(E)=>{await c,a.forEach(P.clearTimeout),i(E)};if(t?.aborted){let E=Me(t);d(E);return}let f=e.headers??{},u=(f.Expect??f.expect)==="100-continue",h=n?s.httpsAgent:s.httpAgent;if(u&&!this.externalAgent)h=new(n?$e.Agent:Oe)({keepAlive:!1,maxSockets:1/0});a.push(P.setTimeout(()=>{this.socketWarningTimestamp=Pe.checkSocketUsage(h,this.socketWarningTimestamp,s.logger)},s.socketAcquisitionWarningTimeout??(s.requestTimeout??2000)+(s.connectionTimeout??1000)));let p=Nr.buildQueryString(e.query||{}),b=void 0;if(e.username!=null||e.password!=null){let E=e.username??"",x=e.password??"";b=`${E}:${x}`}let y=e.path;if(p)y+=`?${p}`;if(e.fragment)y+=`#${e.fragment}`;let m=e.hostname??"";if(m[0]==="["&&m.endsWith("]"))m=e.hostname.slice(1,-1);else m=e.hostname;let w={headers:e.headers,host:m,method:e.method,path:y,port:e.port,agent:h,auth:b},g=(n?$e.request:Br)(w,(E)=>{let x=new Lr.HttpResponse({statusCode:E.statusCode||-1,reason:E.statusMessage,headers:jr(E.headers),body:E});l({response:x})});if(g.on("error",(E)=>{if(vo.includes(E.code))d(Object.assign(E,{name:"TimeoutError"}));else d(E)}),t){let E=()=>{g.destroy();let x=Me(t);d(x)};if(typeof t.addEventListener==="function"){let x=t;x.addEventListener("abort",E,{once:!0}),g.once("close",()=>x.removeEventListener("abort",E))}else t.onabort=E}let O=r??s.requestTimeout;a.push(Yo(g,d,s.connectionTimeout)),a.push(Qo(g,d,O,s.throwOnRequestTimeout,s.logger??console)),a.push(Go(g,d,s.socketTimeout));let I=w.agent;if(typeof I==="object"&&"keepAlive"in I)a.push(Zo(g,{keepAlive:I.keepAlive,keepAliveMsecs:I.keepAliveMsecs}));c=Cr(g,e,O,this.externalAgent).catch((E)=>{return a.forEach(P.clearTimeout),i(E)})})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((r)=>{return{...r,[e]:t}})}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:r,socketTimeout:s,socketAcquisitionWarningTimeout:n,httpAgent:o,httpsAgent:i,throwOnRequestTimeout:c,logger:a}=e||{},l=!0,d=50;return{connectionTimeout:r,requestTimeout:t,socketTimeout:s,socketAcquisitionWarningTimeout:n,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let{Agent:f,request:u}=await import("http");if(Br=u,Oe=f,o instanceof Oe||typeof o?.destroy==="function")return this.externalAgent=!0,o;return new Oe({keepAlive:!0,maxSockets:50,...o})},httpsAgent:(()=>{if(i instanceof $e.Agent||typeof i?.destroy==="function")return this.externalAgent=!0,i;return new $e.Agent({keepAlive:!0,maxSockets:50,...i})})(),logger:a}}}class Fr{sessions=[];constructor(e){this.sessions=e??[]}poll(){if(this.sessions.length>0)return this.sessions.shift()}offerLast(e){this.sessions.push(e)}contains(e){return this.sessions.includes(e)}remove(e){this.sessions=this.sessions.filter((t)=>t!==e)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}destroy(e){for(let t of this.sessions)if(t===e){if(!t.destroyed)t.destroy()}}}class Hr{constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw RangeError("maxConcurrency must be greater than zero.")}config;sessionCache=new Map;lease(e,t){let r=this.getUrlString(e),s=this.sessionCache.get(r);if(s){let c=s.poll();if(c&&!this.config.disableConcurrency)return c}let n=tt.connect(r);if(this.config.maxConcurrency)n.settings({maxConcurrentStreams:this.config.maxConcurrency},(c)=>{if(c)throw Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});n.unref();let o=()=>{n.destroy(),this.deleteSession(r,n)};if(n.on("goaway",o),n.on("error",o),n.on("frameError",o),n.on("close",()=>this.deleteSession(r,n)),t.requestTimeout)n.setTimeout(t.requestTimeout,o);let i=this.sessionCache.get(r)||new Fr;return i.offerLast(n),this.sessionCache.set(r,i),n}deleteSession(e,t){let r=this.sessionCache.get(e);if(!r)return;if(!r.contains(t))return;r.remove(t),this.sessionCache.set(e,r)}release(e,t){let r=this.getUrlString(e);this.sessionCache.get(r)?.offerLast(t)}destroy(){for(let[e,t]of this.sessionCache){for(let r of t){if(!r.destroyed)r.destroy();t.remove(r)}this.sessionCache.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}getUrlString(e){return e.destination.toString()}}class rt{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new Hr({});static create(e){if(typeof e?.handle==="function")return e;return new rt(e)}constructor(e){this.configProvider=new Promise((t,r)=>{if(typeof e==="function")e().then((s)=>{t(s||{})}).catch(r);else t(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:t,requestTimeout:r}={}){if(!this.config){if(this.config=await this.configProvider,this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams||!1),this.config.maxConcurrentStreams)this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams)}let{requestTimeout:s,disableConcurrentStreams:n}=this.config,o=r??s;return new Promise((i,c)=>{let a=!1,l=void 0,d=async($)=>{await l,i($)},f=async($)=>{await l,c($)};if(t?.aborted){a=!0;let $=Me(t);f($);return}let{hostname:u,method:h,port:p,protocol:b,query:y}=e,m="";if(e.username!=null||e.password!=null){let $=e.username??"",B=e.password??"";m=`${$}:${B}@`}let w=`${b}//${m}${u}${p?`:${p}`:""}`,S={destination:new URL(w)},g=this.connectionManager.lease(S,{requestTimeout:this.config?.sessionTimeout,disableConcurrentStreams:n||!1}),O=($)=>{if(n)this.destroySession(g);a=!0,f($)},I=Nr.buildQueryString(y||{}),E=e.path;if(I)E+=`?${I}`;if(e.fragment)E+=`#${e.fragment}`;let x=g.request({...e.headers,[tt.constants.HTTP2_HEADER_PATH]:E,[tt.constants.HTTP2_HEADER_METHOD]:h});if(g.ref(),x.on("response",($)=>{let B=new Lr.HttpResponse({statusCode:$[":status"]||-1,headers:jr($),body:x});if(a=!0,d({response:B}),n)g.close(),this.connectionManager.deleteSession(w,g)}),o)x.setTimeout(o,()=>{x.close();let $=Error(`Stream timed out because of no activity for ${o} ms`);$.name="TimeoutError",O($)});if(t){let $=()=>{x.close();let B=Me(t);O(B)};if(typeof t.addEventListener==="function"){let B=t;B.addEventListener("abort",$,{once:!0}),x.once("close",()=>B.removeEventListener("abort",$))}else t.onabort=$}x.on("frameError",($,B,Qs)=>{O(Error(`Frame type id ${$} in stream id ${Qs} has failed with code ${B}.`))}),x.on("error",O),x.on("aborted",()=>{O(Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${x.rstCode}.`))}),x.on("close",()=>{if(g.unref(),n)g.destroy();if(!a)O(Error("Unexpected error: http2 request did not get a response"))}),l=Cr(x,e,o)})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((r)=>{return{...r,[e]:t}})}httpHandlerConfigs(){return this.config??{}}destroySession(e){if(!e.destroyed)e.destroy()}}class zr extends qr.Writable{bufferedBytes=[];_write(e,t,r){this.bufferedBytes.push(e),r()}}var ei=(e)=>{if(ti(e))return ri(e);return new Promise((t,r)=>{let s=new zr;e.pipe(s),e.on("error",(n)=>{s.end(),r(n)}),s.on("error",r),s.on("finish",function(){let n=new Uint8Array(Buffer.concat(this.bufferedBytes));t(n)})})},ti=(e)=>typeof ReadableStream==="function"&&e instanceof ReadableStream;async function ri(e){let t=[],r=e.getReader(),s=!1,n=0;while(!s){let{done:c,value:a}=await r.read();if(a)t.push(a),n+=a.length;s=c}let o=new Uint8Array(n),i=0;for(let c of t)o.set(c,i),i+=c.length;return o}si.DEFAULT_REQUEST_TIMEOUT=Ko;si.NodeHttp2Handler=rt;si.NodeHttpHandler=Pe;si.streamCollector=ei});var Yr=_((mi)=>{var kr=ye(),ai=et(),fi=k();function Jr(e,t){return new Request(e,t)}function ui(e=0){return new Promise((t,r)=>{if(e)setTimeout(()=>{let s=Error(`Request did not complete within ${e} ms`);s.name="TimeoutError",r(s)},e)})}var Ae={supported:void 0};class st{config;configProvider;static create(e){if(typeof e?.handle==="function")return e;return new st(e)}constructor(e){if(typeof e==="function")this.configProvider=e().then((t)=>t||{});else this.config=e??{},this.configProvider=Promise.resolve(this.config);if(Ae.supported===void 0)Ae.supported=Boolean(typeof Request<"u"&&"keepalive"in Jr("https://[::1]"))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:r}={}){if(!this.config)this.config=await this.configProvider;let s=r??this.config.requestTimeout,n=this.config.keepAlive===!0,o=this.config.credentials;if(t?.aborted){let m=vr(t);return Promise.reject(m)}let i=e.path,c=ai.buildQueryString(e.query||{});if(c)i+=`?${c}`;if(e.fragment)i+=`#${e.fragment}`;let a="";if(e.username!=null||e.password!=null){let m=e.username??"",w=e.password??"";a=`${m}:${w}@`}let{port:l,method:d}=e,f=`${e.protocol}//${a}${e.hostname}${l?`:${l}`:""}${i}`,u=d==="GET"||d==="HEAD"?void 0:e.body,h={body:u,headers:new Headers(e.headers),method:d,credentials:o};if(this.config?.cache)h.cache=this.config.cache;if(u)h.duplex="half";if(typeof AbortController<"u")h.signal=t;if(Ae.supported)h.keepalive=n;if(typeof this.config.requestInit==="function")Object.assign(h,this.config.requestInit(e));let p=()=>{},b=Jr(f,h),y=[fetch(b).then((m)=>{let w=m.headers,S={};for(let O of w.entries())S[O[0]]=O[1];if(m.body==null)return m.blob().then((O)=>({response:new kr.HttpResponse({headers:S,reason:m.statusText,statusCode:m.status,body:O})}));return{response:new kr.HttpResponse({headers:S,reason:m.statusText,statusCode:m.status,body:m.body})}}),ui(s)];if(t)y.push(new Promise((m,w)=>{let S=()=>{let g=vr(t);w(g)};if(typeof t.addEventListener==="function"){let g=t;g.addEventListener("abort",S,{once:!0}),p=()=>g.removeEventListener("abort",S)}else t.onabort=S}));return Promise.race(y).finally(p)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((r)=>{return r[e]=t,r})}httpHandlerConfigs(){return this.config??{}}}function vr(e){let t=e&&typeof e==="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let n=Error("Request aborted");return n.name="AbortError",n.cause=t,n}let s=Error(String(t));return s.name="AbortError",s}let r=Error("Request aborted");return r.name="AbortError",r}var hi=async(e)=>{if(typeof Blob==="function"&&e instanceof Blob||e.constructor?.name==="Blob"){if(Blob.prototype.arrayBuffer!==void 0)return new Uint8Array(await e.arrayBuffer());return di(e)}return li(e)};async function di(e){let t=await pi(e),r=fi.fromBase64(t);return new Uint8Array(r)}async function li(e){let t=[],r=e.getReader(),s=!1,n=0;while(!s){let{done:c,value:a}=await r.read();if(a)t.push(a),n+=a.length;s=c}let o=new Uint8Array(n),i=0;for(let c of t)o.set(c,i),i+=c.length;return o}function pi(e){return new Promise((t,r)=>{let s=new FileReader;s.onloadend=()=>{if(s.readyState!==2)return r(Error("Reader aborted too early"));let n=s.result??"",o=n.indexOf(","),i=o>-1?o+1:n.length;t(n.substring(i))},s.onabort=()=>r(Error("Read aborted")),s.onerror=()=>r(s.error),s.readAsDataURL(e)})}mi.FetchHttpHandler=st;mi.keepAliveSupport=Ae;mi.streamCollector=hi});var Xr=_((Ti)=>{var Qr={},nt={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();if(t.length===1)t=`0${t}`;Qr[e]=t,nt[t]=e}function gi(e){if(e.length%2!==0)throw Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let s=e.slice(r,r+2).toLowerCase();if(s in nt)t[r/2]=nt[s];else throw Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`)}return t}function _i(e){let t="";for(let r=0;r<e.byteLength;r++)t+=Qr[e[r]];return t}Ti.fromHex=gi;Ti.toHex=_i});var ts=_((Kr)=>{Object.defineProperty(Kr,"__esModule",{value:!0});Kr.sdkStreamMixin=void 0;var xi=Yr(),$i=k(),Oi=Xr(),Mi=Te(),Zr=C(),Gr="The stream has already been transformed.",Pi=(e)=>{if(!Vr(e)&&!(0,Zr.isReadableStream)(e)){let n=e?.__proto__?.constructor?.name||e;throw Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let t=!1,r=async()=>{if(t)throw Error(Gr);return t=!0,await(0,xi.streamCollector)(e)},s=(n)=>{if(typeof n.stream!=="function")throw Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
|
|
16
16
|
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 n.stream()};return Object.assign(e,{transformToByteArray:r,transformToString:async(n)=>{let o=await r();if(n==="base64")return(0,$i.toBase64)(o);else if(n==="hex")return(0,Oi.toHex)(o);else if(n===void 0||n==="utf8"||n==="utf-8")return(0,Mi.toUtf8)(o);else if(typeof TextDecoder==="function")return new TextDecoder(n).decode(o);else throw Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw Error(Gr);if(t=!0,Vr(e))return s(e);else if((0,Zr.isReadableStream)(e))return e;else throw Error(`Cannot transform payload to web stream, got ${e}`)}})};Kr.sdkStreamMixin=Pi;var Vr=(e)=>typeof Blob==="function"&&e instanceof Blob});var os=_((ss)=>{Object.defineProperty(ss,"__esModule",{value:!0});ss.sdkStreamMixin=void 0;var Ai=Wr(),Ri=Ze(),ot=D("stream"),Ui=ts(),rs="The stream has already been transformed.",Ii=(e)=>{if(!(e instanceof ot.Readable))try{return(0,Ui.sdkStreamMixin)(e)}catch(s){let n=e?.__proto__?.constructor?.name||e;throw Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${n}`)}let t=!1,r=async()=>{if(t)throw Error(rs);return t=!0,await(0,Ai.streamCollector)(e)};return Object.assign(e,{transformToByteArray:r,transformToString:async(s)=>{let n=await r();if(s===void 0||Buffer.isEncoding(s))return(0,Ri.fromArrayBuffer)(n.buffer,n.byteOffset,n.byteLength).toString(s);else return new TextDecoder(s).decode(n)},transformToWebStream:()=>{if(t)throw Error(rs);if(e.readableFlowing!==null)throw Error("The stream has been consumed by other callbacks.");if(typeof ot.Readable.toWeb!=="function")throw Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return t=!0,ot.Readable.toWeb(e)}})};ss.sdkStreamMixin=Ii});var cs=_((is)=>{Object.defineProperty(is,"__esModule",{value:!0});is.splitStream=Di;async function Di(e){if(typeof e.stream==="function")e=e.stream();return e.tee()}});var hs=_((us)=>{Object.defineProperty(us,"__esModule",{value:!0});us.splitStream=Ni;var as=D("stream"),Li=cs(),fs=C();async function Ni(e){if((0,fs.isReadableStream)(e)||(0,fs.isBlob)(e))return(0,Li.splitStream)(e);let t=new as.PassThrough,r=new as.PassThrough;return e.pipe(t),e.pipe(r),[t,r]}});var ms=_((T)=>{var ds=k(),ls=Te(),Re=Ge(),Ue=or(),Ie=br(),De=Er(),Be=Pr(),Le=os(),Ne=hs(),ps=C();class ne extends Uint8Array{static fromString(e,t="utf-8"){if(typeof e==="string"){if(t==="base64")return ne.mutate(ds.fromBase64(e));return ne.mutate(ls.fromUtf8(e))}throw Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,ne.prototype),e}transformToString(e="utf-8"){if(e==="base64")return ds.toBase64(this);return ls.toUtf8(this)}}T.isBlob=ps.isBlob;T.isReadableStream=ps.isReadableStream;T.Uint8ArrayBlobAdapter=ne;Object.prototype.hasOwnProperty.call(Re,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:Re.__proto__});Object.keys(Re).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=Re[e]});Object.prototype.hasOwnProperty.call(Ue,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:Ue.__proto__});Object.keys(Ue).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=Ue[e]});Object.prototype.hasOwnProperty.call(Ie,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:Ie.__proto__});Object.keys(Ie).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=Ie[e]});Object.prototype.hasOwnProperty.call(De,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:De.__proto__});Object.keys(De).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=De[e]});Object.prototype.hasOwnProperty.call(Be,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:Be.__proto__});Object.keys(Be).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=Be[e]});Object.prototype.hasOwnProperty.call(Le,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:Le.__proto__});Object.keys(Le).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=Le[e]});Object.prototype.hasOwnProperty.call(Ne,"__proto__")&&!Object.prototype.hasOwnProperty.call(T,"__proto__")&&Object.defineProperty(T,"__proto__",{enumerable:!0,value:Ne.__proto__});Object.keys(Ne).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(T,e))T[e]=Ne[e]})});var gs=_((bs)=>{Object.defineProperty(bs,"__esModule",{value:!0});bs.randomUUID=void 0;var zi=Hi(),ys=zi.__importDefault(D("crypto"));bs.randomUUID=ys.default.randomUUID.bind(ys.default)});var Ts=_((ki)=>{var _s=gs(),M=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Wi=()=>{if(_s.randomUUID)return _s.randomUUID();let e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,M[e[0]]+M[e[1]]+M[e[2]]+M[e[3]]+"-"+M[e[4]]+M[e[5]]+"-"+M[e[6]]+M[e[7]]+"-"+M[e[8]]+M[e[9]]+"-"+M[e[10]]+M[e[11]]+M[e[12]]+M[e[13]]+M[e[14]]+M[e[15]]};ki.v4=Wi});var bt=_((Fc)=>{var vi=Ts(),Yi=(e,t,r=(s)=>s)=>e,Qi=(e)=>{switch(e){case"true":return!0;case"false":return!1;default:throw Error(`Unable to parse boolean value "${e}"`)}},Xi=(e)=>{if(e===null||e===void 0)return;if(typeof e==="number"){if(e===0||e===1)ae.warn(je(`Expected boolean, got ${typeof e}: ${e}`));if(e===0)return!1;if(e===1)return!0}if(typeof e==="string"){let t=e.toLowerCase();if(t==="false"||t==="true")ae.warn(je(`Expected boolean, got ${typeof e}: ${e}`));if(t==="false")return!1;if(t==="true")return!0}if(typeof e==="boolean")return e;throw TypeError(`Expected boolean, got ${typeof e}: ${e}`)},ie=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string"){let t=parseFloat(e);if(!Number.isNaN(t)){if(String(t)!==String(e))ae.warn(je(`Expected number but observed string: ${e}`));return t}}if(typeof e==="number")return e;throw TypeError(`Expected number, got ${typeof e}: ${e}`)},Zi=Math.ceil(340282346638528860000000000000000000000),qe=(e)=>{let t=ie(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0){if(Math.abs(t)>Zi)throw TypeError(`Expected 32-bit float, got ${e}`)}return t},ce=(e)=>{if(e===null||e===void 0)return;if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw TypeError(`Expected integer, got ${typeof e}: ${e}`)},Gi=ce,ct=(e)=>ut(e,32),at=(e)=>ut(e,16),ft=(e)=>ut(e,8),ut=(e,t)=>{let r=ce(e);if(r!==void 0&&Vi(r,t)!==r)throw TypeError(`Expected ${t}-bit integer, got ${e}`);return r},Vi=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},Ki=(e,t)=>{if(e===null||e===void 0){if(t)throw TypeError(`Expected a non-null value for ${t}`);throw TypeError("Expected a non-null value")}return e},Ss=(e)=>{if(e===null||e===void 0)return;if(typeof e==="object"&&!Array.isArray(e))return e;let t=Array.isArray(e)?"array":typeof e;throw TypeError(`Expected object, got ${t}: ${e}`)},ec=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string")return e;if(["boolean","number","bigint"].includes(typeof e))return ae.warn(je(`Expected string, got ${typeof e}: ${e}`)),String(e);throw TypeError(`Expected string, got ${typeof e}: ${e}`)},tc=(e)=>{if(e===null||e===void 0)return;let t=Ss(e),r=Object.entries(t).filter(([,s])=>s!=null).map(([s])=>s);if(r.length===0)throw TypeError("Unions must have exactly one non-null member. None were found.");if(r.length>1)throw TypeError(`Unions must have exactly one non-null member. Keys ${r} were not null.`);return t},ht=(e)=>{if(typeof e=="string")return ie(Z(e));return ie(e)},rc=ht,xs=(e)=>{if(typeof e=="string")return qe(Z(e));return qe(e)},sc=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Z=(e)=>{let t=e.match(sc);if(t===null||t[0].length!==e.length)throw TypeError("Expected real number, got implicit NaN");return parseFloat(e)},dt=(e)=>{if(typeof e=="string")return $s(e);return ie(e)},nc=dt,oc=dt,ic=(e)=>{if(typeof e=="string")return $s(e);return qe(e)},$s=(e)=>{switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw Error(`Unable to parse float value: ${e}`)}},Os=(e)=>{if(typeof e==="string")return ce(Z(e));return ce(e)},cc=Os,ac=(e)=>{if(typeof e==="string")return ct(Z(e));return ct(e)},Q=(e)=>{if(typeof e==="string")return at(Z(e));return at(e)},Ms=(e)=>{if(typeof e==="string")return ft(Z(e));return ft(e)},je=(e)=>{return String(TypeError(e).stack||e).split(`
|
|
17
17
|
`).slice(0,5).filter((t)=>!t.includes("stackTraceWarning")).join(`
|
|
18
|
-
`)},ae={warn:console.warn},fc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],lt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function uc(e){let t=e.getUTCFullYear(),r=e.getUTCMonth(),s=e.getUTCDay(),n=e.getUTCDate(),o=e.getUTCHours(),i=e.getUTCMinutes(),c=e.getUTCSeconds(),a=n<10?`0${n}`:`${n}`,l=o<10?`0${o}`:`${o}`,d=i<10?`0${i}`:`${i}`,f=c<10?`0${c}`:`${c}`;return`${fc[s]}, ${a} ${lt[r]} ${t} ${l}:${d}:${f} GMT`}var hc=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),dc=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw TypeError("RFC-3339 date-times must be expressed as strings");let t=hc.exec(e);if(!t)throw TypeError("Invalid RFC-3339 date-time value");let[r,s,n,o,i,c,a,l]=t,d=Q(X(s)),f=L(n,"month",1,12),u=L(o,"day",1,31);return oe(d,f,u,{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l})},lc=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),pc=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw TypeError("RFC-3339 date-times must be expressed as strings");let t=lc.exec(e);if(!t)throw TypeError("Invalid RFC-3339 date-time value");let[r,s,n,o,i,c,a,l,d]=t,f=Q(X(s)),u=L(n,"month",1,12),h=L(o,"day",1,31),p=oe(f,u,h,{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l});if(d.toUpperCase()!="Z")p.setTime(p.getTime()-Mc(d));return p},mc=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$/),yc=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$/),bc=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})$/),wc=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw TypeError("RFC-7231 date-times must be expressed as strings");let t=mc.exec(e);if(t){let[r,s,n,o,i,c,a,l]=t;return oe(Q(X(o)),it(n),L(s,"day",1,31),{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l})}if(t=yc.exec(e),t){let[r,s,n,o,i,c,a,l]=t;return Ec(oe(_c(o),it(n),L(s,"day",1,31),{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l}))}if(t=bc.exec(e),t){let[r,s,n,o,i,c,a,l]=t;return oe(Q(X(l)),it(s),L(n.trimLeft(),"day",1,31),{hours:o,minutes:i,seconds:c,fractionalMilliseconds:a})}throw TypeError("Invalid RFC-7231 date-time value")},gc=(e)=>{if(e===null||e===void 0)return;let t;if(typeof e==="number")t=e;else if(typeof e==="string")t=ht(e);else if(typeof e==="object"&&e.tag===1)t=e.value;else throw TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1000))},oe=(e,t,r,s)=>{let n=t-1;return xc(e,n,r),new Date(Date.UTC(e,n,r,L(s.hours,"hour",0,23),L(s.minutes,"minute",0,59),L(s.seconds,"seconds",0,60),Oc(s.fractionalMilliseconds)))},_c=(e)=>{let t=new Date().getUTCFullYear(),r=Math.floor(t/100)*100+Q(X(e));if(r<t)return r+100;return r},Tc=1576800000000,Ec=(e)=>{if(e.getTime()-new Date().getTime()>Tc)return new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()));return e},it=(e)=>{let t=lt.indexOf(e);if(t<0)throw TypeError(`Invalid month: ${e}`);return t+1},Sc=[31,28,31,30,31,30,31,31,30,31,30,31],xc=(e,t,r)=>{let s=Sc[t];if(t===1&&$c(e))s=29;if(r>s)throw TypeError(`Invalid day for ${lt[t]} in ${e}: ${r}`)},$c=(e)=>{return e%4===0&&(e%100!==0||e%400===0)},L=(e,t,r,s)=>{let n=Ms(X(e));if(n<r||n>s)throw TypeError(`${t} must be between ${r} and ${s}, inclusive`);return n},Oc=(e)=>{if(e===null||e===void 0)return 0;return xs("0."+e)*1000},Mc=(e)=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw TypeError(`Offset direction, ${t}, must be "+" or "-"`);let s=Number(e.substring(1,3)),n=Number(e.substring(4,6));return r*(s*60+n)*60*1000},X=(e)=>{let t=0;while(t<e.length-1&&e.charAt(t)==="0")t++;if(t===0)return e;return e.slice(t)},J=function(t){return Object.assign(new String(t),{deserializeJSON(){return JSON.parse(String(t))},toString(){return String(t)},toJSON(){return String(t)}})};J.from=(e)=>{if(e&&typeof e==="object"&&(e instanceof J||("deserializeJSON"in e)))return e;else if(typeof e==="string"||Object.getPrototypeOf(e)===String.prototype)return J(String(e));return J(JSON.stringify(e))};J.fromObject=J.from;function Pc(e){if(e.includes(",")||e.includes('"'))e=`"${e.replace(/"/g,"\\\"")}"`;return e}var pt="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",mt="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",yt="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Ps="(\\d?\\d)",As="(\\d{4})",Ac=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),Rc=new RegExp(`^${pt}, ${Ps} ${mt} ${As} ${yt} GMT$`),Uc=new RegExp(`^${pt}, ${Ps}-${mt}-(\\d\\d) ${yt} GMT$`),Ic=new RegExp(`^${pt} ${mt} ( [1-9]|\\d\\d) ${yt} ${As}$`),Dc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Bc=(e)=>{if(e==null)return;let t=NaN;if(typeof e==="number")t=e;else if(typeof e==="string"){if(!/^-?\d*\.?\d+$/.test(e))throw TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else if(typeof e==="object"&&e.tag===1)t=e.value;if(isNaN(t)||Math.abs(t)===1/0)throw TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(t*1000))},Lc=(e)=>{if(e==null)return;if(typeof e!=="string")throw TypeError("RFC3339 timestamps must be strings");let t=Ac.exec(e);if(!t)throw TypeError(`Invalid RFC3339 timestamp format ${e}`);let[,r,s,n,o,i,c,,a,l]=t;H(s,1,12),H(n,1,31),H(o,0,23),H(i,0,59),H(c,0,60);let d=new Date(Date.UTC(Number(r),Number(s)-1,Number(n),Number(o),Number(i),Number(c),Number(a)?Math.round(parseFloat(`0.${a}`)*1000):0));if(d.setUTCFullYear(Number(r)),l.toUpperCase()!="Z"){let[,f,u,h]=/([+-])(\d\d):(\d\d)/.exec(l)||[void 0,"+",0,0],p=f==="-"?1:-1;d.setTime(d.getTime()+p*(Number(u)*60*60*1000+Number(h)*60*1000))}return d},Nc=(e)=>{if(e==null)return;if(typeof e!=="string")throw TypeError("RFC7231 timestamps must be strings.");let t,r,s,n,o,i,c,a;if(a=Rc.exec(e))[,t,r,s,n,o,i,c]=a;else if(a=Uc.exec(e))[,t,r,s,n,o,i,c]=a,s=(Number(s)+1900).toString();else if(a=Ic.exec(e))[,r,t,n,o,i,c,s]=a;if(s&&i){let l=Date.UTC(Number(s),Dc.indexOf(r),Number(t),Number(n),Number(o),Number(i),c?Math.round(parseFloat(`0.${c}`)*1000):0);H(t,1,31),H(n,0,23),H(o,0,59),H(i,0,60);let d=new Date(l);return d.setUTCFullYear(Number(s)),d}throw TypeError(`Invalid RFC7231 date-time value ${e}.`)};function H(e,t,r){let s=Number(e);if(s<t||s>r)throw Error(`Value ${s} out of range [${t}, ${r}]`)}function qc(e,t,r){if(r<=0||!Number.isInteger(r))throw Error("Invalid number of delimiters ("+r+") for splitEvery.");let s=e.split(t);if(r===1)return s;let n=[],o="";for(let i=0;i<s.length;i++){if(o==="")o=s[i];else o+=t+s[i];if((i+1)%r===0)n.push(o),o=""}if(o!=="")n.push(o);return n}var jc=(e)=>{let t=e.length,r=[],s=!1,n=void 0,o=0;for(let i=0;i<t;++i){let c=e[i];switch(c){case'"':if(n!=="\\")s=!s;break;case",":if(!s)r.push(e.slice(o,i)),o=i+1;break}n=c}return r.push(e.slice(o)),r.map((i)=>{i=i.trim();let c=i.length;if(c<2)return i;if(i[0]==='"'&&i[c-1]==='"')i=i.slice(1,c-1);return i.replace(/\\"/g,'"')})},Es=/^-?\d*(\.\d+)?$/;class Ce{string;type;constructor(e,t){if(this.string=e,this.type=t,!Es.test(e))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](e){if(!e||typeof e!=="object")return!1;let t=e;return Ce.prototype.isPrototypeOf(e)||t.type==="bigDecimal"&&Es.test(t.string)}}function Cc(e){return new Ce(String(e),"bigDecimal")}Fc.generateIdempotencyToken=vi.v4;Fc.LazyJsonString=J;Fc.NumericValue=Ce;Fc._parseEpochTimestamp=Bc;Fc._parseRfc3339DateTimeWithOffset=Lc;Fc._parseRfc7231DateTime=Nc;Fc.copyDocumentWithTransform=Yi;Fc.dateToUtcString=uc;Fc.expectBoolean=Xi;Fc.expectByte=ft;Fc.expectFloat32=qe;Fc.expectInt=Gi;Fc.expectInt32=ct;Fc.expectLong=ce;Fc.expectNonNull=Ki;Fc.expectNumber=ie;Fc.expectObject=Ss;Fc.expectShort=at;Fc.expectString=ec;Fc.expectUnion=tc;Fc.handleFloat=nc;Fc.limitedParseDouble=dt;Fc.limitedParseFloat=oc;Fc.limitedParseFloat32=ic;Fc.logger=ae;Fc.nv=Cc;Fc.parseBoolean=Qi;Fc.parseEpochTimestamp=gc;Fc.parseRfc3339DateTime=dc;Fc.parseRfc3339DateTimeWithOffset=pc;Fc.parseRfc7231DateTime=wc;Fc.quoteHeader=Pc;Fc.splitEvery=qc;Fc.splitHeader=jc;Fc.strictParseByte=Ms;Fc.strictParseDouble=ht;Fc.strictParseFloat=rc;Fc.strictParseFloat32=xs;Fc.strictParseInt=cc;Fc.strictParseInt32=ac;Fc.strictParseLong=Os;Fc.strictParseShort=Q});var Ls=_((Ra)=>{var Fe=ms(),R=Qe(),U=bt(),fe=ye(),He=k(),wt=Te(),v=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Fe.Uint8ArrayBlobAdapter.mutate(e);if(!e)return Fe.Uint8ArrayBlobAdapter.mutate(new Uint8Array);let r=t.streamCollector(e);return Fe.Uint8ArrayBlobAdapter.mutate(await r)};function ue(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}class G{serdeContext;setSerdeContext(e){this.serdeContext=e}}class ze extends G{options;compositeErrorRegistry;constructor(e){super();this.options=e,this.compositeErrorRegistry=R.TypeRegistry.for(e.defaultNamespace);for(let t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return fe.HttpRequest}getResponseType(){return fe.HttpResponse}setSerdeContext(e){if(this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec())this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){if(e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,!e.query)e.query={};for(let[r,s]of t.url.searchParams.entries())e.query[r]=s;if(t.headers)for(let[r,s]of Object.entries(t.headers))e.headers[r]=s.join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(let[r,s]of Object.entries(t.headers))e.headers[r]=s;return e}}setHostPrefix(e,t,r){if(this.serdeContext?.disableHostPrefix)return;let s=R.NormalizedSchema.of(t.input),n=R.translateTraits(t.traits??{});if(n.endpoint){let o=n.endpoint?.[0];if(typeof o==="string"){let i=[...s.structIterator()].filter(([,c])=>c.getMergedTraits().hostLabel);for(let[c]of i){let a=r[c];if(typeof a!=="string")throw Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);o=o.replace(`{${c}}`,a)}e.hostname=o+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r})}async loadEventStreamCapability(){let{EventStreamSerde:e}=await import("./chunk-z7wchajg.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,r,s,n){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class Rs extends ze{async serializeRequest(e,t,r){let s={...t??{}},n=this.serializer,o={},i={},c=await r.endpoint(),a=R.NormalizedSchema.of(e?.input),l=[],d=[],f=!1,u,h=new fe.HttpRequest({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:o,headers:i,body:void 0});if(c){this.updateServiceEndpoint(h,c),this.setHostPrefix(h,e,s);let p=R.translateTraits(e.traits);if(p.http){h.method=p.http[0];let[b,y]=p.http[1].split("?");if(h.path=="/")h.path=b;else h.path+=b;let m=new URLSearchParams(y??"");Object.assign(o,Object.fromEntries(m))}}for(let[p,b]of a.structIterator()){let y=b.getMergedTraits()??{},m=s[p];if(m==null&&!b.isIdempotencyToken()){if(y.httpLabel){if(h.path.includes(`{${p}+}`)||h.path.includes(`{${p}}`))throw Error(`No value provided for input HTTP label: ${p}.`)}continue}if(y.httpPayload){if(b.isStreaming())if(b.isStructSchema()){if(s[p])u=await this.serializeEventStream({eventStream:s[p],requestSchema:a})}else u=m;else n.write(b,m),u=n.flush();delete s[p]}else if(y.httpLabel){n.write(b,m);let w=n.flush();if(h.path.includes(`{${p}+}`))h.path=h.path.replace(`{${p}+}`,w.split("/").map(ue).join("/"));else if(h.path.includes(`{${p}}`))h.path=h.path.replace(`{${p}}`,ue(w));delete s[p]}else if(y.httpHeader)n.write(b,m),i[y.httpHeader.toLowerCase()]=String(n.flush()),delete s[p];else if(typeof y.httpPrefixHeaders==="string"){for(let[w,S]of Object.entries(m)){let g=y.httpPrefixHeaders+w;n.write([b.getValueSchema(),{httpHeader:g}],S),i[g.toLowerCase()]=n.flush()}delete s[p]}else if(y.httpQuery||y.httpQueryParams)this.serializeQuery(b,m,o),delete s[p];else f=!0,l.push(p),d.push(b)}if(f&&s){let[p,b]=(a.getName(!0)??"#Unknown").split("#"),y=a.getSchema()[6],m=[3,p,b,a.getMergedTraits(),l,d,void 0];if(y)m[6]=y;else m.pop();n.write(m,s),u=n.flush()}return h.headers=i,h.query=o,h.body=u,h}serializeQuery(e,t,r){let s=this.serializer,n=e.getMergedTraits();if(n.httpQueryParams){for(let[o,i]of Object.entries(t))if(!(o in r)){let c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...n,httpQuery:o,httpQueryParams:void 0}),this.serializeQuery(c,i,r)}return}if(e.isListSchema()){let o=!!e.getMergedTraits().sparse,i=[];for(let c of t){s.write([e.getValueSchema(),n],c);let a=s.flush();if(o||a!==void 0)i.push(a)}r[n.httpQuery]=i}else s.write([e,n],t),r[n.httpQuery]=s.flush()}async deserializeResponse(e,t,r){let s=this.deserializer,n=R.NormalizedSchema.of(e.output),o={};if(r.statusCode>=300){let c=await v(r.body,t);if(c.byteLength>0)Object.assign(o,await s.read(15,c));throw await this.handleError(e,t,r,o,this.deserializeMetadata(r)),Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in r.headers){let a=r.headers[c];delete r.headers[c],r.headers[c.toLowerCase()]=a}let i=await this.deserializeHttpMessage(n,t,r,o);if(i.length){let c=await v(r.body,t);if(c.byteLength>0){let a=await s.read(n,c);for(let l of i)if(a[l]!=null)o[l]=a[l]}}else if(i.discardResponseBody)await v(r.body,t);return o.$metadata=this.deserializeMetadata(r),o}async deserializeHttpMessage(e,t,r,s,n){let o;if(s instanceof Set)o=n;else o=s;let i=!0,c=this.deserializer,a=R.NormalizedSchema.of(e),l=[];for(let[d,f]of a.structIterator()){let u=f.getMemberTraits();if(u.httpPayload){if(i=!1,f.isStreaming())if(f.isStructSchema())o[d]=await this.deserializeEventStream({response:r,responseSchema:a});else o[d]=Fe.sdkStreamMixin(r.body);else if(r.body){let p=await v(r.body,t);if(p.byteLength>0)o[d]=await c.read(f,p)}}else if(u.httpHeader){let h=String(u.httpHeader).toLowerCase(),p=r.headers[h];if(p!=null)if(f.isListSchema()){let b=f.getValueSchema();b.getMergedTraits().httpHeader=h;let y;if(b.isTimestampSchema()&&b.getSchema()===4)y=U.splitEvery(p,",",2);else y=U.splitHeader(p);let m=[];for(let w of y)m.push(await c.read(b,w.trim()));o[d]=m}else o[d]=await c.read(f,p)}else if(u.httpPrefixHeaders!==void 0){o[d]={};for(let[h,p]of Object.entries(r.headers))if(h.startsWith(u.httpPrefixHeaders)){let b=f.getValueSchema();b.getMergedTraits().httpHeader=h,o[d][h.slice(u.httpPrefixHeaders.length)]=await c.read(b,p)}}else if(u.httpResponseCode)o[d]=r.statusCode;else l.push(d)}return l.discardResponseBody=i,l}}class Us extends ze{async serializeRequest(e,t,r){let s=this.serializer,n={},o={},i=await r.endpoint(),c=R.NormalizedSchema.of(e?.input),a=c.getSchema(),l,d=new fe.HttpRequest({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:n,headers:o,body:void 0});if(i)this.updateServiceEndpoint(d,i),this.setHostPrefix(d,e,t);let f={...t};if(t){let u=c.getEventStreamMember();if(u){if(f[u]){let h={};for(let[p,b]of c.structIterator())if(p!==u&&f[p])s.write(b,f[p]),h[p]=s.flush();l=await this.serializeEventStream({eventStream:f[u],requestSchema:c,initialRequest:h})}}else s.write(a,f),l=s.flush()}return d.headers=Object.assign(d.headers,o),d.query=n,d.body=l,d.method="POST",d}async deserializeResponse(e,t,r){let s=this.deserializer,n=R.NormalizedSchema.of(e.output),o={};if(r.statusCode>=300){let c=await v(r.body,t);if(c.byteLength>0)Object.assign(o,await s.read(15,c));throw await this.handleError(e,t,r,o,this.deserializeMetadata(r)),Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in r.headers){let a=r.headers[c];delete r.headers[c],r.headers[c.toLowerCase()]=a}let i=n.getEventStreamMember();if(i)o[i]=await this.deserializeEventStream({response:r,responseSchema:n,initialResponseContainer:o});else{let c=await v(r.body,t);if(c.byteLength>0)Object.assign(o,await s.read(n,c))}return o.$metadata=this.deserializeMetadata(r),o}}var Is=(e,t,r,s,n,o)=>{if(t!=null&&t[r]!==void 0){let i=s();if(i==null||i.length<=0)throw Error("Empty value provided for input HTTP label: "+r+".");e=e.replace(n,o?i.split("/").map((c)=>ue(c)).join("/"):ue(i))}else throw Error("No value provided for input HTTP label: "+r+".");return e};function Aa(e,t){return new gt(e,t)}class gt{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,t){this.input=e,this.context=t}async build(){let{hostname:e,protocol:t="https",port:r,path:s}=await this.context.endpoint();this.path=s;for(let n of this.resolvePathStack)n(this.path);return new fe.HttpRequest({protocol:t,hostname:this.hostname||e,port:r,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push((t)=>{this.path=`${t?.endsWith("/")?t.slice(0,-1):t||""}`+e}),this}p(e,t,r,s){return this.resolvePathStack.push((n)=>{this.path=Is(n,this.input,e,t,r,s)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}function _t(e,t){if(t.timestampFormat.useTrait){if(e.isTimestampSchema()&&(e.getSchema()===5||e.getSchema()===6||e.getSchema()===7))return e.getSchema()}let{httpLabel:r,httpPrefixHeaders:s,httpHeader:n,httpQuery:o}=e.getMergedTraits();return(t.httpBindings?typeof s==="string"||Boolean(n)?6:Boolean(o)||Boolean(r)?5:void 0:void 0)??t.timestampFormat.default}class Tt extends G{settings;constructor(e){super();this.settings=e}read(e,t){let r=R.NormalizedSchema.of(e);if(r.isListSchema())return U.splitHeader(t).map((s)=>this.read(r.getValueSchema(),s));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??He.fromBase64)(t);if(r.isTimestampSchema())switch(_t(r,this.settings)){case 5:return U._parseRfc3339DateTimeWithOffset(t);case 6:return U._parseRfc7231DateTime(t);case 7:return U._parseEpochTimestamp(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(r.isStringSchema()){let s=r.getMergedTraits().mediaType,n=t;if(s){if(r.getMergedTraits().httpHeader)n=this.base64ToUtf8(n);if(s==="application/json"||s.endsWith("+json"))n=U.LazyJsonString.from(n);return n}}if(r.isNumericSchema())return Number(t);if(r.isBigIntegerSchema())return BigInt(t);if(r.isBigDecimalSchema())return new U.NumericValue(t,"bigDecimal");if(r.isBooleanSchema())return String(t).toLowerCase()==="true";return t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??wt.toUtf8)((this.serdeContext?.base64Decoder??He.fromBase64)(e))}}class Ds extends G{codecDeserializer;stringDeserializer;constructor(e,t){super();this.codecDeserializer=e,this.stringDeserializer=new Tt(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){let r=R.NormalizedSchema.of(e),s=r.getMergedTraits(),n=this.serdeContext?.utf8Encoder??wt.toUtf8;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(r,n(t));if(s.httpPayload){if(r.isBlobSchema()){let o=this.serdeContext?.utf8Decoder??wt.fromUtf8;if(typeof t==="string")return o(t);return t}else if(r.isStringSchema()){if("byteLength"in t)return n(t);return t}}return this.codecDeserializer.read(r,t)}}class Et extends G{settings;stringBuffer="";constructor(e){super();this.settings=e}write(e,t){let r=R.NormalizedSchema.of(e);switch(typeof t){case"object":if(t===null){this.stringBuffer="null";return}if(r.isTimestampSchema()){if(!(t instanceof Date))throw Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${r.getName(!0)}`);switch(_t(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=U.dateToUtcString(t);break;case 7:this.stringBuffer=String(t.getTime()/1000);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1000)}return}if(r.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??He.toBase64)(t);return}if(r.isListSchema()&&Array.isArray(t)){let o="";for(let i of t){this.write([r.getValueSchema(),r.getMergedTraits()],i);let c=this.flush(),a=r.getValueSchema().isTimestampSchema()?c:U.quoteHeader(c);if(o!=="")o+=", ";o+=a}this.stringBuffer=o;return}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":let s=r.getMergedTraits().mediaType,n=t;if(s){if(s==="application/json"||s.endsWith("+json"))n=U.LazyJsonString.from(n);if(r.getMergedTraits().httpHeader){this.stringBuffer=(this.serdeContext?.base64Encoder??He.toBase64)(n.toString());return}}this.stringBuffer=t;break;default:if(r.isIdempotencyToken())this.stringBuffer=U.generateIdempotencyToken();else this.stringBuffer=String(t)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}class Bs{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new Et(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){let r=R.NormalizedSchema.of(e),s=r.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(r,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(r,t)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}Ra.FromStringShapeDeserializer=Tt;Ra.HttpBindingProtocol=Rs;Ra.HttpInterceptingShapeDeserializer=Ds;Ra.HttpInterceptingShapeSerializer=Bs;Ra.HttpProtocol=ze;Ra.RequestBuilder=gt;Ra.RpcProtocol=Us;Ra.SerdeContext=G;Ra.ToStringShapeSerializer=Et;Ra.collectBody=v;Ra.determineTimestampFormat=_t;Ra.extendedEncodeURIComponent=ue;Ra.requestBuilder=Aa;Ra.resolvedPath=Is});var Ff=_((he)=>{var qs=Ct(),Ot=Ls(),We=At(),Ja=Qe(),ke=bt();class js{config;middlewareStack=qs.constructStack();initConfig;handlers;constructor(e){this.config=e;let{protocol:t,protocolSettings:r}=e;if(r){if(typeof t==="function")e.protocol=new t(r)}}send(e,t,r){let s=typeof t!=="function"?t:void 0,n=typeof t==="function"?t:r,o=s===void 0&&this.config.cacheMiddleware===!0,i;if(o){if(!this.handlers)this.handlers=new WeakMap;let c=this.handlers;if(c.has(e.constructor))i=c.get(e.constructor);else i=e.resolveMiddleware(this.middlewareStack,this.config,s),c.set(e.constructor,i)}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,s);if(n)i(e).then((c)=>n(null,c.output),(c)=>n(c)).catch(()=>{});else return i(e).then((c)=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}var St="***SensitiveInformation***";function xt(e,t){if(t==null)return t;let r=Ja.NormalizedSchema.of(e);if(r.getMergedTraits().sensitive)return St;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return St}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return St}else if(r.isStructSchema()&&typeof t==="object"){let s=t,n={};for(let[o,i]of r.structIterator())if(s[o]!=null)n[o]=xt(i,s[o]);return n}return t}class Mt{middlewareStack=qs.constructStack();schema;static classBuilder(){return new Cs}resolveMiddlewareWithContext(e,t,r,{middlewareFn:s,clientName:n,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,smithyContext:a,additionalContext:l,CommandCtor:d}){for(let b of s.bind(this)(d,e,t,r))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:u}=t,h={logger:u,clientName:n,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,[We.SMITHY_CONTEXT_KEY]:{commandInstance:this,...a},...l},{requestHandler:p}=t;return f.resolve((b)=>p.handle(b.request,r||{}),h)}}class Cs{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=(r)=>r,t=(r)=>r){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,t;return t=class extends Mt{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[r]){super();this.input=r??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(r,s,n){let o=e._operationSchema,i=o?.[4]??o?.input,c=o?.[5]??o?.output;return this.resolveMiddlewareWithContext(r,s,n,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(o?xt.bind(null,i):(a)=>a),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(o?xt.bind(null,c):(a)=>a),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}var va="***SensitiveInformation***",Ya=(e,t,r)=>{for(let[o,i]of Object.entries(e)){let c=async function(l,d,f){let u=new i(l);if(typeof d==="function")this.send(u,d);else if(typeof f==="function"){if(typeof d!=="object")throw Error(`Expected http options but got ${typeof d}`);this.send(u,d||{},f)}else return this.send(u,d)},a=(o[0].toLowerCase()+o.slice(1)).replace(/Command$/,"");t.prototype[a]=c}let{paginators:s={},waiters:n={}}=r??{};for(let[o,i]of Object.entries(s))if(t.prototype[o]===void 0)t.prototype[o]=function(c={},a,...l){return i({...a,client:this},c,...l)};for(let[o,i]of Object.entries(n))if(t.prototype[o]===void 0)t.prototype[o]=async function(c={},a,...l){let d=a;if(typeof a==="number")d={maxWaitTime:a};return i({...d,client:this},c,...l)}};class V extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let t=e;return V.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let t=e;if(this===V)return V.isInstance(e);if(V.isInstance(e)){if(t.name&&this.name)return this.prototype.isPrototypeOf(e)||t.name===this.name;return this.prototype.isPrototypeOf(e)}return!1}}var Fs=(e,t={})=>{Object.entries(t).filter(([,s])=>s!==void 0).forEach(([s,n])=>{if(e[s]==null||e[s]==="")e[s]=n});let r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e},Hs=({output:e,parsedBody:t,exceptionCtor:r,errorCode:s})=>{let n=Xa(e),o=n.httpStatusCode?n.httpStatusCode+"":void 0,i=new r({name:t?.code||t?.Code||s||o||"UnknownError",$fault:"client",$metadata:n});throw Fs(i,t)},Qa=(e)=>{return({output:t,parsedBody:r,errorCode:s})=>{Hs({output:t,parsedBody:r,exceptionCtor:e,errorCode:s})}},Xa=(e)=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),Za=(e)=>{switch(e){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{}}},Ns=!1,Ga=(e)=>{if(e&&!Ns&&parseInt(e.substring(1,e.indexOf(".")))<16)Ns=!0},zs=Object.values(We.AlgorithmId),Va=(e)=>{let t=[];for(let r in We.AlgorithmId){let s=We.AlgorithmId[r];if(e[s]===void 0)continue;t.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}for(let[r,s]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};let s=r.algorithmId(),n=r.checksumConstructor();if(zs.includes(s))e.checksumAlgorithms[s.toUpperCase()]=n;else e.checksumAlgorithms[s]=n;t.push(r)},checksumAlgorithms(){return t}}},Ka=(e)=>{let t={};return e.checksumAlgorithms().forEach((r)=>{let s=r.algorithmId();if(zs.includes(s))t[s]=r.checksumConstructor()}),t},ef=(e)=>{return{setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}},tf=(e)=>{let t={};return t.retryStrategy=e.retryStrategy(),t},Ws=(e)=>{return Object.assign(Va(e),ef(e))},rf=Ws,sf=(e)=>{return Object.assign(Ka(e),tf(e))},nf=(e)=>Array.isArray(e)?e:[e],ks=(e)=>{for(let r in e)if(e.hasOwnProperty(r)&&e[r]["#text"]!==void 0)e[r]=e[r]["#text"];else if(typeof e[r]==="object"&&e[r]!==null)e[r]=ks(e[r]);return e},of=(e)=>{return e!=null};class Js{trace(){}debug(){}info(){}warn(){}error(){}}function vs(e,t,r){let s,n,o;if(typeof t>"u"&&typeof r>"u")s={},o=e;else if(s=e,typeof t==="function")return n=t,o=r,ff(s,n,o);else o=t;for(let i of Object.keys(o)){if(!Array.isArray(o[i])){s[i]=o[i];continue}Ys(s,null,o,i)}return s}var cf=(e)=>{let t={};for(let[r,s]of Object.entries(e||{}))t[r]=[,s];return t},af=(e,t)=>{let r={};for(let s in t)Ys(r,e,t,s);return r},ff=(e,t,r)=>{return vs(e,Object.entries(r).reduce((s,[n,o])=>{if(Array.isArray(o))s[n]=o;else if(typeof o==="function")s[n]=[t,o()];else s[n]=[t,o];return s},{}))},Ys=(e,t,r,s)=>{if(t!==null){let i=r[s];if(typeof i==="function")i=[,i];let[c=uf,a=hf,l=s]=i;if(typeof c==="function"&&c(t[l])||typeof c!=="function"&&!!c)e[s]=a(t[l]);return}let[n,o]=r[s];if(typeof o==="function"){let i,c=n===void 0&&(i=o())!=null,a=typeof n==="function"&&!!n(void 0)||typeof n!=="function"&&!!n;if(c)e[s]=i;else if(a)e[s]=o()}else{let i=n===void 0&&o!=null,c=typeof n==="function"&&!!n(o)||typeof n!=="function"&&!!n;if(i||c)e[s]=o}},uf=(e)=>e!=null,hf=(e)=>e,df=(e)=>{if(e!==e)return"NaN";switch(e){case 1/0:return"Infinity";case-1/0:return"-Infinity";default:return e}},lf=(e)=>e.toISOString().replace(".000Z","Z"),$t=(e)=>{if(e==null)return{};if(Array.isArray(e))return e.filter((t)=>t!=null).map($t);if(typeof e==="object"){let t={};for(let r of Object.keys(e)){if(e[r]==null)continue;t[r]=$t(e[r])}return t}return e};he.collectBody=Ot.collectBody;he.extendedEncodeURIComponent=Ot.extendedEncodeURIComponent;he.resolvedPath=Ot.resolvedPath;he.Client=js;he.Command=Mt;he.NoOpLogger=Js;he.SENSITIVE_STRING=va;he.ServiceException=V;he._json=$t;he.convertMap=cf;he.createAggregatedClient=Ya;he.decorateServiceException=Fs;he.emitWarningIfUnsupportedVersion=Ga;he.getArrayIfSingleItem=nf;he.getDefaultClientConfiguration=rf;he.getDefaultExtensionConfiguration=Ws;he.getValueFromTextNode=ks;he.isSerializableHeaderValue=of;he.loadConfigsForDefaultMode=Za;he.map=vs;he.resolveDefaultRuntimeConfig=sf;he.serializeDateTime=lf;he.serializeFloat=df;he.take=af;he.throwDefaultError=Hs;he.withBaseException=Qa;Object.prototype.hasOwnProperty.call(ke,"__proto__")&&!Object.prototype.hasOwnProperty.call(he,"__proto__")&&Object.defineProperty(he,"__proto__",{enumerable:!0,value:ke.__proto__});Object.keys(ke).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(he,e))he[e]=ke[e]})});
|
|
18
|
+
`)},ae={warn:console.warn},fc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],lt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function uc(e){let t=e.getUTCFullYear(),r=e.getUTCMonth(),s=e.getUTCDay(),n=e.getUTCDate(),o=e.getUTCHours(),i=e.getUTCMinutes(),c=e.getUTCSeconds(),a=n<10?`0${n}`:`${n}`,l=o<10?`0${o}`:`${o}`,d=i<10?`0${i}`:`${i}`,f=c<10?`0${c}`:`${c}`;return`${fc[s]}, ${a} ${lt[r]} ${t} ${l}:${d}:${f} GMT`}var hc=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),dc=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw TypeError("RFC-3339 date-times must be expressed as strings");let t=hc.exec(e);if(!t)throw TypeError("Invalid RFC-3339 date-time value");let[r,s,n,o,i,c,a,l]=t,d=Q(X(s)),f=L(n,"month",1,12),u=L(o,"day",1,31);return oe(d,f,u,{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l})},lc=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),pc=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw TypeError("RFC-3339 date-times must be expressed as strings");let t=lc.exec(e);if(!t)throw TypeError("Invalid RFC-3339 date-time value");let[r,s,n,o,i,c,a,l,d]=t,f=Q(X(s)),u=L(n,"month",1,12),h=L(o,"day",1,31),p=oe(f,u,h,{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l});if(d.toUpperCase()!="Z")p.setTime(p.getTime()-Mc(d));return p},mc=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$/),yc=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$/),bc=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})$/),wc=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw TypeError("RFC-7231 date-times must be expressed as strings");let t=mc.exec(e);if(t){let[r,s,n,o,i,c,a,l]=t;return oe(Q(X(o)),it(n),L(s,"day",1,31),{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l})}if(t=yc.exec(e),t){let[r,s,n,o,i,c,a,l]=t;return Ec(oe(_c(o),it(n),L(s,"day",1,31),{hours:i,minutes:c,seconds:a,fractionalMilliseconds:l}))}if(t=bc.exec(e),t){let[r,s,n,o,i,c,a,l]=t;return oe(Q(X(l)),it(s),L(n.trimLeft(),"day",1,31),{hours:o,minutes:i,seconds:c,fractionalMilliseconds:a})}throw TypeError("Invalid RFC-7231 date-time value")},gc=(e)=>{if(e===null||e===void 0)return;let t;if(typeof e==="number")t=e;else if(typeof e==="string")t=ht(e);else if(typeof e==="object"&&e.tag===1)t=e.value;else throw TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1000))},oe=(e,t,r,s)=>{let n=t-1;return xc(e,n,r),new Date(Date.UTC(e,n,r,L(s.hours,"hour",0,23),L(s.minutes,"minute",0,59),L(s.seconds,"seconds",0,60),Oc(s.fractionalMilliseconds)))},_c=(e)=>{let t=new Date().getUTCFullYear(),r=Math.floor(t/100)*100+Q(X(e));if(r<t)return r+100;return r},Tc=1576800000000,Ec=(e)=>{if(e.getTime()-new Date().getTime()>Tc)return new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()));return e},it=(e)=>{let t=lt.indexOf(e);if(t<0)throw TypeError(`Invalid month: ${e}`);return t+1},Sc=[31,28,31,30,31,30,31,31,30,31,30,31],xc=(e,t,r)=>{let s=Sc[t];if(t===1&&$c(e))s=29;if(r>s)throw TypeError(`Invalid day for ${lt[t]} in ${e}: ${r}`)},$c=(e)=>{return e%4===0&&(e%100!==0||e%400===0)},L=(e,t,r,s)=>{let n=Ms(X(e));if(n<r||n>s)throw TypeError(`${t} must be between ${r} and ${s}, inclusive`);return n},Oc=(e)=>{if(e===null||e===void 0)return 0;return xs("0."+e)*1000},Mc=(e)=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw TypeError(`Offset direction, ${t}, must be "+" or "-"`);let s=Number(e.substring(1,3)),n=Number(e.substring(4,6));return r*(s*60+n)*60*1000},X=(e)=>{let t=0;while(t<e.length-1&&e.charAt(t)==="0")t++;if(t===0)return e;return e.slice(t)},J=function(t){return Object.assign(new String(t),{deserializeJSON(){return JSON.parse(String(t))},toString(){return String(t)},toJSON(){return String(t)}})};J.from=(e)=>{if(e&&typeof e==="object"&&(e instanceof J||("deserializeJSON"in e)))return e;else if(typeof e==="string"||Object.getPrototypeOf(e)===String.prototype)return J(String(e));return J(JSON.stringify(e))};J.fromObject=J.from;function Pc(e){if(e.includes(",")||e.includes('"'))e=`"${e.replace(/"/g,"\\\"")}"`;return e}var pt="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",mt="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",yt="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Ps="(\\d?\\d)",As="(\\d{4})",Ac=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),Rc=new RegExp(`^${pt}, ${Ps} ${mt} ${As} ${yt} GMT$`),Uc=new RegExp(`^${pt}, ${Ps}-${mt}-(\\d\\d) ${yt} GMT$`),Ic=new RegExp(`^${pt} ${mt} ( [1-9]|\\d\\d) ${yt} ${As}$`),Dc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Bc=(e)=>{if(e==null)return;let t=NaN;if(typeof e==="number")t=e;else if(typeof e==="string"){if(!/^-?\d*\.?\d+$/.test(e))throw TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else if(typeof e==="object"&&e.tag===1)t=e.value;if(isNaN(t)||Math.abs(t)===1/0)throw TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(t*1000))},Lc=(e)=>{if(e==null)return;if(typeof e!=="string")throw TypeError("RFC3339 timestamps must be strings");let t=Ac.exec(e);if(!t)throw TypeError(`Invalid RFC3339 timestamp format ${e}`);let[,r,s,n,o,i,c,,a,l]=t;H(s,1,12),H(n,1,31),H(o,0,23),H(i,0,59),H(c,0,60);let d=new Date(Date.UTC(Number(r),Number(s)-1,Number(n),Number(o),Number(i),Number(c),Number(a)?Math.round(parseFloat(`0.${a}`)*1000):0));if(d.setUTCFullYear(Number(r)),l.toUpperCase()!="Z"){let[,f,u,h]=/([+-])(\d\d):(\d\d)/.exec(l)||[void 0,"+",0,0],p=f==="-"?1:-1;d.setTime(d.getTime()+p*(Number(u)*60*60*1000+Number(h)*60*1000))}return d},Nc=(e)=>{if(e==null)return;if(typeof e!=="string")throw TypeError("RFC7231 timestamps must be strings.");let t,r,s,n,o,i,c,a;if(a=Rc.exec(e))[,t,r,s,n,o,i,c]=a;else if(a=Uc.exec(e))[,t,r,s,n,o,i,c]=a,s=(Number(s)+1900).toString();else if(a=Ic.exec(e))[,r,t,n,o,i,c,s]=a;if(s&&i){let l=Date.UTC(Number(s),Dc.indexOf(r),Number(t),Number(n),Number(o),Number(i),c?Math.round(parseFloat(`0.${c}`)*1000):0);H(t,1,31),H(n,0,23),H(o,0,59),H(i,0,60);let d=new Date(l);return d.setUTCFullYear(Number(s)),d}throw TypeError(`Invalid RFC7231 date-time value ${e}.`)};function H(e,t,r){let s=Number(e);if(s<t||s>r)throw Error(`Value ${s} out of range [${t}, ${r}]`)}function qc(e,t,r){if(r<=0||!Number.isInteger(r))throw Error("Invalid number of delimiters ("+r+") for splitEvery.");let s=e.split(t);if(r===1)return s;let n=[],o="";for(let i=0;i<s.length;i++){if(o==="")o=s[i];else o+=t+s[i];if((i+1)%r===0)n.push(o),o=""}if(o!=="")n.push(o);return n}var jc=(e)=>{let t=e.length,r=[],s=!1,n=void 0,o=0;for(let i=0;i<t;++i){let c=e[i];switch(c){case'"':if(n!=="\\")s=!s;break;case",":if(!s)r.push(e.slice(o,i)),o=i+1;break}n=c}return r.push(e.slice(o)),r.map((i)=>{i=i.trim();let c=i.length;if(c<2)return i;if(i[0]==='"'&&i[c-1]==='"')i=i.slice(1,c-1);return i.replace(/\\"/g,'"')})},Es=/^-?\d*(\.\d+)?$/;class Ce{string;type;constructor(e,t){if(this.string=e,this.type=t,!Es.test(e))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](e){if(!e||typeof e!=="object")return!1;let t=e;return Ce.prototype.isPrototypeOf(e)||t.type==="bigDecimal"&&Es.test(t.string)}}function Cc(e){return new Ce(String(e),"bigDecimal")}Fc.generateIdempotencyToken=vi.v4;Fc.LazyJsonString=J;Fc.NumericValue=Ce;Fc._parseEpochTimestamp=Bc;Fc._parseRfc3339DateTimeWithOffset=Lc;Fc._parseRfc7231DateTime=Nc;Fc.copyDocumentWithTransform=Yi;Fc.dateToUtcString=uc;Fc.expectBoolean=Xi;Fc.expectByte=ft;Fc.expectFloat32=qe;Fc.expectInt=Gi;Fc.expectInt32=ct;Fc.expectLong=ce;Fc.expectNonNull=Ki;Fc.expectNumber=ie;Fc.expectObject=Ss;Fc.expectShort=at;Fc.expectString=ec;Fc.expectUnion=tc;Fc.handleFloat=nc;Fc.limitedParseDouble=dt;Fc.limitedParseFloat=oc;Fc.limitedParseFloat32=ic;Fc.logger=ae;Fc.nv=Cc;Fc.parseBoolean=Qi;Fc.parseEpochTimestamp=gc;Fc.parseRfc3339DateTime=dc;Fc.parseRfc3339DateTimeWithOffset=pc;Fc.parseRfc7231DateTime=wc;Fc.quoteHeader=Pc;Fc.splitEvery=qc;Fc.splitHeader=jc;Fc.strictParseByte=Ms;Fc.strictParseDouble=ht;Fc.strictParseFloat=rc;Fc.strictParseFloat32=xs;Fc.strictParseInt=cc;Fc.strictParseInt32=ac;Fc.strictParseLong=Os;Fc.strictParseShort=Q});var Ls=_((Ra)=>{var Fe=ms(),R=Qe(),U=bt(),fe=ye(),He=k(),wt=Te(),v=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Fe.Uint8ArrayBlobAdapter.mutate(e);if(!e)return Fe.Uint8ArrayBlobAdapter.mutate(new Uint8Array);let r=t.streamCollector(e);return Fe.Uint8ArrayBlobAdapter.mutate(await r)};function ue(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}class G{serdeContext;setSerdeContext(e){this.serdeContext=e}}class ze extends G{options;compositeErrorRegistry;constructor(e){super();this.options=e,this.compositeErrorRegistry=R.TypeRegistry.for(e.defaultNamespace);for(let t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return fe.HttpRequest}getResponseType(){return fe.HttpResponse}setSerdeContext(e){if(this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec())this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){if(e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,!e.query)e.query={};for(let[r,s]of t.url.searchParams.entries())e.query[r]=s;if(t.headers)for(let[r,s]of Object.entries(t.headers))e.headers[r]=s.join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(let[r,s]of Object.entries(t.headers))e.headers[r]=s;return e}}setHostPrefix(e,t,r){if(this.serdeContext?.disableHostPrefix)return;let s=R.NormalizedSchema.of(t.input),n=R.translateTraits(t.traits??{});if(n.endpoint){let o=n.endpoint?.[0];if(typeof o==="string"){let i=[...s.structIterator()].filter(([,c])=>c.getMergedTraits().hostLabel);for(let[c]of i){let a=r[c];if(typeof a!=="string")throw Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);o=o.replace(`{${c}}`,a)}e.hostname=o+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r})}async loadEventStreamCapability(){let{EventStreamSerde:e}=await import("./chunk-x26jb60f.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,r,s,n){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class Rs extends ze{async serializeRequest(e,t,r){let s={...t??{}},n=this.serializer,o={},i={},c=await r.endpoint(),a=R.NormalizedSchema.of(e?.input),l=[],d=[],f=!1,u,h=new fe.HttpRequest({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:o,headers:i,body:void 0});if(c){this.updateServiceEndpoint(h,c),this.setHostPrefix(h,e,s);let p=R.translateTraits(e.traits);if(p.http){h.method=p.http[0];let[b,y]=p.http[1].split("?");if(h.path=="/")h.path=b;else h.path+=b;let m=new URLSearchParams(y??"");Object.assign(o,Object.fromEntries(m))}}for(let[p,b]of a.structIterator()){let y=b.getMergedTraits()??{},m=s[p];if(m==null&&!b.isIdempotencyToken()){if(y.httpLabel){if(h.path.includes(`{${p}+}`)||h.path.includes(`{${p}}`))throw Error(`No value provided for input HTTP label: ${p}.`)}continue}if(y.httpPayload){if(b.isStreaming())if(b.isStructSchema()){if(s[p])u=await this.serializeEventStream({eventStream:s[p],requestSchema:a})}else u=m;else n.write(b,m),u=n.flush();delete s[p]}else if(y.httpLabel){n.write(b,m);let w=n.flush();if(h.path.includes(`{${p}+}`))h.path=h.path.replace(`{${p}+}`,w.split("/").map(ue).join("/"));else if(h.path.includes(`{${p}}`))h.path=h.path.replace(`{${p}}`,ue(w));delete s[p]}else if(y.httpHeader)n.write(b,m),i[y.httpHeader.toLowerCase()]=String(n.flush()),delete s[p];else if(typeof y.httpPrefixHeaders==="string"){for(let[w,S]of Object.entries(m)){let g=y.httpPrefixHeaders+w;n.write([b.getValueSchema(),{httpHeader:g}],S),i[g.toLowerCase()]=n.flush()}delete s[p]}else if(y.httpQuery||y.httpQueryParams)this.serializeQuery(b,m,o),delete s[p];else f=!0,l.push(p),d.push(b)}if(f&&s){let[p,b]=(a.getName(!0)??"#Unknown").split("#"),y=a.getSchema()[6],m=[3,p,b,a.getMergedTraits(),l,d,void 0];if(y)m[6]=y;else m.pop();n.write(m,s),u=n.flush()}return h.headers=i,h.query=o,h.body=u,h}serializeQuery(e,t,r){let s=this.serializer,n=e.getMergedTraits();if(n.httpQueryParams){for(let[o,i]of Object.entries(t))if(!(o in r)){let c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...n,httpQuery:o,httpQueryParams:void 0}),this.serializeQuery(c,i,r)}return}if(e.isListSchema()){let o=!!e.getMergedTraits().sparse,i=[];for(let c of t){s.write([e.getValueSchema(),n],c);let a=s.flush();if(o||a!==void 0)i.push(a)}r[n.httpQuery]=i}else s.write([e,n],t),r[n.httpQuery]=s.flush()}async deserializeResponse(e,t,r){let s=this.deserializer,n=R.NormalizedSchema.of(e.output),o={};if(r.statusCode>=300){let c=await v(r.body,t);if(c.byteLength>0)Object.assign(o,await s.read(15,c));throw await this.handleError(e,t,r,o,this.deserializeMetadata(r)),Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in r.headers){let a=r.headers[c];delete r.headers[c],r.headers[c.toLowerCase()]=a}let i=await this.deserializeHttpMessage(n,t,r,o);if(i.length){let c=await v(r.body,t);if(c.byteLength>0){let a=await s.read(n,c);for(let l of i)if(a[l]!=null)o[l]=a[l]}}else if(i.discardResponseBody)await v(r.body,t);return o.$metadata=this.deserializeMetadata(r),o}async deserializeHttpMessage(e,t,r,s,n){let o;if(s instanceof Set)o=n;else o=s;let i=!0,c=this.deserializer,a=R.NormalizedSchema.of(e),l=[];for(let[d,f]of a.structIterator()){let u=f.getMemberTraits();if(u.httpPayload){if(i=!1,f.isStreaming())if(f.isStructSchema())o[d]=await this.deserializeEventStream({response:r,responseSchema:a});else o[d]=Fe.sdkStreamMixin(r.body);else if(r.body){let p=await v(r.body,t);if(p.byteLength>0)o[d]=await c.read(f,p)}}else if(u.httpHeader){let h=String(u.httpHeader).toLowerCase(),p=r.headers[h];if(p!=null)if(f.isListSchema()){let b=f.getValueSchema();b.getMergedTraits().httpHeader=h;let y;if(b.isTimestampSchema()&&b.getSchema()===4)y=U.splitEvery(p,",",2);else y=U.splitHeader(p);let m=[];for(let w of y)m.push(await c.read(b,w.trim()));o[d]=m}else o[d]=await c.read(f,p)}else if(u.httpPrefixHeaders!==void 0){o[d]={};for(let[h,p]of Object.entries(r.headers))if(h.startsWith(u.httpPrefixHeaders)){let b=f.getValueSchema();b.getMergedTraits().httpHeader=h,o[d][h.slice(u.httpPrefixHeaders.length)]=await c.read(b,p)}}else if(u.httpResponseCode)o[d]=r.statusCode;else l.push(d)}return l.discardResponseBody=i,l}}class Us extends ze{async serializeRequest(e,t,r){let s=this.serializer,n={},o={},i=await r.endpoint(),c=R.NormalizedSchema.of(e?.input),a=c.getSchema(),l,d=new fe.HttpRequest({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:n,headers:o,body:void 0});if(i)this.updateServiceEndpoint(d,i),this.setHostPrefix(d,e,t);let f={...t};if(t){let u=c.getEventStreamMember();if(u){if(f[u]){let h={};for(let[p,b]of c.structIterator())if(p!==u&&f[p])s.write(b,f[p]),h[p]=s.flush();l=await this.serializeEventStream({eventStream:f[u],requestSchema:c,initialRequest:h})}}else s.write(a,f),l=s.flush()}return d.headers=Object.assign(d.headers,o),d.query=n,d.body=l,d.method="POST",d}async deserializeResponse(e,t,r){let s=this.deserializer,n=R.NormalizedSchema.of(e.output),o={};if(r.statusCode>=300){let c=await v(r.body,t);if(c.byteLength>0)Object.assign(o,await s.read(15,c));throw await this.handleError(e,t,r,o,this.deserializeMetadata(r)),Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in r.headers){let a=r.headers[c];delete r.headers[c],r.headers[c.toLowerCase()]=a}let i=n.getEventStreamMember();if(i)o[i]=await this.deserializeEventStream({response:r,responseSchema:n,initialResponseContainer:o});else{let c=await v(r.body,t);if(c.byteLength>0)Object.assign(o,await s.read(n,c))}return o.$metadata=this.deserializeMetadata(r),o}}var Is=(e,t,r,s,n,o)=>{if(t!=null&&t[r]!==void 0){let i=s();if(i==null||i.length<=0)throw Error("Empty value provided for input HTTP label: "+r+".");e=e.replace(n,o?i.split("/").map((c)=>ue(c)).join("/"):ue(i))}else throw Error("No value provided for input HTTP label: "+r+".");return e};function Aa(e,t){return new gt(e,t)}class gt{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,t){this.input=e,this.context=t}async build(){let{hostname:e,protocol:t="https",port:r,path:s}=await this.context.endpoint();this.path=s;for(let n of this.resolvePathStack)n(this.path);return new fe.HttpRequest({protocol:t,hostname:this.hostname||e,port:r,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push((t)=>{this.path=`${t?.endsWith("/")?t.slice(0,-1):t||""}`+e}),this}p(e,t,r,s){return this.resolvePathStack.push((n)=>{this.path=Is(n,this.input,e,t,r,s)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}function _t(e,t){if(t.timestampFormat.useTrait){if(e.isTimestampSchema()&&(e.getSchema()===5||e.getSchema()===6||e.getSchema()===7))return e.getSchema()}let{httpLabel:r,httpPrefixHeaders:s,httpHeader:n,httpQuery:o}=e.getMergedTraits();return(t.httpBindings?typeof s==="string"||Boolean(n)?6:Boolean(o)||Boolean(r)?5:void 0:void 0)??t.timestampFormat.default}class Tt extends G{settings;constructor(e){super();this.settings=e}read(e,t){let r=R.NormalizedSchema.of(e);if(r.isListSchema())return U.splitHeader(t).map((s)=>this.read(r.getValueSchema(),s));if(r.isBlobSchema())return(this.serdeContext?.base64Decoder??He.fromBase64)(t);if(r.isTimestampSchema())switch(_t(r,this.settings)){case 5:return U._parseRfc3339DateTimeWithOffset(t);case 6:return U._parseRfc7231DateTime(t);case 7:return U._parseEpochTimestamp(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(r.isStringSchema()){let s=r.getMergedTraits().mediaType,n=t;if(s){if(r.getMergedTraits().httpHeader)n=this.base64ToUtf8(n);if(s==="application/json"||s.endsWith("+json"))n=U.LazyJsonString.from(n);return n}}if(r.isNumericSchema())return Number(t);if(r.isBigIntegerSchema())return BigInt(t);if(r.isBigDecimalSchema())return new U.NumericValue(t,"bigDecimal");if(r.isBooleanSchema())return String(t).toLowerCase()==="true";return t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??wt.toUtf8)((this.serdeContext?.base64Decoder??He.fromBase64)(e))}}class Ds extends G{codecDeserializer;stringDeserializer;constructor(e,t){super();this.codecDeserializer=e,this.stringDeserializer=new Tt(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){let r=R.NormalizedSchema.of(e),s=r.getMergedTraits(),n=this.serdeContext?.utf8Encoder??wt.toUtf8;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(r,n(t));if(s.httpPayload){if(r.isBlobSchema()){let o=this.serdeContext?.utf8Decoder??wt.fromUtf8;if(typeof t==="string")return o(t);return t}else if(r.isStringSchema()){if("byteLength"in t)return n(t);return t}}return this.codecDeserializer.read(r,t)}}class Et extends G{settings;stringBuffer="";constructor(e){super();this.settings=e}write(e,t){let r=R.NormalizedSchema.of(e);switch(typeof t){case"object":if(t===null){this.stringBuffer="null";return}if(r.isTimestampSchema()){if(!(t instanceof Date))throw Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${r.getName(!0)}`);switch(_t(r,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=U.dateToUtcString(t);break;case 7:this.stringBuffer=String(t.getTime()/1000);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1000)}return}if(r.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??He.toBase64)(t);return}if(r.isListSchema()&&Array.isArray(t)){let o="";for(let i of t){this.write([r.getValueSchema(),r.getMergedTraits()],i);let c=this.flush(),a=r.getValueSchema().isTimestampSchema()?c:U.quoteHeader(c);if(o!=="")o+=", ";o+=a}this.stringBuffer=o;return}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":let s=r.getMergedTraits().mediaType,n=t;if(s){if(s==="application/json"||s.endsWith("+json"))n=U.LazyJsonString.from(n);if(r.getMergedTraits().httpHeader){this.stringBuffer=(this.serdeContext?.base64Encoder??He.toBase64)(n.toString());return}}this.stringBuffer=t;break;default:if(r.isIdempotencyToken())this.stringBuffer=U.generateIdempotencyToken();else this.stringBuffer=String(t)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}class Bs{codecSerializer;stringSerializer;buffer;constructor(e,t,r=new Et(t)){this.codecSerializer=e,this.stringSerializer=r}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){let r=R.NormalizedSchema.of(e),s=r.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(r,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(r,t)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}Ra.FromStringShapeDeserializer=Tt;Ra.HttpBindingProtocol=Rs;Ra.HttpInterceptingShapeDeserializer=Ds;Ra.HttpInterceptingShapeSerializer=Bs;Ra.HttpProtocol=ze;Ra.RequestBuilder=gt;Ra.RpcProtocol=Us;Ra.SerdeContext=G;Ra.ToStringShapeSerializer=Et;Ra.collectBody=v;Ra.determineTimestampFormat=_t;Ra.extendedEncodeURIComponent=ue;Ra.requestBuilder=Aa;Ra.resolvedPath=Is});var Ff=_((he)=>{var qs=Ct(),Ot=Ls(),We=At(),Ja=Qe(),ke=bt();class js{config;middlewareStack=qs.constructStack();initConfig;handlers;constructor(e){this.config=e;let{protocol:t,protocolSettings:r}=e;if(r){if(typeof t==="function")e.protocol=new t(r)}}send(e,t,r){let s=typeof t!=="function"?t:void 0,n=typeof t==="function"?t:r,o=s===void 0&&this.config.cacheMiddleware===!0,i;if(o){if(!this.handlers)this.handlers=new WeakMap;let c=this.handlers;if(c.has(e.constructor))i=c.get(e.constructor);else i=e.resolveMiddleware(this.middlewareStack,this.config,s),c.set(e.constructor,i)}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,s);if(n)i(e).then((c)=>n(null,c.output),(c)=>n(c)).catch(()=>{});else return i(e).then((c)=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}var St="***SensitiveInformation***";function xt(e,t){if(t==null)return t;let r=Ja.NormalizedSchema.of(e);if(r.getMergedTraits().sensitive)return St;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return St}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return St}else if(r.isStructSchema()&&typeof t==="object"){let s=t,n={};for(let[o,i]of r.structIterator())if(s[o]!=null)n[o]=xt(i,s[o]);return n}return t}class Mt{middlewareStack=qs.constructStack();schema;static classBuilder(){return new Cs}resolveMiddlewareWithContext(e,t,r,{middlewareFn:s,clientName:n,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,smithyContext:a,additionalContext:l,CommandCtor:d}){for(let b of s.bind(this)(d,e,t,r))this.middlewareStack.use(b);let f=e.concat(this.middlewareStack),{logger:u}=t,h={logger:u,clientName:n,commandName:o,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,[We.SMITHY_CONTEXT_KEY]:{commandInstance:this,...a},...l},{requestHandler:p}=t;return f.resolve((b)=>p.handle(b.request,r||{}),h)}}class Cs{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=(r)=>r,t=(r)=>r){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,t;return t=class extends Mt{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[r]){super();this.input=r??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(r,s,n){let o=e._operationSchema,i=o?.[4]??o?.input,c=o?.[5]??o?.output;return this.resolveMiddlewareWithContext(r,s,n,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(o?xt.bind(null,i):(a)=>a),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(o?xt.bind(null,c):(a)=>a),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}var va="***SensitiveInformation***",Ya=(e,t,r)=>{for(let[o,i]of Object.entries(e)){let c=async function(l,d,f){let u=new i(l);if(typeof d==="function")this.send(u,d);else if(typeof f==="function"){if(typeof d!=="object")throw Error(`Expected http options but got ${typeof d}`);this.send(u,d||{},f)}else return this.send(u,d)},a=(o[0].toLowerCase()+o.slice(1)).replace(/Command$/,"");t.prototype[a]=c}let{paginators:s={},waiters:n={}}=r??{};for(let[o,i]of Object.entries(s))if(t.prototype[o]===void 0)t.prototype[o]=function(c={},a,...l){return i({...a,client:this},c,...l)};for(let[o,i]of Object.entries(n))if(t.prototype[o]===void 0)t.prototype[o]=async function(c={},a,...l){let d=a;if(typeof a==="number")d={maxWaitTime:a};return i({...d,client:this},c,...l)}};class V extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let t=e;return V.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let t=e;if(this===V)return V.isInstance(e);if(V.isInstance(e)){if(t.name&&this.name)return this.prototype.isPrototypeOf(e)||t.name===this.name;return this.prototype.isPrototypeOf(e)}return!1}}var Fs=(e,t={})=>{Object.entries(t).filter(([,s])=>s!==void 0).forEach(([s,n])=>{if(e[s]==null||e[s]==="")e[s]=n});let r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e},Hs=({output:e,parsedBody:t,exceptionCtor:r,errorCode:s})=>{let n=Xa(e),o=n.httpStatusCode?n.httpStatusCode+"":void 0,i=new r({name:t?.code||t?.Code||s||o||"UnknownError",$fault:"client",$metadata:n});throw Fs(i,t)},Qa=(e)=>{return({output:t,parsedBody:r,errorCode:s})=>{Hs({output:t,parsedBody:r,exceptionCtor:e,errorCode:s})}},Xa=(e)=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),Za=(e)=>{switch(e){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{}}},Ns=!1,Ga=(e)=>{if(e&&!Ns&&parseInt(e.substring(1,e.indexOf(".")))<16)Ns=!0},zs=Object.values(We.AlgorithmId),Va=(e)=>{let t=[];for(let r in We.AlgorithmId){let s=We.AlgorithmId[r];if(e[s]===void 0)continue;t.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}for(let[r,s]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};let s=r.algorithmId(),n=r.checksumConstructor();if(zs.includes(s))e.checksumAlgorithms[s.toUpperCase()]=n;else e.checksumAlgorithms[s]=n;t.push(r)},checksumAlgorithms(){return t}}},Ka=(e)=>{let t={};return e.checksumAlgorithms().forEach((r)=>{let s=r.algorithmId();if(zs.includes(s))t[s]=r.checksumConstructor()}),t},ef=(e)=>{return{setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}},tf=(e)=>{let t={};return t.retryStrategy=e.retryStrategy(),t},Ws=(e)=>{return Object.assign(Va(e),ef(e))},rf=Ws,sf=(e)=>{return Object.assign(Ka(e),tf(e))},nf=(e)=>Array.isArray(e)?e:[e],ks=(e)=>{for(let r in e)if(e.hasOwnProperty(r)&&e[r]["#text"]!==void 0)e[r]=e[r]["#text"];else if(typeof e[r]==="object"&&e[r]!==null)e[r]=ks(e[r]);return e},of=(e)=>{return e!=null};class Js{trace(){}debug(){}info(){}warn(){}error(){}}function vs(e,t,r){let s,n,o;if(typeof t>"u"&&typeof r>"u")s={},o=e;else if(s=e,typeof t==="function")return n=t,o=r,ff(s,n,o);else o=t;for(let i of Object.keys(o)){if(!Array.isArray(o[i])){s[i]=o[i];continue}Ys(s,null,o,i)}return s}var cf=(e)=>{let t={};for(let[r,s]of Object.entries(e||{}))t[r]=[,s];return t},af=(e,t)=>{let r={};for(let s in t)Ys(r,e,t,s);return r},ff=(e,t,r)=>{return vs(e,Object.entries(r).reduce((s,[n,o])=>{if(Array.isArray(o))s[n]=o;else if(typeof o==="function")s[n]=[t,o()];else s[n]=[t,o];return s},{}))},Ys=(e,t,r,s)=>{if(t!==null){let i=r[s];if(typeof i==="function")i=[,i];let[c=uf,a=hf,l=s]=i;if(typeof c==="function"&&c(t[l])||typeof c!=="function"&&!!c)e[s]=a(t[l]);return}let[n,o]=r[s];if(typeof o==="function"){let i,c=n===void 0&&(i=o())!=null,a=typeof n==="function"&&!!n(void 0)||typeof n!=="function"&&!!n;if(c)e[s]=i;else if(a)e[s]=o()}else{let i=n===void 0&&o!=null,c=typeof n==="function"&&!!n(o)||typeof n!=="function"&&!!n;if(i||c)e[s]=o}},uf=(e)=>e!=null,hf=(e)=>e,df=(e)=>{if(e!==e)return"NaN";switch(e){case 1/0:return"Infinity";case-1/0:return"-Infinity";default:return e}},lf=(e)=>e.toISOString().replace(".000Z","Z"),$t=(e)=>{if(e==null)return{};if(Array.isArray(e))return e.filter((t)=>t!=null).map($t);if(typeof e==="object"){let t={};for(let r of Object.keys(e)){if(e[r]==null)continue;t[r]=$t(e[r])}return t}return e};he.collectBody=Ot.collectBody;he.extendedEncodeURIComponent=Ot.extendedEncodeURIComponent;he.resolvedPath=Ot.resolvedPath;he.Client=js;he.Command=Mt;he.NoOpLogger=Js;he.SENSITIVE_STRING=va;he.ServiceException=V;he._json=$t;he.convertMap=cf;he.createAggregatedClient=Ya;he.decorateServiceException=Fs;he.emitWarningIfUnsupportedVersion=Ga;he.getArrayIfSingleItem=nf;he.getDefaultClientConfiguration=rf;he.getDefaultExtensionConfiguration=Ws;he.getValueFromTextNode=ks;he.isSerializableHeaderValue=of;he.loadConfigsForDefaultMode=Za;he.map=vs;he.resolveDefaultRuntimeConfig=sf;he.serializeDateTime=lf;he.serializeFloat=df;he.take=af;he.throwDefaultError=Hs;he.withBaseException=Qa;Object.prototype.hasOwnProperty.call(ke,"__proto__")&&!Object.prototype.hasOwnProperty.call(he,"__proto__")&&Object.defineProperty(he,"__proto__",{enumerable:!0,value:ke.__proto__});Object.keys(ke).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(he,e))he[e]=ke[e]})});
|
|
19
19
|
export{Rt as E,k as F,Rr as G,Wr as H,Xr as I,ms as J,It as K,Qe as L,Ts as M,bt as N,Ls as O,Ff as P};
|
|
20
20
|
|
|
21
|
-
//# debugId=
|
|
21
|
+
//# debugId=911C01D0E69D5D6164756E2164756E21
|