@stacksjs/buddy 0.70.13 → 0.70.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{chunk-0evg5jp6.js → chunk-29k4nndh.js} +1 -1
  2. package/dist/{chunk-0bm9jzfk.js → chunk-2v06rzw8.js} +1 -1
  3. package/dist/{chunk-xggr9n1s.js → chunk-3zqgxrhy.js} +2 -2
  4. package/dist/{chunk-wjpycfhj.js → chunk-4k60zpwd.js} +1 -1
  5. package/dist/{chunk-fk4k9w9k.js → chunk-8kjkww7q.js} +2 -2
  6. package/dist/{chunk-bvk6vr3a.js → chunk-9372nf93.js} +1 -1
  7. package/dist/{chunk-v649k10a.js → chunk-97pfgxpz.js} +1 -1
  8. package/dist/{chunk-xd0ntg7m.js → chunk-axp857ek.js} +1 -1
  9. package/dist/{chunk-tjxy77dn.js → chunk-brp1ph5b.js} +148 -148
  10. package/dist/{chunk-8j6ps4r9.js → chunk-cegshd35.js} +1 -1
  11. package/dist/{chunk-jvcbf2ew.js → chunk-ckyz9t7a.js} +2 -2
  12. package/dist/{chunk-ewg2wcyt.js → chunk-dkg2g7mz.js} +2 -2
  13. package/dist/chunk-em7b31a0.js +2 -0
  14. package/dist/{chunk-ndpvrw19.js → chunk-fq939414.js} +2 -2
  15. package/dist/{chunk-p9ga59ne.js → chunk-hjdcb837.js} +1 -1
  16. package/dist/{chunk-76q55r9x.js → chunk-jffk6kjy.js} +1 -1
  17. package/dist/{chunk-6tfy93kv.js → chunk-kg8bv5wt.js} +1 -1
  18. package/dist/{chunk-d2kb25t6.js → chunk-knytfag6.js} +1 -1
  19. package/dist/{chunk-g1f16je5.js → chunk-ksjzw2hp.js} +1 -1
  20. package/dist/{chunk-pzqkq1eg.js → chunk-m5bwp7ny.js} +1 -1
  21. package/dist/{chunk-1gv7jvh2.js → chunk-n2jwcjfa.js} +1 -1
  22. package/dist/chunk-nrb40pqc.js +5 -0
  23. package/dist/{chunk-ebq1d2xm.js → chunk-pt5b0ah0.js} +1 -1
  24. package/dist/{chunk-n549129b.js → chunk-qm8eqyn5.js} +1 -1
  25. package/dist/{chunk-pq12d9s0.js → chunk-qpr5rmm7.js} +1 -1
  26. package/dist/{chunk-y0kfnrfm.js → chunk-sq3kqg71.js} +2 -2
  27. package/dist/{chunk-rcdezkfx.js → chunk-t4y0mz3y.js} +1 -1
  28. package/dist/chunk-tenvzkb8.js +2 -0
  29. package/dist/{chunk-c0xy5mxd.js → chunk-v4k14fcj.js} +1 -1
  30. package/dist/{chunk-1dyb4ha1.js → chunk-v57s04nz.js} +1 -1
  31. package/dist/{chunk-jgcb2h70.js → chunk-xfhw9xck.js} +1 -1
  32. package/dist/cli.js +1 -1
  33. package/dist/index.js +1 -1
  34. package/package.json +1 -1
  35. package/dist/chunk-755h2sey.js +0 -2
  36. package/dist/chunk-d9j9qatb.js +0 -2
  37. package/dist/chunk-n4svhbxp.js +0 -5
