@stacksjs/ai 0.63.0 → 0.64.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/index.js CHANGED
@@ -1,69 +1,13 @@
1
- // src/utils/client-bedrock.ts
2
- import {
3
- BedrockClient,
4
- CreateModelCustomizationJobCommand,
5
- GetModelCustomizationJobCommand,
6
- ListFoundationModelsCommand
7
- } from "@aws-sdk/client-bedrock";
8
- async function createModelCustomizationJob(param) {
9
- logger.debug(param);
10
- const command = new CreateModelCustomizationJobCommand(param);
11
- const res = await client.send(command);
12
- logger.debug("Successfully create model customization job");
13
- logger.debug(res);
14
- return res;
15
- }
16
- async function getModelCustomizationJob(params) {
17
- logger.debug(params);
18
- const command = new GetModelCustomizationJobCommand(params);
19
- const res = await client.send(command);
20
- logger.debug("Successfully get model customization job");
21
- logger.debug(res);
22
- return res;
23
- }
24
- async function listFoundationModels(params) {
25
- logger.debug(params);
26
- const command = new ListFoundationModelsCommand(params);
27
- const res = await client.send(command);
28
- logger.debug("Successfully list foundation models");
29
- logger.debug(res);
30
- return res;
31
- }
32
- var client = new BedrockClient({ region: process.env.REGION || "us-east-1" });
33
- var logger = console;
34
- // src/utils/client-bedrock-runtime.ts
35
- import {
36
- BedrockRuntimeClient,
37
- InvokeModelCommand,
38
- InvokeModelWithResponseStreamCommand
39
- } from "@aws-sdk/client-bedrock-runtime";
40
- async function invokeModel(params) {
41
- logger2.debug(params);
42
- const command = new InvokeModelCommand(params);
43
- const res = await client2.send(command);
44
- logger2.debug("Successfully invoke model");
45
- logger2.debug(res);
46
- return res;
47
- }
48
- async function invokeModelWithResponseStream(params) {
49
- logger2.debug(params);
50
- const command = new InvokeModelWithResponseStreamCommand(params);
51
- const res = await client2.send(command);
52
- logger2.debug("Successfully invoke model with response stream");
53
- logger2.debug(res);
54
- return res;
55
- }
56
- var client2 = new BedrockRuntimeClient({
57
- region: process.env.REGION || "us-east-1"
58
- });
59
- var logger2 = console;
60
- export {
61
- listFoundationModels,
62
- invokeModelWithResponseStream,
63
- invokeModel,
64
- getModelCustomizationJob,
65
- createModelCustomizationJob
66
- };
1
+ var af=Object.create;var{getPrototypeOf:ff,defineProperty:rt,getOwnPropertyNames:cf}=Object;var df=Object.prototype.hasOwnProperty;var st=(e,r,s)=>{s=e!=null?af(ff(e)):{};const n=r||!e||!e.__esModule?rt(s,"default",{value:e,enumerable:!0}):s;for(let t of cf(e))if(!df.call(n,t))rt(n,t,{get:()=>e[t],enumerable:!0});return n};var lf=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Fn=lf((nr,On)=>{(function(e,r){typeof nr=="object"&&typeof On=="object"?On.exports=r():typeof define=="function"&&define.amd?define([],r):typeof nr=="object"?nr.bowser=r():e.bowser=r()})(nr,function(){return function(e){var r={};function s(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,s),t.l=!0,t.exports}return s.m=e,s.c=r,s.d=function(n,t,i){s.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:i})},s.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},s.t=function(n,t){if(1&t&&(n=s(n)),8&t)return n;if(4&t&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&t&&typeof n!="string")for(var c in n)s.d(i,c,function(o){return n[o]}.bind(null,c));return i},s.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return s.d(t,"a",t),t},s.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},s.p="",s(s.s=90)}({17:function(e,r,s){r.__esModule=!0,r.default=void 0;var n=s(18),t=function(){function i(){}return i.getFirstMatch=function(c,o){var a=o.match(c);return a&&a.length>0&&a[1]||""},i.getSecondMatch=function(c,o){var a=o.match(c);return a&&a.length>1&&a[2]||""},i.matchAndReturnConst=function(c,o,a){if(c.test(o))return a},i.getWindowsVersionName=function(c){switch(c){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(c){var o=c.split(".").splice(0,2).map(function(a){return parseInt(a,10)||0});if(o.push(0),o[0]===10)switch(o[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(c){var o=c.split(".").splice(0,2).map(function(a){return parseInt(a,10)||0});if(o.push(0),!(o[0]===1&&o[1]<5))return o[0]===1&&o[1]<6?"Cupcake":o[0]===1&&o[1]>=6?"Donut":o[0]===2&&o[1]<2?"Eclair":o[0]===2&&o[1]===2?"Froyo":o[0]===2&&o[1]>2?"Gingerbread":o[0]===3?"Honeycomb":o[0]===4&&o[1]<1?"Ice Cream Sandwich":o[0]===4&&o[1]<4?"Jelly Bean":o[0]===4&&o[1]>=4?"KitKat":o[0]===5?"Lollipop":o[0]===6?"Marshmallow":o[0]===7?"Nougat":o[0]===8?"Oreo":o[0]===9?"Pie":void 0},i.getVersionPrecision=function(c){return c.split(".").length},i.compareVersions=function(c,o,a){a===void 0&&(a=!1);var f=i.getVersionPrecision(c),h=i.getVersionPrecision(o),l=Math.max(f,h),d=0,m=i.map([c,o],function(g){var w=l-i.getVersionPrecision(g),y=g+new Array(w+1).join(".0");return i.map(y.split("."),function(E){return new Array(20-E.length).join("0")+E}).reverse()});for(a&&(d=l-Math.min(f,h)),l-=1;l>=d;){if(m[0][l]>m[1][l])return 1;if(m[0][l]===m[1][l]){if(l===d)return 0;l-=1}else if(m[0][l]<m[1][l])return-1}},i.map=function(c,o){var a,f=[];if(Array.prototype.map)return Array.prototype.map.call(c,o);for(a=0;a<c.length;a+=1)f.push(o(c[a]));return f},i.find=function(c,o){var a,f;if(Array.prototype.find)return Array.prototype.find.call(c,o);for(a=0,f=c.length;a<f;a+=1){var h=c[a];if(o(h,a))return h}},i.assign=function(c){for(var o,a,f=c,h=arguments.length,l=new Array(h>1?h-1:0),d=1;d<h;d++)l[d-1]=arguments[d];if(Object.assign)return Object.assign.apply(Object,[c].concat(l));var m=function(){var g=l[o];typeof g=="object"&&g!==null&&Object.keys(g).forEach(function(w){f[w]=g[w]})};for(o=0,a=l.length;o<a;o+=1)m();return c},i.getBrowserAlias=function(c){return n.BROWSER_ALIASES_MAP[c]},i.getBrowserTypeByAlias=function(c){return n.BROWSER_MAP[c]||""},i}();r.default=t,e.exports=r.default},18:function(e,r,s){r.__esModule=!0,r.ENGINE_MAP=r.OS_MAP=r.PLATFORMS_MAP=r.BROWSER_MAP=r.BROWSER_ALIASES_MAP=void 0,r.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},r.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},r.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},r.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},r.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,r,s){r.__esModule=!0,r.default=void 0;var n,t=(n=s(91))&&n.__esModule?n:{default:n},i=s(18);function c(a,f){for(var h=0;h<f.length;h++){var l=f[h];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(a,l.key,l)}}var o=function(){function a(){}var f,h,l;return a.getParser=function(d,m){if(m===void 0&&(m=!1),typeof d!="string")throw new Error("UserAgent should be a string");return new t.default(d,m)},a.parse=function(d){return new t.default(d).getResult()},f=a,l=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(h=null)&&c(f.prototype,h),l&&c(f,l),a}();r.default=o,e.exports=r.default},91:function(e,r,s){r.__esModule=!0,r.default=void 0;var n=a(s(92)),t=a(s(93)),i=a(s(94)),c=a(s(95)),o=a(s(17));function a(h){return h&&h.__esModule?h:{default:h}}var f=function(){function h(d,m){if(m===void 0&&(m=!1),d==null||d==="")throw new Error("UserAgent parameter can't be empty");this._ua=d,this.parsedResult={},m!==!0&&this.parse()}var l=h.prototype;return l.getUA=function(){return this._ua},l.test=function(d){return d.test(this._ua)},l.parseBrowser=function(){var d=this;this.parsedResult.browser={};var m=o.default.find(n.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.browser=m.describe(this.getUA())),this.parsedResult.browser},l.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},l.getBrowserName=function(d){return d?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},l.getBrowserVersion=function(){return this.getBrowser().version},l.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},l.parseOS=function(){var d=this;this.parsedResult.os={};var m=o.default.find(t.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.os=m.describe(this.getUA())),this.parsedResult.os},l.getOSName=function(d){var m=this.getOS().name;return d?String(m).toLowerCase()||"":m||""},l.getOSVersion=function(){return this.getOS().version},l.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},l.getPlatformType=function(d){d===void 0&&(d=!1);var m=this.getPlatform().type;return d?String(m).toLowerCase()||"":m||""},l.parsePlatform=function(){var d=this;this.parsedResult.platform={};var m=o.default.find(i.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.platform=m.describe(this.getUA())),this.parsedResult.platform},l.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},l.getEngineName=function(d){return d?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},l.parseEngine=function(){var d=this;this.parsedResult.engine={};var m=o.default.find(c.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.engine=m.describe(this.getUA())),this.parsedResult.engine},l.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},l.getResult=function(){return o.default.assign({},this.parsedResult)},l.satisfies=function(d){var m=this,g={},w=0,y={},E=0;if(Object.keys(d).forEach(function(Q){var tr=d[Q];typeof tr=="string"?(y[Q]=tr,E+=1):typeof tr=="object"&&(g[Q]=tr,w+=1)}),w>0){var p=Object.keys(g),T=o.default.find(p,function(Q){return m.isOS(Q)});if(T){var N=this.satisfies(g[T]);if(N!==void 0)return N}var se=o.default.find(p,function(Q){return m.isPlatform(Q)});if(se){var Pe=this.satisfies(g[se]);if(Pe!==void 0)return Pe}}if(E>0){var of=Object.keys(y),et=o.default.find(of,function(Q){return m.isBrowser(Q,!0)});if(et!==void 0)return this.compareVersion(y[et])}},l.isBrowser=function(d,m){m===void 0&&(m=!1);var g=this.getBrowserName().toLowerCase(),w=d.toLowerCase(),y=o.default.getBrowserTypeByAlias(w);return m&&y&&(w=y.toLowerCase()),w===g},l.compareVersion=function(d){var m=[0],g=d,w=!1,y=this.getBrowserVersion();if(typeof y=="string")return d[0]===">"||d[0]==="<"?(g=d.substr(1),d[1]==="="?(w=!0,g=d.substr(2)):m=[],d[0]===">"?m.push(1):m.push(-1)):d[0]==="="?g=d.substr(1):d[0]==="~"&&(w=!0,g=d.substr(1)),m.indexOf(o.default.compareVersions(y,g,w))>-1},l.isOS=function(d){return this.getOSName(!0)===String(d).toLowerCase()},l.isPlatform=function(d){return this.getPlatformType(!0)===String(d).toLowerCase()},l.isEngine=function(d){return this.getEngineName(!0)===String(d).toLowerCase()},l.is=function(d,m){return m===void 0&&(m=!1),this.isBrowser(d,m)||this.isOS(d)||this.isPlatform(d)},l.some=function(d){var m=this;return d===void 0&&(d=[]),d.some(function(g){return m.is(g)})},h}();r.default=f,e.exports=r.default},92:function(e,r,s){r.__esModule=!0,r.default=void 0;var n,t=(n=s(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,c=[{test:[/googlebot/i],describe:function(o){var a={name:"Googlebot"},f=t.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/opera/i],describe:function(o){var a={name:"Opera"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/opr\/|opios/i],describe:function(o){var a={name:"Opera"},f=t.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/SamsungBrowser/i],describe:function(o){var a={name:"Samsung Internet for Android"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/Whale/i],describe:function(o){var a={name:"NAVER Whale Browser"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/MZBrowser/i],describe:function(o){var a={name:"MZ Browser"},f=t.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/focus/i],describe:function(o){var a={name:"Focus"},f=t.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/swing/i],describe:function(o){var a={name:"Swing"},f=t.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/coast/i],describe:function(o){var a={name:"Opera Coast"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(o){var a={name:"Opera Touch"},f=t.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/yabrowser/i],describe:function(o){var a={name:"Yandex Browser"},f=t.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/ucbrowser/i],describe:function(o){var a={name:"UC Browser"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/Maxthon|mxios/i],describe:function(o){var a={name:"Maxthon"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/epiphany/i],describe:function(o){var a={name:"Epiphany"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/puffin/i],describe:function(o){var a={name:"Puffin"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/sleipnir/i],describe:function(o){var a={name:"Sleipnir"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/k-meleon/i],describe:function(o){var a={name:"K-Meleon"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/micromessenger/i],describe:function(o){var a={name:"WeChat"},f=t.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/qqbrowser/i],describe:function(o){var a={name:/qqbrowserlite/i.test(o)?"QQ Browser Lite":"QQ Browser"},f=t.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/msie|trident/i],describe:function(o){var a={name:"Internet Explorer"},f=t.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/\sedg\//i],describe:function(o){var a={name:"Microsoft Edge"},f=t.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/edg([ea]|ios)/i],describe:function(o){var a={name:"Microsoft Edge"},f=t.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/vivaldi/i],describe:function(o){var a={name:"Vivaldi"},f=t.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/seamonkey/i],describe:function(o){var a={name:"SeaMonkey"},f=t.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/sailfish/i],describe:function(o){var a={name:"Sailfish"},f=t.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,o);return f&&(a.version=f),a}},{test:[/silk/i],describe:function(o){var a={name:"Amazon Silk"},f=t.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/phantom/i],describe:function(o){var a={name:"PhantomJS"},f=t.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/slimerjs/i],describe:function(o){var a={name:"SlimerJS"},f=t.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(o){var a={name:"BlackBerry"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/(web|hpw)[o0]s/i],describe:function(o){var a={name:"WebOS Browser"},f=t.default.getFirstMatch(i,o)||t.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/bada/i],describe:function(o){var a={name:"Bada"},f=t.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/tizen/i],describe:function(o){var a={name:"Tizen"},f=t.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/qupzilla/i],describe:function(o){var a={name:"QupZilla"},f=t.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/firefox|iceweasel|fxios/i],describe:function(o){var a={name:"Firefox"},f=t.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/electron/i],describe:function(o){var a={name:"Electron"},f=t.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/MiuiBrowser/i],describe:function(o){var a={name:"Miui"},f=t.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/chromium/i],describe:function(o){var a={name:"Chromium"},f=t.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,o)||t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/chrome|crios|crmo/i],describe:function(o){var a={name:"Chrome"},f=t.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/GSA/i],describe:function(o){var a={name:"Google Search"},f=t.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:function(o){var a=!o.test(/like android/i),f=o.test(/android/i);return a&&f},describe:function(o){var a={name:"Android Browser"},f=t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/playstation 4/i],describe:function(o){var a={name:"PlayStation 4"},f=t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/safari|applewebkit/i],describe:function(o){var a={name:"Safari"},f=t.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/.*/i],describe:function(o){var a=o.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:t.default.getFirstMatch(a,o),version:t.default.getSecondMatch(a,o)}}}];r.default=c,e.exports=r.default},93:function(e,r,s){r.__esModule=!0,r.default=void 0;var n,t=(n=s(17))&&n.__esModule?n:{default:n},i=s(18),c=[{test:[/Roku\/DVP/],describe:function(o){var a=t.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,o);return{name:i.OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe:function(o){var a=t.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe:function(o){var a=t.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,o),f=t.default.getWindowsVersionName(a);return{name:i.OS_MAP.Windows,version:a,versionName:f}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(o){var a={name:i.OS_MAP.iOS},f=t.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,o);return f&&(a.version=f),a}},{test:[/macintosh/i],describe:function(o){var a=t.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,o).replace(/[_\s]/g,"."),f=t.default.getMacOSVersionName(a),h={name:i.OS_MAP.MacOS,version:a};return f&&(h.versionName=f),h}},{test:[/(ipod|iphone|ipad)/i],describe:function(o){var a=t.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,o).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:a}}},{test:function(o){var a=!o.test(/like android/i),f=o.test(/android/i);return a&&f},describe:function(o){var a=t.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,o),f=t.default.getAndroidVersionName(a),h={name:i.OS_MAP.Android,version:a};return f&&(h.versionName=f),h}},{test:[/(web|hpw)[o0]s/i],describe:function(o){var a=t.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,o),f={name:i.OS_MAP.WebOS};return a&&a.length&&(f.version=a),f}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(o){var a=t.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,o)||t.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,o)||t.default.getFirstMatch(/\bbb(\d+)/i,o);return{name:i.OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe:function(o){var a=t.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe:function(o){var a=t.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(o){var a=t.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.PlayStation4,version:a}}}];r.default=c,e.exports=r.default},94:function(e,r,s){r.__esModule=!0,r.default=void 0;var n,t=(n=s(17))&&n.__esModule?n:{default:n},i=s(18),c=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(o){var a=t.default.getFirstMatch(/(can-l01)/i,o)&&"Nova",f={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&(f.model=a),f}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(o){var a=o.test(/ipod|iphone/i),f=o.test(/like (ipod|iphone)/i);return a&&!f},describe:function(o){var a=t.default.getFirstMatch(/(ipod|iphone)/i,o);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(o){return o.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(o){return o.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(o){return o.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(o){var a=Number(String(o.getOSVersion()).split(".")[0]);return o.getOSName(!0)==="android"&&a>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(o){return o.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(o){return o.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(o){return o.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(o){return o.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(o){return o.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(o){return o.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];r.default=c,e.exports=r.default},95:function(e,r,s){r.__esModule=!0,r.default=void 0;var n,t=(n=s(17))&&n.__esModule?n:{default:n},i=s(18),c=[{test:function(o){return o.getBrowserName(!0)==="microsoft edge"},describe:function(o){if(/\sedg\//i.test(o))return{name:i.ENGINE_MAP.Blink};var a=t.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,o);return{name:i.ENGINE_MAP.EdgeHTML,version:a}}},{test:[/trident/i],describe:function(o){var a={name:i.ENGINE_MAP.Trident},f=t.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:function(o){return o.test(/presto/i)},describe:function(o){var a={name:i.ENGINE_MAP.Presto},f=t.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:function(o){var a=o.test(/gecko/i),f=o.test(/like gecko/i);return a&&!f},describe:function(o){var a={name:i.ENGINE_MAP.Gecko},f=t.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(o){var a={name:i.ENGINE_MAP.WebKit},f=t.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}}];r.default=c,e.exports=r.default}})})});var ir=(e)=>{let r=e.httpHandler;return{setHttpHandler(s){r=s},httpHandler(){return r},updateHttpClientConfig(s,n){r.updateHttpClientConfig(s,n)},httpHandlerConfigs(){return r.httpHandlerConfigs()}}},or=(e)=>{return{httpHandler:e.httpHandler()}};var nt;(function(e){e.HEADER="header",e.QUERY="query"})(nt||(nt={}));var Ls;(function(e){e.HEADER="header",e.QUERY="query"})(Ls||(Ls={}));var Ie;(function(e){e.HTTP="http",e.HTTPS="https"})(Ie||(Ie={}));var Te;(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(Te||(Te={}));var us;(function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"})(us||(us={}));var ne="__smithy_context";var tt;(function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"})(tt||(tt={}));var it;(function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"})(it||(it={}));function mf(e){return Object.keys(e).reduce((r,s)=>{const n=e[s];return{...r,[s]:Array.isArray(n)?[...n]:n}},{})}class M{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const r=new M({...e,headers:{...e.headers}});if(r.query)r.query=mf(r.query);return r}static isInstance(e){if(!e)return!1;const r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query==="object"&&typeof r.headers==="object"}clone(){return M.clone(this)}}class J{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const r=e;return typeof r.statusCode==="number"&&typeof r.headers==="object"}}function ar(e){return e}var hf=(e)=>(r)=>async(s)=>{if(!M.isInstance(s.request))return r(s);const{request:n}=s,{handlerProtocol:t=""}=e.requestHandler.metadata||{};if(t.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let i=n.hostname;if(n.port!=null)i+=`:${n.port}`;n.headers.host=i}return r(s)},gf={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},fr=(e)=>({applyToStack:(r)=>{r.add(hf(e),gf)}});var yf=()=>(e,r)=>async(s)=>{try{const n=await e(s),{clientName:t,commandName:i,logger:c,dynamoDbDocumentClientOptions:o={}}=r,{overrideInputFilterSensitiveLog:a,overrideOutputFilterSensitiveLog:f}=o,h=a??r.inputFilterSensitiveLog,l=f??r.outputFilterSensitiveLog,{$metadata:d,...m}=n.output;return c?.info?.({clientName:t,commandName:i,input:h(s.input),output:l(m),metadata:d}),n}catch(n){const{clientName:t,commandName:i,logger:c,dynamoDbDocumentClientOptions:o={}}=r,{overrideInputFilterSensitiveLog:a}=o,f=a??r.inputFilterSensitiveLog;throw c?.error?.({clientName:t,commandName:i,input:f(s.input),error:n,metadata:n.$metadata}),n}},wf={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},cr=(e)=>({applyToStack:(r)=>{r.add(yf(),wf)}});var ot="X-Amzn-Trace-Id",Ef="AWS_LAMBDA_FUNCTION_NAME",Sf="_X_AMZN_TRACE_ID",pf=(e)=>(r)=>async(s)=>{const{request:n}=s;if(!M.isInstance(n)||e.runtime!=="node"||n.headers.hasOwnProperty(ot))return r(s);const t=process.env[Ef],i=process.env[Sf],c=(o)=>typeof o==="string"&&o.length>0;if(c(t)&&c(i))n.headers[ot]=i;return r({...s,request:n})},Af={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},dr=(e)=>({applyToStack:(r)=>{r.add(pf(e),Af)}});function lr(e){return{...e,customUserAgent:typeof e.customUserAgent==="string"?[[e.customUserAgent]]:e.customUserAgent}}var Rf=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),ve=(e)=>Rf.test(e)||e.startsWith("[")&&e.endsWith("]");var Mf=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Be=(e,r=!1)=>{if(!r)return Mf.test(e);const s=e.split(".");for(let n of s)if(!Be(n))return!1;return!0};var Z={};var _="endpoints";function v(e){if(typeof e!=="object"||e==null)return e;if("ref"in e)return`\$${v(e.ref)}`;if("fn"in e)return`${e.fn}(${(e.argv||[]).map(v).join(", ")})`;return JSON.stringify(e,null,2)}class P extends Error{constructor(e){super(e);this.name="EndpointError"}}var at=(e,r)=>e===r;var ft=(e)=>{const r=e.split("."),s=[];for(let n of r){const t=n.indexOf("[");if(t!==-1){if(n.indexOf("]")!==n.length-1)throw new P(`Path: '${e}' does not end with ']'`);const i=n.slice(t+1,-1);if(Number.isNaN(parseInt(i)))throw new P(`Invalid array index: '${i}' in path: '${e}'`);if(t!==0)s.push(n.slice(0,t));s.push(i)}else s.push(n)}return s};var mr=(e,r)=>ft(r).reduce((s,n)=>{if(typeof s!=="object")throw new P(`Index '${n}' in '${r}' not found in '${JSON.stringify(e)}'`);else if(Array.isArray(s))return s[parseInt(n)];return s[n]},e);var ct=(e)=>e!=null;var dt=(e)=>!e;var vs={[Ie.HTTP]:80,[Ie.HTTPS]:443},lt=(e)=>{const r=(()=>{try{if(e instanceof URL)return e;if(typeof e==="object"&&"hostname"in e){const{hostname:d,port:m,protocol:g="",path:w="",query:y={}}=e,E=new URL(`${g}//${d}${m?`:${m}`:""}${w}`);return E.search=Object.entries(y).map(([p,T])=>`${p}=${T}`).join("&"),E}return new URL(e)}catch(d){return null}})();if(!r)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const s=r.href,{host:n,hostname:t,pathname:i,protocol:c,search:o}=r;if(o)return null;const a=c.slice(0,-1);if(!Object.values(Ie).includes(a))return null;const f=ve(t),h=s.includes(`${n}:${vs[a]}`)||typeof e==="string"&&e.includes(`${n}:${vs[a]}`),l=`${n}${h?`:${vs[a]}`:""}`;return{scheme:a,authority:l,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:f}};var mt=(e,r)=>e===r;var ht=(e,r,s,n)=>{if(r>=s||e.length<s)return null;if(!n)return e.substring(r,s);return e.substring(e.length-s,e.length-r)};var gt=(e)=>encodeURIComponent(e).replace(/[!*'()]/g,(r)=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`);var yt={booleanEquals:at,getAttr:mr,isSet:ct,isValidHostLabel:Be,not:dt,parseURL:lt,stringEquals:mt,substring:ht,uriEncode:gt};var hr=(e,r)=>{const s=[],n={...r.endpointParams,...r.referenceRecord};let t=0;while(t<e.length){const i=e.indexOf("{",t);if(i===-1){s.push(e.slice(t));break}s.push(e.slice(t,i));const c=e.indexOf("}",i);if(c===-1){s.push(e.slice(i));break}if(e[i+1]==="{"&&e[c+1]==="}")s.push(e.slice(i+1,c)),t=c+2;const o=e.substring(i+1,c);if(o.includes("#")){const[a,f]=o.split("#");s.push(mr(n[a],f))}else s.push(n[o]);t=c+1}return s.join("")};var wt=({ref:e},r)=>{return{...r.endpointParams,...r.referenceRecord}[e]};var te=(e,r,s)=>{if(typeof e==="string")return hr(e,s);else if(e.fn)return gr(e,s);else if(e.ref)return wt(e,s);throw new P(`'${r}': ${String(e)} is not a string, function or reference.`)};var gr=({fn:e,argv:r},s)=>{const n=r.map((i)=>["boolean","number"].includes(typeof i)?i:te(i,"arg",s)),t=e.split(".");if(t[0]in Z&&t[1]!=null)return Z[t[0]][t[1]](...n);return yt[e](...n)};var Et=({assign:e,...r},s)=>{if(e&&e in s.referenceRecord)throw new P(`'${e}' is already defined in Reference Record.`);const n=gr(r,s);return s.logger?.debug?.(`${_} evaluateCondition: ${v(r)} = ${v(n)}`),{result:n===""?!0:!!n,...e!=null&&{toAssign:{name:e,value:n}}}};var Ne=(e=[],r)=>{const s={};for(let n of e){const{result:t,toAssign:i}=Et(n,{...r,referenceRecord:{...r.referenceRecord,...s}});if(!t)return{result:t};if(i)s[i.name]=i.value,r.logger?.debug?.(`${_} assign: ${i.name} := ${v(i.value)}`)}return{result:!0,referenceRecord:s}};var St=(e,r)=>Object.entries(e).reduce((s,[n,t])=>({...s,[n]:t.map((i)=>{const c=te(i,"Header value entry",r);if(typeof c!=="string")throw new P(`Header '${n}' value '${c}' is not a string`);return c})}),{});var Bs=(e,r)=>{if(Array.isArray(e))return e.map((s)=>Bs(s,r));switch(typeof e){case"string":return hr(e,r);case"object":if(e===null)throw new P(`Unexpected endpoint property: ${e}`);return yr(e,r);case"boolean":return e;default:throw new P(`Unexpected endpoint property type: ${typeof e}`)}};var yr=(e,r)=>Object.entries(e).reduce((s,[n,t])=>({...s,[n]:Bs(t,r)}),{});var pt=(e,r)=>{const s=te(e,"Endpoint URL",r);if(typeof s==="string")try{return new URL(s)}catch(n){throw console.error(`Failed to construct URL with ${s}`,n),n}throw new P(`Endpoint URL must be a string, got ${typeof s}`)};var At=(e,r)=>{const{conditions:s,endpoint:n}=e,{result:t,referenceRecord:i}=Ne(s,r);if(!t)return;const c={...r,referenceRecord:{...r.referenceRecord,...i}},{url:o,properties:a,headers:f}=n;return r.logger?.debug?.(`${_} Resolving endpoint from template: ${v(n)}`),{...f!=null&&{headers:St(f,c)},...a!=null&&{properties:yr(a,c)},url:pt(o,c)}};var Rt=(e,r)=>{const{conditions:s,error:n}=e,{result:t,referenceRecord:i}=Ne(s,r);if(!t)return;throw new P(te(n,"Error",{...r,referenceRecord:{...r.referenceRecord,...i}}))};var Mt=(e,r)=>{const{conditions:s,rules:n}=e,{result:t,referenceRecord:i}=Ne(s,r);if(!t)return;return wr(n,{...r,referenceRecord:{...r.referenceRecord,...i}})};var wr=(e,r)=>{for(let s of e)if(s.type==="endpoint"){const n=At(s,r);if(n)return n}else if(s.type==="error")Rt(s,r);else if(s.type==="tree"){const n=Mt(s,r);if(n)return n}else throw new P(`Unknown endpoint rule: ${s}`);throw new P("Rules evaluation failed")};var be=(e,r)=>{const{endpointParams:s,logger:n}=r,{parameters:t,rules:i}=e;r.logger?.debug?.(`${_} Initial EndpointParams: ${v(s)}`);const c=Object.entries(t).filter(([,f])=>f.default!=null).map(([f,h])=>[f,h.default]);if(c.length>0)for(let[f,h]of c)s[f]=s[f]??h;const o=Object.entries(t).filter(([,f])=>f.required).map(([f])=>f);for(let f of o)if(s[f]==null)throw new P(`Missing required parameter: '${f}'`);const a=wr(i,{endpointParams:s,logger:n,referenceRecord:{}});if(r.endpointParams?.Endpoint)try{const f=new URL(r.endpointParams.Endpoint),{protocol:h,port:l}=f;a.url.protocol=h,a.url.port=l}catch(f){}return r.logger?.debug?.(`${_} Resolved endpoint: ${v(a)}`),a};var bs=(e,r=!1)=>{if(r){for(let s of e.split("."))if(!bs(s))return!1;return!0}if(!Be(e))return!1;if(e.length<3||e.length>63)return!1;if(e!==e.toLowerCase())return!1;if(ve(e))return!1;return!0};var Pt=(e)=>{const r=e.split(":");if(r.length<6)return null;const[s,n,t,i,c,...o]=r;if(s!=="arn"||n===""||t===""||o.join(":")==="")return null;const a=o.map((f)=>f.split("/")).flat();return{partition:n,service:t,region:i,accountId:c,resourceId:a}};var It={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version:"1.1"};var If=It,Tf="",Tt=(e)=>{const{partitions:r}=If;for(let n of r){const{regions:t,outputs:i}=n;for(let[c,o]of Object.entries(t))if(c===e)return{...i,...o}}for(let n of r){const{regionRegex:t,outputs:i}=n;if(new RegExp(t).test(e))return{...i}}const s=r.find((n)=>n.id==="aws");if(!s)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...s.outputs}};var Nt=()=>Tf;var Ge={isVirtualHostableS3Bucket:bs,parseArn:Pt,partition:Tt};Z.aws=Ge;var Gs="user-agent",Er="x-amz-user-agent",zs=" ",Sr="/",kt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Ot=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,Hs="-";var Nf=(e)=>(r,s)=>async(n)=>{const{request:t}=n;if(!M.isInstance(t))return r(n);const{headers:i}=t,c=s?.userAgent?.map(qs)||[],o=(await e.defaultUserAgentProvider()).map(qs),a=e?.customUserAgent?.map(qs)||[],f=Nt(),h=(f?[f]:[]).concat([...o,...c,...a]).join(zs),l=[...o.filter((d)=>d.startsWith("aws-sdk-")),...a].join(zs);if(e.runtime!=="browser"){if(l)i[Er]=i[Er]?`${i[Gs]} ${l}`:l;i[Gs]=h}else i[Er]=h;return r({...n,request:t})},qs=(e)=>{const r=e[0].split(Sr).map((c)=>c.replace(kt,Hs)).join(Sr),s=e[1]?.replace(Ot,Hs),n=r.indexOf(Sr),t=r.substring(0,n);let i=r.substring(n+1);if(t==="api")i=i.toLowerCase();return[t,i,s].filter((c)=>c&&c.length>0).reduce((c,o,a)=>{switch(a){case 0:return o;case 1:return`${c}/${o}`;default:return`${c}#${o}`}},"")},kf={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},pr=(e)=>({applyToStack:(r)=>{r.add(Nf(e),kf)}});var Ar;(function(e){e.ENV="env",e.CONFIG="shared config entry"})(Ar||(Ar={}));var Rr=!1;var Mr=!1;var q=(e)=>e[ne]||(e[ne]={});var C=(e)=>{if(typeof e==="function")return e;const r=Promise.resolve(e);return()=>r};var Pr=(e)=>typeof e==="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var Vs=(e)=>Pr(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var Ir=(e)=>{const{region:r,useFipsEndpoint:s}=e;if(!r)throw new Error("Region is missing");return{...e,region:async()=>{if(typeof r==="string")return Vs(r);const n=await r();return Vs(n)},useFipsEndpoint:async()=>{const n=typeof r==="string"?r:await r();if(Pr(n))return!0;return typeof s!=="function"?Promise.resolve(!!s):s()}}};function Ff(e){const r=new Map;for(let s of e)r.set(s.schemeId,s);return r}var Ys=(e,r)=>(s,n)=>async(t)=>{const i=e.httpAuthSchemeProvider(await r.httpAuthSchemeParametersProvider(e,n,t.input)),c=Ff(e.httpAuthSchemes),o=q(n),a=[];for(let f of i){const h=c.get(f.schemeId);if(!h){a.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);continue}const l=h.identityProvider(await r.identityProviderConfigProvider(e));if(!l){a.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:d={},signingProperties:m={}}=f.propertiesExtractor?.(e,n)||{};f.identityProperties=Object.assign(f.identityProperties||{},d),f.signingProperties=Object.assign(f.signingProperties||{},m),o.selectedHttpAuthScheme={httpAuthOption:f,identity:await l(f.identityProperties),signer:h.signer};break}if(!o.selectedHttpAuthScheme)throw new Error(a.join("\n"));return s(t)};var Ft=async(e)=>{const r=e?.Bucket||"";if(typeof e.Bucket==="string")e.Bucket=r.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"));if(xf(r)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else if(!Df(r)||r.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||r.toLowerCase()!==r||r.length<3)e.ForcePathStyle=!0;if(e.DisableMultiRegionAccessPoints)e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0;return e},Cf=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,$f=/(\d+\.){3}\d+/,Uf=/\.\./;var Df=(e)=>Cf.test(e)&&!$f.test(e)&&!Uf.test(e),xf=(e)=>{const[r,s,n,,,t]=e.split(":"),i=r==="arn"&&e.split(":").length>=6,c=Boolean(i&&s&&n&&t);if(i&&!c)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return c};var Ct=(e,r,s)=>{const n=async()=>{const t=s[e]??s[r];if(typeof t==="function")return t();return t};if(e==="credentialScope"||r==="CredentialScope")return async()=>{const t=typeof s.credentials==="function"?await s.credentials():s.credentials;return t?.credentialScope??t?.CredentialScope};if(e==="accountId"||r==="AccountId")return async()=>{const t=typeof s.credentials==="function"?await s.credentials():s.credentials;return t?.accountId??t?.AccountId};if(e==="endpoint"||r==="endpoint")return async()=>{const t=await n();if(t&&typeof t==="object"){if("url"in t)return t.url.href;if("hostname"in t){const{protocol:i,hostname:c,port:o,path:a}=t;return`${i}//${c}${o?":"+o:""}${a}`}}return t};return n};var $t=async(e)=>{return};function Ut(e){const r={};if(e=e.replace(/^\?/,""),e)for(let s of e.split("&")){let[n,t=null]=s.split("=");if(n=decodeURIComponent(n),t)t=decodeURIComponent(t);if(!(n in r))r[n]=t;else if(Array.isArray(r[n]))r[n].push(t);else r[n]=[r[n],t]}return r}var ie=(e)=>{if(typeof e==="string")return ie(new URL(e));const{hostname:r,pathname:s,port:n,protocol:t,search:i}=e;let c;if(i)c=Ut(i);return{hostname:r,port:n?parseInt(n):void 0,protocol:t,path:s,query:c}};var Tr=(e)=>{if(typeof e==="object"){if("url"in e)return ie(e.url);return e}return ie(e)};var Dt=async(e,r,s,n)=>{if(!s.endpoint){const c=await $t(s.serviceId||"");if(c)s.endpoint=()=>Promise.resolve(Tr(c))}const t=await Lf(e,r,s);if(typeof s.endpointProvider!=="function")throw new Error("config.endpointProvider is not set.");return s.endpointProvider(t,n)},Lf=async(e,r,s)=>{const n={},t=r?.getEndpointParameterInstructions?.()||{};for(let[i,c]of Object.entries(t))switch(c.type){case"staticContextParams":n[i]=c.value;break;case"contextParams":n[i]=e[c.name];break;case"clientContextParams":case"builtInParams":n[i]=await Ct(c.name,i,s)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(c))}if(Object.keys(t).length===0)Object.assign(n,s);if(String(s.serviceId).toLowerCase()==="s3")await Ft(n);return n};var xt=({config:e,instructions:r})=>{return(s,n)=>async(t)=>{const i=await Dt(t.input,{getEndpointParameterInstructions(){return r}},{...e},n);n.endpointV2=i,n.authSchemes=i.properties?.authSchemes;const c=n.authSchemes?.[0];if(c){n.signing_region=c.signingRegion,n.signing_service=c.signingName;const a=q(n)?.selectedHttpAuthScheme?.httpAuthOption;if(a)a.signingProperties=Object.assign(a.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties)}return s({...t})}};var Lt=(e,r)=>(s)=>async(n)=>{const{response:t}=await s(n);try{const i=await r(t,e);return{response:t,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:t}),!("$metadata"in i)){if(i.message+="\n Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.",typeof i.$responseBodyText!=="undefined"){if(i.$response)i.$response.body=i.$responseBodyText}}throw i}};var ut=(e,r)=>(s,n)=>async(t)=>{const i=n.endpointV2?.url&&e.urlParser?async()=>e.urlParser(n.endpointV2.url):e.endpoint;if(!i)throw new Error("No valid endpoint provider available.");const c=await r(t.input,{...e,endpoint:i});return s({...t,request:c})};function V(e,r,s){return{applyToStack:(n)=>{n.add(Lt(e,s),uf),n.add(ut(e,r),ze)}}}var uf={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ze={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};var Ws={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:ze.name},Y=(e,r)=>({applyToStack:(s)=>{s.addRelativeTo(xt({config:e,instructions:r}),Ws)}});var Nr=(e)=>{const r=e.tls??!0,{endpoint:s}=e,n=s!=null?async()=>Tr(await C(s)()):void 0;return{...e,endpoint:n,tls:r,isCustomEndpoint:!!s,useDualstackEndpoint:C(e.useDualstackEndpoint??!1),useFipsEndpoint:C(e.useFipsEndpoint??!1)}};var vf={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Ws.name},kr=(e,{httpAuthSchemeParametersProvider:r,identityProviderConfigProvider:s})=>({applyToStack:(n)=>{n.addRelativeTo(Ys(e,{httpAuthSchemeParametersProvider:r,identityProviderConfigProvider:s}),vf)}});var iE={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:ze.name};var Bf=(e)=>(r)=>{throw r},bf=(e,r)=>{},vt=(e)=>(r,s)=>async(n)=>{if(!M.isInstance(n.request))return r(n);const i=q(s).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:c={}},identity:o,signer:a}=i,f=await r({...n,request:await a.sign(n.request,o,c)}).catch((a.errorHandler||Bf)(c));return(a.successHandler||bf)(f.response,c),f};var B;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(B||(B={}));var W=3,He=B.STANDARD;var Bt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],bt=["TimeoutError","RequestTimeout","RequestTimeoutException"],Gt=[500,502,503,504],zt=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"];var Gf=(e)=>e.$metadata?.clockSkewCorrected,ke=(e)=>e.$metadata?.httpStatusCode===429||Bt.includes(e.name)||e.$retryable?.throttling==!0,Or=(e)=>Gf(e)||bt.includes(e.name)||zt.includes(e?.code||"")||Gt.includes(e.$metadata?.httpStatusCode||0),Ht=(e)=>{if(e.$metadata?.httpStatusCode!==void 0){const r=e.$metadata.httpStatusCode;if(500<=r&&r<=599&&!Or(e))return!0;return!1}return!1};class Fr{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??0.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??0.5,this.scaleConstant=e?.scaleConstant??0.4,this.smooth=e?.smooth??0.8;const r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1000}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(!this.enabled)return;if(this.refillTokenBucket(),e>this.currentCapacity){const r=(e-this.currentCapacity)/this.fillRate*1000;await new Promise((s)=>setTimeout(s,r))}this.currentCapacity=this.currentCapacity-e}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),ke(e)){const n=!this.enabled?this.measuredTxRate:Math.min(this.measuredTxRate,this.fillRate);this.lastMaxRate=n,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(n),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());const s=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(s)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,0.3333333333333333))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){const s=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(s*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}var he=100,qe=20000,Ks=500,Cr=500,Xs=5,Qs=10,Js=1,$r="amz-sdk-invocation-id",Ur="amz-sdk-request";var qt=()=>{let e=he;return{computeNextBackoffDelay:(n)=>{return Math.floor(Math.min(qe,Math.random()*2**n*e))},setDelayBase:(n)=>{e=n}}};var Zs=({retryDelay:e,retryCount:r,retryCost:s})=>{return{getRetryCount:()=>r,getRetryDelay:()=>Math.min(qe,e),getRetryCost:()=>s}};class Oe{constructor(e){this.maxAttempts=e,this.mode=B.STANDARD,this.capacity=Cr,this.retryBackoffStrategy=qt(),this.maxAttemptsProvider=typeof e==="function"?e:async()=>e}async acquireInitialRetryToken(e){return Zs({retryDelay:he,retryCount:0})}async refreshRetryTokenForRetry(e,r){const s=await this.getMaxAttempts();if(this.shouldRetry(e,r,s)){const n=r.errorType;this.retryBackoffStrategy.setDelayBase(n==="THROTTLING"?Ks:he);const t=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),i=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,t):t,c=this.getCapacityCost(n);return this.capacity-=c,Zs({retryDelay:i,retryCount:e.getRetryCount()+1,retryCost:c})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(Cr,this.capacity+(e.getRetryCost()??Js))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn(`Max attempts provider could not resolve. Using default of ${W}`),W}}shouldRetry(e,r,s){return e.getRetryCount()+1<s&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?Qs:Xs}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class _s{constructor(e,r){this.maxAttemptsProvider=e,this.mode=B.ADAPTIVE;const{rateLimiter:s}=r??{};this.rateLimiter=s??new Fr,this.standardRetryStrategy=new Oe(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}var Dr,zf=new Uint8Array(16);function js(){if(!Dr){if(Dr=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dr)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}return Dr(zf)}function Vt(e,r=0){return O[e[r+0]]+O[e[r+1]]+O[e[r+2]]+O[e[r+3]]+"-"+O[e[r+4]]+O[e[r+5]]+"-"+O[e[r+6]]+O[e[r+7]]+"-"+O[e[r+8]]+O[e[r+9]]+"-"+O[e[r+10]]+O[e[r+11]]+O[e[r+12]]+O[e[r+13]]+O[e[r+14]]+O[e[r+15]]}var O=[];for(let e=0;e<256;++e)O.push((e+256).toString(16).slice(1));var Hf=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),en={randomUUID:Hf};function qf(e,r,s){if(en.randomUUID&&!r&&!e)return en.randomUUID();e=e||{};const n=e.random||(e.rng||js)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){s=s||0;for(let t=0;t<16;++t)r[s+t]=n[t];return r}return Vt(n)}var Ve=qf;var rn=(e)=>{if(e instanceof Error)return e;if(e instanceof Object)return Object.assign(new Error,e);if(typeof e==="string")return new Error(e);return new Error(`AWS SDK error wrapper for ${e}`)};var xr=(e)=>{const{retryStrategy:r}=e,s=C(e.maxAttempts??W);return{...e,maxAttempts:s,retryStrategy:async()=>{if(r)return r;if(await C(e.retryMode)()===B.ADAPTIVE)return new _s(s);return new Oe(s)}}};class ge{trace(){}debug(){}info(){}warn(){}error(){}}var ye=(e,r)=>{const s=[];if(e)s.push(e);if(r)for(let n of r)s.push(n);return s},oe=(e,r)=>{return`${e||"anonymous"}${r&&r.length>0?` (a.k.a. ${r.join(",")})`:""}`},Fe=()=>{let e=[],r=[],s=!1;const n=new Set,t=(l)=>l.sort((d,m)=>Yt[m.step]-Yt[d.step]||Wt[m.priority||"normal"]-Wt[d.priority||"normal"]),i=(l)=>{let d=!1;const m=(g)=>{const w=ye(g.name,g.aliases);if(w.includes(l)){d=!0;for(let y of w)n.delete(y);return!1}return!0};return e=e.filter(m),r=r.filter(m),d},c=(l)=>{let d=!1;const m=(g)=>{if(g.middleware===l){d=!0;for(let w of ye(g.name,g.aliases))n.delete(w);return!1}return!0};return e=e.filter(m),r=r.filter(m),d},o=(l)=>{return e.forEach((d)=>{l.add(d.middleware,{...d})}),r.forEach((d)=>{l.addRelativeTo(d.middleware,{...d})}),l.identifyOnResolve?.(h.identifyOnResolve()),l},a=(l)=>{const d=[];return l.before.forEach((m)=>{if(m.before.length===0&&m.after.length===0)d.push(m);else d.push(...a(m))}),d.push(l),l.after.reverse().forEach((m)=>{if(m.before.length===0&&m.after.length===0)d.push(m);else d.push(...a(m))}),d},f=(l=!1)=>{const d=[],m=[],g={};return e.forEach((y)=>{const E={...y,before:[],after:[]};for(let p of ye(E.name,E.aliases))g[p]=E;d.push(E)}),r.forEach((y)=>{const E={...y,before:[],after:[]};for(let p of ye(E.name,E.aliases))g[p]=E;m.push(E)}),m.forEach((y)=>{if(y.toMiddleware){const E=g[y.toMiddleware];if(E===void 0){if(l)return;throw new Error(`${y.toMiddleware} is not found when adding ${oe(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}if(y.relation==="after")E.after.push(y);if(y.relation==="before")E.before.push(y)}}),t(d).map(a).reduce((y,E)=>{return y.push(...E),y},[])},h={add:(l,d={})=>{const{name:m,override:g,aliases:w}=d,y={step:"initialize",priority:"normal",middleware:l,...d},E=ye(m,w);if(E.length>0){if(E.some((p)=>n.has(p))){if(!g)throw new Error(`Duplicate middleware name '${oe(m,w)}'`);for(let p of E){const T=e.findIndex((se)=>se.name===p||se.aliases?.some((Pe)=>Pe===p));if(T===-1)continue;const N=e[T];if(N.step!==y.step||y.priority!==N.priority)throw new Error(`"${oe(N.name,N.aliases)}" middleware with ${N.priority} priority in ${N.step} step cannot be overridden by "${oe(m,w)}" middleware with ${y.priority} priority in ${y.step} step.`);e.splice(T,1)}}for(let p of E)n.add(p)}e.push(y)},addRelativeTo:(l,d)=>{const{name:m,override:g,aliases:w}=d,y={middleware:l,...d},E=ye(m,w);if(E.length>0){if(E.some((p)=>n.has(p))){if(!g)throw new Error(`Duplicate middleware name '${oe(m,w)}'`);for(let p of E){const T=r.findIndex((se)=>se.name===p||se.aliases?.some((Pe)=>Pe===p));if(T===-1)continue;const N=r[T];if(N.toMiddleware!==y.toMiddleware||N.relation!==y.relation)throw new Error(`"${oe(N.name,N.aliases)}" middleware ${N.relation} "${N.toMiddleware}" middleware cannot be overridden by "${oe(m,w)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);r.splice(T,1)}}for(let p of E)n.add(p)}r.push(y)},clone:()=>o(Fe()),use:(l)=>{l.applyToStack(h)},remove:(l)=>{if(typeof l==="string")return i(l);else return c(l)},removeByTag:(l)=>{let d=!1;const m=(g)=>{const{tags:w,name:y,aliases:E}=g;if(w&&w.includes(l)){const p=ye(y,E);for(let T of p)n.delete(T);return d=!0,!1}return!0};return e=e.filter(m),r=r.filter(m),d},concat:(l)=>{const d=o(Fe());return d.use(l),d.identifyOnResolve(s||d.identifyOnResolve()||(l.identifyOnResolve?.()??!1)),d},applyToStack:o,identify:()=>{return f(!0).map((l)=>{const d=l.step??l.relation+" "+l.toMiddleware;return oe(l.name,l.aliases)+" - "+d})},identifyOnResolve(l){if(typeof l==="boolean")s=l;return s},resolve:(l,d)=>{for(let m of f().map((g)=>g.middleware).reverse())l=m(l,d);if(s)console.log(h.identify());return l}};return h},Yt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Wt={high:3,normal:2,low:1};class Ye{constructor(e){this.middlewareStack=Fe(),this.config=e}send(e,r,s){const n=typeof r!=="function"?r:void 0,t=typeof r==="function"?r:s,i=e.resolveMiddleware(this.middlewareStack,this.config,n);if(t)i(e).then((c)=>t(null,c.output),(c)=>t(c)).catch(()=>{});else return i(e).then((c)=>c.output)}destroy(){if(this.config.requestHandler.destroy)this.config.requestHandler.destroy()}}var j={},we=new Array(64);for(let e=0,r="A".charCodeAt(0),s="Z".charCodeAt(0);e+r<=s;e++){const n=String.fromCharCode(e+r);j[n]=e,we[e]=n}for(let e=0,r="a".charCodeAt(0),s="z".charCodeAt(0);e+r<=s;e++){const n=String.fromCharCode(e+r),t=e+26;j[n]=t,we[t]=n}for(let e=0;e<10;e++){j[e.toString(10)]=e+52;const r=e.toString(10),s=e+52;j[r]=s,we[s]=r}j["+"]=62;we[62]="+";j["/"]=63;we[63]="/";var ae=6,Ee=8,Kt=63;var fe=(e)=>{let r=e.length/4*3;if(e.slice(-2)==="==")r-=2;else if(e.slice(-1)==="=")r--;const s=new ArrayBuffer(r),n=new DataView(s);for(let t=0;t<e.length;t+=4){let i=0,c=0;for(let f=t,h=t+3;f<=h;f++)if(e[f]!=="="){if(!(e[f]in j))throw new TypeError(`Invalid character ${e[f]} in base64 string.`);i|=j[e[f]]<<(h-f)*ae,c+=ae}else i>>=ae;const o=t/4*3;i>>=c%Ee;const a=Math.floor(c/Ee);for(let f=0;f<a;f++){const h=(a-f-1)*Ee;n.setUint8(o+f,(i&255<<h)>>h)}}return new Uint8Array(s)};var D=(e)=>new TextEncoder().encode(e);var ce=(e)=>{if(typeof e==="string")return D(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)};var Se=(e)=>{if(typeof e==="string")return e;if(typeof e!=="object"||typeof e.byteOffset!=="number"||typeof e.byteLength!=="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function pe(e){let r;if(typeof e==="string")r=D(e);else r=e;const s=typeof r==="object"&&typeof r.length==="number",n=typeof r==="object"&&typeof r.byteOffset==="number"&&typeof r.byteLength==="number";if(!s&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let t="";for(let i=0;i<r.length;i+=3){let c=0,o=0;for(let f=i,h=Math.min(i+3,r.length);f<h;f++)c|=r[f]<<(h-f-1)*Ee,o+=Ee;const a=Math.ceil(o/ae);c<<=a*ae-o;for(let f=1;f<=a;f++){const h=(a-f)*ae;t+=we[(c&Kt<<h)>>h]}t+="==".slice(0,4-a)}return t}function Xt(e,r="utf-8"){if(r==="base64")return pe(e);return Se(e)}function Qt(e,r){if(r==="base64")return ee.mutate(fe(e));return ee.mutate(D(e))}class ee extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return Qt(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,ee.prototype),e}transformToString(e="utf-8"){return Xt(this,e)}}var b=(e)=>encodeURIComponent(e).replace(/[!'()*]/g,Vf),Vf=(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function Jt(e){const r=[];for(let s of Object.keys(e).sort()){const n=e[s];if(s=b(s),Array.isArray(n))for(let t=0,i=n.length;t<i;t++)r.push(`${s}=${b(n[t])}`);else{let t=s;if(n||typeof n==="string")t+=`=${b(n)}`;r.push(t)}}return r.join("&")}function Zt(e=0){return new Promise((r,s)=>{if(e)setTimeout(()=>{const n=new Error(`Request did not complete within ${e} ms`);n.name="TimeoutError",s(n)},e)})}var sn={supported:void 0};class Ce{static create(e){if(typeof e?.handle==="function")return e;return new Ce(e)}constructor(e){if(typeof e==="function")this.configProvider=e().then((r)=>r||{});else this.config=e??{},this.configProvider=Promise.resolve(this.config);if(sn.supported===void 0)sn.supported=Boolean(typeof Request!=="undefined"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){if(!this.config)this.config=await this.configProvider;const s=this.config.requestTimeout,n=this.config.keepAlive===!0,t=this.config.credentials;if(r?.aborted){const y=new Error("Request aborted");return y.name="AbortError",Promise.reject(y)}let i=e.path;const c=Jt(e.query||{});if(c)i+=`?${c}`;if(e.fragment)i+=`#${e.fragment}`;let o="";if(e.username!=null||e.password!=null){const y=e.username??"",E=e.password??"";o=`${y}:${E}@`}const{port:a,method:f}=e,h=`${e.protocol}//${o}${e.hostname}${a?`:${a}`:""}${i}`,l=f==="GET"||f==="HEAD"?void 0:e.body,d={body:l,headers:new Headers(e.headers),method:f,credentials:t};if(l)d.duplex="half";if(typeof AbortController!=="undefined")d.signal=r;if(sn.supported)d.keepalive=n;let m=()=>{};const g=new Request(h,d),w=[fetch(g).then((y)=>{const E=y.headers,p={};for(let N of E.entries())p[N[0]]=N[1];if(y.body==null)return y.blob().then((N)=>({response:new J({headers:p,reason:y.statusText,statusCode:y.status,body:N})}));return{response:new J({headers:p,reason:y.statusText,statusCode:y.status,body:y.body})}}),Zt(s)];if(r)w.push(new Promise((y,E)=>{const p=()=>{const T=new Error("Request aborted");T.name="AbortError",E(T)};if(typeof r.addEventListener==="function"){const T=r;T.addEventListener("abort",p,{once:!0}),m=()=>T.removeEventListener("abort",p)}else r.onabort=p}));return Promise.race(w).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then((s)=>{return s[e]=r,s})}httpHandlerConfigs(){return this.config??{}}}async function Yf(e){const r=await Kf(e),s=fe(r);return new Uint8Array(s)}async function Wf(e){const r=[],s=e.getReader();let n=!1,t=0;while(!n){const{done:o,value:a}=await s.read();if(a)r.push(a),t+=a.length;n=o}const i=new Uint8Array(t);let c=0;for(let o of r)i.set(o,c),c+=o.length;return i}function Kf(e){return new Promise((r,s)=>{const n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return s(new Error("Reader aborted too early"));const t=n.result??"",i=t.indexOf(","),c=i>-1?i+1:t.length;r(t.substring(c))},n.onabort=()=>s(new Error("Read aborted")),n.onerror=()=>s(n.error),n.readAsDataURL(e)})}var We=(e)=>{if(typeof Blob==="function"&&e instanceof Blob)return Yf(e);return Wf(e)};function Lr(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const r=new Uint8Array(e.length/2);for(let s=0;s<e.length;s+=2){const n=e.slice(s,s+2).toLowerCase();if(n in nn)r[s/2]=nn[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return r}function k(e){let r="";for(let s=0;s<e.byteLength;s++)r+=_t[e[s]];return r}var _t={},nn={};for(let e=0;e<256;e++){let r=e.toString(16).toLowerCase();if(r.length===1)r=`0${r}`;_t[e]=r,nn[r]=e}var Ke=async(e=new Uint8Array,r)=>{if(e instanceof Uint8Array)return ee.mutate(e);if(!e)return ee.mutate(new Uint8Array);const s=r.streamCollector(e);return ee.mutate(await s)};class G{constructor(){this.middlewareStack=Fe()}static classBuilder(){return new jt}resolveMiddlewareWithContext(e,r,s,{middlewareFn:n,clientName:t,commandName:i,inputFilterSensitiveLog:c,outputFilterSensitiveLog:o,smithyContext:a,additionalContext:f,CommandCtor:h}){for(let w of n.bind(this)(h,e,r,s))this.middlewareStack.use(w);const l=e.concat(this.middlewareStack),{logger:d}=r,m={logger:d,clientName:t,commandName:i,inputFilterSensitiveLog:c,outputFilterSensitiveLog:o,[ne]:{commandInstance:this,...a},...f},{requestHandler:g}=r;return l.resolve((w)=>g.handle(w.request,s||{}),m)}}class jt{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=(e)=>e,this._outputFilterSensitiveLog=(e)=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,s={}){return this._smithyContext={service:e,operation:r,...s},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=(s)=>s,r=(s)=>s){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let r;return r=class extends G{static getEndpointParameterInstructions(){return e._ep}constructor(...[s]){super();this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=s??{},e._init(this)}resolveMiddleware(s,n,t){return this.resolveMiddlewareWithContext(s,n,t,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}var Xe="***SensitiveInformation***";var Xf=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string"){const r=parseFloat(e);if(!Number.isNaN(r)){if(String(r)!==String(e))oi.warn(ii(`Expected number but observed string: ${e}`));return r}}if(typeof e==="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)},Qf=Math.ceil(340282346638528860000000000000000000000),tn=(e)=>{const r=Xf(e);if(r!==void 0&&!Number.isNaN(r)&&r!==1/0&&r!==-1/0){if(Math.abs(r)>Qf)throw new TypeError(`Expected 32-bit float, got ${e}`)}return r},Jf=(e)=>{if(e===null||e===void 0)return;if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)};var ur=(e)=>on(e,32),ei=(e)=>on(e,16),ri=(e)=>on(e,8),on=(e,r)=>{const s=Jf(e);if(s!==void 0&&Zf(s,r)!==s)throw new TypeError(`Expected ${r}-bit integer, got ${e}`);return s},Zf=(e,r)=>{switch(r){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},de=(e,r)=>{if(e===null||e===void 0){if(r)throw new TypeError(`Expected a non-null value for ${r}`);throw new TypeError("Expected a non-null value")}return e},Qe=(e)=>{if(e===null||e===void 0)return;if(typeof e==="object"&&!Array.isArray(e))return e;const r=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${r}: ${e}`)},S=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string")return e;if(["boolean","number","bigint"].includes(typeof e))return oi.warn(ii(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)};var si=(e)=>{if(typeof e=="string")return tn(an(e));return tn(e)},_f=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,an=(e)=>{const r=e.match(_f);if(r===null||r[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)};var fn=(e)=>{if(typeof e=="string")return jf(e);return tn(e)},jf=(e)=>{switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${e}`)}};var ni=(e)=>{if(typeof e==="string")return ei(an(e));return ei(e)},ti=(e)=>{if(typeof e==="string")return ri(an(e));return ri(e)},ii=(e)=>{return String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((r)=>!r.includes("stackTraceWarning")).join("\n")},oi={warn:console.warn};var ec=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],rA=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);var rc=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),vr=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const r=rc.exec(e);if(!r)throw new TypeError("Invalid RFC-3339 date-time value");const[s,n,t,i,c,o,a,f,h]=r,l=ni(ai(n)),d=Je(t,"month",1,12),m=Je(i,"day",1,31),g=sc(l,d,m,{hours:c,minutes:o,seconds:a,fractionalMilliseconds:f});if(h.toUpperCase()!="Z")g.setTime(g.getTime()-ac(h));return g},sA=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$/),nA=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$/),tA=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})$/);var sc=(e,r,s,n)=>{const t=r-1;return tc(e,t,s),new Date(Date.UTC(e,t,s,Je(n.hours,"hour",0,23),Je(n.minutes,"minute",0,59),Je(n.seconds,"seconds",0,60),oc(n.fractionalMilliseconds)))};var nc=[31,28,31,30,31,30,31,31,30,31,30,31],tc=(e,r,s)=>{let n=nc[r];if(r===1&&ic(e))n=29;if(s>n)throw new TypeError(`Invalid day for ${ec[r]} in ${e}: ${s}`)},ic=(e)=>{return e%4===0&&(e%100!==0||e%400===0)},Je=(e,r,s,n)=>{const t=ti(ai(e));if(t<s||t>n)throw new TypeError(`${r} must be between ${s} and ${n}, inclusive`);return t},oc=(e)=>{if(e===null||e===void 0)return 0;return si("0."+e)*1000},ac=(e)=>{const r=e[0];let s=1;if(r=="+")s=1;else if(r=="-")s=-1;else throw new TypeError(`Offset direction, ${r}, must be "+" or "-"`);const n=Number(e.substring(1,3)),t=Number(e.substring(4,6));return s*(n*60+t)*60*1000},ai=(e)=>{let r=0;while(r<e.length-1&&e.charAt(r)==="0")r++;if(r===0)return e;return e.slice(r)};class $e extends Error{constructor(e){super(e.message);Object.setPrototypeOf(this,$e.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}var I=(e,r={})=>{Object.entries(r).filter(([,n])=>n!==void 0).forEach(([n,t])=>{if(e[n]==null||e[n]==="")e[n]=t});const s=e.message||e.Message||"UnknownError";return e.message=s,delete e.Message,e};var fc=({output:e,parsedBody:r,exceptionCtor:s,errorCode:n})=>{const t=cc(e),i=t.httpStatusCode?t.httpStatusCode+"":void 0,c=new s({name:r?.code||r?.Code||n||i||"UnknownError",$fault:"client",$metadata:t});throw I(c,r)},Br=(e)=>{return({output:r,parsedBody:s,errorCode:n})=>{fc({output:r,parsedBody:s,exceptionCtor:e,errorCode:n})}},cc=(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"]});var br=(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{}}};var fi=(e)=>{const r=[];for(let s in Te){const n=Te[s];if(e[n]===void 0)continue;r.push({algorithmId:()=>n,checksumConstructor:()=>e[n]})}return{_checksumAlgorithms:r,addChecksumAlgorithm(s){this._checksumAlgorithms.push(s)},checksumAlgorithms(){return this._checksumAlgorithms}}},ci=(e)=>{const r={};return e.checksumAlgorithms().forEach((s)=>{r[s.algorithmId()]=s.checksumConstructor()}),r};var di=(e)=>{let r=e.retryStrategy;return{setRetryStrategy(s){r=s},retryStrategy(){return r}}},li=(e)=>{const r={};return r.retryStrategy=e.retryStrategy(),r};var Gr=(e)=>{return{...fi(e),...di(e)}};var zr=(e)=>{return{...ci(e),...li(e)}};function cn(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(r){return"%"+r.charCodeAt(0).toString(16).toUpperCase()})}var dn=function(){const e=Object.getPrototypeOf(this).constructor,s=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(s,e.prototype),s};dn.prototype=Object.create(String.prototype,{constructor:{value:dn,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(dn,String);function A(e,r,s){let n,t,i;if(typeof r==="undefined"&&typeof s==="undefined")n={},i=e;else if(n=e,typeof r==="function")return t=r,i=s,dc(n,t,i);else i=r;for(let c of Object.keys(i)){if(!Array.isArray(i[c])){n[c]=i[c];continue}mi(n,null,i,c)}return n}var R=(e,r)=>{const s={};for(let n in r)mi(s,e,r,n);return s},dc=(e,r,s)=>{return A(e,Object.entries(s).reduce((n,[t,i])=>{if(Array.isArray(i))n[t]=i;else if(typeof i==="function")n[t]=[r,i()];else n[t]=[r,i];return n},{}))},mi=(e,r,s,n)=>{if(r!==null){let c=s[n];if(typeof c==="function")c=[,c];const[o=lc,a=mc,f=n]=c;if(typeof o==="function"&&o(r[f])||typeof o!=="function"&&!!o)e[n]=a(r[f]);return}let[t,i]=s[n];if(typeof i==="function"){let c;const o=t===void 0&&(c=i())!=null,a=typeof t==="function"&&!!t(void 0)||typeof t!=="function"&&!!t;if(o)e[n]=c;else if(a)e[n]=i()}else{const c=t===void 0&&i!=null,o=typeof t==="function"&&!!t(i)||typeof t!=="function"&&!!t;if(c||o)e[n]=i}},lc=(e)=>e!=null,mc=(e)=>e;var hi=(e,r,s,n,t,i)=>{if(r!=null&&r[s]!==void 0){const c=n();if(c.length<=0)throw new Error("Empty value provided for input HTTP label: "+s+".");e=e.replace(t,i?c.split("/").map((o)=>cn(o)).join("/"):cn(c))}else throw new Error("No value provided for input HTTP label: "+s+".");return e};var F=(e)=>{if(e==null)return{};if(Array.isArray(e))return e.filter((r)=>r!=null).map(F);if(typeof e==="object"){const r={};for(let s of Object.keys(e)){if(e[s]==null)continue;r[s]=F(e[s])}return r}return e};var gi=(e)=>e?.body instanceof ReadableStream;var hc=(e)=>(r,s)=>async(n)=>{let t=await e.retryStrategy();const i=await e.maxAttempts();if(gc(t)){t=t;let c=await t.acquireInitialRetryToken(s.partition_id),o=new Error,a=0,f=0;const{request:h}=n,l=M.isInstance(h);if(l)h.headers[$r]=Ve();while(!0)try{if(l)h.headers[Ur]=`attempt=${a+1}; max=${i}`;const{response:d,output:m}=await r(n);return t.recordSuccess(c),m.$metadata.attempts=a+1,m.$metadata.totalRetryDelay=f,{response:d,output:m}}catch(d){const m=yc(d);if(o=rn(d),l&&gi(h))throw(s.logger instanceof ge?console:s.logger)?.warn("An error was encountered in a non-retryable streaming request."),o;try{c=await t.refreshRetryTokenForRetry(c,m)}catch(w){if(!o.$metadata)o.$metadata={};throw o.$metadata.attempts=a+1,o.$metadata.totalRetryDelay=f,o}a=c.getRetryCount();const g=c.getRetryDelay();f+=g,await new Promise((w)=>setTimeout(w,g))}}else{if(t=t,t?.mode)s.userAgent=[...s.userAgent||[],["cfg/retry-mode",t.mode]];return t.retry(r,n)}},gc=(e)=>typeof e.acquireInitialRetryToken!=="undefined"&&typeof e.refreshRetryTokenForRetry!=="undefined"&&typeof e.recordSuccess!=="undefined",yc=(e)=>{const r={error:e,errorType:wc(e)},s=Ec(e.$response);if(s)r.retryAfterHint=s;return r},wc=(e)=>{if(ke(e))return"THROTTLING";if(Or(e))return"TRANSIENT";if(Ht(e))return"SERVER_ERROR";return"CLIENT_ERROR"},ln={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Hr=(e)=>({applyToStack:(r)=>{r.add(hc(e),ln)}}),Ec=(e)=>{if(!J.isInstance(e))return;const r=Object.keys(e.headers).find((i)=>i.toLowerCase()==="retry-after");if(!r)return;const s=e.headers[r],n=Number(s);if(!Number.isNaN(n))return new Date(n*1000);return new Date(s)};var Sc={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:ln.name},qr=(e)=>({applyToStack:(r)=>{r.addRelativeTo(vt(e),Sc)}});class Ze{constructor(e){this.authSchemes=new Map;for(let[r,s]of Object.entries(e))if(s!==void 0)this.authSchemes.set(r,s)}getIdentityProvider(e){return this.authSchemes.get(e)}}var pc=(e)=>(r)=>mn(r)&&r.expiration.getTime()-Date.now()<e;var yi=pc(300000),mn=(e)=>e.expiration!==void 0,wi=(e,r,s)=>{if(e===void 0)return;const n=typeof e!=="function"?async()=>Promise.resolve(e):e;let t,i,c,o=!1;const a=async(f)=>{if(!i)i=n(f);try{t=await i,c=!0,o=!1}finally{i=void 0}return t};if(r===void 0)return async(f)=>{if(!c||f?.forceRefresh)t=await a(f);return t};return async(f)=>{if(!c||f?.forceRefresh)t=await a(f);if(o)return t;if(!s(t))return o=!0,t;if(r(t))return await a(f),t;return t}};var _e=(e)=>{if(typeof e==="function")return e;const r=Promise.resolve(e);return()=>r};function Ae(e,r){return new Ei(e,r)}class Ei{constructor(e,r){this.input=e,this.context=r,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){const{hostname:e,protocol:r="https",port:s,path:n}=await this.context.endpoint();this.path=n;for(let t of this.resolvePathStack)t(this.path);return new M({protocol:r,hostname:this.hostname||e,port:s,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push((r)=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,s,n){return this.resolvePathStack.push((t)=>{this.path=hi(t,this.input,e,r,s,n)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}function Ac(e){return(r)=>async(s)=>{const n=s.request;if(M.isInstance(n)){const{body:t,headers:i}=n;if(t&&Object.keys(i).map((c)=>c.toLowerCase()).indexOf(Si)===-1)try{const c=e(t);n.headers={...n.headers,[Si]:String(c)}}catch(c){}}return r({...s,request:n})}}var Si="content-length",Rc={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Vr=(e)=>({applyToStack:(r)=>{r.add(Ac(e.bodyLengthChecker),Rc)}});var hn=(e)=>J.isInstance(e)?e.headers?.date??e.headers?.Date:void 0;var Yr=(e)=>new Date(Date.now()+e);var pi=(e,r)=>Math.abs(Yr(r).getTime()-e)>=300000;var gn=(e,r)=>{const s=Date.parse(e);if(pi(s,r))return s-Date.now();return r};var je=(e,r)=>{if(!r)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return r},Ai=async(e)=>{const r=je("context",e.context),s=je("config",e.config),n=r.endpointV2?.properties?.authSchemes?.[0],i=await je("signer",s.signer)(n),c=e?.signingRegion,o=e?.signingRegionSet,a=e?.signingName;return{config:s,signer:i,signingRegion:c,signingRegionSet:o,signingName:a}};class Ue{async sign(e,r,s){if(!M.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const n=await Ai(s),{config:t,signer:i}=n;let{signingRegion:c,signingName:o}=n;const a=s.context;if(a?.authSchemes?.length??0>1){const[h,l]=a.authSchemes;if(h?.name==="sigv4a"&&l?.name==="sigv4")c=l?.signingRegion??c,o=l?.signingName??o}return await i.sign(e,{signingDate:Yr(t.systemClockOffset),signingRegion:c,signingService:o})}errorHandler(e){return(r)=>{const s=r.ServerTime??hn(r.$response);if(s){const n=je("config",e.config),t=n.systemClockOffset;if(n.systemClockOffset=gn(s,n.systemClockOffset),n.systemClockOffset!==t&&r.$metadata)r.$metadata.clockSkewCorrected=!0}throw r}}successHandler(e,r){const s=hn(e);if(s){const n=je("config",r.config);n.systemClockOffset=gn(s,n.systemClockOffset)}}}var Mi=(e,r,s)=>{let n,t,i,c=!1;const o=async()=>{if(!t)t=e();try{n=await t,i=!0,c=!1}finally{t=void 0}return n};if(r===void 0)return async(a)=>{if(!i||a?.forceRefresh)n=await o();return n};return async(a)=>{if(!i||a?.forceRefresh)n=await o();if(c)return n;if(s&&!s(n))return c=!0,n;if(r(n))return await o(),n;return n}};var Pi="X-Amz-Algorithm",Ii="X-Amz-Credential",Ti="X-Amz-Date",Ni="X-Amz-SignedHeaders",ki="X-Amz-Expires",Oi="X-Amz-Signature",Fi="X-Amz-Security-Token";var Ci="authorization",yn="X-Amz-Date".toLowerCase();var $i=["authorization",yn,"date"],Ui="X-Amz-Signature".toLowerCase(),er="x-amz-content-sha256",Di="X-Amz-Security-Token".toLowerCase();var xi={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},Li=/^proxy-/,ui=/^sec-/;var Wr="AWS4-HMAC-SHA256";var vi="AWS4-HMAC-SHA256-PAYLOAD",Bi="UNSIGNED-PAYLOAD",bi=50,wn="aws4_request",Gi=604800;var Kr={},En=[],Xr=(e,r,s)=>`${e}/${r}/${s}/${wn}`,Hi=async(e,r,s,n,t)=>{const i=await zi(e,r.secretAccessKey,r.accessKeyId),c=`${s}:${n}:${t}:${k(i)}:${r.sessionToken}`;if(c in Kr)return Kr[c];En.push(c);while(En.length>bi)delete Kr[En.shift()];let o=`AWS4${r.secretAccessKey}`;for(let a of[s,n,t,wn])o=await zi(e,o,a);return Kr[c]=o};var zi=(e,r,s)=>{const n=new e(r);return n.update(ce(s)),n.digest()};var Qr=({headers:e},r,s)=>{const n={};for(let t of Object.keys(e).sort()){if(e[t]==null)continue;const i=t.toLowerCase();if(i in xi||r?.has(i)||Li.test(i)||ui.test(i)){if(!s||s&&!s.has(i))continue}n[i]=e[t].trim().replace(/\s+/g," ")}return n};var Sn=({query:e={}})=>{const r=[],s={};for(let n of Object.keys(e).sort()){if(n.toLowerCase()===Ui)continue;r.push(n);const t=e[n];if(typeof t==="string")s[n]=`${b(n)}=${b(t)}`;else if(Array.isArray(t))s[n]=t.slice(0).reduce((i,c)=>i.concat([`${b(n)}=${b(c)}`]),[]).sort().join("&")}return r.map((n)=>s[n]).filter((n)=>n).join("&")};var qi=(e)=>typeof ArrayBuffer==="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]";var rr=async({headers:e,body:r},s)=>{for(let n of Object.keys(e))if(n.toLowerCase()===er)return e[n];if(r==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";else if(typeof r==="string"||ArrayBuffer.isView(r)||qi(r)){const n=new s;return n.update(ce(r)),k(await n.digest())}return Bi};function Yi(e){for(let r=0;r<8;r++)e[r]^=255;for(let r=7;r>-1;r--)if(e[r]++,e[r]!==0)break}class pn{format(e){const r=[];for(let t of Object.keys(e)){const i=D(t);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[t]))}const s=new Uint8Array(r.reduce((t,i)=>t+i.byteLength,0));let n=0;for(let t of r)s.set(t,n),n+=t.byteLength;return s}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,e.value,!1),new Uint8Array(s.buffer);case"long":const n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":const t=new DataView(new ArrayBuffer(3+e.value.byteLength));t.setUint8(0,6),t.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(t.buffer);return i.set(e.value,3),i;case"string":const c=D(e.value),o=new DataView(new ArrayBuffer(3+c.byteLength));o.setUint8(0,7),o.setUint16(1,c.byteLength,!1);const a=new Uint8Array(o.buffer);return a.set(c,3),a;case"timestamp":const f=new Uint8Array(9);return f[0]=8,f.set(An.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!Mc.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(Lr(e.value.replace(/\-/g,"")),1),h}}}var Vi;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(Vi||(Vi={}));var Mc=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class An{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let s=7,n=Math.abs(Math.round(e));s>-1&&n>0;s--,n/=256)r[s]=n;if(e<0)Yi(r);return new An(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;if(r)Yi(e);return parseInt(k(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}var Wi=(e,r)=>{e=e.toLowerCase();for(let s of Object.keys(r))if(e===s.toLowerCase())return!0;return!1};var Rn=(e,r={})=>{const{headers:s,query:n={}}=M.clone(e);for(let t of Object.keys(s)){const i=t.toLowerCase();if(i.slice(0,6)==="x-amz-"&&!r.unhoistableHeaders?.has(i))n[t]=s[t],delete s[t]}return{...e,headers:s,query:n}};var Jr=(e)=>{e=M.clone(e);for(let r of Object.keys(e.headers))if($i.indexOf(r.toLowerCase())>-1)delete e.headers[r];return e};var Ki=(e)=>Pc(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Pc=(e)=>{if(typeof e==="number")return new Date(e*1000);if(typeof e==="string"){if(Number(e))return new Date(Number(e)*1000);return new Date(e)}return e};class _r{constructor({applyChecksum:e,credentials:r,region:s,service:n,sha256:t,uriEscapePath:i=!0}){this.headerFormatter=new pn,this.service=n,this.sha256=t,this.uriEscapePath=i,this.applyChecksum=typeof e==="boolean"?e:!0,this.regionProvider=C(s),this.credentialProvider=C(r)}async presign(e,r={}){const{signingDate:s=new Date,expiresIn:n=3600,unsignableHeaders:t,unhoistableHeaders:i,signableHeaders:c,signingRegion:o,signingService:a}=r,f=await this.credentialProvider();this.validateResolvedCredentials(f);const h=o??await this.regionProvider(),{longDate:l,shortDate:d}=Zr(s);if(n>Gi)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=Xr(d,h,a??this.service),g=Rn(Jr(e),{unhoistableHeaders:i});if(f.sessionToken)g.query[Fi]=f.sessionToken;g.query[Pi]=Wr,g.query[Ii]=`${f.accessKeyId}/${m}`,g.query[Ti]=l,g.query[ki]=n.toString(10);const w=Qr(g,t,c);return g.query[Ni]=Xi(w),g.query[Oi]=await this.getSignature(l,m,this.getSigningKey(f,h,d,a),this.createCanonicalRequest(g,w,await rr(e,this.sha256))),g}async sign(e,r){if(typeof e==="string")return this.signString(e,r);else if(e.headers&&e.payload)return this.signEvent(e,r);else if(e.message)return this.signMessage(e,r);else return this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:s=new Date,priorSignature:n,signingRegion:t,signingService:i}){const c=t??await this.regionProvider(),{shortDate:o,longDate:a}=Zr(s),f=Xr(o,c,i??this.service),h=await rr({headers:{},body:r},this.sha256),l=new this.sha256;l.update(e);const d=k(await l.digest()),m=[vi,a,f,n,d,h].join("\n");return this.signString(m,{signingDate:s,signingRegion:c,signingService:i})}async signMessage(e,{signingDate:r=new Date,signingRegion:s,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:s,signingService:n,priorSignature:e.priorSignature}).then((i)=>{return{message:e.message,signature:i}})}async signString(e,{signingDate:r=new Date,signingRegion:s,signingService:n}={}){const t=await this.credentialProvider();this.validateResolvedCredentials(t);const i=s??await this.regionProvider(),{shortDate:c}=Zr(r),o=new this.sha256(await this.getSigningKey(t,i,c,n));return o.update(ce(e)),k(await o.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:s,unsignableHeaders:n,signingRegion:t,signingService:i}={}){const c=await this.credentialProvider();this.validateResolvedCredentials(c);const o=t??await this.regionProvider(),a=Jr(e),{longDate:f,shortDate:h}=Zr(r),l=Xr(h,o,i??this.service);if(a.headers[yn]=f,c.sessionToken)a.headers[Di]=c.sessionToken;const d=await rr(a,this.sha256);if(!Wi(er,a.headers)&&this.applyChecksum)a.headers[er]=d;const m=Qr(a,n,s),g=await this.getSignature(f,l,this.getSigningKey(c,o,h,i),this.createCanonicalRequest(a,m,d));return a.headers[Ci]=`${Wr} Credential=${c.accessKeyId}/${l}, SignedHeaders=${Xi(m)}, Signature=${g}`,a}createCanonicalRequest(e,r,s){const n=Object.keys(r).sort();return`${e.method}
2
+ ${this.getCanonicalPath(e)}
3
+ ${Sn(e)}
4
+ ${n.map((t)=>`${t}:${r[t]}`).join("\n")}
67
5
 
68
- //# debugId=5BD891C214399E2564756E2164756E21
6
+ ${n.join(";")}
7
+ ${s}`}async createStringToSign(e,r,s){const n=new this.sha256;n.update(ce(s));const t=await n.digest();return`${Wr}
8
+ ${e}
9
+ ${r}
10
+ ${k(t)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(let t of e.split("/")){if(t?.length===0)continue;if(t===".")continue;if(t==="..")r.pop();else r.push(t)}const s=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return b(s).replace(/%2F/g,"/")}return e}async getSignature(e,r,s,n){const t=await this.createStringToSign(e,r,n),i=new this.sha256(await s);return i.update(ce(t)),k(await i.digest())}getSigningKey(e,r,s,n){return Hi(this.sha256,e,s,r,n||this.service)}validateResolvedCredentials(e){if(typeof e!=="object"||typeof e.accessKeyId!=="string"||typeof e.secretAccessKey!=="string")throw new Error("Resolved credential object is not valid")}}var Zr=(e)=>{const r=Ki(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}},Xi=(e)=>Object.keys(e).sort().join(";");var jr=(e)=>{let r;if(e.credentials)r=wi(e.credentials,yi,mn);if(!r)if(e.credentialDefaultProvider)r=_e(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e})));else r=async()=>{throw new Error("`credentials` is missing")};const{signingEscapePath:s=!0,systemClockOffset:n=e.systemClockOffset||0,sha256:t}=e;let i;if(e.signer)i=_e(e.signer);else if(e.regionInfoProvider)i=()=>_e(e.region)().then(async(c)=>[await e.regionInfoProvider(c,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},c]).then(([c,o])=>{const{signingRegion:a,signingService:f}=c;e.signingRegion=e.signingRegion||a||o,e.signingName=e.signingName||f||e.serviceId;const h={...e,credentials:r,region:e.signingRegion,service:e.signingName,sha256:t,uriEscapePath:s};return new(e.signerConstructor||_r)(h)});else i=async(c)=>{c=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await _e(e.region)(),properties:{}},c);const{signingRegion:o,signingName:a}=c;e.signingRegion=e.signingRegion||o,e.signingName=e.signingName||a||e.serviceId;const f={...e,credentials:r,region:e.signingRegion,service:e.signingName,sha256:t,uriEscapePath:s};return new(e.signerConstructor||_r)(f)};return{...e,systemClockOffset:n,signingEscapePath:s,credentials:r,signer:i}};var Qi=(e,r)=>Ke(e,r).then((s)=>r.utf8Encoder(s));var x=(e,r)=>Qi(e,r).then((s)=>{if(s.length)try{return JSON.parse(s)}catch(n){if(n?.name==="SyntaxError")Object.defineProperty(n,"$responseBodyText",{value:s});throw n}return{}}),es=async(e,r)=>{const s=await x(e,r);return s.message=s.message??s.Message,s},rs=(e,r)=>{const s=(i,c)=>Object.keys(i).find((o)=>o.toLowerCase()===c.toLowerCase()),n=(i)=>{let c=i;if(typeof c==="number")c=c.toString();if(c.indexOf(",")>=0)c=c.split(",")[0];if(c.indexOf(":")>=0)c=c.split(":")[0];if(c.indexOf("#")>=0)c=c.split("#")[1];return c},t=s(e.headers,"x-amzn-errortype");if(t!==void 0)return n(e.headers[t]);if(r.code!==void 0)return n(r.code);if(r.__type!==void 0)return n(r.__type)};function Ic(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(r,s)=>({signingProperties:{config:r,context:s}})}}var Ji=async(e,r,s)=>{return{operation:q(r).operation,region:await C(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Zi=(e)=>{const r=[];switch(e.operation){default:r.push(Ic(e))}return r},_i=(e)=>{return{...jr(e)}};var ji=(e)=>{return{...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}},De={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var eo={name:"@aws-sdk/client-bedrock",description:"AWS SDK for JavaScript Bedrock Client for Node.js, Browser and React Native",version:"3.640.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-bedrock","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo bedrock"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.637.0","@aws-sdk/client-sts":"3.637.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.637.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.637.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.637.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2",uuid:"^9.0.1"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96","@types/uuid":"^9.0.4",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock"}};var Mn=(e)=>new TextEncoder().encode(e);function z(e){if(e instanceof Uint8Array)return e;if(typeof e==="string")return Nc(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)}var Nc=typeof Buffer!=="undefined"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:Mn;function le(e){if(typeof e==="string")return e.length===0;return e.byteLength===0}function Pn(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}function In(e){if(!Uint32Array.from){var r=new Uint32Array(e.length),s=0;while(s<e.length)r[s]=e[s],s+=1;return r}return Uint32Array.from(e)}var Tn={name:"SHA-256"},Nn={name:"HMAC",hash:Tn},ro=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);function xe(){if(typeof window!=="undefined")return window;else if(typeof self!=="undefined")return self;return kc}var kc={};var kn=function(){function e(r){this.toHash=new Uint8Array(0),this.secret=r,this.reset()}return e.prototype.update=function(r){if(le(r))return;var s=z(r),n=new Uint8Array(this.toHash.byteLength+s.byteLength);n.set(this.toHash,0),n.set(s,this.toHash.byteLength),this.toHash=n},e.prototype.digest=function(){var r=this;if(this.key)return this.key.then(function(s){return xe().crypto.subtle.sign(Nn,s,r.toHash).then(function(n){return new Uint8Array(n)})});if(le(this.toHash))return Promise.resolve(ro);return Promise.resolve().then(function(){return xe().crypto.subtle.digest(Tn,r.toHash)}).then(function(s){return Promise.resolve(new Uint8Array(s))})},e.prototype.reset=function(){var r=this;if(this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0)this.key=new Promise(function(s,n){xe().crypto.subtle.importKey("raw",z(r.secret),Nn,!1,["sign"]).then(s,n)}),this.key.catch(function(){})},e}();function ss(e,r,s,n){function t(i){return i instanceof s?i:new s(function(c){c(i)})}return new(s||(s=Promise))(function(i,c){function o(h){try{f(n.next(h))}catch(l){c(l)}}function a(h){try{f(n.throw(h))}catch(l){c(l)}}function f(h){h.done?i(h.value):t(h.value).then(o,a)}f((n=n.apply(e,r||[])).next())})}function ns(e,r){var s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,t,i,c;return c={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function o(f){return function(h){return a([f,h])}}function a(f){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,f[0]&&(s=0)),s)try{if(n=1,t&&(i=f[0]&2?t.return:f[0]?t.throw||((i=t.return)&&i.call(t),0):t.next)&&!(i=i.call(t,f[1])).done)return i;if(t=0,i)f=[f[0]&2,i.value];switch(f[0]){case 0:case 1:i=f;break;case 4:return s.label++,{value:f[1],done:!1};case 5:s.label++,t=f[1],f=[0];continue;case 7:f=s.ops.pop(),s.trys.pop();continue;default:if((i=s.trys,!(i=i.length>0&&i[i.length-1]))&&(f[0]===6||f[0]===2)){s=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){s.label=f[1];break}if(f[0]===6&&s.label<i[1]){s.label=i[1],i=f;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(f);break}if(i[2])s.ops.pop();s.trys.pop();continue}f=r.call(e,s)}catch(h){f=[6,h],t=0}finally{n=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function so(e){var r=typeof Symbol==="function"&&Symbol.iterator,s=r&&e[r],n=0;if(s)return s.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&n>=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}var U=64,no=32,to=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),io=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],oo=Math.pow(2,53)-1;var sr=function(){function e(){this.state=Int32Array.from(io),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(r){if(this.finished)throw new Error("Attempted to update an already finished hash.");var s=0,n=r.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>oo)throw new Error("Cannot hash more than 2^53 - 1 bits");while(n>0)if(this.buffer[this.bufferLength++]=r[s++],n--,this.bufferLength===U)this.hashBuffer(),this.bufferLength=0},e.prototype.digest=function(){if(!this.finished){var r=this.bytesHashed*8,s=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(s.setUint8(this.bufferLength++,128),n%U>=U-8){for(var t=this.bufferLength;t<U;t++)s.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(var t=this.bufferLength;t<U-8;t++)s.setUint8(t,0);s.setUint32(U-8,Math.floor(r/4294967296),!0),s.setUint32(U-4,r),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(no);for(var t=0;t<8;t++)i[t*4]=this.state[t]>>>24&255,i[t*4+1]=this.state[t]>>>16&255,i[t*4+2]=this.state[t]>>>8&255,i[t*4+3]=this.state[t]>>>0&255;return i},e.prototype.hashBuffer=function(){var r=this,s=r.buffer,n=r.state,t=n[0],i=n[1],c=n[2],o=n[3],a=n[4],f=n[5],h=n[6],l=n[7];for(var d=0;d<U;d++){if(d<16)this.temp[d]=(s[d*4]&255)<<24|(s[d*4+1]&255)<<16|(s[d*4+2]&255)<<8|s[d*4+3]&255;else{var m=this.temp[d-2],g=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10;m=this.temp[d-15];var w=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;this.temp[d]=(g+this.temp[d-7]|0)+(w+this.temp[d-16]|0)}var y=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&f^~a&h)|0)+(l+(to[d]+this.temp[d]|0)|0)|0,E=((t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10))+(t&i^t&c^i&c)|0;l=h,h=f,f=a,a=o+y|0,o=c,c=i,i=t,t=y+E|0}n[0]+=t,n[1]+=i,n[2]+=c,n[3]+=o,n[4]+=a,n[5]+=f,n[6]+=h,n[7]+=l},e}();function Oc(e){var r=z(e);if(r.byteLength>U){var s=new sr;s.update(r),r=s.digest()}var n=new Uint8Array(U);return n.set(r),n}var ao=function(){function e(r){this.secret=r,this.hash=new sr,this.reset()}return e.prototype.update=function(r){if(le(r)||this.error)return;try{this.hash.update(z(r))}catch(s){this.error=s}},e.prototype.digestSync=function(){if(this.error)throw this.error;if(this.outer){if(!this.outer.finished)this.outer.update(this.hash.digest());return this.outer.digest()}return this.hash.digest()},e.prototype.digest=function(){return ss(this,void 0,void 0,function(){return ns(this,function(r){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new sr,this.secret){this.outer=new sr;var r=Oc(this.secret),s=new Uint8Array(U);s.set(r);for(var n=0;n<U;n++)r[n]^=54,s[n]^=92;this.hash.update(r),this.outer.update(s);for(var n=0;n<r.byteLength;n++)r[n]=0}},e}();function fo(e){if(Cc(e)&&typeof e.crypto.subtle==="object"){var r=e.crypto.subtle;return $c(r)}return!1}function Cc(e){if(typeof e==="object"&&typeof e.crypto==="object"){var r=e.crypto.getRandomValues;return typeof r==="function"}return!1}function $c(e){return e&&Fc.every(function(r){return typeof e[r]==="function"})}var Fc=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];var ts=function(){function e(r){if(fo(xe()))this.hash=new kn(r);else this.hash=new ao(r)}return e.prototype.update=function(r,s){this.hash.update(z(r))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();var co=st(Fn(),1),is=({serviceId:e,clientVersion:r})=>async()=>{const s=typeof window!=="undefined"&&window?.navigator?.userAgent?co.default.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",r],["ua","2.0"],[`os/${s?.os?.name||"other"}`,s?.os?.version],["lang/js"],["md/browser",`${s?.browser?.name??"unknown"}_${s?.browser?.version??"unknown"}`]];if(e)n.push([`api/${e}`,r]);return n};var os=(e)=>()=>Promise.reject(e);var lo=typeof TextEncoder=="function"?new TextEncoder:null,as=(e)=>{if(typeof e==="string"){if(lo)return lo.encode(e).byteLength;let r=e.length;for(let s=r-1;s>=0;s--){const n=e.charCodeAt(s);if(n>127&&n<=2047)r++;else if(n>2047&&n<=65535)r+=2;if(n>=56320&&n<=57343)s--}return r}else if(typeof e.byteLength==="number")return e.byteLength;else if(typeof e.size==="number")return e.size;throw new Error(`Body Length computation failed for ${e}`)};var mo={["required"]:!1,type:"String"},ho={["required"]:!0,default:!1,type:"Boolean"},go={["ref"]:"Endpoint"},Ao={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},Ro={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},K={},yo={["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsFIPS"]},wo={["fn"]:"booleanEquals",["argv"]:[!0,{["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsDualStack"]}]},Eo=[Ao],So=[Ro],po=[{["ref"]:"Region"}],Uc={version:"1.0",parameters:{Region:mo,UseDualStack:ho,UseFIPS:ho,Endpoint:mo},rules:[{conditions:[{["fn"]:"isSet",["argv"]:[go]}],rules:[{conditions:Eo,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:"error"},{rules:[{conditions:So,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:"error"},{endpoint:{url:go,properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{rules:[{conditions:[{["fn"]:"isSet",["argv"]:po}],rules:[{conditions:[{["fn"]:"aws.partition",["argv"]:po,assign:"PartitionResult"}],rules:[{conditions:[Ao,Ro],rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[!0,yo]},wo],rules:[{rules:[{endpoint:{url:"https://bedrock-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:"error"}],type:"tree"},{conditions:Eo,rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[yo,!0]}],rules:[{rules:[{endpoint:{url:"https://bedrock-fips.{Region}.{PartitionResult#dnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS is enabled but this partition does not support FIPS",type:"error"}],type:"tree"},{conditions:So,rules:[{conditions:[wo],rules:[{rules:[{endpoint:{url:"https://bedrock.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"DualStack is enabled but this partition does not support DualStack",type:"error"}],type:"tree"},{rules:[{endpoint:{url:"https://bedrock.{Region}.{PartitionResult#dnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"}],type:"tree"},{error:"Invalid Configuration: Missing Region",type:"error"}],type:"tree"}]},Mo=Uc;var Po=(e,r={})=>{return be(Mo,{endpointParams:e,logger:r.logger})};Z.aws=Ge;var Io=(e)=>{return{apiVersion:"2023-04-20",base64Decoder:e?.base64Decoder??fe,base64Encoder:e?.base64Encoder??pe,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Po,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Zi,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Ue}],logger:e?.logger??new ge,serviceId:e?.serviceId??"Bedrock",urlParser:e?.urlParser??ie,utf8Decoder:e?.utf8Decoder??D,utf8Encoder:e?.utf8Encoder??Se}};var No=st(Fn(),1);var To=["in-region","cross-region","mobile","standard","legacy"];var fs=({defaultsMode:e}={})=>Mi(async()=>{const r=typeof e==="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Promise.resolve(Dc()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${To.join(", ")}, got ${r}`)}}),Dc=()=>{const r=(typeof window!=="undefined"&&window?.navigator?.userAgent?No.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return r==="tablet"||r==="mobile"};var ko=(e)=>{const r=fs(e),s=()=>r().then(br),n=Io(e);return{...n,...e,runtime:"browser",defaultsMode:r,bodyLengthChecker:e?.bodyLengthChecker??as,credentialDefaultProvider:e?.credentialDefaultProvider??((t)=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??is({serviceId:n.serviceId,clientVersion:eo.version}),maxAttempts:e?.maxAttempts??W,region:e?.region??os("Region is missing"),requestHandler:Ce.create(e?.requestHandler??s),retryMode:e?.retryMode??(async()=>(await s()).retryMode||He),sha256:e?.sha256??ts,streamCollector:e?.streamCollector??We,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(Rr)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(Mr))}};var cs=(e)=>{let r=async()=>{if(e.region===void 0)throw new Error("Region is missing from runtimeConfig");const s=e.region;if(typeof s==="string")return s;return s()};return{setRegion(s){r=s},region(){return r}}},ds=(e)=>{return{region:e.region()}};var Oo=(e)=>{const r=e.httpAuthSchemes;let{httpAuthSchemeProvider:s,credentials:n}=e;return{setHttpAuthScheme(t){const i=r.findIndex((c)=>c.schemeId===t.schemeId);if(i===-1)r.push(t);else r.splice(i,1,t)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(t){s=t},httpAuthSchemeProvider(){return s},setCredentials(t){n=t},credentials(){return n}}},Fo=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}};var ls=(e)=>e,Co=(e,r)=>{const s={...ls(cs(e)),...ls(Gr(e)),...ls(ir(e)),...ls(Oo(e))};return r.forEach((n)=>n.configure(s)),{...e,...ds(s),...zr(s),...or(s),...Fo(s)}};class Cn extends Ye{constructor(...[e]){const r=ko(e||{}),s=ji(r),n=lr(s),t=xr(n),i=Ir(t),c=ar(i),o=Nr(c),a=_i(o),f=Co(a,e?.extensions||[]);super(f);this.config=f,this.middlewareStack.use(pr(this.config)),this.middlewareStack.use(Hr(this.config)),this.middlewareStack.use(Vr(this.config)),this.middlewareStack.use(fr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(dr(this.config)),this.middlewareStack.use(kr(this.config,{httpAuthSchemeParametersProvider:Ji,identityProviderConfigProvider:async(h)=>new Ze({"aws.auth#sigv4":h.credentials})})),this.middlewareStack.use(qr(this.config))}destroy(){super.destroy()}}class L extends $e{constructor(e){super(e);Object.setPrototypeOf(this,L.prototype)}}class ms extends L{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,ms.prototype)}}class hs extends L{constructor(e){super({name:"ConflictException",$fault:"client",...e});this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,hs.prototype)}}class gs extends L{constructor(e){super({name:"InternalServerException",$fault:"server",...e});this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,gs.prototype)}}class ys extends L{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,ys.prototype)}}class ws extends L{constructor(e){super({name:"ThrottlingException",$fault:"client",...e});this.name="ThrottlingException",this.$fault="client",Object.setPrototypeOf(this,ws.prototype)}}class Es extends L{constructor(e){super({name:"ValidationException",$fault:"client",...e});this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,Es.prototype)}}var $o;(function(e){e.visit=(r,s)=>{if(r.s3Uri!==void 0)return s.s3Uri(r.s3Uri);return s._(r.$unknown[0],r.$unknown[1])}})($o||($o={}));var Uo;(function(e){e.visit=(r,s)=>{if(r.automated!==void 0)return s.automated(r.automated);if(r.human!==void 0)return s.human(r.human);return s._(r.$unknown[0],r.$unknown[1])}})(Uo||(Uo={}));var Do;(function(e){e.visit=(r,s)=>{if(r.bedrockModel!==void 0)return s.bedrockModel(r.bedrockModel);return s._(r.$unknown[0],r.$unknown[1])}})(Do||(Do={}));var xo;(function(e){e.visit=(r,s)=>{if(r.models!==void 0)return s.models(r.models);return s._(r.$unknown[0],r.$unknown[1])}})(xo||(xo={}));class Ss extends L{constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});this.name="ServiceQuotaExceededException",this.$fault="client",Object.setPrototypeOf(this,Ss.prototype)}}class ps extends L{constructor(e){super({name:"TooManyTagsException",$fault:"client",...e});this.name="TooManyTagsException",this.$fault="client",Object.setPrototypeOf(this,ps.prototype),this.resourceName=e.resourceName}}var Lo;(function(e){e.visit=(r,s)=>{if(r.s3DataSource!==void 0)return s.s3DataSource(r.s3DataSource);return s._(r.$unknown[0],r.$unknown[1])}})(Lo||(Lo={}));var uo;(function(e){e.visit=(r,s)=>{if(r.s3InputDataConfig!==void 0)return s.s3InputDataConfig(r.s3InputDataConfig);return s._(r.$unknown[0],r.$unknown[1])}})(uo||(uo={}));var vo;(function(e){e.visit=(r,s)=>{if(r.s3OutputDataConfig!==void 0)return s.s3OutputDataConfig(r.s3OutputDataConfig);return s._(r.$unknown[0],r.$unknown[1])}})(vo||(vo={}));var Ho=async(e,r)=>{const s=Ae(e,r),n={"content-type":"application/json"};s.bp("/model-customization-jobs");let t;return t=JSON.stringify(R(e,{baseModelIdentifier:[],clientRequestToken:[!0,(i)=>i??Ve()],customModelKmsKeyId:[],customModelName:[],customModelTags:(i)=>F(i),customizationType:[],hyperParameters:(i)=>F(i),jobName:[],jobTags:(i)=>F(i),outputDataConfig:(i)=>F(i),roleArn:[],trainingDataConfig:(i)=>F(i),validationDataConfig:(i)=>F(i),vpcConfig:(i)=>F(i)})),s.m("POST").h(n).b(t),s.build()};var qo=async(e,r)=>{const s=Ae(e,r),n={};s.bp("/model-customization-jobs/{jobIdentifier}"),s.p("jobIdentifier",()=>e.jobIdentifier,"{jobIdentifier}",!1);let t;return s.m("GET").h(n).b(t),s.build()};var Vo=async(e,r)=>{const s=Ae(e,r),n={};s.bp("/foundation-models");const t=A({[zo]:[,e[zo]],[Bo]:[,e[Bo]],[Go]:[,e[Go]],[bo]:[,e[bo]]});let i;return s.m("GET").h(n).q(t).b(i),s.build()};var Yo=async(e,r)=>{if(e.statusCode!==201&&e.statusCode>=300)return $n(e,r);const s=A({$metadata:H(e)}),n=de(Qe(await x(e.body,r)),"body"),t=R(n,{jobArn:S});return Object.assign(s,t),s};var Wo=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return $n(e,r);const s=A({$metadata:H(e)}),n=de(Qe(await x(e.body,r)),"body"),t=R(n,{baseModelArn:S,clientRequestToken:S,creationTime:(i)=>de(vr(i)),customizationType:S,endTime:(i)=>de(vr(i)),failureMessage:S,hyperParameters:F,jobArn:S,jobName:S,lastModifiedTime:(i)=>de(vr(i)),outputDataConfig:F,outputModelArn:S,outputModelKmsKeyArn:S,outputModelName:S,roleArn:S,status:S,trainingDataConfig:F,trainingMetrics:(i)=>Kc(i,r),validationDataConfig:F,validationMetrics:(i)=>Xc(i,r),vpcConfig:F});return Object.assign(s,t),s};var Ko=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return $n(e,r);const s=A({$metadata:H(e)}),n=de(Qe(await x(e.body,r)),"body"),t=R(n,{modelSummaries:F});return Object.assign(s,t),s};var $n=async(e,r)=>{const s={...e,body:await es(e.body,r)},n=rs(e,s.body);switch(n){case"AccessDeniedException":case"com.amazonaws.bedrock#AccessDeniedException":throw await bc(s,r);case"ConflictException":case"com.amazonaws.bedrock#ConflictException":throw await Gc(s,r);case"InternalServerException":case"com.amazonaws.bedrock#InternalServerException":throw await zc(s,r);case"ResourceNotFoundException":case"com.amazonaws.bedrock#ResourceNotFoundException":throw await Hc(s,r);case"ThrottlingException":case"com.amazonaws.bedrock#ThrottlingException":throw await Vc(s,r);case"ValidationException":case"com.amazonaws.bedrock#ValidationException":throw await Wc(s,r);case"ServiceQuotaExceededException":case"com.amazonaws.bedrock#ServiceQuotaExceededException":throw await qc(s,r);case"TooManyTagsException":case"com.amazonaws.bedrock#TooManyTagsException":throw await Yc(s,r);default:const t=s.body;return Bc({output:e,parsedBody:t,errorCode:n})}},Bc=Br(L),bc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new ms({$metadata:H(e),...s});return I(i,e.body)},Gc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new hs({$metadata:H(e),...s});return I(i,e.body)},zc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new gs({$metadata:H(e),...s});return I(i,e.body)},Hc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new ys({$metadata:H(e),...s});return I(i,e.body)},qc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Ss({$metadata:H(e),...s});return I(i,e.body)},Vc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new ws({$metadata:H(e),...s});return I(i,e.body)},Yc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S,resourceName:S});Object.assign(s,t);const i=new ps({$metadata:H(e),...s});return I(i,e.body)},Wc=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Es({$metadata:H(e),...s});return I(i,e.body)};var Kc=(e,r)=>{return R(e,{trainingLoss:fn})},Xc=(e,r)=>{return(e||[]).filter((n)=>n!=null).map((n)=>{return Qc(n,r)})},Qc=(e,r)=>{return R(e,{validationLoss:fn})},H=(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"]});var Bo="byCustomizationType",bo="byInferenceType";var Go="byOutputModality",zo="byProvider";class Un extends G.classBuilder().ep({...De}).m(function(e,r,s,n){return[V(s,this.serialize,this.deserialize),Y(s,e.getEndpointParameterInstructions())]}).s("AmazonBedrockControlPlaneService","CreateModelCustomizationJob",{}).n("BedrockClient","CreateModelCustomizationJobCommand").f(void 0,void 0).ser(Ho).de(Yo).build(){}class Dn extends G.classBuilder().ep({...De}).m(function(e,r,s,n){return[V(s,this.serialize,this.deserialize),Y(s,e.getEndpointParameterInstructions())]}).s("AmazonBedrockControlPlaneService","GetModelCustomizationJob",{}).n("BedrockClient","GetModelCustomizationJobCommand").f(void 0,void 0).ser(qo).de(Wo).build(){}class xn extends G.classBuilder().ep({...De}).m(function(e,r,s,n){return[V(s,this.serialize,this.deserialize),Y(s,e.getEndpointParameterInstructions())]}).s("AmazonBedrockControlPlaneService","ListFoundationModels",{}).n("BedrockClient","ListFoundationModelsCommand").f(void 0,void 0).ser(Vo).de(Ko).build(){}async function UT(e){re.debug(e);const r=new Un(e),s=await Ln.send(r);return re.debug("Successfully create model customization job"),re.debug(s),s}async function DT(e){re.debug(e);const r=new Dn(e),s=await Ln.send(r);return re.debug("Successfully get model customization job"),re.debug(s),s}async function xT(e){re.debug(e);const r=new xn(e),s=await Ln.send(r);return re.debug("Successfully list foundation models"),re.debug(s),s}var Ln=new Cn({region:process.env.REGION||"us-east-1"}),re=console;var Xo=(e)=>({...e,eventStreamMarshaller:e.eventStreamSerdeProvider(e)});function Jc(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(r,s)=>({signingProperties:{config:r,context:s}})}}var Qo=async(e,r,s)=>{return{operation:q(r).operation,region:await C(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Jo=(e)=>{const r=[];switch(e.operation){default:r.push(Jc(e))}return r},Zo=(e)=>{return{...jr(e)}};var _o=(e)=>{return{...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}},As={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var jo={name:"@aws-sdk/client-bedrock-runtime",description:"AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",version:"3.637.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-bedrock-runtime","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo bedrock-runtime"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.637.0","@aws-sdk/client-sts":"3.637.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.637.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.637.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.637.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-stream":"^3.1.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock-runtime"}};var _c=function(){function e(){this.crc32=new Re}return e.prototype.update=function(r){if(le(r))return;this.crc32.update(z(r))},e.prototype.digest=function(){return ss(this,void 0,void 0,function(){return ns(this,function(r){return[2,Pn(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new Re},e}();var Re=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(r){var s,n;try{for(var t=so(r),i=t.next();!i.done;i=t.next()){var c=i.value;this.checksum=this.checksum>>>8^ed[(this.checksum^c)&255]}}catch(o){s={error:o}}finally{try{if(i&&!i.done&&(n=t.return))n.call(t)}finally{if(s)throw s.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();var jc=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],ed=In(jc);function ea(e){for(let r=0;r<8;r++)e[r]^=255;for(let r=7;r>-1;r--)if(e[r]++,e[r]!==0)break}class Le{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let s=7,n=Math.abs(Math.round(e));s>-1&&n>0;s--,n/=256)r[s]=n;if(e<0)ea(r);return new Le(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;if(r)ea(e);return parseInt(k(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}class un{constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){const r=[];for(let t of Object.keys(e)){const i=this.fromUtf8(t);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[t]))}const s=new Uint8Array(r.reduce((t,i)=>t+i.byteLength,0));let n=0;for(let t of r)s.set(t,n),n+=t.byteLength;return s}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,e.value,!1),new Uint8Array(s.buffer);case"long":const n=new Uint8Array(9);return n[0]=5,n.set(e.value.bytes,1),n;case"binary":const t=new DataView(new ArrayBuffer(3+e.value.byteLength));t.setUint8(0,6),t.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(t.buffer);return i.set(e.value,3),i;case"string":const c=this.fromUtf8(e.value),o=new DataView(new ArrayBuffer(3+c.byteLength));o.setUint8(0,7),o.setUint16(1,c.byteLength,!1);const a=new Uint8Array(o.buffer);return a.set(c,3),a;case"timestamp":const f=new Uint8Array(9);return f[0]=8,f.set(Le.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!cd.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(Lr(e.value.replace(/\-/g,"")),1),h}}parse(e){const r={};let s=0;while(s<e.byteLength){const n=e.getUint8(s++),t=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+s,n));switch(s+=n,e.getUint8(s++)){case 0:r[t]={type:sa,value:!0};break;case 1:r[t]={type:sa,value:!1};break;case 2:r[t]={type:rd,value:e.getInt8(s++)};break;case 3:r[t]={type:sd,value:e.getInt16(s,!1)},s+=2;break;case 4:r[t]={type:nd,value:e.getInt32(s,!1)},s+=4;break;case 5:r[t]={type:td,value:new Le(new Uint8Array(e.buffer,e.byteOffset+s,8))},s+=8;break;case 6:const i=e.getUint16(s,!1);s+=2,r[t]={type:id,value:new Uint8Array(e.buffer,e.byteOffset+s,i)},s+=i;break;case 7:const c=e.getUint16(s,!1);s+=2,r[t]={type:od,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+s,c))},s+=c;break;case 8:r[t]={type:ad,value:new Date(new Le(new Uint8Array(e.buffer,e.byteOffset+s,8)).valueOf())},s+=8;break;case 9:const o=new Uint8Array(e.buffer,e.byteOffset+s,16);s+=16,r[t]={type:fd,value:`${k(o.subarray(0,4))}-${k(o.subarray(4,6))}-${k(o.subarray(6,8))}-${k(o.subarray(8,10))}-${k(o.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}}var ra;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(ra||(ra={}));var sa="boolean",rd="byte",sd="short",nd="integer",td="long",id="binary",od="string",ad="timestamp",fd="uuid",cd=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function ta({byteLength:e,byteOffset:r,buffer:s}){if(e<dd)throw new Error("Provided message too short to accommodate event stream message overhead");const n=new DataView(s,r,e),t=n.getUint32(0,!1);if(e!==t)throw new Error("Reported message length does not match received message length");const i=n.getUint32(na,!1),c=n.getUint32(me,!1),o=n.getUint32(e-Me,!1),a=new Re().update(new Uint8Array(s,r,me));if(c!==a.digest())throw new Error(`The prelude checksum specified in the message (${c}) does not match the calculated CRC32 checksum (${a.digest()})`);if(a.update(new Uint8Array(s,r+me,e-(me+Me))),o!==a.digest())throw new Error(`The message checksum (${a.digest()}) did not match the expected value of ${o}`);return{headers:new DataView(s,r+me+Me,i),body:new Uint8Array(s,r+me+Me+i,t-i-(me+Me+Me))}}var na=4,me=na*2,Me=4,dd=me+Me*2;class vn{constructor(e,r){this.headerMarshaller=new un(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){const s=this.headerMarshaller.format(e),n=s.byteLength+r.byteLength+16,t=new Uint8Array(n),i=new DataView(t.buffer,t.byteOffset,t.byteLength),c=new Re;return i.setUint32(0,n,!1),i.setUint32(4,s.byteLength,!1),i.setUint32(8,c.update(t.subarray(0,8)).digest(),!1),t.set(s,12),t.set(r,s.byteLength+12),i.setUint32(n-4,c.update(t.subarray(8,n-4)).digest(),!1),t}decode(e){const{headers:r,body:s}=ta(e);return{headers:this.headerMarshaller.parse(r),body:s}}formatHeaders(e){return this.headerMarshaller.format(e)}}class Bn{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}class bn{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class Gn{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){const r=await this.options.deserializer(e);if(r===void 0)continue;yield r}}}class zn{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}function ia(e){let r=0,s=0,n=null,t=null;const i=(o)=>{if(typeof o!=="number")throw new Error("Attempted to allocate an event message where size was not a number: "+o);r=o,s=4,n=new Uint8Array(o),new DataView(n.buffer).setUint32(0,o,!1)},c=async function*(){const o=e[Symbol.asyncIterator]();while(!0){const{value:a,done:f}=await o.next();if(f){if(!r)return;else if(r===s)yield n;else throw new Error("Truncated event message received.");return}const h=a.length;let l=0;while(l<h){if(!n){const m=h-l;if(!t)t=new Uint8Array(4);const g=Math.min(4-s,m);if(t.set(a.slice(l,l+g),s),s+=g,l+=g,s<4)break;i(new DataView(t.buffer).getUint32(0,!1)),t=null}const d=Math.min(r-s,h-l);if(n.set(a.slice(l,l+d),s),s+=d,l+=d,r&&r===s)yield n,n=null,r=0,s=0}}};return{[Symbol.asyncIterator]:c}}function oa(e,r){return async function(s){const{value:n}=s.headers[":message-type"];if(n==="error"){const t=new Error(s.headers[":error-message"].value||"UnknownError");throw t.name=s.headers[":error-code"].value,t}else if(n==="exception"){const t=s.headers[":exception-type"].value,i={[t]:s},c=await e(i);if(c.$unknown){const o=new Error(r(s.body));throw o.name=t,o}throw c[t]}else if(n==="event"){const t={[s.headers[":event-type"].value]:s},i=await e(t);if(i.$unknown)return;return i}else throw Error(`Unrecognizable event type: ${s.headers[":event-type"].value}`)}}class Rs{constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new vn(e,r),this.utfEncoder=e}deserialize(e,r){const s=ia(e);return new Gn({messageStream:new Bn({inputStream:s,decoder:this.eventStreamCodec}),deserializer:oa(r,this.utfEncoder)})}serialize(e,r){return new bn({messageStream:new zn({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}var aa=(e)=>({[Symbol.asyncIterator]:async function*(){const r=e.getReader();try{while(!0){const{done:s,value:n}=await r.read();if(s)return;yield n}}finally{r.releaseLock()}}}),fa=(e)=>{const r=e[Symbol.asyncIterator]();return new ReadableStream({async pull(s){const{done:n,value:t}=await r.next();if(n)return s.close();s.enqueue(t)}})};class Hn{constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new Rs({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){const s=ld(e)?aa(e):e;return this.universalMarshaller.deserialize(s,r)}serialize(e,r){const s=this.universalMarshaller.serialize(e,r);return typeof ReadableStream==="function"?fa(s):s}}var ld=(e)=>typeof ReadableStream==="function"&&e instanceof ReadableStream;var ca=(e)=>new Hn(e);var da={["required"]:!1,type:"String"},la={["required"]:!0,default:!1,type:"Boolean"},ma={["ref"]:"Endpoint"},Sa={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},pa={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},X={},ha={["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsFIPS"]},ga={["fn"]:"booleanEquals",["argv"]:[!0,{["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsDualStack"]}]},ya=[Sa],wa=[pa],Ea=[{["ref"]:"Region"}],md={version:"1.0",parameters:{Region:da,UseDualStack:la,UseFIPS:la,Endpoint:da},rules:[{conditions:[{["fn"]:"isSet",["argv"]:[ma]}],rules:[{conditions:ya,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:"error"},{rules:[{conditions:wa,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:"error"},{endpoint:{url:ma,properties:X,headers:X},type:"endpoint"}],type:"tree"}],type:"tree"},{rules:[{conditions:[{["fn"]:"isSet",["argv"]:Ea}],rules:[{conditions:[{["fn"]:"aws.partition",["argv"]:Ea,assign:"PartitionResult"}],rules:[{conditions:[Sa,pa],rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[!0,ha]},ga],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:X,headers:X},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:"error"}],type:"tree"},{conditions:ya,rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[ha,!0]}],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:X,headers:X},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS is enabled but this partition does not support FIPS",type:"error"}],type:"tree"},{conditions:wa,rules:[{conditions:[ga],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:X,headers:X},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"DualStack is enabled but this partition does not support DualStack",type:"error"}],type:"tree"},{rules:[{endpoint:{url:"https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",properties:X,headers:X},type:"endpoint"}],type:"tree"}],type:"tree"}],type:"tree"},{error:"Invalid Configuration: Missing Region",type:"error"}],type:"tree"}]},Aa=md;var Ra=(e,r={})=>{return be(Aa,{endpointParams:e,logger:r.logger})};Z.aws=Ge;var Ma=(e)=>{return{apiVersion:"2023-09-30",base64Decoder:e?.base64Decoder??fe,base64Encoder:e?.base64Encoder??pe,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Ra,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Jo,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Ue}],logger:e?.logger??new ge,serviceId:e?.serviceId??"Bedrock Runtime",urlParser:e?.urlParser??ie,utf8Decoder:e?.utf8Decoder??D,utf8Encoder:e?.utf8Encoder??Se}};var Pa=(e)=>{const r=fs(e),s=()=>r().then(br),n=Ma(e);return{...n,...e,runtime:"browser",defaultsMode:r,bodyLengthChecker:e?.bodyLengthChecker??as,credentialDefaultProvider:e?.credentialDefaultProvider??((t)=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??is({serviceId:n.serviceId,clientVersion:jo.version}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??ca,maxAttempts:e?.maxAttempts??W,region:e?.region??os("Region is missing"),requestHandler:Ce.create(e?.requestHandler??s),retryMode:e?.retryMode??(async()=>(await s()).retryMode||He),sha256:e?.sha256??ts,streamCollector:e?.streamCollector??We,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(Rr)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(Mr))}};var Ia=(e)=>{const r=e.httpAuthSchemes;let{httpAuthSchemeProvider:s,credentials:n}=e;return{setHttpAuthScheme(t){const i=r.findIndex((c)=>c.schemeId===t.schemeId);if(i===-1)r.push(t);else r.splice(i,1,t)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(t){s=t},httpAuthSchemeProvider(){return s},setCredentials(t){n=t},credentials(){return n}}},Ta=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}};var Ms=(e)=>e,Na=(e,r)=>{const s={...Ms(cs(e)),...Ms(Gr(e)),...Ms(ir(e)),...Ms(Ia(e))};return r.forEach((n)=>n.configure(s)),{...e,...ds(s),...zr(s),...or(s),...Ta(s)}};class qn extends Ye{constructor(...[e]){const r=Pa(e||{}),s=_o(r),n=lr(s),t=xr(n),i=Ir(t),c=ar(i),o=Nr(c),a=Xo(o),f=Zo(a),h=Na(f,e?.extensions||[]);super(h);this.config=h,this.middlewareStack.use(pr(this.config)),this.middlewareStack.use(Hr(this.config)),this.middlewareStack.use(Vr(this.config)),this.middlewareStack.use(fr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(dr(this.config)),this.middlewareStack.use(kr(this.config,{httpAuthSchemeParametersProvider:Qo,identityProviderConfigProvider:async(l)=>new Ze({"aws.auth#sigv4":l.credentials})})),this.middlewareStack.use(qr(this.config))}destroy(){super.destroy()}}class $ extends $e{constructor(e){super(e);Object.setPrototypeOf(this,$.prototype)}}class Ps extends ${constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,Ps.prototype)}}var ka;(function(e){e.visit=(r,s)=>{if(r.text!==void 0)return s.text(r.text);return s._(r.$unknown[0],r.$unknown[1])}})(ka||(ka={}));class Is extends ${constructor(e){super({name:"InternalServerException",$fault:"server",...e});this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,Is.prototype)}}class Ts extends ${constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,Ts.prototype)}}class Ns extends ${constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});this.name="ServiceQuotaExceededException",this.$fault="client",Object.setPrototypeOf(this,Ns.prototype)}}class ks extends ${constructor(e){super({name:"ThrottlingException",$fault:"client",...e});this.name="ThrottlingException",this.$fault="client",Object.setPrototypeOf(this,ks.prototype)}}class Os extends ${constructor(e){super({name:"ValidationException",$fault:"client",...e});this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,Os.prototype)}}var Vn;(function(e){e.visit=(r,s)=>{if(r.bytes!==void 0)return s.bytes(r.bytes);return s._(r.$unknown[0],r.$unknown[1])}})(Vn||(Vn={}));var Oa;(function(e){e.visit=(r,s)=>{if(r.text!==void 0)return s.text(r.text);return s._(r.$unknown[0],r.$unknown[1])}})(Oa||(Oa={}));var Yn;(function(e){e.visit=(r,s)=>{if(r.bytes!==void 0)return s.bytes(r.bytes);return s._(r.$unknown[0],r.$unknown[1])}})(Yn||(Yn={}));var Wn;(function(e){e.visit=(r,s)=>{if(r.json!==void 0)return s.json(r.json);if(r.text!==void 0)return s.text(r.text);if(r.image!==void 0)return s.image(r.image);if(r.document!==void 0)return s.document(r.document);return s._(r.$unknown[0],r.$unknown[1])}})(Wn||(Wn={}));var Kn;(function(e){e.visit=(r,s)=>{if(r.text!==void 0)return s.text(r.text);if(r.image!==void 0)return s.image(r.image);if(r.document!==void 0)return s.document(r.document);if(r.toolUse!==void 0)return s.toolUse(r.toolUse);if(r.toolResult!==void 0)return s.toolResult(r.toolResult);if(r.guardContent!==void 0)return s.guardContent(r.guardContent);return s._(r.$unknown[0],r.$unknown[1])}})(Kn||(Kn={}));var Fa;(function(e){e.visit=(r,s)=>{if(r.text!==void 0)return s.text(r.text);if(r.guardContent!==void 0)return s.guardContent(r.guardContent);return s._(r.$unknown[0],r.$unknown[1])}})(Fa||(Fa={}));var Ca;(function(e){e.visit=(r,s)=>{if(r.auto!==void 0)return s.auto(r.auto);if(r.any!==void 0)return s.any(r.any);if(r.tool!==void 0)return s.tool(r.tool);return s._(r.$unknown[0],r.$unknown[1])}})(Ca||(Ca={}));var Xn;(function(e){e.visit=(r,s)=>{if(r.json!==void 0)return s.json(r.json);return s._(r.$unknown[0],r.$unknown[1])}})(Xn||(Xn={}));var Qn;(function(e){e.visit=(r,s)=>{if(r.toolSpec!==void 0)return s.toolSpec(r.toolSpec);return s._(r.$unknown[0],r.$unknown[1])}})(Qn||(Qn={}));var $a;(function(e){e.visit=(r,s)=>{if(r.message!==void 0)return s.message(r.message);return s._(r.$unknown[0],r.$unknown[1])}})($a||($a={}));class Fs extends ${constructor(e){super({name:"ModelErrorException",$fault:"client",...e});this.name="ModelErrorException",this.$fault="client",Object.setPrototypeOf(this,Fs.prototype),this.originalStatusCode=e.originalStatusCode,this.resourceName=e.resourceName}}class Cs extends ${constructor(e){super({name:"ModelNotReadyException",$fault:"client",...e});this.name="ModelNotReadyException",this.$fault="client",Object.setPrototypeOf(this,Cs.prototype)}}class $s extends ${constructor(e){super({name:"ModelTimeoutException",$fault:"client",...e});this.name="ModelTimeoutException",this.$fault="client",Object.setPrototypeOf(this,$s.prototype)}}class Us extends ${constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e});this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,Us.prototype)}}var Ua;(function(e){e.visit=(r,s)=>{if(r.text!==void 0)return s.text(r.text);if(r.toolUse!==void 0)return s.toolUse(r.toolUse);return s._(r.$unknown[0],r.$unknown[1])}})(Ua||(Ua={}));var Da;(function(e){e.visit=(r,s)=>{if(r.toolUse!==void 0)return s.toolUse(r.toolUse);return s._(r.$unknown[0],r.$unknown[1])}})(Da||(Da={}));class Ds extends ${constructor(e){super({name:"ModelStreamErrorException",$fault:"client",...e});this.name="ModelStreamErrorException",this.$fault="client",Object.setPrototypeOf(this,Ds.prototype),this.originalStatusCode=e.originalStatusCode,this.originalMessage=e.originalMessage}}var xa;(function(e){e.visit=(r,s)=>{if(r.messageStart!==void 0)return s.messageStart(r.messageStart);if(r.contentBlockStart!==void 0)return s.contentBlockStart(r.contentBlockStart);if(r.contentBlockDelta!==void 0)return s.contentBlockDelta(r.contentBlockDelta);if(r.contentBlockStop!==void 0)return s.contentBlockStop(r.contentBlockStop);if(r.messageStop!==void 0)return s.messageStop(r.messageStop);if(r.metadata!==void 0)return s.metadata(r.metadata);if(r.internalServerException!==void 0)return s.internalServerException(r.internalServerException);if(r.modelStreamErrorException!==void 0)return s.modelStreamErrorException(r.modelStreamErrorException);if(r.validationException!==void 0)return s.validationException(r.validationException);if(r.throttlingException!==void 0)return s.throttlingException(r.throttlingException);if(r.serviceUnavailableException!==void 0)return s.serviceUnavailableException(r.serviceUnavailableException);return s._(r.$unknown[0],r.$unknown[1])}})(xa||(xa={}));var La;(function(e){e.visit=(r,s)=>{if(r.chunk!==void 0)return s.chunk(r.chunk);if(r.internalServerException!==void 0)return s.internalServerException(r.internalServerException);if(r.modelStreamErrorException!==void 0)return s.modelStreamErrorException(r.modelStreamErrorException);if(r.validationException!==void 0)return s.validationException(r.validationException);if(r.throttlingException!==void 0)return s.throttlingException(r.throttlingException);if(r.modelTimeoutException!==void 0)return s.modelTimeoutException(r.modelTimeoutException);if(r.serviceUnavailableException!==void 0)return s.serviceUnavailableException(r.serviceUnavailableException);return s._(r.$unknown[0],r.$unknown[1])}})(La||(La={}));var ua=(e)=>({...e,...e.body&&{body:Xe}}),va=(e)=>({...e,...e.body&&{body:Xe}}),Ba=(e)=>({...e,...e.body&&{body:Xe}});var ba=(e)=>({...e,...e.body&&{body:"STREAMING_CONTENT"}});var Ga=async(e,r)=>{const s=Ae(e,r),n=A({},Za,{[Zn]:e[xs]||"application/octet-stream",[Jn]:e[Jn],[nf]:e[ef],[rf]:e[_a],[sf]:e[ja]});s.bp("/model/{modelId}/invoke"),s.p("modelId",()=>e.modelId,"{modelId}",!1);let t;if(e.body!==void 0)t=e.body;return s.m("POST").h(n).b(t),s.build()},za=async(e,r)=>{const s=Ae(e,r),n=A({},Za,{[Zn]:e[xs]||"application/octet-stream",[Od]:e[Jn],[nf]:e[ef],[rf]:e[_a],[sf]:e[ja]});s.bp("/model/{modelId}/invoke-with-response-stream"),s.p("modelId",()=>e.modelId,"{modelId}",!1);let t;if(e.body!==void 0)t=e.body;return s.m("POST").h(n).b(t),s.build()};var Ha=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return Va(e,r);const s=A({$metadata:u(e),[xs]:[,e.headers[Zn]]}),n=await Ke(e.body,r);return s.body=n,s},qa=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return Va(e,r);const s=A({$metadata:u(e),[xs]:[,e.headers[Fd]]}),n=e.body;return s.body=pd(n,r),s},Va=async(e,r)=>{const s={...e,body:await es(e.body,r)},n=rs(e,s.body);switch(n){case"AccessDeniedException":case"com.amazonaws.bedrockruntime#AccessDeniedException":throw await gd(s,r);case"InternalServerException":case"com.amazonaws.bedrockruntime#InternalServerException":throw await Ya(s,r);case"ResourceNotFoundException":case"com.amazonaws.bedrockruntime#ResourceNotFoundException":throw await Ed(s,r);case"ServiceQuotaExceededException":case"com.amazonaws.bedrockruntime#ServiceQuotaExceededException":throw await Sd(s,r);case"ThrottlingException":case"com.amazonaws.bedrockruntime#ThrottlingException":throw await Qa(s,r);case"ValidationException":case"com.amazonaws.bedrockruntime#ValidationException":throw await Ja(s,r);case"ModelErrorException":case"com.amazonaws.bedrockruntime#ModelErrorException":throw await yd(s,r);case"ModelNotReadyException":case"com.amazonaws.bedrockruntime#ModelNotReadyException":throw await wd(s,r);case"ModelTimeoutException":case"com.amazonaws.bedrockruntime#ModelTimeoutException":throw await Ka(s,r);case"ServiceUnavailableException":case"com.amazonaws.bedrockruntime#ServiceUnavailableException":throw await Xa(s,r);case"ModelStreamErrorException":case"com.amazonaws.bedrockruntime#ModelStreamErrorException":throw await Wa(s,r);default:const t=s.body;return hd({output:e,parsedBody:t,errorCode:n})}},hd=Br($),gd=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Ps({$metadata:u(e),...s});return I(i,e.body)},Ya=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Is({$metadata:u(e),...s});return I(i,e.body)},yd=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S,originalStatusCode:ur,resourceName:S});Object.assign(s,t);const i=new Fs({$metadata:u(e),...s});return I(i,e.body)},wd=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Cs({$metadata:u(e),...s});return I(i,e.body)},Wa=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S,originalMessage:S,originalStatusCode:ur});Object.assign(s,t);const i=new Ds({$metadata:u(e),...s});return I(i,e.body)},Ka=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new $s({$metadata:u(e),...s});return I(i,e.body)},Ed=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Ts({$metadata:u(e),...s});return I(i,e.body)},Sd=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Ns({$metadata:u(e),...s});return I(i,e.body)},Xa=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Us({$metadata:u(e),...s});return I(i,e.body)},Qa=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new ks({$metadata:u(e),...s});return I(i,e.body)},Ja=async(e,r)=>{const s=A({}),n=e.body,t=R(n,{message:S});Object.assign(s,t);const i=new Os({$metadata:u(e),...s});return I(i,e.body)};var pd=(e,r)=>{return r.eventStreamMarshaller.deserialize(e,async(s)=>{if(s.chunk!=null)return{chunk:await Pd(s.chunk,r)};if(s.internalServerException!=null)return{internalServerException:await Ad(s.internalServerException,r)};if(s.modelStreamErrorException!=null)return{modelStreamErrorException:await Rd(s.modelStreamErrorException,r)};if(s.validationException!=null)return{validationException:await Nd(s.validationException,r)};if(s.throttlingException!=null)return{throttlingException:await Td(s.throttlingException,r)};if(s.modelTimeoutException!=null)return{modelTimeoutException:await Md(s.modelTimeoutException,r)};if(s.serviceUnavailableException!=null)return{serviceUnavailableException:await Id(s.serviceUnavailableException,r)};return{$unknown:e}})};var Ad=async(e,r)=>{const s={...e,body:await x(e.body,r)};return Ya(s,r)};var Rd=async(e,r)=>{const s={...e,body:await x(e.body,r)};return Wa(s,r)},Md=async(e,r)=>{const s={...e,body:await x(e.body,r)};return Ka(s,r)},Pd=async(e,r)=>{const s={},n=await x(e.body,r);return Object.assign(s,kd(n,r)),s},Id=async(e,r)=>{const s={...e,body:await x(e.body,r)};return Xa(s,r)},Td=async(e,r)=>{const s={...e,body:await x(e.body,r)};return Qa(s,r)},Nd=async(e,r)=>{const s={...e,body:await x(e.body,r)};return Ja(s,r)};var kd=(e,r)=>{return R(e,{bytes:r.base64Decoder})};var u=(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"]});var Za=(e)=>e!==void 0&&e!==null&&e!==""&&(!Object.getOwnPropertyNames(e).includes("length")||e.length!=0)&&(!Object.getOwnPropertyNames(e).includes("size")||e.size!=0),Jn="accept",xs="contentType",Zn="content-type",_a="guardrailIdentifier",ja="guardrailVersion",ef="trace",Od="x-amzn-bedrock-accept",Fd="x-amzn-bedrock-content-type",rf="x-amzn-bedrock-guardrailidentifier",sf="x-amzn-bedrock-guardrailversion",nf="x-amzn-bedrock-trace";class _n extends G.classBuilder().ep({...As}).m(function(e,r,s,n){return[V(s,this.serialize,this.deserialize),Y(s,e.getEndpointParameterInstructions())]}).s("AmazonBedrockFrontendService","InvokeModel",{}).n("BedrockRuntimeClient","InvokeModelCommand").f(ua,va).ser(Ga).de(Ha).build(){}class jn extends G.classBuilder().ep({...As}).m(function(e,r,s,n){return[V(s,this.serialize,this.deserialize),Y(s,e.getEndpointParameterInstructions())]}).s("AmazonBedrockFrontendService","InvokeModelWithResponseStream",{eventStream:{output:!0}}).n("BedrockRuntimeClient","InvokeModelWithResponseStreamCommand").f(Ba,ba).ser(za).de(qa).build(){}async function ck(e){ue.debug(e);const r=new _n(e),s=await tf.send(r);return ue.debug("Successfully invoke model"),ue.debug(s),s}async function dk(e){ue.debug(e);const r=new jn(e),s=await tf.send(r);return ue.debug("Successfully invoke model with response stream"),ue.debug(s),s}var tf=new qn({region:process.env.REGION||"us-east-1"}),ue=console;export{xT as listFoundationModels,dk as invokeModelWithResponseStream,ck as invokeModel,DT as getModelCustomizationJob,UT as createModelCustomizationJob};
11
+
12
+ //# debugId=14B05121FC4835FE64756E2164756E21
69
13
  //# sourceMappingURL=index.js.map