@allthings/cloud-toolkit 2.5.0-dev.1 → 2.5.0-dev.2
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/lib.umd.min.js +1 -0
- package/package.json +1 -1
- package/dist/lib.umd.min.js/index-CVhusXdQ.js +0 -1
- package/dist/lib.umd.min.js/index-DdGH0TTD.js +0 -1
- package/dist/lib.umd.min.js/index.js +0 -1
- /package/dist/{lib.cjs.js/index.js → lib.cjs.js} +0 -0
- /package/dist/{lib.esm.js/index.js → lib.esm.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as querystring from"querystring";import*as zlib from"zlib";import zlib__default from"zlib";import*as require$$2$1 from"crypto";import require$$2__default from"crypto";import require$$0$a from"events";import require$$0$3 from"url";import require$$0$8 from"util";import require$$0$7 from"fs";import require$$0$5 from"http";import require$$1 from"https";import require$$0$4 from"stream";import require$$7 from"net";import require$$4 from"dns";import require$$0$6 from"os";import require$$0$9 from"path";import require$$1$1 from"tls";import require$$0$b from"child_process";import require$$0$c from"buffer";import require$$1$2 from"string_decoder";const defaultErrorHandler$2=(e,t,n)=>{const{requestId:i}=e.requestContext,r=n.name&&"string"==typeof n.name?n.name.replace(/([A-Z])([A-Z])([a-z])|([a-z])([A-Z])/g,"$1$4 $2$3$5"):"Error",o=n.message||"",a=n.statusCode?` ${n.statusCode}`:"";return"ClientError"===n.name||n.statusCode>=400&&n.statusCode<500?t.respondTo({html:`<html><body><strong>${r}${a}</strong>: ${o}<br/>Request ID: ${i}</body></html>`,json:{error:n.name,message:o,requestId:i}},n.statusCode||400):t.respondTo({html:`<html><body>An internal server error occurred.<br/>Request ID: ${i}</body></html>`,json:{error:"Internal server error",message:"An internal server error occurred",requestId:i}},500)};class ClientError extends Error{name="ClientError";statusCode=400;constructor(e,t,n=400){super(String(e)),this.name=t||this.name,this.statusCode=n}}class ServerError extends Error{name="ServerError";statusCode=500;constructor(e,t,n=500){super(String(e)),this.name=t||this.name,this.statusCode=n}}const applyMiddleware=async(e,t,...n)=>e.reduce(async(e,t)=>t(await e,...n),Promise.resolve(t)),decodeBase64=e=>Buffer.from(e,"base64").toString("utf8"),decodeBase64Body=e=>e.isBase64Encoded&&"string"==typeof e.body?{...e,body:decodeBase64(e.body)}:e,parseCookiePair=e=>{const t=e.indexOf("="),n=-1!==t,i=n&&e.slice(0,Math.max(0,t)).trim(),r=n&&e.substr(t+1,e.length).trim(),o=r&&'"'===r[0]?r.slice(1,-1):r;return i?{[i]:o?decodeURIComponent(o):""}:{}},parseCookieHeader=e=>e.split(/; */).reduce((e,t)=>({...e,...parseCookiePair(t)}),{}),cookies$1=e=>({...e,cookies:parseCookieHeader(e.headers?.cookie||"")}),setHostname=e=>({...e,hostname:e.headers?.host||void 0}),parseJson=e=>{try{return JSON.parse(e)}catch{return{}}},parseJsonBody$2=e=>{const{headers:t,body:n}=e;return t["content-type"]&&"application/json"===t["content-type"].split(";").shift()&&"string"==typeof n?{...e,body:parseJson(n)}:e},state$1=new Map([["invocationCount",0]]),meta=e=>{const t=Number(state$1.get("invocationCount"));return{...e,meta:{...e.meta,coldStart:!t,invocationCount:state$1.set("invocationCount",t+1).get("invocationCount")}}},normalizeHeaders=({headers:e={},...t})=>({...t,headers:Object.keys(e).reduce((n,i)=>{const r=i.toLowerCase();return"aws"===t.provider&&Reflect.has(n,r)&&"content-type"===r&&"application/json"===e[i]?n:{...n,[r]:e[i]}},{})}),normalizeProgrammingModel=e=>({...e,method:e.httpMethod??e.requestContext?.http?.method??"",path:e.path??e.requestContext?.http?.path??"",provider:"aws",query:e.queryStringParameters||{},source:e.requestContext?"api-gateway":e.source}),addTimestamp=e=>({...e,timestamp:Date.now()}),parseUrlEncodedBody=e=>{const{headers:t,body:n}=e;return t["content-type"]&&"application/x-www-form-urlencoded"===t["content-type"].split(";").shift()&&"string"==typeof n?{...e,body:querystring.parse(n)}:e};var makeRequest=async(e,t,n={})=>applyMiddleware([addTimestamp,normalizeProgrammingModel,normalizeHeaders,decodeBase64Body,cookies$1,parseUrlEncodedBody,parseJsonBody$2,setHostname,meta,...n.requestMiddleware||[]],Object.freeze({...e,context:t}),n);const setHeader=(e,t,n,i)=>(Object.assign(t.headers,{[n]:i}),e),makeResponseObject=(e,t="",n=200,{headers:i={},...r}={},o)=>Object.freeze({...e,body:t||"",headers:{...e?.headers,"content-type":o,...i},statusCode:n,...r}),html=(e,t,n,i,r)=>makeResponseObject(e,n,i,r,"text/html"),stringifyIfNotStringifiedJson=e=>{const t="string"==typeof e?e.trim():e;return"string"==typeof e&&["{",'"'].includes(t[0])&&["}",'"'].includes(t.at(-1))?t:JSON.stringify(e)},json$2=(e,t,n,i,r)=>makeResponseObject(e,stringifyIfNotStringifiedJson(n),i,r,"application/json"),COMPRESSIBLE=["application/activity+json","application/alto-costmap+json","application/alto-costmapfilter+json","application/alto-directory+json","application/alto-endpointcost+json","application/alto-endpointcostparams+json","application/alto-endpointprop+json","application/alto-endpointpropparams+json","application/alto-error+json","application/alto-networkmap+json","application/alto-networkmapfilter+json","application/atom+xml","application/calendar+json","application/coap-group+json","application/csvm+json","application/dart","application/dicom+json","application/ecmascript","application/fhir+json","application/fido.trusted-apps+json","application/geo+json","application/javascript","application/jf2feed+json","application/jose+json","application/jrd+json","application/json","application/json-patch+json","application/jsonml+json","application/jwk+json","application/jwk-set+json","application/ld+json","application/manifest+json","application/merge-patch+json","application/mud+json","application/postscript","application/ppsp-tracker+json","application/problem+json","application/raml+yaml","application/rdap+json","application/rdf+xml","application/reputon+json","application/rss+xml","application/rtf","application/scim+json","application/soap+xml","application/tar","application/vcard+json","application/vnd.amadeus+json","application/vnd.api+json","application/vnd.apothekende.reservation+json","application/vnd.avalon+json","application/vnd.bbf.usp.msg+json","application/vnd.bekitzur-stech+json","application/vnd.capasystems-pg+json","application/vnd.collection+json","application/vnd.collection.doc+json","application/vnd.collection.next+json","application/vnd.coreos.ignition+json","application/vnd.dart","application/vnd.datapackage+json","application/vnd.dataresource+json","application/vnd.document+json","application/vnd.drive+json","application/vnd.geo+json","application/vnd.google-earth.kml+xml","application/vnd.hal+json","application/vnd.hc+json","application/vnd.heroku+json","application/vnd.hyper+json","application/vnd.hyper-item+json","application/vnd.hyperdrive+json","application/vnd.ims.lis.v2.result+json","application/vnd.ims.lti.v2.toolconsumerprofile+json","application/vnd.ims.lti.v2.toolproxy+json","application/vnd.ims.lti.v2.toolproxy.id+json","application/vnd.ims.lti.v2.toolsettings+json","application/vnd.ims.lti.v2.toolsettings.simple+json","application/vnd.las.las+json","application/vnd.mason+json","application/vnd.micro+json","application/vnd.miele+json","application/vnd.mozilla.xul+xml","application/vnd.ms-fontobject","application/vnd.ms-opentype","application/vnd.nearst.inv+json","application/vnd.oftn.l10n+json","application/vnd.oma.lwm2m+json","application/vnd.oracle.resource+json","application/vnd.pagerduty+json","application/vnd.restful+json","application/vnd.siren+json","application/vnd.sun.wadl+xml","application/vnd.tableschema+json","application/vnd.vel+json","application/vnd.xacml+json","application/voucher-cms+json","application/wasm","application/webpush-options+json","application/x-httpd-php","application/x-javascript","application/x-ns-proxy-autoconfig","application/x-sh","application/x-tar","application/x-virtualbox-hdd","application/x-virtualbox-ova","application/x-virtualbox-ovf","application/x-virtualbox-vbox","application/x-virtualbox-vdi","application/x-virtualbox-vhd","application/x-virtualbox-vmdk","application/x-web-app-manifest+json","application/x-www-form-urlencoded","application/xhtml+xml","application/xml","application/xml-dtd","application/xop+xml","application/yang-data+json","application/yang-patch+json","font/otf","image/bmp","image/svg+xml","image/vnd.adobe.photoshop","image/x-icon","image/x-ms-bmp","message/imdn+xml","message/rfc822","model/gltf+json","model/gltf-binary","model/x3d+xml","text/cache-manifest","text/calender","text/cmd","text/css","text/csv","text/html","text/javascript","text/jsx","text/markdown","text/n3","text/plain","text/richtext","text/rtf","text/tab-separated-values","text/uri-list","text/vcard","text/vtt","text/x-gwt-rpc","text/x-jquery-tmpl","text/x-markdown","text/x-org","text/x-processing","text/x-suse-ymp","text/xml","x-shader/x-fragment","x-shader/x-vertex"],ZLIB_DEFAULT_OPTIONS={level:5},acceptEncoding=(e,t)=>e.find(e=>t.some(t=>e===t)),getBestAcceptEncoding=e=>{const{headers:t}=e,n=(t["accept-encoding"]||"").split(/, */),i=acceptEncoding(n,["gzip","deflate","identity"]);return"deflate"===i&&acceptEncoding(n,["gzip"])?acceptEncoding(n,["gzip","identity"]):i},compressResponse=(e,t)=>{const{body:n,headers:i,...r}=e,o="gzip"===t?zlib.gzipSync(n,ZLIB_DEFAULT_OPTIONS):zlib.deflateSync(n,ZLIB_DEFAULT_OPTIONS);return{...r,body:o.toString("base64"),headers:{...i,"content-encoding":t,"content-length":o.byteLength},isBase64Encoded:!0}},compress=(e,t)=>{const{body:n,headers:i}=e,r=getBestAcceptEncoding(t);return COMPRESSIBLE.includes(i["content-type"])&&void 0!==r&&"identity"!==r&&n&&n.length>256&&r?compressResponse(e,r):e},contentLengthHeader=e=>{const{body:t,headers:n,...i}=e;return{...i,body:t,headers:{...n,"content-length":n["content-length"]||Buffer.byteLength(t)}}},DEFAULT_POLICIES={"default-src":"'self' https: 'unsafe-inline'","img-src":"* data: blob:"},cspHeaders=(e,t,n)=>{const{headers:i={},...r}=e,o={...DEFAULT_POLICIES,...n.cspPolicies};return{...r,headers:{...i,"content-security-policy":Object.keys(o).map(e=>`${e} ${o[e]}`).join(";"),"referrer-policy":"strict-origin-when-cross-origin","x-content-type-options":"nosniff","x-frame-options":{"'none'":"DENY","'self'":"SAMEORIGIN"}[o["frame-ancestors"]]||void 0,"x-xss-protection":"1; mode=block"}}},enforcedHeaders=(e,t,n)=>({...e,headers:{...e.headers,...n.headers??{}}}),EMPTY_ENTITY_TAG='"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"',entitytag=e=>{const t=require$$2$1.createHash("sha1").update(e,"utf8").digest("base64").slice(0,27);return`"${("string"==typeof e?Buffer.byteLength(e,"utf8"):e.length).toString(16)}-${t}"`},etag=e=>0===e.length?EMPTY_ENTITY_TAG:entitytag(e),etagHeader=e=>({...e,headers:{...e.headers,etag:etag(e.body)}}),aws=e=>{const{headers:t,requestContext:n,context:i}=e;return{apig:{requestId:n.requestId,resourcePath:n.resourcePath??""},awsAccountId:n.accountId,cloudfront:{country:t["cloudfront-viewer-country"],desktop:"true"===t["cloudfront-is-desktop-viewer"],mobile:"true"===t["cloudfront-is-mobile-viewer"],smarttv:"true"===t["cloudfront-is-smarttv-viewer"],tablet:"true"===t["cloudfront-is-tablet-viewer"]},deploymentStage:n.stage,lambda:{functionName:i.functionName,memoryLimit:Number(i.memoryLimitInMB),remainingExecutionTime:i.getRemainingTimeInMillis?.(),requestId:i.awsRequestId},sourceIp:n.identity?.sourceIp??n?.http?.sourceIp}},logger$4=(e,t)=>{const{source:n,headers:i,meta:r,requestContext:o,provider:a,hostname:s,body:c,timestamp:l,path:d,query:u}=e,p=t.statusCode>=500&&t.statusCode<600,m={dateTime:(new Date).toISOString(),eventSource:n,hostname:s,httpMethod:o.httpMethod,httpProtocol:i.via?.split(" ")[0],httpReferrer:i.referer,httpUserAgent:i["user-agent"],requestContentLength:c&&c.length>0||0,requestTime:Date.now()-l,requestUri:d+(u&&Object.keys(u).length>0?`?${querystring.stringify(u)}`:""),responseContentLength:t.headers["content-length"],statusCode:t.statusCode,xForwardedHost:i["x-forwarded-host"],...r,..."aws"===a&&aws(e)};return(p?process.stderr:process.stdout).write(JSON.stringify(m))&&m},logResponse=(e,t,n)=>n.enableLogger&&("function"==typeof n.logger?n.logger(t,e):logger$4(t,e))&&e||e,redirect=(e,t,n,i=302,r={})=>makeResponseObject(e,"",i,{...r,headers:{...r.headers,location:n}}),getBestMatchedFormat=(e,t)=>{const n=e.default||"html",i=t&&"string"==typeof t&&t.split(";")[0].split(",").map(e=>e.split("/").at(-1));return i&&i.find(t=>Reflect.has(e,t))||n},getBestMatchedResponseHelper=e=>{switch(e){case"html":return html;case"json":return json$2}throw new TypeError(`"${e}" is not a valid Alagarr respondTo() format.`)},getBestMatchedFormatBody=(e,t)=>{switch(t){case"html":return e.html;case"json":return e.json}throw new TypeError(`"${t}" is not a valid Alagarr respondTo() format.`)},respondTo=(e,t,n,i,r)=>{const{headers:{accept:o}}=t,a=getBestMatchedFormat(n,o);return getBestMatchedResponseHelper(a)(e,t,getBestMatchedFormatBody(n,a),i,r)},text=(e,t,n,i,r)=>makeResponseObject(e,n,i,r,"text/plain"),middlewareMap={enableCompression:compress,enableContentLength:contentLengthHeader,enableCspHeaders:cspHeaders,enableETagHeader:etagHeader,enableEnforcedHeaders:enforcedHeaders};var makeResponse=async(e,t,n)=>{const i=makeResponseObject(),r=[text,html,json$2,redirect,respondTo].reduce((r,o)=>({...r,[o.name]:async(...r)=>t(null,await applyMiddleware(Object.keys(middlewareMap).reduce((e,t)=>n[t]?[...e,middlewareMap[t]]:e,[...n.responseMiddleware||[],...n.enableLogger?[logResponse]:[]]),o(i,e,...r),e,n))}),{raw:t}),o=[setHeader].reduce((e,t)=>({...e,[t.name]:(...e)=>t(o,i,...e)}),r);return o};const DEFAULT_OPTIONS={cspPolicies:[],enableCompression:!0,enableContentLength:!0,enableCspHeaders:!0,enableETagHeader:!0,enableEnforcedHeaders:!0,enableLogger:!0,enableStrictTransportSecurity:!0,errorHandler:defaultErrorHandler$2,requestMiddleware:[],responseMiddleware:[]},noopHandler=(e,t)=>{throw new ServerError("Misconfiguration in Alagarr setup. No handler function was provided.")},alagarr=(e=noopHandler,t=DEFAULT_OPTIONS)=>async(n,i,r)=>{const o={...DEFAULT_OPTIONS,...t},a=await makeRequest(n,i,o),s=await makeResponse(a,r,o);try{return await e(a,s,i)}catch(e){const t="function"==typeof o.errorHandler?o.errorHandler:defaultErrorHandler$2;try{return await t(a,s,e)}catch(e){return console.error("There was an error in the error handler provided to Alagaar",e,t.toString()),defaultErrorHandler$2(a,s,e)}}};var EndpointURLScheme$1,AlgorithmId$1;!function(e){e.HTTP="http",e.HTTPS="https"}(EndpointURLScheme$1||(EndpointURLScheme$1={})),function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"}(AlgorithmId$1||(AlgorithmId$1={}));const SMITHY_CONTEXT_KEY$1="__smithy_context",getSmithyContext$1=e=>e[SMITHY_CONTEXT_KEY$1]||(e[SMITHY_CONTEXT_KEY$1]={}),normalizeProvider$4=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},DEFAULT_ACCOUNT_ID_ENDPOINT_MODE="preferred",ACCOUNT_ID_ENDPOINT_MODE_VALUES=["disabled","preferred","required"];function validateAccountIdEndpointMode(e){return ACCOUNT_ID_ENDPOINT_MODE_VALUES.includes(e)}const resolveAccountIdEndpointModeConfig=e=>{const{accountIdEndpointMode:t}=e,n=normalizeProvider$4(t??DEFAULT_ACCOUNT_ID_ENDPOINT_MODE);return Object.assign(e,{accountIdEndpointMode:async()=>{const e=await n();if(!validateAccountIdEndpointMode(e))throw new Error(`Invalid value for accountIdEndpointMode: ${e}. Valid values are: "required", "preferred", "disabled".`);return e}})},getHttpHandlerExtensionConfiguration$1=e=>({setHttpHandler(t){e.httpHandler=t},httpHandler:()=>e.httpHandler,updateHttpClientConfig(t,n){e.httpHandler?.updateHttpClientConfig(t,n)},httpHandlerConfigs:()=>e.httpHandler.httpHandlerConfigs()}),resolveHttpHandlerRuntimeConfig$1=e=>({httpHandler:e.httpHandler()});let HttpRequest$2=class e{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;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(t){const n=new e({...t,headers:{...t.headers}});return n.query&&(n.query=cloneQuery$2(n.query)),n}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return e.clone(this)}};function cloneQuery$2(e){return Object.keys(e).reduce((t,n)=>{const i=e[n];return{...t,[n]:Array.isArray(i)?[...i]:i}},{})}let HttpResponse$1=class{statusCode;reason;headers;body;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 t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}};var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},iterator$1,hasRequiredIterator$1,foreach,hasRequiredForeach;function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}),n}function requireIterator$1(){if(hasRequiredIterator$1)return iterator$1;function e(e){Object.defineProperty(this,"_next",{writable:!1,enumerable:!1,value:e}),this.done=!1}return hasRequiredIterator$1=1,e.prototype.next=function(){if(this.done)return{done:!0};var e=this._next();return e.done&&(this.done=!0),e},"undefined"!=typeof Symbol&&(e.prototype[Symbol.iterator]=function(){return this}),e.of=function(){var t=arguments,n=t.length,i=0;return new e(function(){return i>=n?{done:!0}:{done:!1,value:t[i++]}})},e.empty=function(){var t=new e(null);return t.done=!0,t},e.is=function(t){return t instanceof e||"object"==typeof t&&null!==t&&"function"==typeof t.next},iterator$1=e}function requireForeach(){if(hasRequiredForeach)return foreach;hasRequiredForeach=1;var e="undefined"!=typeof ArrayBuffer,t="undefined"!=typeof Symbol;function n(n,i){var r,o,a,s,c;if(!n)throw new Error("obliterator/forEach: invalid iterable.");if("function"!=typeof i)throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(n)||e&&ArrayBuffer.isView(n)||"string"==typeof n||"[object Arguments]"===n.toString())for(a=0,s=n.length;a<s;a++)i(n[a],a);else if("function"!=typeof n.forEach)if(t&&Symbol.iterator in n&&"function"!=typeof n.next&&(n=n[Symbol.iterator]()),"function"!=typeof n.next)for(o in n)n.hasOwnProperty(o)&&i(n[o],o);else for(r=n,a=0;!0!==(c=r.next()).done;)i(c.value,a),a++;else n.forEach(i)}return n.forEachWithNullKeys=function(n,i){var r,o,a,s,c;if(!n)throw new Error("obliterator/forEachWithNullKeys: invalid iterable.");if("function"!=typeof i)throw new Error("obliterator/forEachWithNullKeys: expecting a callback.");if(Array.isArray(n)||e&&ArrayBuffer.isView(n)||"string"==typeof n||"[object Arguments]"===n.toString())for(a=0,s=n.length;a<s;a++)i(n[a],null);else if(n instanceof Set)n.forEach(function(e){i(e,null)});else if("function"!=typeof n.forEach)if(t&&Symbol.iterator in n&&"function"!=typeof n.next&&(n=n[Symbol.iterator]()),"function"!=typeof n.next)for(o in n)n.hasOwnProperty(o)&&i(n[o],o);else for(r=n,a=0;!0!==(c=r.next()).done;)i(c.value,null),a++;else n.forEach(i)},foreach=n}var typedArrays={},hasRequiredTypedArrays;function requireTypedArrays(){return hasRequiredTypedArrays||(hasRequiredTypedArrays=1,function(e){var t=Math.pow(2,8)-1,n=Math.pow(2,16)-1,i=Math.pow(2,32)-1,r=Math.pow(2,7)-1,o=Math.pow(2,15)-1,a=Math.pow(2,31)-1;e.getPointerArray=function(e){var r=e-1;return r<=t?Uint8Array:r<=n?Uint16Array:r<=i?Uint32Array:Float64Array},e.getSignedPointerArray=function(e){var t=e-1;return t<=r?Int8Array:t<=o?Int16Array:t<=a?Int32Array:Float64Array},e.getNumberType=function(e){return e===(0|e)?-1===Math.sign(e)?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(t,n){var i,r,o,a,c,l=null,d=0;for(a=0,c=t.length;a<c;a++)o=n?n(t[a]):t[a],r=e.getNumberType(o),(i=s[r.name])>d&&(d=i,l=r);return l},e.isTypedArray=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView(e)},e.concat=function(){var e,t,n,i=0;for(e=0,n=arguments.length;e<n;e++)i+=arguments[e].length;var r=new arguments[0].constructor(i);for(e=0,t=0;e<n;e++)r.set(arguments[e],t),t+=arguments[e].length;return r},e.indices=function(t){for(var n=new(e.getPointerArray(t))(t),i=0;i<t;i++)n[i]=i;return n}}(typedArrays)),typedArrays}var iterables={},hasRequiredIterables,lruCache,hasRequiredLruCache;function requireIterables(){if(hasRequiredIterables)return iterables;hasRequiredIterables=1;var e=requireForeach(),t=requireTypedArrays();function n(e){return"number"==typeof e.length?e.length:"number"==typeof e.size?e.size:void 0}return iterables.isArrayLike=function(e){return Array.isArray(e)||t.isTypedArray(e)},iterables.guessLength=n,iterables.toArray=function(t){var i=n(t),r="number"==typeof i?new Array(i):[],o=0;return e(t,function(e){r[o++]=e}),r},iterables.toArrayWithIndices=function(i){var r=n(i),o="number"==typeof r?t.getPointerArray(r):Array,a="number"==typeof r?new Array(r):[],s="number"==typeof r?new o(r):[],c=0;return e(i,function(e){a[c]=e,s[c]=c++}),[a,s]},iterables}function requireLruCache(){if(hasRequiredLruCache)return lruCache;hasRequiredLruCache=1;var e=requireIterator$1(),t=requireForeach(),n=requireTypedArrays(),i=requireIterables();function r(e,t,i){if(arguments.length<2&&(i=e,e=null,t=null),this.capacity=i,"number"!=typeof this.capacity||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");var r=n.getPointerArray(i);this.forward=new r(i),this.backward=new r(i),this.K="function"==typeof e?new e(i):new Array(i),this.V="function"==typeof t?new t(i):new Array(i),this.size=0,this.head=0,this.tail=0,this.items={}}return r.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},r.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],i=this.forward[e];return this.tail===e?this.tail=n:this.backward[i]=n,this.forward[n]=i,this.backward[t]=e,this.head=e,this.forward[e]=t,this},r.prototype.set=function(e,t){var n=this.items[e];if(void 0!==n)return this.splayOnTop(n),void(this.V[n]=t);this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n},r.prototype.setpop=function(e,t){var n=null,i=null,r=this.items[e];return void 0!==r?(this.splayOnTop(r),n=this.V[r],this.V[r]=t,{evicted:!1,key:e,value:n}):(this.size<this.capacity?r=this.size++:(r=this.tail,this.tail=this.backward[r],n=this.V[r],i=this.K[r],delete this.items[this.K[r]]),this.items[e]=r,this.K[r]=e,this.V[r]=t,this.forward[r]=this.head,this.backward[this.head]=r,this.head=r,i?{evicted:!0,key:i,value:n}:null)},r.prototype.has=function(e){return e in this.items},r.prototype.get=function(e){var t=this.items[e];if(void 0!==t)return this.splayOnTop(t),this.V[t]},r.prototype.peek=function(e){var t=this.items[e];if(void 0!==t)return this.V[t]},r.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,i=this.size,r=this.head,o=this.K,a=this.V,s=this.forward;n<i;)e.call(t,a[r],o[r],this),r=s[r],n++},r.prototype.keys=function(){var t=0,n=this.size,i=this.head,r=this.K,o=this.forward;return new e(function(){if(t>=n)return{done:!0};var e=r[i];return++t<n&&(i=o[i]),{done:!1,value:e}})},r.prototype.values=function(){var t=0,n=this.size,i=this.head,r=this.V,o=this.forward;return new e(function(){if(t>=n)return{done:!0};var e=r[i];return++t<n&&(i=o[i]),{done:!1,value:e}})},r.prototype.entries=function(){var t=0,n=this.size,i=this.head,r=this.K,o=this.V,a=this.forward;return new e(function(){if(t>=n)return{done:!0};var e=r[i],s=o[i];return++t<n&&(i=a[i]),{done:!1,value:[e,s]}})},"undefined"!=typeof Symbol&&(r.prototype[Symbol.iterator]=r.prototype.entries),r.prototype.inspect=function(){for(var e,t=new Map,n=this.entries();!(e=n.next()).done;)t.set(e.value[0],e.value[1]);return Object.defineProperty(t,"constructor",{value:r,enumerable:!1}),t},"undefined"!=typeof Symbol&&(r.prototype[Symbol.for("nodejs.util.inspect.custom")]=r.prototype.inspect),r.from=function(e,n,o,a){if(arguments.length<2){if("number"!=typeof(a=i.guessLength(e)))throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else 2===arguments.length&&(a=n,n=null,o=null);var s=new r(n,o,a);return t(e,function(e,t){s.set(t,e)}),s},lruCache=r}var lruCacheExports=requireLruCache(),LRUCache=getDefaultExportFromCjs(lruCacheExports);let EndpointCache$2=class{cache;constructor(e){this.cache=new LRUCache(e)}getEndpoint(e){const t=this.get(e);if(!t||0===t.length)return;const n=t.map(e=>e.Address);return n[Math.floor(Math.random()*n.length)]}get(e){if(!this.has(e))return;const t=this.cache.get(e);if(!t)return;const n=Date.now(),i=t.filter(e=>n<e.Expires);if(0!==i.length)return i;this.delete(e)}set(e,t){const n=Date.now();this.cache.set(e,t.map(({Address:e,CachePeriodInMinutes:t})=>({Address:e,Expires:n+60*t*1e3})))}delete(e){this.cache.set(e,[])}has(e){if(!this.cache.has(e))return!1;const t=this.cache.peek(e);return!!t&&t.length>0}clear(){this.cache.clear()}};const resolveEndpointDiscoveryConfig=(e,{endpointDiscoveryCommandCtor:t})=>{const{endpointCacheSize:n,endpointDiscoveryEnabled:i,endpointDiscoveryEnabledProvider:r}=e;return Object.assign(e,{endpointDiscoveryCommandCtor:t,endpointCache:new EndpointCache$2(n??1e3),endpointDiscoveryEnabled:void 0!==i?()=>Promise.resolve(i):r,isClientEndpointDiscoveryEnabled:void 0!==i})};function resolveHostHeaderConfig$1(e){return e}const hostHeaderMiddleware$1=e=>t=>async n=>{if(!HttpRequest$2.isInstance(n.request))return t(n);const{request:i}=n,{handlerProtocol:r=""}=e.requestHandler.metadata||{};if(r.indexOf("h2")>=0&&!i.headers[":authority"])delete i.headers.host,i.headers[":authority"]=i.hostname+(i.port?":"+i.port:"");else if(!i.headers.host){let e=i.hostname;null!=i.port&&(e+=`:${i.port}`),i.headers.host=e}return t(n)},hostHeaderMiddlewareOptions$1={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},getHostHeaderPlugin$1=e=>({applyToStack:t=>{t.add(hostHeaderMiddleware$1(e),hostHeaderMiddlewareOptions$1)}}),loggerMiddleware$1=()=>(e,t)=>async n=>{try{const i=await e(n),{clientName:r,commandName:o,logger:a,dynamoDbDocumentClientOptions:s={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:l}=s,d=c??t.inputFilterSensitiveLog,u=l??t.outputFilterSensitiveLog,{$metadata:p,...m}=i.output;return a?.info?.({clientName:r,commandName:o,input:d(n.input),output:u(m),metadata:p}),i}catch(e){const{clientName:i,commandName:r,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:s}=a,c=s??t.inputFilterSensitiveLog;throw o?.error?.({clientName:i,commandName:r,input:c(n.input),error:e,metadata:e.$metadata}),e}},loggerMiddlewareOptions$1={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},getLoggerPlugin$1=e=>({applyToStack:e=>{e.add(loggerMiddleware$1(),loggerMiddlewareOptions$1)}}),recursionDetectionMiddlewareOptions$1={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},recursionDetectionMiddleware$1=()=>e=>async t=>e(t),getRecursionDetectionPlugin$1=e=>({applyToStack:e=>{e.add(recursionDetectionMiddleware$1(),recursionDetectionMiddlewareOptions$1)}}),resolveAuthOptions$1=(e,t)=>{if(!t||0===t.length)return e;const n=[];for(const i of t)for(const t of e){t.schemeId.split("#")[1]===i&&n.push(t)}for(const t of e)n.find(({schemeId:e})=>e===t.schemeId)||n.push(t);return n};function convertHttpAuthSchemesToMap$1(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}const httpAuthSchemeMiddleware$1=(e,t)=>(n,i)=>async r=>{const o=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,i,r.input)),a=e.authSchemePreference?await e.authSchemePreference():[],s=resolveAuthOptions$1(o,a),c=convertHttpAuthSchemesToMap$1(e.httpAuthSchemes),l=getSmithyContext$1(i),d=[];for(const n of s){const r=c.get(n.schemeId);if(!r){d.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}const o=r.identityProvider(await t.identityProviderConfigProvider(e));if(!o){d.push(`HttpAuthScheme \`${n.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:a={},signingProperties:s={}}=n.propertiesExtractor?.(e,i)||{};n.identityProperties=Object.assign(n.identityProperties||{},a),n.signingProperties=Object.assign(n.signingProperties||{},s),l.selectedHttpAuthScheme={httpAuthOption:n,identity:await o(n.identityProperties),signer:r.signer};break}if(!l.selectedHttpAuthScheme)throw new Error(d.join("\n"));return n(r)},httpAuthSchemeEndpointRuleSetMiddlewareOptions$1={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},getHttpAuthSchemeEndpointRuleSetPlugin$1=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:i=>{i.addRelativeTo(httpAuthSchemeMiddleware$1(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),httpAuthSchemeEndpointRuleSetMiddlewareOptions$1)}}),deserializerMiddleware=(e,t)=>(n,i)=>async r=>{const{response:o}=await n(r);try{return{response:o,output:await t(o,e)}}catch(e){if(Object.defineProperty(e,"$response",{value:o}),!("$metadata"in e)){const t="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{e.message+="\n "+t}catch(e){i.logger&&"NoOpLogger"!==i.logger?.constructor?.name?i.logger?.warn?.(t):console.warn(t)}void 0!==e.$responseBodyText&&e.$response&&(e.$response.body=e.$responseBodyText);try{if(HttpResponse$1.isInstance(o)){const{headers:t={}}=o,n=Object.entries(t);e.$metadata={httpStatusCode:o.statusCode,requestId:findHeader$1(/^x-[\w-]+-request-?id$/,n),extendedRequestId:findHeader$1(/^x-[\w-]+-id-2$/,n),cfId:findHeader$1(/^x-[\w-]+-cf-id$/,n)}}}catch(e){}}throw e}},findHeader$1=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1],serializerMiddleware=(e,t)=>(n,i)=>async r=>{const o=e,a=i.endpointV2?.url&&o.urlParser?async()=>o.urlParser(i.endpointV2.url):o.endpoint;if(!a)throw new Error("No valid endpoint provider available.");const s=await t(r.input,{...e,endpoint:a});return n({...r,request:s})},deserializerMiddlewareOption$1={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},serializerMiddlewareOption$2={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSerdePlugin(e,t,n){return{applyToStack:i=>{i.add(deserializerMiddleware(e,n),deserializerMiddlewareOption$1),i.add(serializerMiddleware(e,t),serializerMiddlewareOption$2)}}}const defaultErrorHandler$1=e=>e=>{throw e},defaultSuccessHandler$1=(e,t)=>{},httpSigningMiddleware$1=e=>(e,t)=>async n=>{if(!HttpRequest$2.isInstance(n.request))return e(n);const i=getSmithyContext$1(t).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:r={}},identity:o,signer:a}=i,s=await e({...n,request:await a.sign(n.request,o,r)}).catch((a.errorHandler||defaultErrorHandler$1)(r));return(a.successHandler||defaultSuccessHandler$1)(s.response,r),s},httpSigningMiddlewareOptions$1={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},getHttpSigningPlugin$1=e=>({applyToStack:e=>{e.addRelativeTo(httpSigningMiddleware$1(),httpSigningMiddlewareOptions$1)}}),normalizeProvider$3=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",alphabetByEncoding=Object.entries(chars).reduce((e,[t,n])=>(e[n]=Number(t),e),{}),alphabetByValue=chars.split(""),bitsPerLetter=6,bitsPerByte=8,maxLetterValue=63,fromBase64=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const n=new ArrayBuffer(t),i=new DataView(n);for(let t=0;t<e.length;t+=4){let n=0,r=0;for(let i=t,o=t+3;i<=o;i++)if("="!==e[i]){if(!(e[i]in alphabetByEncoding))throw new TypeError(`Invalid character ${e[i]} in base64 string.`);n|=alphabetByEncoding[e[i]]<<(o-i)*bitsPerLetter,r+=bitsPerLetter}else n>>=bitsPerLetter;const o=t/4*3;n>>=r%bitsPerByte;const a=Math.floor(r/bitsPerByte);for(let e=0;e<a;e++){const t=(a-e-1)*bitsPerByte;i.setUint8(o+e,(n&255<<t)>>t)}}return new Uint8Array(n)},fromUtf8$2=e=>(new TextEncoder).encode(e),toUint8Array=e=>"string"==typeof e?fromUtf8$2(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),toUtf8=e=>{if("string"==typeof e)return e;if("object"!=typeof e||"number"!=typeof e.byteOffset||"number"!=typeof e.byteLength)throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function toBase64(e){let t;t="string"==typeof e?fromUtf8$2(e):e;const n="object"==typeof t&&"number"==typeof t.length,i="object"==typeof t&&"number"==typeof t.byteOffset&&"number"==typeof t.byteLength;if(!n&&!i)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let r="";for(let e=0;e<t.length;e+=3){let n=0,i=0;for(let r=e,o=Math.min(e+3,t.length);r<o;r++)n|=t[r]<<(o-r-1)*bitsPerByte,i+=bitsPerByte;const o=Math.ceil(i/bitsPerLetter);n<<=o*bitsPerLetter-i;for(let e=1;e<=o;e++){const t=(o-e)*bitsPerLetter;r+=alphabetByValue[(n&maxLetterValue<<t)>>t]}r+="==".slice(0,4-o)}return r}let Uint8ArrayBlobAdapter$1=class e extends Uint8Array{static fromString(t,n="utf-8"){if("string"==typeof t)return"base64"===n?e.mutate(fromBase64(t)):e.mutate(fromUtf8$2(t));throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(e="utf-8"){return"base64"===e?toBase64(this):toUtf8(this)}};const escapeUri=e=>encodeURIComponent(e).replace(/[!'()*]/g,hexEncode),hexEncode=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function buildQueryString$1(e){const t=[];for(let n of Object.keys(e).sort()){const i=e[n];if(n=escapeUri(n),Array.isArray(i))for(let e=0,r=i.length;e<r;e++)t.push(`${n}=${escapeUri(i[e])}`);else{let e=n;(i||"string"==typeof i)&&(e+=`=${escapeUri(i)}`),t.push(e)}}return t.join("&")}function createRequest$1(e,t){return new Request(e,t)}function requestTimeout$1(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)},e)})}const keepAliveSupport$1={supported:void 0};let FetchHttpHandler$1=class e{config;configProvider;static create(t){return"function"==typeof t?.handle?t:new e(t)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===keepAliveSupport$1.supported&&(keepAliveSupport$1.supported=Boolean("undefined"!=typeof Request&&"keepalive"in createRequest$1("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);const i=n??this.config.requestTimeout,r=!0===this.config.keepAlive,o=this.config.credentials;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let a=e.path;const s=buildQueryString$1(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let c="";if(null!=e.username||null!=e.password){c=`${e.username??""}:${e.password??""}@`}const{port:l,method:d}=e,u=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:""}${a}`,p="GET"===d||"HEAD"===d?void 0:e.body,m={body:p,headers:new Headers(e.headers),method:d,credentials:o};this.config?.cache&&(m.cache=this.config.cache),p&&(m.duplex="half"),"undefined"!=typeof AbortController&&(m.signal=t),keepAliveSupport$1.supported&&(m.keepalive=r),"function"==typeof this.config.requestInit&&Object.assign(m,this.config.requestInit(e));let h=()=>{};const f=createRequest$1(u,m),g=[fetch(f).then(e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return null!=e.body?{response:new HttpResponse$1({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new HttpResponse$1({headers:n,reason:e.statusText,statusCode:e.status,body:t})}))}),requestTimeout$1(i)];return t&&g.push(new Promise((e,n)=>{const i=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",i,{once:!0}),h=()=>e.removeEventListener("abort",i)}else t.onabort=i})),Promise.race(g).finally(h)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}};const streamCollector$1=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):collectBlob$1(e):collectStream$1(e);async function collectBlob$1(e){const t=await readToBase64$1(e),n=fromBase64(t);return new Uint8Array(n)}async function collectStream$1(e){const t=[],n=e.getReader();let i=!1,r=0;for(;!i;){const{done:e,value:o}=await n.read();o&&(t.push(o),r+=o.length),i=e}const o=new Uint8Array(r);let a=0;for(const e of t)o.set(e,a),a+=e.length;return o}function readToBase64$1(e){return new Promise((t,n)=>{const i=new FileReader;i.onloadend=()=>{if(2!==i.readyState)return n(new Error("Reader aborted too early"));const e=i.result??"",r=e.indexOf(","),o=r>-1?r+1:e.length;t(e.substring(o))},i.onabort=()=>n(new Error("Read aborted")),i.onerror=()=>n(i.error),i.readAsDataURL(e)})}const SHORT_TO_HEX={},HEX_TO_SHORT={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),SHORT_TO_HEX[e]=t,HEX_TO_SHORT[t]=e}function fromHex(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const i=e.slice(n,n+2).toLowerCase();if(!(i in HEX_TO_SHORT))throw new Error(`Cannot decode unrecognized sequence ${i} as hexadecimal`);t[n/2]=HEX_TO_SHORT[i]}return t}function toHex(e){let t="";for(let n=0;n<e.byteLength;n++)t+=SHORT_TO_HEX[e[n]];return t}const collectBody$1=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Uint8ArrayBlobAdapter$1.mutate(e);if(!e)return Uint8ArrayBlobAdapter$1.mutate(new Uint8Array);const n=t.streamCollector(e);return Uint8ArrayBlobAdapter$1.mutate(await n)};function extendedEncodeURIComponent$1(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}const deref$1=e=>"function"==typeof e?e():e;function translateTraits$1(e){if("object"==typeof e)return e;e|=0;const t={};let n=0;for(const i of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])1==(e>>n++&1)&&(t[i]=1);return t}let NormalizedSchema$1=class e{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=e.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(t,n){this.ref=t,this.memberName=n;const i=[];let r=t,o=t;for(this._isMemberSchema=!1;isMemberSchema$1(r);)i.push(r[1]),r=r[0],o=deref$1(r),this._isMemberSchema=!0;if(i.length>0){this.memberTraits={};for(let e=i.length-1;e>=0;--e){const t=i[e];Object.assign(this.memberTraits,translateTraits$1(t))}}else this.memberTraits=0;if(o instanceof e){const e=this.memberTraits;return Object.assign(this,o),this.memberTraits=Object.assign({},e,o.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,void(this.memberName=n??o.memberName)}if(this.schema=deref$1(o),isStaticSchema$1(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(o),this.traits=0),this._isMemberSchema&&!n)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){const t=this.prototype.isPrototypeOf(e);if(!t&&"object"==typeof e&&null!==e){return e.symbol===this.symbol}return t}static of(t){const n=deref$1(t);if(n instanceof e)return n;if(isMemberSchema$1(n)){const[i,r]=n;if(i instanceof e)return Object.assign(i.getMergedTraits(),translateTraits$1(r)),i;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(t,null,2)}.`)}return new e(n)}getSchema(){const e=this.schema;return 0===e[0]?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return"number"==typeof e?e>=64&&e<128:1===e[0]}isMapSchema(){const e=this.getSchema();return"number"==typeof e?e>=128&&e<=255:2===e[0]}isStructSchema(){const e=this.getSchema();return 3===e[0]||-3===e[0]}isBlobSchema(){const e=this.getSchema();return 21===e||42===e}isTimestampSchema(){const e=this.getSchema();return"number"==typeof e&&e>=4&&e<=7}isUnitSchema(){return"unit"===this.getSchema()}isDocumentSchema(){return 15===this.getSchema()}isStringSchema(){return 0===this.getSchema()}isBooleanSchema(){return 2===this.getSchema()}isNumericSchema(){return 1===this.getSchema()}isBigIntegerSchema(){return 17===this.getSchema()}isBigDecimalSchema(){return 19===this.getSchema()}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||42===this.getSchema()}isIdempotencyToken(){const e=e=>!(4&~e&&!e?.idempotencyToken),{normalizedTraits:t,traits:n,memberTraits:i}=this;return e(t)||e(n)||e(i)}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return translateTraits$1(this.memberTraits)}getOwnTraits(){return translateTraits$1(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const n=this.getSchema();return member$1([e?15:n[4]??0,0],"key")}getValueSchema(){const e=this.getSchema(),[t,n,i]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],r="number"==typeof e?63&e:e&&"object"==typeof e&&(n||i)?e[3+e[0]]:t?15:void 0;if(null!=r)return member$1([r,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const n=t[4].indexOf(e),i=t[5][n];return member$1(isMemberSchema$1(i)?i:[i,0],e)}if(this.isDocumentSchema())return member$1([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,n]of this.structIterator())e[t]=n}catch(e){}return e}getEventStreamMember(){if(this.isStructSchema())for(const[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e;return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema();for(let t=0;t<e[4].length;++t)yield[e[4][t],member$1([e[5][t],0],e[4][t])]}};function member$1(e,t){if(e instanceof NormalizedSchema$1)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new NormalizedSchema$1(e,t)}const isMemberSchema$1=e=>Array.isArray(e)&&2===e.length,isStaticSchema$1=e=>Array.isArray(e)&&e.length>=5,expectBoolean=e=>{if(null!=e){if("number"==typeof e){if(0!==e&&1!==e||logger$3.warn(stackTraceWarning$1(`Expected boolean, got ${typeof e}: ${e}`)),0===e)return!1;if(1===e)return!0}if("string"==typeof e){const t=e.toLowerCase();if("false"!==t&&"true"!==t||logger$3.warn(stackTraceWarning$1(`Expected boolean, got ${typeof e}: ${e}`)),"false"===t)return!1;if("true"===t)return!0}if("boolean"==typeof e)return e;throw new TypeError(`Expected boolean, got ${typeof e}: ${e}`)}},expectNumber$1=e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&logger$3.warn(stackTraceWarning$1(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},expectLong$1=e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},expectInt32=e=>expectSizedInt$1(e,32),expectSizedInt$1=(e,t)=>{const n=expectLong$1(e);if(void 0!==n&&castInt$1(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},castInt$1=(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]}},expectNonNull=(e,t)=>{if(null==e)throw new TypeError("Expected a non-null value");return e},expectObject=e=>{if(null==e)return;if("object"==typeof e&&!Array.isArray(e))return e;const t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},expectString=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return logger$3.warn(stackTraceWarning$1(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},expectUnion=e=>{if(null==e)return;const t=expectObject(e),n=Object.entries(t).filter(([,e])=>null!=e).map(([e])=>e);if(0===n.length)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(n.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${n} were not null.`);return t},strictParseDouble$1=e=>expectNumber$1("string"==typeof e?parseNumber$1(e):e),NUMBER_REGEX$1=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,parseNumber$1=e=>{const t=e.match(NUMBER_REGEX$1);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},limitedParseDouble=e=>"string"==typeof e?parseFloatString(e):expectNumber$1(e),parseFloatString=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}`)}},stackTraceWarning$1=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),logger$3={warn:console.warn},parseEpochTimestamp$1=e=>{if(null==e)return;let t;if("number"==typeof e)t=e;else if("string"==typeof e)t=strictParseDouble$1(e);else{if("object"!=typeof e||1!==e.tag)throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");t=e.value}if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*t))},randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),decimalToHex=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),v4=()=>{if(randomUUID)return randomUUID();const e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128,decimalToHex[e[0]]+decimalToHex[e[1]]+decimalToHex[e[2]]+decimalToHex[e[3]]+"-"+decimalToHex[e[4]]+decimalToHex[e[5]]+"-"+decimalToHex[e[6]]+decimalToHex[e[7]]+"-"+decimalToHex[e[8]]+decimalToHex[e[9]]+"-"+decimalToHex[e[10]]+decimalToHex[e[11]]+decimalToHex[e[12]]+decimalToHex[e[13]]+decimalToHex[e[14]]+decimalToHex[e[15]]},resolvedPath=(e,t,n,i,r,o)=>{if(null==t||void 0===t[n])throw new Error("No value provided for input HTTP label: "+n+".");{const t=i();if(t.length<=0)throw new Error("Empty value provided for input HTTP label: "+n+".");e=e.replace(r,o?t.split("/").map(e=>extendedEncodeURIComponent$1(e)).join("/"):extendedEncodeURIComponent$1(t))}return e};function requestBuilder(e,t){return new RequestBuilder(e,t)}class RequestBuilder{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,t){this.input=e,this.context=t}async build(){const{hostname:e,protocol:t="https",port:n,path:i}=await this.context.endpoint();this.path=i;for(const e of this.resolvePathStack)e(this.path);return new HttpRequest$2({protocol:t,hostname:this.hostname||e,port:n,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(t=>{this.path=`${t?.endsWith("/")?t.slice(0,-1):t||""}`+e}),this}p(e,t,n,i){return this.resolvePathStack.push(r=>{this.path=resolvedPath(r,this.input,e,t,n,i)}),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 setFeature$3(e,t,n){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=n}let DefaultIdentityProviderConfig$1=class{authSchemes=new Map;constructor(e){for(const[t,n]of Object.entries(e))void 0!==n&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}};const createIsIdentityExpiredFunction$1=e=>function(t){return doesIdentityRequireRefresh$1(t)&&t.expiration.getTime()-Date.now()<e},EXPIRATION_MS$1=3e5,isIdentityExpired$1=createIsIdentityExpiredFunction$1(EXPIRATION_MS$1),doesIdentityRequireRefresh$1=e=>void 0!==e.expiration,memoizeIdentityProvider$1=(e,t,n)=>{if(void 0===e)return;const i="function"!=typeof e?async()=>Promise.resolve(e):e;let r,o,a,s=!1;const c=async e=>{o||(o=i(e));try{r=await o,a=!0,s=!1}finally{o=void 0}return r};return void 0===t?async e=>(a&&!e?.forceRefresh||(r=await c(e)),r):async e=>(a&&!e?.forceRefresh||(r=await c(e)),s?r:n(r)?t(r)?(await c(e),r):r:(s=!0,r))},DEFAULT_UA_APP_ID$1=void 0;function isValidUserAgentAppId$1(e){return void 0===e||"string"==typeof e&&e.length<=50}function resolveUserAgentConfig$1(e){const t=normalizeProvider$3(e.userAgentAppId??DEFAULT_UA_APP_ID$1),{customUserAgent:n}=e;return Object.assign(e,{customUserAgent:"string"==typeof n?[[n]]:n,userAgentAppId:async()=>{const n=await t();if(!isValidUserAgentAppId$1(n)){const t="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?e.logger:console;"string"!=typeof n?t?.warn("userAgentAppId must be a string or undefined."):n.length>50&&t?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}let EndpointCache$1=class{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const n=this.hash(e);if(!1===n)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const e=this.data.keys();let t=0;for(;;){const{value:n,done:i}=e.next();if(this.data.delete(n),i||++t>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t="";const{parameters:n}=this;if(0===n.length)return!1;for(const i of n){const n=String(e[i]??"");if(n.includes("|;"))return!1;t+=n+"|;"}return t}};const IP_V4_REGEX$1=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}$"),isIpAddress$1=e=>IP_V4_REGEX$1.test(e)||e.startsWith("[")&&e.endsWith("]"),VALID_HOST_LABEL_REGEX$1=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel$1=(e,t=!1)=>{if(!t)return VALID_HOST_LABEL_REGEX$1.test(e);const n=e.split(".");for(const e of n)if(!isValidHostLabel$1(e))return!1;return!0},customEndpointFunctions$1={},debugId$1="endpoints";function toDebugString$1(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${toDebugString$1(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(toDebugString$1).join(", ")})`:JSON.stringify(e,null,2)}let EndpointError$1=class extends Error{constructor(e){super(e),this.name="EndpointError"}};const booleanEquals$1=(e,t)=>e===t,getAttrPathList$1=e=>{const t=e.split("."),n=[];for(const i of t){const t=i.indexOf("[");if(-1!==t){if(i.indexOf("]")!==i.length-1)throw new EndpointError$1(`Path: '${e}' does not end with ']'`);const r=i.slice(t+1,-1);if(Number.isNaN(parseInt(r)))throw new EndpointError$1(`Invalid array index: '${r}' in path: '${e}'`);0!==t&&n.push(i.slice(0,t)),n.push(r)}else n.push(i)}return n},getAttr$1=(e,t)=>getAttrPathList$1(t).reduce((n,i)=>{if("object"!=typeof n)throw new EndpointError$1(`Index '${i}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(i)]:n[i]},e),isSet$1=e=>null!=e,not$1=e=>!e,DEFAULT_PORTS$1={[EndpointURLScheme$1.HTTP]:80,[EndpointURLScheme$1.HTTPS]:443},parseURL$1=e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:i="",path:r="",query:o={}}=e,a=new URL(`${i}//${t}${n?`:${n}`:""}${r}`);return a.search=Object.entries(o).map(([e,t])=>`${e}=${t}`).join("&"),a}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:i,hostname:r,pathname:o,protocol:a,search:s}=t;if(s)return null;const c=a.slice(0,-1);if(!Object.values(EndpointURLScheme$1).includes(c))return null;const l=isIpAddress$1(r);return{scheme:c,authority:`${i}${n.includes(`${i}:${DEFAULT_PORTS$1[c]}`)||"string"==typeof e&&e.includes(`${i}:${DEFAULT_PORTS$1[c]}`)?`:${DEFAULT_PORTS$1[c]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:l}},stringEquals$1=(e,t)=>e===t,substring$1=(e,t,n,i)=>t>=n||e.length<n?null:i?e.substring(e.length-n,e.length-t):e.substring(t,n),uriEncode$1=e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),endpointFunctions$1={booleanEquals:booleanEquals$1,getAttr:getAttr$1,isSet:isSet$1,isValidHostLabel:isValidHostLabel$1,not:not$1,parseURL:parseURL$1,stringEquals:stringEquals$1,substring:substring$1,uriEncode:uriEncode$1},evaluateTemplate$1=(e,t)=>{const n=[],i={...t.endpointParams,...t.referenceRecord};let r=0;for(;r<e.length;){const t=e.indexOf("{",r);if(-1===t){n.push(e.slice(r));break}n.push(e.slice(r,t));const o=e.indexOf("}",t);if(-1===o){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(n.push(e.slice(t+1,o)),r=o+2);const a=e.substring(t+1,o);if(a.includes("#")){const[e,t]=a.split("#");n.push(getAttr$1(i[e],t))}else n.push(i[a]);r=o+1}return n.join("")},getReferenceValue$1=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]),evaluateExpression$1=(e,t,n)=>{if("string"==typeof e)return evaluateTemplate$1(e,n);if(e.fn)return group$5.callFunction(e,n);if(e.ref)return getReferenceValue$1(e,n);throw new EndpointError$1(`'${t}': ${String(e)} is not a string, function or reference.`)},callFunction$1=({fn:e,argv:t},n)=>{const i=t.map(e=>["boolean","number"].includes(typeof e)?e:group$5.evaluateExpression(e,"arg",n)),r=e.split(".");return r[0]in customEndpointFunctions$1&&null!=r[1]?customEndpointFunctions$1[r[0]][r[1]](...i):endpointFunctions$1[e](...i)},group$5={evaluateExpression:evaluateExpression$1,callFunction:callFunction$1},evaluateCondition$1=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new EndpointError$1(`'${e}' is already defined in Reference Record.`);const i=callFunction$1(t,n);return n.logger?.debug?.(`${debugId$1} evaluateCondition: ${toDebugString$1(t)} = ${toDebugString$1(i)}`),{result:""===i||!!i,...null!=e&&{toAssign:{name:e,value:i}}}},evaluateConditions$1=(e=[],t)=>{const n={};for(const i of e){const{result:e,toAssign:r}=evaluateCondition$1(i,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};r&&(n[r.name]=r.value,t.logger?.debug?.(`${debugId$1} assign: ${r.name} := ${toDebugString$1(r.value)}`))}return{result:!0,referenceRecord:n}},getEndpointHeaders$1=(e,t)=>Object.entries(e).reduce((e,[n,i])=>({...e,[n]:i.map(e=>{const i=evaluateExpression$1(e,"Header value entry",t);if("string"!=typeof i)throw new EndpointError$1(`Header '${n}' value '${i}' is not a string`);return i})}),{}),getEndpointProperties$1=(e,t)=>Object.entries(e).reduce((e,[n,i])=>({...e,[n]:group$4.getEndpointProperty(i,t)}),{}),getEndpointProperty$1=(e,t)=>{if(Array.isArray(e))return e.map(e=>getEndpointProperty$1(e,t));switch(typeof e){case"string":return evaluateTemplate$1(e,t);case"object":if(null===e)throw new EndpointError$1(`Unexpected endpoint property: ${e}`);return group$4.getEndpointProperties(e,t);case"boolean":return e;default:throw new EndpointError$1("Unexpected endpoint property type: "+typeof e)}},group$4={getEndpointProperty:getEndpointProperty$1,getEndpointProperties:getEndpointProperties$1},getEndpointUrl$1=(e,t)=>{const n=evaluateExpression$1(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new EndpointError$1("Endpoint URL must be a string, got "+typeof n)},evaluateEndpointRule$1=(e,t)=>{const{conditions:n,endpoint:i}=e,{result:r,referenceRecord:o}=evaluateConditions$1(n,t);if(!r)return;const a={...t,referenceRecord:{...t.referenceRecord,...o}},{url:s,properties:c,headers:l}=i;return t.logger?.debug?.(`${debugId$1} Resolving endpoint from template: ${toDebugString$1(i)}`),{...null!=l&&{headers:getEndpointHeaders$1(l,a)},...null!=c&&{properties:getEndpointProperties$1(c,a)},url:getEndpointUrl$1(s,a)}},evaluateErrorRule$1=(e,t)=>{const{conditions:n,error:i}=e,{result:r,referenceRecord:o}=evaluateConditions$1(n,t);if(r)throw new EndpointError$1(evaluateExpression$1(i,"Error",{...t,referenceRecord:{...t.referenceRecord,...o}}))},evaluateRules$1=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=evaluateEndpointRule$1(n,t);if(e)return e}else if("error"===n.type)evaluateErrorRule$1(n,t);else{if("tree"!==n.type)throw new EndpointError$1(`Unknown endpoint rule: ${n}`);{const e=group$3.evaluateTreeRule(n,t);if(e)return e}}throw new EndpointError$1("Rules evaluation failed")},evaluateTreeRule$1=(e,t)=>{const{conditions:n,rules:i}=e,{result:r,referenceRecord:o}=evaluateConditions$1(n,t);if(r)return group$3.evaluateRules(i,{...t,referenceRecord:{...t.referenceRecord,...o}})},group$3={evaluateRules:evaluateRules$1,evaluateTreeRule:evaluateTreeRule$1},resolveEndpoint$1=(e,t)=>{const{endpointParams:n,logger:i}=t,{parameters:r,rules:o}=e;t.logger?.debug?.(`${debugId$1} Initial EndpointParams: ${toDebugString$1(n)}`);const a=Object.entries(r).filter(([,e])=>null!=e.default).map(([e,t])=>[e,t.default]);if(a.length>0)for(const[e,t]of a)n[e]=n[e]??t;const s=Object.entries(r).filter(([,e])=>e.required).map(([e])=>e);for(const e of s)if(null==n[e])throw new EndpointError$1(`Missing required parameter: '${e}'`);const c=evaluateRules$1(o,{endpointParams:n,logger:i,referenceRecord:{}});return t.logger?.debug?.(`${debugId$1} Resolved endpoint: ${toDebugString$1(c)}`),c},isVirtualHostableS3Bucket$1=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!isVirtualHostableS3Bucket$1(t))return!1;return!0}return!!isValidHostLabel$1(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!isIpAddress$1(e)))},ARN_DELIMITER$1=":",RESOURCE_DELIMITER$1="/",parseArn$1=e=>{const t=e.split(ARN_DELIMITER$1);if(t.length<6)return null;const[n,i,r,o,a,...s]=t;if("arn"!==n||""===i||""===r||""===s.join(ARN_DELIMITER$1))return null;return{partition:i,service:r,region:o,accountId:a,resourceId:s.map(e=>e.split(RESOURCE_DELIMITER$1)).flat()}},partitions$1=[{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-east-2":{description:"Asia Pacific (Taipei)"},"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-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws 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-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso 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:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{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-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}];var partitionsInfo$1={partitions:partitions$1};let selectedPartitionsInfo$1=partitionsInfo$1;const partition$1=e=>{const{partitions:t}=selectedPartitionsInfo$1;for(const n of t){const{regions:t,outputs:i}=n;for(const[n,r]of Object.entries(t))if(n===e)return{...i,...r}}for(const n of t){const{regionRegex:t,outputs:i}=n;if(new RegExp(t).test(e))return{...i}}const n=t.find(e=>"aws"===e.id);if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}},awsEndpointFunctions$1={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket$1,parseArn:parseArn$1,partition:partition$1};function parseQueryString$1(e){const t={};if(e=e.replace(/^\?/,""))for(const n of e.split("&")){let[e,i=null]=n.split("=");e=decodeURIComponent(e),i&&(i=decodeURIComponent(i)),e in t?Array.isArray(t[e])?t[e].push(i):t[e]=[t[e],i]:t[e]=i}return t}customEndpointFunctions$1.aws=awsEndpointFunctions$1;const parseUrl$1=e=>{if("string"==typeof e)return parseUrl$1(new URL(e));const{hostname:t,pathname:n,port:i,protocol:r,search:o}=e;let a;return o&&(a=parseQueryString$1(o)),{hostname:t,port:i?parseInt(i):void 0,protocol:r,path:n,query:a}};function setCredentialFeature$1(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}function setFeature$2(e,t,n){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=n}const getDateHeader$1=e=>HttpResponse$1.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,getSkewCorrectedDate$1=e=>new Date(Date.now()+e),isClockSkewed$1=(e,t)=>Math.abs(getSkewCorrectedDate$1(t).getTime()-e)>=3e5,getUpdatedSystemClockOffset$1=(e,t)=>{const n=Date.parse(e);return isClockSkewed$1(n,t)?n-Date.now():t},throwSigningPropertyError$1=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},validateSigningProperties$1=async e=>{const t=throwSigningPropertyError$1("context",e.context),n=throwSigningPropertyError$1("config",e.config),i=t.endpointV2?.properties?.authSchemes?.[0],r=throwSigningPropertyError$1("signer",n.signer),o=await r(i),a=e?.signingRegion,s=e?.signingRegionSet,c=e?.signingName;return{config:n,signer:o,signingRegion:a,signingRegionSet:s,signingName:c}};let AwsSdkSigV4Signer$1=class{async sign(e,t,n){if(!HttpRequest$2.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await validateSigningProperties$1(n),{config:r,signer:o}=i;let{signingRegion:a,signingName:s}=i;const c=n.context;if(c?.authSchemes?.length){const[e,t]=c.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(a=t?.signingRegion??a,s=t?.signingName??s)}return await o.sign(e,{signingDate:getSkewCorrectedDate$1(r.systemClockOffset),signingRegion:a,signingService:s})}errorHandler(e){return t=>{const n=t.ServerTime??getDateHeader$1(t.$response);if(n){const i=throwSigningPropertyError$1("config",e.config),r=i.systemClockOffset;i.systemClockOffset=getUpdatedSystemClockOffset$1(n,i.systemClockOffset);i.systemClockOffset!==r&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=getDateHeader$1(e);if(n){const e=throwSigningPropertyError$1("config",t.config);e.systemClockOffset=getUpdatedSystemClockOffset$1(n,e.systemClockOffset)}}};const ALGORITHM_QUERY_PARAM$1="X-Amz-Algorithm",CREDENTIAL_QUERY_PARAM$1="X-Amz-Credential",AMZ_DATE_QUERY_PARAM$1="X-Amz-Date",SIGNED_HEADERS_QUERY_PARAM$1="X-Amz-SignedHeaders",EXPIRES_QUERY_PARAM$1="X-Amz-Expires",SIGNATURE_QUERY_PARAM$1="X-Amz-Signature",TOKEN_QUERY_PARAM$1="X-Amz-Security-Token",AUTH_HEADER$1="authorization",AMZ_DATE_HEADER$1=AMZ_DATE_QUERY_PARAM$1.toLowerCase(),DATE_HEADER$1="date",GENERATED_HEADERS$1=[AUTH_HEADER$1,AMZ_DATE_HEADER$1,DATE_HEADER$1],SIGNATURE_HEADER$1=SIGNATURE_QUERY_PARAM$1.toLowerCase(),SHA256_HEADER$1="x-amz-content-sha256",TOKEN_HEADER$1=TOKEN_QUERY_PARAM$1.toLowerCase(),ALWAYS_UNSIGNABLE_HEADERS$1={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},PROXY_HEADER_PATTERN$1=/^proxy-/,SEC_HEADER_PATTERN$1=/^sec-/,ALGORITHM_IDENTIFIER$1="AWS4-HMAC-SHA256",EVENT_ALGORITHM_IDENTIFIER$1="AWS4-HMAC-SHA256-PAYLOAD",UNSIGNED_PAYLOAD$1="UNSIGNED-PAYLOAD",MAX_CACHE_SIZE$1=50,KEY_TYPE_IDENTIFIER$1="aws4_request",MAX_PRESIGNED_TTL$1=604800,signingKeyCache$1={},cacheQueue$1=[],createScope$1=(e,t,n)=>`${e}/${t}/${n}/${KEY_TYPE_IDENTIFIER$1}`,getSigningKey$1=async(e,t,n,i,r)=>{const o=`${n}:${i}:${r}:${toHex(await hmac$1(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(o in signingKeyCache$1)return signingKeyCache$1[o];for(cacheQueue$1.push(o);cacheQueue$1.length>MAX_CACHE_SIZE$1;)delete signingKeyCache$1[cacheQueue$1.shift()];let a=`AWS4${t.secretAccessKey}`;for(const t of[n,i,r,KEY_TYPE_IDENTIFIER$1])a=await hmac$1(e,a,t);return signingKeyCache$1[o]=a},hmac$1=(e,t,n)=>{const i=new e(t);return i.update(toUint8Array(n)),i.digest()},getCanonicalHeaders$1=({headers:e},t,n)=>{const i={};for(const r of Object.keys(e).sort()){if(null==e[r])continue;const o=r.toLowerCase();(o in ALWAYS_UNSIGNABLE_HEADERS$1||t?.has(o)||PROXY_HEADER_PATTERN$1.test(o)||SEC_HEADER_PATTERN$1.test(o))&&(!n||n&&!n.has(o))||(i[o]=e[r].trim().replace(/\s+/g," "))}return i},isArrayBuffer=e=>"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e),getPayloadHash$1=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===SHA256_HEADER$1)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||isArrayBuffer(t)){const e=new n;return e.update(toUint8Array(t)),toHex(await e.digest())}return UNSIGNED_PAYLOAD$1};let HeaderFormatter$1=class{format(e){const t=[];for(const n of Object.keys(e)){const i=fromUtf8$2(n);t.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n}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 t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const r=new DataView(new ArrayBuffer(3+e.value.byteLength));r.setUint8(0,6),r.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(r.buffer);return o.set(e.value,3),o;case"string":const a=fromUtf8$2(e.value),s=new DataView(new ArrayBuffer(3+a.byteLength));s.setUint8(0,7),s.setUint16(1,a.byteLength,!1);const c=new Uint8Array(s.buffer);return c.set(a,3),c;case"timestamp":const l=new Uint8Array(9);return l[0]=8,l.set(Int64$2.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!UUID_PATTERN$2.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(fromHex(e.value.replace(/\-/g,"")),1),d}}};var HEADER_VALUE_TYPE$2;!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"}(HEADER_VALUE_TYPE$2||(HEADER_VALUE_TYPE$2={}));const UUID_PATTERN$2=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let Int64$2=class e{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const n=new Uint8Array(8);for(let e=7,i=Math.abs(Math.round(t));e>-1&&i>0;e--,i/=256)n[e]=i;return t<0&&negate$2(n),new e(n)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&negate$2(e),parseInt(toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function negate$2(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const hasHeader$1=(e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1},moveHeadersToQuery$1=(e,t={})=>{const{headers:n,query:i={}}=HttpRequest$2.clone(e);for(const e of Object.keys(n)){const r=e.toLowerCase();("x-amz-"===r.slice(0,6)&&!t.unhoistableHeaders?.has(r)||t.hoistableHeaders?.has(r))&&(i[e]=n[e],delete n[e])}return{...e,headers:n,query:i}},prepareRequest$1=e=>{e=HttpRequest$2.clone(e);for(const t of Object.keys(e.headers))GENERATED_HEADERS$1.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},getCanonicalQuery$1=({query:e={}})=>{const t=[],n={};for(const i of Object.keys(e)){if(i.toLowerCase()===SIGNATURE_HEADER$1)continue;const r=escapeUri(i);t.push(r);const o=e[i];"string"==typeof o?n[r]=`${r}=${escapeUri(o)}`:Array.isArray(o)&&(n[r]=o.slice(0).reduce((e,t)=>e.concat([`${r}=${escapeUri(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>n[e]).filter(e=>e).join("&")},iso8601$1=e=>toDate$1(e).toISOString().replace(/\.\d{3}Z$/,"Z"),toDate$1=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;let SignatureV4Base$1=class{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o=!0}){this.service=i,this.sha256=r,this.uriEscapePath=o,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=normalizeProvider$4(n),this.credentialProvider=normalizeProvider$4(t)}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${getCanonicalQuery$1(e)}\n${i.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${i.join(";")}\n${n}`}async createStringToSign(e,t,n,i){const r=new this.sha256;r.update(toUint8Array(n));return`${i}\n${e}\n${t}\n${toHex(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return escapeUri(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}formatDate(e){const t=iso8601$1(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}},SignatureV4$1=class extends SignatureV4Base$1{headerFormatter=new HeaderFormatter$1;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o=!0}){super({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o})}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:r,unhoistableHeaders:o,signableHeaders:a,hoistableHeaders:s,signingRegion:c,signingService:l}=t,d=await this.credentialProvider();this.validateResolvedCredentials(d);const u=c??await this.regionProvider(),{longDate:p,shortDate:m}=this.formatDate(n);if(i>MAX_PRESIGNED_TTL$1)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const h=createScope$1(m,u,l??this.service),f=moveHeadersToQuery$1(prepareRequest$1(e),{unhoistableHeaders:o,hoistableHeaders:s});d.sessionToken&&(f.query[TOKEN_QUERY_PARAM$1]=d.sessionToken),f.query[ALGORITHM_QUERY_PARAM$1]=ALGORITHM_IDENTIFIER$1,f.query[CREDENTIAL_QUERY_PARAM$1]=`${d.accessKeyId}/${h}`,f.query[AMZ_DATE_QUERY_PARAM$1]=p,f.query[EXPIRES_QUERY_PARAM$1]=i.toString(10);const g=getCanonicalHeaders$1(f,r,a);return f.query[SIGNED_HEADERS_QUERY_PARAM$1]=this.getCanonicalHeaderList(g),f.query[SIGNATURE_QUERY_PARAM$1]=await this.getSignature(p,h,this.getSigningKey(d,u,m,l),this.createCanonicalRequest(f,g,await getPayloadHash$1(e,this.sha256))),f}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:i,signingRegion:r,signingService:o}){const a=r??await this.regionProvider(),{shortDate:s,longDate:c}=this.formatDate(n),l=createScope$1(s,a,o??this.service),d=await getPayloadHash$1({headers:{},body:t},this.sha256),u=new this.sha256;u.update(e);const p=toHex(await u.digest()),m=[EVENT_ALGORITHM_IDENTIFIER$1,c,l,i,p,d].join("\n");return this.signString(m,{signingDate:n,signingRegion:a,signingService:o})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:i,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i}={}){const r=await this.credentialProvider();this.validateResolvedCredentials(r);const o=n??await this.regionProvider(),{shortDate:a}=this.formatDate(t),s=new this.sha256(await this.getSigningKey(r,o,a,i));return s.update(toUint8Array(e)),toHex(await s.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:r,signingService:o}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const s=r??await this.regionProvider(),c=prepareRequest$1(e),{longDate:l,shortDate:d}=this.formatDate(t),u=createScope$1(d,s,o??this.service);c.headers[AMZ_DATE_HEADER$1]=l,a.sessionToken&&(c.headers[TOKEN_HEADER$1]=a.sessionToken);const p=await getPayloadHash$1(c,this.sha256);!hasHeader$1(SHA256_HEADER$1,c.headers)&&this.applyChecksum&&(c.headers[SHA256_HEADER$1]=p);const m=getCanonicalHeaders$1(c,i,n),h=await this.getSignature(l,u,this.getSigningKey(a,s,d,o),this.createCanonicalRequest(c,m,p));return c.headers[AUTH_HEADER$1]=`${ALGORITHM_IDENTIFIER$1} Credential=${a.accessKeyId}/${u}, SignedHeaders=${this.getCanonicalHeaderList(m)}, Signature=${h}`,c}async getSignature(e,t,n,i){const r=await this.createStringToSign(e,t,i,ALGORITHM_IDENTIFIER$1),o=new this.sha256(await n);return o.update(toUint8Array(r)),toHex(await o.digest())}getSigningKey(e,t,n,i){return getSigningKey$1(this.sha256,e,n,t,i||this.service)}};const resolveAwsSdkSigV4Config$1=e=>{let t,n=e.credentials,i=!!e.credentials;Object.defineProperty(e,"credentials",{set(r){r&&r!==n&&r!==t&&(i=!0),n=r;const o=normalizeCredentialProvider$1(e,{credentials:n,credentialDefaultProvider:e.credentialDefaultProvider}),a=bindCallerConfig$1(e,o);i&&!a.attributed?(t=async e=>a(e).then(e=>setCredentialFeature$1(e,"CREDENTIALS_CODE","e")),t.memoized=a.memoized,t.configBound=a.configBound,t.attributed=!0):t=a},get:()=>t,enumerable:!0,configurable:!0}),e.credentials=n;const{signingEscapePath:r=!0,systemClockOffset:o=e.systemClockOffset||0,sha256:a}=e;let s;s=e.signer?normalizeProvider$3(e.signer):e.regionInfoProvider?()=>normalizeProvider$3(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,n])=>{const{signingRegion:i,signingService:o}=t;e.signingRegion=e.signingRegion||i||n,e.signingName=e.signingName||o||e.serviceId;const s={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:a,uriEscapePath:r};return new(e.signerConstructor||SignatureV4$1)(s)}):async t=>{const n=(t=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await normalizeProvider$3(e.region)(),properties:{}},t)).signingRegion,i=t.signingName;e.signingRegion=e.signingRegion||n,e.signingName=e.signingName||i||e.serviceId;const o={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:a,uriEscapePath:r};return new(e.signerConstructor||SignatureV4$1)(o)};return Object.assign(e,{systemClockOffset:o,signingEscapePath:r,signer:s})};function normalizeCredentialProvider$1(e,{credentials:t,credentialDefaultProvider:n}){let i;return i=t?t?.memoized?t:memoizeIdentityProvider$1(t,isIdentityExpired$1,doesIdentityRequireRefresh$1):n?normalizeProvider$3(n(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},i.memoized=!0,i}function bindCallerConfig$1(e,t){if(t.configBound)return t;const n=async n=>t({...n,callerClientConfig:e});return n.memoized=t.memoized,n.configBound=!0,n}const TEXT_ENCODER="function"==typeof TextEncoder?new TextEncoder:null,calculateBodyLength=e=>{if("string"==typeof e){if(TEXT_ENCODER)return TEXT_ENCODER.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const i=e.charCodeAt(n);i>127&&i<=2047?t++:i>2047&&i<=65535&&(t+=2),i>=56320&&i<=57343&&n--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)},_toStr=e=>{if(null==e)return e;if("number"==typeof e||"bigint"==typeof e){const t=new Error(`Received number ${e} where a string was expected.`);return t.name="Warning",console.warn(t),String(e)}if("boolean"==typeof e){const t=new Error(`Received boolean ${e} where a string was expected.`);return t.name="Warning",console.warn(t),String(e)}return e},_toNum=e=>{if(null==e)return e;if("string"==typeof e){const t=Number(e);if(t.toString()!==e){const t=new Error(`Received string "${e}" where a number was expected.`);return t.name="Warning",console.warn(t),e}return t}return e},getAllAliases$1=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const e of t)n.push(e);return n},getMiddlewareNameWithAliases$1=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,constructStack$1=()=>{let e=[],t=[],n=!1;const i=new Set,r=n=>(e.forEach(e=>{n.add(e.middleware,{...e})}),t.forEach(e=>{n.addRelativeTo(e.middleware,{...e})}),n.identifyOnResolve?.(s.identifyOnResolve()),n),o=e=>{const t=[];return e.before.forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...o(e))}),t.push(e),e.after.reverse().forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...o(e))}),t},a=(n=!1)=>{const i=[],r=[],a={};e.forEach(e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases$1(t.name,t.aliases))a[e]=t;i.push(t)}),t.forEach(e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases$1(t.name,t.aliases))a[e]=t;r.push(t)}),r.forEach(e=>{if(e.toMiddleware){const t=a[e.toMiddleware];if(void 0===t){if(n)return;throw new Error(`${e.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases$1(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}});const s=(c=i,c.sort((e,t)=>stepWeights$1[t.step]-stepWeights$1[e.step]||priorityWeights$1[t.priority||"normal"]-priorityWeights$1[e.priority||"normal"])).map(o).reduce((e,t)=>(e.push(...t),e),[]);var c;return s},s={add:(t,n={})=>{const{name:r,override:o,aliases:a}=n,s={step:"initialize",priority:"normal",middleware:t,...n},c=getAllAliases$1(r,a);if(c.length>0){if(c.some(e=>i.has(e))){if(!o)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases$1(r,a)}'`);for(const t of c){const n=e.findIndex(e=>e.name===t||e.aliases?.some(e=>e===t));if(-1===n)continue;const i=e[n];if(i.step!==s.step||s.priority!==i.priority)throw new Error(`"${getMiddlewareNameWithAliases$1(i.name,i.aliases)}" middleware with ${i.priority} priority in ${i.step} step cannot be overridden by "${getMiddlewareNameWithAliases$1(r,a)}" middleware with ${s.priority} priority in ${s.step} step.`);e.splice(n,1)}}for(const e of c)i.add(e)}e.push(s)},addRelativeTo:(e,n)=>{const{name:r,override:o,aliases:a}=n,s={middleware:e,...n},c=getAllAliases$1(r,a);if(c.length>0){if(c.some(e=>i.has(e))){if(!o)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases$1(r,a)}'`);for(const e of c){const n=t.findIndex(t=>t.name===e||t.aliases?.some(t=>t===e));if(-1===n)continue;const i=t[n];if(i.toMiddleware!==s.toMiddleware||i.relation!==s.relation)throw new Error(`"${getMiddlewareNameWithAliases$1(i.name,i.aliases)}" middleware ${i.relation} "${i.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases$1(r,a)}" middleware ${s.relation} "${s.toMiddleware}" middleware.`);t.splice(n,1)}}for(const e of c)i.add(e)}t.push(s)},clone:()=>r(constructStack$1()),use:e=>{e.applyToStack(s)},remove:n=>"string"==typeof n?(n=>{let r=!1;const o=e=>{const t=getAllAliases$1(e.name,e.aliases);if(t.includes(n)){r=!0;for(const e of t)i.delete(e);return!1}return!0};return e=e.filter(o),t=t.filter(o),r})(n):(n=>{let r=!1;const o=e=>{if(e.middleware===n){r=!0;for(const t of getAllAliases$1(e.name,e.aliases))i.delete(t);return!1}return!0};return e=e.filter(o),t=t.filter(o),r})(n),removeByTag:n=>{let r=!1;const o=e=>{const{tags:t,name:o,aliases:a}=e;if(t&&t.includes(n)){const e=getAllAliases$1(o,a);for(const t of e)i.delete(t);return r=!0,!1}return!0};return e=e.filter(o),t=t.filter(o),r},concat:e=>{const t=r(constructStack$1());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:r,identify:()=>a(!0).map(e=>{const t=e.step??e.relation+" "+e.toMiddleware;return getMiddlewareNameWithAliases$1(e.name,e.aliases)+" - "+t}),identifyOnResolve:e=>("boolean"==typeof e&&(n=e),n),resolve:(e,t)=>{for(const n of a().map(e=>e.middleware).reverse())e=n(e,t);return n&&console.log(s.identify()),e}};return s},stepWeights$1={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},priorityWeights$1={high:3,normal:2,low:1};let Client$1=class{config;middlewareStack=constructStack$1();initConfig;handlers;constructor(e){this.config=e}send(e,t,n){const i="function"!=typeof t?t:void 0,r="function"==typeof t?t:n;let o;if(void 0===i&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=new WeakMap);const t=this.handlers;t.has(e.constructor)?o=t.get(e.constructor):(o=e.resolveMiddleware(this.middlewareStack,this.config,i),t.set(e.constructor,o))}else delete this.handlers,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(!r)return o(e).then(e=>e.output);o(e).then(e=>r(null,e.output),e=>r(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};const SENSITIVE_STRING$2="***SensitiveInformation***";function schemaLogFilter$1(e,t){if(null==t)return t;const n=NormalizedSchema$1.of(e);if(n.getMergedTraits().sensitive)return SENSITIVE_STRING$2;if(n.isListSchema()){if(!!n.getValueSchema().getMergedTraits().sensitive)return SENSITIVE_STRING$2}else if(n.isMapSchema()){if(!!n.getKeySchema().getMergedTraits().sensitive||!!n.getValueSchema().getMergedTraits().sensitive)return SENSITIVE_STRING$2}else if(n.isStructSchema()&&"object"==typeof t){const e=t,i={};for(const[t,r]of n.structIterator())null!=e[t]&&(i[t]=schemaLogFilter$1(r,e[t]));return i}return t}let Command$1=class{middlewareStack=constructStack$1();schema;static classBuilder(){return new ClassBuilder$1}resolveMiddlewareWithContext(e,t,n,{middlewareFn:i,clientName:r,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:s,smithyContext:c,additionalContext:l,CommandCtor:d}){for(const r of i.bind(this)(d,e,t,n))this.middlewareStack.use(r);const u=e.concat(this.middlewareStack),{logger:p}=t,m={logger:p,clientName:r,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:s,[SMITHY_CONTEXT_KEY$1]:{commandInstance:this,...c},...l},{requestHandler:h}=t;return u.resolve(e=>h.handle(e.request,n||{}),m)}},ClassBuilder$1=class{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends Command$1{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,i,r){const o=e._operationSchema,a=o?.[4]??o?.input,s=o?.[5]??o?.output;return this.resolveMiddlewareWithContext(n,i,r,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(o?schemaLogFilter$1.bind(null,a):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(o?schemaLogFilter$1.bind(null,s):e=>e),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}};const SENSITIVE_STRING$1="***SensitiveInformation***";let ServiceException$2=class e extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(t){if(!t)return!1;const n=t;return e.prototype.isPrototypeOf(n)||Boolean(n.$fault)&&Boolean(n.$metadata)&&("client"===n.$fault||"server"===n.$fault)}static[Symbol.hasInstance](t){if(!t)return!1;const n=t;return this===e?e.isInstance(t):!!e.isInstance(t)&&(n.name&&this.name?this.prototype.isPrototypeOf(t)||n.name===this.name:this.prototype.isPrototypeOf(t))}};const decorateServiceException$1=(e,t={})=>{Object.entries(t).filter(([,e])=>void 0!==e).forEach(([t,n])=>{null!=e[t]&&""!==e[t]||(e[t]=n)});const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},throwDefaultError$4=({output:e,parsedBody:t,exceptionCtor:n,errorCode:i})=>{const r=deserializeMetadata$4(e),o=r.httpStatusCode?r.httpStatusCode+"":void 0,a=new n({name:t?.code||t?.Code||i||o||"UnknownError",$fault:"client",$metadata:r});throw decorateServiceException$1(a,t)},withBaseException=e=>({output:t,parsedBody:n,errorCode:i})=>{throwDefaultError$4({output:t,parsedBody:n,exceptionCtor:e,errorCode:i})},deserializeMetadata$4=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"]}),loadConfigsForDefaultMode$1=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},getChecksumConfiguration$1=e=>{const t=[];for(const n in AlgorithmId$1){const i=AlgorithmId$1[n];void 0!==e[i]&&t.push({algorithmId:()=>i,checksumConstructor:()=>e[i]})}return{addChecksumAlgorithm(e){t.push(e)},checksumAlgorithms:()=>t}},resolveChecksumRuntimeConfig$1=e=>{const t={};return e.checksumAlgorithms().forEach(e=>{t[e.algorithmId()]=e.checksumConstructor()}),t},getRetryConfiguration$1=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy:()=>e.retryStrategy}),resolveRetryRuntimeConfig$1=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},getDefaultExtensionConfiguration$1=e=>Object.assign(getChecksumConfiguration$1(e),getRetryConfiguration$1(e)),resolveDefaultRuntimeConfig$1=e=>Object.assign(resolveChecksumRuntimeConfig$1(e),resolveRetryRuntimeConfig$1(e)),isSerializableHeaderValue=e=>null!=e;let NoOpLogger$1=class{trace(){}debug(){}info(){}warn(){}error(){}};function map(e,t,n){let i,r,o;if(void 0===t&&void 0===n)i={},o=e;else{if(i=e,"function"==typeof t)return r=t,o=n,mapWithFilter(i,r,o);o=t}for(const e of Object.keys(o))Array.isArray(o[e])?applyInstruction(i,null,o,e):i[e]=o[e];return i}const take=(e,t)=>{const n={};for(const i in t)applyInstruction(n,e,t,i);return n},mapWithFilter=(e,t,n)=>map(e,Object.entries(n).reduce((e,[n,i])=>(Array.isArray(i)?e[n]=i:e[n]="function"==typeof i?[t,i()]:[t,i],e),{})),applyInstruction=(e,t,n,i)=>{if(null!==t){let r=n[i];"function"==typeof r&&(r=[,r]);const[o=nonNullish,a=pass,s=i]=r;return void(("function"==typeof o&&o(t[s])||"function"!=typeof o&&o)&&(e[i]=a(t[s])))}let[r,o]=n[i];if("function"==typeof o){let t;const n=void 0===r&&null!=(t=o()),a="function"==typeof r&&!!r(void 0)||"function"!=typeof r&&!!r;n?e[i]=t:a&&(e[i]=o())}else{const t=void 0===r&&null!=o,n="function"==typeof r&&!!r(o)||"function"!=typeof r&&!!r;(t||n)&&(e[i]=o)}},nonNullish=e=>null!=e,pass=e=>e,_json=e=>{if(null==e)return{};if(Array.isArray(e))return e.filter(e=>null!=e).map(_json);if("object"==typeof e){const t={};for(const n of Object.keys(e))null!=e[n]&&(t[n]=_json(e[n]));return t}return e},collectBodyString$1=(e,t)=>collectBody$1(e,t).then(e=>(t?.utf8Encoder??toUtf8)(e)),parseJsonBody$1=(e,t)=>collectBodyString$1(e,t).then(e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw"SyntaxError"===t?.name&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}return{}}),parseJsonErrorBody=async(e,t)=>{const n=await parseJsonBody$1(e,t);return n.message=n.message??n.Message,n},loadRestJsonErrorCode$1=(e,t)=>{const n=(e,t)=>Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase()),i=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},r=n(e.headers,"x-amzn-errortype");if(void 0!==r)return i(e.headers[r]);if(t&&"object"==typeof t){const e=n(t,"code");if(e&&void 0!==t[e])return i(t[e]);if(void 0!==t.__type)return i(t.__type)}},awsExpectUnion=e=>{if(null!=e)return"object"==typeof e&&"__type"in e&&delete e.__type,expectUnion(e)},ACCOUNT_ID_ENDPOINT_REGEX$1=/\d{12}\.ddb/;async function checkFeatures$1(e,t,n){const i=n.request;if("rpc-v2-cbor"===i?.headers?.["smithy-protocol"]&&setFeature$2(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const n=await t.retryStrategy();"function"==typeof n.acquireInitialRetryToken?n.constructor?.name?.includes("Adaptive")?setFeature$2(e,"RETRY_MODE_ADAPTIVE","F"):setFeature$2(e,"RETRY_MODE_STANDARD","E"):setFeature$2(e,"RETRY_MODE_LEGACY","D")}if("function"==typeof t.accountIdEndpointMode){const n=e.endpointV2;switch(String(n?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX$1)&&setFeature$2(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":setFeature$2(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":setFeature$2(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":setFeature$2(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const r=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(r?.$source){const t=r;t.accountId&&setFeature$2(e,"RESOLVED_ACCOUNT_ID","T");for(const[n,i]of Object.entries(t.$source??{}))setFeature$2(e,n,i)}}const USER_AGENT$1="user-agent",X_AMZ_USER_AGENT$1="x-amz-user-agent",SPACE$1=" ",UA_NAME_SEPARATOR$1="/",UA_NAME_ESCAPE_REGEX$1=/[^!$%&'*+\-.^_`|~\w]/g,UA_VALUE_ESCAPE_REGEX$1=/[^!$%&'*+\-.^_`|~\w#]/g,UA_ESCAPE_CHAR$1="-",BYTE_LIMIT$1=1024;function encodeFeatures$1(e){let t="";for(const n in e){const i=e[n];if(!(t.length+i.length+1<=BYTE_LIMIT$1))break;t.length?t+=","+i:t+=i}return t}const userAgentMiddleware$1=e=>(t,n)=>async i=>{const{request:r}=i;if(!HttpRequest$2.isInstance(r))return t(i);const{headers:o}=r,a=n?.userAgent?.map(escapeUserAgent$1)||[],s=(await e.defaultUserAgentProvider()).map(escapeUserAgent$1);await checkFeatures$1(n,e,i);const c=n;s.push(`m/${encodeFeatures$1(Object.assign({},n.__smithy_context?.features,c.__aws_sdk_context?.features))}`);const l=e?.customUserAgent?.map(escapeUserAgent$1)||[],d=await e.userAgentAppId();d&&s.push(escapeUserAgent$1(["app",`${d}`]));const u=[].concat([...s,...a,...l]).join(SPACE$1),p=[...s.filter(e=>e.startsWith("aws-sdk-")),...l].join(SPACE$1);return"browser"!==e.runtime?(p&&(o[X_AMZ_USER_AGENT$1]=o[X_AMZ_USER_AGENT$1]?`${o[USER_AGENT$1]} ${p}`:p),o[USER_AGENT$1]=u):o[X_AMZ_USER_AGENT$1]=u,t({...i,request:r})},escapeUserAgent$1=e=>{const t=e[0].split(UA_NAME_SEPARATOR$1).map(e=>e.replace(UA_NAME_ESCAPE_REGEX$1,UA_ESCAPE_CHAR$1)).join(UA_NAME_SEPARATOR$1),n=e[1]?.replace(UA_VALUE_ESCAPE_REGEX$1,UA_ESCAPE_CHAR$1),i=t.indexOf(UA_NAME_SEPARATOR$1),r=t.substring(0,i);let o=t.substring(i+1);return"api"===r&&(o=o.toLowerCase()),[r,o,n].filter(e=>e&&e.length>0).reduce((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},"")},getUserAgentMiddlewareOptions$1={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},getUserAgentPlugin$1=e=>({applyToStack:t=>{t.add(userAgentMiddleware$1(e),getUserAgentMiddlewareOptions$1)}}),DEFAULT_USE_DUALSTACK_ENDPOINT$1=!1,DEFAULT_USE_FIPS_ENDPOINT$1=!1,validRegions$1=new Set,checkRegion$1=(e,t=isValidHostLabel$1)=>{if(validRegions$1.has(e)||t(e))validRegions$1.add(e);else{if("*"!==e)throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.')}},isFipsRegion$1=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),getRealRegion$1=e=>isFipsRegion$1(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,resolveRegionConfig$1=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{const e="function"==typeof t?await t():t,n=getRealRegion$1(e);return checkRegion$1(n),n},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!isFipsRegion$1(e)||("function"!=typeof n?Promise.resolve(!!n):n())}})},CONTENT_LENGTH_HEADER$1="content-length";function contentLengthMiddleware$1(e){return t=>async n=>{const i=n.request;if(HttpRequest$2.isInstance(i)){const{body:t,headers:n}=i;if(t&&-1===Object.keys(n).map(e=>e.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER$1))try{const n=e(t);i.headers={...i.headers,[CONTENT_LENGTH_HEADER$1]:String(n)}}catch(e){}}return t({...n,request:i})}}const contentLengthMiddlewareOptions$1={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},getContentLengthPlugin$1=e=>({applyToStack:t=>{t.add(contentLengthMiddleware$1(e.bodyLengthChecker),contentLengthMiddlewareOptions$1)}}),resolveParamsForS3$1=async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName$1(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!isDnsCompatibleBucketName$1(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},DOMAIN_PATTERN$1=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,IP_ADDRESS_PATTERN$1=/(\d+\.){3}\d+/,DOTS_PATTERN$1=/\.\./,isDnsCompatibleBucketName$1=e=>DOMAIN_PATTERN$1.test(e)&&!IP_ADDRESS_PATTERN$1.test(e)&&!DOTS_PATTERN$1.test(e),isArnBucketName$1=e=>{const[t,n,i,,,r]=e.split(":"),o="arn"===t&&e.split(":").length>=6,a=Boolean(o&&n&&i&&r);if(o&&!a)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return a},createConfigValueProvider$1=(e,t,n)=>{const i=async()=>{const i=n[e]??n[t];return"function"==typeof i?i():i};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{if(!1===n.isCustomEndpoint)return;const e=await i();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:n,port:i,path:r}=e;return`${t}//${n}${i?":"+i:""}${r}`}}return e}:i},getEndpointFromConfig$1=async e=>{},toEndpointV1$1=e=>"object"==typeof e?"url"in e?parseUrl$1(e.url):e:parseUrl$1(e),getEndpointFromInstructions$1=async(e,t,n,i)=>{if(!n.isCustomEndpoint){let e;e=n.serviceConfiguredEndpoint?await n.serviceConfiguredEndpoint():await getEndpointFromConfig$1(n.serviceId),e&&(n.endpoint=()=>Promise.resolve(toEndpointV1$1(e)),n.isCustomEndpoint=!0)}const r=await resolveParams$1(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(r,i)},resolveParams$1=async(e,t,n)=>{const i={},r=t?.getEndpointParameterInstructions?.()||{};for(const[t,o]of Object.entries(r))switch(o.type){case"staticContextParams":i[t]=o.value;break;case"contextParams":i[t]=e[o.name];break;case"clientContextParams":case"builtInParams":i[t]=await createConfigValueProvider$1(o.name,t,n)();break;case"operationContextParams":i[t]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(r).length&&Object.assign(i,n),"s3"===String(n.serviceId).toLowerCase()&&await resolveParamsForS3$1(i),i},endpointMiddleware$1=({config:e,instructions:t})=>(n,i)=>async r=>{e.isCustomEndpoint&&setFeature$3(i,"ENDPOINT_OVERRIDE","N");const o=await getEndpointFromInstructions$1(r.input,{getEndpointParameterInstructions:()=>t},{...e},i);i.endpointV2=o,i.authSchemes=o.properties?.authSchemes;const a=i.authSchemes?.[0];if(a){i.signing_region=a.signingRegion,i.signing_service=a.signingName;const e=getSmithyContext$1(i),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return n({...r})},endpointMiddlewareOptions$1={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:serializerMiddlewareOption$2.name},getEndpointPlugin$1=(e,t)=>({applyToStack:n=>{n.addRelativeTo(endpointMiddleware$1({config:e,instructions:t}),endpointMiddlewareOptions$1)}}),resolveEndpointConfig$1=e=>{const t=e.tls??!0,{endpoint:n,useDualstackEndpoint:i,useFipsEndpoint:r}=e,o=null!=n?async()=>toEndpointV1$1(await normalizeProvider$4(n)()):void 0,a=!!n,s=Object.assign(e,{endpoint:o,tls:t,isCustomEndpoint:a,useDualstackEndpoint:normalizeProvider$4(i??!1),useFipsEndpoint:normalizeProvider$4(r??!1)});let c;return s.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=getEndpointFromConfig$1(e.serviceId)),c),s};var RETRY_MODES$1;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(RETRY_MODES$1||(RETRY_MODES$1={}));const DEFAULT_MAX_ATTEMPTS$1=3,DEFAULT_RETRY_MODE$1=RETRY_MODES$1.STANDARD,THROTTLING_ERROR_CODES$1=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],TRANSIENT_ERROR_CODES$1=["TimeoutError","RequestTimeout","RequestTimeoutException"],TRANSIENT_ERROR_STATUS_CODES$1=[500,502,503,504],NODEJS_TIMEOUT_ERROR_CODES$1=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],NODEJS_NETWORK_ERROR_CODES$1=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],isRetryableByTrait$1=e=>void 0!==e?.$retryable,isClockSkewCorrectedError$1=e=>e.$metadata?.clockSkewCorrected,isBrowserNetworkError$1=e=>{const t=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return!!(e&&e instanceof TypeError)&&t.has(e.message)},isThrottlingError$1=e=>429===e.$metadata?.httpStatusCode||THROTTLING_ERROR_CODES$1.includes(e.name)||1==e.$retryable?.throttling,isTransientError$1=(e,t=0)=>isRetryableByTrait$1(e)||isClockSkewCorrectedError$1(e)||TRANSIENT_ERROR_CODES$1.includes(e.name)||NODEJS_TIMEOUT_ERROR_CODES$1.includes(e?.code||"")||NODEJS_NETWORK_ERROR_CODES$1.includes(e?.code||"")||TRANSIENT_ERROR_STATUS_CODES$1.includes(e.$metadata?.httpStatusCode||0)||isBrowserNetworkError$1(e)||void 0!==e.cause&&t<=10&&isTransientError$1(e.cause,t+1),isServerError$1=e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!isTransientError$1(e)}return!1};let DefaultRateLimiter$1=class e{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;currentCapacity=0;enabled=!1;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(t){if(this.enabled){if(this.refillTokenBucket(),t>this.currentCapacity){const n=(t-this.currentCapacity)/this.fillRate*1e3;await new Promise(t=>e.setTimeoutFn(t,n))}this.currentCapacity=this.currentCapacity-t}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const 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(),isThrottlingError$1(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}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(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}};const DEFAULT_RETRY_DELAY_BASE$1=100,MAXIMUM_RETRY_DELAY$1=2e4,THROTTLING_RETRY_DELAY_BASE$1=500,INITIAL_RETRY_TOKENS$1=500,RETRY_COST$1=5,TIMEOUT_RETRY_COST$1=10,NO_RETRY_INCREMENT$1=1,INVOCATION_ID_HEADER$1="amz-sdk-invocation-id",REQUEST_HEADER$1="amz-sdk-request",getDefaultRetryBackoffStrategy$1=()=>{let e=DEFAULT_RETRY_DELAY_BASE$1;return{computeNextBackoffDelay:t=>Math.floor(Math.min(MAXIMUM_RETRY_DELAY$1,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}},createDefaultRetryToken$1=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(MAXIMUM_RETRY_DELAY$1,e),getRetryCost:()=>n});let StandardRetryStrategy$1=class{maxAttempts;mode=RETRY_MODES$1.STANDARD;capacity=INITIAL_RETRY_TOKENS$1;retryBackoffStrategy=getDefaultRetryBackoffStrategy$1();maxAttemptsProvider;constructor(e){this.maxAttempts=e,this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return createDefaultRetryToken$1({retryDelay:DEFAULT_RETRY_DELAY_BASE$1,retryCount:0})}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts();if(this.shouldRetry(e,t,n)){const n=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===n?THROTTLING_RETRY_DELAY_BASE$1:DEFAULT_RETRY_DELAY_BASE$1);const i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),r=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,i):i,o=this.getCapacityCost(n);return this.capacity-=o,createDefaultRetryToken$1({retryDelay:r,retryCount:e.getRetryCount()+1,retryCost:o})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(INITIAL_RETRY_TOKENS$1,this.capacity+(e.getRetryCost()??NO_RETRY_INCREMENT$1))}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 ${DEFAULT_MAX_ATTEMPTS$1}`),DEFAULT_MAX_ATTEMPTS$1}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?TIMEOUT_RETRY_COST$1:RETRY_COST$1}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}},AdaptiveRetryStrategy$1=class{maxAttemptsProvider;rateLimiter;standardRetryStrategy;mode=RETRY_MODES$1.ADAPTIVE;constructor(e,t){this.maxAttemptsProvider=e;const{rateLimiter:n}=t??{};this.rateLimiter=n??new DefaultRateLimiter$1,this.standardRetryStrategy=new StandardRetryStrategy$1(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)}};const asSdkError$1=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),resolveRetryConfig$1=e=>{const{retryStrategy:t,retryMode:n,maxAttempts:i}=e,r=normalizeProvider$4(i??DEFAULT_MAX_ATTEMPTS$1);return Object.assign(e,{maxAttempts:r,retryStrategy:async()=>{if(t)return t;return await normalizeProvider$4(n)()===RETRY_MODES$1.ADAPTIVE?new AdaptiveRetryStrategy$1(r):new StandardRetryStrategy$1(r)}})},isStreamingPayload$1=e=>e?.body instanceof ReadableStream,retryMiddleware$1=e=>(t,n)=>async i=>{let r=await e.retryStrategy();const o=await e.maxAttempts();if(!isRetryStrategyV2$1(r))return r?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",r.mode]]),r.retry(t,i);{let e=await r.acquireInitialRetryToken(n.partition_id),a=new Error,s=0,c=0;const{request:l}=i,d=HttpRequest$2.isInstance(l);for(d&&(l.headers[INVOCATION_ID_HEADER$1]=v4());;)try{d&&(l.headers[REQUEST_HEADER$1]=`attempt=${s+1}; max=${o}`);const{response:n,output:a}=await t(i);return r.recordSuccess(e),a.$metadata.attempts=s+1,a.$metadata.totalRetryDelay=c,{response:n,output:a}}catch(t){const i=getRetryErrorInfo$1(t);if(a=asSdkError$1(t),d&&isStreamingPayload$1(l))throw(n.logger instanceof NoOpLogger$1?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{e=await r.refreshRetryTokenForRetry(e,i)}catch(e){throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=s+1,a.$metadata.totalRetryDelay=c,a}s=e.getRetryCount();const o=e.getRetryDelay();c+=o,await new Promise(e=>setTimeout(e,o))}}},isRetryStrategyV2$1=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,getRetryErrorInfo$1=e=>{const t={error:e,errorType:getRetryErrorType$1(e)},n=getRetryAfterHint$1(e.$response);return n&&(t.retryAfterHint=n),t},getRetryErrorType$1=e=>isThrottlingError$1(e)?"THROTTLING":isTransientError$1(e)?"TRANSIENT":isServerError$1(e)?"SERVER_ERROR":"CLIENT_ERROR",retryMiddlewareOptions$1={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryPlugin$1=e=>({applyToStack:t=>{t.add(retryMiddleware$1(e),retryMiddlewareOptions$1)}}),getRetryAfterHint$1=e=>{if(!HttpResponse$1.isInstance(e))return;const t=Object.keys(e.headers).find(e=>"retry-after"===e.toLowerCase());if(!t)return;const n=e.headers[t],i=Number(n);if(!Number.isNaN(i))return new Date(1e3*i);return new Date(n)},defaultDynamoDBHttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext$1(t).operation,region:await normalizeProvider$4(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption$4(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"dynamodb",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const defaultDynamoDBHttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption$4(e)),t},resolveHttpAuthSchemeConfig$4=e=>{const t=resolveAwsSdkSigV4Config$1(e);return Object.assign(t,{authSchemePreference:normalizeProvider$4(e.authSchemePreference??[])})},resolveClientEndpointParameters$4=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"dynamodb"}),commonParams$4={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},AccountId:{type:"builtInParams",name:"accountId"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"},AccountIdEndpointMode:{type:"builtInParams",name:"accountIdEndpointMode"}};class DynamoDBServiceException extends ServiceException$2{constructor(e){super(e),Object.setPrototypeOf(this,DynamoDBServiceException.prototype)}}class BackupInUseException extends DynamoDBServiceException{name="BackupInUseException";$fault="client";constructor(e){super({name:"BackupInUseException",$fault:"client",...e}),Object.setPrototypeOf(this,BackupInUseException.prototype)}}class BackupNotFoundException extends DynamoDBServiceException{name="BackupNotFoundException";$fault="client";constructor(e){super({name:"BackupNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,BackupNotFoundException.prototype)}}let InternalServerError$1=class e extends DynamoDBServiceException{name="InternalServerError";$fault="server";constructor(t){super({name:"InternalServerError",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}};class RequestLimitExceeded extends DynamoDBServiceException{name="RequestLimitExceeded";$fault="client";ThrottlingReasons;constructor(e){super({name:"RequestLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,RequestLimitExceeded.prototype),this.ThrottlingReasons=e.ThrottlingReasons}}let ThrottlingException$1=class e extends DynamoDBServiceException{name="ThrottlingException";$fault="client";throttlingReasons;constructor(t){super({name:"ThrottlingException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.throttlingReasons=t.throttlingReasons}};class InvalidEndpointException extends DynamoDBServiceException{name="InvalidEndpointException";$fault="client";Message;constructor(e){super({name:"InvalidEndpointException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidEndpointException.prototype),this.Message=e.Message}}class ProvisionedThroughputExceededException extends DynamoDBServiceException{name="ProvisionedThroughputExceededException";$fault="client";ThrottlingReasons;constructor(e){super({name:"ProvisionedThroughputExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ProvisionedThroughputExceededException.prototype),this.ThrottlingReasons=e.ThrottlingReasons}}let ResourceNotFoundException$3=class e extends DynamoDBServiceException{name="ResourceNotFoundException";$fault="client";constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};class ItemCollectionSizeLimitExceededException extends DynamoDBServiceException{name="ItemCollectionSizeLimitExceededException";$fault="client";constructor(e){super({name:"ItemCollectionSizeLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ItemCollectionSizeLimitExceededException.prototype)}}class ReplicatedWriteConflictException extends DynamoDBServiceException{name="ReplicatedWriteConflictException";$fault="client";$retryable={};constructor(e){super({name:"ReplicatedWriteConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,ReplicatedWriteConflictException.prototype)}}class ContinuousBackupsUnavailableException extends DynamoDBServiceException{name="ContinuousBackupsUnavailableException";$fault="client";constructor(e){super({name:"ContinuousBackupsUnavailableException",$fault:"client",...e}),Object.setPrototypeOf(this,ContinuousBackupsUnavailableException.prototype)}}let LimitExceededException$2=class e extends DynamoDBServiceException{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};class TableInUseException extends DynamoDBServiceException{name="TableInUseException";$fault="client";constructor(e){super({name:"TableInUseException",$fault:"client",...e}),Object.setPrototypeOf(this,TableInUseException.prototype)}}class TableNotFoundException extends DynamoDBServiceException{name="TableNotFoundException";$fault="client";constructor(e){super({name:"TableNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,TableNotFoundException.prototype)}}class GlobalTableAlreadyExistsException extends DynamoDBServiceException{name="GlobalTableAlreadyExistsException";$fault="client";constructor(e){super({name:"GlobalTableAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,GlobalTableAlreadyExistsException.prototype)}}let ResourceInUseException$2=class e extends DynamoDBServiceException{name="ResourceInUseException";$fault="client";constructor(t){super({name:"ResourceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};class TransactionConflictException extends DynamoDBServiceException{name="TransactionConflictException";$fault="client";constructor(e){super({name:"TransactionConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,TransactionConflictException.prototype)}}class PolicyNotFoundException extends DynamoDBServiceException{name="PolicyNotFoundException";$fault="client";constructor(e){super({name:"PolicyNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,PolicyNotFoundException.prototype)}}class ExportNotFoundException extends DynamoDBServiceException{name="ExportNotFoundException";$fault="client";constructor(e){super({name:"ExportNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ExportNotFoundException.prototype)}}class GlobalTableNotFoundException extends DynamoDBServiceException{name="GlobalTableNotFoundException";$fault="client";constructor(e){super({name:"GlobalTableNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,GlobalTableNotFoundException.prototype)}}class ImportNotFoundException extends DynamoDBServiceException{name="ImportNotFoundException";$fault="client";constructor(e){super({name:"ImportNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ImportNotFoundException.prototype)}}class DuplicateItemException extends DynamoDBServiceException{name="DuplicateItemException";$fault="client";constructor(e){super({name:"DuplicateItemException",$fault:"client",...e}),Object.setPrototypeOf(this,DuplicateItemException.prototype)}}class IdempotentParameterMismatchException extends DynamoDBServiceException{name="IdempotentParameterMismatchException";$fault="client";Message;constructor(e){super({name:"IdempotentParameterMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,IdempotentParameterMismatchException.prototype),this.Message=e.Message}}class TransactionInProgressException extends DynamoDBServiceException{name="TransactionInProgressException";$fault="client";Message;constructor(e){super({name:"TransactionInProgressException",$fault:"client",...e}),Object.setPrototypeOf(this,TransactionInProgressException.prototype),this.Message=e.Message}}class ExportConflictException extends DynamoDBServiceException{name="ExportConflictException";$fault="client";constructor(e){super({name:"ExportConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,ExportConflictException.prototype)}}class InvalidExportTimeException extends DynamoDBServiceException{name="InvalidExportTimeException";$fault="client";constructor(e){super({name:"InvalidExportTimeException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidExportTimeException.prototype)}}class PointInTimeRecoveryUnavailableException extends DynamoDBServiceException{name="PointInTimeRecoveryUnavailableException";$fault="client";constructor(e){super({name:"PointInTimeRecoveryUnavailableException",$fault:"client",...e}),Object.setPrototypeOf(this,PointInTimeRecoveryUnavailableException.prototype)}}class ImportConflictException extends DynamoDBServiceException{name="ImportConflictException";$fault="client";constructor(e){super({name:"ImportConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,ImportConflictException.prototype)}}class TableAlreadyExistsException extends DynamoDBServiceException{name="TableAlreadyExistsException";$fault="client";constructor(e){super({name:"TableAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,TableAlreadyExistsException.prototype)}}class InvalidRestoreTimeException extends DynamoDBServiceException{name="InvalidRestoreTimeException";$fault="client";constructor(e){super({name:"InvalidRestoreTimeException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidRestoreTimeException.prototype)}}class ReplicaAlreadyExistsException extends DynamoDBServiceException{name="ReplicaAlreadyExistsException";$fault="client";constructor(e){super({name:"ReplicaAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,ReplicaAlreadyExistsException.prototype)}}class ReplicaNotFoundException extends DynamoDBServiceException{name="ReplicaNotFoundException";$fault="client";constructor(e){super({name:"ReplicaNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ReplicaNotFoundException.prototype)}}class IndexNotFoundException extends DynamoDBServiceException{name="IndexNotFoundException";$fault="client";constructor(e){super({name:"IndexNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,IndexNotFoundException.prototype)}}var AttributeValue;!function(e){e.visit=(e,t)=>void 0!==e.S?t.S(e.S):void 0!==e.N?t.N(e.N):void 0!==e.B?t.B(e.B):void 0!==e.SS?t.SS(e.SS):void 0!==e.NS?t.NS(e.NS):void 0!==e.BS?t.BS(e.BS):void 0!==e.M?t.M(e.M):void 0!==e.L?t.L(e.L):void 0!==e.NULL?t.NULL(e.NULL):void 0!==e.BOOL?t.BOOL(e.BOOL):t._(e.$unknown[0],e.$unknown[1])}(AttributeValue||(AttributeValue={}));class ConditionalCheckFailedException extends DynamoDBServiceException{name="ConditionalCheckFailedException";$fault="client";Item;constructor(e){super({name:"ConditionalCheckFailedException",$fault:"client",...e}),Object.setPrototypeOf(this,ConditionalCheckFailedException.prototype),this.Item=e.Item}}class TransactionCanceledException extends DynamoDBServiceException{name="TransactionCanceledException";$fault="client";Message;CancellationReasons;constructor(e){super({name:"TransactionCanceledException",$fault:"client",...e}),Object.setPrototypeOf(this,TransactionCanceledException.prototype),this.Message=e.Message,this.CancellationReasons=e.CancellationReasons}}const se_BatchWriteItemCommand=async(e,t)=>{const n=sharedHeaders$2("BatchWriteItem");let i;return i=JSON.stringify(se_BatchWriteItemInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_DeleteItemCommand=async(e,t)=>{const n=sharedHeaders$2("DeleteItem");let i;return i=JSON.stringify(se_DeleteItemInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_DescribeEndpointsCommand=async(e,t)=>{const n=sharedHeaders$2("DescribeEndpoints");let i;return i=JSON.stringify(_json(e)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_GetItemCommand=async(e,t)=>{const n=sharedHeaders$2("GetItem");let i;return i=JSON.stringify(se_GetItemInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_PutItemCommand=async(e,t)=>{const n=sharedHeaders$2("PutItem");let i;return i=JSON.stringify(se_PutItemInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_QueryCommand=async(e,t)=>{const n=sharedHeaders$2("Query");let i;return i=JSON.stringify(se_QueryInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_ScanCommand=async(e,t)=>{const n=sharedHeaders$2("Scan");let i;return i=JSON.stringify(se_ScanInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},se_UpdateItemCommand=async(e,t)=>{const n=sharedHeaders$2("UpdateItem");let i;return i=JSON.stringify(se_UpdateItemInput(e,t)),buildHttpRpcRequest$2(t,n,"/",void 0,i)},de_BatchWriteItemCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_BatchWriteItemOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_DeleteItemCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_DeleteItemOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_DescribeEndpointsCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=_json(n);return{$metadata:deserializeMetadata$3(e),...i}},de_GetItemCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_GetItemOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_PutItemCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_PutItemOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_QueryCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_QueryOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_ScanCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_ScanOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_UpdateItemCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$3(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_UpdateItemOutput(n,t);return{$metadata:deserializeMetadata$3(e),...i}},de_CommandError$3=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},i=loadRestJsonErrorCode$1(e,n.body);switch(i){case"InternalServerError":case"com.amazonaws.dynamodb#InternalServerError":throw await de_InternalServerErrorRes$1(n);case"RequestLimitExceeded":case"com.amazonaws.dynamodb#RequestLimitExceeded":throw await de_RequestLimitExceededRes(n);case"ThrottlingException":case"com.amazonaws.dynamodb#ThrottlingException":throw await de_ThrottlingExceptionRes$1(n);case"InvalidEndpointException":case"com.amazonaws.dynamodb#InvalidEndpointException":throw await de_InvalidEndpointExceptionRes(n);case"ProvisionedThroughputExceededException":case"com.amazonaws.dynamodb#ProvisionedThroughputExceededException":throw await de_ProvisionedThroughputExceededExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.dynamodb#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes$3(n);case"ItemCollectionSizeLimitExceededException":case"com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException":throw await de_ItemCollectionSizeLimitExceededExceptionRes(n);case"ReplicatedWriteConflictException":case"com.amazonaws.dynamodb#ReplicatedWriteConflictException":throw await de_ReplicatedWriteConflictExceptionRes(n);case"BackupInUseException":case"com.amazonaws.dynamodb#BackupInUseException":throw await de_BackupInUseExceptionRes(n);case"ContinuousBackupsUnavailableException":case"com.amazonaws.dynamodb#ContinuousBackupsUnavailableException":throw await de_ContinuousBackupsUnavailableExceptionRes(n);case"LimitExceededException":case"com.amazonaws.dynamodb#LimitExceededException":throw await de_LimitExceededExceptionRes(n);case"TableInUseException":case"com.amazonaws.dynamodb#TableInUseException":throw await de_TableInUseExceptionRes(n);case"TableNotFoundException":case"com.amazonaws.dynamodb#TableNotFoundException":throw await de_TableNotFoundExceptionRes(n);case"GlobalTableAlreadyExistsException":case"com.amazonaws.dynamodb#GlobalTableAlreadyExistsException":throw await de_GlobalTableAlreadyExistsExceptionRes(n);case"ResourceInUseException":case"com.amazonaws.dynamodb#ResourceInUseException":throw await de_ResourceInUseExceptionRes$2(n);case"BackupNotFoundException":case"com.amazonaws.dynamodb#BackupNotFoundException":throw await de_BackupNotFoundExceptionRes(n);case"ConditionalCheckFailedException":case"com.amazonaws.dynamodb#ConditionalCheckFailedException":throw await de_ConditionalCheckFailedExceptionRes(n,t);case"TransactionConflictException":case"com.amazonaws.dynamodb#TransactionConflictException":throw await de_TransactionConflictExceptionRes(n);case"PolicyNotFoundException":case"com.amazonaws.dynamodb#PolicyNotFoundException":throw await de_PolicyNotFoundExceptionRes(n);case"ExportNotFoundException":case"com.amazonaws.dynamodb#ExportNotFoundException":throw await de_ExportNotFoundExceptionRes(n);case"GlobalTableNotFoundException":case"com.amazonaws.dynamodb#GlobalTableNotFoundException":throw await de_GlobalTableNotFoundExceptionRes(n);case"ImportNotFoundException":case"com.amazonaws.dynamodb#ImportNotFoundException":throw await de_ImportNotFoundExceptionRes(n);case"DuplicateItemException":case"com.amazonaws.dynamodb#DuplicateItemException":throw await de_DuplicateItemExceptionRes(n);case"IdempotentParameterMismatchException":case"com.amazonaws.dynamodb#IdempotentParameterMismatchException":throw await de_IdempotentParameterMismatchExceptionRes(n);case"TransactionCanceledException":case"com.amazonaws.dynamodb#TransactionCanceledException":throw await de_TransactionCanceledExceptionRes(n,t);case"TransactionInProgressException":case"com.amazonaws.dynamodb#TransactionInProgressException":throw await de_TransactionInProgressExceptionRes(n);case"ExportConflictException":case"com.amazonaws.dynamodb#ExportConflictException":throw await de_ExportConflictExceptionRes(n);case"InvalidExportTimeException":case"com.amazonaws.dynamodb#InvalidExportTimeException":throw await de_InvalidExportTimeExceptionRes(n);case"PointInTimeRecoveryUnavailableException":case"com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException":throw await de_PointInTimeRecoveryUnavailableExceptionRes(n);case"ImportConflictException":case"com.amazonaws.dynamodb#ImportConflictException":throw await de_ImportConflictExceptionRes(n);case"TableAlreadyExistsException":case"com.amazonaws.dynamodb#TableAlreadyExistsException":throw await de_TableAlreadyExistsExceptionRes(n);case"InvalidRestoreTimeException":case"com.amazonaws.dynamodb#InvalidRestoreTimeException":throw await de_InvalidRestoreTimeExceptionRes(n);case"ReplicaAlreadyExistsException":case"com.amazonaws.dynamodb#ReplicaAlreadyExistsException":throw await de_ReplicaAlreadyExistsExceptionRes(n);case"ReplicaNotFoundException":case"com.amazonaws.dynamodb#ReplicaNotFoundException":throw await de_ReplicaNotFoundExceptionRes(n);case"IndexNotFoundException":case"com.amazonaws.dynamodb#IndexNotFoundException":throw await de_IndexNotFoundExceptionRes(n);default:const r=n.body;return throwDefaultError$3({output:e,parsedBody:r,errorCode:i})}},de_BackupInUseExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new BackupInUseException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_BackupNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new BackupNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ConditionalCheckFailedExceptionRes=async(e,t)=>{const n=e.body,i=de_ConditionalCheckFailedException(n,t),r=new ConditionalCheckFailedException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ContinuousBackupsUnavailableExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ContinuousBackupsUnavailableException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_DuplicateItemExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DuplicateItemException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ExportConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ExportConflictException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ExportNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ExportNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_GlobalTableAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new GlobalTableAlreadyExistsException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_GlobalTableNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new GlobalTableNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_IdempotentParameterMismatchExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new IdempotentParameterMismatchException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ImportConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ImportConflictException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ImportNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ImportNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_IndexNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new IndexNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_InternalServerErrorRes$1=async(e,t)=>{const n=e.body,i=_json(n),r=new InternalServerError$1({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_InvalidEndpointExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidEndpointException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_InvalidExportTimeExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidExportTimeException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_InvalidRestoreTimeExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidRestoreTimeException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ItemCollectionSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ItemCollectionSizeLimitExceededException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_LimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new LimitExceededException$2({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_PointInTimeRecoveryUnavailableExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new PointInTimeRecoveryUnavailableException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_PolicyNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new PolicyNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ProvisionedThroughputExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ProvisionedThroughputExceededException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ReplicaAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ReplicaAlreadyExistsException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ReplicaNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ReplicaNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ReplicatedWriteConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ReplicatedWriteConflictException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_RequestLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new RequestLimitExceeded({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ResourceInUseExceptionRes$2=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceInUseException$2({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ResourceNotFoundExceptionRes$3=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceNotFoundException$3({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_TableAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TableAlreadyExistsException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_TableInUseExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TableInUseException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_TableNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TableNotFoundException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_ThrottlingExceptionRes$1=async(e,t)=>{const n=e.body,i=_json(n),r=new ThrottlingException$1({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_TransactionCanceledExceptionRes=async(e,t)=>{const n=e.body,i=de_TransactionCanceledException(n,t),r=new TransactionCanceledException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_TransactionConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TransactionConflictException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},de_TransactionInProgressExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TransactionInProgressException({$metadata:deserializeMetadata$3(e),...i});return decorateServiceException$1(r,n)},se_AttributeUpdates=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_AttributeValueUpdate(i,t)),e),{}),se_AttributeValue=(e,t)=>AttributeValue.visit(e,{B:e=>({B:t.base64Encoder(e)}),BOOL:e=>({BOOL:e}),BS:e=>({BS:se_BinarySetAttributeValue(e,t)}),L:e=>({L:se_ListAttributeValue(e,t)}),M:e=>({M:se_MapAttributeValue(e,t)}),N:e=>({N:e}),NS:e=>({NS:_json(e)}),NULL:e=>({NULL:e}),S:e=>({S:e}),SS:e=>({SS:_json(e)}),_:(e,t)=>({[e]:t})}),se_AttributeValueList=(e,t)=>e.filter(e=>null!=e).map(e=>se_AttributeValue(e,t)),se_AttributeValueUpdate=(e,t)=>take(e,{Action:[],Value:e=>se_AttributeValue(e,t)}),se_BatchWriteItemInput=(e,t)=>take(e,{RequestItems:e=>se_BatchWriteItemRequestMap(e,t),ReturnConsumedCapacity:[],ReturnItemCollectionMetrics:[]}),se_BatchWriteItemRequestMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_WriteRequests(i,t)),e),{}),se_BinarySetAttributeValue=(e,t)=>e.filter(e=>null!=e).map(e=>t.base64Encoder(e)),se_Condition=(e,t)=>take(e,{AttributeValueList:e=>se_AttributeValueList(e,t),ComparisonOperator:[]}),se_DeleteItemInput=(e,t)=>take(e,{ConditionExpression:[],ConditionalOperator:[],Expected:e=>se_ExpectedAttributeMap(e,t),ExpressionAttributeNames:_json,ExpressionAttributeValues:e=>se_ExpressionAttributeValueMap(e,t),Key:e=>se_Key(e,t),ReturnConsumedCapacity:[],ReturnItemCollectionMetrics:[],ReturnValues:[],ReturnValuesOnConditionCheckFailure:[],TableName:[]}),se_DeleteRequest=(e,t)=>take(e,{Key:e=>se_Key(e,t)}),se_ExpectedAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_ExpectedAttributeValue(i,t)),e),{}),se_ExpectedAttributeValue=(e,t)=>take(e,{AttributeValueList:e=>se_AttributeValueList(e,t),ComparisonOperator:[],Exists:[],Value:e=>se_AttributeValue(e,t)}),se_ExpressionAttributeValueMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_AttributeValue(i,t)),e),{}),se_FilterConditionMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_Condition(i,t)),e),{}),se_GetItemInput=(e,t)=>take(e,{AttributesToGet:_json,ConsistentRead:[],ExpressionAttributeNames:_json,Key:e=>se_Key(e,t),ProjectionExpression:[],ReturnConsumedCapacity:[],TableName:[]}),se_Key=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_AttributeValue(i,t)),e),{}),se_KeyConditions=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_Condition(i,t)),e),{}),se_ListAttributeValue=(e,t)=>e.filter(e=>null!=e).map(e=>se_AttributeValue(e,t)),se_MapAttributeValue=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_AttributeValue(i,t)),e),{}),se_PutItemInput=(e,t)=>take(e,{ConditionExpression:[],ConditionalOperator:[],Expected:e=>se_ExpectedAttributeMap(e,t),ExpressionAttributeNames:_json,ExpressionAttributeValues:e=>se_ExpressionAttributeValueMap(e,t),Item:e=>se_PutItemInputAttributeMap(e,t),ReturnConsumedCapacity:[],ReturnItemCollectionMetrics:[],ReturnValues:[],ReturnValuesOnConditionCheckFailure:[],TableName:[]}),se_PutItemInputAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_AttributeValue(i,t)),e),{}),se_PutRequest=(e,t)=>take(e,{Item:e=>se_PutItemInputAttributeMap(e,t)}),se_QueryInput=(e,t)=>take(e,{AttributesToGet:_json,ConditionalOperator:[],ConsistentRead:[],ExclusiveStartKey:e=>se_Key(e,t),ExpressionAttributeNames:_json,ExpressionAttributeValues:e=>se_ExpressionAttributeValueMap(e,t),FilterExpression:[],IndexName:[],KeyConditionExpression:[],KeyConditions:e=>se_KeyConditions(e,t),Limit:[],ProjectionExpression:[],QueryFilter:e=>se_FilterConditionMap(e,t),ReturnConsumedCapacity:[],ScanIndexForward:[],Select:[],TableName:[]}),se_ScanInput=(e,t)=>take(e,{AttributesToGet:_json,ConditionalOperator:[],ConsistentRead:[],ExclusiveStartKey:e=>se_Key(e,t),ExpressionAttributeNames:_json,ExpressionAttributeValues:e=>se_ExpressionAttributeValueMap(e,t),FilterExpression:[],IndexName:[],Limit:[],ProjectionExpression:[],ReturnConsumedCapacity:[],ScanFilter:e=>se_FilterConditionMap(e,t),Segment:[],Select:[],TableName:[],TotalSegments:[]}),se_UpdateItemInput=(e,t)=>take(e,{AttributeUpdates:e=>se_AttributeUpdates(e,t),ConditionExpression:[],ConditionalOperator:[],Expected:e=>se_ExpectedAttributeMap(e,t),ExpressionAttributeNames:_json,ExpressionAttributeValues:e=>se_ExpressionAttributeValueMap(e,t),Key:e=>se_Key(e,t),ReturnConsumedCapacity:[],ReturnItemCollectionMetrics:[],ReturnValues:[],ReturnValuesOnConditionCheckFailure:[],TableName:[],UpdateExpression:[]}),se_WriteRequest=(e,t)=>take(e,{DeleteRequest:e=>se_DeleteRequest(e,t),PutRequest:e=>se_PutRequest(e,t)}),se_WriteRequests=(e,t)=>e.filter(e=>null!=e).map(e=>se_WriteRequest(e,t)),de_AttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_AttributeValue(awsExpectUnion(i),t)),e),{}),de_AttributeValue=(e,t)=>null!=e.B?{B:t.base64Decoder(e.B)}:void 0!==expectBoolean(e.BOOL)?{BOOL:expectBoolean(e.BOOL)}:null!=e.BS?{BS:de_BinarySetAttributeValue(e.BS,t)}:null!=e.L?{L:de_ListAttributeValue(e.L,t)}:null!=e.M?{M:de_MapAttributeValue(e.M,t)}:void 0!==expectString(e.N)?{N:expectString(e.N)}:null!=e.NS?{NS:_json(e.NS)}:void 0!==expectBoolean(e.NULL)?{NULL:expectBoolean(e.NULL)}:void 0!==expectString(e.S)?{S:expectString(e.S)}:null!=e.SS?{SS:_json(e.SS)}:{$unknown:Object.entries(e)[0]},de_BatchWriteItemOutput=(e,t)=>take(e,{ConsumedCapacity:e=>de_ConsumedCapacityMultiple(e),ItemCollectionMetrics:e=>de_ItemCollectionMetricsPerTable(e,t),UnprocessedItems:e=>de_BatchWriteItemRequestMap(e,t)}),de_BatchWriteItemRequestMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_WriteRequests(i,t)),e),{}),de_BinarySetAttributeValue=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>t.base64Decoder(e));return n},de_CancellationReason=(e,t)=>take(e,{Code:expectString,Item:e=>de_AttributeMap(e,t),Message:expectString}),de_CancellationReasonList=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_CancellationReason(e,t));return n},de_Capacity=(e,t)=>take(e,{CapacityUnits:limitedParseDouble,ReadCapacityUnits:limitedParseDouble,WriteCapacityUnits:limitedParseDouble}),de_ConditionalCheckFailedException=(e,t)=>take(e,{Item:e=>de_AttributeMap(e,t),message:expectString}),de_ConsumedCapacity=(e,t)=>take(e,{CapacityUnits:limitedParseDouble,GlobalSecondaryIndexes:e=>de_SecondaryIndexesCapacityMap(e),LocalSecondaryIndexes:e=>de_SecondaryIndexesCapacityMap(e),ReadCapacityUnits:limitedParseDouble,Table:e=>de_Capacity(e),TableName:expectString,WriteCapacityUnits:limitedParseDouble}),de_ConsumedCapacityMultiple=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_ConsumedCapacity(e));return n},de_DeleteItemOutput=(e,t)=>take(e,{Attributes:e=>de_AttributeMap(e,t),ConsumedCapacity:e=>de_ConsumedCapacity(e),ItemCollectionMetrics:e=>de_ItemCollectionMetrics(e,t)}),de_DeleteRequest=(e,t)=>take(e,{Key:e=>de_Key(e,t)}),de_GetItemOutput=(e,t)=>take(e,{ConsumedCapacity:e=>de_ConsumedCapacity(e),Item:e=>de_AttributeMap(e,t)}),de_ItemCollectionKeyAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_AttributeValue(awsExpectUnion(i),t)),e),{}),de_ItemCollectionMetrics=(e,t)=>take(e,{ItemCollectionKey:e=>de_ItemCollectionKeyAttributeMap(e,t),SizeEstimateRangeGB:e=>de_ItemCollectionSizeEstimateRange(e)}),de_ItemCollectionMetricsMultiple=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_ItemCollectionMetrics(e,t));return n},de_ItemCollectionMetricsPerTable=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_ItemCollectionMetricsMultiple(i,t)),e),{}),de_ItemCollectionSizeEstimateRange=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>limitedParseDouble(e));return n},de_ItemList=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_AttributeMap(e,t));return n},de_Key=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_AttributeValue(awsExpectUnion(i),t)),e),{}),de_ListAttributeValue=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_AttributeValue(awsExpectUnion(e),t));return n},de_MapAttributeValue=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_AttributeValue(awsExpectUnion(i),t)),e),{}),de_PutItemInputAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_AttributeValue(awsExpectUnion(i),t)),e),{}),de_PutItemOutput=(e,t)=>take(e,{Attributes:e=>de_AttributeMap(e,t),ConsumedCapacity:e=>de_ConsumedCapacity(e),ItemCollectionMetrics:e=>de_ItemCollectionMetrics(e,t)}),de_PutRequest=(e,t)=>take(e,{Item:e=>de_PutItemInputAttributeMap(e,t)}),de_QueryOutput=(e,t)=>take(e,{ConsumedCapacity:e=>de_ConsumedCapacity(e),Count:expectInt32,Items:e=>de_ItemList(e,t),LastEvaluatedKey:e=>de_Key(e,t),ScannedCount:expectInt32}),de_ScanOutput=(e,t)=>take(e,{ConsumedCapacity:e=>de_ConsumedCapacity(e),Count:expectInt32,Items:e=>de_ItemList(e,t),LastEvaluatedKey:e=>de_Key(e,t),ScannedCount:expectInt32}),de_SecondaryIndexesCapacityMap=(e,t)=>Object.entries(e).reduce((e,[t,n])=>(null===n||(e[t]=de_Capacity(n)),e),{}),de_TransactionCanceledException=(e,t)=>take(e,{CancellationReasons:e=>de_CancellationReasonList(e,t),Message:expectString}),de_UpdateItemOutput=(e,t)=>take(e,{Attributes:e=>de_AttributeMap(e,t),ConsumedCapacity:e=>de_ConsumedCapacity(e),ItemCollectionMetrics:e=>de_ItemCollectionMetrics(e,t)}),de_WriteRequest=(e,t)=>take(e,{DeleteRequest:e=>de_DeleteRequest(e,t),PutRequest:e=>de_PutRequest(e,t)}),de_WriteRequests=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_WriteRequest(e,t));return n},deserializeMetadata$3=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"]}),throwDefaultError$3=withBaseException(DynamoDBServiceException),buildHttpRpcRequest$2=async(e,t,n,i,r)=>{const{hostname:o,protocol:a="https",port:s,path:c}=await e.endpoint(),l={protocol:a,hostname:o,port:s,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==r&&(l.body=r),new HttpRequest$2(l)};function sharedHeaders$2(e){return{"content-type":"application/x-amz-json-1.0","x-amz-target":`DynamoDB_20120810.${e}`}}class DescribeEndpointsCommand extends(Command$1.classBuilder().ep(commonParams$4).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","DescribeEndpoints",{}).n("DynamoDBClient","DescribeEndpointsCommand").f(void 0,void 0).ser(se_DescribeEndpointsCommand).de(de_DescribeEndpointsCommand).build()){}const version$7="3.926.0";var packageInfo$4={version:version$7};const fromUtf8$1=e=>(new TextEncoder).encode(e);var fromUtf8="undefined"!=typeof Buffer&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:fromUtf8$1;function convertToBuffer$1(e){return e instanceof Uint8Array?e:"string"==typeof e?fromUtf8(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function isEmptyData$1(e){return"string"==typeof e?0===e.length:0===e.byteLength}function uint32ArrayFrom(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}var SHA_256_HASH={name:"SHA-256"},SHA_256_HMAC_ALGO={name:"HMAC",hash:SHA_256_HASH},EMPTY_DATA_SHA_256=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]);const fallbackWindow={};function locateWindow(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:fallbackWindow}var Sha256$2=function(){function e(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return e.prototype.update=function(e){if(!isEmptyData$1(e)){var t=convertToBuffer$1(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return locateWindow().crypto.subtle.sign(SHA_256_HMAC_ALGO,t,e.toHash).then(function(e){return new Uint8Array(e)})}):isEmptyData$1(this.toHash)?Promise.resolve(EMPTY_DATA_SHA_256):Promise.resolve().then(function(){return locateWindow().crypto.subtle.digest(SHA_256_HASH,e.toHash)}).then(function(e){return Promise.resolve(new Uint8Array(e))})},e.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&void 0!==this.secret&&(this.key=new Promise(function(t,n){locateWindow().crypto.subtle.importKey("raw",convertToBuffer$1(e.secret),SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)}),this.key.catch(function(){}))},e}();function __awaiter(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((i=i.apply(e,t||[])).next())})}function __generator(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function __values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var BLOCK_SIZE$1=64,DIGEST_LENGTH$1=32,KEY=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]),INIT$1=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],MAX_HASHABLE_LENGTH=Math.pow(2,53)-1,RawSha256=function(){function e(){this.state=Int32Array.from(INIT$1),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===BLOCK_SIZE$1&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%BLOCK_SIZE$1>=BLOCK_SIZE$1-8){for(var i=this.bufferLength;i<BLOCK_SIZE$1;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(i=this.bufferLength;i<BLOCK_SIZE$1-8;i++)t.setUint8(i,0);t.setUint32(BLOCK_SIZE$1-8,Math.floor(e/4294967296),!0),t.setUint32(BLOCK_SIZE$1-4,e),this.hashBuffer(),this.finished=!0}var r=new Uint8Array(DIGEST_LENGTH$1);for(i=0;i<8;i++)r[4*i]=this.state[i]>>>24&255,r[4*i+1]=this.state[i]>>>16&255,r[4*i+2]=this.state[i]>>>8&255,r[4*i+3]=this.state[i]>>>0&255;return r},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],i=t[1],r=t[2],o=t[3],a=t[4],s=t[5],c=t[6],l=t[7],d=0;d<BLOCK_SIZE$1;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var u=this.temp[d-2],p=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,m=((u=this.temp[d-15])>>>7|u<<25)^(u>>>18|u<<14)^u>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(m+this.temp[d-16]|0)}var h=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&s^~a&c)|0)+(l+(KEY[d]+this.temp[d]|0)|0)|0,f=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&r^i&r)|0;l=c,c=s,s=a,a=o+h|0,o=r,r=i,i=n,n=h+f|0}t[0]+=n,t[1]+=i,t[2]+=r,t[3]+=o,t[4]+=a,t[5]+=s,t[6]+=c,t[7]+=l},e}(),Sha256$1=function(){function e(e){this.secret=e,this.hash=new RawSha256,this.reset()}return e.prototype.update=function(e){if(!isEmptyData$1(e)&&!this.error)try{this.hash.update(convertToBuffer$1(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new RawSha256,this.secret){this.outer=new RawSha256;var e=bufferFromSecret(this.secret),t=new Uint8Array(BLOCK_SIZE$1);t.set(e);for(var n=0;n<BLOCK_SIZE$1;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(n=0;n<e.byteLength;n++)e[n]=0}},e}();function bufferFromSecret(e){var t=convertToBuffer$1(e);if(t.byteLength>BLOCK_SIZE$1){var n=new RawSha256;n.update(t),t=n.digest()}var i=new Uint8Array(BLOCK_SIZE$1);return i.set(t),i}var subtleCryptoMethods=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function supportsWebCrypto(e){return!(!supportsSecureRandom(e)||"object"!=typeof e.crypto.subtle)&&supportsSubtleCrypto(e.crypto.subtle)}function supportsSecureRandom(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function supportsSubtleCrypto(e){return e&&subtleCryptoMethods.every(function(t){return"function"==typeof e[t]})}var Sha256=function(){function e(e){supportsWebCrypto(locateWindow())?this.hash=new Sha256$2(e):this.hash=new Sha256$1(e)}return e.prototype.update=function(e,t){this.hash.update(convertToBuffer$1(e))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();const createDefaultUserAgentProvider$1=({serviceId:e,clientVersion:t})=>async n=>{const i="undefined"!=typeof window?window.navigator:void 0,r=i?.userAgent??"",o=i?.userAgentData?.platform??fallback$1.os(r)??"other",a=i?.userAgentData?.brands??[],s=a[a.length-1],c=s?.brand??fallback$1.browser(r)??"unknown",l=[["aws-sdk-js",t],["ua","2.1"],[`os/${o}`,undefined],["lang/js"],["md/browser",`${c}_${s?.version??"unknown"}`]];e&&l.push([`api/${e}`,t]);const d=await(n?.userAgentAppId?.());return d&&l.push([`app/${d}`]),l},fallback$1={os:e=>/iPhone|iPad|iPod/.test(e)?"iOS":/Macintosh|Mac OS X/.test(e)?"macOS":/Windows NT/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":void 0,browser:e=>/EdgiOS|EdgA|Edg\//.test(e)?"Microsoft Edge":/Firefox\//.test(e)?"Firefox":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)?"Safari":void 0},invalidProvider$1=e=>()=>Promise.reject(e),K="required",L="type",M="rules",N="conditions",O="fn",P="argv",Q="ref",R="assign",S="url",T="properties",U="headers",V="metricValues",a$4=!1,b$4="error",c$4="stringEquals",d$4="https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",e$4="endpoint",f$4="tree",g$4="dynamodb",h$4={[K]:!1,[L]:"string"},i$4={[K]:!0,default:!1,[L]:"boolean"},j$4={[O]:"isSet",[P]:[{[Q]:"Endpoint"}]},k$4={[Q]:"Endpoint"},l$4={[O]:"isSet",[P]:[{[Q]:"Region"}]},m$4={[Q]:"Region"},n$4={[O]:"aws.partition",[P]:[m$4],[R]:"PartitionResult"},o$4={[N]:[{[O]:"booleanEquals",[P]:[{[Q]:"UseFIPS"},!0]}],[b$4]:"Invalid Configuration: FIPS and custom endpoint are not supported",[L]:b$4},p$4={[O]:"booleanEquals",[P]:[{[Q]:"UseFIPS"},!0]},q$4={[N]:[{[O]:"booleanEquals",[P]:[{[Q]:"UseDualStack"},!0]}],[b$4]:"Invalid Configuration: Dualstack and custom endpoint are not supported",[L]:b$4},r$4={[O]:"booleanEquals",[P]:[{[Q]:"UseDualStack"},!0]},s$4={[e$4]:{[S]:"{Endpoint}",[T]:{},[U]:{}},[L]:e$4},t$4={},u$4={[O]:"booleanEquals",[P]:[{[O]:"getAttr",[P]:[{[Q]:"PartitionResult"},"supportsFIPS"]},!0]},v$4={[O]:"booleanEquals",[P]:[{[O]:"getAttr",[P]:[{[Q]:"PartitionResult"},"supportsDualStack"]},!0]},w$3={[N]:[{[O]:"isSet",[P]:[{[Q]:"AccountIdEndpointMode"}]},{[O]:c$4,[P]:[{[Q]:"AccountIdEndpointMode"},"required"]}],[M]:[{[b$4]:"Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported",[L]:b$4}],[L]:f$4},x$3={[O]:"getAttr",[P]:[{[Q]:"PartitionResult"},"name"]},y$1={[e$4]:{[S]:"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",[T]:{},[U]:{}},[L]:e$4},z$1={[S]:"https://{ParsedArn#accountId}.ddb.{Region}.{PartitionResult#dualStackDnsSuffix}",[T]:{[V]:["O"]},[U]:{}},A$1={[V]:["O"]},B$1={[b$4]:"Credentials-sourced account ID parameter is invalid",[L]:b$4},C$1={[N]:[{[O]:"isSet",[P]:[{[Q]:"AccountIdEndpointMode"}]},{[O]:c$4,[P]:[{[Q]:"AccountIdEndpointMode"},"required"]}],[M]:[{[N]:[{[O]:"not",[P]:[p$4]}],[M]:[{[N]:[{[O]:c$4,[P]:[x$3,"aws"]}],[M]:[{[b$4]:"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded",[L]:b$4}],[L]:f$4},{[b$4]:"Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition",[L]:b$4}],[L]:f$4},{[b$4]:"Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported",[L]:b$4}],[L]:f$4},D$1={[S]:"https://{ParsedArn#accountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[T]:A$1,[U]:{}},E=[p$4],F=[r$4],G=[{[O]:"isSet",[P]:[{[Q]:"AccountIdEndpointMode"}]},{[O]:"not",[P]:[{[O]:c$4,[P]:[{[Q]:"AccountIdEndpointMode"},"disabled"]}]},{[O]:c$4,[P]:[x$3,"aws"]},{[O]:"not",[P]:[p$4]},{[O]:"isSet",[P]:[{[Q]:"ResourceArn"}]},{[O]:"aws.parseArn",[P]:[{[Q]:"ResourceArn"}],[R]:"ParsedArn"},{[O]:c$4,[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"service"]},g$4]},{[O]:"isValidHostLabel",[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"region"]},!1]},{[O]:c$4,[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"region"]},"{Region}"]},{[O]:"isValidHostLabel",[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"accountId"]},!1]}],H=[{[O]:"isSet",[P]:[{[Q]:"AccountIdEndpointMode"}]},{[O]:"not",[P]:[{[O]:c$4,[P]:[{[Q]:"AccountIdEndpointMode"},"disabled"]}]},{[O]:c$4,[P]:[x$3,"aws"]},{[O]:"not",[P]:[p$4]},{[O]:"isSet",[P]:[{[Q]:"ResourceArnList"}]},{[O]:"getAttr",[P]:[{[Q]:"ResourceArnList"},"[0]"],[R]:"FirstArn"},{[O]:"aws.parseArn",[P]:[{[Q]:"FirstArn"}],[R]:"ParsedArn"},{[O]:c$4,[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"service"]},g$4]},{[O]:"isValidHostLabel",[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"region"]},!1]},{[O]:c$4,[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"region"]},"{Region}"]},{[O]:"isValidHostLabel",[P]:[{[O]:"getAttr",[P]:[{[Q]:"ParsedArn"},"accountId"]},!1]}],I=[{[O]:"isSet",[P]:[{[Q]:"AccountIdEndpointMode"}]},{[O]:"not",[P]:[{[O]:c$4,[P]:[{[Q]:"AccountIdEndpointMode"},"disabled"]}]},{[O]:c$4,[P]:[x$3,"aws"]},{[O]:"not",[P]:[p$4]},{[O]:"isSet",[P]:[{[Q]:"AccountId"}]}],J=[{[O]:"isValidHostLabel",[P]:[{[Q]:"AccountId"},!1]}],_data$4={parameters:{Region:h$4,UseDualStack:i$4,UseFIPS:i$4,Endpoint:h$4,AccountId:h$4,AccountIdEndpointMode:h$4,ResourceArn:h$4,ResourceArnList:{[K]:a$4,[L]:"stringArray"}},[M]:[{[N]:[j$4,l$4,n$4],[M]:[o$4,q$4,{[N]:[{[O]:c$4,[P]:[k$4,d$4]}],error:"Endpoint override is not supported for dual-stack endpoints. Please enable dual-stack functionality by enabling the configuration. For more details, see: https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoints.html",[L]:b$4},s$4],[L]:f$4},{[N]:[j$4],[M]:[o$4,q$4,s$4],[L]:f$4},{[N]:[l$4],[M]:[{[N]:[n$4],[M]:[{[N]:[{[O]:c$4,[P]:[m$4,"local"]}],[M]:[{[N]:E,error:"Invalid Configuration: FIPS and local endpoint are not supported",[L]:b$4},{[N]:F,error:"Invalid Configuration: Dualstack and local endpoint are not supported",[L]:b$4},{endpoint:{[S]:"http://localhost:8000",[T]:{authSchemes:[{name:"sigv4",signingName:g$4,signingRegion:"us-east-1"}]},[U]:t$4},[L]:e$4}],[L]:f$4},{[N]:[p$4,r$4],[M]:[{[N]:[u$4,v$4],[M]:[w$3,{endpoint:{[S]:"https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[T]:t$4,[U]:t$4},[L]:e$4}],[L]:f$4},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[L]:b$4}],[L]:f$4},{[N]:E,[M]:[{[N]:[u$4],[M]:[{[N]:[{[O]:c$4,[P]:[x$3,"aws-us-gov"]}],[M]:[w$3,y$1],[L]:f$4},w$3,{endpoint:{[S]:"https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",[T]:t$4,[U]:t$4},[L]:e$4}],[L]:f$4},{error:"FIPS is enabled but this partition does not support FIPS",[L]:b$4}],[L]:f$4},{[N]:F,[M]:[{[N]:[v$4],[M]:[{[N]:G,endpoint:z$1,[L]:e$4},{[N]:H,endpoint:z$1,[L]:e$4},{[N]:I,[M]:[{[N]:J,[M]:[{endpoint:{[S]:"https://{AccountId}.ddb.{Region}.{PartitionResult#dualStackDnsSuffix}",[T]:A$1,[U]:t$4},[L]:e$4}],[L]:f$4},B$1],[L]:f$4},C$1,{endpoint:{[S]:d$4,[T]:t$4,[U]:t$4},[L]:e$4}],[L]:f$4},{error:"DualStack is enabled but this partition does not support DualStack",[L]:b$4}],[L]:f$4},{[N]:G,endpoint:D$1,[L]:e$4},{[N]:H,endpoint:D$1,[L]:e$4},{[N]:I,[M]:[{[N]:J,[M]:[{endpoint:{[S]:"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[T]:A$1,[U]:t$4},[L]:e$4}],[L]:f$4},B$1],[L]:f$4},C$1,y$1],[L]:f$4}],[L]:f$4},{error:"Invalid Configuration: Missing Region",[L]:b$4}]},ruleSet$4=_data$4,cache$4=new EndpointCache$1({size:50,params:["AccountId","AccountIdEndpointMode","Endpoint","Region","ResourceArn","ResourceArnList","UseDualStack","UseFIPS"]}),defaultEndpointResolver$4=(e,t={})=>cache$4.get(e,()=>resolveEndpoint$1(ruleSet$4,{endpointParams:e,logger:t.logger}));customEndpointFunctions$1.aws=awsEndpointFunctions$1;const getRuntimeConfig$9=e=>({apiVersion:"2012-08-10",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver$4,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultDynamoDBHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer$1}],logger:e?.logger??new NoOpLogger$1,serviceId:e?.serviceId??"DynamoDB",urlParser:e?.urlParser??parseUrl$1,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),memoize$1=(e,t,n)=>{let i,r,o,a=!1;return async t=>(o&&!t?.forceRefresh||(i=await(async()=>{r||(r=e());try{i=await r,o=!0,a=!1}finally{r=void 0}return i})()),i)},DEFAULTS_MODE_OPTIONS$1=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig$1=({defaultsMode:e}={})=>memoize$1(async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(useMobileConfiguration$1()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS$1.join(", ")}, got ${t}`)}}),useMobileConfiguration$1=()=>{const e=window?.navigator;if(e?.connection){const{effectiveType:t,rtt:n,downlink:i}=e?.connection;if("string"==typeof t&&"4g"!==t||Number(n)>100||Number(i)<10)return!0}return e?.userAgentData?.mobile||"number"==typeof e?.maxTouchPoints&&e?.maxTouchPoints>1},getRuntimeConfig$8=e=>{const t=resolveDefaultsModeConfig$1(e),n=()=>t().then(loadConfigsForDefaultMode$1),i=getRuntimeConfig$9(e);return{...i,...e,runtime:"browser",defaultsMode:t,accountIdEndpointMode:e?.accountIdEndpointMode??(()=>Promise.resolve(DEFAULT_ACCOUNT_ID_ENDPOINT_MODE)),bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??createDefaultUserAgentProvider$1({serviceId:i.serviceId,clientVersion:packageInfo$4.version}),endpointDiscoveryEnabledProvider:e?.endpointDiscoveryEnabledProvider??(()=>Promise.resolve(void 0)),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS$1,region:e?.region??invalidProvider$1("Region is missing"),requestHandler:FetchHttpHandler$1.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE$1),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector$1,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT$1)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT$1))}},getAwsRegionExtensionConfiguration$1=e=>({setRegion(t){e.region=t},region:()=>e.region}),resolveAwsRegionExtensionConfiguration$1=e=>({region:e.region()}),getHttpAuthExtensionConfiguration$4=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex(t=>t.schemeId===e.schemeId);-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){i=e},credentials:()=>i}},resolveHttpAuthRuntimeConfig$4=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),resolveRuntimeExtensions$4=(e,t)=>{const n=Object.assign(getAwsRegionExtensionConfiguration$1(e),getDefaultExtensionConfiguration$1(e),getHttpHandlerExtensionConfiguration$1(e),getHttpAuthExtensionConfiguration$4(e));return t.forEach(e=>e.configure(n)),Object.assign(e,resolveAwsRegionExtensionConfiguration$1(n),resolveDefaultRuntimeConfig$1(n),resolveHttpHandlerRuntimeConfig$1(n),resolveHttpAuthRuntimeConfig$4(n))};class DynamoDBClient extends Client$1{config;constructor(...[e]){const t=getRuntimeConfig$8(e||{});super(t),this.initConfig=t;const n=resolveClientEndpointParameters$4(t),i=resolveUserAgentConfig$1(resolveAccountIdEndpointModeConfig(n)),r=resolveRetryConfig$1(i),o=resolveHostHeaderConfig$1(resolveRegionConfig$1(r)),a=resolveEndpointConfig$1(o),s=resolveHttpAuthSchemeConfig$4(a),c=resolveEndpointDiscoveryConfig(s,{endpointDiscoveryCommandCtor:DescribeEndpointsCommand}),l=resolveRuntimeExtensions$4(c,e?.extensions||[]);this.config=l,this.middlewareStack.use(getUserAgentPlugin$1(this.config)),this.middlewareStack.use(getRetryPlugin$1(this.config)),this.middlewareStack.use(getContentLengthPlugin$1(this.config)),this.middlewareStack.use(getHostHeaderPlugin$1(this.config)),this.middlewareStack.use(getLoggerPlugin$1(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin$1(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin$1(this.config,{httpAuthSchemeParametersProvider:defaultDynamoDBHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new DefaultIdentityProviderConfig$1({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(getHttpSigningPlugin$1(this.config))}destroy(){super.destroy()}}class BatchWriteItemCommand extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArnList:{type:"operationContextParams",get:e=>Object.keys(e?.RequestItems??{})}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","BatchWriteItem",{}).n("DynamoDBClient","BatchWriteItemCommand").f(void 0,void 0).ser(se_BatchWriteItemCommand).de(de_BatchWriteItemCommand).build()){}class DeleteItemCommand extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","DeleteItem",{}).n("DynamoDBClient","DeleteItemCommand").f(void 0,void 0).ser(se_DeleteItemCommand).de(de_DeleteItemCommand).build()){}class GetItemCommand extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","GetItem",{}).n("DynamoDBClient","GetItemCommand").f(void 0,void 0).ser(se_GetItemCommand).de(de_GetItemCommand).build()){}class PutItemCommand extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","PutItem",{}).n("DynamoDBClient","PutItemCommand").f(void 0,void 0).ser(se_PutItemCommand).de(de_PutItemCommand).build()){}let QueryCommand$1=class extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","Query",{}).n("DynamoDBClient","QueryCommand").f(void 0,void 0).ser(se_QueryCommand).de(de_QueryCommand).build()){},ScanCommand$1=class extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","Scan",{}).n("DynamoDBClient","ScanCommand").f(void 0,void 0).ser(se_ScanCommand).de(de_ScanCommand).build()){};class UpdateItemCommand extends(Command$1.classBuilder().ep({...commonParams$4,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","UpdateItem",{}).n("DynamoDBClient","UpdateItemCommand").f(void 0,void 0).ser(se_UpdateItemCommand).de(de_UpdateItemCommand).build()){}class NumberValue{value;constructor(e){this.value=String("object"==typeof e&&"N"in e?e.N:e);const t="number"==typeof e.valueOf()?e.valueOf():0;if(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||Math.abs(t)===1/0||Number.isNaN(t))throw new Error(`NumberValue should not be initialized with an imprecise number=${t}. Use a string instead.`)}static from(e){return new NumberValue(e)}toAttributeValue(){return{N:this.toString()}}toBigInt(){const e=this.toString();return BigInt(e)}toString(){return String(this.value)}valueOf(){return this.toString()}}const convertToAttr=(e,t)=>{if(void 0===e)throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(null===e&&"object"==typeof e)return convertToNullAttr();if(Array.isArray(e))return convertToListAttr(e,t);if("Set"===e?.constructor?.name)return convertToSetAttr(e,t);if("Map"===e?.constructor?.name)return convertToMapAttrFromIterable(e,t);if("Object"===e?.constructor?.name||!e.constructor&&"object"==typeof e)return convertToMapAttrFromEnumerableProps(e,t);if(isBinary(e))return 0===e.length&&t?.convertEmptyValues?convertToNullAttr():convertToBinaryAttr(e);if("boolean"==typeof e||"Boolean"===e?.constructor?.name)return{BOOL:e.valueOf()};if("number"==typeof e||"Number"===e?.constructor?.name)return convertToNumberAttr(e,t);if(e instanceof NumberValue)return e.toAttributeValue();if("bigint"==typeof e)return convertToBigIntAttr(e);if("string"==typeof e||"String"===e?.constructor?.name)return 0===e.length&&t?.convertEmptyValues?convertToNullAttr():convertToStringAttr(e);if(t?.convertClassInstanceToMap&&"object"==typeof e)return convertToMapAttrFromEnumerableProps(e,t);throw new Error(`Unsupported type passed: ${e}. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.`)},convertToListAttr=(e,t)=>({L:e.filter(e=>"function"!=typeof e&&(!t?.removeUndefinedValues||t?.removeUndefinedValues&&void 0!==e)).map(e=>convertToAttr(e,t))}),convertToSetAttr=(e,t)=>{const n=t?.removeUndefinedValues?new Set([...e].filter(e=>void 0!==e)):e;if(!t?.removeUndefinedValues&&n.has(void 0))throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(0===n.size){if(t?.convertEmptyValues)return convertToNullAttr();throw new Error("Pass a non-empty set, or options.convertEmptyValues=true.")}const i=n.values().next().value;if(i instanceof NumberValue)return{NS:Array.from(n).map(e=>e.toString())};if("number"==typeof i)return{NS:Array.from(n).map(e=>convertToNumberAttr(e,t)).map(e=>e.N)};if("bigint"==typeof i)return{NS:Array.from(n).map(convertToBigIntAttr).map(e=>e.N)};if("string"==typeof i)return{SS:Array.from(n).map(convertToStringAttr).map(e=>e.S)};if(isBinary(i))return{BS:Array.from(n).map(convertToBinaryAttr).map(e=>e.B)};throw new Error("Only Number Set (NS), Binary Set (BS) or String Set (SS) are allowed.")},convertToMapAttrFromIterable=(e,t)=>({M:(e=>{const n={};for(const[i,r]of e)"function"==typeof r||void 0===r&&t?.removeUndefinedValues||(n[i]=convertToAttr(r,t));return n})(e)}),convertToMapAttrFromEnumerableProps=(e,t)=>({M:(e=>{const n={};for(const i in e){const r=e[i];"function"==typeof r||void 0===r&&t?.removeUndefinedValues||(n[i]=convertToAttr(r,t))}return n})(e)}),convertToNullAttr=()=>({NULL:!0}),convertToBinaryAttr=e=>({B:e}),convertToStringAttr=e=>({S:e.toString()}),convertToBigIntAttr=e=>({N:e.toString()}),validateBigIntAndThrow=e=>{throw new Error(`${e} Use NumberValue from @aws-sdk/lib-dynamodb.`)},convertToNumberAttr=(e,t)=>{if([Number.NaN,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY].map(e=>e.toString()).includes(e.toString()))throw new Error(`Special numeric value ${e.toString()} is not allowed`);return t?.allowImpreciseNumbers||(Number(e)>Number.MAX_SAFE_INTEGER?validateBigIntAndThrow(`Number ${e.toString()} is greater than Number.MAX_SAFE_INTEGER.`):Number(e)<Number.MIN_SAFE_INTEGER&&validateBigIntAndThrow(`Number ${e.toString()} is lesser than Number.MIN_SAFE_INTEGER.`)),{N:e.toString()}},isBinary=e=>{const t=["ArrayBuffer","Blob","Buffer","DataView","File","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];return!!e?.constructor&&t.includes(e.constructor.name)},convertToNative=(e,t)=>{for(const[n,i]of Object.entries(e))if(void 0!==i)switch(n){case"NULL":return null;case"BOOL":return Boolean(i);case"N":return convertNumber(i,t);case"B":return convertBinary(i);case"S":return convertString(i);case"L":return convertList(i,t);case"M":return convertMap(i,t);case"NS":return new Set(i.map(e=>convertNumber(e,t)));case"BS":return new Set(i.map(convertBinary));case"SS":return new Set(i.map(convertString));default:throw new Error(`Unsupported type passed: ${n}`)}throw new Error(`No value defined: ${JSON.stringify(e)}`)},convertNumber=(e,t)=>{if("function"==typeof t?.wrapNumbers)return t?.wrapNumbers(e);if(t?.wrapNumbers)return NumberValue.from(e);const n=Number(e),i=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];if((n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)&&!i.includes(n)){if("function"!=typeof BigInt)throw new Error(`${e} is outside SAFE_INTEGER bounds. Set options.wrapNumbers to get string value.`);try{return BigInt(e)}catch(t){throw new Error(`${e} can't be converted to BigInt. Set options.wrapNumbers to get string value.`)}}return n},convertString=e=>e,convertBinary=e=>e,convertList=(e,t)=>e.map(e=>convertToNative(e,t)),convertMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(e[n]=convertToNative(i,t),e),{});function marshall(e,t){const n=convertToAttr(e,t),[i,r]=Object.entries(n)[0];switch(i){case"M":case"L":return t?.convertTopLevelContainer?n:r;default:return n}}const unmarshall=(e,t)=>convertToNative(t?.convertWithoutMapWrapper?e:{M:e},t),SELF=null,ALL_VALUES={},ALL_MEMBERS=[],NEXT_LEVEL="*",processObj=(e,t,n)=>{if(void 0!==e){if(null==n)return t(e);{const i=Object.keys(n),r=1===i.length&&i[0]===NEXT_LEVEL,o=i.length>=1&&!r,a=0===i.length;if(o)return processKeysInObj(e,t,n);if(a)return processAllKeysInObj(e,t,SELF);if(r)return Object.entries(e??{}).reduce((e,[i,r])=>("function"!=typeof r&&(e[i]=processObj(r,t,n[NEXT_LEVEL])),e),Array.isArray(e)?[]:{})}}},processKeysInObj=(e,t,n)=>{let i;if(Array.isArray(e))i=e.filter(e=>"function"!=typeof e);else{i={};for(const[t,n]of Object.entries(e))"function"!=typeof n&&(i[t]=n)}for(const[r,o]of Object.entries(n)){if("function"==typeof e[r])continue;const n=processObj(e[r],t,o);void 0!==n&&"function"!=typeof n&&(i[r]=n)}return i},processAllKeysInObj=(e,t,n)=>Array.isArray(e)?e.filter(e=>"function"!=typeof e).map(e=>processObj(e,t,n)):Object.entries(e).reduce((e,[i,r])=>{if("function"==typeof r)return e;const o=processObj(r,t,n);return void 0!==o&&"function"!=typeof o&&(e[i]=o),e},{}),marshallInput=(e,t,n)=>processKeysInObj(e,e=>marshall(e,n),t),unmarshallOutput=(e,t,n)=>processKeysInObj(e,e=>unmarshall(e,n),t);class DynamoDBDocumentClientCommand extends Command$1{addMarshallingMiddleware(e){const{marshallOptions:t={},unmarshallOptions:n={}}=e.translateConfig||{};t.convertTopLevelContainer=t.convertTopLevelContainer??!0,n.convertWithoutMapWrapper=n.convertWithoutMapWrapper??!0,this.clientCommand.middlewareStack.addRelativeTo((e,n)=>async i=>(setFeature$2(n,"DDB_MAPPER","d"),e({...i,input:marshallInput(i.input,this.inputKeyNodes,t)})),{name:"DocumentMarshall",relation:"before",toMiddleware:"serializerMiddleware",override:!0}),this.clientCommand.middlewareStack.addRelativeTo((e,t)=>async t=>{const i=await e(t);return i.output=unmarshallOutput(i.output,this.outputKeyNodes,n),i},{name:"DocumentUnmarshall",relation:"before",toMiddleware:"deserializerMiddleware",override:!0})}}class BatchWriteCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={RequestItems:{"*":{"*":{PutRequest:{Item:ALL_VALUES},DeleteRequest:{Key:ALL_VALUES}}}}};outputKeyNodes={UnprocessedItems:{"*":{"*":{PutRequest:{Item:ALL_VALUES},DeleteRequest:{Key:ALL_VALUES}}}},ItemCollectionMetrics:{"*":{"*":{ItemCollectionKey:ALL_VALUES}}}};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new BatchWriteItemCommand(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class DeleteCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={Key:ALL_VALUES,Expected:{"*":{Value:SELF,AttributeValueList:ALL_MEMBERS}},ExpressionAttributeValues:ALL_VALUES};outputKeyNodes={Attributes:ALL_VALUES,ItemCollectionMetrics:{ItemCollectionKey:ALL_VALUES}};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new DeleteItemCommand(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class GetCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={Key:ALL_VALUES};outputKeyNodes={Item:ALL_VALUES};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new GetItemCommand(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class PutCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={Item:ALL_VALUES,Expected:{"*":{Value:SELF,AttributeValueList:ALL_MEMBERS}},ExpressionAttributeValues:ALL_VALUES};outputKeyNodes={Attributes:ALL_VALUES,ItemCollectionMetrics:{ItemCollectionKey:ALL_VALUES}};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new PutItemCommand(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class QueryCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={KeyConditions:{"*":{AttributeValueList:ALL_MEMBERS}},QueryFilter:{"*":{AttributeValueList:ALL_MEMBERS}},ExclusiveStartKey:ALL_VALUES,ExpressionAttributeValues:ALL_VALUES};outputKeyNodes={Items:{"*":ALL_VALUES},LastEvaluatedKey:ALL_VALUES};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new QueryCommand$1(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class ScanCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={ScanFilter:{"*":{AttributeValueList:ALL_MEMBERS}},ExclusiveStartKey:ALL_VALUES,ExpressionAttributeValues:ALL_VALUES};outputKeyNodes={Items:{"*":ALL_VALUES},LastEvaluatedKey:ALL_VALUES};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new ScanCommand$1(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class UpdateCommand extends DynamoDBDocumentClientCommand{input;inputKeyNodes={Key:ALL_VALUES,AttributeUpdates:{"*":{Value:SELF}},Expected:{"*":{Value:SELF,AttributeValueList:ALL_MEMBERS}},ExpressionAttributeValues:ALL_VALUES};outputKeyNodes={Attributes:ALL_VALUES,ItemCollectionMetrics:{ItemCollectionKey:ALL_VALUES}};clientCommand;middlewareStack;constructor(e){super(),this.input=e,this.clientCommand=new UpdateItemCommand(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(e,t,n){this.addMarshallingMiddleware(t);const i=e.concat(this.middlewareStack),r=this.clientCommand.resolveMiddleware(i,t,n);return async()=>r(this.clientCommand)}}class DynamoDBDocumentClient extends Client$1{config;constructor(e,t){if(super(e.config),this.config=e.config,this.config.translateConfig=t,this.middlewareStack=e.middlewareStack,this.config?.cacheMiddleware)throw new Error("@aws-sdk/lib-dynamodb - cacheMiddleware=true is not compatible with the DynamoDBDocumentClient. This option must be set to false.")}static from(e,t){return new DynamoDBDocumentClient(e,t)}destroy(){}}var parser={},hasRequiredParser,DLList_1,hasRequiredDLList,Events_1,hasRequiredEvents,Queues_1,hasRequiredQueues,BottleneckError_1,hasRequiredBottleneckError,Job_1,hasRequiredJob,LocalDatastore_1,hasRequiredLocalDatastore;function requireParser(){return hasRequiredParser||(hasRequiredParser=1,parser.load=function(e,t,n={}){var i,r,o;for(i in t)o=t[i],n[i]=null!=(r=e[i])?r:o;return n},parser.overwrite=function(e,t,n={}){var i,r;for(i in e)r=e[i],void 0!==t[i]&&(n[i]=r);return n}),parser}function requireDLList(){return hasRequiredDLList?DLList_1:(hasRequiredDLList=1,DLList_1=class{constructor(e,t){this.incr=e,this.decr=t,this._first=null,this._last=null,this.length=0}push(e){var t;this.length++,"function"==typeof this.incr&&this.incr(),t={value:e,prev:this._last,next:null},null!=this._last?(this._last.next=t,this._last=t):this._first=this._last=t}shift(){var e;if(null!=this._first)return this.length--,"function"==typeof this.decr&&this.decr(),e=this._first.value,null!=(this._first=this._first.next)?this._first.prev=null:this._last=null,e}first(){if(null!=this._first)return this._first.value}getArray(){var e,t,n;for(e=this._first,n=[];null!=e;)n.push((t=e,e=e.next,t.value));return n}forEachShift(e){var t;for(t=this.shift();null!=t;)e(t),t=this.shift()}debug(){var e,t,n,i,r;for(e=this._first,r=[];null!=e;)r.push((t=e,e=e.next,{value:t.value,prev:null!=(n=t.prev)?n.value:void 0,next:null!=(i=t.next)?i.value:void 0}));return r}})}function requireEvents(){if(hasRequiredEvents)return Events_1;function e(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function t(t){return function(){var n=this,i=arguments;return new Promise(function(r,o){var a=t.apply(n,i);function s(t){e(a,r,o,s,c,"next",t)}function c(t){e(a,r,o,s,c,"throw",t)}s(void 0)})}}var n;return hasRequiredEvents=1,n=class{constructor(e){if(this.instance=e,this._events={},null!=this.instance.on||null!=this.instance.once||null!=this.instance.removeAllListeners)throw new Error("An Emitter already exists for this object");this.instance.on=(e,t)=>this._addListener(e,"many",t),this.instance.once=(e,t)=>this._addListener(e,"once",t),this.instance.removeAllListeners=(e=null)=>null!=e?delete this._events[e]:this._events={}}_addListener(e,t,n){var i;return null==(i=this._events)[e]&&(i[e]=[]),this._events[e].push({cb:n,status:t}),this.instance}listenerCount(e){return null!=this._events[e]?this._events[e].length:0}trigger(e,...n){var i=this;return t(function*(){var r,o;try{if("debug"!==e&&i.trigger("debug",`Event triggered: ${e}`,n),null==i._events[e])return;return i._events[e]=i._events[e].filter(function(e){return"none"!==e.status}),o=i._events[e].map(function(){var e=t(function*(e){var t,r;if("none"!==e.status){"once"===e.status&&(e.status="none");try{return"function"==typeof(null!=(r="function"==typeof e.cb?e.cb(...n):void 0)?r.then:void 0)?yield r:r}catch(e){return t=e,i.trigger("error",t),null}}});return function(t){return e.apply(this,arguments)}}()),(yield Promise.all(o)).find(function(e){return null!=e})}catch(e){return r=e,i.trigger("error",r),null}})()}},Events_1=n}function requireQueues(){return hasRequiredQueues?Queues_1:(hasRequiredQueues=1,e=requireDLList(),t=requireEvents(),n=class{constructor(n){this.Events=new t(this),this._length=0,this._lists=function(){var t,i,r;for(r=[],t=1,i=n;1<=i?t<=i:t>=i;1<=i?++t:--t)r.push(new e(()=>this.incr(),()=>this.decr()));return r}.call(this)}incr(){if(0===this._length++)return this.Events.trigger("leftzero")}decr(){if(0===--this._length)return this.Events.trigger("zero")}push(e){return this._lists[e.options.priority].push(e)}queued(e){return null!=e?this._lists[e].length:this._length}shiftAll(e){return this._lists.forEach(function(t){return t.forEachShift(e)})}getFirst(e=this._lists){var t,n,i;for(t=0,n=e.length;t<n;t++)if((i=e[t]).length>0)return i;return[]}shiftLastFrom(e){return this.getFirst(this._lists.slice(e).reverse()).shift()}},Queues_1=n);var e,t,n}function requireBottleneckError(){return hasRequiredBottleneckError?BottleneckError_1:(hasRequiredBottleneckError=1,e=class extends Error{},BottleneckError_1=e);var e}function requireJob(){if(hasRequiredJob)return Job_1;function e(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function t(t){return function(){var n=this,i=arguments;return new Promise(function(r,o){var a=t.apply(n,i);function s(t){e(a,r,o,s,c,"next",t)}function c(t){e(a,r,o,s,c,"throw",t)}s(void 0)})}}var n,i;return hasRequiredJob=1,i=requireParser(),n=requireBottleneckError(),Job_1=class{constructor(e,t,n,r,o,a,s,c){this.task=e,this.args=t,this.rejectOnDrop=o,this.Events=a,this._states=s,this.Promise=c,this.options=i.load(n,r),this.options.priority=this._sanitizePriority(this.options.priority),this.options.id===r.id&&(this.options.id=`${this.options.id}-${this._randomIndex()}`),this.promise=new this.Promise((e,t)=>{this._resolve=e,this._reject=t}),this.retryCount=0}_sanitizePriority(e){var t;return(t=~~e!==e?5:e)<0?0:t>9?9:t}_randomIndex(){return Math.random().toString(36).slice(2)}doDrop({error:e,message:t="This job has been dropped by Bottleneck"}={}){return!!this._states.remove(this.options.id)&&(this.rejectOnDrop&&this._reject(null!=e?e:new n(t)),this.Events.trigger("dropped",{args:this.args,options:this.options,task:this.task,promise:this.promise}),!0)}_assertStatus(e){var t;if((t=this._states.jobStatus(this.options.id))!==e&&("DONE"!==e||null!==t))throw new n(`Invalid job status ${t}, expected ${e}. Please open an issue at https://github.com/SGrondin/bottleneck/issues`)}doReceive(){return this._states.start(this.options.id),this.Events.trigger("received",{args:this.args,options:this.options})}doQueue(e,t){return this._assertStatus("RECEIVED"),this._states.next(this.options.id),this.Events.trigger("queued",{args:this.args,options:this.options,reachedHWM:e,blocked:t})}doRun(){return 0===this.retryCount?(this._assertStatus("QUEUED"),this._states.next(this.options.id)):this._assertStatus("EXECUTING"),this.Events.trigger("scheduled",{args:this.args,options:this.options})}doExecute(e,n,i,r){var o=this;return t(function*(){var t,a,s;0===o.retryCount?(o._assertStatus("RUNNING"),o._states.next(o.options.id)):o._assertStatus("EXECUTING"),a={args:o.args,options:o.options,retryCount:o.retryCount},o.Events.trigger("executing",a);try{if(s=yield null!=e?e.schedule(o.options,o.task,...o.args):o.task(...o.args),n())return o.doDone(a),yield r(o.options,a),o._assertStatus("DONE"),o._resolve(s)}catch(e){return t=e,o._onFailure(t,a,n,i,r)}})()}doExpire(e,t,i){var r,o;return this._states.jobStatus("RUNNING"===this.options.id)&&this._states.next(this.options.id),this._assertStatus("EXECUTING"),o={args:this.args,options:this.options,retryCount:this.retryCount},r=new n(`This job timed out after ${this.options.expiration} ms.`),this._onFailure(r,o,e,t,i)}_onFailure(e,n,i,r,o){var a=this;return t(function*(){var t,s;if(i())return null!=(t=yield a.Events.trigger("failed",e,n))?(s=~~t,a.Events.trigger("retry",`Retrying ${a.options.id} after ${s} ms`,n),a.retryCount++,r(s)):(a.doDone(n),yield o(a.options,n),a._assertStatus("DONE"),a._reject(e))})()}doDone(e){return this._assertStatus("EXECUTING"),this._states.next(this.options.id),this.Events.trigger("done",e)}}}function requireLocalDatastore(){if(hasRequiredLocalDatastore)return LocalDatastore_1;function e(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function t(t){return function(){var n=this,i=arguments;return new Promise(function(r,o){var a=t.apply(n,i);function s(t){e(a,r,o,s,c,"next",t)}function c(t){e(a,r,o,s,c,"throw",t)}s(void 0)})}}var n,i,r;return hasRequiredLocalDatastore=1,r=requireParser(),n=requireBottleneckError(),i=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.clientId=this.instance._randomIndex(),r.load(n,n,this),this._nextRequest=this._lastReservoirRefresh=this._lastReservoirIncrease=Date.now(),this._running=0,this._done=0,this._unblockTime=0,this.ready=this.Promise.resolve(),this.clients={},this._startHeartbeat()}_startHeartbeat(){var e;return null==this.heartbeat&&(null!=this.storeOptions.reservoirRefreshInterval&&null!=this.storeOptions.reservoirRefreshAmount||null!=this.storeOptions.reservoirIncreaseInterval&&null!=this.storeOptions.reservoirIncreaseAmount)?"function"==typeof(e=this.heartbeat=setInterval(()=>{var e,t,n,i,r;if(i=Date.now(),null!=this.storeOptions.reservoirRefreshInterval&&i>=this._lastReservoirRefresh+this.storeOptions.reservoirRefreshInterval&&(this._lastReservoirRefresh=i,this.storeOptions.reservoir=this.storeOptions.reservoirRefreshAmount,this.instance._drainAll(this.computeCapacity())),null!=this.storeOptions.reservoirIncreaseInterval&&i>=this._lastReservoirIncrease+this.storeOptions.reservoirIncreaseInterval){var o=this.storeOptions;if(e=o.reservoirIncreaseAmount,n=o.reservoirIncreaseMaximum,r=o.reservoir,this._lastReservoirIncrease=i,(t=null!=n?Math.min(e,n-r):e)>0)return this.storeOptions.reservoir+=t,this.instance._drainAll(this.computeCapacity())}},this.heartbeatInterval)).unref?e.unref():void 0:clearInterval(this.heartbeat)}__publish__(e){var n=this;return t(function*(){return yield n.yieldLoop(),n.instance.Events.trigger("message",e.toString())})()}__disconnect__(e){var n=this;return t(function*(){return yield n.yieldLoop(),clearInterval(n.heartbeat),n.Promise.resolve()})()}yieldLoop(e=0){return new this.Promise(function(t,n){return setTimeout(t,e)})}computePenalty(){var e;return null!=(e=this.storeOptions.penalty)?e:15*this.storeOptions.minTime||5e3}__updateSettings__(e){var n=this;return t(function*(){return yield n.yieldLoop(),r.overwrite(e,e,n.storeOptions),n._startHeartbeat(),n.instance._drainAll(n.computeCapacity()),!0})()}__running__(){var e=this;return t(function*(){return yield e.yieldLoop(),e._running})()}__queued__(){var e=this;return t(function*(){return yield e.yieldLoop(),e.instance.queued()})()}__done__(){var e=this;return t(function*(){return yield e.yieldLoop(),e._done})()}__groupCheck__(e){var n=this;return t(function*(){return yield n.yieldLoop(),n._nextRequest+n.timeout<e})()}computeCapacity(){var e,t,n=this.storeOptions;return e=n.maxConcurrent,t=n.reservoir,null!=e&&null!=t?Math.min(e-this._running,t):null!=e?e-this._running:null!=t?t:null}conditionsCheck(e){var t;return null==(t=this.computeCapacity())||e<=t}__incrementReservoir__(e){var n=this;return t(function*(){var t;return yield n.yieldLoop(),t=n.storeOptions.reservoir+=e,n.instance._drainAll(n.computeCapacity()),t})()}__currentReservoir__(){var e=this;return t(function*(){return yield e.yieldLoop(),e.storeOptions.reservoir})()}isBlocked(e){return this._unblockTime>=e}check(e,t){return this.conditionsCheck(e)&&this._nextRequest-t<=0}__check__(e){var n=this;return t(function*(){var t;return yield n.yieldLoop(),t=Date.now(),n.check(e,t)})()}__register__(e,n,i){var r=this;return t(function*(){var e,t;return yield r.yieldLoop(),e=Date.now(),r.conditionsCheck(n)?(r._running+=n,null!=r.storeOptions.reservoir&&(r.storeOptions.reservoir-=n),t=Math.max(r._nextRequest-e,0),r._nextRequest=e+t+r.storeOptions.minTime,{success:!0,wait:t,reservoir:r.storeOptions.reservoir}):{success:!1}})()}strategyIsBlock(){return 3===this.storeOptions.strategy}__submit__(e,i){var r=this;return t(function*(){var t,o,a;if(yield r.yieldLoop(),null!=r.storeOptions.maxConcurrent&&i>r.storeOptions.maxConcurrent)throw new n(`Impossible to add a job having a weight of ${i} to a limiter having a maxConcurrent setting of ${r.storeOptions.maxConcurrent}`);return o=Date.now(),a=null!=r.storeOptions.highWater&&e===r.storeOptions.highWater&&!r.check(i,o),(t=r.strategyIsBlock()&&(a||r.isBlocked(o)))&&(r._unblockTime=o+r.computePenalty(),r._nextRequest=r._unblockTime+r.storeOptions.minTime,r.instance._dropAllQueued()),{reachedHWM:a,blocked:t,strategy:r.storeOptions.strategy}})()}__free__(e,n){var i=this;return t(function*(){return yield i.yieldLoop(),i._running-=n,i._done+=n,i.instance._drainAll(i.computeCapacity()),{running:i._running}})()}},LocalDatastore_1=i}var Scripts={},require$$0$2={"blacklist_client.lua":"local blacklist = ARGV[num_static_argv + 1]\n\nif redis.call('zscore', client_last_seen_key, blacklist) then\n redis.call('zadd', client_last_seen_key, 0, blacklist)\nend\n\n\nreturn {}\n","check.lua":"local weight = tonumber(ARGV[num_static_argv + 1])\n\nlocal capacity = process_tick(now, false)['capacity']\nlocal nextRequest = tonumber(redis.call('hget', settings_key, 'nextRequest'))\n\nreturn conditions_check(capacity, weight) and nextRequest - now <= 0\n","conditions_check.lua":"local conditions_check = function (capacity, weight)\n return capacity == nil or weight <= capacity\nend\n","current_reservoir.lua":"return process_tick(now, false)['reservoir']\n","done.lua":"process_tick(now, false)\n\nreturn tonumber(redis.call('hget', settings_key, 'done'))\n","free.lua":"local index = ARGV[num_static_argv + 1]\n\nredis.call('zadd', job_expirations_key, 0, index)\n\nreturn process_tick(now, false)['running']\n","get_time.lua":"redis.replicate_commands()\n\nlocal get_time = function ()\n local time = redis.call('time')\n\n return tonumber(time[1]..string.sub(time[2], 1, 3))\nend\n","group_check.lua":"return not (redis.call('exists', settings_key) == 1)\n","heartbeat.lua":"process_tick(now, true)\n","increment_reservoir.lua":"local incr = tonumber(ARGV[num_static_argv + 1])\n\nredis.call('hincrby', settings_key, 'reservoir', incr)\n\nlocal reservoir = process_tick(now, true)['reservoir']\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn reservoir\n","init.lua":"local clear = tonumber(ARGV[num_static_argv + 1])\nlocal limiter_version = ARGV[num_static_argv + 2]\nlocal num_local_argv = num_static_argv + 2\n\nif clear == 1 then\n redis.call('del', unpack(KEYS))\nend\n\nif redis.call('exists', settings_key) == 0 then\n -- Create\n local args = {'hmset', settings_key}\n\n for i = num_local_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\n end\n\n redis.call(unpack(args))\n redis.call('hmset', settings_key,\n 'nextRequest', now,\n 'lastReservoirRefresh', now,\n 'lastReservoirIncrease', now,\n 'running', 0,\n 'done', 0,\n 'unblockTime', 0,\n 'capacityPriorityCounter', 0\n )\n\nelse\n -- Apply migrations\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'version'\n )\n local id = settings[1]\n local current_version = settings[2]\n\n if current_version ~= limiter_version then\n local version_digits = {}\n for k, v in string.gmatch(current_version, \"([^.]+)\") do\n table.insert(version_digits, tonumber(k))\n end\n\n -- 2.10.0\n if version_digits[2] < 10 then\n redis.call('hsetnx', settings_key, 'reservoirRefreshInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirRefreshAmount', '')\n redis.call('hsetnx', settings_key, 'lastReservoirRefresh', '')\n redis.call('hsetnx', settings_key, 'done', 0)\n redis.call('hset', settings_key, 'version', '2.10.0')\n end\n\n -- 2.11.1\n if version_digits[2] < 11 or (version_digits[2] == 11 and version_digits[3] < 1) then\n if redis.call('hstrlen', settings_key, 'lastReservoirRefresh') == 0 then\n redis.call('hmset', settings_key,\n 'lastReservoirRefresh', now,\n 'version', '2.11.1'\n )\n end\n end\n\n -- 2.14.0\n if version_digits[2] < 14 then\n local old_running_key = 'b_'..id..'_running'\n local old_executing_key = 'b_'..id..'_executing'\n\n if redis.call('exists', old_running_key) == 1 then\n redis.call('rename', old_running_key, job_weights_key)\n end\n if redis.call('exists', old_executing_key) == 1 then\n redis.call('rename', old_executing_key, job_expirations_key)\n end\n redis.call('hset', settings_key, 'version', '2.14.0')\n end\n\n -- 2.15.2\n if version_digits[2] < 15 or (version_digits[2] == 15 and version_digits[3] < 2) then\n redis.call('hsetnx', settings_key, 'capacityPriorityCounter', 0)\n redis.call('hset', settings_key, 'version', '2.15.2')\n end\n\n -- 2.17.0\n if version_digits[2] < 17 then\n redis.call('hsetnx', settings_key, 'clientTimeout', 10000)\n redis.call('hset', settings_key, 'version', '2.17.0')\n end\n\n -- 2.18.0\n if version_digits[2] < 18 then\n redis.call('hsetnx', settings_key, 'reservoirIncreaseInterval', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseAmount', '')\n redis.call('hsetnx', settings_key, 'reservoirIncreaseMaximum', '')\n redis.call('hsetnx', settings_key, 'lastReservoirIncrease', now)\n redis.call('hset', settings_key, 'version', '2.18.0')\n end\n\n end\n\n process_tick(now, false)\nend\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","process_tick.lua":"local process_tick = function (now, always_publish)\n\n local compute_capacity = function (maxConcurrent, running, reservoir)\n if maxConcurrent ~= nil and reservoir ~= nil then\n return math.min((maxConcurrent - running), reservoir)\n elseif maxConcurrent ~= nil then\n return maxConcurrent - running\n elseif reservoir ~= nil then\n return reservoir\n else\n return nil\n end\n end\n\n local settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'running',\n 'reservoir',\n 'reservoirRefreshInterval',\n 'reservoirRefreshAmount',\n 'lastReservoirRefresh',\n 'reservoirIncreaseInterval',\n 'reservoirIncreaseAmount',\n 'reservoirIncreaseMaximum',\n 'lastReservoirIncrease',\n 'capacityPriorityCounter',\n 'clientTimeout'\n )\n local id = settings[1]\n local maxConcurrent = tonumber(settings[2])\n local running = tonumber(settings[3])\n local reservoir = tonumber(settings[4])\n local reservoirRefreshInterval = tonumber(settings[5])\n local reservoirRefreshAmount = tonumber(settings[6])\n local lastReservoirRefresh = tonumber(settings[7])\n local reservoirIncreaseInterval = tonumber(settings[8])\n local reservoirIncreaseAmount = tonumber(settings[9])\n local reservoirIncreaseMaximum = tonumber(settings[10])\n local lastReservoirIncrease = tonumber(settings[11])\n local capacityPriorityCounter = tonumber(settings[12])\n local clientTimeout = tonumber(settings[13])\n\n local initial_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n --\n -- Process 'running' changes\n --\n local expired = redis.call('zrangebyscore', job_expirations_key, '-inf', '('..now)\n\n if #expired > 0 then\n redis.call('zremrangebyscore', job_expirations_key, '-inf', '('..now)\n\n local flush_batch = function (batch, acc)\n local weights = redis.call('hmget', job_weights_key, unpack(batch))\n redis.call('hdel', job_weights_key, unpack(batch))\n local clients = redis.call('hmget', job_clients_key, unpack(batch))\n redis.call('hdel', job_clients_key, unpack(batch))\n\n -- Calculate sum of removed weights\n for i = 1, #weights do\n acc['total'] = acc['total'] + (tonumber(weights[i]) or 0)\n end\n\n -- Calculate sum of removed weights by client\n local client_weights = {}\n for i = 1, #clients do\n local removed = tonumber(weights[i]) or 0\n if removed > 0 then\n acc['client_weights'][clients[i]] = (acc['client_weights'][clients[i]] or 0) + removed\n end\n end\n end\n\n local acc = {\n ['total'] = 0,\n ['client_weights'] = {}\n }\n local batch_size = 1000\n\n -- Compute changes to Zsets and apply changes to Hashes\n for i = 1, #expired, batch_size do\n local batch = {}\n for j = i, math.min(i + batch_size - 1, #expired) do\n table.insert(batch, expired[j])\n end\n\n flush_batch(batch, acc)\n end\n\n -- Apply changes to Zsets\n if acc['total'] > 0 then\n redis.call('hincrby', settings_key, 'done', acc['total'])\n running = tonumber(redis.call('hincrby', settings_key, 'running', -acc['total']))\n end\n\n for client, weight in pairs(acc['client_weights']) do\n redis.call('zincrby', client_running_key, -weight, client)\n end\n end\n\n --\n -- Process 'reservoir' changes\n --\n local reservoirRefreshActive = reservoirRefreshInterval ~= nil and reservoirRefreshAmount ~= nil\n if reservoirRefreshActive and now >= lastReservoirRefresh + reservoirRefreshInterval then\n reservoir = reservoirRefreshAmount\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirRefresh', now\n )\n end\n\n local reservoirIncreaseActive = reservoirIncreaseInterval ~= nil and reservoirIncreaseAmount ~= nil\n if reservoirIncreaseActive and now >= lastReservoirIncrease + reservoirIncreaseInterval then\n local num_intervals = math.floor((now - lastReservoirIncrease) / reservoirIncreaseInterval)\n local incr = reservoirIncreaseAmount * num_intervals\n if reservoirIncreaseMaximum ~= nil then\n incr = math.min(incr, reservoirIncreaseMaximum - (reservoir or 0))\n end\n if incr > 0 then\n reservoir = (reservoir or 0) + incr\n end\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'lastReservoirIncrease', lastReservoirIncrease + (num_intervals * reservoirIncreaseInterval)\n )\n end\n\n --\n -- Clear unresponsive clients\n --\n local unresponsive = redis.call('zrangebyscore', client_last_seen_key, '-inf', (now - clientTimeout))\n local unresponsive_lookup = {}\n local terminated_clients = {}\n for i = 1, #unresponsive do\n unresponsive_lookup[unresponsive[i]] = true\n if tonumber(redis.call('zscore', client_running_key, unresponsive[i])) == 0 then\n table.insert(terminated_clients, unresponsive[i])\n end\n end\n if #terminated_clients > 0 then\n redis.call('zrem', client_running_key, unpack(terminated_clients))\n redis.call('hdel', client_num_queued_key, unpack(terminated_clients))\n redis.call('zrem', client_last_registered_key, unpack(terminated_clients))\n redis.call('zrem', client_last_seen_key, unpack(terminated_clients))\n end\n\n --\n -- Broadcast capacity changes\n --\n local final_capacity = compute_capacity(maxConcurrent, running, reservoir)\n\n if always_publish or (initial_capacity ~= nil and final_capacity == nil) then\n -- always_publish or was not unlimited, now unlimited\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n\n elseif initial_capacity ~= nil and final_capacity ~= nil and final_capacity > initial_capacity then\n -- capacity was increased\n -- send the capacity message to the limiter having the lowest number of running jobs\n -- the tiebreaker is the limiter having not registered a job in the longest time\n\n local lowest_concurrency_value = nil\n local lowest_concurrency_clients = {}\n local lowest_concurrency_last_registered = {}\n local client_concurrencies = redis.call('zrange', client_running_key, 0, -1, 'withscores')\n\n for i = 1, #client_concurrencies, 2 do\n local client = client_concurrencies[i]\n local concurrency = tonumber(client_concurrencies[i+1])\n\n if (\n lowest_concurrency_value == nil or lowest_concurrency_value == concurrency\n ) and (\n not unresponsive_lookup[client]\n ) and (\n tonumber(redis.call('hget', client_num_queued_key, client)) > 0\n ) then\n lowest_concurrency_value = concurrency\n table.insert(lowest_concurrency_clients, client)\n local last_registered = tonumber(redis.call('zscore', client_last_registered_key, client))\n table.insert(lowest_concurrency_last_registered, last_registered)\n end\n end\n\n if #lowest_concurrency_clients > 0 then\n local position = 1\n local earliest = lowest_concurrency_last_registered[1]\n\n for i,v in ipairs(lowest_concurrency_last_registered) do\n if v < earliest then\n position = i\n earliest = v\n end\n end\n\n local next_client = lowest_concurrency_clients[position]\n redis.call('publish', 'b_'..id,\n 'capacity-priority:'..(final_capacity or '')..\n ':'..next_client..\n ':'..capacityPriorityCounter\n )\n redis.call('hincrby', settings_key, 'capacityPriorityCounter', '1')\n else\n redis.call('publish', 'b_'..id, 'capacity:'..(final_capacity or ''))\n end\n end\n\n return {\n ['capacity'] = final_capacity,\n ['running'] = running,\n ['reservoir'] = reservoir\n }\nend\n","queued.lua":"local clientTimeout = tonumber(redis.call('hget', settings_key, 'clientTimeout'))\nlocal valid_clients = redis.call('zrangebyscore', client_last_seen_key, (now - clientTimeout), 'inf')\nlocal client_queued = redis.call('hmget', client_num_queued_key, unpack(valid_clients))\n\nlocal sum = 0\nfor i = 1, #client_queued do\n sum = sum + tonumber(client_queued[i])\nend\n\nreturn sum\n","refresh_expiration.lua":"local refresh_expiration = function (now, nextRequest, groupTimeout)\n\n if groupTimeout ~= nil then\n local ttl = (nextRequest + groupTimeout) - now\n\n for i = 1, #KEYS do\n redis.call('pexpire', KEYS[i], ttl)\n end\n end\n\nend\n","refs.lua":"local settings_key = KEYS[1]\nlocal job_weights_key = KEYS[2]\nlocal job_expirations_key = KEYS[3]\nlocal job_clients_key = KEYS[4]\nlocal client_running_key = KEYS[5]\nlocal client_num_queued_key = KEYS[6]\nlocal client_last_registered_key = KEYS[7]\nlocal client_last_seen_key = KEYS[8]\n\nlocal now = tonumber(ARGV[1])\nlocal client = ARGV[2]\n\nlocal num_static_argv = 2\n","register.lua":"local index = ARGV[num_static_argv + 1]\nlocal weight = tonumber(ARGV[num_static_argv + 2])\nlocal expiration = tonumber(ARGV[num_static_argv + 3])\n\nlocal state = process_tick(now, false)\nlocal capacity = state['capacity']\nlocal reservoir = state['reservoir']\n\nlocal settings = redis.call('hmget', settings_key,\n 'nextRequest',\n 'minTime',\n 'groupTimeout'\n)\nlocal nextRequest = tonumber(settings[1])\nlocal minTime = tonumber(settings[2])\nlocal groupTimeout = tonumber(settings[3])\n\nif conditions_check(capacity, weight) then\n\n redis.call('hincrby', settings_key, 'running', weight)\n redis.call('hset', job_weights_key, index, weight)\n if expiration ~= nil then\n redis.call('zadd', job_expirations_key, now + expiration, index)\n end\n redis.call('hset', job_clients_key, index, client)\n redis.call('zincrby', client_running_key, weight, client)\n redis.call('hincrby', client_num_queued_key, client, -1)\n redis.call('zadd', client_last_registered_key, now, client)\n\n local wait = math.max(nextRequest - now, 0)\n local newNextRequest = now + wait + minTime\n\n if reservoir == nil then\n redis.call('hset', settings_key,\n 'nextRequest', newNextRequest\n )\n else\n reservoir = reservoir - weight\n redis.call('hmset', settings_key,\n 'reservoir', reservoir,\n 'nextRequest', newNextRequest\n )\n end\n\n refresh_expiration(now, newNextRequest, groupTimeout)\n\n return {true, wait, reservoir}\n\nelse\n return {false}\nend\n","register_client.lua":"local queued = tonumber(ARGV[num_static_argv + 1])\n\n-- Could have been re-registered concurrently\nif not redis.call('zscore', client_last_seen_key, client) then\n redis.call('zadd', client_running_key, 0, client)\n redis.call('hset', client_num_queued_key, client, queued)\n redis.call('zadd', client_last_registered_key, 0, client)\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n\nreturn {}\n","running.lua":"return process_tick(now, false)['running']\n","submit.lua":"local queueLength = tonumber(ARGV[num_static_argv + 1])\nlocal weight = tonumber(ARGV[num_static_argv + 2])\n\nlocal capacity = process_tick(now, false)['capacity']\n\nlocal settings = redis.call('hmget', settings_key,\n 'id',\n 'maxConcurrent',\n 'highWater',\n 'nextRequest',\n 'strategy',\n 'unblockTime',\n 'penalty',\n 'minTime',\n 'groupTimeout'\n)\nlocal id = settings[1]\nlocal maxConcurrent = tonumber(settings[2])\nlocal highWater = tonumber(settings[3])\nlocal nextRequest = tonumber(settings[4])\nlocal strategy = tonumber(settings[5])\nlocal unblockTime = tonumber(settings[6])\nlocal penalty = tonumber(settings[7])\nlocal minTime = tonumber(settings[8])\nlocal groupTimeout = tonumber(settings[9])\n\nif maxConcurrent ~= nil and weight > maxConcurrent then\n return redis.error_reply('OVERWEIGHT:'..weight..':'..maxConcurrent)\nend\n\nlocal reachedHWM = (highWater ~= nil and queueLength == highWater\n and not (\n conditions_check(capacity, weight)\n and nextRequest - now <= 0\n )\n)\n\nlocal blocked = strategy == 3 and (reachedHWM or unblockTime >= now)\n\nif blocked then\n local computedPenalty = penalty\n if computedPenalty == nil then\n if minTime == 0 then\n computedPenalty = 5000\n else\n computedPenalty = 15 * minTime\n end\n end\n\n local newNextRequest = now + computedPenalty + minTime\n\n redis.call('hmset', settings_key,\n 'unblockTime', now + computedPenalty,\n 'nextRequest', newNextRequest\n )\n\n local clients_queued_reset = redis.call('hkeys', client_num_queued_key)\n local queued_reset = {}\n for i = 1, #clients_queued_reset do\n table.insert(queued_reset, clients_queued_reset[i])\n table.insert(queued_reset, 0)\n end\n redis.call('hmset', client_num_queued_key, unpack(queued_reset))\n\n redis.call('publish', 'b_'..id, 'blocked:')\n\n refresh_expiration(now, newNextRequest, groupTimeout)\nend\n\nif not blocked and not reachedHWM then\n redis.call('hincrby', client_num_queued_key, client, 1)\nend\n\nreturn {reachedHWM, blocked, strategy}\n","update_settings.lua":"local args = {'hmset', settings_key}\n\nfor i = num_static_argv + 1, #ARGV do\n table.insert(args, ARGV[i])\nend\n\nredis.call(unpack(args))\n\nprocess_tick(now, true)\n\nlocal groupTimeout = tonumber(redis.call('hget', settings_key, 'groupTimeout'))\nrefresh_expiration(0, 0, groupTimeout)\n\nreturn {}\n","validate_client.lua":"if not redis.call('zscore', client_last_seen_key, client) then\n return redis.error_reply('UNKNOWN_CLIENT')\nend\n\nredis.call('zadd', client_last_seen_key, now, client)\n","validate_keys.lua":"if not (redis.call('exists', settings_key) == 1) then\n return redis.error_reply('SETTINGS_KEY_NOT_FOUND')\nend\n"},hasRequiredScripts,RedisConnection_1,hasRequiredRedisConnection,IORedisConnection_1,hasRequiredIORedisConnection,RedisDatastore_1,hasRequiredRedisDatastore,States_1,hasRequiredStates,Sync_1,hasRequiredSync;function requireScripts(){return hasRequiredScripts||(hasRequiredScripts=1,e=Scripts,t={refs:(n=require$$0$2)["refs.lua"],validate_keys:n["validate_keys.lua"],validate_client:n["validate_client.lua"],refresh_expiration:n["refresh_expiration.lua"],process_tick:n["process_tick.lua"],conditions_check:n["conditions_check.lua"],get_time:n["get_time.lua"]},e.allKeys=function(e){return[`b_${e}_settings`,`b_${e}_job_weights`,`b_${e}_job_expirations`,`b_${e}_job_clients`,`b_${e}_client_running`,`b_${e}_client_num_queued`,`b_${e}_client_last_registered`,`b_${e}_client_last_seen`]},i={init:{keys:e.allKeys,headers:["process_tick"],refresh_expiration:!0,code:n["init.lua"]},group_check:{keys:e.allKeys,headers:[],refresh_expiration:!1,code:n["group_check.lua"]},register_client:{keys:e.allKeys,headers:["validate_keys"],refresh_expiration:!1,code:n["register_client.lua"]},blacklist_client:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["blacklist_client.lua"]},heartbeat:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["heartbeat.lua"]},update_settings:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["update_settings.lua"]},running:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["running.lua"]},queued:{keys:e.allKeys,headers:["validate_keys","validate_client"],refresh_expiration:!1,code:n["queued.lua"]},done:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["done.lua"]},check:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!1,code:n["check.lua"]},submit:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["submit.lua"]},register:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick","conditions_check"],refresh_expiration:!0,code:n["register.lua"]},free:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["free.lua"]},current_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!1,code:n["current_reservoir.lua"]},increment_reservoir:{keys:e.allKeys,headers:["validate_keys","validate_client","process_tick"],refresh_expiration:!0,code:n["increment_reservoir.lua"]}},e.names=Object.keys(i),e.keys=function(e,t){return i[e].keys(t)},e.payload=function(e){var n;return n=i[e],Array.prototype.concat(t.refs,n.headers.map(function(e){return t[e]}),n.refresh_expiration?t.refresh_expiration:"",n.code).join("\n")}),Scripts;var e,t,n,i}function requireRedisConnection(){if(hasRequiredRedisConnection)return RedisConnection_1;function asyncGeneratorStep(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(e){asyncGeneratorStep(o,i,r,a,s,"next",e)}function s(e){asyncGeneratorStep(o,i,r,a,s,"throw",e)}a(void 0)})}}var Events,RedisConnection,Scripts,parser;return hasRequiredRedisConnection=1,parser=requireParser(),Events=requireEvents(),Scripts=requireScripts(),RedisConnection=function(){class RedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("redis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null==this.client&&(this.client=this.Redis.createClient(this.clientOptions)),this.subscriber=this.client.duplicate(),this.limiters={},this.shas={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then(()=>this._loadScripts()).then(()=>({client:this.client,subscriber:this.subscriber}))}_setup(e,t){return e.setMaxListeners(0),new this.Promise((n,i)=>(e.on("error",e=>this.Events.trigger("error",e)),t&&e.on("message",(e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0}),e.ready?n():e.once("ready",n)))}_loadScript(e){return new this.Promise((t,n)=>{var i;return i=Scripts.payload(e),this.client.multi([["script","load",i]]).exec((i,r)=>null!=i?n(i):(this.shas[e]=r[0],t(r[0])))})}_loadScripts(){return this.Promise.all(Scripts.names.map(e=>this._loadScript(e)))}__runCommand__(e){var t=this;return _asyncToGenerator(function*(){return yield t.ready,new t.Promise((n,i)=>t.client.multi([e]).exec_atomic(function(e,t){return null!=e?i(e):n(t[0])}))})()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map(t=>new this.Promise((n,i)=>{var r;return r=i=>{if(i===t)return this.subscriber.removeListener("subscribe",r),this.limiters[t]=e,n()},this.subscriber.on("subscribe",r),this.subscriber.subscribe(t)})))}__removeLimiter__(e){var t=this;return this.Promise.all([e.channel(),e.channel_client()].map(function(){var e=_asyncToGenerator(function*(e){return t.terminated||(yield new t.Promise((n,i)=>t.subscriber.unsubscribe(e,function(t,r){return null!=t?i(t):r===e?n():void 0}))),delete t.limiters[e]});return function(t){return e.apply(this,arguments)}}()))}__scriptArgs__(e,t,n,i){var r;return r=Scripts.keys(e,t),[this.shas[e],r.length].concat(r,n,i)}__scriptFn__(e){return this.client.evalsha.bind(this.client)}disconnect(e=!0){var t,n,i,r;for(t=0,i=(r=Object.keys(this.limiters)).length;t<i;t++)n=r[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,this.client.end(e),this.subscriber.end(e),this.Promise.resolve()}}return RedisConnection.prototype.datastore="redis",RedisConnection.prototype.defaults={Redis:null,clientOptions:{},client:null,Promise:Promise,Events:null},RedisConnection}.call(void 0),RedisConnection_1=RedisConnection,RedisConnection_1}function requireIORedisConnection(){if(hasRequiredIORedisConnection)return IORedisConnection_1;function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(e){asyncGeneratorStep(o,i,r,a,s,"next",e)}function s(e){asyncGeneratorStep(o,i,r,a,s,"throw",e)}a(void 0)})}}var Events,IORedisConnection,Scripts,parser;return hasRequiredIORedisConnection=1,parser=requireParser(),Events=requireEvents(),Scripts=requireScripts(),IORedisConnection=function(){class IORedisConnection{constructor(options={}){parser.load(options,this.defaults,this),null==this.Redis&&(this.Redis=eval("require")("ioredis")),null==this.Events&&(this.Events=new Events(this)),this.terminated=!1,null!=this.clusterNodes?(this.client=new this.Redis.Cluster(this.clusterNodes,this.clientOptions),this.subscriber=new this.Redis.Cluster(this.clusterNodes,this.clientOptions)):null!=this.client&&null==this.client.duplicate?this.subscriber=new this.Redis.Cluster(this.client.startupNodes,this.client.options):(null==this.client&&(this.client=new this.Redis(this.clientOptions)),this.subscriber=this.client.duplicate()),this.limiters={},this.ready=this.Promise.all([this._setup(this.client,!1),this._setup(this.subscriber,!0)]).then(()=>(this._loadScripts(),{client:this.client,subscriber:this.subscriber}))}_setup(e,t){return e.setMaxListeners(0),new this.Promise((n,i)=>(e.on("error",e=>this.Events.trigger("error",e)),t&&e.on("message",(e,t)=>{var n;return null!=(n=this.limiters[e])?n._store.onMessage(e,t):void 0}),"ready"===e.status?n():e.once("ready",n)))}_loadScripts(){return Scripts.names.forEach(e=>this.client.defineCommand(e,{lua:Scripts.payload(e)}))}__runCommand__(e){var t=this;return _asyncToGenerator(function*(){yield t.ready;var n=_slicedToArray(yield t.client.pipeline([e]).exec(),1),i=_slicedToArray(n[0],2);return i[0],i[1]})()}__addLimiter__(e){return this.Promise.all([e.channel(),e.channel_client()].map(t=>new this.Promise((n,i)=>this.subscriber.subscribe(t,()=>(this.limiters[t]=e,n())))))}__removeLimiter__(e){var t=this;return[e.channel(),e.channel_client()].forEach(function(){var e=_asyncToGenerator(function*(e){return t.terminated||(yield t.subscriber.unsubscribe(e)),delete t.limiters[e]});return function(t){return e.apply(this,arguments)}}())}__scriptArgs__(e,t,n,i){var r;return[(r=Scripts.keys(e,t)).length].concat(r,n,i)}__scriptFn__(e){return this.client[e].bind(this.client)}disconnect(e=!0){var t,n,i,r;for(t=0,i=(r=Object.keys(this.limiters)).length;t<i;t++)n=r[t],clearInterval(this.limiters[n]._store.heartbeat);return this.limiters={},this.terminated=!0,e?this.Promise.all([this.client.quit(),this.subscriber.quit()]):(this.client.disconnect(),this.subscriber.disconnect(),this.Promise.resolve())}}return IORedisConnection.prototype.datastore="ioredis",IORedisConnection.prototype.defaults={Redis:null,clientOptions:{},clusterNodes:null,client:null,Promise:Promise,Events:null},IORedisConnection}.call(void 0),IORedisConnection_1=IORedisConnection,IORedisConnection_1}function requireRedisDatastore(){if(hasRequiredRedisDatastore)return RedisDatastore_1;function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function t(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function n(e){return function(){var n=this,i=arguments;return new Promise(function(r,o){var a=e.apply(n,i);function s(e){t(a,r,o,s,c,"next",e)}function c(e){t(a,r,o,s,c,"throw",e)}s(void 0)})}}var i,r,o,a,s;return hasRequiredRedisDatastore=1,s=requireParser(),i=requireBottleneckError(),o=requireRedisConnection(),r=requireIORedisConnection(),a=class{constructor(e,t,n){this.instance=e,this.storeOptions=t,this.originalId=this.instance.id,this.clientId=this.instance._randomIndex(),s.load(n,n,this),this.clients={},this.capacityPriorityCounters={},this.sharedConnection=null!=this.connection,null==this.connection&&(this.connection="redis"===this.instance.datastore?new o({Redis:this.Redis,clientOptions:this.clientOptions,Promise:this.Promise,Events:this.instance.Events}):"ioredis"===this.instance.datastore?new r({Redis:this.Redis,clientOptions:this.clientOptions,clusterNodes:this.clusterNodes,Promise:this.Promise,Events:this.instance.Events}):void 0),this.instance.connection=this.connection,this.instance.datastore=this.connection.datastore,this.ready=this.connection.ready.then(e=>(this.clients=e,this.runScript("init",this.prepareInitSettings(this.clearDatastore)))).then(()=>this.connection.__addLimiter__(this.instance)).then(()=>this.runScript("register_client",[this.instance.queued()])).then(()=>{var e;return"function"==typeof(e=this.heartbeat=setInterval(()=>this.runScript("heartbeat",[]).catch(e=>this.instance.Events.trigger("error",e)),this.heartbeatInterval)).unref&&e.unref(),this.clients})}__publish__(e){var t=this;return n(function*(){return(yield t.ready).client.publish(t.instance.channel(),`message:${e.toString()}`)})()}onMessage(t,i){var r=this;return n(function*(){var t,o,a,s,c,l,d,u,p,m;try{d=i.indexOf(":");var h=[i.slice(0,d),i.slice(d+1)];if(a=h[1],"capacity"===(m=h[0]))return yield r.instance._drainAll(a.length>0?~~a:void 0);if("capacity-priority"===m){var f=e(a.split(":"),3);return p=f[0],u=f[1],o=f[2],t=p.length>0?~~p:void 0,u===r.clientId?(s=yield r.instance._drainAll(t),l=null!=t?t-(s||0):"",yield r.clients.client.publish(r.instance.channel(),`capacity-priority:${l}::${o}`)):""===u?(clearTimeout(r.capacityPriorityCounters[o]),delete r.capacityPriorityCounters[o],r.instance._drainAll(t)):r.capacityPriorityCounters[o]=setTimeout(n(function*(){var e;try{return delete r.capacityPriorityCounters[o],yield r.runScript("blacklist_client",[u]),yield r.instance._drainAll(t)}catch(t){return e=t,r.instance.Events.trigger("error",e)}}),1e3)}if("message"===m)return r.instance.Events.trigger("message",a);if("blocked"===m)return yield r.instance._dropAllQueued()}catch(e){return c=e,r.instance.Events.trigger("error",c)}})()}__disconnect__(e){return clearInterval(this.heartbeat),this.sharedConnection?this.connection.__removeLimiter__(this.instance):this.connection.disconnect(e)}runScript(e,t){var i=this;return n(function*(){return"init"!==e&&"register_client"!==e&&(yield i.ready),new i.Promise((n,r)=>{var o,a;return o=[Date.now(),i.clientId].concat(t),i.instance.Events.trigger("debug",`Calling Redis script: ${e}.lua`,o),a=i.connection.__scriptArgs__(e,i.originalId,o,function(e,t){return null!=e?r(e):n(t)}),i.connection.__scriptFn__(e)(...a)}).catch(n=>"SETTINGS_KEY_NOT_FOUND"===n.message?"heartbeat"===e?i.Promise.resolve():i.runScript("init",i.prepareInitSettings(!1)).then(()=>i.runScript(e,t)):"UNKNOWN_CLIENT"===n.message?i.runScript("register_client",[i.instance.queued()]).then(()=>i.runScript(e,t)):i.Promise.reject(n))})()}prepareArray(e){var t,n,i,r;for(i=[],t=0,n=e.length;t<n;t++)r=e[t],i.push(null!=r?r.toString():"");return i}prepareObject(e){var t,n,i;for(n in t=[],e)i=e[n],t.push(n,null!=i?i.toString():"");return t}prepareInitSettings(e){var t;return(t=this.prepareObject(Object.assign({},this.storeOptions,{id:this.originalId,version:this.instance.version,groupTimeout:this.timeout,clientTimeout:this.clientTimeout}))).unshift(e?1:0,this.instance.version),t}convertBool(e){return!!e}__updateSettings__(e){var t=this;return n(function*(){return yield t.runScript("update_settings",t.prepareObject(e)),s.overwrite(e,e,t.storeOptions)})()}__running__(){return this.runScript("running",[])}__queued__(){return this.runScript("queued",[])}__done__(){return this.runScript("done",[])}__groupCheck__(){var e=this;return n(function*(){return e.convertBool(yield e.runScript("group_check",[]))})()}__incrementReservoir__(e){return this.runScript("increment_reservoir",[e])}__currentReservoir__(){return this.runScript("current_reservoir",[])}__check__(e){var t=this;return n(function*(){return t.convertBool(yield t.runScript("check",t.prepareArray([e])))})()}__register__(t,i,r){var o=this;return n(function*(){var n,a,s,c=e(yield o.runScript("register",o.prepareArray([t,i,r])),3);return a=c[0],s=c[1],n=c[2],{success:o.convertBool(a),wait:s,reservoir:n}})()}__submit__(t,r){var o=this;return n(function*(){var n,a,s,c,l;try{var d=e(yield o.runScript("submit",o.prepareArray([t,r])),3);return c=d[0],n=d[1],l=d[2],{reachedHWM:o.convertBool(c),blocked:o.convertBool(n),strategy:l}}catch(t){if(0===(a=t).message.indexOf("OVERWEIGHT")){var u=e(a.message.split(":"),3);throw u[0],r=u[1],s=u[2],new i(`Impossible to add a job having a weight of ${r} to a limiter having a maxConcurrent setting of ${s}`)}throw a}})()}__free__(e,t){var i=this;return n(function*(){return{running:yield i.runScript("free",i.prepareArray([e]))}})()}},RedisDatastore_1=a}function requireStates(){return hasRequiredStates?States_1:(hasRequiredStates=1,e=requireBottleneckError(),t=class{constructor(e){this.status=e,this._jobs={},this.counts=this.status.map(function(){return 0})}next(e){var t,n;return n=(t=this._jobs[e])+1,null!=t&&n<this.status.length?(this.counts[t]--,this.counts[n]++,this._jobs[e]++):null!=t?(this.counts[t]--,delete this._jobs[e]):void 0}start(e){return this._jobs[e]=0,this.counts[0]++}remove(e){var t;return null!=(t=this._jobs[e])&&(this.counts[t]--,delete this._jobs[e]),null!=t}jobStatus(e){var t;return null!=(t=this.status[this._jobs[e]])?t:null}statusJobs(t){var n,i,r,o;if(null!=t){if((i=this.status.indexOf(t))<0)throw new e(`status must be one of ${this.status.join(", ")}`);for(n in o=[],r=this._jobs)r[n]===i&&o.push(n);return o}return Object.keys(this._jobs)}statusCounts(){return this.counts.reduce((e,t,n)=>(e[this.status[n]]=t,e),{})}},States_1=t);var e,t}function requireSync(){if(hasRequiredSync)return Sync_1;function e(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function t(t){return function(){var n=this,i=arguments;return new Promise(function(r,o){var a=t.apply(n,i);function s(t){e(a,r,o,s,c,"next",t)}function c(t){e(a,r,o,s,c,"throw",t)}s(void 0)})}}var n,i;return hasRequiredSync=1,n=requireDLList(),i=class{constructor(e,t){this.schedule=this.schedule.bind(this),this.name=e,this.Promise=t,this._running=0,this._queue=new n}isEmpty(){return 0===this._queue.length}_tryToRun(){var e=this;return t(function*(){var n,i,r,o,a,s,c;if(e._running<1&&e._queue.length>0){e._running++;var l=e._queue.shift();return c=l.task,n=l.args,a=l.resolve,o=l.reject,i=yield t(function*(){try{return s=yield c(...n),function(){return a(s)}}catch(e){return r=e,function(){return o(r)}}})(),e._running--,e._tryToRun(),i()}})()}schedule(e,...t){var n,i,r;return r=i=null,n=new this.Promise(function(e,t){return r=e,i=t}),this._queue.push({task:e,args:t,resolve:r,reject:i}),this._tryToRun(),n}},Sync_1=i}const version$6="2.19.5";var require$$8={version:version$6},Group_1,hasRequiredGroup,Batcher_1,hasRequiredBatcher,Bottleneck_1,hasRequiredBottleneck,lib,hasRequiredLib;function requireGroup(){if(hasRequiredGroup)return Group_1;function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function t(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function n(e){return function(){var n=this,i=arguments;return new Promise(function(r,o){var a=e.apply(n,i);function s(e){t(a,r,o,s,c,"next",e)}function c(e){t(a,r,o,s,c,"throw",e)}s(void 0)})}}var i,r,o,a,s,c;return hasRequiredGroup=1,c=requireParser(),i=requireEvents(),a=requireRedisConnection(),o=requireIORedisConnection(),s=requireScripts(),r=function(){class t{constructor(e={}){this.deleteKey=this.deleteKey.bind(this),this.limiterOptions=e,c.load(this.limiterOptions,this.defaults,this),this.Events=new i(this),this.instances={},this.Bottleneck=requireBottleneck(),this._startAutoCleanup(),this.sharedConnection=null!=this.connection,null==this.connection&&("redis"===this.limiterOptions.datastore?this.connection=new a(Object.assign({},this.limiterOptions,{Events:this.Events})):"ioredis"===this.limiterOptions.datastore&&(this.connection=new o(Object.assign({},this.limiterOptions,{Events:this.Events}))))}key(e=""){var t;return null!=(t=this.instances[e])?t:(()=>{var t;return t=this.instances[e]=new this.Bottleneck(Object.assign(this.limiterOptions,{id:`${this.id}-${e}`,timeout:this.timeout,connection:this.connection})),this.Events.trigger("created",t,e),t})()}deleteKey(e=""){var t=this;return n(function*(){var n,i;return i=t.instances[e],t.connection&&(n=yield t.connection.__runCommand__(["del",...s.allKeys(`${t.id}-${e}`)])),null!=i&&(delete t.instances[e],yield i.disconnect()),null!=i||n>0})()}limiters(){var e,t,n,i;for(e in n=[],t=this.instances)i=t[e],n.push({key:e,limiter:i});return n}keys(){return Object.keys(this.instances)}clusterKeys(){var t=this;return n(function*(){var n,i,r,o,a,s,c;if(null==t.connection)return t.Promise.resolve(t.keys());for(a=[],n=null,c=`b_${t.id}-`.length,9;0!==n;){var l=e(yield t.connection.__runCommand__(["scan",null!=n?n:0,"match",`b_${t.id}-*_settings`,"count",1e4]),2);for(n=~~l[0],r=0,s=(i=l[1]).length;r<s;r++)o=i[r],a.push(o.slice(c,-9))}return a})()}_startAutoCleanup(){var e,t=this;return clearInterval(this.interval),"function"==typeof(e=this.interval=setInterval(n(function*(){var e,n,i,r,o,a;for(n in o=Date.now(),r=[],i=t.instances){a=i[n];try{(yield a._store.__groupCheck__(o))?r.push(t.deleteKey(n)):r.push(void 0)}catch(t){e=t,r.push(a.Events.trigger("error",e))}}return r}),this.timeout/2)).unref?e.unref():void 0}updateSettings(e={}){if(c.overwrite(e,this.defaults,this),c.overwrite(e,e,this.limiterOptions),null!=e.timeout)return this._startAutoCleanup()}disconnect(e=!0){var t;if(!this.sharedConnection)return null!=(t=this.connection)?t.disconnect(e):void 0}}return t.prototype.defaults={timeout:3e5,connection:null,Promise:Promise,id:"group-key"},t}.call(void 0),Group_1=r}function requireBatcher(){return hasRequiredBatcher?Batcher_1:(hasRequiredBatcher=1,n=requireParser(),t=requireEvents(),e=function(){class e{constructor(e={}){this.options=e,n.load(this.options,this.defaults,this),this.Events=new t(this),this._arr=[],this._resetPromise(),this._lastFlush=Date.now()}_resetPromise(){return this._promise=new this.Promise((e,t)=>this._resolve=e)}_flush(){return clearTimeout(this._timeout),this._lastFlush=Date.now(),this._resolve(),this.Events.trigger("batch",this._arr),this._arr=[],this._resetPromise()}add(e){var t;return this._arr.push(e),t=this._promise,this._arr.length===this.maxSize?this._flush():null!=this.maxTime&&1===this._arr.length&&(this._timeout=setTimeout(()=>this._flush(),this.maxTime)),t}}return e.prototype.defaults={maxTime:null,maxSize:null,Promise:Promise},e}.call(void 0),Batcher_1=e);var e,t,n}function requireBottleneck(){if(hasRequiredBottleneck)return Bottleneck_1;function e(e,t){return i(e)||function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n}(e,t)||n()}function t(e){return i(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function i(e){if(Array.isArray(e))return e}function r(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(i,o){var a=e.apply(t,n);function s(e){r(a,i,o,s,c,"next",e)}function c(e){r(a,i,o,s,c,"throw",e)}s(void 0)})}}hasRequiredBottleneck=1;var a,s,c,l,d,u,p,m,h,f=[].splice;return h=requireParser(),d=requireQueues(),c=requireJob(),l=requireLocalDatastore(),u=requireRedisDatastore(),s=requireEvents(),p=requireStates(),m=requireSync(),a=function(){class n{constructor(e={},...t){var i,r;this._addToQueue=this._addToQueue.bind(this),this._validateOptions(e,t),h.load(e,this.instanceDefaults,this),this._queues=new d(10),this._scheduled={},this._states=new p(["RECEIVED","QUEUED","RUNNING","EXECUTING"].concat(this.trackDoneStatus?["DONE"]:[])),this._limiter=null,this.Events=new s(this),this._submitLock=new m("submit",this.Promise),this._registerLock=new m("register",this.Promise),r=h.load(e,this.storeDefaults,{}),this._store=function(){if("redis"===this.datastore||"ioredis"===this.datastore||null!=this.connection)return i=h.load(e,this.redisStoreDefaults,{}),new u(this,r,i);if("local"===this.datastore)return i=h.load(e,this.localStoreDefaults,{}),new l(this,r,i);throw new n.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`)}.call(this),this._queues.on("leftzero",()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.ref?e.ref():void 0}),this._queues.on("zero",()=>{var e;return null!=(e=this._store.heartbeat)&&"function"==typeof e.unref?e.unref():void 0})}_validateOptions(e,t){if(null==e||"object"!=typeof e||0!==t.length)throw new n.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-to-v2 if you're upgrading from Bottleneck v1.")}ready(){return this._store.ready}clients(){return this._store.clients}channel(){return`b_${this.id}`}channel_client(){return`b_${this.id}_${this._store.clientId}`}publish(e){return this._store.__publish__(e)}disconnect(e=!0){return this._store.__disconnect__(e)}chain(e){return this._limiter=e,this}queued(e){return this._queues.queued(e)}clusterQueued(){return this._store.__queued__()}empty(){return 0===this.queued()&&this._submitLock.isEmpty()}running(){return this._store.__running__()}done(){return this._store.__done__()}jobStatus(e){return this._states.jobStatus(e)}jobs(e){return this._states.statusJobs(e)}counts(){return this._states.statusCounts()}_randomIndex(){return Math.random().toString(36).slice(2)}check(e=1){return this._store.__check__(e)}_clearGlobalState(e){return null!=this._scheduled[e]&&(clearTimeout(this._scheduled[e].expiration),delete this._scheduled[e],!0)}_free(e,t,n,i){var r=this;return o(function*(){var t,o;try{if(o=(yield r._store.__free__(e,n.weight)).running,r.Events.trigger("debug",`Freed ${n.id}`,i),0===o&&r.empty())return r.Events.trigger("idle")}catch(e){return t=e,r.Events.trigger("error",t)}})()}_run(e,t,n){var i,r,o;return t.doRun(),i=this._clearGlobalState.bind(this,e),o=this._run.bind(this,e,t),r=this._free.bind(this,e,t),this._scheduled[e]={timeout:setTimeout(()=>t.doExecute(this._limiter,i,o,r),n),expiration:null!=t.options.expiration?setTimeout(function(){return t.doExpire(i,o,r)},n+t.options.expiration):void 0,job:t}}_drainOne(e){return this._registerLock.schedule(()=>{var t,n,i,r,o;if(0===this.queued())return this.Promise.resolve(null);o=this._queues.getFirst();var a=i=o.first();return r=a.options,t=a.args,null!=e&&r.weight>e?this.Promise.resolve(null):(this.Events.trigger("debug",`Draining ${r.id}`,{args:t,options:r}),n=this._randomIndex(),this._store.__register__(n,r.weight,r.expiration).then(({success:e,wait:a,reservoir:s})=>{var c;return this.Events.trigger("debug",`Drained ${r.id}`,{success:e,args:t,options:r}),e?(o.shift(),(c=this.empty())&&this.Events.trigger("empty"),0===s&&this.Events.trigger("depleted",c),this._run(n,i,a),this.Promise.resolve(r.weight)):this.Promise.resolve(null)}))})}_drainAll(e,t=0){return this._drainOne(e).then(n=>{var i;return null!=n?(i=null!=e?e-n:e,this._drainAll(i,t+n)):this.Promise.resolve(t)}).catch(e=>this.Events.trigger("error",e))}_dropAllQueued(e){return this._queues.shiftAll(function(t){return t.doDrop({message:e})})}stop(e={}){var t,i;return e=h.load(e,this.stopDefaults),i=e=>{var t;return t=()=>{var t;return(t=this._states.counts)[0]+t[1]+t[2]+t[3]===e},new this.Promise((e,n)=>t()?e():this.on("done",()=>{if(t())return this.removeAllListeners("done"),e()}))},t=e.dropWaitingJobs?(this._run=function(t,n){return n.doDrop({message:e.dropErrorMessage})},this._drainOne=()=>this.Promise.resolve(null),this._registerLock.schedule(()=>this._submitLock.schedule(()=>{var t,n,r;for(t in n=this._scheduled)r=n[t],"RUNNING"===this.jobStatus(r.job.options.id)&&(clearTimeout(r.timeout),clearTimeout(r.expiration),r.job.doDrop({message:e.dropErrorMessage}));return this._dropAllQueued(e.dropErrorMessage),i(0)}))):this.schedule({priority:9,weight:0},()=>i(1)),this._receive=function(t){return t._reject(new n.prototype.BottleneckError(e.enqueueErrorMessage))},this.stop=()=>this.Promise.reject(new n.prototype.BottleneckError("stop() has already been called")),t}_addToQueue(e){var t=this;return o(function*(){var i,r,o,a,s,c,l;i=e.args,a=e.options;try{var d=yield t._store.__submit__(t.queued(),a.weight);s=d.reachedHWM,r=d.blocked,l=d.strategy}catch(n){return o=n,t.Events.trigger("debug",`Could not queue ${a.id}`,{args:i,options:a,error:o}),e.doDrop({error:o}),!1}return r?(e.doDrop(),!0):s&&(null!=(c=l===n.prototype.strategy.LEAK?t._queues.shiftLastFrom(a.priority):l===n.prototype.strategy.OVERFLOW_PRIORITY?t._queues.shiftLastFrom(a.priority+1):l===n.prototype.strategy.OVERFLOW?e:void 0)&&c.doDrop(),null==c||l===n.prototype.strategy.OVERFLOW)?(null==c&&e.doDrop(),s):(e.doQueue(s,r),t._queues.push(e),yield t._drainAll(),s)})()}_receive(e){return null!=this._states.jobStatus(e.options.id)?(e._reject(new n.prototype.BottleneckError(`A job with the same id already exists (id=${e.options.id})`)),!1):(e.doReceive(),this._submitLock.schedule(this._addToQueue,e))}submit(...n){var i,r,o,a,s,l,d,u,p;"function"==typeof n[0]?(l=t(n),r=l[0],n=l.slice(1),d=e(f.call(n,-1),1),i=d[0],a=h.load({},this.jobDefaults)):(a=(u=t(n))[0],r=u[1],n=u.slice(2),p=e(f.call(n,-1),1),i=p[0],a=h.load(a,this.jobDefaults));return s=(...e)=>new this.Promise(function(t,n){return r(...e,function(...e){return(null!=e[0]?n:t)(e)})}),(o=new c(s,n,a,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise)).promise.then(function(e){return"function"==typeof i?i(...e):void 0}).catch(function(e){return Array.isArray(e)?"function"==typeof i?i(...e):void 0:"function"==typeof i?i(e):void 0}),this._receive(o)}schedule(...e){var n,i,r;if("function"==typeof e[0]){var o=t(e);r=o[0],e=o.slice(1),i={}}else{var a=t(e);i=a[0],r=a[1],e=a.slice(2)}return n=new c(r,e,i,this.jobDefaults,this.rejectOnDrop,this.Events,this._states,this.Promise),this._receive(n),n.promise}wrap(e){var t,n;return t=this.schedule.bind(this),(n=function(...n){return t(e.bind(this),...n)}).withOptions=function(n,...i){return t(n,e,...i)},n}updateSettings(e={}){var t=this;return o(function*(){return yield t._store.__updateSettings__(h.overwrite(e,t.storeDefaults)),h.overwrite(e,t.instanceDefaults,t),t})()}currentReservoir(){return this._store.__currentReservoir__()}incrementReservoir(e=0){return this._store.__incrementReservoir__(e)}}return n.default=n,n.Events=s,n.version=n.prototype.version=require$$8.version,n.strategy=n.prototype.strategy={LEAK:1,OVERFLOW:2,OVERFLOW_PRIORITY:4,BLOCK:3},n.BottleneckError=n.prototype.BottleneckError=requireBottleneckError(),n.Group=n.prototype.Group=requireGroup(),n.RedisConnection=n.prototype.RedisConnection=requireRedisConnection(),n.IORedisConnection=n.prototype.IORedisConnection=requireIORedisConnection(),n.Batcher=n.prototype.Batcher=requireBatcher(),n.prototype.jobDefaults={priority:5,weight:1,expiration:null,id:"<no-id>"},n.prototype.storeDefaults={maxConcurrent:null,minTime:0,highWater:null,strategy:n.prototype.strategy.LEAK,penalty:null,reservoir:null,reservoirRefreshInterval:null,reservoirRefreshAmount:null,reservoirIncreaseInterval:null,reservoirIncreaseAmount:null,reservoirIncreaseMaximum:null},n.prototype.localStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:250},n.prototype.redisStoreDefaults={Promise:Promise,timeout:null,heartbeatInterval:5e3,clientTimeout:1e4,Redis:null,clientOptions:{},clusterNodes:null,clearDatastore:!1,connection:null},n.prototype.instanceDefaults={datastore:"local",connection:null,id:"<no-id>",rejectOnDrop:!0,trackDoneStatus:!1,Promise:Promise},n.prototype.stopDefaults={enqueueErrorMessage:"This limiter has been stopped and cannot accept new jobs.",dropWaitingJobs:!0,dropErrorMessage:"This limiter has been stopped."},n}.call(void 0),Bottleneck_1=a}function requireLib(){return hasRequiredLib?lib:(hasRequiredLib=1,lib=requireBottleneck())}var libExports=requireLib(),Bottleneck=getDefaultExportFromCjs(libExports);const DEFAULT_AWS_CONFIGURATION={region:"eu-central-2"},splitEvery$1=(e,t)=>Array.from({length:Math.ceil(t.length/e)}).map((n,i)=>t.slice(i*e,i*e+e)),until=async(e,t,n,i=0)=>{const r=await t(n,i);return await e(r,i)?r:until(e,t,r,i+1)},DEFAULT_BATCH_ITEMS_MAX_RETRIES=50;let queue;const makeKey=e=>"string"==typeof e?{id:e}:e,deleteItem=async(e,t,n,i,r={})=>{try{const{ReturnValues:o="NONE"}=r,a=new DeleteCommand({Key:makeKey(i),ReturnValues:o,TableName:e.tableNamePrefix+n});return(await queue.schedule(()=>t.send(a))).Attributes}catch(t){return void(e.logger&&e.logger.error(t))}},getItem=async(e,t,n,i,r={})=>{try{const{ConsistentRead:o=!1}=r,a=new GetCommand({ConsistentRead:o,Key:makeKey(i),TableName:e.tableNamePrefix+n});return(await queue.schedule(()=>t.send(a))).Item}catch(t){return void(e.logger&&e.logger.error(t))}},putItem=async(e,t,n,i)=>{try{const{expires:r,...o}=i,a=new PutCommand({Item:null===r?o:i,TableName:e.tableNamePrefix+n});return await queue.schedule(()=>t.send(a))&&i}catch(t){return void(e.logger&&e.logger.error(t))}},updateItem=async(e,t,n,i,r={})=>{try{const o=new UpdateCommand({Key:makeKey(i),...r,ReturnValues:"ALL_NEW",TableName:e.tableNamePrefix+n});return(await queue.schedule(async()=>t.send(o))).Attributes}catch(t){return void(e.logger&&e.logger.error(t))}},hasNoUnprocessedItems=({UnprocessedItems:e})=>!e||0===Object.keys(e).length,makeBatchWriteRequestWithExponentialBackoff=(e,t,n)=>async(i,r)=>{if(r>n)throw new Error("Reached maximum number of DynamoDB BatchWrite request retries.");const o=new BatchWriteCommand({RequestItems:i.UnprocessedItems??{[t]:i.map(e=>({PutRequest:{Item:e}}))},ReturnConsumedCapacity:"TOTAL",ReturnItemCollectionMetrics:"SIZE"});return e.send(o)},batchWriteItems=async(e,t,n,i)=>{try{const r=splitEvery$1(25,i);return await Promise.all(r.map(async i=>queue.schedule(async()=>until(hasNoUnprocessedItems,makeBatchWriteRequestWithExponentialBackoff(t,e.tableNamePrefix+n,e.batchWriteMaxRetries??DEFAULT_BATCH_ITEMS_MAX_RETRIES),i))))&&i}catch(t){return void(e.logger&&e.logger.error(t))}},scanTable=async(e,t,n,i={})=>{try{const{ConsistentRead:r=!1}=i,o=new ScanCommand({...i,ConsistentRead:r,TableName:e.tableNamePrefix+n});return await queue.schedule(()=>t.send(o))}catch(t){return void(e.logger&&e.logger.error(t))}},queryTable=async(e,t,n,i={})=>{try{const{ConsistentRead:r=!1}=i,o=new QueryCommand({...i,ConsistentRead:r,TableName:e.tableNamePrefix+n});return await queue.schedule(()=>t.send(o))}catch(t){return void(e.logger&&e.logger.error(t))}},dynamodb=e=>{const{clientConfig:t,...n}={...DEFAULT_AWS_CONFIGURATION,...e},i=new DynamoDBClient(n.dockerConfig?{credentials:{accessKeyId:"foobarkey",secretAccessKey:"foobarsecret"},endpoint:n.dockerConfig.endpoint,region:"local",retryMode:"standard"}:{retryMode:"standard",...t}),r=DynamoDBDocumentClient.from(i);return queue=new Bottleneck({maxConcurrent:n.queueConfig?.queueConcurrency??25,minTime:n.queueConfig?.queueDelay??void 0}),{batchWriteItems:(e,t)=>batchWriteItems(n,r,e,t),deleteItem:(e,t,i)=>deleteItem(n,r,e,t,i),getItem:(e,t,i)=>getItem(n,r,e,t,i),putItem:(e,t)=>putItem(n,r,e,t),queryTable:(e,t)=>queryTable(n,r,e,t),scanTable:(e,t)=>scanTable(n,r,e,t),updateItem:(e,t,i)=>updateItem(n,r,e,t,i)}},resolveEventStreamSerdeConfig=e=>Object.assign(e,{eventStreamMarshaller:e.eventStreamSerdeProvider(e)}),defaultLambdaHttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext$1(t).operation,region:await normalizeProvider$4(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption$3(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"lambda",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const defaultLambdaHttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption$3(e)),t},resolveHttpAuthSchemeConfig$3=e=>{const t=resolveAwsSdkSigV4Config$1(e);return Object.assign(t,{authSchemePreference:normalizeProvider$4(e.authSchemePreference??[])})},resolveClientEndpointParameters$3=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"lambda"}),commonParams$3={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},version$5="3.926.0";var packageInfo$3={version:version$5},Crc32=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,n;try{for(var i=__values(e),r=i.next();!r.done;r=i.next()){var o=r.value;this.checksum=this.checksum>>>8^lookupTable[255&(this.checksum^o)]}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(4294967295^this.checksum)>>>0},e}(),a_lookUpTable=[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,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],lookupTable=uint32ArrayFrom(a_lookUpTable);let Int64$1=class e{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const n=new Uint8Array(8);for(let e=7,i=Math.abs(Math.round(t));e>-1&&i>0;e--,i/=256)n[e]=i;return t<0&&negate$1(n),new e(n)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&negate$1(e),parseInt(toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}};function negate$1(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}class HeaderMarshaller{toUtf8;fromUtf8;constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){const t=[];for(const n of Object.keys(e)){const i=this.fromUtf8(n);t.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n}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 t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const r=new DataView(new ArrayBuffer(3+e.value.byteLength));r.setUint8(0,6),r.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(r.buffer);return o.set(e.value,3),o;case"string":const a=this.fromUtf8(e.value),s=new DataView(new ArrayBuffer(3+a.byteLength));s.setUint8(0,7),s.setUint16(1,a.byteLength,!1);const c=new Uint8Array(s.buffer);return c.set(a,3),c;case"timestamp":const l=new Uint8Array(9);return l[0]=8,l.set(Int64$1.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!UUID_PATTERN$1.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(fromHex(e.value.replace(/\-/g,"")),1),d}}parse(e){const t={};let n=0;for(;n<e.byteLength;){const i=e.getUint8(n++),r=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,i));switch(n+=i,e.getUint8(n++)){case 0:t[r]={type:BOOLEAN_TAG,value:!0};break;case 1:t[r]={type:BOOLEAN_TAG,value:!1};break;case 2:t[r]={type:BYTE_TAG,value:e.getInt8(n++)};break;case 3:t[r]={type:SHORT_TAG,value:e.getInt16(n,!1)},n+=2;break;case 4:t[r]={type:INT_TAG,value:e.getInt32(n,!1)},n+=4;break;case 5:t[r]={type:LONG_TAG,value:new Int64$1(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:const i=e.getUint16(n,!1);n+=2,t[r]={type:BINARY_TAG,value:new Uint8Array(e.buffer,e.byteOffset+n,i)},n+=i;break;case 7:const o=e.getUint16(n,!1);n+=2,t[r]={type:STRING_TAG,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,o))},n+=o;break;case 8:t[r]={type:TIMESTAMP_TAG,value:new Date(new Int64$1(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:const a=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,t[r]={type:UUID_TAG,value:`${toHex(a.subarray(0,4))}-${toHex(a.subarray(4,6))}-${toHex(a.subarray(6,8))}-${toHex(a.subarray(8,10))}-${toHex(a.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return t}}var HEADER_VALUE_TYPE$1;!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"}(HEADER_VALUE_TYPE$1||(HEADER_VALUE_TYPE$1={}));const BOOLEAN_TAG="boolean",BYTE_TAG="byte",SHORT_TAG="short",INT_TAG="integer",LONG_TAG="long",BINARY_TAG="binary",STRING_TAG="string",TIMESTAMP_TAG="timestamp",UUID_TAG="uuid",UUID_PATTERN$1=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,PRELUDE_MEMBER_LENGTH=4,PRELUDE_LENGTH=2*PRELUDE_MEMBER_LENGTH,CHECKSUM_LENGTH=4,MINIMUM_MESSAGE_LENGTH=PRELUDE_LENGTH+2*CHECKSUM_LENGTH;function splitMessage({byteLength:e,byteOffset:t,buffer:n}){if(e<MINIMUM_MESSAGE_LENGTH)throw new Error("Provided message too short to accommodate event stream message overhead");const i=new DataView(n,t,e),r=i.getUint32(0,!1);if(e!==r)throw new Error("Reported message length does not match received message length");const o=i.getUint32(PRELUDE_MEMBER_LENGTH,!1),a=i.getUint32(PRELUDE_LENGTH,!1),s=i.getUint32(e-CHECKSUM_LENGTH,!1),c=(new Crc32).update(new Uint8Array(n,t,PRELUDE_LENGTH));if(a!==c.digest())throw new Error(`The prelude checksum specified in the message (${a}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+PRELUDE_LENGTH,e-(PRELUDE_LENGTH+CHECKSUM_LENGTH))),s!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+PRELUDE_LENGTH+CHECKSUM_LENGTH,o),body:new Uint8Array(n,t+PRELUDE_LENGTH+CHECKSUM_LENGTH+o,r-o-(PRELUDE_LENGTH+CHECKSUM_LENGTH+CHECKSUM_LENGTH))}}class EventStreamCodec{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,t){this.headerMarshaller=new HeaderMarshaller(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage:()=>e,isEndOfStream:()=>t}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const t=this.isEndOfStream;return{getMessages:()=>e,isEndOfStream:()=>t}}encode({headers:e,body:t}){const n=this.headerMarshaller.format(e),i=n.byteLength+t.byteLength+16,r=new Uint8Array(i),o=new DataView(r.buffer,r.byteOffset,r.byteLength),a=new Crc32;return o.setUint32(0,i,!1),o.setUint32(4,n.byteLength,!1),o.setUint32(8,a.update(r.subarray(0,8)).digest(),!1),r.set(n,12),r.set(t,n.byteLength+12),o.setUint32(i-4,a.update(r.subarray(8,i-4)).digest(),!1),r}decode(e){const{headers:t,body:n}=splitMessage(e);return{headers:this.headerMarshaller.parse(t),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}class MessageDecoderStream{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.decoder.decode(e);yield t}}}class MessageEncoderStream{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=this.options.encoder.encode(e);yield t}this.options.includeEndFrame&&(yield new Uint8Array(0))}}class SmithyMessageDecoderStream{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.messageStream){const t=await this.options.deserializer(e);void 0!==t&&(yield t)}}}class SmithyMessageEncoderStream{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const e of this.options.inputStream){const t=this.options.serializer(e);yield t}}}function getChunkedStream(e){let t=0,n=0,i=null,r=null;const o=e=>{if("number"!=typeof e)throw new Error("Attempted to allocate an event message where size was not a number: "+e);t=e,n=4,i=new Uint8Array(e);new DataView(i.buffer).setUint32(0,e,!1)};return{[Symbol.asyncIterator]:async function*(){const a=e[Symbol.asyncIterator]();for(;;){const{value:e,done:s}=await a.next();if(s){if(!t)return;if(t!==n)throw new Error("Truncated event message received.");return void(yield i)}const c=e.length;let l=0;for(;l<c;){if(!i){const t=c-l;r||(r=new Uint8Array(4));const i=Math.min(4-n,t);if(r.set(e.slice(l,l+i),n),n+=i,l+=i,n<4)break;o(new DataView(r.buffer).getUint32(0,!1)),r=null}const a=Math.min(t-n,c-l);i.set(e.slice(l,l+a),n),n+=a,l+=a,t&&t===n&&(yield i,i=null,t=0,n=0)}}}}}function getMessageUnmarshaller(e,t){return async function(n){const{value:i}=n.headers[":message-type"];if("error"===i){const e=new Error(n.headers[":error-message"].value||"UnknownError");throw e.name=n.headers[":error-code"].value,e}if("exception"===i){const i=n.headers[":exception-type"].value,r={[i]:n},o=await e(r);if(o.$unknown){const e=new Error(t(n.body));throw e.name=i,e}throw o[i]}if("event"===i){const t={[n.headers[":event-type"].value]:n},i=await e(t);if(i.$unknown)return;return i}throw Error(`Unrecognizable event type: ${n.headers[":event-type"].value}`)}}let EventStreamMarshaller$1=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new EventStreamCodec(e,t),this.utfEncoder=e}deserialize(e,t){const n=getChunkedStream(e);return new SmithyMessageDecoderStream({messageStream:new MessageDecoderStream({inputStream:n,decoder:this.eventStreamCodec}),deserializer:getMessageUnmarshaller(t,this.utfEncoder)})}serialize(e,t){return new MessageEncoderStream({messageStream:new SmithyMessageEncoderStream({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const readableStreamtoIterable=e=>({[Symbol.asyncIterator]:async function*(){const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}}),iterableToReadableStream=e=>{const t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){const{done:n,value:i}=await t.next();if(n)return e.close();e.enqueue(i)}})};class EventStreamMarshaller{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new EventStreamMarshaller$1({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){const n=isReadableStream$1(e)?readableStreamtoIterable(e):e;return this.universalMarshaller.deserialize(n,t)}serialize(e,t){const n=this.universalMarshaller.serialize(e,t);return"function"==typeof ReadableStream?iterableToReadableStream(n):n}}const isReadableStream$1=e=>"function"==typeof ReadableStream&&e instanceof ReadableStream,eventStreamSerdeProvider=e=>new EventStreamMarshaller(e),s$3="required",t$3="fn",u$3="argv",v$3="ref",a$3=!0,b$3="isSet",c$3="booleanEquals",d$3="error",e$3="endpoint",f$3="tree",g$3="PartitionResult",h$3={[s$3]:!1,type:"string"},i$3={[s$3]:!0,default:!1,type:"boolean"},j$3={[v$3]:"Endpoint"},k$3={[t$3]:c$3,[u$3]:[{[v$3]:"UseFIPS"},!0]},l$3={[t$3]:c$3,[u$3]:[{[v$3]:"UseDualStack"},!0]},m$3={},n$3={[t$3]:"getAttr",[u$3]:[{[v$3]:g$3},"supportsFIPS"]},o$3={[t$3]:c$3,[u$3]:[!0,{[t$3]:"getAttr",[u$3]:[{[v$3]:g$3},"supportsDualStack"]}]},p$3=[k$3],q$3=[l$3],r$3=[{[v$3]:"Region"}],_data$3={parameters:{Region:h$3,UseDualStack:i$3,UseFIPS:i$3,Endpoint:h$3},rules:[{conditions:[{[t$3]:b$3,[u$3]:[j$3]}],rules:[{conditions:p$3,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d$3},{conditions:q$3,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d$3},{endpoint:{url:j$3,properties:m$3,headers:m$3},type:e$3}],type:f$3},{conditions:[{[t$3]:b$3,[u$3]:r$3}],rules:[{conditions:[{[t$3]:"aws.partition",[u$3]:r$3,assign:g$3}],rules:[{conditions:[k$3,l$3],rules:[{conditions:[{[t$3]:c$3,[u$3]:[a$3,n$3]},o$3],rules:[{endpoint:{url:"https://lambda-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:m$3,headers:m$3},type:e$3}],type:f$3},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d$3}],type:f$3},{conditions:p$3,rules:[{conditions:[{[t$3]:c$3,[u$3]:[n$3,a$3]}],rules:[{endpoint:{url:"https://lambda-fips.{Region}.{PartitionResult#dnsSuffix}",properties:m$3,headers:m$3},type:e$3}],type:f$3},{error:"FIPS is enabled but this partition does not support FIPS",type:d$3}],type:f$3},{conditions:q$3,rules:[{conditions:[o$3],rules:[{endpoint:{url:"https://lambda.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:m$3,headers:m$3},type:e$3}],type:f$3},{error:"DualStack is enabled but this partition does not support DualStack",type:d$3}],type:f$3},{endpoint:{url:"https://lambda.{Region}.{PartitionResult#dnsSuffix}",properties:m$3,headers:m$3},type:e$3}],type:f$3}],type:f$3},{error:"Invalid Configuration: Missing Region",type:d$3}]},ruleSet$3=_data$3,cache$3=new EndpointCache$1({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver$3=(e,t={})=>cache$3.get(e,()=>resolveEndpoint$1(ruleSet$3,{endpointParams:e,logger:t.logger}));customEndpointFunctions$1.aws=awsEndpointFunctions$1;const getRuntimeConfig$7=e=>({apiVersion:"2015-03-31",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver$3,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultLambdaHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer$1}],logger:e?.logger??new NoOpLogger$1,serviceId:e?.serviceId??"Lambda",urlParser:e?.urlParser??parseUrl$1,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),getRuntimeConfig$6=e=>{const t=resolveDefaultsModeConfig$1(e),n=()=>t().then(loadConfigsForDefaultMode$1),i=getRuntimeConfig$7(e);return{...i,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??createDefaultUserAgentProvider$1({serviceId:i.serviceId,clientVersion:packageInfo$3.version}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??eventStreamSerdeProvider,maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS$1,region:e?.region??invalidProvider$1("Region is missing"),requestHandler:FetchHttpHandler$1.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE$1),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector$1,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT$1)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT$1))}},getHttpAuthExtensionConfiguration$3=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex(t=>t.schemeId===e.schemeId);-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){i=e},credentials:()=>i}},resolveHttpAuthRuntimeConfig$3=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),resolveRuntimeExtensions$3=(e,t)=>{const n=Object.assign(getAwsRegionExtensionConfiguration$1(e),getDefaultExtensionConfiguration$1(e),getHttpHandlerExtensionConfiguration$1(e),getHttpAuthExtensionConfiguration$3(e));return t.forEach(e=>e.configure(n)),Object.assign(e,resolveAwsRegionExtensionConfiguration$1(n),resolveDefaultRuntimeConfig$1(n),resolveHttpHandlerRuntimeConfig$1(n),resolveHttpAuthRuntimeConfig$3(n))};class LambdaClient extends Client$1{config;constructor(...[e]){const t=getRuntimeConfig$6(e||{});super(t),this.initConfig=t;const n=resolveUserAgentConfig$1(resolveClientEndpointParameters$3(t)),i=resolveRetryConfig$1(n),r=resolveHostHeaderConfig$1(resolveRegionConfig$1(i)),o=resolveEndpointConfig$1(r),a=resolveEventStreamSerdeConfig(o),s=resolveHttpAuthSchemeConfig$3(a),c=resolveRuntimeExtensions$3(s,e?.extensions||[]);this.config=c,this.middlewareStack.use(getUserAgentPlugin$1(this.config)),this.middlewareStack.use(getRetryPlugin$1(this.config)),this.middlewareStack.use(getContentLengthPlugin$1(this.config)),this.middlewareStack.use(getHostHeaderPlugin$1(this.config)),this.middlewareStack.use(getLoggerPlugin$1(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin$1(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin$1(this.config,{httpAuthSchemeParametersProvider:defaultLambdaHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new DefaultIdentityProviderConfig$1({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(getHttpSigningPlugin$1(this.config))}destroy(){super.destroy()}}class LambdaServiceException extends ServiceException$2{constructor(e){super(e),Object.setPrototypeOf(this,LambdaServiceException.prototype)}}class InvalidParameterValueException extends LambdaServiceException{name="InvalidParameterValueException";$fault="client";Type;constructor(e){super({name:"InvalidParameterValueException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidParameterValueException.prototype),this.Type=e.Type}}class PolicyLengthExceededException extends LambdaServiceException{name="PolicyLengthExceededException";$fault="client";Type;constructor(e){super({name:"PolicyLengthExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,PolicyLengthExceededException.prototype),this.Type=e.Type}}class PreconditionFailedException extends LambdaServiceException{name="PreconditionFailedException";$fault="client";Type;constructor(e){super({name:"PreconditionFailedException",$fault:"client",...e}),Object.setPrototypeOf(this,PreconditionFailedException.prototype),this.Type=e.Type}}class ResourceConflictException extends LambdaServiceException{name="ResourceConflictException";$fault="client";Type;constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceConflictException.prototype),this.Type=e.Type}}let ResourceNotFoundException$2=class e extends LambdaServiceException{name="ResourceNotFoundException";$fault="client";Type;Message;constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Type=t.Type,this.Message=t.Message}},ServiceException$1=class e extends LambdaServiceException{name="ServiceException";$fault="server";Type;Message;constructor(t){super({name:"ServiceException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype),this.Type=t.Type,this.Message=t.Message}},TooManyRequestsException$2=class e extends LambdaServiceException{name="TooManyRequestsException";$fault="client";retryAfterSeconds;Type;Reason;constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.retryAfterSeconds=t.retryAfterSeconds,this.Type=t.Type,this.Reason=t.Reason}},ResourceInUseException$1=class e extends LambdaServiceException{name="ResourceInUseException";$fault="client";Type;Message;constructor(t){super({name:"ResourceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Type=t.Type,this.Message=t.Message}};class CodeSigningConfigNotFoundException extends LambdaServiceException{name="CodeSigningConfigNotFoundException";$fault="client";Type;Message;constructor(e){super({name:"CodeSigningConfigNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,CodeSigningConfigNotFoundException.prototype),this.Type=e.Type,this.Message=e.Message}}class CodeStorageExceededException extends LambdaServiceException{name="CodeStorageExceededException";$fault="client";Type;constructor(e){super({name:"CodeStorageExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,CodeStorageExceededException.prototype),this.Type=e.Type}}class CodeVerificationFailedException extends LambdaServiceException{name="CodeVerificationFailedException";$fault="client";Type;Message;constructor(e){super({name:"CodeVerificationFailedException",$fault:"client",...e}),Object.setPrototypeOf(this,CodeVerificationFailedException.prototype),this.Type=e.Type,this.Message=e.Message}}class InvalidCodeSignatureException extends LambdaServiceException{name="InvalidCodeSignatureException";$fault="client";Type;Message;constructor(e){super({name:"InvalidCodeSignatureException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidCodeSignatureException.prototype),this.Type=e.Type,this.Message=e.Message}}class EC2AccessDeniedException extends LambdaServiceException{name="EC2AccessDeniedException";$fault="server";Type;Message;constructor(e){super({name:"EC2AccessDeniedException",$fault:"server",...e}),Object.setPrototypeOf(this,EC2AccessDeniedException.prototype),this.Type=e.Type,this.Message=e.Message}}class EC2ThrottledException extends LambdaServiceException{name="EC2ThrottledException";$fault="server";Type;Message;constructor(e){super({name:"EC2ThrottledException",$fault:"server",...e}),Object.setPrototypeOf(this,EC2ThrottledException.prototype),this.Type=e.Type,this.Message=e.Message}}class EC2UnexpectedException extends LambdaServiceException{name="EC2UnexpectedException";$fault="server";Type;Message;EC2ErrorCode;constructor(e){super({name:"EC2UnexpectedException",$fault:"server",...e}),Object.setPrototypeOf(this,EC2UnexpectedException.prototype),this.Type=e.Type,this.Message=e.Message,this.EC2ErrorCode=e.EC2ErrorCode}}class EFSIOException extends LambdaServiceException{name="EFSIOException";$fault="client";Type;Message;constructor(e){super({name:"EFSIOException",$fault:"client",...e}),Object.setPrototypeOf(this,EFSIOException.prototype),this.Type=e.Type,this.Message=e.Message}}class EFSMountConnectivityException extends LambdaServiceException{name="EFSMountConnectivityException";$fault="client";Type;Message;constructor(e){super({name:"EFSMountConnectivityException",$fault:"client",...e}),Object.setPrototypeOf(this,EFSMountConnectivityException.prototype),this.Type=e.Type,this.Message=e.Message}}class EFSMountFailureException extends LambdaServiceException{name="EFSMountFailureException";$fault="client";Type;Message;constructor(e){super({name:"EFSMountFailureException",$fault:"client",...e}),Object.setPrototypeOf(this,EFSMountFailureException.prototype),this.Type=e.Type,this.Message=e.Message}}class EFSMountTimeoutException extends LambdaServiceException{name="EFSMountTimeoutException";$fault="client";Type;Message;constructor(e){super({name:"EFSMountTimeoutException",$fault:"client",...e}),Object.setPrototypeOf(this,EFSMountTimeoutException.prototype),this.Type=e.Type,this.Message=e.Message}}class ENILimitReachedException extends LambdaServiceException{name="ENILimitReachedException";$fault="server";Type;Message;constructor(e){super({name:"ENILimitReachedException",$fault:"server",...e}),Object.setPrototypeOf(this,ENILimitReachedException.prototype),this.Type=e.Type,this.Message=e.Message}}class InvalidRequestContentException extends LambdaServiceException{name="InvalidRequestContentException";$fault="client";Type;constructor(e){super({name:"InvalidRequestContentException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidRequestContentException.prototype),this.Type=e.Type}}class InvalidRuntimeException extends LambdaServiceException{name="InvalidRuntimeException";$fault="server";Type;Message;constructor(e){super({name:"InvalidRuntimeException",$fault:"server",...e}),Object.setPrototypeOf(this,InvalidRuntimeException.prototype),this.Type=e.Type,this.Message=e.Message}}class InvalidSecurityGroupIDException extends LambdaServiceException{name="InvalidSecurityGroupIDException";$fault="server";Type;Message;constructor(e){super({name:"InvalidSecurityGroupIDException",$fault:"server",...e}),Object.setPrototypeOf(this,InvalidSecurityGroupIDException.prototype),this.Type=e.Type,this.Message=e.Message}}class InvalidSubnetIDException extends LambdaServiceException{name="InvalidSubnetIDException";$fault="server";Type;Message;constructor(e){super({name:"InvalidSubnetIDException",$fault:"server",...e}),Object.setPrototypeOf(this,InvalidSubnetIDException.prototype),this.Type=e.Type,this.Message=e.Message}}class InvalidZipFileException extends LambdaServiceException{name="InvalidZipFileException";$fault="server";Type;Message;constructor(e){super({name:"InvalidZipFileException",$fault:"server",...e}),Object.setPrototypeOf(this,InvalidZipFileException.prototype),this.Type=e.Type,this.Message=e.Message}}class KMSAccessDeniedException extends LambdaServiceException{name="KMSAccessDeniedException";$fault="server";Type;Message;constructor(e){super({name:"KMSAccessDeniedException",$fault:"server",...e}),Object.setPrototypeOf(this,KMSAccessDeniedException.prototype),this.Type=e.Type,this.Message=e.Message}}class KMSDisabledException extends LambdaServiceException{name="KMSDisabledException";$fault="server";Type;Message;constructor(e){super({name:"KMSDisabledException",$fault:"server",...e}),Object.setPrototypeOf(this,KMSDisabledException.prototype),this.Type=e.Type,this.Message=e.Message}}class KMSInvalidStateException extends LambdaServiceException{name="KMSInvalidStateException";$fault="server";Type;Message;constructor(e){super({name:"KMSInvalidStateException",$fault:"server",...e}),Object.setPrototypeOf(this,KMSInvalidStateException.prototype),this.Type=e.Type,this.Message=e.Message}}class KMSNotFoundException extends LambdaServiceException{name="KMSNotFoundException";$fault="server";Type;Message;constructor(e){super({name:"KMSNotFoundException",$fault:"server",...e}),Object.setPrototypeOf(this,KMSNotFoundException.prototype),this.Type=e.Type,this.Message=e.Message}}class RecursiveInvocationException extends LambdaServiceException{name="RecursiveInvocationException";$fault="client";Type;Message;constructor(e){super({name:"RecursiveInvocationException",$fault:"client",...e}),Object.setPrototypeOf(this,RecursiveInvocationException.prototype),this.Type=e.Type,this.Message=e.Message}}class RequestTooLargeException extends LambdaServiceException{name="RequestTooLargeException";$fault="client";Type;constructor(e){super({name:"RequestTooLargeException",$fault:"client",...e}),Object.setPrototypeOf(this,RequestTooLargeException.prototype),this.Type=e.Type}}class ResourceNotReadyException extends LambdaServiceException{name="ResourceNotReadyException";$fault="server";Type;constructor(e){super({name:"ResourceNotReadyException",$fault:"server",...e}),Object.setPrototypeOf(this,ResourceNotReadyException.prototype),this.Type=e.Type}}class SerializedRequestEntityTooLargeException extends LambdaServiceException{name="SerializedRequestEntityTooLargeException";$fault="client";Type;constructor(e){super({name:"SerializedRequestEntityTooLargeException",$fault:"client",...e}),Object.setPrototypeOf(this,SerializedRequestEntityTooLargeException.prototype),this.Type=e.Type}}class SnapStartException extends LambdaServiceException{name="SnapStartException";$fault="client";Type;Message;constructor(e){super({name:"SnapStartException",$fault:"client",...e}),Object.setPrototypeOf(this,SnapStartException.prototype),this.Type=e.Type,this.Message=e.Message}}class SnapStartNotReadyException extends LambdaServiceException{name="SnapStartNotReadyException";$fault="client";Type;Message;constructor(e){super({name:"SnapStartNotReadyException",$fault:"client",...e}),Object.setPrototypeOf(this,SnapStartNotReadyException.prototype),this.Type=e.Type,this.Message=e.Message}}class SnapStartTimeoutException extends LambdaServiceException{name="SnapStartTimeoutException";$fault="client";Type;Message;constructor(e){super({name:"SnapStartTimeoutException",$fault:"client",...e}),Object.setPrototypeOf(this,SnapStartTimeoutException.prototype),this.Type=e.Type,this.Message=e.Message}}class SubnetIPAddressLimitReachedException extends LambdaServiceException{name="SubnetIPAddressLimitReachedException";$fault="server";Type;Message;constructor(e){super({name:"SubnetIPAddressLimitReachedException",$fault:"server",...e}),Object.setPrototypeOf(this,SubnetIPAddressLimitReachedException.prototype),this.Type=e.Type,this.Message=e.Message}}class UnsupportedMediaTypeException extends LambdaServiceException{name="UnsupportedMediaTypeException";$fault="client";Type;constructor(e){super({name:"UnsupportedMediaTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedMediaTypeException.prototype),this.Type=e.Type}}var InvokeWithResponseStreamResponseEvent;!function(e){e.visit=(e,t)=>void 0!==e.PayloadChunk?t.PayloadChunk(e.PayloadChunk):void 0!==e.InvokeComplete?t.InvokeComplete(e.InvokeComplete):t._(e.$unknown[0],e.$unknown[1])}(InvokeWithResponseStreamResponseEvent||(InvokeWithResponseStreamResponseEvent={}));class ProvisionedConcurrencyConfigNotFoundException extends LambdaServiceException{name="ProvisionedConcurrencyConfigNotFoundException";$fault="client";Type;constructor(e){super({name:"ProvisionedConcurrencyConfigNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ProvisionedConcurrencyConfigNotFoundException.prototype),this.Type=e.Type}}const InvocationRequestFilterSensitiveLog=e=>({...e,...e.Payload&&{Payload:SENSITIVE_STRING$1}}),InvocationResponseFilterSensitiveLog=e=>({...e,...e.Payload&&{Payload:SENSITIVE_STRING$1}}),se_InvokeCommand=async(e,t)=>{const n=requestBuilder(e,t),i=map({},isSerializableHeaderValue,{"content-type":"application/octet-stream",[_xait]:e[_IT],[_xalt]:e[_LT],[_xacc]:e[_CC]});n.bp("/2015-03-31/functions/{FunctionName}/invocations"),n.p("FunctionName",()=>e.FunctionName,"{FunctionName}",!1);const r=map({[_Q]:[,e[_Q]]});let o;return void 0!==e.Payload&&(o=e.Payload),n.m("POST").h(i).q(r).b(o),n.build()},de_InvokeCommand=async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return de_CommandError$2(e,t);const n=map({$metadata:deserializeMetadata$2(e),[_FE]:[,e.headers[_xafe]],[_LR]:[,e.headers[_xalr]],[_EV]:[,e.headers[_xaev]]}),i=await collectBody$1(e.body,t);return n.Payload=i,map(n,{StatusCode:[,e.statusCode]}),n},de_CommandError$2=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},i=loadRestJsonErrorCode$1(e,n.body);switch(i){case"InvalidParameterValueException":case"com.amazonaws.lambda#InvalidParameterValueException":throw await de_InvalidParameterValueExceptionRes(n);case"PolicyLengthExceededException":case"com.amazonaws.lambda#PolicyLengthExceededException":throw await de_PolicyLengthExceededExceptionRes(n);case"PreconditionFailedException":case"com.amazonaws.lambda#PreconditionFailedException":throw await de_PreconditionFailedExceptionRes(n);case"ResourceConflictException":case"com.amazonaws.lambda#ResourceConflictException":throw await de_ResourceConflictExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.lambda#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes$2(n);case"ServiceException":case"com.amazonaws.lambda#ServiceException":throw await de_ServiceExceptionRes(n);case"TooManyRequestsException":case"com.amazonaws.lambda#TooManyRequestsException":throw await de_TooManyRequestsExceptionRes(n);case"CodeSigningConfigNotFoundException":case"com.amazonaws.lambda#CodeSigningConfigNotFoundException":throw await de_CodeSigningConfigNotFoundExceptionRes(n);case"CodeStorageExceededException":case"com.amazonaws.lambda#CodeStorageExceededException":throw await de_CodeStorageExceededExceptionRes(n);case"CodeVerificationFailedException":case"com.amazonaws.lambda#CodeVerificationFailedException":throw await de_CodeVerificationFailedExceptionRes(n);case"InvalidCodeSignatureException":case"com.amazonaws.lambda#InvalidCodeSignatureException":throw await de_InvalidCodeSignatureExceptionRes(n);case"ResourceInUseException":case"com.amazonaws.lambda#ResourceInUseException":throw await de_ResourceInUseExceptionRes$1(n);case"ProvisionedConcurrencyConfigNotFoundException":case"com.amazonaws.lambda#ProvisionedConcurrencyConfigNotFoundException":throw await de_ProvisionedConcurrencyConfigNotFoundExceptionRes(n);case"EC2AccessDeniedException":case"com.amazonaws.lambda#EC2AccessDeniedException":throw await de_EC2AccessDeniedExceptionRes(n);case"EC2ThrottledException":case"com.amazonaws.lambda#EC2ThrottledException":throw await de_EC2ThrottledExceptionRes(n);case"EC2UnexpectedException":case"com.amazonaws.lambda#EC2UnexpectedException":throw await de_EC2UnexpectedExceptionRes(n);case"EFSIOException":case"com.amazonaws.lambda#EFSIOException":throw await de_EFSIOExceptionRes(n);case"EFSMountConnectivityException":case"com.amazonaws.lambda#EFSMountConnectivityException":throw await de_EFSMountConnectivityExceptionRes(n);case"EFSMountFailureException":case"com.amazonaws.lambda#EFSMountFailureException":throw await de_EFSMountFailureExceptionRes(n);case"EFSMountTimeoutException":case"com.amazonaws.lambda#EFSMountTimeoutException":throw await de_EFSMountTimeoutExceptionRes(n);case"ENILimitReachedException":case"com.amazonaws.lambda#ENILimitReachedException":throw await de_ENILimitReachedExceptionRes(n);case"InvalidRequestContentException":case"com.amazonaws.lambda#InvalidRequestContentException":throw await de_InvalidRequestContentExceptionRes(n);case"InvalidRuntimeException":case"com.amazonaws.lambda#InvalidRuntimeException":throw await de_InvalidRuntimeExceptionRes(n);case"InvalidSecurityGroupIDException":case"com.amazonaws.lambda#InvalidSecurityGroupIDException":throw await de_InvalidSecurityGroupIDExceptionRes(n);case"InvalidSubnetIDException":case"com.amazonaws.lambda#InvalidSubnetIDException":throw await de_InvalidSubnetIDExceptionRes(n);case"InvalidZipFileException":case"com.amazonaws.lambda#InvalidZipFileException":throw await de_InvalidZipFileExceptionRes(n);case"KMSAccessDeniedException":case"com.amazonaws.lambda#KMSAccessDeniedException":throw await de_KMSAccessDeniedExceptionRes(n);case"KMSDisabledException":case"com.amazonaws.lambda#KMSDisabledException":throw await de_KMSDisabledExceptionRes(n);case"KMSInvalidStateException":case"com.amazonaws.lambda#KMSInvalidStateException":throw await de_KMSInvalidStateExceptionRes(n);case"KMSNotFoundException":case"com.amazonaws.lambda#KMSNotFoundException":throw await de_KMSNotFoundExceptionRes(n);case"RecursiveInvocationException":case"com.amazonaws.lambda#RecursiveInvocationException":throw await de_RecursiveInvocationExceptionRes(n);case"RequestTooLargeException":case"com.amazonaws.lambda#RequestTooLargeException":throw await de_RequestTooLargeExceptionRes(n);case"ResourceNotReadyException":case"com.amazonaws.lambda#ResourceNotReadyException":throw await de_ResourceNotReadyExceptionRes(n);case"SerializedRequestEntityTooLargeException":case"com.amazonaws.lambda#SerializedRequestEntityTooLargeException":throw await de_SerializedRequestEntityTooLargeExceptionRes(n);case"SnapStartException":case"com.amazonaws.lambda#SnapStartException":throw await de_SnapStartExceptionRes(n);case"SnapStartNotReadyException":case"com.amazonaws.lambda#SnapStartNotReadyException":throw await de_SnapStartNotReadyExceptionRes(n);case"SnapStartTimeoutException":case"com.amazonaws.lambda#SnapStartTimeoutException":throw await de_SnapStartTimeoutExceptionRes(n);case"SubnetIPAddressLimitReachedException":case"com.amazonaws.lambda#SubnetIPAddressLimitReachedException":throw await de_SubnetIPAddressLimitReachedExceptionRes(n);case"UnsupportedMediaTypeException":case"com.amazonaws.lambda#UnsupportedMediaTypeException":throw await de_UnsupportedMediaTypeExceptionRes(n);default:const t=n.body;return throwDefaultError$2({output:e,parsedBody:t,errorCode:i})}},throwDefaultError$2=withBaseException(LambdaServiceException),de_CodeSigningConfigNotFoundExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new CodeSigningConfigNotFoundException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_CodeStorageExceededExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new CodeStorageExceededException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_CodeVerificationFailedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new CodeVerificationFailedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EC2AccessDeniedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new EC2AccessDeniedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EC2ThrottledExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new EC2ThrottledException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EC2UnexpectedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{EC2ErrorCode:expectString,Message:expectString,Type:expectString});Object.assign(n,r);const o=new EC2UnexpectedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EFSIOExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new EFSIOException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EFSMountConnectivityExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new EFSMountConnectivityException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EFSMountFailureExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new EFSMountFailureException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_EFSMountTimeoutExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new EFSMountTimeoutException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ENILimitReachedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new ENILimitReachedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidCodeSignatureExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new InvalidCodeSignatureException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidParameterValueExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new InvalidParameterValueException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidRequestContentExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new InvalidRequestContentException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidRuntimeExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new InvalidRuntimeException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidSecurityGroupIDExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new InvalidSecurityGroupIDException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidSubnetIDExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new InvalidSubnetIDException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_InvalidZipFileExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new InvalidZipFileException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_KMSAccessDeniedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new KMSAccessDeniedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_KMSDisabledExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new KMSDisabledException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_KMSInvalidStateExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new KMSInvalidStateException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_KMSNotFoundExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new KMSNotFoundException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_PolicyLengthExceededExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new PolicyLengthExceededException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_PreconditionFailedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new PreconditionFailedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ProvisionedConcurrencyConfigNotFoundExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new ProvisionedConcurrencyConfigNotFoundException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_RecursiveInvocationExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new RecursiveInvocationException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_RequestTooLargeExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new RequestTooLargeException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ResourceConflictExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new ResourceConflictException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ResourceInUseExceptionRes$1=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new ResourceInUseException$1({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ResourceNotFoundExceptionRes$2=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new ResourceNotFoundException$2({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ResourceNotReadyExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new ResourceNotReadyException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_SerializedRequestEntityTooLargeExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new SerializedRequestEntityTooLargeException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_ServiceExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new ServiceException$1({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_SnapStartExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new SnapStartException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_SnapStartNotReadyExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new SnapStartNotReadyException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_SnapStartTimeoutExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new SnapStartTimeoutException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_SubnetIPAddressLimitReachedExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Message:expectString,Type:expectString});Object.assign(n,r);const o=new SubnetIPAddressLimitReachedException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_TooManyRequestsExceptionRes=async(e,t)=>{const n=map({[_rAS]:[,e.headers[_ra]]}),i=e.body,r=take(i,{Reason:expectString,Type:expectString,message:expectString});Object.assign(n,r);const o=new TooManyRequestsException$2({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},de_UnsupportedMediaTypeExceptionRes=async(e,t)=>{const n=map({}),i=e.body,r=take(i,{Type:expectString,message:expectString});Object.assign(n,r);const o=new UnsupportedMediaTypeException({$metadata:deserializeMetadata$2(e),...n});return decorateServiceException$1(o,e.body)},deserializeMetadata$2=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"]}),_CC="ClientContext",_EV="ExecutedVersion",_FE="FunctionError",_IT="InvocationType",_LR="LogResult",_LT="LogType",_Q="Qualifier",_rAS="retryAfterSeconds",_ra="retry-after",_xacc="x-amz-client-context",_xaev="x-amz-executed-version",_xafe="x-amz-function-error",_xait="x-amz-invocation-type",_xalr="x-amz-log-result",_xalt="x-amz-log-type";class InvokeCommand extends(Command$1.classBuilder().ep(commonParams$3).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("AWSGirApiService","Invoke",{}).n("LambdaClient","InvokeCommand").f(InvocationRequestFilterSensitiveLog,InvocationResponseFilterSensitiveLog).ser(se_InvokeCommand).de(de_InvokeCommand).build()){}const invokeLambda=async(e,t,n,i)=>{try{const r=new InvokeCommand({FunctionName:t.functionName,InvocationType:n,Payload:Buffer.from(JSON.stringify(i))}),o=await e.send(r);return t.logger&&t.logger.info(JSON.stringify(o)),!0}catch(e){return t.logger&&t.logger.error(e),!1}},lambda=e=>{const{clientConfig:t,...n}={...DEFAULT_AWS_CONFIGURATION,...e},i=new LambdaClient(t);return{invokeLambda:(e,t)=>invokeLambda(i,n,e,t)}},defaultSSMHttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext$1(t).operation,region:await normalizeProvider$4(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption$2(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"ssm",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const defaultSSMHttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption$2(e)),t},resolveHttpAuthSchemeConfig$2=e=>{const t=resolveAwsSdkSigV4Config$1(e);return Object.assign(t,{authSchemePreference:normalizeProvider$4(e.authSchemePreference??[])})},resolveClientEndpointParameters$2=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"ssm"}),commonParams$2={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},version$4="3.926.0";var packageInfo$2={version:version$4};const u$2="required",v$2="fn",w$2="argv",x$2="ref",a$2=!0,b$2="isSet",c$2="booleanEquals",d$2="error",e$2="endpoint",f$2="tree",g$2="PartitionResult",h$2="getAttr",i$2={[u$2]:!1,type:"string"},j$2={[u$2]:!0,default:!1,type:"boolean"},k$2={[x$2]:"Endpoint"},l$2={[v$2]:c$2,[w$2]:[{[x$2]:"UseFIPS"},!0]},m$2={[v$2]:c$2,[w$2]:[{[x$2]:"UseDualStack"},!0]},n$2={},o$2={[v$2]:h$2,[w$2]:[{[x$2]:g$2},"supportsFIPS"]},p$2={[x$2]:g$2},q$2={[v$2]:c$2,[w$2]:[!0,{[v$2]:h$2,[w$2]:[p$2,"supportsDualStack"]}]},r$2=[l$2],s$2=[m$2],t$2=[{[x$2]:"Region"}],_data$2={parameters:{Region:i$2,UseDualStack:j$2,UseFIPS:j$2,Endpoint:i$2},rules:[{conditions:[{[v$2]:b$2,[w$2]:[k$2]}],rules:[{conditions:r$2,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d$2},{conditions:s$2,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d$2},{endpoint:{url:k$2,properties:n$2,headers:n$2},type:e$2}],type:f$2},{conditions:[{[v$2]:b$2,[w$2]:t$2}],rules:[{conditions:[{[v$2]:"aws.partition",[w$2]:t$2,assign:g$2}],rules:[{conditions:[l$2,m$2],rules:[{conditions:[{[v$2]:c$2,[w$2]:[a$2,o$2]},q$2],rules:[{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n$2,headers:n$2},type:e$2}],type:f$2},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d$2}],type:f$2},{conditions:r$2,rules:[{conditions:[{[v$2]:c$2,[w$2]:[o$2,a$2]}],rules:[{conditions:[{[v$2]:"stringEquals",[w$2]:[{[v$2]:h$2,[w$2]:[p$2,"name"]},"aws-us-gov"]}],endpoint:{url:"https://ssm.{Region}.amazonaws.com",properties:n$2,headers:n$2},type:e$2},{endpoint:{url:"https://ssm-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n$2,headers:n$2},type:e$2}],type:f$2},{error:"FIPS is enabled but this partition does not support FIPS",type:d$2}],type:f$2},{conditions:s$2,rules:[{conditions:[q$2],rules:[{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n$2,headers:n$2},type:e$2}],type:f$2},{error:"DualStack is enabled but this partition does not support DualStack",type:d$2}],type:f$2},{endpoint:{url:"https://ssm.{Region}.{PartitionResult#dnsSuffix}",properties:n$2,headers:n$2},type:e$2}],type:f$2}],type:f$2},{error:"Invalid Configuration: Missing Region",type:d$2}]},ruleSet$2=_data$2,cache$2=new EndpointCache$1({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver$2=(e,t={})=>cache$2.get(e,()=>resolveEndpoint$1(ruleSet$2,{endpointParams:e,logger:t.logger}));customEndpointFunctions$1.aws=awsEndpointFunctions$1;const getRuntimeConfig$5=e=>({apiVersion:"2014-11-06",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver$2,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSSMHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer$1}],logger:e?.logger??new NoOpLogger$1,serviceId:e?.serviceId??"SSM",urlParser:e?.urlParser??parseUrl$1,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),getRuntimeConfig$4=e=>{const t=resolveDefaultsModeConfig$1(e),n=()=>t().then(loadConfigsForDefaultMode$1),i=getRuntimeConfig$5(e);return{...i,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??createDefaultUserAgentProvider$1({serviceId:i.serviceId,clientVersion:packageInfo$2.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS$1,region:e?.region??invalidProvider$1("Region is missing"),requestHandler:FetchHttpHandler$1.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE$1),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector$1,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT$1)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT$1))}},getHttpAuthExtensionConfiguration$2=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex(t=>t.schemeId===e.schemeId);-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){i=e},credentials:()=>i}},resolveHttpAuthRuntimeConfig$2=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),resolveRuntimeExtensions$2=(e,t)=>{const n=Object.assign(getAwsRegionExtensionConfiguration$1(e),getDefaultExtensionConfiguration$1(e),getHttpHandlerExtensionConfiguration$1(e),getHttpAuthExtensionConfiguration$2(e));return t.forEach(e=>e.configure(n)),Object.assign(e,resolveAwsRegionExtensionConfiguration$1(n),resolveDefaultRuntimeConfig$1(n),resolveHttpHandlerRuntimeConfig$1(n),resolveHttpAuthRuntimeConfig$2(n))};class SSMClient extends Client$1{config;constructor(...[e]){const t=getRuntimeConfig$4(e||{});super(t),this.initConfig=t;const n=resolveUserAgentConfig$1(resolveClientEndpointParameters$2(t)),i=resolveRetryConfig$1(n),r=resolveHostHeaderConfig$1(resolveRegionConfig$1(i)),o=resolveEndpointConfig$1(r),a=resolveHttpAuthSchemeConfig$2(o),s=resolveRuntimeExtensions$2(a,e?.extensions||[]);this.config=s,this.middlewareStack.use(getUserAgentPlugin$1(this.config)),this.middlewareStack.use(getRetryPlugin$1(this.config)),this.middlewareStack.use(getContentLengthPlugin$1(this.config)),this.middlewareStack.use(getHostHeaderPlugin$1(this.config)),this.middlewareStack.use(getLoggerPlugin$1(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin$1(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin$1(this.config,{httpAuthSchemeParametersProvider:defaultSSMHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new DefaultIdentityProviderConfig$1({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(getHttpSigningPlugin$1(this.config))}destroy(){super.destroy()}}class SSMServiceException extends ServiceException$2{constructor(e){super(e),Object.setPrototypeOf(this,SSMServiceException.prototype)}}class AccessDeniedException extends SSMServiceException{name="AccessDeniedException";$fault="client";Message;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,AccessDeniedException.prototype),this.Message=e.Message}}class InternalServerError extends SSMServiceException{name="InternalServerError";$fault="server";Message;constructor(e){super({name:"InternalServerError",$fault:"server",...e}),Object.setPrototypeOf(this,InternalServerError.prototype),this.Message=e.Message}}class InvalidResourceId extends SSMServiceException{name="InvalidResourceId";$fault="client";constructor(e){super({name:"InvalidResourceId",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidResourceId.prototype)}}class InvalidResourceType extends SSMServiceException{name="InvalidResourceType";$fault="client";constructor(e){super({name:"InvalidResourceType",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidResourceType.prototype)}}class TooManyTagsError extends SSMServiceException{name="TooManyTagsError";$fault="client";constructor(e){super({name:"TooManyTagsError",$fault:"client",...e}),Object.setPrototypeOf(this,TooManyTagsError.prototype)}}class TooManyUpdates extends SSMServiceException{name="TooManyUpdates";$fault="client";Message;constructor(e){super({name:"TooManyUpdates",$fault:"client",...e}),Object.setPrototypeOf(this,TooManyUpdates.prototype),this.Message=e.Message}}let AlreadyExistsException$2=class e extends SSMServiceException{name="AlreadyExistsException";$fault="client";Message;constructor(t){super({name:"AlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class OpsItemConflictException extends SSMServiceException{name="OpsItemConflictException";$fault="client";Message;constructor(e){super({name:"OpsItemConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemConflictException.prototype),this.Message=e.Message}}class OpsItemInvalidParameterException extends SSMServiceException{name="OpsItemInvalidParameterException";$fault="client";ParameterNames;Message;constructor(e){super({name:"OpsItemInvalidParameterException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class OpsItemLimitExceededException extends SSMServiceException{name="OpsItemLimitExceededException";$fault="client";ResourceTypes;Limit;LimitType;Message;constructor(e){super({name:"OpsItemLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemLimitExceededException.prototype),this.ResourceTypes=e.ResourceTypes,this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}class OpsItemNotFoundException extends SSMServiceException{name="OpsItemNotFoundException";$fault="client";Message;constructor(e){super({name:"OpsItemNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemNotFoundException.prototype),this.Message=e.Message}}class OpsItemRelatedItemAlreadyExistsException extends SSMServiceException{name="OpsItemRelatedItemAlreadyExistsException";$fault="client";Message;ResourceUri;OpsItemId;constructor(e){super({name:"OpsItemRelatedItemAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemRelatedItemAlreadyExistsException.prototype),this.Message=e.Message,this.ResourceUri=e.ResourceUri,this.OpsItemId=e.OpsItemId}}class DuplicateInstanceId extends SSMServiceException{name="DuplicateInstanceId";$fault="client";constructor(e){super({name:"DuplicateInstanceId",$fault:"client",...e}),Object.setPrototypeOf(this,DuplicateInstanceId.prototype)}}class InvalidCommandId extends SSMServiceException{name="InvalidCommandId";$fault="client";constructor(e){super({name:"InvalidCommandId",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidCommandId.prototype)}}class InvalidInstanceId extends SSMServiceException{name="InvalidInstanceId";$fault="client";Message;constructor(e){super({name:"InvalidInstanceId",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidInstanceId.prototype),this.Message=e.Message}}class DoesNotExistException extends SSMServiceException{name="DoesNotExistException";$fault="client";Message;constructor(e){super({name:"DoesNotExistException",$fault:"client",...e}),Object.setPrototypeOf(this,DoesNotExistException.prototype),this.Message=e.Message}}class InvalidParameters extends SSMServiceException{name="InvalidParameters";$fault="client";Message;constructor(e){super({name:"InvalidParameters",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidParameters.prototype),this.Message=e.Message}}class AssociationAlreadyExists extends SSMServiceException{name="AssociationAlreadyExists";$fault="client";constructor(e){super({name:"AssociationAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,AssociationAlreadyExists.prototype)}}class AssociationLimitExceeded extends SSMServiceException{name="AssociationLimitExceeded";$fault="client";constructor(e){super({name:"AssociationLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,AssociationLimitExceeded.prototype)}}class InvalidDocument extends SSMServiceException{name="InvalidDocument";$fault="client";Message;constructor(e){super({name:"InvalidDocument",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDocument.prototype),this.Message=e.Message}}class InvalidDocumentVersion extends SSMServiceException{name="InvalidDocumentVersion";$fault="client";Message;constructor(e){super({name:"InvalidDocumentVersion",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDocumentVersion.prototype),this.Message=e.Message}}class InvalidOutputLocation extends SSMServiceException{name="InvalidOutputLocation";$fault="client";constructor(e){super({name:"InvalidOutputLocation",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidOutputLocation.prototype)}}class InvalidSchedule extends SSMServiceException{name="InvalidSchedule";$fault="client";Message;constructor(e){super({name:"InvalidSchedule",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidSchedule.prototype),this.Message=e.Message}}class InvalidTag extends SSMServiceException{name="InvalidTag";$fault="client";Message;constructor(e){super({name:"InvalidTag",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidTag.prototype),this.Message=e.Message}}class InvalidTarget extends SSMServiceException{name="InvalidTarget";$fault="client";Message;constructor(e){super({name:"InvalidTarget",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidTarget.prototype),this.Message=e.Message}}class InvalidTargetMaps extends SSMServiceException{name="InvalidTargetMaps";$fault="client";Message;constructor(e){super({name:"InvalidTargetMaps",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidTargetMaps.prototype),this.Message=e.Message}}class UnsupportedPlatformType extends SSMServiceException{name="UnsupportedPlatformType";$fault="client";Message;constructor(e){super({name:"UnsupportedPlatformType",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedPlatformType.prototype),this.Message=e.Message}}class DocumentAlreadyExists extends SSMServiceException{name="DocumentAlreadyExists";$fault="client";Message;constructor(e){super({name:"DocumentAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,DocumentAlreadyExists.prototype),this.Message=e.Message}}class DocumentLimitExceeded extends SSMServiceException{name="DocumentLimitExceeded";$fault="client";Message;constructor(e){super({name:"DocumentLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,DocumentLimitExceeded.prototype),this.Message=e.Message}}class InvalidDocumentContent extends SSMServiceException{name="InvalidDocumentContent";$fault="client";Message;constructor(e){super({name:"InvalidDocumentContent",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDocumentContent.prototype),this.Message=e.Message}}class InvalidDocumentSchemaVersion extends SSMServiceException{name="InvalidDocumentSchemaVersion";$fault="client";Message;constructor(e){super({name:"InvalidDocumentSchemaVersion",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDocumentSchemaVersion.prototype),this.Message=e.Message}}class MaxDocumentSizeExceeded extends SSMServiceException{name="MaxDocumentSizeExceeded";$fault="client";Message;constructor(e){super({name:"MaxDocumentSizeExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,MaxDocumentSizeExceeded.prototype),this.Message=e.Message}}class NoLongerSupportedException extends SSMServiceException{name="NoLongerSupportedException";$fault="client";Message;constructor(e){super({name:"NoLongerSupportedException",$fault:"client",...e}),Object.setPrototypeOf(this,NoLongerSupportedException.prototype),this.Message=e.Message}}class IdempotentParameterMismatch extends SSMServiceException{name="IdempotentParameterMismatch";$fault="client";Message;constructor(e){super({name:"IdempotentParameterMismatch",$fault:"client",...e}),Object.setPrototypeOf(this,IdempotentParameterMismatch.prototype),this.Message=e.Message}}class ResourceLimitExceededException extends SSMServiceException{name="ResourceLimitExceededException";$fault="client";Message;constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceLimitExceededException.prototype),this.Message=e.Message}}class OpsItemAccessDeniedException extends SSMServiceException{name="OpsItemAccessDeniedException";$fault="client";Message;constructor(e){super({name:"OpsItemAccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemAccessDeniedException.prototype),this.Message=e.Message}}class OpsItemAlreadyExistsException extends SSMServiceException{name="OpsItemAlreadyExistsException";$fault="client";Message;OpsItemId;constructor(e){super({name:"OpsItemAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemAlreadyExistsException.prototype),this.Message=e.Message,this.OpsItemId=e.OpsItemId}}class OpsMetadataAlreadyExistsException extends SSMServiceException{name="OpsMetadataAlreadyExistsException";$fault="client";constructor(e){super({name:"OpsMetadataAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsMetadataAlreadyExistsException.prototype)}}class OpsMetadataInvalidArgumentException extends SSMServiceException{name="OpsMetadataInvalidArgumentException";$fault="client";constructor(e){super({name:"OpsMetadataInvalidArgumentException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsMetadataInvalidArgumentException.prototype)}}class OpsMetadataLimitExceededException extends SSMServiceException{name="OpsMetadataLimitExceededException";$fault="client";constructor(e){super({name:"OpsMetadataLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsMetadataLimitExceededException.prototype)}}class OpsMetadataTooManyUpdatesException extends SSMServiceException{name="OpsMetadataTooManyUpdatesException";$fault="client";constructor(e){super({name:"OpsMetadataTooManyUpdatesException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsMetadataTooManyUpdatesException.prototype)}}class ResourceDataSyncAlreadyExistsException extends SSMServiceException{name="ResourceDataSyncAlreadyExistsException";$fault="client";SyncName;constructor(e){super({name:"ResourceDataSyncAlreadyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceDataSyncAlreadyExistsException.prototype),this.SyncName=e.SyncName}}class ResourceDataSyncCountExceededException extends SSMServiceException{name="ResourceDataSyncCountExceededException";$fault="client";Message;constructor(e){super({name:"ResourceDataSyncCountExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceDataSyncCountExceededException.prototype),this.Message=e.Message}}class ResourceDataSyncInvalidConfigurationException extends SSMServiceException{name="ResourceDataSyncInvalidConfigurationException";$fault="client";Message;constructor(e){super({name:"ResourceDataSyncInvalidConfigurationException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceDataSyncInvalidConfigurationException.prototype),this.Message=e.Message}}class InvalidActivation extends SSMServiceException{name="InvalidActivation";$fault="client";Message;constructor(e){super({name:"InvalidActivation",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidActivation.prototype),this.Message=e.Message}}class InvalidActivationId extends SSMServiceException{name="InvalidActivationId";$fault="client";Message;constructor(e){super({name:"InvalidActivationId",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidActivationId.prototype),this.Message=e.Message}}class AssociationDoesNotExist extends SSMServiceException{name="AssociationDoesNotExist";$fault="client";Message;constructor(e){super({name:"AssociationDoesNotExist",$fault:"client",...e}),Object.setPrototypeOf(this,AssociationDoesNotExist.prototype),this.Message=e.Message}}class AssociatedInstances extends SSMServiceException{name="AssociatedInstances";$fault="client";constructor(e){super({name:"AssociatedInstances",$fault:"client",...e}),Object.setPrototypeOf(this,AssociatedInstances.prototype)}}class InvalidDocumentOperation extends SSMServiceException{name="InvalidDocumentOperation";$fault="client";Message;constructor(e){super({name:"InvalidDocumentOperation",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDocumentOperation.prototype),this.Message=e.Message}}class InvalidDeleteInventoryParametersException extends SSMServiceException{name="InvalidDeleteInventoryParametersException";$fault="client";Message;constructor(e){super({name:"InvalidDeleteInventoryParametersException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDeleteInventoryParametersException.prototype),this.Message=e.Message}}class InvalidInventoryRequestException extends SSMServiceException{name="InvalidInventoryRequestException";$fault="client";Message;constructor(e){super({name:"InvalidInventoryRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidInventoryRequestException.prototype),this.Message=e.Message}}class InvalidOptionException extends SSMServiceException{name="InvalidOptionException";$fault="client";Message;constructor(e){super({name:"InvalidOptionException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidOptionException.prototype),this.Message=e.Message}}class InvalidTypeNameException extends SSMServiceException{name="InvalidTypeNameException";$fault="client";Message;constructor(e){super({name:"InvalidTypeNameException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidTypeNameException.prototype),this.Message=e.Message}}class OpsMetadataNotFoundException extends SSMServiceException{name="OpsMetadataNotFoundException";$fault="client";constructor(e){super({name:"OpsMetadataNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsMetadataNotFoundException.prototype)}}class ParameterNotFound extends SSMServiceException{name="ParameterNotFound";$fault="client";constructor(e){super({name:"ParameterNotFound",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterNotFound.prototype)}}class ResourceInUseException extends SSMServiceException{name="ResourceInUseException";$fault="client";Message;constructor(e){super({name:"ResourceInUseException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceInUseException.prototype),this.Message=e.Message}}class ResourceDataSyncNotFoundException extends SSMServiceException{name="ResourceDataSyncNotFoundException";$fault="client";SyncName;SyncType;Message;constructor(e){super({name:"ResourceDataSyncNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceDataSyncNotFoundException.prototype),this.SyncName=e.SyncName,this.SyncType=e.SyncType,this.Message=e.Message}}class MalformedResourcePolicyDocumentException extends SSMServiceException{name="MalformedResourcePolicyDocumentException";$fault="client";Message;constructor(e){super({name:"MalformedResourcePolicyDocumentException",$fault:"client",...e}),Object.setPrototypeOf(this,MalformedResourcePolicyDocumentException.prototype),this.Message=e.Message}}let ResourceNotFoundException$1=class e extends SSMServiceException{name="ResourceNotFoundException";$fault="client";Message;constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}};class ResourcePolicyConflictException extends SSMServiceException{name="ResourcePolicyConflictException";$fault="client";Message;constructor(e){super({name:"ResourcePolicyConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourcePolicyConflictException.prototype),this.Message=e.Message}}class ResourcePolicyInvalidParameterException extends SSMServiceException{name="ResourcePolicyInvalidParameterException";$fault="client";ParameterNames;Message;constructor(e){super({name:"ResourcePolicyInvalidParameterException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourcePolicyInvalidParameterException.prototype),this.ParameterNames=e.ParameterNames,this.Message=e.Message}}class ResourcePolicyNotFoundException extends SSMServiceException{name="ResourcePolicyNotFoundException";$fault="client";Message;constructor(e){super({name:"ResourcePolicyNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourcePolicyNotFoundException.prototype),this.Message=e.Message}}class TargetInUseException extends SSMServiceException{name="TargetInUseException";$fault="client";Message;constructor(e){super({name:"TargetInUseException",$fault:"client",...e}),Object.setPrototypeOf(this,TargetInUseException.prototype),this.Message=e.Message}}class InvalidFilter extends SSMServiceException{name="InvalidFilter";$fault="client";Message;constructor(e){super({name:"InvalidFilter",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidFilter.prototype),this.Message=e.Message}}class InvalidNextToken extends SSMServiceException{name="InvalidNextToken";$fault="client";Message;constructor(e){super({name:"InvalidNextToken",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidNextToken.prototype),this.Message=e.Message}}class InvalidAssociationVersion extends SSMServiceException{name="InvalidAssociationVersion";$fault="client";Message;constructor(e){super({name:"InvalidAssociationVersion",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAssociationVersion.prototype),this.Message=e.Message}}class AssociationExecutionDoesNotExist extends SSMServiceException{name="AssociationExecutionDoesNotExist";$fault="client";Message;constructor(e){super({name:"AssociationExecutionDoesNotExist",$fault:"client",...e}),Object.setPrototypeOf(this,AssociationExecutionDoesNotExist.prototype),this.Message=e.Message}}class InvalidFilterKey extends SSMServiceException{name="InvalidFilterKey";$fault="client";constructor(e){super({name:"InvalidFilterKey",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidFilterKey.prototype)}}class InvalidFilterValue extends SSMServiceException{name="InvalidFilterValue";$fault="client";Message;constructor(e){super({name:"InvalidFilterValue",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidFilterValue.prototype),this.Message=e.Message}}class AutomationExecutionNotFoundException extends SSMServiceException{name="AutomationExecutionNotFoundException";$fault="client";Message;constructor(e){super({name:"AutomationExecutionNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,AutomationExecutionNotFoundException.prototype),this.Message=e.Message}}class InvalidPermissionType extends SSMServiceException{name="InvalidPermissionType";$fault="client";Message;constructor(e){super({name:"InvalidPermissionType",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidPermissionType.prototype),this.Message=e.Message}}class UnsupportedOperatingSystem extends SSMServiceException{name="UnsupportedOperatingSystem";$fault="client";Message;constructor(e){super({name:"UnsupportedOperatingSystem",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedOperatingSystem.prototype),this.Message=e.Message}}class InvalidInstanceInformationFilterValue extends SSMServiceException{name="InvalidInstanceInformationFilterValue";$fault="client";constructor(e){super({name:"InvalidInstanceInformationFilterValue",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidInstanceInformationFilterValue.prototype)}}class InvalidInstancePropertyFilterValue extends SSMServiceException{name="InvalidInstancePropertyFilterValue";$fault="client";constructor(e){super({name:"InvalidInstancePropertyFilterValue",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidInstancePropertyFilterValue.prototype)}}class InvalidDeletionIdException extends SSMServiceException{name="InvalidDeletionIdException";$fault="client";Message;constructor(e){super({name:"InvalidDeletionIdException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDeletionIdException.prototype),this.Message=e.Message}}class InvalidFilterOption extends SSMServiceException{name="InvalidFilterOption";$fault="client";constructor(e){super({name:"InvalidFilterOption",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidFilterOption.prototype)}}class OpsItemRelatedItemAssociationNotFoundException extends SSMServiceException{name="OpsItemRelatedItemAssociationNotFoundException";$fault="client";Message;constructor(e){super({name:"OpsItemRelatedItemAssociationNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsItemRelatedItemAssociationNotFoundException.prototype),this.Message=e.Message}}class ThrottlingException extends SSMServiceException{name="ThrottlingException";$fault="client";Message;QuotaCode;ServiceCode;constructor(e){super({name:"ThrottlingException",$fault:"client",...e}),Object.setPrototypeOf(this,ThrottlingException.prototype),this.Message=e.Message,this.QuotaCode=e.QuotaCode,this.ServiceCode=e.ServiceCode}}class ValidationException extends SSMServiceException{name="ValidationException";$fault="client";Message;ReasonCode;constructor(e){super({name:"ValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,ValidationException.prototype),this.Message=e.Message,this.ReasonCode=e.ReasonCode}}class InvalidDocumentType extends SSMServiceException{name="InvalidDocumentType";$fault="client";Message;constructor(e){super({name:"InvalidDocumentType",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidDocumentType.prototype),this.Message=e.Message}}class UnsupportedCalendarException extends SSMServiceException{name="UnsupportedCalendarException";$fault="client";Message;constructor(e){super({name:"UnsupportedCalendarException",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedCalendarException.prototype),this.Message=e.Message}}class InvalidPluginName extends SSMServiceException{name="InvalidPluginName";$fault="client";constructor(e){super({name:"InvalidPluginName",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidPluginName.prototype)}}class InvocationDoesNotExist extends SSMServiceException{name="InvocationDoesNotExist";$fault="client";constructor(e){super({name:"InvocationDoesNotExist",$fault:"client",...e}),Object.setPrototypeOf(this,InvocationDoesNotExist.prototype)}}class UnsupportedFeatureRequiredException extends SSMServiceException{name="UnsupportedFeatureRequiredException";$fault="client";Message;constructor(e){super({name:"UnsupportedFeatureRequiredException",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedFeatureRequiredException.prototype),this.Message=e.Message}}var ExecutionPreview,NodeType;!function(e){e.visit=(e,t)=>void 0!==e.Automation?t.Automation(e.Automation):t._(e.$unknown[0],e.$unknown[1])}(ExecutionPreview||(ExecutionPreview={}));class InvalidAggregatorException extends SSMServiceException{name="InvalidAggregatorException";$fault="client";Message;constructor(e){super({name:"InvalidAggregatorException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAggregatorException.prototype),this.Message=e.Message}}class InvalidInventoryGroupException extends SSMServiceException{name="InvalidInventoryGroupException";$fault="client";Message;constructor(e){super({name:"InvalidInventoryGroupException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidInventoryGroupException.prototype),this.Message=e.Message}}class InvalidResultAttributeException extends SSMServiceException{name="InvalidResultAttributeException";$fault="client";Message;constructor(e){super({name:"InvalidResultAttributeException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidResultAttributeException.prototype),this.Message=e.Message}}class InvalidKeyId extends SSMServiceException{name="InvalidKeyId";$fault="client";constructor(e){super({name:"InvalidKeyId",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidKeyId.prototype)}}class ParameterVersionNotFound extends SSMServiceException{name="ParameterVersionNotFound";$fault="client";constructor(e){super({name:"ParameterVersionNotFound",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterVersionNotFound.prototype)}}class ServiceSettingNotFound extends SSMServiceException{name="ServiceSettingNotFound";$fault="client";Message;constructor(e){super({name:"ServiceSettingNotFound",$fault:"client",...e}),Object.setPrototypeOf(this,ServiceSettingNotFound.prototype),this.Message=e.Message}}class ParameterVersionLabelLimitExceeded extends SSMServiceException{name="ParameterVersionLabelLimitExceeded";$fault="client";constructor(e){super({name:"ParameterVersionLabelLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterVersionLabelLimitExceeded.prototype)}}!function(e){e.visit=(e,t)=>void 0!==e.Instance?t.Instance(e.Instance):t._(e.$unknown[0],e.$unknown[1])}(NodeType||(NodeType={}));class UnsupportedOperationException extends SSMServiceException{name="UnsupportedOperationException";$fault="client";Message;constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedOperationException.prototype),this.Message=e.Message}}class DocumentPermissionLimit extends SSMServiceException{name="DocumentPermissionLimit";$fault="client";Message;constructor(e){super({name:"DocumentPermissionLimit",$fault:"client",...e}),Object.setPrototypeOf(this,DocumentPermissionLimit.prototype),this.Message=e.Message}}class ComplianceTypeCountLimitExceededException extends SSMServiceException{name="ComplianceTypeCountLimitExceededException";$fault="client";Message;constructor(e){super({name:"ComplianceTypeCountLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ComplianceTypeCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidItemContentException extends SSMServiceException{name="InvalidItemContentException";$fault="client";TypeName;Message;constructor(e){super({name:"InvalidItemContentException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidItemContentException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class ItemSizeLimitExceededException extends SSMServiceException{name="ItemSizeLimitExceededException";$fault="client";TypeName;Message;constructor(e){super({name:"ItemSizeLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ItemSizeLimitExceededException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class TotalSizeLimitExceededException extends SSMServiceException{name="TotalSizeLimitExceededException";$fault="client";Message;constructor(e){super({name:"TotalSizeLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,TotalSizeLimitExceededException.prototype),this.Message=e.Message}}class CustomSchemaCountLimitExceededException extends SSMServiceException{name="CustomSchemaCountLimitExceededException";$fault="client";Message;constructor(e){super({name:"CustomSchemaCountLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,CustomSchemaCountLimitExceededException.prototype),this.Message=e.Message}}class InvalidInventoryItemContextException extends SSMServiceException{name="InvalidInventoryItemContextException";$fault="client";Message;constructor(e){super({name:"InvalidInventoryItemContextException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidInventoryItemContextException.prototype),this.Message=e.Message}}class ItemContentMismatchException extends SSMServiceException{name="ItemContentMismatchException";$fault="client";TypeName;Message;constructor(e){super({name:"ItemContentMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,ItemContentMismatchException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class SubTypeCountLimitExceededException extends SSMServiceException{name="SubTypeCountLimitExceededException";$fault="client";Message;constructor(e){super({name:"SubTypeCountLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,SubTypeCountLimitExceededException.prototype),this.Message=e.Message}}class UnsupportedInventoryItemContextException extends SSMServiceException{name="UnsupportedInventoryItemContextException";$fault="client";TypeName;Message;constructor(e){super({name:"UnsupportedInventoryItemContextException",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedInventoryItemContextException.prototype),this.TypeName=e.TypeName,this.Message=e.Message}}class UnsupportedInventorySchemaVersionException extends SSMServiceException{name="UnsupportedInventorySchemaVersionException";$fault="client";Message;constructor(e){super({name:"UnsupportedInventorySchemaVersionException",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedInventorySchemaVersionException.prototype),this.Message=e.Message}}class HierarchyLevelLimitExceededException extends SSMServiceException{name="HierarchyLevelLimitExceededException";$fault="client";constructor(e){super({name:"HierarchyLevelLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,HierarchyLevelLimitExceededException.prototype)}}class HierarchyTypeMismatchException extends SSMServiceException{name="HierarchyTypeMismatchException";$fault="client";constructor(e){super({name:"HierarchyTypeMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,HierarchyTypeMismatchException.prototype)}}class IncompatiblePolicyException extends SSMServiceException{name="IncompatiblePolicyException";$fault="client";constructor(e){super({name:"IncompatiblePolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,IncompatiblePolicyException.prototype)}}class InvalidAllowedPatternException extends SSMServiceException{name="InvalidAllowedPatternException";$fault="client";constructor(e){super({name:"InvalidAllowedPatternException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAllowedPatternException.prototype)}}class InvalidPolicyAttributeException extends SSMServiceException{name="InvalidPolicyAttributeException";$fault="client";constructor(e){super({name:"InvalidPolicyAttributeException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidPolicyAttributeException.prototype)}}class InvalidPolicyTypeException extends SSMServiceException{name="InvalidPolicyTypeException";$fault="client";constructor(e){super({name:"InvalidPolicyTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidPolicyTypeException.prototype)}}class ParameterAlreadyExists extends SSMServiceException{name="ParameterAlreadyExists";$fault="client";constructor(e){super({name:"ParameterAlreadyExists",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterAlreadyExists.prototype)}}class ParameterLimitExceeded extends SSMServiceException{name="ParameterLimitExceeded";$fault="client";constructor(e){super({name:"ParameterLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterLimitExceeded.prototype)}}class ParameterMaxVersionLimitExceeded extends SSMServiceException{name="ParameterMaxVersionLimitExceeded";$fault="client";constructor(e){super({name:"ParameterMaxVersionLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterMaxVersionLimitExceeded.prototype)}}class ParameterPatternMismatchException extends SSMServiceException{name="ParameterPatternMismatchException";$fault="client";constructor(e){super({name:"ParameterPatternMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,ParameterPatternMismatchException.prototype)}}class PoliciesLimitExceededException extends SSMServiceException{name="PoliciesLimitExceededException";$fault="client";constructor(e){super({name:"PoliciesLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,PoliciesLimitExceededException.prototype)}}class UnsupportedParameterType extends SSMServiceException{name="UnsupportedParameterType";$fault="client";constructor(e){super({name:"UnsupportedParameterType",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedParameterType.prototype)}}class ResourcePolicyLimitExceededException extends SSMServiceException{name="ResourcePolicyLimitExceededException";$fault="client";Limit;LimitType;Message;constructor(e){super({name:"ResourcePolicyLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourcePolicyLimitExceededException.prototype),this.Limit=e.Limit,this.LimitType=e.LimitType,this.Message=e.Message}}const ParameterFilterSensitiveLog=e=>({...e,...e.Value&&{Value:SENSITIVE_STRING$1}}),GetParameterResultFilterSensitiveLog=e=>({...e,...e.Parameter&&{Parameter:ParameterFilterSensitiveLog(e.Parameter)}}),GetParametersResultFilterSensitiveLog=e=>({...e,...e.Parameters&&{Parameters:e.Parameters.map(e=>ParameterFilterSensitiveLog(e))}});class FeatureNotAvailableException extends SSMServiceException{name="FeatureNotAvailableException";$fault="client";Message;constructor(e){super({name:"FeatureNotAvailableException",$fault:"client",...e}),Object.setPrototypeOf(this,FeatureNotAvailableException.prototype),this.Message=e.Message}}class AutomationStepNotFoundException extends SSMServiceException{name="AutomationStepNotFoundException";$fault="client";Message;constructor(e){super({name:"AutomationStepNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,AutomationStepNotFoundException.prototype),this.Message=e.Message}}class InvalidAutomationSignalException extends SSMServiceException{name="InvalidAutomationSignalException";$fault="client";Message;constructor(e){super({name:"InvalidAutomationSignalException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAutomationSignalException.prototype),this.Message=e.Message}}class InvalidNotificationConfig extends SSMServiceException{name="InvalidNotificationConfig";$fault="client";Message;constructor(e){super({name:"InvalidNotificationConfig",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidNotificationConfig.prototype),this.Message=e.Message}}class InvalidOutputFolder extends SSMServiceException{name="InvalidOutputFolder";$fault="client";constructor(e){super({name:"InvalidOutputFolder",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidOutputFolder.prototype)}}class InvalidRole extends SSMServiceException{name="InvalidRole";$fault="client";Message;constructor(e){super({name:"InvalidRole",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidRole.prototype),this.Message=e.Message}}class ServiceQuotaExceededException extends SSMServiceException{name="ServiceQuotaExceededException";$fault="client";Message;ResourceId;ResourceType;QuotaCode;ServiceCode;constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,ServiceQuotaExceededException.prototype),this.Message=e.Message,this.ResourceId=e.ResourceId,this.ResourceType=e.ResourceType,this.QuotaCode=e.QuotaCode,this.ServiceCode=e.ServiceCode}}class InvalidAssociation extends SSMServiceException{name="InvalidAssociation";$fault="client";Message;constructor(e){super({name:"InvalidAssociation",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAssociation.prototype),this.Message=e.Message}}class AutomationDefinitionNotFoundException extends SSMServiceException{name="AutomationDefinitionNotFoundException";$fault="client";Message;constructor(e){super({name:"AutomationDefinitionNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,AutomationDefinitionNotFoundException.prototype),this.Message=e.Message}}class AutomationDefinitionVersionNotFoundException extends SSMServiceException{name="AutomationDefinitionVersionNotFoundException";$fault="client";Message;constructor(e){super({name:"AutomationDefinitionVersionNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,AutomationDefinitionVersionNotFoundException.prototype),this.Message=e.Message}}class AutomationExecutionLimitExceededException extends SSMServiceException{name="AutomationExecutionLimitExceededException";$fault="client";Message;constructor(e){super({name:"AutomationExecutionLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,AutomationExecutionLimitExceededException.prototype),this.Message=e.Message}}class InvalidAutomationExecutionParametersException extends SSMServiceException{name="InvalidAutomationExecutionParametersException";$fault="client";Message;constructor(e){super({name:"InvalidAutomationExecutionParametersException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAutomationExecutionParametersException.prototype),this.Message=e.Message}}class AutomationDefinitionNotApprovedException extends SSMServiceException{name="AutomationDefinitionNotApprovedException";$fault="client";Message;constructor(e){super({name:"AutomationDefinitionNotApprovedException",$fault:"client",...e}),Object.setPrototypeOf(this,AutomationDefinitionNotApprovedException.prototype),this.Message=e.Message}}var ExecutionInputs;!function(e){e.visit=(e,t)=>void 0!==e.Automation?t.Automation(e.Automation):t._(e.$unknown[0],e.$unknown[1])}(ExecutionInputs||(ExecutionInputs={}));class TargetNotConnected extends SSMServiceException{name="TargetNotConnected";$fault="client";Message;constructor(e){super({name:"TargetNotConnected",$fault:"client",...e}),Object.setPrototypeOf(this,TargetNotConnected.prototype),this.Message=e.Message}}class InvalidAutomationStatusUpdateException extends SSMServiceException{name="InvalidAutomationStatusUpdateException";$fault="client";Message;constructor(e){super({name:"InvalidAutomationStatusUpdateException",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAutomationStatusUpdateException.prototype),this.Message=e.Message}}class AssociationVersionLimitExceeded extends SSMServiceException{name="AssociationVersionLimitExceeded";$fault="client";Message;constructor(e){super({name:"AssociationVersionLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,AssociationVersionLimitExceeded.prototype),this.Message=e.Message}}class InvalidUpdate extends SSMServiceException{name="InvalidUpdate";$fault="client";Message;constructor(e){super({name:"InvalidUpdate",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidUpdate.prototype),this.Message=e.Message}}class StatusUnchanged extends SSMServiceException{name="StatusUnchanged";$fault="client";constructor(e){super({name:"StatusUnchanged",$fault:"client",...e}),Object.setPrototypeOf(this,StatusUnchanged.prototype)}}class DocumentVersionLimitExceeded extends SSMServiceException{name="DocumentVersionLimitExceeded";$fault="client";Message;constructor(e){super({name:"DocumentVersionLimitExceeded",$fault:"client",...e}),Object.setPrototypeOf(this,DocumentVersionLimitExceeded.prototype),this.Message=e.Message}}class DuplicateDocumentContent extends SSMServiceException{name="DuplicateDocumentContent";$fault="client";Message;constructor(e){super({name:"DuplicateDocumentContent",$fault:"client",...e}),Object.setPrototypeOf(this,DuplicateDocumentContent.prototype),this.Message=e.Message}}class DuplicateDocumentVersionName extends SSMServiceException{name="DuplicateDocumentVersionName";$fault="client";Message;constructor(e){super({name:"DuplicateDocumentVersionName",$fault:"client",...e}),Object.setPrototypeOf(this,DuplicateDocumentVersionName.prototype),this.Message=e.Message}}class OpsMetadataKeyLimitExceededException extends SSMServiceException{name="OpsMetadataKeyLimitExceededException";$fault="client";constructor(e){super({name:"OpsMetadataKeyLimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,OpsMetadataKeyLimitExceededException.prototype)}}class ResourceDataSyncConflictException extends SSMServiceException{name="ResourceDataSyncConflictException";$fault="client";Message;constructor(e){super({name:"ResourceDataSyncConflictException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceDataSyncConflictException.prototype),this.Message=e.Message}}const se_GetParameterCommand=async(e,t)=>{const n=sharedHeaders$1("GetParameter");let i;return i=JSON.stringify(_json(e)),buildHttpRpcRequest$1(t,n,"/",void 0,i)},se_GetParametersCommand=async(e,t)=>{const n=sharedHeaders$1("GetParameters");let i;return i=JSON.stringify(_json(e)),buildHttpRpcRequest$1(t,n,"/",void 0,i)},de_GetParameterCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$1(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_GetParameterResult(n);return{$metadata:deserializeMetadata$1(e),...i}},de_GetParametersCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError$1(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_GetParametersResult(n);return{$metadata:deserializeMetadata$1(e),...i}},de_CommandError$1=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)},i=loadRestJsonErrorCode$1(e,n.body);switch(i){case"InternalServerError":case"com.amazonaws.ssm#InternalServerError":throw await de_InternalServerErrorRes(n);case"InvalidResourceId":case"com.amazonaws.ssm#InvalidResourceId":throw await de_InvalidResourceIdRes(n);case"InvalidResourceType":case"com.amazonaws.ssm#InvalidResourceType":throw await de_InvalidResourceTypeRes(n);case"TooManyTagsError":case"com.amazonaws.ssm#TooManyTagsError":throw await de_TooManyTagsErrorRes(n);case"TooManyUpdates":case"com.amazonaws.ssm#TooManyUpdates":throw await de_TooManyUpdatesRes(n);case"OpsItemConflictException":case"com.amazonaws.ssm#OpsItemConflictException":throw await de_OpsItemConflictExceptionRes(n);case"OpsItemInvalidParameterException":case"com.amazonaws.ssm#OpsItemInvalidParameterException":throw await de_OpsItemInvalidParameterExceptionRes(n);case"OpsItemLimitExceededException":case"com.amazonaws.ssm#OpsItemLimitExceededException":throw await de_OpsItemLimitExceededExceptionRes(n);case"OpsItemNotFoundException":case"com.amazonaws.ssm#OpsItemNotFoundException":throw await de_OpsItemNotFoundExceptionRes(n);case"OpsItemRelatedItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemRelatedItemAlreadyExistsException":throw await de_OpsItemRelatedItemAlreadyExistsExceptionRes(n);case"DuplicateInstanceId":case"com.amazonaws.ssm#DuplicateInstanceId":throw await de_DuplicateInstanceIdRes(n);case"InvalidCommandId":case"com.amazonaws.ssm#InvalidCommandId":throw await de_InvalidCommandIdRes(n);case"InvalidInstanceId":case"com.amazonaws.ssm#InvalidInstanceId":throw await de_InvalidInstanceIdRes(n);case"DoesNotExistException":case"com.amazonaws.ssm#DoesNotExistException":throw await de_DoesNotExistExceptionRes(n);case"InvalidParameters":case"com.amazonaws.ssm#InvalidParameters":throw await de_InvalidParametersRes(n);case"AssociationAlreadyExists":case"com.amazonaws.ssm#AssociationAlreadyExists":throw await de_AssociationAlreadyExistsRes(n);case"AssociationLimitExceeded":case"com.amazonaws.ssm#AssociationLimitExceeded":throw await de_AssociationLimitExceededRes(n);case"InvalidDocument":case"com.amazonaws.ssm#InvalidDocument":throw await de_InvalidDocumentRes(n);case"InvalidDocumentVersion":case"com.amazonaws.ssm#InvalidDocumentVersion":throw await de_InvalidDocumentVersionRes(n);case"InvalidOutputLocation":case"com.amazonaws.ssm#InvalidOutputLocation":throw await de_InvalidOutputLocationRes(n);case"InvalidSchedule":case"com.amazonaws.ssm#InvalidSchedule":throw await de_InvalidScheduleRes(n);case"InvalidTag":case"com.amazonaws.ssm#InvalidTag":throw await de_InvalidTagRes(n);case"InvalidTarget":case"com.amazonaws.ssm#InvalidTarget":throw await de_InvalidTargetRes(n);case"InvalidTargetMaps":case"com.amazonaws.ssm#InvalidTargetMaps":throw await de_InvalidTargetMapsRes(n);case"UnsupportedPlatformType":case"com.amazonaws.ssm#UnsupportedPlatformType":throw await de_UnsupportedPlatformTypeRes(n);case"DocumentAlreadyExists":case"com.amazonaws.ssm#DocumentAlreadyExists":throw await de_DocumentAlreadyExistsRes(n);case"DocumentLimitExceeded":case"com.amazonaws.ssm#DocumentLimitExceeded":throw await de_DocumentLimitExceededRes(n);case"InvalidDocumentContent":case"com.amazonaws.ssm#InvalidDocumentContent":throw await de_InvalidDocumentContentRes(n);case"InvalidDocumentSchemaVersion":case"com.amazonaws.ssm#InvalidDocumentSchemaVersion":throw await de_InvalidDocumentSchemaVersionRes(n);case"MaxDocumentSizeExceeded":case"com.amazonaws.ssm#MaxDocumentSizeExceeded":throw await de_MaxDocumentSizeExceededRes(n);case"NoLongerSupportedException":case"com.amazonaws.ssm#NoLongerSupportedException":throw await de_NoLongerSupportedExceptionRes(n);case"IdempotentParameterMismatch":case"com.amazonaws.ssm#IdempotentParameterMismatch":throw await de_IdempotentParameterMismatchRes(n);case"ResourceLimitExceededException":case"com.amazonaws.ssm#ResourceLimitExceededException":throw await de_ResourceLimitExceededExceptionRes(n);case"OpsItemAccessDeniedException":case"com.amazonaws.ssm#OpsItemAccessDeniedException":throw await de_OpsItemAccessDeniedExceptionRes(n);case"OpsItemAlreadyExistsException":case"com.amazonaws.ssm#OpsItemAlreadyExistsException":throw await de_OpsItemAlreadyExistsExceptionRes(n);case"OpsMetadataAlreadyExistsException":case"com.amazonaws.ssm#OpsMetadataAlreadyExistsException":throw await de_OpsMetadataAlreadyExistsExceptionRes(n);case"OpsMetadataInvalidArgumentException":case"com.amazonaws.ssm#OpsMetadataInvalidArgumentException":throw await de_OpsMetadataInvalidArgumentExceptionRes(n);case"OpsMetadataLimitExceededException":case"com.amazonaws.ssm#OpsMetadataLimitExceededException":throw await de_OpsMetadataLimitExceededExceptionRes(n);case"OpsMetadataTooManyUpdatesException":case"com.amazonaws.ssm#OpsMetadataTooManyUpdatesException":throw await de_OpsMetadataTooManyUpdatesExceptionRes(n);case"ResourceDataSyncAlreadyExistsException":case"com.amazonaws.ssm#ResourceDataSyncAlreadyExistsException":throw await de_ResourceDataSyncAlreadyExistsExceptionRes(n);case"ResourceDataSyncCountExceededException":case"com.amazonaws.ssm#ResourceDataSyncCountExceededException":throw await de_ResourceDataSyncCountExceededExceptionRes(n);case"ResourceDataSyncInvalidConfigurationException":case"com.amazonaws.ssm#ResourceDataSyncInvalidConfigurationException":throw await de_ResourceDataSyncInvalidConfigurationExceptionRes(n);case"InvalidActivation":case"com.amazonaws.ssm#InvalidActivation":throw await de_InvalidActivationRes(n);case"InvalidActivationId":case"com.amazonaws.ssm#InvalidActivationId":throw await de_InvalidActivationIdRes(n);case"AssociationDoesNotExist":case"com.amazonaws.ssm#AssociationDoesNotExist":throw await de_AssociationDoesNotExistRes(n);case"AssociatedInstances":case"com.amazonaws.ssm#AssociatedInstances":throw await de_AssociatedInstancesRes(n);case"InvalidDocumentOperation":case"com.amazonaws.ssm#InvalidDocumentOperation":throw await de_InvalidDocumentOperationRes(n);case"InvalidDeleteInventoryParametersException":case"com.amazonaws.ssm#InvalidDeleteInventoryParametersException":throw await de_InvalidDeleteInventoryParametersExceptionRes(n);case"InvalidInventoryRequestException":case"com.amazonaws.ssm#InvalidInventoryRequestException":throw await de_InvalidInventoryRequestExceptionRes(n);case"InvalidOptionException":case"com.amazonaws.ssm#InvalidOptionException":throw await de_InvalidOptionExceptionRes(n);case"InvalidTypeNameException":case"com.amazonaws.ssm#InvalidTypeNameException":throw await de_InvalidTypeNameExceptionRes(n);case"OpsMetadataNotFoundException":case"com.amazonaws.ssm#OpsMetadataNotFoundException":throw await de_OpsMetadataNotFoundExceptionRes(n);case"ParameterNotFound":case"com.amazonaws.ssm#ParameterNotFound":throw await de_ParameterNotFoundRes(n);case"ResourceInUseException":case"com.amazonaws.ssm#ResourceInUseException":throw await de_ResourceInUseExceptionRes(n);case"ResourceDataSyncNotFoundException":case"com.amazonaws.ssm#ResourceDataSyncNotFoundException":throw await de_ResourceDataSyncNotFoundExceptionRes(n);case"MalformedResourcePolicyDocumentException":case"com.amazonaws.ssm#MalformedResourcePolicyDocumentException":throw await de_MalformedResourcePolicyDocumentExceptionRes(n);case"ResourceNotFoundException":case"com.amazonaws.ssm#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes$1(n);case"ResourcePolicyConflictException":case"com.amazonaws.ssm#ResourcePolicyConflictException":throw await de_ResourcePolicyConflictExceptionRes(n);case"ResourcePolicyInvalidParameterException":case"com.amazonaws.ssm#ResourcePolicyInvalidParameterException":throw await de_ResourcePolicyInvalidParameterExceptionRes(n);case"ResourcePolicyNotFoundException":case"com.amazonaws.ssm#ResourcePolicyNotFoundException":throw await de_ResourcePolicyNotFoundExceptionRes(n);case"TargetInUseException":case"com.amazonaws.ssm#TargetInUseException":throw await de_TargetInUseExceptionRes(n);case"InvalidFilter":case"com.amazonaws.ssm#InvalidFilter":throw await de_InvalidFilterRes(n);case"InvalidNextToken":case"com.amazonaws.ssm#InvalidNextToken":throw await de_InvalidNextTokenRes(n);case"InvalidAssociationVersion":case"com.amazonaws.ssm#InvalidAssociationVersion":throw await de_InvalidAssociationVersionRes(n);case"AssociationExecutionDoesNotExist":case"com.amazonaws.ssm#AssociationExecutionDoesNotExist":throw await de_AssociationExecutionDoesNotExistRes(n);case"InvalidFilterKey":case"com.amazonaws.ssm#InvalidFilterKey":throw await de_InvalidFilterKeyRes(n);case"InvalidFilterValue":case"com.amazonaws.ssm#InvalidFilterValue":throw await de_InvalidFilterValueRes(n);case"AutomationExecutionNotFoundException":case"com.amazonaws.ssm#AutomationExecutionNotFoundException":throw await de_AutomationExecutionNotFoundExceptionRes(n);case"InvalidPermissionType":case"com.amazonaws.ssm#InvalidPermissionType":throw await de_InvalidPermissionTypeRes(n);case"UnsupportedOperatingSystem":case"com.amazonaws.ssm#UnsupportedOperatingSystem":throw await de_UnsupportedOperatingSystemRes(n);case"InvalidInstanceInformationFilterValue":case"com.amazonaws.ssm#InvalidInstanceInformationFilterValue":throw await de_InvalidInstanceInformationFilterValueRes(n);case"InvalidInstancePropertyFilterValue":case"com.amazonaws.ssm#InvalidInstancePropertyFilterValue":throw await de_InvalidInstancePropertyFilterValueRes(n);case"InvalidDeletionIdException":case"com.amazonaws.ssm#InvalidDeletionIdException":throw await de_InvalidDeletionIdExceptionRes(n);case"InvalidFilterOption":case"com.amazonaws.ssm#InvalidFilterOption":throw await de_InvalidFilterOptionRes(n);case"OpsItemRelatedItemAssociationNotFoundException":case"com.amazonaws.ssm#OpsItemRelatedItemAssociationNotFoundException":throw await de_OpsItemRelatedItemAssociationNotFoundExceptionRes(n);case"AccessDeniedException":case"com.amazonaws.ssm#AccessDeniedException":throw await de_AccessDeniedExceptionRes(n);case"ThrottlingException":case"com.amazonaws.ssm#ThrottlingException":throw await de_ThrottlingExceptionRes(n);case"ValidationException":case"com.amazonaws.ssm#ValidationException":throw await de_ValidationExceptionRes(n);case"InvalidDocumentType":case"com.amazonaws.ssm#InvalidDocumentType":throw await de_InvalidDocumentTypeRes(n);case"UnsupportedCalendarException":case"com.amazonaws.ssm#UnsupportedCalendarException":throw await de_UnsupportedCalendarExceptionRes(n);case"InvalidPluginName":case"com.amazonaws.ssm#InvalidPluginName":throw await de_InvalidPluginNameRes(n);case"InvocationDoesNotExist":case"com.amazonaws.ssm#InvocationDoesNotExist":throw await de_InvocationDoesNotExistRes(n);case"UnsupportedFeatureRequiredException":case"com.amazonaws.ssm#UnsupportedFeatureRequiredException":throw await de_UnsupportedFeatureRequiredExceptionRes(n);case"InvalidAggregatorException":case"com.amazonaws.ssm#InvalidAggregatorException":throw await de_InvalidAggregatorExceptionRes(n);case"InvalidInventoryGroupException":case"com.amazonaws.ssm#InvalidInventoryGroupException":throw await de_InvalidInventoryGroupExceptionRes(n);case"InvalidResultAttributeException":case"com.amazonaws.ssm#InvalidResultAttributeException":throw await de_InvalidResultAttributeExceptionRes(n);case"InvalidKeyId":case"com.amazonaws.ssm#InvalidKeyId":throw await de_InvalidKeyIdRes(n);case"ParameterVersionNotFound":case"com.amazonaws.ssm#ParameterVersionNotFound":throw await de_ParameterVersionNotFoundRes(n);case"ServiceSettingNotFound":case"com.amazonaws.ssm#ServiceSettingNotFound":throw await de_ServiceSettingNotFoundRes(n);case"ParameterVersionLabelLimitExceeded":case"com.amazonaws.ssm#ParameterVersionLabelLimitExceeded":throw await de_ParameterVersionLabelLimitExceededRes(n);case"UnsupportedOperationException":case"com.amazonaws.ssm#UnsupportedOperationException":throw await de_UnsupportedOperationExceptionRes(n);case"DocumentPermissionLimit":case"com.amazonaws.ssm#DocumentPermissionLimit":throw await de_DocumentPermissionLimitRes(n);case"ComplianceTypeCountLimitExceededException":case"com.amazonaws.ssm#ComplianceTypeCountLimitExceededException":throw await de_ComplianceTypeCountLimitExceededExceptionRes(n);case"InvalidItemContentException":case"com.amazonaws.ssm#InvalidItemContentException":throw await de_InvalidItemContentExceptionRes(n);case"ItemSizeLimitExceededException":case"com.amazonaws.ssm#ItemSizeLimitExceededException":throw await de_ItemSizeLimitExceededExceptionRes(n);case"TotalSizeLimitExceededException":case"com.amazonaws.ssm#TotalSizeLimitExceededException":throw await de_TotalSizeLimitExceededExceptionRes(n);case"CustomSchemaCountLimitExceededException":case"com.amazonaws.ssm#CustomSchemaCountLimitExceededException":throw await de_CustomSchemaCountLimitExceededExceptionRes(n);case"InvalidInventoryItemContextException":case"com.amazonaws.ssm#InvalidInventoryItemContextException":throw await de_InvalidInventoryItemContextExceptionRes(n);case"ItemContentMismatchException":case"com.amazonaws.ssm#ItemContentMismatchException":throw await de_ItemContentMismatchExceptionRes(n);case"SubTypeCountLimitExceededException":case"com.amazonaws.ssm#SubTypeCountLimitExceededException":throw await de_SubTypeCountLimitExceededExceptionRes(n);case"UnsupportedInventoryItemContextException":case"com.amazonaws.ssm#UnsupportedInventoryItemContextException":throw await de_UnsupportedInventoryItemContextExceptionRes(n);case"UnsupportedInventorySchemaVersionException":case"com.amazonaws.ssm#UnsupportedInventorySchemaVersionException":throw await de_UnsupportedInventorySchemaVersionExceptionRes(n);case"HierarchyLevelLimitExceededException":case"com.amazonaws.ssm#HierarchyLevelLimitExceededException":throw await de_HierarchyLevelLimitExceededExceptionRes(n);case"HierarchyTypeMismatchException":case"com.amazonaws.ssm#HierarchyTypeMismatchException":throw await de_HierarchyTypeMismatchExceptionRes(n);case"IncompatiblePolicyException":case"com.amazonaws.ssm#IncompatiblePolicyException":throw await de_IncompatiblePolicyExceptionRes(n);case"InvalidAllowedPatternException":case"com.amazonaws.ssm#InvalidAllowedPatternException":throw await de_InvalidAllowedPatternExceptionRes(n);case"InvalidPolicyAttributeException":case"com.amazonaws.ssm#InvalidPolicyAttributeException":throw await de_InvalidPolicyAttributeExceptionRes(n);case"InvalidPolicyTypeException":case"com.amazonaws.ssm#InvalidPolicyTypeException":throw await de_InvalidPolicyTypeExceptionRes(n);case"ParameterAlreadyExists":case"com.amazonaws.ssm#ParameterAlreadyExists":throw await de_ParameterAlreadyExistsRes(n);case"ParameterLimitExceeded":case"com.amazonaws.ssm#ParameterLimitExceeded":throw await de_ParameterLimitExceededRes(n);case"ParameterMaxVersionLimitExceeded":case"com.amazonaws.ssm#ParameterMaxVersionLimitExceeded":throw await de_ParameterMaxVersionLimitExceededRes(n);case"ParameterPatternMismatchException":case"com.amazonaws.ssm#ParameterPatternMismatchException":throw await de_ParameterPatternMismatchExceptionRes(n);case"PoliciesLimitExceededException":case"com.amazonaws.ssm#PoliciesLimitExceededException":throw await de_PoliciesLimitExceededExceptionRes(n);case"UnsupportedParameterType":case"com.amazonaws.ssm#UnsupportedParameterType":throw await de_UnsupportedParameterTypeRes(n);case"ResourcePolicyLimitExceededException":case"com.amazonaws.ssm#ResourcePolicyLimitExceededException":throw await de_ResourcePolicyLimitExceededExceptionRes(n);case"AlreadyExistsException":case"com.amazonaws.ssm#AlreadyExistsException":throw await de_AlreadyExistsExceptionRes(n);case"FeatureNotAvailableException":case"com.amazonaws.ssm#FeatureNotAvailableException":throw await de_FeatureNotAvailableExceptionRes(n);case"AutomationStepNotFoundException":case"com.amazonaws.ssm#AutomationStepNotFoundException":throw await de_AutomationStepNotFoundExceptionRes(n);case"InvalidAutomationSignalException":case"com.amazonaws.ssm#InvalidAutomationSignalException":throw await de_InvalidAutomationSignalExceptionRes(n);case"InvalidNotificationConfig":case"com.amazonaws.ssm#InvalidNotificationConfig":throw await de_InvalidNotificationConfigRes(n);case"InvalidOutputFolder":case"com.amazonaws.ssm#InvalidOutputFolder":throw await de_InvalidOutputFolderRes(n);case"InvalidRole":case"com.amazonaws.ssm#InvalidRole":throw await de_InvalidRoleRes(n);case"ServiceQuotaExceededException":case"com.amazonaws.ssm#ServiceQuotaExceededException":throw await de_ServiceQuotaExceededExceptionRes(n);case"InvalidAssociation":case"com.amazonaws.ssm#InvalidAssociation":throw await de_InvalidAssociationRes(n);case"AutomationDefinitionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionNotFoundException":throw await de_AutomationDefinitionNotFoundExceptionRes(n);case"AutomationDefinitionVersionNotFoundException":case"com.amazonaws.ssm#AutomationDefinitionVersionNotFoundException":throw await de_AutomationDefinitionVersionNotFoundExceptionRes(n);case"AutomationExecutionLimitExceededException":case"com.amazonaws.ssm#AutomationExecutionLimitExceededException":throw await de_AutomationExecutionLimitExceededExceptionRes(n);case"InvalidAutomationExecutionParametersException":case"com.amazonaws.ssm#InvalidAutomationExecutionParametersException":throw await de_InvalidAutomationExecutionParametersExceptionRes(n);case"AutomationDefinitionNotApprovedException":case"com.amazonaws.ssm#AutomationDefinitionNotApprovedException":throw await de_AutomationDefinitionNotApprovedExceptionRes(n);case"TargetNotConnected":case"com.amazonaws.ssm#TargetNotConnected":throw await de_TargetNotConnectedRes(n);case"InvalidAutomationStatusUpdateException":case"com.amazonaws.ssm#InvalidAutomationStatusUpdateException":throw await de_InvalidAutomationStatusUpdateExceptionRes(n);case"AssociationVersionLimitExceeded":case"com.amazonaws.ssm#AssociationVersionLimitExceeded":throw await de_AssociationVersionLimitExceededRes(n);case"InvalidUpdate":case"com.amazonaws.ssm#InvalidUpdate":throw await de_InvalidUpdateRes(n);case"StatusUnchanged":case"com.amazonaws.ssm#StatusUnchanged":throw await de_StatusUnchangedRes(n);case"DocumentVersionLimitExceeded":case"com.amazonaws.ssm#DocumentVersionLimitExceeded":throw await de_DocumentVersionLimitExceededRes(n);case"DuplicateDocumentContent":case"com.amazonaws.ssm#DuplicateDocumentContent":throw await de_DuplicateDocumentContentRes(n);case"DuplicateDocumentVersionName":case"com.amazonaws.ssm#DuplicateDocumentVersionName":throw await de_DuplicateDocumentVersionNameRes(n);case"OpsMetadataKeyLimitExceededException":case"com.amazonaws.ssm#OpsMetadataKeyLimitExceededException":throw await de_OpsMetadataKeyLimitExceededExceptionRes(n);case"ResourceDataSyncConflictException":case"com.amazonaws.ssm#ResourceDataSyncConflictException":throw await de_ResourceDataSyncConflictExceptionRes(n);default:const t=n.body;return throwDefaultError$1({output:e,parsedBody:t,errorCode:i})}},de_AccessDeniedExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AccessDeniedException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AlreadyExistsException$2({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AssociatedInstancesRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AssociatedInstances({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AssociationAlreadyExistsRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AssociationAlreadyExists({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AssociationDoesNotExistRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AssociationDoesNotExist({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AssociationExecutionDoesNotExistRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AssociationExecutionDoesNotExist({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AssociationLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AssociationLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AssociationVersionLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AssociationVersionLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AutomationDefinitionNotApprovedExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AutomationDefinitionNotApprovedException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AutomationDefinitionNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AutomationDefinitionNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AutomationDefinitionVersionNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AutomationDefinitionVersionNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AutomationExecutionLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AutomationExecutionLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AutomationExecutionNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AutomationExecutionNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_AutomationStepNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new AutomationStepNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ComplianceTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ComplianceTypeCountLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_CustomSchemaCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new CustomSchemaCountLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DocumentAlreadyExistsRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DocumentAlreadyExists({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DocumentLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DocumentLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DocumentPermissionLimitRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DocumentPermissionLimit({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DocumentVersionLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DocumentVersionLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DoesNotExistExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DoesNotExistException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DuplicateDocumentContentRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DuplicateDocumentContent({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DuplicateDocumentVersionNameRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DuplicateDocumentVersionName({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_DuplicateInstanceIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new DuplicateInstanceId({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_FeatureNotAvailableExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new FeatureNotAvailableException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_HierarchyLevelLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new HierarchyLevelLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_HierarchyTypeMismatchExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new HierarchyTypeMismatchException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_IdempotentParameterMismatchRes=async(e,t)=>{const n=e.body,i=_json(n),r=new IdempotentParameterMismatch({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_IncompatiblePolicyExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new IncompatiblePolicyException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InternalServerErrorRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InternalServerError({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidActivationRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidActivation({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidActivationIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidActivationId({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAggregatorExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAggregatorException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAllowedPatternExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAllowedPatternException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAssociationRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAssociation({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAssociationVersionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAssociationVersion({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAutomationExecutionParametersExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAutomationExecutionParametersException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAutomationSignalExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAutomationSignalException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidAutomationStatusUpdateExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAutomationStatusUpdateException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidCommandIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidCommandId({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDeleteInventoryParametersExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDeleteInventoryParametersException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDeletionIdExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDeletionIdException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDocumentRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDocument({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDocumentContentRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDocumentContent({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDocumentOperationRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDocumentOperation({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDocumentSchemaVersionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDocumentSchemaVersion({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDocumentTypeRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDocumentType({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidDocumentVersionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidDocumentVersion({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidFilterRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidFilter({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidFilterKeyRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidFilterKey({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidFilterOptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidFilterOption({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidFilterValueRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidFilterValue({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidInstanceIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidInstanceId({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidInstanceInformationFilterValueRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidInstanceInformationFilterValue({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidInstancePropertyFilterValueRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidInstancePropertyFilterValue({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidInventoryGroupExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidInventoryGroupException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidInventoryItemContextException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidInventoryRequestExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidInventoryRequestException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidItemContentExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidItemContentException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidKeyIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidKeyId({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidNextTokenRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidNextToken({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidNotificationConfigRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidNotificationConfig({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidOptionExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidOptionException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidOutputFolderRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidOutputFolder({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidOutputLocationRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidOutputLocation({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidParametersRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidParameters({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidPermissionTypeRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidPermissionType({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidPluginNameRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidPluginName({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidPolicyAttributeExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidPolicyAttributeException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidPolicyTypeExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidPolicyTypeException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidResourceIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidResourceId({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidResourceTypeRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidResourceType({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidResultAttributeExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidResultAttributeException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidRoleRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidRole({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidScheduleRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidSchedule({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidTagRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidTag({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidTargetRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidTarget({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidTargetMapsRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidTargetMaps({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidTypeNameExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidTypeNameException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvalidUpdateRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidUpdate({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_InvocationDoesNotExistRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvocationDoesNotExist({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ItemContentMismatchExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ItemContentMismatchException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ItemSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ItemSizeLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_MalformedResourcePolicyDocumentExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new MalformedResourcePolicyDocumentException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_MaxDocumentSizeExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new MaxDocumentSizeExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_NoLongerSupportedExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new NoLongerSupportedException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemAccessDeniedExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemAccessDeniedException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemAlreadyExistsException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemConflictException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemInvalidParameterException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemRelatedItemAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemRelatedItemAlreadyExistsException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsItemRelatedItemAssociationNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsItemRelatedItemAssociationNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsMetadataAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsMetadataAlreadyExistsException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsMetadataInvalidArgumentExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsMetadataInvalidArgumentException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsMetadataKeyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsMetadataKeyLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsMetadataLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsMetadataLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsMetadataNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsMetadataNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_OpsMetadataTooManyUpdatesExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OpsMetadataTooManyUpdatesException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterAlreadyExistsRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterAlreadyExists({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterMaxVersionLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterMaxVersionLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterNotFoundRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterNotFound({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterPatternMismatchExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterPatternMismatchException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterVersionLabelLimitExceededRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterVersionLabelLimitExceeded({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ParameterVersionNotFoundRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ParameterVersionNotFound({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_PoliciesLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new PoliciesLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceDataSyncAlreadyExistsExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceDataSyncAlreadyExistsException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceDataSyncConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceDataSyncConflictException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceDataSyncCountExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceDataSyncCountExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceDataSyncInvalidConfigurationExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceDataSyncInvalidConfigurationException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceDataSyncNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceDataSyncNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceInUseExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceInUseException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourceNotFoundExceptionRes$1=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceNotFoundException$1({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourcePolicyConflictExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourcePolicyConflictException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourcePolicyInvalidParameterExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourcePolicyInvalidParameterException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourcePolicyLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourcePolicyLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ResourcePolicyNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourcePolicyNotFoundException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ServiceQuotaExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ServiceQuotaExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ServiceSettingNotFoundRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ServiceSettingNotFound({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_StatusUnchangedRes=async(e,t)=>{const n=e.body,i=_json(n),r=new StatusUnchanged({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_SubTypeCountLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new SubTypeCountLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_TargetInUseExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TargetInUseException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_TargetNotConnectedRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TargetNotConnected({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ThrottlingExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ThrottlingException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_TooManyTagsErrorRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TooManyTagsError({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_TooManyUpdatesRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TooManyUpdates({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_TotalSizeLimitExceededExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TotalSizeLimitExceededException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedCalendarExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedCalendarException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedFeatureRequiredExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedFeatureRequiredException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedInventoryItemContextExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedInventoryItemContextException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedInventorySchemaVersionExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedInventorySchemaVersionException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedOperatingSystemRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedOperatingSystem({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedOperationExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedOperationException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedParameterTypeRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedParameterType({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedPlatformTypeRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedPlatformType({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_ValidationExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ValidationException({$metadata:deserializeMetadata$1(e),...i});return decorateServiceException$1(r,n)},de_GetParameterResult=(e,t)=>take(e,{Parameter:e=>de_Parameter(e)}),de_GetParametersResult=(e,t)=>take(e,{InvalidParameters:_json,Parameters:e=>de_ParameterList(e)}),de_Parameter=(e,t)=>take(e,{ARN:expectString,DataType:expectString,LastModifiedDate:e=>expectNonNull(parseEpochTimestamp$1(expectNumber$1(e))),Name:expectString,Selector:expectString,SourceResult:expectString,Type:expectString,Value:expectString,Version:expectLong$1}),de_ParameterList=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_Parameter(e));return n},deserializeMetadata$1=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"]}),throwDefaultError$1=withBaseException(SSMServiceException),buildHttpRpcRequest$1=async(e,t,n,i,r)=>{const{hostname:o,protocol:a="https",port:s,path:c}=await e.endpoint(),l={protocol:a,hostname:o,port:s,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==r&&(l.body=r),new HttpRequest$2(l)};function sharedHeaders$1(e){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AmazonSSM.${e}`}}class GetParameterCommand extends(Command$1.classBuilder().ep(commonParams$2).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("AmazonSSM","GetParameter",{}).n("SSMClient","GetParameterCommand").f(void 0,GetParameterResultFilterSensitiveLog).ser(se_GetParameterCommand).de(de_GetParameterCommand).build()){}class GetParametersCommand extends(Command$1.classBuilder().ep(commonParams$2).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("AmazonSSM","GetParameters",{}).n("SSMClient","GetParametersCommand").f(void 0,GetParametersResultFilterSensitiveLog).ser(se_GetParametersCommand).de(de_GetParametersCommand).build()){}const DEFAULT_CLIENT_CONFIG$1={clientConfig:DEFAULT_AWS_CONFIGURATION,onlyDefault:!1,prefix:process.env.SSM_PARAM_PATH},getSecrets=async(e,t,n,i)=>{if(t.onlyDefault)return i;try{const r=new GetParametersCommand({Names:n.map(e=>`${t.prefix??""}${e}`),WithDecryption:!0}),o=await e.send(r);return o?.Parameters?.map(e=>{const t=!e.Value&&e.Name?i.find(t=>t.name===e.Name):i[0];return{name:e.Name??t?.name??"",value:e.Value??t?.value??""}})??i}catch(e){return t.logger&&t.logger.error(e),i}},getSecret=async(e,t,n,i)=>{if(t.onlyDefault)return i;try{const r=await e.send(new GetParameterCommand({Name:`${t.prefix??""}${n}`,WithDecryption:!0}));return r?.Parameter?.Value??i}catch(e){return t.logger&&t.logger.error(e),i}},parameterStore=e=>{const{clientConfig:t,...n}={...DEFAULT_CLIENT_CONFIG$1,...e},i=new SSMClient(t);return{getSecret:(e,t="")=>getSecret(i,n,e,t),getSecrets:(e,t=[])=>getSecrets(i,n,e,t)}},getHttpHandlerExtensionConfiguration=e=>({setHttpHandler(t){e.httpHandler=t},httpHandler:()=>e.httpHandler,updateHttpClientConfig(t,n){e.httpHandler?.updateHttpClientConfig(t,n)},httpHandlerConfigs:()=>e.httpHandler.httpHandlerConfigs()}),resolveHttpHandlerRuntimeConfig=e=>({httpHandler:e.httpHandler()});var EndpointURLScheme,AlgorithmId;!function(e){e.HTTP="http",e.HTTPS="https"}(EndpointURLScheme||(EndpointURLScheme={})),function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"}(AlgorithmId||(AlgorithmId={}));const SMITHY_CONTEXT_KEY="__smithy_context";let HttpRequest$1=class e{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;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(t){const n=new e({...t,headers:{...t.headers}});return n.query&&(n.query=cloneQuery$1(n.query)),n}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return e.clone(this)}};function cloneQuery$1(e){return Object.keys(e).reduce((t,n)=>{const i=e[n];return{...t,[n]:Array.isArray(i)?[...i]:i}},{})}class HttpResponse{statusCode;reason;headers;body;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 t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}function resolveHostHeaderConfig(e){return e}const hostHeaderMiddleware=e=>t=>async n=>{if(!HttpRequest$1.isInstance(n.request))return t(n);const{request:i}=n,{handlerProtocol:r=""}=e.requestHandler.metadata||{};if(r.indexOf("h2")>=0&&!i.headers[":authority"])delete i.headers.host,i.headers[":authority"]=i.hostname+(i.port?":"+i.port:"");else if(!i.headers.host){let e=i.hostname;null!=i.port&&(e+=`:${i.port}`),i.headers.host=e}return t(n)},hostHeaderMiddlewareOptions={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},getHostHeaderPlugin=e=>({applyToStack:t=>{t.add(hostHeaderMiddleware(e),hostHeaderMiddlewareOptions)}}),loggerMiddleware=()=>(e,t)=>async n=>{try{const i=await e(n),{clientName:r,commandName:o,logger:a,dynamoDbDocumentClientOptions:s={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:l}=s,d=c??t.inputFilterSensitiveLog,u=l??t.outputFilterSensitiveLog,{$metadata:p,...m}=i.output;return a?.info?.({clientName:r,commandName:o,input:d(n.input),output:u(m),metadata:p}),i}catch(e){const{clientName:i,commandName:r,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:s}=a,c=s??t.inputFilterSensitiveLog;throw o?.error?.({clientName:i,commandName:r,input:c(n.input),error:e,metadata:e.$metadata}),e}},loggerMiddlewareOptions={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},getLoggerPlugin=e=>({applyToStack:e=>{e.add(loggerMiddleware(),loggerMiddlewareOptions)}}),recursionDetectionMiddlewareOptions={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},recursionDetectionMiddleware=()=>e=>async t=>e(t),getRecursionDetectionPlugin=e=>({applyToStack:e=>{e.add(recursionDetectionMiddleware(),recursionDetectionMiddlewareOptions)}}),getSmithyContext=e=>e[SMITHY_CONTEXT_KEY]||(e[SMITHY_CONTEXT_KEY]={}),normalizeProvider$2=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},resolveAuthOptions=(e,t)=>{if(!t||0===t.length)return e;const n=[];for(const i of t)for(const t of e){t.schemeId.split("#")[1]===i&&n.push(t)}for(const t of e)n.find(({schemeId:e})=>e===t.schemeId)||n.push(t);return n};function convertHttpAuthSchemesToMap(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}const httpAuthSchemeMiddleware=(e,t)=>(n,i)=>async r=>{const o=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,i,r.input)),a=e.authSchemePreference?await e.authSchemePreference():[],s=resolveAuthOptions(o,a),c=convertHttpAuthSchemesToMap(e.httpAuthSchemes),l=getSmithyContext(i),d=[];for(const n of s){const r=c.get(n.schemeId);if(!r){d.push(`HttpAuthScheme \`${n.schemeId}\` was not enabled for this service.`);continue}const o=r.identityProvider(await t.identityProviderConfigProvider(e));if(!o){d.push(`HttpAuthScheme \`${n.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:a={},signingProperties:s={}}=n.propertiesExtractor?.(e,i)||{};n.identityProperties=Object.assign(n.identityProperties||{},a),n.signingProperties=Object.assign(n.signingProperties||{},s),l.selectedHttpAuthScheme={httpAuthOption:n,identity:await o(n.identityProperties),signer:r.signer};break}if(!l.selectedHttpAuthScheme)throw new Error(d.join("\n"));return n(r)},httpAuthSchemeEndpointRuleSetMiddlewareOptions={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},getHttpAuthSchemeEndpointRuleSetPlugin=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:i=>{i.addRelativeTo(httpAuthSchemeMiddleware(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),httpAuthSchemeEndpointRuleSetMiddlewareOptions)}}),serializerMiddlewareOption$1={name:"serializerMiddleware"},defaultErrorHandler=e=>e=>{throw e},defaultSuccessHandler=(e,t)=>{},httpSigningMiddleware=e=>(e,t)=>async n=>{if(!HttpRequest$1.isInstance(n.request))return e(n);const i=getSmithyContext(t).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:r={}},identity:o,signer:a}=i,s=await e({...n,request:await a.sign(n.request,o,r)}).catch((a.errorHandler||defaultErrorHandler)(r));return(a.successHandler||defaultSuccessHandler)(s.response,r),s},httpSigningMiddlewareOptions={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},getHttpSigningPlugin=e=>({applyToStack:e=>{e.addRelativeTo(httpSigningMiddleware(),httpSigningMiddlewareOptions)}}),normalizeProvider$1=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t};class Uint8ArrayBlobAdapter extends Uint8Array{static fromString(e,t="utf-8"){if("string"==typeof e)return"base64"===t?Uint8ArrayBlobAdapter.mutate(fromBase64(e)):Uint8ArrayBlobAdapter.mutate(fromUtf8$2(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,Uint8ArrayBlobAdapter.prototype),e}transformToString(e="utf-8"){return"base64"===e?toBase64(this):toUtf8(this)}}const isReadableStream=e=>"function"==typeof ReadableStream&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream);function buildQueryString(e){const t=[];for(let n of Object.keys(e).sort()){const i=e[n];if(n=escapeUri(n),Array.isArray(i))for(let e=0,r=i.length;e<r;e++)t.push(`${n}=${escapeUri(i[e])}`);else{let e=n;(i||"string"==typeof i)&&(e+=`=${escapeUri(i)}`),t.push(e)}}return t.join("&")}function createRequest(e,t){return new Request(e,t)}function requestTimeout(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)},e)})}const keepAliveSupport={supported:void 0};class FetchHttpHandler{config;configProvider;static create(e){return"function"==typeof e?.handle?e:new FetchHttpHandler(e)}constructor(e){"function"==typeof e?this.configProvider=e().then(e=>e||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),void 0===keepAliveSupport.supported&&(keepAliveSupport.supported=Boolean("undefined"!=typeof Request&&"keepalive"in createRequest("https://[::1]")))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);const i=n??this.config.requestTimeout,r=!0===this.config.keepAlive,o=this.config.credentials;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let a=e.path;const s=buildQueryString(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let c="";if(null!=e.username||null!=e.password){c=`${e.username??""}:${e.password??""}@`}const{port:l,method:d}=e,u=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:""}${a}`,p="GET"===d||"HEAD"===d?void 0:e.body,m={body:p,headers:new Headers(e.headers),method:d,credentials:o};this.config?.cache&&(m.cache=this.config.cache),p&&(m.duplex="half"),"undefined"!=typeof AbortController&&(m.signal=t),keepAliveSupport.supported&&(m.keepalive=r),"function"==typeof this.config.requestInit&&Object.assign(m,this.config.requestInit(e));let h=()=>{};const f=createRequest(u,m),g=[fetch(f).then(e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return null!=e.body?{response:new HttpResponse({headers:n,reason:e.statusText,statusCode:e.status,body:e.body})}:e.blob().then(t=>({response:new HttpResponse({headers:n,reason:e.statusText,statusCode:e.status,body:t})}))}),requestTimeout(i)];return t&&g.push(new Promise((e,n)=>{const i=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)};if("function"==typeof t.addEventListener){const e=t;e.addEventListener("abort",i,{once:!0}),h=()=>e.removeEventListener("abort",i)}else t.onabort=i})),Promise.race(g).finally(h)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}const streamCollector=async e=>"function"==typeof Blob&&e instanceof Blob||"Blob"===e.constructor?.name?void 0!==Blob.prototype.arrayBuffer?new Uint8Array(await e.arrayBuffer()):collectBlob(e):collectStream(e);async function collectBlob(e){const t=await readToBase64(e),n=fromBase64(t);return new Uint8Array(n)}async function collectStream(e){const t=[],n=e.getReader();let i=!1,r=0;for(;!i;){const{done:e,value:o}=await n.read();o&&(t.push(o),r+=o.length),i=e}const o=new Uint8Array(r);let a=0;for(const e of t)o.set(e,a),a+=e.length;return o}function readToBase64(e){return new Promise((t,n)=>{const i=new FileReader;i.onloadend=()=>{if(2!==i.readyState)return n(new Error("Reader aborted too early"));const e=i.result??"",r=e.indexOf(","),o=r>-1?r+1:e.length;t(e.substring(o))},i.onabort=()=>n(new Error("Read aborted")),i.onerror=()=>n(i.error),i.readAsDataURL(e)})}const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED="The stream has already been transformed.",sdkStreamMixin=e=>{if(!isBlobInstance(e)&&!isReadableStream(e)){throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${e?.__proto__?.constructor?.name||e}`)}let t=!1;const n=async()=>{if(t)throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);return t=!0,await streamCollector(e)};return Object.assign(e,{transformToByteArray:n,transformToString:async e=>{const t=await n();if("base64"===e)return toBase64(t);if("hex"===e)return toHex(t);if(void 0===e||"utf8"===e||"utf-8"===e)return toUtf8(t);if("function"==typeof TextDecoder)return new TextDecoder(e).decode(t);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);if(t=!0,isBlobInstance(e))return(e=>{if("function"!=typeof e.stream)throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");return e.stream()})(e);if(isReadableStream(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},isBlobInstance=e=>"function"==typeof Blob&&e instanceof Blob,collectBody=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Uint8ArrayBlobAdapter.mutate(e);if(!e)return Uint8ArrayBlobAdapter.mutate(new Uint8Array);const n=t.streamCollector(e);return Uint8ArrayBlobAdapter.mutate(await n)};function extendedEncodeURIComponent(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}const deref=e=>"function"==typeof e?e():e,operation=(e,t,n,i,r)=>({name:t,namespace:e,traits:n,input:i,output:r}),schemaDeserializationMiddleware=e=>(t,n)=>async i=>{const{response:r}=await t(i),{operationSchema:o}=getSmithyContext(n),[,a,s,c,l,d]=o??[];try{return{response:r,output:await e.protocol.deserializeResponse(operation(a,s,c,l,d),{...e,...n},r)}}catch(e){if(Object.defineProperty(e,"$response",{value:r,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in e)){const t="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{e.message+="\n "+t}catch(e){n.logger&&"NoOpLogger"!==n.logger?.constructor?.name?n.logger?.warn?.(t):console.warn(t)}void 0!==e.$responseBodyText&&e.$response&&(e.$response.body=e.$responseBodyText);try{if(HttpResponse.isInstance(r)){const{headers:t={}}=r,n=Object.entries(t);e.$metadata={httpStatusCode:r.statusCode,requestId:findHeader(/^x-[\w-]+-request-?id$/,n),extendedRequestId:findHeader(/^x-[\w-]+-id-2$/,n),cfId:findHeader(/^x-[\w-]+-cf-id$/,n)}}}catch(e){}}throw e}},findHeader=(e,t)=>(t.find(([t])=>t.match(e))||[void 0,void 0])[1],schemaSerializationMiddleware=e=>(t,n)=>async i=>{const{operationSchema:r}=getSmithyContext(n),[,o,a,s,c,l]=r??[],d=n.endpointV2?.url&&e.urlParser?async()=>e.urlParser(n.endpointV2.url):e.endpoint,u=await e.protocol.serializeRequest(operation(o,a,s,c,l),i.input,{...e,...n,endpoint:d});return t({...i,request:u})},deserializerMiddlewareOption={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},serializerMiddlewareOption={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function getSchemaSerdePlugin(e){return{applyToStack:t=>{t.add(schemaSerializationMiddleware(e),serializerMiddlewareOption),t.add(schemaDeserializationMiddleware(e),deserializerMiddlewareOption),e.protocol.setSerdeContext(e)}}}function translateTraits(e){if("object"==typeof e)return e;e|=0;const t={};let n=0;for(const i of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])1==(e>>n++&1)&&(t[i]=1);return t}class NormalizedSchema{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=NormalizedSchema.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const n=[];let i=e,r=e;for(this._isMemberSchema=!1;isMemberSchema(i);)n.push(i[1]),i=i[0],r=deref(i),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let e=n.length-1;e>=0;--e){const t=n[e];Object.assign(this.memberTraits,translateTraits(t))}}else this.memberTraits=0;if(r instanceof NormalizedSchema){const e=this.memberTraits;return Object.assign(this,r),this.memberTraits=Object.assign({},e,r.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,void(this.memberName=t??r.memberName)}if(this.schema=deref(r),isStaticSchema(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(r),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){const t=this.prototype.isPrototypeOf(e);if(!t&&"object"==typeof e&&null!==e){return e.symbol===this.symbol}return t}static of(e){const t=deref(e);if(t instanceof NormalizedSchema)return t;if(isMemberSchema(t)){const[n,i]=t;if(n instanceof NormalizedSchema)return Object.assign(n.getMergedTraits(),translateTraits(i)),n;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}return new NormalizedSchema(t)}getSchema(){const e=this.schema;return 0===e[0]?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return"number"==typeof e?e>=64&&e<128:1===e[0]}isMapSchema(){const e=this.getSchema();return"number"==typeof e?e>=128&&e<=255:2===e[0]}isStructSchema(){const e=this.getSchema();return 3===e[0]||-3===e[0]}isBlobSchema(){const e=this.getSchema();return 21===e||42===e}isTimestampSchema(){const e=this.getSchema();return"number"==typeof e&&e>=4&&e<=7}isUnitSchema(){return"unit"===this.getSchema()}isDocumentSchema(){return 15===this.getSchema()}isStringSchema(){return 0===this.getSchema()}isBooleanSchema(){return 2===this.getSchema()}isNumericSchema(){return 1===this.getSchema()}isBigIntegerSchema(){return 17===this.getSchema()}isBigDecimalSchema(){return 19===this.getSchema()}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||42===this.getSchema()}isIdempotencyToken(){const e=e=>!(4&~e&&!e?.idempotencyToken),{normalizedTraits:t,traits:n,memberTraits:i}=this;return e(t)||e(n)||e(i)}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return translateTraits(this.memberTraits)}getOwnTraits(){return translateTraits(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const n=this.getSchema();return member([e?15:n[4]??0,0],"key")}getValueSchema(){const e=this.getSchema(),[t,n,i]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],r="number"==typeof e?63&e:e&&"object"==typeof e&&(n||i)?e[3+e[0]]:t?15:void 0;if(null!=r)return member([r,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const n=t[4].indexOf(e),i=t[5][n];return member(isMemberSchema(i)?i:[i,0],e)}if(this.isDocumentSchema())return member([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,n]of this.structIterator())e[t]=n}catch(e){}return e}getEventStreamMember(){if(this.isStructSchema())for(const[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e;return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema();for(let t=0;t<e[4].length;++t)yield[e[4][t],member([e[5][t],0],e[4][t])]}}function member(e,t){if(e instanceof NormalizedSchema)return Object.assign(e,{memberName:t,_isMemberSchema:!0});return new NormalizedSchema(e,t)}const isMemberSchema=e=>Array.isArray(e)&&2===e.length,isStaticSchema=e=>Array.isArray(e)&&e.length>=5;class TypeRegistry{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,n=new Map){this.namespace=e,this.schemas=t,this.exceptions=n}static for(e){return TypeRegistry.registries.has(e)||TypeRegistry.registries.set(e,new TypeRegistry(e)),TypeRegistry.registries.get(e)}register(e,t){const n=this.normalizeShapeId(e);TypeRegistry.for(n.split("#")[0]).schemas.set(n,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t))throw new Error(`@smithy/core/schema - schema not found for ${t}`);return this.schemas.get(t)}registerError(e,t){const n=e,i=TypeRegistry.for(n[1]);i.schemas.set(n[1]+"#"+n[2],n),i.exceptions.set(n,t)}getErrorCtor(e){const t=e;return TypeRegistry.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,n]=e,i=t+"#"+n;if(i.startsWith("smithy.ts.sdk.synthetic.")&&i.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}const expectNumber=e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&logger$2.warn(stackTraceWarning(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},MAX_FLOAT=Math.ceil(2**127*(2-2**-23)),expectFloat32=e=>{const t=expectNumber(e);if(void 0!==t&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>MAX_FLOAT)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},expectLong=e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},expectShort=e=>expectSizedInt(e,16),expectByte=e=>expectSizedInt(e,8),expectSizedInt=(e,t)=>{const n=expectLong(e);if(void 0!==n&&castInt(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},castInt=(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]}},strictParseDouble=e=>expectNumber("string"==typeof e?parseNumber(e):e),strictParseFloat32=e=>expectFloat32("string"==typeof e?parseNumber(e):e),NUMBER_REGEX=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,parseNumber=e=>{const t=e.match(NUMBER_REGEX);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},strictParseShort=e=>expectShort("string"==typeof e?parseNumber(e):e),strictParseByte=e=>expectByte("string"==typeof e?parseNumber(e):e),stackTraceWarning=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join("\n"),logger$2={warn:console.warn},DAYS=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MONTHS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dateToUtcString(e){const t=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDay(),r=e.getUTCDate(),o=e.getUTCHours(),a=e.getUTCMinutes(),s=e.getUTCSeconds(),c=r<10?`0${r}`:`${r}`,l=o<10?`0${o}`:`${o}`,d=a<10?`0${a}`:`${a}`,u=s<10?`0${s}`:`${s}`;return`${DAYS[i]}, ${c} ${MONTHS[n]} ${t} ${l}:${d}:${u} GMT`}const RFC3339_WITH_OFFSET$1=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),parseRfc3339DateTimeWithOffset=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-3339 date-times must be expressed as strings");const t=RFC3339_WITH_OFFSET$1.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");const[n,i,r,o,a,s,c,l,d]=t,u=strictParseShort(stripLeadingZeroes(i)),p=parseDateValue(r,"month",1,12),m=parseDateValue(o,"day",1,31),h=buildDate(u,p,m,{hours:a,minutes:s,seconds:c,fractionalMilliseconds:l});return"Z"!=d.toUpperCase()&&h.setTime(h.getTime()-parseOffsetToMilliseconds(d)),h},IMF_FIXDATE$1=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),RFC_850_DATE$1=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),ASC_TIME$1=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),parseRfc7231DateTime=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=IMF_FIXDATE$1.exec(e);if(t){const[e,n,i,r,o,a,s,c]=t;return buildDate(strictParseShort(stripLeadingZeroes(r)),parseMonthByShortName(i),parseDateValue(n,"day",1,31),{hours:o,minutes:a,seconds:s,fractionalMilliseconds:c})}if(t=RFC_850_DATE$1.exec(e),t){const[e,n,i,r,o,a,s,c]=t;return adjustRfc850Year(buildDate(parseTwoDigitYear(r),parseMonthByShortName(i),parseDateValue(n,"day",1,31),{hours:o,minutes:a,seconds:s,fractionalMilliseconds:c}))}if(t=ASC_TIME$1.exec(e),t){const[e,n,i,r,o,a,s,c]=t;return buildDate(strictParseShort(stripLeadingZeroes(c)),parseMonthByShortName(n),parseDateValue(i.trimLeft(),"day",1,31),{hours:r,minutes:o,seconds:a,fractionalMilliseconds:s})}throw new TypeError("Invalid RFC-7231 date-time value")},parseEpochTimestamp=e=>{if(null==e)return;let t;if("number"==typeof e)t=e;else if("string"==typeof e)t=strictParseDouble(e);else{if("object"!=typeof e||1!==e.tag)throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");t=e.value}if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*t))},buildDate=(e,t,n,i)=>{const r=t-1;return validateDayOfMonth(e,r,n),new Date(Date.UTC(e,r,n,parseDateValue(i.hours,"hour",0,23),parseDateValue(i.minutes,"minute",0,59),parseDateValue(i.seconds,"seconds",0,60),parseMilliseconds(i.fractionalMilliseconds)))},parseTwoDigitYear=e=>{const t=(new Date).getUTCFullYear(),n=100*Math.floor(t/100)+strictParseShort(stripLeadingZeroes(e));return n<t?n+100:n},FIFTY_YEARS_IN_MILLIS=15768e8,adjustRfc850Year=e=>e.getTime()-(new Date).getTime()>FIFTY_YEARS_IN_MILLIS?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,parseMonthByShortName=e=>{const t=MONTHS.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},DAYS_IN_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31],validateDayOfMonth=(e,t,n)=>{let i=DAYS_IN_MONTH[t];if(1===t&&isLeapYear(e)&&(i=29),n>i)throw new TypeError(`Invalid day for ${MONTHS[t]} in ${e}: ${n}`)},isLeapYear=e=>e%4==0&&(e%100!=0||e%400==0),parseDateValue=(e,t,n,i)=>{const r=strictParseByte(stripLeadingZeroes(e));if(r<n||r>i)throw new TypeError(`${t} must be between ${n} and ${i}, inclusive`);return r},parseMilliseconds=e=>null==e?0:1e3*strictParseFloat32("0."+e),parseOffsetToMilliseconds=e=>{const t=e[0];let n=1;if("+"==t)n=1;else{if("-"!=t)throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);n=-1}return n*(60*Number(e.substring(1,3))+Number(e.substring(4,6)))*60*1e3},stripLeadingZeroes=e=>{let t=0;for(;t<e.length-1&&"0"===e.charAt(t);)t++;return 0===t?e:e.slice(t)},LazyJsonString=function(e){return Object.assign(new String(e),{deserializeJSON:()=>JSON.parse(String(e)),toString:()=>String(e),toJSON:()=>String(e)})};function quoteHeader(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}LazyJsonString.from=e=>e&&"object"==typeof e&&(e instanceof LazyJsonString||"deserializeJSON"in e)?e:"string"==typeof e||Object.getPrototypeOf(e)===String.prototype?LazyJsonString(String(e)):LazyJsonString(JSON.stringify(e)),LazyJsonString.fromObject=LazyJsonString.from;const ddd="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",mmm="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",time="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",date="(\\d?\\d)",year="(\\d{4})",RFC3339_WITH_OFFSET=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),IMF_FIXDATE=new RegExp(`^${ddd}, ${date} ${mmm} ${year} ${time} GMT$`),RFC_850_DATE=new RegExp(`^${ddd}, ${date}-${mmm}-(\\d\\d) ${time} GMT$`),ASC_TIME=new RegExp(`^${ddd} ${mmm} ( [1-9]|\\d\\d) ${time} ${year}$`),months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_parseEpochTimestamp=e=>{if(null==e)return;let t=NaN;if("number"==typeof e)t=e;else if("string"==typeof e){if(!/^-?\d*\.?\d+$/.test(e))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else"object"==typeof e&&1===e.tag&&(t=e.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(1e3*t))},_parseRfc3339DateTimeWithOffset=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC3339 timestamps must be strings");const t=RFC3339_WITH_OFFSET.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);const[,n,i,r,o,a,s,,c,l]=t;range(i,1,12),range(r,1,31),range(o,0,23),range(a,0,59),range(s,0,60);const d=new Date(Date.UTC(Number(n),Number(i)-1,Number(r),Number(o),Number(a),Number(s),Number(c)?Math.round(1e3*parseFloat(`0.${c}`)):0));if(d.setUTCFullYear(Number(n)),"Z"!=l.toUpperCase()){const[,e,t,n]=/([+-])(\d\d):(\d\d)/.exec(l)||[void 0,"+",0,0],i="-"===e?1:-1;d.setTime(d.getTime()+i*(60*Number(t)*60*1e3+60*Number(n)*1e3))}return d},_parseRfc7231DateTime=e=>{if(null==e)return;if("string"!=typeof e)throw new TypeError("RFC7231 timestamps must be strings.");let t,n,i,r,o,a,s,c;if((c=IMF_FIXDATE.exec(e))?[,t,n,i,r,o,a,s]=c:(c=RFC_850_DATE.exec(e))?([,t,n,i,r,o,a,s]=c,i=(Number(i)+1900).toString()):(c=ASC_TIME.exec(e))&&([,n,t,r,o,a,s,i]=c),i&&a){const e=Date.UTC(Number(i),months.indexOf(n),Number(t),Number(r),Number(o),Number(a),s?Math.round(1e3*parseFloat(`0.${s}`)):0);range(t,1,31),range(r,0,23),range(o,0,59),range(a,0,60);const c=new Date(e);return c.setUTCFullYear(Number(i)),c}throw new TypeError(`Invalid RFC7231 date-time value ${e}.`)};function range(e,t,n){const i=Number(e);if(i<t||i>n)throw new Error(`Value ${i} out of range [${t}, ${n}]`)}function splitEvery(e,t,n){if(!Number.isInteger(n))throw new Error("Invalid number of delimiters ("+n+") for splitEvery.");const i=e.split(t),r=[];let o="";for(let e=0;e<i.length;e++)""===o?o=i[e]:o+=t+i[e],(e+1)%n===0&&(r.push(o),o="");return""!==o&&r.push(o),r}const splitHeader=e=>{const t=e.length,n=[];let i,r=!1,o=0;for(let a=0;a<t;++a){const t=e[a];switch(t){case'"':"\\"!==i&&(r=!r);break;case",":r||(n.push(e.slice(o,a)),o=a+1)}i=t}return n.push(e.slice(o)),n.map(e=>{const t=(e=e.trim()).length;return t<2?e:('"'===e[0]&&'"'===e[t-1]&&(e=e.slice(1,t-1)),e.replace(/\\"/g,'"'))})},format$3=/^-?\d*(\.\d+)?$/;class NumericValue{string;type;constructor(e,t){if(this.string=e,this.type=t,!format$3.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||"object"!=typeof e)return!1;const t=e;return NumericValue.prototype.isPrototypeOf(e)||"bigDecimal"===t.type&&format$3.test(t.string)}}class SerdeContext{serdeContext;setSerdeContext(e){this.serdeContext=e}}class HttpProtocol extends SerdeContext{options;constructor(e){super(),this.options=e}getRequestType(){return HttpRequest$1}getResponseType(){return HttpResponse}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(const[n,i]of t.url.searchParams.entries())e.query[n]=i;return e}return e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},e}setHostPrefix(e,t,n){const i=NormalizedSchema.of(t.input),r=translateTraits(t.traits??{});if(r.endpoint){let t=r.endpoint?.[0];if("string"==typeof t){const r=[...i.structIterator()].filter(([,e])=>e.getMergedTraits().hostLabel);for(const[e]of r){const i=n[e];if("string"!=typeof i)throw new Error(`@smithy/core/schema - ${e} in input must be a string as hostLabel.`);t=t.replace(`{${e}}`,i)}e.hostname=t+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n})}async loadEventStreamCapability(){const{EventStreamSerde:e}=await import("./index-CVhusXdQ.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,n,i,r){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class HttpBindingProtocol extends HttpProtocol{async serializeRequest(e,t,n){const i={...t??{}},r=this.serializer,o={},a={},s=await n.endpoint(),c=NormalizedSchema.of(e?.input),l=c.getSchema();let d,u=!1;const p=new HttpRequest$1({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:o,headers:a,body:void 0});if(s){this.updateServiceEndpoint(p,s),this.setHostPrefix(p,e,i);const t=translateTraits(e.traits);if(t.http){p.method=t.http[0];const[e,n]=t.http[1].split("?");"/"==p.path?p.path=e:p.path+=e;const i=new URLSearchParams(n??"");Object.assign(o,Object.fromEntries(i))}}for(const[e,t]of c.structIterator()){const n=t.getMergedTraits()??{},s=i[e];if(null!=s||t.isIdempotencyToken())if(n.httpPayload){if(t.isStreaming()){t.isStructSchema()?i[e]&&(d=await this.serializeEventStream({eventStream:i[e],requestSchema:c})):d=s}else r.write(t,s),d=r.flush();delete i[e]}else if(n.httpLabel){r.write(t,s);const n=r.flush();p.path.includes(`{${e}+}`)?p.path=p.path.replace(`{${e}+}`,n.split("/").map(extendedEncodeURIComponent).join("/")):p.path.includes(`{${e}}`)&&(p.path=p.path.replace(`{${e}}`,extendedEncodeURIComponent(n))),delete i[e]}else if(n.httpHeader)r.write(t,s),a[n.httpHeader.toLowerCase()]=String(r.flush()),delete i[e];else if("string"==typeof n.httpPrefixHeaders){for(const[e,i]of Object.entries(s)){const o=n.httpPrefixHeaders+e;r.write([t.getValueSchema(),{httpHeader:o}],i),a[o.toLowerCase()]=r.flush()}delete i[e]}else n.httpQuery||n.httpQueryParams?(this.serializeQuery(t,s,o),delete i[e]):u=!0}return u&&i&&(r.write(l,i),d=r.flush()),p.headers=a,p.query=o,p.body=d,p}serializeQuery(e,t,n){const i=this.serializer,r=e.getMergedTraits();if(r.httpQueryParams){for(const[i,o]of Object.entries(t))if(!(i in n)){const t=e.getValueSchema();Object.assign(t.getMergedTraits(),{...r,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(t,o,n)}}else if(e.isListSchema()){const o=!!e.getMergedTraits().sparse,a=[];for(const n of t){i.write([e.getValueSchema(),r],n);const t=i.flush();(o||void 0!==t)&&a.push(t)}n[r.httpQuery]=a}else i.write([e,r],t),n[r.httpQuery]=i.flush()}async deserializeResponse(e,t,n){const i=this.deserializer,r=NormalizedSchema.of(e.output),o={};if(n.statusCode>=300){const r=await collectBody(n.body,t);throw r.byteLength>0&&Object.assign(o,await i.read(15,r)),await this.handleError(e,t,n,o,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(const e in n.headers){const t=n.headers[e];delete n.headers[e],n.headers[e.toLowerCase()]=t}const a=await this.deserializeHttpMessage(r,t,n,o);if(a.length){const e=await collectBody(n.body,t);if(e.byteLength>0){const t=await i.read(r,e);for(const e of a)o[e]=t[e]}}else a.discardResponseBody&&await collectBody(n.body,t);return o.$metadata=this.deserializeMetadata(n),o}async deserializeHttpMessage(e,t,n,i,r){let o;o=i instanceof Set?r:i;let a=!0;const s=this.deserializer,c=NormalizedSchema.of(e),l=[];for(const[e,i]of c.structIterator()){const r=i.getMemberTraits();if(r.httpPayload){a=!1;if(i.isStreaming()){const t=i.isStructSchema();o[e]=t?await this.deserializeEventStream({response:n,responseSchema:c}):sdkStreamMixin(n.body)}else if(n.body){const r=await collectBody(n.body,t);r.byteLength>0&&(o[e]=await s.read(i,r))}}else if(r.httpHeader){const t=String(r.httpHeader).toLowerCase(),a=n.headers[t];if(null!=a)if(i.isListSchema()){const n=i.getValueSchema();let r;n.getMergedTraits().httpHeader=t,r=n.isTimestampSchema()&&4===n.getSchema()?splitEvery(a,",",2):splitHeader(a);const c=[];for(const e of r)c.push(await s.read(n,e.trim()));o[e]=c}else o[e]=await s.read(i,a)}else if(void 0!==r.httpPrefixHeaders){o[e]={};for(const[t,a]of Object.entries(n.headers))if(t.startsWith(r.httpPrefixHeaders)){const n=i.getValueSchema();n.getMergedTraits().httpHeader=t,o[e][t.slice(r.httpPrefixHeaders.length)]=await s.read(n,a)}}else r.httpResponseCode?o[e]=n.statusCode:l.push(e)}return l.discardResponseBody=a,l}}function determineTimestampFormat(e,t){if(t.timestampFormat.useTrait&&e.isTimestampSchema()&&(5===e.getSchema()||6===e.getSchema()||7===e.getSchema()))return e.getSchema();const{httpLabel:n,httpPrefixHeaders:i,httpHeader:r,httpQuery:o}=e.getMergedTraits();return(t.httpBindings?"string"==typeof i||Boolean(r)?6:Boolean(o)||Boolean(n)?5:void 0:void 0)??t.timestampFormat.default}class FromStringShapeDeserializer extends SerdeContext{settings;constructor(e){super(),this.settings=e}read(e,t){const n=NormalizedSchema.of(e);if(n.isListSchema())return splitHeader(t).map(e=>this.read(n.getValueSchema(),e));if(n.isBlobSchema())return(this.serdeContext?.base64Decoder??fromBase64)(t);if(n.isTimestampSchema()){switch(determineTimestampFormat(n,this.settings)){case 5:return _parseRfc3339DateTimeWithOffset(t);case 6:return _parseRfc7231DateTime(t);case 7:return _parseEpochTimestamp(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}}if(n.isStringSchema()){const e=n.getMergedTraits().mediaType;let i=t;if(e){n.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i));return("application/json"===e||e.endsWith("+json"))&&(i=LazyJsonString.from(i)),i}}return n.isNumericSchema()?Number(t):n.isBigIntegerSchema()?BigInt(t):n.isBigDecimalSchema()?new NumericValue(t,"bigDecimal"):n.isBooleanSchema()?"true"===String(t).toLowerCase():t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??toUtf8)((this.serdeContext?.base64Decoder??fromBase64)(e))}}class HttpInterceptingShapeDeserializer extends SerdeContext{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new FromStringShapeDeserializer(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){const n=NormalizedSchema.of(e),i=n.getMergedTraits(),r=this.serdeContext?.utf8Encoder??toUtf8;if(i.httpHeader||i.httpResponseCode)return this.stringDeserializer.read(n,r(t));if(i.httpPayload){if(n.isBlobSchema()){const e=this.serdeContext?.utf8Decoder??fromUtf8$2;return"string"==typeof t?e(t):t}if(n.isStringSchema())return"byteLength"in t?r(t):t}return this.codecDeserializer.read(n,t)}}class ToStringShapeSerializer extends SerdeContext{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){const n=NormalizedSchema.of(e);switch(typeof t){case"object":if(null===t)return void(this.stringBuffer="null");if(n.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${n.getName(!0)}`);switch(determineTimestampFormat(n,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=dateToUtcString(t);break;case 7:this.stringBuffer=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1e3)}return}if(n.isBlobSchema()&&"byteLength"in t)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??toBase64)(t));if(n.isListSchema()&&Array.isArray(t)){let e="";for(const i of t){this.write([n.getValueSchema(),n.getMergedTraits()],i);const t=this.flush();""!==e&&(e+=", "),e+=n.getValueSchema().isTimestampSchema()?t:quoteHeader(t)}return void(this.stringBuffer=e)}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":const e=n.getMergedTraits().mediaType;let i=t;if(e){if(("application/json"===e||e.endsWith("+json"))&&(i=LazyJsonString.from(i)),n.getMergedTraits().httpHeader)return void(this.stringBuffer=(this.serdeContext?.base64Encoder??toBase64)(i.toString()))}this.stringBuffer=t;break;default:n.isIdempotencyToken()?this.stringBuffer=v4():this.stringBuffer=String(t)}}flush(){const e=this.stringBuffer;return this.stringBuffer="",e}}class HttpInterceptingShapeSerializer{codecSerializer;stringSerializer;buffer;constructor(e,t,n=new ToStringShapeSerializer(t)){this.codecSerializer=e,this.stringSerializer=n}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){const n=NormalizedSchema.of(e),i=n.getMergedTraits();return i.httpHeader||i.httpLabel||i.httpQuery?(this.stringSerializer.write(n,t),void(this.buffer=this.stringSerializer.flush())):this.codecSerializer.write(n,t)}flush(){if(void 0!==this.buffer){const e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}function setFeature$1(e,t,n){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=n}class DefaultIdentityProviderConfig{authSchemes=new Map;constructor(e){for(const[t,n]of Object.entries(e))void 0!==n&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}const createIsIdentityExpiredFunction=e=>function(t){return doesIdentityRequireRefresh(t)&&t.expiration.getTime()-Date.now()<e},EXPIRATION_MS=3e5,isIdentityExpired=createIsIdentityExpiredFunction(EXPIRATION_MS),doesIdentityRequireRefresh=e=>void 0!==e.expiration,memoizeIdentityProvider=(e,t,n)=>{if(void 0===e)return;const i="function"!=typeof e?async()=>Promise.resolve(e):e;let r,o,a,s=!1;const c=async e=>{o||(o=i(e));try{r=await o,a=!0,s=!1}finally{o=void 0}return r};return void 0===t?async e=>(a&&!e?.forceRefresh||(r=await c(e)),r):async e=>(a&&!e?.forceRefresh||(r=await c(e)),s?r:n(r)?t(r)?(await c(e),r):r:(s=!0,r))},DEFAULT_UA_APP_ID=void 0;function isValidUserAgentAppId(e){return void 0===e||"string"==typeof e&&e.length<=50}function resolveUserAgentConfig(e){const t=normalizeProvider$1(e.userAgentAppId??DEFAULT_UA_APP_ID),{customUserAgent:n}=e;return Object.assign(e,{customUserAgent:"string"==typeof n?[[n]]:n,userAgentAppId:async()=>{const n=await t();if(!isValidUserAgentAppId(n)){const t="NoOpLogger"!==e.logger?.constructor?.name&&e.logger?e.logger:console;"string"!=typeof n?t?.warn("userAgentAppId must be a string or undefined."):n.length>50&&t?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}class EndpointCache{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const n=this.hash(e);if(!1===n)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const e=this.data.keys();let t=0;for(;;){const{value:n,done:i}=e.next();if(this.data.delete(n),i||++t>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t="";const{parameters:n}=this;if(0===n.length)return!1;for(const i of n){const n=String(e[i]??"");if(n.includes("|;"))return!1;t+=n+"|;"}return t}}const IP_V4_REGEX=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}$"),isIpAddress=e=>IP_V4_REGEX.test(e)||e.startsWith("[")&&e.endsWith("]"),VALID_HOST_LABEL_REGEX=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),isValidHostLabel=(e,t=!1)=>{if(!t)return VALID_HOST_LABEL_REGEX.test(e);const n=e.split(".");for(const e of n)if(!isValidHostLabel(e))return!1;return!0},customEndpointFunctions={},debugId="endpoints";function toDebugString(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${toDebugString(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(toDebugString).join(", ")})`:JSON.stringify(e,null,2)}class EndpointError extends Error{constructor(e){super(e),this.name="EndpointError"}}const booleanEquals=(e,t)=>e===t,getAttrPathList=e=>{const t=e.split("."),n=[];for(const i of t){const t=i.indexOf("[");if(-1!==t){if(i.indexOf("]")!==i.length-1)throw new EndpointError(`Path: '${e}' does not end with ']'`);const r=i.slice(t+1,-1);if(Number.isNaN(parseInt(r)))throw new EndpointError(`Invalid array index: '${r}' in path: '${e}'`);0!==t&&n.push(i.slice(0,t)),n.push(r)}else n.push(i)}return n},getAttr=(e,t)=>getAttrPathList(t).reduce((n,i)=>{if("object"!=typeof n)throw new EndpointError(`Index '${i}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(i)]:n[i]},e),isSet=e=>null!=e,not=e=>!e,DEFAULT_PORTS={[EndpointURLScheme.HTTP]:80,[EndpointURLScheme.HTTPS]:443},parseURL=e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:i="",path:r="",query:o={}}=e,a=new URL(`${i}//${t}${n?`:${n}`:""}${r}`);return a.search=Object.entries(o).map(([e,t])=>`${e}=${t}`).join("&"),a}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:i,hostname:r,pathname:o,protocol:a,search:s}=t;if(s)return null;const c=a.slice(0,-1);if(!Object.values(EndpointURLScheme).includes(c))return null;const l=isIpAddress(r);return{scheme:c,authority:`${i}${n.includes(`${i}:${DEFAULT_PORTS[c]}`)||"string"==typeof e&&e.includes(`${i}:${DEFAULT_PORTS[c]}`)?`:${DEFAULT_PORTS[c]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:l}},stringEquals=(e,t)=>e===t,substring=(e,t,n,i)=>t>=n||e.length<n?null:i?e.substring(e.length-n,e.length-t):e.substring(t,n),uriEncode=e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),endpointFunctions={booleanEquals:booleanEquals,getAttr:getAttr,isSet:isSet,isValidHostLabel:isValidHostLabel,not:not,parseURL:parseURL,stringEquals:stringEquals,substring:substring,uriEncode:uriEncode},evaluateTemplate=(e,t)=>{const n=[],i={...t.endpointParams,...t.referenceRecord};let r=0;for(;r<e.length;){const t=e.indexOf("{",r);if(-1===t){n.push(e.slice(r));break}n.push(e.slice(r,t));const o=e.indexOf("}",t);if(-1===o){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(n.push(e.slice(t+1,o)),r=o+2);const a=e.substring(t+1,o);if(a.includes("#")){const[e,t]=a.split("#");n.push(getAttr(i[e],t))}else n.push(i[a]);r=o+1}return n.join("")},getReferenceValue=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]),evaluateExpression=(e,t,n)=>{if("string"==typeof e)return evaluateTemplate(e,n);if(e.fn)return group$2.callFunction(e,n);if(e.ref)return getReferenceValue(e,n);throw new EndpointError(`'${t}': ${String(e)} is not a string, function or reference.`)},callFunction=({fn:e,argv:t},n)=>{const i=t.map(e=>["boolean","number"].includes(typeof e)?e:group$2.evaluateExpression(e,"arg",n)),r=e.split(".");return r[0]in customEndpointFunctions&&null!=r[1]?customEndpointFunctions[r[0]][r[1]](...i):endpointFunctions[e](...i)},group$2={evaluateExpression:evaluateExpression,callFunction:callFunction},evaluateCondition=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new EndpointError(`'${e}' is already defined in Reference Record.`);const i=callFunction(t,n);return n.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(t)} = ${toDebugString(i)}`),{result:""===i||!!i,...null!=e&&{toAssign:{name:e,value:i}}}},evaluateConditions=(e=[],t)=>{const n={};for(const i of e){const{result:e,toAssign:r}=evaluateCondition(i,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};r&&(n[r.name]=r.value,t.logger?.debug?.(`${debugId} assign: ${r.name} := ${toDebugString(r.value)}`))}return{result:!0,referenceRecord:n}},getEndpointHeaders=(e,t)=>Object.entries(e).reduce((e,[n,i])=>({...e,[n]:i.map(e=>{const i=evaluateExpression(e,"Header value entry",t);if("string"!=typeof i)throw new EndpointError(`Header '${n}' value '${i}' is not a string`);return i})}),{}),getEndpointProperties=(e,t)=>Object.entries(e).reduce((e,[n,i])=>({...e,[n]:group$1.getEndpointProperty(i,t)}),{}),getEndpointProperty=(e,t)=>{if(Array.isArray(e))return e.map(e=>getEndpointProperty(e,t));switch(typeof e){case"string":return evaluateTemplate(e,t);case"object":if(null===e)throw new EndpointError(`Unexpected endpoint property: ${e}`);return group$1.getEndpointProperties(e,t);case"boolean":return e;default:throw new EndpointError("Unexpected endpoint property type: "+typeof e)}},group$1={getEndpointProperty:getEndpointProperty,getEndpointProperties:getEndpointProperties},getEndpointUrl=(e,t)=>{const n=evaluateExpression(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new EndpointError("Endpoint URL must be a string, got "+typeof n)},evaluateEndpointRule=(e,t)=>{const{conditions:n,endpoint:i}=e,{result:r,referenceRecord:o}=evaluateConditions(n,t);if(!r)return;const a={...t,referenceRecord:{...t.referenceRecord,...o}},{url:s,properties:c,headers:l}=i;return t.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(i)}`),{...null!=l&&{headers:getEndpointHeaders(l,a)},...null!=c&&{properties:getEndpointProperties(c,a)},url:getEndpointUrl(s,a)}},evaluateErrorRule=(e,t)=>{const{conditions:n,error:i}=e,{result:r,referenceRecord:o}=evaluateConditions(n,t);if(r)throw new EndpointError(evaluateExpression(i,"Error",{...t,referenceRecord:{...t.referenceRecord,...o}}))},evaluateRules=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=evaluateEndpointRule(n,t);if(e)return e}else if("error"===n.type)evaluateErrorRule(n,t);else{if("tree"!==n.type)throw new EndpointError(`Unknown endpoint rule: ${n}`);{const e=group.evaluateTreeRule(n,t);if(e)return e}}throw new EndpointError("Rules evaluation failed")},evaluateTreeRule=(e,t)=>{const{conditions:n,rules:i}=e,{result:r,referenceRecord:o}=evaluateConditions(n,t);if(r)return group.evaluateRules(i,{...t,referenceRecord:{...t.referenceRecord,...o}})},group={evaluateRules:evaluateRules,evaluateTreeRule:evaluateTreeRule},resolveEndpoint=(e,t)=>{const{endpointParams:n,logger:i}=t,{parameters:r,rules:o}=e;t.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(n)}`);const a=Object.entries(r).filter(([,e])=>null!=e.default).map(([e,t])=>[e,t.default]);if(a.length>0)for(const[e,t]of a)n[e]=n[e]??t;const s=Object.entries(r).filter(([,e])=>e.required).map(([e])=>e);for(const e of s)if(null==n[e])throw new EndpointError(`Missing required parameter: '${e}'`);const c=evaluateRules(o,{endpointParams:n,logger:i,referenceRecord:{}});return t.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(c)}`),c},isVirtualHostableS3Bucket=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!isVirtualHostableS3Bucket(t))return!1;return!0}return!!isValidHostLabel(e)&&(!(e.length<3||e.length>63)&&(e===e.toLowerCase()&&!isIpAddress(e)))},ARN_DELIMITER=":",RESOURCE_DELIMITER="/",parseArn=e=>{const t=e.split(ARN_DELIMITER);if(t.length<6)return null;const[n,i,r,o,a,...s]=t;if("arn"!==n||""===i||""===r||""===s.join(ARN_DELIMITER))return null;return{partition:i,service:r,region:o,accountId:a,resourceId:s.map(e=>e.split(RESOURCE_DELIMITER)).flat()}},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-east-2":{description:"Asia Pacific (Taipei)"},"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-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws 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-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso 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:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{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-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}];var partitionsInfo={partitions:partitions};let selectedPartitionsInfo=partitionsInfo;const partition=e=>{const{partitions:t}=selectedPartitionsInfo;for(const n of t){const{regions:t,outputs:i}=n;for(const[n,r]of Object.entries(t))if(n===e)return{...i,...r}}for(const n of t){const{regionRegex:t,outputs:i}=n;if(new RegExp(t).test(e))return{...i}}const n=t.find(e=>"aws"===e.id);if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}},awsEndpointFunctions={isVirtualHostableS3Bucket:isVirtualHostableS3Bucket,parseArn:parseArn,partition:partition};function parseQueryString(e){const t={};if(e=e.replace(/^\?/,""))for(const n of e.split("&")){let[e,i=null]=n.split("=");e=decodeURIComponent(e),i&&(i=decodeURIComponent(i)),e in t?Array.isArray(t[e])?t[e].push(i):t[e]=[t[e],i]:t[e]=i}return t}customEndpointFunctions.aws=awsEndpointFunctions;const parseUrl=e=>{if("string"==typeof e)return parseUrl(new URL(e));const{hostname:t,pathname:n,port:i,protocol:r,search:o}=e;let a;return o&&(a=parseQueryString(o)),{hostname:t,port:i?parseInt(i):void 0,protocol:r,path:n,query:a}};function setCredentialFeature(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}function setFeature(e,t,n){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=n}const getDateHeader=e=>HttpResponse.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,getSkewCorrectedDate=e=>new Date(Date.now()+e),isClockSkewed=(e,t)=>Math.abs(getSkewCorrectedDate(t).getTime()-e)>=3e5,getUpdatedSystemClockOffset=(e,t)=>{const n=Date.parse(e);return isClockSkewed(n,t)?n-Date.now():t},throwSigningPropertyError=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},validateSigningProperties=async e=>{const t=throwSigningPropertyError("context",e.context),n=throwSigningPropertyError("config",e.config),i=t.endpointV2?.properties?.authSchemes?.[0],r=throwSigningPropertyError("signer",n.signer),o=await r(i),a=e?.signingRegion,s=e?.signingRegionSet,c=e?.signingName;return{config:n,signer:o,signingRegion:a,signingRegionSet:s,signingName:c}};class AwsSdkSigV4Signer{async sign(e,t,n){if(!HttpRequest$1.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await validateSigningProperties(n),{config:r,signer:o}=i;let{signingRegion:a,signingName:s}=i;const c=n.context;if(c?.authSchemes?.length){const[e,t]=c.authSchemes;"sigv4a"===e?.name&&"sigv4"===t?.name&&(a=t?.signingRegion??a,s=t?.signingName??s)}return await o.sign(e,{signingDate:getSkewCorrectedDate(r.systemClockOffset),signingRegion:a,signingService:s})}errorHandler(e){return t=>{const n=t.ServerTime??getDateHeader(t.$response);if(n){const i=throwSigningPropertyError("config",e.config),r=i.systemClockOffset;i.systemClockOffset=getUpdatedSystemClockOffset(n,i.systemClockOffset);i.systemClockOffset!==r&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=getDateHeader(e);if(n){const e=throwSigningPropertyError("config",t.config);e.systemClockOffset=getUpdatedSystemClockOffset(n,e.systemClockOffset)}}}class AwsSdkSigV4ASigner extends AwsSdkSigV4Signer{async sign(e,t,n){if(!HttpRequest$1.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:i,signer:r,signingRegion:o,signingRegionSet:a,signingName:s}=await validateSigningProperties(n),c=(await(i.sigv4aSigningRegionSet?.())??a??[o]).join(",");return await r.sign(e,{signingDate:getSkewCorrectedDate(i.systemClockOffset),signingRegion:c,signingService:s})}}const memoize=(e,t,n)=>{let i,r,o,a=!1;return async t=>(o&&!t?.forceRefresh||(i=await(async()=>{r||(r=e());try{i=await r,o=!0,a=!1}finally{r=void 0}return i})()),i)},resolveAwsSdkSigV4AConfig=e=>(e.sigv4aSigningRegionSet=normalizeProvider$1(e.sigv4aSigningRegionSet),e),ALGORITHM_QUERY_PARAM="X-Amz-Algorithm",CREDENTIAL_QUERY_PARAM="X-Amz-Credential",AMZ_DATE_QUERY_PARAM="X-Amz-Date",SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders",EXPIRES_QUERY_PARAM="X-Amz-Expires",SIGNATURE_QUERY_PARAM="X-Amz-Signature",TOKEN_QUERY_PARAM="X-Amz-Security-Token",AUTH_HEADER="authorization",AMZ_DATE_HEADER=AMZ_DATE_QUERY_PARAM.toLowerCase(),DATE_HEADER="date",GENERATED_HEADERS=[AUTH_HEADER,AMZ_DATE_HEADER,DATE_HEADER],SIGNATURE_HEADER=SIGNATURE_QUERY_PARAM.toLowerCase(),SHA256_HEADER="x-amz-content-sha256",TOKEN_HEADER=TOKEN_QUERY_PARAM.toLowerCase(),ALWAYS_UNSIGNABLE_HEADERS={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},PROXY_HEADER_PATTERN=/^proxy-/,SEC_HEADER_PATTERN=/^sec-/,ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256",EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD",UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD",MAX_CACHE_SIZE=50,KEY_TYPE_IDENTIFIER="aws4_request",MAX_PRESIGNED_TTL=604800,signingKeyCache={},cacheQueue=[],createScope=(e,t,n)=>`${e}/${t}/${n}/${KEY_TYPE_IDENTIFIER}`,getSigningKey=async(e,t,n,i,r)=>{const o=`${n}:${i}:${r}:${toHex(await hmac(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(o in signingKeyCache)return signingKeyCache[o];for(cacheQueue.push(o);cacheQueue.length>MAX_CACHE_SIZE;)delete signingKeyCache[cacheQueue.shift()];let a=`AWS4${t.secretAccessKey}`;for(const t of[n,i,r,KEY_TYPE_IDENTIFIER])a=await hmac(e,a,t);return signingKeyCache[o]=a},hmac=(e,t,n)=>{const i=new e(t);return i.update(toUint8Array(n)),i.digest()},getCanonicalHeaders=({headers:e},t,n)=>{const i={};for(const r of Object.keys(e).sort()){if(null==e[r])continue;const o=r.toLowerCase();(o in ALWAYS_UNSIGNABLE_HEADERS||t?.has(o)||PROXY_HEADER_PATTERN.test(o)||SEC_HEADER_PATTERN.test(o))&&(!n||n&&!n.has(o))||(i[o]=e[r].trim().replace(/\s+/g," "))}return i},getPayloadHash=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===SHA256_HEADER)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||isArrayBuffer(t)){const e=new n;return e.update(toUint8Array(t)),toHex(await e.digest())}return UNSIGNED_PAYLOAD};class HeaderFormatter{format(e){const t=[];for(const n of Object.keys(e)){const i=fromUtf8$2(n);t.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[n]))}const n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0));let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n}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 t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const r=new DataView(new ArrayBuffer(3+e.value.byteLength));r.setUint8(0,6),r.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(r.buffer);return o.set(e.value,3),o;case"string":const a=fromUtf8$2(e.value),s=new DataView(new ArrayBuffer(3+a.byteLength));s.setUint8(0,7),s.setUint16(1,a.byteLength,!1);const c=new Uint8Array(s.buffer);return c.set(a,3),c;case"timestamp":const l=new Uint8Array(9);return l[0]=8,l.set(Int64.fromNumber(e.value.valueOf()).bytes,1),l;case"uuid":if(!UUID_PATTERN.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(fromHex(e.value.replace(/\-/g,"")),1),d}}}var HEADER_VALUE_TYPE;!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"}(HEADER_VALUE_TYPE||(HEADER_VALUE_TYPE={}));const UUID_PATTERN=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Int64{bytes;constructor(e){if(this.bytes=e,8!==e.byteLength)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>0x8000000000000000||e<-0x8000000000000000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)t[n]=i;return e<0&&negate(t),new Int64(t)}valueOf(){const e=this.bytes.slice(0),t=128&e[0];return t&&negate(e),parseInt(toHex(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function negate(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,0===e[t]);t--);}const hasHeader=(e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1};class HttpRequest{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;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 t=new HttpRequest({...e,headers:{...e.headers}});return t.query&&(t.query=cloneQuery(t.query)),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){return HttpRequest.clone(this)}}function cloneQuery(e){return Object.keys(e).reduce((t,n)=>{const i=e[n];return{...t,[n]:Array.isArray(i)?[...i]:i}},{})}const moveHeadersToQuery=(e,t={})=>{const{headers:n,query:i={}}=HttpRequest.clone(e);for(const e of Object.keys(n)){const r=e.toLowerCase();("x-amz-"===r.slice(0,6)&&!t.unhoistableHeaders?.has(r)||t.hoistableHeaders?.has(r))&&(i[e]=n[e],delete n[e])}return{...e,headers:n,query:i}},prepareRequest=e=>{e=HttpRequest.clone(e);for(const t of Object.keys(e.headers))GENERATED_HEADERS.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},normalizeProvider=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},getCanonicalQuery=({query:e={}})=>{const t=[],n={};for(const i of Object.keys(e)){if(i.toLowerCase()===SIGNATURE_HEADER)continue;const r=escapeUri(i);t.push(r);const o=e[i];"string"==typeof o?n[r]=`${r}=${escapeUri(o)}`:Array.isArray(o)&&(n[r]=o.slice(0).reduce((e,t)=>e.concat([`${r}=${escapeUri(t)}`]),[]).sort().join("&"))}return t.sort().map(e=>n[e]).filter(e=>e).join("&")},iso8601=e=>toDate(e).toISOString().replace(/\.\d{3}Z$/,"Z"),toDate=e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e;class SignatureV4Base{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o=!0}){this.service=i,this.sha256=r,this.uriEscapePath=o,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=normalizeProvider(n),this.credentialProvider=normalizeProvider(t)}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${getCanonicalQuery(e)}\n${i.map(e=>`${e}:${t[e]}`).join("\n")}\n\n${i.join(";")}\n${n}`}async createStringToSign(e,t,n,i){const r=new this.sha256;r.update(toUint8Array(n));return`${i}\n${e}\n${t}\n${toHex(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return escapeUri(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}formatDate(e){const t=iso8601(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}class SignatureV4 extends SignatureV4Base{headerFormatter=new HeaderFormatter;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o=!0}){super({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o})}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:r,unhoistableHeaders:o,signableHeaders:a,hoistableHeaders:s,signingRegion:c,signingService:l}=t,d=await this.credentialProvider();this.validateResolvedCredentials(d);const u=c??await this.regionProvider(),{longDate:p,shortDate:m}=this.formatDate(n);if(i>MAX_PRESIGNED_TTL)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const h=createScope(m,u,l??this.service),f=moveHeadersToQuery(prepareRequest(e),{unhoistableHeaders:o,hoistableHeaders:s});d.sessionToken&&(f.query[TOKEN_QUERY_PARAM]=d.sessionToken),f.query[ALGORITHM_QUERY_PARAM]=ALGORITHM_IDENTIFIER,f.query[CREDENTIAL_QUERY_PARAM]=`${d.accessKeyId}/${h}`,f.query[AMZ_DATE_QUERY_PARAM]=p,f.query[EXPIRES_QUERY_PARAM]=i.toString(10);const g=getCanonicalHeaders(f,r,a);return f.query[SIGNED_HEADERS_QUERY_PARAM]=this.getCanonicalHeaderList(g),f.query[SIGNATURE_QUERY_PARAM]=await this.getSignature(p,h,this.getSigningKey(d,u,m,l),this.createCanonicalRequest(f,g,await getPayloadHash(e,this.sha256))),f}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:i,signingRegion:r,signingService:o}){const a=r??await this.regionProvider(),{shortDate:s,longDate:c}=this.formatDate(n),l=createScope(s,a,o??this.service),d=await getPayloadHash({headers:{},body:t},this.sha256),u=new this.sha256;u.update(e);const p=toHex(await u.digest()),m=[EVENT_ALGORITHM_IDENTIFIER,c,l,i,p,d].join("\n");return this.signString(m,{signingDate:n,signingRegion:a,signingService:o})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:i,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i}={}){const r=await this.credentialProvider();this.validateResolvedCredentials(r);const o=n??await this.regionProvider(),{shortDate:a}=this.formatDate(t),s=new this.sha256(await this.getSigningKey(r,o,a,i));return s.update(toUint8Array(e)),toHex(await s.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:r,signingService:o}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const s=r??await this.regionProvider(),c=prepareRequest(e),{longDate:l,shortDate:d}=this.formatDate(t),u=createScope(d,s,o??this.service);c.headers[AMZ_DATE_HEADER]=l,a.sessionToken&&(c.headers[TOKEN_HEADER]=a.sessionToken);const p=await getPayloadHash(c,this.sha256);!hasHeader(SHA256_HEADER,c.headers)&&this.applyChecksum&&(c.headers[SHA256_HEADER]=p);const m=getCanonicalHeaders(c,i,n),h=await this.getSignature(l,u,this.getSigningKey(a,s,d,o),this.createCanonicalRequest(c,m,p));return c.headers[AUTH_HEADER]=`${ALGORITHM_IDENTIFIER} Credential=${a.accessKeyId}/${u}, SignedHeaders=${this.getCanonicalHeaderList(m)}, Signature=${h}`,c}async getSignature(e,t,n,i){const r=await this.createStringToSign(e,t,i,ALGORITHM_IDENTIFIER),o=new this.sha256(await n);return o.update(toUint8Array(r)),toHex(await o.digest())}getSigningKey(e,t,n,i){return getSigningKey(this.sha256,e,n,t,i||this.service)}}const resolveAwsSdkSigV4Config=e=>{let t,n=e.credentials,i=!!e.credentials;Object.defineProperty(e,"credentials",{set(r){r&&r!==n&&r!==t&&(i=!0),n=r;const o=normalizeCredentialProvider(e,{credentials:n,credentialDefaultProvider:e.credentialDefaultProvider}),a=bindCallerConfig(e,o);i&&!a.attributed?(t=async e=>a(e).then(e=>setCredentialFeature(e,"CREDENTIALS_CODE","e")),t.memoized=a.memoized,t.configBound=a.configBound,t.attributed=!0):t=a},get:()=>t,enumerable:!0,configurable:!0}),e.credentials=n;const{signingEscapePath:r=!0,systemClockOffset:o=e.systemClockOffset||0,sha256:a}=e;let s;s=e.signer?normalizeProvider$1(e.signer):e.regionInfoProvider?()=>normalizeProvider$1(e.region)().then(async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t]).then(([t,n])=>{const{signingRegion:i,signingService:o}=t;e.signingRegion=e.signingRegion||i||n,e.signingName=e.signingName||o||e.serviceId;const s={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:a,uriEscapePath:r};return new(e.signerConstructor||SignatureV4)(s)}):async t=>{const n=(t=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await normalizeProvider$1(e.region)(),properties:{}},t)).signingRegion,i=t.signingName;e.signingRegion=e.signingRegion||n,e.signingName=e.signingName||i||e.serviceId;const o={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:a,uriEscapePath:r};return new(e.signerConstructor||SignatureV4)(o)};return Object.assign(e,{systemClockOffset:o,signingEscapePath:r,signer:s})};function normalizeCredentialProvider(e,{credentials:t,credentialDefaultProvider:n}){let i;return i=t?t?.memoized?t:memoizeIdentityProvider(t,isIdentityExpired,doesIdentityRequireRefresh):n?normalizeProvider$1(n(Object.assign({},e,{parentClientConfig:e}))):async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},i.memoized=!0,i}function bindCallerConfig(e,t){if(t.configBound)return t;const n=async n=>t({...n,callerClientConfig:e});return n.memoized=t.memoized,n.configBound=!0,n}const getAllAliases=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const e of t)n.push(e);return n},getMiddlewareNameWithAliases=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,constructStack=()=>{let e=[],t=[],n=!1;const i=new Set,r=n=>(e.forEach(e=>{n.add(e.middleware,{...e})}),t.forEach(e=>{n.addRelativeTo(e.middleware,{...e})}),n.identifyOnResolve?.(s.identifyOnResolve()),n),o=e=>{const t=[];return e.before.forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...o(e))}),t.push(e),e.after.reverse().forEach(e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...o(e))}),t},a=(n=!1)=>{const i=[],r=[],a={};e.forEach(e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases(t.name,t.aliases))a[e]=t;i.push(t)}),t.forEach(e=>{const t={...e,before:[],after:[]};for(const e of getAllAliases(t.name,t.aliases))a[e]=t;r.push(t)}),r.forEach(e=>{if(e.toMiddleware){const t=a[e.toMiddleware];if(void 0===t){if(n)return;throw new Error(`${e.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(e.name,e.aliases)} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}});const s=(c=i,c.sort((e,t)=>stepWeights[t.step]-stepWeights[e.step]||priorityWeights[t.priority||"normal"]-priorityWeights[e.priority||"normal"])).map(o).reduce((e,t)=>(e.push(...t),e),[]);var c;return s},s={add:(t,n={})=>{const{name:r,override:o,aliases:a}=n,s={step:"initialize",priority:"normal",middleware:t,...n},c=getAllAliases(r,a);if(c.length>0){if(c.some(e=>i.has(e))){if(!o)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(r,a)}'`);for(const t of c){const n=e.findIndex(e=>e.name===t||e.aliases?.some(e=>e===t));if(-1===n)continue;const i=e[n];if(i.step!==s.step||s.priority!==i.priority)throw new Error(`"${getMiddlewareNameWithAliases(i.name,i.aliases)}" middleware with ${i.priority} priority in ${i.step} step cannot be overridden by "${getMiddlewareNameWithAliases(r,a)}" middleware with ${s.priority} priority in ${s.step} step.`);e.splice(n,1)}}for(const e of c)i.add(e)}e.push(s)},addRelativeTo:(e,n)=>{const{name:r,override:o,aliases:a}=n,s={middleware:e,...n},c=getAllAliases(r,a);if(c.length>0){if(c.some(e=>i.has(e))){if(!o)throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(r,a)}'`);for(const e of c){const n=t.findIndex(t=>t.name===e||t.aliases?.some(t=>t===e));if(-1===n)continue;const i=t[n];if(i.toMiddleware!==s.toMiddleware||i.relation!==s.relation)throw new Error(`"${getMiddlewareNameWithAliases(i.name,i.aliases)}" middleware ${i.relation} "${i.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(r,a)}" middleware ${s.relation} "${s.toMiddleware}" middleware.`);t.splice(n,1)}}for(const e of c)i.add(e)}t.push(s)},clone:()=>r(constructStack()),use:e=>{e.applyToStack(s)},remove:n=>"string"==typeof n?(n=>{let r=!1;const o=e=>{const t=getAllAliases(e.name,e.aliases);if(t.includes(n)){r=!0;for(const e of t)i.delete(e);return!1}return!0};return e=e.filter(o),t=t.filter(o),r})(n):(n=>{let r=!1;const o=e=>{if(e.middleware===n){r=!0;for(const t of getAllAliases(e.name,e.aliases))i.delete(t);return!1}return!0};return e=e.filter(o),t=t.filter(o),r})(n),removeByTag:n=>{let r=!1;const o=e=>{const{tags:t,name:o,aliases:a}=e;if(t&&t.includes(n)){const e=getAllAliases(o,a);for(const t of e)i.delete(t);return r=!0,!1}return!0};return e=e.filter(o),t=t.filter(o),r},concat:e=>{const t=r(constructStack());return t.use(e),t.identifyOnResolve(n||t.identifyOnResolve()||(e.identifyOnResolve?.()??!1)),t},applyToStack:r,identify:()=>a(!0).map(e=>{const t=e.step??e.relation+" "+e.toMiddleware;return getMiddlewareNameWithAliases(e.name,e.aliases)+" - "+t}),identifyOnResolve:e=>("boolean"==typeof e&&(n=e),n),resolve:(e,t)=>{for(const n of a().map(e=>e.middleware).reverse())e=n(e,t);return n&&console.log(s.identify()),e}};return s},stepWeights={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},priorityWeights={high:3,normal:2,low:1};class Client{config;middlewareStack=constructStack();initConfig;handlers;constructor(e){this.config=e}send(e,t,n){const i="function"!=typeof t?t:void 0,r="function"==typeof t?t:n;let o;if(void 0===i&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=new WeakMap);const t=this.handlers;t.has(e.constructor)?o=t.get(e.constructor):(o=e.resolveMiddleware(this.middlewareStack,this.config,i),t.set(e.constructor,o))}else delete this.handlers,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(!r)return o(e).then(e=>e.output);o(e).then(e=>r(null,e.output),e=>r(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const SENSITIVE_STRING="***SensitiveInformation***";function schemaLogFilter(e,t){if(null==t)return t;const n=NormalizedSchema.of(e);if(n.getMergedTraits().sensitive)return SENSITIVE_STRING;if(n.isListSchema()){if(!!n.getValueSchema().getMergedTraits().sensitive)return SENSITIVE_STRING}else if(n.isMapSchema()){if(!!n.getKeySchema().getMergedTraits().sensitive||!!n.getValueSchema().getMergedTraits().sensitive)return SENSITIVE_STRING}else if(n.isStructSchema()&&"object"==typeof t){const e=t,i={};for(const[t,r]of n.structIterator())null!=e[t]&&(i[t]=schemaLogFilter(r,e[t]));return i}return t}class Command{middlewareStack=constructStack();schema;static classBuilder(){return new ClassBuilder}resolveMiddlewareWithContext(e,t,n,{middlewareFn:i,clientName:r,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:s,smithyContext:c,additionalContext:l,CommandCtor:d}){for(const r of i.bind(this)(d,e,t,n))this.middlewareStack.use(r);const u=e.concat(this.middlewareStack),{logger:p}=t,m={logger:p,clientName:r,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:s,[SMITHY_CONTEXT_KEY]:{commandInstance:this,...c},...l},{requestHandler:h}=t;return u.resolve(e=>h.handle(e.request,n||{}),m)}}class ClassBuilder{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=e=>e,t=e=>e){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends Command{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super(),this.input=t??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,i,r){const o=e._operationSchema,a=o?.[4]??o?.input,s=o?.[5]??o?.output;return this.resolveMiddlewareWithContext(n,i,r,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(o?schemaLogFilter.bind(null,a):e=>e),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(o?schemaLogFilter.bind(null,s):e=>e),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class ServiceException extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;const t=e;return ServiceException.prototype.isPrototypeOf(t)||Boolean(t.$fault)&&Boolean(t.$metadata)&&("client"===t.$fault||"server"===t.$fault)}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===ServiceException?ServiceException.isInstance(e):!!ServiceException.isInstance(e)&&(t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e))}}const decorateServiceException=(e,t={})=>{Object.entries(t).filter(([,e])=>void 0!==e).forEach(([t,n])=>{null!=e[t]&&""!==e[t]||(e[t]=n)});const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},loadConfigsForDefaultMode=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},getChecksumConfiguration=e=>{const t=[];for(const n in AlgorithmId){const i=AlgorithmId[n];void 0!==e[i]&&t.push({algorithmId:()=>i,checksumConstructor:()=>e[i]})}return{addChecksumAlgorithm(e){t.push(e)},checksumAlgorithms:()=>t}},resolveChecksumRuntimeConfig=e=>{const t={};return e.checksumAlgorithms().forEach(e=>{t[e.algorithmId()]=e.checksumConstructor()}),t},getRetryConfiguration=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy:()=>e.retryStrategy}),resolveRetryRuntimeConfig=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},getDefaultExtensionConfiguration=e=>Object.assign(getChecksumConfiguration(e),getRetryConfiguration(e)),resolveDefaultRuntimeConfig=e=>Object.assign(resolveChecksumRuntimeConfig(e),resolveRetryRuntimeConfig(e));class NoOpLogger{trace(){}debug(){}info(){}warn(){}error(){}}class ProtocolLib{queryCompat;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const n=t.getMemberSchemas(),i=Object.values(n).find(e=>!!e.getMergedTraits().httpPayload);if(i){const t=i.getMergedTraits().mediaType;return t||(i.isStringSchema()?"text/plain":i.isBlobSchema()?"application/octet-stream":e)}if(!t.isUnitSchema()){const t=Object.values(n).find(e=>{const{httpQuery:t,httpQueryParams:n,httpHeader:i,httpLabel:r,httpPrefixHeaders:o}=e.getMergedTraits();return!t&&!n&&!i&&!r&&void 0===o});if(t)return e}}async getErrorSchemaOrThrowBaseException(e,t,n,i,r,o){let a=t,s=e;e.includes("#")&&([a,s]=e.split("#"));const c={$metadata:r,$fault:n.statusCode<500?"client":"server"},l=TypeRegistry.for(a);try{return{errorSchema:o?.(l,s)??l.getSchema(e),errorMetadata:c}}catch(e){i.message=i.message??i.Message??"UnknownError";const t=TypeRegistry.for("smithy.ts.sdk.synthetic."+a),n=t.getBaseException();if(n){const e=t.getErrorCtor(n)??Error;throw this.decorateServiceException(Object.assign(new e({name:s}),c),i)}throw this.decorateServiceException(Object.assign(new Error(s),c),i)}}decorateServiceException(e,t={}){if(this.queryCompat){const n=e.Message??t.Message,i=decorateServiceException(e,t);return n&&(i.Message=n,i.message=n),i}return decorateServiceException(e,t)}setQueryCompatError(e,t){const n=t.headers?.["x-amzn-query-error"];if(void 0!==e&&null!=n){const[t,i]=n.split(";"),r=Object.entries(e),o={Code:t,Type:i};Object.assign(e,o);for(const[e,t]of r)o[e]=t;delete o.__type,e.Error=o}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}}class SerdeContextConfig{serdeContext;setSerdeContext(e){this.serdeContext=e}}function*serializingStructIterator(e,t){if(e.isUnitSchema())return;const n=e.getSchema();for(let e=0;e<n[4].length;++e){const i=n[4][e],r=n[5][e],o=new NormalizedSchema([r,0],i);(i in t||o.isIdempotencyToken())&&(yield[i,o])}}function*deserializingStructIterator(e,t,n){if(e.isUnitSchema())return;const i=e.getSchema();let r=Object.keys(t).filter(e=>"__type"!==e).length;for(let e=0;e<i[4].length&&0!==r;++e){const o=i[4][e],a=i[5][e],s=new NormalizedSchema([a,0],o);let c=o;n&&(c=s.getMergedTraits()[n]??o),c in t&&(yield[o,s],r-=1)}}function jsonReviver(e,t,n){if(n?.source){const e=n.source;if("number"==typeof t&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||e!==String(t))){return e.includes(".")?new NumericValue(e,"bigDecimal"):BigInt(e)}}return t}const collectBodyString=(e,t)=>collectBody(e,t).then(e=>(t?.utf8Encoder??toUtf8)(e)),parseJsonBody=(e,t)=>collectBodyString(e,t).then(e=>{if(e.length)try{return JSON.parse(e)}catch(t){throw"SyntaxError"===t?.name&&Object.defineProperty(t,"$responseBodyText",{value:e}),t}return{}}),loadRestJsonErrorCode=(e,t)=>{const n=(e,t)=>Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase()),i=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},r=n(e.headers,"x-amzn-errortype");if(void 0!==r)return i(e.headers[r]);if(t&&"object"==typeof t){const e=n(t,"code");if(e&&void 0!==t[e])return i(t[e]);if(void 0!==t.__type)return i(t.__type)}};class JsonShapeDeserializer extends SerdeContextConfig{settings;constructor(e){super(),this.settings=e}async read(e,t){return this._read(e,"string"==typeof t?JSON.parse(t,jsonReviver):await parseJsonBody(t,this.serdeContext))}readObject(e,t){return this._read(e,t)}_read(e,t){const n=null!==t&&"object"==typeof t,i=NormalizedSchema.of(e);if(n){if(i.isStructSchema()){const e={};for(const[n,r]of deserializingStructIterator(i,t,!!this.settings.jsonName&&"jsonName")){const i=this.settings.jsonName?r.getMergedTraits().jsonName??n:n,o=this._read(r,t[i]);null!=o&&(e[n]=o)}return e}if(Array.isArray(t)&&i.isListSchema()){const e=i.getValueSchema(),n=[],r=!!i.getMergedTraits().sparse;for(const i of t)(r||null!=i)&&n.push(this._read(e,i));return n}if(i.isMapSchema()){const e=i.getValueSchema(),n={},r=!!i.getMergedTraits().sparse;for(const[i,o]of Object.entries(t))(r||null!=o)&&(n[i]=this._read(e,o));return n}}if(i.isBlobSchema()&&"string"==typeof t)return fromBase64(t);const r=i.getMergedTraits().mediaType;if(i.isStringSchema()&&"string"==typeof t&&r){return"application/json"===r||r.endsWith("+json")?LazyJsonString.from(t):t}if(i.isTimestampSchema()&&null!=t){switch(determineTimestampFormat(i,this.settings)){case 5:return parseRfc3339DateTimeWithOffset(t);case 6:return parseRfc7231DateTime(t);case 7:return parseEpochTimestamp(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}}if(i.isBigIntegerSchema()&&("number"==typeof t||"string"==typeof t))return BigInt(t);if(i.isBigDecimalSchema()&&null!=t){if(t instanceof NumericValue)return t;const e=t;return"bigDecimal"===e.type&&"string"in e?new NumericValue(e.string,e.type):new NumericValue(String(t),"bigDecimal")}if(i.isNumericSchema()&&"string"==typeof t){switch(t){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return t}if(i.isDocumentSchema()){if(n){const e=Array.isArray(t)?[]:{};for(const[n,r]of Object.entries(t))e[n]=r instanceof NumericValue?r:this._read(i,r);return e}return structuredClone(t)}return t}}const NUMERIC_CONTROL_CHAR=String.fromCharCode(925);class JsonReplacer{values=new Map;counter=0;stage=0;createReplacer(){if(1===this.stage)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(2===this.stage)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,t)=>{if(t instanceof NumericValue){const e=NUMERIC_CONTROL_CHAR+"nv"+this.counter+++"_"+t.string;return this.values.set(`"${e}"`,t.string),e}if("bigint"==typeof t){const e=t.toString(),n=NUMERIC_CONTROL_CHAR+"b"+this.counter+++"_"+e;return this.values.set(`"${n}"`,e),n}return t}}replaceInJson(e){if(0===this.stage)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(2===this.stage)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,0===this.counter)return e;for(const[t,n]of this.values)e=e.replace(t,n);return e}}class JsonShapeSerializer extends SerdeContextConfig{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,t){this.rootSchema=NormalizedSchema.of(e),this.buffer=this._write(this.rootSchema,t)}writeDiscriminatedDocument(e,t){this.write(e,t),"object"==typeof this.buffer&&(this.buffer.__type=NormalizedSchema.of(e).getName(!0))}flush(){const{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);const e=new JsonReplacer;return e.replaceInJson(JSON.stringify(this.buffer,e.createReplacer(),0))}return this.buffer}_write(e,t,n){const i=null!==t&&"object"==typeof t,r=NormalizedSchema.of(e);if(i){if(r.isStructSchema()){const e={};for(const[n,i]of serializingStructIterator(r,t)){const o=this._write(i,t[n],r);if(void 0!==o){const t=i.getMergedTraits().jsonName;e[this.settings.jsonName?t??n:n]=o}}return e}if(Array.isArray(t)&&r.isListSchema()){const e=r.getValueSchema(),n=[],i=!!r.getMergedTraits().sparse;for(const r of t)(i||null!=r)&&n.push(this._write(e,r));return n}if(r.isMapSchema()){const e=r.getValueSchema(),n={},i=!!r.getMergedTraits().sparse;for(const[r,o]of Object.entries(t))(i||null!=o)&&(n[r]=this._write(e,o));return n}if(t instanceof Uint8Array&&(r.isBlobSchema()||r.isDocumentSchema()))return r===this.rootSchema?t:(this.serdeContext?.base64Encoder??toBase64)(t);if(t instanceof Date&&(r.isTimestampSchema()||r.isDocumentSchema())){switch(determineTimestampFormat(r,this.settings)){case 5:return t.toISOString().replace(".000Z","Z");case 6:return dateToUtcString(t);case 7:return t.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",t),t.getTime()/1e3}}t instanceof NumericValue&&(this.useReplacer=!0)}if(null!==t||!n?.isStructSchema()){if(r.isStringSchema()){if(void 0===t&&r.isIdempotencyToken())return v4();const e=r.getMergedTraits().mediaType;if(null!=t&&e){if("application/json"===e||e.endsWith("+json"))return LazyJsonString.from(t)}return t}if("number"==typeof t&&r.isNumericSchema())return Math.abs(t)===1/0||isNaN(t)?String(t):t;if("string"==typeof t&&r.isBlobSchema())return r===this.rootSchema?t:(this.serdeContext?.base64Encoder??toBase64)(t);if("bigint"==typeof t&&(this.useReplacer=!0),r.isDocumentSchema()){if(i){const e=Array.isArray(t)?[]:{};for(const[n,i]of Object.entries(t))i instanceof NumericValue?(this.useReplacer=!0,e[n]=i):e[n]=this._write(r,i);return e}return structuredClone(t)}return t}}}class JsonCodec extends SerdeContextConfig{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new JsonShapeSerializer(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new JsonShapeDeserializer(this.settings);return e.setSerdeContext(this.serdeContext),e}}class AwsRestJsonProtocol extends HttpBindingProtocol{serializer;deserializer;codec;mixin=new ProtocolLib;constructor({defaultNamespace:e}){super({defaultNamespace:e});const t={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new JsonCodec(t),this.serializer=new HttpInterceptingShapeSerializer(this.codec.createSerializer(),t),this.deserializer=new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(),t)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(e){this.codec.setSerdeContext(e),super.setSerdeContext(e)}async serializeRequest(e,t,n){const i=await super.serializeRequest(e,t,n),r=NormalizedSchema.of(e.input);if(!i.headers["content-type"]){const e=this.mixin.resolveRestContentType(this.getDefaultContentType(),r);e&&(i.headers["content-type"]=e)}return null==i.body&&i.headers["content-type"]===this.getDefaultContentType()&&(i.body="{}"),i}async deserializeResponse(e,t,n){const i=await super.deserializeResponse(e,t,n),r=NormalizedSchema.of(e.output);for(const[e,t]of r.structIterator())t.getMemberTraits().httpPayload&&!(e in i)&&(i[e]=null);return i}async handleError(e,t,n,i,r){const o=loadRestJsonErrorCode(n,i)??"Unknown",{errorSchema:a,errorMetadata:s}=await this.mixin.getErrorSchemaOrThrowBaseException(o,this.options.defaultNamespace,n,i,r),c=NormalizedSchema.of(a),l=i.message??i.Message??"Unknown",d=new(TypeRegistry.for(a[1]).getErrorCtor(a)??Error)(l);await this.deserializeHttpMessage(a,t,n,i);const u={};for(const[e,t]of c.structIterator()){const n=t.getMergedTraits().jsonName??e;u[e]=this.codec.createDeserializer().readObject(t,i[n])}throw this.mixin.decorateServiceException(Object.assign(d,s,{$fault:c.getMergedTraits().error,message:l},u),i)}getDefaultContentType(){return"application/json"}}const ACCOUNT_ID_ENDPOINT_REGEX=/\d{12}\.ddb/;async function checkFeatures(e,t,n){const i=n.request;if("rpc-v2-cbor"===i?.headers?.["smithy-protocol"]&&setFeature(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const n=await t.retryStrategy();"function"==typeof n.acquireInitialRetryToken?n.constructor?.name?.includes("Adaptive")?setFeature(e,"RETRY_MODE_ADAPTIVE","F"):setFeature(e,"RETRY_MODE_STANDARD","E"):setFeature(e,"RETRY_MODE_LEGACY","D")}if("function"==typeof t.accountIdEndpointMode){const n=e.endpointV2;switch(String(n?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)&&setFeature(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":setFeature(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":setFeature(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":setFeature(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const r=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(r?.$source){const t=r;t.accountId&&setFeature(e,"RESOLVED_ACCOUNT_ID","T");for(const[n,i]of Object.entries(t.$source??{}))setFeature(e,n,i)}}const USER_AGENT="user-agent",X_AMZ_USER_AGENT="x-amz-user-agent",SPACE=" ",UA_NAME_SEPARATOR="/",UA_NAME_ESCAPE_REGEX=/[^!$%&'*+\-.^_`|~\w]/g,UA_VALUE_ESCAPE_REGEX=/[^!$%&'*+\-.^_`|~\w#]/g,UA_ESCAPE_CHAR="-",BYTE_LIMIT=1024;function encodeFeatures(e){let t="";for(const n in e){const i=e[n];if(!(t.length+i.length+1<=BYTE_LIMIT))break;t.length?t+=","+i:t+=i}return t}const userAgentMiddleware=e=>(t,n)=>async i=>{const{request:r}=i;if(!HttpRequest$1.isInstance(r))return t(i);const{headers:o}=r,a=n?.userAgent?.map(escapeUserAgent)||[],s=(await e.defaultUserAgentProvider()).map(escapeUserAgent);await checkFeatures(n,e,i);const c=n;s.push(`m/${encodeFeatures(Object.assign({},n.__smithy_context?.features,c.__aws_sdk_context?.features))}`);const l=e?.customUserAgent?.map(escapeUserAgent)||[],d=await e.userAgentAppId();d&&s.push(escapeUserAgent(["app",`${d}`]));const u=[].concat([...s,...a,...l]).join(SPACE),p=[...s.filter(e=>e.startsWith("aws-sdk-")),...l].join(SPACE);return"browser"!==e.runtime?(p&&(o[X_AMZ_USER_AGENT]=o[X_AMZ_USER_AGENT]?`${o[USER_AGENT]} ${p}`:p),o[USER_AGENT]=u):o[X_AMZ_USER_AGENT]=u,t({...i,request:r})},escapeUserAgent=e=>{const t=e[0].split(UA_NAME_SEPARATOR).map(e=>e.replace(UA_NAME_ESCAPE_REGEX,UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR),n=e[1]?.replace(UA_VALUE_ESCAPE_REGEX,UA_ESCAPE_CHAR),i=t.indexOf(UA_NAME_SEPARATOR),r=t.substring(0,i);let o=t.substring(i+1);return"api"===r&&(o=o.toLowerCase()),[r,o,n].filter(e=>e&&e.length>0).reduce((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},"")},getUserAgentMiddlewareOptions={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},getUserAgentPlugin=e=>({applyToStack:t=>{t.add(userAgentMiddleware(e),getUserAgentMiddlewareOptions)}}),DEFAULT_USE_DUALSTACK_ENDPOINT=!1,DEFAULT_USE_FIPS_ENDPOINT=!1,validRegions=new Set,checkRegion=(e,t=isValidHostLabel)=>{if(validRegions.has(e)||t(e))validRegions.add(e);else{if("*"!==e)throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.')}},isFipsRegion=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),getRealRegion=e=>isFipsRegion(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,resolveRegionConfig=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{const e="function"==typeof t?await t():t,n=getRealRegion(e);return checkRegion(n),n},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!isFipsRegion(e)||("function"!=typeof n?Promise.resolve(!!n):n())}})},CONTENT_LENGTH_HEADER="content-length";function contentLengthMiddleware(e){return t=>async n=>{const i=n.request;if(HttpRequest$1.isInstance(i)){const{body:t,headers:n}=i;if(t&&-1===Object.keys(n).map(e=>e.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER))try{const n=e(t);i.headers={...i.headers,[CONTENT_LENGTH_HEADER]:String(n)}}catch(e){}}return t({...n,request:i})}}const contentLengthMiddlewareOptions={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},getContentLengthPlugin=e=>({applyToStack:t=>{t.add(contentLengthMiddleware(e.bodyLengthChecker),contentLengthMiddlewareOptions)}}),resolveParamsForS3=async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),isArnBucketName(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!isDnsCompatibleBucketName(t)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},DOMAIN_PATTERN=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,IP_ADDRESS_PATTERN=/(\d+\.){3}\d+/,DOTS_PATTERN=/\.\./,isDnsCompatibleBucketName=e=>DOMAIN_PATTERN.test(e)&&!IP_ADDRESS_PATTERN.test(e)&&!DOTS_PATTERN.test(e),isArnBucketName=e=>{const[t,n,i,,,r]=e.split(":"),o="arn"===t&&e.split(":").length>=6,a=Boolean(o&&n&&i&&r);if(o&&!a)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return a},createConfigValueProvider=(e,t,n)=>{const i=async()=>{const i=n[e]??n[t];return"function"==typeof i?i():i};return"credentialScope"===e||"CredentialScope"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.credentialScope??e?.CredentialScope}:"accountId"===e||"AccountId"===t?async()=>{const e="function"==typeof n.credentials?await n.credentials():n.credentials;return e?.accountId??e?.AccountId}:"endpoint"===e||"endpoint"===t?async()=>{if(!1===n.isCustomEndpoint)return;const e=await i();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:n,port:i,path:r}=e;return`${t}//${n}${i?":"+i:""}${r}`}}return e}:i},getEndpointFromConfig=async e=>{},toEndpointV1=e=>"object"==typeof e?"url"in e?parseUrl(e.url):e:parseUrl(e),getEndpointFromInstructions=async(e,t,n,i)=>{if(!n.isCustomEndpoint){let e;e=n.serviceConfiguredEndpoint?await n.serviceConfiguredEndpoint():await getEndpointFromConfig(n.serviceId),e&&(n.endpoint=()=>Promise.resolve(toEndpointV1(e)),n.isCustomEndpoint=!0)}const r=await resolveParams(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(r,i)},resolveParams=async(e,t,n)=>{const i={},r=t?.getEndpointParameterInstructions?.()||{};for(const[t,o]of Object.entries(r))switch(o.type){case"staticContextParams":i[t]=o.value;break;case"contextParams":i[t]=e[o.name];break;case"clientContextParams":case"builtInParams":i[t]=await createConfigValueProvider(o.name,t,n)();break;case"operationContextParams":i[t]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(r).length&&Object.assign(i,n),"s3"===String(n.serviceId).toLowerCase()&&await resolveParamsForS3(i),i},endpointMiddleware=({config:e,instructions:t})=>(n,i)=>async r=>{e.isCustomEndpoint&&setFeature$1(i,"ENDPOINT_OVERRIDE","N");const o=await getEndpointFromInstructions(r.input,{getEndpointParameterInstructions:()=>t},{...e},i);i.endpointV2=o,i.authSchemes=o.properties?.authSchemes;const a=i.authSchemes?.[0];if(a){i.signing_region=a.signingRegion,i.signing_service=a.signingName;const e=getSmithyContext(i),t=e?.selectedHttpAuthScheme?.httpAuthOption;t&&(t.signingProperties=Object.assign(t.signingProperties||{},{signing_region:a.signingRegion,signingRegion:a.signingRegion,signing_service:a.signingName,signingName:a.signingName,signingRegionSet:a.signingRegionSet},a.properties))}return n({...r})},endpointMiddlewareOptions={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:serializerMiddlewareOption$1.name},getEndpointPlugin=(e,t)=>({applyToStack:n=>{n.addRelativeTo(endpointMiddleware({config:e,instructions:t}),endpointMiddlewareOptions)}}),resolveEndpointConfig=e=>{const t=e.tls??!0,{endpoint:n,useDualstackEndpoint:i,useFipsEndpoint:r}=e,o=null!=n?async()=>toEndpointV1(await normalizeProvider$2(n)()):void 0,a=!!n,s=Object.assign(e,{endpoint:o,tls:t,isCustomEndpoint:a,useDualstackEndpoint:normalizeProvider$2(i??!1),useFipsEndpoint:normalizeProvider$2(r??!1)});let c;return s.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=getEndpointFromConfig(e.serviceId)),c),s};var RETRY_MODES;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(RETRY_MODES||(RETRY_MODES={}));const DEFAULT_MAX_ATTEMPTS=3,DEFAULT_RETRY_MODE=RETRY_MODES.STANDARD,THROTTLING_ERROR_CODES=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],TRANSIENT_ERROR_CODES=["TimeoutError","RequestTimeout","RequestTimeoutException"],TRANSIENT_ERROR_STATUS_CODES=[500,502,503,504],NODEJS_TIMEOUT_ERROR_CODES=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],NODEJS_NETWORK_ERROR_CODES=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],isRetryableByTrait=e=>void 0!==e?.$retryable,isClockSkewCorrectedError=e=>e.$metadata?.clockSkewCorrected,isBrowserNetworkError=e=>{const t=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return!!(e&&e instanceof TypeError)&&t.has(e.message)},isThrottlingError=e=>429===e.$metadata?.httpStatusCode||THROTTLING_ERROR_CODES.includes(e.name)||1==e.$retryable?.throttling,isTransientError=(e,t=0)=>isRetryableByTrait(e)||isClockSkewCorrectedError(e)||TRANSIENT_ERROR_CODES.includes(e.name)||NODEJS_TIMEOUT_ERROR_CODES.includes(e?.code||"")||NODEJS_NETWORK_ERROR_CODES.includes(e?.code||"")||TRANSIENT_ERROR_STATUS_CODES.includes(e.$metadata?.httpStatusCode||0)||isBrowserNetworkError(e)||void 0!==e.cause&&t<=10&&isTransientError(e.cause,t+1),isServerError=e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!isTransientError(e)}return!1};class DefaultRateLimiter{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;currentCapacity=0;enabled=!1;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(e=>DefaultRateLimiter.setTimeoutFn(e,t))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const 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(),isThrottlingError(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}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(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const DEFAULT_RETRY_DELAY_BASE=100,MAXIMUM_RETRY_DELAY=2e4,THROTTLING_RETRY_DELAY_BASE=500,INITIAL_RETRY_TOKENS=500,RETRY_COST=5,TIMEOUT_RETRY_COST=10,NO_RETRY_INCREMENT=1,INVOCATION_ID_HEADER="amz-sdk-invocation-id",REQUEST_HEADER="amz-sdk-request",getDefaultRetryBackoffStrategy=()=>{let e=DEFAULT_RETRY_DELAY_BASE;return{computeNextBackoffDelay:t=>Math.floor(Math.min(MAXIMUM_RETRY_DELAY,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}},createDefaultRetryToken=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(MAXIMUM_RETRY_DELAY,e),getRetryCost:()=>n});class StandardRetryStrategy{maxAttempts;mode=RETRY_MODES.STANDARD;capacity=INITIAL_RETRY_TOKENS;retryBackoffStrategy=getDefaultRetryBackoffStrategy();maxAttemptsProvider;constructor(e){this.maxAttempts=e,this.maxAttemptsProvider="function"==typeof e?e:async()=>e}async acquireInitialRetryToken(e){return createDefaultRetryToken({retryDelay:DEFAULT_RETRY_DELAY_BASE,retryCount:0})}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts();if(this.shouldRetry(e,t,n)){const n=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===n?THROTTLING_RETRY_DELAY_BASE:DEFAULT_RETRY_DELAY_BASE);const i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),r=t.retryAfterHint?Math.max(t.retryAfterHint.getTime()-Date.now()||0,i):i,o=this.getCapacityCost(n);return this.capacity-=o,createDefaultRetryToken({retryDelay:r,retryCount:e.getRetryCount()+1,retryCost:o})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(INITIAL_RETRY_TOKENS,this.capacity+(e.getRetryCost()??NO_RETRY_INCREMENT))}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 ${DEFAULT_MAX_ATTEMPTS}`),DEFAULT_MAX_ATTEMPTS}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return"TRANSIENT"===e?TIMEOUT_RETRY_COST:RETRY_COST}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class AdaptiveRetryStrategy{maxAttemptsProvider;rateLimiter;standardRetryStrategy;mode=RETRY_MODES.ADAPTIVE;constructor(e,t){this.maxAttemptsProvider=e;const{rateLimiter:n}=t??{};this.rateLimiter=n??new DefaultRateLimiter,this.standardRetryStrategy=new StandardRetryStrategy(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)}}const asSdkError=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),resolveRetryConfig=e=>{const{retryStrategy:t,retryMode:n,maxAttempts:i}=e,r=normalizeProvider$2(i??DEFAULT_MAX_ATTEMPTS);return Object.assign(e,{maxAttempts:r,retryStrategy:async()=>{if(t)return t;return await normalizeProvider$2(n)()===RETRY_MODES.ADAPTIVE?new AdaptiveRetryStrategy(r):new StandardRetryStrategy(r)}})},isStreamingPayload=e=>e?.body instanceof ReadableStream,retryMiddleware=e=>(t,n)=>async i=>{let r=await e.retryStrategy();const o=await e.maxAttempts();if(!isRetryStrategyV2(r))return r?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",r.mode]]),r.retry(t,i);{let e=await r.acquireInitialRetryToken(n.partition_id),a=new Error,s=0,c=0;const{request:l}=i,d=HttpRequest$1.isInstance(l);for(d&&(l.headers[INVOCATION_ID_HEADER]=v4());;)try{d&&(l.headers[REQUEST_HEADER]=`attempt=${s+1}; max=${o}`);const{response:n,output:a}=await t(i);return r.recordSuccess(e),a.$metadata.attempts=s+1,a.$metadata.totalRetryDelay=c,{response:n,output:a}}catch(t){const i=getRetryErrorInfo(t);if(a=asSdkError(t),d&&isStreamingPayload(l))throw(n.logger instanceof NoOpLogger?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{e=await r.refreshRetryTokenForRetry(e,i)}catch(e){throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=s+1,a.$metadata.totalRetryDelay=c,a}s=e.getRetryCount();const o=e.getRetryDelay();c+=o,await new Promise(e=>setTimeout(e,o))}}},isRetryStrategyV2=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,getRetryErrorInfo=e=>{const t={error:e,errorType:getRetryErrorType(e)},n=getRetryAfterHint(e.$response);return n&&(t.retryAfterHint=n),t},getRetryErrorType=e=>isThrottlingError(e)?"THROTTLING":isTransientError(e)?"TRANSIENT":isServerError(e)?"SERVER_ERROR":"CLIENT_ERROR",retryMiddlewareOptions={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},getRetryPlugin=e=>({applyToStack:t=>{t.add(retryMiddleware(e),retryMiddlewareOptions)}}),getRetryAfterHint=e=>{if(!HttpResponse.isInstance(e))return;const t=Object.keys(e.headers).find(e=>"retry-after"===e.toLowerCase());if(!t)return;const n=e.headers[t],i=Number(n);if(!Number.isNaN(i))return new Date(1e3*i);return new Date(n)},SESSION_TOKEN_QUERY_PARAM="X-Amz-S3session-Token",SESSION_TOKEN_HEADER=SESSION_TOKEN_QUERY_PARAM.toLowerCase();class SignatureV4S3Express extends SignatureV4{async signWithCredentials(e,t,n){const i=getCredentialsWithoutSessionToken(t);e.headers[SESSION_TOKEN_HEADER]=t.sessionToken;return setSingleOverride(this,i),this.signRequest(e,n??{})}async presignWithCredentials(e,t,n){const i=getCredentialsWithoutSessionToken(t);delete e.headers[SESSION_TOKEN_HEADER],e.headers[SESSION_TOKEN_QUERY_PARAM]=t.sessionToken,e.query=e.query??{},e.query[SESSION_TOKEN_QUERY_PARAM]=t.sessionToken;return setSingleOverride(this,i),this.presign(e,n)}}function getCredentialsWithoutSessionToken(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function setSingleOverride(e,t){const n=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),i=e.credentialProvider;e.credentialProvider=()=>(clearTimeout(n),e.credentialProvider=i,Promise.resolve(t))}class SignatureV4MultiRegion{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return"none"}constructor(e){this.sigv4Signer=new SignatureV4S3Express(e),this.signerOptions=e}async sign(e,t={}){return"*"===t.signingRegion?this.getSigv4aSigner().sign(e,t):this.sigv4Signer.sign(e,t)}async signWithCredentials(e,t,n={}){if("*"===n.signingRegion)throw this.getSigv4aSigner(),new Error('signWithCredentials with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.signWithCredentials(e,t,n)}async presign(e,t={}){if("*"===t.signingRegion)throw this.getSigv4aSigner(),new Error('presign with signingRegion \'*\' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt');return this.sigv4Signer.presign(e,t)}async presignWithCredentials(e,t,n={}){if("*"===n.signingRegion)throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(e,t,n)}getSigv4aSigner(){if(!this.sigv4aSigner)throw"node"===this.signerOptions.runtime?new Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt"):new Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");return this.sigv4aSigner}}const z="required",A="type",B="fn",C="argv",D="ref",a$1=!1,b$1=!0,c$1="isSet",d$1="booleanEquals",e$1="endpoint",f$1="tree",g$1="error",h$1={[z]:!1,[A]:"string"},i$1={[z]:!0,default:!1,[A]:"boolean"},j$1={[D]:"EndpointId"},k$1={[B]:c$1,[C]:[{[D]:"Region"}]},l$1={[B]:"aws.partition",[C]:[{[D]:"Region"}],assign:"PartitionResult"},m$1={[D]:"UseFIPS"},n$1={[D]:"Endpoint"},o$1={authSchemes:[{name:"sigv4a",signingName:"ses",signingRegionSet:["*"]}]},p$1={},q$1={[B]:d$1,[C]:[{[D]:"UseDualStack"},!0]},r$1={[B]:d$1,[C]:[!0,{[B]:"getAttr",[C]:[{[D]:"PartitionResult"},"supportsDualStack"]}]},s$1={[g$1]:"DualStack is enabled but this partition does not support DualStack",[A]:g$1},t$1={[B]:d$1,[C]:[m$1,!0]},u$1={[B]:"getAttr",[C]:[{[D]:"PartitionResult"},"supportsFIPS"]},v$1=[{[B]:c$1,[C]:[n$1]}],w$1=[q$1],x$1=[r$1],y=[t$1],_data$1={parameters:{Region:h$1,UseDualStack:i$1,UseFIPS:i$1,Endpoint:h$1,EndpointId:h$1},rules:[{conditions:[{[B]:c$1,[C]:[j$1]},k$1,l$1],rules:[{conditions:[{[B]:"isValidHostLabel",[C]:[j$1,b$1]}],rules:[{conditions:[{[B]:d$1,[C]:[m$1,a$1]}],rules:[{conditions:v$1,endpoint:{url:n$1,properties:o$1,headers:p$1},[A]:e$1},{conditions:w$1,rules:[{conditions:x$1,rules:[{endpoint:{url:"https://{EndpointId}.endpoints.email.global.{PartitionResult#dualStackDnsSuffix}",properties:o$1,headers:p$1},[A]:e$1}],[A]:f$1},s$1],[A]:f$1},{endpoint:{url:"https://{EndpointId}.endpoints.email.{PartitionResult#dnsSuffix}",properties:o$1,headers:p$1},[A]:e$1}],[A]:f$1},{error:"Invalid Configuration: FIPS is not supported with multi-region endpoints",[A]:g$1}],[A]:f$1},{error:"EndpointId must be a valid host label",[A]:g$1}],[A]:f$1},{conditions:v$1,rules:[{conditions:y,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[A]:g$1},{conditions:w$1,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[A]:g$1},{endpoint:{url:n$1,properties:p$1,headers:p$1},[A]:e$1}],[A]:f$1},{conditions:[k$1],rules:[{conditions:[l$1],rules:[{conditions:[t$1,q$1],rules:[{conditions:[{[B]:d$1,[C]:[b$1,u$1]},r$1],rules:[{endpoint:{url:"https://email-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:p$1,headers:p$1},[A]:e$1}],[A]:f$1},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[A]:g$1}],[A]:f$1},{conditions:y,rules:[{conditions:[{[B]:d$1,[C]:[u$1,b$1]}],rules:[{endpoint:{url:"https://email-fips.{Region}.{PartitionResult#dnsSuffix}",properties:p$1,headers:p$1},[A]:e$1}],[A]:f$1},{error:"FIPS is enabled but this partition does not support FIPS",[A]:g$1}],[A]:f$1},{conditions:w$1,rules:[{conditions:x$1,rules:[{endpoint:{url:"https://email.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:p$1,headers:p$1},[A]:e$1}],[A]:f$1},s$1],[A]:f$1},{endpoint:{url:"https://email.{Region}.{PartitionResult#dnsSuffix}",properties:p$1,headers:p$1},[A]:e$1}],[A]:f$1}],[A]:f$1},{error:"Invalid Configuration: Missing Region",[A]:g$1}]},ruleSet$1=_data$1,cache$1=new EndpointCache({size:50,params:["Endpoint","EndpointId","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver$1=(e,t={})=>cache$1.get(e,()=>resolveEndpoint(ruleSet$1,{endpointParams:e,logger:t.logger}));customEndpointFunctions.aws=awsEndpointFunctions;const createEndpointRuleSetHttpAuthSchemeParametersProvider=e=>async(t,n,i)=>{if(!i)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");const r=await e(t,n,i),o=getSmithyContext(n)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!o)throw new Error(`getEndpointParameterInstructions() is not defined on \`${n.commandName}\``);const a=await resolveParams(i,{getEndpointParameterInstructions:o},t);return Object.assign(r,a)},_defaultSESv2HttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext(t).operation,region:await normalizeProvider$2(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),defaultSESv2HttpAuthSchemeParametersProvider=createEndpointRuleSetHttpAuthSchemeParametersProvider(_defaultSESv2HttpAuthSchemeParametersProvider);function createAwsAuthSigv4HttpAuthOption$1(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"ses",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function createAwsAuthSigv4aHttpAuthOption(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"ses",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const createEndpointRuleSetHttpAuthSchemeProvider=(e,t,n)=>i=>{const r=e(i),o=r.properties?.authSchemes;if(!o)return t(i);const a=[];for(const e of o){const{name:t,properties:r={},...s}=e,c=t.toLowerCase();let l;if(t!==c&&console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${t}\` to \`${c}\``),"sigv4a"===c){l="aws.auth#sigv4a";const e=o.find(e=>{const t=e.name.toLowerCase();return"sigv4a"!==t&&t.startsWith("sigv4")});if("none"===SignatureV4MultiRegion.sigv4aDependency()&&e)continue}else{if(!c.startsWith("sigv4"))throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${c}\``);l="aws.auth#sigv4"}const d=n[l];if(!d)throw new Error(`Could not find HttpAuthOption create function for \`${l}\``);const u=d(i);u.schemeId=l,u.signingProperties={...u.signingProperties||{},...s,...r},a.push(u)}return a},_defaultSESv2HttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption$1(e)),t.push(createAwsAuthSigv4aHttpAuthOption(e)),t},defaultSESv2HttpAuthSchemeProvider=createEndpointRuleSetHttpAuthSchemeProvider(defaultEndpointResolver$1,_defaultSESv2HttpAuthSchemeProvider,{"aws.auth#sigv4":createAwsAuthSigv4HttpAuthOption$1,"aws.auth#sigv4a":createAwsAuthSigv4aHttpAuthOption}),resolveHttpAuthSchemeConfig$1=e=>{const t=resolveAwsSdkSigV4Config(e),n=resolveAwsSdkSigV4AConfig(t);return Object.assign(n,{authSchemePreference:normalizeProvider$2(e.authSchemePreference??[])})},resolveClientEndpointParameters$1=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"ses"}),commonParams$1={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},version$3="3.943.0";var packageInfo$1={version:version$3};const createDefaultUserAgentProvider=({serviceId:e,clientVersion:t})=>async n=>{const i="undefined"!=typeof window?window.navigator:void 0,r=i?.userAgent??"",o=i?.userAgentData?.platform??fallback.os(r)??"other",a=i?.userAgentData?.brands??[],s=a[a.length-1],c=s?.brand??fallback.browser(r)??"unknown",l=[["aws-sdk-js",t],["ua","2.1"],[`os/${o}`,undefined],["lang/js"],["md/browser",`${c}_${s?.version??"unknown"}`]];e&&l.push([`api/${e}`,t]);const d=await(n?.userAgentAppId?.());return d&&l.push([`app/${d}`]),l},fallback={os:e=>/iPhone|iPad|iPod/.test(e)?"iOS":/Macintosh|Mac OS X/.test(e)?"macOS":/Windows NT/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":void 0,browser:e=>/EdgiOS|EdgA|Edg\//.test(e)?"Microsoft Edge":/Firefox\//.test(e)?"Firefox":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)?"Safari":void 0},invalidProvider=e=>()=>Promise.reject(e),getRuntimeConfig$3=e=>({apiVersion:"2019-09-27",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver$1,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSESv2HttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4a"),signer:new AwsSdkSigV4ASigner}],logger:e?.logger??new NoOpLogger,protocol:e?.protocol??new AwsRestJsonProtocol({defaultNamespace:"com.amazonaws.sesv2"}),serviceId:e?.serviceId??"SESv2",signerConstructor:e?.signerConstructor??SignatureV4MultiRegion,urlParser:e?.urlParser??parseUrl,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),DEFAULTS_MODE_OPTIONS=["in-region","cross-region","mobile","standard","legacy"],resolveDefaultsModeConfig=({defaultsMode:e}={})=>memoize(async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(useMobileConfiguration()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${t}`)}}),useMobileConfiguration=()=>{const e=window?.navigator;if(e?.connection){const{effectiveType:t,rtt:n,downlink:i}=e?.connection;if("string"==typeof t&&"4g"!==t||Number(n)>100||Number(i)<10)return!0}return e?.userAgentData?.mobile||"number"==typeof e?.maxTouchPoints&&e?.maxTouchPoints>1},getRuntimeConfig$2=e=>{const t=resolveDefaultsModeConfig(e),n=()=>t().then(loadConfigsForDefaultMode),i=getRuntimeConfig$3(e);return{...i,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??createDefaultUserAgentProvider({serviceId:i.serviceId,clientVersion:packageInfo$1.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS,region:e?.region??invalidProvider("Region is missing"),requestHandler:FetchHttpHandler.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))}},getAwsRegionExtensionConfiguration=e=>({setRegion(t){e.region=t},region:()=>e.region}),resolveAwsRegionExtensionConfiguration=e=>({region:e.region()}),getHttpAuthExtensionConfiguration$1=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex(t=>t.schemeId===e.schemeId);-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){i=e},credentials:()=>i}},resolveHttpAuthRuntimeConfig$1=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),resolveRuntimeExtensions$1=(e,t)=>{const n=Object.assign(getAwsRegionExtensionConfiguration(e),getDefaultExtensionConfiguration(e),getHttpHandlerExtensionConfiguration(e),getHttpAuthExtensionConfiguration$1(e));return t.forEach(e=>e.configure(n)),Object.assign(e,resolveAwsRegionExtensionConfiguration(n),resolveDefaultRuntimeConfig(n),resolveHttpHandlerRuntimeConfig(n),resolveHttpAuthRuntimeConfig$1(n))};class SESv2Client extends Client{config;constructor(...[e]){const t=getRuntimeConfig$2(e||{});super(t),this.initConfig=t;const n=resolveUserAgentConfig(resolveClientEndpointParameters$1(t)),i=resolveRetryConfig(n),r=resolveHostHeaderConfig(resolveRegionConfig(i)),o=resolveEndpointConfig(r),a=resolveHttpAuthSchemeConfig$1(o),s=resolveRuntimeExtensions$1(a,e?.extensions||[]);this.config=s,this.middlewareStack.use(getSchemaSerdePlugin(this.config)),this.middlewareStack.use(getUserAgentPlugin(this.config)),this.middlewareStack.use(getRetryPlugin(this.config)),this.middlewareStack.use(getContentLengthPlugin(this.config)),this.middlewareStack.use(getHostHeaderPlugin(this.config)),this.middlewareStack.use(getLoggerPlugin(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:defaultSESv2HttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new DefaultIdentityProviderConfig({"aws.auth#sigv4":e.credentials,"aws.auth#sigv4a":e.credentials})})),this.middlewareStack.use(getHttpSigningPlugin(this.config))}destroy(){super.destroy()}}let SESv2ServiceException$1=class e extends ServiceException{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}},AccountSuspendedException$1=class e extends SESv2ServiceException$1{name="AccountSuspendedException";$fault="client";constructor(t){super({name:"AccountSuspendedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},AlreadyExistsException$1=class e extends SESv2ServiceException$1{name="AlreadyExistsException";$fault="client";constructor(t){super({name:"AlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},BadRequestException$1=class e extends SESv2ServiceException$1{name="BadRequestException";$fault="client";constructor(t){super({name:"BadRequestException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},InternalServiceErrorException$1=class e extends SESv2ServiceException$1{name="InternalServiceErrorException";$fault="server";constructor(t){super({name:"InternalServiceErrorException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},NotFoundException$1=class e extends SESv2ServiceException$1{name="NotFoundException";$fault="client";constructor(t){super({name:"NotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},TooManyRequestsException$1=class e extends SESv2ServiceException$1{name="TooManyRequestsException";$fault="client";constructor(t){super({name:"TooManyRequestsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ConcurrentModificationException$1=class e extends SESv2ServiceException$1{name="ConcurrentModificationException";$fault="server";constructor(t){super({name:"ConcurrentModificationException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},ConflictException$1=class e extends SESv2ServiceException$1{name="ConflictException";$fault="client";constructor(t){super({name:"ConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},LimitExceededException$1=class e extends SESv2ServiceException$1{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},MailFromDomainNotVerifiedException$1=class e extends SESv2ServiceException$1{name="MailFromDomainNotVerifiedException";$fault="client";constructor(t){super({name:"MailFromDomainNotVerifiedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},MessageRejected$1=class e extends SESv2ServiceException$1{name="MessageRejected";$fault="client";constructor(t){super({name:"MessageRejected",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},SendingPausedException$1=class e extends SESv2ServiceException$1{name="SendingPausedException";$fault="client";constructor(t){super({name:"SendingPausedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},InvalidNextTokenException$1=class e extends SESv2ServiceException$1{name="InvalidNextTokenException";$fault="client";constructor(t){super({name:"InvalidNextTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};const _A="Attachment",_AEE="AlreadyExistsException",_AL="AttachmentList",_ASE="AccountSuspendedException",_At="Attachments",_B="Body",_BA="BccAddresses",_BRE="BadRequestException",_CA="CcAddresses",_CD="ContentDisposition",_CDo="ContentDescription",_CE="ConflictException",_CI="ContentId",_CLN="ContactListName",_CME="ConcurrentModificationException",_CSN="ConfigurationSetName",_CT="ContentType",_CTE="ContentTransferEncoding",_Ch="Charset",_Con="Content",_Da="Data",_Des="Destination",_EC="EmailContent",_EIn="EndpointId",_ET="EmailTags",_ETC="EmailTemplateContent",_FEA="FromEmailAddress",_FEAIA="FromEmailAddressIdentityArn",_FFEA="FeedbackForwardingEmailAddress",_FFEAIA="FeedbackForwardingEmailAddressIdentityArn",_FN="FileName",_H="Html",_He="Headers",_INTE="InvalidNextTokenException",_ISEE="InternalServiceErrorException",_LEE="LimitExceededException",_LMO="ListManagementOptions",_MFDNVE="MailFromDomainNotVerifiedException",_MH="MessageHeader",_MHL="MessageHeaderList",_MI="MessageId",_MRe="MessageRejected",_MTL="MessageTagList",_MTe="MessageTag",_Me="Message",_NFE="NotFoundException",_Na="Name",_RC="RawContent",_RM="RawMessage",_RTA="ReplyToAddresses",_Ra="Raw",_SER="SendEmailRequest",_SERe="SendEmailResponse",_SEen="SendEmail",_SPE="SendingPausedException",_Si="Simple",_Su="Subject",_T="Text",_TAe="TemplateArn",_TAo="ToAddresses",_TC="TemplateContent",_TD="TemplateData",_TMRE="TooManyRequestsException",_TN="TemplateName",_TNe="TenantName",_TNo="TopicName",_Te="Template",_V="Value",_c="client",_e="error",_h="http",_hE="httpError",_m="message",_s="server",_sm="smithy.ts.sdk.synthetic.com.amazonaws.sesv2",n0="com.amazonaws.sesv2";var AccountSuspendedException=[-3,n0,_ASE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(AccountSuspendedException,AccountSuspendedException$1);var AlreadyExistsException=[-3,n0,_AEE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(AlreadyExistsException,AlreadyExistsException$1);var Attachment=[3,n0,_A,0,[_RC,_CD,_FN,_CDo,_CI,_CTE,_CT],[21,0,0,0,0,0,0]],BadRequestException=[-3,n0,_BRE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(BadRequestException,BadRequestException$1);var Body=[3,n0,_B,0,[_T,_H],[()=>Content,()=>Content]],ConcurrentModificationException=[-3,n0,_CME,{[_e]:_s,[_hE]:500},[_m],[0]];TypeRegistry.for(n0).registerError(ConcurrentModificationException,ConcurrentModificationException$1);var ConflictException=[-3,n0,_CE,{[_e]:_c,[_hE]:409},[_m],[0]];TypeRegistry.for(n0).registerError(ConflictException,ConflictException$1);var Content=[3,n0,_Con,0,[_Da,_Ch],[0,0]],Destination=[3,n0,_Des,0,[_TAo,_CA,_BA],[64,64,64]],EmailContent=[3,n0,_EC,0,[_Si,_Ra,_Te],[()=>Message,()=>RawMessage,()=>Template]],EmailTemplateContent=[3,n0,_ETC,0,[_Su,_T,_H],[0,0,0]],InternalServiceErrorException=[-3,n0,_ISEE,{[_e]:_s,[_hE]:500},[_m],[0]];TypeRegistry.for(n0).registerError(InternalServiceErrorException,InternalServiceErrorException$1);var InvalidNextTokenException=[-3,n0,_INTE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(InvalidNextTokenException,InvalidNextTokenException$1);var LimitExceededException=[-3,n0,_LEE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(LimitExceededException,LimitExceededException$1);var ListManagementOptions=[3,n0,_LMO,0,[_CLN,_TNo],[0,0]],MailFromDomainNotVerifiedException=[-3,n0,_MFDNVE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(MailFromDomainNotVerifiedException,MailFromDomainNotVerifiedException$1);var Message=[3,n0,_Me,0,[_Su,_B,_He,_At],[()=>Content,()=>Body,()=>MessageHeaderList,()=>AttachmentList]],MessageHeader=[3,n0,_MH,0,[_Na,_V],[0,0]],MessageRejected=[-3,n0,_MRe,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(MessageRejected,MessageRejected$1);var MessageTag=[3,n0,_MTe,0,[_Na,_V],[0,0]],NotFoundException=[-3,n0,_NFE,{[_e]:_c,[_hE]:404},[_m],[0]];TypeRegistry.for(n0).registerError(NotFoundException,NotFoundException$1);var RawMessage=[3,n0,_RM,0,[_Da],[21]],SendEmailRequest=[3,n0,_SER,0,[_FEA,_FEAIA,_Des,_RTA,_FFEA,_FFEAIA,_Con,_ET,_CSN,_EIn,_TNe,_LMO],[0,0,()=>Destination,64,0,0,()=>EmailContent,()=>MessageTagList,0,0,0,()=>ListManagementOptions]],SendEmailResponse=[3,n0,_SERe,0,[_MI],[0]],SendingPausedException=[-3,n0,_SPE,{[_e]:_c,[_hE]:400},[_m],[0]];TypeRegistry.for(n0).registerError(SendingPausedException,SendingPausedException$1);var Template=[3,n0,_Te,0,[_TN,_TAe,_TC,_TD,_He,_At],[0,0,()=>EmailTemplateContent,0,()=>MessageHeaderList,()=>AttachmentList]],TooManyRequestsException=[-3,n0,_TMRE,{[_e]:_c,[_hE]:429},[_m],[0]];TypeRegistry.for(n0).registerError(TooManyRequestsException,TooManyRequestsException$1);var SESv2ServiceException=[-3,_sm,"SESv2ServiceException",0,[],[]];TypeRegistry.for(_sm).registerError(SESv2ServiceException,SESv2ServiceException$1);var AttachmentList=[1,n0,_AL,0,()=>Attachment],MessageHeaderList=[1,n0,_MHL,0,()=>MessageHeader],MessageTagList=[1,n0,_MTL,0,()=>MessageTag],SendEmail=[9,n0,_SEen,{[_h]:["POST","/v2/email/outbound-emails",200]},()=>SendEmailRequest,()=>SendEmailResponse];class SendEmailCommand extends(Command.classBuilder().ep({...commonParams$1,EndpointId:{type:"contextParams",name:"EndpointId"}}).m(function(e,t,n,i){return[getEndpointPlugin(n,e.getEndpointParameterInstructions())]}).s("SimpleEmailService_v2","SendEmail",{}).n("SESv2Client","SendEmailCommand").sc(SendEmail).build()){}var nodemailer={},shared={exports:{}},fetch$1={exports:{}},cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;const e=require$$0$3;return cookies=class{constructor(e){this.options=e||{},this.cookies=[]}set(t,n){let i,r=e.parse(n||""),o=this.parse(t);return o.domain?(i=o.domain.replace(/^\./,""),(r.hostname.length<i.length||("."+r.hostname).substr(1-i.length)!=="."+i)&&(o.domain=r.hostname)):o.domain=r.hostname,o.path||(o.path=this.getPath(r.pathname)),o.expires||(o.expires=new Date(Date.now()+1e3*(Number(this.options.sessionTimeout||1800)||1800))),this.add(o)}get(e){return this.list(e).map(e=>e.name+"="+e.value).join("; ")}list(e){let t,n,i=[];for(t=this.cookies.length-1;t>=0;t--)n=this.cookies[t],this.isExpired(n)?this.cookies.splice(t,t):this.match(n,e)&&i.unshift(n);return i}parse(e){let t={};return(e||"").toString().split(";").forEach(e=>{let n,i=e.split("="),r=i.shift().trim().toLowerCase(),o=i.join("=").trim();if(r)switch(r){case"expires":o=new Date(o),"Invalid Date"!==o.toString()&&(t.expires=o);break;case"path":t.path=o;break;case"domain":n=o.toLowerCase(),n.length&&"."!==n.charAt(0)&&(n="."+n),t.domain=n;break;case"max-age":t.expires=new Date(Date.now()+1e3*(Number(o)||0));break;case"secure":t.secure=!0;break;case"httponly":t.httponly=!0;break;default:t.name||(t.name=r,t.value=o)}}),t}match(t,n){let i=e.parse(n||"");return(i.hostname===t.domain||"."===t.domain.charAt(0)&&("."+i.hostname).substr(-t.domain.length)===t.domain)&&(this.getPath(i.pathname).substr(0,t.path.length)===t.path&&(!t.secure||"https:"===i.protocol))}add(e){let t,n;if(!e||!e.name)return!1;for(t=0,n=this.cookies.length;t<n;t++)if(this.compare(this.cookies[t],e))return this.isExpired(e)?(this.cookies.splice(t,1),!1):(this.cookies[t]=e,!0);return this.isExpired(e)||this.cookies.push(e),!0}compare(e,t){return e.name===t.name&&e.path===t.path&&e.domain===t.domain&&e.secure===t.secure&&e.httponly==e.httponly}isExpired(e){return e.expires&&e.expires<new Date||!e.value}getPath(e){let t=(e||"/").split("/");return t.pop(),t=t.join("/").trim(),"/"!==t.charAt(0)&&(t="/"+t),"/"!==t.substr(-1)&&(t+="/"),t}},cookies}const name="nodemailer",version$2="6.10.1",homepage="https://nodemailer.com/";var require$$9={name:name,version:version$2,homepage:homepage},hasRequiredFetch,hasRequiredShared,mimeTypes_1,hasRequiredMimeTypes,punycode_1,hasRequiredPunycode,base64,hasRequiredBase64,qp,hasRequiredQp,mimeFuncs,hasRequiredMimeFuncs,addressparser_1,hasRequiredAddressparser,lastNewline,hasRequiredLastNewline,leWindows,hasRequiredLeWindows,leUnix,hasRequiredLeUnix,mimeNode,hasRequiredMimeNode,mailComposer,hasRequiredMailComposer,messageParser,hasRequiredMessageParser,relaxedBody,hasRequiredRelaxedBody;function requireFetch(){if(hasRequiredFetch)return fetch$1.exports;hasRequiredFetch=1;const e=require$$0$5,t=require$$1,n=require$$0$3,i=zlib__default,r=require$$0$4.PassThrough,o=requireCookies(),a=require$$9,s=require$$7;function c(l,d){(d=d||{}).fetchRes=d.fetchRes||new r,d.cookies=d.cookies||new o,d.redirects=d.redirects||0,d.maxRedirects=isNaN(d.maxRedirects)?5:d.maxRedirects,d.cookie&&([].concat(d.cookie||[]).forEach(e=>{d.cookies.set(e,l)}),d.cookie=!1);let u,p,m,h=d.fetchRes,f=n.parse(l),g=(d.method||"").toString().trim().toUpperCase()||"GET",y=!1,v="https:"===f.protocol?t:e,x={"accept-encoding":"gzip,deflate","user-agent":"nodemailer/"+a.version};if(Object.keys(d.headers||{}).forEach(e=>{x[e.toLowerCase().trim()]=d.headers[e]}),d.userAgent&&(x["user-agent"]=d.userAgent),f.auth&&(x.Authorization="Basic "+Buffer.from(f.auth).toString("base64")),(u=d.cookies.get(l))&&(x.cookie=u),d.body){if(!1!==d.contentType&&(x["Content-Type"]=d.contentType||"application/x-www-form-urlencoded"),"function"==typeof d.body.pipe)x["Transfer-Encoding"]="chunked",p=d.body,p.on("error",e=>{y||(y=!0,e.type="FETCH",e.sourceUrl=l,h.emit("error",e))});else{if(d.body instanceof Buffer)p=d.body;else if("object"==typeof d.body)try{p=Buffer.from(Object.keys(d.body).map(e=>{let t=d.body[e].toString().trim();return encodeURIComponent(e)+"="+encodeURIComponent(t)}).join("&"))}catch(e){if(y)return;return y=!0,e.type="FETCH",e.sourceUrl=l,void h.emit("error",e)}else p=Buffer.from(d.body.toString().trim());x["Content-Type"]=d.contentType||"application/x-www-form-urlencoded",x["Content-Length"]=p.length}g=(d.method||"").toString().trim().toUpperCase()||"POST"}let E={method:g,host:f.hostname,path:f.path,port:f.port?f.port:"https:"===f.protocol?443:80,headers:x,rejectUnauthorized:!1,agent:!1};d.tls&&Object.keys(d.tls).forEach(e=>{E[e]=d.tls[e]}),"https:"!==f.protocol||!f.hostname||f.hostname===E.host||s.isIP(f.hostname)||E.servername||(E.servername=f.hostname);try{m=v.request(E)}catch(e){return y=!0,setImmediate(()=>{e.type="FETCH",e.sourceUrl=l,h.emit("error",e)}),h}return d.timeout&&m.setTimeout(d.timeout,()=>{if(y)return;y=!0,m.abort();let e=new Error("Request Timeout");e.type="FETCH",e.sourceUrl=l,h.emit("error",e)}),m.on("error",e=>{y||(y=!0,e.type="FETCH",e.sourceUrl=l,h.emit("error",e))}),m.on("response",e=>{let t;if(!y){switch(e.headers["content-encoding"]){case"gzip":case"deflate":t=i.createUnzip()}if(e.headers["set-cookie"]&&[].concat(e.headers["set-cookie"]||[]).forEach(e=>{d.cookies.set(e,l)}),[301,302,303,307,308].includes(e.statusCode)&&e.headers.location){if(d.redirects++,d.redirects>d.maxRedirects){y=!0;let e=new Error("Maximum redirect count exceeded");return e.type="FETCH",e.sourceUrl=l,h.emit("error",e),void m.abort()}return d.method="GET",d.body=!1,c(n.resolve(l,e.headers.location),d)}if(h.statusCode=e.statusCode,h.headers=e.headers,e.statusCode>=300&&!d.allowErrorResponse){y=!0;let t=new Error("Invalid status code "+e.statusCode);return t.type="FETCH",t.sourceUrl=l,h.emit("error",t),void m.abort()}e.on("error",e=>{y||(y=!0,e.type="FETCH",e.sourceUrl=l,h.emit("error",e),m.abort())}),t?(e.pipe(t).pipe(h),t.on("error",e=>{y||(y=!0,e.type="FETCH",e.sourceUrl=l,h.emit("error",e),m.abort())})):e.pipe(h)}}),setImmediate(()=>{if(p)try{if("function"==typeof p.pipe)return p.pipe(m);m.write(p)}catch(e){return y=!0,e.type="FETCH",e.sourceUrl=l,void h.emit("error",e)}m.end()}),h}return fetch$1.exports=function(e,t){return c(e,t)},fetch$1.exports.Cookies=o,fetch$1.exports}function requireShared(){return hasRequiredShared||(hasRequiredShared=1,function(e){const t=require$$0$3,n=require$$0$8,i=require$$0$7,r=requireFetch(),o=require$$4,a=require$$7,s=require$$0$6,c=3e5;let l;try{l=s.networkInterfaces()}catch(e){}e.exports.networkInterfaces=l;const d=(t,n)=>{let i=e.exports.networkInterfaces;if(!i)return!0;const r=Object.keys(i).map(e=>i[e]).reduce((e,t)=>e.concat(t),[]).filter(e=>!e.internal||n).filter(e=>e.family==="IPv"+t||e.family===t).length>0;return r},u=(e,t,n,i)=>{if(!d(e,(n=n||{}).allowInternalNetworkInterfaces))return i(null,[]);(o.Resolver?new o.Resolver(n):o)["resolve"+e](t,(e,t)=>{if(e){switch(e.code){case o.NODATA:case o.NOTFOUND:case o.NOTIMP:case o.SERVFAIL:case o.CONNREFUSED:case o.REFUSED:case"EAI_AGAIN":return i(null,[])}return i(e)}return i(null,Array.isArray(t)?t:[].concat(t||[]))})},p=e.exports.dnsCache=new Map,m=(e,t)=>e?Object.assign({servername:e.servername,host:e.addresses&&e.addresses.length?1===e.addresses.length?e.addresses[0]:e.addresses[Math.floor(Math.random()*e.addresses.length)]:null},t||{}):Object.assign({},t||{});function h(e,t){let n=!1,i=[],r=0;e.on("error",e=>{n||(n=!0,t(e))}),e.on("readable",()=>{let t;for(;null!==(t=e.read());)i.push(t),r+=t.length}),e.on("end",()=>{if(n)return;let e;n=!0;try{e=Buffer.concat(i,r)}catch(e){return t(e)}t(null,e)})}e.exports.resolveHostname=(e,t)=>{if(!(e=e||{}).host&&e.servername&&(e.host=e.servername),!e.host||a.isIP(e.host)){let n={addresses:[e.host],servername:e.servername||!1};return t(null,m(n,{cached:!1}))}let n;if(p.has(e.host)&&(n=p.get(e.host),!n.expires||n.expires>=Date.now()))return t(null,m(n.value,{cached:!0}));u(4,e.host,e,(i,r)=>{if(i)return n?t(null,m(n.value,{cached:!0,error:i})):t(i);if(r&&r.length){let n={addresses:r,servername:e.servername||e.host};return p.set(e.host,{value:n,expires:Date.now()+(e.dnsTtl||c)}),t(null,m(n,{cached:!1}))}u(6,e.host,e,(i,r)=>{if(i)return n?t(null,m(n.value,{cached:!0,error:i})):t(i);if(r&&r.length){let n={addresses:r,servername:e.servername||e.host};return p.set(e.host,{value:n,expires:Date.now()+(e.dnsTtl||c)}),t(null,m(n,{cached:!1}))}try{o.lookup(e.host,{all:!0},(i,r)=>{if(i)return n?t(null,m(n.value,{cached:!0,error:i})):t(i);let o=!!r&&r.filter(e=>d(e.family)).map(e=>e.address).shift();if(r&&r.length&&!o&&console.warn(`Failed to resolve IPv${r[0].family} addresses with current network`),!o&&n)return t(null,m(n.value,{cached:!0}));let a={addresses:o?[o]:[e.host],servername:e.servername||e.host};return p.set(e.host,{value:a,expires:Date.now()+(e.dnsTtl||c)}),t(null,m(a,{cached:!1}))})}catch(i){return n?t(null,m(n.value,{cached:!0,error:i})):t(i)}})})},e.exports.parseConnectionUrl=e=>{e=e||"";let n={};return[t.parse(e,!0)].forEach(e=>{let t;switch(e.protocol){case"smtp:":n.secure=!1;break;case"smtps:":n.secure=!0;break;case"direct:":n.direct=!0}!isNaN(e.port)&&Number(e.port)&&(n.port=Number(e.port)),e.hostname&&(n.host=e.hostname),e.auth&&(t=e.auth.split(":"),n.auth||(n.auth={}),n.auth.user=t.shift(),n.auth.pass=t.join(":")),Object.keys(e.query||{}).forEach(t=>{let i=n,r=t,o=e.query[t];switch(isNaN(o)||(o=Number(o)),o){case"true":o=!0;break;case"false":o=!1}if(0===t.indexOf("tls."))r=t.substr(4),n.tls||(n.tls={}),i=n.tls;else if(t.indexOf(".")>=0)return;r in i||(i[r]=o)})}),n},e.exports._logFunc=(e,t,n,i,r,...o)=>{let a={};Object.keys(n||{}).forEach(e=>{"level"!==e&&(a[e]=n[e])}),Object.keys(i||{}).forEach(e=>{"level"!==e&&(a[e]=i[e])}),e[t](a,r,...o)},e.exports.getLogger=(t,i)=>{let r={},o=["trace","debug","info","warn","error","fatal"];if(!(t=t||{}).logger)return o.forEach(e=>{r[e]=()=>!1}),r;let a=t.logger;return!0===t.logger&&(a=function(e){let t=0,i=new Map;e.forEach(e=>{e.length>t&&(t=e.length)}),e.forEach(e=>{let n=e.toUpperCase();n.length<t&&(n+=" ".repeat(t-n.length)),i.set(e,n)});let r=(e,t,r,...o)=>{let a="";t&&("server"===t.tnx?a="S: ":"client"===t.tnx&&(a="C: "),t.sid&&(a="["+t.sid+"] "+a),t.cid&&(a="[#"+t.cid+"] "+a)),(r=n.format(r,...o)).split(/\r?\n/).forEach(t=>{console.log("[%s] %s %s",(new Date).toISOString().substr(0,19).replace(/T/," "),i.get(e),a+t)})},o={};return e.forEach(e=>{o[e]=r.bind(null,e)}),o}(o)),o.forEach(t=>{r[t]=(n,r,...o)=>{e.exports._logFunc(a,t,i,n,r,...o)}}),r},e.exports.callbackPromise=(e,t)=>function(){let n=Array.from(arguments),i=n.shift();i?t(i):e(...n)},e.exports.parseDataURI=e=>{let t=e,n=t.indexOf(",");if(!n)return e;let i,r=t.substring(n+1),o=t.substring(5,n).split(";"),a=o.length>1&&o[o.length-1];a&&a.indexOf("=")<0&&(i=a.toLowerCase(),o.pop());let s=o.shift()||"application/octet-stream",c={};for(let e of o){let t=e.indexOf("=");if(t>=0){let n=e.substring(0,t),i=e.substring(t+1);c[n]=i}}switch(i){case"base64":r=Buffer.from(r,"base64");break;case"utf8":r=Buffer.from(r);break;default:try{r=Buffer.from(decodeURIComponent(r))}catch(e){r=Buffer.from(r)}r=Buffer.from(r)}return{data:r,encoding:i,contentType:s,params:c}},e.exports.resolveContent=(t,n,o)=>{let a;o||(a=new Promise((t,n)=>{o=e.exports.callbackPromise(t,n)}));let s,c=t&&t[n]&&t[n].content||t[n],l=("object"==typeof t[n]&&t[n].encoding||"utf8").toString().toLowerCase().replace(/[-_\s]/g,"");if(!c)return o(null,c);if("object"==typeof c){if("function"==typeof c.pipe)return h(c,(e,i)=>{if(e)return o(e);t[n].content?t[n].content=i:t[n]=i,o(null,i)});if(/^https?:\/\//i.test(c.path||c.href))return s=r(c.path||c.href),h(s,o);if(/^data:/i.test(c.path||c.href)){let t=e.exports.parseDataURI(c.path||c.href);return t&&t.data?o(null,t.data):o(null,Buffer.from(0))}if(c.path)return h(i.createReadStream(c.path),o)}return"string"!=typeof t[n].content||["utf8","usascii","ascii"].includes(l)||(c=Buffer.from(t[n].content,l)),setImmediate(()=>o(null,c)),a},e.exports.assign=function(){let e=Array.from(arguments),t=e.shift()||{};return e.forEach(e=>{Object.keys(e||{}).forEach(n=>{["tls","auth"].includes(n)&&e[n]&&"object"==typeof e[n]?(t[n]||(t[n]={}),Object.keys(e[n]).forEach(i=>{t[n][i]=e[n][i]})):t[n]=e[n]})}),t},e.exports.encodeXText=e=>{if(!/[^\x21-\x2A\x2C-\x3C\x3E-\x7E]/.test(e))return e;let t=Buffer.from(e),n="";for(let e=0,i=t.length;e<i;e++){let i=t[e];n+=i<33||i>126||43===i||61===i?"+"+(i<16?"0":"")+i.toString(16).toUpperCase():String.fromCharCode(i)}return n}}(shared)),shared.exports}function requireMimeTypes(){if(hasRequiredMimeTypes)return mimeTypes_1;hasRequiredMimeTypes=1;const e=require$$0$9,t="application/octet-stream",n=new Map([["application/acad","dwg"],["application/applixware","aw"],["application/arj","arj"],["application/atom+xml","xml"],["application/atomcat+xml","atomcat"],["application/atomsvc+xml","atomsvc"],["application/base64",["mm","mme"]],["application/binhex","hqx"],["application/binhex4","hqx"],["application/book",["book","boo"]],["application/ccxml+xml,","ccxml"],["application/cdf","cdf"],["application/cdmi-capability","cdmia"],["application/cdmi-container","cdmic"],["application/cdmi-domain","cdmid"],["application/cdmi-object","cdmio"],["application/cdmi-queue","cdmiq"],["application/clariscad","ccad"],["application/commonground","dp"],["application/cu-seeme","cu"],["application/davmount+xml","davmount"],["application/drafting","drw"],["application/dsptype","tsp"],["application/dssc+der","dssc"],["application/dssc+xml","xdssc"],["application/dxf","dxf"],["application/ecmascript",["js","es"]],["application/emma+xml","emma"],["application/envoy","evy"],["application/epub+zip","epub"],["application/excel",["xls","xl","xla","xlb","xlc","xld","xlk","xll","xlm","xlt","xlv","xlw"]],["application/exi","exi"],["application/font-tdpfr","pfr"],["application/fractals","fif"],["application/freeloader","frl"],["application/futuresplash","spl"],["application/geo+json","geojson"],["application/gnutar","tgz"],["application/groupwise","vew"],["application/hlp","hlp"],["application/hta","hta"],["application/hyperstudio","stk"],["application/i-deas","unv"],["application/iges",["iges","igs"]],["application/inf","inf"],["application/internet-property-stream","acx"],["application/ipfix","ipfix"],["application/java","class"],["application/java-archive","jar"],["application/java-byte-code","class"],["application/java-serialized-object","ser"],["application/java-vm","class"],["application/javascript","js"],["application/json","json"],["application/lha","lha"],["application/lzx","lzx"],["application/mac-binary","bin"],["application/mac-binhex","hqx"],["application/mac-binhex40","hqx"],["application/mac-compactpro","cpt"],["application/macbinary","bin"],["application/mads+xml","mads"],["application/marc","mrc"],["application/marcxml+xml","mrcx"],["application/mathematica","ma"],["application/mathml+xml","mathml"],["application/mbedlet","mbd"],["application/mbox","mbox"],["application/mcad","mcd"],["application/mediaservercontrol+xml","mscml"],["application/metalink4+xml","meta4"],["application/mets+xml","mets"],["application/mime","aps"],["application/mods+xml","mods"],["application/mp21","m21"],["application/mp4","mp4"],["application/mspowerpoint",["ppt","pot","pps","ppz"]],["application/msword",["doc","dot","w6w","wiz","word"]],["application/mswrite","wri"],["application/mxf","mxf"],["application/netmc","mcp"],["application/octet-stream",["*"]],["application/oda","oda"],["application/oebps-package+xml","opf"],["application/ogg","ogx"],["application/olescript","axs"],["application/onenote","onetoc"],["application/patch-ops-error+xml","xer"],["application/pdf","pdf"],["application/pgp-encrypted","asc"],["application/pgp-signature","pgp"],["application/pics-rules","prf"],["application/pkcs-12","p12"],["application/pkcs-crl","crl"],["application/pkcs10","p10"],["application/pkcs7-mime",["p7c","p7m"]],["application/pkcs7-signature","p7s"],["application/pkcs8","p8"],["application/pkix-attr-cert","ac"],["application/pkix-cert",["cer","crt"]],["application/pkix-crl","crl"],["application/pkix-pkipath","pkipath"],["application/pkixcmp","pki"],["application/plain","text"],["application/pls+xml","pls"],["application/postscript",["ps","ai","eps"]],["application/powerpoint","ppt"],["application/pro_eng",["part","prt"]],["application/prs.cww","cww"],["application/pskc+xml","pskcxml"],["application/rdf+xml","rdf"],["application/reginfo+xml","rif"],["application/relax-ng-compact-syntax","rnc"],["application/resource-lists+xml","rl"],["application/resource-lists-diff+xml","rld"],["application/ringing-tones","rng"],["application/rls-services+xml","rs"],["application/rsd+xml","rsd"],["application/rss+xml","xml"],["application/rtf",["rtf","rtx"]],["application/sbml+xml","sbml"],["application/scvp-cv-request","scq"],["application/scvp-cv-response","scs"],["application/scvp-vp-request","spq"],["application/scvp-vp-response","spp"],["application/sdp","sdp"],["application/sea","sea"],["application/set","set"],["application/set-payment-initiation","setpay"],["application/set-registration-initiation","setreg"],["application/shf+xml","shf"],["application/sla","stl"],["application/smil",["smi","smil"]],["application/smil+xml","smi"],["application/solids","sol"],["application/sounder","sdr"],["application/sparql-query","rq"],["application/sparql-results+xml","srx"],["application/srgs","gram"],["application/srgs+xml","grxml"],["application/sru+xml","sru"],["application/ssml+xml","ssml"],["application/step",["step","stp"]],["application/streamingmedia","ssm"],["application/tei+xml","tei"],["application/thraud+xml","tfi"],["application/timestamped-data","tsd"],["application/toolbook","tbk"],["application/vda","vda"],["application/vnd.3gpp.pic-bw-large","plb"],["application/vnd.3gpp.pic-bw-small","psb"],["application/vnd.3gpp.pic-bw-var","pvb"],["application/vnd.3gpp2.tcap","tcap"],["application/vnd.3m.post-it-notes","pwn"],["application/vnd.accpac.simply.aso","aso"],["application/vnd.accpac.simply.imp","imp"],["application/vnd.acucobol","acu"],["application/vnd.acucorp","atc"],["application/vnd.adobe.air-application-installer-package+zip","air"],["application/vnd.adobe.fxp","fxp"],["application/vnd.adobe.xdp+xml","xdp"],["application/vnd.adobe.xfdf","xfdf"],["application/vnd.ahead.space","ahead"],["application/vnd.airzip.filesecure.azf","azf"],["application/vnd.airzip.filesecure.azs","azs"],["application/vnd.amazon.ebook","azw"],["application/vnd.americandynamics.acc","acc"],["application/vnd.amiga.ami","ami"],["application/vnd.android.package-archive","apk"],["application/vnd.anser-web-certificate-issue-initiation","cii"],["application/vnd.anser-web-funds-transfer-initiation","fti"],["application/vnd.antix.game-component","atx"],["application/vnd.apple.installer+xml","mpkg"],["application/vnd.apple.mpegurl","m3u8"],["application/vnd.aristanetworks.swi","swi"],["application/vnd.audiograph","aep"],["application/vnd.blueice.multipass","mpm"],["application/vnd.bmi","bmi"],["application/vnd.businessobjects","rep"],["application/vnd.chemdraw+xml","cdxml"],["application/vnd.chipnuts.karaoke-mmd","mmd"],["application/vnd.cinderella","cdy"],["application/vnd.claymore","cla"],["application/vnd.cloanto.rp9","rp9"],["application/vnd.clonk.c4group","c4g"],["application/vnd.cluetrust.cartomobile-config","c11amc"],["application/vnd.cluetrust.cartomobile-config-pkg","c11amz"],["application/vnd.commonspace","csp"],["application/vnd.contact.cmsg","cdbcmsg"],["application/vnd.cosmocaller","cmc"],["application/vnd.crick.clicker","clkx"],["application/vnd.crick.clicker.keyboard","clkk"],["application/vnd.crick.clicker.palette","clkp"],["application/vnd.crick.clicker.template","clkt"],["application/vnd.crick.clicker.wordbank","clkw"],["application/vnd.criticaltools.wbs+xml","wbs"],["application/vnd.ctc-posml","pml"],["application/vnd.cups-ppd","ppd"],["application/vnd.curl.car","car"],["application/vnd.curl.pcurl","pcurl"],["application/vnd.data-vision.rdz","rdz"],["application/vnd.denovo.fcselayout-link","fe_launch"],["application/vnd.dna","dna"],["application/vnd.dolby.mlp","mlp"],["application/vnd.dpgraph","dpg"],["application/vnd.dreamfactory","dfac"],["application/vnd.dvb.ait","ait"],["application/vnd.dvb.service","svc"],["application/vnd.dynageo","geo"],["application/vnd.ecowin.chart","mag"],["application/vnd.enliven","nml"],["application/vnd.epson.esf","esf"],["application/vnd.epson.msf","msf"],["application/vnd.epson.quickanime","qam"],["application/vnd.epson.salt","slt"],["application/vnd.epson.ssf","ssf"],["application/vnd.eszigno3+xml","es3"],["application/vnd.ezpix-album","ez2"],["application/vnd.ezpix-package","ez3"],["application/vnd.fdf","fdf"],["application/vnd.fdsn.seed","seed"],["application/vnd.flographit","gph"],["application/vnd.fluxtime.clip","ftc"],["application/vnd.framemaker","fm"],["application/vnd.frogans.fnc","fnc"],["application/vnd.frogans.ltf","ltf"],["application/vnd.fsc.weblaunch","fsc"],["application/vnd.fujitsu.oasys","oas"],["application/vnd.fujitsu.oasys2","oa2"],["application/vnd.fujitsu.oasys3","oa3"],["application/vnd.fujitsu.oasysgp","fg5"],["application/vnd.fujitsu.oasysprs","bh2"],["application/vnd.fujixerox.ddd","ddd"],["application/vnd.fujixerox.docuworks","xdw"],["application/vnd.fujixerox.docuworks.binder","xbd"],["application/vnd.fuzzysheet","fzs"],["application/vnd.genomatix.tuxedo","txd"],["application/vnd.geogebra.file","ggb"],["application/vnd.geogebra.tool","ggt"],["application/vnd.geometry-explorer","gex"],["application/vnd.geonext","gxt"],["application/vnd.geoplan","g2w"],["application/vnd.geospace","g3w"],["application/vnd.gmx","gmx"],["application/vnd.google-earth.kml+xml","kml"],["application/vnd.google-earth.kmz","kmz"],["application/vnd.grafeq","gqf"],["application/vnd.groove-account","gac"],["application/vnd.groove-help","ghf"],["application/vnd.groove-identity-message","gim"],["application/vnd.groove-injector","grv"],["application/vnd.groove-tool-message","gtm"],["application/vnd.groove-tool-template","tpl"],["application/vnd.groove-vcard","vcg"],["application/vnd.hal+xml","hal"],["application/vnd.handheld-entertainment+xml","zmm"],["application/vnd.hbci","hbci"],["application/vnd.hhe.lesson-player","les"],["application/vnd.hp-hpgl",["hgl","hpg","hpgl"]],["application/vnd.hp-hpid","hpid"],["application/vnd.hp-hps","hps"],["application/vnd.hp-jlyt","jlt"],["application/vnd.hp-pcl","pcl"],["application/vnd.hp-pclxl","pclxl"],["application/vnd.hydrostatix.sof-data","sfd-hdstx"],["application/vnd.hzn-3d-crossword","x3d"],["application/vnd.ibm.minipay","mpy"],["application/vnd.ibm.modcap","afp"],["application/vnd.ibm.rights-management","irm"],["application/vnd.ibm.secure-container","sc"],["application/vnd.iccprofile","icc"],["application/vnd.igloader","igl"],["application/vnd.immervision-ivp","ivp"],["application/vnd.immervision-ivu","ivu"],["application/vnd.insors.igm","igm"],["application/vnd.intercon.formnet","xpw"],["application/vnd.intergeo","i2g"],["application/vnd.intu.qbo","qbo"],["application/vnd.intu.qfx","qfx"],["application/vnd.ipunplugged.rcprofile","rcprofile"],["application/vnd.irepository.package+xml","irp"],["application/vnd.is-xpr","xpr"],["application/vnd.isac.fcs","fcs"],["application/vnd.jam","jam"],["application/vnd.jcp.javame.midlet-rms","rms"],["application/vnd.jisp","jisp"],["application/vnd.joost.joda-archive","joda"],["application/vnd.kahootz","ktz"],["application/vnd.kde.karbon","karbon"],["application/vnd.kde.kchart","chrt"],["application/vnd.kde.kformula","kfo"],["application/vnd.kde.kivio","flw"],["application/vnd.kde.kontour","kon"],["application/vnd.kde.kpresenter","kpr"],["application/vnd.kde.kspread","ksp"],["application/vnd.kde.kword","kwd"],["application/vnd.kenameaapp","htke"],["application/vnd.kidspiration","kia"],["application/vnd.kinar","kne"],["application/vnd.koan","skp"],["application/vnd.kodak-descriptor","sse"],["application/vnd.las.las+xml","lasxml"],["application/vnd.llamagraphics.life-balance.desktop","lbd"],["application/vnd.llamagraphics.life-balance.exchange+xml","lbe"],["application/vnd.lotus-1-2-3","123"],["application/vnd.lotus-approach","apr"],["application/vnd.lotus-freelance","pre"],["application/vnd.lotus-notes","nsf"],["application/vnd.lotus-organizer","org"],["application/vnd.lotus-screencam","scm"],["application/vnd.lotus-wordpro","lwp"],["application/vnd.macports.portpkg","portpkg"],["application/vnd.mcd","mcd"],["application/vnd.medcalcdata","mc1"],["application/vnd.mediastation.cdkey","cdkey"],["application/vnd.mfer","mwf"],["application/vnd.mfmp","mfm"],["application/vnd.micrografx.flo","flo"],["application/vnd.micrografx.igx","igx"],["application/vnd.mif","mif"],["application/vnd.mobius.daf","daf"],["application/vnd.mobius.dis","dis"],["application/vnd.mobius.mbk","mbk"],["application/vnd.mobius.mqy","mqy"],["application/vnd.mobius.msl","msl"],["application/vnd.mobius.plc","plc"],["application/vnd.mobius.txf","txf"],["application/vnd.mophun.application","mpn"],["application/vnd.mophun.certificate","mpc"],["application/vnd.mozilla.xul+xml","xul"],["application/vnd.ms-artgalry","cil"],["application/vnd.ms-cab-compressed","cab"],["application/vnd.ms-excel",["xls","xla","xlc","xlm","xlt","xlw","xlb","xll"]],["application/vnd.ms-excel.addin.macroenabled.12","xlam"],["application/vnd.ms-excel.sheet.binary.macroenabled.12","xlsb"],["application/vnd.ms-excel.sheet.macroenabled.12","xlsm"],["application/vnd.ms-excel.template.macroenabled.12","xltm"],["application/vnd.ms-fontobject","eot"],["application/vnd.ms-htmlhelp","chm"],["application/vnd.ms-ims","ims"],["application/vnd.ms-lrm","lrm"],["application/vnd.ms-officetheme","thmx"],["application/vnd.ms-outlook","msg"],["application/vnd.ms-pki.certstore","sst"],["application/vnd.ms-pki.pko","pko"],["application/vnd.ms-pki.seccat","cat"],["application/vnd.ms-pki.stl","stl"],["application/vnd.ms-pkicertstore","sst"],["application/vnd.ms-pkiseccat","cat"],["application/vnd.ms-pkistl","stl"],["application/vnd.ms-powerpoint",["ppt","pot","pps","ppa","pwz"]],["application/vnd.ms-powerpoint.addin.macroenabled.12","ppam"],["application/vnd.ms-powerpoint.presentation.macroenabled.12","pptm"],["application/vnd.ms-powerpoint.slide.macroenabled.12","sldm"],["application/vnd.ms-powerpoint.slideshow.macroenabled.12","ppsm"],["application/vnd.ms-powerpoint.template.macroenabled.12","potm"],["application/vnd.ms-project","mpp"],["application/vnd.ms-word.document.macroenabled.12","docm"],["application/vnd.ms-word.template.macroenabled.12","dotm"],["application/vnd.ms-works",["wks","wcm","wdb","wps"]],["application/vnd.ms-wpl","wpl"],["application/vnd.ms-xpsdocument","xps"],["application/vnd.mseq","mseq"],["application/vnd.musician","mus"],["application/vnd.muvee.style","msty"],["application/vnd.neurolanguage.nlu","nlu"],["application/vnd.noblenet-directory","nnd"],["application/vnd.noblenet-sealer","nns"],["application/vnd.noblenet-web","nnw"],["application/vnd.nokia.configuration-message","ncm"],["application/vnd.nokia.n-gage.data","ngdat"],["application/vnd.nokia.n-gage.symbian.install","n-gage"],["application/vnd.nokia.radio-preset","rpst"],["application/vnd.nokia.radio-presets","rpss"],["application/vnd.nokia.ringing-tone","rng"],["application/vnd.novadigm.edm","edm"],["application/vnd.novadigm.edx","edx"],["application/vnd.novadigm.ext","ext"],["application/vnd.oasis.opendocument.chart","odc"],["application/vnd.oasis.opendocument.chart-template","otc"],["application/vnd.oasis.opendocument.database","odb"],["application/vnd.oasis.opendocument.formula","odf"],["application/vnd.oasis.opendocument.formula-template","odft"],["application/vnd.oasis.opendocument.graphics","odg"],["application/vnd.oasis.opendocument.graphics-template","otg"],["application/vnd.oasis.opendocument.image","odi"],["application/vnd.oasis.opendocument.image-template","oti"],["application/vnd.oasis.opendocument.presentation","odp"],["application/vnd.oasis.opendocument.presentation-template","otp"],["application/vnd.oasis.opendocument.spreadsheet","ods"],["application/vnd.oasis.opendocument.spreadsheet-template","ots"],["application/vnd.oasis.opendocument.text","odt"],["application/vnd.oasis.opendocument.text-master","odm"],["application/vnd.oasis.opendocument.text-template","ott"],["application/vnd.oasis.opendocument.text-web","oth"],["application/vnd.olpc-sugar","xo"],["application/vnd.oma.dd2+xml","dd2"],["application/vnd.openofficeorg.extension","oxt"],["application/vnd.openxmlformats-officedocument.presentationml.presentation","pptx"],["application/vnd.openxmlformats-officedocument.presentationml.slide","sldx"],["application/vnd.openxmlformats-officedocument.presentationml.slideshow","ppsx"],["application/vnd.openxmlformats-officedocument.presentationml.template","potx"],["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsx"],["application/vnd.openxmlformats-officedocument.spreadsheetml.template","xltx"],["application/vnd.openxmlformats-officedocument.wordprocessingml.document","docx"],["application/vnd.openxmlformats-officedocument.wordprocessingml.template","dotx"],["application/vnd.osgeo.mapguide.package","mgp"],["application/vnd.osgi.dp","dp"],["application/vnd.palm","pdb"],["application/vnd.pawaafile","paw"],["application/vnd.pg.format","str"],["application/vnd.pg.osasli","ei6"],["application/vnd.picsel","efif"],["application/vnd.pmi.widget","wg"],["application/vnd.pocketlearn","plf"],["application/vnd.powerbuilder6","pbd"],["application/vnd.previewsystems.box","box"],["application/vnd.proteus.magazine","mgz"],["application/vnd.publishare-delta-tree","qps"],["application/vnd.pvi.ptid1","ptid"],["application/vnd.quark.quarkxpress","qxd"],["application/vnd.realvnc.bed","bed"],["application/vnd.recordare.musicxml","mxl"],["application/vnd.recordare.musicxml+xml","musicxml"],["application/vnd.rig.cryptonote","cryptonote"],["application/vnd.rim.cod","cod"],["application/vnd.rn-realmedia","rm"],["application/vnd.rn-realplayer","rnx"],["application/vnd.route66.link66+xml","link66"],["application/vnd.sailingtracker.track","st"],["application/vnd.seemail","see"],["application/vnd.sema","sema"],["application/vnd.semd","semd"],["application/vnd.semf","semf"],["application/vnd.shana.informed.formdata","ifm"],["application/vnd.shana.informed.formtemplate","itp"],["application/vnd.shana.informed.interchange","iif"],["application/vnd.shana.informed.package","ipk"],["application/vnd.simtech-mindmapper","twd"],["application/vnd.smaf","mmf"],["application/vnd.smart.teacher","teacher"],["application/vnd.solent.sdkm+xml","sdkm"],["application/vnd.spotfire.dxp","dxp"],["application/vnd.spotfire.sfs","sfs"],["application/vnd.stardivision.calc","sdc"],["application/vnd.stardivision.draw","sda"],["application/vnd.stardivision.impress","sdd"],["application/vnd.stardivision.math","smf"],["application/vnd.stardivision.writer","sdw"],["application/vnd.stardivision.writer-global","sgl"],["application/vnd.stepmania.stepchart","sm"],["application/vnd.sun.xml.calc","sxc"],["application/vnd.sun.xml.calc.template","stc"],["application/vnd.sun.xml.draw","sxd"],["application/vnd.sun.xml.draw.template","std"],["application/vnd.sun.xml.impress","sxi"],["application/vnd.sun.xml.impress.template","sti"],["application/vnd.sun.xml.math","sxm"],["application/vnd.sun.xml.writer","sxw"],["application/vnd.sun.xml.writer.global","sxg"],["application/vnd.sun.xml.writer.template","stw"],["application/vnd.sus-calendar","sus"],["application/vnd.svd","svd"],["application/vnd.symbian.install","sis"],["application/vnd.syncml+xml","xsm"],["application/vnd.syncml.dm+wbxml","bdm"],["application/vnd.syncml.dm+xml","xdm"],["application/vnd.tao.intent-module-archive","tao"],["application/vnd.tmobile-livetv","tmo"],["application/vnd.trid.tpt","tpt"],["application/vnd.triscape.mxs","mxs"],["application/vnd.trueapp","tra"],["application/vnd.ufdl","ufd"],["application/vnd.uiq.theme","utz"],["application/vnd.umajin","umj"],["application/vnd.unity","unityweb"],["application/vnd.uoml+xml","uoml"],["application/vnd.vcx","vcx"],["application/vnd.visio","vsd"],["application/vnd.visionary","vis"],["application/vnd.vsf","vsf"],["application/vnd.wap.wbxml","wbxml"],["application/vnd.wap.wmlc","wmlc"],["application/vnd.wap.wmlscriptc","wmlsc"],["application/vnd.webturbo","wtb"],["application/vnd.wolfram.player","nbp"],["application/vnd.wordperfect","wpd"],["application/vnd.wqd","wqd"],["application/vnd.wt.stf","stf"],["application/vnd.xara",["web","xar"]],["application/vnd.xfdl","xfdl"],["application/vnd.yamaha.hv-dic","hvd"],["application/vnd.yamaha.hv-script","hvs"],["application/vnd.yamaha.hv-voice","hvp"],["application/vnd.yamaha.openscoreformat","osf"],["application/vnd.yamaha.openscoreformat.osfpvg+xml","osfpvg"],["application/vnd.yamaha.smaf-audio","saf"],["application/vnd.yamaha.smaf-phrase","spf"],["application/vnd.yellowriver-custom-menu","cmp"],["application/vnd.zul","zir"],["application/vnd.zzazz.deck+xml","zaz"],["application/vocaltec-media-desc","vmd"],["application/vocaltec-media-file","vmf"],["application/voicexml+xml","vxml"],["application/widget","wgt"],["application/winhlp","hlp"],["application/wordperfect",["wp","wp5","wp6","wpd"]],["application/wordperfect6.0",["w60","wp5"]],["application/wordperfect6.1","w61"],["application/wsdl+xml","wsdl"],["application/wspolicy+xml","wspolicy"],["application/x-123","wk1"],["application/x-7z-compressed","7z"],["application/x-abiword","abw"],["application/x-ace-compressed","ace"],["application/x-aim","aim"],["application/x-authorware-bin","aab"],["application/x-authorware-map","aam"],["application/x-authorware-seg","aas"],["application/x-bcpio","bcpio"],["application/x-binary","bin"],["application/x-binhex40","hqx"],["application/x-bittorrent","torrent"],["application/x-bsh",["bsh","sh","shar"]],["application/x-bytecode.elisp","elc"],["application/x-bytecode.python","pyc"],["application/x-bzip","bz"],["application/x-bzip2",["boz","bz2"]],["application/x-cdf","cdf"],["application/x-cdlink","vcd"],["application/x-chat",["cha","chat"]],["application/x-chess-pgn","pgn"],["application/x-cmu-raster","ras"],["application/x-cocoa","cco"],["application/x-compactpro","cpt"],["application/x-compress","z"],["application/x-compressed",["tgz","gz","z","zip"]],["application/x-conference","nsc"],["application/x-cpio","cpio"],["application/x-cpt","cpt"],["application/x-csh","csh"],["application/x-debian-package","deb"],["application/x-deepv","deepv"],["application/x-director",["dir","dcr","dxr"]],["application/x-doom","wad"],["application/x-dtbncx+xml","ncx"],["application/x-dtbook+xml","dtb"],["application/x-dtbresource+xml","res"],["application/x-dvi","dvi"],["application/x-elc","elc"],["application/x-envoy",["env","evy"]],["application/x-esrehber","es"],["application/x-excel",["xls","xla","xlb","xlc","xld","xlk","xll","xlm","xlt","xlv","xlw"]],["application/x-font-bdf","bdf"],["application/x-font-ghostscript","gsf"],["application/x-font-linux-psf","psf"],["application/x-font-otf","otf"],["application/x-font-pcf","pcf"],["application/x-font-snf","snf"],["application/x-font-ttf","ttf"],["application/x-font-type1","pfa"],["application/x-font-woff","woff"],["application/x-frame","mif"],["application/x-freelance","pre"],["application/x-futuresplash","spl"],["application/x-gnumeric","gnumeric"],["application/x-gsp","gsp"],["application/x-gss","gss"],["application/x-gtar","gtar"],["application/x-gzip",["gz","gzip"]],["application/x-hdf","hdf"],["application/x-helpfile",["help","hlp"]],["application/x-httpd-imap","imap"],["application/x-ima","ima"],["application/x-internet-signup",["ins","isp"]],["application/x-internett-signup","ins"],["application/x-inventor","iv"],["application/x-ip2","ip"],["application/x-iphone","iii"],["application/x-java-class","class"],["application/x-java-commerce","jcm"],["application/x-java-jnlp-file","jnlp"],["application/x-javascript","js"],["application/x-koan",["skd","skm","skp","skt"]],["application/x-ksh","ksh"],["application/x-latex",["latex","ltx"]],["application/x-lha","lha"],["application/x-lisp","lsp"],["application/x-livescreen","ivy"],["application/x-lotus","wq1"],["application/x-lotusscreencam","scm"],["application/x-lzh","lzh"],["application/x-lzx","lzx"],["application/x-mac-binhex40","hqx"],["application/x-macbinary","bin"],["application/x-magic-cap-package-1.0","mc$"],["application/x-mathcad","mcd"],["application/x-meme","mm"],["application/x-midi",["mid","midi"]],["application/x-mif","mif"],["application/x-mix-transfer","nix"],["application/x-mobipocket-ebook","prc"],["application/x-mplayer2","asx"],["application/x-ms-application","application"],["application/x-ms-wmd","wmd"],["application/x-ms-wmz","wmz"],["application/x-ms-xbap","xbap"],["application/x-msaccess","mdb"],["application/x-msbinder","obd"],["application/x-mscardfile","crd"],["application/x-msclip","clp"],["application/x-msdownload",["exe","dll"]],["application/x-msexcel",["xls","xla","xlw"]],["application/x-msmediaview",["mvb","m13","m14"]],["application/x-msmetafile","wmf"],["application/x-msmoney","mny"],["application/x-mspowerpoint","ppt"],["application/x-mspublisher","pub"],["application/x-msschedule","scd"],["application/x-msterminal","trm"],["application/x-mswrite","wri"],["application/x-navi-animation","ani"],["application/x-navidoc","nvd"],["application/x-navimap","map"],["application/x-navistyle","stl"],["application/x-netcdf",["cdf","nc"]],["application/x-newton-compatible-pkg","pkg"],["application/x-nokia-9000-communicator-add-on-software","aos"],["application/x-omc","omc"],["application/x-omcdatamaker","omcd"],["application/x-omcregerator","omcr"],["application/x-pagemaker",["pm4","pm5"]],["application/x-pcl","pcl"],["application/x-perfmon",["pma","pmc","pml","pmr","pmw"]],["application/x-pixclscript","plx"],["application/x-pkcs10","p10"],["application/x-pkcs12",["p12","pfx"]],["application/x-pkcs7-certificates",["p7b","spc"]],["application/x-pkcs7-certreqresp","p7r"],["application/x-pkcs7-mime",["p7m","p7c"]],["application/x-pkcs7-signature",["p7s","p7a"]],["application/x-pointplus","css"],["application/x-portable-anymap","pnm"],["application/x-project",["mpc","mpt","mpv","mpx"]],["application/x-qpro","wb1"],["application/x-rar-compressed","rar"],["application/x-rtf","rtf"],["application/x-sdp","sdp"],["application/x-sea","sea"],["application/x-seelogo","sl"],["application/x-sh","sh"],["application/x-shar",["shar","sh"]],["application/x-shockwave-flash","swf"],["application/x-silverlight-app","xap"],["application/x-sit","sit"],["application/x-sprite",["spr","sprite"]],["application/x-stuffit","sit"],["application/x-stuffitx","sitx"],["application/x-sv4cpio","sv4cpio"],["application/x-sv4crc","sv4crc"],["application/x-tar","tar"],["application/x-tbook",["sbk","tbk"]],["application/x-tcl","tcl"],["application/x-tex","tex"],["application/x-tex-tfm","tfm"],["application/x-texinfo",["texi","texinfo"]],["application/x-troff",["roff","t","tr"]],["application/x-troff-man","man"],["application/x-troff-me","me"],["application/x-troff-ms","ms"],["application/x-troff-msvideo","avi"],["application/x-ustar","ustar"],["application/x-visio",["vsd","vst","vsw"]],["application/x-vnd.audioexplosion.mzz","mzz"],["application/x-vnd.ls-xpix","xpix"],["application/x-vrml","vrml"],["application/x-wais-source",["src","wsrc"]],["application/x-winhelp","hlp"],["application/x-wintalk","wtk"],["application/x-world",["wrl","svr"]],["application/x-wpwin","wpd"],["application/x-wri","wri"],["application/x-x509-ca-cert",["cer","crt","der"]],["application/x-x509-user-cert","crt"],["application/x-xfig","fig"],["application/x-xpinstall","xpi"],["application/x-zip-compressed","zip"],["application/xcap-diff+xml","xdf"],["application/xenc+xml","xenc"],["application/xhtml+xml","xhtml"],["application/xml","xml"],["application/xml-dtd","dtd"],["application/xop+xml","xop"],["application/xslt+xml","xslt"],["application/xspf+xml","xspf"],["application/xv+xml","mxml"],["application/yang","yang"],["application/yin+xml","yin"],["application/ynd.ms-pkipko","pko"],["application/zip","zip"],["audio/adpcm","adp"],["audio/aiff",["aiff","aif","aifc"]],["audio/basic",["snd","au"]],["audio/it","it"],["audio/make",["funk","my","pfunk"]],["audio/make.my.funk","pfunk"],["audio/mid",["mid","rmi"]],["audio/midi",["midi","kar","mid"]],["audio/mod","mod"],["audio/mp4","mp4a"],["audio/mpeg",["mpga","mp3","m2a","mp2","mpa","mpg"]],["audio/mpeg3","mp3"],["audio/nspaudio",["la","lma"]],["audio/ogg","oga"],["audio/s3m","s3m"],["audio/tsp-audio","tsi"],["audio/tsplayer","tsp"],["audio/vnd.dece.audio","uva"],["audio/vnd.digital-winds","eol"],["audio/vnd.dra","dra"],["audio/vnd.dts","dts"],["audio/vnd.dts.hd","dtshd"],["audio/vnd.lucent.voice","lvp"],["audio/vnd.ms-playready.media.pya","pya"],["audio/vnd.nuera.ecelp4800","ecelp4800"],["audio/vnd.nuera.ecelp7470","ecelp7470"],["audio/vnd.nuera.ecelp9600","ecelp9600"],["audio/vnd.qcelp","qcp"],["audio/vnd.rip","rip"],["audio/voc","voc"],["audio/voxware","vox"],["audio/wav","wav"],["audio/webm","weba"],["audio/x-aac","aac"],["audio/x-adpcm","snd"],["audio/x-aiff",["aiff","aif","aifc"]],["audio/x-au","au"],["audio/x-gsm",["gsd","gsm"]],["audio/x-jam","jam"],["audio/x-liveaudio","lam"],["audio/x-mid",["mid","midi"]],["audio/x-midi",["midi","mid"]],["audio/x-mod","mod"],["audio/x-mpeg","mp2"],["audio/x-mpeg-3","mp3"],["audio/x-mpegurl","m3u"],["audio/x-mpequrl","m3u"],["audio/x-ms-wax","wax"],["audio/x-ms-wma","wma"],["audio/x-nspaudio",["la","lma"]],["audio/x-pn-realaudio",["ra","ram","rm","rmm","rmp"]],["audio/x-pn-realaudio-plugin",["ra","rmp","rpm"]],["audio/x-psid","sid"],["audio/x-realaudio","ra"],["audio/x-twinvq","vqf"],["audio/x-twinvq-plugin",["vqe","vql"]],["audio/x-vnd.audioexplosion.mjuicemediafile","mjf"],["audio/x-voc","voc"],["audio/x-wav","wav"],["audio/xm","xm"],["chemical/x-cdx","cdx"],["chemical/x-cif","cif"],["chemical/x-cmdf","cmdf"],["chemical/x-cml","cml"],["chemical/x-csml","csml"],["chemical/x-pdb",["pdb","xyz"]],["chemical/x-xyz","xyz"],["drawing/x-dwf","dwf"],["i-world/i-vrml","ivr"],["image/bmp",["bmp","bm"]],["image/cgm","cgm"],["image/cis-cod","cod"],["image/cmu-raster",["ras","rast"]],["image/fif","fif"],["image/florian",["flo","turbot"]],["image/g3fax","g3"],["image/gif","gif"],["image/ief",["ief","iefs"]],["image/jpeg",["jpeg","jpe","jpg","jfif","jfif-tbnl"]],["image/jutvision","jut"],["image/ktx","ktx"],["image/naplps",["nap","naplps"]],["image/pict",["pic","pict"]],["image/pipeg","jfif"],["image/pjpeg",["jfif","jpe","jpeg","jpg"]],["image/png",["png","x-png"]],["image/prs.btif","btif"],["image/svg+xml","svg"],["image/tiff",["tif","tiff"]],["image/vasa","mcf"],["image/vnd.adobe.photoshop","psd"],["image/vnd.dece.graphic","uvi"],["image/vnd.djvu","djvu"],["image/vnd.dvb.subtitle","sub"],["image/vnd.dwg",["dwg","dxf","svf"]],["image/vnd.dxf","dxf"],["image/vnd.fastbidsheet","fbs"],["image/vnd.fpx","fpx"],["image/vnd.fst","fst"],["image/vnd.fujixerox.edmics-mmr","mmr"],["image/vnd.fujixerox.edmics-rlc","rlc"],["image/vnd.ms-modi","mdi"],["image/vnd.net-fpx",["fpx","npx"]],["image/vnd.rn-realflash","rf"],["image/vnd.rn-realpix","rp"],["image/vnd.wap.wbmp","wbmp"],["image/vnd.xiff","xif"],["image/webp","webp"],["image/x-cmu-raster","ras"],["image/x-cmx","cmx"],["image/x-dwg",["dwg","dxf","svf"]],["image/x-freehand","fh"],["image/x-icon","ico"],["image/x-jg","art"],["image/x-jps","jps"],["image/x-niff",["niff","nif"]],["image/x-pcx","pcx"],["image/x-pict",["pct","pic"]],["image/x-portable-anymap","pnm"],["image/x-portable-bitmap","pbm"],["image/x-portable-graymap","pgm"],["image/x-portable-greymap","pgm"],["image/x-portable-pixmap","ppm"],["image/x-quicktime",["qif","qti","qtif"]],["image/x-rgb","rgb"],["image/x-tiff",["tif","tiff"]],["image/x-windows-bmp","bmp"],["image/x-xbitmap","xbm"],["image/x-xbm","xbm"],["image/x-xpixmap",["xpm","pm"]],["image/x-xwd","xwd"],["image/x-xwindowdump","xwd"],["image/xbm","xbm"],["image/xpm","xpm"],["message/rfc822",["eml","mht","mhtml","nws","mime"]],["model/iges",["iges","igs"]],["model/mesh","msh"],["model/vnd.collada+xml","dae"],["model/vnd.dwf","dwf"],["model/vnd.gdl","gdl"],["model/vnd.gtw","gtw"],["model/vnd.mts","mts"],["model/vnd.vtu","vtu"],["model/vrml",["vrml","wrl","wrz"]],["model/x-pov","pov"],["multipart/x-gzip","gzip"],["multipart/x-ustar","ustar"],["multipart/x-zip","zip"],["music/crescendo",["mid","midi"]],["music/x-karaoke","kar"],["paleovu/x-pv","pvu"],["text/asp","asp"],["text/calendar","ics"],["text/css","css"],["text/csv","csv"],["text/ecmascript","js"],["text/h323","323"],["text/html",["html","htm","stm","acgi","htmls","htx","shtml"]],["text/iuls","uls"],["text/javascript","js"],["text/mcf","mcf"],["text/n3","n3"],["text/pascal","pas"],["text/plain",["txt","bas","c","h","c++","cc","com","conf","cxx","def","f","f90","for","g","hh","idc","jav","java","list","log","lst","m","mar","pl","sdml","text"]],["text/plain-bas","par"],["text/prs.lines.tag","dsc"],["text/richtext",["rtx","rt","rtf"]],["text/scriplet","wsc"],["text/scriptlet","sct"],["text/sgml",["sgm","sgml"]],["text/tab-separated-values","tsv"],["text/troff","t"],["text/turtle","ttl"],["text/uri-list",["uni","unis","uri","uris"]],["text/vnd.abc","abc"],["text/vnd.curl","curl"],["text/vnd.curl.dcurl","dcurl"],["text/vnd.curl.mcurl","mcurl"],["text/vnd.curl.scurl","scurl"],["text/vnd.fly","fly"],["text/vnd.fmi.flexstor","flx"],["text/vnd.graphviz","gv"],["text/vnd.in3d.3dml","3dml"],["text/vnd.in3d.spot","spot"],["text/vnd.rn-realtext","rt"],["text/vnd.sun.j2me.app-descriptor","jad"],["text/vnd.wap.wml","wml"],["text/vnd.wap.wmlscript","wmls"],["text/webviewhtml","htt"],["text/x-asm",["asm","s"]],["text/x-audiosoft-intra","aip"],["text/x-c",["c","cc","cpp"]],["text/x-component","htc"],["text/x-fortran",["for","f","f77","f90"]],["text/x-h",["h","hh"]],["text/x-java-source",["java","jav"]],["text/x-java-source,java","java"],["text/x-la-asf","lsx"],["text/x-m","m"],["text/x-pascal","p"],["text/x-script","hlb"],["text/x-script.csh","csh"],["text/x-script.elisp","el"],["text/x-script.guile","scm"],["text/x-script.ksh","ksh"],["text/x-script.lisp","lsp"],["text/x-script.perl","pl"],["text/x-script.perl-module","pm"],["text/x-script.phyton","py"],["text/x-script.rexx","rexx"],["text/x-script.scheme","scm"],["text/x-script.sh","sh"],["text/x-script.tcl","tcl"],["text/x-script.tcsh","tcsh"],["text/x-script.zsh","zsh"],["text/x-server-parsed-html",["shtml","ssi"]],["text/x-setext","etx"],["text/x-sgml",["sgm","sgml"]],["text/x-speech",["spc","talk"]],["text/x-uil","uil"],["text/x-uuencode",["uu","uue"]],["text/x-vcalendar","vcs"],["text/x-vcard","vcf"],["text/xml","xml"],["video/3gpp","3gp"],["video/3gpp2","3g2"],["video/animaflex","afl"],["video/avi","avi"],["video/avs-video","avs"],["video/dl","dl"],["video/fli","fli"],["video/gl","gl"],["video/h261","h261"],["video/h263","h263"],["video/h264","h264"],["video/jpeg","jpgv"],["video/jpm","jpm"],["video/mj2","mj2"],["video/mp4","mp4"],["video/mpeg",["mpeg","mp2","mpa","mpe","mpg","mpv2","m1v","m2v","mp3"]],["video/msvideo","avi"],["video/ogg","ogv"],["video/quicktime",["mov","qt","moov"]],["video/vdo","vdo"],["video/vivo",["viv","vivo"]],["video/vnd.dece.hd","uvh"],["video/vnd.dece.mobile","uvm"],["video/vnd.dece.pd","uvp"],["video/vnd.dece.sd","uvs"],["video/vnd.dece.video","uvv"],["video/vnd.fvt","fvt"],["video/vnd.mpegurl","mxu"],["video/vnd.ms-playready.media.pyv","pyv"],["video/vnd.rn-realvideo","rv"],["video/vnd.uvvu.mp4","uvu"],["video/vnd.vivo",["viv","vivo"]],["video/vosaic","vos"],["video/webm","webm"],["video/x-amt-demorun","xdr"],["video/x-amt-showrun","xsr"],["video/x-atomic3d-feature","fmf"],["video/x-dl","dl"],["video/x-dv",["dif","dv"]],["video/x-f4v","f4v"],["video/x-fli","fli"],["video/x-flv","flv"],["video/x-gl","gl"],["video/x-isvideo","isu"],["video/x-la-asf",["lsf","lsx"]],["video/x-m4v","m4v"],["video/x-motion-jpeg","mjpg"],["video/x-mpeg",["mp3","mp2"]],["video/x-mpeq2a","mp2"],["video/x-ms-asf",["asf","asr","asx"]],["video/x-ms-asf-plugin","asx"],["video/x-ms-wm","wm"],["video/x-ms-wmv","wmv"],["video/x-ms-wmx","wmx"],["video/x-ms-wvx","wvx"],["video/x-msvideo","avi"],["video/x-qtc","qtc"],["video/x-scm","scm"],["video/x-sgi-movie",["movie","mv"]],["windows/metafile","wmf"],["www/mime","mime"],["x-conference/x-cooltalk","ice"],["x-music/x-midi",["mid","midi"]],["x-world/x-3dmf",["3dm","3dmf","qd3","qd3d"]],["x-world/x-svr","svr"],["x-world/x-vrml",["flr","vrml","wrl","wrz","xaf","xof"]],["x-world/x-vrt","vrt"],["xgl/drawing","xgz"],["xgl/movie","xmz"]]),i=new Map([["123","application/vnd.lotus-1-2-3"],["323","text/h323"],["*","application/octet-stream"],["3dm","x-world/x-3dmf"],["3dmf","x-world/x-3dmf"],["3dml","text/vnd.in3d.3dml"],["3g2","video/3gpp2"],["3gp","video/3gpp"],["7z","application/x-7z-compressed"],["a","application/octet-stream"],["aab","application/x-authorware-bin"],["aac","audio/x-aac"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abc","text/vnd.abc"],["abw","application/x-abiword"],["ac","application/pkix-attr-cert"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acgi","text/html"],["acu","application/vnd.acucobol"],["acx","application/internet-property-stream"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afl","video/animaflex"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/postscript"],["aif",["audio/aiff","audio/x-aiff"]],["aifc",["audio/aiff","audio/x-aiff"]],["aiff",["audio/aiff","audio/x-aiff"]],["aim","application/x-aim"],["aip","text/x-audiosoft-intra"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["ani","application/x-navi-animation"],["aos","application/x-nokia-9000-communicator-add-on-software"],["apk","application/vnd.android.package-archive"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["aps","application/mime"],["arc","application/octet-stream"],["arj",["application/arj","application/octet-stream"]],["art","image/x-jg"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asp","text/asp"],["asr","video/x-ms-asf"],["asx",["video/x-ms-asf","application/x-mplayer2","video/x-ms-asf-plugin"]],["atc","application/vnd.acucorp"],["atomcat","application/atomcat+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au",["audio/basic","audio/x-au"]],["avi",["video/avi","video/msvideo","application/x-troff-msvideo","video/x-msvideo"]],["avs","video/avs-video"],["aw","application/applixware"],["axs","application/olescript"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azw","application/vnd.amazon.ebook"],["bas","text/plain"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin",["application/octet-stream","application/mac-binary","application/macbinary","application/x-macbinary","application/x-binary"]],["bm","image/bmp"],["bmi","application/vnd.bmi"],["bmp",["image/bmp","image/x-windows-bmp"]],["boo","application/book"],["book","application/book"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bsh","application/x-bsh"],["btif","image/prs.btif"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c",["text/plain","text/x-c"]],["c++","text/plain"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["c4g","application/vnd.clonk.c4group"],["cab","application/vnd.ms-cab-compressed"],["car","application/vnd.curl.car"],["cat",["application/vnd.ms-pkiseccat","application/vnd.ms-pki.seccat"]],["cc",["text/plain","text/x-c"]],["ccad","application/clariscad"],["cco","application/x-cocoa"],["ccxml","application/ccxml+xml,"],["cdbcmsg","application/vnd.contact.cmsg"],["cdf",["application/cdf","application/x-cdf","application/x-netcdf"]],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer",["application/pkix-cert","application/x-x509-ca-cert"]],["cgm","image/cgm"],["cha","application/x-chat"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cla","application/vnd.claymore"],["class",["application/octet-stream","application/java","application/java-byte-code","application/java-vm","application/x-java-class"]],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod",["image/cis-cod","application/vnd.rim.cod"]],["com",["application/octet-stream","text/plain"]],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt",["application/mac-compactpro","application/x-compactpro","application/x-cpt"]],["crd","application/x-mscardfile"],["crl",["application/pkix-crl","application/pkcs-crl"]],["crt",["application/pkix-cert","application/x-x509-user-cert","application/x-x509-ca-cert"]],["cryptonote","application/vnd.rig.cryptonote"],["csh",["text/x-script.csh","application/x-csh"]],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["css",["text/css","application/x-pointplus"]],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxx","text/plain"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["davmount","application/davmount+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["deb","application/x-debian-package"],["deepv","application/x-deepv"],["def","text/plain"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dif","video/x-dv"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["djvu","image/vnd.djvu"],["dl",["video/dl","video/x-dl"]],["dll","application/x-msdownload"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.document.macroenabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroenabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp",["application/commonground","application/vnd.osgi.dp"]],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drw","application/drafting"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dv","video/x-dv"],["dvi","application/x-dvi"],["dwf",["model/vnd.dwf","drawing/x-dwf"]],["dwg",["application/acad","image/vnd.dwg","image/x-dwg"]],["dxf",["application/dxf","image/vnd.dwg","image/vnd.dxf","image/x-dwg"]],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["el","text/x-script.elisp"],["elc",["application/x-elc","application/x-bytecode.elisp"]],["eml","message/rfc822"],["emma","application/emma+xml"],["env","application/x-envoy"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es",["application/ecmascript","application/x-esrehber"]],["es3","application/vnd.eszigno3+xml"],["esf","application/vnd.epson.esf"],["etx","text/x-setext"],["evy",["application/envoy","application/x-envoy"]],["exe",["application/octet-stream","application/x-msdownload"]],["exi","application/exi"],["ext","application/vnd.novadigm.ext"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f",["text/plain","text/x-fortran"]],["f4v","video/x-f4v"],["f77","text/x-fortran"],["f90",["text/plain","text/x-fortran"]],["fbs","image/vnd.fastbidsheet"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fh","image/x-freehand"],["fif",["application/fractals","image/fif"]],["fig","application/x-xfig"],["fli",["video/fli","video/x-fli"]],["flo",["image/florian","application/vnd.micrografx.flo"]],["flr","x-world/x-vrml"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fmf","video/x-atomic3d-feature"],["fnc","application/vnd.frogans.fnc"],["for",["text/plain","text/x-fortran"]],["fpx",["image/vnd.fpx","image/vnd.net-fpx"]],["frl","application/freeloader"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["funk","audio/make"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g","text/plain"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gdl","model/vnd.gdl"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["gl",["video/gl","video/x-gl"]],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gph","application/vnd.flographit"],["gqf","application/vnd.grafeq"],["gram","application/srgs"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsd","audio/x-gsm"],["gsf","application/x-font-ghostscript"],["gsm","audio/x-gsm"],["gsp","application/x-gsp"],["gss","application/x-gss"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxt","application/vnd.geonext"],["gz",["application/x-gzip","application/x-compressed"]],["gzip",["multipart/x-gzip","application/x-gzip"]],["h",["text/plain","text/x-h"]],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hdf","application/x-hdf"],["help","application/x-helpfile"],["hgl","application/vnd.hp-hpgl"],["hh",["text/plain","text/x-h"]],["hlb","text/x-script"],["hlp",["application/winhlp","application/hlp","application/x-helpfile","application/x-winhelp"]],["hpg","application/vnd.hp-hpgl"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx",["application/mac-binhex40","application/binhex","application/binhex4","application/mac-binhex","application/x-binhex40","application/x-mac-binhex40"]],["hta","application/hta"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["htmls","text/html"],["htt","text/webviewhtml"],["htx","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["ico","image/x-icon"],["ics","text/calendar"],["idc","text/plain"],["ief","image/ief"],["iefs","image/ief"],["ifm","application/vnd.shana.informed.formdata"],["iges",["application/iges","model/iges"]],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs",["application/iges","model/iges"]],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["iii","application/x-iphone"],["ima","application/x-ima"],["imap","application/x-httpd-imap"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["inf","application/inf"],["ins",["application/x-internet-signup","application/x-internett-signup"]],["ip","application/x-ip2"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["isp","application/x-internet-signup"],["isu","video/x-isvideo"],["it","audio/it"],["itp","application/vnd.shana.informed.formtemplate"],["iv","application/x-inventor"],["ivp","application/vnd.immervision-ivp"],["ivr","i-world/i-vrml"],["ivu","application/vnd.immervision-ivu"],["ivy","application/x-livescreen"],["jad","text/vnd.sun.j2me.app-descriptor"],["jam",["application/vnd.jam","audio/x-jam"]],["jar","application/java-archive"],["jav",["text/plain","text/x-java-source"]],["java",["text/plain","text/x-java-source,java","text/x-java-source"]],["jcm","application/x-java-commerce"],["jfif",["image/pipeg","image/jpeg","image/pjpeg"]],["jfif-tbnl","image/jpeg"],["jisp","application/vnd.jisp"],["jlt","application/vnd.hp-jlyt"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jpe",["image/jpeg","image/pjpeg"]],["jpeg",["image/jpeg","image/pjpeg"]],["jpg",["image/jpeg","image/pjpeg"]],["jpgv","video/jpeg"],["jpm","video/jpm"],["jps","image/x-jps"],["js",["application/javascript","application/ecmascript","text/javascript","text/ecmascript","application/x-javascript"]],["json","application/json"],["jut","image/jutvision"],["kar",["audio/midi","music/x-karaoke"]],["karbon","application/vnd.kde.karbon"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["ksh",["application/x-ksh","text/x-script.ksh"]],["ksp","application/vnd.kde.kspread"],["ktx","image/ktx"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["la",["audio/nspaudio","audio/x-nspaudio"]],["lam","audio/x-liveaudio"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["lha",["application/octet-stream","application/lha","application/x-lha"]],["lhx","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["lma",["audio/nspaudio","audio/x-nspaudio"]],["log","text/plain"],["lrm","application/vnd.ms-lrm"],["lsf","video/x-la-asf"],["lsp",["application/x-lisp","text/x-script.lisp"]],["lst","text/plain"],["lsx",["video/x-la-asf","text/x-la-asf"]],["ltf","application/vnd.frogans.ltf"],["ltx","application/x-latex"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh",["application/octet-stream","application/x-lzh"]],["lzx",["application/lzx","application/octet-stream","application/x-lzx"]],["m",["text/plain","text/x-m"]],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m1v","video/mpeg"],["m21","application/mp21"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3u",["audio/x-mpegurl","audio/x-mpequrl"]],["m3u8","application/vnd.apple.mpegurl"],["m4v","video/x-m4v"],["ma","application/mathematica"],["mads","application/mads+xml"],["mag","application/vnd.ecowin.chart"],["man","application/x-troff-man"],["map","application/x-navimap"],["mar","text/plain"],["mathml","application/mathml+xml"],["mbd","application/mbedlet"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc$","application/x-magic-cap-package-1.0"],["mc1","application/vnd.medcalcdata"],["mcd",["application/mcad","application/vnd.mcd","application/x-mathcad"]],["mcf",["image/vasa","text/mcf"]],["mcp","application/netmc"],["mcurl","text/vnd.curl.mcurl"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["me","application/x-troff-me"],["meta4","application/metalink4+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mht","message/rfc822"],["mhtml","message/rfc822"],["mid",["audio/mid","audio/midi","music/crescendo","x-music/x-midi","audio/x-midi","application/x-midi","audio/x-mid"]],["midi",["audio/midi","music/crescendo","x-music/x-midi","audio/x-midi","application/x-midi","audio/x-mid"]],["mif",["application/vnd.mif","application/x-mif","application/x-frame"]],["mime",["message/rfc822","www/mime"]],["mj2","video/mj2"],["mjf","audio/x-vnd.audioexplosion.mjuicemediafile"],["mjpg","video/x-motion-jpeg"],["mlp","application/vnd.dolby.mlp"],["mm",["application/base64","application/x-meme"]],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mme","application/base64"],["mmf","application/vnd.smaf"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mny","application/x-msmoney"],["mod",["audio/mod","audio/x-mod"]],["mods","application/mods+xml"],["moov","video/quicktime"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2",["video/mpeg","audio/mpeg","video/x-mpeg","audio/x-mpeg","video/x-mpeq2a"]],["mp3",["audio/mpeg","audio/mpeg3","video/mpeg","audio/x-mpeg-3","video/x-mpeg"]],["mp4",["video/mp4","application/mp4"]],["mp4a","audio/mp4"],["mpa",["video/mpeg","audio/mpeg"]],["mpc",["application/vnd.mophun.certificate","application/x-project"]],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg",["video/mpeg","audio/mpeg"]],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/x-project"],["mpv","application/x-project"],["mpv2","video/mpeg"],["mpx","application/x-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","application/x-troff-ms"],["mscml","application/mediaservercontrol+xml"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msl","application/vnd.mobius.msl"],["msty","application/vnd.muvee.style"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musicxml","application/vnd.recordare.musicxml+xml"],["mv","video/x-sgi-movie"],["mvb","application/x-msmediaview"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["my","audio/make"],["mzz","application/x-vnd.audioexplosion.mzz"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nap","image/naplps"],["naplps","image/naplps"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncm","application/vnd.nokia.configuration-message"],["ncx","application/x-dtbncx+xml"],["ngdat","application/vnd.nokia.n-gage.data"],["nif","image/x-niff"],["niff","image/x-niff"],["nix","application/x-mix-transfer"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nvd","application/x-navidoc"],["nws","message/rfc822"],["o","application/octet-stream"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omc","application/x-omc"],["omcd","application/x-omcdatamaker"],["omcr","application/x-omcregerator"],["onetoc","application/onenote"],["opf","application/oebps-package+xml"],["org","application/vnd.lotus-organizer"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","application/x-font-otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p10",["application/pkcs10","application/x-pkcs10"]],["p12",["application/pkcs-12","application/x-pkcs12"]],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c",["application/pkcs7-mime","application/x-pkcs7-mime"]],["p7m",["application/pkcs7-mime","application/x-pkcs7-mime"]],["p7r","application/x-pkcs7-certreqresp"],["p7s",["application/pkcs7-signature","application/x-pkcs7-signature"]],["p8","application/pkcs8"],["par","text/plain-bas"],["part","application/pro_eng"],["pas","text/pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcf","application/x-font-pcf"],["pcl",["application/vnd.hp-pcl","application/x-pcl"]],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb",["application/vnd.palm","chemical/x-pdb"]],["pdf","application/pdf"],["pfa","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfunk",["audio/make","audio/make.my.funk"]],["pfx","application/x-pkcs12"],["pgm",["image/x-portable-graymap","image/x-portable-greymap"]],["pgn","application/x-chess-pgn"],["pgp","application/pgp-signature"],["pic",["image/pict","image/x-pict"]],["pict","image/pict"],["pkg","application/x-newton-compatible-pkg"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pko",["application/ynd.ms-pkipko","application/vnd.ms-pki.pko"]],["pl",["text/plain","text/x-script.perl"]],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["plx","application/x-pixclscript"],["pm",["text/x-script.perl-module","image/x-xpixmap"]],["pm4","application/x-pagemaker"],["pm5","application/x-pagemaker"],["pma","application/x-perfmon"],["pmc","application/x-perfmon"],["pml",["application/vnd.ctc-posml","application/x-perfmon"]],["pmr","application/x-perfmon"],["pmw","application/x-perfmon"],["png","image/png"],["pnm",["application/x-portable-anymap","image/x-portable-anymap"]],["portpkg","application/vnd.macports.portpkg"],["pot",["application/vnd.ms-powerpoint","application/mspowerpoint"]],["potm","application/vnd.ms-powerpoint.template.macroenabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["pov","model/x-pov"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroenabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps",["application/vnd.ms-powerpoint","application/mspowerpoint"]],["ppsm","application/vnd.ms-powerpoint.slideshow.macroenabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt",["application/vnd.ms-powerpoint","application/mspowerpoint","application/powerpoint","application/x-mspowerpoint"]],["pptm","application/vnd.ms-powerpoint.presentation.macroenabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["ppz","application/mspowerpoint"],["prc","application/x-mobipocket-ebook"],["pre",["application/vnd.lotus-freelance","application/x-freelance"]],["prf","application/pics-rules"],["prt","application/pro_eng"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd",["application/octet-stream","image/vnd.adobe.photoshop"]],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pvu","paleovu/x-pv"],["pwn","application/vnd.3m.post-it-notes"],["pwz","application/vnd.ms-powerpoint"],["py","text/x-script.phyton"],["pya","audio/vnd.ms-playready.media.pya"],["pyc","application/x-bytecode.python"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qcp","audio/vnd.qcelp"],["qd3","x-world/x-3dmf"],["qd3d","x-world/x-3dmf"],["qfx","application/vnd.intu.qfx"],["qif","image/x-quicktime"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qtc","video/x-qtc"],["qti","image/x-quicktime"],["qtif","image/x-quicktime"],["qxd","application/vnd.quark.quarkxpress"],["ra",["audio/x-realaudio","audio/x-pn-realaudio","audio/x-pn-realaudio-plugin"]],["ram","audio/x-pn-realaudio"],["rar","application/x-rar-compressed"],["ras",["image/cmu-raster","application/x-cmu-raster","image/x-cmu-raster"]],["rast","image/cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rexx","text/x-script.rexx"],["rf","image/vnd.rn-realflash"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm",["application/vnd.rn-realmedia","audio/x-pn-realaudio"]],["rmi","audio/mid"],["rmm","audio/x-pn-realaudio"],["rmp",["audio/x-pn-realaudio-plugin","audio/x-pn-realaudio"]],["rms","application/vnd.jcp.javame.midlet-rms"],["rnc","application/relax-ng-compact-syntax"],["rng",["application/ringing-tones","application/vnd.nokia.ringing-tone"]],["rnx","application/vnd.rn-realplayer"],["roff","application/x-troff"],["rp","image/vnd.rn-realpix"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsd","application/rsd+xml"],["rt",["text/richtext","text/vnd.rn-realtext"]],["rtf",["application/rtf","text/richtext","application/x-rtf"]],["rtx",["text/richtext","application/rtf"]],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["saveme","application/octet-stream"],["sbk","application/x-tbook"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm",["application/vnd.lotus-screencam","video/x-scm","text/x-script.guile","application/x-lotusscreencam","text/x-script.scheme"]],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["sct","text/scriptlet"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkm","application/vnd.solent.sdkm+xml"],["sdml","text/plain"],["sdp",["application/sdp","application/x-sdp"]],["sdr","application/sounder"],["sdw","application/vnd.stardivision.writer"],["sea",["application/sea","application/x-sea"]],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["ser","application/java-serialized-object"],["set","application/set"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sgl","application/vnd.stardivision.writer-global"],["sgm",["text/sgml","text/x-sgml"]],["sgml",["text/sgml","text/x-sgml"]],["sh",["application/x-shar","application/x-bsh","application/x-sh","text/x-script.sh"]],["shar",["application/x-bsh","application/x-shar"]],["shf","application/shf+xml"],["shtml",["text/html","text/x-server-parsed-html"]],["sid","audio/x-psid"],["sis","application/vnd.symbian.install"],["sit",["application/x-stuffit","application/x-sit"]],["sitx","application/x-stuffitx"],["skd","application/x-koan"],["skm","application/x-koan"],["skp",["application/vnd.koan","application/x-koan"]],["skt","application/x-koan"],["sl","application/x-seelogo"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi",["application/smil","application/smil+xml"]],["smil","application/smil"],["snd",["audio/basic","audio/x-adpcm"]],["snf","application/x-font-snf"],["sol","application/solids"],["spc",["text/x-speech","application/x-pkcs7-certificates"]],["spf","application/vnd.yamaha.smaf-phrase"],["spl",["application/futuresplash","application/x-futuresplash"]],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spr","application/x-sprite"],["sprite","application/x-sprite"],["src","application/x-wais-source"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssi","text/x-server-parsed-html"],["ssm","application/streamingmedia"],["ssml","application/ssml+xml"],["sst",["application/vnd.ms-pkicertstore","application/vnd.ms-pki.certstore"]],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["step","application/step"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl",["application/vnd.ms-pkistl","application/sla","application/vnd.ms-pki.stl","application/x-navistyle"]],["stm","text/html"],["stp","application/step"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["sub","image/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svf",["image/vnd.dwg","image/x-dwg"]],["svg","image/svg+xml"],["svr",["x-world/x-svr","application/x-world"]],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t",["text/troff","application/x-troff"]],["talk","text/x-speech"],["tao","application/vnd.tao.intent-module-archive"],["tar","application/x-tar"],["tbk",["application/toolbook","application/x-tbook"]],["tcap","application/vnd.3gpp2.tcap"],["tcl",["text/x-script.tcl","application/x-tcl"]],["tcsh","text/x-script.tcsh"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text",["application/plain","text/plain"]],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tgz",["application/gnutar","application/x-compressed"]],["thmx","application/vnd.ms-officetheme"],["tif",["image/tiff","image/x-tiff"]],["tiff",["image/tiff","image/x-tiff"]],["tmo","application/vnd.tmobile-livetv"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","application/x-troff"],["tra","application/vnd.trueapp"],["trm","application/x-msterminal"],["tsd","application/timestamped-data"],["tsi","audio/tsp-audio"],["tsp",["application/dsptype","audio/tsplayer"]],["tsv","text/tab-separated-values"],["ttf","application/x-font-ttf"],["ttl","text/turtle"],["turbot","image/florian"],["twd","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["ufd","application/vnd.ufdl"],["uil","text/x-uil"],["uls","text/iuls"],["umj","application/vnd.umajin"],["uni","text/uri-list"],["unis","text/uri-list"],["unityweb","application/vnd.unity"],["unv","application/i-deas"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["ustar",["application/x-ustar","multipart/x-ustar"]],["utz","application/vnd.uiq.theme"],["uu",["application/octet-stream","text/x-uuencode"]],["uue","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vda","application/vda"],["vdo","video/vdo"],["vew","application/groupwise"],["vis","application/vnd.visionary"],["viv",["video/vivo","video/vnd.vivo"]],["vivo",["video/vivo","video/vnd.vivo"]],["vmd","application/vocaltec-media-desc"],["vmf","application/vocaltec-media-file"],["voc",["audio/voc","audio/x-voc"]],["vos","video/vosaic"],["vox","audio/voxware"],["vqe","audio/x-twinvq-plugin"],["vqf","audio/x-twinvq"],["vql","audio/x-twinvq-plugin"],["vrml",["model/vrml","x-world/x-vrml","application/x-vrml"]],["vrt","x-world/x-vrt"],["vsd",["application/vnd.visio","application/x-visio"]],["vsf","application/vnd.vsf"],["vst","application/x-visio"],["vsw","application/x-visio"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w60","application/wordperfect6.0"],["w61","application/wordperfect6.1"],["w6w","application/msword"],["wad","application/x-doom"],["wav",["audio/wav","audio/x-wav"]],["wax","audio/x-ms-wax"],["wb1","application/x-qpro"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/vnd.wap.wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["web","application/vnd.xara"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wiz","application/msword"],["wk1","application/x-123"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf",["windows/metafile","application/x-msmetafile"]],["wml","text/vnd.wap.wml"],["wmlc","application/vnd.wap.wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-ms-wmz"],["woff","application/x-font-woff"],["word","application/msword"],["wp","application/wordperfect"],["wp5",["application/wordperfect","application/wordperfect6.0"]],["wp6","application/wordperfect"],["wpd",["application/wordperfect","application/vnd.wordperfect","application/x-wpwin"]],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wq1","application/x-lotus"],["wqd","application/vnd.wqd"],["wri",["application/mswrite","application/x-wri","application/x-mswrite"]],["wrl",["model/vrml","x-world/x-vrml","application/x-world"]],["wrz",["model/vrml","x-world/x-vrml"]],["wsc","text/scriplet"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wsrc","application/x-wais-source"],["wtb","application/vnd.webturbo"],["wtk","application/x-wintalk"],["wvx","video/x-ms-wvx"],["x-png","image/png"],["x3d","application/vnd.hzn-3d-crossword"],["xaf","x-world/x-vrml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm",["image/xbm","image/x-xbm","image/x-xbitmap"]],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdr","video/x-amt-demorun"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xgz","xgl/drawing"],["xhtml","application/xhtml+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla",["application/vnd.ms-excel","application/excel","application/x-msexcel","application/x-excel"]],["xlam","application/vnd.ms-excel.addin.macroenabled.12"],["xlb",["application/excel","application/vnd.ms-excel","application/x-excel"]],["xlc",["application/vnd.ms-excel","application/excel","application/x-excel"]],["xld",["application/excel","application/x-excel"]],["xlk",["application/excel","application/x-excel"]],["xll",["application/excel","application/vnd.ms-excel","application/x-excel"]],["xlm",["application/vnd.ms-excel","application/excel","application/x-excel"]],["xls",["application/vnd.ms-excel","application/excel","application/x-msexcel","application/x-excel"]],["xlsb","application/vnd.ms-excel.sheet.binary.macroenabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroenabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt",["application/vnd.ms-excel","application/excel","application/x-excel"]],["xltm","application/vnd.ms-excel.template.macroenabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlv",["application/excel","application/x-excel"]],["xlw",["application/vnd.ms-excel","application/excel","application/x-msexcel","application/x-excel"]],["xm","audio/xm"],["xml",["application/xml","text/xml","application/atom+xml","application/rss+xml"]],["xmz","xgl/movie"],["xo","application/vnd.olpc-sugar"],["xof","x-world/x-vrml"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpix","application/x-vnd.ls-xpix"],["xpm",["image/xpm","image/x-xpixmap"]],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xsr","video/x-amt-showrun"],["xul","application/vnd.mozilla.xul+xml"],["xwd",["image/x-xwd","image/x-xwindowdump"]],["xyz",["chemical/x-xyz","chemical/x-pdb"]],["yang","application/yang"],["yin","application/yin+xml"],["z",["application/x-compressed","application/x-compress"]],["zaz","application/vnd.zzazz.deck+xml"],["zip",["application/zip","multipart/x-zip","application/x-zip-compressed","application/x-compressed"]],["zir","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zoo","application/octet-stream"],["zsh","text/x-script.zsh"]]);return mimeTypes_1={detectMimeType(n){if(!n)return t;let r=e.parse(n),o=(r.ext.substr(1)||r.name||"").split("?").shift().trim().toLowerCase(),a=t;return i.has(o)&&(a=i.get(o)),Array.isArray(a)?a[0]:a},detectExtension(e){if(!e)return"bin";let t=(e||"").toLowerCase().trim().split("/"),i=t.shift().trim(),r=t.join("/").trim();if(n.has(i+"/"+r)){let e=n.get(i+"/"+r);return Array.isArray(e)?e[0]:e}return"text"===i?"txt":"bin"}}}function requirePunycode(){if(hasRequiredPunycode)return punycode_1;hasRequiredPunycode=1;const e=2147483647,t=36,n=/^xn--/,i=/[^\0-\x7F]/,r=/[\x2E\u3002\uFF0E\uFF61]/g,o={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},a=Math.floor,s=String.fromCharCode;function c(e){throw new RangeError(o[e])}function l(e,t){const n=e.split("@");let i="";n.length>1&&(i=n[0]+"@",e=n[1]);const o=function(e,t){const n=[];let i=e.length;for(;i--;)n[i]=t(e[i]);return n}((e=e.replace(r,".")).split("."),t).join(".");return i+o}function d(e){const t=[];let n=0;const i=e.length;for(;n<i;){const r=e.charCodeAt(n++);if(r>=55296&&r<=56319&&n<i){const i=e.charCodeAt(n++);56320==(64512&i)?t.push(((1023&r)<<10)+(1023&i)+65536):(t.push(r),n--)}else t.push(r)}return t}const u=function(e){return e>=48&&e<58?e-48+26:e>=65&&e<91?e-65:e>=97&&e<123?e-97:t},p=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},m=function(e,n,i){let r=0;for(e=i?a(e/700):e>>1,e+=a(e/n);e>455;r+=t)e=a(e/35);return a(r+36*e/(e+38))},h=function(n){const i=[],r=n.length;let o=0,s=128,l=72,d=n.lastIndexOf("-");d<0&&(d=0);for(let e=0;e<d;++e)n.charCodeAt(e)>=128&&c("not-basic"),i.push(n.charCodeAt(e));for(let p=d>0?d+1:0;p<r;){const d=o;for(let i=1,s=t;;s+=t){p>=r&&c("invalid-input");const d=u(n.charCodeAt(p++));d>=t&&c("invalid-input"),d>a((e-o)/i)&&c("overflow"),o+=d*i;const m=s<=l?1:s>=l+26?26:s-l;if(d<m)break;const h=t-m;i>a(e/h)&&c("overflow"),i*=h}const h=i.length+1;l=m(o-d,h,0==d),a(o/h)>e-s&&c("overflow"),s+=a(o/h),o%=h,i.splice(o++,0,s)}return String.fromCodePoint(...i)},f=function(n){const i=[],r=(n=d(n)).length;let o=128,l=0,u=72;for(const e of n)e<128&&i.push(s(e));const h=i.length;let f=h;for(h&&i.push("-");f<r;){let r=e;for(const e of n)e>=o&&e<r&&(r=e);const d=f+1;r-o>a((e-l)/d)&&c("overflow"),l+=(r-o)*d,o=r;for(const r of n)if(r<o&&++l>e&&c("overflow"),r===o){let e=l;for(let n=t;;n+=t){const r=n<=u?1:n>=u+26?26:n-u;if(e<r)break;const o=e-r,c=t-r;i.push(s(p(r+o%c,0))),e=a(o/c)}i.push(s(p(e,0))),u=m(l,d,f===h),l=0,++f}++l,++o}return i.join("")};return punycode_1={version:"2.3.1",ucs2:{decode:d,encode:e=>String.fromCodePoint(...e)},decode:h,encode:f,toASCII:function(e){return l(e,function(e){return i.test(e)?"xn--"+f(e):e})},toUnicode:function(e){return l(e,function(e){return n.test(e)?h(e.slice(4).toLowerCase()):e})}}}function requireBase64(){if(hasRequiredBase64)return base64;hasRequiredBase64=1;const e=require$$0$4.Transform;function t(e){return"string"==typeof e&&(e=Buffer.from(e,"utf-8")),e.toString("base64")}function n(e,t){if(t=t||76,(e=(e||"").toString()).length<=t)return e;let n=[],i=0,r=1024*t;for(;i<e.length;){let o=e.substr(i,r).replace(new RegExp(".{"+t+"}","g"),"$&\r\n").trim();n.push(o),i+=r}return n.join("\r\n").trim()}return base64={encode:t,wrap:n,Encoder:class extends e{constructor(e){super(),this.options=e||{},!1!==this.options.lineLength&&(this.options.lineLength=this.options.lineLength||76),this._curLine="",this._remainingBytes=!1,this.inputBytes=0,this.outputBytes=0}_transform(e,i,r){if("buffer"!==i&&(e=Buffer.from(e,i)),!e||!e.length)return setImmediate(r);this.inputBytes+=e.length,this._remainingBytes&&this._remainingBytes.length&&(e=Buffer.concat([this._remainingBytes,e],this._remainingBytes.length+e.length),this._remainingBytes=!1),e.length%3?(this._remainingBytes=e.slice(e.length-e.length%3),e=e.slice(0,e.length-e.length%3)):this._remainingBytes=!1;let o=this._curLine+t(e);if(this.options.lineLength){o=n(o,this.options.lineLength);let e=o.lastIndexOf("\n");e<0?(this._curLine=o,o=""):e===o.length-1?this._curLine="":(this._curLine=o.substr(e+1),o=o.substr(0,e+1))}o&&(this.outputBytes+=o.length,this.push(Buffer.from(o,"ascii"))),setImmediate(r)}_flush(e){this._remainingBytes&&this._remainingBytes.length&&(this._curLine+=t(this._remainingBytes)),this._curLine&&(this._curLine=n(this._curLine,this.options.lineLength),this.outputBytes+=this._curLine.length,this.push(this._curLine,"ascii"),this._curLine=""),e()}}}}function requireQp(){if(hasRequiredQp)return qp;hasRequiredQp=1;const e=require$$0$4.Transform;function t(e){"string"==typeof e&&(e=Buffer.from(e,"utf-8"));let t,n=[[9],[10],[13],[32,60],[62,126]],r="";for(let o=0,a=e.length;o<a;o++)t=e[o],i(t,n)&&(32!==t&&9!==t||o!==a-1&&10!==e[o+1]&&13!==e[o+1])?r+=String.fromCharCode(t):r+="="+(t<16?"0":"")+t.toString(16).toUpperCase();return r}function n(e,t){if(t=t||76,(e=(e||"").toString()).length<=t)return e;let n,i,r,o=0,a=e.length,s=Math.floor(t/3),c="";for(;o<a;)if(r=e.substr(o,t),n=r.match(/\r\n/))r=r.substr(0,n.index+n[0].length),c+=r,o+=r.length;else if("\n"!==r.substr(-1))if(n=r.substr(-s).match(/\n.*?$/))r=r.substr(0,r.length-(n[0].length-1)),c+=r,o+=r.length;else{if(r.length>t-s&&(n=r.substr(-s).match(/[ \t.,!?][^ \t.,!?]*$/)))r=r.substr(0,r.length-(n[0].length-1));else if(r.match(/[=][\da-f]{0,2}$/i))for((n=r.match(/[=][\da-f]{0,1}$/i))&&(r=r.substr(0,r.length-n[0].length));r.length>3&&r.length<a-o&&!r.match(/^(?:=[\da-f]{2}){1,4}$/i)&&(n=r.match(/[=][\da-f]{2}$/gi))&&(i=parseInt(n[0].substr(1,2),16),!(i<128))&&(r=r.substr(0,r.length-3),!(i>=192)););o+r.length<a&&"\n"!==r.substr(-1)?(r.length===t&&r.match(/[=][\da-f]{2}$/i)?r=r.substr(0,r.length-3):r.length===t&&(r=r.substr(0,r.length-1)),o+=r.length,r+="=\r\n"):o+=r.length,c+=r}else c+=r,o+=r.length;return c}function i(e,t){for(let n=t.length-1;n>=0;n--)if(t[n].length){if(1===t[n].length&&e===t[n][0])return!0;if(2===t[n].length&&e>=t[n][0]&&e<=t[n][1])return!0}return!1}return qp={encode:t,wrap:n,Encoder:class extends e{constructor(e){super(),this.options=e||{},!1!==this.options.lineLength&&(this.options.lineLength=this.options.lineLength||76),this._curLine="",this.inputBytes=0,this.outputBytes=0}_transform(e,i,r){let o;if("buffer"!==i&&(e=Buffer.from(e,i)),!e||!e.length)return r();this.inputBytes+=e.length,this.options.lineLength?(o=this._curLine+t(e),o=n(o,this.options.lineLength),o=o.replace(/(^|\n)([^\n]*)$/,(e,t,n)=>(this._curLine=n,t)),o&&(this.outputBytes+=o.length,this.push(o))):(o=t(e),this.outputBytes+=o.length,this.push(o,"ascii")),r()}_flush(e){this._curLine&&(this.outputBytes+=this._curLine.length,this.push(this._curLine,"ascii")),e()}}}}function requireMimeFuncs(){if(hasRequiredMimeFuncs)return mimeFuncs;hasRequiredMimeFuncs=1;const e=requireBase64(),t=requireQp(),n=requireMimeTypes();return mimeFuncs={isPlainText:(e,t)=>"string"==typeof e&&!(t?/[\x00-\x08\x0b\x0c\x0e-\x1f"\u0080-\uFFFF]/:/[\x00-\x08\x0b\x0c\x0e-\x1f\u0080-\uFFFF]/).test(e),hasLongerLines:(e,t)=>e.length>131072||new RegExp("^.{"+(t+1)+",}","m").test(e),encodeWord(n,i,r){let o;if((r=r||0)&&r>12&&(r-=12),"Q"===(i=(i||"Q").toString().toUpperCase().trim().charAt(0))?o=t.encode(n).replace(/[^a-z0-9!*+\-/=]/gi,e=>{let t=e.charCodeAt(0).toString(16).toUpperCase();return" "===e?"_":"="+(1===t.length?"0"+t:t)}):"B"===i&&(o="string"==typeof n?n:e.encode(n),r=r?Math.max(3,(r-r%4)/4*3):0),r&&("B"!==i?o:e.encode(n)).length>r)if("Q"===i)o=this.splitMimeEncodedString(o,r).join("?= =?UTF-8?"+i+"?");else{let t=[],n="";for(let i=0,a=o.length;i<a;i++){let s=o.charAt(i);/[\ud83c\ud83d\ud83e]/.test(s)&&i<a-1&&(s+=o.charAt(++i)),Buffer.byteLength(n+s)<=r||0===i?n+=s:(t.push(e.encode(n)),n=s)}n&&t.push(e.encode(n)),o=t.length>1?t.join("?= =?UTF-8?"+i+"?"):t.join("")}else"B"===i&&(o=e.encode(n));return"=?UTF-8?"+i+"?"+o+("?="===o.substr(-2)?"":"?=")},encodeWords(e,t,n,i){let r;n=n||0;let o=e.match(/(?:^|\s)([^\s]*["\u0080-\uFFFF])/);if(!o)return e;if(i)return this.encodeWord(e,t,n);let a=e.match(/(["\u0080-\uFFFF][^\s]*)[^"\u0080-\uFFFF]*$/);if(!a)return e;let s=o.index+(o[0].match(/[^\s]/)||{index:0}).index,c=a.index+(a[1]||"").length;return r=(s?e.substr(0,s):"")+this.encodeWord(e.substring(s,c),t||"Q",n)+(c<e.length?e.substr(c):""),r},buildHeaderValue(e){let t=[];return Object.keys(e.params||{}).forEach(n=>{let i=e.params[n];!this.isPlainText(i,!0)||i.length>=75?this.buildHeaderParam(n,i,50).forEach(e=>{/[\s"\\;:/=(),<>@[\]?]|^[-']|'$/.test(e.value)&&"*"!==e.key.substr(-1)?t.push(e.key+"="+JSON.stringify(e.value)):t.push(e.key+"="+e.value)}):/[\s'"\\;:/=(),<>@[\]?]|^-/.test(i)?t.push(n+"="+JSON.stringify(i)):t.push(n+"="+i)}),e.value+(t.length?"; "+t.join("; "):"")},buildHeaderParam(e,t,n){let i,r,o,a,s,c,l=[],d="string"==typeof t?t:(t||"").toString(),u=0;if(n=n||50,this.isPlainText(t,!0)){if(d.length<=n)return[{key:e,value:d}];d=d.replace(new RegExp(".{"+n+"}","g"),e=>(l.push({line:e}),"")),d&&l.push({line:d})}else{if(/[\uD800-\uDBFF]/.test(d)){for(i=[],s=0,c=d.length;s<c;s++)r=d.charAt(s),o=r.charCodeAt(0),o>=55296&&o<=56319&&s<c-1?(r+=d.charAt(s+1),i.push(r),s++):i.push(r);d=i}a="utf-8''";let e=!0;for(u=0,s=0,c=d.length;s<c;s++){if(r=d[s],e)r=this.safeEncodeURIComponent(r);else if(r=" "===r?r:this.safeEncodeURIComponent(r),r!==d[s]){if(!((this.safeEncodeURIComponent(a)+r).length>=n)){e=!0,s=u,a="";continue}l.push({line:a,encoded:e}),a="",u=s-1}(a+r).length>=n?(l.push({line:a,encoded:e}),a=r=" "===d[s]?" ":this.safeEncodeURIComponent(d[s]),r===d[s]?(e=!1,u=s-1):e=!0):a+=r}a&&l.push({line:a,encoded:e})}return l.map((t,n)=>({key:e+"*"+n+(t.encoded?"*":""),value:t.line}))},parseHeaderValue(e){let t,n={value:!1,params:{}},i=!1,r="",o="value",a=!1,s=!1;for(let c=0,l=e.length;c<l;c++)if(t=e.charAt(c),"key"===o){if("="===t){i=r.trim().toLowerCase(),o="value",r="";continue}r+=t}else{if(s)r+=t;else{if("\\"===t){s=!0;continue}a&&t===a?a=!1:a||'"'!==t?a||";"!==t?r+=t:(!1===i?n.value=r.trim():n.params[i]=r.trim(),o="key",r=""):a=t}s=!1}return"value"===o?!1===i?n.value=r.trim():n.params[i]=r.trim():r.trim()&&(n.params[r.trim().toLowerCase()]=""),Object.keys(n.params).forEach(e=>{let t,i,r,o;(r=e.match(/(\*(\d+)|\*(\d+)\*|\*)$/))&&(t=e.substr(0,r.index),i=Number(r[2]||r[3])||0,n.params[t]&&"object"==typeof n.params[t]||(n.params[t]={charset:!1,values:[]}),o=n.params[e],0===i&&"*"===r[0].substr(-1)&&(r=o.match(/^([^']*)'[^']*'(.*)$/))&&(n.params[t].charset=r[1]||"iso-8859-1",o=r[2]),n.params[t].values[i]=o,delete n.params[e])}),Object.keys(n.params).forEach(e=>{let t;n.params[e]&&Array.isArray(n.params[e].values)&&(t=n.params[e].values.map(e=>e||"").join(""),n.params[e].charset?n.params[e]="=?"+n.params[e].charset+"?Q?"+t.replace(/[=?_\s]/g,e=>{let t=e.charCodeAt(0).toString(16);return" "===e?"_":"%"+(t.length<2?"0":"")+t}).replace(/%/g,"=")+"?=":n.params[e]=t)}),n},detectExtension:e=>n.detectExtension(e),detectMimeType:e=>n.detectMimeType(e),foldLines(e,t,n){t=t||76;let i,r,o=0,a=(e=(e||"").toString()).length,s="";for(;o<a;){if(i=e.substr(o,t),i.length<t){s+=i;break}(r=i.match(/^[^\n\r]*(\r?\n|\r)/))?(i=r[0],s+=i,o+=i.length):((r=i.match(/(\s+)[^\s]*$/))&&r[0].length-(n?(r[1]||"").length:0)<i.length?i=i.substr(0,i.length-(r[0].length-(n?(r[1]||"").length:0))):(r=e.substr(o+i.length).match(/^[^\s]+(\s*)/))&&(i+=r[0].substr(0,r[0].length-(n?0:(r[1]||"").length))),s+=i,o+=i.length,o<a&&(s+="\r\n"))}return s},splitMimeEncodedString:(e,t)=>{let n,i,r,o,a=[];for(t=Math.max(t||0,12);e.length;){for(n=e.substr(0,t),(i=n.match(/[=][0-9A-F]?$/i))&&(n=n.substr(0,i.index)),o=!1;!o;)o=!0,(i=e.substr(n.length).match(/^[=]([0-9A-F]{2})/i))&&(r=parseInt(i[1],16),r<194&&r>127&&(n=n.substr(0,n.length-3),o=!1));n.length&&a.push(n),e=e.substr(n.length)}return a},encodeURICharComponent:e=>{let t="",n=e.charCodeAt(0).toString(16).toUpperCase();if(n.length%2&&(n="0"+n),n.length>2)for(let e=0,i=n.length/2;e<i;e++)t+="%"+n.substr(e,2);else t+="%"+n;return t},safeEncodeURIComponent(e){e=(e||"").toString();try{e=encodeURIComponent(e)}catch(t){return e.replace(/[^\x00-\x1F *'()<>@,;:\\"[\]?=\u007F-\uFFFF]+/g,"")}return e.replace(/[\x00-\x1F *'()<>@,;:\\"[\]?=\u007F-\uFFFF]/g,e=>this.encodeURICharComponent(e))}},mimeFuncs}function requireAddressparser(){if(hasRequiredAddressparser)return addressparser_1;hasRequiredAddressparser=1;class e{constructor(e){this.str=(e||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let e=[];for(let e=0,t=this.str.length;e<t;e++){let n=this.str.charAt(e),i=e<t-1?this.str.charAt(e+1):null;this.checkChar(n,i)}return this.list.forEach(t=>{t.value=(t.value||"").toString().trim(),t.value&&e.push(t)}),e}checkChar(e,t){if(this.escaped);else{if(e===this.operatorExpecting)return this.node={type:"operator",value:e},t&&![" ","\t","\r","\n",",",";"].includes(t)&&(this.node.noBreak=!0),this.list.push(this.node),this.node=null,this.operatorExpecting="",void(this.escaped=!1);if(!this.operatorExpecting&&e in this.operators)return this.node={type:"operator",value:e},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[e],void(this.escaped=!1);if(['"',"'"].includes(this.operatorExpecting)&&"\\"===e)return void(this.escaped=!0)}this.node||(this.node={type:"text",value:""},this.list.push(this.node)),"\n"===e&&(e=" "),(e.charCodeAt(0)>=33||[" ","\t"].includes(e))&&(this.node.value+=e),this.escaped=!1}}function t(n,i){i=i||{};let r=new e(n).tokenize(),o=[],a=[],s=[];if(r.forEach(e=>{"operator"!==e.type||","!==e.value&&";"!==e.value?a.push(e):(a.length&&o.push(a),a=[])}),a.length&&o.push(a),o.forEach(e=>{e=function(e){let n,i,r,o=!1,a="text",s=[],c={address:[],comment:[],group:[],text:[]};for(i=0,r=e.length;i<r;i++){let t=e[i],n=i?e[i-1]:null;if("operator"===t.type)switch(t.value){case"<":a="address";break;case"(":a="comment";break;case":":a="group",o=!0;break;default:a="text"}else t.value&&("address"===a&&(t.value=t.value.replace(/^[^<]*<\s*/,"")),n&&n.noBreak&&c[a].length?c[a][c[a].length-1]+=t.value:c[a].push(t.value))}if(!c.text.length&&c.comment.length&&(c.text=c.comment,c.comment=[]),o)c.text=c.text.join(" "),s.push({name:c.text||n&&n.name,group:c.group.length?t(c.group.join(",")):[]});else{if(!c.address.length&&c.text.length){for(i=c.text.length-1;i>=0;i--)if(c.text[i].match(/^[^@\s]+@[^@\s]+$/)){c.address=c.text.splice(i,1);break}let e=function(e){return c.address.length?e:(c.address=[e.trim()]," ")};if(!c.address.length)for(i=c.text.length-1;i>=0&&(c.text[i]=c.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,e).trim(),!c.address.length);i--);}if(!c.text.length&&c.comment.length&&(c.text=c.comment,c.comment=[]),c.address.length>1&&(c.text=c.text.concat(c.address.splice(1))),c.text=c.text.join(" "),c.address=c.address.join(" "),!c.address&&o)return[];n={address:c.address||c.text||"",name:c.text||c.address||""},n.address===n.name&&((n.address||"").match(/@/)?n.name="":n.address=""),s.push(n)}return s}(e),e.length&&(s=s.concat(e))}),i.flatten){let e=[],t=n=>{n.forEach(n=>{if(n.group)return t(n.group);e.push(n)})};return t(s),e}return s}return addressparser_1=t}function requireLastNewline(){if(hasRequiredLastNewline)return lastNewline;hasRequiredLastNewline=1;const e=require$$0$4.Transform;return lastNewline=class extends e{constructor(){super(),this.lastByte=!1}_transform(e,t,n){e.length&&(this.lastByte=e[e.length-1]),this.push(e),n()}_flush(e){return 10===this.lastByte?e():13===this.lastByte?(this.push(Buffer.from("\n")),e()):(this.push(Buffer.from("\r\n")),e())}}}function requireLeWindows(){if(hasRequiredLeWindows)return leWindows;hasRequiredLeWindows=1;const e=require$$0$4.Transform;return leWindows=class extends e{constructor(e){super(e),this.options=e||{},this.lastByte=!1}_transform(e,t,n){let i,r=0;for(let t=0,n=e.length;t<n;t++)10===e[t]&&(t&&13!==e[t-1]||!t&&13!==this.lastByte)&&(t>r&&(i=e.slice(r,t),this.push(i)),this.push(Buffer.from("\r\n")),r=t+1);r&&r<e.length?(i=e.slice(r),this.push(i)):r||this.push(e),this.lastByte=e[e.length-1],n()}},leWindows}function requireLeUnix(){if(hasRequiredLeUnix)return leUnix;hasRequiredLeUnix=1;const e=require$$0$4.Transform;return leUnix=class extends e{constructor(e){super(e),this.options=e||{}}_transform(e,t,n){let i,r=0;for(let t=0,n=e.length;t<n;t++)13===e[t]&&(i=e.slice(r,t),r=t+1,this.push(i));r&&r<e.length?(i=e.slice(r),this.push(i)):r||this.push(e),n()}},leUnix}function requireMimeNode(){if(hasRequiredMimeNode)return mimeNode;hasRequiredMimeNode=1;const e=require$$2__default,t=require$$0$7,n=requirePunycode(),i=require$$0$4.PassThrough,r=requireShared(),o=requireMimeFuncs(),a=requireQp(),s=requireBase64(),c=requireAddressparser(),l=requireFetch(),d=requireLastNewline(),u=requireLeWindows(),p=requireLeUnix();class m{constructor(t,n){this.nodeCounter=0,n=n||{},this.baseBoundary=n.baseBoundary||e.randomBytes(8).toString("hex"),this.boundaryPrefix=n.boundaryPrefix||"--_NmP",this.disableFileAccess=!!n.disableFileAccess,this.disableUrlAccess=!!n.disableUrlAccess,this.normalizeHeaderKey=n.normalizeHeaderKey,this.date=new Date,this.rootNode=n.rootNode||this,this.keepBcc=!!n.keepBcc,n.filename&&(this.filename=n.filename,t||(t=o.detectMimeType(this.filename.split(".").pop()))),this.textEncoding=(n.textEncoding||"").toString().trim().charAt(0).toUpperCase(),this.parentNode=n.parentNode,this.hostname=n.hostname,this.newline=n.newline,this.childNodes=[],this._nodeId=++this.rootNode.nodeCounter,this._headers=[],this._isPlainText=!1,this._hasLongLines=!1,this._envelope=!1,this._raw=!1,this._transforms=[],this._processFuncs=[],t&&this.setHeader("Content-Type",t)}createChild(e,t){t||"object"!=typeof e||(t=e,e=void 0);let n=new m(e,t);return this.appendChild(n),n}appendChild(e){return e.rootNode!==this.rootNode&&(e.rootNode=this.rootNode,e._nodeId=++this.rootNode.nodeCounter),e.parentNode=this,this.childNodes.push(e),e}replace(e){return e===this?this:(this.parentNode.childNodes.forEach((t,n)=>{t===this&&(e.rootNode=this.rootNode,e.parentNode=this.parentNode,e._nodeId=this._nodeId,this.rootNode=this,this.parentNode=void 0,e.parentNode.childNodes[n]=e)}),e)}remove(){if(!this.parentNode)return this;for(let e=this.parentNode.childNodes.length-1;e>=0;e--)if(this.parentNode.childNodes[e]===this)return this.parentNode.childNodes.splice(e,1),this.parentNode=void 0,this.rootNode=this,this}setHeader(e,t){let n,i=!1;if(!t&&e&&"object"==typeof e)return e.key&&"value"in e?this.setHeader(e.key,e.value):Array.isArray(e)?e.forEach(e=>{this.setHeader(e.key,e.value)}):Object.keys(e).forEach(t=>{this.setHeader(t,e[t])}),this;n={key:e=this._normalizeHeaderKey(e),value:t};for(let t=0,r=this._headers.length;t<r;t++)this._headers[t].key===e&&(i?(this._headers.splice(t,1),t--,r--):(this._headers[t]=n,i=!0));return i||this._headers.push(n),this}addHeader(e,t){return!t&&e&&"object"==typeof e?(e.key&&e.value?this.addHeader(e.key,e.value):Array.isArray(e)?e.forEach(e=>{this.addHeader(e.key,e.value)}):Object.keys(e).forEach(t=>{this.addHeader(t,e[t])}),this):Array.isArray(t)?(t.forEach(t=>{this.addHeader(e,t)}),this):(this._headers.push({key:this._normalizeHeaderKey(e),value:t}),this)}getHeader(e){e=this._normalizeHeaderKey(e);for(let t=0,n=this._headers.length;t<n;t++)if(this._headers[t].key===e)return this._headers[t].value}setContent(e){return this.content=e,"function"==typeof this.content.pipe?(this._contentErrorHandler=e=>{this.content.removeListener("error",this._contentErrorHandler),this.content=e},this.content.once("error",this._contentErrorHandler)):"string"==typeof this.content&&(this._isPlainText=o.isPlainText(this.content),this._isPlainText&&o.hasLongerLines(this.content,76)&&(this._hasLongLines=!0)),this}build(e){let t;e||(t=new Promise((t,n)=>{e=r.callbackPromise(t,n)}));let n=this.createReadStream(),i=[],o=0,a=!1;return n.on("readable",()=>{let e;for(;null!==(e=n.read());)i.push(e),o+=e.length}),n.once("error",t=>{if(!a)return a=!0,e(t)}),n.once("end",t=>{if(!a)return a=!0,t&&t.length&&(i.push(t),o+=t.length),e(null,Buffer.concat(i,o))}),t}getTransferEncoding(){let e=!1,t=(this.getHeader("Content-Type")||"").toString().toLowerCase().trim();return this.content&&(e=(this.getHeader("Content-Transfer-Encoding")||"").toString().toLowerCase().trim(),e&&["base64","quoted-printable"].includes(e)||(/^text\//i.test(t)?e=this._isPlainText&&!this._hasLongLines?"7bit":"string"==typeof this.content||this.content instanceof Buffer?"Q"===this._getTextEncoding(this.content)?"quoted-printable":"base64":"B"===this.textEncoding?"base64":"quoted-printable":/^(multipart|message)\//i.test(t)||(e=e||"base64"))),e}buildHeaders(){let e=this.getTransferEncoding(),t=[];if(e&&this.setHeader("Content-Transfer-Encoding",e),this.filename&&!this.getHeader("Content-Disposition")&&this.setHeader("Content-Disposition","attachment"),this.rootNode===this){this.getHeader("Date")||this.setHeader("Date",this.date.toUTCString().replace(/GMT/,"+0000")),this.messageId(),this.getHeader("MIME-Version")||this.setHeader("MIME-Version","1.0");for(let e=this._headers.length-2;e>=0;e--){let t=this._headers[e];"Content-Type"===t.key&&(this._headers.splice(e,1),this._headers.push(t))}}return this._headers.forEach(e=>{let n,i,r=e.key,a=e.value,s={};if(!a||"object"!=typeof a||["From","Sender","To","Cc","Bcc","Reply-To","Date","References"].includes(r)||(Object.keys(a).forEach(e=>{"value"!==e&&(s[e]=a[e])}),a=(a.value||"").toString(),a.trim()))if(s.prepared)s.foldLines?t.push(o.foldLines(r+": "+a)):t.push(r+": "+a);else{switch(e.key){case"Content-Disposition":n=o.parseHeaderValue(a),this.filename&&(n.params.filename=this.filename),a=o.buildHeaderValue(n);break;case"Content-Type":n=o.parseHeaderValue(a),this._handleContentType(n),n.value.match(/^text\/plain\b/)&&"string"==typeof this.content&&/[\u0080-\uFFFF]/.test(this.content)&&(n.params.charset="utf-8"),a=o.buildHeaderValue(n),this.filename&&(i=this._encodeWords(this.filename),(i!==this.filename||/[\s'"\\;:/=(),<>@[\]?]|^-/.test(i))&&(i='"'+i+'"'),a+="; name="+i);break;case"Bcc":if(!this.keepBcc)return}if(a=this._encodeHeaderValue(r,a),(a||"").toString().trim()){if("function"==typeof this.normalizeHeaderKey){let e=this.normalizeHeaderKey(r,a);e&&"string"==typeof e&&e.length&&(r=e)}t.push(o.foldLines(r+": "+a,76))}}}),t.join("\r\n")}createReadStream(e){let t,n=new i(e=e||{}),r=n;this.stream(n,e,e=>{e?r.emit("error",e):n.end()});for(let e=0,n=this._transforms.length;e<n;e++)t="function"==typeof this._transforms[e]?this._transforms[e]():this._transforms[e],r.once("error",e=>{t.emit("error",e)}),r=r.pipe(t);t=new d,r.once("error",e=>{t.emit("error",e)}),r=r.pipe(t);for(let e=0,n=this._processFuncs.length;e<n;e++)t=this._processFuncs[e],r=t(r);if(this.newline){const e=["win","windows","dos","\r\n"].includes(this.newline.toString().toLowerCase())?new u:new p,t=r.pipe(e);return r.on("error",e=>t.emit("error",e)),t}return r}transform(e){this._transforms.push(e)}processFunc(e){this._processFuncs.push(e)}stream(e,t,n){let i,r,o=this.getTransferEncoding(),c=!1,l=e=>{c||(c=!0,n(e))},d=()=>{let n=0,i=()=>{if(n>=this.childNodes.length)return e.write("\r\n--"+this.boundary+"--\r\n"),l();let r=this.childNodes[n++];e.write((n>1?"\r\n":"")+"--"+this.boundary+"\r\n"),r.stream(e,t,e=>{if(e)return l(e);setImmediate(i)})};if(!this.multipart)return l();setImmediate(i)},u=()=>{if(this.content){if("[object Error]"===Object.prototype.toString.call(this.content))return l(this.content);"function"==typeof this.content.pipe&&(this.content.removeListener("error",this._contentErrorHandler),this._contentErrorHandler=e=>l(e),this.content.once("error",this._contentErrorHandler));let n=()=>{["quoted-printable","base64"].includes(o)?(i=new("base64"===o?s:a).Encoder(t),i.pipe(e,{end:!1}),i.once("end",d),i.once("error",e=>l(e)),r=this._getStream(this.content),r.pipe(i)):(r=this._getStream(this.content),r.pipe(e,{end:!1}),r.once("end",d)),r.once("error",e=>l(e))};if(this.content._resolve){let e=[],t=0,i=!1,r=this._getStream(this.content);r.on("error",e=>{i||(i=!0,l(e))}),r.on("readable",()=>{let n;for(;null!==(n=r.read());)e.push(n),t+=n.length}),r.on("end",()=>{i||(i=!0,this.content._resolve=!1,this.content._resolvedValue=Buffer.concat(e,t),setImmediate(n))})}else setImmediate(n);return}return setImmediate(d)};this._raw?setImmediate(()=>{if("[object Error]"===Object.prototype.toString.call(this._raw))return l(this._raw);"function"==typeof this._raw.pipe&&this._raw.removeListener("error",this._contentErrorHandler);let t=this._getStream(this._raw);t.pipe(e,{end:!1}),t.on("error",t=>e.emit("error",t)),t.on("end",d)}):(e.write(this.buildHeaders()+"\r\n\r\n"),setImmediate(u))}setEnvelope(e){let t;this._envelope={from:!1,to:[]},e.from&&(t=[],this._convertAddresses(this._parseAddresses(e.from),t),t=t.filter(e=>e&&e.address),t.length&&t[0]&&(this._envelope.from=t[0].address)),["to","cc","bcc"].forEach(t=>{e[t]&&this._convertAddresses(this._parseAddresses(e[t]),this._envelope.to)}),this._envelope.to=this._envelope.to.map(e=>e.address).filter(e=>e);let n=["to","cc","bcc","from"];return Object.keys(e).forEach(t=>{n.includes(t)||(this._envelope[t]=e[t])}),this}getAddresses(){let e={};return this._headers.forEach(t=>{let n=t.key.toLowerCase();["from","sender","reply-to","to","cc","bcc"].includes(n)&&(Array.isArray(e[n])||(e[n]=[]),this._convertAddresses(this._parseAddresses(t.value),e[n]))}),e}getEnvelope(){if(this._envelope)return this._envelope;let e={from:!1,to:[]};return this._headers.forEach(t=>{let n=[];"From"===t.key||!e.from&&["Reply-To","Sender"].includes(t.key)?(this._convertAddresses(this._parseAddresses(t.value),n),n.length&&n[0]&&(e.from=n[0].address)):["To","Cc","Bcc"].includes(t.key)&&this._convertAddresses(this._parseAddresses(t.value),e.to)}),e.to=e.to.map(e=>e.address),e}messageId(){let e=this.getHeader("Message-ID");return e||(e=this._generateMessageId(),this.setHeader("Message-ID",e)),e}setRaw(e){return this._raw=e,this._raw&&"function"==typeof this._raw.pipe&&(this._contentErrorHandler=e=>{this._raw.removeListener("error",this._contentErrorHandler),this._raw=e},this._raw.once("error",this._contentErrorHandler)),this}_getStream(e){let n;return e._resolvedValue?(n=new i,setImmediate(()=>{try{n.end(e._resolvedValue)}catch(e){n.emit("error",e)}}),n):"function"==typeof e.pipe?e:e&&"string"==typeof e.path&&!e.href?this.disableFileAccess?(n=new i,setImmediate(()=>n.emit("error",new Error("File access rejected for "+e.path))),n):t.createReadStream(e.path):e&&"string"==typeof e.href?this.disableUrlAccess?(n=new i,setImmediate(()=>n.emit("error",new Error("Url access rejected for "+e.href))),n):l(e.href,{headers:e.httpHeaders}):(n=new i,setImmediate(()=>{try{n.end(e||"")}catch(e){n.emit("error",e)}}),n)}_parseAddresses(e){return[].concat.apply([],[].concat(e).map(e=>e&&e.address?(e.address=this._normalizeAddress(e.address),e.name=e.name||"",[e]):c(e)))}_normalizeHeaderKey(e){return e=(e||"").toString().replace(/\r?\n|\r/g," ").trim().toLowerCase().replace(/^X-SMTPAPI$|^(MIME|DKIM|ARC|BIMI)\b|^[a-z]|-(SPF|FBL|ID|MD5)$|-[a-z]/gi,e=>e.toUpperCase()).replace(/^Content-Features$/i,"Content-features"),e}_handleContentType(e){this.contentType=e.value.trim().toLowerCase(),this.multipart=!!/^multipart\//i.test(this.contentType)&&this.contentType.substr(this.contentType.indexOf("/")+1),this.multipart?this.boundary=e.params.boundary=e.params.boundary||this.boundary||this._generateBoundary():this.boundary=!1}_generateBoundary(){return this.rootNode.boundaryPrefix+"-"+this.rootNode.baseBoundary+"-Part_"+this._nodeId}_encodeHeaderValue(e,t){switch(e=this._normalizeHeaderKey(e)){case"From":case"Sender":case"To":case"Cc":case"Bcc":case"Reply-To":return this._convertAddresses(this._parseAddresses(t));case"Message-ID":case"In-Reply-To":case"Content-Id":return"<"!==(t=(t||"").toString().replace(/\r?\n|\r/g," ")).charAt(0)&&(t="<"+t),">"!==t.charAt(t.length-1)&&(t+=">"),t;case"References":return(t=[].concat.apply([],[].concat(t||"").map(e=>(e=(e||"").toString().replace(/\r?\n|\r/g," ").trim()).replace(/<[^>]*>/g,e=>e.replace(/\s/g,"")).split(/\s+/))).map(e=>("<"!==e.charAt(0)&&(e="<"+e),">"!==e.charAt(e.length-1)&&(e+=">"),e))).join(" ").trim();case"Date":return"[object Date]"===Object.prototype.toString.call(t)?t.toUTCString().replace(/GMT/,"+0000"):(t=(t||"").toString().replace(/\r?\n|\r/g," "),this._encodeWords(t));case"Content-Type":case"Content-Disposition":return(t||"").toString().replace(/\r?\n|\r/g," ");default:return t=(t||"").toString().replace(/\r?\n|\r/g," "),this._encodeWords(t)}}_convertAddresses(e,t){let n=[];return t=t||[],[].concat(e||[]).forEach(e=>{if(e.address)e.address=this._normalizeAddress(e.address),e.name?e.name&&n.push(`${this._encodeAddressName(e.name)} <${e.address}>`):n.push(e.address.indexOf(" ")>=0?`<${e.address}>`:`${e.address}`),e.address&&(t.filter(t=>t.address===e.address).length||t.push(e));else if(e.group){let i=(e.group.length?this._convertAddresses(e.group,t):"").trim();n.push(`${this._encodeAddressName(e.name)}:${i};`)}}),n.join(", ")}_normalizeAddress(e){let t=(e=(e||"").toString().replace(/[\x00-\x1F<>]+/g," ").trim()).lastIndexOf("@");if(t<0)return e;let i,r=e.substr(0,t),o=e.substr(t+1);try{i=n.toASCII(o.toLowerCase())}catch(e){}return r.indexOf(" ")>=0&&('"'!==r.charAt(0)&&(r='"'+r),'"'!==r.substr(-1)&&(r+='"')),`${r}@${i}`}_encodeAddressName(e){return/^[\w ]*$/.test(e)?e:/^[\x20-\x7e]*$/.test(e)?'"'+e.replace(/([\\"])/g,"\\$1")+'"':o.encodeWord(e,this._getTextEncoding(e),52)}_encodeWords(e){return o.encodeWords(e,this._getTextEncoding(e),52,!0)}_getTextEncoding(e){e=(e||"").toString();let t,n,i=this.textEncoding;return i||(n=(e.match(/[\x00-\x08\x0B\x0C\x0E-\x1F\u0080-\uFFFF]/g)||[]).length,t=(e.match(/[a-z]/gi)||[]).length,i=n<t?"Q":"B"),i}_generateMessageId(){return"<"+[2,2,2,6].reduce((t,n)=>t+"-"+e.randomBytes(n).toString("hex"),e.randomBytes(4).toString("hex"))+"@"+(this.getEnvelope().from||this.hostname||"localhost").split("@").pop()+">"}}return mimeNode=m}function requireMailComposer(){if(hasRequiredMailComposer)return mailComposer;hasRequiredMailComposer=1;const e=requireMimeNode(),t=requireMimeFuncs(),n=requireShared().parseDataURI;return mailComposer=class{constructor(e){this.mail=e||{},this.message=!1}compile(){return this._alternatives=this.getAlternatives(),this._htmlNode=this._alternatives.filter(e=>/^text\/html\b/i.test(e.contentType)).pop(),this._attachments=this.getAttachments(!!this._htmlNode),this._useRelated=!(!this._htmlNode||!this._attachments.related.length),this._useAlternative=this._alternatives.length>1,this._useMixed=this._attachments.attached.length>1||this._alternatives.length&&1===this._attachments.attached.length,this.mail.raw?this.message=new e("message/rfc822",{newline:this.mail.newline}).setRaw(this.mail.raw):this._useMixed?this.message=this._createMixed():this._useAlternative?this.message=this._createAlternative():this._useRelated?this.message=this._createRelated():this.message=this._createContentNode(!1,[].concat(this._alternatives||[]).concat(this._attachments.attached||[]).shift()||{contentType:"text/plain",content:""}),this.mail.headers&&this.message.addHeader(this.mail.headers),["from","sender","to","cc","bcc","reply-to","in-reply-to","references","subject","message-id","date"].forEach(e=>{let t=e.replace(/-(\w)/g,(e,t)=>t.toUpperCase());this.mail[t]&&this.message.setHeader(e,this.mail[t])}),this.mail.envelope&&this.message.setEnvelope(this.mail.envelope),this.message.messageId(),this.message}getAttachments(e){let n,i,r=[].concat(this.mail.attachments||[]).map((e,n)=>{let i,r=/^message\//i.test(e.contentType);/^data:/i.test(e.path||e.href)&&(e=this._processDataUrl(e));let o=e.contentType||t.detectMimeType(e.filename||e.path||e.href||"bin"),a=/^image\//i.test(o);return i={contentType:o,contentDisposition:e.contentDisposition||(r||a&&e.cid?"inline":"attachment"),contentTransferEncoding:"contentTransferEncoding"in e?e.contentTransferEncoding:"base64"},e.filename?i.filename=e.filename:r||!1===e.filename||(i.filename=(e.path||e.href||"").split("/").pop().split("?").shift()||"attachment-"+(n+1),i.filename.indexOf(".")<0&&(i.filename+="."+t.detectExtension(i.contentType))),/^https?:\/\//i.test(e.path)&&(e.href=e.path,e.path=void 0),e.cid&&(i.cid=e.cid),e.raw?i.raw=e.raw:e.path?i.content={path:e.path}:e.href?i.content={href:e.href,httpHeaders:e.httpHeaders}:i.content=e.content||"",e.encoding&&(i.encoding=e.encoding),e.headers&&(i.headers=e.headers),i});return this.mail.icalEvent&&(n="object"==typeof this.mail.icalEvent&&(this.mail.icalEvent.content||this.mail.icalEvent.path||this.mail.icalEvent.href||this.mail.icalEvent.raw)?this.mail.icalEvent:{content:this.mail.icalEvent},i={},Object.keys(n).forEach(e=>{i[e]=n[e]}),i.contentType="application/ics",i.headers||(i.headers={}),i.filename=i.filename||"invite.ics",i.headers["Content-Disposition"]="attachment",i.headers["Content-Transfer-Encoding"]="base64"),e?{attached:r.filter(e=>!e.cid).concat(i||[]),related:r.filter(e=>!!e.cid)}:{attached:r.concat(i||[]),related:[]}}getAlternatives(){let e,n,i,r,o,a,s=[];return this.mail.text&&(e="object"==typeof this.mail.text&&(this.mail.text.content||this.mail.text.path||this.mail.text.href||this.mail.text.raw)?this.mail.text:{content:this.mail.text},e.contentType="text/plain; charset=utf-8"),this.mail.watchHtml&&(i="object"==typeof this.mail.watchHtml&&(this.mail.watchHtml.content||this.mail.watchHtml.path||this.mail.watchHtml.href||this.mail.watchHtml.raw)?this.mail.watchHtml:{content:this.mail.watchHtml},i.contentType="text/watch-html; charset=utf-8"),this.mail.amp&&(r="object"==typeof this.mail.amp&&(this.mail.amp.content||this.mail.amp.path||this.mail.amp.href||this.mail.amp.raw)?this.mail.amp:{content:this.mail.amp},r.contentType="text/x-amp-html; charset=utf-8"),this.mail.icalEvent&&(o="object"==typeof this.mail.icalEvent&&(this.mail.icalEvent.content||this.mail.icalEvent.path||this.mail.icalEvent.href||this.mail.icalEvent.raw)?this.mail.icalEvent:{content:this.mail.icalEvent},a={},Object.keys(o).forEach(e=>{a[e]=o[e]}),a.content&&"object"==typeof a.content&&(a.content._resolve=!0),a.filename=!1,a.contentType="text/calendar; charset=utf-8; method="+(a.method||"PUBLISH").toString().trim().toUpperCase(),a.headers||(a.headers={})),this.mail.html&&(n="object"==typeof this.mail.html&&(this.mail.html.content||this.mail.html.path||this.mail.html.href||this.mail.html.raw)?this.mail.html:{content:this.mail.html},n.contentType="text/html; charset=utf-8"),[].concat(e||[]).concat(i||[]).concat(r||[]).concat(n||[]).concat(a||[]).concat(this.mail.alternatives||[]).forEach(e=>{let n;/^data:/i.test(e.path||e.href)&&(e=this._processDataUrl(e)),n={contentType:e.contentType||t.detectMimeType(e.filename||e.path||e.href||"txt"),contentTransferEncoding:e.contentTransferEncoding},e.filename&&(n.filename=e.filename),/^https?:\/\//i.test(e.path)&&(e.href=e.path,e.path=void 0),e.raw?n.raw=e.raw:e.path?n.content={path:e.path}:e.href?n.content={href:e.href}:n.content=e.content||"",e.encoding&&(n.encoding=e.encoding),e.headers&&(n.headers=e.headers),s.push(n)}),s}_createMixed(t){let n;return n=t?t.createChild("multipart/mixed",{disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}):new e("multipart/mixed",{baseBoundary:this.mail.baseBoundary,textEncoding:this.mail.textEncoding,boundaryPrefix:this.mail.boundaryPrefix,disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}),this._useAlternative?this._createAlternative(n):this._useRelated&&this._createRelated(n),[].concat(!this._useAlternative&&this._alternatives||[]).concat(this._attachments.attached||[]).forEach(e=>{this._useRelated&&e===this._htmlNode||this._createContentNode(n,e)}),n}_createAlternative(t){let n;return n=t?t.createChild("multipart/alternative",{disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}):new e("multipart/alternative",{baseBoundary:this.mail.baseBoundary,textEncoding:this.mail.textEncoding,boundaryPrefix:this.mail.boundaryPrefix,disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}),this._alternatives.forEach(e=>{this._useRelated&&this._htmlNode===e?this._createRelated(n):this._createContentNode(n,e)}),n}_createRelated(t){let n;return n=t?t.createChild('multipart/related; type="text/html"',{disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}):new e('multipart/related; type="text/html"',{baseBoundary:this.mail.baseBoundary,textEncoding:this.mail.textEncoding,boundaryPrefix:this.mail.boundaryPrefix,disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}),this._createContentNode(n,this._htmlNode),this._attachments.related.forEach(e=>this._createContentNode(n,e)),n}_createContentNode(t,n){let i;(n=n||{}).content=n.content||"";let r=(n.encoding||"utf8").toString().toLowerCase().replace(/[-_\s]/g,"");return i=t?t.createChild(n.contentType,{filename:n.filename,textEncoding:this.mail.textEncoding,disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}):new e(n.contentType,{filename:n.filename,baseBoundary:this.mail.baseBoundary,textEncoding:this.mail.textEncoding,boundaryPrefix:this.mail.boundaryPrefix,disableUrlAccess:this.mail.disableUrlAccess,disableFileAccess:this.mail.disableFileAccess,normalizeHeaderKey:this.mail.normalizeHeaderKey,newline:this.mail.newline}),n.headers&&i.addHeader(n.headers),n.cid&&i.setHeader("Content-Id","<"+n.cid.replace(/[<>]/g,"")+">"),n.contentTransferEncoding?i.setHeader("Content-Transfer-Encoding",n.contentTransferEncoding):this.mail.encoding&&/^text\//i.test(n.contentType)&&i.setHeader("Content-Transfer-Encoding",this.mail.encoding),/^text\//i.test(n.contentType)&&!n.contentDisposition||i.setHeader("Content-Disposition",n.contentDisposition||(n.cid&&/^image\//i.test(n.contentType)?"inline":"attachment")),"string"!=typeof n.content||["utf8","usascii","ascii"].includes(r)||(n.content=Buffer.from(n.content,r)),n.raw?i.setRaw(n.raw):i.setContent(n.content),i}_processDataUrl(e){let t;return(e.path||e.href).match(/^data:/)&&(t=n(e.path||e.href)),t?(e.content=t.data,e.contentType=e.contentType||t.contentType,"path"in e&&(e.path=!1),"href"in e&&(e.href=!1),e):e}},mailComposer}function requireMessageParser(){if(hasRequiredMessageParser)return messageParser;hasRequiredMessageParser=1;const e=require$$0$4.Transform;return messageParser=class extends e{constructor(e){super(e),this.lastBytes=Buffer.alloc(4),this.headersParsed=!1,this.headerBytes=0,this.headerChunks=[],this.rawHeaders=!1,this.bodySize=0}updateLastBytes(e){let t=this.lastBytes.length,n=Math.min(e.length,t);for(let e=0,i=t-n;e<i;e++)this.lastBytes[e]=this.lastBytes[e+n];for(let i=1;i<=n;i++)this.lastBytes[t-i]=e[e.length-i]}checkHeaders(e){if(this.headersParsed)return!0;let t=this.lastBytes.length,n=0;this.curLinePos=0;for(let i=0,r=this.lastBytes.length+e.length;i<r;i++){let r;if(r=i<t?this.lastBytes[i]:e[i-t],10===r&&i){let r=i-1<t?this.lastBytes[i-1]:e[i-1-t],o=i>1&&(i-2<t?this.lastBytes[i-2]:e[i-2-t]);if(10===r){this.headersParsed=!0,n=i-t+1,this.headerBytes+=n;break}if(13===r&&10===o){this.headersParsed=!0,n=i-t+1,this.headerBytes+=n;break}}}if(this.headersParsed){if(this.headerChunks.push(e.slice(0,n)),this.rawHeaders=Buffer.concat(this.headerChunks,this.headerBytes),this.headerChunks=null,this.emit("headers",this.parseHeaders()),e.length-1>n){let t=e.slice(n);this.bodySize+=t.length,setImmediate(()=>this.push(t))}return!1}return this.headerBytes+=e.length,this.headerChunks.push(e),this.updateLastBytes(e),!1}_transform(e,t,n){if(!e||!e.length)return n();let i;"string"==typeof e&&(e=Buffer.from(e,t));try{i=this.checkHeaders(e)}catch(e){return n(e)}i&&(this.bodySize+=e.length,this.push(e)),setImmediate(n)}_flush(e){if(this.headerChunks){let e=Buffer.concat(this.headerChunks,this.headerBytes);this.bodySize+=e.length,this.push(e),this.headerChunks=null}e()}parseHeaders(){let e=(this.rawHeaders||"").toString().split(/\r?\n/);for(let t=e.length-1;t>0;t--)/^\s/.test(e[t])&&(e[t-1]+="\n"+e[t],e.splice(t,1));return e.filter(e=>e.trim()).map(e=>({key:e.substr(0,e.indexOf(":")).trim().toLowerCase(),line:e}))}},messageParser}function requireRelaxedBody(){if(hasRequiredRelaxedBody)return relaxedBody;hasRequiredRelaxedBody=1;const e=require$$0$4.Transform,t=require$$2__default;return relaxedBody=class extends e{constructor(e){super(),e=e||{},this.chunkBuffer=[],this.chunkBufferLen=0,this.bodyHash=t.createHash(e.hashAlgo||"sha1"),this.remainder="",this.byteLength=0,this.debug=e.debug,this._debugBody=!!e.debug&&[]}updateHash(e){let t,n="",i="file";for(let t=e.length-1;t>=0;t--){let r=e[t];if("file"!==i||10!==r&&13!==r)if("file"!==i||9!==r&&32!==r)if("line"!==i||9!==r&&32!==r){if(("file"===i||"line"===i)&&(i="body",t===e.length-1))break}else;else i="line";else;if(0===t){if("file"===i&&(!this.remainder||/[\r\n]$/.test(this.remainder))||"line"===i&&(!this.remainder||/[ \t]$/.test(this.remainder)))return void(this.remainder+=e.toString("binary"));if("line"===i||"file"===i){n=e.toString("binary"),e=!1;break}}if("body"===i){n=e.slice(t+1).toString("binary"),e=e.slice(0,t+1);break}}let r=!!this.remainder;if(e&&!r)for(let t=0,n=e.length;t<n;t++){if(t&&10===e[t]&&13!==e[t-1]){r=!0;break}if(t&&13===e[t]&&32===e[t-1]){r=!0;break}if(t&&32===e[t]&&32===e[t-1]){r=!0;break}if(9===e[t]){r=!0;break}}r?(t=this.remainder+(e?e.toString("binary"):""),this.remainder=n,t=t.replace(/\r?\n/g,"\n").replace(/[ \t]*$/gm,"").replace(/[ \t]+/gm," ").replace(/\n/g,"\r\n"),e=Buffer.from(t,"binary")):n&&(this.remainder=n),this.debug&&this._debugBody.push(e),this.bodyHash.update(e)}_transform(e,t,n){if(!e||!e.length)return n();"string"==typeof e&&(e=Buffer.from(e,t)),this.updateHash(e),this.byteLength+=e.length,this.push(e),n()}_flush(e){/[\r\n]$/.test(this.remainder)&&this.byteLength>2&&this.bodyHash.update(Buffer.from("\r\n")),this.byteLength||this.push(Buffer.from("\r\n")),this.emit("hash",this.bodyHash.digest("base64"),!!this.debug&&Buffer.concat(this._debugBody)),e()}},relaxedBody}var sign={exports:{}},hasRequiredSign,dkim,hasRequiredDkim,httpProxyClient_1,hasRequiredHttpProxyClient,mailMessage,hasRequiredMailMessage,mailer,hasRequiredMailer,dataStream,hasRequiredDataStream,smtpConnection,hasRequiredSmtpConnection,xoauth2,hasRequiredXoauth2,poolResource,hasRequiredPoolResource;function requireSign(){if(hasRequiredSign)return sign.exports;hasRequiredSign=1;const e=requirePunycode(),t=requireMimeFuncs(),n=require$$2__default;function i(e,t,n){let i=new Set,o=new Set,a=new Map;(n||"").toLowerCase().split(":").forEach(e=>{o.add(e.trim())}),(t||"").toLowerCase().split(":").filter(e=>!o.has(e.trim())).forEach(e=>{i.add(e.trim())});for(let t=e.length-1;t>=0;t--){let n=e[t];i.has(n.key)&&!a.has(n.key)&&a.set(n.key,r(n.line))}let s=[],c=[];return i.forEach(e=>{a.has(e)&&(c.push(e),s.push(e+":"+a.get(e)))}),{headers:s.join("\r\n")+"\r\n",fieldNames:c.join(":")}}function r(e){return e.substr(e.indexOf(":")+1).replace(/\r?\n/g,"").replace(/\s+/g," ").trim()}return sign.exports=(o,a,s,c)=>{let l,d,u=i(o,(c=c||{}).headerFieldNames||"From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive",c.skipFields),p=function(n,i,r,o,a){let s=["v=1","a=rsa-"+o,"c=relaxed/relaxed","d="+e.toASCII(n),"q=dns/txt","s="+i,"bh="+a,"h="+r].join("; ");return t.foldLines("DKIM-Signature: "+s,76)+";\r\n b="}(c.domainName,c.keySelector,u.fieldNames,a,s);u.headers+="dkim-signature:"+r(p),l=n.createSign(("rsa-"+a).toUpperCase()),l.update(u.headers);try{d=l.sign(c.privateKey,"base64")}catch(e){return!1}return p+d.replace(/(^.{73}|.{75}(?!\r?\n|\r))/g,"$&\r\n ").trim()},sign.exports.relaxedHeaders=i,sign.exports}function requireDkim(){if(hasRequiredDkim)return dkim;hasRequiredDkim=1;const e=requireMessageParser(),t=requireRelaxedBody(),n=requireSign(),i=require$$0$4.PassThrough,r=require$$0$7,o=require$$0$9,a=require$$2__default;class s{constructor(e,t,n,i){this.options=e||{},this.keys=t,this.cacheTreshold=Number(this.options.cacheTreshold)||131072,this.hashAlgo=this.options.hashAlgo||"sha256",this.cacheDir=this.options.cacheDir||!1,this.chunks=[],this.chunklen=0,this.readPos=0,this.cachePath=!!this.cacheDir&&o.join(this.cacheDir,"message."+Date.now()+"-"+a.randomBytes(14).toString("hex")),this.cache=!1,this.headers=!1,this.bodyHash=!1,this.parser=!1,this.relaxedBody=!1,this.input=n,this.output=i,this.output.usingCache=!1,this.hasErrored=!1,this.input.on("error",e=>{this.hasErrored=!0,this.cleanup(),i.emit("error",e)})}cleanup(){this.cache&&this.cachePath&&r.unlink(this.cachePath,()=>!1)}createReadCache(){this.cache=r.createReadStream(this.cachePath),this.cache.once("error",e=>{this.cleanup(),this.output.emit("error",e)}),this.cache.once("close",()=>{this.cleanup()}),this.cache.pipe(this.output)}sendNextChunk(){if(this.hasErrored)return;if(this.readPos>=this.chunks.length)return this.cache?this.createReadCache():this.output.end();let e=this.chunks[this.readPos++];if(!1===this.output.write(e))return this.output.once("drain",()=>{this.sendNextChunk()});setImmediate(()=>this.sendNextChunk())}sendSignedOutput(){let e=0,t=()=>{if(e>=this.keys.length)return this.output.write(this.parser.rawHeaders),setImmediate(()=>this.sendNextChunk());let i=this.keys[e++],r=n(this.headers,this.hashAlgo,this.bodyHash,{domainName:i.domainName,keySelector:i.keySelector,privateKey:i.privateKey,headerFieldNames:this.options.headerFieldNames,skipFields:this.options.skipFields});return r&&this.output.write(Buffer.from(r+"\r\n")),setImmediate(t)};if(this.bodyHash&&this.headers)return t();this.output.write(this.parser.rawHeaders),this.sendNextChunk()}createWriteCache(){this.output.usingCache=!0,this.cache=r.createWriteStream(this.cachePath),this.cache.once("error",e=>{this.cleanup(),this.relaxedBody.unpipe(this.cache),this.relaxedBody.on("readable",()=>{for(;null!==this.relaxedBody.read(););}),this.hasErrored=!0,this.output.emit("error",e)}),this.cache.once("close",()=>{this.sendSignedOutput()}),this.relaxedBody.removeAllListeners("readable"),this.relaxedBody.pipe(this.cache)}signStream(){this.parser=new e,this.relaxedBody=new t({hashAlgo:this.hashAlgo}),this.parser.on("headers",e=>{this.headers=e}),this.relaxedBody.on("hash",e=>{this.bodyHash=e}),this.relaxedBody.on("readable",()=>{let e;if(!this.cache)for(;null!==(e=this.relaxedBody.read());)if(this.chunks.push(e),this.chunklen+=e.length,this.chunklen>=this.cacheTreshold&&this.cachePath)return this.createWriteCache()}),this.relaxedBody.on("end",()=>{this.cache||this.sendSignedOutput()}),this.parser.pipe(this.relaxedBody),setImmediate(()=>this.input.pipe(this.parser))}}return dkim=class{constructor(e){this.options=e||{},this.keys=[].concat(this.options.keys||{domainName:e.domainName,keySelector:e.keySelector,privateKey:e.privateKey})}sign(e,t){let n=new i,r=e,o=!1;Buffer.isBuffer(e)?(o=e,r=new i):"string"==typeof e&&(o=Buffer.from(e),r=new i);let a=this.options;t&&Object.keys(t).length&&(a={},Object.keys(this.options||{}).forEach(e=>{a[e]=this.options[e]}),Object.keys(t||{}).forEach(e=>{e in a||(a[e]=t[e])}));let c=new s(a,this.keys,r,n);return setImmediate(()=>{c.signStream(),o&&setImmediate(()=>{r.end(o)})}),n}}}function requireHttpProxyClient(){if(hasRequiredHttpProxyClient)return httpProxyClient_1;hasRequiredHttpProxyClient=1;const e=require$$7,t=require$$1$1,n=require$$0$3;return httpProxyClient_1=function i(r,o,a,s){let c,l,d,u=n.parse(r);c={host:u.hostname,port:Number(u.port)?Number(u.port):"https:"===u.protocol?443:80},"https:"===u.protocol?(c.rejectUnauthorized=!1,l=t.connect.bind(t)):l=e.connect.bind(e);let p=!1,m=e=>{if(!p){p=!0;try{d.destroy()}catch(e){}s(e)}},h=()=>{let e=new Error("Proxy socket timed out");e.code="ETIMEDOUT",m(e)};d=l(c,()=>{if(p)return;let e={Host:a+":"+o,Connection:"close"};u.auth&&(e["Proxy-Authorization"]="Basic "+Buffer.from(u.auth).toString("base64")),d.write("CONNECT "+a+":"+o+" HTTP/1.1\r\n"+Object.keys(e).map(t=>t+": "+e[t]).join("\r\n")+"\r\n\r\n");let t="",n=e=>{let i,r;if(!p&&(t+=e.toString("binary"),i=t.match(/\r\n\r\n/))){if(d.removeListener("data",n),r=t.substr(i.index+i[0].length),t=t.substr(0,i.index),r&&d.unshift(Buffer.from(r,"binary")),p=!0,i=t.match(/^HTTP\/\d+\.\d+ (\d+)/i),!i||"2"!==(i[1]||"").charAt(0)){try{d.destroy()}catch(e){}return s(new Error("Invalid response from proxy"+(i&&": "+i[1]||"")))}return d.removeListener("error",m),d.removeListener("timeout",h),d.setTimeout(0),s(null,d)}};d.on("data",n)}),d.setTimeout(i.timeout||3e4),d.on("timeout",h),d.once("error",m)},httpProxyClient_1}function requireMailMessage(){if(hasRequiredMailMessage)return mailMessage;hasRequiredMailMessage=1;const e=requireShared(),t=requireMimeNode(),n=requireMimeFuncs();return mailMessage=class{constructor(e,t){this.mailer=e,this.data={},this.message=null,t=t||{};let n=e.options||{},i=e._defaults||{};Object.keys(t).forEach(e=>{this.data[e]=t[e]}),this.data.headers=this.data.headers||{},Object.keys(i).forEach(e=>{e in this.data?"headers"===e&&Object.keys(i.headers).forEach(e=>{e in this.data.headers||(this.data.headers[e]=i.headers[e])}):this.data[e]=i[e]}),["disableFileAccess","disableUrlAccess","normalizeHeaderKey"].forEach(e=>{e in n&&(this.data[e]=n[e])})}resolveContent(...t){return e.resolveContent(...t)}resolveAll(i){let r=[[this.data,"html"],[this.data,"text"],[this.data,"watchHtml"],[this.data,"amp"],[this.data,"icalEvent"]];this.data.alternatives&&this.data.alternatives.length&&this.data.alternatives.forEach((e,t)=>{r.push([this.data.alternatives,t])}),this.data.attachments&&this.data.attachments.length&&this.data.attachments.forEach((e,t)=>{e.filename||(e.filename=(e.path||e.href||"").split("/").pop().split("?").shift()||"attachment-"+(t+1),e.filename.indexOf(".")<0&&(e.filename+="."+n.detectExtension(e.contentType))),e.contentType||(e.contentType=n.detectMimeType(e.filename||e.path||e.href||"bin")),r.push([this.data.attachments,t])});let o=new t;["from","to","cc","bcc","sender","replyTo"].forEach(e=>{let t;this.message?t=[].concat(o._parseAddresses(this.message.getHeader("replyTo"===e?"reply-to":e))||[]):this.data[e]&&(t=[].concat(o._parseAddresses(this.data[e])||[])),t&&t.length?this.data[e]=t:e in this.data&&(this.data[e]=null)});["from","sender"].forEach(e=>{this.data[e]&&(this.data[e]=this.data[e].shift())});let a=0,s=()=>{if(a>=r.length)return i(null,this.data);let t=r[a++];if(!t[0]||!t[0][t[1]])return s();e.resolveContent(...t,(e,n)=>{if(e)return i(e);let r={content:n};t[0][t[1]]&&"object"==typeof t[0][t[1]]&&!Buffer.isBuffer(t[0][t[1]])&&Object.keys(t[0][t[1]]).forEach(e=>{e in r||["content","path","href","raw"].includes(e)||(r[e]=t[0][t[1]][e])}),t[0][t[1]]=r,s()})};setImmediate(()=>s())}normalize(e){let t=this.data.envelope||this.message.getEnvelope(),n=this.message.messageId();this.resolveAll((i,r)=>{if(i)return e(i);if(r.envelope=t,r.messageId=n,["html","text","watchHtml","amp"].forEach(e=>{r[e]&&r[e].content&&("string"==typeof r[e].content?r[e]=r[e].content:Buffer.isBuffer(r[e].content)&&(r[e]=r[e].content.toString()))}),r.icalEvent&&Buffer.isBuffer(r.icalEvent.content)&&(r.icalEvent.content=r.icalEvent.content.toString("base64"),r.icalEvent.encoding="base64"),r.alternatives&&r.alternatives.length&&r.alternatives.forEach(e=>{e&&e.content&&Buffer.isBuffer(e.content)&&(e.content=e.content.toString("base64"),e.encoding="base64")}),r.attachments&&r.attachments.length&&r.attachments.forEach(e=>{e&&e.content&&Buffer.isBuffer(e.content)&&(e.content=e.content.toString("base64"),e.encoding="base64")}),r.normalizedHeaders={},Object.keys(r.headers||{}).forEach(e=>{let t=[].concat(r.headers[e]||[]).shift();t=t&&t.value||t,t&&(["references","in-reply-to","message-id","content-id"].includes(e)&&(t=this.message._encodeHeaderValue(e,t)),r.normalizedHeaders[e]=t)}),r.list&&"object"==typeof r.list){this._getListHeaders(r.list).forEach(e=>{r.normalizedHeaders[e.key]=e.value.map(e=>e&&e.value||e).join(", ")})}return r.references&&(r.normalizedHeaders.references=this.message._encodeHeaderValue("references",r.references)),r.inReplyTo&&(r.normalizedHeaders["in-reply-to"]=this.message._encodeHeaderValue("in-reply-to",r.inReplyTo)),e(null,r)})}setMailerHeader(){this.message&&this.data.xMailer&&this.message.setHeader("X-Mailer",this.data.xMailer)}setPriorityHeaders(){if(this.message&&this.data.priority)switch((this.data.priority||"").toString().toLowerCase()){case"high":this.message.setHeader("X-Priority","1 (Highest)"),this.message.setHeader("X-MSMail-Priority","High"),this.message.setHeader("Importance","High");break;case"low":this.message.setHeader("X-Priority","5 (Lowest)"),this.message.setHeader("X-MSMail-Priority","Low"),this.message.setHeader("Importance","Low")}}setListHeaders(){this.message&&this.data.list&&"object"==typeof this.data.list&&this.data.list&&"object"==typeof this.data.list&&this._getListHeaders(this.data.list).forEach(e=>{e.value.forEach(t=>{this.message.addHeader(e.key,t)})})}_getListHeaders(e){return Object.keys(e).map(t=>({key:"list-"+t.toLowerCase().trim(),value:[].concat(e[t]||[]).map(e=>({prepared:!0,foldLines:!0,value:[].concat(e||[]).map(e=>{if("string"==typeof e&&(e={url:e}),e&&e.url){if("id"===t.toLowerCase().trim()){let t=e.comment||"";return t=n.isPlainText(t)?'"'+t+'"':n.encodeWord(t),(e.comment?t+" ":"")+this._formatListUrl(e.url).replace(/^<[^:]+\/{,2}/,"")}let i=e.comment||"";return n.isPlainText(i)||(i=n.encodeWord(i)),this._formatListUrl(e.url)+(e.comment?" ("+i+")":"")}return""}).filter(e=>e).join(", ")}))}))}_formatListUrl(e){return e=e.replace(/[\s<]+|[\s>]+/g,""),/^(https?|mailto|ftp):/.test(e)?"<"+e+">":/^[^@]+@[^@]+$/.test(e)?"<mailto:"+e+">":"<http://"+e+">"}},mailMessage}function requireMailer(){if(hasRequiredMailer)return mailer;hasRequiredMailer=1;const e=require$$0$a,t=requireShared(),n=requireMimeTypes(),i=requireMailComposer(),r=requireDkim(),o=requireHttpProxyClient(),a=require$$0$8,s=require$$0$3,c=require$$9,l=requireMailMessage(),d=require$$7,u=require$$4,p=require$$2__default;return mailer=class extends e{constructor(e,n,i){super(),this.options=n||{},this._defaults=i||{},this._defaultPlugins={compile:[(...e)=>this._convertDataImages(...e)],stream:[]},this._userPlugins={compile:[],stream:[]},this.meta=new Map,this.dkim=!!this.options.dkim&&new r(this.options.dkim),this.transporter=e,this.transporter.mailer=this,this.logger=t.getLogger(this.options,{component:this.options.component||"mail"}),this.logger.debug({tnx:"create"},"Creating transport: %s",this.getVersionString()),"function"==typeof this.transporter.on&&(this.transporter.on("log",e=>{this.logger.debug({tnx:"transport"},"%s: %s",e.type,e.message)}),this.transporter.on("error",e=>{this.logger.error({err:e,tnx:"transport"},"Transport Error: %s",e.message),this.emit("error",e)}),this.transporter.on("idle",(...e)=>{this.emit("idle",...e)})),["close","isIdle","verify"].forEach(e=>{this[e]=(...t)=>"function"==typeof this.transporter[e]?("verify"===e&&"function"==typeof this.getSocket&&(this.transporter.getSocket=this.getSocket,this.getSocket=!1),this.transporter[e](...t)):(this.logger.warn({tnx:"transport",methodName:e},"Non existing method %s called for transport",e),!1)}),this.options.proxy&&"string"==typeof this.options.proxy&&this.setupProxy(this.options.proxy)}use(e,t){return e=(e||"").toString(),this._userPlugins.hasOwnProperty(e)?this._userPlugins[e].push(t):this._userPlugins[e]=[t],this}sendMail(e,n=null){let o;n||(o=new Promise((e,i)=>{n=t.callbackPromise(e,i)})),"function"==typeof this.getSocket&&(this.transporter.getSocket=this.getSocket,this.getSocket=!1);let a=new l(this,e);return this.logger.debug({tnx:"transport",name:this.transporter.name,version:this.transporter.version,action:"send"},"Sending mail using %s/%s",this.transporter.name,this.transporter.version),this._processPlugins("compile",a,e=>{if(e)return this.logger.error({err:e,tnx:"plugin",action:"compile"},"PluginCompile Error: %s",e.message),n(e);a.message=new i(a.data).compile(),a.setMailerHeader(),a.setPriorityHeaders(),a.setListHeaders(),this._processPlugins("stream",a,e=>{if(e)return this.logger.error({err:e,tnx:"plugin",action:"stream"},"PluginStream Error: %s",e.message),n(e);(a.data.dkim||this.dkim)&&a.message.processFunc(e=>{let t=a.data.dkim?new r(a.data.dkim):this.dkim;return this.logger.debug({tnx:"DKIM",messageId:a.message.messageId(),dkimDomains:t.keys.map(e=>e.keySelector+"."+e.domainName).join(", ")},"Signing outgoing message with %s keys",t.keys.length),t.sign(e,a.data._dkim)}),this.transporter.send(a,(...e)=>{e[0]&&this.logger.error({err:e[0],tnx:"transport",action:"send"},"Send Error: %s",e[0].message),n(...e)})})}),o}getVersionString(){return a.format("%s (%s; +%s; %s/%s)",c.name,c.version,c.homepage,this.transporter.name,this.transporter.version)}_processPlugins(e,t,n){if(e=(e||"").toString(),!this._userPlugins.hasOwnProperty(e))return n();let i=this._userPlugins[e]||[],r=this._defaultPlugins[e]||[];if(i.length&&this.logger.debug({tnx:"transaction",pluginCount:i.length,step:e},"Using %s plugins for %s",i.length,e),i.length+r.length===0)return n();let o=0,a="default",s=()=>{let e="default"===a?r:i;if(o>=e.length){if("default"!==a||!i.length)return n();a="user",o=0,e=i}(0,e[o++])(t,e=>{if(e)return n(e);s()})};s()}setupProxy(e){let t=s.parse(e);this.getSocket=(e,n)=>{let i=t.protocol.replace(/:$/,"").toLowerCase();if(this.meta.has("proxy_handler_"+i))return this.meta.get("proxy_handler_"+i)(t,e,n);switch(i){case"http":case"https":return void o(t.href,e.port,e.host,(e,t)=>e?n(e):n(null,{connection:t}));case"socks":case"socks5":case"socks4":case"socks4a":{if(!this.meta.has("proxy_socks_module"))return n(new Error("Socks module not loaded"));let i=i=>{let r=!!this.meta.get("proxy_socks_module").SocksClient,o=r?this.meta.get("proxy_socks_module").SocksClient:this.meta.get("proxy_socks_module"),a=Number(t.protocol.replace(/\D/g,""))||5,s={proxy:{ipaddress:i,port:Number(t.port),type:a},[r?"destination":"target"]:{host:e.host,port:e.port},command:"connect"};if(t.auth){let e=decodeURIComponent(t.auth.split(":").shift()),n=decodeURIComponent(t.auth.split(":").pop());r?(s.proxy.userId=e,s.proxy.password=n):4===a?s.userid=e:s.authentication={username:e,password:n}}o.createConnection(s,(e,t)=>e?n(e):n(null,{connection:t.socket||t}))};return d.isIP(t.hostname)?i(t.hostname):u.resolve(t.hostname,(e,t)=>{if(e)return n(e);i(Array.isArray(t)?t[0]:t)})}}n(new Error("Unknown proxy configuration"))}}_convertDataImages(e,t){if(!this.options.attachDataUrls&&!e.data.attachDataUrls||!e.data.html)return t();e.resolveContent(e.data,"html",(i,r)=>{if(i)return t(i);let o=0;r=(r||"").toString().replace(/(<img\b[^<>]{0,1024} src\s{0,20}=[\s"']{0,20})(data:([^;]+);[^"'>\s]+)/gi,(t,i,r,a)=>{let s=p.randomBytes(10).toString("hex")+"@localhost";return e.data.attachments||(e.data.attachments=[]),Array.isArray(e.data.attachments)||(e.data.attachments=[].concat(e.data.attachments||[])),e.data.attachments.push({path:r,cid:s,filename:"image-"+ ++o+"."+n.detectExtension(a)}),i+"cid:"+s}),e.data.html=r,t()})}set(e,t){return this.meta.set(e,t)}get(e){return this.meta.get(e)}},mailer}function requireDataStream(){if(hasRequiredDataStream)return dataStream;hasRequiredDataStream=1;const e=require$$0$4.Transform;return dataStream=class extends e{constructor(e){super(e),this.options=e||{},this._curLine="",this.inByteCount=0,this.outByteCount=0,this.lastByte=!1}_transform(e,t,n){let i,r,o,a=[],s=0,c=0;if(!e||!e.length)return n();for("string"==typeof e&&(e=Buffer.from(e)),this.inByteCount+=e.length,i=0,r=e.length;i<r;i++)46===e[i]?(i&&10===e[i-1]||!i&&(!this.lastByte||10===this.lastByte))&&(o=e.slice(c,i+1),a.push(o),a.push(Buffer.from(".")),s+=o.length+1,c=i+1):10===e[i]&&(i&&13!==e[i-1]||!i&&13!==this.lastByte)&&(i>c?(o=e.slice(c,i),a.push(o),s+=o.length+2):s+=2,a.push(Buffer.from("\r\n")),c=i+1);s?(c<e.length&&(o=e.slice(c),a.push(o),s+=o.length),this.outByteCount+=s,this.push(Buffer.concat(a,s))):(this.outByteCount+=e.length,this.push(e)),this.lastByte=e[e.length-1],n()}_flush(e){let t;t=10===this.lastByte?Buffer.from(".\r\n"):13===this.lastByte?Buffer.from("\n.\r\n"):Buffer.from("\r\n.\r\n"),this.outByteCount+=t.length,this.push(t),e()}},dataStream}function requireSmtpConnection(){if(hasRequiredSmtpConnection)return smtpConnection;hasRequiredSmtpConnection=1;const e=require$$9,t=require$$0$a.EventEmitter,n=require$$7,i=require$$1$1,r=require$$0$6,o=require$$2__default,a=requireDataStream(),s=require$$0$4.PassThrough,c=requireShared(),l=6e5;return smtpConnection=class extends t{constructor(t){super(t),this.id=o.randomBytes(8).toString("base64").replace(/\W/g,""),this.stage="init",this.options=t||{},this.secureConnection=!!this.options.secure,this.alreadySecured=!!this.options.secured,this.port=Number(this.options.port)||(this.secureConnection?465:587),this.host=this.options.host||"localhost",this.servername=this.options.servername?this.options.servername:!n.isIP(this.host)&&this.host,this.allowInternalNetworkInterfaces=this.options.allowInternalNetworkInterfaces||!1,void 0===this.options.secure&&465===this.port&&(this.secureConnection=!0),this.name=this.options.name||this._getHostname(),this.logger=c.getLogger(this.options,{component:this.options.component||"smtp-connection",sid:this.id}),this.customAuth=new Map,Object.keys(this.options.customAuth||{}).forEach(e=>{let t=(e||"").toString().trim().toUpperCase();t&&this.customAuth.set(t,this.options.customAuth[e])}),this.version=e.version,this.authenticated=!1,this.destroyed=!1,this.secure=!!this.secureConnection,this._remainder="",this._responseQueue=[],this.lastServerResponse=!1,this._socket=!1,this._supportedAuth=[],this.allowsAuth=!1,this._envelope=!1,this._supportedExtensions=[],this._maxAllowedSize=0,this._responseActions=[],this._recipientQueue=[],this._greetingTimeout=!1,this._connectionTimeout=!1,this._destroyed=!1,this._closing=!1,this._onSocketData=e=>this._onData(e),this._onSocketError=e=>this._onError(e,"ESOCKET",!1,"CONN"),this._onSocketClose=()=>this._onClose(),this._onSocketEnd=()=>this._onEnd(),this._onSocketTimeout=()=>this._onTimeout()}connect(e){if("function"==typeof e){this.once("connect",()=>{this.logger.debug({tnx:"smtp"},"SMTP handshake finished"),e()});const t=this._isDestroyedMessage("connect");if(t)return e(this._formatError(t,"ECONNECTION",!1,"CONN"))}let t={port:this.port,host:this.host,allowInternalNetworkInterfaces:this.allowInternalNetworkInterfaces,timeout:this.options.dnsTimeout||3e4};this.options.localAddress&&(t.localAddress=this.options.localAddress);let r=()=>{this._connectionTimeout=setTimeout(()=>{this._onError("Connection timeout","ETIMEDOUT",!1,"CONN")},this.options.connectionTimeout||12e4),this._socket.on("error",this._onSocketError)};return this.options.connection?(this._socket=this.options.connection,r(),void(this.secureConnection&&!this.alreadySecured?setImmediate(()=>this._upgradeConnection(e=>{e?this._onError(new Error("Error initiating TLS - "+(e.message||e)),"ETLS",!1,"CONN"):this._onConnect()})):setImmediate(()=>this._onConnect()))):this.options.socket?(this._socket=this.options.socket,c.resolveHostname(t,(e,n)=>{if(e)return setImmediate(()=>this._onError(e,"EDNS",!1,"CONN"));this.logger.debug({tnx:"dns",source:t.host,resolved:n.host,cached:!!n.cached},"Resolved %s as %s [cache %s]",t.host,n.host,n.cached?"hit":"miss"),Object.keys(n).forEach(e=>{"_"!==e.charAt(0)&&n[e]&&(t[e]=n[e])});try{this._socket.connect(this.port,this.host,()=>{this._socket.setKeepAlive(!0),this._onConnect()}),r()}catch(e){return setImmediate(()=>this._onError(e,"ECONNECTION",!1,"CONN"))}})):this.secureConnection?(this.options.tls&&Object.keys(this.options.tls).forEach(e=>{t[e]=this.options.tls[e]}),this.servername&&!t.servername&&(t.servername=this.servername),c.resolveHostname(t,(e,n)=>{if(e)return setImmediate(()=>this._onError(e,"EDNS",!1,"CONN"));this.logger.debug({tnx:"dns",source:t.host,resolved:n.host,cached:!!n.cached},"Resolved %s as %s [cache %s]",t.host,n.host,n.cached?"hit":"miss"),Object.keys(n).forEach(e=>{"_"!==e.charAt(0)&&n[e]&&(t[e]=n[e])});try{this._socket=i.connect(t,()=>{this._socket.setKeepAlive(!0),this._onConnect()}),r()}catch(e){return setImmediate(()=>this._onError(e,"ECONNECTION",!1,"CONN"))}})):c.resolveHostname(t,(e,i)=>{if(e)return setImmediate(()=>this._onError(e,"EDNS",!1,"CONN"));this.logger.debug({tnx:"dns",source:t.host,resolved:i.host,cached:!!i.cached},"Resolved %s as %s [cache %s]",t.host,i.host,i.cached?"hit":"miss"),Object.keys(i).forEach(e=>{"_"!==e.charAt(0)&&i[e]&&(t[e]=i[e])});try{this._socket=n.connect(t,()=>{this._socket.setKeepAlive(!0),this._onConnect()}),r()}catch(e){return setImmediate(()=>this._onError(e,"ECONNECTION",!1,"CONN"))}})}quit(){this._sendCommand("QUIT"),this._responseActions.push(this.close)}close(){if(clearTimeout(this._connectionTimeout),clearTimeout(this._greetingTimeout),this._responseActions=[],this._closing)return;this._closing=!0;let e="end";"init"===this.stage&&(e="destroy"),this.logger.debug({tnx:"smtp"},'Closing connection to the server using "%s"',e);let t=this._socket&&this._socket.socket||this._socket;if(t&&!t.destroyed)try{t[e]()}catch(e){}this._destroy()}login(e,t){const n=this._isDestroyedMessage("login");if(n)return t(this._formatError(n,"ECONNECTION",!1,"API"));if(this._auth=e||{},this._authMethod=(this._auth.method||"").toString().trim().toUpperCase()||!1,this._authMethod||!this._auth.oauth2||this._auth.credentials?this._authMethod&&("XOAUTH2"!==this._authMethod||this._auth.oauth2)||(this._authMethod=(this._supportedAuth[0]||"PLAIN").toUpperCase().trim()):this._authMethod="XOAUTH2",!("XOAUTH2"===this._authMethod||this._auth.credentials&&this._auth.credentials.user&&this._auth.credentials.pass)){if(!(this._auth.user&&this._auth.pass||this.customAuth.has(this._authMethod)))return t(this._formatError('Missing credentials for "'+this._authMethod+'"',"EAUTH",!1,"API"));this._auth.credentials={user:this._auth.user,pass:this._auth.pass,options:this._auth.options}}if(this.customAuth.has(this._authMethod)){let e,n=this.customAuth.get(this._authMethod),i=!1,r=()=>{i||(i=!0,this.logger.info({tnx:"smtp",username:this._auth.user,action:"authenticated",method:this._authMethod},"User %s authenticated",JSON.stringify(this._auth.user)),this.authenticated=!0,t(null,!0))},o=n=>{i||(i=!0,t(this._formatError(n,"EAUTH",e,"AUTH "+this._authMethod)))},a=n({auth:this._auth,method:this._authMethod,extensions:[].concat(this._supportedExtensions),authMethods:[].concat(this._supportedAuth),maxAllowedSize:this._maxAllowedSize||!1,sendCommand:(t,n)=>{let i;return n||(i=new Promise((e,t)=>{n=c.callbackPromise(e,t)})),this._responseActions.push(i=>{e=i;let r=i.match(/^(\d+)(?:\s(\d+\.\d+\.\d+))?\s/),o={command:t,response:i};r?(o.status=Number(r[1])||0,r[2]&&(o.code=r[2]),o.text=i.substr(r[0].length)):(o.text=i,o.status=0),n(null,o)}),setImmediate(()=>this._sendCommand(t)),i},resolve:r,reject:o});return void(a&&"function"==typeof a.catch&&a.then(r).catch(o))}switch(this._authMethod){case"XOAUTH2":return void this._handleXOauth2Token(!1,t);case"LOGIN":return this._responseActions.push(e=>{this._actionAUTH_LOGIN_USER(e,t)}),void this._sendCommand("AUTH LOGIN");case"PLAIN":return this._responseActions.push(e=>{this._actionAUTHComplete(e,t)}),void this._sendCommand("AUTH PLAIN "+Buffer.from("\0"+this._auth.credentials.user+"\0"+this._auth.credentials.pass,"utf-8").toString("base64"),"AUTH PLAIN "+Buffer.from("\0"+this._auth.credentials.user+"\0/* secret */","utf-8").toString("base64"));case"CRAM-MD5":return this._responseActions.push(e=>{this._actionAUTH_CRAM_MD5(e,t)}),void this._sendCommand("AUTH CRAM-MD5")}return t(this._formatError('Unknown authentication method "'+this._authMethod+'"',"EAUTH",!1,"API"))}send(e,t,n){if(!t)return n(this._formatError("Empty message","EMESSAGE",!1,"API"));const i=this._isDestroyedMessage("send message");if(i)return n(this._formatError(i,"ECONNECTION",!1,"API"));if(this._maxAllowedSize&&e.size>this._maxAllowedSize)return setImmediate(()=>{n(this._formatError("Message size larger than allowed "+this._maxAllowedSize,"EMESSAGE",!1,"MAIL FROM"))});let r=!1,o=function(){r||(r=!0,n(...arguments))};"function"==typeof t.on&&t.on("error",e=>o(this._formatError(e,"ESTREAM",!1,"API")));let a=Date.now();this._setEnvelope(e,(e,n)=>{if(e){let n=new s;return"function"==typeof t.pipe?t.pipe(n):(n.write(t),n.end()),o(e)}let i=Date.now(),r=this._createSendStream((e,t)=>e?o(e):(n.envelopeTime=i-a,n.messageTime=Date.now()-i,n.messageSize=r.outByteCount,n.response=t,o(null,n)));"function"==typeof t.pipe?t.pipe(r):(r.write(t),r.end())})}reset(e){this._sendCommand("RSET"),this._responseActions.push(t=>"2"!==t.charAt(0)?e(this._formatError("Could not reset session state. response="+t,"EPROTOCOL",t,"RSET")):(this._envelope=!1,e(null,!0)))}_onConnect(){clearTimeout(this._connectionTimeout),this.logger.info({tnx:"network",localAddress:this._socket.localAddress,localPort:this._socket.localPort,remoteAddress:this._socket.remoteAddress,remotePort:this._socket.remotePort},"%s established to %s:%s",this.secure?"Secure connection":"Connection",this._socket.remoteAddress,this._socket.remotePort),this._destroyed?this.close():(this.stage="connected",this._socket.removeListener("data",this._onSocketData),this._socket.removeListener("timeout",this._onSocketTimeout),this._socket.removeListener("close",this._onSocketClose),this._socket.removeListener("end",this._onSocketEnd),this._socket.on("data",this._onSocketData),this._socket.once("close",this._onSocketClose),this._socket.once("end",this._onSocketEnd),this._socket.setTimeout(this.options.socketTimeout||l),this._socket.on("timeout",this._onSocketTimeout),this._greetingTimeout=setTimeout(()=>{this._socket&&!this._destroyed&&this._responseActions[0]===this._actionGreeting&&this._onError("Greeting never received","ETIMEDOUT",!1,"CONN")},this.options.greetingTimeout||3e4),this._responseActions.push(this._actionGreeting),this._socket.resume())}_onData(e){if(this._destroyed||!e||!e.length)return;let t,n=(e||"").toString("binary"),i=(this._remainder+n).split(/\r?\n/);this._remainder=i.pop();for(let e=0,n=i.length;e<n;e++)this._responseQueue.length&&(t=this._responseQueue[this._responseQueue.length-1],/^\d+-/.test(t.split("\n").pop()))?this._responseQueue[this._responseQueue.length-1]+="\n"+i[e]:this._responseQueue.push(i[e]);this._responseQueue.length&&(t=this._responseQueue[this._responseQueue.length-1],/^\d+-/.test(t.split("\n").pop()))||this._processResponse()}_onError(e,t,n,i){clearTimeout(this._connectionTimeout),clearTimeout(this._greetingTimeout),this._destroyed||(e=this._formatError(e,t,n,i),this.logger.error(n,e.message),this.emit("error",e),this.close())}_formatError(e,t,n,i){let r;r=/Error\]$/i.test(Object.prototype.toString.call(e))?e:new Error(e),t&&"Error"!==t&&(r.code=t),n&&(r.response=n,r.message+=": "+n);let o="string"==typeof n&&Number((n.match(/^\d+/)||[])[0])||!1;return o&&(r.responseCode=o),i&&(r.command=i),r}_onClose(){let e=!1;return this._remainder&&this._remainder.trim()&&((this.options.debug||this.options.transactionLog)&&this.logger.debug({tnx:"server"},this._remainder.replace(/\r?\n$/,"")),this.lastServerResponse=e=this._remainder.trim()),this.logger.info({tnx:"network"},"Connection closed"),this.upgrading&&!this._destroyed?this._onError(new Error("Connection closed unexpectedly"),"ETLS",e,"CONN"):[this._actionGreeting,this.close].includes(this._responseActions[0])||this._destroyed?/^[45]\d{2}\b/.test(e)?this._onError(new Error("Connection closed unexpectedly"),"ECONNECTION",e,"CONN"):void this._destroy():this._onError(new Error("Connection closed unexpectedly"),"ECONNECTION",e,"CONN")}_onEnd(){this._socket&&!this._socket.destroyed&&this._socket.destroy()}_onTimeout(){return this._onError(new Error("Timeout"),"ETIMEDOUT",!1,"CONN")}_destroy(){this._destroyed||(this._destroyed=!0,this.emit("end"))}_upgradeConnection(e){this._socket.removeListener("data",this._onSocketData),this._socket.removeListener("timeout",this._onSocketTimeout);let t=this._socket,n={socket:this._socket,host:this.host};Object.keys(this.options.tls||{}).forEach(e=>{n[e]=this.options.tls[e]}),this.servername&&!n.servername&&(n.servername=this.servername),this.upgrading=!0;try{this._socket=i.connect(n,()=>(this.secure=!0,this.upgrading=!1,this._socket.on("data",this._onSocketData),t.removeListener("close",this._onSocketClose),t.removeListener("end",this._onSocketEnd),e(null,!0)))}catch(t){return e(t)}this._socket.on("error",this._onSocketError),this._socket.once("close",this._onSocketClose),this._socket.once("end",this._onSocketEnd),this._socket.setTimeout(this.options.socketTimeout||l),this._socket.on("timeout",this._onSocketTimeout),t.resume()}_processResponse(){if(!this._responseQueue.length)return!1;let e=this.lastServerResponse=(this._responseQueue.shift()||"").toString();if(/^\d+-/.test(e.split("\n").pop()))return;(this.options.debug||this.options.transactionLog)&&this.logger.debug({tnx:"server"},e.replace(/\r?\n$/,"")),e.trim()||setImmediate(()=>this._processResponse());let t=this._responseActions.shift();if("function"!=typeof t)return this._onError(new Error("Unexpected Response"),"EPROTOCOL",e,"CONN");t.call(this,e),setImmediate(()=>this._processResponse())}_sendCommand(e,t){if(!this._destroyed){if(this._socket.destroyed)return this.close();(this.options.debug||this.options.transactionLog)&&this.logger.debug({tnx:"client"},(t||e||"").toString().replace(/\r?\n$/,"")),this._socket.write(Buffer.from(e+"\r\n","utf-8"))}}_setEnvelope(e,t){let n=[],i=!1;if(this._envelope=e||{},this._envelope.from=(this._envelope.from&&this._envelope.from.address||this._envelope.from||"").toString().trim(),this._envelope.to=[].concat(this._envelope.to||[]).map(e=>(e&&e.address||e||"").toString().trim()),!this._envelope.to.length)return t(this._formatError("No recipients defined","EENVELOPE",!1,"API"));if(this._envelope.from&&/[\r\n<>]/.test(this._envelope.from))return t(this._formatError("Invalid sender "+JSON.stringify(this._envelope.from),"EENVELOPE",!1,"API"));/[\x80-\uFFFF]/.test(this._envelope.from)&&(i=!0);for(let e=0,n=this._envelope.to.length;e<n;e++){if(!this._envelope.to[e]||/[\r\n<>]/.test(this._envelope.to[e]))return t(this._formatError("Invalid recipient "+JSON.stringify(this._envelope.to[e]),"EENVELOPE",!1,"API"));/[\x80-\uFFFF]/.test(this._envelope.to[e])&&(i=!0)}if(this._envelope.rcptQueue=JSON.parse(JSON.stringify(this._envelope.to||[])),this._envelope.rejected=[],this._envelope.rejectedErrors=[],this._envelope.accepted=[],this._envelope.dsn)try{this._envelope.dsn=this._setDsnEnvelope(this._envelope.dsn)}catch(e){return t(this._formatError("Invalid DSN "+e.message,"EENVELOPE",!1,"API"))}this._responseActions.push(e=>{this._actionMAIL(e,t)}),i&&this._supportedExtensions.includes("SMTPUTF8")&&(n.push("SMTPUTF8"),this._usingSmtpUtf8=!0),this._envelope.use8BitMime&&this._supportedExtensions.includes("8BITMIME")&&(n.push("BODY=8BITMIME"),this._using8BitMime=!0),this._envelope.size&&this._supportedExtensions.includes("SIZE")&&n.push("SIZE="+this._envelope.size),this._envelope.dsn&&this._supportedExtensions.includes("DSN")&&(this._envelope.dsn.ret&&n.push("RET="+c.encodeXText(this._envelope.dsn.ret)),this._envelope.dsn.envid&&n.push("ENVID="+c.encodeXText(this._envelope.dsn.envid))),this._sendCommand("MAIL FROM:<"+this._envelope.from+">"+(n.length?" "+n.join(" "):""))}_setDsnEnvelope(e){let t=(e.ret||e.return||"").toString().toUpperCase()||null;if(t)switch(t){case"HDRS":case"HEADERS":t="HDRS";break;case"FULL":case"BODY":t="FULL"}if(t&&!["FULL","HDRS"].includes(t))throw new Error("ret: "+JSON.stringify(t));let n=(e.envid||e.id||"").toString()||null,i=e.notify||null;if(i){"string"==typeof i&&(i=i.split(",")),i=i.map(e=>e.trim().toUpperCase());let e=["NEVER","SUCCESS","FAILURE","DELAY"],t=i.filter(t=>!e.includes(t));if(t.length||i.length>1&&i.includes("NEVER"))throw new Error("notify: "+JSON.stringify(i.join(",")));i=i.join(",")}let r=(e.recipient||e.orcpt||"").toString()||null;return r&&r.indexOf(";")<0&&(r="rfc822;"+r),{ret:t,envid:n,notify:i,orcpt:r}}_getDsnRcptToArgs(){let e=[];return this._envelope.dsn&&this._supportedExtensions.includes("DSN")&&(this._envelope.dsn.notify&&e.push("NOTIFY="+c.encodeXText(this._envelope.dsn.notify)),this._envelope.dsn.orcpt&&e.push("ORCPT="+c.encodeXText(this._envelope.dsn.orcpt))),e.length?" "+e.join(" "):""}_createSendStream(e){let t,n=new a;return this.options.lmtp?this._envelope.accepted.forEach((t,n)=>{let i=n===this._envelope.accepted.length-1;this._responseActions.push(n=>{this._actionLMTPStream(t,i,n,e)})}):this._responseActions.push(t=>{this._actionSMTPStream(t,e)}),n.pipe(this._socket,{end:!1}),this.options.debug&&(t=new s,t.on("readable",()=>{let e;for(;e=t.read();)this.logger.debug({tnx:"message"},e.toString("binary").replace(/\r?\n$/,""))}),n.pipe(t)),n.once("end",()=>{this.logger.info({tnx:"message",inByteCount:n.inByteCount,outByteCount:n.outByteCount},"<%s bytes encoded mime message (source size %s bytes)>",n.outByteCount,n.inByteCount)}),n}_actionGreeting(e){clearTimeout(this._greetingTimeout),"220"===e.substr(0,3)?this.options.lmtp?(this._responseActions.push(this._actionLHLO),this._sendCommand("LHLO "+this.name)):(this._responseActions.push(this._actionEHLO),this._sendCommand("EHLO "+this.name)):this._onError(new Error("Invalid greeting. response="+e),"EPROTOCOL",e,"CONN")}_actionLHLO(e){"2"===e.charAt(0)?this._actionEHLO(e):this._onError(new Error("Invalid LHLO. response="+e),"EPROTOCOL",e,"LHLO")}_actionEHLO(e){let t;if("421"!==e.substr(0,3)){if("2"!==e.charAt(0))return this.options.requireTLS?void this._onError(new Error("EHLO failed but HELO does not support required STARTTLS. response="+e),"ECONNECTION",e,"EHLO"):(this._responseActions.push(this._actionHELO),void this._sendCommand("HELO "+this.name));if(this._ehloLines=e.split(/\r?\n/).map(e=>e.replace(/^\d+[ -]/,"").trim()).filter(e=>e).slice(1),!this.secure&&!this.options.ignoreTLS&&(/[ -]STARTTLS\b/im.test(e)||this.options.requireTLS))return this._sendCommand("STARTTLS"),void this._responseActions.push(this._actionSTARTTLS);/[ -]SMTPUTF8\b/im.test(e)&&this._supportedExtensions.push("SMTPUTF8"),/[ -]DSN\b/im.test(e)&&this._supportedExtensions.push("DSN"),/[ -]8BITMIME\b/im.test(e)&&this._supportedExtensions.push("8BITMIME"),/[ -]PIPELINING\b/im.test(e)&&this._supportedExtensions.push("PIPELINING"),/[ -]AUTH\b/i.test(e)&&(this.allowsAuth=!0),/[ -]AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)PLAIN/i.test(e)&&this._supportedAuth.push("PLAIN"),/[ -]AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)LOGIN/i.test(e)&&this._supportedAuth.push("LOGIN"),/[ -]AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)CRAM-MD5/i.test(e)&&this._supportedAuth.push("CRAM-MD5"),/[ -]AUTH(?:(\s+|=)[^\n]*\s+|\s+|=)XOAUTH2/i.test(e)&&this._supportedAuth.push("XOAUTH2"),(t=e.match(/[ -]SIZE(?:[ \t]+(\d+))?/im))&&(this._supportedExtensions.push("SIZE"),this._maxAllowedSize=Number(t[1])||0),this.emit("connect")}else this._onError(new Error("Server terminates connection. response="+e),"ECONNECTION",e,"EHLO")}_actionHELO(e){"2"===e.charAt(0)?(this.allowsAuth=!0,this.emit("connect")):this._onError(new Error("Invalid HELO. response="+e),"EPROTOCOL",e,"HELO")}_actionSTARTTLS(e){if("2"!==e.charAt(0))return this.options.opportunisticTLS?(this.logger.info({tnx:"smtp"},"Failed STARTTLS upgrade, continuing unencrypted"),this.emit("connect")):void this._onError(new Error("Error upgrading connection with STARTTLS"),"ETLS",e,"STARTTLS");this._upgradeConnection((e,t)=>{e?this._onError(new Error("Error initiating TLS - "+(e.message||e)),"ETLS",!1,"STARTTLS"):(this.logger.info({tnx:"smtp"},"Connection upgraded with STARTTLS"),t?this.options.lmtp?(this._responseActions.push(this._actionLHLO),this._sendCommand("LHLO "+this.name)):(this._responseActions.push(this._actionEHLO),this._sendCommand("EHLO "+this.name)):this.emit("connect"))})}_actionAUTH_LOGIN_USER(e,t){/^334[ -]/.test(e)?(this._responseActions.push(e=>{this._actionAUTH_LOGIN_PASS(e,t)}),this._sendCommand(Buffer.from(this._auth.credentials.user+"","utf-8").toString("base64"))):t(this._formatError('Invalid login sequence while waiting for "334 VXNlcm5hbWU6"',"EAUTH",e,"AUTH LOGIN"))}_actionAUTH_CRAM_MD5(e,t){let n=e.match(/^334\s+(.+)$/),i="";if(!n)return t(this._formatError("Invalid login sequence while waiting for server challenge string","EAUTH",e,"AUTH CRAM-MD5"));i=n[1];let r=Buffer.from(i,"base64").toString("ascii"),a=o.createHmac("md5",this._auth.credentials.pass);a.update(r);let s=this._auth.credentials.user+" "+a.digest("hex");this._responseActions.push(e=>{this._actionAUTH_CRAM_MD5_PASS(e,t)}),this._sendCommand(Buffer.from(s).toString("base64"),Buffer.from(this._auth.credentials.user+" /* secret */").toString("base64"))}_actionAUTH_CRAM_MD5_PASS(e,t){if(!e.match(/^235\s+/))return t(this._formatError('Invalid login sequence while waiting for "235"',"EAUTH",e,"AUTH CRAM-MD5"));this.logger.info({tnx:"smtp",username:this._auth.user,action:"authenticated",method:this._authMethod},"User %s authenticated",JSON.stringify(this._auth.user)),this.authenticated=!0,t(null,!0)}_actionAUTH_LOGIN_PASS(e,t){if(!/^334[ -]/.test(e))return t(this._formatError('Invalid login sequence while waiting for "334 UGFzc3dvcmQ6"',"EAUTH",e,"AUTH LOGIN"));this._responseActions.push(e=>{this._actionAUTHComplete(e,t)}),this._sendCommand(Buffer.from((this._auth.credentials.pass||"").toString(),"utf-8").toString("base64"),Buffer.from("/* secret */","utf-8").toString("base64"))}_actionAUTHComplete(e,t,n){return n||"function"!=typeof t||(n=t,t=!1),"334"===e.substr(0,3)?(this._responseActions.push(e=>{t||"XOAUTH2"!==this._authMethod?this._actionAUTHComplete(e,!0,n):setImmediate(()=>this._handleXOauth2Token(!0,n))}),void this._sendCommand("")):"2"!==e.charAt(0)?(this.logger.info({tnx:"smtp",username:this._auth.user,action:"authfail",method:this._authMethod},"User %s failed to authenticate",JSON.stringify(this._auth.user)),n(this._formatError("Invalid login","EAUTH",e,"AUTH "+this._authMethod))):(this.logger.info({tnx:"smtp",username:this._auth.user,action:"authenticated",method:this._authMethod},"User %s authenticated",JSON.stringify(this._auth.user)),this.authenticated=!0,void n(null,!0))}_actionMAIL(e,t){let n,i;if(2!==Number(e.charAt(0)))return n=this._usingSmtpUtf8&&/^550 /.test(e)&&/[\x80-\uFFFF]/.test(this._envelope.from)?"Internationalized mailbox name not allowed":"Mail command failed",t(this._formatError(n,"EENVELOPE",e,"MAIL FROM"));if(!this._envelope.rcptQueue.length)return t(this._formatError("Can't send mail - no recipients defined","EENVELOPE",!1,"API"));if(this._recipientQueue=[],this._supportedExtensions.includes("PIPELINING"))for(;this._envelope.rcptQueue.length;)i=this._envelope.rcptQueue.shift(),this._recipientQueue.push(i),this._responseActions.push(e=>{this._actionRCPT(e,t)}),this._sendCommand("RCPT TO:<"+i+">"+this._getDsnRcptToArgs());else i=this._envelope.rcptQueue.shift(),this._recipientQueue.push(i),this._responseActions.push(e=>{this._actionRCPT(e,t)}),this._sendCommand("RCPT TO:<"+i+">"+this._getDsnRcptToArgs())}_actionRCPT(e,t){let n,i,r=this._recipientQueue.shift();if(2!==Number(e.charAt(0))?(n=this._usingSmtpUtf8&&/^553 /.test(e)&&/[\x80-\uFFFF]/.test(r)?"Internationalized mailbox name not allowed":"Recipient command failed",this._envelope.rejected.push(r),i=this._formatError(n,"EENVELOPE",e,"RCPT TO"),i.recipient=r,this._envelope.rejectedErrors.push(i)):this._envelope.accepted.push(r),this._envelope.rcptQueue.length||this._recipientQueue.length)this._envelope.rcptQueue.length&&(r=this._envelope.rcptQueue.shift(),this._recipientQueue.push(r),this._responseActions.push(e=>{this._actionRCPT(e,t)}),this._sendCommand("RCPT TO:<"+r+">"+this._getDsnRcptToArgs()));else{if(!(this._envelope.rejected.length<this._envelope.to.length))return i=this._formatError("Can't send mail - all recipients were rejected","EENVELOPE",e,"RCPT TO"),i.rejected=this._envelope.rejected,i.rejectedErrors=this._envelope.rejectedErrors,t(i);this._responseActions.push(e=>{this._actionDATA(e,t)}),this._sendCommand("DATA")}}_actionDATA(e,t){if(!/^[23]/.test(e))return t(this._formatError("Data command failed","EENVELOPE",e,"DATA"));let n={accepted:this._envelope.accepted,rejected:this._envelope.rejected};this._ehloLines&&this._ehloLines.length&&(n.ehlo=this._ehloLines),this._envelope.rejectedErrors.length&&(n.rejectedErrors=this._envelope.rejectedErrors),t(null,n)}_actionSMTPStream(e,t){return 2!==Number(e.charAt(0))?t(this._formatError("Message failed","EMESSAGE",e,"DATA")):t(null,e)}_actionLMTPStream(e,t,n,i){let r;if(2!==Number(n.charAt(0))){r=this._formatError("Message failed for recipient "+e,"EMESSAGE",n,"DATA"),r.recipient=e,this._envelope.rejected.push(e),this._envelope.rejectedErrors.push(r);for(let t=0,n=this._envelope.accepted.length;t<n;t++)this._envelope.accepted[t]===e&&this._envelope.accepted.splice(t,1)}if(t)return i(null,n)}_handleXOauth2Token(e,t){this._auth.oauth2.getToken(e,(n,i)=>{if(n)return this.logger.info({tnx:"smtp",username:this._auth.user,action:"authfail",method:this._authMethod},"User %s failed to authenticate",JSON.stringify(this._auth.user)),t(this._formatError(n,"EAUTH",!1,"AUTH XOAUTH2"));this._responseActions.push(n=>{this._actionAUTHComplete(n,e,t)}),this._sendCommand("AUTH XOAUTH2 "+this._auth.oauth2.buildXOAuth2Token(i),"AUTH XOAUTH2 "+this._auth.oauth2.buildXOAuth2Token("/* secret */"))})}_isDestroyedMessage(e){if(this._destroyed)return"Cannot "+e+" - smtp connection is already destroyed.";if(this._socket){if(this._socket.destroyed)return"Cannot "+e+" - smtp connection socket is already destroyed.";if(!this._socket.writable)return"Cannot "+e+" - smtp connection socket is already half-closed."}}_getHostname(){let e;try{e=r.hostname()||""}catch(t){e="localhost"}return(!e||e.indexOf(".")<0)&&(e="[127.0.0.1]"),e.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)&&(e="["+e+"]"),e}},smtpConnection}function requireXoauth2(){if(hasRequiredXoauth2)return xoauth2;hasRequiredXoauth2=1;const e=require$$0$4.Stream,t=requireFetch(),n=require$$2__default,i=requireShared();return xoauth2=class extends e{constructor(e,t){if(super(),this.options=e||{},e&&e.serviceClient){if(!e.privateKey||!e.user)return void setImmediate(()=>this.emit("error",new Error('Options "privateKey" and "user" are required for service account!')));let t=Math.min(Math.max(Number(this.options.serviceRequestTimeout)||0,0),3600);this.options.serviceRequestTimeout=t||300}if(this.logger=i.getLogger({logger:t},{component:this.options.component||"OAuth2"}),this.provisionCallback="function"==typeof this.options.provisionCallback&&this.options.provisionCallback,this.options.accessUrl=this.options.accessUrl||"https://accounts.google.com/o/oauth2/token",this.options.customHeaders=this.options.customHeaders||{},this.options.customParams=this.options.customParams||{},this.accessToken=this.options.accessToken||!1,this.options.expires&&Number(this.options.expires))this.expires=this.options.expires;else{let e=Math.max(Number(this.options.timeout)||0,0);this.expires=e&&Date.now()+1e3*e||0}}getToken(e,t){if(!e&&this.accessToken&&(!this.expires||this.expires>Date.now()))return t(null,this.accessToken);let n=(...e)=>{e[0]?this.logger.error({err:e[0],tnx:"OAUTH2",user:this.options.user,action:"renew"},"Failed generating new Access Token for %s",this.options.user):this.logger.info({tnx:"OAUTH2",user:this.options.user,action:"renew"},"Generated new Access Token for %s",this.options.user),t(...e)};this.provisionCallback?this.provisionCallback(this.options.user,!!e,(e,t,i)=>{!e&&t&&(this.accessToken=t,this.expires=i||0),n(e,t)}):this.generateToken(n)}updateToken(e,t){this.accessToken=e,t=Math.max(Number(t)||0,0),this.expires=t&&Date.now()+1e3*t||0,this.emit("token",{user:this.options.user,accessToken:e||"",expires:this.expires})}generateToken(e){let t,n;if(this.options.serviceClient){let i,r=Math.floor(Date.now()/1e3),o={iss:this.options.serviceClient,scope:this.options.scope||"https://mail.google.com/",sub:this.options.user,aud:this.options.accessUrl,iat:r,exp:r+this.options.serviceRequestTimeout};try{i=this.jwtSignRS256(o)}catch(t){return e(new Error("Can't generate token. Check your auth options"))}t={grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:i},n={grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:o}}else{if(!this.options.refreshToken)return e(new Error("Can't create new access token for user"));t={client_id:this.options.clientId||"",client_secret:this.options.clientSecret||"",refresh_token:this.options.refreshToken,grant_type:"refresh_token"},n={client_id:this.options.clientId||"",client_secret:(this.options.clientSecret||"").substr(0,6)+"...",refresh_token:(this.options.refreshToken||"").substr(0,6)+"...",grant_type:"refresh_token"}}Object.keys(this.options.customParams).forEach(e=>{t[e]=this.options.customParams[e],n[e]=this.options.customParams[e]}),this.logger.debug({tnx:"OAUTH2",user:this.options.user,action:"generate"},"Requesting token using: %s",JSON.stringify(n)),this.postRequest(this.options.accessUrl,t,this.options,(t,n)=>{let i;if(t)return e(t);try{i=JSON.parse(n.toString())}catch(t){return e(t)}if(!i||"object"!=typeof i)return this.logger.debug({tnx:"OAUTH2",user:this.options.user,action:"post"},"Response: %s",(n||"").toString()),e(new Error("Invalid authentication response"));let r={};if(Object.keys(i).forEach(e=>{r[e]="access_token"!==e?i[e]:(i[e]||"").toString().substr(0,6)+"..."}),this.logger.debug({tnx:"OAUTH2",user:this.options.user,action:"post"},"Response: %s",JSON.stringify(r)),i.error){let t=i.error;return i.error_description&&(t+=": "+i.error_description),i.error_uri&&(t+=" ("+i.error_uri+")"),e(new Error(t))}return i.access_token?(this.updateToken(i.access_token,i.expires_in),e(null,this.accessToken)):e(new Error("No access token"))})}buildXOAuth2Token(e){let t=["user="+(this.options.user||""),"auth=Bearer "+(e||this.accessToken),"",""];return Buffer.from(t.join(""),"utf-8").toString("base64")}postRequest(e,n,i,r){let o=!1,a=[],s=0,c=t(e,{method:"post",headers:i.customHeaders,body:n,allowErrorResponse:!0});c.on("readable",()=>{let e;for(;null!==(e=c.read());)a.push(e),s+=e.length}),c.once("error",e=>{if(!o)return o=!0,r(e)}),c.once("end",()=>{if(!o)return o=!0,r(null,Buffer.concat(a,s))})}toBase64URL(e){return"string"==typeof e&&(e=Buffer.from(e)),e.toString("base64").replace(/[=]+/g,"").replace(/\+/g,"-").replace(/\//g,"_")}jwtSignRS256(e){e=['{"alg":"RS256","typ":"JWT"}',JSON.stringify(e)].map(e=>this.toBase64URL(e)).join(".");let t=n.createSign("RSA-SHA256").update(e).sign(this.options.privateKey);return e+"."+this.toBase64URL(t)}},xoauth2}function requirePoolResource(){if(hasRequiredPoolResource)return poolResource;hasRequiredPoolResource=1;const e=requireSmtpConnection(),t=requireShared().assign,n=requireXoauth2(),i=require$$0$a;return poolResource=class extends i{constructor(e){if(super(),this.pool=e,this.options=e.options,this.logger=this.pool.logger,this.options.auth)switch((this.options.auth.type||"").toString().toUpperCase()){case"OAUTH2":{let e=new n(this.options.auth,this.logger);e.provisionCallback=this.pool.mailer&&this.pool.mailer.get("oauth2_provision_cb")||e.provisionCallback,this.auth={type:"OAUTH2",user:this.options.auth.user,oauth2:e,method:"XOAUTH2"},e.on("token",e=>this.pool.mailer.emit("token",e)),e.on("error",e=>this.emit("error",e));break}default:if(!this.options.auth.user&&!this.options.auth.pass)break;this.auth={type:(this.options.auth.type||"").toString().toUpperCase()||"LOGIN",user:this.options.auth.user,credentials:{user:this.options.auth.user||"",pass:this.options.auth.pass,options:this.options.auth.options},method:(this.options.auth.method||"").trim().toUpperCase()||this.options.authMethod||!1}}this._connection=!1,this._connected=!1,this.messages=0,this.available=!0}connect(n){this.pool.getSocket(this.options,(i,r)=>{if(i)return n(i);let o=!1,a=this.options;r&&r.connection&&(this.logger.info({tnx:"proxy",remoteAddress:r.connection.remoteAddress,remotePort:r.connection.remotePort,destHost:a.host||"",destPort:a.port||"",action:"connected"},"Using proxied socket from %s:%s to %s:%s",r.connection.remoteAddress,r.connection.remotePort,a.host||"",a.port||""),a=t(!1,a),Object.keys(r).forEach(e=>{a[e]=r[e]})),this.connection=new e(a),this.connection.once("error",e=>{if(this.emit("error",e),!o)return o=!0,n(e)}),this.connection.once("end",()=>{if(this.close(),o)return;o=!0;let e=setTimeout(()=>{if(o)return;let e=new Error("Unexpected socket close");this.connection&&this.connection._socket&&this.connection._socket.upgrading&&(e.code="ETLS"),n(e)},1e3);try{e.unref()}catch(e){}}),this.connection.connect(()=>{if(!o)return this.auth&&(this.connection.allowsAuth||a.forceAuth)?void this.connection.login(this.auth,e=>{if(!o){if(o=!0,e)return this.connection.close(),this.emit("error",e),n(e);this._connected=!0,n(null,!0)}}):(o=!0,this._connected=!0,n(null,!0))})})}send(e,t){if(!this._connected)return this.connect(n=>n?t(n):this.send(e,t));let n=e.message.getEnvelope(),i=e.message.messageId(),r=[].concat(n.to||[]);r.length>3&&r.push("...and "+r.splice(2).length+" more"),this.logger.info({tnx:"send",messageId:i,cid:this.id},"Sending message %s using #%s to <%s>",i,this.id,r.join(", ")),e.data.dsn&&(n.dsn=e.data.dsn),this.connection.send(n,e.message.createReadStream(),(e,r)=>{if(this.messages++,e)return this.connection.close(),this.emit("error",e),t(e);r.envelope={from:n.from,to:n.to},r.messageId=i,setImmediate(()=>{let e;this.messages>=this.options.maxMessages?(e=new Error("Resource exhausted"),e.code="EMAXLIMIT",this.connection.close(),this.emit("error",e)):this.pool._checkRateLimit(()=>{this.available=!0,this.emit("available")})}),t(null,r)})}close(){this._connected=!1,this.auth&&this.auth.oauth2&&this.auth.oauth2.removeAllListeners(),this.connection&&this.connection.close(),this.emit("close")}},poolResource}const Aliyun={domains:["aliyun.com"],host:"smtp.aliyun.com",port:465,secure:!0},AOL={domains:["aol.com"],host:"smtp.aol.com",port:587},Bluewin={host:"smtpauths.bluewin.ch",domains:["bluewin.ch"],port:465},DebugMail={host:"debugmail.io",port:25},DynectEmail={aliases:["Dynect"],host:"smtp.dynect.net",port:25},Ethereal={aliases:["ethereal.email"],host:"smtp.ethereal.email",port:587},FastMail={domains:["fastmail.fm"],host:"smtp.fastmail.com",port:465,secure:!0},GandiMail={aliases:["Gandi","Gandi Mail"],host:"mail.gandi.net",port:587},Gmail={aliases:["Google Mail"],domains:["gmail.com","googlemail.com"],host:"smtp.gmail.com",port:465,secure:!0},Godaddy={host:"smtpout.secureserver.net",port:25},GodaddyAsia={host:"smtp.asia.secureserver.net",port:25},GodaddyEurope={host:"smtp.europe.secureserver.net",port:25},Hotmail={aliases:["Outlook","Outlook.com","Hotmail.com"],domains:["hotmail.com","outlook.com"],host:"smtp-mail.outlook.com",port:587},iCloud={aliases:["Me","Mac"],domains:["me.com","mac.com"],host:"smtp.mail.me.com",port:587},Infomaniak={host:"mail.infomaniak.com",domains:["ik.me","ikmail.com","etik.com"],port:587},Loopia={host:"mailcluster.loopia.se",port:465},Maildev={port:1025,ignoreTLS:!0},Mailgun={host:"smtp.mailgun.org",port:465,secure:!0},Mailjet={host:"in.mailjet.com",port:587},Mailosaur={host:"mailosaur.io",port:25},Mailtrap={host:"live.smtp.mailtrap.io",port:587},Mandrill={host:"smtp.mandrillapp.com",port:587},Naver={host:"smtp.naver.com",port:587},One={host:"send.one.com",port:465,secure:!0},OpenMailBox={aliases:["OMB","openmailbox.org"],host:"smtp.openmailbox.org",port:465,secure:!0},Outlook365={host:"smtp.office365.com",port:587,secure:!1},OhMySMTP={host:"smtp.ohmysmtp.com",port:587,secure:!1},Postmark={aliases:["PostmarkApp"],host:"smtp.postmarkapp.com",port:2525},Proton={aliases:["ProtonMail","Proton.me","Protonmail.com","Protonmail.ch"],domains:["proton.me","protonmail.com","pm.me","protonmail.ch"],host:"smtp.protonmail.ch",port:587,requireTLS:!0},QQ={domains:["qq.com"],host:"smtp.qq.com",port:465,secure:!0},QQex={aliases:["QQ Enterprise"],domains:["exmail.qq.com"],host:"smtp.exmail.qq.com",port:465,secure:!0},SendCloud={host:"smtp.sendcloud.net",port:2525},SendGrid={host:"smtp.sendgrid.net",port:587},SendinBlue={aliases:["Brevo"],host:"smtp-relay.brevo.com",port:587},SendPulse={host:"smtp-pulse.com",port:465,secure:!0},SES={host:"email-smtp.us-east-1.amazonaws.com",port:465,secure:!0},Seznam={aliases:["Seznam Email"],domains:["seznam.cz","email.cz","post.cz","spoluzaci.cz"],host:"smtp.seznam.cz",port:465,secure:!0},Sparkpost={aliases:["SparkPost","SparkPost Mail"],domains:["sparkpost.com"],host:"smtp.sparkpostmail.com",port:587,secure:!1},Tipimail={host:"smtp.tipimail.com",port:587},Yahoo={domains:["yahoo.com"],host:"smtp.mail.yahoo.com",port:465,secure:!0},Yandex={domains:["yandex.ru"],host:"smtp.yandex.ru",port:465,secure:!0},Zoho={host:"smtp.zoho.com",port:465,secure:!0,authMethod:"LOGIN"};var require$$0$1={126:{host:"smtp.126.com",port:465,secure:!0},163:{host:"smtp.163.com",port:465,secure:!0},"1und1":{host:"smtp.1und1.de",port:465,secure:!0,authMethod:"LOGIN"},Aliyun:Aliyun,AOL:AOL,Bluewin:Bluewin,DebugMail:DebugMail,DynectEmail:DynectEmail,Ethereal:Ethereal,FastMail:FastMail,"Forward Email":{aliases:["FE","ForwardEmail"],domains:["forwardemail.net"],host:"smtp.forwardemail.net",port:465,secure:!0},"Feishu Mail":{aliases:["Feishu","FeishuMail"],domains:["www.feishu.cn"],host:"smtp.feishu.cn",port:465,secure:!0},GandiMail:GandiMail,Gmail:Gmail,Godaddy:Godaddy,GodaddyAsia:GodaddyAsia,GodaddyEurope:GodaddyEurope,"hot.ee":{host:"mail.hot.ee"},Hotmail:Hotmail,iCloud:iCloud,Infomaniak:Infomaniak,Loopia:Loopia,"mail.ee":{host:"smtp.mail.ee"},"Mail.ru":{host:"smtp.mail.ru",port:465,secure:!0},"Mailcatch.app":{host:"sandbox-smtp.mailcatch.app",port:2525},Maildev:Maildev,Mailgun:Mailgun,Mailjet:Mailjet,Mailosaur:Mailosaur,Mailtrap:Mailtrap,Mandrill:Mandrill,Naver:Naver,One:One,OpenMailBox:OpenMailBox,Outlook365:Outlook365,OhMySMTP:OhMySMTP,Postmark:Postmark,Proton:Proton,"qiye.aliyun":{host:"smtp.mxhichina.com",port:"465",secure:!0},QQ:QQ,QQex:QQex,SendCloud:SendCloud,SendGrid:SendGrid,SendinBlue:SendinBlue,SendPulse:SendPulse,SES:SES,"SES-US-EAST-1":{host:"email-smtp.us-east-1.amazonaws.com",port:465,secure:!0},"SES-US-WEST-2":{host:"email-smtp.us-west-2.amazonaws.com",port:465,secure:!0},"SES-EU-WEST-1":{host:"email-smtp.eu-west-1.amazonaws.com",port:465,secure:!0},"SES-AP-SOUTH-1":{host:"email-smtp.ap-south-1.amazonaws.com",port:465,secure:!0},"SES-AP-NORTHEAST-1":{host:"email-smtp.ap-northeast-1.amazonaws.com",port:465,secure:!0},"SES-AP-NORTHEAST-2":{host:"email-smtp.ap-northeast-2.amazonaws.com",port:465,secure:!0},"SES-AP-NORTHEAST-3":{host:"email-smtp.ap-northeast-3.amazonaws.com",port:465,secure:!0},"SES-AP-SOUTHEAST-1":{host:"email-smtp.ap-southeast-1.amazonaws.com",port:465,secure:!0},"SES-AP-SOUTHEAST-2":{host:"email-smtp.ap-southeast-2.amazonaws.com",port:465,secure:!0},Seznam:Seznam,Sparkpost:Sparkpost,Tipimail:Tipimail,Yahoo:Yahoo,Yandex:Yandex,Zoho:Zoho},wellKnown,hasRequiredWellKnown,smtpPool,hasRequiredSmtpPool,smtpTransport,hasRequiredSmtpTransport,sendmailTransport,hasRequiredSendmailTransport,streamTransport,hasRequiredStreamTransport,jsonTransport,hasRequiredJsonTransport,sesTransport,hasRequiredSesTransport,hasRequiredNodemailer;function requireWellKnown(){if(hasRequiredWellKnown)return wellKnown;hasRequiredWellKnown=1;const e=require$$0$1,t={};function n(e){return e.replace(/[^a-zA-Z0-9.-]/g,"").toLowerCase()}function i(e){let t=["domains","aliases"],n={};return Object.keys(e).forEach(i=>{t.indexOf(i)<0&&(n[i]=e[i])}),n}return Object.keys(e).forEach(r=>{let o=e[r];t[n(r)]=i(o),[].concat(o.aliases||[]).forEach(e=>{t[n(e)]=i(o)}),[].concat(o.domains||[]).forEach(e=>{t[n(e)]=i(o)})}),wellKnown=function(e){return e=n(e.split("@").pop()),t[e]||!1}}function requireSmtpPool(){if(hasRequiredSmtpPool)return smtpPool;hasRequiredSmtpPool=1;const e=require$$0$a,t=requirePoolResource(),n=requireSmtpConnection(),i=requireWellKnown(),r=requireShared(),o=require$$9;return smtpPool=class extends e{constructor(e){let t;super(),"string"==typeof(e=e||{})&&(e={url:e});let a=e.service;"function"==typeof e.getSocket&&(this.getSocket=e.getSocket),e.url&&(t=r.parseConnectionUrl(e.url),a=a||t.service),this.options=r.assign(!1,e,t,a&&i(a)),this.options.maxConnections=this.options.maxConnections||5,this.options.maxMessages=this.options.maxMessages||100,this.logger=r.getLogger(this.options,{component:this.options.component||"smtp-pool"});let s=new n(this.options);this.name="SMTP (pool)",this.version=o.version+"[client:"+s.version+"]",this._rateLimit={counter:0,timeout:null,waiting:[],checkpoint:!1,delta:Number(this.options.rateDelta)||1e3,limit:Number(this.options.rateLimit)||0},this._closed=!1,this._queue=[],this._connections=[],this._connectionCounter=0,this.idling=!0,setImmediate(()=>{this.idling&&this.emit("idle")})}getSocket(e,t){return setImmediate(()=>t(null,!1))}send(e,t){return!this._closed&&(this._queue.push({mail:e,requeueAttempts:0,callback:t}),this.idling&&this._queue.length>=this.options.maxConnections&&(this.idling=!1),setImmediate(()=>this._processMessages()),!0)}close(){let e,t=this._connections.length;if(this._closed=!0,clearTimeout(this._rateLimit.timeout),!t&&!this._queue.length)return;for(let n=t-1;n>=0;n--)this._connections[n]&&this._connections[n].available&&(e=this._connections[n],e.close(),this.logger.info({tnx:"connection",cid:e.id,action:"removed"},"Connection #%s removed",e.id));if(t&&!this._connections.length&&this.logger.debug({tnx:"connection"},"All connections removed"),!this._queue.length)return;let n=()=>{if(!this._queue.length)return void this.logger.debug({tnx:"connection"},"Pending queue entries cleared");let t=this._queue.shift();if(t&&"function"==typeof t.callback)try{t.callback(new Error("Connection pool was closed"))}catch(t){this.logger.error({err:t,tnx:"callback",cid:e.id},"Callback error for #%s: %s",e.id,t.message)}setImmediate(n)};setImmediate(n)}_processMessages(){let e,t,n;if(this._closed)return;if(!this._queue.length)return void(this.idling||(this.idling=!0,this.emit("idle")));for(t=0,n=this._connections.length;t<n;t++)if(this._connections[t].available){e=this._connections[t];break}if(!e&&this._connections.length<this.options.maxConnections&&(e=this._createConnection()),!e)return void(this.idling=!1);!this.idling&&this._queue.length<this.options.maxConnections&&(this.idling=!0,this.emit("idle"));let i=e.queueEntry=this._queue.shift();i.messageId=(e.queueEntry.mail.message.getHeader("message-id")||"").replace(/[<>\s]/g,""),e.available=!1,this.logger.debug({tnx:"pool",cid:e.id,messageId:i.messageId,action:"assign"},"Assigned message <%s> to #%s (%s)",i.messageId,e.id,e.messages+1),this._rateLimit.limit&&(this._rateLimit.counter++,this._rateLimit.checkpoint||(this._rateLimit.checkpoint=Date.now())),e.send(i.mail,(t,n)=>{if(i===e.queueEntry){try{i.callback(t,n)}catch(t){this.logger.error({err:t,tnx:"callback",cid:e.id},"Callback error for #%s: %s",e.id,t.message)}e.queueEntry=!1}})}_createConnection(){let e=new t(this);return e.id=++this._connectionCounter,this.logger.info({tnx:"pool",cid:e.id,action:"conection"},"Created new pool resource #%s",e.id),e.on("available",()=>{this.logger.debug({tnx:"connection",cid:e.id,action:"available"},"Connection #%s became available",e.id),this._closed?this.close():this._processMessages()}),e.once("error",t=>{if("EMAXLIMIT"!==t.code?this.logger.error({err:t,tnx:"pool",cid:e.id},"Pool Error for #%s: %s",e.id,t.message):this.logger.debug({tnx:"pool",cid:e.id,action:"maxlimit"},"Max messages limit exchausted for #%s",e.id),e.queueEntry){try{e.queueEntry.callback(t)}catch(t){this.logger.error({err:t,tnx:"callback",cid:e.id},"Callback error for #%s: %s",e.id,t.message)}e.queueEntry=!1}this._removeConnection(e),this._continueProcessing()}),e.once("close",()=>{this.logger.info({tnx:"connection",cid:e.id,action:"closed"},"Connection #%s was closed",e.id),this._removeConnection(e),e.queueEntry?setTimeout(()=>{e.queueEntry&&(this._shouldRequeuOnConnectionClose(e.queueEntry)?this._requeueEntryOnConnectionClose(e):this._failDeliveryOnConnectionClose(e)),this._continueProcessing()},50):this._continueProcessing()}),this._connections.push(e),e}_shouldRequeuOnConnectionClose(e){return void 0===this.options.maxRequeues||this.options.maxRequeues<0||e.requeueAttempts<this.options.maxRequeues}_failDeliveryOnConnectionClose(e){if(e.queueEntry&&e.queueEntry.callback){try{e.queueEntry.callback(new Error("Reached maximum number of retries after connection was closed"))}catch(t){this.logger.error({err:t,tnx:"callback",messageId:e.queueEntry.messageId,cid:e.id},"Callback error for #%s: %s",e.id,t.message)}e.queueEntry=!1}}_requeueEntryOnConnectionClose(e){e.queueEntry.requeueAttempts=e.queueEntry.requeueAttempts+1,this.logger.debug({tnx:"pool",cid:e.id,messageId:e.queueEntry.messageId,action:"requeue"},"Re-queued message <%s> for #%s. Attempt: #%s",e.queueEntry.messageId,e.id,e.queueEntry.requeueAttempts),this._queue.unshift(e.queueEntry),e.queueEntry=!1}_continueProcessing(){this._closed?this.close():setTimeout(()=>this._processMessages(),100)}_removeConnection(e){let t=this._connections.indexOf(e);-1!==t&&this._connections.splice(t,1)}_checkRateLimit(e){if(!this._rateLimit.limit)return e();let t=Date.now();return this._rateLimit.counter<this._rateLimit.limit?e():(this._rateLimit.waiting.push(e),this._rateLimit.checkpoint<=t-this._rateLimit.delta?this._clearRateLimit():void(this._rateLimit.timeout||(this._rateLimit.timeout=setTimeout(()=>this._clearRateLimit(),this._rateLimit.delta-(t-this._rateLimit.checkpoint)),this._rateLimit.checkpoint=t)))}_clearRateLimit(){for(clearTimeout(this._rateLimit.timeout),this._rateLimit.timeout=null,this._rateLimit.counter=0,this._rateLimit.checkpoint=!1;this._rateLimit.waiting.length;){let e=this._rateLimit.waiting.shift();setImmediate(e)}}isIdle(){return this.idling}verify(e){let i;e||(i=new Promise((t,n)=>{e=r.callbackPromise(t,n)}));let o=new t(this).auth;return this.getSocket(this.options,(t,i)=>{if(t)return e(t);let a=this.options;i&&i.connection&&(this.logger.info({tnx:"proxy",remoteAddress:i.connection.remoteAddress,remotePort:i.connection.remotePort,destHost:a.host||"",destPort:a.port||"",action:"connected"},"Using proxied socket from %s:%s to %s:%s",i.connection.remoteAddress,i.connection.remotePort,a.host||"",a.port||""),a=r.assign(!1,a),Object.keys(i).forEach(e=>{a[e]=i[e]}));let s=new n(a),c=!1;s.once("error",t=>{if(!c)return c=!0,s.close(),e(t)}),s.once("end",()=>{if(!c)return c=!0,e(new Error("Connection closed"))});let l=()=>{if(!c)return c=!0,s.quit(),e(null,!0)};s.connect(()=>{if(!c)if(o&&(s.allowsAuth||a.forceAuth))s.login(o,t=>{if(!c)return t?(c=!0,s.close(),e(t)):void l()});else{if(!o&&s.allowsAuth&&a.forceAuth){let t=new Error("Authentication info was not provided");return t.code="NoAuth",c=!0,s.close(),e(t)}l()}})}),i}},smtpPool}function requireSmtpTransport(){if(hasRequiredSmtpTransport)return smtpTransport;hasRequiredSmtpTransport=1;const e=require$$0$a,t=requireSmtpConnection(),n=requireWellKnown(),i=requireShared(),r=requireXoauth2(),o=require$$9;return smtpTransport=class extends e{constructor(e){let r;super(),"string"==typeof(e=e||{})&&(e={url:e});let a=e.service;"function"==typeof e.getSocket&&(this.getSocket=e.getSocket),e.url&&(r=i.parseConnectionUrl(e.url),a=a||r.service),this.options=i.assign(!1,e,r,a&&n(a)),this.logger=i.getLogger(this.options,{component:this.options.component||"smtp-transport"});let s=new t(this.options);this.name="SMTP",this.version=o.version+"[client:"+s.version+"]",this.options.auth&&(this.auth=this.getAuth({}))}getSocket(e,t){return setImmediate(()=>t(null,!1))}getAuth(e){if(!e)return this.auth;let t=!1,n={};if(this.options.auth&&"object"==typeof this.options.auth&&Object.keys(this.options.auth).forEach(e=>{t=!0,n[e]=this.options.auth[e]}),e&&"object"==typeof e&&Object.keys(e).forEach(i=>{t=!0,n[i]=e[i]}),!t)return!1;if("OAUTH2"===(n.type||"").toString().toUpperCase()){if(!n.service&&!n.user)return!1;let e=new r(n,this.logger);return e.provisionCallback=this.mailer&&this.mailer.get("oauth2_provision_cb")||e.provisionCallback,e.on("token",e=>this.mailer.emit("token",e)),e.on("error",e=>this.emit("error",e)),{type:"OAUTH2",user:n.user,oauth2:e,method:"XOAUTH2"}}return{type:(n.type||"").toString().toUpperCase()||"LOGIN",user:n.user,credentials:{user:n.user||"",pass:n.pass,options:n.options},method:(n.method||"").trim().toUpperCase()||this.options.authMethod||!1}}send(e,n){this.getSocket(this.options,(r,o)=>{if(r)return n(r);let a=!1,s=this.options;o&&o.connection&&(this.logger.info({tnx:"proxy",remoteAddress:o.connection.remoteAddress,remotePort:o.connection.remotePort,destHost:s.host||"",destPort:s.port||"",action:"connected"},"Using proxied socket from %s:%s to %s:%s",o.connection.remoteAddress,o.connection.remotePort,s.host||"",s.port||""),s=i.assign(!1,s),Object.keys(o).forEach(e=>{s[e]=o[e]}));let c=new t(s);c.once("error",e=>{if(!a)return a=!0,c.close(),n(e)}),c.once("end",()=>{if(a)return;let e=setTimeout(()=>{if(a)return;a=!0;let e=new Error("Unexpected socket close");c&&c._socket&&c._socket.upgrading&&(e.code="ETLS"),n(e)},1e3);try{e.unref()}catch(e){}});let l=()=>{let t=e.message.getEnvelope(),i=e.message.messageId(),r=[].concat(t.to||[]);r.length>3&&r.push("...and "+r.splice(2).length+" more"),e.data.dsn&&(t.dsn=e.data.dsn),this.logger.info({tnx:"send",messageId:i},"Sending message %s to <%s>",i,r.join(", ")),c.send(t,e.message.createReadStream(),(e,r)=>{if(a=!0,c.close(),e)return this.logger.error({err:e,tnx:"send"},"Send error for %s: %s",i,e.message),n(e);r.envelope={from:t.from,to:t.to},r.messageId=i;try{return n(null,r)}catch(e){this.logger.error({err:e,tnx:"callback"},"Callback error for %s: %s",i,e.message)}})};c.connect(()=>{if(a)return;let t=this.getAuth(e.data.auth);t&&(c.allowsAuth||s.forceAuth)?c.login(t,e=>{if(t&&t!==this.auth&&t.oauth2&&t.oauth2.removeAllListeners(),!a)return e?(a=!0,c.close(),n(e)):void l()}):l()})})}verify(e){let n;return e||(n=new Promise((t,n)=>{e=i.callbackPromise(t,n)})),this.getSocket(this.options,(n,r)=>{if(n)return e(n);let o=this.options;r&&r.connection&&(this.logger.info({tnx:"proxy",remoteAddress:r.connection.remoteAddress,remotePort:r.connection.remotePort,destHost:o.host||"",destPort:o.port||"",action:"connected"},"Using proxied socket from %s:%s to %s:%s",r.connection.remoteAddress,r.connection.remotePort,o.host||"",o.port||""),o=i.assign(!1,o),Object.keys(r).forEach(e=>{o[e]=r[e]}));let a=new t(o),s=!1;a.once("error",t=>{if(!s)return s=!0,a.close(),e(t)}),a.once("end",()=>{if(!s)return s=!0,e(new Error("Connection closed"))});let c=()=>{if(!s)return s=!0,a.quit(),e(null,!0)};a.connect(()=>{if(s)return;let t=this.getAuth({});if(t&&(a.allowsAuth||o.forceAuth))a.login(t,t=>{if(!s)return t?(s=!0,a.close(),e(t)):void c()});else{if(!t&&a.allowsAuth&&o.forceAuth){let t=new Error("Authentication info was not provided");return t.code="NoAuth",s=!0,a.close(),e(t)}c()}})}),n}close(){this.auth&&this.auth.oauth2&&this.auth.oauth2.removeAllListeners(),this.emit("close")}},smtpTransport}function requireSendmailTransport(){if(hasRequiredSendmailTransport)return sendmailTransport;hasRequiredSendmailTransport=1;const e=require$$0$b.spawn,t=require$$9,n=requireShared();return sendmailTransport=class{constructor(i){i=i||{},this._spawn=e,this.options=i||{},this.name="Sendmail",this.version=t.version,this.path="sendmail",this.args=!1,this.winbreak=!1,this.logger=n.getLogger(this.options,{component:this.options.component||"sendmail"}),i&&("string"==typeof i?this.path=i:"object"==typeof i&&(i.path&&(this.path=i.path),Array.isArray(i.args)&&(this.args=i.args),this.winbreak=["win","windows","dos","\r\n"].includes((i.newline||"").toString().toLowerCase())))}send(e,t){e.message.keepBcc=!0;let n,i,r,o=e.data.envelope||e.message.getEnvelope(),a=e.message.messageId();if([].concat(o.from||[]).concat(o.to||[]).some(e=>/^-/.test(e)))return t(new Error("Can not send mail. Invalid envelope addresses."));n=this.args?["-i"].concat(this.args).concat(o.to):["-i"].concat(o.from?["-f",o.from]:[]).concat(o.to);let s=n=>{if(!r)return r=!0,"function"==typeof t?n?t(n):t(null,{envelope:e.data.envelope||e.message.getEnvelope(),messageId:a,response:"Messages queued for delivery"}):void 0};try{i=this._spawn(this.path,n)}catch(e){return this.logger.error({err:e,tnx:"spawn",messageId:a},"Error occurred while spawning sendmail. %s",e.message),s(e)}if(!i)return s(new Error("sendmail was not found"));{i.on("error",e=>{this.logger.error({err:e,tnx:"spawn",messageId:a},"Error occurred when sending message %s. %s",a,e.message),s(e)}),i.once("exit",e=>{if(!e)return s();let t;t=127===e?new Error("Sendmail command not found, process exited with code "+e):new Error("Sendmail exited with code "+e),this.logger.error({err:t,tnx:"stdin",messageId:a},"Error sending message %s to sendmail. %s",a,t.message),s(t)}),i.once("close",s),i.stdin.on("error",e=>{this.logger.error({err:e,tnx:"stdin",messageId:a},"Error occurred when piping message %s to sendmail. %s",a,e.message),s(e)});let t=[].concat(o.to||[]);t.length>3&&t.push("...and "+t.splice(2).length+" more"),this.logger.info({tnx:"send",messageId:a},"Sending message %s to <%s>",a,t.join(", "));let n=e.message.createReadStream();n.once("error",e=>{this.logger.error({err:e,tnx:"stdin",messageId:a},"Error occurred when generating message %s. %s",a,e.message),i.kill("SIGINT"),s(e)}),n.pipe(i.stdin)}}},sendmailTransport}function requireStreamTransport(){if(hasRequiredStreamTransport)return streamTransport;hasRequiredStreamTransport=1;const e=require$$9,t=requireShared();return streamTransport=class{constructor(n){n=n||{},this.options=n||{},this.name="StreamTransport",this.version=e.version,this.logger=t.getLogger(this.options,{component:this.options.component||"stream-transport"}),this.winbreak=["win","windows","dos","\r\n"].includes((n.newline||"").toString().toLowerCase())}send(e,t){e.message.keepBcc=!0;let n=e.data.envelope||e.message.getEnvelope(),i=e.message.messageId(),r=[].concat(n.to||[]);r.length>3&&r.push("...and "+r.splice(2).length+" more"),this.logger.info({tnx:"send",messageId:i},"Sending message %s to <%s> using %s line breaks",i,r.join(", "),this.winbreak?"<CR><LF>":"<LF>"),setImmediate(()=>{let n;try{n=e.message.createReadStream()}catch(e){return this.logger.error({err:e,tnx:"send",messageId:i},"Creating send stream failed for %s. %s",i,e.message),t(e)}if(!this.options.buffer)return n.once("error",e=>{this.logger.error({err:e,tnx:"send",messageId:i},"Failed creating message for %s. %s",i,e.message)}),t(null,{envelope:e.data.envelope||e.message.getEnvelope(),messageId:i,message:n});let r=[],o=0;n.on("readable",()=>{let e;for(;null!==(e=n.read());)r.push(e),o+=e.length}),n.once("error",e=>(this.logger.error({err:e,tnx:"send",messageId:i},"Failed creating message for %s. %s",i,e.message),t(e))),n.on("end",()=>t(null,{envelope:e.data.envelope||e.message.getEnvelope(),messageId:i,message:Buffer.concat(r,o)}))})}},streamTransport}function requireJsonTransport(){if(hasRequiredJsonTransport)return jsonTransport;hasRequiredJsonTransport=1;const e=require$$9,t=requireShared();return jsonTransport=class{constructor(n){n=n||{},this.options=n||{},this.name="JSONTransport",this.version=e.version,this.logger=t.getLogger(this.options,{component:this.options.component||"json-transport"})}send(e,t){e.message.keepBcc=!0;let n=e.data.envelope||e.message.getEnvelope(),i=e.message.messageId(),r=[].concat(n.to||[]);r.length>3&&r.push("...and "+r.splice(2).length+" more"),this.logger.info({tnx:"send",messageId:i},"Composing JSON structure of %s to <%s>",i,r.join(", ")),setImmediate(()=>{e.normalize((e,r)=>e?(this.logger.error({err:e,tnx:"send",messageId:i},"Failed building JSON structure for %s. %s",i,e.message),t(e)):(delete r.envelope,delete r.normalizedHeaders,t(null,{envelope:n,messageId:i,message:this.options.skipEncoding?r:JSON.stringify(r)})))})}}}function requireSesTransport(){if(hasRequiredSesTransport)return sesTransport;hasRequiredSesTransport=1;const e=require$$0$a,t=require$$9,n=requireShared(),i=requireLeWindows();return sesTransport=class extends e{constructor(e){super(),e=e||{},this.options=e||{},this.ses=this.options.SES,this.name="SESTransport",this.version=t.version,this.logger=n.getLogger(this.options,{component:this.options.component||"ses-transport"}),this.maxConnections=Number(this.options.maxConnections)||1/0,this.connections=0,this.sendingRate=Number(this.options.sendingRate)||1/0,this.sendingRateTTL=null,this.rateInterval=1e3,this.rateMessages=[],this.pending=[],this.idling=!0,setImmediate(()=>{this.idling&&this.emit("idle")})}send(e,t){return this.connections>=this.maxConnections?(this.idling=!1,this.pending.push({mail:e,callback:t})):this._checkSendingRate()?void this._send(e,(...e)=>{setImmediate(()=>t(...e)),this._sent()}):(this.idling=!1,this.pending.push({mail:e,callback:t}))}_checkRatedQueue(){if(this.connections>=this.maxConnections||!this._checkSendingRate())return;if(!this.pending.length)return void(this.idling||(this.idling=!0,this.emit("idle")));let e=this.pending.shift();this._send(e.mail,(...t)=>{setImmediate(()=>e.callback(...t)),this._sent()})}_checkSendingRate(){clearTimeout(this.sendingRateTTL);let e=Date.now(),t=!1;for(let n=this.rateMessages.length-1;n>=0;n--)this.rateMessages[n].ts>=e-this.rateInterval&&(!t||this.rateMessages[n].ts<t)&&(t=this.rateMessages[n].ts),this.rateMessages[n].ts<e-this.rateInterval&&!this.rateMessages[n].pending&&this.rateMessages.splice(n,1);if(this.rateMessages.length<this.sendingRate)return!0;let n=Math.max(t+1001,e+20);this.sendingRateTTL=setTimeout(()=>this._checkRatedQueue(),e-n);try{this.sendingRateTTL.unref()}catch(e){}return!1}_sent(){this.connections--,this._checkRatedQueue()}isIdle(){return this.idling}_send(e,t){let n={ts:Date.now(),pending:!0};this.connections++,this.rateMessages.push(n);let r=e.data.envelope||e.message.getEnvelope(),o=e.message.messageId(),a=[].concat(r.to||[]);a.length>3&&a.push("...and "+a.splice(2).length+" more"),this.logger.info({tnx:"send",messageId:o},"Sending message %s to <%s>",o,a.join(", "));setImmediate(()=>(t=>{e.data._dkim||(e.data._dkim={}),e.data._dkim.skipFields&&"string"==typeof e.data._dkim.skipFields?e.data._dkim.skipFields+=":date:message-id":e.data._dkim.skipFields="date:message-id";let n=e.message.createReadStream(),r=n.pipe(new i),o=[],a=0;r.on("readable",()=>{let e;for(;null!==(e=r.read());)o.push(e),a+=e.length}),n.once("error",e=>r.emit("error",e)),r.once("error",e=>{t(e)}),r.once("end",()=>t(null,Buffer.concat(o,a)))})((i,a)=>{if(i)return this.logger.error({err:i,tnx:"send",messageId:o},"Failed creating message for %s. %s",o,i.message),n.pending=!1,t(i);let s={RawMessage:{Data:a},Source:r.from,Destinations:r.to};Object.keys(e.data.ses||{}).forEach(t=>{s[t]=e.data.ses[t]});let c=(this.ses.aws?this.ses.ses:this.ses)||{},l=this.ses.aws||{};var d;d=(e,i)=>{let d;!e&&i||(i="us-east-1"),d="function"==typeof c.send&&l.SendRawEmailCommand?c.send(new l.SendRawEmailCommand(s)):c.sendRawEmail(s).promise(),d.then(e=>{"us-east-1"===i&&(i="email"),n.pending=!1,t(null,{envelope:{from:r.from,to:r.to},messageId:"<"+e.MessageId+(/@/.test(e.MessageId)?"":"@"+i+".amazonses.com")+">",response:e.MessageId,raw:a})}).catch(e=>{this.logger.error({err:e,tnx:"send"},"Send error for %s: %s",o,e.message),n.pending=!1,t(e)})},c.config&&"function"==typeof c.config.region?c.config.region().then(e=>d(null,e)).catch(e=>d(e)):d(null,c.config&&c.config.region||"us-east-1")}))}verify(e){let t,i=(this.ses.aws?this.ses.ses:this.ses)||{},r=this.ses.aws||{};const o={RawMessage:{Data:"From: invalid@invalid\r\nTo: invalid@invalid\r\n Subject: Invalid\r\n\r\nInvalid"},Source:"invalid@invalid",Destinations:["invalid@invalid"]};e||(t=new Promise((t,i)=>{e=n.callbackPromise(t,i)}));const a=t=>t&&"InvalidParameterValue"!==(t.code||t.Code)?e(t):e(null,!0);return"function"==typeof i.send&&r.SendRawEmailCommand?(o.RawMessage.Data=Buffer.from(o.RawMessage.Data),i.send(new r.SendRawEmailCommand(o),a)):i.sendRawEmail(o,a),t}},sesTransport}function requireNodemailer(){if(hasRequiredNodemailer)return nodemailer;hasRequiredNodemailer=1;const e=requireMailer(),t=requireShared(),n=requireSmtpPool(),i=requireSmtpTransport(),r=requireSendmailTransport(),o=requireStreamTransport(),a=requireJsonTransport(),s=requireSesTransport(),c=requireFetch(),l=require$$9,d=(process.env.ETHEREAL_API||"https://api.nodemailer.com").replace(/\/+$/,""),u=(process.env.ETHEREAL_WEB||"https://ethereal.email").replace(/\/+$/,""),p=(process.env.ETHEREAL_API_KEY||"").replace(/\s*/g,"")||null,m=["true","yes","y","1"].includes((process.env.ETHEREAL_CACHE||"yes").toString().trim().toLowerCase());let h=!1;return nodemailer.createTransport=function(c,l){let d,u,p;return("object"==typeof c&&"function"!=typeof c.send||"string"==typeof c&&/^(smtps?|direct):/i.test(c))&&(u=(d="string"==typeof c?c:c.url)?t.parseConnectionUrl(d):c,c=u.pool?new n(u):u.sendmail?new r(u):u.streamTransport?new o(u):u.jsonTransport?new a(u):u.SES?new s(u):new i(u)),p=new e(c,u,l),p},nodemailer.createTestAccount=function(e,n){let i;if(n||"function"!=typeof e||(n=e,e=!1),n||(i=new Promise((e,i)=>{n=t.callbackPromise(e,i)})),m&&h)return setImmediate(()=>n(null,h)),i;e=e||d;let r=[],o=0,a={},s={requestor:l.name,version:l.version};p&&(a.Authorization="Bearer "+p);let u=c(e+"/user",{contentType:"application/json",method:"POST",headers:a,body:Buffer.from(JSON.stringify(s))});return u.on("readable",()=>{let e;for(;null!==(e=u.read());)r.push(e),o+=e.length}),u.once("error",e=>n(e)),u.once("end",()=>{let e,t,i=Buffer.concat(r,o);try{e=JSON.parse(i.toString())}catch(e){t=e}return t?n(t):"success"!==e.status||e.error?n(new Error(e.error||"Request failed")):(delete e.status,h=e,void n(null,h))}),i},nodemailer.getTestMessageUrl=function(e){if(!e||!e.response)return!1;let t=new Map;return e.response.replace(/\[([^\]]+)\]$/,(e,n)=>{n.replace(/\b([A-Z0-9]+)=([^\s]+)/g,(e,n,i)=>{t.set(n,i)})}),!(!t.has("STATUS")||!t.has("MSGID"))&&(h.web||u)+"/message/"+t.get("MSGID")},nodemailer}var nodemailerExports=requireNodemailer();const DEFAULT_CLIENT_CONFIG={clientConfig:{region:"eu-west-1"}},sendMail=async(e,t,n,i)=>{try{if(!n.html&&!n.text)return e.logger&&e.logger.error("The option text or html needs to be set."),!1;if(!n.to||!n.subject)return e.logger&&e.logger.error("The fields to and subject have to be set."),!1;const r=await t.sendMail(n);return i&&await i(r),!!r||(e.logger&&e.logger.error("Sending email failed!"),!1)}catch(t){return e.logger&&e.logger.error(t),!1}},ses=e=>{const{clientConfig:t,...n}={...DEFAULT_CLIENT_CONFIG,...e},i=new SESv2Client(t),r=nodemailerExports.createTransport(e.customSMTPConfig??{SES:{SendEmailCommand:SendEmailCommand,sesClient:i}});return{sendMail:(e,t)=>sendMail(n,r,e,t)}},resolveQueueUrlConfig=e=>Object.assign(e,{useQueueUrlAsEndpoint:e.useQueueUrlAsEndpoint??!0});function queueUrlMiddleware({useQueueUrlAsEndpoint:e,endpoint:t}){return(n,i)=>async r=>{const{input:o}=r,a=i.endpointV2;if(!t&&o.QueueUrl&&a&&e){const e=i.logger instanceof NoOpLogger$1||!i.logger?.warn?console:i.logger;try{const t=new URL(o.QueueUrl),n=new URL(t.origin);a.url.origin!==n.origin&&(e.warn(`QueueUrl=${o.QueueUrl} differs from SQSClient resolved endpoint=${a.url.toString()}, using QueueUrl host as endpoint.\nSet [endpoint=string] or [useQueueUrlAsEndpoint=false] on the SQSClient.`),i.endpointV2={...a,url:n})}catch(t){e.warn(t)}}return n(r)}}const queueUrlMiddlewareOptions={name:"queueUrlMiddleware",relation:"after",toMiddleware:"endpointV2Middleware",override:!0},getQueueUrlPlugin=e=>({applyToStack:t=>{t.addRelativeTo(queueUrlMiddleware(e),queueUrlMiddlewareOptions)}});function receiveMessageMiddleware(e){return t=>async n=>{const i=await t({...n});if(!1===e.md5)return i;const r=i.output,o=[];if(void 0!==r.Messages)for(const t of r.Messages){const n=t.MD5OfBody,i=new e.md5;i.update(toUint8Array(t.Body||"")),n!==toHex(await i.digest())&&o.push(t.MessageId)}if(o.length>0)throw new Error("Invalid MD5 checksum on messages: "+o.join(", "));return i}}const receiveMessageMiddlewareOptions={step:"initialize",tags:["VALIDATE_BODY_MD5"],name:"receiveMessageMiddleware",override:!0},getReceiveMessagePlugin=e=>({applyToStack:t=>{t.add(receiveMessageMiddleware(e),receiveMessageMiddlewareOptions)}}),sendMessageMiddleware=e=>t=>async n=>{const i=await t({...n});if(!1===e.md5)return i;const r=i.output,o=new e.md5;if(o.update(toUint8Array(n.input.MessageBody||"")),r.MD5OfMessageBody!==toHex(await o.digest()))throw new Error("InvalidChecksumError");return i},sendMessageMiddlewareOptions={step:"initialize",tags:["VALIDATE_BODY_MD5"],name:"sendMessageMiddleware",override:!0},getSendMessagePlugin=e=>({applyToStack:t=>{t.add(sendMessageMiddleware(e),sendMessageMiddlewareOptions)}}),defaultSQSHttpAuthSchemeParametersProvider=async(e,t,n)=>({operation:getSmithyContext$1(t).operation,region:await normalizeProvider$4(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function createAwsAuthSigv4HttpAuthOption(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sqs",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}const defaultSQSHttpAuthSchemeProvider=e=>{const t=[];return e.operation,t.push(createAwsAuthSigv4HttpAuthOption(e)),t},resolveHttpAuthSchemeConfig=e=>{const t=resolveAwsSdkSigV4Config$1(e);return Object.assign(t,{authSchemePreference:normalizeProvider$4(e.authSchemePreference??[])})},resolveClientEndpointParameters=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"sqs"}),commonParams={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},version$1="3.926.0";var packageInfo={version:version$1};const BLOCK_SIZE=64,DIGEST_LENGTH=16,INIT=[1732584193,4023233417,2562383102,271733878];class Md5{state;buffer;bufferLength;bytesHashed;finished;constructor(){this.reset()}update(e){if(isEmptyData(e))return;if(this.finished)throw new Error("Attempted to update an already finished hash.");const t=convertToBuffer(e);let n=0,{byteLength:i}=t;for(this.bytesHashed+=i;i>0;)this.buffer.setUint8(this.bufferLength++,t[n++]),i--,this.bufferLength===BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)}async digest(){if(!this.finished){const{buffer:e,bufferLength:t,bytesHashed:n}=this,i=8*n;if(e.setUint8(this.bufferLength++,128),t%BLOCK_SIZE>=BLOCK_SIZE-8){for(let t=this.bufferLength;t<BLOCK_SIZE;t++)e.setUint8(t,0);this.hashBuffer(),this.bufferLength=0}for(let t=this.bufferLength;t<BLOCK_SIZE-8;t++)e.setUint8(t,0);e.setUint32(BLOCK_SIZE-8,i>>>0,!0),e.setUint32(BLOCK_SIZE-4,Math.floor(i/4294967296),!0),this.hashBuffer(),this.finished=!0}const e=new DataView(new ArrayBuffer(DIGEST_LENGTH));for(let t=0;t<4;t++)e.setUint32(4*t,this.state[t],!0);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}hashBuffer(){const{buffer:e,state:t}=this;let n=t[0],i=t[1],r=t[2],o=t[3];n=ff(n,i,r,o,e.getUint32(0,!0),7,3614090360),o=ff(o,n,i,r,e.getUint32(4,!0),12,3905402710),r=ff(r,o,n,i,e.getUint32(8,!0),17,606105819),i=ff(i,r,o,n,e.getUint32(12,!0),22,3250441966),n=ff(n,i,r,o,e.getUint32(16,!0),7,4118548399),o=ff(o,n,i,r,e.getUint32(20,!0),12,1200080426),r=ff(r,o,n,i,e.getUint32(24,!0),17,2821735955),i=ff(i,r,o,n,e.getUint32(28,!0),22,4249261313),n=ff(n,i,r,o,e.getUint32(32,!0),7,1770035416),o=ff(o,n,i,r,e.getUint32(36,!0),12,2336552879),r=ff(r,o,n,i,e.getUint32(40,!0),17,4294925233),i=ff(i,r,o,n,e.getUint32(44,!0),22,2304563134),n=ff(n,i,r,o,e.getUint32(48,!0),7,1804603682),o=ff(o,n,i,r,e.getUint32(52,!0),12,4254626195),r=ff(r,o,n,i,e.getUint32(56,!0),17,2792965006),i=ff(i,r,o,n,e.getUint32(60,!0),22,1236535329),n=gg(n,i,r,o,e.getUint32(4,!0),5,4129170786),o=gg(o,n,i,r,e.getUint32(24,!0),9,3225465664),r=gg(r,o,n,i,e.getUint32(44,!0),14,643717713),i=gg(i,r,o,n,e.getUint32(0,!0),20,3921069994),n=gg(n,i,r,o,e.getUint32(20,!0),5,3593408605),o=gg(o,n,i,r,e.getUint32(40,!0),9,38016083),r=gg(r,o,n,i,e.getUint32(60,!0),14,3634488961),i=gg(i,r,o,n,e.getUint32(16,!0),20,3889429448),n=gg(n,i,r,o,e.getUint32(36,!0),5,568446438),o=gg(o,n,i,r,e.getUint32(56,!0),9,3275163606),r=gg(r,o,n,i,e.getUint32(12,!0),14,4107603335),i=gg(i,r,o,n,e.getUint32(32,!0),20,1163531501),n=gg(n,i,r,o,e.getUint32(52,!0),5,2850285829),o=gg(o,n,i,r,e.getUint32(8,!0),9,4243563512),r=gg(r,o,n,i,e.getUint32(28,!0),14,1735328473),i=gg(i,r,o,n,e.getUint32(48,!0),20,2368359562),n=hh(n,i,r,o,e.getUint32(20,!0),4,4294588738),o=hh(o,n,i,r,e.getUint32(32,!0),11,2272392833),r=hh(r,o,n,i,e.getUint32(44,!0),16,1839030562),i=hh(i,r,o,n,e.getUint32(56,!0),23,4259657740),n=hh(n,i,r,o,e.getUint32(4,!0),4,2763975236),o=hh(o,n,i,r,e.getUint32(16,!0),11,1272893353),r=hh(r,o,n,i,e.getUint32(28,!0),16,4139469664),i=hh(i,r,o,n,e.getUint32(40,!0),23,3200236656),n=hh(n,i,r,o,e.getUint32(52,!0),4,681279174),o=hh(o,n,i,r,e.getUint32(0,!0),11,3936430074),r=hh(r,o,n,i,e.getUint32(12,!0),16,3572445317),i=hh(i,r,o,n,e.getUint32(24,!0),23,76029189),n=hh(n,i,r,o,e.getUint32(36,!0),4,3654602809),o=hh(o,n,i,r,e.getUint32(48,!0),11,3873151461),r=hh(r,o,n,i,e.getUint32(60,!0),16,530742520),i=hh(i,r,o,n,e.getUint32(8,!0),23,3299628645),n=ii(n,i,r,o,e.getUint32(0,!0),6,4096336452),o=ii(o,n,i,r,e.getUint32(28,!0),10,1126891415),r=ii(r,o,n,i,e.getUint32(56,!0),15,2878612391),i=ii(i,r,o,n,e.getUint32(20,!0),21,4237533241),n=ii(n,i,r,o,e.getUint32(48,!0),6,1700485571),o=ii(o,n,i,r,e.getUint32(12,!0),10,2399980690),r=ii(r,o,n,i,e.getUint32(40,!0),15,4293915773),i=ii(i,r,o,n,e.getUint32(4,!0),21,2240044497),n=ii(n,i,r,o,e.getUint32(32,!0),6,1873313359),o=ii(o,n,i,r,e.getUint32(60,!0),10,4264355552),r=ii(r,o,n,i,e.getUint32(24,!0),15,2734768916),i=ii(i,r,o,n,e.getUint32(52,!0),21,1309151649),n=ii(n,i,r,o,e.getUint32(16,!0),6,4149444226),o=ii(o,n,i,r,e.getUint32(44,!0),10,3174756917),r=ii(r,o,n,i,e.getUint32(8,!0),15,718787259),i=ii(i,r,o,n,e.getUint32(36,!0),21,3951481745),t[0]=n+t[0]&4294967295,t[1]=i+t[1]&4294967295,t[2]=r+t[2]&4294967295,t[3]=o+t[3]&4294967295}reset(){this.state=Uint32Array.from(INIT),this.buffer=new DataView(new ArrayBuffer(BLOCK_SIZE)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}}function cmn(e,t,n,i,r,o){return((t=(t+e&4294967295)+(i+o&4294967295)&4294967295)<<r|t>>>32-r)+n&4294967295}function ff(e,t,n,i,r,o,a){return cmn(t&n|~t&i,e,t,r,o,a)}function gg(e,t,n,i,r,o,a){return cmn(t&i|n&~i,e,t,r,o,a)}function hh(e,t,n,i,r,o,a){return cmn(t^n^i,e,t,r,o,a)}function ii(e,t,n,i,r,o,a){return cmn(n^(t|~i),e,t,r,o,a)}function isEmptyData(e){return"string"==typeof e?0===e.length:0===e.byteLength}function convertToBuffer(e){return"string"==typeof e?fromUtf8$2(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}const u="required",v="fn",w="argv",x="ref",a=!0,b="isSet",c="booleanEquals",d="error",e="endpoint",f="tree",g="PartitionResult",h="getAttr",i={[u]:!1,type:"string"},j={[u]:!0,default:!1,type:"boolean"},k={[x]:"Endpoint"},l={[v]:c,[w]:[{[x]:"UseFIPS"},!0]},m={[v]:c,[w]:[{[x]:"UseDualStack"},!0]},n={},o={[v]:h,[w]:[{[x]:g},"supportsFIPS"]},p={[x]:g},q={[v]:c,[w]:[!0,{[v]:h,[w]:[p,"supportsDualStack"]}]},r=[l],s=[m],t=[{[x]:"Region"}],_data={parameters:{Region:i,UseDualStack:j,UseFIPS:j,Endpoint:i},rules:[{conditions:[{[v]:b,[w]:[k]}],rules:[{conditions:r,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:d},{conditions:s,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:d},{endpoint:{url:k,properties:n,headers:n},type:e}],type:f},{conditions:[{[v]:b,[w]:t}],rules:[{conditions:[{[v]:"aws.partition",[w]:t,assign:g}],rules:[{conditions:[l,m],rules:[{conditions:[{[v]:c,[w]:[a,o]},q],rules:[{endpoint:{url:"https://sqs-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:d}],type:f},{conditions:r,rules:[{conditions:[{[v]:c,[w]:[o,a]}],rules:[{conditions:[{[v]:"stringEquals",[w]:[{[v]:h,[w]:[p,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sqs.{Region}.amazonaws.com",properties:n,headers:n},type:e},{endpoint:{url:"https://sqs-fips.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"FIPS is enabled but this partition does not support FIPS",type:d}],type:f},{conditions:s,rules:[{conditions:[q],rules:[{endpoint:{url:"https://sqs.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:n,headers:n},type:e}],type:f},{error:"DualStack is enabled but this partition does not support DualStack",type:d}],type:f},{endpoint:{url:"https://sqs.{Region}.{PartitionResult#dnsSuffix}",properties:n,headers:n},type:e}],type:f}],type:f},{error:"Invalid Configuration: Missing Region",type:d}]},ruleSet=_data,cache=new EndpointCache$1({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),defaultEndpointResolver=(e,t={})=>cache.get(e,()=>resolveEndpoint$1(ruleSet,{endpointParams:e,logger:t.logger}));customEndpointFunctions$1.aws=awsEndpointFunctions$1;const getRuntimeConfig$1=e=>({apiVersion:"2012-11-05",base64Decoder:e?.base64Decoder??fromBase64,base64Encoder:e?.base64Encoder??toBase64,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??defaultEndpointResolver,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??defaultSQSHttpAuthSchemeProvider,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AwsSdkSigV4Signer$1}],logger:e?.logger??new NoOpLogger$1,serviceId:e?.serviceId??"SQS",urlParser:e?.urlParser??parseUrl$1,utf8Decoder:e?.utf8Decoder??fromUtf8$2,utf8Encoder:e?.utf8Encoder??toUtf8}),getRuntimeConfig=e=>{const t=resolveDefaultsModeConfig$1(e),n=()=>t().then(loadConfigsForDefaultMode$1),i=getRuntimeConfig$1(e);return{...i,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??calculateBodyLength,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??createDefaultUserAgentProvider$1({serviceId:i.serviceId,clientVersion:packageInfo.version}),maxAttempts:e?.maxAttempts??DEFAULT_MAX_ATTEMPTS$1,md5:e?.md5??Md5,region:e?.region??invalidProvider$1("Region is missing"),requestHandler:FetchHttpHandler$1.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||DEFAULT_RETRY_MODE$1),sha256:e?.sha256??Sha256,streamCollector:e?.streamCollector??streamCollector$1,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT$1)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT$1))}},getHttpAuthExtensionConfiguration=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex(t=>t.schemeId===e.schemeId);-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){i=e},credentials:()=>i}},resolveHttpAuthRuntimeConfig=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),resolveRuntimeExtensions=(e,t)=>{const n=Object.assign(getAwsRegionExtensionConfiguration$1(e),getDefaultExtensionConfiguration$1(e),getHttpHandlerExtensionConfiguration$1(e),getHttpAuthExtensionConfiguration(e));return t.forEach(e=>e.configure(n)),Object.assign(e,resolveAwsRegionExtensionConfiguration$1(n),resolveDefaultRuntimeConfig$1(n),resolveHttpHandlerRuntimeConfig$1(n),resolveHttpAuthRuntimeConfig(n))};class SQSClient extends Client$1{config;constructor(...[e]){const t=getRuntimeConfig(e||{});super(t),this.initConfig=t;const n=resolveUserAgentConfig$1(resolveClientEndpointParameters(t)),i=resolveRetryConfig$1(n),r=resolveHostHeaderConfig$1(resolveRegionConfig$1(i)),o=resolveEndpointConfig$1(r),a=resolveQueueUrlConfig(o),s=resolveHttpAuthSchemeConfig(a),c=resolveRuntimeExtensions(s,e?.extensions||[]);this.config=c,this.middlewareStack.use(getUserAgentPlugin$1(this.config)),this.middlewareStack.use(getRetryPlugin$1(this.config)),this.middlewareStack.use(getContentLengthPlugin$1(this.config)),this.middlewareStack.use(getHostHeaderPlugin$1(this.config)),this.middlewareStack.use(getLoggerPlugin$1(this.config)),this.middlewareStack.use(getRecursionDetectionPlugin$1(this.config)),this.middlewareStack.use(getQueueUrlPlugin(this.config)),this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin$1(this.config,{httpAuthSchemeParametersProvider:defaultSQSHttpAuthSchemeParametersProvider,identityProviderConfigProvider:async e=>new DefaultIdentityProviderConfig$1({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(getHttpSigningPlugin$1(this.config))}destroy(){super.destroy()}}class SQSServiceException extends ServiceException$2{constructor(e){super(e),Object.setPrototypeOf(this,SQSServiceException.prototype)}}class InvalidAddress extends SQSServiceException{name="InvalidAddress";$fault="client";constructor(e){super({name:"InvalidAddress",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAddress.prototype)}}class InvalidSecurity extends SQSServiceException{name="InvalidSecurity";$fault="client";constructor(e){super({name:"InvalidSecurity",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidSecurity.prototype)}}class OverLimit extends SQSServiceException{name="OverLimit";$fault="client";constructor(e){super({name:"OverLimit",$fault:"client",...e}),Object.setPrototypeOf(this,OverLimit.prototype)}}class QueueDoesNotExist extends SQSServiceException{name="QueueDoesNotExist";$fault="client";constructor(e){super({name:"QueueDoesNotExist",$fault:"client",...e}),Object.setPrototypeOf(this,QueueDoesNotExist.prototype)}}class RequestThrottled extends SQSServiceException{name="RequestThrottled";$fault="client";constructor(e){super({name:"RequestThrottled",$fault:"client",...e}),Object.setPrototypeOf(this,RequestThrottled.prototype)}}class UnsupportedOperation extends SQSServiceException{name="UnsupportedOperation";$fault="client";constructor(e){super({name:"UnsupportedOperation",$fault:"client",...e}),Object.setPrototypeOf(this,UnsupportedOperation.prototype)}}class ResourceNotFoundException extends SQSServiceException{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,ResourceNotFoundException.prototype)}}class MessageNotInflight extends SQSServiceException{name="MessageNotInflight";$fault="client";constructor(e){super({name:"MessageNotInflight",$fault:"client",...e}),Object.setPrototypeOf(this,MessageNotInflight.prototype)}}class ReceiptHandleIsInvalid extends SQSServiceException{name="ReceiptHandleIsInvalid";$fault="client";constructor(e){super({name:"ReceiptHandleIsInvalid",$fault:"client",...e}),Object.setPrototypeOf(this,ReceiptHandleIsInvalid.prototype)}}class BatchEntryIdsNotDistinct extends SQSServiceException{name="BatchEntryIdsNotDistinct";$fault="client";constructor(e){super({name:"BatchEntryIdsNotDistinct",$fault:"client",...e}),Object.setPrototypeOf(this,BatchEntryIdsNotDistinct.prototype)}}class EmptyBatchRequest extends SQSServiceException{name="EmptyBatchRequest";$fault="client";constructor(e){super({name:"EmptyBatchRequest",$fault:"client",...e}),Object.setPrototypeOf(this,EmptyBatchRequest.prototype)}}class InvalidBatchEntryId extends SQSServiceException{name="InvalidBatchEntryId";$fault="client";constructor(e){super({name:"InvalidBatchEntryId",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidBatchEntryId.prototype)}}class TooManyEntriesInBatchRequest extends SQSServiceException{name="TooManyEntriesInBatchRequest";$fault="client";constructor(e){super({name:"TooManyEntriesInBatchRequest",$fault:"client",...e}),Object.setPrototypeOf(this,TooManyEntriesInBatchRequest.prototype)}}class InvalidAttributeName extends SQSServiceException{name="InvalidAttributeName";$fault="client";constructor(e){super({name:"InvalidAttributeName",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAttributeName.prototype)}}class InvalidAttributeValue extends SQSServiceException{name="InvalidAttributeValue";$fault="client";constructor(e){super({name:"InvalidAttributeValue",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidAttributeValue.prototype)}}class QueueDeletedRecently extends SQSServiceException{name="QueueDeletedRecently";$fault="client";constructor(e){super({name:"QueueDeletedRecently",$fault:"client",...e}),Object.setPrototypeOf(this,QueueDeletedRecently.prototype)}}class QueueNameExists extends SQSServiceException{name="QueueNameExists";$fault="client";constructor(e){super({name:"QueueNameExists",$fault:"client",...e}),Object.setPrototypeOf(this,QueueNameExists.prototype)}}class InvalidIdFormat extends SQSServiceException{name="InvalidIdFormat";$fault="client";constructor(e){super({name:"InvalidIdFormat",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidIdFormat.prototype)}}class PurgeQueueInProgress extends SQSServiceException{name="PurgeQueueInProgress";$fault="client";constructor(e){super({name:"PurgeQueueInProgress",$fault:"client",...e}),Object.setPrototypeOf(this,PurgeQueueInProgress.prototype)}}class KmsAccessDenied extends SQSServiceException{name="KmsAccessDenied";$fault="client";constructor(e){super({name:"KmsAccessDenied",$fault:"client",...e}),Object.setPrototypeOf(this,KmsAccessDenied.prototype)}}class KmsDisabled extends SQSServiceException{name="KmsDisabled";$fault="client";constructor(e){super({name:"KmsDisabled",$fault:"client",...e}),Object.setPrototypeOf(this,KmsDisabled.prototype)}}class KmsInvalidKeyUsage extends SQSServiceException{name="KmsInvalidKeyUsage";$fault="client";constructor(e){super({name:"KmsInvalidKeyUsage",$fault:"client",...e}),Object.setPrototypeOf(this,KmsInvalidKeyUsage.prototype)}}class KmsInvalidState extends SQSServiceException{name="KmsInvalidState";$fault="client";constructor(e){super({name:"KmsInvalidState",$fault:"client",...e}),Object.setPrototypeOf(this,KmsInvalidState.prototype)}}class KmsNotFound extends SQSServiceException{name="KmsNotFound";$fault="client";constructor(e){super({name:"KmsNotFound",$fault:"client",...e}),Object.setPrototypeOf(this,KmsNotFound.prototype)}}class KmsOptInRequired extends SQSServiceException{name="KmsOptInRequired";$fault="client";constructor(e){super({name:"KmsOptInRequired",$fault:"client",...e}),Object.setPrototypeOf(this,KmsOptInRequired.prototype)}}class KmsThrottled extends SQSServiceException{name="KmsThrottled";$fault="client";constructor(e){super({name:"KmsThrottled",$fault:"client",...e}),Object.setPrototypeOf(this,KmsThrottled.prototype)}}class InvalidMessageContents extends SQSServiceException{name="InvalidMessageContents";$fault="client";constructor(e){super({name:"InvalidMessageContents",$fault:"client",...e}),Object.setPrototypeOf(this,InvalidMessageContents.prototype)}}class BatchRequestTooLong extends SQSServiceException{name="BatchRequestTooLong";$fault="client";constructor(e){super({name:"BatchRequestTooLong",$fault:"client",...e}),Object.setPrototypeOf(this,BatchRequestTooLong.prototype)}}const se_DeleteMessageCommand=async(e,t)=>{const n=sharedHeaders("DeleteMessage");let i;return i=JSON.stringify(se_DeleteMessageRequest(e)),buildHttpRpcRequest(t,n,"/",void 0,i)},se_GetQueueUrlCommand=async(e,t)=>{const n=sharedHeaders("GetQueueUrl");let i;return i=JSON.stringify(se_GetQueueUrlRequest(e)),buildHttpRpcRequest(t,n,"/",void 0,i)},se_ReceiveMessageCommand=async(e,t)=>{const n=sharedHeaders("ReceiveMessage");let i;return i=JSON.stringify(se_ReceiveMessageRequest(e)),buildHttpRpcRequest(t,n,"/",void 0,i)},se_SendMessageCommand=async(e,t)=>{const n=sharedHeaders("SendMessage");let i;return i=JSON.stringify(se_SendMessageRequest(e,t)),buildHttpRpcRequest(t,n,"/",void 0,i)},de_DeleteMessageCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);await collectBody$1(e.body,t);return{$metadata:deserializeMetadata(e)}},de_GetQueueUrlCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=_json(n);return{$metadata:deserializeMetadata(e),...i}},de_ReceiveMessageCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=de_ReceiveMessageResult(n,t);return{$metadata:deserializeMetadata(e),...i}},de_SendMessageCommand=async(e,t)=>{if(e.statusCode>=300)return de_CommandError(e,t);const n=await parseJsonBody$1(e.body,t);let i={};i=_json(n);return{$metadata:deserializeMetadata(e),...i}},de_CommandError=async(e,t)=>{const n={...e,body:await parseJsonErrorBody(e.body,t)};populateBodyWithQueryCompatibility(n,e.headers);const i=loadRestJsonErrorCode$1(e,n.body);switch(i){case"InvalidAddress":case"com.amazonaws.sqs#InvalidAddress":throw await de_InvalidAddressRes(n);case"InvalidSecurity":case"com.amazonaws.sqs#InvalidSecurity":throw await de_InvalidSecurityRes(n);case"OverLimit":case"com.amazonaws.sqs#OverLimit":throw await de_OverLimitRes(n);case"QueueDoesNotExist":case"com.amazonaws.sqs#QueueDoesNotExist":case"AWS.SimpleQueueService.NonExistentQueue":throw await de_QueueDoesNotExistRes(n);case"RequestThrottled":case"com.amazonaws.sqs#RequestThrottled":throw await de_RequestThrottledRes(n);case"UnsupportedOperation":case"com.amazonaws.sqs#UnsupportedOperation":case"AWS.SimpleQueueService.UnsupportedOperation":throw await de_UnsupportedOperationRes(n);case"ResourceNotFoundException":case"com.amazonaws.sqs#ResourceNotFoundException":throw await de_ResourceNotFoundExceptionRes(n);case"MessageNotInflight":case"com.amazonaws.sqs#MessageNotInflight":case"AWS.SimpleQueueService.MessageNotInflight":throw await de_MessageNotInflightRes(n);case"ReceiptHandleIsInvalid":case"com.amazonaws.sqs#ReceiptHandleIsInvalid":throw await de_ReceiptHandleIsInvalidRes(n);case"BatchEntryIdsNotDistinct":case"com.amazonaws.sqs#BatchEntryIdsNotDistinct":case"AWS.SimpleQueueService.BatchEntryIdsNotDistinct":throw await de_BatchEntryIdsNotDistinctRes(n);case"EmptyBatchRequest":case"com.amazonaws.sqs#EmptyBatchRequest":case"AWS.SimpleQueueService.EmptyBatchRequest":throw await de_EmptyBatchRequestRes(n);case"InvalidBatchEntryId":case"com.amazonaws.sqs#InvalidBatchEntryId":case"AWS.SimpleQueueService.InvalidBatchEntryId":throw await de_InvalidBatchEntryIdRes(n);case"TooManyEntriesInBatchRequest":case"com.amazonaws.sqs#TooManyEntriesInBatchRequest":case"AWS.SimpleQueueService.TooManyEntriesInBatchRequest":throw await de_TooManyEntriesInBatchRequestRes(n);case"InvalidAttributeName":case"com.amazonaws.sqs#InvalidAttributeName":throw await de_InvalidAttributeNameRes(n);case"InvalidAttributeValue":case"com.amazonaws.sqs#InvalidAttributeValue":throw await de_InvalidAttributeValueRes(n);case"QueueDeletedRecently":case"com.amazonaws.sqs#QueueDeletedRecently":case"AWS.SimpleQueueService.QueueDeletedRecently":throw await de_QueueDeletedRecentlyRes(n);case"QueueNameExists":case"com.amazonaws.sqs#QueueNameExists":case"QueueAlreadyExists":throw await de_QueueNameExistsRes(n);case"InvalidIdFormat":case"com.amazonaws.sqs#InvalidIdFormat":throw await de_InvalidIdFormatRes(n);case"PurgeQueueInProgress":case"com.amazonaws.sqs#PurgeQueueInProgress":case"AWS.SimpleQueueService.PurgeQueueInProgress":throw await de_PurgeQueueInProgressRes(n);case"KmsAccessDenied":case"com.amazonaws.sqs#KmsAccessDenied":case"KMS.AccessDeniedException":throw await de_KmsAccessDeniedRes(n);case"KmsDisabled":case"com.amazonaws.sqs#KmsDisabled":case"KMS.DisabledException":throw await de_KmsDisabledRes(n);case"KmsInvalidKeyUsage":case"com.amazonaws.sqs#KmsInvalidKeyUsage":case"KMS.InvalidKeyUsageException":throw await de_KmsInvalidKeyUsageRes(n);case"KmsInvalidState":case"com.amazonaws.sqs#KmsInvalidState":case"KMS.InvalidStateException":throw await de_KmsInvalidStateRes(n);case"KmsNotFound":case"com.amazonaws.sqs#KmsNotFound":case"KMS.NotFoundException":throw await de_KmsNotFoundRes(n);case"KmsOptInRequired":case"com.amazonaws.sqs#KmsOptInRequired":case"KMS.OptInRequired":throw await de_KmsOptInRequiredRes(n);case"KmsThrottled":case"com.amazonaws.sqs#KmsThrottled":case"KMS.ThrottlingException":throw await de_KmsThrottledRes(n);case"InvalidMessageContents":case"com.amazonaws.sqs#InvalidMessageContents":throw await de_InvalidMessageContentsRes(n);case"BatchRequestTooLong":case"com.amazonaws.sqs#BatchRequestTooLong":case"AWS.SimpleQueueService.BatchRequestTooLong":throw await de_BatchRequestTooLongRes(n);default:const t=n.body;return throwDefaultError({output:e,parsedBody:t,errorCode:i})}},de_BatchEntryIdsNotDistinctRes=async(e,t)=>{const n=e.body,i=_json(n),r=new BatchEntryIdsNotDistinct({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_BatchRequestTooLongRes=async(e,t)=>{const n=e.body,i=_json(n),r=new BatchRequestTooLong({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_EmptyBatchRequestRes=async(e,t)=>{const n=e.body,i=_json(n),r=new EmptyBatchRequest({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidAddressRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAddress({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidAttributeNameRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAttributeName({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidAttributeValueRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidAttributeValue({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidBatchEntryIdRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidBatchEntryId({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidIdFormatRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidIdFormat({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidMessageContentsRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidMessageContents({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_InvalidSecurityRes=async(e,t)=>{const n=e.body,i=_json(n),r=new InvalidSecurity({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsAccessDeniedRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsAccessDenied({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsDisabledRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsDisabled({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsInvalidKeyUsageRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsInvalidKeyUsage({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsInvalidStateRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsInvalidState({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsNotFoundRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsNotFound({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsOptInRequiredRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsOptInRequired({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_KmsThrottledRes=async(e,t)=>{const n=e.body,i=_json(n),r=new KmsThrottled({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_MessageNotInflightRes=async(e,t)=>{const n=e.body,i=_json(n),r=new MessageNotInflight({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_OverLimitRes=async(e,t)=>{const n=e.body,i=_json(n),r=new OverLimit({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_PurgeQueueInProgressRes=async(e,t)=>{const n=e.body,i=_json(n),r=new PurgeQueueInProgress({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_QueueDeletedRecentlyRes=async(e,t)=>{const n=e.body,i=_json(n),r=new QueueDeletedRecently({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_QueueDoesNotExistRes=async(e,t)=>{const n=e.body,i=_json(n),r=new QueueDoesNotExist({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_QueueNameExistsRes=async(e,t)=>{const n=e.body,i=_json(n),r=new QueueNameExists({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_ReceiptHandleIsInvalidRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ReceiptHandleIsInvalid({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_RequestThrottledRes=async(e,t)=>{const n=e.body,i=_json(n),r=new RequestThrottled({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_ResourceNotFoundExceptionRes=async(e,t)=>{const n=e.body,i=_json(n),r=new ResourceNotFoundException({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_TooManyEntriesInBatchRequestRes=async(e,t)=>{const n=e.body,i=_json(n),r=new TooManyEntriesInBatchRequest({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},de_UnsupportedOperationRes=async(e,t)=>{const n=e.body,i=_json(n),r=new UnsupportedOperation({$metadata:deserializeMetadata(e),...i});return decorateServiceException$1(r,n)},se_AttributeNameList=(e,t)=>e.filter(e=>null!=e).map(e=>_toStr(e)),se_BinaryList=(e,t)=>e.filter(e=>null!=e).map(e=>t.base64Encoder(e)),se_DeleteMessageRequest=(e,t)=>take(e,{QueueUrl:_toStr,ReceiptHandle:_toStr}),se_GetQueueUrlRequest=(e,t)=>take(e,{QueueName:_toStr,QueueOwnerAWSAccountId:_toStr}),se_MessageAttributeNameList=(e,t)=>e.filter(e=>null!=e).map(e=>_toStr(e)),se_MessageAttributeValue=(e,t)=>take(e,{BinaryListValues:e=>se_BinaryList(e,t),BinaryValue:t.base64Encoder,DataType:_toStr,StringListValues:e=>se_StringList(e),StringValue:_toStr}),se_MessageBodyAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_MessageAttributeValue(i,t)),e),{}),se_MessageBodySystemAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=se_MessageSystemAttributeValue(i,t)),e),{}),se_MessageSystemAttributeList=(e,t)=>e.filter(e=>null!=e).map(e=>_toStr(e)),se_MessageSystemAttributeValue=(e,t)=>take(e,{BinaryListValues:e=>se_BinaryList(e,t),BinaryValue:t.base64Encoder,DataType:_toStr,StringListValues:e=>se_StringList(e),StringValue:_toStr}),se_ReceiveMessageRequest=(e,t)=>take(e,{AttributeNames:e=>se_AttributeNameList(e),MaxNumberOfMessages:_toNum,MessageAttributeNames:e=>se_MessageAttributeNameList(e),MessageSystemAttributeNames:e=>se_MessageSystemAttributeList(e),QueueUrl:_toStr,ReceiveRequestAttemptId:_toStr,VisibilityTimeout:_toNum,WaitTimeSeconds:_toNum}),se_SendMessageRequest=(e,t)=>take(e,{DelaySeconds:_toNum,MessageAttributes:e=>se_MessageBodyAttributeMap(e,t),MessageBody:_toStr,MessageDeduplicationId:_toStr,MessageGroupId:_toStr,MessageSystemAttributes:e=>se_MessageBodySystemAttributeMap(e,t),QueueUrl:_toStr}),se_StringList=(e,t)=>e.filter(e=>null!=e).map(e=>_toStr(e)),de_BinaryList=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>t.base64Decoder(e));return n},de_Message=(e,t)=>take(e,{Attributes:_json,Body:expectString,MD5OfBody:expectString,MD5OfMessageAttributes:expectString,MessageAttributes:e=>de_MessageBodyAttributeMap(e,t),MessageId:expectString,ReceiptHandle:expectString}),de_MessageAttributeValue=(e,t)=>take(e,{BinaryListValues:e=>de_BinaryList(e,t),BinaryValue:t.base64Decoder,DataType:expectString,StringListValues:_json,StringValue:expectString}),de_MessageBodyAttributeMap=(e,t)=>Object.entries(e).reduce((e,[n,i])=>(null===i||(e[n]=de_MessageAttributeValue(i,t)),e),{}),de_MessageList=(e,t)=>{const n=(e||[]).filter(e=>null!=e).map(e=>de_Message(e,t));return n},de_ReceiveMessageResult=(e,t)=>take(e,{Messages:e=>de_MessageList(e,t)}),deserializeMetadata=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"]}),throwDefaultError=withBaseException(SQSServiceException),buildHttpRpcRequest=async(e,t,n,i,r)=>{const{hostname:o,protocol:a="https",port:s,path:c}=await e.endpoint(),l={protocol:a,hostname:o,port:s,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return void 0!==r&&(l.body=r),new HttpRequest$2(l)};function sharedHeaders(e){return{"content-type":"application/x-amz-json-1.0","x-amz-target":`AmazonSQS.${e}`,"x-amzn-query-mode":"true"}}const populateBodyWithQueryCompatibility=(e,t)=>{const n=t["x-amzn-query-error"];if(void 0!==e.body&&null!=n){const[t,i]=n.split(";"),r=Object.entries(e.body),o={Type:i,Code:t};Object.assign(e.body,o);for(const[e,t]of r)o[e]=t;delete o.__type,e.body.Error=o}};class DeleteMessageCommand extends(Command$1.classBuilder().ep(commonParams).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("AmazonSQS","DeleteMessage",{}).n("SQSClient","DeleteMessageCommand").f(void 0,void 0).ser(se_DeleteMessageCommand).de(de_DeleteMessageCommand).build()){}class GetQueueUrlCommand extends(Command$1.classBuilder().ep(commonParams).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions())]}).s("AmazonSQS","GetQueueUrl",{}).n("SQSClient","GetQueueUrlCommand").f(void 0,void 0).ser(se_GetQueueUrlCommand).de(de_GetQueueUrlCommand).build()){}class ReceiveMessageCommand extends(Command$1.classBuilder().ep(commonParams).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions()),getReceiveMessagePlugin(n)]}).s("AmazonSQS","ReceiveMessage",{}).n("SQSClient","ReceiveMessageCommand").f(void 0,void 0).ser(se_ReceiveMessageCommand).de(de_ReceiveMessageCommand).build()){}class SendMessageCommand extends(Command$1.classBuilder().ep(commonParams).m(function(e,t,n,i){return[getSerdePlugin(n,this.serialize,this.deserialize),getEndpointPlugin$1(n,e.getEndpointParameterInstructions()),getSendMessagePlugin(n)]}).s("AmazonSQS","SendMessage",{}).n("SQSClient","SendMessageCommand").f(void 0,void 0).ser(se_SendMessageCommand).de(de_SendMessageCommand).build()){}const deleteQueueItem=async(e,t,n,i)=>{try{const t=new DeleteMessageCommand({QueueUrl:n,ReceiptHandle:i});return await e.send(t)}catch(e){return void(t.logger&&t.logger.error(e))}},getQueueItems=async(e,t,n,i=1)=>{try{const t=new ReceiveMessageCommand({MaxNumberOfMessages:i,QueueUrl:n});return await e.send(t)}catch(e){return void(t.logger&&t.logger.error(e))}},getQueueUrl=async(e,t,n)=>{try{const t=new GetQueueUrlCommand({QueueName:n});return(await e.send(t)).QueueUrl}catch(e){return void(t.logger&&t.logger.error(e))}},sendMessage=async(e,t,n,i,r={},o,a=0)=>{try{const t=new SendMessageCommand({...r,...o?{MessageAttributes:o}:{},DelaySeconds:a,MessageBody:i,QueueUrl:n});return(await e.send(t)).MessageId}catch(e){return void(t.logger&&t.logger.error(e))}},sqs=e=>{const{clientConfig:t,...n}={...DEFAULT_AWS_CONFIGURATION,...e},i=new SQSClient(t);return{deleteQueueItem:(e,t)=>deleteQueueItem(i,n,e,t),getQueueItems:(e,t)=>getQueueItems(i,n,e,t),getQueueUrl:e=>getQueueUrl(i,n,e),sendMessage:(e,t,r,o,a)=>sendMessage(i,n,e,t,r,o,a)}};var winston={},browser$2={},format$2,hasRequiredFormat$1;function requireFormat$1(){if(hasRequiredFormat$1)return format$2;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n,r){return n=o(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,i()?Reflect.construct(n,r||[],o(t).constructor):n.apply(t,r))}function n(e){var t="function"==typeof Map?new Map:void 0;return n=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,t);var a=new(e.bind.apply(e,o));return n&&r(a,n.prototype),a}(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),r(n,e)},n(e)}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}hasRequiredFormat$1=1;var a=function(e){function n(e){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),i=t(this,n,["Format functions must be synchronous taking a two arguments: (info, opts)\nFound: ".concat(e.toString().split("\n")[0],"\n")]),Error.captureStackTrace(i,n),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(n,e),function(e){return Object.defineProperty(e,"prototype",{writable:!1}),e}(n)}(n(Error));return format$2=function(e){if(e.length>2)throw new a(e);function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}function n(e){return new t(e)}return t.prototype.transform=e,n.Format=t,n},format$2}var colorize={exports:{}},safe={exports:{}},colors={exports:{}},styles={exports:{}},hasRequiredStyles,hasFlag,hasRequiredHasFlag,supportsColors,hasRequiredSupportsColors;function requireStyles(){return hasRequiredStyles||(hasRequiredStyles=1,function(e){var t={};e.exports=t;var n={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(n).forEach(function(e){var i=n[e],r=t[e]=[];r.open="["+i[0]+"m",r.close="["+i[1]+"m"})}(styles)),styles.exports}function requireHasFlag(){return hasRequiredHasFlag?hasFlag:(hasRequiredHasFlag=1,hasFlag=function(e,t){var n=(t=t||process.argv||[]).indexOf("--"),i=/^-{1,2}/.test(e)?"":"--",r=t.indexOf(i+e);return-1!==r&&(-1===n||r<n)})}function requireSupportsColors(){if(hasRequiredSupportsColors)return supportsColors;hasRequiredSupportsColors=1;var e=require$$0$6,t=requireHasFlag(),n=[],i=void 0;function r(r){var o=function(r){if(!1===i)return 0;if(t("color=16m")||t("color=full")||t("color=truecolor"))return 3;if(t("color=256"))return 2;if(r&&!r.isTTY&&!0!==i)return 0;var o=i?1:0;if("win32"===process.platform){var a=e.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in n)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(e){return e in n})||"codeship"===n.CI_NAME?1:o;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in n){var s=parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:o}(r);return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(o)}return t("no-color")||t("no-colors")||t("color=false")?i=!1:(t("color")||t("colors")||t("color=true")||t("color=always"))&&(i=!0),"FORCE_COLOR"in n&&(i=0===n.FORCE_COLOR.length||0!==parseInt(n.FORCE_COLOR,10)),supportsColors={supportsColor:r,stdout:r(process.stdout),stderr:r(process.stderr)}}var trap={exports:{}},hasRequiredTrap;function requireTrap(){return hasRequiredTrap||(hasRequiredTrap=1,trap.exports=function(e,t){var n="";e=(e=e||"Run the trap, drop the bass").split("");var i={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return e.forEach(function(e){e=e.toLowerCase();var t=i[e]||[" "],r=Math.floor(Math.random()*t.length);n+=void 0!==i[e]?i[e][r]:e}),n}),trap.exports}var zalgo={exports:{}},hasRequiredZalgo;function requireZalgo(){return hasRequiredZalgo||(hasRequiredZalgo=1,zalgo.exports=function(e,t){e=e||" he is here ";var n={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},i=[].concat(n.up,n.down,n.mid);function r(e){return Math.floor(Math.random()*e)}function o(e){var t=!1;return i.filter(function(n){t=n===e}),t}return function(e,t){var i,a,s="";for(a in(t=t||{}).up=void 0===t.up||t.up,t.mid=void 0===t.mid||t.mid,t.down=void 0===t.down||t.down,t.size=void 0!==t.size?t.size:"maxi",e=e.split(""))if(!o(a)){switch(s+=e[a],i={up:0,down:0,mid:0},t.size){case"mini":i.up=r(8),i.mid=r(2),i.down=r(8);break;case"maxi":i.up=r(16)+3,i.mid=r(4)+1,i.down=r(64)+3;break;default:i.up=r(8)+1,i.mid=r(6)/2,i.down=r(8)+1}var c=["up","mid","down"];for(var l in c)for(var d=c[l],u=0;u<=i[d];u++)t[d]&&(s+=n[d][r(n[d].length)])}return s}(e,t)}),zalgo.exports}var america={exports:{}},hasRequiredAmerica;function requireAmerica(){return hasRequiredAmerica||(hasRequiredAmerica=1,america.exports=function(e){return function(t,n,i){if(" "===t)return t;switch(n%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}),america.exports}var zebra={exports:{}},hasRequiredZebra;function requireZebra(){return hasRequiredZebra||(hasRequiredZebra=1,zebra.exports=function(e){return function(t,n,i){return n%2==0?t:e.inverse(t)}}),zebra.exports}var rainbow={exports:{}},hasRequiredRainbow;function requireRainbow(){return hasRequiredRainbow||(hasRequiredRainbow=1,rainbow.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(n,i,r){return" "===n?n:e[t[i++%t.length]](n)}}),rainbow.exports}var random={exports:{}},hasRequiredRandom,hasRequiredColors,hasRequiredSafe;function requireRandom(){return hasRequiredRandom||(hasRequiredRandom=1,random.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(n,i,r){return" "===n?n:e[t[Math.round(Math.random()*(t.length-2))]](n)}}),random.exports}function requireColors(){return hasRequiredColors||(hasRequiredColors=1,function(e){var t={};e.exports=t,t.themes={};var n=require$$0$8,i=t.styles=requireStyles(),r=Object.defineProperties,o=new RegExp(/[\r\n]+/g);t.supportsColor=requireSupportsColors().supportsColor,void 0===t.enabled&&(t.enabled=!1!==t.supportsColor()),t.enable=function(){t.enabled=!0},t.disable=function(){t.enabled=!1},t.stripColors=t.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")},t.stylize=function(e,n){if(!t.enabled)return e+"";var r=i[n];return!r&&n in t?t[n](e):r.open+e+r.close};var a=/[|\\{}()[\]^$+*?.]/g;function s(e){var t=function e(){return u.apply(e,arguments)};return t._styles=e,t.__proto__=d,t}var c,l=(c={},i.grey=i.gray,Object.keys(i).forEach(function(e){i[e].closeRe=new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(a,"\\$&")}(i[e].close),"g"),c[e]={get:function(){return s(this._styles.concat(e))}}}),c),d=r(function(){},l);function u(){var e=Array.prototype.slice.call(arguments).map(function(e){return null!=e&&e.constructor===String?e:n.inspect(e)}).join(" ");if(!t.enabled||!e)return e;for(var r=-1!=e.indexOf("\n"),a=this._styles,s=a.length;s--;){var c=i[a[s]];e=c.open+e.replace(c.closeRe,c.open)+c.close,r&&(e=e.replace(o,function(e){return c.close+e+c.open}))}return e}t.setTheme=function(e){if("string"!=typeof e)for(var n in e)(function(n){t[n]=function(i){if("object"==typeof e[n]){var r=i;for(var o in e[n])r=t[e[n][o]](r);return r}return t[e[n]](i)}})(n);else console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));")};var p=function(e,t){var n=t.split("");return(n=n.map(e)).join("")};for(var m in t.trap=requireTrap(),t.zalgo=requireZalgo(),t.maps={},t.maps.america=requireAmerica()(t),t.maps.zebra=requireZebra()(t),t.maps.rainbow=requireRainbow()(t),t.maps.random=requireRandom()(t),t.maps)(function(e){t[e]=function(n){return p(t.maps[e],n)}})(m);r(t,function(){var e={};return Object.keys(l).forEach(function(t){e[t]={get:function(){return s([t])}}}),e}())}(colors)),colors.exports}function requireSafe(){return hasRequiredSafe||(hasRequiredSafe=1,function(e){var t=requireColors();e.exports=t}(safe)),safe.exports}var tripleBeam={},config$1={},cli$1={},hasRequiredCli$1;function requireCli$1(){return hasRequiredCli$1||(hasRequiredCli$1=1,cli$1.levels={error:0,warn:1,help:2,data:3,info:4,debug:5,prompt:6,verbose:7,input:8,silly:9},cli$1.colors={error:"red",warn:"yellow",help:"cyan",data:"grey",info:"green",debug:"blue",prompt:"grey",verbose:"cyan",input:"grey",silly:"magenta"}),cli$1}var npm={},hasRequiredNpm;function requireNpm(){return hasRequiredNpm||(hasRequiredNpm=1,npm.levels={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6},npm.colors={error:"red",warn:"yellow",info:"green",http:"green",verbose:"cyan",debug:"blue",silly:"magenta"}),npm}var syslog={},hasRequiredSyslog,hasRequiredConfig$1,hasRequiredTripleBeam,hasRequiredColorize,levels,hasRequiredLevels,align,hasRequiredAlign;function requireSyslog(){return hasRequiredSyslog||(hasRequiredSyslog=1,syslog.levels={emerg:0,alert:1,crit:2,error:3,warning:4,notice:5,info:6,debug:7},syslog.colors={emerg:"red",alert:"yellow",crit:"red",error:"red",warning:"red",notice:"yellow",info:"green",debug:"blue"}),syslog}function requireConfig$1(){return hasRequiredConfig$1||(hasRequiredConfig$1=1,e=config$1,Object.defineProperty(e,"cli",{value:requireCli$1()}),Object.defineProperty(e,"npm",{value:requireNpm()}),Object.defineProperty(e,"syslog",{value:requireSyslog()})),config$1;var e}function requireTripleBeam(){return hasRequiredTripleBeam||(hasRequiredTripleBeam=1,e=tripleBeam,Object.defineProperty(e,"LEVEL",{value:Symbol.for("level")}),Object.defineProperty(e,"MESSAGE",{value:Symbol.for("message")}),Object.defineProperty(e,"SPLAT",{value:Symbol.for("splat")}),Object.defineProperty(e,"configs",{value:requireConfig$1()})),tripleBeam;var e}function requireColorize(){if(hasRequiredColorize)return colorize.exports;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredColorize=1;var i=requireSafe(),r=requireTripleBeam(),o=r.LEVEL,a=r.MESSAGE;i.enabled=!0;var s=/\s+/,c=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.colors&&this.addColors(t.colors),this.options=t}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"addColors",value:function(t){return e.addColors(t)}},{key:"colorize",value:function(t,n,r){if(void 0===r&&(r=n),!Array.isArray(e.allColors[t]))return i[e.allColors[t]](r);for(var o=0,a=e.allColors[t].length;o<a;o++)r=i[e.allColors[t][o]](r);return r}},{key:"transform",value:function(e,t){return t.all&&"string"==typeof e[a]&&(e[a]=this.colorize(e[o],e.level,e[a])),(t.level||t.all||!t.message)&&(e.level=this.colorize(e[o],e.level)),(t.all||t.message)&&(e.message=this.colorize(e[o],e.level,e.message)),e}}],[{key:"addColors",value:function(t){var n=Object.keys(t).reduce(function(e,n){return e[n]=s.test(t[n])?t[n].split(s):t[n],e},{});return e.allColors=Object.assign({},e.allColors||{},n),e.allColors}}])}();return colorize.exports=function(e){return new c(e)},colorize.exports.Colorizer=colorize.exports.Format=c,colorize.exports}function requireLevels(){if(hasRequiredLevels)return levels;hasRequiredLevels=1;var e=requireColorize().Colorizer;return levels=function(t){return e.addColors(t.colors||t),t},levels}function requireAlign(){if(hasRequiredAlign)return align;hasRequiredAlign=1;var e=requireFormat$1();return align=e(function(e){return e.message="\t".concat(e.message),e})}var cli={exports:{}},padLevels={exports:{}},hasRequiredPadLevels,hasRequiredCli;function requirePadLevels(){if(hasRequiredPadLevels)return padLevels.exports;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function r(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredPadLevels=1;var o=requireTripleBeam(),a=o.configs,s=o.LEVEL,c=o.MESSAGE,l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{levels:a.npm.levels};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.paddings=e.paddingForLevels(t.levels,t.filler),this.options=t}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"transform",value:function(e,t){return e.message="".concat(this.paddings[e[s]]).concat(e.message),e[c]&&(e[c]="".concat(this.paddings[e[s]]).concat(e[c])),e}}],[{key:"getLongestLevel",value:function(e){var n=Object.keys(e).map(function(e){return e.length});return Math.max.apply(Math,t(n))}},{key:"paddingForLevel",value:function(e,t,n){var i=n+1-e.length,r=Math.floor(i/t.length);return"".concat(t).concat(t.repeat(r)).slice(0,i)}},{key:"paddingForLevels",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",i=e.getLongestLevel(t);return Object.keys(t).reduce(function(t,r){return t[r]=e.paddingForLevel(r,n,i),t},{})}}])}();return padLevels.exports=function(e){return new l(e)},padLevels.exports.Padder=padLevels.exports.Format=l,padLevels.exports}function requireCli(){if(hasRequiredCli)return cli.exports;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredCli=1;var i=requireColorize().Colorizer,r=requirePadLevels().Padder,o=requireTripleBeam(),a=o.configs,s=o.MESSAGE,c=function(){return t(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.levels||(t.levels=a.cli.levels),this.colorizer=new i(t),this.padder=new r(t),this.options=t},[{key:"transform",value:function(e,t){return this.colorizer.transform(this.padder.transform(e,t),t),e[s]="".concat(e.level,":").concat(e.message),e}}])}();return cli.exports=function(e){return new c(e)},cli.exports.Format=c,cli.exports}var combine={exports:{}},hasRequiredCombine,errors,hasRequiredErrors;function requireCombine(){if(hasRequiredCombine)return combine.exports;hasRequiredCombine=1;var e=requireFormat$1();function t(e){if(e.every(n))return function(t){for(var n=t,i=0;i<e.length;i++)if(!(n=e[i].transform(n,e[i].options)))return!1;return n}}function n(e){if("function"!=typeof e.transform)throw new Error(["No transform function found on format. Did you create a format instance?","const myFormat = format(formatFn);","const instance = myFormat();"].join("\n"));return!0}return combine.exports=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=e(t(i)),a=o();return a.Format=o.Format,a},combine.exports.cascade=t,combine.exports}function requireErrors(){if(hasRequiredErrors)return errors;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n,i){return(n=function(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}hasRequiredErrors=1;var n=requireFormat$1(),i=requireTripleBeam(),r=i.LEVEL,o=i.MESSAGE;return errors=n(function(e,n){var i=n.stack,a=n.cause;if(e instanceof Error){var s=Object.assign({},e,t(t(t({level:e.level},r,e[r]||e.level),"message",e.message),o,e[o]||e.message));return i&&(s.stack=e.stack),a&&(s.cause=e.cause),s}if(!(e.message instanceof Error))return e;var c=e.message;return Object.assign(e,c),e.message=c.message,e[o]=c.message,i&&(e.stack=c.stack),a&&(e.cause=c.cause),e})}var safeStableStringify={exports:{}},hasRequiredSafeStableStringify,json$1,hasRequiredJson$1,label,hasRequiredLabel,logstash,hasRequiredLogstash,metadata,hasRequiredMetadata,ms,hasRequiredMs$1,ms_1,hasRequiredMs,prettyPrint,hasRequiredPrettyPrint;function requireSafeStableStringify(){return hasRequiredSafeStableStringify||(hasRequiredSafeStableStringify=1,function(e,t){const{hasOwnProperty:n}=Object.prototype,i=p();i.configure=p,i.stringify=i,i.default=i,t.stringify=i,t.configure=p,e.exports=i;const r=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(e){return e.length<5e3&&!r.test(e)?`"${e}"`:JSON.stringify(e)}function a(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){const n=e[t];let i=t;for(;0!==i&&e[i-1]>n;)e[i]=e[i-1],i--;e[i]=n}return e}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return void 0!==s.call(e)&&0!==e.length}function l(e,t,n){e.length<n&&(n=e.length);const i=","===t?"":" ";let r=`"0":${i}${e[0]}`;for(let o=1;o<n;o++)r+=`${t}"${o}":${i}${e[o]}`;return r}function d(e,t){let i;if(n.call(e,t)){if(i=e[t],"number"!=typeof i)throw new TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(i))throw new TypeError(`The "${t}" argument must be an integer`);if(i<1)throw new RangeError(`The "${t}" argument must be >= 1`)}return void 0===i?1/0:i}function u(e){return 1===e?"1 item":`${e} items`}function p(e){const t=function(e){if(n.call(e,"strict")){const t=e.strict;if("boolean"!=typeof t)throw new TypeError('The "strict" argument must be of type boolean');if(t)return e=>{let t="Object can not safely be stringified. Received type "+typeof e;throw"function"!=typeof e&&(t+=` (${e.toString()})`),new Error(t)}}}(e={...e});t&&(void 0===e.bigint&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));const i=function(e){if(n.call(e,"circularValue")){const t=e.circularValue;if("string"==typeof t)return`"${t}"`;if(null==t)return t;if(t===Error||t===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}(e),r=function(e,t){let i;if(n.call(e,t)&&(i=e[t],"boolean"!=typeof i))throw new TypeError(`The "${t}" argument must be of type boolean`);return void 0===i||i}(e,"bigint"),s=function(e){let t;if(n.call(e,"deterministic")&&(t=e.deterministic,"boolean"!=typeof t&&"function"!=typeof t))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return void 0===t||t}(e),p="function"==typeof s?s:void 0,m=d(e,"maximumDepth"),h=d(e,"maximumBreadth");function f(e,n,l,d,g,y){let v=n[e];switch("object"==typeof v&&null!==v&&"function"==typeof v.toJSON&&(v=v.toJSON(e)),v=d.call(n,e,v),typeof v){case"string":return o(v);case"object":{if(null===v)return"null";if(-1!==l.indexOf(v))return i;let e="",t=",";const n=y;if(Array.isArray(v)){if(0===v.length)return"[]";if(m<l.length+1)return'"[Array]"';l.push(v),""!==g&&(e+=`\n${y+=g}`,t=`,\n${y}`);const i=Math.min(v.length,h);let r=0;for(;r<i-1;r++){const n=f(String(r),v,l,d,g,y);e+=void 0!==n?n:"null",e+=t}const o=f(String(r),v,l,d,g,y);if(e+=void 0!==o?o:"null",v.length-1>h){e+=`${t}"... ${u(v.length-h-1)} not stringified"`}return""!==g&&(e+=`\n${n}`),l.pop(),`[${e}]`}let r=Object.keys(v);const x=r.length;if(0===x)return"{}";if(m<l.length+1)return'"[Object]"';let E="",b="";""!==g&&(t=`,\n${y+=g}`,E=" ");const S=Math.min(x,h);s&&!c(v)&&(r=a(r,p)),l.push(v);for(let n=0;n<S;n++){const i=r[n],a=f(i,v,l,d,g,y);void 0!==a&&(e+=`${b}${o(i)}:${E}${a}`,b=t)}if(x>h){e+=`${b}"...":${E}"${u(x-h)} not stringified"`,b=t}return""!==g&&b.length>1&&(e=`\n${y}${e}\n${n}`),l.pop(),`{${e}}`}case"number":return isFinite(v)?String(v):t?t(v):"null";case"boolean":return!0===v?"true":"false";case"undefined":return;case"bigint":if(r)return String(v);default:return t?t(v):void 0}}function g(e,n,a,s,c,l){switch("object"==typeof n&&null!==n&&"function"==typeof n.toJSON&&(n=n.toJSON(e)),typeof n){case"string":return o(n);case"object":{if(null===n)return"null";if(-1!==a.indexOf(n))return i;const e=l;let t="",r=",";if(Array.isArray(n)){if(0===n.length)return"[]";if(m<a.length+1)return'"[Array]"';a.push(n),""!==c&&(t+=`\n${l+=c}`,r=`,\n${l}`);const i=Math.min(n.length,h);let o=0;for(;o<i-1;o++){const e=g(String(o),n[o],a,s,c,l);t+=void 0!==e?e:"null",t+=r}const d=g(String(o),n[o],a,s,c,l);if(t+=void 0!==d?d:"null",n.length-1>h){t+=`${r}"... ${u(n.length-h-1)} not stringified"`}return""!==c&&(t+=`\n${e}`),a.pop(),`[${t}]`}a.push(n);let d="";""!==c&&(r=`,\n${l+=c}`,d=" ");let p="";for(const e of s){const i=g(e,n[e],a,s,c,l);void 0!==i&&(t+=`${p}${o(e)}:${d}${i}`,p=r)}return""!==c&&p.length>1&&(t=`\n${l}${t}\n${e}`),a.pop(),`{${t}}`}case"number":return isFinite(n)?String(n):t?t(n):"null";case"boolean":return!0===n?"true":"false";case"undefined":return;case"bigint":if(r)return String(n);default:return t?t(n):void 0}}function y(e,n,d,f,g){switch(typeof n){case"string":return o(n);case"object":{if(null===n)return"null";if("function"==typeof n.toJSON){if("object"!=typeof(n=n.toJSON(e)))return y(e,n,d,f,g);if(null===n)return"null"}if(-1!==d.indexOf(n))return i;const t=g;if(Array.isArray(n)){if(0===n.length)return"[]";if(m<d.length+1)return'"[Array]"';d.push(n);let e=`\n${g+=f}`;const i=`,\n${g}`,r=Math.min(n.length,h);let o=0;for(;o<r-1;o++){const t=y(String(o),n[o],d,f,g);e+=void 0!==t?t:"null",e+=i}const a=y(String(o),n[o],d,f,g);if(e+=void 0!==a?a:"null",n.length-1>h){e+=`${i}"... ${u(n.length-h-1)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(n);const v=r.length;if(0===v)return"{}";if(m<d.length+1)return'"[Object]"';const x=`,\n${g+=f}`;let E="",b="",S=Math.min(v,h);c(n)&&(E+=l(n,x,h),r=r.slice(n.length),S-=n.length,b=x),s&&(r=a(r,p)),d.push(n);for(let e=0;e<S;e++){const t=r[e],i=y(t,n[t],d,f,g);void 0!==i&&(E+=`${b}${o(t)}: ${i}`,b=x)}if(v>h){E+=`${b}"...": "${u(v-h)} not stringified"`,b=x}return""!==b&&(E=`\n${g}${E}\n${t}`),d.pop(),`{${E}}`}case"number":return isFinite(n)?String(n):t?t(n):"null";case"boolean":return!0===n?"true":"false";case"undefined":return;case"bigint":if(r)return String(n);default:return t?t(n):void 0}}function v(e,n,d){switch(typeof n){case"string":return o(n);case"object":{if(null===n)return"null";if("function"==typeof n.toJSON){if("object"!=typeof(n=n.toJSON(e)))return v(e,n,d);if(null===n)return"null"}if(-1!==d.indexOf(n))return i;let t="";const r=void 0!==n.length;if(r&&Array.isArray(n)){if(0===n.length)return"[]";if(m<d.length+1)return'"[Array]"';d.push(n);const e=Math.min(n.length,h);let i=0;for(;i<e-1;i++){const e=v(String(i),n[i],d);t+=void 0!==e?e:"null",t+=","}const r=v(String(i),n[i],d);if(t+=void 0!==r?r:"null",n.length-1>h){t+=`,"... ${u(n.length-h-1)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(n);const g=f.length;if(0===g)return"{}";if(m<d.length+1)return'"[Object]"';let y="",x=Math.min(g,h);r&&c(n)&&(t+=l(n,",",h),f=f.slice(n.length),x-=n.length,y=","),s&&(f=a(f,p)),d.push(n);for(let e=0;e<x;e++){const i=f[e],r=v(i,n[i],d);void 0!==r&&(t+=`${y}${o(i)}:${r}`,y=",")}if(g>h){t+=`${y}"...":"${u(g-h)} not stringified"`}return d.pop(),`{${t}}`}case"number":return isFinite(n)?String(n):t?t(n):"null";case"boolean":return!0===n?"true":"false";case"undefined":return;case"bigint":if(r)return String(n);default:return t?t(n):void 0}}return function(e,t,n){if(arguments.length>1){let i="";if("number"==typeof n?i=" ".repeat(Math.min(n,10)):"string"==typeof n&&(i=n.slice(0,10)),null!=t){if("function"==typeof t)return f("",{"":e},[],t,i,"");if(Array.isArray(t))return g("",e,[],function(e){const t=new Set;for(const n of e)"string"!=typeof n&&"number"!=typeof n||t.add(String(n));return t}(t),i,"")}if(0!==i.length)return y("",e,[],i,"")}return v("",e,[])}}}(safeStableStringify,safeStableStringify.exports)),safeStableStringify.exports}function requireJson$1(){if(hasRequiredJson$1)return json$1;hasRequiredJson$1=1;var e=requireFormat$1(),t=requireTripleBeam().MESSAGE,n=requireSafeStableStringify();function i(e,t){return"bigint"==typeof t?t.toString():t}return json$1=e(function(e,r){var o=n.configure(r);return e[t]=o(e,r.replacer||i,r.space),e})}function requireLabel(){if(hasRequiredLabel)return label;hasRequiredLabel=1;var e=requireFormat$1();return label=e(function(e,t){return t.message?(e.message="[".concat(t.label,"] ").concat(e.message),e):(e.label=t.label,e)})}function requireLogstash(){if(hasRequiredLogstash)return logstash;hasRequiredLogstash=1;var e=requireFormat$1(),t=requireTripleBeam().MESSAGE,n=requireSafeStableStringify();return logstash=e(function(e){var i={};return e.message&&(i["@message"]=e.message,delete e.message),e.timestamp&&(i["@timestamp"]=e.timestamp,delete e.timestamp),i["@fields"]=e,e[t]=n(i),e})}function requireMetadata(){if(hasRequiredMetadata)return metadata;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n,i){return(n=function(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}hasRequiredMetadata=1;var n=requireFormat$1();return metadata=n(function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="metadata";n.key&&(i=n.key);var r=[];return n.fillExcept||n.fillWith||(r.push("level"),r.push("message")),n.fillExcept&&(r=n.fillExcept),r.length>0?function(e,n,i){var r=n.reduce(function(t,n){return t[n]=e[n],delete e[n],t},{}),o=Object.keys(e).reduce(function(t,n){return t[n]=e[n],delete e[n],t},{});return Object.assign(e,r,t({},i,o)),e}(e,r,i):n.fillWith?function(e,t,n){return e[n]=t.reduce(function(t,n){return t[n]=e[n],delete e[n],t},{}),e}(e,n.fillWith,i):e}),metadata}function requireMs$1(){if(hasRequiredMs$1)return ms;hasRequiredMs$1=1;var e=1e3,t=60*e,n=60*t,i=24*n,r=7*i,o=365.25*i;function a(e,t,n,i){var r=t>=1.5*n;return Math.round(e/n)+" "+i+(r?"s":"")}return ms=function(s,c){c=c||{};var l=typeof s;if("string"===l&&s.length>0)return function(a){if((a=String(a)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*r;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===l&&isFinite(s))return c.long?function(r){var o=Math.abs(r);if(o>=i)return a(r,o,i,"day");if(o>=n)return a(r,o,n,"hour");if(o>=t)return a(r,o,t,"minute");if(o>=e)return a(r,o,e,"second");return r+" ms"}(s):function(r){var o=Math.abs(r);if(o>=i)return Math.round(r/i)+"d";if(o>=n)return Math.round(r/n)+"h";if(o>=t)return Math.round(r/t)+"m";if(o>=e)return Math.round(r/e)+"s";return r+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},ms}function requireMs(){if(hasRequiredMs)return ms_1;hasRequiredMs=1;var e=void 0,t=requireFormat$1(),n=requireMs$1();return ms_1=t(function(t){var i=+new Date;return e.diff=i-(e.prevTime||i),e.prevTime=i,t.ms="+".concat(n(e.diff)),t})}function requirePrettyPrint(){if(hasRequiredPrettyPrint)return prettyPrint;hasRequiredPrettyPrint=1;var e=require$$0$8.inspect,t=requireFormat$1(),n=requireTripleBeam(),i=n.LEVEL,r=n.MESSAGE,o=n.SPLAT;return prettyPrint=t(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=Object.assign({},t);return delete a[i],delete a[r],delete a[o],t[r]=e(a,!1,n.depth||null,n.colorize),t}),prettyPrint}var printf={exports:{}},hasRequiredPrintf,simple,hasRequiredSimple,splat,hasRequiredSplat;function requirePrintf(){if(hasRequiredPrintf)return printf.exports;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredPrintf=1;var i=requireTripleBeam().MESSAGE,r=function(){return t(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.template=t},[{key:"transform",value:function(e){return e[i]=this.template(e),e}}])}();return printf.exports=function(e){return new r(e)},printf.exports.Printf=printf.exports.Format=r,printf.exports}function requireSimple(){if(hasRequiredSimple)return simple;hasRequiredSimple=1;var e=requireFormat$1(),t=requireTripleBeam().MESSAGE,n=requireSafeStableStringify();return simple=e(function(e){var i=n(Object.assign({},e,{level:void 0,message:void 0,splat:void 0})),r=e.padding&&e.padding[e.level]||"";return e[t]="{}"!==i?"".concat(e.level,":").concat(r," ").concat(e.message," ").concat(i):"".concat(e.level,":").concat(r," ").concat(e.message),e})}function requireSplat(){if(hasRequiredSplat)return splat;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function i(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredSplat=1;var o=require$$0$8,a=requireTripleBeam().SPLAT,s=/%[scdjifoO%]/g,c=/%%/g,l=function(){return i(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t},[{key:"_splat",value:function(e,n){var i=e.message,r=e[a]||e.splat||[],s=i.match(c),l=s&&s.length||0,d=n.length-l-r.length,u=d<0?r.splice(d,-1*d):[],p=u.length;if(p)for(var m=0;m<p;m++)Object.assign(e,u[m]);return e.message=o.format.apply(o,[i].concat(t(r))),e}},{key:"transform",value:function(e){var t=e.message,n=e[a]||e.splat;if(!n||!n.length)return e;var i=t&&t.match&&t.match(s);if(!i&&(n||n.length)){var r=n.length>1?n.splice(0):n,o=r.length;if(o)for(var c=0;c<o;c++)Object.assign(e,r[c]);return e}return i?this._splat(e,i):e}}])}();return splat=function(e){return new l(e)}}var token=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,twoDigitsOptional="\\d\\d?",twoDigits="\\d\\d",threeDigits="\\d{3}",fourDigits="\\d{4}",word="[^\\s]+",literal=/\[([^]*?)\]/gm;function shorten(e,t){for(var n=[],i=0,r=e.length;i<r;i++)n.push(e[i].substr(0,t));return n}var monthUpdate=function(e){return function(t,n){var i=n[e].map(function(e){return e.toLowerCase()}),r=i.indexOf(t.toLowerCase());return r>-1?r:null}};function assign(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var i=0,r=t;i<r.length;i++){var o=r[i];for(var a in o)e[a]=o[a]}return e}var dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort=shorten(monthNames,3),dayNamesShort=shorten(dayNames,3),defaultI18n={dayNamesShort:dayNamesShort,dayNames:dayNames,monthNamesShort:monthNamesShort,monthNames:monthNames,amPm:["am","pm"],DoFn:function(e){return e+["th","st","nd","rd"][e%10>3?0:(e-e%10!=10?1:0)*e%10]}},globalI18n=assign({},defaultI18n),setGlobalDateI18n=function(e){return globalI18n=assign(globalI18n,e)},regexEscape=function(e){return e.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},pad=function(e,t){for(void 0===t&&(t=2),e=String(e);e.length<t;)e="0"+e;return e},formatFlags={D:function(e){return String(e.getDate())},DD:function(e){return pad(e.getDate())},Do:function(e,t){return t.DoFn(e.getDate())},d:function(e){return String(e.getDay())},dd:function(e){return pad(e.getDay())},ddd:function(e,t){return t.dayNamesShort[e.getDay()]},dddd:function(e,t){return t.dayNames[e.getDay()]},M:function(e){return String(e.getMonth()+1)},MM:function(e){return pad(e.getMonth()+1)},MMM:function(e,t){return t.monthNamesShort[e.getMonth()]},MMMM:function(e,t){return t.monthNames[e.getMonth()]},YY:function(e){return pad(String(e.getFullYear()),4).substr(2)},YYYY:function(e){return pad(e.getFullYear(),4)},h:function(e){return String(e.getHours()%12||12)},hh:function(e){return pad(e.getHours()%12||12)},H:function(e){return String(e.getHours())},HH:function(e){return pad(e.getHours())},m:function(e){return String(e.getMinutes())},mm:function(e){return pad(e.getMinutes())},s:function(e){return String(e.getSeconds())},ss:function(e){return pad(e.getSeconds())},S:function(e){return String(Math.round(e.getMilliseconds()/100))},SS:function(e){return pad(Math.round(e.getMilliseconds()/10),2)},SSS:function(e){return pad(e.getMilliseconds(),3)},a:function(e,t){return e.getHours()<12?t.amPm[0]:t.amPm[1]},A:function(e,t){return e.getHours()<12?t.amPm[0].toUpperCase():t.amPm[1].toUpperCase()},ZZ:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+pad(100*Math.floor(Math.abs(t)/60)+Math.abs(t)%60,4)},Z:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+pad(Math.floor(Math.abs(t)/60),2)+":"+pad(Math.abs(t)%60,2)}},monthParse=function(e){return+e-1},emptyDigits=[null,twoDigitsOptional],emptyWord=[null,word],amPm=["isPm",word,function(e,t){var n=e.toLowerCase();return n===t.amPm[0]?0:n===t.amPm[1]?1:null}],timezoneOffset=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var t=(e+"").match(/([+-]|\d\d)/gi);if(t){var n=60*+t[1]+parseInt(t[2],10);return"+"===t[0]?n:-n}return 0}],parseFlags={D:["day",twoDigitsOptional],DD:["day",twoDigits],Do:["day",twoDigitsOptional+word,function(e){return parseInt(e,10)}],M:["month",twoDigitsOptional,monthParse],MM:["month",twoDigits,monthParse],YY:["year",twoDigits,function(e){var t=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+e>68?t-1:t)+e)}],h:["hour",twoDigitsOptional,void 0,"isPm"],hh:["hour",twoDigits,void 0,"isPm"],H:["hour",twoDigitsOptional],HH:["hour",twoDigits],m:["minute",twoDigitsOptional],mm:["minute",twoDigits],s:["second",twoDigitsOptional],ss:["second",twoDigits],YYYY:["year",fourDigits],S:["millisecond","\\d",function(e){return 100*+e}],SS:["millisecond",twoDigits,function(e){return 10*+e}],SSS:["millisecond",threeDigits],d:emptyDigits,dd:emptyDigits,ddd:emptyWord,dddd:emptyWord,MMM:["month",word,monthUpdate("monthNamesShort")],MMMM:["month",word,monthUpdate("monthNames")],a:amPm,A:amPm,ZZ:timezoneOffset,Z:timezoneOffset},globalMasks={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},setGlobalDateMasks=function(e){return assign(globalMasks,e)},format$1=function(e,t,n){if(void 0===t&&(t=globalMasks.default),void 0===n&&(n={}),"number"==typeof e&&(e=new Date(e)),"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");t=globalMasks[t]||t;var i=[];t=t.replace(literal,function(e,t){return i.push(t),"@@@"});var r=assign(assign({},globalI18n),n);return(t=t.replace(token,function(t){return formatFlags[t](e,r)})).replace(/@@@/g,function(){return i.shift()})};function parse(e,t,n){if(void 0===n&&(n={}),"string"!=typeof t)throw new Error("Invalid format in fecha parse");if(t=globalMasks[t]||t,e.length>1e3)return null;var i={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},r=[],o=[],a=t.replace(literal,function(e,t){return o.push(regexEscape(t)),"@@@"}),s={},c={};a=regexEscape(a).replace(token,function(e){var t=parseFlags[e],n=t[0],i=t[1],o=t[3];if(s[n])throw new Error("Invalid format. "+n+" specified twice in format");return s[n]=!0,o&&(c[o]=!0),r.push(t),"("+i+")"}),Object.keys(c).forEach(function(e){if(!s[e])throw new Error("Invalid format. "+e+" is required in specified format")}),a=a.replace(/@@@/g,function(){return o.shift()});var l=e.match(new RegExp(a,"i"));if(!l)return null;for(var d,u=assign(assign({},globalI18n),n),p=1;p<l.length;p++){var m=r[p-1],h=m[0],f=m[2],g=f?f(l[p],u):+l[p];if(null==g)return null;i[h]=g}if(1===i.isPm&&null!=i.hour&&12!==+i.hour?i.hour=+i.hour+12:0===i.isPm&&12===+i.hour&&(i.hour=0),null==i.timezoneOffset){d=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var y=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],v=(p=0,y.length);p<v;p++)if(s[y[p][0]]&&i[y[p][0]]!==d[y[p][1]]())return null}else if(d=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return d}var fecha={format:format$1,parse:parse,defaultI18n:defaultI18n,setGlobalDateI18n:setGlobalDateI18n,setGlobalDateMasks:setGlobalDateMasks},fecha$1=Object.freeze({__proto__:null,assign:assign,default:fecha,defaultI18n:defaultI18n,format:format$1,parse:parse,setGlobalDateI18n:setGlobalDateI18n,setGlobalDateMasks:setGlobalDateMasks}),require$$0=getAugmentedNamespace(fecha$1),timestamp,hasRequiredTimestamp,uncolorize,hasRequiredUncolorize,hasRequiredBrowser$2;function requireTimestamp(){if(hasRequiredTimestamp)return timestamp;hasRequiredTimestamp=1;var e=require$$0,t=requireFormat$1();return timestamp=t(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n.format&&(t.timestamp="function"==typeof n.format?n.format():e.format(new Date,n.format)),t.timestamp||(t.timestamp=(new Date).toISOString()),n.alias&&(t[n.alias]=t.timestamp),t}),timestamp}function requireUncolorize(){if(hasRequiredUncolorize)return uncolorize;hasRequiredUncolorize=1;var e=requireSafe(),t=requireFormat$1(),n=requireTripleBeam().MESSAGE;return uncolorize=t(function(t,i){return!1!==i.level&&(t.level=e.strip(t.level)),!1!==i.message&&(t.message=e.strip(String(t.message))),!1!==i.raw&&t[n]&&(t[n]=e.strip(String(t[n]))),t})}function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$2;hasRequiredBrowser$2=1;var e=browser$2.format=requireFormat$1();return browser$2.levels=requireLevels(),Object.defineProperty(e,"align",{value:requireAlign()}),Object.defineProperty(e,"cli",{value:requireCli()}),Object.defineProperty(e,"colorize",{value:requireColorize()}),Object.defineProperty(e,"combine",{value:requireCombine()}),Object.defineProperty(e,"errors",{value:requireErrors()}),Object.defineProperty(e,"json",{value:requireJson$1()}),Object.defineProperty(e,"label",{value:requireLabel()}),Object.defineProperty(e,"logstash",{value:requireLogstash()}),Object.defineProperty(e,"metadata",{value:requireMetadata()}),Object.defineProperty(e,"ms",{value:requireMs()}),Object.defineProperty(e,"padLevels",{value:requirePadLevels()}),Object.defineProperty(e,"prettyPrint",{value:requirePrettyPrint()}),Object.defineProperty(e,"printf",{value:requirePrintf()}),Object.defineProperty(e,"simple",{value:requireSimple()}),Object.defineProperty(e,"splat",{value:requireSplat()}),Object.defineProperty(e,"timestamp",{value:requireTimestamp()}),Object.defineProperty(e,"uncolorize",{value:requireUncolorize()}),browser$2}var common={},hasRequiredCommon;function requireCommon(){return hasRequiredCommon||(hasRequiredCommon=1,function(e){var t=require$$0$8.format;e.warn={deprecated:function(e){return function(){throw new Error(t("{ %s } was removed in winston@3.0.0.",e))}},useFormat:function(e){return function(){throw new Error([t("{ %s } was removed in winston@3.0.0.",e),"Use a custom winston.format = winston.format(function) instead."].join("\n"))}},forFunctions:function(t,n,i){i.forEach(function(i){t[i]=e.warn[n](i)})},forProperties:function(t,n,i){i.forEach(function(i){var r=e.warn[n](i);Object.defineProperty(t,i,{get:r,set:r})})}}}(common)),common}const version="3.18.3";var require$$2={version:version},transports={},dist={exports:{}},modern$1={exports:{}},browser$1,hasRequiredBrowser$1,streamBrowser,hasRequiredStreamBrowser,destroy_1,hasRequiredDestroy;function requireBrowser$1(){if(hasRequiredBrowser$1)return browser$1;function e(e){try{if(!commonjsGlobal.localStorage)return!1}catch(e){return!1}var t=commonjsGlobal.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return hasRequiredBrowser$1=1,browser$1=function(t,n){if(e("noDeprecation"))return t;var i=!1;return function(){if(!i){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),i=!0}return t.apply(this,arguments)}},browser$1}function requireStreamBrowser(){return hasRequiredStreamBrowser?streamBrowser:(hasRequiredStreamBrowser=1,streamBrowser=require$$0$a.EventEmitter)}function requireDestroy(){if(hasRequiredDestroy)return destroy_1;function e(e,i){n(e,i),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return hasRequiredDestroy=1,destroy_1={destroy:function(i,r){var o=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?(r?r(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,i)):process.nextTick(n,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(n){!r&&n?o._writableState?o._writableState.errorEmitted?process.nextTick(t,o):(o._writableState.errorEmitted=!0,process.nextTick(e,o,n)):process.nextTick(e,o,n):r?(process.nextTick(t,o),r(n)):process.nextTick(t,o)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,i=e._writableState;n&&n.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}},destroy_1}var errorsBrowser={},hasRequiredErrorsBrowser,state,hasRequiredState;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;var e={};function t(t,n,i){i||(i=Error);var r=function(e){var t,i;function r(t,i,r){return e.call(this,function(e,t,i){return"string"==typeof n?n:n(e,t,i)}(t,i,r))||this}return i=e,(t=r).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i,r}(i);r.prototype.name=i.name,r.prototype.code=t,e[t]=r}function n(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}return t("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),t("ERR_INVALID_ARG_TYPE",function(e,t,i){var r,o,a;if("string"==typeof t&&(o="not ",t.substr(0,o.length)===o)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))a="The ".concat(e," ").concat(r," ").concat(n(t,"type"));else{var s=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";a='The "'.concat(e,'" ').concat(s," ").concat(r," ").concat(n(t,"type"))}return a+=". Received type ".concat(typeof i)},TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=e,errorsBrowser}function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var e=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;return state={getHighWaterMark:function(t,n,i,r){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(n,r,i);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new e(r?i:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}}var inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,"function"==typeof Object.create?inherits_browser.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}),inherits_browser.exports}var _nodeResolve_empty={},_nodeResolve_empty$1=Object.freeze({__proto__:null,default:_nodeResolve_empty}),require$$3=getAugmentedNamespace(_nodeResolve_empty$1),buffer_list,hasRequiredBuffer_list;function requireBuffer_list(){if(hasRequiredBuffer_list)return buffer_list;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function t(t){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?e(Object(r),!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function n(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}hasRequiredBuffer_list=1;var o=require$$0$c.Buffer,a=require$$3.inspect,s=a&&a.custom||"inspect";function c(e,t,n){o.prototype.copy.call(e,t,n)}return buffer_list=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return i(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t=o.allocUnsafe(e>>>0),n=this.head,i=0;n;)c(n.data,t,i),i+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,i=t.data;for(e-=i.length;t=t.next;){var r=t.data,o=e>r.length?r.length:e;if(o===r.length?i+=r:i+=r.slice(0,e),0===(e-=o)){o===r.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=r.slice(o));break}++n}return this.length-=n,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,i=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var r=n.data,a=e>r.length?r.length:e;if(r.copy(t,t.length-e,0,a),0===(e-=a)){a===r.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=r.slice(a));break}++i}return this.length-=i,t}},{key:s,value:function(e,n){return a(this,t(t({},n),{},{depth:0,customInspect:!1}))}}]),e}(),buffer_list}var string_decoder={},safeBuffer={exports:{}},hasRequiredSafeBuffer,hasRequiredString_decoder,endOfStream,hasRequiredEndOfStream,async_iterator,hasRequiredAsync_iterator,fromBrowser,hasRequiredFromBrowser,_stream_readable,hasRequired_stream_readable,_stream_duplex,hasRequired_stream_duplex,_stream_writable,hasRequired_stream_writable,hasRequiredModern$1;function requireSafeBuffer(){return hasRequiredSafeBuffer||(hasRequiredSafeBuffer=1,function(e,t){var n=require$$0$c,i=n.Buffer;function r(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(r(n,t),t.Buffer=o),o.prototype=Object.create(i.prototype),r(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(safeBuffer,safeBuffer.exports)),safeBuffer.exports}function requireString_decoder(){if(hasRequiredString_decoder)return string_decoder;hasRequiredString_decoder=1;var e=requireSafeBuffer().Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(n){var i;switch(this.encoding=function(n){var i=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(n);if("string"!=typeof i&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return i||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,i=4;break;case"utf8":this.fillLast=r,i=4;break;case"base64":this.text=s,this.end=c,i=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(i)}function i(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function r(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}return string_decoder.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var o=i(t[r]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--r<n||-2===o)return 0;if(o=i(t[r]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--r<n||-2===o)return 0;if(o=i(t[r]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},string_decoder}function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var e=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function t(){}return endOfStream=function n(i,r,o){if("function"==typeof r)return n(i,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];e.apply(this,i)}}}(o||t);var a=r.readable||!1!==r.readable&&i.readable,s=r.writable||!1!==r.writable&&i.writable,c=function(){i.writable||d()},l=i._writableState&&i._writableState.finished,d=function(){s=!1,l=!0,a||o.call(i)},u=i._readableState&&i._readableState.endEmitted,p=function(){a=!1,u=!0,s||o.call(i)},m=function(e){o.call(i,e)},h=function(){var t;return a&&!u?(i._readableState&&i._readableState.ended||(t=new e),o.call(i,t)):s&&!l?(i._writableState&&i._writableState.ended||(t=new e),o.call(i,t)):void 0},f=function(){i.req.on("finish",d)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(i)?s&&!i._writableState&&(i.on("end",c),i.on("close",c)):(i.on("complete",d),i.on("abort",h),i.req?f():i.on("request",f)),i.on("end",p),i.on("finish",d),!1!==r.error&&i.on("error",m),i.on("close",h),function(){i.removeListener("complete",d),i.removeListener("abort",h),i.removeListener("request",f),i.req&&i.req.removeListener("finish",d),i.removeListener("end",c),i.removeListener("close",c),i.removeListener("finish",d),i.removeListener("end",p),i.removeListener("error",m),i.removeListener("close",h)}},endOfStream}function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}hasRequiredAsync_iterator=1;var n=requireEndOfStream(),i=Symbol("lastResolve"),r=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function d(e,t){return{value:e,done:t}}function u(e){var t=e[i];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[i]=null,e[r]=null,t(d(n,!1)))}}function p(e){process.nextTick(u,e)}var m=Object.getPrototypeOf(function(){}),h=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise(function(t,n){process.nextTick(function(){e[o]?n(e[o]):t(d(void 0,!0))})});var n,i=this[s];if(i)n=new Promise(function(e,t){return function(n,i){e.then(function(){t[a]?n(d(void 0,!0)):t[c](n,i)},i)}}(i,this));else{var r=this[l].read();if(null!==r)return Promise.resolve(d(r,!1));n=new Promise(this[c])}return this[s]=n,n}},Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(d(void 0,!0))})})}),e),m);return async_iterator=function(e){var u,m=Object.create(h,(t(u={},l,{value:e,writable:!0}),t(u,i,{value:null,writable:!0}),t(u,r,{value:null,writable:!0}),t(u,o,{value:null,writable:!0}),t(u,a,{value:e._readableState.endEmitted,writable:!0}),t(u,c,{value:function(e,t){var n=m[l].read();n?(m[s]=null,m[i]=null,m[r]=null,e(d(n,!1))):(m[i]=e,m[r]=t)},writable:!0}),u));return m[s]=null,n(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=m[r];return null!==t&&(m[s]=null,m[i]=null,m[r]=null,t(e)),void(m[o]=e)}var n=m[i];null!==n&&(m[s]=null,m[i]=null,m[r]=null,n(d(void 0,!0))),m[a]=!0}),e.on("readable",p.bind(null,m)),m},async_iterator}function requireFromBrowser(){return hasRequiredFromBrowser?fromBrowser:(hasRequiredFromBrowser=1,fromBrowser=function(){throw new Error("Readable.from is not available in the browser")})}function require_stream_readable(){if(hasRequired_stream_readable)return _stream_readable;var e;hasRequired_stream_readable=1,_stream_readable=b,b.ReadableState=E,require$$0$a.EventEmitter;var t=function(e,t){return e.listeners(t).length},n=requireStreamBrowser(),i=require$$0$c.Buffer,r=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,a=require$$3;o=a&&a.debuglog?a.debuglog("stream"):function(){};var s,c,l,d=requireBuffer_list(),u=requireDestroy(),p=requireState().getHighWaterMark,m=requireErrorsBrowser().codes,h=m.ERR_INVALID_ARG_TYPE,f=m.ERR_STREAM_PUSH_AFTER_EOF,g=m.ERR_METHOD_NOT_IMPLEMENTED,y=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;requireInherits_browser()(b,n);var v=u.errorOrDestroy,x=["error","close","destroy","pause","resume"];function E(t,n,i){e=e||require_stream_duplex(),t=t||{},"boolean"!=typeof i&&(i=n instanceof e),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=p(this,t,"readableHighWaterMark",i),this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(s||(s=requireString_decoder().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function b(t){if(e=e||require_stream_duplex(),!(this instanceof b))return new b(t);var i=this instanceof e;this._readableState=new E(t,this,i),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function S(e,t,n,a,s){o("readableAddChunk",t);var c,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(o("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?R(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,A(e)))}(e,l);else if(s||(c=function(e,t){var n;o=t,i.isBuffer(o)||o instanceof r||"string"==typeof t||void 0===t||e.objectMode||(n=new h("chunk",["string","Buffer","Uint8Array"],t));var o;return n}(l,t)),c)v(e,c);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=function(e){return i.from(e)}(t)),a)l.endEmitted?v(e,new y):w(e,l,t,!0);else if(l.ended)v(e,new f);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?w(e,l,t,!1):I(e,l)):w(e,l,t,!1)}else a||(l.reading=!1,I(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function w(e,t,n,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&R(e)),I(e,t)}Object.defineProperty(b.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),b.prototype.destroy=u.destroy,b.prototype._undestroy=u.undestroy,b.prototype._destroy=function(e,t){t(e)},b.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),S(this,e,t,!1,n)},b.prototype.unshift=function(e){return S(this,e,null,!0,!1)},b.prototype.isPaused=function(){return!1===this._readableState.flowing},b.prototype.setEncoding=function(e){s||(s=requireString_decoder().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var _=1073741824;function $(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=_?e=_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function R(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(A,e))}function A(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,O(e)}function I(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(T,e,t))}function T(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(o("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function C(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function M(e){o("readable nexttick read 0"),e.read(0)}function P(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),O(e),t.flowing&&!t.reading&&e.read(0)}function O(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function k(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function D(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(N,t,e))}function N(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function L(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}return b.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):R(this),null;if(0===(e=$(e,t))&&t.ended)return 0===t.length&&D(this),null;var i,r=t.needReadable;return o("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",r=!0),t.ended||t.reading?o("reading or ended",r=!1):r&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=$(n,t))),null===(i=e>0?k(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&D(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(e){v(this,new g("_read()"))},b.prototype.pipe=function(e,n){var i=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,n);var a=(!n||!1!==n.end)&&e!==process.stdout&&e!==process.stderr?c:f;function s(t,n){o("onunpipe"),t===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,o("cleanup"),e.removeListener("close",m),e.removeListener("finish",h),e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",s),i.removeListener("end",c),i.removeListener("end",f),i.removeListener("data",u),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){o("onend"),e.end()}r.endEmitted?process.nextTick(a):i.once("end",a),e.on("unpipe",s);var l=function(e){return function(){var n=e._readableState;o("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,0===n.awaitDrain&&t(e,"data")&&(n.flowing=!0,O(e))}}(i);e.on("drain",l);var d=!1;function u(t){o("ondata");var n=e.write(t);o("dest.write",n),!1===n&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==L(r.pipes,e))&&!d&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),i.pause())}function p(n){o("onerror",n),f(),e.removeListener("error",p),0===t(e,"error")&&v(e,n)}function m(){e.removeListener("finish",h),f()}function h(){o("onfinish"),e.removeListener("close",m),f()}function f(){o("unpipe"),i.unpipe(e)}return i.on("data",u),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",p),e.once("close",m),e.once("finish",h),e.emit("pipe",i),r.flowing||(o("pipe resume"),i.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<r;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=L(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},b.prototype.on=function(e,t){var i=n.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?R(this):r.reading||process.nextTick(M,this))),i},b.prototype.addListener=b.prototype.on,b.prototype.removeListener=function(e,t){var i=n.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(C,this),i},b.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(C,this),t},b.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(P,e,t))}(this,e)),e.paused=!1,this},b.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},b.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",function(){if(o("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(r){(o("wrapped data"),n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))}),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var a=0;a<x.length;a++)e.on(x[a],this.emit.bind(this,x[a]));return this._read=function(t){o("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(b.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=requireAsync_iterator()),c(this)}),Object.defineProperty(b.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(b.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(b.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),b._fromList=k,Object.defineProperty(b.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(b.from=function(e,t){return void 0===l&&(l=requireFromBrowser()),l(b,e,t)}),_stream_readable}function require_stream_duplex(){if(hasRequired_stream_duplex)return _stream_duplex;hasRequired_stream_duplex=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};_stream_duplex=a;var t=require_stream_readable(),n=require_stream_writable();requireInherits_browser()(a,t);for(var i=e(n.prototype),r=0;r<i.length;r++){var o=i[r];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),_stream_duplex}function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;e.entry=null;for(;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}var t;hasRequired_stream_writable=1,_stream_writable=b,b.WritableState=E;var n={deprecate:requireBrowser$1()},i=requireStreamBrowser(),r=require$$0$c.Buffer,o=(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,s=requireDestroy(),c=requireState().getHighWaterMark,l=requireErrorsBrowser().codes,d=l.ERR_INVALID_ARG_TYPE,u=l.ERR_METHOD_NOT_IMPLEMENTED,p=l.ERR_MULTIPLE_CALLBACK,m=l.ERR_STREAM_CANNOT_PIPE,h=l.ERR_STREAM_DESTROYED,f=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,v=s.errorOrDestroy;function x(){}function E(n,i,r){t=t||require_stream_duplex(),n=n||{},"boolean"!=typeof r&&(r=i instanceof t),this.objectMode=!!n.objectMode,r&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=c(this,n,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,r=n.writecb;if("function"!=typeof r)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,r){--t.pendingcb,n?(process.nextTick(r,i),process.nextTick(A,e,t),e._writableState.errorEmitted=!0,v(e,i)):(r(i),e._writableState.errorEmitted=!0,v(e,i),A(e,t))}(e,n,i,t,r);else{var o=$(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||_(e,n),i?process.nextTick(w,e,n,o,r):w(e,n,o,r)}}(i,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function b(e){var n=this instanceof(t=t||require_stream_duplex());if(!n&&!a.call(b,this))return new b(e);this._writableState=new E(e,this,n),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function S(e,t,n,i,r,o,a){t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new h("write")):n?e._writev(r,t.onwrite):e._write(r,o,t.onwrite),t.sync=!1}function w(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),A(e,t)}function _(t,n){n.bufferProcessing=!0;var i=n.bufferedRequest;if(t._writev&&i&&i.next){var r=n.bufferedRequestCount,o=new Array(r),a=n.corkedRequestsFree;a.entry=i;for(var s=0,c=!0;i;)o[s]=i,i.isBuf||(c=!1),i=i.next,s+=1;o.allBuffers=c,S(t,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,d=i.encoding,u=i.callback;if(S(t,n,!1,n.objectMode?1:l.length,l,d,u),i=i.next,n.bufferedRequestCount--,n.writing)break}null===i&&(n.lastBufferedRequest=null)}n.bufferedRequest=i,n.bufferProcessing=!1}function $(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function R(e,t){e._final(function(n){t.pendingcb--,n&&v(e,n),t.prefinished=!0,e.emit("prefinish"),A(e,t)})}function A(e,t){var n=$(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(R,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}return requireInherits_browser()(b,i),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===b&&(e&&e._writableState instanceof E)}})):a=function(e){return e instanceof this},b.prototype.pipe=function(){v(this,new m)},b.prototype.write=function(e,t,n){var i,a=this._writableState,s=!1,c=!a.objectMode&&(i=e,r.isBuffer(i)||i instanceof o);return c&&!r.isBuffer(e)&&(e=function(e){return r.from(e)}(e)),"function"==typeof t&&(n=t,t=null),c?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof n&&(n=x),a.ending?function(e,t){var n=new g;v(e,n),process.nextTick(t,n)}(this,n):(c||function(e,t,n,i){var r;return null===n?r=new f:"string"==typeof n||t.objectMode||(r=new d("chunk",["string","Buffer"],n)),!r||(v(e,r),process.nextTick(i,r),!1)}(this,a,e,n))&&(a.pendingcb++,s=function(e,t,n,i,o,a){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=r.from(t,n));return t}(t,i,o);i!==s&&(n=!0,o="buffer",i=s)}var c=t.objectMode?1:i.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:o,isBuf:n,callback:a,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else S(e,t,!1,c,i,o,a);return l}(this,a,c,e,t,n)),s},b.prototype.cork=function(){this._writableState.corked++},b.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||_(this,e))},b.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,n){n(new u("_write()"))},b.prototype._writev=null,b.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,A(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(b.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(b.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=s.destroy,b.prototype._undestroy=s.undestroy,b.prototype._destroy=function(e,t){t(e)},_stream_writable}function requireModern$1(){if(hasRequiredModern$1)return modern$1.exports;hasRequiredModern$1=1;var e=require$$0$8,t=require_stream_writable(),n=requireTripleBeam().LEVEL,i=modern$1.exports=function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.call(this,{objectMode:!0,highWaterMark:n.highWaterMark}),this.format=n.format,this.level=n.level,this.handleExceptions=n.handleExceptions,this.handleRejections=n.handleRejections,this.silent=n.silent,n.log&&(this.log=n.log),n.logv&&(this.logv=n.logv),n.close&&(this.close=n.close),this.once("pipe",function(t){e.levels=t.levels,e.parent=t}),this.once("unpipe",function(t){t===e.parent&&(e.parent=null,e.close&&e.close())})};return e.inherits(i,t),i.prototype._write=function(e,t,i){if(this.silent||!0===e.exception&&!this.handleExceptions)return i(null);var r=this.level||this.parent&&this.parent.level;if(!r||this.levels[r]>=this.levels[e[n]]){if(e&&!this.format)return this.log(e,i);var o=void 0,a=void 0;try{a=this.format.transform(Object.assign({},e),this.format.options)}catch(e){o=e}if(o||!a){if(i(),o)throw o;return}return this.log(a,i)}return this._writableState.sync=!1,i(null)},i.prototype._writev=function(e,t){if(this.logv){var n=e.filter(this._accept,this);return n.length?this.logv(n,t):t(null)}for(var i=0;i<e.length;i++)if(this._accept(e[i]))if(!e[i].chunk||this.format){var r=void 0,o=void 0;try{o=this.format.transform(Object.assign({},e[i].chunk),this.format.options)}catch(e){r=e}if(r||!o){if(e[i].callback(),r)throw t(null),r}else this.log(o,e[i].callback)}else this.log(e[i].chunk,e[i].callback);return t(null)},i.prototype._accept=function(e){var t=e.chunk;if(this.silent)return!1;var i=this.level||this.parent&&this.parent.level;return!(!0!==t.exception&&i&&!(this.levels[i]>=this.levels[t[n]])||!this.handleExceptions&&!0===t.exception)},i.prototype._nop=function(){},modern$1.exports}var legacy$1={exports:{}},hasRequiredLegacy$1,hasRequiredDist,console_1,hasRequiredConsole;function requireLegacy$1(){if(hasRequiredLegacy$1)return legacy$1.exports;hasRequiredLegacy$1=1;var e=require$$0$8,t=requireTripleBeam().LEVEL,n=requireModern$1(),i=legacy$1.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n.call(this,e),!e.transport||"function"!=typeof e.transport.log)throw new Error("Invalid transport, must be an object with a log method.");this.transport=e.transport,this.level=this.level||e.transport.level,this.handleExceptions=this.handleExceptions||e.transport.handleExceptions,this._deprecated(),this.transport.__winstonError||(this.transport.__winstonError=function(e){this.emit("error",e,this.transport)}.bind(this),this.transport.on("error",this.transport.__winstonError))};return e.inherits(i,n),i.prototype._write=function(e,n,i){if(this.silent||!0===e.exception&&!this.handleExceptions)return i(null);(!this.level||this.levels[this.level]>=this.levels[e[t]])&&this.transport.log(e[t],e.message,e,this._nop),i(null)},i.prototype._writev=function(e,n){for(var i=0;i<e.length;i++)this._accept(e[i])&&(this.transport.log(e[i].chunk[t],e[i].chunk.message,e[i].chunk,this._nop),e[i].callback());return n(null)},i.prototype._deprecated=function(){console.error([this.transport.name+" is a legacy winston transport. Consider upgrading: ","- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"].join("\n"))},i.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)},legacy$1.exports}function requireDist(){return hasRequiredDist||(hasRequiredDist=1,dist.exports=requireModern$1(),dist.exports.LegacyTransportStream=requireLegacy$1()),dist.exports}function requireConsole(){if(hasRequiredConsole)return console_1;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}function i(t,n,i){return n=o(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,r()?Reflect.construct(n,i||[],o(t).constructor):n.apply(t,i))}function r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(r=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}hasRequiredConsole=1;var s=require$$0$6,c=requireTripleBeam(),l=c.LEVEL,d=c.MESSAGE,u=requireDist();return console_1=function(e){function n(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=i(this,n,[t])).name=t.name||"console",e.stderrLevels=e._stringArrayToSet(t.stderrLevels),e.consoleWarnLevels=e._stringArrayToSet(t.consoleWarnLevels),e.eol="string"==typeof t.eol?t.eol:s.EOL,e.forceConsole=t.forceConsole||!1,e._consoleLog=console.log.bind(console),e._consoleWarn=console.warn.bind(console),e._consoleError=console.error.bind(console),e.setMaxListeners(30),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(n,e),t(n,[{key:"log",value:function(e,t){var n=this;return setImmediate(function(){return n.emit("logged",e)}),this.stderrLevels[e[l]]?(console._stderr&&!this.forceConsole?console._stderr.write("".concat(e[d]).concat(this.eol)):this._consoleError(e[d]),void(t&&t())):this.consoleWarnLevels[e[l]]?(console._stderr&&!this.forceConsole?console._stderr.write("".concat(e[d]).concat(this.eol)):this._consoleWarn(e[d]),void(t&&t())):(console._stdout&&!this.forceConsole?console._stdout.write("".concat(e[d]).concat(this.eol)):this._consoleLog(e[d]),void(t&&t()))}},{key:"_stringArrayToSet",value:function(e,t){if(!e)return{};if(t=t||"Cannot make set from type other than Array of string elements",!Array.isArray(e))throw new Error(t);return e.reduce(function(e,n){if("string"!=typeof n)throw new Error(t);return e[n]=!0,e},{})}}])}(u),console_1}var series={exports:{}},parallel={exports:{}},isArrayLike={exports:{}},hasRequiredIsArrayLike;function requireIsArrayLike(){return hasRequiredIsArrayLike||(hasRequiredIsArrayLike=1,e=isArrayLike,t=isArrayLike.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0},e.exports=t.default),isArrayLike.exports;var e,t}var wrapAsync={},asyncify={exports:{}},initialParams={exports:{}},hasRequiredInitialParams;function requireInitialParams(){return hasRequiredInitialParams||(hasRequiredInitialParams=1,e=initialParams,t=initialParams.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(...t){var n=t.pop();return e.call(this,t,n)}},e.exports=t.default),initialParams.exports;var e,t}var setImmediate$1={},hasRequiredSetImmediate,hasRequiredAsyncify,hasRequiredWrapAsync;function requireSetImmediate(){if(hasRequiredSetImmediate)return setImmediate$1;hasRequiredSetImmediate=1,Object.defineProperty(setImmediate$1,"__esModule",{value:!0}),setImmediate$1.fallback=r,setImmediate$1.wrap=o;var e,t=setImmediate$1.hasQueueMicrotask="function"==typeof queueMicrotask&&queueMicrotask,n=setImmediate$1.hasSetImmediate="function"==typeof setImmediate&&setImmediate,i=setImmediate$1.hasNextTick="object"==typeof process&&"function"==typeof process.nextTick;function r(e){setTimeout(e,0)}function o(e){return(t,...n)=>e(()=>t(...n))}return e=t?queueMicrotask:n?setImmediate:i?process.nextTick:r,setImmediate$1.default=o(e),setImmediate$1}function requireAsyncify(){return hasRequiredAsyncify||(hasRequiredAsyncify=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,r.isAsync)(e))return function(...t){const n=t.pop();return a(e.apply(this,t),n)};return(0,n.default)(function(t,n){var i;try{i=e.apply(this,t)}catch(e){return n(e)}if(i&&"function"==typeof i.then)return a(i,n);n(null,i)})};var n=o(requireInitialParams()),i=o(requireSetImmediate()),r=requireWrapAsync();function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){return e.then(e=>{s(t,null,e)},e=>{s(t,e&&(e instanceof Error||e.message)?e:new Error(e))})}function s(e,t,n){try{e(t,n)}catch(e){(0,i.default)(e=>{throw e},e)}}e.exports=t.default}(asyncify,asyncify.exports)),asyncify.exports}function requireWrapAsync(){if(hasRequiredWrapAsync)return wrapAsync;hasRequiredWrapAsync=1,Object.defineProperty(wrapAsync,"__esModule",{value:!0}),wrapAsync.isAsyncIterable=wrapAsync.isAsyncGenerator=wrapAsync.isAsync=void 0;var e,t=requireAsyncify(),n=(e=t)&&e.__esModule?e:{default:e};function i(e){return"AsyncFunction"===e[Symbol.toStringTag]}return wrapAsync.default=function(e){if("function"!=typeof e)throw new Error("expected a function");return i(e)?(0,n.default)(e):e},wrapAsync.isAsync=i,wrapAsync.isAsyncGenerator=function(e){return"AsyncGenerator"===e[Symbol.toStringTag]},wrapAsync.isAsyncIterable=function(e){return"function"==typeof e[Symbol.asyncIterator]},wrapAsync}var awaitify={exports:{}},hasRequiredAwaitify,hasRequiredParallel;function requireAwaitify(){return hasRequiredAwaitify||(hasRequiredAwaitify=1,e=awaitify,t=awaitify.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t||(t=e.length),!t)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[t-1]?e.apply(this,n):new Promise((i,r)=>{n[t-1]=(e,...t)=>{if(e)return r(e);i(t.length>1?t:t[0])},e.apply(this,n)})}},e.exports=t.default),awaitify.exports;var e,t}function requireParallel(){return hasRequiredParallel||(hasRequiredParallel=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=o(requireIsArrayLike()),i=o(requireWrapAsync()),r=o(requireAwaitify());function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,r.default)((e,t,r)=>{var o=(0,n.default)(t)?[]:{};e(t,(e,t,n)=>{(0,i.default)(e)((e,...i)=>{i.length<2&&([i]=i),o[t]=i,n(e)})},e=>r(e,o))},3),e.exports=t.default}(parallel,parallel.exports)),parallel.exports}var eachOfSeries={exports:{}},eachOfLimit$1={exports:{}},eachOfLimit={exports:{}},once={exports:{}},hasRequiredOnce;function requireOnce(){return hasRequiredOnce||(hasRequiredOnce=1,e=once,t=once.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(...t){if(null!==e){var n=e;e=null,n.apply(this,t)}}return Object.assign(t,e),t},e.exports=t.default),once.exports;var e,t}var iterator={exports:{}},getIterator={exports:{}},hasRequiredGetIterator,hasRequiredIterator;function requireGetIterator(){return hasRequiredGetIterator||(hasRequiredGetIterator=1,e=getIterator,t=getIterator.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()},e.exports=t.default),getIterator.exports;var e,t}function requireIterator(){return hasRequiredIterator||(hasRequiredIterator=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,n.default)(e))return function(e){var t=-1,n=e.length;return function(){return++t<n?{value:e[t],key:t}:null}}(e);var t=(0,i.default)(e);return t?function(e){var t=-1;return function(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}(t):function(e){var t=e?Object.keys(e):[],n=-1,i=t.length;return function r(){var o=t[++n];return"__proto__"===o?r():n<i?{value:e[o],key:o}:null}}(e)};var n=r(requireIsArrayLike()),i=r(requireGetIterator());function r(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(iterator,iterator.exports)),iterator.exports}var onlyOnce={exports:{}},hasRequiredOnlyOnce;function requireOnlyOnce(){return hasRequiredOnlyOnce||(hasRequiredOnlyOnce=1,e=onlyOnce,t=onlyOnce.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var n=e;e=null,n.apply(this,t)}},e.exports=t.default),onlyOnce.exports;var e,t}var asyncEachOfLimit={exports:{}},breakLoop={exports:{}},hasRequiredBreakLoop,hasRequiredAsyncEachOfLimit,hasRequiredEachOfLimit$1,hasRequiredEachOfLimit,hasRequiredEachOfSeries,hasRequiredSeries;function requireBreakLoop(){return hasRequiredBreakLoop||(hasRequiredBreakLoop=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default={},e.exports=t.default}(breakLoop,breakLoop.exports)),breakLoop.exports}function requireAsyncEachOfLimit(){return hasRequiredAsyncEachOfLimit||(hasRequiredAsyncEachOfLimit=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,i){let o=!1,a=!1,s=!1,c=0,l=0;function d(){c>=t||s||o||(s=!0,e.next().then(({value:e,done:t})=>{if(!a&&!o){if(s=!1,t)return o=!0,void(c<=0&&i(null));c++,n(e,l,u),l++,d()}}).catch(p))}function u(e,t){if(c-=1,!a)return e?p(e):!1===e?(o=!0,void(a=!0)):t===r.default||o&&c<=0?(o=!0,i(null)):void d()}function p(e){a||(s=!1,o=!0,i(e))}d()};var n,i=requireBreakLoop(),r=(n=i)&&n.__esModule?n:{default:n};e.exports=t.default}(asyncEachOfLimit,asyncEachOfLimit.exports)),asyncEachOfLimit.exports}function requireEachOfLimit$1(){return hasRequiredEachOfLimit$1||(hasRequiredEachOfLimit$1=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=c(requireOnce()),i=c(requireIterator()),r=c(requireOnlyOnce()),o=requireWrapAsync(),a=c(requireAsyncEachOfLimit()),s=c(requireBreakLoop());function c(e){return e&&e.__esModule?e:{default:e}}t.default=e=>(t,c,l)=>{if(l=(0,n.default)(l),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return l(null);if((0,o.isAsyncGenerator)(t))return(0,a.default)(t,e,c,l);if((0,o.isAsyncIterable)(t))return(0,a.default)(t[Symbol.asyncIterator](),e,c,l);var d=(0,i.default)(t),u=!1,p=!1,m=0,h=!1;function f(e,t){if(!p)if(m-=1,e)u=!0,l(e);else if(!1===e)u=!0,p=!0;else{if(t===s.default||u&&m<=0)return u=!0,l(null);h||g()}}function g(){for(h=!0;m<e&&!u;){var t=d();if(null===t)return u=!0,void(m<=0&&l(null));m+=1,c(t.value,t.key,(0,r.default)(f))}h=!1}g()},e.exports=t.default}(eachOfLimit,eachOfLimit.exports)),eachOfLimit.exports}function requireEachOfLimit(){return hasRequiredEachOfLimit||(hasRequiredEachOfLimit=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=o(requireEachOfLimit$1()),i=o(requireWrapAsync()),r=o(requireAwaitify());function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,r.default)(function(e,t,r,o){return(0,n.default)(t)(e,(0,i.default)(r),o)},4),e.exports=t.default}(eachOfLimit$1,eachOfLimit$1.exports)),eachOfLimit$1.exports}function requireEachOfSeries(){return hasRequiredEachOfSeries||(hasRequiredEachOfSeries=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=r(requireEachOfLimit()),i=r(requireAwaitify());function r(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(function(e,t,i){return(0,n.default)(e,1,t,i)},3),e.exports=t.default}(eachOfSeries,eachOfSeries.exports)),eachOfSeries.exports}function requireSeries(){return hasRequiredSeries||(hasRequiredSeries=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,n.default)(i.default,e,t)};var n=r(requireParallel()),i=r(requireEachOfSeries());function r(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(series,series.exports)),series.exports}var readableBrowser={exports:{}},_stream_transform,hasRequired_stream_transform,_stream_passthrough,hasRequired_stream_passthrough,pipeline_1,hasRequiredPipeline,hasRequiredReadableBrowser;function require_stream_transform(){if(hasRequired_stream_transform)return _stream_transform;hasRequired_stream_transform=1,_stream_transform=s;var e=requireErrorsBrowser().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,i=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,r=e.ERR_TRANSFORM_WITH_LENGTH_0,o=require_stream_duplex();function a(e,t){var i=this._transformState;i.transforming=!1;var r=i.writecb;if(null===r)return this.emit("error",new n);i.writechunk=null,i.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);o.call(this,e),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush(function(t,n){l(e,t,n)})}function l(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new r;if(e._transformState.transforming)throw new i;return e.push(null)}return requireInherits_browser()(s,o),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,o.prototype.push.call(this,e,t)},s.prototype._transform=function(e,n,i){i(new t("_transform()"))},s.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},s.prototype._destroy=function(e,t){o.prototype._destroy.call(this,e,function(e){t(e)})},_stream_transform}function require_stream_passthrough(){if(hasRequired_stream_passthrough)return _stream_passthrough;hasRequired_stream_passthrough=1,_stream_passthrough=t;var e=require_stream_transform();function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return requireInherits_browser()(t,e),t.prototype._transform=function(e,t,n){n(null,e)},_stream_passthrough}function requirePipeline(){if(hasRequiredPipeline)return pipeline_1;var e;hasRequiredPipeline=1;var t=requireErrorsBrowser().codes,n=t.ERR_MISSING_ARGS,i=t.ERR_STREAM_DESTROYED;function r(e){if(e)throw e}function o(e){e()}function a(e,t){return e.pipe(t)}return pipeline_1=function(){for(var t=arguments.length,s=new Array(t),c=0;c<t;c++)s[c]=arguments[c];var l,d=function(e){return e.length?"function"!=typeof e[e.length-1]?r:e.pop():r}(s);if(Array.isArray(s[0])&&(s=s[0]),s.length<2)throw new n("streams");var u=s.map(function(t,n){var r=n<s.length-1;return function(t,n,r,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;t.on("close",function(){a=!0}),void 0===e&&(e=requireEndOfStream()),e(t,{readable:n,writable:r},function(e){if(e)return o(e);a=!0,o()});var s=!1;return function(e){if(!a&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new i("pipe"))}}(t,r,n>0,function(e){l||(l=e),e&&u.forEach(o),r||(u.forEach(o),d(l))})});return s.reduce(a)},pipeline_1}function requireReadableBrowser(){return hasRequiredReadableBrowser||(hasRequiredReadableBrowser=1,e=readableBrowser,t=readableBrowser.exports,(t=e.exports=require_stream_readable()).Stream=t,t.Readable=t,t.Writable=require_stream_writable(),t.Duplex=require_stream_duplex(),t.Transform=require_stream_transform(),t.PassThrough=require_stream_passthrough(),t.finished=requireEndOfStream(),t.pipeline=requirePipeline()),readableBrowser.exports;var e,t}var browser={exports:{}},diagnostics,hasRequiredDiagnostics,production,hasRequiredProduction,hasRequiredBrowser,tailFile,hasRequiredTailFile,file,hasRequiredFile,http_1,hasRequiredHttp,isStream_1,hasRequiredIsStream,stream,hasRequiredStream,hasRequiredTransports;function requireDiagnostics(){if(hasRequiredDiagnostics)return diagnostics;hasRequiredDiagnostics=1;var e=[],t=[],n=function(){};function i(t){return!~e.indexOf(t)&&(e.push(t),!0)}function r(e){n=e}function o(t){for(var n=[],i=0;i<e.length;i++)if(e[i].async)n.push(e[i]);else if(e[i](t))return!0;return!!n.length&&new Promise(function(e){Promise.all(n.map(function(e){return e(t)})).then(function(t){e(t.some(Boolean))})})}function a(e){return!~t.indexOf(e)&&(t.push(e),!0)}function s(){n.apply(n,arguments)}function c(e){for(var n=0;n<t.length;n++)e=t[n].apply(t[n],arguments);return e}function l(e,t){var n=Object.prototype.hasOwnProperty;for(var i in t)n.call(t,i)&&(e[i]=t[i]);return e}function d(e){return e.enabled=!1,e.modify=a,e.set=r,e.use=i,l(function(){return!1},e)}function u(e){return e.enabled=!0,e.modify=a,e.set=r,e.use=i,l(function(){var t=Array.prototype.slice.call(arguments,0);return s.call(s,e,c(t,e)),!0},e)}return diagnostics=function(e){return e.introduce=l,e.enabled=o,e.process=c,e.modify=a,e.write=s,e.nope=d,e.yep=u,e.set=r,e.use=i,e}}function requireProduction(){if(hasRequiredProduction)return production;hasRequiredProduction=1;var e=requireDiagnostics()(function e(t,n){return(n=n||{}).namespace=t,n.prod=!0,n.dev=!1,n.force||e.force?e.yep(n):e.nope(n)});return production=e}function requireBrowser(){return hasRequiredBrowser||(hasRequiredBrowser=1,browser.exports=requireProduction()),browser.exports}function requireTailFile(){if(hasRequiredTailFile)return tailFile;hasRequiredTailFile=1;var e=require$$0$7,t=require$$1$2.StringDecoder,n=requireReadableBrowser().Stream;function i(){}return tailFile=function(r,o){var a=Buffer.alloc(65536),s=new t("utf8"),c=new n,l="",d=0,u=0;return-1===r.start&&delete r.start,c.readable=!0,c.destroy=function(){c.destroyed=!0,c.emit("end"),c.emit("close")},e.open(r.file,"a+","0644",function(t,n){if(t)return o?o(t):c.emit("error",t),void c.destroy();!function t(){if(!c.destroyed)return e.read(n,a,0,a.length,d,function(e,n){if(e)return o?o(e):c.emit("error",e),void c.destroy();if(!n)return l&&((null==r.start||u>r.start)&&(o?o(null,l):c.emit("line",l)),u++,l=""),setTimeout(t,1e3);var i=s.write(a.slice(0,n));o||c.emit("data",i);for(var p=(i=(l+i).split(/\n+/)).length-1,m=0;m<p;m++)(null==r.start||u>r.start)&&(o?o(null,i[m]):c.emit("line",i[m])),u++;return l=i[p],d+=n,t()});e.close(n,i)}()}),o?c.destroy:c},tailFile}function requireFile(){if(hasRequiredFile)return file;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}function i(t,n,i){return n=o(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,r()?Reflect.construct(n,i||[],o(t).constructor):n.apply(t,i))}function r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(r=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}hasRequiredFile=1;var s=require$$0$7,c=require$$0$9,l=requireSeries(),d=zlib__default,u=requireTripleBeam().MESSAGE,p=requireReadableBrowser(),m=p.Stream,h=p.PassThrough,f=requireDist(),g=requireBrowser()("winston:file"),y=require$$0$6,v=requireTailFile();return file=function(n){function r(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};function n(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];i.slice(1).forEach(function(n){if(t[n])throw new Error("Cannot set ".concat(n," and ").concat(e," together"))})}if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),(e=i(this,r,[t])).name=t.name||"file",e._stream=new h,e._stream.setMaxListeners(30),e._onError=e._onError.bind(e),t.filename||t.dirname)n("filename or dirname","stream"),e._basename=e.filename=t.filename?c.basename(t.filename):"winston.log",e.dirname=t.dirname||c.dirname(t.filename),e.options=t.options||{flags:"a"};else{if(!t.stream)throw new Error("Cannot log to file without filename or stream.");console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream"),n("stream","filename","maxsize"),e._dest=e._stream.pipe(e._setupStream(t.stream)),e.dirname=c.dirname(e._dest.path)}return e.maxsize=t.maxsize||null,e.rotationFormat=t.rotationFormat||!1,e.zippedArchive=t.zippedArchive||!1,e.maxFiles=t.maxFiles||null,e.eol="string"==typeof t.eol?t.eol:y.EOL,e.tailable=t.tailable||!1,e.lazy=t.lazy||!1,e._size=0,e._pendingSize=0,e._created=0,e._drain=!1,e._opening=!1,e._ending=!1,e._fileExist=!1,e.dirname&&e._createLogDirIfNotExist(e.dirname),e.lazy||e.open(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(r,n),t(r,[{key:"finishIfEnding",value:function(){var e=this;this._ending&&(this._opening?this.once("open",function(){e._stream.once("finish",function(){return e.emit("finish")}),setImmediate(function(){return e._stream.end()})}):(this._stream.once("finish",function(){return e.emit("finish")}),setImmediate(function(){return e._stream.end()})))}},{key:"log",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};if(this.silent)return n(),!0;if(this._drain)this._stream.once("drain",function(){t._drain=!1,t.log(e,n)});else{if(!this._rotate){if(this.lazy){if(!this._fileExist)return this._opening||this.open(),void this.once("open",function(){t._fileExist=!0,t.log(e,n)});if(this._needsNewFile(this._pendingSize))return void this._dest.once("close",function(){t._opening||t.open(),t.once("open",function(){t.log(e,n)})})}var i="".concat(e[u]).concat(this.eol),r=Buffer.byteLength(i);this._pendingSize+=r,this._opening&&!this.rotatedWhileOpening&&this._needsNewFile(this._size+this._pendingSize)&&(this.rotatedWhileOpening=!0);var o=this._stream.write(i,function(){var t=this;this._size+=r,this._pendingSize-=r,g("logged %s %s",this._size,i),this.emit("logged",e),this._rotate||this._opening||this._needsNewFile()&&(this.lazy?this._endStream(function(){t.emit("fileclosed")}):(this._rotate=!0,this._endStream(function(){return t._rotateFile()})))}.bind(this));return o?n():(this._drain=!0,this._stream.once("drain",function(){t._drain=!1,n()})),g("written",o,this._drain),this.finishIfEnding(),o}this._stream.once("rotate",function(){t._rotate=!1,t.log(e,n)})}}},{key:"query",value:function(t,n){"function"==typeof t&&(n=t,t={}),t=function(t){t=t||{},t.rows=t.rows||t.limit||10,t.start=t.start||0,t.until=t.until||new Date,"object"!==e(t.until)&&(t.until=new Date(t.until));t.from=t.from||t.until-864e5,"object"!==e(t.from)&&(t.from=new Date(t.from));return t.order=t.order||"desc",t}(t);var i=c.join(this.dirname,this.filename),r="",o=[],a=0,l=s.createReadStream(i,{encoding:"utf8"});function d(n,i){try{var r=JSON.parse(n);(function(n){if(!n)return;if("object"!==e(n))return;var i=new Date(n.timestamp);if(t.from&&i<t.from||t.until&&i>t.until||t.level&&t.level!==n.level)return;return!0})(r)&&function(e){if(t.rows&&o.length>=t.rows&&"desc"!==t.order)return void(l.readable&&l.destroy());t.fields&&(e=t.fields.reduce(function(t,n){return t[n]=e[n],t},{}));"desc"===t.order&&o.length>=t.rows&&o.shift();o.push(e)}(r)}catch(e){i||l.emit("error",e)}}l.on("error",function(e){if(l.readable&&l.destroy(),n)return"ENOENT"!==e.code?n(e):n(null,o)}),l.on("data",function(e){for(var n=(e=(r+e).split(/\n+/)).length-1,i=0;i<n;i++)(!t.start||a>=t.start)&&d(e[i]),a++;r=e[n]}),l.on("close",function(){r&&d(r,!0),"desc"===t.order&&(o=o.reverse()),n&&n(null,o)})}},{key:"stream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=c.join(this.dirname,this.filename),n=new m,i={file:t,start:e.start};return n.destroy=v(i,function(e,t){if(e)return n.emit("error",e);try{n.emit("data",t),t=JSON.parse(t),n.emit("log",t)}catch(e){n.emit("error",e)}}),n}},{key:"open",value:function(){var e=this;this.filename&&(this._opening||(this._opening=!0,this.stat(function(t,n){if(t)return e.emit("error",t);g("stat done: %s { size: %s }",e.filename,n),e._size=n,e._dest=e._createStream(e._stream),e._opening=!1,e.once("open",function(){e._stream.emit("rotate")||(e._rotate=!1)})})))}},{key:"stat",value:function(e){var t=this,n=this._getFile(),i=c.join(this.dirname,n);s.stat(i,function(r,o){return r&&"ENOENT"===r.code?(g("ENOENT ok",i),t.filename=n,e(null,0)):r?(g("err ".concat(r.code," ").concat(i)),e(r)):!o||t._needsNewFile(o.size)?t._incFile(function(){return t.stat(e)}):(t.filename=n,void e(null,o.size))})}},{key:"close",value:function(e){var t=this;this._stream&&this._stream.end(function(){e&&e(),t.emit("flush"),t.emit("closed")})}},{key:"_needsNewFile",value:function(e){return e=e||this._size,this.maxsize&&e>=this.maxsize}},{key:"_onError",value:function(e){this.emit("error",e)}},{key:"_setupStream",value:function(e){return e.on("error",this._onError),e}},{key:"_cleanupStream",value:function(e){return e.removeListener("error",this._onError),e.destroy(),e}},{key:"_rotateFile",value:function(){var e=this;this._incFile(function(){return e.open()})}},{key:"_endStream",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this._dest?(this._stream.unpipe(this._dest),this._dest.end(function(){e._cleanupStream(e._dest),t()})):t()}},{key:"_createStream",value:function(e){var t=this,n=c.join(this.dirname,this.filename);g("create stream start",n,this.options);var i=s.createWriteStream(n,this.options).on("error",function(e){return g(e)}).on("close",function(){return g("close",i.path,i.bytesWritten)}).on("open",function(){g("file open ok",n),t.emit("open",n),e.pipe(i),t.rotatedWhileOpening&&(t._stream=new h,t._stream.setMaxListeners(30),t._rotateFile(),t.rotatedWhileOpening=!1,t._cleanupStream(i),e.end())});return g("create stream ok",n),i}},{key:"_incFile",value:function(e){g("_incFile",this.filename);var t=c.extname(this._basename),n=c.basename(this._basename,t),i=[];this.zippedArchive&&i.push(function(e){var i=this._created>0&&!this.tailable?this._created:"";this._compressFile(c.join(this.dirname,"".concat(n).concat(i).concat(t)),c.join(this.dirname,"".concat(n).concat(i).concat(t,".gz")),e)}.bind(this)),i.push(function(e){this.tailable?this._checkMaxFilesTailable(t,n,e):(this._created+=1,this._checkMaxFilesIncrementing(t,n,e))}.bind(this)),l(i,e)}},{key:"_getFile",value:function(){var e=c.extname(this._basename),t=c.basename(this._basename,e),n=this.rotationFormat?this.rotationFormat():this._created;return!this.tailable&&this._created?"".concat(t).concat(n).concat(e):"".concat(t).concat(e)}},{key:"_checkMaxFilesIncrementing",value:function(e,t,n){if(!this.maxFiles||this._created<this.maxFiles)return setImmediate(n);var i=this._created-this.maxFiles,r=0!==i?i:"",o=this.zippedArchive?".gz":"",a="".concat(t).concat(r).concat(e).concat(o),l=c.join(this.dirname,a);s.unlink(l,n)}},{key:"_checkMaxFilesTailable",value:function(e,t,n){var i=this,r=[];if(this.maxFiles){for(var o=this.zippedArchive?".gz":"",a=this.maxFiles-1;a>1;a--)r.push(function(n,i){var r=this,a="".concat(t).concat(n-1).concat(e).concat(o),l=c.join(this.dirname,a);s.exists(l,function(d){if(!d)return i(null);a="".concat(t).concat(n).concat(e).concat(o),s.rename(l,c.join(r.dirname,a),i)})}.bind(this,a));l(r,function(){s.rename(c.join(i.dirname,"".concat(t).concat(e).concat(o)),c.join(i.dirname,"".concat(t,"1").concat(e).concat(o)),n)})}}},{key:"_compressFile",value:function(e,t,n){s.access(e,s.F_OK,function(i){if(i)return n();var r=d.createGzip(),o=s.createReadStream(e),a=s.createWriteStream(t);a.on("finish",function(){s.unlink(e,n)}),o.pipe(r).pipe(a)})}},{key:"_createLogDirIfNotExist",value:function(e){s.existsSync(e)||s.mkdirSync(e,{recursive:!0})}}])}(f),file}function requireHttp(){if(hasRequiredHttp)return http_1;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function n(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,o(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}function a(t,n,i){return n=c(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,s()?Reflect.construct(n,i||[],c(t).constructor):n.apply(t,i))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}hasRequiredHttp=1;var d=require$$0$5,u=require$$1,p=requireReadableBrowser().Stream,m=requireDist(),h=requireSafeStableStringify().configure;return http_1=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=a(this,t,[n])).options=n,e.name=n.name||"http",e.ssl=!!n.ssl,e.host=n.host||"localhost",e.port=n.port,e.auth=n.auth,e.path=n.path||"",e.maximumDepth=n.maximumDepth,e.agent=n.agent,e.headers=n.headers||{},e.headers["content-type"]="application/json",e.batch=n.batch||!1,e.batchInterval=n.batchInterval||5e3,e.batchCount=n.batchCount||10,e.batchOptions=[],e.batchTimeoutID=-1,e.batchCallback={},e.port||(e.port=e.ssl?443:80),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(t,e),r(t,[{key:"log",value:function(e,t){var n=this;this._request(e,null,null,function(t,i){i&&200!==i.statusCode&&(t=new Error("Invalid HTTP Status Code: ".concat(i.statusCode))),t?n.emit("warn",t):n.emit("logged",e)}),t&&setImmediate(t)}},{key:"query",value:function(e,t){"function"==typeof e&&(t=e,e={});var n=(e={method:"query",params:this.normalizeQuery(e)}).params.auth||null;delete e.params.auth;var i=e.params.path||null;delete e.params.path,this._request(e,n,i,function(e,n,i){if(n&&200!==n.statusCode&&(e=new Error("Invalid HTTP Status Code: ".concat(n.statusCode))),e)return t(e);if("string"==typeof i)try{i=JSON.parse(i)}catch(e){return t(e)}t(null,i)})}},{key:"stream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new p,n=(e={method:"stream",params:e}).params.path||null;delete e.params.path;var i=e.params.auth||null;delete e.params.auth;var r="",o=this._request(e,i,n);return t.destroy=function(){return o.destroy()},o.on("data",function(e){for(var n=(e=(r+e).split(/\n+/)).length-1,i=0;i<n;i++)try{t.emit("log",JSON.parse(e[i]))}catch(e){t.emit("error",e)}r=e[n]}),o.on("error",function(e){return t.emit("error",e)}),t}},{key:"_request",value:function(e,t,n,i){e=e||{},t=t||this.auth,n=n||this.path||"",this.batch?this._doBatch(e,i,t,n):this._doRequest(e,i,t,n)}},{key:"_doBatch",value:function(e,t,n,i){if(this.batchOptions.push(e),1===this.batchOptions.length){var r=this;this.batchCallback=t,this.batchTimeoutID=setTimeout(function(){r.batchTimeoutID=-1,r._doBatchRequest(r.batchCallback,n,i)},this.batchInterval)}this.batchOptions.length===this.batchCount&&this._doBatchRequest(this.batchCallback,n,i)}},{key:"_doBatchRequest",value:function(e,t,n){this.batchTimeoutID>0&&(clearTimeout(this.batchTimeoutID),this.batchTimeoutID=-1);var i=this.batchOptions.slice();this.batchOptions=[],this._doRequest(i,e,t,n)}},{key:"_doRequest",value:function(e,t,i,r){var o=Object.assign({},this.headers);i&&i.bearer&&(o.Authorization="Bearer ".concat(i.bearer));var a=(this.ssl?u:d).request(n(n({},this.options),{},{method:"POST",host:this.host,port:this.port,path:"/".concat(r.replace(/^\//,"")),headers:o,auth:i&&i.username&&i.password?"".concat(i.username,":").concat(i.password):"",agent:this.agent}));a.on("error",t),a.on("response",function(e){return e.on("end",function(){return t(null,e)}).resume()});var s=h(n({},this.maximumDepth&&{maximumDepth:this.maximumDepth}));a.end(Buffer.from(s(e,this.options.replacer),"utf8"))}}])}(m),http_1}function requireIsStream(){if(hasRequiredIsStream)return isStream_1;hasRequiredIsStream=1;const e=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;return e.writable=t=>e(t)&&!1!==t.writable&&"function"==typeof t._write&&"object"==typeof t._writableState,e.readable=t=>e(t)&&!1!==t.readable&&"function"==typeof t._read&&"object"==typeof t._readableState,e.duplex=t=>e.writable(t)&&e.readable(t),e.transform=t=>e.duplex(t)&&"function"==typeof t._transform,isStream_1=e}function requireStream(){if(hasRequiredStream)return stream;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}function i(t,n,i){return n=o(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,r()?Reflect.construct(n,i||[],o(t).constructor):n.apply(t,i))}function r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(r=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}hasRequiredStream=1;var s=requireIsStream(),c=requireTripleBeam().MESSAGE,l=require$$0$6,d=requireDist();return stream=function(e){function n(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),e=i(this,n,[t]),!t.stream||!s(t.stream))throw new Error("options.stream is required.");return e._stream=t.stream,e._stream.setMaxListeners(1/0),e.isObjectMode=t.stream._writableState.objectMode,e.eol="string"==typeof t.eol?t.eol:l.EOL,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(n,e),t(n,[{key:"log",value:function(e,t){var n=this;if(setImmediate(function(){return n.emit("logged",e)}),this.isObjectMode)return this._stream.write(e),void(t&&t());this._stream.write("".concat(e[c]).concat(this.eol)),t&&t()}}])}(d),stream}function requireTransports(){return hasRequiredTransports||(hasRequiredTransports=1,e=transports,Object.defineProperty(e,"Console",{configurable:!0,enumerable:!0,get:function(){return requireConsole()}}),Object.defineProperty(e,"File",{configurable:!0,enumerable:!0,get:function(){return requireFile()}}),Object.defineProperty(e,"Http",{configurable:!0,enumerable:!0,get:function(){return requireHttp()}}),Object.defineProperty(e,"Stream",{configurable:!0,enumerable:!0,get:function(){return requireStream()}})),transports;var e}var config={},hasRequiredConfig;function requireConfig(){if(hasRequiredConfig)return config;hasRequiredConfig=1;var e=requireBrowser$2(),t=requireTripleBeam().configs;return config.cli=e.levels(t.cli),config.npm=e.levels(t.npm),config.syslog=e.levels(t.syslog),config.addColors=e.levels,config}var forEach={exports:{}},eachOf={exports:{}},hasRequiredEachOf;function requireEachOf(){return hasRequiredEachOf||(hasRequiredEachOf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=l(requireIsArrayLike()),i=l(requireBreakLoop()),r=l(requireEachOfLimit()),o=l(requireOnce()),a=l(requireOnlyOnce()),s=l(requireWrapAsync()),c=l(requireAwaitify());function l(e){return e&&e.__esModule?e:{default:e}}function d(e,t,n){n=(0,o.default)(n);var r=0,s=0,{length:c}=e,l=!1;function d(e,t){!1===e&&(l=!0),!0!==l&&(e?n(e):++s!==c&&t!==i.default||n(null))}for(0===c&&n(null);r<c;r++)t(e[r],r,(0,a.default)(d))}function u(e,t,n){return(0,r.default)(e,1/0,t,n)}t.default=(0,c.default)(function(e,t,i){return((0,n.default)(e)?d:u)(e,(0,s.default)(t),i)},3),e.exports=t.default}(eachOf,eachOf.exports)),eachOf.exports}var withoutIndex={exports:{}},hasRequiredWithoutIndex,hasRequiredForEach,fn_name,hasRequiredFn_name,oneTime,hasRequiredOneTime;function requireWithoutIndex(){return hasRequiredWithoutIndex||(hasRequiredWithoutIndex=1,e=withoutIndex,t=withoutIndex.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(t,n,i)=>e(t,i)},e.exports=t.default),withoutIndex.exports;var e,t}function requireForEach(){return hasRequiredForEach||(hasRequiredForEach=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=a(requireEachOf()),i=a(requireWithoutIndex()),r=a(requireWrapAsync()),o=a(requireAwaitify());function a(e){return e&&e.__esModule?e:{default:e}}t.default=(0,o.default)(function(e,t,o){return(0,n.default)(e,(0,i.default)((0,r.default)(t)),o)},3),e.exports=t.default}(forEach,forEach.exports)),forEach.exports}function requireFn_name(){if(hasRequiredFn_name)return fn_name;hasRequiredFn_name=1;var e=Object.prototype.toString;return fn_name=function(t){if("string"==typeof t.displayName&&t.constructor.name)return t.displayName;if("string"==typeof t.name&&t.name)return t.name;if("object"==typeof t&&t.constructor&&"string"==typeof t.constructor.name)return t.constructor.name;var n=t.toString(),i=e.call(t).slice(8,-1);return(n="Function"===i?n.substring(n.indexOf("(")+1,n.indexOf(")")):i)||"anonymous"}}function requireOneTime(){if(hasRequiredOneTime)return oneTime;hasRequiredOneTime=1;var e=requireFn_name();return oneTime=function(t){var n,i=0;function r(){return i||(i=1,n=t.apply(this,arguments),t=null),n}return r.displayName=e(t),r},oneTime}var stackTrace={},hasRequiredStackTrace,exceptionStream,hasRequiredExceptionStream,exceptionHandler,hasRequiredExceptionHandler,rejectionStream,hasRequiredRejectionStream,rejectionHandler,hasRequiredRejectionHandler;function requireStackTrace(){return hasRequiredStackTrace||(hasRequiredStackTrace=1,function(e){function t(e){for(var t in e)this[t]=e[t]}e.get=function(t){var n=Error.stackTraceLimit;Error.stackTraceLimit=1/0;var i={},r=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t},Error.captureStackTrace(i,t||e.get);var o=i.stack;return Error.prepareStackTrace=r,Error.stackTraceLimit=n,o},e.parse=function(e){if(!e.stack)return[];var t=this;return e.stack.split("\n").slice(1).map(function(e){if(e.match(/^\s*[-]{4,}$/))return t._createParsedCallSite({fileName:e,lineNumber:null,functionName:null,typeName:null,methodName:null,columnNumber:null,native:null});var n=e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);if(n){var i=null,r=null,o=null,a=null,s=null,c="native"===n[5];if(n[1]){var l=(o=n[1]).lastIndexOf(".");if("."==o[l-1]&&l--,l>0){i=o.substr(0,l),r=o.substr(l+1);var d=i.indexOf(".Module");d>0&&(o=o.substr(d+1),i=i.substr(0,d))}a=null}r&&(a=i,s=r),"<anonymous>"===r&&(s=null,o=null);var u={fileName:n[2]||null,lineNumber:parseInt(n[3],10)||null,functionName:o,typeName:a,methodName:s,columnNumber:parseInt(n[4],10)||null,native:c};return t._createParsedCallSite(u)}}).filter(function(e){return!!e})};["this","typeName","functionName","methodName","fileName","lineNumber","columnNumber","function","evalOrigin"].forEach(function(e){t.prototype[e]=null,t.prototype["get"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}),["topLevel","eval","native","constructor"].forEach(function(e){t.prototype[e]=!1,t.prototype["is"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}),e._createParsedCallSite=function(e){return new t(e)}}(stackTrace)),stackTrace}function requireExceptionStream(){if(hasRequiredExceptionStream)return exceptionStream;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}function i(t,n,i){return n=o(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,r()?Reflect.construct(n,i||[],o(t).constructor):n.apply(t,i))}function r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(r=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}hasRequiredExceptionStream=1;var s=requireReadableBrowser().Writable;return exceptionStream=function(e){function n(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t=i(this,n,[{objectMode:!0}]),!e)throw new Error("ExceptionStream requires a TransportStream instance.");return t.handleExceptions=!0,t.transport=e,t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(n,e),t(n,[{key:"_write",value:function(e,t,n){return e.exception?this.transport.log(e,n):(n(),!0)}}])}(s),exceptionStream}function requireExceptionHandler(){if(hasRequiredExceptionHandler)return exceptionHandler;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredExceptionHandler=1;var i=require$$0$6,r=requireForEach(),o=requireBrowser()("winston:exception"),a=requireOneTime(),s=requireStackTrace(),c=requireExceptionStream();return exceptionHandler=function(){return t(function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new Error("Logger is required to handle exceptions");this.logger=t,this.handlers=new Map},[{key:"handle",value:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];n.forEach(function(t){if(Array.isArray(t))return t.forEach(function(t){return e._addHandler(t)});e._addHandler(t)}),this.catcher||(this.catcher=this._uncaughtException.bind(this),process.on("uncaughtException",this.catcher))}},{key:"unhandle",value:function(){var e=this;this.catcher&&(process.removeListener("uncaughtException",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(function(t){return e.logger.unpipe(t)}))}},{key:"getAllInfo",value:function(e){var t=null;return e&&(t="string"==typeof e?e:e.message),{error:e,level:"error",message:["uncaughtException: ".concat(t||"(no error message)"),e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:!0,date:(new Date).toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}},{key:"getProcessInfo",value:function(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}},{key:"getOsInfo",value:function(){return{loadavg:i.loadavg(),uptime:i.uptime()}}},{key:"getTrace",value:function(e){return(e?s.parse(e):s.get()).map(function(e){return{column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}})}},{key:"_addHandler",value:function(e){if(!this.handlers.has(e)){e.handleExceptions=!0;var t=new c(e);this.handlers.set(e,t),this.logger.pipe(t)}}},{key:"_uncaughtException",value:function(e){var t,n=this.getAllInfo(e),i=this._getExceptionHandlers(),s="function"==typeof this.logger.exitOnError?this.logger.exitOnError(e):this.logger.exitOnError;function c(){o("doExit",s),o("process._exiting",process._exiting),s&&!process._exiting&&(t&&clearTimeout(t),process.exit(1))}if(!i.length&&s&&(console.warn("winston: exitOnError cannot be true with no exception handlers."),console.warn("winston: not exiting process."),s=!1),!i||0===i.length)return process.nextTick(c);r(i,function(e,t){var n=a(t),i=e.transport||e;function r(e){return function(){o(e),n()}}i._ending=!0,i.once("finish",r("finished")),i.once("error",r("error"))},function(){return s&&c()}),this.logger.log(n),s&&(t=setTimeout(c,3e3))}},{key:"_getExceptionHandlers",value:function(){return this.logger.transports.filter(function(e){return(e.transport||e).handleExceptions})}}])}(),exceptionHandler}function requireRejectionStream(){if(hasRequiredRejectionStream)return rejectionStream;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}function i(t,n,i){return n=o(n),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,r()?Reflect.construct(n,i||[],o(t).constructor):n.apply(t,i))}function r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(r=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}hasRequiredRejectionStream=1;var s=requireReadableBrowser().Writable;return rejectionStream=function(e){function n(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t=i(this,n,[{objectMode:!0}]),!e)throw new Error("RejectionStream requires a TransportStream instance.");return t.handleRejections=!0,t.transport=e,t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}(n,e),t(n,[{key:"_write",value:function(e,t,n){return e.rejection?this.transport.log(e,n):(n(),!0)}}])}(s),rejectionStream}function requireRejectionHandler(){if(hasRequiredRejectionHandler)return rejectionHandler;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredRejectionHandler=1;var i=require$$0$6,r=requireForEach(),o=requireBrowser()("winston:rejection"),a=requireOneTime(),s=requireStackTrace(),c=requireRejectionStream();return rejectionHandler=function(){return t(function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new Error("Logger is required to handle rejections");this.logger=t,this.handlers=new Map},[{key:"handle",value:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];n.forEach(function(t){if(Array.isArray(t))return t.forEach(function(t){return e._addHandler(t)});e._addHandler(t)}),this.catcher||(this.catcher=this._unhandledRejection.bind(this),process.on("unhandledRejection",this.catcher))}},{key:"unhandle",value:function(){var e=this;this.catcher&&(process.removeListener("unhandledRejection",this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(function(t){return e.logger.unpipe(t)}))}},{key:"getAllInfo",value:function(e){var t=null;return e&&(t="string"==typeof e?e:e.message),{error:e,level:"error",message:["unhandledRejection: ".concat(t||"(no error message)"),e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,rejection:!0,date:(new Date).toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}},{key:"getProcessInfo",value:function(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}},{key:"getOsInfo",value:function(){return{loadavg:i.loadavg(),uptime:i.uptime()}}},{key:"getTrace",value:function(e){return(e?s.parse(e):s.get()).map(function(e){return{column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}})}},{key:"_addHandler",value:function(e){if(!this.handlers.has(e)){e.handleRejections=!0;var t=new c(e);this.handlers.set(e,t),this.logger.pipe(t)}}},{key:"_unhandledRejection",value:function(e){var t,n=this.getAllInfo(e),i=this._getRejectionHandlers(),s="function"==typeof this.logger.exitOnError?this.logger.exitOnError(e):this.logger.exitOnError;function c(){o("doExit",s),o("process._exiting",process._exiting),s&&!process._exiting&&(t&&clearTimeout(t),process.exit(1))}if(!i.length&&s&&(console.warn("winston: exitOnError cannot be true with no rejection handlers."),console.warn("winston: not exiting process."),s=!1),!i||0===i.length)return process.nextTick(c);r(i,function(e,t){var n=a(t),i=e.transport||e;function r(e){return function(){o(e),n()}}i._ending=!0,i.once("finish",r("finished")),i.once("error",r("error"))},function(){return s&&c()}),this.logger.log(n),s&&(t=setTimeout(c,3e3))}},{key:"_getRejectionHandlers",value:function(){return this.logger.transports.filter(function(e){return(e.transport||e).handleRejections})}}])}(),rejectionHandler}var legacy={exports:{}},modern={exports:{}},hasRequiredModern,hasRequiredLegacy,profiler,hasRequiredProfiler,format,hasRequiredFormat,json,hasRequiredJson,logger$1,hasRequiredLogger,createLogger,hasRequiredCreateLogger,container,hasRequiredContainer,hasRequiredWinston;function requireModern(){if(hasRequiredModern)return modern.exports;hasRequiredModern=1;const e=require$$0$8,t=require_stream_writable(),{LEVEL:n}=requireTripleBeam(),i=modern.exports=function(e={}){t.call(this,{objectMode:!0,highWaterMark:e.highWaterMark}),this.format=e.format,this.level=e.level,this.handleExceptions=e.handleExceptions,this.handleRejections=e.handleRejections,this.silent=e.silent,e.log&&(this.log=e.log),e.logv&&(this.logv=e.logv),e.close&&(this.close=e.close),this.once("pipe",e=>{this.levels=e.levels,this.parent=e}),this.once("unpipe",e=>{e===this.parent&&(this.parent=null,this.close&&this.close())})};return e.inherits(i,t),i.prototype._write=function(e,t,i){if(this.silent||!0===e.exception&&!this.handleExceptions)return i(null);const r=this.level||this.parent&&this.parent.level;if(!r||this.levels[r]>=this.levels[e[n]]){if(e&&!this.format)return this.log(e,i);let t,n;try{n=this.format.transform(Object.assign({},e),this.format.options)}catch(e){t=e}if(t||!n){if(i(),t)throw t;return}return this.log(n,i)}return this._writableState.sync=!1,i(null)},i.prototype._writev=function(e,t){if(this.logv){const n=e.filter(this._accept,this);return n.length?this.logv(n,t):t(null)}for(let n=0;n<e.length;n++){if(!this._accept(e[n]))continue;if(e[n].chunk&&!this.format){this.log(e[n].chunk,e[n].callback);continue}let i,r;try{r=this.format.transform(Object.assign({},e[n].chunk),this.format.options)}catch(e){i=e}if(i||!r){if(e[n].callback(),i)throw t(null),i}else this.log(r,e[n].callback)}return t(null)},i.prototype._accept=function(e){const t=e.chunk;if(this.silent)return!1;const i=this.level||this.parent&&this.parent.level;return!(!0!==t.exception&&i&&!(this.levels[i]>=this.levels[t[n]])||!this.handleExceptions&&!0===t.exception)},i.prototype._nop=function(){},modern.exports}function requireLegacy(){if(hasRequiredLegacy)return legacy.exports;hasRequiredLegacy=1;const e=require$$0$8,{LEVEL:t}=requireTripleBeam(),n=requireModern(),i=legacy.exports=function(e={}){if(n.call(this,e),!e.transport||"function"!=typeof e.transport.log)throw new Error("Invalid transport, must be an object with a log method.");this.transport=e.transport,this.level=this.level||e.transport.level,this.handleExceptions=this.handleExceptions||e.transport.handleExceptions,this._deprecated(),this.transport.__winstonError||(this.transport.__winstonError=function(e){this.emit("error",e,this.transport)}.bind(this),this.transport.on("error",this.transport.__winstonError))};return e.inherits(i,n),i.prototype._write=function(e,n,i){if(this.silent||!0===e.exception&&!this.handleExceptions)return i(null);(!this.level||this.levels[this.level]>=this.levels[e[t]])&&this.transport.log(e[t],e.message,e,this._nop),i(null)},i.prototype._writev=function(e,n){for(let n=0;n<e.length;n++)this._accept(e[n])&&(this.transport.log(e[n].chunk[t],e[n].chunk.message,e[n].chunk,this._nop),e[n].callback());return n(null)},i.prototype._deprecated=function(){console.error([`${this.transport.name} is a legacy winston transport. Consider upgrading: `,"- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"].join("\n"))},i.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)},legacy.exports}function requireProfiler(){if(hasRequiredProfiler)return profiler;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredProfiler=1;var i=function(){return t(function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=requireLogger();if("object"!==e(n)||Array.isArray(n)||!(n instanceof i))throw new Error("Logger is required for profiling");this.logger=n,this.start=Date.now()},[{key:"done",value:function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];"function"==typeof n[n.length-1]&&(console.warn("Callback function no longer supported as of winston@3.0.0"),n.pop());var r="object"===e(n[n.length-1])?n.pop():{};return r.level=r.level||"info",r.durationMs=Date.now()-this.start,this.logger.write(r)}}])}();return profiler=i}function requireFormat(){if(hasRequiredFormat)return format;hasRequiredFormat=1;class e extends Error{constructor(t){super(`Format functions must be synchronous taking a two arguments: (info, opts)\nFound: ${t.toString().split("\n")[0]}\n`),Error.captureStackTrace(this,e)}}return format=t=>{if(t.length>2)throw new e(t);function n(e={}){this.options=e}function i(e){return new n(e)}return n.prototype.transform=t,i.Format=n,i}}function requireJson(){if(hasRequiredJson)return json;hasRequiredJson=1;const e=requireFormat(),{MESSAGE:t}=requireTripleBeam(),n=requireSafeStableStringify();function i(e,t){return"bigint"==typeof t?t.toString():t}return json=e((e,r)=>{const o=n.configure(r);return e[t]=o(e,r.replacer||i,r.space),e})}function requireLogger(){if(hasRequiredLogger)return logger$1;function e(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,n);if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==t(n)?n:n+""}function r(e,n,i){return n=a(n),function(e,n){if(n&&("object"==t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,o()?Reflect.construct(n,i||[],a(e).constructor):n.apply(e,i))}function o(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o=function(){return!!e})()}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}hasRequiredLogger=1;var c=requireReadableBrowser(),l=c.Stream,d=c.Transform,u=requireForEach(),p=requireTripleBeam(),m=p.LEVEL,h=p.SPLAT,f=requireIsStream(),g=requireExceptionHandler(),y=requireRejectionHandler(),v=requireLegacy(),x=requireProfiler(),E=requireCommon().warn,b=requireConfig(),S=/%[scdjifoO%]/g,w=function(i){function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=r(this,o,[{objectMode:!0}])).configure(e),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(o,i),n(o,[{key:"child",value:function(e){var t=this;return Object.create(t,{write:{value:function(n){var i=Object.assign({},e,n);n instanceof Error&&(i.stack=n.stack,i.message=n.message),t.write(i)}}})}},{key:"configure",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.silent,i=t.format,r=t.defaultMeta,o=t.levels,a=t.level,s=void 0===a?"info":a,c=t.exitOnError,l=void 0===c||c,d=t.transports,u=t.colors,p=t.emitErrs,m=t.formatters,h=t.padLevels,f=t.rewriters,v=t.stripColors,x=t.exceptionHandlers,E=t.rejectionHandlers;if(this.transports.length&&this.clear(),this.silent=n,this.format=i||this.format||requireJson()(),this.defaultMeta=r||null,this.levels=o||this.levels||b.npm.levels,this.level=s,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new g(this),this.rejections=new y(this),this.profilers={},this.exitOnError=l,d&&(d=Array.isArray(d)?d:[d]).forEach(function(t){return e.add(t)}),u||p||m||h||f||v)throw new Error(["{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.","Use a custom winston.format(function) instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join("\n"));x&&this.exceptions.handle(x),E&&this.rejections.handle(E)}},{key:"getHighestLogLevel",value:function(){var e=this,t=_(this.levels,this.level);return this.transports&&0!==this.transports.length?this.transports.reduce(function(t,n){var i=_(e.levels,n.level);return null!==i&&i>t?i:t},t):t}},{key:"isLevelEnabled",value:function(e){var t=this,n=_(this.levels,e);if(null===n)return!1;var i=_(this.levels,this.level);return null!==i&&(this.transports&&0!==this.transports.length?-1!==this.transports.findIndex(function(e){var r=_(t.levels,e.level);return null===r&&(r=i),r>=n}):i>=n)}},{key:"log",value:function(n,i){for(var r=arguments.length,o=new Array(r>2?r-2:0),a=2;a<r;a++)o[a-2]=arguments[a];if(1===arguments.length)return n[m]=n.level,this._addDefaultMeta(n),this.write(n),this;if(2===arguments.length)return i&&"object"===t(i)?(i[m]=i.level=n,this._addDefaultMeta(i),this.write(i),this):(i=e(e(e({},m,n),"level",n),"message",i),this._addDefaultMeta(i),this.write(i),this);var s=o[0];if("object"===t(s)&&null!==s&&!(i&&i.match&&i.match(S))){var c=Object.assign({},this.defaultMeta,s,e(e(e(e({},m,n),h,o),"level",n),"message",i));return s.message&&(c.message="".concat(c.message," ").concat(s.message)),s.stack&&(c.stack=s.stack),s.cause&&(c.cause=s.cause),this.write(c),this}return this.write(Object.assign({},this.defaultMeta,e(e(e(e({},m,n),h,o),"level",n),"message",i))),this}},{key:"_transform",value:function(e,t,n){if(this.silent)return n();e[m]||(e[m]=e.level),this.levels[e[m]]||0===this.levels[e[m]]||console.error("[winston] Unknown logger level: %s",e[m]),this._readableState.pipes||console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",e);try{this.push(this.format.transform(e,this.format.options))}finally{this._writableState.sync=!1,n()}}},{key:"_final",value:function(e){var t=this.transports.slice();u(t,function(e,t){if(!e||e.finished)return setImmediate(t);e.once("finish",t),e.end()},e)}},{key:"add",value:function(e){var t=!f(e)||e.log.length>2?new v({transport:e}):e;if(!t._writableState||!t._writableState.objectMode)throw new Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.");return this._onEvent("error",t),this._onEvent("warn",t),this.pipe(t),e.handleExceptions&&this.exceptions.handle(),e.handleRejections&&this.rejections.handle(),this}},{key:"remove",value:function(e){if(!e)return this;var t=e;return(!f(e)||e.log.length>2)&&(t=this.transports.filter(function(t){return t.transport===e})[0]),t&&this.unpipe(t),this}},{key:"clear",value:function(){return this.unpipe(),this}},{key:"close",value:function(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit("close"),this}},{key:"setLevels",value:function(){E.deprecated("setLevels")}},{key:"query",value:function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};var n={},i=Object.assign({},e.query||{});u(this.transports.filter(function(e){return!!e.query}),function(t,r){!function(t,n){e.query&&"function"==typeof t.formatQuery&&(e.query=t.formatQuery(i)),t.query(e,function(i,r){if(i)return n(i);"function"==typeof t.formatResults&&(r=t.formatResults(r,e.format)),n(null,r)})}(t,function(e,i){r&&((i=e||i)&&(n[t.name]=i),r()),r=null})},function(){return t(null,n)})}},{key:"stream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new l,n=[];return t._streams=n,t.destroy=function(){for(var e=n.length;e--;)n[e].destroy()},this.transports.filter(function(e){return!!e.stream}).forEach(function(i){var r=i.stream(e);r&&(n.push(r),r.on("log",function(e){e.transport=e.transport||[],e.transport.push(i.name),t.emit("log",e)}),r.on("error",function(e){e.transport=e.transport||[],e.transport.push(i.name),t.emit("error",e)}))}),t}},{key:"startTimer",value:function(){return new x(this)}},{key:"profile",value:function(e){var n=Date.now();if(this.profilers[e]){var i=this.profilers[e];delete this.profilers[e];for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];"function"==typeof o[o.length-2]&&(console.warn("Callback function no longer supported as of winston@3.0.0"),o.pop());var s="object"===t(o[o.length-1])?o.pop():{};return s.level=s.level||"info",s.durationMs=n-i,s.message=s.message||e,this.write(s)}return this.profilers[e]=n,this}},{key:"handleExceptions",value:function(){var e;console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()"),(e=this.exceptions).handle.apply(e,arguments)}},{key:"unhandleExceptions",value:function(){var e;console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()"),(e=this.exceptions).unhandle.apply(e,arguments)}},{key:"cli",value:function(){throw new Error(["Logger.cli() was removed in winston@3.0.0","Use a custom winston.formats.cli() instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join("\n"))}},{key:"_onEvent",value:function(e,t){t["__winston"+e]||(t["__winston"+e]=function(n){"error"!==e||this.transports.includes(t)||this.add(t),this.emit(e,n,t)}.bind(this),t.on(e,t["__winston"+e]))}},{key:"_addDefaultMeta",value:function(e){this.defaultMeta&&Object.assign(e,this.defaultMeta)}}])}(d);function _(e,t){var n=e[t];return n||0===n?n:null}return Object.defineProperty(w.prototype,"transports",{configurable:!1,enumerable:!0,get:function(){var e=this._readableState.pipes;return Array.isArray(e)?e:[e].filter(Boolean)}}),logger$1=w}function requireCreateLogger(){if(hasRequiredCreateLogger)return createLogger;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,r,o){return r=i(r),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,n()?Reflect.construct(r,o||[],i(t).constructor):r.apply(t,o))}function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(n=function(){return!!e})()}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}hasRequiredCreateLogger=1;var o=requireTripleBeam().LEVEL,a=requireConfig(),s=requireLogger(),c=requireBrowser()("winston:create-logger");return createLogger=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.levels=e.levels||a.npm.levels;var n=function(e){function n(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t(this,n,[e])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(n,e),function(e){return Object.defineProperty(e,"prototype",{writable:!1}),e}(n)}(s),i=new n(e);return Object.keys(e.levels).forEach(function(e){c('Define prototype method for "%s"',e),"log"!==e?(n.prototype[e]=function(){for(var t=this||i,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];if(1===r.length){var s=r[0],c=s&&s.message&&s||{message:s};return c.level=c[o]=e,t._addDefaultMeta(c),t.write(c),this||i}return 0===r.length?(t.log(e,""),t):t.log.apply(t,[e].concat(r))},n.prototype[function(e){return"is"+e.charAt(0).toUpperCase()+e.slice(1)+"Enabled"}(e)]=function(){return(this||i).isLevelEnabled(e)}):console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.')}),i},createLogger}function requireContainer(){if(hasRequiredContainer)return container;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t,i){return t&&function(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,n);if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==e(n)?n:n+""}hasRequiredContainer=1;var i=requireCreateLogger();return container=function(){return t(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.loggers=new Map,this.options=t},[{key:"add",value:function(e,t){var n=this;if(!this.loggers.has(e)){var r=(t=Object.assign({},t||this.options)).transports||this.options.transports;t.transports=r?Array.isArray(r)?r.slice():[r]:[];var o=i(t);o.on("close",function(){return n._delete(e)}),this.loggers.set(e,o)}return this.loggers.get(e)}},{key:"get",value:function(e,t){return this.add(e,t)}},{key:"has",value:function(e){return!!this.loggers.has(e)}},{key:"close",value:function(e){var t=this;if(e)return this._removeLogger(e);this.loggers.forEach(function(e,n){return t._removeLogger(n)})}},{key:"_removeLogger",value:function(e){this.loggers.has(e)&&(this.loggers.get(e).close(),this._delete(e))}},{key:"_delete",value:function(e){this.loggers.delete(e)}}])}(),container}function requireWinston(){return hasRequiredWinston||(hasRequiredWinston=1,function(e){var t=requireBrowser$2(),n=requireCommon().warn;e.version=require$$2.version,e.transports=requireTransports(),e.config=requireConfig(),e.addColors=t.levels,e.format=t.format,e.createLogger=requireCreateLogger(),e.Logger=requireLogger(),e.ExceptionHandler=requireExceptionHandler(),e.RejectionHandler=requireRejectionHandler(),e.Container=requireContainer(),e.Transport=requireDist(),e.loggers=new e.Container;var i=e.createLogger();Object.keys(e.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(function(t){return e[t]=function(){return i[t].apply(i,arguments)}}),Object.defineProperty(e,"level",{get:function(){return i.level},set:function(e){i.level=e}}),Object.defineProperty(e,"exceptions",{get:function(){return i.exceptions}}),Object.defineProperty(e,"rejections",{get:function(){return i.rejections}}),["exitOnError"].forEach(function(t){Object.defineProperty(e,t,{get:function(){return i[t]},set:function(e){i[t]=e}})}),Object.defineProperty(e,"default",{get:function(){return{exceptionHandlers:i.exceptionHandlers,rejectionHandlers:i.rejectionHandlers,transports:i.transports}}}),n.deprecated(e,"setLevels"),n.forFunctions(e,"useFormat",["cli"]),n.forProperties(e,"useFormat",["padLevels","stripColors"]),n.forFunctions(e,"deprecated",["addRewriter","addFilter","clone","extend"]),n.forProperties(e,"deprecated",["emitErrs","levelLength"])}(winston)),winston}var winstonExports=requireWinston();const logger=e=>{const t={defaultMeta:{...e.defaultLogInformation,deploymentStage:e.deploymentStage,service:e.service},format:winstonExports.format.combine(winstonExports.format.timestamp({format:"DD-MM-YYYY HH:mm:ss"}),winstonExports.format.json()),level:e.level||"info"};if(e.datadogApiKey){const n={host:"http-intake.logs.datadoghq.eu",path:`/api/v2/logs?dd-api-key=${e.datadogApiKey}&ddsource=nodejs&service=${e.service}`,port:443,ssl:!0};return winstonExports.createLogger({...t,transports:[new winstonExports.transports.Http(n)]})}return winstonExports.createLogger({...t,transports:[new winstonExports.transports.Console({forceConsole:!0})]})};export{ClientError as C,DEFAULT_CLIENT_CONFIG$1 as D,ServerError as S,alagarr as a,DEFAULT_CLIENT_CONFIG as b,sqs as c,dynamodb as d,logger as e,fromUtf8$2 as f,lambda as l,parameterStore as p,ses as s,toUtf8 as t,winstonExports as w};
|