@@ -1,2 +0,0 @@
1
- import{Kb as F,Lb as ge}from"./chunk-ndpvrw19.js";import{Ob as m,Pb as we,jc as yt}from"./chunk-n4svhbxp.js";import{rc as De,uc as nr,vc as Or}from"./chunk-jvcbf2ew.js";import{Lc as Ee}from"./chunk-1dyb4ha1.js";import{Pc as W,Rc as le}from"./chunk-p9ga59ne.js";import{Xc as jr}from"./chunk-xggr9n1s.js";import{Yc as N,bd as zr}from"./chunk-g1f16je5.js";function Kr(e){return e}var Vt=(e)=>(t)=>async(r)=>{if(!m.isInstance(r.request))return t(r);let{request:o}=r,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let s=o.hostname;if(o.port!=null)s+=`:${o.port}`;o.headers.host=s}return t(r)},Bt={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Qr=(e)=>({applyToStack:(t)=>{t.add(Vt(e),Bt)}});var Wt=()=>(e,t)=>async(r)=>{try{let o=await e(r),{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:f}=a,u=c??t.inputFilterSensitiveLog,R=f??t.outputFilterSensitiveLog,{$metadata:l,...d}=o.output;return i?.info?.({clientName:n,commandName:s,input:u(r.input),output:R(d),metadata:l}),o}catch(o){let{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c}=a,f=c??t.inputFilterSensitiveLog;throw i?.error?.({clientName:n,commandName:s,input:f(r.input),error:o,metadata:o.$metadata}),o}},Yt={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},to=(e)=>({applyToStack:(t)=>{t.add(Wt(),Yt)}});var ne="X-Amzn-Trace-Id",zt="AWS_LAMBDA_FUNCTION_NAME",jt="_X_AMZN_TRACE_ID",Xt=(e)=>(t)=>async(r)=>{let{request:o}=r;if(!m.isInstance(o)||e.runtime!=="node")return t(r);let n=Object.keys(o.headers??{}).find((c)=>c.toLowerCase()===ne.toLowerCase())??ne;if(o.headers.hasOwnProperty(n))return t(r);let s=process.env[zt],i=process.env[jt],a=(c)=>typeof c==="string"&&c.length>0;if(a(s)&&a(i))o.headers[ne]=i;return t({...r,request:o})},Ht={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},io=(e)=>({applyToStack:(t)=>{t.add(Xt(e),Ht)}});var Ce=N(De(),1),se=void 0;function qt(e){if(e===void 0)return!0;return typeof e==="string"&&e.length<=50}function co(e){let t=Ce.normalizeProvider(e.userAgentAppId??se),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:typeof r==="string"?[[r]]:r,userAgentAppId:async()=>{let o=await t();if(!qt(o)){let n=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?console:e.logger;if(typeof o!=="string")n?.warn("userAgentAppId must be a string or undefined.");else if(o.length>50)n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}class Zt{constructor({size:e,params:t}){if(this.data=new Map,this.parameters=[],this.capacity=e??50,t)this.parameters=t}get(e,t){let r=this.hash(e);if(r===!1)return t();if(!this.data.has(r)){if(this.data.size>this.capacity+10){let o=this.data.keys(),n=0;while(!0){let{value:s,done:i}=o.next();if(this.data.delete(s),i||++n>10)break}}this.data.set(r,t())}return this.data.get(r)}size(){return this.data.size}hash(e){let t="",{parameters:r}=this;if(r.length===0)return!1;for(let o of r){let n=String(e[o]??"");if(n.includes("|;"))return!1;t+=n+"|;"}return t}}var Jt=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}$"),M=(e)=>Jt.test(e)||e.startsWith("[")&&e.endsWith("]");var Kt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),L=(e,t=!1)=>{if(!t)return Kt.test(e);let r=e.split(".");for(let o of r)if(!L(o))return!1;return!0};var $={};var h="endpoints";function E(e){if(typeof e!=="object"||e==null)return e;if("ref"in e)return`$${E(e.ref)}`;if("fn"in e)return`${e.fn}(${(e.argv||[]).map(E).join(", ")})`;return JSON.stringify(e,null,2)}class p extends Error{constructor(e){super(e);this.name="EndpointError"}}var Pe=(e,t)=>e===t;var Ue=(e)=>{let t=e.split("."),r=[];for(let o of t){let n=o.indexOf("[");if(n!==-1){if(o.indexOf("]")!==o.length-1)throw new p(`Path: '${e}' does not end with ']'`);let s=o.slice(n+1,-1);if(Number.isNaN(parseInt(s)))throw new p(`Invalid array index: '${s}' in path: '${e}'`);if(n!==0)r.push(o.slice(0,n));r.push(s)}else r.push(o)}return r};var B=(e,t)=>Ue(t).reduce((r,o)=>{if(typeof r!=="object")throw new p(`Index '${o}' in '${t}' not found in '${JSON.stringify(e)}'`);else if(Array.isArray(r))return r[parseInt(o)];return r[o]},e);var ve=(e)=>e!=null;var Me=(e)=>!e;var ie={[W.HTTP]:80,[W.HTTPS]:443},Le=(e)=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e==="object"&&"hostname"in e){let{hostname:l,port:d,protocol:I="",path:V="",query:Ft={}}=e,be=new URL(`${I}//${l}${d?`:${d}`:""}${V}`);return be.search=Object.entries(Ft).map(([kt,Gt])=>`${kt}=${Gt}`).join("&"),be}return new URL(e)}catch(l){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let r=t.href,{host:o,hostname:n,pathname:s,protocol:i,search:a}=t;if(a)return null;let c=i.slice(0,-1);if(!Object.values(W).includes(c))return null;let f=M(n),u=r.includes(`${o}:${ie[c]}`)||typeof e==="string"&&e.includes(`${o}:${ie[c]}`),R=`${o}${u?`:${ie[c]}`:""}`;return{scheme:c,authority:R,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:f}};var $e=(e,t)=>e===t;var Fe=(e,t,r,o)=>{if(t>=r||e.length<r)return null;if(!o)return e.substring(t,r);return e.substring(e.length-r,e.length-t)};var ke=(e)=>encodeURIComponent(e).replace(/[!*'()]/g,(t)=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);var Ge={booleanEquals:Pe,getAttr:B,isSet:ve,isValidHostLabel:L,not:Me,parseURL:Le,stringEquals:$e,substring:Fe,uriEncode:ke};var Y=(e,t)=>{let r=[],o={...t.endpointParams,...t.referenceRecord},n=0;while(n<e.length){let s=e.indexOf("{",n);if(s===-1){r.push(e.slice(n));break}r.push(e.slice(n,s));let i=e.indexOf("}",s);if(i===-1){r.push(e.slice(s));break}if(e[s+1]==="{"&&e[i+1]==="}")r.push(e.slice(s+1,i)),n=i+2;let a=e.substring(s+1,i);if(a.includes("#")){let[c,f]=a.split("#");r.push(B(o[c],f))}else r.push(o[a]);n=i+1}return r.join("")};var Ve=({ref:e},t)=>{return{...t.endpointParams,...t.referenceRecord}[e]};var S=(e,t,r)=>{if(typeof e==="string")return Y(e,r);else if(e.fn)return z(e,r);else if(e.ref)return Ve(e,r);throw new p(`'${t}': ${String(e)} is not a string, function or reference.`)};var z=({fn:e,argv:t},r)=>{let o=t.map((s)=>["boolean","number"].includes(typeof s)?s:S(s,"arg",r)),n=e.split(".");if(n[0]in $&&n[1]!=null)return $[n[0]][n[1]](...o);return Ge[e](...o)};var Be=({assign:e,...t},r)=>{if(e&&e in r.referenceRecord)throw new p(`'${e}' is already defined in Reference Record.`);let o=z(t,r);return r.logger?.debug?.(`${h} evaluateCondition: ${E(t)} = ${E(o)}`),{result:o===""?!0:!!o,...e!=null&&{toAssign:{name:e,value:o}}}};var b=(e=[],t)=>{let r={};for(let o of e){let{result:n,toAssign:s}=Be(o,{...t,referenceRecord:{...t.referenceRecord,...r}});if(!n)return{result:n};if(s)r[s.name]=s.value,t.logger?.debug?.(`${h} assign: ${s.name} := ${E(s.value)}`)}return{result:!0,referenceRecord:r}};var We=(e,t)=>Object.entries(e).reduce((r,[o,n])=>({...r,[o]:n.map((s)=>{let i=S(s,"Header value entry",t);if(typeof i!=="string")throw new p(`Header '${o}' value '${i}' is not a string`);return i})}),{});var ae=(e,t)=>{if(Array.isArray(e))return e.map((r)=>ae(r,t));switch(typeof e){case"string":return Y(e,t);case"object":if(e===null)throw new p(`Unexpected endpoint property: ${e}`);return j(e,t);case"boolean":return e;default:throw new p(`Unexpected endpoint property type: ${typeof e}`)}};var j=(e,t)=>Object.entries(e).reduce((r,[o,n])=>({...r,[o]:ae(n,t)}),{});var Ye=(e,t)=>{let r=S(e,"Endpoint URL",t);if(typeof r==="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new p(`Endpoint URL must be a string, got ${typeof r}`)};var ze=(e,t)=>{let{conditions:r,endpoint:o}=e,{result:n,referenceRecord:s}=b(r,t);if(!n)return;let i={...t,referenceRecord:{...t.referenceRecord,...s}},{url:a,properties:c,headers:f}=o;return t.logger?.debug?.(`${h} Resolving endpoint from template: ${E(o)}`),{...f!=null&&{headers:We(f,i)},...c!=null&&{properties:j(c,i)},url:Ye(a,i)}};var je=(e,t)=>{let{conditions:r,error:o}=e,{result:n,referenceRecord:s}=b(r,t);if(!n)return;throw new p(S(o,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))};var Xe=(e,t)=>{let{conditions:r,rules:o}=e,{result:n,referenceRecord:s}=b(r,t);if(!n)return;return X(o,{...t,referenceRecord:{...t.referenceRecord,...s}})};var X=(e,t)=>{for(let r of e)if(r.type==="endpoint"){let o=ze(r,t);if(o)return o}else if(r.type==="error")je(r,t);else if(r.type==="tree"){let o=Xe(r,t);if(o)return o}else throw new p(`Unknown endpoint rule: ${r}`);throw new p("Rules evaluation failed")};var Qt=(e,t)=>{let{endpointParams:r,logger:o}=t,{parameters:n,rules:s}=e;t.logger?.debug?.(`${h} Initial EndpointParams: ${E(r)}`);let i=Object.entries(n).filter(([,f])=>f.default!=null).map(([f,u])=>[f,u.default]);if(i.length>0)for(let[f,u]of i)r[f]=r[f]??u;let a=Object.entries(n).filter(([,f])=>f.required).map(([f])=>f);for(let f of a)if(r[f]==null)throw new p(`Missing required parameter: '${f}'`);let c=X(s,{endpointParams:r,logger:o,referenceRecord:{}});return t.logger?.debug?.(`${h} Resolved endpoint: ${E(c)}`),c};var ce=(e,t=!1)=>{if(t){for(let r of e.split("."))if(!ce(r))return!1;return!0}if(!L(e))return!1;if(e.length<3||e.length>63)return!1;if(e!==e.toLowerCase())return!1;if(M(e))return!1;return!0};var He=(e)=>{let t=e.split(":");if(t.length<6)return null;let[r,o,n,s,i,...a]=t;if(r!=="arn"||o===""||n===""||a.join(":")==="")return null;let c=a.map((f)=>f.split("/")).flat();return{partition:o,service:n,region:s,accountId:i,resourceId:c}};var qe={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"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)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS 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:{"aws-iso-f-global":{description:"AWS ISOF global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}}],version:"1.1"};var tr=qe,rr="",Ze=(e)=>{let{partitions:t}=tr;for(let o of t){let{regions:n,outputs:s}=o;for(let[i,a]of Object.entries(n))if(i===e)return{...s,...a}}for(let o of t){let{regionRegex:n,outputs:s}=o;if(new RegExp(n).test(e))return{...s}}let r=t.find((o)=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}};var Je=()=>rr;var or={isVirtualHostableS3Bucket:ce,parseArn:He,partition:Ze};$.aws=or;var x=N(nr(),1),sr=/\d{12}\.ddb/;async function Ke(e,t,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor")x.setFeature(e,"PROTOCOL_RPC_V2_CBOR","M");if(typeof t.retryStrategy==="function"){let s=await t.retryStrategy();if(typeof s.acquireInitialRetryToken==="function")if(s.constructor?.name?.includes("Adaptive"))x.setFeature(e,"RETRY_MODE_ADAPTIVE","F");else x.setFeature(e,"RETRY_MODE_STANDARD","E");else x.setFeature(e,"RETRY_MODE_LEGACY","D")}if(typeof t.accountIdEndpointMode==="function"){let s=e.endpointV2;if(String(s?.url?.hostname).match(sr))x.setFeature(e,"ACCOUNT_ID_ENDPOINT","O");switch(await t.accountIdEndpointMode?.()){case"disabled":x.setFeature(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":x.setFeature(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":x.setFeature(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let s=n;if(s.accountId)x.setFeature(e,"RESOLVED_ACCOUNT_ID","T");for(let[i,a]of Object.entries(s.$source??{}))x.setFeature(e,i,a)}}var fe="user-agent",H="x-amz-user-agent",pe=" ",q="/",Qe=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,et=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,ue="-";function tt(e){let t="";for(let r in e){let o=e[r];if(t.length+o.length+1<=1024){if(t.length)t+=","+o;else t+=o;continue}break}return t}var ir=(e)=>(t,r)=>async(o)=>{let{request:n}=o;if(!m.isInstance(n))return t(o);let{headers:s}=n,i=r?.userAgent?.map(Z)||[],a=(await e.defaultUserAgentProvider()).map(Z);await Ke(r,e,o);let c=r;a.push(`m/${tt(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let f=e?.customUserAgent?.map(Z)||[],u=await e.userAgentAppId();if(u)a.push(Z([`app/${u}`]));let R=Je(),l=(R?[R]:[]).concat([...a,...i,...f]).join(pe),d=[...a.filter((I)=>I.startsWith("aws-sdk-")),...f].join(pe);if(e.runtime!=="browser"){if(d)s[H]=s[H]?`${s[fe]} ${d}`:d;s[fe]=l}else s[H]=l;return t({...o,request:n})},Z=(e)=>{let t=e[0].split(q).map((i)=>i.replace(Qe,ue)).join(q),r=e[1]?.replace(et,ue),o=t.indexOf(q),n=t.substring(0,o),s=t.substring(o+1);if(n==="api")s=s.toLowerCase();return[n,s,r].filter((i)=>i&&i.length>0).reduce((i,a,c)=>{switch(c){case 0:return a;case 1:return`${i}/${a}`;default:return`${i}#${a}`}},"")},ar={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Zs=(e)=>({applyToStack:(t)=>{t.add(ir(e),ar)}});var J=(e)=>typeof e==="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var de=(e)=>J(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var ii=(e)=>{let{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{if(typeof t==="string")return de(t);let o=await t();return de(o)},useFipsEndpoint:async()=>{let o=typeof t==="string"?t:await t();if(J(o))return!0;return typeof r!=="function"?Promise.resolve(!!r):r()}})};var D=(e,t,r)=>{if(!(t in e))return;if(e[t]==="true")return!0;if(e[t]==="false")return!1;throw new Error(`Cannot load ${r} "${t}". Expected "true" or "false", got ${e[t]}.`)};var T;(function(e){e.ENV="env",e.CONFIG="shared config entry"})(T||(T={}));var cr="AWS_USE_DUALSTACK_ENDPOINT",fr="use_dualstack_endpoint";var gi={environmentVariableSelector:(e)=>D(e,cr,T.ENV),configFileSelector:(e)=>D(e,fr,T.CONFIG),default:!1};var pr="AWS_USE_FIPS_ENDPOINT",ur="use_fips_endpoint";var _i={environmentVariableSelector:(e)=>D(e,pr,T.ENV),configFileSelector:(e)=>D(e,ur,T.CONFIG),default:!1};var rt=(e)=>e[le]||(e[le]={});var A=(e)=>{if(typeof e==="function")return e;let t=Promise.resolve(e);return()=>t};var ot={environmentVariableSelector:(e)=>e.AWS_REGION,configFileSelector:(e)=>e.region,default:()=>{throw new Error("Region is missing")}},ki={preferredFile:"credentials"};var nt="content-length";function dr(e){return(t)=>async(r)=>{let o=r.request;if(m.isInstance(o)){let{body:n,headers:s}=o;if(n&&Object.keys(s).map((i)=>i.toLowerCase()).indexOf(nt)===-1)try{let i=e(n);o.headers={...o.headers,[nt]:String(i)}}catch(i){}}return t({...r,request:o})}}var lr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},da=(e)=>({applyToStack:(t)=>{t.add(dr(e.bodyLengthChecker),lr)}});var st=(e,t)=>(r,o)=>async(n)=>{let{response:s}=await r(n);try{let i=await t(s,e);return{response:s,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:s}),!("$metadata"in i)){try{i.message+=`
2
- Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`}catch(c){if(!o.logger||o.logger?.constructor?.name==="NoOpLogger")console.warn("Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.");else o.logger?.warn?.("Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.")}if(typeof i.$responseBodyText!=="undefined"){if(i.$response)i.$response.body=i.$responseBodyText}}throw i}};var it=(e,t)=>(r,o)=>async(n)=>{let s=o.endpointV2?.url&&e.urlParser?async()=>e.urlParser(o.endpointV2.url):e.endpoint;if(!s)throw new Error("No valid endpoint provider available.");let i=await t(n.input,{...e,endpoint:s});return r({...n,request:i})};var mr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},me={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Ra(e,t,r){return{applyToStack:(o)=>{o.add(st(e,r),mr),o.add(it(e,t),me)}}}var lt=N(De(),1);var at=async(e)=>{let t=e?.Bucket||"";if(typeof e.Bucket==="string")e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"));if(_r(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else if(!Rr(t)||t.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)e.ForcePathStyle=!0;if(e.DisableMultiRegionAccessPoints)e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0;return e},Er=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,gr=/(\d+\.){3}\d+/,xr=/\.\./;var Rr=(e)=>Er.test(e)&&!gr.test(e)&&!xr.test(e),_r=(e)=>{let[t,r,o,,,n]=e.split(":"),s=t==="arn"&&e.split(":").length>=6,i=Boolean(s&&r&&o&&n);if(s&&!i)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return i};var ct=(e,t,r)=>{let o=async()=>{let n=r[e]??r[t];if(typeof n==="function")return n();return n};if(e==="credentialScope"||t==="CredentialScope")return async()=>{let n=typeof r.credentials==="function"?await r.credentials():r.credentials;return n?.credentialScope??n?.CredentialScope};if(e==="accountId"||t==="AccountId")return async()=>{let n=typeof r.credentials==="function"?await r.credentials():r.credentials;return n?.accountId??n?.AccountId};if(e==="endpoint"||t==="endpoint")return async()=>{let n=await o();if(n&&typeof n==="object"){if("url"in n)return n.url.href;if("hostname"in n){let{protocol:s,hostname:i,port:a,path:c}=n;return`${s}//${i}${a?":"+a:""}${c}`}}return n};return o};var ft="AWS_ENDPOINT_URL",pt="endpoint_url",ut=(e)=>({environmentVariableSelector:(t)=>{let r=e.split(" ").map((s)=>s.toUpperCase()),o=t[[ft,...r].join("_")];if(o)return o;let n=t[ft];if(n)return n;return},configFileSelector:(t,r)=>{if(r&&t.services){let n=r[["services",t.services].join(Ee)];if(n){let s=e.split(" ").map((a)=>a.toLowerCase()),i=n[[s.join("_"),pt].join(Ee)];if(i)return i}}let o=t[pt];if(o)return o;return},default:void 0});var K=async(e)=>F(ut(e??""))();var Q=(e)=>{if(typeof e==="object"){if("url"in e)return ge(e.url);return e}return ge(e)};var dt=async(e,t,r,o)=>{if(!r.endpoint){let i;if(r.serviceConfiguredEndpoint)i=await r.serviceConfiguredEndpoint();else i=await K(r.serviceId);if(i)r.endpoint=()=>Promise.resolve(Q(i))}let n=await hr(e,t,r);if(typeof r.endpointProvider!=="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(n,o)},hr=async(e,t,r)=>{let o={},n=t?.getEndpointParameterInstructions?.()||{};for(let[s,i]of Object.entries(n))switch(i.type){case"staticContextParams":o[s]=i.value;break;case"contextParams":o[s]=e[i.name];break;case"clientContextParams":case"builtInParams":o[s]=await ct(i.name,s,r)();break;case"operationContextParams":o[s]=i.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}if(Object.keys(n).length===0)Object.assign(o,r);if(String(r.serviceId).toLowerCase()==="s3")await at(o);return o};var mt=({config:e,instructions:t})=>{return(r,o)=>async(n)=>{if(e.endpoint)lt.setFeature(o,"ENDPOINT_OVERRIDE","N");let s=await dt(n.input,{getEndpointParameterInstructions(){return t}},{...e},o);o.endpointV2=s,o.authSchemes=s.properties?.authSchemes;let i=o.authSchemes?.[0];if(i){o.signing_region=i.signingRegion,o.signing_service=i.signingName;let c=rt(o)?.selectedHttpAuthScheme?.httpAuthOption;if(c)c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:i.signingRegion,signingRegion:i.signingRegion,signing_service:i.signingName,signingName:i.signingName,signingRegionSet:i.signingRegionSet},i.properties)}return r({...n})}};var Ar={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:me.name},za=(e,t)=>({applyToStack:(r)=>{r.addRelativeTo(mt({config:e,instructions:t}),Ar)}});var Za=(e)=>{let t=e.tls??!0,{endpoint:r,useDualstackEndpoint:o,useFipsEndpoint:n}=e,s=r!=null?async()=>Q(await A(r)()):void 0,a=Object.assign(e,{endpoint:s,tls:t,isCustomEndpoint:!!r,useDualstackEndpoint:A(o??!1),useFipsEndpoint:A(n??!1)}),c=void 0;return a.serviceConfiguredEndpoint=async()=>{if(e.serviceId&&!c)c=K(e.serviceId);return c},a};var g;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(g||(g={}));var w=3,Et=g.STANDARD;var gt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],xt=["TimeoutError","RequestTimeout","RequestTimeoutException"],Rt=[500,502,503,504],_t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"];var Sr=(e)=>e.$metadata?.clockSkewCorrected,C=(e)=>e.$metadata?.httpStatusCode===429||gt.includes(e.name)||e.$retryable?.throttling==!0,k=(e,t=0)=>Sr(e)||xt.includes(e.name)||_t.includes(e?.code||"")||Rt.includes(e.$metadata?.httpStatusCode||0)||e.cause!==void 0&&t<=10&&k(e.cause,t+1),ht=(e)=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;if(500<=t&&t<=599&&!k(e))return!0;return!1}return!1};class P{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;let t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,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){let t=(e-this.currentCapacity)/this.fillRate*1000;await new Promise((r)=>P.setTimeoutFn(r,t))}this.currentCapacity=this.currentCapacity-e}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),C(e)){let o=!this.enabled?this.measuredTxRate:Math.min(this.measuredTxRate,this.fillRate);this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());let r=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(r)}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(){let e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){let r=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(r*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}P.setTimeoutFn=setTimeout;var O=100,G=20000,xe=500,ee=500,Re=5,_e=10,he=1,te="amz-sdk-invocation-id",re="amz-sdk-request";var At=()=>{let e=O;return{computeNextBackoffDelay:(o)=>{return Math.floor(Math.min(G,Math.random()*2**o*e))},setDelayBase:(o)=>{e=o}}};var Ae=({retryDelay:e,retryCount:t,retryCost:r})=>{return{getRetryCount:()=>t,getRetryDelay:()=>Math.min(G,e),getRetryCost:()=>r}};class U{constructor(e){this.maxAttempts=e,this.mode=g.STANDARD,this.capacity=ee,this.retryBackoffStrategy=At(),this.maxAttemptsProvider=typeof e==="function"?e:async()=>e}async acquireInitialRetryToken(e){return Ae({retryDelay:O,retryCount:0})}async refreshRetryTokenForRetry(e,t){let r=await this.getMaxAttempts();if(this.shouldRetry(e,t,r)){let o=t.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?xe:O);let n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),s=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,n):n,i=this.getCapacityCost(o);return this.capacity-=i,Ae({retryDelay:s,retryCount:e.getRetryCount()+1,retryCost:i})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(ee,this.capacity+(e.getRetryCost()??he))}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,t,r){return e.getRetryCount()+1<r&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return e==="TRANSIENT"?_e:Re}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class Se{constructor(e,t){this.maxAttemptsProvider=e,this.mode=g.ADAPTIVE;let{rateLimiter:r}=t??{};this.rateLimiter=r??new P,this.standardRetryStrategy=new U(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}var St="AWS_MAX_ATTEMPTS",Tt="max_attempts",Vc={environmentVariableSelector:(e)=>{let t=e[St];if(!t)return;let r=parseInt(t);if(Number.isNaN(r))throw new Error(`Environment variable ${St} mast be a number, got "${t}"`);return r},configFileSelector:(e)=>{let t=e[Tt];if(!t)return;let r=parseInt(t);if(Number.isNaN(r))throw new Error(`Shared config file entry ${Tt} mast be a number, got "${t}"`);return r},default:w},Bc=(e)=>{let{retryStrategy:t,retryMode:r,maxAttempts:o}=e,n=A(o??w);return Object.assign(e,{maxAttempts:n,retryStrategy:async()=>{if(t)return t;if(await A(r)()===g.ADAPTIVE)return new Se(n);return new U(n)}})},Tr="AWS_RETRY_MODE",wr="retry_mode",Wc={environmentVariableSelector:(e)=>e[Tr],configFileSelector:(e)=>e[wr],default:Et};var _=N(Or(),1),zc=_.default.v1,jc=_.default.v3,wt=_.default.v4,Xc=_.default.v5,Hc=_.default.NIL,qc=_.default.version,Zc=_.default.validate,Jc=_.default.stringify,Kc=_.default.parse;import{Readable as yr}from"node:stream";var Ot=(e)=>e?.body instanceof yr||typeof ReadableStream!=="undefined"&&e?.body instanceof ReadableStream;var Te=(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 Ir=(e)=>(t,r)=>async(o)=>{let n=await e.retryStrategy(),s=await e.maxAttempts();if(Nr(n)){n=n;let i=await n.acquireInitialRetryToken(r.partition_id),a=new Error,c=0,f=0,{request:u}=o,R=m.isInstance(u);if(R)u.headers[te]=wt();while(!0)try{if(R)u.headers[re]=`attempt=${c+1}; max=${s}`;let{response:l,output:d}=await t(o);return n.recordSuccess(i),d.$metadata.attempts=c+1,d.$metadata.totalRetryDelay=f,{response:l,output:d}}catch(l){let d=br(l);if(a=Te(l),R&&Ot(u))throw(r.logger instanceof yt?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{i=await n.refreshRetryTokenForRetry(i,d)}catch(V){if(!a.$metadata)a.$metadata={};throw a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=f,a}c=i.getRetryCount();let I=i.getRetryDelay();f+=I,await new Promise((V)=>setTimeout(V,I))}}else{if(n=n,n?.mode)r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]];return n.retry(t,o)}},Nr=(e)=>typeof e.acquireInitialRetryToken!=="undefined"&&typeof e.refreshRetryTokenForRetry!=="undefined"&&typeof e.recordSuccess!=="undefined",br=(e)=>{let t={error:e,errorType:Dr(e)},r=Pr(e.$response);if(r)t.retryAfterHint=r;return t},Dr=(e)=>{if(C(e))return"THROTTLING";if(k(e))return"TRANSIENT";if(ht(e))return"SERVER_ERROR";return"CLIENT_ERROR"},Cr={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},uf=(e)=>({applyToStack:(t)=>{t.add(Ir(e),Cr)}}),Pr=(e)=>{if(!we.isInstance(e))return;let t=Object.keys(e.headers).find((s)=>s.toLowerCase()==="retry-after");if(!t)return;let r=e.headers[t],o=Number(r);if(!Number.isNaN(o))return new Date(o*1000);return new Date(r)};import{platform as Ur,release as vr}from"node:os";import{env as Nt,versions as Mr}from"node:process";var Oe={isCrtAvailable:!1};var It=()=>{if(Oe.isCrtAvailable)return["md/crt-avail"];return null};var Qf=({serviceId:e,clientVersion:t})=>{return async(r)=>{let o=[["aws-sdk-js",t],["ua","2.1"],[`os/${Ur()}`,vr()],["lang/js"],["md/nodejs",`${Mr.node}`]],n=It();if(n)o.push(n);if(e)o.push([`api/${e}`,t]);if(Nt.AWS_EXECUTION_ENV)o.push([`exec-env/${Nt.AWS_EXECUTION_ENV}`]);let s=await r?.userAgentAppId?.();return s?[...o,[`app/${s}`]]:[...o]}};var Lr="AWS_SDK_UA_APP_ID",$r="sdk_ua_app_id",Fr="sdk-ua-app-id",op={environmentVariableSelector:(e)=>e[Lr],configFileSelector:(e)=>e[$r]??e[Fr],default:se};var bt=(e)=>typeof ArrayBuffer==="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]";import{Buffer as ye}from"node:buffer";var y=(e,t=0,r=e.byteLength-t)=>{if(!bt(e))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof e} (${e})`);return ye.from(e,t,r)},v=(e,t)=>{if(typeof e!=="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?ye.from(e,t):ye.from(e)};var oe=(e)=>{let t=v(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)};var Dt=(e)=>{if(typeof e==="string")return oe(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)};var xp=(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 y(e.buffer,e.byteOffset,e.byteLength).toString("utf8")};import{Buffer as kr}from"node:buffer";import{createHash as Gr,createHmac as Vr}from"node:crypto";class Br{constructor(e,t){this.algorithmIdentifier=e,this.secret=t,this.reset()}update(e,t){this.hash.update(Dt(Ct(e,t)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Vr(this.algorithmIdentifier,Ct(this.secret)):Gr(this.algorithmIdentifier)}}function Ct(e,t){if(kr.isBuffer(e))return e;if(typeof e==="string")return v(e,t);if(ArrayBuffer.isView(e))return y(e.buffer,e.byteOffset,e.byteLength);return y(e)}import{fstatSync as Wr,lstatSync as Yr}from"node:fs";var bp=(e)=>{if(!e)return 0;if(typeof e==="string")return Buffer.byteLength(e);else if(typeof e.byteLength==="number")return e.byteLength;else if(typeof e.size==="number")return e.size;else if(typeof e.start==="number"&&typeof e.end==="number")return e.end+1-e.start;else if(typeof e.path==="string"||Buffer.isBuffer(e.path))return Yr(e.path).size;else if(typeof e.fd==="number")return Wr(e.fd).size;throw new Error(`Body Length computation failed for ${e}`)};var $t=N(jr(),1);var Pt="AWS_EXECUTION_ENV",Ie="AWS_REGION",Ne="AWS_DEFAULT_REGION",Ut="AWS_EC2_METADATA_DISABLED",vt=["in-region","cross-region","mobile","standard","legacy"],Mt="/latest/meta-data/placement/region";var Lt={environmentVariableSelector:(e)=>{return e.AWS_DEFAULTS_MODE},configFileSelector:(e)=>{return e.defaults_mode},default:"legacy"};var kp=({region:e=F(ot),defaultsMode:t=F(Lt)}={})=>$t.memoize(async()=>{let r=typeof t==="function"?await t():t;switch(r?.toLowerCase()){case"auto":return Xr(e);case"in-region":case"cross-region":case"mobile":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 ${vt.join(", ")}, got ${r}`)}}),Xr=async(e)=>{if(e){let t=typeof e==="function"?await e():e,r=await Hr();if(!r)return"standard";if(t===r)return"in-region";else return"cross-region"}return"standard"},Hr=async()=>{if(process.env[Pt]&&(process.env[Ie]||process.env[Ne]))return process.env[Ie]??process.env[Ne];if(!process.env[Ut])try{let{getInstanceMetadataEndpoint:e,httpRequest:t}=await import("./chunk-xd0ntg7m.js"),r=await e();return(await t({...r,path:Mt})).toString()}catch(e){}};var Wp=(e)=>{return{setRegion(t){e.region=t},region(){return e.region}}},Yp=(e)=>{return{region:e.region()}};var Zr=/^[A-Za-z0-9+/]*={0,2}$/,au=(e)=>{if(e.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Zr.exec(e))throw new TypeError("Invalid base64 string.");let t=v(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)};var uu=(e)=>{let t;if(typeof e==="string")t=oe(e);else t=e;if(typeof t!=="object"||typeof t.byteOffset!=="number"||typeof t.byteLength!=="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return y(t.buffer,t.byteOffset,t.byteLength).toString("base64")};export{Kr as $a,Qr as ab,to as bb,io as cb,co as db,Zt as eb,$ as fb,Qt as gb,or as hb,Zs as ib,gi as jb,_i as kb,rt as lb,A as mb,ot as nb,ki as ob,ii as pb,da as qb,Ra as rb,za as sb,Za as tb,Et as ub,Vc as vb,Bc as wb,Wc as xb,uf as yb,Qf as zb,op as Ab,oe as Bb,xp as Cb,Br as Db,bp as Eb,au as Fb,uu as Gb,kp as Hb,Wp as Ib,Yp as Jb};
@@ -1,5 +0,0 @@
1
- import{Gc as D}from"./chunk-ewg2wcyt.js";import{Qc as H,Rc as G}from"./chunk-p9ga59ne.js";import{Yc as O}from"./chunk-g1f16je5.js";var b=(e,t)=>{let r=[];if(e)r.push(e);if(t)for(let n of t)r.push(n);return r},S=(e,t)=>{return`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`},$=()=>{let e=[],t=[],r=!1,n=new Set,o=(a)=>a.sort((f,d)=>V[d.step]-V[f.step]||Q[d.priority||"normal"]-Q[f.priority||"normal"]),s=(a)=>{let f=!1,d=(m)=>{let g=b(m.name,m.aliases);if(g.includes(a)){f=!0;for(let l of g)n.delete(l);return!1}return!0};return e=e.filter(d),t=t.filter(d),f},i=(a)=>{let f=!1,d=(m)=>{if(m.middleware===a){f=!0;for(let g of b(m.name,m.aliases))n.delete(g);return!1}return!0};return e=e.filter(d),t=t.filter(d),f},c=(a)=>{return e.forEach((f)=>{a.add(f.middleware,{...f})}),t.forEach((f)=>{a.addRelativeTo(f.middleware,{...f})}),a.identifyOnResolve?.(E.identifyOnResolve()),a},p=(a)=>{let f=[];return a.before.forEach((d)=>{if(d.before.length===0&&d.after.length===0)f.push(d);else f.push(...p(d))}),f.push(a),a.after.reverse().forEach((d)=>{if(d.before.length===0&&d.after.length===0)f.push(d);else f.push(...p(d))}),f},x=(a=!1)=>{let f=[],d=[],m={};return e.forEach((l)=>{let h={...l,before:[],after:[]};for(let u of b(h.name,h.aliases))m[u]=h;f.push(h)}),t.forEach((l)=>{let h={...l,before:[],after:[]};for(let u of b(h.name,h.aliases))m[u]=h;d.push(h)}),d.forEach((l)=>{if(l.toMiddleware){let h=m[l.toMiddleware];if(h===void 0){if(a)return;throw new Error(`${l.toMiddleware} is not found when adding ${S(l.name,l.aliases)} middleware ${l.relation} ${l.toMiddleware}`)}if(l.relation==="after")h.after.push(l);if(l.relation==="before")h.before.push(l)}}),o(f).map(p).reduce((l,h)=>{return l.push(...h),l},[])},E={add:(a,f={})=>{let{name:d,override:m,aliases:g}=f,l={step:"initialize",priority:"normal",middleware:a,...f},h=b(d,g);if(h.length>0){if(h.some((u)=>n.has(u))){if(!m)throw new Error(`Duplicate middleware name '${S(d,g)}'`);for(let u of h){let y=e.findIndex((I)=>I.name===u||I.aliases?.some((P)=>P===u));if(y===-1)continue;let T=e[y];if(T.step!==l.step||l.priority!==T.priority)throw new Error(`"${S(T.name,T.aliases)}" middleware with ${T.priority} priority in ${T.step} step cannot be overridden by "${S(d,g)}" middleware with ${l.priority} priority in ${l.step} step.`);e.splice(y,1)}}for(let u of h)n.add(u)}e.push(l)},addRelativeTo:(a,f)=>{let{name:d,override:m,aliases:g}=f,l={middleware:a,...f},h=b(d,g);if(h.length>0){if(h.some((u)=>n.has(u))){if(!m)throw new Error(`Duplicate middleware name '${S(d,g)}'`);for(let u of h){let y=t.findIndex((I)=>I.name===u||I.aliases?.some((P)=>P===u));if(y===-1)continue;let T=t[y];if(T.toMiddleware!==l.toMiddleware||T.relation!==l.relation)throw new Error(`"${S(T.name,T.aliases)}" middleware ${T.relation} "${T.toMiddleware}" middleware cannot be overridden by "${S(d,g)}" middleware ${l.relation} "${l.toMiddleware}" middleware.`);t.splice(y,1)}}for(let u of h)n.add(u)}t.push(l)},clone:()=>c($()),use:(a)=>{a.applyToStack(E)},remove:(a)=>{if(typeof a==="string")return s(a);else return i(a)},removeByTag:(a)=>{let f=!1,d=(m)=>{let{tags:g,name:l,aliases:h}=m;if(g&&g.includes(a)){let u=b(l,h);for(let y of u)n.delete(y);return f=!0,!1}return!0};return e=e.filter(d),t=t.filter(d),f},concat:(a)=>{let f=c($());return f.use(a),f.identifyOnResolve(r||f.identifyOnResolve()||(a.identifyOnResolve?.()??!1)),f},applyToStack:c,identify:()=>{return x(!0).map((a)=>{let f=a.step??a.relation+" "+a.toMiddleware;return S(a.name,a.aliases)+" - "+f})},identifyOnResolve(a){if(typeof a==="boolean")r=a;return r},resolve:(a,f)=>{for(let d of x().map((m)=>m.middleware).reverse())a=d(a,f);if(r)console.log(E.identify());return a}};return E},V={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Q={high:3,normal:2,low:1};class Ce{constructor(e){this.config=e,this.middlewareStack=$()}send(e,t,r){let n=typeof t!=="function"?t:void 0,o=typeof t==="function"?t:r,s=n===void 0&&this.config.cacheMiddleware===!0,i;if(s){if(!this.handlers)this.handlers=new WeakMap;let c=this.handlers;if(c.has(e.constructor))i=c.get(e.constructor);else i=e.resolveMiddleware(this.middlewareStack,this.config,n),c.set(e.constructor,i)}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,n);if(o)i(e).then((c)=>o(null,c.output),(c)=>o(c)).catch(()=>{});else return i(e).then((c)=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}class Z{constructor(){this.middlewareStack=$()}static classBuilder(){return new X}resolveMiddlewareWithContext(e,t,r,{middlewareFn:n,clientName:o,commandName:s,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,smithyContext:p,additionalContext:x,CommandCtor:E}){for(let g of n.bind(this)(E,e,t,r))this.middlewareStack.use(g);let a=e.concat(this.middlewareStack),{logger:f}=t,d={logger:f,clientName:o,commandName:s,inputFilterSensitiveLog:i,outputFilterSensitiveLog:c,[G]:{commandInstance:this,...p},...x},{requestHandler:m}=t;return a.resolve((g)=>m.handle(g.request,r||{}),d)}}class X{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,t,r={}){return this._smithyContext={service:e,operation:t,...r},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=(r)=>r,t=(r)=>r){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){let e=this,t;return t=class extends Z{static getEndpointParameterInstructions(){return e._ep}constructor(...[r]){super();this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=r??{},e._init(this)}resolveMiddleware(r,n,o){return this.resolveMiddlewareWithContext(r,n,o,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}var $e=O(D(),1);var mt="***SensitiveInformation***";var yt=(e)=>{if(e===null||e===void 0)return;if(typeof e==="number"){if(e===0||e===1)R.warn(_(`Expected boolean, got ${typeof e}: ${e}`));if(e===0)return!1;if(e===1)return!0}if(typeof e==="string"){let t=e.toLowerCase();if(t==="false"||t==="true")R.warn(_(`Expected boolean, got ${typeof e}: ${e}`));if(t==="false")return!1;if(t==="true")return!0}if(typeof e==="boolean")return e;throw new TypeError(`Expected boolean, got ${typeof e}: ${e}`)},re=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string"){let t=parseFloat(e);if(!Number.isNaN(t)){if(String(t)!==String(e))R.warn(_(`Expected number but observed string: ${e}`));return t}}if(typeof e==="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)},Me=Math.ceil(340282346638528860000000000000000000000),K=(e)=>{let t=re(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0){if(Math.abs(t)>Me)throw new TypeError(`Expected 32-bit float, got ${e}`)}return t},Ie=(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 v=(e)=>U(e,32),ee=(e)=>U(e,16),te=(e)=>U(e,8),U=(e,t)=>{let r=Ie(e);if(r!==void 0&&Ae(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},Ae=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},wt=(e,t)=>{if(e===null||e===void 0){if(t)throw new TypeError(`Expected a non-null value for ${t}`);throw new TypeError("Expected a non-null value")}return e},xt=(e)=>{if(e===null||e===void 0)return;if(typeof e==="object"&&!Array.isArray(e))return e;let t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},Et=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string")return e;if(["boolean","number","bigint"].includes(typeof e))return R.warn(_(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)};var ne=(e)=>{if(typeof e=="string")return K(k(e));return K(e)},Ne=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,k=(e)=>{let t=e.match(Ne);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},Tt=(e)=>{if(typeof e=="string")return _e(e);return re(e)};var _e=(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 St=(e)=>{if(typeof e==="string")return v(k(e));return v(e)},L=(e)=>{if(typeof e==="string")return ee(k(e));return ee(e)},oe=(e)=>{if(typeof e==="string")return te(k(e));return te(e)},_=(e)=>{return String(new TypeError(e).stack||e).split(`
2
- `).slice(0,5).filter((t)=>!t.includes("stackTraceWarning")).join(`
3
- `)},R={warn:console.warn};var Re=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var ke=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Mt=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=ke.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,s,i,c,p,x]=t,E=L(z(n)),a=C(o,"month",1,12),f=C(s,"day",1,31);return se(E,a,f,{hours:i,minutes:c,seconds:p,fractionalMilliseconds:x})},Fe=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),It=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Fe.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,s,i,c,p,x,E]=t,a=L(z(n)),f=C(o,"month",1,12),d=C(s,"day",1,31),m=se(a,f,d,{hours:i,minutes:c,seconds:p,fractionalMilliseconds:x});if(E.toUpperCase()!="Z")m.setTime(m.getTime()-Le(E));return m},At=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$/),Nt=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$/),_t=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 se=(e,t,r,n)=>{let o=t-1;return Oe(e,o,r),new Date(Date.UTC(e,o,r,C(n.hours,"hour",0,23),C(n.minutes,"minute",0,59),C(n.seconds,"seconds",0,60),Ue(n.fractionalMilliseconds)))};var Pe=[31,28,31,30,31,30,31,31,30,31,30,31],Oe=(e,t,r)=>{let n=Pe[t];if(t===1&&De(e))n=29;if(r>n)throw new TypeError(`Invalid day for ${Re[t]} in ${e}: ${r}`)},De=(e)=>{return e%4===0&&(e%100!==0||e%400===0)},C=(e,t,r,n)=>{let o=oe(z(e));if(o<r||o>n)throw new TypeError(`${t} must be between ${r} and ${n}, inclusive`);return o},Ue=(e)=>{if(e===null||e===void 0)return 0;return ne("0."+e)*1000},Le=(e)=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);let n=Number(e.substring(1,3)),o=Number(e.substring(4,6));return r*(n*60+o)*60*1000},z=(e)=>{let t=0;while(t<e.length-1&&e.charAt(t)==="0")t++;if(t===0)return e;return e.slice(t)};class A extends Error{constructor(e){super(e.message);Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let t=e;return A.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let t=e;if(this===A)return A.isInstance(e);if(A.isInstance(e)){if(t.name&&this.name)return this.prototype.isPrototypeOf(e)||t.name===this.name;return this.prototype.isPrototypeOf(e)}return!1}}var ie=(e,t={})=>{Object.entries(t).filter(([,n])=>n!==void 0).forEach(([n,o])=>{if(e[n]==null||e[n]==="")e[n]=o});let r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e};var ze=({output:e,parsedBody:t,exceptionCtor:r,errorCode:n})=>{let o=He(e),s=o.httpStatusCode?o.httpStatusCode+"":void 0,i=new r({name:t?.code||t?.Code||n||s||"UnknownError",$fault:"client",$metadata:o});throw ie(i,t)},Pt=(e)=>{return({output:t,parsedBody:r,errorCode:n})=>{ze({output:t,parsedBody:r,exceptionCtor:e,errorCode:n})}},He=(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 Dt=(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 ce=!1,Lt=(e)=>{if(e&&!ce&&parseInt(e.substring(1,e.indexOf(".")))<16)ce=!0};var Be=O(D(),1);var ae=(e)=>{let t=[];for(let r in H){let n=H[r];if(e[n]===void 0)continue;t.push({algorithmId:()=>n,checksumConstructor:()=>e[n]})}return{addChecksumAlgorithm(r){t.push(r)},checksumAlgorithms(){return t}}},fe=(e)=>{let t={};return e.checksumAlgorithms().forEach((r)=>{t[r.algorithmId()]=r.checksumConstructor()}),t};var de=(e)=>{return{setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}},ue=(e)=>{let t={};return t.retryStrategy=e.retryStrategy(),t};var qt=(e)=>{return Object.assign(ae(e),de(e))};var Vt=(e)=>{return Object.assign(fe(e),ue(e))};var Xt=(e)=>Array.isArray(e)?e:[e];var er=(e)=>{return e!=null};var M=function e(t){return Object.assign(new String(t),{deserializeJSON(){return JSON.parse(String(t))},toString(){return String(t)},toJSON(){return String(t)}})};M.from=(e)=>{if(e&&typeof e==="object"&&(e instanceof M||("deserializeJSON"in e)))return e;else if(typeof e==="string"||Object.getPrototypeOf(e)===String.prototype)return M(String(e));return M(JSON.stringify(e))};M.fromObject=M.from;class We{trace(){}debug(){}info(){}warn(){}error(){}}function Je(e,t,r){let n,o,s;if(typeof t==="undefined"&&typeof r==="undefined")n={},s=e;else if(n=e,typeof t==="function")return o=t,s=r,je(n,o,s);else s=t;for(let i of Object.keys(s)){if(!Array.isArray(s[i])){n[i]=s[i];continue}le(n,null,s,i)}return n}var or=(e,t)=>{let r={};for(let n in t)le(r,e,t,n);return r},je=(e,t,r)=>{return Je(e,Object.entries(r).reduce((n,[o,s])=>{if(Array.isArray(s))n[o]=s;else if(typeof s==="function")n[o]=[t,s()];else n[o]=[t,s];return n},{}))},le=(e,t,r,n)=>{if(t!==null){let i=r[n];if(typeof i==="function")i=[,i];let[c=Ye,p=qe,x=n]=i;if(typeof c==="function"&&c(t[x])||typeof c!=="function"&&!!c)e[n]=p(t[x]);return}let[o,s]=r[n];if(typeof s==="function"){let i,c=o===void 0&&(i=s())!=null,p=typeof o==="function"&&!!o(void 0)||typeof o!=="function"&&!!o;if(c)e[n]=i;else if(p)e[n]=s()}else{let i=o===void 0&&s!=null,c=typeof o==="function"&&!!o(s)||typeof o!=="function"&&!!o;if(i||c)e[n]=s}},Ye=(e)=>e!=null,qe=(e)=>e;var Ve=O(D(),1);var he=(e)=>{if(e==null)return{};if(Array.isArray(e))return e.filter((t)=>t!=null).map(he);if(typeof e==="object"){let t={};for(let r of Object.keys(e)){if(e[r]==null)continue;t[r]=he(e[r])}return t}return e};var Lr=(e)=>{return{setHttpHandler(t){e.httpHandler=t},httpHandler(){return e.httpHandler},updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs(){return e.httpHandler.httpHandlerConfigs()}}},zr=(e)=>{return{httpHandler:e.httpHandler()}};class B{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){let t=new B({...e,headers:{...e.headers}});if(t.query)t.query=Qe(t.query);return t}static isInstance(e){if(!e)return!1;let t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query==="object"&&typeof t.headers==="object"}clone(){return B.clone(this)}}function Qe(e){return Object.keys(e).reduce((t,r)=>{let n=e[r];return{...t,[r]:Array.isArray(n)?[...n]:n}},{})}class F{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;let t=e;return typeof t.statusCode==="number"&&typeof t.headers==="object"}}var N=(e)=>encodeURIComponent(e).replace(/[!'()*]/g,Ge),Ge=(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function W(e){let t=[];for(let r of Object.keys(e).sort()){let n=e[r];if(r=N(r),Array.isArray(n))for(let o=0,s=n.length;o<s;o++)t.push(`${r}=${N(n[o])}`);else{let o=r;if(n||typeof n==="string")o+=`=${N(n)}`;t.push(o)}}return t.join("&")}import{Agent as Se,request as ve}from"node:http";import{Agent as be,request as et}from"node:https";var me=["ECONNRESET","EPIPE","ETIMEDOUT"];var J=(e)=>{let t={};for(let r of Object.keys(e)){let n=e[r];t[r]=Array.isArray(n)?n.join(","):n}return t};var w={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:(e)=>clearTimeout(e)};var pe=1000,ge=(e,t,r=0)=>{if(!r)return-1;let n=(o)=>{let s=w.setTimeout(()=>{e.destroy(),t(Object.assign(new Error(`Socket timed out without establishing a connection within ${r} ms`),{name:"TimeoutError"}))},r-o),i=(c)=>{if(c?.connecting)c.on("connect",()=>{w.clearTimeout(s)});else w.clearTimeout(s)};if(e.socket)i(e.socket);else e.on("socket",i)};if(r<2000)return n(0),0;return w.setTimeout(n.bind(null,pe),pe)};var Ze=3000,ye=(e,{keepAlive:t,keepAliveMsecs:r},n=Ze)=>{if(t!==!0)return-1;let o=()=>{if(e.socket)e.socket.setKeepAlive(t,r||0);else e.on("socket",(s)=>{s.setKeepAlive(t,r||0)})};if(n===0)return o(),0;return w.setTimeout(o,n)};var we=3000,xe=(e,t,r=Ee)=>{let n=(o)=>{let s=r-o,i=()=>{e.destroy(),t(Object.assign(new Error(`Connection timed out after ${r} ms`),{name:"TimeoutError"}))};if(e.socket)e.socket.setTimeout(s,i),e.on("close",()=>e.socket?.removeListener("timeout",i));else e.setTimeout(s,i)};if(0<r&&r<6000)return n(0),0;return w.setTimeout(n.bind(null,r===0?0:we),we)};import{Readable as Xe}from"node:stream";var Te=6000;async function j(e,t,r=Te){let n=t.headers??{},o=n.Expect||n.expect,s=-1,i=!0;if(o==="100-continue")i=await Promise.race([new Promise((c)=>{s=Number(w.setTimeout(()=>c(!0),Math.max(Te,r)))}),new Promise((c)=>{e.on("continue",()=>{w.clearTimeout(s),c(!0)}),e.on("response",()=>{w.clearTimeout(s),c(!1)}),e.on("error",()=>{w.clearTimeout(s),c(!1)})})]);if(i)Ke(e,t.body)}function Ke(e,t){if(t instanceof Xe){t.pipe(e);return}if(t){if(Buffer.isBuffer(t)||typeof t==="string"){e.end(t);return}let r=t;if(typeof r==="object"&&r.buffer&&typeof r.byteOffset==="number"&&typeof r.byteLength==="number"){e.end(Buffer.from(r.buffer,r.byteOffset,r.byteLength));return}e.end(Buffer.from(t));return}e.end()}var Ee=0;class Y{static create(e){if(typeof e?.handle==="function")return e;return new Y(e)}static checkSocketUsage(e,t,r=console){let{sockets:n,requests:o,maxSockets:s}=e;if(typeof s!=="number"||s===1/0)return t;let i=15000;if(Date.now()-i<t)return t;if(n&&o)for(let c in n){let p=n[c]?.length??0,x=o[c]?.length??0;if(p>=s&&x>=2*s)return r?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${p} and ${x} additional requests are enqueued.
4
- See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
5
- or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return t}constructor(e){this.socketWarningTimestamp=0,this.metadata={handlerProtocol:"http/1.1"},this.configProvider=new Promise((t,r)=>{if(typeof e==="function")e().then((n)=>{t(this.resolveDefaultConfig(n))}).catch(r);else t(this.resolveDefaultConfig(e))})}resolveDefaultConfig(e){let{requestTimeout:t,connectionTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:o,httpAgent:s,httpsAgent:i}=e||{},c=!0,p=50;return{connectionTimeout:r,requestTimeout:t??n,socketAcquisitionWarningTimeout:o,httpAgent:(()=>{if(s instanceof Se||typeof s?.destroy==="function")return s;return new Se({keepAlive:!0,maxSockets:50,...s})})(),httpsAgent:(()=>{if(i instanceof be||typeof i?.destroy==="function")return i;return new be({keepAlive:!0,maxSockets:50,...i})})(),logger:console}}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:t}={}){if(!this.config)this.config=await this.configProvider;return new Promise((r,n)=>{let o=void 0,s=[],i=async(u)=>{await o,s.forEach(w.clearTimeout),r(u)},c=async(u)=>{await o,s.forEach(w.clearTimeout),n(u)};if(!this.config)throw new Error("Node HTTP request handler config is not resolved");if(t?.aborted){let u=new Error("Request aborted");u.name="AbortError",c(u);return}let p=e.protocol==="https:",x=p?this.config.httpsAgent:this.config.httpAgent;s.push(w.setTimeout(()=>{this.socketWarningTimestamp=Y.checkSocketUsage(x,this.socketWarningTimestamp,this.config.logger)},this.config.socketAcquisitionWarningTimeout??(this.config.requestTimeout??2000)+(this.config.connectionTimeout??1000)));let E=W(e.query||{}),a=void 0;if(e.username!=null||e.password!=null){let u=e.username??"",y=e.password??"";a=`${u}:${y}`}let f=e.path;if(E)f+=`?${E}`;if(e.fragment)f+=`#${e.fragment}`;let d=e.hostname??"";if(d[0]==="["&&d.endsWith("]"))d=e.hostname.slice(1,-1);else d=e.hostname;let m={headers:e.headers,host:d,method:e.method,path:f,port:e.port,agent:x,auth:a},l=(p?et:ve)(m,(u)=>{let y=new F({statusCode:u.statusCode||-1,reason:u.statusMessage,headers:J(u.headers),body:u});i({response:y})});if(l.on("error",(u)=>{if(me.includes(u.code))c(Object.assign(u,{name:"TimeoutError"}));else c(u)}),t){let u=()=>{l.destroy();let y=new Error("Request aborted");y.name="AbortError",c(y)};if(typeof t.addEventListener==="function"){let y=t;y.addEventListener("abort",u,{once:!0}),l.once("close",()=>y.removeEventListener("abort",u))}else t.onabort=u}s.push(ge(l,c,this.config.connectionTimeout)),s.push(xe(l,c,this.config.requestTimeout));let h=m.agent;if(typeof h==="object"&&"keepAlive"in h)s.push(ye(l,{keepAlive:h.keepAlive,keepAliveMsecs:h.keepAliveMsecs}));o=j(l,e,this.config.requestTimeout).catch((u)=>{return s.forEach(w.clearTimeout),n(u)})})}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then((r)=>{return{...r,[e]:t}})}httpHandlerConfigs(){return this.config??{}}}import{Writable as tt}from"node:stream";class q extends tt{constructor(){super(...arguments);this.bufferedBytes=[]}_write(e,t,r){this.bufferedBytes.push(e),r()}}var vn=(e)=>{if(rt(e))return nt(e);return new Promise((t,r)=>{let n=new q;e.pipe(n),e.on("error",(o)=>{n.end(),r(o)}),n.on("error",r),n.on("finish",function(){let o=new Uint8Array(Buffer.concat(this.bufferedBytes));t(o)})})},rt=(e)=>typeof ReadableStream==="function"&&e instanceof ReadableStream;async function nt(e){let t=[],r=e.getReader(),n=!1,o=0;while(!n){let{done:c,value:p}=await r.read();if(p)t.push(p),o+=p.length;n=c}let s=new Uint8Array(o),i=0;for(let c of t)s.set(c,i),i+=c.length;return s}export{Lr as Mb,zr as Nb,B as Ob,F as Pb,Ce as Qb,Z as Rb,mt as Sb,yt as Tb,v as Ub,wt as Vb,xt as Wb,Et as Xb,Tt as Yb,St as Zb,Mt as _b,It as $b,A as ac,ie as bc,Pt as cc,Dt as dc,Lt as ec,qt as fc,Vt as gc,Xt as hc,er as ic,We as jc,Je as kc,or as lc,he as mc,Y as nc,vn as oc};