diff --git a/.eslintrc.js b/.eslintrc.js index 928e440..7510b17 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,7 +31,6 @@ module.exports = { }, ], '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars-experimental': 'warn', '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/explicit-function-return-type': 'error', }, diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1d0f55e..f03924d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,6 +1,13 @@ - -name: mondo-eslint-config + +name: CI + on: + pull_request: + branches: + - main + paths-ignore: + - 'docs/**' + - '**.md' push: branches: - main @@ -9,36 +16,38 @@ on: - '**.md' jobs: verify: + name: Verify build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 16 - run: npm --silent ci --quiet --no-progress --no-audit --unsafe-perm --loglevel warn - - run: 'npm run audit' - - run: 'npm run lint' - publish: + - run: npm run audit + - run: npm run lint + publish: + name: Publish to NPM runs-on: ubuntu-latest + if: github.repository == 'MondoPower/codeartifact-auth' && !(github.event_name == 'pull_request') needs: verify steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 16 - run: npm --silent ci --quiet --no-progress --no-audit --unsafe-perm --loglevel warn - uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} access: public - - slackNotification: - needs: publish - if: failure() - name: CodeArtifact Auth CI Notification + slack: + name: Notify Slack on failure runs-on: ubuntu-latest + if: github.repository == 'MondoPower/codeartifact-auth' && !(github.event_name == 'pull_request') && failure() + needs: publish steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Slack Notification uses: rtCamp/action-slack-notify@v2 env: diff --git a/.nvmrc b/.nvmrc index cab6793..b6a7d89 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -12.22.4 \ No newline at end of file +16 diff --git a/action.yaml b/action.yaml index 61d8ef8..d5fa35f 100644 --- a/action.yaml +++ b/action.yaml @@ -22,6 +22,6 @@ inputs: outputs: status: # success/failure description: 'If we succeeded or failed to login' -runs: - using: node12 - main: './action/action.js' \ No newline at end of file +runs: + using: node16 + main: './action/action.js' diff --git a/action/action.js b/action/action.js index c445f38..ccde79f 100644 --- a/action/action.js +++ b/action/action.js @@ -1,36 +1,42 @@ -var Fl=Object.create;var Vi=Object.defineProperty;var Bl=Object.getOwnPropertyDescriptor;var Ul=Object.getOwnPropertyNames;var jl=Object.getPrototypeOf,Vl=Object.prototype.hasOwnProperty;var Xl=t=>Vi(t,"__esModule",{value:!0});var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Wl=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ul(e))!Vl.call(t,i)&&i!=="default"&&Vi(t,i,{get:()=>e[i],enumerable:!(r=Bl(e,i))||r.enumerable});return t},Xi=t=>Wl(Xl(Vi(t!=null?Fl(jl(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Br=I(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.toCommandProperties=Xt.toCommandValue=void 0;function Hl(t){return t==null?"":typeof t=="string"||t instanceof String?t:JSON.stringify(t)}Xt.toCommandValue=Hl;function zl(t){return Object.keys(t).length?{title:t.title,file:t.file,line:t.startLine,endLine:t.endLine,col:t.startColumn,endColumn:t.endColumn}:{}}Xt.toCommandProperties=zl});var os=I(Me=>{"use strict";var Kl=Me&&Me.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Gl=Me&&Me.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$l=Me&&Me.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Kl(e,t,r);return Gl(e,t),e};Object.defineProperty(Me,"__esModule",{value:!0});Me.issue=Me.issueCommand=void 0;var Yl=$l(require("os")),rs=Br();function is(t,e,r){let i=new ss(t,e,r);process.stdout.write(i.toString()+Yl.EOL)}Me.issueCommand=is;function Jl(t,e=""){is(t,{},e)}Me.issue=Jl;var ns="::",ss=class{constructor(e,r,i){e||(e="missing.command"),this.command=e,this.properties=r,this.message=i}toString(){let e=ns+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=!0;for(let i in this.properties)if(this.properties.hasOwnProperty(i)){let n=this.properties[i];n&&(r?r=!1:e+=",",e+=`${i}=${Zl(n)}`)}}return e+=`${ns}${Ql(this.message)}`,e}};function Ql(t){return rs.toCommandValue(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function Zl(t){return rs.toCommandValue(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}});var cs=I($e=>{"use strict";var ef=$e&&$e.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),tf=$e&&$e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),as=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&ef(e,t,r);return tf(e,t),e};Object.defineProperty($e,"__esModule",{value:!0});$e.issueCommand=void 0;var us=as(require("fs")),rf=as(require("os")),nf=Br();function sf(t,e){let r=process.env[`GITHUB_${t}`];if(!r)throw new Error(`Unable to find environment variable for file command ${t}`);if(!us.existsSync(r))throw new Error(`Missing file at path: ${r}`);us.appendFileSync(r,`${nf.toCommandValue(e)}${rf.EOL}`,{encoding:"utf8"})}$e.issueCommand=sf});var fs=I(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.checkBypass=Wt.getProxyUrl=void 0;function of(t){let e=t.protocol==="https:";if(ls(t))return;let r=(()=>e?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(r)return new URL(r)}Wt.getProxyUrl=of;function ls(t){if(!t.hostname)return!1;let e=process.env.no_proxy||process.env.NO_PROXY||"";if(!e)return!1;let r;t.port?r=Number(t.port):t.protocol==="http:"?r=80:t.protocol==="https:"&&(r=443);let i=[t.hostname.toUpperCase()];typeof r=="number"&&i.push(`${i[0]}:${r}`);for(let n of e.split(",").map(s=>s.trim().toUpperCase()).filter(s=>s))if(i.some(s=>s===n))return!0;return!1}Wt.checkBypass=ls});var ms=I(Ht=>{"use strict";var jv=require("net"),af=require("tls"),Wi=require("http"),ps=require("https"),uf=require("events"),Vv=require("assert"),cf=require("util");Ht.httpOverHttp=lf;Ht.httpsOverHttp=ff;Ht.httpOverHttps=pf;Ht.httpsOverHttps=df;function lf(t){var e=new ct(t);return e.request=Wi.request,e}function ff(t){var e=new ct(t);return e.request=Wi.request,e.createSocket=ds,e.defaultPort=443,e}function pf(t){var e=new ct(t);return e.request=ps.request,e}function df(t){var e=new ct(t);return e.request=ps.request,e.createSocket=ds,e.defaultPort=443,e}function ct(t){var e=this;e.options=t||{},e.proxyOptions=e.options.proxy||{},e.maxSockets=e.options.maxSockets||Wi.Agent.defaultMaxSockets,e.requests=[],e.sockets=[],e.on("free",function(i,n,s,o){for(var a=hs(n,s,o),u=0,c=e.requests.length;u=this.maxSockets){s.requests.push(o);return}s.createSocket(o,function(a){a.on("free",u),a.on("close",c),a.on("agentRemove",c),e.onSocket(a);function u(){s.emit("free",a,o)}function c(l){s.removeSocket(a),a.removeListener("free",u),a.removeListener("close",c),a.removeListener("agentRemove",c)}})};ct.prototype.createSocket=function(e,r){var i=this,n={};i.sockets.push(n);var s=Hi({},i.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(s.localAddress=e.localAddress),s.proxyAuth&&(s.headers=s.headers||{},s.headers["Proxy-Authorization"]="Basic "+new Buffer(s.proxyAuth).toString("base64")),St("making CONNECT request");var o=i.request(s);o.useChunkedEncodingByDefault=!1,o.once("response",a),o.once("upgrade",u),o.once("connect",c),o.once("error",l),o.end();function a(h){h.upgrade=!0}function u(h,g,b){process.nextTick(function(){c(h,g,b)})}function c(h,g,b){if(o.removeAllListeners(),g.removeAllListeners(),h.statusCode!==200){St("tunneling socket could not be established, statusCode=%d",h.statusCode),g.destroy();var y=new Error("tunneling socket could not be established, statusCode="+h.statusCode);y.code="ECONNRESET",e.request.emit("error",y),i.removeSocket(n);return}if(b.length>0){St("got illegal response body from proxy"),g.destroy();var y=new Error("got illegal response body from proxy");y.code="ECONNRESET",e.request.emit("error",y),i.removeSocket(n);return}return St("tunneling connection has established"),i.sockets[i.sockets.indexOf(n)]=g,r(g)}function l(h){o.removeAllListeners(),St(`tunneling socket could not be established, cause=%s -`,h.message,h.stack);var g=new Error("tunneling socket could not be established, cause="+h.message);g.code="ECONNRESET",e.request.emit("error",g),i.removeSocket(n)}};ct.prototype.removeSocket=function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var i=this.requests.shift();i&&this.createSocket(i,function(n){i.request.onSocket(n)})}};function ds(t,e){var r=this;ct.prototype.createSocket.call(r,t,function(i){var n=t.request.getHeader("host"),s=Hi({},r.options,{socket:i,servername:n?n.replace(/:.*$/,""):t.host}),o=af.connect(0,s);r.sockets[r.sockets.indexOf(i)]=o,e(o)})}function hs(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}function Hi(t){for(var e=1,r=arguments.length;e{vs.exports=ms()});var Ss=I(Z=>{"use strict";var hf=Z&&Z.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),mf=Z&&Z.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ur=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&hf(e,t,r);return mf(e,t),e},de=Z&&Z.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(h){o(h)}}function u(l){try{c(i.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(Z,"__esModule",{value:!0});Z.HttpClient=Z.isHttps=Z.HttpClientResponse=Z.HttpClientError=Z.getProxyUrl=Z.MediaTypes=Z.Headers=Z.HttpCodes=void 0;var jr=Ur(require("http")),zi=Ur(require("https")),gs=Ur(fs()),Vr=Ur(ys()),We;(function(t){t[t.OK=200]="OK",t[t.MultipleChoices=300]="MultipleChoices",t[t.MovedPermanently=301]="MovedPermanently",t[t.ResourceMoved=302]="ResourceMoved",t[t.SeeOther=303]="SeeOther",t[t.NotModified=304]="NotModified",t[t.UseProxy=305]="UseProxy",t[t.SwitchProxy=306]="SwitchProxy",t[t.TemporaryRedirect=307]="TemporaryRedirect",t[t.PermanentRedirect=308]="PermanentRedirect",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.PaymentRequired=402]="PaymentRequired",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.MethodNotAllowed=405]="MethodNotAllowed",t[t.NotAcceptable=406]="NotAcceptable",t[t.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.TooManyRequests=429]="TooManyRequests",t[t.InternalServerError=500]="InternalServerError",t[t.NotImplemented=501]="NotImplemented",t[t.BadGateway=502]="BadGateway",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout"})(We=Z.HttpCodes||(Z.HttpCodes={}));var be;(function(t){t.Accept="accept",t.ContentType="content-type"})(be=Z.Headers||(Z.Headers={}));var _t;(function(t){t.ApplicationJson="application/json"})(_t=Z.MediaTypes||(Z.MediaTypes={}));function vf(t){let e=gs.getProxyUrl(new URL(t));return e?e.href:""}Z.getProxyUrl=vf;var yf=[We.MovedPermanently,We.ResourceMoved,We.SeeOther,We.TemporaryRedirect,We.PermanentRedirect],gf=[We.BadGateway,We.ServiceUnavailable,We.GatewayTimeout],Ef=["OPTIONS","GET","DELETE","HEAD"],Sf=10,_f=5,er=class extends Error{constructor(e,r){super(e);this.name="HttpClientError",this.statusCode=r,Object.setPrototypeOf(this,er.prototype)}};Z.HttpClientError=er;var Ki=class{constructor(e){this.message=e}readBody(){return de(this,void 0,void 0,function*(){return new Promise(e=>de(this,void 0,void 0,function*(){let r=Buffer.alloc(0);this.message.on("data",i=>{r=Buffer.concat([r,i])}),this.message.on("end",()=>{e(r.toString())})}))})}};Z.HttpClientResponse=Ki;function wf(t){return new URL(t).protocol==="https:"}Z.isHttps=wf;var Es=class{constructor(e,r,i){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=e,this.handlers=r||[],this.requestOptions=i,i&&(i.ignoreSslError!=null&&(this._ignoreSslError=i.ignoreSslError),this._socketTimeout=i.socketTimeout,i.allowRedirects!=null&&(this._allowRedirects=i.allowRedirects),i.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=i.allowRedirectDowngrade),i.maxRedirects!=null&&(this._maxRedirects=Math.max(i.maxRedirects,0)),i.keepAlive!=null&&(this._keepAlive=i.keepAlive),i.allowRetries!=null&&(this._allowRetries=i.allowRetries),i.maxRetries!=null&&(this._maxRetries=i.maxRetries))}options(e,r){return de(this,void 0,void 0,function*(){return this.request("OPTIONS",e,null,r||{})})}get(e,r){return de(this,void 0,void 0,function*(){return this.request("GET",e,null,r||{})})}del(e,r){return de(this,void 0,void 0,function*(){return this.request("DELETE",e,null,r||{})})}post(e,r,i){return de(this,void 0,void 0,function*(){return this.request("POST",e,r,i||{})})}patch(e,r,i){return de(this,void 0,void 0,function*(){return this.request("PATCH",e,r,i||{})})}put(e,r,i){return de(this,void 0,void 0,function*(){return this.request("PUT",e,r,i||{})})}head(e,r){return de(this,void 0,void 0,function*(){return this.request("HEAD",e,null,r||{})})}sendStream(e,r,i,n){return de(this,void 0,void 0,function*(){return this.request(e,r,i,n)})}getJson(e,r={}){return de(this,void 0,void 0,function*(){r[be.Accept]=this._getExistingOrDefaultHeader(r,be.Accept,_t.ApplicationJson);let i=yield this.get(e,r);return this._processResponse(i,this.requestOptions)})}postJson(e,r,i={}){return de(this,void 0,void 0,function*(){let n=JSON.stringify(r,null,2);i[be.Accept]=this._getExistingOrDefaultHeader(i,be.Accept,_t.ApplicationJson),i[be.ContentType]=this._getExistingOrDefaultHeader(i,be.ContentType,_t.ApplicationJson);let s=yield this.post(e,n,i);return this._processResponse(s,this.requestOptions)})}putJson(e,r,i={}){return de(this,void 0,void 0,function*(){let n=JSON.stringify(r,null,2);i[be.Accept]=this._getExistingOrDefaultHeader(i,be.Accept,_t.ApplicationJson),i[be.ContentType]=this._getExistingOrDefaultHeader(i,be.ContentType,_t.ApplicationJson);let s=yield this.put(e,n,i);return this._processResponse(s,this.requestOptions)})}patchJson(e,r,i={}){return de(this,void 0,void 0,function*(){let n=JSON.stringify(r,null,2);i[be.Accept]=this._getExistingOrDefaultHeader(i,be.Accept,_t.ApplicationJson),i[be.ContentType]=this._getExistingOrDefaultHeader(i,be.ContentType,_t.ApplicationJson);let s=yield this.patch(e,n,i);return this._processResponse(s,this.requestOptions)})}request(e,r,i,n){return de(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let s=new URL(r),o=this._prepareRequest(e,s,n),a=this._allowRetries&&Ef.includes(e)?this._maxRetries+1:1,u=0,c;do{if(c=yield this.requestRaw(o,i),c&&c.message&&c.message.statusCode===We.Unauthorized){let h;for(let g of this.handlers)if(g.canHandleAuthentication(c)){h=g;break}return h?h.handleAuthentication(this,o,i):c}let l=this._maxRedirects;for(;c.message.statusCode&&yf.includes(c.message.statusCode)&&this._allowRedirects&&l>0;){let h=c.message.headers.location;if(!h)break;let g=new URL(h);if(s.protocol==="https:"&&s.protocol!==g.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield c.readBody(),g.hostname!==s.hostname)for(let b in n)b.toLowerCase()==="authorization"&&delete n[b];o=this._prepareRequest(e,g,n),c=yield this.requestRaw(o,i),l--}if(!c.message.statusCode||!gf.includes(c.message.statusCode))return c;u+=1,u{function s(o,a){o?n(o):a?i(a):n(new Error("Unknown error"))}this.requestRawWithCallback(e,r,s)})})}requestRawWithCallback(e,r,i){typeof r=="string"&&(e.options.headers||(e.options.headers={}),e.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8"));let n=!1;function s(u,c){n||(n=!0,i(u,c))}let o=e.httpModule.request(e.options,u=>{let c=new Ki(u);s(void 0,c)}),a;o.on("socket",u=>{a=u}),o.setTimeout(this._socketTimeout||3*6e4,()=>{a&&a.end(),s(new Error(`Request timeout: ${e.options.path}`))}),o.on("error",function(u){s(u)}),r&&typeof r=="string"&&o.write(r,"utf8"),r&&typeof r!="string"?(r.on("close",function(){o.end()}),r.pipe(o)):o.end()}getAgent(e){let r=new URL(e);return this._getAgent(r)}_prepareRequest(e,r,i){let n={};n.parsedUrl=r;let s=n.parsedUrl.protocol==="https:";n.httpModule=s?zi:jr;let o=s?443:80;if(n.options={},n.options.host=n.parsedUrl.hostname,n.options.port=n.parsedUrl.port?parseInt(n.parsedUrl.port):o,n.options.path=(n.parsedUrl.pathname||"")+(n.parsedUrl.search||""),n.options.method=e,n.options.headers=this._mergeHeaders(i),this.userAgent!=null&&(n.options.headers["user-agent"]=this.userAgent),n.options.agent=this._getAgent(n.parsedUrl),this.handlers)for(let a of this.handlers)a.prepareRequest(n.options);return n}_mergeHeaders(e){return this.requestOptions&&this.requestOptions.headers?Object.assign({},Xr(this.requestOptions.headers),Xr(e||{})):Xr(e||{})}_getExistingOrDefaultHeader(e,r,i){let n;return this.requestOptions&&this.requestOptions.headers&&(n=Xr(this.requestOptions.headers)[r]),e[r]||n||i}_getAgent(e){let r,i=gs.getProxyUrl(e),n=i&&i.hostname;if(this._keepAlive&&n&&(r=this._proxyAgent),this._keepAlive&&!n&&(r=this._agent),r)return r;let s=e.protocol==="https:",o=100;if(this.requestOptions&&(o=this.requestOptions.maxSockets||jr.globalAgent.maxSockets),i&&i.hostname){let a={maxSockets:o,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(i.username||i.password)&&{proxyAuth:`${i.username}:${i.password}`}),{host:i.hostname,port:i.port})},u,c=i.protocol==="https:";s?u=c?Vr.httpsOverHttps:Vr.httpsOverHttp:u=c?Vr.httpOverHttps:Vr.httpOverHttp,r=u(a),this._proxyAgent=r}if(this._keepAlive&&!r){let a={keepAlive:this._keepAlive,maxSockets:o};r=s?new zi.Agent(a):new jr.Agent(a),this._agent=r}return r||(r=s?zi.globalAgent:jr.globalAgent),s&&this._ignoreSslError&&(r.options=Object.assign(r.options||{},{rejectUnauthorized:!1})),r}_performExponentialBackoff(e){return de(this,void 0,void 0,function*(){e=Math.min(Sf,e);let r=_f*Math.pow(2,e);return new Promise(i=>setTimeout(()=>i(),r))})}_processResponse(e,r){return de(this,void 0,void 0,function*(){return new Promise((i,n)=>de(this,void 0,void 0,function*(){let s=e.message.statusCode||0,o={statusCode:s,result:null,headers:{}};s===We.NotFound&&i(o);function a(l,h){if(typeof h=="string"){let g=new Date(h);if(!isNaN(g.valueOf()))return g}return h}let u,c;try{c=yield e.readBody(),c&&c.length>0&&(r&&r.deserializeDates?u=JSON.parse(c,a):u=JSON.parse(c),o.result=u),o.headers=e.message.headers}catch(l){}if(s>299){let l;u&&u.message?l=u.message:c&&c.length>0?l=c:l=`Failed request: (${s})`;let h=new er(l,s);h.result=o.result,n(h)}else i(o)}))})}};Z.HttpClient=Es;var Xr=t=>Object.keys(t).reduce((e,r)=>(e[r.toLowerCase()]=t[r],e),{})});var Ts=I(Ye=>{"use strict";var Gi=Ye&&Ye.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(h){o(h)}}function u(l){try{c(i.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.PersonalAccessTokenCredentialHandler=Ye.BearerCredentialHandler=Ye.BasicCredentialHandler=void 0;var _s=class{constructor(e,r){this.username=e,this.password=r}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Gi(this,void 0,void 0,function*(){throw new Error("not implemented")})}};Ye.BasicCredentialHandler=_s;var ws=class{constructor(e){this.token=e}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return Gi(this,void 0,void 0,function*(){throw new Error("not implemented")})}};Ye.BearerCredentialHandler=ws;var Cs=class{constructor(e){this.token=e}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return Gi(this,void 0,void 0,function*(){throw new Error("not implemented")})}};Ye.PersonalAccessTokenCredentialHandler=Cs});var xs=I(zt=>{"use strict";var bs=zt&&zt.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(h){o(h)}}function u(l){try{c(i.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(zt,"__esModule",{value:!0});zt.OidcClient=void 0;var Cf=Ss(),Tf=Ts(),As=$i(),It=class{static createHttpClient(e=!0,r=10){let i={allowRetries:e,maxRetries:r};return new Cf.HttpClient("actions/oidc-client",[new Tf.BearerCredentialHandler(It.getRequestToken())],i)}static getRequestToken(){let e=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return e}static getIDTokenUrl(){let e=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!e)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return e}static getCall(e){var r;return bs(this,void 0,void 0,function*(){let s=(r=(yield It.createHttpClient().getJson(e).catch(o=>{throw new Error(`Failed to get ID Token. +"use strict";var Xf=Object.create;var Zr=Object.defineProperty;var Gf=Object.getOwnPropertyDescriptor;var $f=Object.getOwnPropertyNames;var Yf=Object.getPrototypeOf,Jf=Object.prototype.hasOwnProperty;var be=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Qf=(t,e)=>{for(var r in e)Zr(t,r,{get:e[r],enumerable:!0})},Os=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $f(e))!Jf.call(t,n)&&n!==r&&Zr(t,n,{get:()=>e[n],enumerable:!(i=Gf(e,n))||i.enumerable});return t};var fr=(t,e,r)=>(r=t!=null?Xf(Yf(t)):{},Os(e||!t||!t.__esModule?Zr(r,"default",{value:t,enumerable:!0}):r,t)),Zf=t=>Os(Zr({},"__esModule",{value:!0}),t);var ei=I(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.toCommandProperties=Jt.toCommandValue=void 0;function ep(t){return t==null?"":typeof t=="string"||t instanceof String?t:JSON.stringify(t)}Jt.toCommandValue=ep;function tp(t){return Object.keys(t).length?{title:t.title,file:t.file,line:t.startLine,endLine:t.endLine,col:t.startColumn,endColumn:t.endColumn}:{}}Jt.toCommandProperties=tp});var Bs=I(Ue=>{"use strict";var rp=Ue&&Ue.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),ip=Ue&&Ue.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),np=Ue&&Ue.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&rp(e,t,r);return ip(e,t),e};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.issue=Ue.issueCommand=void 0;var sp=np(require("os")),Ms=ei();function Fs(t,e,r){let i=new cn(t,e,r);process.stdout.write(i.toString()+sp.EOL)}Ue.issueCommand=Fs;function op(t,e=""){Fs(t,{},e)}Ue.issue=op;var Ls="::",cn=class{constructor(e,r,i){e||(e="missing.command"),this.command=e,this.properties=r,this.message=i}toString(){let e=Ls+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=!0;for(let i in this.properties)if(this.properties.hasOwnProperty(i)){let n=this.properties[i];n&&(r?r=!1:e+=",",e+=`${i}=${up(n)}`)}}return e+=`${Ls}${ap(this.message)}`,e}};function ap(t){return Ms.toCommandValue(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function up(t){return Ms.toCommandValue(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}});function pr(){return ti>ri.length-16&&(Us.default.randomFillSync(ri),ti=0),ri.slice(ti,ti+=16)}var Us,ri,ti,ln=be(()=>{Us=fr(require("crypto")),ri=new Uint8Array(256),ti=ri.length});var Vs,js=be(()=>{Vs=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function cp(t){return typeof t=="string"&&Vs.test(t)}var _t,dr=be(()=>{js();_t=cp});function lp(t,e=0){let r=(ye[t[e+0]]+ye[t[e+1]]+ye[t[e+2]]+ye[t[e+3]]+"-"+ye[t[e+4]]+ye[t[e+5]]+"-"+ye[t[e+6]]+ye[t[e+7]]+"-"+ye[t[e+8]]+ye[t[e+9]]+"-"+ye[t[e+10]]+ye[t[e+11]]+ye[t[e+12]]+ye[t[e+13]]+ye[t[e+14]]+ye[t[e+15]]).toLowerCase();if(!_t(r))throw TypeError("Stringified UUID is invalid");return r}var ye,At,hr=be(()=>{dr();ye=[];for(let t=0;t<256;++t)ye.push((t+256).toString(16).substr(1));At=lp});function fp(t,e,r){let i=e&&r||0,n=e||new Array(16);t=t||{};let s=t.node||Ws,o=t.clockseq!==void 0?t.clockseq:fn;if(s==null||o==null){let v=t.random||(t.rng||pr)();s==null&&(s=Ws=[v[0]|1,v[1],v[2],v[3],v[4],v[5]]),o==null&&(o=fn=(v[6]<<8|v[7])&16383)}let a=t.msecs!==void 0?t.msecs:Date.now(),u=t.nsecs!==void 0?t.nsecs:dn+1,c=a-pn+(u-dn)/1e4;if(c<0&&t.clockseq===void 0&&(o=o+1&16383),(c<0||a>pn)&&t.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");pn=a,dn=u,fn=o,a+=122192928e5;let l=((a&268435455)*1e4+u)%4294967296;n[i++]=l>>>24&255,n[i++]=l>>>16&255,n[i++]=l>>>8&255,n[i++]=l&255;let d=a/4294967296*1e4&268435455;n[i++]=d>>>8&255,n[i++]=d&255,n[i++]=d>>>24&15|16,n[i++]=d>>>16&255,n[i++]=o>>>8|128,n[i++]=o&255;for(let v=0;v<6;++v)n[i+v]=s[v];return e||At(n)}var Ws,fn,pn,dn,Hs,zs=be(()=>{ln();hr();pn=0,dn=0;Hs=fp});function pp(t){if(!_t(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var ii,hn=be(()=>{dr();ii=pp});function dp(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;r{hr();hn();hp="6ba7b810-9dad-11d1-80b4-00c04fd430c8",mp="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function vp(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),Ks.default.createHash("md5").update(t).digest()}var Ks,Xs,Gs=be(()=>{Ks=fr(require("crypto"));Xs=vp});var gp,$s,Ys=be(()=>{mn();Gs();gp=ni("v3",48,Xs),$s=gp});function yp(t,e,r){t=t||{};let i=t.random||(t.rng||pr)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){r=r||0;for(let n=0;n<16;++n)e[r+n]=i[n];return e}return At(i)}var Js,Qs=be(()=>{ln();hr();Js=yp});function Ep(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),Zs.default.createHash("sha1").update(t).digest()}var Zs,eo,to=be(()=>{Zs=fr(require("crypto"));eo=Ep});var Sp,ro,io=be(()=>{mn();to();Sp=ni("v5",80,eo),ro=Sp});var no,so=be(()=>{no="00000000-0000-0000-0000-000000000000"});function wp(t){if(!_t(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}var oo,ao=be(()=>{dr();oo=wp});var uo={};Qf(uo,{NIL:()=>no,parse:()=>ii,stringify:()=>At,v1:()=>Hs,v3:()=>$s,v4:()=>Js,v5:()=>ro,validate:()=>_t,version:()=>oo});var co=be(()=>{zs();Ys();Qs();io();so();ao();dr();hr();hn()});var ho=I(Ve=>{"use strict";var Cp=Ve&&Ve.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Tp=Ve&&Ve.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fo=Ve&&Ve.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Cp(e,t,r);return Tp(e,t),e};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.prepareKeyValueMessage=Ve.issueFileCommand=void 0;var lo=fo(require("fs")),vn=fo(require("os")),_p=(co(),Zf(uo)),po=ei();function Ap(t,e){let r=process.env[`GITHUB_${t}`];if(!r)throw new Error(`Unable to find environment variable for file command ${t}`);if(!lo.existsSync(r))throw new Error(`Missing file at path: ${r}`);lo.appendFileSync(r,`${po.toCommandValue(e)}${vn.EOL}`,{encoding:"utf8"})}Ve.issueFileCommand=Ap;function xp(t,e){let r=`ghadelimiter_${_p.v4()}`,i=po.toCommandValue(e);if(t.includes(r))throw new Error(`Unexpected input: name should not contain the delimiter "${r}"`);if(i.includes(r))throw new Error(`Unexpected input: value should not contain the delimiter "${r}"`);return`${t}<<${r}${vn.EOL}${i}${vn.EOL}${r}`}Ve.prepareKeyValueMessage=xp});var vo=I(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.checkBypass=Qt.getProxyUrl=void 0;function bp(t){let e=t.protocol==="https:";if(mo(t))return;let r=(()=>e?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY)();if(r)return new URL(r)}Qt.getProxyUrl=bp;function mo(t){if(!t.hostname)return!1;let e=t.hostname;if(Rp(e))return!0;let r=process.env.no_proxy||process.env.NO_PROXY||"";if(!r)return!1;let i;t.port?i=Number(t.port):t.protocol==="http:"?i=80:t.protocol==="https:"&&(i=443);let n=[t.hostname.toUpperCase()];typeof i=="number"&&n.push(`${n[0]}:${i}`);for(let s of r.split(",").map(o=>o.trim().toUpperCase()).filter(o=>o))if(s==="*"||n.some(o=>o===s||o.endsWith(`.${s}`)||s.startsWith(".")&&o.endsWith(`${s}`)))return!0;return!1}Qt.checkBypass=mo;function Rp(t){let e=t.toLowerCase();return e==="localhost"||e.startsWith("127.")||e.startsWith("[::1]")||e.startsWith("[0:0:0:0:0:0:0:1]")}});var So=I(Zt=>{"use strict";var Qy=require("net"),Ip=require("tls"),gn=require("http"),go=require("https"),Pp=require("events"),Zy=require("assert"),Np=require("util");Zt.httpOverHttp=Dp;Zt.httpsOverHttp=qp;Zt.httpOverHttps=kp;Zt.httpsOverHttps=Op;function Dp(t){var e=new ht(t);return e.request=gn.request,e}function qp(t){var e=new ht(t);return e.request=gn.request,e.createSocket=yo,e.defaultPort=443,e}function kp(t){var e=new ht(t);return e.request=go.request,e}function Op(t){var e=new ht(t);return e.request=go.request,e.createSocket=yo,e.defaultPort=443,e}function ht(t){var e=this;e.options=t||{},e.proxyOptions=e.options.proxy||{},e.maxSockets=e.options.maxSockets||gn.Agent.defaultMaxSockets,e.requests=[],e.sockets=[],e.on("free",function(i,n,s,o){for(var a=Eo(n,s,o),u=0,c=e.requests.length;u=this.maxSockets){s.requests.push(o);return}s.createSocket(o,function(a){a.on("free",u),a.on("close",c),a.on("agentRemove",c),e.onSocket(a);function u(){s.emit("free",a,o)}function c(l){s.removeSocket(a),a.removeListener("free",u),a.removeListener("close",c),a.removeListener("agentRemove",c)}})};ht.prototype.createSocket=function(e,r){var i=this,n={};i.sockets.push(n);var s=yn({},i.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(s.localAddress=e.localAddress),s.proxyAuth&&(s.headers=s.headers||{},s.headers["Proxy-Authorization"]="Basic "+new Buffer(s.proxyAuth).toString("base64")),xt("making CONNECT request");var o=i.request(s);o.useChunkedEncodingByDefault=!1,o.once("response",a),o.once("upgrade",u),o.once("connect",c),o.once("error",l),o.end();function a(d){d.upgrade=!0}function u(d,v,A){process.nextTick(function(){c(d,v,A)})}function c(d,v,A){if(o.removeAllListeners(),v.removeAllListeners(),d.statusCode!==200){xt("tunneling socket could not be established, statusCode=%d",d.statusCode),v.destroy();var g=new Error("tunneling socket could not be established, statusCode="+d.statusCode);g.code="ECONNRESET",e.request.emit("error",g),i.removeSocket(n);return}if(A.length>0){xt("got illegal response body from proxy"),v.destroy();var g=new Error("got illegal response body from proxy");g.code="ECONNRESET",e.request.emit("error",g),i.removeSocket(n);return}return xt("tunneling connection has established"),i.sockets[i.sockets.indexOf(n)]=v,r(v)}function l(d){o.removeAllListeners(),xt(`tunneling socket could not be established, cause=%s +`,d.message,d.stack);var v=new Error("tunneling socket could not be established, cause="+d.message);v.code="ECONNRESET",e.request.emit("error",v),i.removeSocket(n)}};ht.prototype.removeSocket=function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var i=this.requests.shift();i&&this.createSocket(i,function(n){i.request.onSocket(n)})}};function yo(t,e){var r=this;ht.prototype.createSocket.call(r,t,function(i){var n=t.request.getHeader("host"),s=yn({},r.options,{socket:i,servername:n?n.replace(/:.*$/,""):t.host}),o=Ip.connect(0,s);r.sockets[r.sockets.indexOf(i)]=o,e(o)})}function Eo(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}function yn(t){for(var e=1,r=arguments.length;e{wo.exports=So()});var _o=I(Z=>{"use strict";var Lp=Z&&Z.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Mp=Z&&Z.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ci=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Lp(e,t,r);return Mp(e,t),e},he=Z&&Z.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(Z,"__esModule",{value:!0});Z.HttpClient=Z.isHttps=Z.HttpClientResponse=Z.HttpClientError=Z.getProxyUrl=Z.MediaTypes=Z.Headers=Z.HttpCodes=void 0;var si=ci(require("http")),En=ci(require("https")),To=ci(vo()),oi=ci(Co()),Ge;(function(t){t[t.OK=200]="OK",t[t.MultipleChoices=300]="MultipleChoices",t[t.MovedPermanently=301]="MovedPermanently",t[t.ResourceMoved=302]="ResourceMoved",t[t.SeeOther=303]="SeeOther",t[t.NotModified=304]="NotModified",t[t.UseProxy=305]="UseProxy",t[t.SwitchProxy=306]="SwitchProxy",t[t.TemporaryRedirect=307]="TemporaryRedirect",t[t.PermanentRedirect=308]="PermanentRedirect",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.PaymentRequired=402]="PaymentRequired",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.MethodNotAllowed=405]="MethodNotAllowed",t[t.NotAcceptable=406]="NotAcceptable",t[t.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.TooManyRequests=429]="TooManyRequests",t[t.InternalServerError=500]="InternalServerError",t[t.NotImplemented=501]="NotImplemented",t[t.BadGateway=502]="BadGateway",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout"})(Ge=Z.HttpCodes||(Z.HttpCodes={}));var Re;(function(t){t.Accept="accept",t.ContentType="content-type"})(Re=Z.Headers||(Z.Headers={}));var bt;(function(t){t.ApplicationJson="application/json"})(bt=Z.MediaTypes||(Z.MediaTypes={}));function Fp(t){let e=To.getProxyUrl(new URL(t));return e?e.href:""}Z.getProxyUrl=Fp;var Bp=[Ge.MovedPermanently,Ge.ResourceMoved,Ge.SeeOther,Ge.TemporaryRedirect,Ge.PermanentRedirect],Up=[Ge.BadGateway,Ge.ServiceUnavailable,Ge.GatewayTimeout],Vp=["OPTIONS","GET","DELETE","HEAD"],jp=10,Wp=5,er=class extends Error{constructor(e,r){super(e),this.name="HttpClientError",this.statusCode=r,Object.setPrototypeOf(this,er.prototype)}};Z.HttpClientError=er;var ui=class{constructor(e){this.message=e}readBody(){return he(this,void 0,void 0,function*(){return new Promise(e=>he(this,void 0,void 0,function*(){let r=Buffer.alloc(0);this.message.on("data",i=>{r=Buffer.concat([r,i])}),this.message.on("end",()=>{e(r.toString())})}))})}};Z.HttpClientResponse=ui;function Hp(t){return new URL(t).protocol==="https:"}Z.isHttps=Hp;var Sn=class{constructor(e,r,i){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=e,this.handlers=r||[],this.requestOptions=i,i&&(i.ignoreSslError!=null&&(this._ignoreSslError=i.ignoreSslError),this._socketTimeout=i.socketTimeout,i.allowRedirects!=null&&(this._allowRedirects=i.allowRedirects),i.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=i.allowRedirectDowngrade),i.maxRedirects!=null&&(this._maxRedirects=Math.max(i.maxRedirects,0)),i.keepAlive!=null&&(this._keepAlive=i.keepAlive),i.allowRetries!=null&&(this._allowRetries=i.allowRetries),i.maxRetries!=null&&(this._maxRetries=i.maxRetries))}options(e,r){return he(this,void 0,void 0,function*(){return this.request("OPTIONS",e,null,r||{})})}get(e,r){return he(this,void 0,void 0,function*(){return this.request("GET",e,null,r||{})})}del(e,r){return he(this,void 0,void 0,function*(){return this.request("DELETE",e,null,r||{})})}post(e,r,i){return he(this,void 0,void 0,function*(){return this.request("POST",e,r,i||{})})}patch(e,r,i){return he(this,void 0,void 0,function*(){return this.request("PATCH",e,r,i||{})})}put(e,r,i){return he(this,void 0,void 0,function*(){return this.request("PUT",e,r,i||{})})}head(e,r){return he(this,void 0,void 0,function*(){return this.request("HEAD",e,null,r||{})})}sendStream(e,r,i,n){return he(this,void 0,void 0,function*(){return this.request(e,r,i,n)})}getJson(e,r={}){return he(this,void 0,void 0,function*(){r[Re.Accept]=this._getExistingOrDefaultHeader(r,Re.Accept,bt.ApplicationJson);let i=yield this.get(e,r);return this._processResponse(i,this.requestOptions)})}postJson(e,r,i={}){return he(this,void 0,void 0,function*(){let n=JSON.stringify(r,null,2);i[Re.Accept]=this._getExistingOrDefaultHeader(i,Re.Accept,bt.ApplicationJson),i[Re.ContentType]=this._getExistingOrDefaultHeader(i,Re.ContentType,bt.ApplicationJson);let s=yield this.post(e,n,i);return this._processResponse(s,this.requestOptions)})}putJson(e,r,i={}){return he(this,void 0,void 0,function*(){let n=JSON.stringify(r,null,2);i[Re.Accept]=this._getExistingOrDefaultHeader(i,Re.Accept,bt.ApplicationJson),i[Re.ContentType]=this._getExistingOrDefaultHeader(i,Re.ContentType,bt.ApplicationJson);let s=yield this.put(e,n,i);return this._processResponse(s,this.requestOptions)})}patchJson(e,r,i={}){return he(this,void 0,void 0,function*(){let n=JSON.stringify(r,null,2);i[Re.Accept]=this._getExistingOrDefaultHeader(i,Re.Accept,bt.ApplicationJson),i[Re.ContentType]=this._getExistingOrDefaultHeader(i,Re.ContentType,bt.ApplicationJson);let s=yield this.patch(e,n,i);return this._processResponse(s,this.requestOptions)})}request(e,r,i,n){return he(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");let s=new URL(r),o=this._prepareRequest(e,s,n),a=this._allowRetries&&Vp.includes(e)?this._maxRetries+1:1,u=0,c;do{if(c=yield this.requestRaw(o,i),c&&c.message&&c.message.statusCode===Ge.Unauthorized){let d;for(let v of this.handlers)if(v.canHandleAuthentication(c)){d=v;break}return d?d.handleAuthentication(this,o,i):c}let l=this._maxRedirects;for(;c.message.statusCode&&Bp.includes(c.message.statusCode)&&this._allowRedirects&&l>0;){let d=c.message.headers.location;if(!d)break;let v=new URL(d);if(s.protocol==="https:"&&s.protocol!==v.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield c.readBody(),v.hostname!==s.hostname)for(let A in n)A.toLowerCase()==="authorization"&&delete n[A];o=this._prepareRequest(e,v,n),c=yield this.requestRaw(o,i),l--}if(!c.message.statusCode||!Up.includes(c.message.statusCode))return c;u+=1,u{function s(o,a){o?n(o):a?i(a):n(new Error("Unknown error"))}this.requestRawWithCallback(e,r,s)})})}requestRawWithCallback(e,r,i){typeof r=="string"&&(e.options.headers||(e.options.headers={}),e.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8"));let n=!1;function s(u,c){n||(n=!0,i(u,c))}let o=e.httpModule.request(e.options,u=>{let c=new ui(u);s(void 0,c)}),a;o.on("socket",u=>{a=u}),o.setTimeout(this._socketTimeout||3*6e4,()=>{a&&a.end(),s(new Error(`Request timeout: ${e.options.path}`))}),o.on("error",function(u){s(u)}),r&&typeof r=="string"&&o.write(r,"utf8"),r&&typeof r!="string"?(r.on("close",function(){o.end()}),r.pipe(o)):o.end()}getAgent(e){let r=new URL(e);return this._getAgent(r)}_prepareRequest(e,r,i){let n={};n.parsedUrl=r;let s=n.parsedUrl.protocol==="https:";n.httpModule=s?En:si;let o=s?443:80;if(n.options={},n.options.host=n.parsedUrl.hostname,n.options.port=n.parsedUrl.port?parseInt(n.parsedUrl.port):o,n.options.path=(n.parsedUrl.pathname||"")+(n.parsedUrl.search||""),n.options.method=e,n.options.headers=this._mergeHeaders(i),this.userAgent!=null&&(n.options.headers["user-agent"]=this.userAgent),n.options.agent=this._getAgent(n.parsedUrl),this.handlers)for(let a of this.handlers)a.prepareRequest(n.options);return n}_mergeHeaders(e){return this.requestOptions&&this.requestOptions.headers?Object.assign({},ai(this.requestOptions.headers),ai(e||{})):ai(e||{})}_getExistingOrDefaultHeader(e,r,i){let n;return this.requestOptions&&this.requestOptions.headers&&(n=ai(this.requestOptions.headers)[r]),e[r]||n||i}_getAgent(e){let r,i=To.getProxyUrl(e),n=i&&i.hostname;if(this._keepAlive&&n&&(r=this._proxyAgent),this._keepAlive&&!n&&(r=this._agent),r)return r;let s=e.protocol==="https:",o=100;if(this.requestOptions&&(o=this.requestOptions.maxSockets||si.globalAgent.maxSockets),i&&i.hostname){let a={maxSockets:o,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(i.username||i.password)&&{proxyAuth:`${i.username}:${i.password}`}),{host:i.hostname,port:i.port})},u,c=i.protocol==="https:";s?u=c?oi.httpsOverHttps:oi.httpsOverHttp:u=c?oi.httpOverHttps:oi.httpOverHttp,r=u(a),this._proxyAgent=r}if(this._keepAlive&&!r){let a={keepAlive:this._keepAlive,maxSockets:o};r=s?new En.Agent(a):new si.Agent(a),this._agent=r}return r||(r=s?En.globalAgent:si.globalAgent),s&&this._ignoreSslError&&(r.options=Object.assign(r.options||{},{rejectUnauthorized:!1})),r}_performExponentialBackoff(e){return he(this,void 0,void 0,function*(){e=Math.min(jp,e);let r=Wp*Math.pow(2,e);return new Promise(i=>setTimeout(()=>i(),r))})}_processResponse(e,r){return he(this,void 0,void 0,function*(){return new Promise((i,n)=>he(this,void 0,void 0,function*(){let s=e.message.statusCode||0,o={statusCode:s,result:null,headers:{}};s===Ge.NotFound&&i(o);function a(l,d){if(typeof d=="string"){let v=new Date(d);if(!isNaN(v.valueOf()))return v}return d}let u,c;try{c=yield e.readBody(),c&&c.length>0&&(r&&r.deserializeDates?u=JSON.parse(c,a):u=JSON.parse(c),o.result=u),o.headers=e.message.headers}catch{}if(s>299){let l;u&&u.message?l=u.message:c&&c.length>0?l=c:l=`Failed request: (${s})`;let d=new er(l,s);d.result=o.result,n(d)}else i(o)}))})}};Z.HttpClient=Sn;var ai=t=>Object.keys(t).reduce((e,r)=>(e[r.toLowerCase()]=t[r],e),{})});var Ao=I(tt=>{"use strict";var _n=tt&&tt.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(tt,"__esModule",{value:!0});tt.PersonalAccessTokenCredentialHandler=tt.BearerCredentialHandler=tt.BasicCredentialHandler=void 0;var wn=class{constructor(e,r){this.username=e,this.password=r}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return _n(this,void 0,void 0,function*(){throw new Error("not implemented")})}};tt.BasicCredentialHandler=wn;var Cn=class{constructor(e){this.token=e}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return _n(this,void 0,void 0,function*(){throw new Error("not implemented")})}};tt.BearerCredentialHandler=Cn;var Tn=class{constructor(e){this.token=e}prepareRequest(e){if(!e.headers)throw Error("The request has no headers");e.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return _n(this,void 0,void 0,function*(){throw new Error("not implemented")})}};tt.PersonalAccessTokenCredentialHandler=Tn});var Ro=I(tr=>{"use strict";var xo=tr&&tr.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(tr,"__esModule",{value:!0});tr.OidcClient=void 0;var zp=_o(),Kp=Ao(),bo=An(),Rt=class{static createHttpClient(e=!0,r=10){let i={allowRetries:e,maxRetries:r};return new zp.HttpClient("actions/oidc-client",[new Kp.BearerCredentialHandler(Rt.getRequestToken())],i)}static getRequestToken(){let e=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!e)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return e}static getIDTokenUrl(){let e=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!e)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return e}static getCall(e){var r;return xo(this,void 0,void 0,function*(){let s=(r=(yield Rt.createHttpClient().getJson(e).catch(o=>{throw new Error(`Failed to get ID Token. Error Code : ${o.statusCode} - Error Message: ${o.result.message}`)})).result)===null||r===void 0?void 0:r.value;if(!s)throw new Error("Response json body do not have ID Token field");return s})}static getIDToken(e){return bs(this,void 0,void 0,function*(){try{let r=It.getIDTokenUrl();if(e){let n=encodeURIComponent(e);r=`${r}&audience=${n}`}As.debug(`ID token url is ${r}`);let i=yield It.getCall(r);return As.setSecret(i),i}catch(r){throw new Error(`Error message: ${r.message}`)}})}};zt.OidcClient=It});var Qi=I(Re=>{"use strict";var Yi=Re&&Re.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(h){o(h)}}function u(l){try{c(i.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(Re,"__esModule",{value:!0});Re.summary=Re.markdownSummary=Re.SUMMARY_DOCS_URL=Re.SUMMARY_ENV_VAR=void 0;var bf=require("os"),Ji=require("fs"),{access:Af,appendFile:xf,writeFile:Rf}=Ji.promises;Re.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";Re.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Rs=class{constructor(){this._buffer=""}filePath(){return Yi(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let e=process.env[Re.SUMMARY_ENV_VAR];if(!e)throw new Error(`Unable to find environment variable for $${Re.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield Af(e,Ji.constants.R_OK|Ji.constants.W_OK)}catch(r){throw new Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}return this._filePath=e,this._filePath})}wrap(e,r,i={}){let n=Object.entries(i).map(([s,o])=>` ${s}="${o}"`).join("");return r?`<${e}${n}>${r}`:`<${e}${n}>`}write(e){return Yi(this,void 0,void 0,function*(){let r=!!(e==null?void 0:e.overwrite),i=yield this.filePath();return yield(r?Rf:xf)(i,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return Yi(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(e,r=!1){return this._buffer+=e,r?this.addEOL():this}addEOL(){return this.addRaw(bf.EOL)}addCodeBlock(e,r){let i=Object.assign({},r&&{lang:r}),n=this.wrap("pre",this.wrap("code",e),i);return this.addRaw(n).addEOL()}addList(e,r=!1){let i=r?"ol":"ul",n=e.map(o=>this.wrap("li",o)).join(""),s=this.wrap(i,n);return this.addRaw(s).addEOL()}addTable(e){let r=e.map(n=>{let s=n.map(o=>{if(typeof o=="string")return this.wrap("td",o);let{header:a,data:u,colspan:c,rowspan:l}=o,h=a?"th":"td",g=Object.assign(Object.assign({},c&&{colspan:c}),l&&{rowspan:l});return this.wrap(h,u,g)}).join("");return this.wrap("tr",s)}).join(""),i=this.wrap("table",r);return this.addRaw(i).addEOL()}addDetails(e,r){let i=this.wrap("details",this.wrap("summary",e)+r);return this.addRaw(i).addEOL()}addImage(e,r,i){let{width:n,height:s}=i||{},o=Object.assign(Object.assign({},n&&{width:n}),s&&{height:s}),a=this.wrap("img",null,Object.assign({src:e,alt:r},o));return this.addRaw(a).addEOL()}addHeading(e,r){let i=`h${r}`,n=["h1","h2","h3","h4","h5","h6"].includes(i)?i:"h1",s=this.wrap(n,e);return this.addRaw(s).addEOL()}addSeparator(){let e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){let e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,r){let i=Object.assign({},r&&{cite:r}),n=this.wrap("blockquote",e,i);return this.addRaw(n).addEOL()}addLink(e,r){let i=this.wrap("a",e,{href:r});return this.addRaw(i).addEOL()}},Is=new Rs;Re.markdownSummary=Is;Re.summary=Is});var Ds=I(Ie=>{"use strict";var If=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Df=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nf=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&If(e,t,r);return Df(e,t),e};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.toPlatformPath=Ie.toWin32Path=Ie.toPosixPath=void 0;var Pf=Nf(require("path"));function qf(t){return t.replace(/[\\]/g,"/")}Ie.toPosixPath=qf;function Of(t){return t.replace(/[/]/g,"\\")}Ie.toWin32Path=Of;function Lf(t){return t.replace(/[/\\]/g,Pf.sep)}Ie.toPlatformPath=Lf});var $i=I(U=>{"use strict";var kf=U&&U.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Mf=U&&U.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ns=U&&U.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&kf(e,t,r);return Mf(e,t),e},Ps=U&&U.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(h){o(h)}}function u(l){try{c(i.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(U,"__esModule",{value:!0});U.getIDToken=U.getState=U.saveState=U.group=U.endGroup=U.startGroup=U.info=U.notice=U.warning=U.error=U.debug=U.isDebug=U.setFailed=U.setCommandEcho=U.setOutput=U.getBooleanInput=U.getMultilineInput=U.getInput=U.addPath=U.setSecret=U.exportVariable=U.ExitCode=void 0;var Fe=os(),qs=cs(),Wr=Br(),Hr=Ns(require("os")),Ff=Ns(require("path")),Bf=xs(),Os;(function(t){t[t.Success=0]="Success",t[t.Failure=1]="Failure"})(Os=U.ExitCode||(U.ExitCode={}));function Uf(t,e){let r=Wr.toCommandValue(e);if(process.env[t]=r,process.env.GITHUB_ENV||""){let n="_GitHubActionsFileCommandDelimeter_",s=`${t}<<${n}${Hr.EOL}${r}${Hr.EOL}${n}`;qs.issueCommand("ENV",s)}else Fe.issueCommand("set-env",{name:t},r)}U.exportVariable=Uf;function jf(t){Fe.issueCommand("add-mask",{},t)}U.setSecret=jf;function Vf(t){process.env.GITHUB_PATH||""?qs.issueCommand("PATH",t):Fe.issueCommand("add-path",{},t),process.env.PATH=`${t}${Ff.delimiter}${process.env.PATH}`}U.addPath=Vf;function Zi(t,e){let r=process.env[`INPUT_${t.replace(/ /g,"_").toUpperCase()}`]||"";if(e&&e.required&&!r)throw new Error(`Input required and not supplied: ${t}`);return e&&e.trimWhitespace===!1?r:r.trim()}U.getInput=Zi;function Xf(t,e){return Zi(t,e).split(` -`).filter(i=>i!=="")}U.getMultilineInput=Xf;function Wf(t,e){let r=["true","True","TRUE"],i=["false","False","FALSE"],n=Zi(t,e);if(r.includes(n))return!0;if(i.includes(n))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${t} -Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}U.getBooleanInput=Wf;function Hf(t,e){process.stdout.write(Hr.EOL),Fe.issueCommand("set-output",{name:t},e)}U.setOutput=Hf;function zf(t){Fe.issue("echo",t?"on":"off")}U.setCommandEcho=zf;function Kf(t){process.exitCode=Os.Failure,Ls(t)}U.setFailed=Kf;function Gf(){return process.env.RUNNER_DEBUG==="1"}U.isDebug=Gf;function $f(t){Fe.issueCommand("debug",{},t)}U.debug=$f;function Ls(t,e={}){Fe.issueCommand("error",Wr.toCommandProperties(e),t instanceof Error?t.toString():t)}U.error=Ls;function Yf(t,e={}){Fe.issueCommand("warning",Wr.toCommandProperties(e),t instanceof Error?t.toString():t)}U.warning=Yf;function Jf(t,e={}){Fe.issueCommand("notice",Wr.toCommandProperties(e),t instanceof Error?t.toString():t)}U.notice=Jf;function Qf(t){process.stdout.write(t+Hr.EOL)}U.info=Qf;function ks(t){Fe.issue("group",t)}U.startGroup=ks;function Ms(){Fe.issue("endgroup")}U.endGroup=Ms;function Zf(t,e){return Ps(this,void 0,void 0,function*(){ks(t);let r;try{r=yield e()}finally{Ms()}return r})}U.group=Zf;function ep(t,e){Fe.issueCommand("save-state",{name:t},e)}U.saveState=ep;function tp(t){return process.env[`STATE_${t}`]||""}U.getState=tp;function rp(t){return Ps(this,void 0,void 0,function*(){return yield Bf.OidcClient.getIDToken(t)})}U.getIDToken=rp;var ip=Qi();Object.defineProperty(U,"summary",{enumerable:!0,get:function(){return ip.summary}});var np=Qi();Object.defineProperty(U,"markdownSummary",{enumerable:!0,get:function(){return np.markdownSummary}});var en=Ds();Object.defineProperty(U,"toPosixPath",{enumerable:!0,get:function(){return en.toPosixPath}});Object.defineProperty(U,"toWin32Path",{enumerable:!0,get:function(){return en.toWin32Path}});Object.defineProperty(U,"toPlatformPath",{enumerable:!0,get:function(){return en.toPlatformPath}})});var Kr=I((Jv,Bs)=>{var tn=le();function Fs(){}Fs.prototype.build=function(t,e){return JSON.stringify(zr(t,e))};function zr(t,e){if(!(!e||t===void 0||t===null))switch(e.type){case"structure":return sp(t,e);case"map":return ap(t,e);case"list":return op(t,e);default:return up(t,e)}}function sp(t,e){if(e.isDocument)return t;var r={};return tn.each(t,function(i,n){var s=e.members[i];if(s){if(s.location!=="body")return;var o=s.isLocationName?s.name:i,a=zr(n,s);a!==void 0&&(r[o]=a)}}),r}function op(t,e){var r=[];return tn.arrayEach(t,function(i){var n=zr(i,e.member);n!==void 0&&r.push(n)}),r}function ap(t,e){var r={};return tn.each(t,function(i,n){var s=zr(n,e.value);s!==void 0&&(r[i]=s)}),r}function up(t,e){return e.toWireFormat(t)}Bs.exports=Fs});var $r=I((Qv,js)=>{var rn=le();function Us(){}Us.prototype.parse=function(t,e){return Gr(JSON.parse(t),e)};function Gr(t,e){if(!(!e||t===void 0))switch(e.type){case"structure":return cp(t,e);case"map":return fp(t,e);case"list":return lp(t,e);default:return pp(t,e)}}function cp(t,e){if(t!=null){if(e.isDocument)return t;var r={},i=e.members;return rn.each(i,function(n,s){var o=s.isLocationName?s.name:n;if(Object.prototype.hasOwnProperty.call(t,o)){var a=t[o],u=Gr(a,s);u!==void 0&&(r[n]=u)}}),r}}function lp(t,e){if(t!=null){var r=[];return rn.arrayEach(t,function(i){var n=Gr(i,e.member);n===void 0?r.push(null):r.push(n)}),r}}function fp(t,e){if(t!=null){var r={};return rn.each(t,function(i,n){var s=Gr(n,e.value);s===void 0?r[i]=null:r[i]=s}),r}}function pp(t,e){return e.toType(t)}js.exports=Us});var Yr=I((Zv,Vs)=>{var tr=le(),dp=j();function hp(t){var e=t.service.config.hostPrefixEnabled;if(!e)return t;var r=t.service.api.operations[t.operation];if(mp(t))return t;if(r.endpoint&&r.endpoint.hostPrefix){var i=r.endpoint.hostPrefix,n=vp(i,t.params,r.input);yp(t.httpRequest.endpoint,n),gp(t.httpRequest.endpoint.hostname)}return t}function mp(t){var e=t.service.api,r=e.operations[t.operation],i=e.endpointOperation&&e.endpointOperation===tr.string.lowerFirst(r.name);return r.endpointDiscoveryRequired!=="NULL"||i===!0}function vp(t,e,r){return tr.each(r.members,function(i,n){if(n.hostLabel===!0){if(typeof e[i]!="string"||e[i]==="")throw tr.error(new Error,{message:"Parameter "+i+" should be a non-empty string.",code:"InvalidParameter"});var s=new RegExp("\\{"+i+"\\}","g");t=t.replace(s,e[i])}}),t}function yp(t,e){t.host&&(t.host=e+t.host),t.hostname&&(t.hostname=e+t.hostname)}function gp(t){var e=t.split("."),r=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;tr.arrayEach(e,function(i){if(!i.length||i.length<1||i.length>63)throw tr.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!r.test(i))throw dp.util.error(new Error,{code:"ValidationError",message:i+" is not hostname compatible."})})}Vs.exports={populateHostPrefix:hp}});var Jr=I((ey,Xs)=>{var Ep=le(),Sp=Kr(),_p=$r(),wp=Yr().populateHostPrefix;function Cp(t){var e=t.httpRequest,r=t.service.api,i=r.targetPrefix+"."+r.operations[t.operation].name,n=r.jsonVersion||"1.0",s=r.operations[t.operation].input,o=new Sp;n===1&&(n="1.0"),e.body=o.build(t.params||{},s),e.headers["Content-Type"]="application/x-amz-json-"+n,e.headers["X-Amz-Target"]=i,wp(t)}function Tp(t){var e={},r=t.httpResponse;if(e.code=r.headers["x-amzn-errortype"]||"UnknownError",typeof e.code=="string"&&(e.code=e.code.split(":")[0]),r.body.length>0)try{var i=JSON.parse(r.body.toString()),n=i.__type||i.code||i.Code;n&&(e.code=n.split("#").pop()),e.code==="RequestEntityTooLarge"?e.message="Request body must be less than 1 MB":e.message=i.message||i.Message||null}catch(s){e.statusCode=r.statusCode,e.message=r.statusMessage}else e.statusCode=r.statusCode,e.message=r.statusCode.toString();t.error=Ep.error(new Error,e)}function bp(t){var e=t.httpResponse.body.toString()||"{}";if(t.request.service.config.convertResponseTypes===!1)t.data=JSON.parse(e);else{var r=t.request.service.api.operations[t.request.operation],i=r.output||{},n=new _p;t.data=n.parse(e,i)}}Xs.exports={buildRequest:Cp,extractError:Tp,extractData:bp}});var Gs=I((ty,Ks)=>{var nn=le();function Ws(){}Ws.prototype.serialize=function(t,e,r){zs("",t,e,r)};function Hs(t){return t.isQueryName||t.api.protocol!=="ec2"?t.name:t.name[0].toUpperCase()+t.name.substr(1)}function zs(t,e,r,i){nn.each(r.members,function(n,s){var o=e[n];if(o!=null){var a=Hs(s);a=t?t+"."+a:a,Qr(a,o,s,i)}})}function Ap(t,e,r,i){var n=1;nn.each(e,function(s,o){var a=r.flattened?".":".entry.",u=a+n+++".",c=u+(r.key.name||"key"),l=u+(r.value.name||"value");Qr(t+c,s,r.key,i),Qr(t+l,o,r.value,i)})}function xp(t,e,r,i){var n=r.member||{};if(e.length===0){i.call(this,t,null);return}nn.arrayEach(e,function(s,o){var a="."+(o+1);if(r.api.protocol==="ec2")a=a+"";else if(r.flattened){if(n.name){var u=t.split(".");u.pop(),u.push(Hs(n)),t=u.join(".")}}else a="."+(n.name?n.name:"member")+a;Qr(t+a,s,n,i)})}function Qr(t,e,r,i){e!=null&&(r.type==="structure"?zs(t,e,r,i):r.type==="list"?xp(t,e,r,i):r.type==="map"?Ap(t,e,r,i):i(t,r.toWireFormat(e).toString()))}Ks.exports=Ws});var sn=I((ry,$s)=>{var Rp=le().memoizedProperty;function Ip(t,e,r,i){Rp(this,i(t),function(){return r(t,e)})}function Dp(t,e,r,i,n){i=i||String;var s=this;for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(Ip.call(s,o,t[o],r,i),n&&n(o,t[o]))}$s.exports=Dp});var rr=I((iy,io)=>{var Np=sn(),lt=le();function V(t,e,r){r!=null&<.property.apply(this,arguments)}function Dt(t,e){t.constructor.prototype[e]||lt.memoizedProperty.apply(this,arguments)}function re(t,e,r){e=e||{},V(this,"shape",t.shape),V(this,"api",e.api,!1),V(this,"type",t.type),V(this,"enum",t.enum),V(this,"min",t.min),V(this,"max",t.max),V(this,"pattern",t.pattern),V(this,"location",t.location||this.location||"body"),V(this,"name",this.name||t.xmlName||t.queryName||t.locationName||r),V(this,"isStreaming",t.streaming||this.isStreaming||!1),V(this,"requiresLength",t.requiresLength,!1),V(this,"isComposite",t.isComposite||!1),V(this,"isShape",!0,!1),V(this,"isQueryName",Boolean(t.queryName),!1),V(this,"isLocationName",Boolean(t.locationName),!1),V(this,"isIdempotent",t.idempotencyToken===!0),V(this,"isJsonValue",t.jsonvalue===!0),V(this,"isSensitive",t.sensitive===!0||t.prototype&&t.prototype.sensitive===!0),V(this,"isEventStream",Boolean(t.eventstream),!1),V(this,"isEvent",Boolean(t.event),!1),V(this,"isEventPayload",Boolean(t.eventpayload),!1),V(this,"isEventHeader",Boolean(t.eventheader),!1),V(this,"isTimestampFormatSet",Boolean(t.timestampFormat)||t.prototype&&t.prototype.isTimestampFormatSet===!0,!1),V(this,"endpointDiscoveryId",Boolean(t.endpointdiscoveryid),!1),V(this,"hostLabel",Boolean(t.hostLabel),!1),e.documentation&&(V(this,"documentation",t.documentation),V(this,"documentationUrl",t.documentationUrl)),t.xmlAttribute&&V(this,"isXmlAttribute",t.xmlAttribute||!1),V(this,"defaultValue",null),this.toWireFormat=function(i){return i==null?"":i},this.toType=function(i){return i}}re.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"};re.types={structure:Ys,list:Js,map:Qs,boolean:ro,timestamp:Pp,float:qp,integer:Op,string:Zs,base64:to,binary:eo};re.resolve=function(e,r){if(e.shape){var i=r.api.shapes[e.shape];if(!i)throw new Error("Cannot find shape reference: "+e.shape);return i}else return null};re.create=function(e,r,i){if(e.isShape)return e;var n=re.resolve(e,r);if(n){var s=Object.keys(e);r.documentation||(s=s.filter(function(u){return!u.match(/documentation/)}));var o=function(){n.constructor.call(this,e,r,i)};return o.prototype=n,new o}else{e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var a=e.type;if(re.normalizedTypes[e.type]&&(e.type=re.normalizedTypes[e.type]),re.types[e.type])return new re.types[e.type](e,r,i);throw new Error("Unrecognized shape type: "+a)}};function on(t){re.apply(this,arguments),V(this,"isComposite",!0),t.flattened&&V(this,"flattened",t.flattened||!1)}function Ys(t,e){var r=this,i=null,n=!this.isShape;on.apply(this,arguments),n&&(V(this,"defaultValue",function(){return{}}),V(this,"members",{}),V(this,"memberNames",[]),V(this,"required",[]),V(this,"isRequired",function(){return!1}),V(this,"isDocument",Boolean(t.document))),t.members&&(V(this,"members",new Np(t.members,e,function(s,o){return re.create(o,e,s)})),Dt(this,"memberNames",function(){return t.xmlOrder||Object.keys(t.members)}),t.event&&(Dt(this,"eventPayloadMemberName",function(){for(var s=r.members,o=r.memberNames,a=0,u=o.length;a-1?e||"":e,this.isJsonValue?JSON.parse(e):e&&typeof e.toString=="function"?e.toString():e},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function qp(){re.apply(this,arguments),this.toType=function(t){return t==null?null:parseFloat(t)},this.toWireFormat=this.toType}function Op(){re.apply(this,arguments),this.toType=function(t){return t==null?null:parseInt(t,10)},this.toWireFormat=this.toType}function eo(){re.apply(this,arguments),this.toType=function(t){var e=lt.base64.decode(t);if(this.isSensitive&<.isNode()&&typeof lt.Buffer.alloc=="function"){var r=lt.Buffer.alloc(e.length,e);e.fill(0),e=r}return e},this.toWireFormat=lt.base64.encode}function to(){eo.apply(this,arguments)}function ro(){re.apply(this,arguments),this.toType=function(t){return typeof t=="boolean"?t:t==null?null:t==="true"}}re.shapes={StructureShape:Ys,ListShape:Js,MapShape:Qs,StringShape:Zs,BooleanShape:ro,Base64Shape:to};io.exports=re});var an=I((ny,oo)=>{var no=j(),ir=le(),Lp=Gs(),so=rr(),kp=Yr().populateHostPrefix;function Mp(t){var e=t.service.api.operations[t.operation],r=t.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:t.service.api.apiVersion,Action:e.name};var i=new Lp;i.serialize(t.params,e.input,function(n,s){r.params[n]=s}),r.body=ir.queryParamsToString(r.params),kp(t)}function Fp(t){var e,r=t.httpResponse.body.toString();if(r.match("{var ye=le(),Up=Yr().populateHostPrefix;function jp(t){t.httpRequest.method=t.service.api.operations[t.operation].httpMethod}function ao(t,e,r,i){var n=[t,e].join("/");n=n.replace(/\/+/g,"/");var s={},o=!1;if(ye.each(r.members,function(u,c){var l=i[u];if(l!=null)if(c.location==="uri"){var h=new RegExp("\\{"+c.name+"(\\+)?\\}");n=n.replace(h,function(g,b){var y=b?ye.uriEscapePath:ye.uriEscape;return y(String(l))})}else c.location==="querystring"&&(o=!0,c.type==="list"?s[c.name]=l.map(function(g){return ye.uriEscape(c.member.toWireFormat(g).toString())}):c.type==="map"?ye.each(l,function(g,b){Array.isArray(b)?s[g]=b.map(function(y){return ye.uriEscape(String(y))}):s[g]=ye.uriEscape(String(b))}):s[c.name]=ye.uriEscape(c.toWireFormat(l).toString()))}),o){n+=n.indexOf("?")>=0?"&":"?";var a=[];ye.arrayEach(Object.keys(s).sort(),function(u){Array.isArray(s[u])||(s[u]=[s[u]]);for(var c=0;c{var co=le(),lo=nr(),fo=Jr(),Kp=Kr(),po=$r();function Gp(t){var e=new Kp,r=t.service.api.operations[t.operation].input;if(r.payload){var i={},n=r.members[r.payload];i=t.params[r.payload],n.type==="structure"?(t.httpRequest.body=e.build(i||{},n),un(t)):i!==void 0&&(t.httpRequest.body=i,(n.type==="binary"||n.isStreaming)&&un(t,!0))}else t.httpRequest.body=e.build(t.params,r),un(t)}function un(t,e){if(!t.httpRequest.headers["Content-Type"]){var r=e?"binary/octet-stream":"application/json";t.httpRequest.headers["Content-Type"]=r}}function $p(t){lo.buildRequest(t),["GET","HEAD","DELETE"].indexOf(t.httpRequest.method)<0&&Gp(t)}function Yp(t){fo.extractError(t)}function Jp(t){lo.extractData(t);var e=t.request,r=e.service.api.operations[e.operation],i=e.service.api.operations[e.operation].output||{},n,s=r.hasEventOutput;if(i.payload){var o=i.members[i.payload],a=t.httpResponse.body;if(o.isEventStream)n=new po,t.data[payload]=co.createEventStream(AWS.HttpClient.streamsApiVersion===2?t.httpResponse.stream:a,n,o);else if(o.type==="structure"||o.type==="list"){var n=new po;t.data[i.payload]=n.parse(a,o)}else o.type==="binary"||o.isStreaming?t.data[i.payload]=a:t.data[i.payload]=o.toType(a)}else{var u=t.data;fo.extractData(t),t.data=co.merge(u,t.data)}}ho.exports={buildRequest:$p,extractError:Yp,extractData:Jp}});var fn=I((ay,mo)=>{var Kt=j(),sr=le(),ln=nr();function Qp(t){var e=t.service.api.operations[t.operation].input,r=new Kt.XML.Builder,i=t.params,n=e.payload;if(n){var s=e.members[n];if(i=i[n],i===void 0)return;if(s.type==="structure"){var o=s.name;t.httpRequest.body=r.toXML(i,s,o,!0)}else t.httpRequest.body=i}else t.httpRequest.body=r.toXML(i,e,e.name||e.shape||sr.string.upperFirst(t.operation)+"Request")}function Zp(t){ln.buildRequest(t),["GET","HEAD"].indexOf(t.httpRequest.method)<0&&Qp(t)}function ed(t){ln.extractError(t);var e;try{e=new Kt.XML.Parser().parse(t.httpResponse.body.toString())}catch(r){e={Code:t.httpResponse.statusCode,Message:t.httpResponse.statusMessage}}e.Errors&&(e=e.Errors),e.Error&&(e=e.Error),e.Code?t.error=sr.error(new Error,{code:e.Code,message:e.Message}):t.error=sr.error(new Error,{code:t.httpResponse.statusCode,message:null})}function td(t){ln.extractData(t);var e,r=t.request,i=t.httpResponse.body,n=r.service.api.operations[r.operation],s=n.output,o=n.hasEventOutput,a=s.payload;if(a){var u=s.members[a];u.isEventStream?(e=new Kt.XML.Parser,t.data[a]=sr.createEventStream(Kt.HttpClient.streamsApiVersion===2?t.httpResponse.stream:t.httpResponse.body,e,u)):u.type==="structure"?(e=new Kt.XML.Parser,t.data[a]=e.parse(i.toString(),u)):u.type==="binary"||u.isStreaming?t.data[a]=i:t.data[a]=u.toType(i)}else if(i.length>0){e=new Kt.XML.Parser;var c=e.parse(i.toString(),s);sr.update(t.data,c)}}mo.exports={buildRequest:Zp,extractError:ed,extractData:td}});var yo=I((uy,vo)=>{function rd(t){return t.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}vo.exports={escapeAttribute:rd}});var Eo=I((cy,go)=>{var id=yo().escapeAttribute;function or(t,e){e===void 0&&(e=[]),this.name=t,this.children=e,this.attributes={}}or.prototype.addAttribute=function(t,e){return this.attributes[t]=e,this};or.prototype.addChildNode=function(t){return this.children.push(t),this};or.prototype.removeAttribute=function(t){return delete this.attributes[t],this};or.prototype.toString=function(){for(var t=Boolean(this.children.length),e="<"+this.name,r=this.attributes,i=0,n=Object.keys(r);i"+this.children.map(function(a){return a.toString()}).join("")+"":"/>"};go.exports={XmlNode:or}});var _o=I((ly,So)=>{function nd(t){return t.replace(/&/g,"&").replace(//g,">").replace(/\r/g," ").replace(/\n/g," ").replace(/\u0085/g,"…").replace(/\u2028/,"
")}So.exports={escapeElement:nd}});var To=I((fy,Co)=>{var sd=_o().escapeElement;function wo(t){this.value=t}wo.prototype.toString=function(){return sd(""+this.value)};Co.exports={XmlText:wo}});var Ro=I((py,xo)=>{var Zr=le(),Nt=Eo().XmlNode,od=To().XmlText;function bo(){}bo.prototype.toXML=function(t,e,r,i){var n=new Nt(r);return Ao(n,e,!0),Pt(n,t,e),n.children.length>0||i?n.toString():""};function Pt(t,e,r){switch(r.type){case"structure":return ad(t,e,r);case"map":return ud(t,e,r);case"list":return cd(t,e,r);default:return ld(t,e,r)}}function ad(t,e,r){Zr.arrayEach(r.memberNames,function(i){var n=r.members[i];if(n.location==="body"){var s=e[i],o=n.name;if(s!=null)if(n.isXmlAttribute)t.addAttribute(o,s);else if(n.flattened)Pt(t,s,n);else{var a=new Nt(o);t.addChildNode(a),Ao(a,n),Pt(a,s,n)}}})}function ud(t,e,r){var i=r.key.name||"key",n=r.value.name||"value";Zr.each(e,function(s,o){var a=new Nt(r.flattened?r.name:"entry");t.addChildNode(a);var u=new Nt(i),c=new Nt(n);a.addChildNode(u),a.addChildNode(c),Pt(u,s,r.key),Pt(c,o,r.value)})}function cd(t,e,r){r.flattened?Zr.arrayEach(e,function(i){var n=r.member.name||r.name,s=new Nt(n);t.addChildNode(s),Pt(s,i,r.member)}):Zr.arrayEach(e,function(i){var n=r.member.name||"member",s=new Nt(n);t.addChildNode(s),Pt(s,i,r.member)})}function ld(t,e,r){t.addChildNode(new od(r.toWireFormat(e)))}function Ao(t,e,r){var i,n="xmlns";e.xmlNamespaceUri?(i=e.xmlNamespaceUri,e.xmlNamespacePrefix&&(n+=":"+e.xmlNamespacePrefix)):r&&e.api.xmlNamespaceUri&&(i=e.api.xmlNamespaceUri),i&&t.addAttribute(n,i)}xo.exports=bo});var pn=I((dy,Do)=>{var ar=rr(),Io=le(),Je=Io.property,Gt=Io.memoizedProperty;function fd(t,e,r){var i=this;r=r||{},Je(this,"name",e.name||t),Je(this,"api",r.api,!1),e.http=e.http||{},Je(this,"endpoint",e.endpoint),Je(this,"httpMethod",e.http.method||"POST"),Je(this,"httpPath",e.http.requestUri||"/"),Je(this,"authtype",e.authtype||""),Je(this,"endpointDiscoveryRequired",e.endpointdiscovery?e.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL");var n=e.httpChecksumRequired||e.httpChecksum&&e.httpChecksum.requestChecksumRequired;Je(this,"httpChecksumRequired",n,!1),Gt(this,"input",function(){return e.input?ar.create(e.input,r):new ar.create({type:"structure"},r)}),Gt(this,"output",function(){return e.output?ar.create(e.output,r):new ar.create({type:"structure"},r)}),Gt(this,"errors",function(){var s=[];if(!e.errors)return null;for(var o=0;o{var ur=le().property;function dd(t,e){ur(this,"inputToken",e.input_token),ur(this,"limitKey",e.limit_key),ur(this,"moreResults",e.more_results),ur(this,"outputToken",e.output_token),ur(this,"resultKey",e.result_key)}No.exports=dd});var hn=I((my,qo)=>{var Po=le(),ei=Po.property;function hd(t,e,r){r=r||{},ei(this,"name",t),ei(this,"api",r.api,!1),e.operation&&ei(this,"operation",Po.string.lowerFirst(e.operation));var i=this,n=["type","description","delay","maxAttempts","acceptors"];n.forEach(function(s){var o=e[s];o&&ei(i,s,o)})}qo.exports=hd});var mn=I((vy,md)=>{md.exports={acm:{name:"ACM",cors:!0},apigateway:{name:"APIGateway",cors:!0},applicationautoscaling:{prefix:"application-autoscaling",name:"ApplicationAutoScaling",cors:!0},appstream:{name:"AppStream"},autoscaling:{name:"AutoScaling",cors:!0},batch:{name:"Batch"},budgets:{name:"Budgets"},clouddirectory:{name:"CloudDirectory",versions:["2016-05-10*"]},cloudformation:{name:"CloudFormation",cors:!0},cloudfront:{name:"CloudFront",versions:["2013-05-12*","2013-11-11*","2014-05-31*","2014-10-21*","2014-11-06*","2015-04-17*","2015-07-27*","2015-09-17*","2016-01-13*","2016-01-28*","2016-08-01*","2016-08-20*","2016-09-07*","2016-09-29*","2016-11-25*","2017-03-25*","2017-10-30*","2018-06-18*","2018-11-05*","2019-03-26*"],cors:!0},cloudhsm:{name:"CloudHSM",cors:!0},cloudsearch:{name:"CloudSearch"},cloudsearchdomain:{name:"CloudSearchDomain"},cloudtrail:{name:"CloudTrail",cors:!0},cloudwatch:{prefix:"monitoring",name:"CloudWatch",cors:!0},cloudwatchevents:{prefix:"events",name:"CloudWatchEvents",versions:["2014-02-03*"],cors:!0},cloudwatchlogs:{prefix:"logs",name:"CloudWatchLogs",cors:!0},codebuild:{name:"CodeBuild",cors:!0},codecommit:{name:"CodeCommit",cors:!0},codedeploy:{name:"CodeDeploy",cors:!0},codepipeline:{name:"CodePipeline",cors:!0},cognitoidentity:{prefix:"cognito-identity",name:"CognitoIdentity",cors:!0},cognitoidentityserviceprovider:{prefix:"cognito-idp",name:"CognitoIdentityServiceProvider",cors:!0},cognitosync:{prefix:"cognito-sync",name:"CognitoSync",cors:!0},configservice:{prefix:"config",name:"ConfigService",cors:!0},cur:{name:"CUR",cors:!0},datapipeline:{name:"DataPipeline"},devicefarm:{name:"DeviceFarm",cors:!0},directconnect:{name:"DirectConnect",cors:!0},directoryservice:{prefix:"ds",name:"DirectoryService"},discovery:{name:"Discovery"},dms:{name:"DMS"},dynamodb:{name:"DynamoDB",cors:!0},dynamodbstreams:{prefix:"streams.dynamodb",name:"DynamoDBStreams",cors:!0},ec2:{name:"EC2",versions:["2013-06-15*","2013-10-15*","2014-02-01*","2014-05-01*","2014-06-15*","2014-09-01*","2014-10-01*","2015-03-01*","2015-04-15*","2015-10-01*","2016-04-01*","2016-09-15*"],cors:!0},ecr:{name:"ECR",cors:!0},ecs:{name:"ECS",cors:!0},efs:{prefix:"elasticfilesystem",name:"EFS",cors:!0},elasticache:{name:"ElastiCache",versions:["2012-11-15*","2014-03-24*","2014-07-15*","2014-09-30*"],cors:!0},elasticbeanstalk:{name:"ElasticBeanstalk",cors:!0},elb:{prefix:"elasticloadbalancing",name:"ELB",cors:!0},elbv2:{prefix:"elasticloadbalancingv2",name:"ELBv2",cors:!0},emr:{prefix:"elasticmapreduce",name:"EMR",cors:!0},es:{name:"ES"},elastictranscoder:{name:"ElasticTranscoder",cors:!0},firehose:{name:"Firehose",cors:!0},gamelift:{name:"GameLift",cors:!0},glacier:{name:"Glacier"},health:{name:"Health"},iam:{name:"IAM",cors:!0},importexport:{name:"ImportExport"},inspector:{name:"Inspector",versions:["2015-08-18*"],cors:!0},iot:{name:"Iot",cors:!0},iotdata:{prefix:"iot-data",name:"IotData",cors:!0},kinesis:{name:"Kinesis",cors:!0},kinesisanalytics:{name:"KinesisAnalytics"},kms:{name:"KMS",cors:!0},lambda:{name:"Lambda",cors:!0},lexruntime:{prefix:"runtime.lex",name:"LexRuntime",cors:!0},lightsail:{name:"Lightsail"},machinelearning:{name:"MachineLearning",cors:!0},marketplacecommerceanalytics:{name:"MarketplaceCommerceAnalytics",cors:!0},marketplacemetering:{prefix:"meteringmarketplace",name:"MarketplaceMetering"},mturk:{prefix:"mturk-requester",name:"MTurk",cors:!0},mobileanalytics:{name:"MobileAnalytics",cors:!0},opsworks:{name:"OpsWorks",cors:!0},opsworkscm:{name:"OpsWorksCM"},organizations:{name:"Organizations"},pinpoint:{name:"Pinpoint"},polly:{name:"Polly",cors:!0},rds:{name:"RDS",versions:["2014-09-01*"],cors:!0},redshift:{name:"Redshift",cors:!0},rekognition:{name:"Rekognition",cors:!0},resourcegroupstaggingapi:{name:"ResourceGroupsTaggingAPI"},route53:{name:"Route53",cors:!0},route53domains:{name:"Route53Domains",cors:!0},s3:{name:"S3",dualstackAvailable:!0,cors:!0},s3control:{name:"S3Control",dualstackAvailable:!0,xmlNoDefaultLists:!0},servicecatalog:{name:"ServiceCatalog",cors:!0},ses:{prefix:"email",name:"SES",cors:!0},shield:{name:"Shield"},simpledb:{prefix:"sdb",name:"SimpleDB"},sms:{name:"SMS"},snowball:{name:"Snowball"},sns:{name:"SNS",cors:!0},sqs:{name:"SQS",cors:!0},ssm:{name:"SSM",cors:!0},storagegateway:{name:"StorageGateway",cors:!0},stepfunctions:{prefix:"states",name:"StepFunctions"},sts:{name:"STS",cors:!0},support:{name:"Support"},swf:{name:"SWF"},xray:{name:"XRay",cors:!0},waf:{name:"WAF",cors:!0},wafregional:{prefix:"waf-regional",name:"WAFRegional"},workdocs:{name:"WorkDocs",cors:!0},workspaces:{name:"WorkSpaces"},codestar:{name:"CodeStar"},lexmodelbuildingservice:{prefix:"lex-models",name:"LexModelBuildingService",cors:!0},marketplaceentitlementservice:{prefix:"entitlement.marketplace",name:"MarketplaceEntitlementService"},athena:{name:"Athena",cors:!0},greengrass:{name:"Greengrass"},dax:{name:"DAX"},migrationhub:{prefix:"AWSMigrationHub",name:"MigrationHub"},cloudhsmv2:{name:"CloudHSMV2",cors:!0},glue:{name:"Glue"},mobile:{name:"Mobile"},pricing:{name:"Pricing",cors:!0},costexplorer:{prefix:"ce",name:"CostExplorer",cors:!0},mediaconvert:{name:"MediaConvert"},medialive:{name:"MediaLive"},mediapackage:{name:"MediaPackage"},mediastore:{name:"MediaStore"},mediastoredata:{prefix:"mediastore-data",name:"MediaStoreData",cors:!0},appsync:{name:"AppSync"},guardduty:{name:"GuardDuty"},mq:{name:"MQ"},comprehend:{name:"Comprehend",cors:!0},iotjobsdataplane:{prefix:"iot-jobs-data",name:"IoTJobsDataPlane"},kinesisvideoarchivedmedia:{prefix:"kinesis-video-archived-media",name:"KinesisVideoArchivedMedia",cors:!0},kinesisvideomedia:{prefix:"kinesis-video-media",name:"KinesisVideoMedia",cors:!0},kinesisvideo:{name:"KinesisVideo",cors:!0},sagemakerruntime:{prefix:"runtime.sagemaker",name:"SageMakerRuntime"},sagemaker:{name:"SageMaker"},translate:{name:"Translate",cors:!0},resourcegroups:{prefix:"resource-groups",name:"ResourceGroups",cors:!0},alexaforbusiness:{name:"AlexaForBusiness"},cloud9:{name:"Cloud9"},serverlessapplicationrepository:{prefix:"serverlessrepo",name:"ServerlessApplicationRepository"},servicediscovery:{name:"ServiceDiscovery"},workmail:{name:"WorkMail"},autoscalingplans:{prefix:"autoscaling-plans",name:"AutoScalingPlans"},transcribeservice:{prefix:"transcribe",name:"TranscribeService"},connect:{name:"Connect",cors:!0},acmpca:{prefix:"acm-pca",name:"ACMPCA"},fms:{name:"FMS"},secretsmanager:{name:"SecretsManager",cors:!0},iotanalytics:{name:"IoTAnalytics",cors:!0},iot1clickdevicesservice:{prefix:"iot1click-devices",name:"IoT1ClickDevicesService"},iot1clickprojects:{prefix:"iot1click-projects",name:"IoT1ClickProjects"},pi:{name:"PI"},neptune:{name:"Neptune"},mediatailor:{name:"MediaTailor"},eks:{name:"EKS"},macie:{name:"Macie"},dlm:{name:"DLM"},signer:{name:"Signer"},chime:{name:"Chime"},pinpointemail:{prefix:"pinpoint-email",name:"PinpointEmail"},ram:{name:"RAM"},route53resolver:{name:"Route53Resolver"},pinpointsmsvoice:{prefix:"sms-voice",name:"PinpointSMSVoice"},quicksight:{name:"QuickSight"},rdsdataservice:{prefix:"rds-data",name:"RDSDataService"},amplify:{name:"Amplify"},datasync:{name:"DataSync"},robomaker:{name:"RoboMaker"},transfer:{name:"Transfer"},globalaccelerator:{name:"GlobalAccelerator"},comprehendmedical:{name:"ComprehendMedical",cors:!0},kinesisanalyticsv2:{name:"KinesisAnalyticsV2"},mediaconnect:{name:"MediaConnect"},fsx:{name:"FSx"},securityhub:{name:"SecurityHub"},appmesh:{name:"AppMesh",versions:["2018-10-01*"]},licensemanager:{prefix:"license-manager",name:"LicenseManager"},kafka:{name:"Kafka"},apigatewaymanagementapi:{name:"ApiGatewayManagementApi"},apigatewayv2:{name:"ApiGatewayV2"},docdb:{name:"DocDB"},backup:{name:"Backup"},worklink:{name:"WorkLink"},textract:{name:"Textract"},managedblockchain:{name:"ManagedBlockchain"},mediapackagevod:{prefix:"mediapackage-vod",name:"MediaPackageVod"},groundstation:{name:"GroundStation"},iotthingsgraph:{name:"IoTThingsGraph"},iotevents:{name:"IoTEvents"},ioteventsdata:{prefix:"iotevents-data",name:"IoTEventsData"},personalize:{name:"Personalize",cors:!0},personalizeevents:{prefix:"personalize-events",name:"PersonalizeEvents",cors:!0},personalizeruntime:{prefix:"personalize-runtime",name:"PersonalizeRuntime",cors:!0},applicationinsights:{prefix:"application-insights",name:"ApplicationInsights"},servicequotas:{prefix:"service-quotas",name:"ServiceQuotas"},ec2instanceconnect:{prefix:"ec2-instance-connect",name:"EC2InstanceConnect"},eventbridge:{name:"EventBridge"},lakeformation:{name:"LakeFormation"},forecastservice:{prefix:"forecast",name:"ForecastService",cors:!0},forecastqueryservice:{prefix:"forecastquery",name:"ForecastQueryService",cors:!0},qldb:{name:"QLDB"},qldbsession:{prefix:"qldb-session",name:"QLDBSession"},workmailmessageflow:{name:"WorkMailMessageFlow"},codestarnotifications:{prefix:"codestar-notifications",name:"CodeStarNotifications"},savingsplans:{name:"SavingsPlans"},sso:{name:"SSO"},ssooidc:{prefix:"sso-oidc",name:"SSOOIDC"},marketplacecatalog:{prefix:"marketplace-catalog",name:"MarketplaceCatalog"},dataexchange:{name:"DataExchange"},sesv2:{name:"SESV2"},migrationhubconfig:{prefix:"migrationhub-config",name:"MigrationHubConfig"},connectparticipant:{name:"ConnectParticipant"},appconfig:{name:"AppConfig"},iotsecuretunneling:{name:"IoTSecureTunneling"},wafv2:{name:"WAFV2"},elasticinference:{prefix:"elastic-inference",name:"ElasticInference"},imagebuilder:{name:"Imagebuilder"},schemas:{name:"Schemas"},accessanalyzer:{name:"AccessAnalyzer"},codegurureviewer:{prefix:"codeguru-reviewer",name:"CodeGuruReviewer"},codeguruprofiler:{name:"CodeGuruProfiler"},computeoptimizer:{prefix:"compute-optimizer",name:"ComputeOptimizer"},frauddetector:{name:"FraudDetector"},kendra:{name:"Kendra"},networkmanager:{name:"NetworkManager"},outposts:{name:"Outposts"},augmentedairuntime:{prefix:"sagemaker-a2i-runtime",name:"AugmentedAIRuntime"},ebs:{name:"EBS"},kinesisvideosignalingchannels:{prefix:"kinesis-video-signaling",name:"KinesisVideoSignalingChannels",cors:!0},detective:{name:"Detective"},codestarconnections:{prefix:"codestar-connections",name:"CodeStarconnections"},synthetics:{name:"Synthetics"},iotsitewise:{name:"IoTSiteWise"},macie2:{name:"Macie2"},codeartifact:{name:"CodeArtifact"},honeycode:{name:"Honeycode"},ivs:{name:"IVS"},braket:{name:"Braket"},identitystore:{name:"IdentityStore"},appflow:{name:"Appflow"},redshiftdata:{prefix:"redshift-data",name:"RedshiftData"},ssoadmin:{prefix:"sso-admin",name:"SSOAdmin"},timestreamquery:{prefix:"timestream-query",name:"TimestreamQuery"},timestreamwrite:{prefix:"timestream-write",name:"TimestreamWrite"},s3outposts:{name:"S3Outposts"},databrew:{name:"DataBrew"},servicecatalogappregistry:{prefix:"servicecatalog-appregistry",name:"ServiceCatalogAppRegistry"},networkfirewall:{prefix:"network-firewall",name:"NetworkFirewall"},mwaa:{name:"MWAA"},amplifybackend:{name:"AmplifyBackend"},appintegrations:{name:"AppIntegrations"},connectcontactlens:{prefix:"connect-contact-lens",name:"ConnectContactLens"},devopsguru:{prefix:"devops-guru",name:"DevOpsGuru"},ecrpublic:{prefix:"ecr-public",name:"ECRPUBLIC"},lookoutvision:{name:"LookoutVision"},sagemakerfeaturestoreruntime:{prefix:"sagemaker-featurestore-runtime",name:"SageMakerFeatureStoreRuntime"},customerprofiles:{prefix:"customer-profiles",name:"CustomerProfiles"},auditmanager:{name:"AuditManager"},emrcontainers:{prefix:"emr-containers",name:"EMRcontainers"},healthlake:{name:"HealthLake"},sagemakeredge:{prefix:"sagemaker-edge",name:"SagemakerEdge"},amp:{name:"Amp"},greengrassv2:{name:"GreengrassV2"},iotdeviceadvisor:{name:"IotDeviceAdvisor"},iotfleethub:{name:"IoTFleetHub"},iotwireless:{name:"IoTWireless"},location:{name:"Location",cors:!0},wellarchitected:{name:"WellArchitected"},lexmodelsv2:{prefix:"models.lex.v2",name:"LexModelsV2"},lexruntimev2:{prefix:"runtime.lex.v2",name:"LexRuntimeV2",cors:!0},fis:{name:"Fis"},lookoutmetrics:{name:"LookoutMetrics"},mgn:{name:"Mgn"},lookoutequipment:{name:"LookoutEquipment"},nimble:{name:"Nimble"},finspace:{name:"Finspace"},finspacedata:{prefix:"finspace-data",name:"Finspacedata"},ssmcontacts:{prefix:"ssm-contacts",name:"SSMContacts"},ssmincidents:{prefix:"ssm-incidents",name:"SSMIncidents"},applicationcostprofiler:{name:"ApplicationCostProfiler"},apprunner:{name:"AppRunner"},proton:{name:"Proton"},route53recoverycluster:{prefix:"route53-recovery-cluster",name:"Route53RecoveryCluster"},route53recoverycontrolconfig:{prefix:"route53-recovery-control-config",name:"Route53RecoveryControlConfig"},route53recoveryreadiness:{prefix:"route53-recovery-readiness",name:"Route53RecoveryReadiness"},chimesdkidentity:{prefix:"chime-sdk-identity",name:"ChimeSDKIdentity"},chimesdkmessaging:{prefix:"chime-sdk-messaging",name:"ChimeSDKMessaging"},snowdevicemanagement:{prefix:"snow-device-management",name:"SnowDeviceManagement"},memorydb:{name:"MemoryDB"},opensearch:{name:"OpenSearch"},kafkaconnect:{name:"KafkaConnect"},voiceid:{prefix:"voice-id",name:"VoiceID"},wisdom:{name:"Wisdom"},account:{name:"Account"},cloudcontrol:{name:"CloudControl"},grafana:{name:"Grafana"},panorama:{name:"Panorama"},chimesdkmeetings:{prefix:"chime-sdk-meetings",name:"ChimeSDKMeetings"},resiliencehub:{name:"Resiliencehub"},migrationhubstrategy:{name:"MigrationHubStrategy"},appconfigdata:{name:"AppConfigData"},drs:{name:"Drs"},migrationhubrefactorspaces:{prefix:"migration-hub-refactor-spaces",name:"MigrationHubRefactorSpaces"},evidently:{name:"Evidently"},inspector2:{name:"Inspector2"},rbin:{name:"Rbin"},rum:{name:"RUM"},backupgateway:{prefix:"backup-gateway",name:"BackupGateway"},iottwinmaker:{name:"IoTTwinMaker"},workspacesweb:{prefix:"workspaces-web",name:"WorkSpacesWeb"},amplifyuibuilder:{name:"AmplifyUIBuilder"},keyspaces:{name:"Keyspaces"},billingconductor:{name:"Billingconductor"},gamesparks:{name:"GameSparks"},pinpointsmsvoicev2:{prefix:"pinpoint-sms-voice-v2",name:"PinpointSMSVoiceV2"},ivschat:{name:"Ivschat"},chimesdkmediapipelines:{prefix:"chime-sdk-media-pipelines",name:"ChimeSDKMediaPipelines"},emrserverless:{prefix:"emr-serverless",name:"EMRServerless"},m2:{name:"M2"},connectcampaigns:{name:"ConnectCampaigns"},redshiftserverless:{prefix:"redshift-serverless",name:"RedshiftServerless"},rolesanywhere:{name:"RolesAnywhere"},licensemanagerusersubscriptions:{prefix:"license-manager-user-subscriptions",name:"LicenseManagerUserSubscriptions"}}});var vn=I((yy,Lo)=>{var ti=sn(),vd=pn(),yd=rr(),gd=dn(),Ed=hn(),Oo=mn(),cr=le(),ie=cr.property,Sd=cr.memoizedProperty;function _d(t,e){var r=this;t=t||{},e=e||{},e.api=this,t.metadata=t.metadata||{};var i=e.serviceIdentifier;delete e.serviceIdentifier,ie(this,"isApi",!0,!1),ie(this,"apiVersion",t.metadata.apiVersion),ie(this,"endpointPrefix",t.metadata.endpointPrefix),ie(this,"signingName",t.metadata.signingName),ie(this,"globalEndpoint",t.metadata.globalEndpoint),ie(this,"signatureVersion",t.metadata.signatureVersion),ie(this,"jsonVersion",t.metadata.jsonVersion),ie(this,"targetPrefix",t.metadata.targetPrefix),ie(this,"protocol",t.metadata.protocol),ie(this,"timestampFormat",t.metadata.timestampFormat),ie(this,"xmlNamespaceUri",t.metadata.xmlNamespace),ie(this,"abbreviation",t.metadata.serviceAbbreviation),ie(this,"fullName",t.metadata.serviceFullName),ie(this,"serviceId",t.metadata.serviceId),i&&Oo[i]&&ie(this,"xmlNoDefaultLists",Oo[i].xmlNoDefaultLists,!1),Sd(this,"className",function(){var s=t.metadata.serviceAbbreviation||t.metadata.serviceFullName;return s?(s=s.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""),s==="ElasticLoadBalancing"&&(s="ELB"),s):null});function n(s,o){o.endpointoperation===!0&&ie(r,"endpointOperation",cr.string.lowerFirst(s)),o.endpointdiscovery&&!r.hasRequiredEndpointDiscovery&&ie(r,"hasRequiredEndpointDiscovery",o.endpointdiscovery.required===!0)}ie(this,"operations",new ti(t.operations,e,function(s,o){return new vd(s,o,e)},cr.string.lowerFirst,n)),ie(this,"shapes",new ti(t.shapes,e,function(s,o){return yd.create(o,e)})),ie(this,"paginators",new ti(t.paginators,e,function(s,o){return new gd(s,o,e)})),ie(this,"waiters",new ti(t.waiters,e,function(s,o){return new Ed(s,o,e)},cr.string.lowerFirst)),e.documentation&&(ie(this,"documentation",t.documentation),ie(this,"documentationUrl",t.documentationUrl)),ie(this,"errorCodeMapping",t.awsQueryCompatible)}Lo.exports=_d});var Mo=I((gy,ko)=>{function ri(t,e){if(!ri.services.hasOwnProperty(t))throw new Error("InvalidService: Failed to load api for "+t);return ri.services[t][e]}ri.services={};ko.exports=ri});var Fo=I(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var wd=function(){function t(e,r){this.key=e,this.value=r}return t}(),Cd=function(){function t(e){if(this.nodeMap={},this.size=0,typeof e!="number"||e<1)throw new Error("Cache size can only be positive number");this.sizeLimit=e}return Object.defineProperty(t.prototype,"length",{get:function(){return this.size},enumerable:!0,configurable:!0}),t.prototype.prependToList=function(e){this.headerNode?(this.headerNode.prev=e,e.next=this.headerNode):this.tailNode=e,this.headerNode=e,this.size++},t.prototype.removeFromTail=function(){if(!!this.tailNode){var e=this.tailNode,r=e.prev;return r&&(r.next=void 0),e.prev=void 0,this.tailNode=r,this.size--,e}},t.prototype.detachFromList=function(e){this.headerNode===e&&(this.headerNode=e.next),this.tailNode===e&&(this.tailNode=e.prev),e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.next=void 0,e.prev=void 0,this.size--},t.prototype.get=function(e){if(this.nodeMap[e]){var r=this.nodeMap[e];return this.detachFromList(r),this.prependToList(r),r.value}},t.prototype.remove=function(e){if(this.nodeMap[e]){var r=this.nodeMap[e];this.detachFromList(r),delete this.nodeMap[e]}},t.prototype.put=function(e,r){if(this.nodeMap[e])this.remove(e);else if(this.size===this.sizeLimit){var i=this.removeFromTail(),n=i.key;delete this.nodeMap[n]}var s=new wd(e,r);this.nodeMap[e]=s,this.prependToList(s)},t.prototype.empty=function(){for(var e=Object.keys(this.nodeMap),r=0;r{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});var Td=Fo(),bd=1e3,Ad=function(){function t(e){e===void 0&&(e=bd),this.maxSize=e,this.cache=new Td.LRUCache(e)}return Object.defineProperty(t.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),t.prototype.put=function(e,r){var i=typeof e!="string"?t.getKeyString(e):e,n=this.populateValue(r);this.cache.put(i,n)},t.prototype.get=function(e){var r=typeof e!="string"?t.getKeyString(e):e,i=Date.now(),n=this.cache.get(r);if(n){for(var s=n.length-1;s>=0;s--){var o=n[s];o.Expire{var ft=j();ft.SequentialExecutor=ft.util.inherit({constructor:function(){this._events={}},listeners:function(e){return this._events[e]?this._events[e].slice(0):[]},on:function(e,r,i){return this._events[e]?i?this._events[e].unshift(r):this._events[e].push(r):this._events[e]=[r],this},onAsync:function(e,r,i){return r._isAsync=!0,this.on(e,r,i)},removeListener:function(e,r){var i=this._events[e];if(i){for(var n=i.length,s=-1,o=0;o-1&&i.splice(s,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,r,i){i||(i=function(){});var n=this.listeners(e),s=n.length;return this.callListeners(n,r,i),s>0},callListeners:function(e,r,i,n){var s=this,o=n||null;function a(c){if(c&&(o=ft.util.error(o||new Error,c),s._haltHandlersOnError))return i.call(s,o);s.callListeners(e,r,i,o)}for(;e.length>0;){var u=e.shift();if(u._isAsync){u.apply(s,r.concat([a]));return}else{try{u.apply(s,r)}catch(c){o=ft.util.error(o||new Error,c)}if(o&&s._haltHandlersOnError){i.call(s,o);return}}}i.call(s,o)},addListeners:function(e){var r=this;return e._events&&(e=e._events),ft.util.each(e,function(i,n){typeof n=="function"&&(n=[n]),ft.util.arrayEach(n,function(s){r.on(i,s)})}),r},addNamedListener:function(e,r,i,n){return this[e]=i,this.addListener(r,i,n),this},addNamedAsyncListener:function(e,r,i,n){return i._isAsync=!0,this.addNamedListener(e,r,i,n)},addNamedListeners:function(e){var r=this;return e(function(){r.addNamedListener.apply(r,arguments)},function(){r.addNamedAsyncListener.apply(r,arguments)}),this}});ft.SequentialExecutor.prototype.addListener=ft.SequentialExecutor.prototype.on;Uo.exports=ft.SequentialExecutor});var jo=I((wy,xd)=>{xd.exports={rules:{"*/*":{endpoint:"{service}.{region}.amazonaws.com"},"cn-*/*":{endpoint:"{service}.{region}.amazonaws.com.cn"},"us-iso-*/*":"usIso","us-isob-*/*":"usIsob","*/budgets":"globalSSL","*/cloudfront":"globalSSL","*/sts":"globalSSL","*/importexport":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2",globalEndpoint:!0},"*/route53":"globalSSL","cn-*/route53":{endpoint:"{service}.amazonaws.com.cn",globalEndpoint:!0,signingRegion:"cn-northwest-1"},"us-gov-*/route53":"globalGovCloud","us-iso-*/route53":{endpoint:"{service}.c2s.ic.gov",globalEndpoint:!0,signingRegion:"us-iso-east-1"},"us-isob-*/route53":{endpoint:"{service}.sc2s.sgov.gov",globalEndpoint:!0,signingRegion:"us-isob-east-1"},"*/waf":"globalSSL","*/iam":"globalSSL","cn-*/iam":{endpoint:"{service}.cn-north-1.amazonaws.com.cn",globalEndpoint:!0,signingRegion:"cn-north-1"},"us-gov-*/iam":"globalGovCloud","us-gov-*/sts":{endpoint:"{service}.{region}.amazonaws.com"},"us-gov-west-1/s3":"s3signature","us-west-1/s3":"s3signature","us-west-2/s3":"s3signature","eu-west-1/s3":"s3signature","ap-southeast-1/s3":"s3signature","ap-southeast-2/s3":"s3signature","ap-northeast-1/s3":"s3signature","sa-east-1/s3":"s3signature","us-east-1/s3":{endpoint:"{service}.amazonaws.com",signatureVersion:"s3"},"us-east-1/sdb":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2"},"*/sdb":{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"v2"}},fipsRules:{"*/*":"fipsStandard","us-gov-*/*":"fipsStandard","us-iso-*/*":{endpoint:"{service}-fips.{region}.c2s.ic.gov"},"us-iso-*/dms":"usIso","us-isob-*/*":{endpoint:"{service}-fips.{region}.sc2s.sgov.gov"},"us-isob-*/dms":"usIsob","cn-*/*":{endpoint:"{service}-fips.{region}.amazonaws.com.cn"},"*/api.ecr":"fips.api.ecr","*/api.sagemaker":"fips.api.sagemaker","*/batch":"fipsDotPrefix","*/eks":"fipsDotPrefix","*/models.lex":"fips.models.lex","*/runtime.lex":"fips.runtime.lex","*/runtime.sagemaker":{endpoint:"runtime-fips.sagemaker.{region}.amazonaws.com"},"*/iam":"fipsWithoutRegion","*/route53":"fipsWithoutRegion","*/transcribe":"fipsDotPrefix","*/waf":"fipsWithoutRegion","us-gov-*/transcribe":"fipsDotPrefix","us-gov-*/api.ecr":"fips.api.ecr","us-gov-*/api.sagemaker":"fips.api.sagemaker","us-gov-*/models.lex":"fips.models.lex","us-gov-*/runtime.lex":"fips.runtime.lex","us-gov-*/acm-pca":"fipsWithServiceOnly","us-gov-*/batch":"fipsWithServiceOnly","us-gov-*/config":"fipsWithServiceOnly","us-gov-*/eks":"fipsWithServiceOnly","us-gov-*/elasticmapreduce":"fipsWithServiceOnly","us-gov-*/identitystore":"fipsWithServiceOnly","us-gov-*/dynamodb":"fipsWithServiceOnly","us-gov-*/elasticloadbalancing":"fipsWithServiceOnly","us-gov-*/guardduty":"fipsWithServiceOnly","us-gov-*/monitoring":"fipsWithServiceOnly","us-gov-*/resource-groups":"fipsWithServiceOnly","us-gov-*/runtime.sagemaker":"fipsWithServiceOnly","us-gov-*/servicecatalog-appregistry":"fipsWithServiceOnly","us-gov-*/servicequotas":"fipsWithServiceOnly","us-gov-*/ssm":"fipsWithServiceOnly","us-gov-*/sts":"fipsWithServiceOnly","us-gov-*/support":"fipsWithServiceOnly","us-gov-west-1/states":"fipsWithServiceOnly","us-iso-east-1/elasticfilesystem":{endpoint:"elasticfilesystem-fips.{region}.c2s.ic.gov"},"us-gov-west-1/organizations":"fipsWithServiceOnly","us-gov-west-1/route53":{endpoint:"route53.us-gov.amazonaws.com"}},dualstackRules:{"*/*":{endpoint:"{service}.{region}.api.aws"},"cn-*/*":{endpoint:"{service}.{region}.api.amazonwebservices.com.cn"},"*/s3":"dualstackLegacy","cn-*/s3":"dualstackLegacyCn","*/s3-control":"dualstackLegacy","cn-*/s3-control":"dualstackLegacyCn","ap-south-1/ec2":"dualstackLegacyEc2","eu-west-1/ec2":"dualstackLegacyEc2","sa-east-1/ec2":"dualstackLegacyEc2","us-east-1/ec2":"dualstackLegacyEc2","us-east-2/ec2":"dualstackLegacyEc2","us-west-2/ec2":"dualstackLegacyEc2"},dualstackFipsRules:{"*/*":{endpoint:"{service}-fips.{region}.api.aws"},"cn-*/*":{endpoint:"{service}-fips.{region}.api.amazonwebservices.com.cn"},"*/s3":"dualstackFipsLegacy","cn-*/s3":"dualstackFipsLegacyCn","*/s3-control":"dualstackFipsLegacy","cn-*/s3-control":"dualstackFipsLegacyCn"},patterns:{globalSSL:{endpoint:"https://{service}.amazonaws.com",globalEndpoint:!0,signingRegion:"us-east-1"},globalGovCloud:{endpoint:"{service}.us-gov.amazonaws.com",globalEndpoint:!0,signingRegion:"us-gov-west-1"},s3signature:{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"s3"},usIso:{endpoint:"{service}.{region}.c2s.ic.gov"},usIsob:{endpoint:"{service}.{region}.sc2s.sgov.gov"},fipsStandard:{endpoint:"{service}-fips.{region}.amazonaws.com"},fipsDotPrefix:{endpoint:"fips.{service}.{region}.amazonaws.com"},fipsWithoutRegion:{endpoint:"{service}-fips.amazonaws.com"},"fips.api.ecr":{endpoint:"ecr-fips.{region}.amazonaws.com"},"fips.api.sagemaker":{endpoint:"api-fips.sagemaker.{region}.amazonaws.com"},"fips.models.lex":{endpoint:"models-fips.lex.{region}.amazonaws.com"},"fips.runtime.lex":{endpoint:"runtime-fips.lex.{region}.amazonaws.com"},fipsWithServiceOnly:{endpoint:"{service}.{region}.amazonaws.com"},dualstackLegacy:{endpoint:"{service}.dualstack.{region}.amazonaws.com"},dualstackLegacyCn:{endpoint:"{service}.dualstack.{region}.amazonaws.com.cn"},dualstackFipsLegacy:{endpoint:"{service}-fips.dualstack.{region}.amazonaws.com"},dualstackFipsLegacyCn:{endpoint:"{service}-fips.dualstack.{region}.amazonaws.com.cn"},dualstackLegacyEc2:{endpoint:"api.ec2.{region}.aws"}}}});var Xo=I((Cy,Vo)=>{var Rd=le(),lr=jo();function Id(t){if(!t)return null;var e=t.split("-");return e.length<3?null:e.slice(0,e.length-2).join("-")+"-*"}function Dd(t){var e=t.config.region,r=Id(e),i=t.api.endpointPrefix;return[[e,i],[r,i],[e,"*"],[r,"*"],["*",i],["*","*"]].map(function(n){return n[0]&&n[1]?n.join("/"):null})}function Nd(t,e){Rd.each(e,function(r,i){r!=="globalEndpoint"&&(t.config[r]===void 0||t.config[r]===null)&&(t.config[r]=i)})}function Pd(t){for(var e=Dd(t),r=t.config.useFipsEndpoint,i=t.config.useDualstackEndpoint,n=0;n{function Od(t){return typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))}function Ld(t){return typeof t=="string"&&["aws-global","aws-us-gov-global"].includes(t)}function kd(t){return["fips-aws-global","aws-fips","aws-global"].includes(t)?"us-east-1":["fips-aws-us-gov-global","aws-us-gov-global"].includes(t)?"us-gov-west-1":t.replace(/fips-(dkr-|prod-)?|-fips/,"")}Wo.exports={isFipsRegion:Od,isGlobalRegion:Ld,getRealRegion:kd}});var zo=I((by,Ho)=>{var B=j(),Md=vn(),Fd=Xo(),_n=B.util.inherit,Bd=0,ii=Sn();B.Service=_n({constructor:function(e){if(!this.loadServiceClass)throw B.util.error(new Error,"Service must be constructed with `new' operator");if(e){if(e.region){var r=e.region;ii.isFipsRegion(r)&&(e.region=ii.getRealRegion(r),e.useFipsEndpoint=!0),ii.isGlobalRegion(r)&&(e.region=ii.getRealRegion(r))}typeof e.useDualstack=="boolean"&&typeof e.useDualstackEndpoint!="boolean"&&(e.useDualstackEndpoint=e.useDualstack)}var i=this.loadServiceClass(e||{});if(i){var n=B.util.copy(e),s=new i(e);return Object.defineProperty(s,"_originalConfig",{get:function(){return n},enumerable:!1,configurable:!0}),s._clientId=++Bd,s}this.initialize(e)},initialize:function(e){var r=B.config[this.serviceIdentifier];if(this.config=new B.Config(B.config),r&&this.config.update(r,!0),e&&this.config.update(e,!0),this.validateService(),this.config.endpoint||Fd.configureEndpoint(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint),B.SequentialExecutor.call(this),B.Service.addDefaultMonitoringListeners(this),(this.config.clientSideMonitoring||B.Service._clientSideMonitoring)&&this.publisher){var i=this.publisher;this.addNamedListener("PUBLISH_API_CALL","apiCall",function(s){process.nextTick(function(){i.eventHandler(s)})}),this.addNamedListener("PUBLISH_API_ATTEMPT","apiCallAttempt",function(s){process.nextTick(function(){i.eventHandler(s)})})}},validateService:function(){},loadServiceClass:function(e){var r=e;if(B.util.isEmpty(this.api)){if(r.apiConfig)return B.Service.defineServiceApi(this.constructor,r.apiConfig);if(this.constructor.services){r=new B.Config(B.config),r.update(e,!0);var i=r.apiVersions[this.constructor.serviceIdentifier];return i=i||r.apiVersion,this.getLatestServiceClass(i)}else return null}else return null},getLatestServiceClass:function(e){return e=this.getLatestServiceVersion(e),this.constructor.services[e]===null&&B.Service.defineServiceApi(this.constructor,e),this.constructor.services[e]},getLatestServiceVersion:function(e){if(!this.constructor.services||this.constructor.services.length===0)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(e?B.util.isType(e,Date)&&(e=B.util.date.iso8601(e).split("T")[0]):e="latest",Object.hasOwnProperty(this.constructor.services,e))return e;for(var r=Object.keys(this.constructor.services).sort(),i=null,n=r.length-1;n>=0;n--)if(r[n][r[n].length-1]!=="*"&&(i=r[n]),r[n].substr(0,10)<=e)return i;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(!e)this.customRequestHandler=null;else if(typeof e=="function")this.customRequestHandler=e;else throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests")},makeRequest:function(e,r,i){if(typeof r=="function"&&(i=r,r=null),r=r||{},this.config.params){var n=this.api.operations[e];n&&(r=B.util.copy(r),B.util.each(this.config.params,function(o,a){n.input.members[o]&&(r[o]===void 0||r[o]===null)&&(r[o]=a)}))}var s=new B.Request(this,e,r);return this.addAllRequestListeners(s),this.attachMonitoringEmitter(s),i&&s.send(i),s},makeUnauthenticatedRequest:function(e,r,i){typeof r=="function"&&(i=r,r={});var n=this.makeRequest(e,r).toUnauthenticated();return i?n.send(i):n},waitFor:function(e,r,i){var n=new B.ResourceWaiter(this,e);return n.wait(r,i)},addAllRequestListeners:function(e){for(var r=[B.events,B.EventListeners.Core,this.serviceInterface(),B.EventListeners.CorePost],i=0;i299?(s.code&&(i.FinalAwsException=s.code),s.message&&(i.FinalAwsExceptionMessage=s.message)):((s.code||s.name)&&(i.FinalSdkException=s.code||s.name),s.message&&(i.FinalSdkExceptionMessage=s.message))}return i},apiAttemptEvent:function(e){var r=e.service.api.operations[e.operation],i={Type:"ApiCallAttempt",Api:r?r.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},n=e.response;return n.httpResponse.statusCode&&(i.HttpStatusCode=n.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(i.AccessKey=e.service.config.credentials.accessKeyId),n.httpResponse.headers&&(e.httpRequest.headers["x-amz-security-token"]&&(i.SessionToken=e.httpRequest.headers["x-amz-security-token"]),n.httpResponse.headers["x-amzn-requestid"]&&(i.XAmznRequestId=n.httpResponse.headers["x-amzn-requestid"]),n.httpResponse.headers["x-amz-request-id"]&&(i.XAmzRequestId=n.httpResponse.headers["x-amz-request-id"]),n.httpResponse.headers["x-amz-id-2"]&&(i.XAmzId2=n.httpResponse.headers["x-amz-id-2"])),i},attemptFailEvent:function(e){var r=this.apiAttemptEvent(e),i=e.response,n=i.error;return i.httpResponse.statusCode>299?(n.code&&(r.AwsException=n.code),n.message&&(r.AwsExceptionMessage=n.message)):((n.code||n.name)&&(r.SdkException=n.code||n.name),n.message&&(r.SdkExceptionMessage=n.message)),r},attachMonitoringEmitter:function(e){var r,i,n,s,o=0,a,u,c=this,l=!0;e.on("validate",function(){s=B.util.realClock.now(),u=Date.now()},l),e.on("sign",function(){i=B.util.realClock.now(),r=Date.now(),a=e.httpRequest.region,o++},l),e.on("validateResponse",function(){n=Math.round(B.util.realClock.now()-i)}),e.addNamedListener("API_CALL_ATTEMPT","success",function(){var g=c.apiAttemptEvent(e);g.Timestamp=r,g.AttemptLatency=n>=0?n:0,g.Region=a,c.emit("apiCallAttempt",[g])}),e.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var g=c.attemptFailEvent(e);g.Timestamp=r,n=n||Math.round(B.util.realClock.now()-i),g.AttemptLatency=n>=0?n:0,g.Region=a,c.emit("apiCallAttempt",[g])}),e.addNamedListener("API_CALL","complete",function(){var g=c.apiCallEvent(e);if(g.AttemptCount=o,!(g.AttemptCount<=0)){g.Timestamp=u;var b=Math.round(B.util.realClock.now()-s);g.Latency=b>=0?b:0;var y=e.response;y.error&&y.error.retryable&&typeof y.retryCount=="number"&&typeof y.maxRetries=="number"&&y.retryCount>=y.maxRetries&&(g.MaxRetriesExceeded=1),c.emit("apiCall",[g])}})},setupRequestListeners:function(e){},getSigningName:function(){return this.api.signingName||this.api.endpointPrefix},getSignerClass:function(e){var r,i=null,n="";if(e){var s=e.service.api.operations||{};i=s[e.operation]||null,n=i?i.authtype:""}return this.config.signatureVersion?r=this.config.signatureVersion:n==="v4"||n==="v4-unsigned-body"?r="v4":r=this.api.signatureVersion,B.Signers.RequestSigner.getVersion(r)},serviceInterface:function(){switch(this.api.protocol){case"ec2":return B.EventListeners.Query;case"query":return B.EventListeners.Query;case"json":return B.EventListeners.Json;case"rest-json":return B.EventListeners.RestJson;case"rest-xml":return B.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return this.config.maxRetries!==void 0?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e,r){return B.util.calculateRetryDelay(e,this.config.retryDelayOptions,r)},retryableError:function(e){return!!(this.timeoutError(e)||this.networkingError(e)||this.expiredCredentialsError(e)||this.throttledError(e)||e.statusCode>=500)},networkingError:function(e){return e.code==="NetworkingError"},timeoutError:function(e){return e.code==="TimeoutError"},expiredCredentialsError:function(e){return e.code==="ExpiredTokenException"},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e5},throttledError:function(e){if(e.statusCode===429)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":case"EC2ThrottledException":return!0;default:return!1}},endpointFromTemplate:function(e){if(typeof e!="string")return e;var r=e;return r=r.replace(/\{service\}/g,this.api.endpointPrefix),r=r.replace(/\{region\}/g,this.config.region),r=r.replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http"),r},setEndpoint:function(e){this.endpoint=new B.Endpoint(e,this.config)},paginationConfig:function(e,r){var i=this.api.operations[e].paginator;if(!i){if(r){var n=new Error;throw B.util.error(n,"No pagination configuration for "+e)}return null}return i}});B.util.update(B.Service,{defineMethods:function(e){B.util.each(e.prototype.api.operations,function(i){if(!e.prototype[i]){var n=e.prototype.api.operations[i];n.authtype==="none"?e.prototype[i]=function(s,o){return this.makeUnauthenticatedRequest(i,s,o)}:e.prototype[i]=function(s,o){return this.makeRequest(i,s,o)}}})},defineService:function(e,r,i){B.Service._serviceMap[e]=!0,Array.isArray(r)||(i=r,r=[]);var n=_n(B.Service,i||{});if(typeof e=="string"){B.Service.addVersions(n,r);var s=n.serviceIdentifier||e;n.serviceIdentifier=s}else n.prototype.api=e,B.Service.defineMethods(n);if(B.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&B.util.clientSideMonitoring){var o=B.util.clientSideMonitoring.Publisher,a=B.util.clientSideMonitoring.configProvider,u=a();this.prototype.publisher=new o(u),u.enabled&&(B.Service._clientSideMonitoring=!0)}return B.SequentialExecutor.call(n.prototype),B.Service.addDefaultMonitoringListeners(n.prototype),n},addVersions:function(e,r){Array.isArray(r)||(r=[r]),e.services=e.services||{};for(var i=0;i{var Be=j();Be.Credentials=Be.util.inherit({constructor:function(){if(Be.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],arguments.length===1&&typeof arguments[0]=="object"){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=Be.util.date.getDate().getTime(),r=new Date(e+this.expiryWindow*1e3);return this.expireTime&&r>this.expireTime?!0:this.expired||!this.accessKeyId||!this.secretAccessKey},get:function(e){var r=this;this.needsRefresh()?this.refresh(function(i){i||(r.expired=!1),e&&e(i)}):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,r){var i=this;i.refreshCallbacks.push(e)===1&&i.load(function(s){Be.util.arrayEach(i.refreshCallbacks,function(o){r?o(s):Be.util.defer(function(){o(s)})}),i.refreshCallbacks.length=0})},load:function(e){e()}});Be.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=Be.util.promisifyMethod("get",e),this.prototype.refreshPromise=Be.util.promisifyMethod("refresh",e)};Be.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise};Be.util.addPromises(Be.Credentials)});var Cn=I(()=>{var He=j();He.CredentialProviderChain=He.util.inherit(He.Credentials,{constructor:function(e){e?this.providers=e:this.providers=He.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var r=this;if(r.providers.length===0)return e(new Error("No providers")),r;if(r.resolveCallbacks.push(e)===1){let o=function(a,u){if(!a&&u||i===n.length){He.util.arrayEach(r.resolveCallbacks,function(l){l(a,u)}),r.resolveCallbacks.length=0;return}var c=n[i++];typeof c=="function"?u=c.call():u=c,u.get?u.get(function(l){o(l,l?null:u)}):o(null,u)};var s=o,i=0,n=r.providers.slice(0);o()}return r}});He.CredentialProviderChain.defaultProviders=[];He.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=He.util.promisifyMethod("resolve",e)};He.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise};He.util.addPromises(He.CredentialProviderChain)});var Ko=I(()=>{var ne=j();wn();Cn();var ni;ne.Config=ne.util.inherit({constructor:function(e){e===void 0&&(e={}),e=this.extractCredentials(e),ne.util.each.call(this,this.keys,function(r,i){this.set(r,e[r],i)})},getCredentials:function(e){var r=this;function i(a){e(a,a?null:r.credentials)}function n(a,u){return new ne.util.error(u||new Error,{code:"CredentialsError",message:a,name:"CredentialsError"})}function s(){r.credentials.get(function(a){if(a){var u="Could not load credentials from "+r.credentials.constructor.name;a=n(u,a)}i(a)})}function o(){var a=null;(!r.credentials.accessKeyId||!r.credentials.secretAccessKey)&&(a=n("Missing credentials")),i(a)}r.credentials?typeof r.credentials.get=="function"?s():o():r.credentialProvider?r.credentialProvider.resolve(function(a,u){a&&(a=n("Could not load credentials from any providers",a)),r.credentials=u,i(a)}):i(n("No credentials to load"))},update:function(e,r){r=r||!1,e=this.extractCredentials(e),ne.util.each.call(this,e,function(i,n){(r||Object.prototype.hasOwnProperty.call(this.keys,i)||ne.Service.hasService(i))&&this.set(i,n)})},loadFromPath:function(e){this.clear();var r=JSON.parse(ne.util.readFileSync(e)),i=new ne.FileSystemCredentials(e),n=new ne.CredentialProviderChain;return n.providers.unshift(i),n.resolve(function(s,o){if(s)throw s;r.credentials=o}),this.constructor(r),this},clear:function(){ne.util.each.call(this,this.keys,function(e){delete this[e]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(e,r,i){r===void 0?(i===void 0&&(i=this.keys[e]),typeof i=="function"?this[e]=i.call(this):this[e]=i):e==="httpOptions"&&this[e]?this[e]=ne.util.merge(this[e],r):this[e]=r},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,s3UsEast1RegionalEndpoint:"legacy",s3UseArnRegion:void 0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:void 0,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:"legacy",useFipsEndpoint:!1,useDualstackEndpoint:!1},extractCredentials:function(e){return e.accessKeyId&&e.secretAccessKey&&(e=ne.util.copy(e),e.credentials=new ne.Credentials(e)),e},setPromisesDependency:function(e){ni=e,e===null&&typeof Promise=="function"&&(ni=Promise);var r=[ne.Request,ne.Credentials,ne.CredentialProviderChain];ne.S3&&(r.push(ne.S3),ne.S3.ManagedUpload&&r.push(ne.S3.ManagedUpload)),ne.util.addPromises(r,ni)},getPromisesDependency:function(){return ni}});ne.config=new ne.Config});var oi=I(()=>{var ge=j(),si=ge.util.inherit;ge.Endpoint=si({constructor:function(e,r){if(ge.util.hideProperties(this,["slashes","auth","hash","search","query"]),typeof e=="undefined"||e===null)throw new Error("Invalid endpoint: "+e);if(typeof e!="string")return ge.util.copy(e);if(!e.match(/^http/)){var i=r&&r.sslEnabled!==void 0?r.sslEnabled:ge.config.sslEnabled;e=(i?"https":"http")+"://"+e}ge.util.update(this,ge.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port=this.protocol==="https:"?443:80}});ge.HttpRequest=si({constructor:function(e,r){e=new ge.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=r,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=ge.util.userAgent()},getUserAgentHeaderName:function(){var e=ge.util.isBrowser()?"X-Amz-":"";return e+"User-Agent"},appendToUserAgent:function(e){typeof e=="string"&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=ge.util.queryStringParse(e),ge.util.queryParamsToString(e)):""},updateEndpoint:function(e){var r=new ge.Endpoint(e);this.endpoint=r,this.path=r.path||"/",this.headers.Host&&(this.headers.Host=r.host)}});ge.HttpResponse=si({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}});ge.HttpClient=si({});ge.HttpClient.getInstance=function(){return this.singleton===void 0&&(this.singleton=new this),this.singleton}});var ta=I((Oy,ea)=>{var he=j(),qe=le(),Go=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function ai(t){var e=t.service,r=e.api||{},i=r.operations,n={};return e.config.region&&(n.region=e.config.region),r.serviceId&&(n.serviceId=r.serviceId),e.config.credentials.accessKeyId&&(n.accessKeyId=e.config.credentials.accessKeyId),n}function $o(t,e,r){!r||e===void 0||e===null||r.type==="structure"&&r.required&&r.required.length>0&&qe.arrayEach(r.required,function(i){var n=r.members[i];if(n.endpointDiscoveryId===!0){var s=n.isLocationName?n.name:i;t[s]=String(e[i])}else $o(t,e[i],n)})}function ui(t,e){var r={};return $o(r,t.params,e),r}function Yo(t){var e=t.service,r=e.api,i=r.operations?r.operations[t.operation]:void 0,n=i?i.input:void 0,s=ui(t,n),o=ai(t);Object.keys(s).length>0&&(o=qe.update(o,s),i&&(o.operation=i.name));var a=he.endpointCache.get(o);if(!(a&&a.length===1&&a[0].Address===""))if(a&&a.length>0)t.httpRequest.updateEndpoint(a[0].Address);else{var u=e.makeRequest(r.endpointOperation,{Operation:i.name,Identifiers:s});Qo(u),u.removeListener("validate",he.EventListeners.Core.VALIDATE_PARAMETERS),u.removeListener("retry",he.EventListeners.Core.RETRY_CHECK),he.endpointCache.put(o,[{Address:"",CachePeriodInMinutes:1}]),u.send(function(c,l){l&&l.Endpoints?he.endpointCache.put(o,l.Endpoints):c&&he.endpointCache.put(o,[{Address:"",CachePeriodInMinutes:1}])})}}var pt={};function Jo(t,e){var r=t.service,i=r.api,n=i.operations?i.operations[t.operation]:void 0,s=n?n.input:void 0,o=ui(t,s),a=ai(t);Object.keys(o).length>0&&(a=qe.update(a,o),n&&(a.operation=n.name));var u=he.EndpointCache.getKeyString(a),c=he.endpointCache.get(u);if(c&&c.length===1&&c[0].Address===""){pt[u]||(pt[u]=[]),pt[u].push({request:t,callback:e});return}else if(c&&c.length>0)t.httpRequest.updateEndpoint(c[0].Address),e();else{var l=r.makeRequest(i.endpointOperation,{Operation:n.name,Identifiers:o});l.removeListener("validate",he.EventListeners.Core.VALIDATE_PARAMETERS),Qo(l),he.endpointCache.put(u,[{Address:"",CachePeriodInMinutes:60}]),l.send(function(h,g){if(h){if(t.response.error=qe.error(h,{retryable:!1}),he.endpointCache.remove(a),pt[u]){var b=pt[u];qe.arrayEach(b,function(y){y.request.response.error=qe.error(h,{retryable:!1}),y.callback()}),delete pt[u]}}else if(g&&(he.endpointCache.put(u,g.Endpoints),t.httpRequest.updateEndpoint(g.Endpoints[0].Address),pt[u])){var b=pt[u];qe.arrayEach(b,function(E){E.request.httpRequest.updateEndpoint(g.Endpoints[0].Address),E.callback()}),delete pt[u]}e()})}}function Qo(t){var e=t.service.api,r=e.apiVersion;r&&!t.httpRequest.headers["x-amz-api-version"]&&(t.httpRequest.headers["x-amz-api-version"]=r)}function Tn(t){var e=t.error,r=t.httpResponse;if(e&&(e.code==="InvalidEndpointException"||r.statusCode===421)){var i=t.request,n=i.service.api.operations||{},s=n[i.operation]?n[i.operation].input:void 0,o=ui(i,s),a=ai(i);Object.keys(o).length>0&&(a=qe.update(a,o),n[i.operation]&&(a.operation=n[i.operation].name)),he.endpointCache.remove(a)}}function Ud(t){if(t._originalConfig&&t._originalConfig.endpoint&&t._originalConfig.endpointDiscoveryEnabled===!0)throw qe.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var e=he.config[t.serviceIdentifier]||{};return Boolean(he.config.endpoint||e.endpoint||t._originalConfig&&t._originalConfig.endpoint)}function Zo(t){return["false","0"].indexOf(t)>=0}function jd(t){var e=t.service||{};if(e.config.endpointDiscoveryEnabled!==void 0)return e.config.endpointDiscoveryEnabled;if(!qe.isBrowser()){for(var r=0;r{var G=j(),wt=En(),Xd=ta().discoverEndpoint;G.EventListeners={Core:{}};function Wd(t){if(!t.service.api.operations)return"";var e=t.service.api.operations[t.operation];return e?e.authtype:""}G.EventListeners={Core:new wt().addNamedListeners(function(t,e){e("VALIDATE_CREDENTIALS","validate",function(n,s){if(!n.service.api.signatureVersion&&!n.service.config.signatureVersion)return s();n.service.config.getCredentials(function(o){o&&(n.response.error=G.util.error(o,{code:"CredentialsError",message:"Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1"})),s()})}),t("VALIDATE_REGION","validate",function(n){if(!n.service.isGlobalEndpoint){var s=new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);n.service.config.region?s.test(n.service.config.region)||(n.response.error=G.util.error(new Error,{code:"ConfigError",message:"Invalid region in config"})):n.response.error=G.util.error(new Error,{code:"ConfigError",message:"Missing region in config"})}}),t("BUILD_IDEMPOTENCY_TOKENS","validate",function(n){if(!!n.service.api.operations){var s=n.service.api.operations[n.operation];if(!!s){var o=s.idempotentMembers;if(!!o.length){for(var a=G.util.copy(n.params),u=0,c=o.length;u=0)return n.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",s();G.util.computeSha256(u,function(c,l){c?s(c):(n.httpRequest.headers["X-Amz-Content-Sha256"]=l,s())})}else s()}}),t("SET_CONTENT_LENGTH","afterBuild",function(n){var s=Wd(n),o=G.util.getRequestPayloadShape(n);if(n.httpRequest.headers["Content-Length"]===void 0)try{var a=G.util.string.byteLength(n.httpRequest.body);n.httpRequest.headers["Content-Length"]=a}catch(u){if(o&&o.isStreaming){if(o.requiresLength)throw u;if(s.indexOf("unsigned-body")>=0){n.httpRequest.headers["Transfer-Encoding"]="chunked";return}else throw u}throw u}}),t("SET_HTTP_HOST","afterBuild",function(n){n.httpRequest.headers.Host=n.httpRequest.endpoint.host}),t("SET_TRACE_ID","afterBuild",function(n){var s="X-Amzn-Trace-Id";if(G.util.isNode()&&!Object.hasOwnProperty.call(n.httpRequest.headers,s)){var o="AWS_LAMBDA_FUNCTION_NAME",a="_X_AMZN_TRACE_ID",u=process.env[o],c=process.env[a];typeof u=="string"&&u.length>0&&typeof c=="string"&&c.length>0&&(n.httpRequest.headers[s]=c)}}),t("RESTART","restart",function(){var n=this.response.error;!n||!n.retryable||(this.httpRequest=new G.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=60*10?this.emit("sign",[this],function(h){h?s(h):c()}):c()}),t("HTTP_HEADERS","httpHeaders",function(n,s,o,a){o.httpResponse.statusCode=n,o.httpResponse.statusMessage=a,o.httpResponse.headers=s,o.httpResponse.body=G.util.buffer.toBuffer(""),o.httpResponse.buffers=[],o.httpResponse.numBytes=0;var u=s.date||s.Date,c=o.request.service;if(u){var l=Date.parse(u);c.config.correctClockSkew&&c.isClockSkewed(l)&&c.applyClockOffset(l)}}),t("HTTP_DATA","httpData",function(n,s){if(n){if(G.util.isNode()){s.httpResponse.numBytes+=n.length;var o=s.httpResponse.headers["content-length"],a={loaded:s.httpResponse.numBytes,total:o};s.request.emit("httpDownloadProgress",[a,s])}s.httpResponse.buffers.push(G.util.buffer.toBuffer(n))}}),t("HTTP_DONE","httpDone",function(n){if(n.httpResponse.buffers&&n.httpResponse.buffers.length>0){var s=G.util.buffer.concat(n.httpResponse.buffers);n.httpResponse.body=s}delete n.httpResponse.numBytes,delete n.httpResponse.buffers}),t("FINALIZE_ERROR","retry",function(n){n.httpResponse.statusCode&&(n.error.statusCode=n.httpResponse.statusCode,n.error.retryable===void 0&&(n.error.retryable=this.service.retryableError(n.error,this)))}),t("INVALIDATE_CREDENTIALS","retry",function(n){if(!!n.error)switch(n.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":n.error.retryable=!0,n.request.service.config.credentials.expired=!0}}),t("EXPIRED_SIGNATURE","retry",function(n){var s=n.error;!s||typeof s.code=="string"&&typeof s.message=="string"&&s.code.match(/Signature/)&&s.message.match(/expired/)&&(n.error.retryable=!0)}),t("CLOCK_SKEWED","retry",function(n){!n.error||this.service.clockSkewError(n.error)&&this.service.config.correctClockSkew&&(n.error.retryable=!0)}),t("REDIRECT","retry",function(n){n.error&&n.error.statusCode>=300&&n.error.statusCode<400&&n.httpResponse.headers.location&&(this.httpRequest.endpoint=new G.Endpoint(n.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,n.error.redirect=!0,n.error.retryable=!0)}),t("RETRY_CHECK","retry",function(n){n.error&&(n.error.redirect&&n.redirectCount=0?(n.error=null,setTimeout(s,o)):s()})}),CorePost:new wt().addNamedListeners(function(t){t("EXTRACT_REQUEST_ID","extractData",G.util.extractRequestId),t("EXTRACT_REQUEST_ID","extractError",G.util.extractRequestId),t("ENOTFOUND_ERROR","httpError",function(r){function i(s){return s.errno==="ENOTFOUND"||typeof s.errno=="number"&&typeof G.util.getSystemErrorName=="function"&&["EAI_NONAME","EAI_NODATA"].indexOf(G.util.getSystemErrorName(s.errno)>=0)}if(r.code==="NetworkingError"&&i(r)){var n="Inaccessible host: `"+r.hostname+"' at port `"+r.port+"'. This service may not be available in the `"+r.region+"' region.";this.response.error=G.util.error(new Error(n),{code:"UnknownEndpoint",region:r.region,hostname:r.hostname,retryable:!0,originalError:r})}})}),Logger:new wt().addNamedListeners(function(t){t("LOG_REQUEST","complete",function(r){var i=r.request,n=i.service.config.logger;if(!n)return;function s(u,c){if(!c)return c;if(u.isSensitive)return"***SensitiveInformation***";switch(u.type){case"structure":var l={};return G.util.each(c,function(b,y){Object.prototype.hasOwnProperty.call(u.members,b)?l[b]=s(u.members[b],y):l[b]=y}),l;case"list":var h=[];return G.util.arrayEach(c,function(b,y){h.push(s(u.member,b))}),h;case"map":var g={};return G.util.each(c,function(b,y){g[b]=s(u.value,y)}),g;default:return c}}function o(){var u=r.request.service.getSkewCorrectedDate().getTime(),c=(u-i.startTime.getTime())/1e3,l=!!n.isTTY,h=r.httpResponse.statusCode,g=i.params;if(i.service.api.operations&&i.service.api.operations[i.operation]&&i.service.api.operations[i.operation].input){var b=i.service.api.operations[i.operation].input;g=s(b,i.params)}var y=require("util").inspect(g,!0,null),E="";return l&&(E+=""),E+="[AWS "+i.service.serviceIdentifier+" "+h,E+=" "+c.toString()+"s "+r.retryCount+" retries]",l&&(E+=""),E+=" "+G.util.string.lowerFirst(i.operation),E+="("+y+")",l&&(E+=""),E}var a=o();typeof n.log=="function"?n.log(a):typeof n.write=="function"&&n.write(a+` -`)})}),Json:new wt().addNamedListeners(function(t){var e=Jr();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),Rest:new wt().addNamedListeners(function(t){var e=nr();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),RestJson:new wt().addNamedListeners(function(t){var e=cn();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),RestXml:new wt().addNamedListeners(function(t){var e=fn();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),Query:new wt().addNamedListeners(function(t){var e=an();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)})}});var na=I((My,ia)=>{function bn(t,e){this.currentState=e||null,this.states=t||{}}bn.prototype.runTo=function(e,r,i,n){typeof e=="function"&&(n=i,i=r,r=e,e=null);var s=this,o=s.states[s.currentState];o.fn.call(i||s,n,function(a){if(a)if(o.fail)s.currentState=o.fail;else return r?r.call(i,a):null;else if(o.accept)s.currentState=o.accept;else return r?r.call(i):null;if(s.currentState===e)return r?r.call(i,a):null;s.runTo(e,r,i,a)})};bn.prototype.addState=function(e,r,i,n){return typeof r=="function"?(n=r,r=null,i=null):typeof i=="function"&&(n=i,i=null),this.currentState||(this.currentState=e),this.states[e]={accept:r,fail:i,fn:n},this};ia.exports=bn});var li=I(ci=>{(function(t){"use strict";function e(p){return p!==null?Object.prototype.toString.call(p)==="[object Array]":!1}function r(p){return p!==null?Object.prototype.toString.call(p)==="[object Object]":!1}function i(p,v){if(p===v)return!0;var w=Object.prototype.toString.call(p);if(w!==Object.prototype.toString.call(v))return!1;if(e(p)===!0){if(p.length!==v.length)return!1;for(var P=0;P",9:"Array"},_="EOF",R="UnquotedIdentifier",N="QuotedIdentifier",C="Rbracket",T="Rparen",L="Comma",X="Colon",M="Rbrace",W="Number",A="Current",ve="Expref",fe="Pipe",Q="Or",Pe="And",it="EQ",nt="GT",xt="LT",$="GTE",jt="LTE",gt="NE",Le="Flatten",Ce="Star",st="Filter",Rt="Dot",Vt="Not",Et="Lbrace",ot="Lbracket",m="Lparen",f="Literal",q={".":Rt,"*":Ce,",":L,":":X,"{":Et,"}":M,"]":C,"(":m,")":T,"@":A},x={"<":!0,">":!0,"=":!0,"!":!0},J={" ":!0," ":!0,"\n":!0};function ae(p){return p>="a"&&p<="z"||p>="A"&&p<="Z"||p==="_"}function ue(p){return p>="0"&&p<="9"||p==="-"}function we(p){return p>="a"&&p<="z"||p>="A"&&p<="Z"||p>="0"&&p<="9"||p==="_"}function xe(){}xe.prototype={tokenize:function(p){var v=[];this._current=0;for(var w,P,O;this._current")return p[this._current]==="="?(this._current++,{type:$,value:">=",start:v}):{type:nt,value:">",start:v};if(w==="="&&p[this._current]==="=")return this._current++,{type:it,value:"==",start:v}},_consumeLiteral:function(p){this._current++;for(var v=this._current,w=p.length,P;p[this._current]!=="`"&&this._current=0)return!0;if(w.indexOf(p)>=0)return!0;if(P.indexOf(p[0])>=0)try{return JSON.parse(p),!0}catch(O){return!1}else return!1}};var H={};H[_]=0,H[R]=0,H[N]=0,H[C]=0,H[T]=0,H[L]=0,H[M]=0,H[W]=0,H[A]=0,H[ve]=0,H[fe]=1,H[Q]=2,H[Pe]=3,H[it]=5,H[nt]=5,H[xt]=5,H[$]=5,H[jt]=5,H[gt]=5,H[Le]=9,H[Ce]=20,H[st]=21,H[Rt]=40,H[Vt]=45,H[Et]=50,H[ot]=55,H[m]=60;function ce(){}ce.prototype={parse:function(p){this._loadTokens(p),this.index=0;var v=this.expression(0);if(this._lookahead(0)!==_){var w=this._lookaheadToken(0),P=new Error("Unexpected token type: "+w.type+", value: "+w.value);throw P.name="ParserError",P}return v},_loadTokens:function(p){var v=new xe,w=v.tokenize(p);w.push({type:_,value:"",start:p.length}),this.tokens=w},expression:function(p){var v=this._lookaheadToken(0);this._advance();for(var w=this.nud(v),P=this._lookahead(0);p=0)return this.expression(p);if(v===ot)return this._match(ot),this._parseMultiselectList();if(v===Et)return this._match(Et),this._parseMultiselectHash()},_parseProjectionRHS:function(p){var v;if(H[this._lookahead(0)]<10)v={type:"Identity"};else if(this._lookahead(0)===ot)v=this.expression(p);else if(this._lookahead(0)===st)v=this.expression(p);else if(this._lookahead(0)===Rt)this._match(Rt),v=this._parseDotRHS(p);else{var w=this._lookaheadToken(0),P=new Error("Sytanx error, unexpected token: "+w.value+"("+w.type+")");throw P.name="ParserError",P}return v},_parseMultiselectList:function(){for(var p=[];this._lookahead(0)!==C;){var v=this.expression(0);if(p.push(v),this._lookahead(0)===L&&(this._match(L),this._lookahead(0)===C))throw new Error("Unexpected token Rbracket")}return this._match(C),{type:"MultiSelectList",children:p}},_parseMultiselectHash:function(){for(var p=[],v=[R,N],w,P,O,F;;){if(w=this._lookaheadToken(0),v.indexOf(w.type)<0)throw new Error("Expecting an identifier token, got: "+w.type);if(P=w.value,this._advance(),this._match(X),O=this.expression(0),F={type:"KeyValuePair",name:P,value:O},p.push(F),this._lookahead(0)===L)this._match(L);else if(this._lookahead(0)===M){this._match(M);break}}return{type:"MultiSelectHash",children:p}}};function ke(p){this.runtime=p}ke.prototype={search:function(p,v){return this.visit(p,v)},visit:function(p,v){var w,P,O,F,K,Y,Te,at,pe,z;switch(p.type){case"Field":return v!==null&&r(v)?(Y=v[p.name],Y===void 0?null:Y):null;case"Subexpression":for(O=this.visit(p.children[0],v),z=1;z0)for(z=Yn;zJn;z+=Mi)O.push(v[z]);return O;case"Projection":var Xe=this.visit(p.children[0],v);if(!e(Xe))return null;for(pe=[],z=0;zK;break;case $:O=F>=K;break;case xt:O=F=p&&(v=w<0?p-1:p),v}};function Lr(p){this._interpreter=p,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[u]}]},avg:{_func:this._functionAvg,_signature:[{types:[D]}]},ceil:{_func:this._functionCeil,_signature:[{types:[u]}]},contains:{_func:this._functionContains,_signature:[{types:[l,h]},{types:[c]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[l]},{types:[l]}]},floor:{_func:this._functionFloor,_signature:[{types:[u]}]},length:{_func:this._functionLength,_signature:[{types:[l,h,g]}]},map:{_func:this._functionMap,_signature:[{types:[y]},{types:[h]}]},max:{_func:this._functionMax,_signature:[{types:[D,S]}]},merge:{_func:this._functionMerge,_signature:[{types:[g],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[h]},{types:[y]}]},sum:{_func:this._functionSum,_signature:[{types:[D]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[l]},{types:[l]}]},min:{_func:this._functionMin,_signature:[{types:[D,S]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[h]},{types:[y]}]},type:{_func:this._functionType,_signature:[{types:[c]}]},keys:{_func:this._functionKeys,_signature:[{types:[g]}]},values:{_func:this._functionValues,_signature:[{types:[g]}]},sort:{_func:this._functionSort,_signature:[{types:[S,D]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[h]},{types:[y]}]},join:{_func:this._functionJoin,_signature:[{types:[l]},{types:[S]}]},reverse:{_func:this._functionReverse,_signature:[{types:[l,h]}]},to_array:{_func:this._functionToArray,_signature:[{types:[c]}]},to_string:{_func:this._functionToString,_signature:[{types:[c]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[c]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[c],variadic:!0}]}}}Lr.prototype={callFunction:function(p,v){var w=this.functionTable[p];if(w===void 0)throw new Error("Unknown function: "+p+"()");return this._validateArgs(p,v,w._signature),w._func.call(this,v)},_validateArgs:function(p,v,w){var P;if(w[w.length-1].variadic){if(v.length=0;O--)P+=w[O];return P}else{var F=p[0].slice(0);return F.reverse(),F}},_functionAbs:function(p){return Math.abs(p[0])},_functionCeil:function(p){return Math.ceil(p[0])},_functionAvg:function(p){for(var v=0,w=p[0],P=0;P=0},_functionFloor:function(p){return Math.floor(p[0])},_functionLength:function(p){return r(p[0])?Object.keys(p[0]).length:p[0].length},_functionMap:function(p){for(var v=[],w=this._interpreter,P=p[0],O=p[1],F=0;F0){var v=this._getTypeName(p[0][0]);if(v===u)return Math.max.apply(Math,p[0]);for(var w=p[0],P=w[0],O=1;O0){var v=this._getTypeName(p[0][0]);if(v===u)return Math.min.apply(Math,p[0]);for(var w=p[0],P=w[0],O=1;Out?1:zO&&(O=K,F=w[Y]);return F},_functionMinBy:function(p){for(var v=p[1],w=p[0],P=this.createKeyFunction(v,[u,l]),O=1/0,F,K,Y=0;Y{var ee=j(),sa=na(),Hd=ee.util.inherit,fi=ee.util.domain,zd=li(),Kd={success:1,error:1,complete:1};function Gd(t){return Object.prototype.hasOwnProperty.call(Kd,t._asm.currentState)}var An=new sa;An.setupStates=function(){var t=function(e,r){var i=this;i._haltHandlersOnError=!1,i.emit(i._asm.currentState,function(n){if(n)if(Gd(i))if(fi&&i.domain instanceof fi.Domain)n.domainEmitter=i,n.domain=i.domain,n.domainThrown=!1,i.domain.emit("error",n);else throw n;else i.response.error=n,r(n);else r(i.response.error)})};this.addState("validate","build","error",t),this.addState("build","afterBuild","restart",t),this.addState("afterBuild","sign","restart",t),this.addState("sign","send","retry",t),this.addState("retry","afterRetry","afterRetry",t),this.addState("afterRetry","sign","error",t),this.addState("send","validateResponse","retry",t),this.addState("validateResponse","extractData","extractError",t),this.addState("extractError","extractData","retry",t),this.addState("extractData","success","retry",t),this.addState("restart","build","error",t),this.addState("success","complete","complete",t),this.addState("error","complete","complete",t),this.addState("complete",null,null,t)};An.setupStates();ee.Request=Hd({constructor:function(e,r,i){var n=e.endpoint,s=e.config.region,o=e.config.customUserAgent;e.signingRegion?s=e.signingRegion:e.isGlobalEndpoint&&(s="us-east-1"),this.domain=fi&&fi.active,this.service=e,this.operation=r,this.params=i||{},this.httpRequest=new ee.HttpRequest(n,s),this.httpRequest.appendToUserAgent(o),this.startTime=e.getSkewCorrectedDate(),this.response=new ee.Response(this),this._asm=new sa(An.states,"validate"),this._haltHandlersOnError=!1,ee.SequentialExecutor.call(this),this.emit=this.emitEvent},send:function(e){return e&&(this.httpRequest.appendToUserAgent("callback"),this.on("complete",function(r){e.call(r,r.error,r.data)})),this.runTo(),this.response},build:function(e){return this.runTo("send",e)},runTo:function(e,r){return this._asm.runTo(e,r,this),this},abort:function(){return this.removeAllListeners("validateResponse"),this.removeAllListeners("extractError"),this.on("validateResponse",function(r){r.error=ee.util.error(new Error("Request aborted by user"),{code:"RequestAbortedError",retryable:!1})}),this.httpRequest.stream&&!this.httpRequest.stream.didCallback&&(this.httpRequest.stream.abort(),this.httpRequest._abortCallback?this.httpRequest._abortCallback():this.removeAllListeners("send")),this},eachPage:function(e){e=ee.util.fn.makeAsync(e,3);function r(i){e.call(i,i.error,i.data,function(n){n!==!1&&(i.hasNextPage()?i.nextPage().on("complete",r).send():e.call(i,null,null,ee.util.fn.noop))})}this.on("complete",r).send()},eachItem:function(e){var r=this;function i(n,s){if(n)return e(n,null);if(s===null)return e(null,null);var o=r.service.paginationConfig(r.operation),a=o.resultKey;Array.isArray(a)&&(a=a[0]);var u=zd.search(s,a),c=!0;return ee.util.arrayEach(u,function(l){if(c=e(null,l),c===!1)return ee.util.abort}),c}this.eachPage(i)},isPageable:function(){return!!this.service.paginationConfig(this.operation)},createReadStream:function(){var e=ee.util.stream,r=this,i=null;return ee.HttpClient.streamsApiVersion===2?(i=new e.PassThrough,process.nextTick(function(){r.send()})):(i=new e.Stream,i.readable=!0,i.sent=!1,i.on("newListener",function(n){!i.sent&&n==="data"&&(i.sent=!0,process.nextTick(function(){r.send()}))})),this.on("error",function(n){i.emit("error",n)}),this.on("httpHeaders",function(s,o,a){if(s<300){r.removeListener("httpData",ee.EventListeners.Core.HTTP_DATA),r.removeListener("httpError",ee.EventListeners.Core.HTTP_ERROR),r.on("httpError",function(E){a.error=E,a.error.retryable=!1});var u=!1,c;if(r.httpRequest.method!=="HEAD"&&(c=parseInt(o["content-length"],10)),c!==void 0&&!isNaN(c)&&c>=0){u=!0;var l=0}var h=function(){u&&l!==c?i.emit("error",ee.util.error(new Error("Stream content length mismatch. Received "+l+" of "+c+" bytes."),{code:"StreamContentLengthMismatch"})):ee.HttpClient.streamsApiVersion===2?i.end():i.emit("end")},g=a.httpResponse.createUnbufferedStream();if(ee.HttpClient.streamsApiVersion===2)if(u){var b=new e.PassThrough;b._write=function(y){return y&&y.length&&(l+=y.length),e.PassThrough.prototype._write.apply(this,arguments)},b.on("end",h),i.on("error",function(y){u=!1,g.unpipe(b),b.emit("end"),b.end()}),g.pipe(b).pipe(i,{end:!1})}else g.pipe(i);else u&&g.on("data",function(y){y&&y.length&&(l+=y.length)}),g.on("data",function(y){i.emit("data",y)}),g.on("end",h);g.on("error",function(y){u=!1,i.emit("error",y)})}}),i},emitEvent:function(e,r,i){typeof r=="function"&&(i=r,r=null),i||(i=function(){}),r||(r=this.eventParameters(e,this.response));var n=ee.SequentialExecutor.prototype.emit;n.call(this,e,r,function(s){s&&(this.response.error=s),i.call(this,s)})},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,r){return!r&&typeof e=="function"&&(r=e,e=null),new ee.Signers.Presign().sign(this.toGet(),e,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",ee.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",ee.EventListeners.Core.SIGN),this},toGet:function(){return(this.service.api.protocol==="query"||this.service.api.protocol==="ec2")&&(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}});ee.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var i=this;return this.httpRequest.appendToUserAgent("promise"),new e(function(n,s){i.on("complete",function(o){o.error?s(o.error):n(Object.defineProperty(o.data||{},"$response",{value:o}))}),i.runTo()})}};ee.Request.deletePromisesFromClass=function(){delete this.prototype.promise};ee.util.addPromises(ee.Request);ee.util.mixin(ee.Request,ee.SequentialExecutor)});var ua=I(()=>{var fr=j(),$d=fr.util.inherit,aa=li();fr.Response=$d({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new fr.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var r,i=this.request.service,n=this.request.operation;try{r=i.paginationConfig(n,!0)}catch(u){this.error=u}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var s=fr.util.copy(this.request.params);if(this.nextPageTokens){var o=r.inputToken;typeof o=="string"&&(o=[o]);for(var a=0;a{var qt=j(),Yd=qt.util.inherit,$t=li();function ca(t){var e=t.request._waiter,r=e.config.acceptors,i=!1,n="retry";r.forEach(function(s){if(!i){var o=e.matchers[s.matcher];o&&o(t,s.expected,s.argument)&&(i=!0,n=s.state)}}),!i&&t.error&&(n="failure"),n==="success"?e.setSuccess(t):e.setError(t,n==="retry")}qt.ResourceWaiter=Yd({constructor:function(e,r){this.service=e,this.state=r,this.loadWaiterConfig(this.state)},service:null,state:null,config:null,matchers:{path:function(t,e,r){try{var i=$t.search(t.data,r)}catch(n){return!1}return $t.strictDeepEqual(i,e)},pathAll:function(t,e,r){try{var i=$t.search(t.data,r)}catch(o){return!1}Array.isArray(i)||(i=[i]);var n=i.length;if(!n)return!1;for(var s=0;s{var dt=j(),Jd=dt.util.inherit;dt.Signers.V2=Jd(dt.Signers.RequestSigner,{addAuthorization:function(e,r){r||(r=dt.util.date.getDate());var i=this.request;i.params.Timestamp=dt.util.date.iso8601(r),i.params.SignatureVersion="2",i.params.SignatureMethod="HmacSHA256",i.params.AWSAccessKeyId=e.accessKeyId,e.sessionToken&&(i.params.SecurityToken=e.sessionToken),delete i.params.Signature,i.params.Signature=this.signature(e),i.body=dt.util.queryParamsToString(i.params),i.headers["Content-Length"]=i.body.length},signature:function(e){return dt.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push(this.request.endpoint.host.toLowerCase()),e.push(this.request.pathname()),e.push(dt.util.queryParamsToString(this.request.params)),e.join(` -`)}});fa.exports=dt.Signers.V2});var xn=I((zy,da)=>{var Qe=j(),Qd=Qe.util.inherit;Qe.Signers.V3=Qd(Qe.Signers.RequestSigner,{addAuthorization:function(e,r){var i=Qe.util.date.rfc822(r);this.request.headers["X-Amz-Date"]=i,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,i)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return Qe.util.arrayEach(this.headersToSign(),function(i){e.push(i.toLowerCase())}),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,r=[];return Qe.util.arrayEach(this.headersToSign(),function(n){r.push(n.toLowerCase().trim()+":"+String(e[n]).trim())}),r.sort().join(` + Error Message: ${o.result.message}`)})).result)===null||r===void 0?void 0:r.value;if(!s)throw new Error("Response json body do not have ID Token field");return s})}static getIDToken(e){return xo(this,void 0,void 0,function*(){try{let r=Rt.getIDTokenUrl();if(e){let n=encodeURIComponent(e);r=`${r}&audience=${n}`}bo.debug(`ID token url is ${r}`);let i=yield Rt.getCall(r);return bo.setSecret(i),i}catch(r){throw new Error(`Error message: ${r.message}`)}})}};tr.OidcClient=Rt});var In=I(Ne=>{"use strict";var xn=Ne&&Ne.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.summary=Ne.markdownSummary=Ne.SUMMARY_DOCS_URL=Ne.SUMMARY_ENV_VAR=void 0;var Xp=require("os"),bn=require("fs"),{access:Gp,appendFile:$p,writeFile:Yp}=bn.promises;Ne.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";Ne.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";var Rn=class{constructor(){this._buffer=""}filePath(){return xn(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;let e=process.env[Ne.SUMMARY_ENV_VAR];if(!e)throw new Error(`Unable to find environment variable for $${Ne.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield Gp(e,bn.constants.R_OK|bn.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}return this._filePath=e,this._filePath})}wrap(e,r,i={}){let n=Object.entries(i).map(([s,o])=>` ${s}="${o}"`).join("");return r?`<${e}${n}>${r}`:`<${e}${n}>`}write(e){return xn(this,void 0,void 0,function*(){let r=!!(e!=null&&e.overwrite),i=yield this.filePath();return yield(r?Yp:$p)(i,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return xn(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw(e,r=!1){return this._buffer+=e,r?this.addEOL():this}addEOL(){return this.addRaw(Xp.EOL)}addCodeBlock(e,r){let i=Object.assign({},r&&{lang:r}),n=this.wrap("pre",this.wrap("code",e),i);return this.addRaw(n).addEOL()}addList(e,r=!1){let i=r?"ol":"ul",n=e.map(o=>this.wrap("li",o)).join(""),s=this.wrap(i,n);return this.addRaw(s).addEOL()}addTable(e){let r=e.map(n=>{let s=n.map(o=>{if(typeof o=="string")return this.wrap("td",o);let{header:a,data:u,colspan:c,rowspan:l}=o,d=a?"th":"td",v=Object.assign(Object.assign({},c&&{colspan:c}),l&&{rowspan:l});return this.wrap(d,u,v)}).join("");return this.wrap("tr",s)}).join(""),i=this.wrap("table",r);return this.addRaw(i).addEOL()}addDetails(e,r){let i=this.wrap("details",this.wrap("summary",e)+r);return this.addRaw(i).addEOL()}addImage(e,r,i){let{width:n,height:s}=i||{},o=Object.assign(Object.assign({},n&&{width:n}),s&&{height:s}),a=this.wrap("img",null,Object.assign({src:e,alt:r},o));return this.addRaw(a).addEOL()}addHeading(e,r){let i=`h${r}`,n=["h1","h2","h3","h4","h5","h6"].includes(i)?i:"h1",s=this.wrap(n,e);return this.addRaw(s).addEOL()}addSeparator(){let e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){let e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,r){let i=Object.assign({},r&&{cite:r}),n=this.wrap("blockquote",e,i);return this.addRaw(n).addEOL()}addLink(e,r){let i=this.wrap("a",e,{href:r});return this.addRaw(i).addEOL()}},Io=new Rn;Ne.markdownSummary=Io;Ne.summary=Io});var Po=I(De=>{"use strict";var Jp=De&&De.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Qp=De&&De.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zp=De&&De.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Jp(e,t,r);return Qp(e,t),e};Object.defineProperty(De,"__esModule",{value:!0});De.toPlatformPath=De.toWin32Path=De.toPosixPath=void 0;var ed=Zp(require("path"));function td(t){return t.replace(/[\\]/g,"/")}De.toPosixPath=td;function rd(t){return t.replace(/[/]/g,"\\")}De.toWin32Path=rd;function id(t){return t.replace(/[/\\]/g,ed.sep)}De.toPlatformPath=id});var An=I(U=>{"use strict";var nd=U&&U.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),sd=U&&U.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),No=U&&U.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&nd(e,t,r);return sd(e,t),e},Do=U&&U.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?s(l.value):n(l.value).then(a,u)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(U,"__esModule",{value:!0});U.getIDToken=U.getState=U.saveState=U.group=U.endGroup=U.startGroup=U.info=U.notice=U.warning=U.error=U.debug=U.isDebug=U.setFailed=U.setCommandEcho=U.setOutput=U.getBooleanInput=U.getMultilineInput=U.getInput=U.addPath=U.setSecret=U.exportVariable=U.ExitCode=void 0;var je=Bs(),Lt=ho(),rr=ei(),qo=No(require("os")),od=No(require("path")),ad=Ro(),ko;(function(t){t[t.Success=0]="Success",t[t.Failure=1]="Failure"})(ko=U.ExitCode||(U.ExitCode={}));function ud(t,e){let r=rr.toCommandValue(e);if(process.env[t]=r,process.env.GITHUB_ENV||"")return Lt.issueFileCommand("ENV",Lt.prepareKeyValueMessage(t,e));je.issueCommand("set-env",{name:t},r)}U.exportVariable=ud;function cd(t){je.issueCommand("add-mask",{},t)}U.setSecret=cd;function ld(t){process.env.GITHUB_PATH||""?Lt.issueFileCommand("PATH",t):je.issueCommand("add-path",{},t),process.env.PATH=`${t}${od.delimiter}${process.env.PATH}`}U.addPath=ld;function Pn(t,e){let r=process.env[`INPUT_${t.replace(/ /g,"_").toUpperCase()}`]||"";if(e&&e.required&&!r)throw new Error(`Input required and not supplied: ${t}`);return e&&e.trimWhitespace===!1?r:r.trim()}U.getInput=Pn;function fd(t,e){let r=Pn(t,e).split(` +`).filter(i=>i!=="");return e&&e.trimWhitespace===!1?r:r.map(i=>i.trim())}U.getMultilineInput=fd;function pd(t,e){let r=["true","True","TRUE"],i=["false","False","FALSE"],n=Pn(t,e);if(r.includes(n))return!0;if(i.includes(n))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${t} +Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}U.getBooleanInput=pd;function dd(t,e){if(process.env.GITHUB_OUTPUT||"")return Lt.issueFileCommand("OUTPUT",Lt.prepareKeyValueMessage(t,e));process.stdout.write(qo.EOL),je.issueCommand("set-output",{name:t},rr.toCommandValue(e))}U.setOutput=dd;function hd(t){je.issue("echo",t?"on":"off")}U.setCommandEcho=hd;function md(t){process.exitCode=ko.Failure,Oo(t)}U.setFailed=md;function vd(){return process.env.RUNNER_DEBUG==="1"}U.isDebug=vd;function gd(t){je.issueCommand("debug",{},t)}U.debug=gd;function Oo(t,e={}){je.issueCommand("error",rr.toCommandProperties(e),t instanceof Error?t.toString():t)}U.error=Oo;function yd(t,e={}){je.issueCommand("warning",rr.toCommandProperties(e),t instanceof Error?t.toString():t)}U.warning=yd;function Ed(t,e={}){je.issueCommand("notice",rr.toCommandProperties(e),t instanceof Error?t.toString():t)}U.notice=Ed;function Sd(t){process.stdout.write(t+qo.EOL)}U.info=Sd;function Lo(t){je.issue("group",t)}U.startGroup=Lo;function Mo(){je.issue("endgroup")}U.endGroup=Mo;function wd(t,e){return Do(this,void 0,void 0,function*(){Lo(t);let r;try{r=yield e()}finally{Mo()}return r})}U.group=wd;function Cd(t,e){if(process.env.GITHUB_STATE||"")return Lt.issueFileCommand("STATE",Lt.prepareKeyValueMessage(t,e));je.issueCommand("save-state",{name:t},rr.toCommandValue(e))}U.saveState=Cd;function Td(t){return process.env[`STATE_${t}`]||""}U.getState=Td;function _d(t){return Do(this,void 0,void 0,function*(){return yield ad.OidcClient.getIDToken(t)})}U.getIDToken=_d;var Ad=In();Object.defineProperty(U,"summary",{enumerable:!0,get:function(){return Ad.summary}});var xd=In();Object.defineProperty(U,"markdownSummary",{enumerable:!0,get:function(){return xd.markdownSummary}});var Nn=Po();Object.defineProperty(U,"toPosixPath",{enumerable:!0,get:function(){return Nn.toPosixPath}});Object.defineProperty(U,"toWin32Path",{enumerable:!0,get:function(){return Nn.toWin32Path}});Object.defineProperty(U,"toPlatformPath",{enumerable:!0,get:function(){return Nn.toPlatformPath}})});var fi=I((u0,Bo)=>{var Dn=le();function Fo(){}Fo.prototype.build=function(t,e){return JSON.stringify(li(t,e))};function li(t,e){if(!(!e||t===void 0||t===null))switch(e.type){case"structure":return bd(t,e);case"map":return Id(t,e);case"list":return Rd(t,e);default:return Pd(t,e)}}function bd(t,e){if(e.isDocument)return t;var r={};return Dn.each(t,function(i,n){var s=e.members[i];if(s){if(s.location!=="body")return;var o=s.isLocationName?s.name:i,a=li(n,s);a!==void 0&&(r[o]=a)}}),r}function Rd(t,e){var r=[];return Dn.arrayEach(t,function(i){var n=li(i,e.member);n!==void 0&&r.push(n)}),r}function Id(t,e){var r={};return Dn.each(t,function(i,n){var s=li(n,e.value);s!==void 0&&(r[i]=s)}),r}function Pd(t,e){return e.toWireFormat(t)}Bo.exports=Fo});var di=I((c0,Vo)=>{var qn=le();function Uo(){}Uo.prototype.parse=function(t,e){return pi(JSON.parse(t),e)};function pi(t,e){if(!(!e||t===void 0))switch(e.type){case"structure":return Nd(t,e);case"map":return qd(t,e);case"list":return Dd(t,e);default:return kd(t,e)}}function Nd(t,e){if(t!=null){if(e.isDocument)return t;var r={},i=e.members;return qn.each(i,function(n,s){var o=s.isLocationName?s.name:n;if(Object.prototype.hasOwnProperty.call(t,o)){var a=t[o],u=pi(a,s);u!==void 0&&(r[n]=u)}}),r}}function Dd(t,e){if(t!=null){var r=[];return qn.arrayEach(t,function(i){var n=pi(i,e.member);n===void 0?r.push(null):r.push(n)}),r}}function qd(t,e){if(t!=null){var r={};return qn.each(t,function(i,n){var s=pi(n,e.value);s===void 0?r[i]=null:r[i]=s}),r}}function kd(t,e){return e.toType(t)}Vo.exports=Uo});var hi=I((l0,jo)=>{var mr=le(),Od=V();function Ld(t){var e=t.service.config.hostPrefixEnabled;if(!e)return t;var r=t.service.api.operations[t.operation];if(Md(t))return t;if(r.endpoint&&r.endpoint.hostPrefix){var i=r.endpoint.hostPrefix,n=Fd(i,t.params,r.input);Bd(t.httpRequest.endpoint,n),Ud(t.httpRequest.endpoint.hostname)}return t}function Md(t){var e=t.service.api,r=e.operations[t.operation],i=e.endpointOperation&&e.endpointOperation===mr.string.lowerFirst(r.name);return r.endpointDiscoveryRequired!=="NULL"||i===!0}function Fd(t,e,r){return mr.each(r.members,function(i,n){if(n.hostLabel===!0){if(typeof e[i]!="string"||e[i]==="")throw mr.error(new Error,{message:"Parameter "+i+" should be a non-empty string.",code:"InvalidParameter"});var s=new RegExp("\\{"+i+"\\}","g");t=t.replace(s,e[i])}}),t}function Bd(t,e){t.host&&(t.host=e+t.host),t.hostname&&(t.hostname=e+t.hostname)}function Ud(t){var e=t.split("."),r=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;mr.arrayEach(e,function(i){if(!i.length||i.length<1||i.length>63)throw mr.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!r.test(i))throw Od.util.error(new Error,{code:"ValidationError",message:i+" is not hostname compatible."})})}jo.exports={populateHostPrefix:Ld}});var mi=I((f0,Wo)=>{var Vd=le(),jd=fi(),Wd=di(),Hd=hi().populateHostPrefix;function zd(t){var e=t.httpRequest,r=t.service.api,i=r.targetPrefix+"."+r.operations[t.operation].name,n=r.jsonVersion||"1.0",s=r.operations[t.operation].input,o=new jd;n===1&&(n="1.0"),e.body=o.build(t.params||{},s),e.headers["Content-Type"]="application/x-amz-json-"+n,e.headers["X-Amz-Target"]=i,Hd(t)}function Kd(t){var e={},r=t.httpResponse;if(e.code=r.headers["x-amzn-errortype"]||"UnknownError",typeof e.code=="string"&&(e.code=e.code.split(":")[0]),r.body.length>0)try{var i=JSON.parse(r.body.toString()),n=i.__type||i.code||i.Code;n&&(e.code=n.split("#").pop()),e.code==="RequestEntityTooLarge"?e.message="Request body must be less than 1 MB":e.message=i.message||i.Message||null}catch{e.statusCode=r.statusCode,e.message=r.statusMessage}else e.statusCode=r.statusCode,e.message=r.statusCode.toString();t.error=Vd.error(new Error,e)}function Xd(t){var e=t.httpResponse.body.toString()||"{}";if(t.request.service.config.convertResponseTypes===!1)t.data=JSON.parse(e);else{var r=t.request.service.api.operations[t.request.operation],i=r.output||{},n=new Wd;t.data=n.parse(e,i)}}Wo.exports={buildRequest:zd,extractError:Kd,extractData:Xd}});var Go=I((p0,Xo)=>{var kn=le();function Ho(){}Ho.prototype.serialize=function(t,e,r){Ko("",t,e,r)};function zo(t){return t.isQueryName||t.api.protocol!=="ec2"?t.name:t.name[0].toUpperCase()+t.name.substr(1)}function Ko(t,e,r,i){kn.each(r.members,function(n,s){var o=e[n];if(o!=null){var a=zo(s);a=t?t+"."+a:a,vi(a,o,s,i)}})}function Gd(t,e,r,i){var n=1;kn.each(e,function(s,o){var a=r.flattened?".":".entry.",u=a+n+++".",c=u+(r.key.name||"key"),l=u+(r.value.name||"value");vi(t+c,s,r.key,i),vi(t+l,o,r.value,i)})}function $d(t,e,r,i){var n=r.member||{};if(e.length===0){i.call(this,t,null);return}kn.arrayEach(e,function(s,o){var a="."+(o+1);if(r.api.protocol==="ec2")a=a+"";else if(r.flattened){if(n.name){var u=t.split(".");u.pop(),u.push(zo(n)),t=u.join(".")}}else a="."+(n.name?n.name:"member")+a;vi(t+a,s,n,i)})}function vi(t,e,r,i){e!=null&&(r.type==="structure"?Ko(t,e,r,i):r.type==="list"?$d(t,e,r,i):r.type==="map"?Gd(t,e,r,i):i(t,r.toWireFormat(e).toString()))}Xo.exports=Ho});var On=I((d0,$o)=>{var Yd=le().memoizedProperty;function Jd(t,e,r,i){Yd(this,i(t),function(){return r(t,e)})}function Qd(t,e,r,i,n){i=i||String;var s=this;for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(Jd.call(s,o,t[o],r,i),n&&n(o,t[o]))}$o.exports=Qd});var vr=I((h0,ia)=>{var Zd=On(),mt=le();function j(t,e,r){r!=null&&mt.property.apply(this,arguments)}function Mt(t,e){t.constructor.prototype[e]||mt.memoizedProperty.apply(this,arguments)}function re(t,e,r){e=e||{},j(this,"shape",t.shape),j(this,"api",e.api,!1),j(this,"type",t.type),j(this,"enum",t.enum),j(this,"min",t.min),j(this,"max",t.max),j(this,"pattern",t.pattern),j(this,"location",t.location||this.location||"body"),j(this,"name",this.name||t.xmlName||t.queryName||t.locationName||r),j(this,"isStreaming",t.streaming||this.isStreaming||!1),j(this,"requiresLength",t.requiresLength,!1),j(this,"isComposite",t.isComposite||!1),j(this,"isShape",!0,!1),j(this,"isQueryName",!!t.queryName,!1),j(this,"isLocationName",!!t.locationName,!1),j(this,"isIdempotent",t.idempotencyToken===!0),j(this,"isJsonValue",t.jsonvalue===!0),j(this,"isSensitive",t.sensitive===!0||t.prototype&&t.prototype.sensitive===!0),j(this,"isEventStream",!!t.eventstream,!1),j(this,"isEvent",!!t.event,!1),j(this,"isEventPayload",!!t.eventpayload,!1),j(this,"isEventHeader",!!t.eventheader,!1),j(this,"isTimestampFormatSet",!!t.timestampFormat||t.prototype&&t.prototype.isTimestampFormatSet===!0,!1),j(this,"endpointDiscoveryId",!!t.endpointdiscoveryid,!1),j(this,"hostLabel",!!t.hostLabel,!1),e.documentation&&(j(this,"documentation",t.documentation),j(this,"documentationUrl",t.documentationUrl)),t.xmlAttribute&&j(this,"isXmlAttribute",t.xmlAttribute||!1),j(this,"defaultValue",null),this.toWireFormat=function(i){return i==null?"":i},this.toType=function(i){return i}}re.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"};re.types={structure:Yo,list:Jo,map:Qo,boolean:ra,timestamp:eh,float:th,integer:rh,string:Zo,base64:ta,binary:ea};re.resolve=function(e,r){if(e.shape){var i=r.api.shapes[e.shape];if(!i)throw new Error("Cannot find shape reference: "+e.shape);return i}else return null};re.create=function(e,r,i){if(e.isShape)return e;var n=re.resolve(e,r);if(n){var s=Object.keys(e);r.documentation||(s=s.filter(function(u){return!u.match(/documentation/)}));var o=function(){n.constructor.call(this,e,r,i)};return o.prototype=n,new o}else{e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");var a=e.type;if(re.normalizedTypes[e.type]&&(e.type=re.normalizedTypes[e.type]),re.types[e.type])return new re.types[e.type](e,r,i);throw new Error("Unrecognized shape type: "+a)}};function Ln(t){re.apply(this,arguments),j(this,"isComposite",!0),t.flattened&&j(this,"flattened",t.flattened||!1)}function Yo(t,e){var r=this,i=null,n=!this.isShape;Ln.apply(this,arguments),n&&(j(this,"defaultValue",function(){return{}}),j(this,"members",{}),j(this,"memberNames",[]),j(this,"required",[]),j(this,"isRequired",function(){return!1}),j(this,"isDocument",!!t.document)),t.members&&(j(this,"members",new Zd(t.members,e,function(s,o){return re.create(o,e,s)})),Mt(this,"memberNames",function(){return t.xmlOrder||Object.keys(t.members)}),t.event&&(Mt(this,"eventPayloadMemberName",function(){for(var s=r.members,o=r.memberNames,a=0,u=o.length;a-1?e||"":e,this.isJsonValue?JSON.parse(e):e&&typeof e.toString=="function"?e.toString():e},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function th(){re.apply(this,arguments),this.toType=function(t){return t==null?null:parseFloat(t)},this.toWireFormat=this.toType}function rh(){re.apply(this,arguments),this.toType=function(t){return t==null?null:parseInt(t,10)},this.toWireFormat=this.toType}function ea(){re.apply(this,arguments),this.toType=function(t){var e=mt.base64.decode(t);if(this.isSensitive&&mt.isNode()&&typeof mt.Buffer.alloc=="function"){var r=mt.Buffer.alloc(e.length,e);e.fill(0),e=r}return e},this.toWireFormat=mt.base64.encode}function ta(){ea.apply(this,arguments)}function ra(){re.apply(this,arguments),this.toType=function(t){return typeof t=="boolean"?t:t==null?null:t==="true"}}re.shapes={StructureShape:Yo,ListShape:Jo,MapShape:Qo,StringShape:Zo,BooleanShape:ra,Base64Shape:ta};ia.exports=re});var Mn=I((m0,oa)=>{var sa=V(),gr=le(),ih=Go(),na=vr(),nh=hi().populateHostPrefix;function sh(t){var e=t.service.api.operations[t.operation],r=t.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:t.service.api.apiVersion,Action:e.name};var i=new ih;i.serialize(t.params,e.input,function(n,s){r.params[n]=s}),r.body=gr.queryParamsToString(r.params),nh(t)}function oh(t){var e,r=t.httpResponse.body.toString();if(r.match("{var Ee=le(),uh=hi().populateHostPrefix;function ch(t){t.httpRequest.method=t.service.api.operations[t.operation].httpMethod}function aa(t,e,r,i){var n=[t,e].join("/");n=n.replace(/\/+/g,"/");var s={},o=!1;if(Ee.each(r.members,function(u,c){var l=i[u];if(l!=null)if(c.location==="uri"){var d=new RegExp("\\{"+c.name+"(\\+)?\\}");n=n.replace(d,function(v,A){var g=A?Ee.uriEscapePath:Ee.uriEscape;return g(String(l))})}else c.location==="querystring"&&(o=!0,c.type==="list"?s[c.name]=l.map(function(v){return Ee.uriEscape(c.member.toWireFormat(v).toString())}):c.type==="map"?Ee.each(l,function(v,A){Array.isArray(A)?s[v]=A.map(function(g){return Ee.uriEscape(String(g))}):s[v]=Ee.uriEscape(String(A))}):s[c.name]=Ee.uriEscape(c.toWireFormat(l).toString()))}),o){n+=n.indexOf("?")>=0?"&":"?";var a=[];Ee.arrayEach(Object.keys(s).sort(),function(u){Array.isArray(s[u])||(s[u]=[s[u]]);for(var c=0;c{var Bn=le(),la=yr(),fa=mi(),mh=fi(),ca=di(),pa=["GET","HEAD","DELETE"];function vh(t){var e=Bn.getRequestPayloadShape(t);e===void 0&&pa.indexOf(t.httpRequest.method)>=0&&delete t.httpRequest.headers["Content-Length"]}function gh(t){var e=new mh,r=t.service.api.operations[t.operation].input;if(r.payload){var i={},n=r.members[r.payload];i=t.params[r.payload],n.type==="structure"?(t.httpRequest.body=e.build(i||{},n),Fn(t)):i!==void 0&&(t.httpRequest.body=i,(n.type==="binary"||n.isStreaming)&&Fn(t,!0))}else t.httpRequest.body=e.build(t.params,r),Fn(t)}function Fn(t,e){if(!t.httpRequest.headers["Content-Type"]){var r=e?"binary/octet-stream":"application/json";t.httpRequest.headers["Content-Type"]=r}}function yh(t){la.buildRequest(t),pa.indexOf(t.httpRequest.method)<0&&gh(t)}function Eh(t){fa.extractError(t)}function Sh(t){la.extractData(t);var e=t.request,r=e.service.api.operations[e.operation],i=e.service.api.operations[e.operation].output||{},n,s=r.hasEventOutput;if(i.payload){var o=i.members[i.payload],a=t.httpResponse.body;if(o.isEventStream)n=new ca,t.data[payload]=Bn.createEventStream(AWS.HttpClient.streamsApiVersion===2?t.httpResponse.stream:a,n,o);else if(o.type==="structure"||o.type==="list"){var n=new ca;t.data[i.payload]=n.parse(a,o)}else o.type==="binary"||o.isStreaming?t.data[i.payload]=a:t.data[i.payload]=o.toType(a)}else{var u=t.data;fa.extractData(t),t.data=Bn.merge(u,t.data)}}da.exports={buildRequest:yh,extractError:Eh,extractData:Sh,unsetContentLength:vh}});var jn=I((y0,ha)=>{var ir=V(),Er=le(),Vn=yr();function wh(t){var e=t.service.api.operations[t.operation].input,r=new ir.XML.Builder,i=t.params,n=e.payload;if(n){var s=e.members[n];if(i=i[n],i===void 0)return;if(s.type==="structure"){var o=s.name;t.httpRequest.body=r.toXML(i,s,o,!0)}else t.httpRequest.body=i}else t.httpRequest.body=r.toXML(i,e,e.name||e.shape||Er.string.upperFirst(t.operation)+"Request")}function Ch(t){Vn.buildRequest(t),["GET","HEAD"].indexOf(t.httpRequest.method)<0&&wh(t)}function Th(t){Vn.extractError(t);var e;try{e=new ir.XML.Parser().parse(t.httpResponse.body.toString())}catch{e={Code:t.httpResponse.statusCode,Message:t.httpResponse.statusMessage}}e.Errors&&(e=e.Errors),e.Error&&(e=e.Error),e.Code?t.error=Er.error(new Error,{code:e.Code,message:e.Message}):t.error=Er.error(new Error,{code:t.httpResponse.statusCode,message:null})}function _h(t){Vn.extractData(t);var e,r=t.request,i=t.httpResponse.body,n=r.service.api.operations[r.operation],s=n.output,o=n.hasEventOutput,a=s.payload;if(a){var u=s.members[a];u.isEventStream?(e=new ir.XML.Parser,t.data[a]=Er.createEventStream(ir.HttpClient.streamsApiVersion===2?t.httpResponse.stream:t.httpResponse.body,e,u)):u.type==="structure"?(e=new ir.XML.Parser,t.data[a]=e.parse(i.toString(),u)):u.type==="binary"||u.isStreaming?t.data[a]=i:t.data[a]=u.toType(i)}else if(i.length>0){e=new ir.XML.Parser;var c=e.parse(i.toString(),s);Er.update(t.data,c)}}ha.exports={buildRequest:Ch,extractError:Th,extractData:_h}});var va=I((E0,ma)=>{function Ah(t){return t.replace(/&/g,"&").replace(/'/g,"'").replace(//g,">").replace(/"/g,""")}ma.exports={escapeAttribute:Ah}});var ya=I((S0,ga)=>{var xh=va().escapeAttribute;function Sr(t,e){e===void 0&&(e=[]),this.name=t,this.children=e,this.attributes={}}Sr.prototype.addAttribute=function(t,e){return this.attributes[t]=e,this};Sr.prototype.addChildNode=function(t){return this.children.push(t),this};Sr.prototype.removeAttribute=function(t){return delete this.attributes[t],this};Sr.prototype.toString=function(){for(var t=!!this.children.length,e="<"+this.name,r=this.attributes,i=0,n=Object.keys(r);i"+this.children.map(function(a){return a.toString()}).join("")+"":"/>"};ga.exports={XmlNode:Sr}});var Sa=I((w0,Ea)=>{function bh(t){return t.replace(/&/g,"&").replace(//g,">").replace(/\r/g," ").replace(/\n/g," ").replace(/\u0085/g,"…").replace(/\u2028/,"
")}Ea.exports={escapeElement:bh}});var Ta=I((C0,Ca)=>{var Rh=Sa().escapeElement;function wa(t){this.value=t}wa.prototype.toString=function(){return Rh(""+this.value)};Ca.exports={XmlText:wa}});var ba=I((T0,xa)=>{var gi=le(),Ft=ya().XmlNode,Ih=Ta().XmlText;function _a(){}_a.prototype.toXML=function(t,e,r,i){var n=new Ft(r);return Aa(n,e,!0),Bt(n,t,e),n.children.length>0||i?n.toString():""};function Bt(t,e,r){switch(r.type){case"structure":return Ph(t,e,r);case"map":return Nh(t,e,r);case"list":return Dh(t,e,r);default:return qh(t,e,r)}}function Ph(t,e,r){gi.arrayEach(r.memberNames,function(i){var n=r.members[i];if(n.location==="body"){var s=e[i],o=n.name;if(s!=null)if(n.isXmlAttribute)t.addAttribute(o,s);else if(n.flattened)Bt(t,s,n);else{var a=new Ft(o);t.addChildNode(a),Aa(a,n),Bt(a,s,n)}}})}function Nh(t,e,r){var i=r.key.name||"key",n=r.value.name||"value";gi.each(e,function(s,o){var a=new Ft(r.flattened?r.name:"entry");t.addChildNode(a);var u=new Ft(i),c=new Ft(n);a.addChildNode(u),a.addChildNode(c),Bt(u,s,r.key),Bt(c,o,r.value)})}function Dh(t,e,r){r.flattened?gi.arrayEach(e,function(i){var n=r.member.name||r.name,s=new Ft(n);t.addChildNode(s),Bt(s,i,r.member)}):gi.arrayEach(e,function(i){var n=r.member.name||"member",s=new Ft(n);t.addChildNode(s),Bt(s,i,r.member)})}function qh(t,e,r){t.addChildNode(new Ih(r.toWireFormat(e)))}function Aa(t,e,r){var i,n="xmlns";e.xmlNamespaceUri?(i=e.xmlNamespaceUri,e.xmlNamespacePrefix&&(n+=":"+e.xmlNamespacePrefix)):r&&e.api.xmlNamespaceUri&&(i=e.api.xmlNamespaceUri),i&&t.addAttribute(n,i)}xa.exports=_a});var Wn=I((_0,Ia)=>{var wr=vr(),Ra=le(),rt=Ra.property,nr=Ra.memoizedProperty;function kh(t,e,r){var i=this;r=r||{},rt(this,"name",e.name||t),rt(this,"api",r.api,!1),e.http=e.http||{},rt(this,"endpoint",e.endpoint),rt(this,"httpMethod",e.http.method||"POST"),rt(this,"httpPath",e.http.requestUri||"/"),rt(this,"authtype",e.authtype||""),rt(this,"endpointDiscoveryRequired",e.endpointdiscovery?e.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL");var n=e.httpChecksumRequired||e.httpChecksum&&e.httpChecksum.requestChecksumRequired;rt(this,"httpChecksumRequired",n,!1),nr(this,"input",function(){return e.input?wr.create(e.input,r):new wr.create({type:"structure"},r)}),nr(this,"output",function(){return e.output?wr.create(e.output,r):new wr.create({type:"structure"},r)}),nr(this,"errors",function(){var s=[];if(!e.errors)return null;for(var o=0;o{var Cr=le().property;function Lh(t,e){Cr(this,"inputToken",e.input_token),Cr(this,"limitKey",e.limit_key),Cr(this,"moreResults",e.more_results),Cr(this,"outputToken",e.output_token),Cr(this,"resultKey",e.result_key)}Pa.exports=Lh});var zn=I((x0,Da)=>{var Na=le(),yi=Na.property;function Mh(t,e,r){r=r||{},yi(this,"name",t),yi(this,"api",r.api,!1),e.operation&&yi(this,"operation",Na.string.lowerFirst(e.operation));var i=this,n=["type","description","delay","maxAttempts","acceptors"];n.forEach(function(s){var o=e[s];o&&yi(i,s,o)})}Da.exports=Mh});var Kn=I((b0,Fh)=>{Fh.exports={acm:{name:"ACM",cors:!0},apigateway:{name:"APIGateway",cors:!0},applicationautoscaling:{prefix:"application-autoscaling",name:"ApplicationAutoScaling",cors:!0},appstream:{name:"AppStream"},autoscaling:{name:"AutoScaling",cors:!0},batch:{name:"Batch"},budgets:{name:"Budgets"},clouddirectory:{name:"CloudDirectory",versions:["2016-05-10*"]},cloudformation:{name:"CloudFormation",cors:!0},cloudfront:{name:"CloudFront",versions:["2013-05-12*","2013-11-11*","2014-05-31*","2014-10-21*","2014-11-06*","2015-04-17*","2015-07-27*","2015-09-17*","2016-01-13*","2016-01-28*","2016-08-01*","2016-08-20*","2016-09-07*","2016-09-29*","2016-11-25*","2017-03-25*","2017-10-30*","2018-06-18*","2018-11-05*","2019-03-26*"],cors:!0},cloudhsm:{name:"CloudHSM",cors:!0},cloudsearch:{name:"CloudSearch"},cloudsearchdomain:{name:"CloudSearchDomain"},cloudtrail:{name:"CloudTrail",cors:!0},cloudwatch:{prefix:"monitoring",name:"CloudWatch",cors:!0},cloudwatchevents:{prefix:"events",name:"CloudWatchEvents",versions:["2014-02-03*"],cors:!0},cloudwatchlogs:{prefix:"logs",name:"CloudWatchLogs",cors:!0},codebuild:{name:"CodeBuild",cors:!0},codecommit:{name:"CodeCommit",cors:!0},codedeploy:{name:"CodeDeploy",cors:!0},codepipeline:{name:"CodePipeline",cors:!0},cognitoidentity:{prefix:"cognito-identity",name:"CognitoIdentity",cors:!0},cognitoidentityserviceprovider:{prefix:"cognito-idp",name:"CognitoIdentityServiceProvider",cors:!0},cognitosync:{prefix:"cognito-sync",name:"CognitoSync",cors:!0},configservice:{prefix:"config",name:"ConfigService",cors:!0},cur:{name:"CUR",cors:!0},datapipeline:{name:"DataPipeline"},devicefarm:{name:"DeviceFarm",cors:!0},directconnect:{name:"DirectConnect",cors:!0},directoryservice:{prefix:"ds",name:"DirectoryService"},discovery:{name:"Discovery"},dms:{name:"DMS"},dynamodb:{name:"DynamoDB",cors:!0},dynamodbstreams:{prefix:"streams.dynamodb",name:"DynamoDBStreams",cors:!0},ec2:{name:"EC2",versions:["2013-06-15*","2013-10-15*","2014-02-01*","2014-05-01*","2014-06-15*","2014-09-01*","2014-10-01*","2015-03-01*","2015-04-15*","2015-10-01*","2016-04-01*","2016-09-15*"],cors:!0},ecr:{name:"ECR",cors:!0},ecs:{name:"ECS",cors:!0},efs:{prefix:"elasticfilesystem",name:"EFS",cors:!0},elasticache:{name:"ElastiCache",versions:["2012-11-15*","2014-03-24*","2014-07-15*","2014-09-30*"],cors:!0},elasticbeanstalk:{name:"ElasticBeanstalk",cors:!0},elb:{prefix:"elasticloadbalancing",name:"ELB",cors:!0},elbv2:{prefix:"elasticloadbalancingv2",name:"ELBv2",cors:!0},emr:{prefix:"elasticmapreduce",name:"EMR",cors:!0},es:{name:"ES"},elastictranscoder:{name:"ElasticTranscoder",cors:!0},firehose:{name:"Firehose",cors:!0},gamelift:{name:"GameLift",cors:!0},glacier:{name:"Glacier"},health:{name:"Health"},iam:{name:"IAM",cors:!0},importexport:{name:"ImportExport"},inspector:{name:"Inspector",versions:["2015-08-18*"],cors:!0},iot:{name:"Iot",cors:!0},iotdata:{prefix:"iot-data",name:"IotData",cors:!0},kinesis:{name:"Kinesis",cors:!0},kinesisanalytics:{name:"KinesisAnalytics"},kms:{name:"KMS",cors:!0},lambda:{name:"Lambda",cors:!0},lexruntime:{prefix:"runtime.lex",name:"LexRuntime",cors:!0},lightsail:{name:"Lightsail"},machinelearning:{name:"MachineLearning",cors:!0},marketplacecommerceanalytics:{name:"MarketplaceCommerceAnalytics",cors:!0},marketplacemetering:{prefix:"meteringmarketplace",name:"MarketplaceMetering"},mturk:{prefix:"mturk-requester",name:"MTurk",cors:!0},mobileanalytics:{name:"MobileAnalytics",cors:!0},opsworks:{name:"OpsWorks",cors:!0},opsworkscm:{name:"OpsWorksCM"},organizations:{name:"Organizations"},pinpoint:{name:"Pinpoint"},polly:{name:"Polly",cors:!0},rds:{name:"RDS",versions:["2014-09-01*"],cors:!0},redshift:{name:"Redshift",cors:!0},rekognition:{name:"Rekognition",cors:!0},resourcegroupstaggingapi:{name:"ResourceGroupsTaggingAPI"},route53:{name:"Route53",cors:!0},route53domains:{name:"Route53Domains",cors:!0},s3:{name:"S3",dualstackAvailable:!0,cors:!0},s3control:{name:"S3Control",dualstackAvailable:!0,xmlNoDefaultLists:!0},servicecatalog:{name:"ServiceCatalog",cors:!0},ses:{prefix:"email",name:"SES",cors:!0},shield:{name:"Shield"},simpledb:{prefix:"sdb",name:"SimpleDB"},sms:{name:"SMS"},snowball:{name:"Snowball"},sns:{name:"SNS",cors:!0},sqs:{name:"SQS",cors:!0},ssm:{name:"SSM",cors:!0},storagegateway:{name:"StorageGateway",cors:!0},stepfunctions:{prefix:"states",name:"StepFunctions"},sts:{name:"STS",cors:!0},support:{name:"Support"},swf:{name:"SWF"},xray:{name:"XRay",cors:!0},waf:{name:"WAF",cors:!0},wafregional:{prefix:"waf-regional",name:"WAFRegional"},workdocs:{name:"WorkDocs",cors:!0},workspaces:{name:"WorkSpaces"},codestar:{name:"CodeStar"},lexmodelbuildingservice:{prefix:"lex-models",name:"LexModelBuildingService",cors:!0},marketplaceentitlementservice:{prefix:"entitlement.marketplace",name:"MarketplaceEntitlementService"},athena:{name:"Athena",cors:!0},greengrass:{name:"Greengrass"},dax:{name:"DAX"},migrationhub:{prefix:"AWSMigrationHub",name:"MigrationHub"},cloudhsmv2:{name:"CloudHSMV2",cors:!0},glue:{name:"Glue"},mobile:{name:"Mobile"},pricing:{name:"Pricing",cors:!0},costexplorer:{prefix:"ce",name:"CostExplorer",cors:!0},mediaconvert:{name:"MediaConvert"},medialive:{name:"MediaLive"},mediapackage:{name:"MediaPackage"},mediastore:{name:"MediaStore"},mediastoredata:{prefix:"mediastore-data",name:"MediaStoreData",cors:!0},appsync:{name:"AppSync"},guardduty:{name:"GuardDuty"},mq:{name:"MQ"},comprehend:{name:"Comprehend",cors:!0},iotjobsdataplane:{prefix:"iot-jobs-data",name:"IoTJobsDataPlane"},kinesisvideoarchivedmedia:{prefix:"kinesis-video-archived-media",name:"KinesisVideoArchivedMedia",cors:!0},kinesisvideomedia:{prefix:"kinesis-video-media",name:"KinesisVideoMedia",cors:!0},kinesisvideo:{name:"KinesisVideo",cors:!0},sagemakerruntime:{prefix:"runtime.sagemaker",name:"SageMakerRuntime"},sagemaker:{name:"SageMaker"},translate:{name:"Translate",cors:!0},resourcegroups:{prefix:"resource-groups",name:"ResourceGroups",cors:!0},alexaforbusiness:{name:"AlexaForBusiness"},cloud9:{name:"Cloud9"},serverlessapplicationrepository:{prefix:"serverlessrepo",name:"ServerlessApplicationRepository"},servicediscovery:{name:"ServiceDiscovery"},workmail:{name:"WorkMail"},autoscalingplans:{prefix:"autoscaling-plans",name:"AutoScalingPlans"},transcribeservice:{prefix:"transcribe",name:"TranscribeService"},connect:{name:"Connect",cors:!0},acmpca:{prefix:"acm-pca",name:"ACMPCA"},fms:{name:"FMS"},secretsmanager:{name:"SecretsManager",cors:!0},iotanalytics:{name:"IoTAnalytics",cors:!0},iot1clickdevicesservice:{prefix:"iot1click-devices",name:"IoT1ClickDevicesService"},iot1clickprojects:{prefix:"iot1click-projects",name:"IoT1ClickProjects"},pi:{name:"PI"},neptune:{name:"Neptune"},mediatailor:{name:"MediaTailor"},eks:{name:"EKS"},macie:{name:"Macie"},dlm:{name:"DLM"},signer:{name:"Signer"},chime:{name:"Chime"},pinpointemail:{prefix:"pinpoint-email",name:"PinpointEmail"},ram:{name:"RAM"},route53resolver:{name:"Route53Resolver"},pinpointsmsvoice:{prefix:"sms-voice",name:"PinpointSMSVoice"},quicksight:{name:"QuickSight"},rdsdataservice:{prefix:"rds-data",name:"RDSDataService"},amplify:{name:"Amplify"},datasync:{name:"DataSync"},robomaker:{name:"RoboMaker"},transfer:{name:"Transfer"},globalaccelerator:{name:"GlobalAccelerator"},comprehendmedical:{name:"ComprehendMedical",cors:!0},kinesisanalyticsv2:{name:"KinesisAnalyticsV2"},mediaconnect:{name:"MediaConnect"},fsx:{name:"FSx"},securityhub:{name:"SecurityHub"},appmesh:{name:"AppMesh",versions:["2018-10-01*"]},licensemanager:{prefix:"license-manager",name:"LicenseManager"},kafka:{name:"Kafka"},apigatewaymanagementapi:{name:"ApiGatewayManagementApi"},apigatewayv2:{name:"ApiGatewayV2"},docdb:{name:"DocDB"},backup:{name:"Backup"},worklink:{name:"WorkLink"},textract:{name:"Textract"},managedblockchain:{name:"ManagedBlockchain"},mediapackagevod:{prefix:"mediapackage-vod",name:"MediaPackageVod"},groundstation:{name:"GroundStation"},iotthingsgraph:{name:"IoTThingsGraph"},iotevents:{name:"IoTEvents"},ioteventsdata:{prefix:"iotevents-data",name:"IoTEventsData"},personalize:{name:"Personalize",cors:!0},personalizeevents:{prefix:"personalize-events",name:"PersonalizeEvents",cors:!0},personalizeruntime:{prefix:"personalize-runtime",name:"PersonalizeRuntime",cors:!0},applicationinsights:{prefix:"application-insights",name:"ApplicationInsights"},servicequotas:{prefix:"service-quotas",name:"ServiceQuotas"},ec2instanceconnect:{prefix:"ec2-instance-connect",name:"EC2InstanceConnect"},eventbridge:{name:"EventBridge"},lakeformation:{name:"LakeFormation"},forecastservice:{prefix:"forecast",name:"ForecastService",cors:!0},forecastqueryservice:{prefix:"forecastquery",name:"ForecastQueryService",cors:!0},qldb:{name:"QLDB"},qldbsession:{prefix:"qldb-session",name:"QLDBSession"},workmailmessageflow:{name:"WorkMailMessageFlow"},codestarnotifications:{prefix:"codestar-notifications",name:"CodeStarNotifications"},savingsplans:{name:"SavingsPlans"},sso:{name:"SSO"},ssooidc:{prefix:"sso-oidc",name:"SSOOIDC"},marketplacecatalog:{prefix:"marketplace-catalog",name:"MarketplaceCatalog",cors:!0},dataexchange:{name:"DataExchange"},sesv2:{name:"SESV2"},migrationhubconfig:{prefix:"migrationhub-config",name:"MigrationHubConfig"},connectparticipant:{name:"ConnectParticipant"},appconfig:{name:"AppConfig"},iotsecuretunneling:{name:"IoTSecureTunneling"},wafv2:{name:"WAFV2"},elasticinference:{prefix:"elastic-inference",name:"ElasticInference"},imagebuilder:{name:"Imagebuilder"},schemas:{name:"Schemas"},accessanalyzer:{name:"AccessAnalyzer"},codegurureviewer:{prefix:"codeguru-reviewer",name:"CodeGuruReviewer"},codeguruprofiler:{name:"CodeGuruProfiler"},computeoptimizer:{prefix:"compute-optimizer",name:"ComputeOptimizer"},frauddetector:{name:"FraudDetector"},kendra:{name:"Kendra"},networkmanager:{name:"NetworkManager"},outposts:{name:"Outposts"},augmentedairuntime:{prefix:"sagemaker-a2i-runtime",name:"AugmentedAIRuntime"},ebs:{name:"EBS"},kinesisvideosignalingchannels:{prefix:"kinesis-video-signaling",name:"KinesisVideoSignalingChannels",cors:!0},detective:{name:"Detective"},codestarconnections:{prefix:"codestar-connections",name:"CodeStarconnections"},synthetics:{name:"Synthetics"},iotsitewise:{name:"IoTSiteWise"},macie2:{name:"Macie2"},codeartifact:{name:"CodeArtifact"},honeycode:{name:"Honeycode"},ivs:{name:"IVS"},braket:{name:"Braket"},identitystore:{name:"IdentityStore"},appflow:{name:"Appflow"},redshiftdata:{prefix:"redshift-data",name:"RedshiftData"},ssoadmin:{prefix:"sso-admin",name:"SSOAdmin"},timestreamquery:{prefix:"timestream-query",name:"TimestreamQuery"},timestreamwrite:{prefix:"timestream-write",name:"TimestreamWrite"},s3outposts:{name:"S3Outposts"},databrew:{name:"DataBrew"},servicecatalogappregistry:{prefix:"servicecatalog-appregistry",name:"ServiceCatalogAppRegistry"},networkfirewall:{prefix:"network-firewall",name:"NetworkFirewall"},mwaa:{name:"MWAA"},amplifybackend:{name:"AmplifyBackend"},appintegrations:{name:"AppIntegrations"},connectcontactlens:{prefix:"connect-contact-lens",name:"ConnectContactLens"},devopsguru:{prefix:"devops-guru",name:"DevOpsGuru"},ecrpublic:{prefix:"ecr-public",name:"ECRPUBLIC"},lookoutvision:{name:"LookoutVision"},sagemakerfeaturestoreruntime:{prefix:"sagemaker-featurestore-runtime",name:"SageMakerFeatureStoreRuntime"},customerprofiles:{prefix:"customer-profiles",name:"CustomerProfiles"},auditmanager:{name:"AuditManager"},emrcontainers:{prefix:"emr-containers",name:"EMRcontainers"},healthlake:{name:"HealthLake"},sagemakeredge:{prefix:"sagemaker-edge",name:"SagemakerEdge"},amp:{name:"Amp"},greengrassv2:{name:"GreengrassV2"},iotdeviceadvisor:{name:"IotDeviceAdvisor"},iotfleethub:{name:"IoTFleetHub"},iotwireless:{name:"IoTWireless"},location:{name:"Location",cors:!0},wellarchitected:{name:"WellArchitected"},lexmodelsv2:{prefix:"models.lex.v2",name:"LexModelsV2"},lexruntimev2:{prefix:"runtime.lex.v2",name:"LexRuntimeV2",cors:!0},fis:{name:"Fis"},lookoutmetrics:{name:"LookoutMetrics"},mgn:{name:"Mgn"},lookoutequipment:{name:"LookoutEquipment"},nimble:{name:"Nimble"},finspace:{name:"Finspace"},finspacedata:{prefix:"finspace-data",name:"Finspacedata"},ssmcontacts:{prefix:"ssm-contacts",name:"SSMContacts"},ssmincidents:{prefix:"ssm-incidents",name:"SSMIncidents"},applicationcostprofiler:{name:"ApplicationCostProfiler"},apprunner:{name:"AppRunner"},proton:{name:"Proton"},route53recoverycluster:{prefix:"route53-recovery-cluster",name:"Route53RecoveryCluster"},route53recoverycontrolconfig:{prefix:"route53-recovery-control-config",name:"Route53RecoveryControlConfig"},route53recoveryreadiness:{prefix:"route53-recovery-readiness",name:"Route53RecoveryReadiness"},chimesdkidentity:{prefix:"chime-sdk-identity",name:"ChimeSDKIdentity"},chimesdkmessaging:{prefix:"chime-sdk-messaging",name:"ChimeSDKMessaging"},snowdevicemanagement:{prefix:"snow-device-management",name:"SnowDeviceManagement"},memorydb:{name:"MemoryDB"},opensearch:{name:"OpenSearch"},kafkaconnect:{name:"KafkaConnect"},voiceid:{prefix:"voice-id",name:"VoiceID"},wisdom:{name:"Wisdom"},account:{name:"Account"},cloudcontrol:{name:"CloudControl"},grafana:{name:"Grafana"},panorama:{name:"Panorama"},chimesdkmeetings:{prefix:"chime-sdk-meetings",name:"ChimeSDKMeetings"},resiliencehub:{name:"Resiliencehub"},migrationhubstrategy:{name:"MigrationHubStrategy"},appconfigdata:{name:"AppConfigData"},drs:{name:"Drs"},migrationhubrefactorspaces:{prefix:"migration-hub-refactor-spaces",name:"MigrationHubRefactorSpaces"},evidently:{name:"Evidently"},inspector2:{name:"Inspector2"},rbin:{name:"Rbin"},rum:{name:"RUM"},backupgateway:{prefix:"backup-gateway",name:"BackupGateway"},iottwinmaker:{name:"IoTTwinMaker"},workspacesweb:{prefix:"workspaces-web",name:"WorkSpacesWeb"},amplifyuibuilder:{name:"AmplifyUIBuilder"},keyspaces:{name:"Keyspaces"},billingconductor:{name:"Billingconductor"},gamesparks:{name:"GameSparks"},pinpointsmsvoicev2:{prefix:"pinpoint-sms-voice-v2",name:"PinpointSMSVoiceV2"},ivschat:{name:"Ivschat"},chimesdkmediapipelines:{prefix:"chime-sdk-media-pipelines",name:"ChimeSDKMediaPipelines"},emrserverless:{prefix:"emr-serverless",name:"EMRServerless"},m2:{name:"M2"},connectcampaigns:{name:"ConnectCampaigns"},redshiftserverless:{prefix:"redshift-serverless",name:"RedshiftServerless"},rolesanywhere:{name:"RolesAnywhere"},licensemanagerusersubscriptions:{prefix:"license-manager-user-subscriptions",name:"LicenseManagerUserSubscriptions"},backupstorage:{name:"BackupStorage"},privatenetworks:{name:"PrivateNetworks"},supportapp:{prefix:"support-app",name:"SupportApp"},controltower:{name:"ControlTower"},iotfleetwise:{name:"IoTFleetWise"},migrationhuborchestrator:{name:"MigrationHubOrchestrator"},connectcases:{name:"ConnectCases"},resourceexplorer2:{prefix:"resource-explorer-2",name:"ResourceExplorer2"},scheduler:{name:"Scheduler"},chimesdkvoice:{prefix:"chime-sdk-voice",name:"ChimeSDKVoice"},iotroborunner:{prefix:"iot-roborunner",name:"IoTRoboRunner"},ssmsap:{prefix:"ssm-sap",name:"SsmSap"},oam:{name:"OAM"},arczonalshift:{prefix:"arc-zonal-shift",name:"ARCZonalShift"},omics:{name:"Omics"},opensearchserverless:{name:"OpenSearchServerless"},securitylake:{name:"SecurityLake"},simspaceweaver:{name:"SimSpaceWeaver"},docdbelastic:{prefix:"docdb-elastic",name:"DocDBElastic"},sagemakergeospatial:{prefix:"sagemaker-geospatial",name:"SageMakerGeospatial"},codecatalyst:{name:"CodeCatalyst"},pipes:{name:"Pipes"},sagemakermetrics:{prefix:"sagemaker-metrics",name:"SageMakerMetrics"},kinesisvideowebrtcstorage:{prefix:"kinesis-video-webrtc-storage",name:"KinesisVideoWebRTCStorage"},licensemanagerlinuxsubscriptions:{prefix:"license-manager-linux-subscriptions",name:"LicenseManagerLinuxSubscriptions"},kendraranking:{prefix:"kendra-ranking",name:"KendraRanking"},cleanrooms:{name:"CleanRooms"},cloudtraildata:{prefix:"cloudtrail-data",name:"CloudTrailData"},tnb:{name:"Tnb"},internetmonitor:{name:"InternetMonitor"}}});var Xn=I((R0,ka)=>{var Ei=On(),Bh=Wn(),Uh=vr(),Vh=Hn(),jh=zn(),qa=Kn(),Tr=le(),ie=Tr.property,Wh=Tr.memoizedProperty;function Hh(t,e){var r=this;t=t||{},e=e||{},e.api=this,t.metadata=t.metadata||{};var i=e.serviceIdentifier;delete e.serviceIdentifier,ie(this,"isApi",!0,!1),ie(this,"apiVersion",t.metadata.apiVersion),ie(this,"endpointPrefix",t.metadata.endpointPrefix),ie(this,"signingName",t.metadata.signingName),ie(this,"globalEndpoint",t.metadata.globalEndpoint),ie(this,"signatureVersion",t.metadata.signatureVersion),ie(this,"jsonVersion",t.metadata.jsonVersion),ie(this,"targetPrefix",t.metadata.targetPrefix),ie(this,"protocol",t.metadata.protocol),ie(this,"timestampFormat",t.metadata.timestampFormat),ie(this,"xmlNamespaceUri",t.metadata.xmlNamespace),ie(this,"abbreviation",t.metadata.serviceAbbreviation),ie(this,"fullName",t.metadata.serviceFullName),ie(this,"serviceId",t.metadata.serviceId),i&&qa[i]&&ie(this,"xmlNoDefaultLists",qa[i].xmlNoDefaultLists,!1),Wh(this,"className",function(){var s=t.metadata.serviceAbbreviation||t.metadata.serviceFullName;return s?(s=s.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""),s==="ElasticLoadBalancing"&&(s="ELB"),s):null});function n(s,o){o.endpointoperation===!0&&ie(r,"endpointOperation",Tr.string.lowerFirst(s)),o.endpointdiscovery&&!r.hasRequiredEndpointDiscovery&&ie(r,"hasRequiredEndpointDiscovery",o.endpointdiscovery.required===!0)}ie(this,"operations",new Ei(t.operations,e,function(s,o){return new Bh(s,o,e)},Tr.string.lowerFirst,n)),ie(this,"shapes",new Ei(t.shapes,e,function(s,o){return Uh.create(o,e)})),ie(this,"paginators",new Ei(t.paginators,e,function(s,o){return new Vh(s,o,e)})),ie(this,"waiters",new Ei(t.waiters,e,function(s,o){return new jh(s,o,e)},Tr.string.lowerFirst)),e.documentation&&(ie(this,"documentation",t.documentation),ie(this,"documentationUrl",t.documentationUrl)),ie(this,"awsQueryCompatible",t.metadata.awsQueryCompatible)}ka.exports=Hh});var La=I((I0,Oa)=>{function Si(t,e){if(!Si.services.hasOwnProperty(t))throw new Error("InvalidService: Failed to load api for "+t);return Si.services[t][e]}Si.services={};Oa.exports=Si});var Ma=I(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});var zh=function(){function t(e,r){this.key=e,this.value=r}return t}(),Kh=function(){function t(e){if(this.nodeMap={},this.size=0,typeof e!="number"||e<1)throw new Error("Cache size can only be positive number");this.sizeLimit=e}return Object.defineProperty(t.prototype,"length",{get:function(){return this.size},enumerable:!0,configurable:!0}),t.prototype.prependToList=function(e){this.headerNode?(this.headerNode.prev=e,e.next=this.headerNode):this.tailNode=e,this.headerNode=e,this.size++},t.prototype.removeFromTail=function(){if(this.tailNode){var e=this.tailNode,r=e.prev;return r&&(r.next=void 0),e.prev=void 0,this.tailNode=r,this.size--,e}},t.prototype.detachFromList=function(e){this.headerNode===e&&(this.headerNode=e.next),this.tailNode===e&&(this.tailNode=e.prev),e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.next=void 0,e.prev=void 0,this.size--},t.prototype.get=function(e){if(this.nodeMap[e]){var r=this.nodeMap[e];return this.detachFromList(r),this.prependToList(r),r.value}},t.prototype.remove=function(e){if(this.nodeMap[e]){var r=this.nodeMap[e];this.detachFromList(r),delete this.nodeMap[e]}},t.prototype.put=function(e,r){if(this.nodeMap[e])this.remove(e);else if(this.size===this.sizeLimit){var i=this.removeFromTail(),n=i.key;delete this.nodeMap[n]}var s=new zh(e,r);this.nodeMap[e]=s,this.prependToList(s)},t.prototype.empty=function(){for(var e=Object.keys(this.nodeMap),r=0;r{"use strict";Object.defineProperty($n,"__esModule",{value:!0});var Xh=Ma(),Gh=1e3,$h=function(){function t(e){e===void 0&&(e=Gh),this.maxSize=e,this.cache=new Xh.LRUCache(e)}return Object.defineProperty(t.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),t.prototype.put=function(e,r){var i=typeof e!="string"?t.getKeyString(e):e,n=this.populateValue(r);this.cache.put(i,n)},t.prototype.get=function(e){var r=typeof e!="string"?t.getKeyString(e):e,i=Date.now(),n=this.cache.get(r);if(n){for(var s=n.length-1;s>=0;s--){var o=n[s];o.Expire{var vt=V();vt.SequentialExecutor=vt.util.inherit({constructor:function(){this._events={}},listeners:function(e){return this._events[e]?this._events[e].slice(0):[]},on:function(e,r,i){return this._events[e]?i?this._events[e].unshift(r):this._events[e].push(r):this._events[e]=[r],this},onAsync:function(e,r,i){return r._isAsync=!0,this.on(e,r,i)},removeListener:function(e,r){var i=this._events[e];if(i){for(var n=i.length,s=-1,o=0;o-1&&i.splice(s,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,r,i){i||(i=function(){});var n=this.listeners(e),s=n.length;return this.callListeners(n,r,i),s>0},callListeners:function(e,r,i,n){var s=this,o=n||null;function a(c){if(c&&(o=vt.util.error(o||new Error,c),s._haltHandlersOnError))return i.call(s,o);s.callListeners(e,r,i,o)}for(;e.length>0;){var u=e.shift();if(u._isAsync){u.apply(s,r.concat([a]));return}else{try{u.apply(s,r)}catch(c){o=vt.util.error(o||new Error,c)}if(o&&s._haltHandlersOnError){i.call(s,o);return}}}i.call(s,o)},addListeners:function(e){var r=this;return e._events&&(e=e._events),vt.util.each(e,function(i,n){typeof n=="function"&&(n=[n]),vt.util.arrayEach(n,function(s){r.on(i,s)})}),r},addNamedListener:function(e,r,i,n){return this[e]=i,this.addListener(r,i,n),this},addNamedAsyncListener:function(e,r,i,n){return i._isAsync=!0,this.addNamedListener(e,r,i,n)},addNamedListeners:function(e){var r=this;return e(function(){r.addNamedListener.apply(r,arguments)},function(){r.addNamedAsyncListener.apply(r,arguments)}),this}});vt.SequentialExecutor.prototype.addListener=vt.SequentialExecutor.prototype.on;Ba.exports=vt.SequentialExecutor});var Ua=I((q0,Yh)=>{Yh.exports={rules:{"*/*":{endpoint:"{service}.{region}.amazonaws.com"},"cn-*/*":{endpoint:"{service}.{region}.amazonaws.com.cn"},"us-iso-*/*":"usIso","us-isob-*/*":"usIsob","*/budgets":"globalSSL","*/cloudfront":"globalSSL","*/sts":"globalSSL","*/importexport":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2",globalEndpoint:!0},"*/route53":"globalSSL","cn-*/route53":{endpoint:"{service}.amazonaws.com.cn",globalEndpoint:!0,signingRegion:"cn-northwest-1"},"us-gov-*/route53":"globalGovCloud","us-iso-*/route53":{endpoint:"{service}.c2s.ic.gov",globalEndpoint:!0,signingRegion:"us-iso-east-1"},"us-isob-*/route53":{endpoint:"{service}.sc2s.sgov.gov",globalEndpoint:!0,signingRegion:"us-isob-east-1"},"*/waf":"globalSSL","*/iam":"globalSSL","cn-*/iam":{endpoint:"{service}.cn-north-1.amazonaws.com.cn",globalEndpoint:!0,signingRegion:"cn-north-1"},"us-gov-*/iam":"globalGovCloud","us-gov-*/sts":{endpoint:"{service}.{region}.amazonaws.com"},"us-gov-west-1/s3":"s3signature","us-west-1/s3":"s3signature","us-west-2/s3":"s3signature","eu-west-1/s3":"s3signature","ap-southeast-1/s3":"s3signature","ap-southeast-2/s3":"s3signature","ap-northeast-1/s3":"s3signature","sa-east-1/s3":"s3signature","us-east-1/s3":{endpoint:"{service}.amazonaws.com",signatureVersion:"s3"},"us-east-1/sdb":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2"},"*/sdb":{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"v2"},"*/resource-explorer-2":"dualstackByDefault","*/kendra-ranking":"dualstackByDefault","*/internetmonitor":"dualstackByDefault","*/codecatalyst":"globalDualstackByDefault"},fipsRules:{"*/*":"fipsStandard","us-gov-*/*":"fipsStandard","us-iso-*/*":{endpoint:"{service}-fips.{region}.c2s.ic.gov"},"us-iso-*/dms":"usIso","us-isob-*/*":{endpoint:"{service}-fips.{region}.sc2s.sgov.gov"},"us-isob-*/dms":"usIsob","cn-*/*":{endpoint:"{service}-fips.{region}.amazonaws.com.cn"},"*/api.ecr":"fips.api.ecr","*/api.sagemaker":"fips.api.sagemaker","*/batch":"fipsDotPrefix","*/eks":"fipsDotPrefix","*/models.lex":"fips.models.lex","*/runtime.lex":"fips.runtime.lex","*/runtime.sagemaker":{endpoint:"runtime-fips.sagemaker.{region}.amazonaws.com"},"*/iam":"fipsWithoutRegion","*/route53":"fipsWithoutRegion","*/transcribe":"fipsDotPrefix","*/waf":"fipsWithoutRegion","us-gov-*/transcribe":"fipsDotPrefix","us-gov-*/api.ecr":"fips.api.ecr","us-gov-*/api.sagemaker":"fips.api.sagemaker","us-gov-*/models.lex":"fips.models.lex","us-gov-*/runtime.lex":"fips.runtime.lex","us-gov-*/acm-pca":"fipsWithServiceOnly","us-gov-*/batch":"fipsWithServiceOnly","us-gov-*/cloudformation":"fipsWithServiceOnly","us-gov-*/config":"fipsWithServiceOnly","us-gov-*/eks":"fipsWithServiceOnly","us-gov-*/elasticmapreduce":"fipsWithServiceOnly","us-gov-*/identitystore":"fipsWithServiceOnly","us-gov-*/dynamodb":"fipsWithServiceOnly","us-gov-*/elasticloadbalancing":"fipsWithServiceOnly","us-gov-*/guardduty":"fipsWithServiceOnly","us-gov-*/monitoring":"fipsWithServiceOnly","us-gov-*/resource-groups":"fipsWithServiceOnly","us-gov-*/runtime.sagemaker":"fipsWithServiceOnly","us-gov-*/servicecatalog-appregistry":"fipsWithServiceOnly","us-gov-*/servicequotas":"fipsWithServiceOnly","us-gov-*/ssm":"fipsWithServiceOnly","us-gov-*/sts":"fipsWithServiceOnly","us-gov-*/support":"fipsWithServiceOnly","us-gov-west-1/states":"fipsWithServiceOnly","us-iso-east-1/elasticfilesystem":{endpoint:"elasticfilesystem-fips.{region}.c2s.ic.gov"},"us-gov-west-1/organizations":"fipsWithServiceOnly","us-gov-west-1/route53":{endpoint:"route53.us-gov.amazonaws.com"},"*/resource-explorer-2":"fipsDualstackByDefault","*/kendra-ranking":"dualstackByDefault","*/internetmonitor":"dualstackByDefault","*/codecatalyst":"fipsGlobalDualstackByDefault"},dualstackRules:{"*/*":{endpoint:"{service}.{region}.api.aws"},"cn-*/*":{endpoint:"{service}.{region}.api.amazonwebservices.com.cn"},"*/s3":"dualstackLegacy","cn-*/s3":"dualstackLegacyCn","*/s3-control":"dualstackLegacy","cn-*/s3-control":"dualstackLegacyCn","ap-south-1/ec2":"dualstackLegacyEc2","eu-west-1/ec2":"dualstackLegacyEc2","sa-east-1/ec2":"dualstackLegacyEc2","us-east-1/ec2":"dualstackLegacyEc2","us-east-2/ec2":"dualstackLegacyEc2","us-west-2/ec2":"dualstackLegacyEc2"},dualstackFipsRules:{"*/*":{endpoint:"{service}-fips.{region}.api.aws"},"cn-*/*":{endpoint:"{service}-fips.{region}.api.amazonwebservices.com.cn"},"*/s3":"dualstackFipsLegacy","cn-*/s3":"dualstackFipsLegacyCn","*/s3-control":"dualstackFipsLegacy","cn-*/s3-control":"dualstackFipsLegacyCn"},patterns:{globalSSL:{endpoint:"https://{service}.amazonaws.com",globalEndpoint:!0,signingRegion:"us-east-1"},globalGovCloud:{endpoint:"{service}.us-gov.amazonaws.com",globalEndpoint:!0,signingRegion:"us-gov-west-1"},s3signature:{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"s3"},usIso:{endpoint:"{service}.{region}.c2s.ic.gov"},usIsob:{endpoint:"{service}.{region}.sc2s.sgov.gov"},fipsStandard:{endpoint:"{service}-fips.{region}.amazonaws.com"},fipsDotPrefix:{endpoint:"fips.{service}.{region}.amazonaws.com"},fipsWithoutRegion:{endpoint:"{service}-fips.amazonaws.com"},"fips.api.ecr":{endpoint:"ecr-fips.{region}.amazonaws.com"},"fips.api.sagemaker":{endpoint:"api-fips.sagemaker.{region}.amazonaws.com"},"fips.models.lex":{endpoint:"models-fips.lex.{region}.amazonaws.com"},"fips.runtime.lex":{endpoint:"runtime-fips.lex.{region}.amazonaws.com"},fipsWithServiceOnly:{endpoint:"{service}.{region}.amazonaws.com"},dualstackLegacy:{endpoint:"{service}.dualstack.{region}.amazonaws.com"},dualstackLegacyCn:{endpoint:"{service}.dualstack.{region}.amazonaws.com.cn"},dualstackFipsLegacy:{endpoint:"{service}-fips.dualstack.{region}.amazonaws.com"},dualstackFipsLegacyCn:{endpoint:"{service}-fips.dualstack.{region}.amazonaws.com.cn"},dualstackLegacyEc2:{endpoint:"api.ec2.{region}.aws"},dualstackByDefault:{endpoint:"{service}.{region}.api.aws"},fipsDualstackByDefault:{endpoint:"{service}-fips.{region}.api.aws"},globalDualstackByDefault:{endpoint:"{service}.global.api.aws"},fipsGlobalDualstackByDefault:{endpoint:"{service}-fips.global.api.aws"}}}});var ja=I((k0,Va)=>{var Jh=le(),_r=Ua();function Qh(t){if(!t)return null;var e=t.split("-");return e.length<3?null:e.slice(0,e.length-2).join("-")+"-*"}function Zh(t){var e=t.config.region,r=Qh(e),i=t.api.endpointPrefix;return[[e,i],[r,i],[e,"*"],[r,"*"],["*",i],["*","*"]].map(function(n){return n[0]&&n[1]?n.join("/"):null})}function em(t,e){Jh.each(e,function(r,i){r!=="globalEndpoint"&&(t.config[r]===void 0||t.config[r]===null)&&(t.config[r]=i)})}function tm(t){for(var e=Zh(t),r=t.config.useFipsEndpoint,i=t.config.useDualstackEndpoint,n=0;n{function im(t){return typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))}function nm(t){return typeof t=="string"&&["aws-global","aws-us-gov-global"].includes(t)}function sm(t){return["fips-aws-global","aws-fips","aws-global"].includes(t)?"us-east-1":["fips-aws-us-gov-global","aws-us-gov-global"].includes(t)?"us-gov-west-1":t.replace(/fips-(dkr-|prod-)?|-fips/,"")}Wa.exports={isFipsRegion:im,isGlobalRegion:nm,getRealRegion:sm}});var za=I((L0,Ha)=>{var B=V(),om=Xn(),am=ja(),Qn=B.util.inherit,um=0,wi=Jn();B.Service=Qn({constructor:function(e){if(!this.loadServiceClass)throw B.util.error(new Error,"Service must be constructed with `new' operator");if(e){if(e.region){var r=e.region;wi.isFipsRegion(r)&&(e.region=wi.getRealRegion(r),e.useFipsEndpoint=!0),wi.isGlobalRegion(r)&&(e.region=wi.getRealRegion(r))}typeof e.useDualstack=="boolean"&&typeof e.useDualstackEndpoint!="boolean"&&(e.useDualstackEndpoint=e.useDualstack)}var i=this.loadServiceClass(e||{});if(i){var n=B.util.copy(e),s=new i(e);return Object.defineProperty(s,"_originalConfig",{get:function(){return n},enumerable:!1,configurable:!0}),s._clientId=++um,s}this.initialize(e)},initialize:function(e){var r=B.config[this.serviceIdentifier];if(this.config=new B.Config(B.config),r&&this.config.update(r,!0),e&&this.config.update(e,!0),this.validateService(),this.config.endpoint||am.configureEndpoint(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint),B.SequentialExecutor.call(this),B.Service.addDefaultMonitoringListeners(this),(this.config.clientSideMonitoring||B.Service._clientSideMonitoring)&&this.publisher){var i=this.publisher;this.addNamedListener("PUBLISH_API_CALL","apiCall",function(s){process.nextTick(function(){i.eventHandler(s)})}),this.addNamedListener("PUBLISH_API_ATTEMPT","apiCallAttempt",function(s){process.nextTick(function(){i.eventHandler(s)})})}},validateService:function(){},loadServiceClass:function(e){var r=e;if(B.util.isEmpty(this.api)){if(r.apiConfig)return B.Service.defineServiceApi(this.constructor,r.apiConfig);if(this.constructor.services){r=new B.Config(B.config),r.update(e,!0);var i=r.apiVersions[this.constructor.serviceIdentifier];return i=i||r.apiVersion,this.getLatestServiceClass(i)}else return null}else return null},getLatestServiceClass:function(e){return e=this.getLatestServiceVersion(e),this.constructor.services[e]===null&&B.Service.defineServiceApi(this.constructor,e),this.constructor.services[e]},getLatestServiceVersion:function(e){if(!this.constructor.services||this.constructor.services.length===0)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(e?B.util.isType(e,Date)&&(e=B.util.date.iso8601(e).split("T")[0]):e="latest",Object.hasOwnProperty(this.constructor.services,e))return e;for(var r=Object.keys(this.constructor.services).sort(),i=null,n=r.length-1;n>=0;n--)if(r[n][r[n].length-1]!=="*"&&(i=r[n]),r[n].substr(0,10)<=e)return i;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(!e)this.customRequestHandler=null;else if(typeof e=="function")this.customRequestHandler=e;else throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests")},makeRequest:function(e,r,i){if(typeof r=="function"&&(i=r,r=null),r=r||{},this.config.params){var n=this.api.operations[e];n&&(r=B.util.copy(r),B.util.each(this.config.params,function(o,a){n.input.members[o]&&(r[o]===void 0||r[o]===null)&&(r[o]=a)}))}var s=new B.Request(this,e,r);return this.addAllRequestListeners(s),this.attachMonitoringEmitter(s),i&&s.send(i),s},makeUnauthenticatedRequest:function(e,r,i){typeof r=="function"&&(i=r,r={});var n=this.makeRequest(e,r).toUnauthenticated();return i?n.send(i):n},waitFor:function(e,r,i){var n=new B.ResourceWaiter(this,e);return n.wait(r,i)},addAllRequestListeners:function(e){for(var r=[B.events,B.EventListeners.Core,this.serviceInterface(),B.EventListeners.CorePost],i=0;i299?(s.code&&(i.FinalAwsException=s.code),s.message&&(i.FinalAwsExceptionMessage=s.message)):((s.code||s.name)&&(i.FinalSdkException=s.code||s.name),s.message&&(i.FinalSdkExceptionMessage=s.message))}return i},apiAttemptEvent:function(e){var r=e.service.api.operations[e.operation],i={Type:"ApiCallAttempt",Api:r?r.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},n=e.response;return n.httpResponse.statusCode&&(i.HttpStatusCode=n.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(i.AccessKey=e.service.config.credentials.accessKeyId),n.httpResponse.headers&&(e.httpRequest.headers["x-amz-security-token"]&&(i.SessionToken=e.httpRequest.headers["x-amz-security-token"]),n.httpResponse.headers["x-amzn-requestid"]&&(i.XAmznRequestId=n.httpResponse.headers["x-amzn-requestid"]),n.httpResponse.headers["x-amz-request-id"]&&(i.XAmzRequestId=n.httpResponse.headers["x-amz-request-id"]),n.httpResponse.headers["x-amz-id-2"]&&(i.XAmzId2=n.httpResponse.headers["x-amz-id-2"])),i},attemptFailEvent:function(e){var r=this.apiAttemptEvent(e),i=e.response,n=i.error;return i.httpResponse.statusCode>299?(n.code&&(r.AwsException=n.code),n.message&&(r.AwsExceptionMessage=n.message)):((n.code||n.name)&&(r.SdkException=n.code||n.name),n.message&&(r.SdkExceptionMessage=n.message)),r},attachMonitoringEmitter:function(e){var r,i,n,s,o=0,a,u,c=this,l=!0;e.on("validate",function(){s=B.util.realClock.now(),u=Date.now()},l),e.on("sign",function(){i=B.util.realClock.now(),r=Date.now(),a=e.httpRequest.region,o++},l),e.on("validateResponse",function(){n=Math.round(B.util.realClock.now()-i)}),e.addNamedListener("API_CALL_ATTEMPT","success",function(){var v=c.apiAttemptEvent(e);v.Timestamp=r,v.AttemptLatency=n>=0?n:0,v.Region=a,c.emit("apiCallAttempt",[v])}),e.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var v=c.attemptFailEvent(e);v.Timestamp=r,n=n||Math.round(B.util.realClock.now()-i),v.AttemptLatency=n>=0?n:0,v.Region=a,c.emit("apiCallAttempt",[v])}),e.addNamedListener("API_CALL","complete",function(){var v=c.apiCallEvent(e);if(v.AttemptCount=o,!(v.AttemptCount<=0)){v.Timestamp=u;var A=Math.round(B.util.realClock.now()-s);v.Latency=A>=0?A:0;var g=e.response;g.error&&g.error.retryable&&typeof g.retryCount=="number"&&typeof g.maxRetries=="number"&&g.retryCount>=g.maxRetries&&(v.MaxRetriesExceeded=1),c.emit("apiCall",[v])}})},setupRequestListeners:function(e){},getSigningName:function(){return this.api.signingName||this.api.endpointPrefix},getSignerClass:function(e){var r,i=null,n="";if(e){var s=e.service.api.operations||{};i=s[e.operation]||null,n=i?i.authtype:""}return this.config.signatureVersion?r=this.config.signatureVersion:n==="v4"||n==="v4-unsigned-body"?r="v4":n==="bearer"?r="bearer":r=this.api.signatureVersion,B.Signers.RequestSigner.getVersion(r)},serviceInterface:function(){switch(this.api.protocol){case"ec2":return B.EventListeners.Query;case"query":return B.EventListeners.Query;case"json":return B.EventListeners.Json;case"rest-json":return B.EventListeners.RestJson;case"rest-xml":return B.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return this.config.maxRetries!==void 0?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e,r){return B.util.calculateRetryDelay(e,this.config.retryDelayOptions,r)},retryableError:function(e){return!!(this.timeoutError(e)||this.networkingError(e)||this.expiredCredentialsError(e)||this.throttledError(e)||e.statusCode>=500)},networkingError:function(e){return e.code==="NetworkingError"},timeoutError:function(e){return e.code==="TimeoutError"},expiredCredentialsError:function(e){return e.code==="ExpiredTokenException"},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return Math.abs(this.getSkewCorrectedDate().getTime()-e)>=3e5},throttledError:function(e){if(e.statusCode===429)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":case"EC2ThrottledException":return!0;default:return!1}},endpointFromTemplate:function(e){if(typeof e!="string")return e;var r=e;return r=r.replace(/\{service\}/g,this.api.endpointPrefix),r=r.replace(/\{region\}/g,this.config.region),r=r.replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http"),r},setEndpoint:function(e){this.endpoint=new B.Endpoint(e,this.config)},paginationConfig:function(e,r){var i=this.api.operations[e].paginator;if(!i){if(r){var n=new Error;throw B.util.error(n,"No pagination configuration for "+e)}return null}return i}});B.util.update(B.Service,{defineMethods:function(e){B.util.each(e.prototype.api.operations,function(i){if(!e.prototype[i]){var n=e.prototype.api.operations[i];n.authtype==="none"?e.prototype[i]=function(s,o){return this.makeUnauthenticatedRequest(i,s,o)}:e.prototype[i]=function(s,o){return this.makeRequest(i,s,o)}}})},defineService:function(e,r,i){B.Service._serviceMap[e]=!0,Array.isArray(r)||(i=r,r=[]);var n=Qn(B.Service,i||{});if(typeof e=="string"){B.Service.addVersions(n,r);var s=n.serviceIdentifier||e;n.serviceIdentifier=s}else n.prototype.api=e,B.Service.defineMethods(n);if(B.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&B.util.clientSideMonitoring){var o=B.util.clientSideMonitoring.Publisher,a=B.util.clientSideMonitoring.configProvider,u=a();this.prototype.publisher=new o(u),u.enabled&&(B.Service._clientSideMonitoring=!0)}return B.SequentialExecutor.call(n.prototype),B.Service.addDefaultMonitoringListeners(n.prototype),n},addVersions:function(e,r){Array.isArray(r)||(r=[r]),e.services=e.services||{};for(var i=0;i{var We=V();We.Credentials=We.util.inherit({constructor:function(){if(We.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],arguments.length===1&&typeof arguments[0]=="object"){var e=arguments[0].credentials||arguments[0];this.accessKeyId=e.accessKeyId,this.secretAccessKey=e.secretAccessKey,this.sessionToken=e.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var e=We.util.date.getDate().getTime(),r=new Date(e+this.expiryWindow*1e3);return this.expireTime&&r>this.expireTime?!0:this.expired||!this.accessKeyId||!this.secretAccessKey},get:function(e){var r=this;this.needsRefresh()?this.refresh(function(i){i||(r.expired=!1),e&&e(i)}):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,r){var i=this;i.refreshCallbacks.push(e)===1&&i.load(function(s){We.util.arrayEach(i.refreshCallbacks,function(o){r?o(s):We.util.defer(function(){o(s)})}),i.refreshCallbacks.length=0})},load:function(e){e()}});We.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=We.util.promisifyMethod("get",e),this.prototype.refreshPromise=We.util.promisifyMethod("refresh",e)};We.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise};We.util.addPromises(We.Credentials)});var es=I(()=>{var $e=V();$e.CredentialProviderChain=$e.util.inherit($e.Credentials,{constructor:function(e){e?this.providers=e:this.providers=$e.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var r=this;if(r.providers.length===0)return e(new Error("No providers")),r;if(r.resolveCallbacks.push(e)===1){let o=function(a,u){if(!a&&u||i===n.length){$e.util.arrayEach(r.resolveCallbacks,function(l){l(a,u)}),r.resolveCallbacks.length=0;return}var c=n[i++];typeof c=="function"?u=c.call():u=c,u.get?u.get(function(l){o(l,l?null:u)}):o(null,u)};var s=o,i=0,n=r.providers.slice(0);o()}return r}});$e.CredentialProviderChain.defaultProviders=[];$e.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=$e.util.promisifyMethod("resolve",e)};$e.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise};$e.util.addPromises($e.CredentialProviderChain)});var Ka=I(()=>{var ne=V();Zn();es();var Ci;ne.Config=ne.util.inherit({constructor:function(e){e===void 0&&(e={}),e=this.extractCredentials(e),ne.util.each.call(this,this.keys,function(r,i){this.set(r,e[r],i)})},getCredentials:function(e){var r=this;function i(a){e(a,a?null:r.credentials)}function n(a,u){return new ne.util.error(u||new Error,{code:"CredentialsError",message:a,name:"CredentialsError"})}function s(){r.credentials.get(function(a){if(a){var u="Could not load credentials from "+r.credentials.constructor.name;a=n(u,a)}i(a)})}function o(){var a=null;(!r.credentials.accessKeyId||!r.credentials.secretAccessKey)&&(a=n("Missing credentials")),i(a)}r.credentials?typeof r.credentials.get=="function"?s():o():r.credentialProvider?r.credentialProvider.resolve(function(a,u){a&&(a=n("Could not load credentials from any providers",a)),r.credentials=u,i(a)}):i(n("No credentials to load"))},getToken:function(e){var r=this;function i(a){e(a,a?null:r.token)}function n(a,u){return new ne.util.error(u||new Error,{code:"TokenError",message:a,name:"TokenError"})}function s(){r.token.get(function(a){if(a){var u="Could not load token from "+r.token.constructor.name;a=n(u,a)}i(a)})}function o(){var a=null;r.token.token||(a=n("Missing token")),i(a)}r.token?typeof r.token.get=="function"?s():o():r.tokenProvider?r.tokenProvider.resolve(function(a,u){a&&(a=n("Could not load token from any providers",a)),r.token=u,i(a)}):i(n("No token to load"))},update:function(e,r){r=r||!1,e=this.extractCredentials(e),ne.util.each.call(this,e,function(i,n){(r||Object.prototype.hasOwnProperty.call(this.keys,i)||ne.Service.hasService(i))&&this.set(i,n)})},loadFromPath:function(e){this.clear();var r=JSON.parse(ne.util.readFileSync(e)),i=new ne.FileSystemCredentials(e),n=new ne.CredentialProviderChain;return n.providers.unshift(i),n.resolve(function(s,o){if(s)throw s;r.credentials=o}),this.constructor(r),this},clear:function(){ne.util.each.call(this,this.keys,function(e){delete this[e]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(e,r,i){r===void 0?(i===void 0&&(i=this.keys[e]),typeof i=="function"?this[e]=i.call(this):this[e]=i):e==="httpOptions"&&this[e]?this[e]=ne.util.merge(this[e],r):this[e]=r},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,s3UsEast1RegionalEndpoint:"legacy",s3UseArnRegion:void 0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:void 0,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:"legacy",useFipsEndpoint:!1,useDualstackEndpoint:!1,token:null},extractCredentials:function(e){return e.accessKeyId&&e.secretAccessKey&&(e=ne.util.copy(e),e.credentials=new ne.Credentials(e)),e},setPromisesDependency:function(e){Ci=e,e===null&&typeof Promise=="function"&&(Ci=Promise);var r=[ne.Request,ne.Credentials,ne.CredentialProviderChain];ne.S3&&(r.push(ne.S3),ne.S3.ManagedUpload&&r.push(ne.S3.ManagedUpload)),ne.util.addPromises(r,Ci)},getPromisesDependency:function(){return Ci}});ne.config=new ne.Config});var _i=I(()=>{var Se=V(),Ti=Se.util.inherit;Se.Endpoint=Ti({constructor:function(e,r){if(Se.util.hideProperties(this,["slashes","auth","hash","search","query"]),typeof e>"u"||e===null)throw new Error("Invalid endpoint: "+e);if(typeof e!="string")return Se.util.copy(e);if(!e.match(/^http/)){var i=r&&r.sslEnabled!==void 0?r.sslEnabled:Se.config.sslEnabled;e=(i?"https":"http")+"://"+e}Se.util.update(this,Se.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port=this.protocol==="https:"?443:80}});Se.HttpRequest=Ti({constructor:function(e,r){e=new Se.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=r,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=Se.util.userAgent()},getUserAgentHeaderName:function(){var e=Se.util.isBrowser()?"X-Amz-":"";return e+"User-Agent"},appendToUserAgent:function(e){typeof e=="string"&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=Se.util.queryStringParse(e),Se.util.queryParamsToString(e)):""},updateEndpoint:function(e){var r=new Se.Endpoint(e);this.endpoint=r,this.path=r.path||"/",this.headers.Host&&(this.headers.Host=r.host)}});Se.HttpResponse=Ti({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}});Se.HttpClient=Ti({});Se.HttpClient.getInstance=function(){return this.singleton===void 0&&(this.singleton=new this),this.singleton}});var eu=I((z0,Za)=>{var me=V(),Le=le(),Xa=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function Ai(t){var e=t.service,r=e.api||{},i=r.operations,n={};return e.config.region&&(n.region=e.config.region),r.serviceId&&(n.serviceId=r.serviceId),e.config.credentials.accessKeyId&&(n.accessKeyId=e.config.credentials.accessKeyId),n}function $a(t,e,r){!r||e===void 0||e===null||r.type==="structure"&&r.required&&r.required.length>0&&Le.arrayEach(r.required,function(i){var n=r.members[i];if(n.endpointDiscoveryId===!0){var s=n.isLocationName?n.name:i;t[s]=String(e[i])}else $a(t,e[i],n)})}function xi(t,e){var r={};return $a(r,t.params,e),r}function Ya(t){var e=t.service,r=e.api,i=r.operations?r.operations[t.operation]:void 0,n=i?i.input:void 0,s=xi(t,n),o=Ai(t);Object.keys(s).length>0&&(o=Le.update(o,s),i&&(o.operation=i.name));var a=me.endpointCache.get(o);if(!(a&&a.length===1&&a[0].Address===""))if(a&&a.length>0)t.httpRequest.updateEndpoint(a[0].Address);else{var u=e.makeRequest(r.endpointOperation,{Operation:i.name,Identifiers:s});Qa(u),u.removeListener("validate",me.EventListeners.Core.VALIDATE_PARAMETERS),u.removeListener("retry",me.EventListeners.Core.RETRY_CHECK),me.endpointCache.put(o,[{Address:"",CachePeriodInMinutes:1}]),u.send(function(c,l){l&&l.Endpoints?me.endpointCache.put(o,l.Endpoints):c&&me.endpointCache.put(o,[{Address:"",CachePeriodInMinutes:1}])})}}var gt={};function Ja(t,e){var r=t.service,i=r.api,n=i.operations?i.operations[t.operation]:void 0,s=n?n.input:void 0,o=xi(t,s),a=Ai(t);Object.keys(o).length>0&&(a=Le.update(a,o),n&&(a.operation=n.name));var u=me.EndpointCache.getKeyString(a),c=me.endpointCache.get(u);if(c&&c.length===1&&c[0].Address===""){gt[u]||(gt[u]=[]),gt[u].push({request:t,callback:e});return}else if(c&&c.length>0)t.httpRequest.updateEndpoint(c[0].Address),e();else{var l=r.makeRequest(i.endpointOperation,{Operation:n.name,Identifiers:o});l.removeListener("validate",me.EventListeners.Core.VALIDATE_PARAMETERS),Qa(l),me.endpointCache.put(u,[{Address:"",CachePeriodInMinutes:60}]),l.send(function(d,v){if(d){if(t.response.error=Le.error(d,{retryable:!1}),me.endpointCache.remove(a),gt[u]){var A=gt[u];Le.arrayEach(A,function(g){g.request.response.error=Le.error(d,{retryable:!1}),g.callback()}),delete gt[u]}}else if(v&&(me.endpointCache.put(u,v.Endpoints),t.httpRequest.updateEndpoint(v.Endpoints[0].Address),gt[u])){var A=gt[u];Le.arrayEach(A,function(E){E.request.httpRequest.updateEndpoint(v.Endpoints[0].Address),E.callback()}),delete gt[u]}e()})}}function Qa(t){var e=t.service.api,r=e.apiVersion;r&&!t.httpRequest.headers["x-amz-api-version"]&&(t.httpRequest.headers["x-amz-api-version"]=r)}function ts(t){var e=t.error,r=t.httpResponse;if(e&&(e.code==="InvalidEndpointException"||r.statusCode===421)){var i=t.request,n=i.service.api.operations||{},s=n[i.operation]?n[i.operation].input:void 0,o=xi(i,s),a=Ai(i);Object.keys(o).length>0&&(a=Le.update(a,o),n[i.operation]&&(a.operation=n[i.operation].name)),me.endpointCache.remove(a)}}function cm(t){if(t._originalConfig&&t._originalConfig.endpoint&&t._originalConfig.endpointDiscoveryEnabled===!0)throw Le.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var e=me.config[t.serviceIdentifier]||{};return!!(me.config.endpoint||e.endpoint||t._originalConfig&&t._originalConfig.endpoint)}function Ga(t){return["false","0"].indexOf(t)>=0}function lm(t){var e=t.service||{};if(e.config.endpointDiscoveryEnabled!==void 0)return e.config.endpointDiscoveryEnabled;if(!Le.isBrowser()){for(var r=0;r{var G=V(),It=Yn(),pm=eu().discoverEndpoint;G.EventListeners={Core:{}};function ru(t){if(!t.service.api.operations)return"";var e=t.service.api.operations[t.operation];return e?e.authtype:""}function tu(t){var e=t.service;return e.config.signatureVersion?e.config.signatureVersion:e.api.signatureVersion?e.api.signatureVersion:ru(t)}G.EventListeners={Core:new It().addNamedListeners(function(t,e){e("VALIDATE_CREDENTIALS","validate",function(n,s){if(!n.service.api.signatureVersion&&!n.service.config.signatureVersion)return s();var o=tu(n);if(o==="bearer"){n.service.config.getToken(function(a){a&&(n.response.error=G.util.error(a,{code:"TokenError"})),s()});return}n.service.config.getCredentials(function(a){a&&(n.response.error=G.util.error(a,{code:"CredentialsError",message:"Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1"})),s()})}),t("VALIDATE_REGION","validate",function(n){if(!n.service.isGlobalEndpoint){var s=new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);n.service.config.region?s.test(n.service.config.region)||(n.response.error=G.util.error(new Error,{code:"ConfigError",message:"Invalid region in config"})):n.response.error=G.util.error(new Error,{code:"ConfigError",message:"Missing region in config"})}}),t("BUILD_IDEMPOTENCY_TOKENS","validate",function(n){if(n.service.api.operations){var s=n.service.api.operations[n.operation];if(s){var o=s.idempotentMembers;if(o.length){for(var a=G.util.copy(n.params),u=0,c=o.length;u=0)return n.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",s();G.util.computeSha256(u,function(c,l){c?s(c):(n.httpRequest.headers["X-Amz-Content-Sha256"]=l,s())})}else s()}}),t("SET_CONTENT_LENGTH","afterBuild",function(n){var s=ru(n),o=G.util.getRequestPayloadShape(n);if(n.httpRequest.headers["Content-Length"]===void 0)try{var a=G.util.string.byteLength(n.httpRequest.body);n.httpRequest.headers["Content-Length"]=a}catch(u){if(o&&o.isStreaming){if(o.requiresLength)throw u;if(s.indexOf("unsigned-body")>=0){n.httpRequest.headers["Transfer-Encoding"]="chunked";return}else throw u}throw u}}),t("SET_HTTP_HOST","afterBuild",function(n){n.httpRequest.headers.Host=n.httpRequest.endpoint.host}),t("SET_TRACE_ID","afterBuild",function(n){var s="X-Amzn-Trace-Id";if(G.util.isNode()&&!Object.hasOwnProperty.call(n.httpRequest.headers,s)){var o="AWS_LAMBDA_FUNCTION_NAME",a="_X_AMZN_TRACE_ID",u=process.env[o],c=process.env[a];typeof u=="string"&&u.length>0&&typeof c=="string"&&c.length>0&&(n.httpRequest.headers[s]=c)}}),t("RESTART","restart",function(){var n=this.response.error;!n||!n.retryable||(this.httpRequest=new G.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount=60*10?this.emit("sign",[this],function(d){d?s(d):c()}):c()}),t("HTTP_HEADERS","httpHeaders",function(n,s,o,a){o.httpResponse.statusCode=n,o.httpResponse.statusMessage=a,o.httpResponse.headers=s,o.httpResponse.body=G.util.buffer.toBuffer(""),o.httpResponse.buffers=[],o.httpResponse.numBytes=0;var u=s.date||s.Date,c=o.request.service;if(u){var l=Date.parse(u);c.config.correctClockSkew&&c.isClockSkewed(l)&&c.applyClockOffset(l)}}),t("HTTP_DATA","httpData",function(n,s){if(n){if(G.util.isNode()){s.httpResponse.numBytes+=n.length;var o=s.httpResponse.headers["content-length"],a={loaded:s.httpResponse.numBytes,total:o};s.request.emit("httpDownloadProgress",[a,s])}s.httpResponse.buffers.push(G.util.buffer.toBuffer(n))}}),t("HTTP_DONE","httpDone",function(n){if(n.httpResponse.buffers&&n.httpResponse.buffers.length>0){var s=G.util.buffer.concat(n.httpResponse.buffers);n.httpResponse.body=s}delete n.httpResponse.numBytes,delete n.httpResponse.buffers}),t("FINALIZE_ERROR","retry",function(n){n.httpResponse.statusCode&&(n.error.statusCode=n.httpResponse.statusCode,n.error.retryable===void 0&&(n.error.retryable=this.service.retryableError(n.error,this)))}),t("INVALIDATE_CREDENTIALS","retry",function(n){if(n.error)switch(n.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":n.error.retryable=!0,n.request.service.config.credentials.expired=!0}}),t("EXPIRED_SIGNATURE","retry",function(n){var s=n.error;s&&typeof s.code=="string"&&typeof s.message=="string"&&s.code.match(/Signature/)&&s.message.match(/expired/)&&(n.error.retryable=!0)}),t("CLOCK_SKEWED","retry",function(n){n.error&&this.service.clockSkewError(n.error)&&this.service.config.correctClockSkew&&(n.error.retryable=!0)}),t("REDIRECT","retry",function(n){n.error&&n.error.statusCode>=300&&n.error.statusCode<400&&n.httpResponse.headers.location&&(this.httpRequest.endpoint=new G.Endpoint(n.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,n.error.redirect=!0,n.error.retryable=!0)}),t("RETRY_CHECK","retry",function(n){n.error&&(n.error.redirect&&n.redirectCount=0?(n.error=null,setTimeout(s,o)):s()})}),CorePost:new It().addNamedListeners(function(t){t("EXTRACT_REQUEST_ID","extractData",G.util.extractRequestId),t("EXTRACT_REQUEST_ID","extractError",G.util.extractRequestId),t("ENOTFOUND_ERROR","httpError",function(r){function i(s){return s.errno==="ENOTFOUND"||typeof s.errno=="number"&&typeof G.util.getSystemErrorName=="function"&&["EAI_NONAME","EAI_NODATA"].indexOf(G.util.getSystemErrorName(s.errno)>=0)}if(r.code==="NetworkingError"&&i(r)){var n="Inaccessible host: `"+r.hostname+"' at port `"+r.port+"'. This service may not be available in the `"+r.region+"' region.";this.response.error=G.util.error(new Error(n),{code:"UnknownEndpoint",region:r.region,hostname:r.hostname,retryable:!0,originalError:r})}})}),Logger:new It().addNamedListeners(function(t){t("LOG_REQUEST","complete",function(r){var i=r.request,n=i.service.config.logger;if(!n)return;function s(u,c){if(!c)return c;if(u.isSensitive)return"***SensitiveInformation***";switch(u.type){case"structure":var l={};return G.util.each(c,function(A,g){Object.prototype.hasOwnProperty.call(u.members,A)?l[A]=s(u.members[A],g):l[A]=g}),l;case"list":var d=[];return G.util.arrayEach(c,function(A,g){d.push(s(u.member,A))}),d;case"map":var v={};return G.util.each(c,function(A,g){v[A]=s(u.value,g)}),v;default:return c}}function o(){var u=r.request.service.getSkewCorrectedDate().getTime(),c=(u-i.startTime.getTime())/1e3,l=!!n.isTTY,d=r.httpResponse.statusCode,v=i.params;if(i.service.api.operations&&i.service.api.operations[i.operation]&&i.service.api.operations[i.operation].input){var A=i.service.api.operations[i.operation].input;v=s(A,i.params)}var g=require("util").inspect(v,!0,null),E="";return l&&(E+="\x1B[33m"),E+="[AWS "+i.service.serviceIdentifier+" "+d,E+=" "+c.toString()+"s "+r.retryCount+" retries]",l&&(E+="\x1B[0;1m"),E+=" "+G.util.string.lowerFirst(i.operation),E+="("+g+")",l&&(E+="\x1B[0m"),E}var a=o();typeof n.log=="function"?n.log(a):typeof n.write=="function"&&n.write(a+` +`)})}),Json:new It().addNamedListeners(function(t){var e=mi();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),Rest:new It().addNamedListeners(function(t){var e=yr();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),RestJson:new It().addNamedListeners(function(t){var e=Un();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError),t("UNSET_CONTENT_LENGTH","afterBuild",e.unsetContentLength)}),RestXml:new It().addNamedListeners(function(t){var e=jn();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)}),Query:new It().addNamedListeners(function(t){var e=Mn();t("BUILD","build",e.buildRequest),t("EXTRACT_DATA","extractData",e.extractData),t("EXTRACT_ERROR","extractError",e.extractError)})}});var su=I((G0,nu)=>{function rs(t,e){this.currentState=e||null,this.states=t||{}}rs.prototype.runTo=function(e,r,i,n){typeof e=="function"&&(n=i,i=r,r=e,e=null);var s=this,o=s.states[s.currentState];o.fn.call(i||s,n,function(a){if(a)if(o.fail)s.currentState=o.fail;else return r?r.call(i,a):null;else if(o.accept)s.currentState=o.accept;else return r?r.call(i):null;if(s.currentState===e)return r?r.call(i,a):null;s.runTo(e,r,i,a)})};rs.prototype.addState=function(e,r,i,n){return typeof r=="function"?(n=r,r=null,i=null):typeof i=="function"&&(n=i,i=null),this.currentState||(this.currentState=e),this.states[e]={accept:r,fail:i,fn:n},this};nu.exports=rs});var Ri=I(bi=>{(function(t){"use strict";function e(p){return p!==null?Object.prototype.toString.call(p)==="[object Array]":!1}function r(p){return p!==null?Object.prototype.toString.call(p)==="[object Object]":!1}function i(p,y){if(p===y)return!0;var C=Object.prototype.toString.call(p);if(C!==Object.prototype.toString.call(y))return!1;if(e(p)===!0){if(p.length!==y.length)return!1;for(var D=0;D",9:"Array"},w="EOF",R="UnquotedIdentifier",N="QuotedIdentifier",T="Rbracket",_="Rparen",O="Comma",W="Colon",M="Rbrace",H="Number",x="Current",ge="Expref",pe="Pipe",Q="Or",Oe="And",ut="EQ",ct="GT",kt="LT",$="GTE",$t="LTE",Ct="NE",Fe="Flatten",Ae="Star",lt="Filter",Ot="Dot",Yt="Not",Tt="Lbrace",ft="Lbracket",m="Lparen",f="Literal",q={".":Ot,"*":Ae,",":O,":":W,"{":Tt,"}":M,"]":T,"(":m,")":_,"@":x},b={"<":!0,">":!0,"=":!0,"!":!0},J={" ":!0," ":!0,"\n":!0};function ae(p){return p>="a"&&p<="z"||p>="A"&&p<="Z"||p==="_"}function ue(p){return p>="0"&&p<="9"||p==="-"}function _e(p){return p>="a"&&p<="z"||p>="A"&&p<="Z"||p>="0"&&p<="9"||p==="_"}function Pe(){}Pe.prototype={tokenize:function(p){var y=[];this._current=0;for(var C,D,k;this._current")return p[this._current]==="="?(this._current++,{type:$,value:">=",start:y}):{type:ct,value:">",start:y};if(C==="="&&p[this._current]==="=")return this._current++,{type:ut,value:"==",start:y}},_consumeLiteral:function(p){this._current++;for(var y=this._current,C=p.length,D;p[this._current]!=="`"&&this._current=0)return!0;if(C.indexOf(p)>=0)return!0;if(D.indexOf(p[0])>=0)try{return JSON.parse(p),!0}catch{return!1}else return!1}};var z={};z[w]=0,z[R]=0,z[N]=0,z[T]=0,z[_]=0,z[O]=0,z[M]=0,z[H]=0,z[x]=0,z[ge]=0,z[pe]=1,z[Q]=2,z[Oe]=3,z[ut]=5,z[ct]=5,z[kt]=5,z[$]=5,z[$t]=5,z[Ct]=5,z[Fe]=9,z[Ae]=20,z[lt]=21,z[Ot]=40,z[Yt]=45,z[Tt]=50,z[ft]=55,z[m]=60;function ce(){}ce.prototype={parse:function(p){this._loadTokens(p),this.index=0;var y=this.expression(0);if(this._lookahead(0)!==w){var C=this._lookaheadToken(0),D=new Error("Unexpected token type: "+C.type+", value: "+C.value);throw D.name="ParserError",D}return y},_loadTokens:function(p){var y=new Pe,C=y.tokenize(p);C.push({type:w,value:"",start:p.length}),this.tokens=C},expression:function(p){var y=this._lookaheadToken(0);this._advance();for(var C=this.nud(y),D=this._lookahead(0);p=0)return this.expression(p);if(y===ft)return this._match(ft),this._parseMultiselectList();if(y===Tt)return this._match(Tt),this._parseMultiselectHash()},_parseProjectionRHS:function(p){var y;if(z[this._lookahead(0)]<10)y={type:"Identity"};else if(this._lookahead(0)===ft)y=this.expression(p);else if(this._lookahead(0)===lt)y=this.expression(p);else if(this._lookahead(0)===Ot)this._match(Ot),y=this._parseDotRHS(p);else{var C=this._lookaheadToken(0),D=new Error("Sytanx error, unexpected token: "+C.value+"("+C.type+")");throw D.name="ParserError",D}return y},_parseMultiselectList:function(){for(var p=[];this._lookahead(0)!==T;){var y=this.expression(0);if(p.push(y),this._lookahead(0)===O&&(this._match(O),this._lookahead(0)===T))throw new Error("Unexpected token Rbracket")}return this._match(T),{type:"MultiSelectList",children:p}},_parseMultiselectHash:function(){for(var p=[],y=[R,N],C,D,k,F;;){if(C=this._lookaheadToken(0),y.indexOf(C.type)<0)throw new Error("Expecting an identifier token, got: "+C.type);if(D=C.value,this._advance(),this._match(W),k=this.expression(0),F={type:"KeyValuePair",name:D,value:k},p.push(F),this._lookahead(0)===O)this._match(O);else if(this._lookahead(0)===M){this._match(M);break}}return{type:"MultiSelectHash",children:p}}};function Be(p){this.runtime=p}Be.prototype={search:function(p,y){return this.visit(p,y)},visit:function(p,y){var C,D,k,F,X,Y,xe,pt,de,K;switch(p.type){case"Field":return y!==null&&r(y)?(Y=y[p.name],Y===void 0?null:Y):null;case"Subexpression":for(k=this.visit(p.children[0],y),K=1;K0)for(K=Is;KPs;K+=nn)k.push(y[K]);return k;case"Projection":var Xe=this.visit(p.children[0],y);if(!e(Xe))return null;for(de=[],K=0;KX;break;case $:k=F>=X;break;case kt:k=F=p&&(y=C<0?p-1:p),y}};function $r(p){this._interpreter=p,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[u]}]},avg:{_func:this._functionAvg,_signature:[{types:[P]}]},ceil:{_func:this._functionCeil,_signature:[{types:[u]}]},contains:{_func:this._functionContains,_signature:[{types:[l,d]},{types:[c]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[l]},{types:[l]}]},floor:{_func:this._functionFloor,_signature:[{types:[u]}]},length:{_func:this._functionLength,_signature:[{types:[l,d,v]}]},map:{_func:this._functionMap,_signature:[{types:[g]},{types:[d]}]},max:{_func:this._functionMax,_signature:[{types:[P,S]}]},merge:{_func:this._functionMerge,_signature:[{types:[v],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[d]},{types:[g]}]},sum:{_func:this._functionSum,_signature:[{types:[P]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[l]},{types:[l]}]},min:{_func:this._functionMin,_signature:[{types:[P,S]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[d]},{types:[g]}]},type:{_func:this._functionType,_signature:[{types:[c]}]},keys:{_func:this._functionKeys,_signature:[{types:[v]}]},values:{_func:this._functionValues,_signature:[{types:[v]}]},sort:{_func:this._functionSort,_signature:[{types:[S,P]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[d]},{types:[g]}]},join:{_func:this._functionJoin,_signature:[{types:[l]},{types:[S]}]},reverse:{_func:this._functionReverse,_signature:[{types:[l,d]}]},to_array:{_func:this._functionToArray,_signature:[{types:[c]}]},to_string:{_func:this._functionToString,_signature:[{types:[c]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[c]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[c],variadic:!0}]}}}$r.prototype={callFunction:function(p,y){var C=this.functionTable[p];if(C===void 0)throw new Error("Unknown function: "+p+"()");return this._validateArgs(p,y,C._signature),C._func.call(this,y)},_validateArgs:function(p,y,C){var D;if(C[C.length-1].variadic){if(y.length=0;k--)D+=C[k];return D}else{var F=p[0].slice(0);return F.reverse(),F}},_functionAbs:function(p){return Math.abs(p[0])},_functionCeil:function(p){return Math.ceil(p[0])},_functionAvg:function(p){for(var y=0,C=p[0],D=0;D=0},_functionFloor:function(p){return Math.floor(p[0])},_functionLength:function(p){return r(p[0])?Object.keys(p[0]).length:p[0].length},_functionMap:function(p){for(var y=[],C=this._interpreter,D=p[0],k=p[1],F=0;F0){var y=this._getTypeName(p[0][0]);if(y===u)return Math.max.apply(Math,p[0]);for(var C=p[0],D=C[0],k=1;k0){var y=this._getTypeName(p[0][0]);if(y===u)return Math.min.apply(Math,p[0]);for(var C=p[0],D=C[0],k=1;kdt?1:Kk&&(k=X,F=C[Y]);return F},_functionMinBy:function(p){for(var y=p[1],C=p[0],D=this.createKeyFunction(y,[u,l]),k=1/0,F,X,Y=0;Y"u"?bi.jmespath={}:bi)});var au=I(()=>{var ee=V(),ou=su(),dm=ee.util.inherit,Ii=ee.util.domain,hm=Ri(),mm={success:1,error:1,complete:1};function vm(t){return Object.prototype.hasOwnProperty.call(mm,t._asm.currentState)}var is=new ou;is.setupStates=function(){var t=function(e,r){var i=this;i._haltHandlersOnError=!1,i.emit(i._asm.currentState,function(n){if(n)if(vm(i))if(Ii&&i.domain instanceof Ii.Domain)n.domainEmitter=i,n.domain=i.domain,n.domainThrown=!1,i.domain.emit("error",n);else throw n;else i.response.error=n,r(n);else r(i.response.error)})};this.addState("validate","build","error",t),this.addState("build","afterBuild","restart",t),this.addState("afterBuild","sign","restart",t),this.addState("sign","send","retry",t),this.addState("retry","afterRetry","afterRetry",t),this.addState("afterRetry","sign","error",t),this.addState("send","validateResponse","retry",t),this.addState("validateResponse","extractData","extractError",t),this.addState("extractError","extractData","retry",t),this.addState("extractData","success","retry",t),this.addState("restart","build","error",t),this.addState("success","complete","complete",t),this.addState("error","complete","complete",t),this.addState("complete",null,null,t)};is.setupStates();ee.Request=dm({constructor:function(e,r,i){var n=e.endpoint,s=e.config.region,o=e.config.customUserAgent;e.signingRegion?s=e.signingRegion:e.isGlobalEndpoint&&(s="us-east-1"),this.domain=Ii&&Ii.active,this.service=e,this.operation=r,this.params=i||{},this.httpRequest=new ee.HttpRequest(n,s),this.httpRequest.appendToUserAgent(o),this.startTime=e.getSkewCorrectedDate(),this.response=new ee.Response(this),this._asm=new ou(is.states,"validate"),this._haltHandlersOnError=!1,ee.SequentialExecutor.call(this),this.emit=this.emitEvent},send:function(e){return e&&(this.httpRequest.appendToUserAgent("callback"),this.on("complete",function(r){e.call(r,r.error,r.data)})),this.runTo(),this.response},build:function(e){return this.runTo("send",e)},runTo:function(e,r){return this._asm.runTo(e,r,this),this},abort:function(){return this.removeAllListeners("validateResponse"),this.removeAllListeners("extractError"),this.on("validateResponse",function(r){r.error=ee.util.error(new Error("Request aborted by user"),{code:"RequestAbortedError",retryable:!1})}),this.httpRequest.stream&&!this.httpRequest.stream.didCallback&&(this.httpRequest.stream.abort(),this.httpRequest._abortCallback?this.httpRequest._abortCallback():this.removeAllListeners("send")),this},eachPage:function(e){e=ee.util.fn.makeAsync(e,3);function r(i){e.call(i,i.error,i.data,function(n){n!==!1&&(i.hasNextPage()?i.nextPage().on("complete",r).send():e.call(i,null,null,ee.util.fn.noop))})}this.on("complete",r).send()},eachItem:function(e){var r=this;function i(n,s){if(n)return e(n,null);if(s===null)return e(null,null);var o=r.service.paginationConfig(r.operation),a=o.resultKey;Array.isArray(a)&&(a=a[0]);var u=hm.search(s,a),c=!0;return ee.util.arrayEach(u,function(l){if(c=e(null,l),c===!1)return ee.util.abort}),c}this.eachPage(i)},isPageable:function(){return!!this.service.paginationConfig(this.operation)},createReadStream:function(){var e=ee.util.stream,r=this,i=null;return ee.HttpClient.streamsApiVersion===2?(i=new e.PassThrough,process.nextTick(function(){r.send()})):(i=new e.Stream,i.readable=!0,i.sent=!1,i.on("newListener",function(n){!i.sent&&n==="data"&&(i.sent=!0,process.nextTick(function(){r.send()}))})),this.on("error",function(n){i.emit("error",n)}),this.on("httpHeaders",function(s,o,a){if(s<300){r.removeListener("httpData",ee.EventListeners.Core.HTTP_DATA),r.removeListener("httpError",ee.EventListeners.Core.HTTP_ERROR),r.on("httpError",function(E){a.error=E,a.error.retryable=!1});var u=!1,c;if(r.httpRequest.method!=="HEAD"&&(c=parseInt(o["content-length"],10)),c!==void 0&&!isNaN(c)&&c>=0){u=!0;var l=0}var d=function(){u&&l!==c?i.emit("error",ee.util.error(new Error("Stream content length mismatch. Received "+l+" of "+c+" bytes."),{code:"StreamContentLengthMismatch"})):ee.HttpClient.streamsApiVersion===2?i.end():i.emit("end")},v=a.httpResponse.createUnbufferedStream();if(ee.HttpClient.streamsApiVersion===2)if(u){var A=new e.PassThrough;A._write=function(g){return g&&g.length&&(l+=g.length),e.PassThrough.prototype._write.apply(this,arguments)},A.on("end",d),i.on("error",function(g){u=!1,v.unpipe(A),A.emit("end"),A.end()}),v.pipe(A).pipe(i,{end:!1})}else v.pipe(i);else u&&v.on("data",function(g){g&&g.length&&(l+=g.length)}),v.on("data",function(g){i.emit("data",g)}),v.on("end",d);v.on("error",function(g){u=!1,i.emit("error",g)})}}),i},emitEvent:function(e,r,i){typeof r=="function"&&(i=r,r=null),i||(i=function(){}),r||(r=this.eventParameters(e,this.response));var n=ee.SequentialExecutor.prototype.emit;n.call(this,e,r,function(s){s&&(this.response.error=s),i.call(this,s)})},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,r){return!r&&typeof e=="function"&&(r=e,e=null),new ee.Signers.Presign().sign(this.toGet(),e,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",ee.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",ee.EventListeners.Core.SIGN),this},toGet:function(){return(this.service.api.protocol==="query"||this.service.api.protocol==="ec2")&&(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}});ee.Request.addPromisesToClass=function(e){this.prototype.promise=function(){var i=this;return this.httpRequest.appendToUserAgent("promise"),new e(function(n,s){i.on("complete",function(o){o.error?s(o.error):n(Object.defineProperty(o.data||{},"$response",{value:o}))}),i.runTo()})}};ee.Request.deletePromisesFromClass=function(){delete this.prototype.promise};ee.util.addPromises(ee.Request);ee.util.mixin(ee.Request,ee.SequentialExecutor)});var cu=I(()=>{var Ar=V(),gm=Ar.util.inherit,uu=Ri();Ar.Response=gm({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new Ar.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var r,i=this.request.service,n=this.request.operation;try{r=i.paginationConfig(n,!0)}catch(u){this.error=u}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var s=Ar.util.copy(this.request.params);if(this.nextPageTokens){var o=r.inputToken;typeof o=="string"&&(o=[o]);for(var a=0;a{var Ut=V(),ym=Ut.util.inherit,sr=Ri();function lu(t){var e=t.request._waiter,r=e.config.acceptors,i=!1,n="retry";r.forEach(function(s){if(!i){var o=e.matchers[s.matcher];o&&o(t,s.expected,s.argument)&&(i=!0,n=s.state)}}),!i&&t.error&&(n="failure"),n==="success"?e.setSuccess(t):e.setError(t,n==="retry")}Ut.ResourceWaiter=ym({constructor:function(e,r){this.service=e,this.state=r,this.loadWaiterConfig(this.state)},service:null,state:null,config:null,matchers:{path:function(t,e,r){try{var i=sr.search(t.data,r)}catch{return!1}return sr.strictDeepEqual(i,e)},pathAll:function(t,e,r){try{var i=sr.search(t.data,r)}catch{return!1}Array.isArray(i)||(i=[i]);var n=i.length;if(!n)return!1;for(var s=0;s{var yt=V(),Em=yt.util.inherit;yt.Signers.V2=Em(yt.Signers.RequestSigner,{addAuthorization:function(e,r){r||(r=yt.util.date.getDate());var i=this.request;i.params.Timestamp=yt.util.date.iso8601(r),i.params.SignatureVersion="2",i.params.SignatureMethod="HmacSHA256",i.params.AWSAccessKeyId=e.accessKeyId,e.sessionToken&&(i.params.SecurityToken=e.sessionToken),delete i.params.Signature,i.params.Signature=this.signature(e),i.body=yt.util.queryParamsToString(i.params),i.headers["Content-Length"]=i.body.length},signature:function(e){return yt.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push(this.request.endpoint.host.toLowerCase()),e.push(this.request.pathname()),e.push(yt.util.queryParamsToString(this.request.params)),e.join(` +`)}});pu.exports=yt.Signers.V2});var ns=I((iE,hu)=>{var it=V(),Sm=it.util.inherit;it.Signers.V3=Sm(it.Signers.RequestSigner,{addAuthorization:function(e,r){var i=it.util.date.rfc822(r);this.request.headers["X-Amz-Date"]=i,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,i)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var e=[];return it.util.arrayEach(this.headersToSign(),function(i){e.push(i.toLowerCase())}),e.sort().join(";")},canonicalHeaders:function(){var e=this.request.headers,r=[];return it.util.arrayEach(this.headersToSign(),function(n){r.push(n.toLowerCase().trim()+":"+String(e[n]).trim())}),r.sort().join(` `)+` -`},headersToSign:function(){var e=[];return Qe.util.each(this.request.headers,function(i){(i==="Host"||i==="Content-Encoding"||i.match(/^X-Amz/i))&&e.push(i)}),e},signature:function(e){return Qe.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),Qe.util.crypto.sha256(e.join(` -`))}});da.exports=Qe.Signers.V3});var ma=I((Ky,ha)=>{var pi=j(),Zd=pi.util.inherit;xn();pi.Signers.V3Https=Zd(pi.Signers.V3,{authorization:function(e){return"AWS3-HTTPS AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,Signature="+this.signature(e)},stringToSign:function(){return this.request.headers["X-Amz-Date"]}});ha.exports=pi.Signers.V3Https});var ga=I((Gy,ya)=>{var pr=j(),dr={},di=[],eh=50,va="aws4_request";ya.exports={createScope:function(e,r,i){return[e.substr(0,8),r,i,va].join("/")},getSigningKey:function(e,r,i,n,s){var o=pr.util.crypto.hmac(e.secretAccessKey,e.accessKeyId,"base64"),a=[o,r,i,n].join("_");if(s=s!==!1,s&&a in dr)return dr[a];var u=pr.util.crypto.hmac("AWS4"+e.secretAccessKey,r,"buffer"),c=pr.util.crypto.hmac(u,i,"buffer"),l=pr.util.crypto.hmac(c,n,"buffer"),h=pr.util.crypto.hmac(l,va,"buffer");return s&&(dr[a]=h,di.push(a),di.length>eh&&delete dr[di.shift()]),h},emptyCache:function(){dr={},di=[]}}});var _a=I(($y,Sa)=>{var Ae=j(),Ea=ga(),th=Ae.util.inherit,hi="presigned-expires";Ae.Signers.V4=th(Ae.Signers.RequestSigner,{constructor:function(e,r,i){Ae.Signers.RequestSigner.call(this,e),this.serviceName=r,i=i||{},this.signatureCache=typeof i.signatureCache=="boolean"?i.signatureCache:!0,this.operation=i.operation,this.signatureVersion=i.signatureVersion},algorithm:"AWS4-HMAC-SHA256",addAuthorization:function(e,r){var i=Ae.util.date.iso8601(r).replace(/[:\-]|\.\d{3}/g,"");this.isPresigned()?this.updateForPresigned(e,i):this.addHeaders(e,i),this.request.headers.Authorization=this.authorization(e,i)},addHeaders:function(e,r){this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken)},updateForPresigned:function(e,r){var i=this.credentialString(r),n={"X-Amz-Date":r,"X-Amz-Algorithm":this.algorithm,"X-Amz-Credential":e.accessKeyId+"/"+i,"X-Amz-Expires":this.request.headers[hi],"X-Amz-SignedHeaders":this.signedHeaders()};e.sessionToken&&(n["X-Amz-Security-Token"]=e.sessionToken),this.request.headers["Content-Type"]&&(n["Content-Type"]=this.request.headers["Content-Type"]),this.request.headers["Content-MD5"]&&(n["Content-MD5"]=this.request.headers["Content-MD5"]),this.request.headers["Cache-Control"]&&(n["Cache-Control"]=this.request.headers["Cache-Control"]),Ae.util.each.call(this,this.request.headers,function(o,a){if(o!==hi&&this.isSignableHeader(o)){var u=o.toLowerCase();u.indexOf("x-amz-meta-")===0?n[u]=a:u.indexOf("x-amz-")===0&&(n[o]=a)}});var s=this.request.path.indexOf("?")>=0?"&":"?";this.request.path+=s+Ae.util.queryParamsToString(n)},authorization:function(e,r){var i=[],n=this.credentialString(r);return i.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),i.push("SignedHeaders="+this.signedHeaders()),i.push("Signature="+this.signature(e,r)),i.join(", ")},signature:function(e,r){var i=Ea.getSigningKey(e,r.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return Ae.util.crypto.hmac(i,this.stringToSign(r),"hex")},stringToSign:function(e){var r=[];return r.push("AWS4-HMAC-SHA256"),r.push(e),r.push(this.credentialString(e)),r.push(this.hexEncodedHash(this.canonicalString())),r.join(` -`)},canonicalString:function(){var e=[],r=this.request.pathname();return this.serviceName!=="s3"&&this.signatureVersion!=="s3v4"&&(r=Ae.util.uriEscapePath(r)),e.push(this.request.method),e.push(r),e.push(this.request.search()),e.push(this.canonicalHeaders()+` +`},headersToSign:function(){var e=[];return it.util.each(this.request.headers,function(i){(i==="Host"||i==="Content-Encoding"||i.match(/^X-Amz/i))&&e.push(i)}),e},signature:function(e){return it.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),it.util.crypto.sha256(e.join(` +`))}});hu.exports=it.Signers.V3});var vu=I((nE,mu)=>{var Pi=V(),wm=Pi.util.inherit;ns();Pi.Signers.V3Https=wm(Pi.Signers.V3,{authorization:function(e){return"AWS3-HTTPS AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,Signature="+this.signature(e)},stringToSign:function(){return this.request.headers["X-Amz-Date"]}});mu.exports=Pi.Signers.V3Https});var Eu=I((sE,yu)=>{var xr=V(),br={},Ni=[],Cm=50,gu="aws4_request";yu.exports={createScope:function(e,r,i){return[e.substr(0,8),r,i,gu].join("/")},getSigningKey:function(e,r,i,n,s){var o=xr.util.crypto.hmac(e.secretAccessKey,e.accessKeyId,"base64"),a=[o,r,i,n].join("_");if(s=s!==!1,s&&a in br)return br[a];var u=xr.util.crypto.hmac("AWS4"+e.secretAccessKey,r,"buffer"),c=xr.util.crypto.hmac(u,i,"buffer"),l=xr.util.crypto.hmac(c,n,"buffer"),d=xr.util.crypto.hmac(l,gu,"buffer");return s&&(br[a]=d,Ni.push(a),Ni.length>Cm&&delete br[Ni.shift()]),d},emptyCache:function(){br={},Ni=[]}}});var Cu=I((oE,wu)=>{var Ie=V(),Su=Eu(),Tm=Ie.util.inherit,Di="presigned-expires";Ie.Signers.V4=Tm(Ie.Signers.RequestSigner,{constructor:function(e,r,i){Ie.Signers.RequestSigner.call(this,e),this.serviceName=r,i=i||{},this.signatureCache=typeof i.signatureCache=="boolean"?i.signatureCache:!0,this.operation=i.operation,this.signatureVersion=i.signatureVersion},algorithm:"AWS4-HMAC-SHA256",addAuthorization:function(e,r){var i=Ie.util.date.iso8601(r).replace(/[:\-]|\.\d{3}/g,"");this.isPresigned()?this.updateForPresigned(e,i):this.addHeaders(e,i),this.request.headers.Authorization=this.authorization(e,i)},addHeaders:function(e,r){this.request.headers["X-Amz-Date"]=r,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken)},updateForPresigned:function(e,r){var i=this.credentialString(r),n={"X-Amz-Date":r,"X-Amz-Algorithm":this.algorithm,"X-Amz-Credential":e.accessKeyId+"/"+i,"X-Amz-Expires":this.request.headers[Di],"X-Amz-SignedHeaders":this.signedHeaders()};e.sessionToken&&(n["X-Amz-Security-Token"]=e.sessionToken),this.request.headers["Content-Type"]&&(n["Content-Type"]=this.request.headers["Content-Type"]),this.request.headers["Content-MD5"]&&(n["Content-MD5"]=this.request.headers["Content-MD5"]),this.request.headers["Cache-Control"]&&(n["Cache-Control"]=this.request.headers["Cache-Control"]),Ie.util.each.call(this,this.request.headers,function(o,a){if(o!==Di&&this.isSignableHeader(o)){var u=o.toLowerCase();u.indexOf("x-amz-meta-")===0?n[u]=a:u.indexOf("x-amz-")===0&&(n[o]=a)}});var s=this.request.path.indexOf("?")>=0?"&":"?";this.request.path+=s+Ie.util.queryParamsToString(n)},authorization:function(e,r){var i=[],n=this.credentialString(r);return i.push(this.algorithm+" Credential="+e.accessKeyId+"/"+n),i.push("SignedHeaders="+this.signedHeaders()),i.push("Signature="+this.signature(e,r)),i.join(", ")},signature:function(e,r){var i=Su.getSigningKey(e,r.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return Ie.util.crypto.hmac(i,this.stringToSign(r),"hex")},stringToSign:function(e){var r=[];return r.push("AWS4-HMAC-SHA256"),r.push(e),r.push(this.credentialString(e)),r.push(this.hexEncodedHash(this.canonicalString())),r.join(` +`)},canonicalString:function(){var e=[],r=this.request.pathname();return this.serviceName!=="s3"&&this.signatureVersion!=="s3v4"&&(r=Ie.util.uriEscapePath(r)),e.push(this.request.method),e.push(r),e.push(this.request.search()),e.push(this.canonicalHeaders()+` `),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join(` -`)},canonicalHeaders:function(){var e=[];Ae.util.each.call(this,this.request.headers,function(i,n){e.push([i,n])}),e.sort(function(i,n){return i[0].toLowerCase()-1&&!e.body?"UNSIGNED-PAYLOAD":e.headers["X-Amz-Content-Sha256"]?e.headers["X-Amz-Content-Sha256"]:this.hexEncodedHash(this.request.body||"")},unsignableHeaders:["authorization","content-type","content-length","user-agent",hi,"expect","x-amzn-trace-id"],isSignableHeader:function(e){return e.toLowerCase().indexOf("x-amz-")===0?!0:this.unsignableHeaders.indexOf(e)<0},isPresigned:function(){return!!this.request.headers[hi]}});Sa.exports=Ae.Signers.V4});var Ca=I((Yy,wa)=>{var Ze=j(),rh=Ze.util.inherit;Ze.Signers.S3=rh(Ze.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,r){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=Ze.util.date.rfc822(r)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var i=this.sign(e.secretAccessKey,this.stringToSign()),n="AWS "+e.accessKeyId+":"+i;this.request.headers.Authorization=n},stringToSign:function(){var e=this.request,r=[];r.push(e.method),r.push(e.headers["Content-MD5"]||""),r.push(e.headers["Content-Type"]||""),r.push(e.headers["presigned-expires"]||"");var i=this.canonicalizedAmzHeaders();return i&&r.push(i),r.push(this.canonicalizedResource()),r.join(` -`)},canonicalizedAmzHeaders:function(){var e=[];Ze.util.each(this.request.headers,function(i){i.match(/^x-amz-/i)&&e.push(i)}),e.sort(function(i,n){return i.toLowerCase(){var Ee=j(),ih=Ee.util.inherit,Yt="presigned-expires";function nh(t){var e=t.httpRequest.headers[Yt],r=t.service.getSignerClass(t);if(delete t.httpRequest.headers["User-Agent"],delete t.httpRequest.headers["X-Amz-User-Agent"],r===Ee.Signers.V4){if(e>604800){var i="Presigning does not support expiry time greater than a week with SigV4 signing.";throw Ee.util.error(new Error,{code:"InvalidExpiryTime",message:i,retryable:!1})}t.httpRequest.headers[Yt]=e}else if(r===Ee.Signers.S3){var n=t.service?t.service.getSkewCorrectedDate():Ee.util.date.getDate();t.httpRequest.headers[Yt]=parseInt(Ee.util.date.unixTimestamp(n)+e,10).toString()}else throw Ee.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1})}function sh(t){var e=t.httpRequest.endpoint,r=Ee.util.urlParse(t.httpRequest.path),i={};r.search&&(i=Ee.util.queryStringParse(r.search.substr(1)));var n=t.httpRequest.headers.Authorization.split(" ");if(n[0]==="AWS")n=n[1].split(":"),i.Signature=n.pop(),i.AWSAccessKeyId=n.join(":"),Ee.util.each(t.httpRequest.headers,function(a,u){a===Yt&&(a="Expires"),a.indexOf("x-amz-meta-")===0&&(delete i[a],a=a.toLowerCase()),i[a]=u}),delete t.httpRequest.headers[Yt],delete i.Authorization,delete i.Host;else if(n[0]==="AWS4-HMAC-SHA256"){n.shift();var s=n.join(" "),o=s.match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];i["X-Amz-Signature"]=o,delete i.Expires}e.pathname=r.pathname,e.search=Ee.util.queryParamsToString(i)}Ee.Signers.Presign=ih({sign:function(e,r,i){if(e.httpRequest.headers[Yt]=r||3600,e.on("build",nh),e.on("sign",sh),e.removeListener("afterBuild",Ee.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",Ee.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),i)e.build(function(){this.response.error?i(this.response.error):i(null,Ee.util.urlFormat(e.httpRequest.endpoint))});else{if(e.build(),e.response.error)throw e.response.error;return Ee.util.urlFormat(e.httpRequest.endpoint)}}});Ta.exports=Ee.Signers.Presign});var Aa=I(()=>{var ht=j(),oh=ht.util.inherit;ht.Signers.RequestSigner=oh({constructor:function(e){this.request=e},setServiceClientId:function(e){this.serviceClientId=e},getServiceClientId:function(){return this.serviceClientId}});ht.Signers.RequestSigner.getVersion=function(e){switch(e){case"v2":return ht.Signers.V2;case"v3":return ht.Signers.V3;case"s3v4":return ht.Signers.V4;case"v4":return ht.Signers.V4;case"s3":return ht.Signers.S3;case"v3https":return ht.Signers.V3Https}throw new Error("Unknown signing version "+e)};pa();xn();ma();_a();Ca();ba()});var xa=I(()=>{var ze=j();ze.ParamValidator=ze.util.inherit({constructor:function(e){(e===!0||e===void 0)&&(e={min:!0}),this.validation=e},validate:function(e,r,i){if(this.errors=[],this.validateMember(e,r||{},i||"params"),this.errors.length>1){var n=this.errors.join(` +`)},canonicalHeaders:function(){var e=[];Ie.util.each.call(this,this.request.headers,function(i,n){e.push([i,n])}),e.sort(function(i,n){return i[0].toLowerCase()"u"||s===null||typeof s.toString!="function")throw Ie.util.error(new Error("Header "+n+" contains invalid value"),{code:"InvalidHeader"});r.push(n+":"+this.canonicalHeaderValues(s.toString()))}}),r.join(` +`)},canonicalHeaderValues:function(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")},signedHeaders:function(){var e=[];return Ie.util.each.call(this,this.request.headers,function(r){r=r.toLowerCase(),this.isSignableHeader(r)&&e.push(r)}),e.sort().join(";")},credentialString:function(e){return Su.createScope(e.substr(0,8),this.request.region,this.serviceName)},hexEncodedHash:function(e){return Ie.util.crypto.sha256(e,"hex")},hexEncodedBodyHash:function(){var e=this.request;return this.isPresigned()&&["s3","s3-object-lambda"].indexOf(this.serviceName)>-1&&!e.body?"UNSIGNED-PAYLOAD":e.headers["X-Amz-Content-Sha256"]?e.headers["X-Amz-Content-Sha256"]:this.hexEncodedHash(this.request.body||"")},unsignableHeaders:["authorization","content-type","content-length","user-agent",Di,"expect","x-amzn-trace-id"],isSignableHeader:function(e){return e.toLowerCase().indexOf("x-amz-")===0?!0:this.unsignableHeaders.indexOf(e)<0},isPresigned:function(){return!!this.request.headers[Di]}});wu.exports=Ie.Signers.V4});var _u=I((aE,Tu)=>{var nt=V(),_m=nt.util.inherit;nt.Signers.S3=_m(nt.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,r){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=nt.util.date.rfc822(r)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);var i=this.sign(e.secretAccessKey,this.stringToSign()),n="AWS "+e.accessKeyId+":"+i;this.request.headers.Authorization=n},stringToSign:function(){var e=this.request,r=[];r.push(e.method),r.push(e.headers["Content-MD5"]||""),r.push(e.headers["Content-Type"]||""),r.push(e.headers["presigned-expires"]||"");var i=this.canonicalizedAmzHeaders();return i&&r.push(i),r.push(this.canonicalizedResource()),r.join(` +`)},canonicalizedAmzHeaders:function(){var e=[];nt.util.each(this.request.headers,function(i){i.match(/^x-amz-/i)&&e.push(i)}),e.sort(function(i,n){return i.toLowerCase(){var we=V(),Am=we.util.inherit,or="presigned-expires";function xm(t){var e=t.httpRequest.headers[or],r=t.service.getSignerClass(t);if(delete t.httpRequest.headers["User-Agent"],delete t.httpRequest.headers["X-Amz-User-Agent"],r===we.Signers.V4){if(e>604800){var i="Presigning does not support expiry time greater than a week with SigV4 signing.";throw we.util.error(new Error,{code:"InvalidExpiryTime",message:i,retryable:!1})}t.httpRequest.headers[or]=e}else if(r===we.Signers.S3){var n=t.service?t.service.getSkewCorrectedDate():we.util.date.getDate();t.httpRequest.headers[or]=parseInt(we.util.date.unixTimestamp(n)+e,10).toString()}else throw we.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1})}function bm(t){var e=t.httpRequest.endpoint,r=we.util.urlParse(t.httpRequest.path),i={};r.search&&(i=we.util.queryStringParse(r.search.substr(1)));var n=t.httpRequest.headers.Authorization.split(" ");if(n[0]==="AWS")n=n[1].split(":"),i.Signature=n.pop(),i.AWSAccessKeyId=n.join(":"),we.util.each(t.httpRequest.headers,function(a,u){a===or&&(a="Expires"),a.indexOf("x-amz-meta-")===0&&(delete i[a],a=a.toLowerCase()),i[a]=u}),delete t.httpRequest.headers[or],delete i.Authorization,delete i.Host;else if(n[0]==="AWS4-HMAC-SHA256"){n.shift();var s=n.join(" "),o=s.match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];i["X-Amz-Signature"]=o,delete i.Expires}e.pathname=r.pathname,e.search=we.util.queryParamsToString(i)}we.Signers.Presign=Am({sign:function(e,r,i){if(e.httpRequest.headers[or]=r||3600,e.on("build",xm),e.on("sign",bm),e.removeListener("afterBuild",we.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",we.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),i)e.build(function(){this.response.error?i(this.response.error):i(null,we.util.urlFormat(e.httpRequest.endpoint))});else{if(e.build(),e.response.error)throw e.response.error;return we.util.urlFormat(e.httpRequest.endpoint)}}});Au.exports=we.Signers.Presign});var bu=I(()=>{var qi=V();qi.Signers.Bearer=qi.util.inherit(qi.Signers.RequestSigner,{constructor:function(e){qi.Signers.RequestSigner.call(this,e)},addAuthorization:function(e){this.request.headers.Authorization="Bearer "+e.token}})});var Ru=I(()=>{var st=V(),Rm=st.util.inherit;st.Signers.RequestSigner=Rm({constructor:function(e){this.request=e},setServiceClientId:function(e){this.serviceClientId=e},getServiceClientId:function(){return this.serviceClientId}});st.Signers.RequestSigner.getVersion=function(e){switch(e){case"v2":return st.Signers.V2;case"v3":return st.Signers.V3;case"s3v4":return st.Signers.V4;case"v4":return st.Signers.V4;case"s3":return st.Signers.S3;case"v3https":return st.Signers.V3Https;case"bearer":return st.Signers.Bearer}throw new Error("Unknown signing version "+e)};du();ns();vu();Cu();_u();xu();bu()});var Iu=I(()=>{var Ye=V();Ye.ParamValidator=Ye.util.inherit({constructor:function(e){(e===!0||e===void 0)&&(e={min:!0}),this.validation=e},validate:function(e,r,i){if(this.errors=[],this.validateMember(e,r||{},i||"params"),this.errors.length>1){var n=this.errors.join(` * `);throw n="There were "+this.errors.length+` validation errors: -* `+n,ze.util.error(new Error(n),{code:"MultipleValidationErrors",errors:this.errors})}else{if(this.errors.length===1)throw this.errors[0];return!0}},fail:function(e,r){this.errors.push(ze.util.error(new Error(r),{code:e}))},validateStructure:function(e,r,i){if(e.isDocument)return!0;this.validateType(r,i,["object"],"structure");for(var n,s=0;e.required&&s= 1, but found "'+r+'" for '+i)},validatePattern:function(e,r,i){this.validation.pattern&&e.pattern!==void 0&&(new RegExp(e.pattern).test(r)||this.fail("PatternMatchError",'Provided value "'+r+'" does not match regex pattern /'+e.pattern+"/ for "+i))},validateRange:function(e,r,i,n){this.validation.min&&e.min!==void 0&&r= "+e.min+", but found "+r+" for "+i),this.validation.max&&e.max!==void 0&&r>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+r+" for "+i)},validateEnum:function(e,r,i){this.validation.enum&&e.enum!==void 0&&e.enum.indexOf(r)===-1&&this.fail("EnumError","Found string value of "+r+", but expected "+e.enum.join("|")+" for "+i)},validateType:function(e,r,i,n){if(e==null)return!1;for(var s=!1,o=0;o{var mt={util:le()},ah={};ah.toString();Ra.exports=mt;mt.util.update(mt,{VERSION:"2.1188.0",Signers:{},Protocol:{Json:Jr(),Query:an(),Rest:nr(),RestJson:cn(),RestXml:fn()},XML:{Builder:Ro(),Parser:null},JSON:{Builder:Kr(),Parser:$r()},Model:{Api:vn(),Operation:pn(),Shape:rr(),Paginator:dn(),ResourceWaiter:hn()},apiLoader:Mo(),EndpointCache:Bo().EndpointCache});En();zo();Ko();oi();ra();oa();ua();la();Aa();xa();mt.events=new mt.SequentialExecutor;mt.util.memoizedProperty(mt,"endpointCache",function(){return new mt.EndpointCache(mt.config.endpointCacheSize)},!0)});var In=I(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.default=lh;var uh=ch(require("crypto"));function ch(t){return t&&t.__esModule?t:{default:t}}function lh(){return uh.default.randomBytes(16)}});var vi=I(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.default=void 0;var Ia=[];for(hr=0;hr<256;++hr)Ia[hr]=(hr+256).toString(16).substr(1);var hr;function fh(t,e){var r=e||0,i=Ia;return[i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]]].join("")}var ph=fh;mi.default=ph});var Pa=I(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.default=void 0;var dh=Da(In()),hh=Da(vi());function Da(t){return t&&t.__esModule?t:{default:t}}var Na,Dn,Nn=0,Pn=0;function mh(t,e,r){var i=e&&r||0,n=e||[];t=t||{};var s=t.node||Na,o=t.clockseq!==void 0?t.clockseq:Dn;if(s==null||o==null){var a=t.random||(t.rng||dh.default)();s==null&&(s=Na=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=Dn=(a[6]<<8|a[7])&16383)}var u=t.msecs!==void 0?t.msecs:new Date().getTime(),c=t.nsecs!==void 0?t.nsecs:Pn+1,l=u-Nn+(c-Pn)/1e4;if(l<0&&t.clockseq===void 0&&(o=o+1&16383),(l<0||u>Nn)&&t.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Nn=u,Pn=c,Dn=o,u+=122192928e5;var h=((u&268435455)*1e4+c)%4294967296;n[i++]=h>>>24&255,n[i++]=h>>>16&255,n[i++]=h>>>8&255,n[i++]=h&255;var g=u/4294967296*1e4&268435455;n[i++]=g>>>8&255,n[i++]=g&255,n[i++]=g>>>24&15|16,n[i++]=g>>>16&255,n[i++]=o>>>8|128,n[i++]=o&255;for(var b=0;b<6;++b)n[i+b]=s[b];return e||(0,hh.default)(n)}var vh=mh;yi.default=vh});var qn=I(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.default=_h;Ot.URL=Ot.DNS=void 0;var yh=gh(vi());function gh(t){return t&&t.__esModule?t:{default:t}}function Eh(t){var e=[];return t.replace(/[a-fA-F0-9]{2}/g,function(r){e.push(parseInt(r,16))}),e}function Sh(t){t=unescape(encodeURIComponent(t));for(var e=new Array(t.length),r=0;r{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.default=void 0;var wh=Ch(require("crypto"));function Ch(t){return t&&t.__esModule?t:{default:t}}function Th(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),wh.default.createHash("md5").update(t).digest()}var bh=Th;gi.default=bh});var Ma=I(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.default=void 0;var Ah=ka(qn()),xh=ka(La());function ka(t){return t&&t.__esModule?t:{default:t}}var Rh=(0,Ah.default)("v3",48,xh.default),Ih=Rh;Ei.default=Ih});var Ba=I(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.default=void 0;var Dh=Fa(In()),Nh=Fa(vi());function Fa(t){return t&&t.__esModule?t:{default:t}}function Ph(t,e,r){var i=e&&r||0;typeof t=="string"&&(e=t==="binary"?new Array(16):null,t=null),t=t||{};var n=t.random||(t.rng||Dh.default)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e)for(var s=0;s<16;++s)e[i+s]=n[s];return e||(0,Nh.default)(n)}var qh=Ph;Si.default=qh});var Ua=I(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.default=void 0;var Oh=Lh(require("crypto"));function Lh(t){return t&&t.__esModule?t:{default:t}}function kh(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),Oh.default.createHash("sha1").update(t).digest()}var Mh=kh;_i.default=Mh});var Va=I(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.default=void 0;var Fh=ja(qn()),Bh=ja(Ua());function ja(t){return t&&t.__esModule?t:{default:t}}var Uh=(0,Fh.default)("v5",80,Bh.default),jh=Uh;wi.default=jh});var Xa=I(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Object.defineProperty(Jt,"v1",{enumerable:!0,get:function(){return Vh.default}});Object.defineProperty(Jt,"v3",{enumerable:!0,get:function(){return Xh.default}});Object.defineProperty(Jt,"v4",{enumerable:!0,get:function(){return Wh.default}});Object.defineProperty(Jt,"v5",{enumerable:!0,get:function(){return Hh.default}});var Vh=Ci(Pa()),Xh=Ci(Ma()),Wh=Ci(Ba()),Hh=Ci(Va());function Ci(t){return t&&t.__esModule?t:{default:t}}});var le=I((dg,Wa)=>{var Ue,k={environment:"nodejs",engine:function(){if(k.isBrowser()&&typeof navigator!="undefined")return navigator.userAgent;var e=process.platform+"/"+process.version;return process.env.AWS_EXECUTION_ENV&&(e+=" exec-env/"+process.env.AWS_EXECUTION_ENV),e},userAgent:function(){var e=k.environment,r="aws-sdk-"+e+"/"+j().VERSION;return e==="nodejs"&&(r+=" "+k.engine()),r},uriEscape:function(e){var r=encodeURIComponent(e);return r=r.replace(/[^A-Za-z0-9_.~\-%]+/g,escape),r=r.replace(/[*]/g,function(i){return"%"+i.charCodeAt(0).toString(16).toUpperCase()}),r},uriEscapePath:function(e){var r=[];return k.arrayEach(e.split("/"),function(i){r.push(k.uriEscape(i))}),r.join("/")},urlParse:function(e){return k.url.parse(e)},urlFormat:function(e){return k.url.format(e)},queryStringParse:function(e){return k.querystring.parse(e)},queryParamsToString:function(e){var r=[],i=k.uriEscape,n=Object.keys(e).sort();return k.arrayEach(n,function(s){var o=e[s],a=i(s),u=a+"=";if(Array.isArray(o)){var c=[];k.arrayEach(o,function(l){c.push(i(l))}),u=a+"="+c.sort().join("&"+a+"=")}else o!=null&&(u=a+"="+i(o));r.push(u)}),r.join("&")},readFileSync:function(e){return k.isBrowser()?null:require("fs").readFileSync(e,"utf-8")},base64:{encode:function(e){if(typeof e=="number")throw k.error(new Error("Cannot base64 encode number "+e));if(e===null||typeof e=="undefined")return e;var r=k.buffer.toBuffer(e);return r.toString("base64")},decode:function(e){if(typeof e=="number")throw k.error(new Error("Cannot base64 decode number "+e));return e===null||typeof e=="undefined"?e:k.buffer.toBuffer(e,"base64")}},buffer:{toBuffer:function(t,e){return typeof k.Buffer.from=="function"&&k.Buffer.from!==Uint8Array.from?k.Buffer.from(t,e):new k.Buffer(t,e)},alloc:function(t,e,r){if(typeof t!="number")throw new Error("size passed to alloc must be a number.");if(typeof k.Buffer.alloc=="function")return k.Buffer.alloc(t,e,r);var i=new k.Buffer(t);return e!==void 0&&typeof i.fill=="function"&&i.fill(e,void 0,void 0,r),i},toStream:function(e){k.Buffer.isBuffer(e)||(e=k.buffer.toBuffer(e));var r=new k.stream.Readable,i=0;return r._read=function(n){if(i>=e.length)return r.push(null);var s=i+n;s>e.length&&(s=e.length),r.push(e.slice(i,s)),i=s},r},concat:function(t){var e=0,r=0,i=null,n;for(n=0;n>>8^r[(i^s)&255]}return(i^-1)>>>0},hmac:function(e,r,i,n){return i||(i="binary"),i==="buffer"&&(i=void 0),n||(n="sha256"),typeof r=="string"&&(r=k.buffer.toBuffer(r)),k.crypto.lib.createHmac(n,e).update(r).digest(i)},md5:function(e,r,i){return k.crypto.hash("md5",e,r,i)},sha256:function(e,r,i){return k.crypto.hash("sha256",e,r,i)},hash:function(t,e,r,i){var n=k.crypto.createHash(t);r||(r="binary"),r==="buffer"&&(r=void 0),typeof e=="string"&&(e=k.buffer.toBuffer(e));var s=k.arraySliceFn(e),o=k.Buffer.isBuffer(e);if(k.isBrowser()&&typeof ArrayBuffer!="undefined"&&e&&e.buffer instanceof ArrayBuffer&&(o=!0),i&&typeof e=="object"&&typeof e.on=="function"&&!o)e.on("data",function(h){n.update(h)}),e.on("error",function(h){i(h)}),e.on("end",function(){i(null,n.digest(r))});else if(i&&s&&!o&&typeof FileReader!="undefined"){var a=0,u=1024*512,c=new FileReader;c.onerror=function(){i(new Error("Failed to read data."))},c.onload=function(){var h=new k.Buffer(new Uint8Array(c.result));n.update(h),a+=h.length,c._continueReading()},c._continueReading=function(){if(a>=e.size){i(null,n.digest(r));return}var h=a+u;h>e.size&&(h=e.size),c.readAsArrayBuffer(s.call(e,a,h))},c._continueReading()}else{k.isBrowser()&&typeof e=="object"&&!o&&(e=new k.Buffer(new Uint8Array(e)));var l=n.update(e).digest(r);return i&&i(null,l),l}},toHex:function(e){for(var r=[],i=0;i=3e5,!1),Ue.config.isClockSkewed},applyClockOffset:function(e){e&&(Ue.config.systemClockOffset=e-new Date().getTime())},extractRequestId:function(e){var r=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!r&&e.data&&e.data.ResponseMetadata&&(r=e.data.ResponseMetadata.RequestId),r&&(e.requestId=r),e.error&&(e.error.requestId=r)},addPromises:function(e,r){var i=!1;r===void 0&&Ue&&Ue.config&&(r=Ue.config.getPromisesDependency()),r===void 0&&typeof Promise!="undefined"&&(r=Promise),typeof r!="function"&&(i=!0),Array.isArray(e)||(e=[e]);for(var n=0;n=0){o++,setTimeout(u,h+(c.retryAfter||0));return}}i(c)},u=function(){var c="";n.handleRequest(e,s,function(l){l.on("data",function(h){c+=h.toString()}),l.on("end",function(){var h=l.statusCode;if(h<300)i(null,c);else{var g=parseInt(l.headers["retry-after"],10)*1e3||0,b=k.error(new Error,{statusCode:h,retryable:h>=500||h===429});g&&b.retryable&&(b.retryAfter=g),a(b)}})},a)};Ue.util.defer(u)},uuid:{v4:function(){return Xa().v4()}},convertPayloadToString:function(e){var r=e.request,i=r.operation,n=r.service.api.operations[i].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick(e):typeof setImmediate=="function"?setImmediate(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var r=e.service.api.operations;if(!!r){var i=(r||{})[e.operation];if(!(!i||!i.input||!i.input.payload))return i.input.members[i.input.payload]}},getProfilesFromSharedConfig:function(e,r){var i={},n={};if(process.env[k.configOptInEnv])var n=e.loadFrom({isConfig:!0,filename:process.env[k.sharedConfigFileEnv]});var s={};try{var s=e.loadFrom({filename:r||process.env[k.configOptInEnv]&&process.env[k.sharedCredentialsFileEnv]})}catch(c){if(!process.env[k.configOptInEnv])throw c}for(var o=0,a=Object.keys(n);o=6},parse:function(e){var r=e.split(":");return{partition:r[1],service:r[2],region:r[3],accountId:r[4],resource:r.slice(5).join(":")}},build:function(e){if(e.service===void 0||e.region===void 0||e.accountId===void 0||e.resource===void 0)throw k.error(new Error("Input ARN object is invalid"));return"arn:"+(e.partition||"aws")+":"+e.service+":"+e.region+":"+e.accountId+":"+e.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};Wa.exports=k});var Ga=I((hg,Ka)=>{var zh=j().util,Ha=require("stream").Transform,za=zh.buffer.alloc;function mr(t){Ha.call(this,t),this.currentMessageTotalLength=0,this.currentMessagePendingLength=0,this.currentMessage=null,this.messageLengthBuffer=null}mr.prototype=Object.create(Ha.prototype);mr.prototype._transform=function(t,e,r){for(var i=t.length,n=0;n{var $a=j().util,Kh=$a.buffer.toBuffer;function vr(t){if(t.length!==8)throw new Error("Int64 buffers must be exactly 8 bytes");$a.Buffer.isBuffer(t)||(t=Kh(t)),this.bytes=t}vr.fromNumber=function(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(t+" is too large (or, if negative, too small) to represent as an Int64");for(var e=new Uint8Array(8),r=7,i=Math.abs(Math.round(t));r>-1&&i>0;r--,i/=256)e[r]=i;return t<0&&Ya(e),new vr(e)};vr.prototype.valueOf=function(){var t=this.bytes.slice(0),e=t[0]&128;return e&&Ya(t),parseInt(t.toString("hex"),16)*(e?-1:1)};vr.prototype.toString=function(){return String(this.valueOf())};function Ya(t){for(var e=0;e<8;e++)t[e]^=255;for(var e=7;e>-1&&(t[e]++,t[e]===0);e--);}Ja.exports={Int64:vr}});var tu=I((vg,eu)=>{var Ti=j().util,Gh=Ti.buffer.toBuffer,Za=4,bi=Za*2,yr=4,$h=bi+yr*2;function Yh(t){if(Ti.Buffer.isBuffer(t)||(t=Gh(t)),t.length<$h)throw new Error("Provided message too short to accommodate event stream message overhead");if(t.length!==t.readUInt32BE(0))throw new Error("Reported message length does not match received message length");var e=t.readUInt32BE(bi);if(e!==Ti.crypto.crc32(t.slice(0,bi)))throw new Error("The prelude checksum specified in the message ("+e+") does not match the calculated CRC32 checksum.");var r=t.readUInt32BE(t.length-yr);if(r!==Ti.crypto.crc32(t.slice(0,t.length-yr)))throw new Error("The message checksum did not match the expected value of "+r);var i=bi+yr,n=i+t.readUInt32BE(Za);return{headers:t.slice(i,n),body:t.slice(n,t.length-yr)}}eu.exports={splitMessage:Yh}});var su=I((yg,nu)=>{var ru=Qa().Int64,Jh=tu().splitMessage,iu="boolean",Qh="byte",Zh="short",em="integer",tm="long",rm="binary",im="string",nm="timestamp",sm="uuid";function om(t){for(var e={},r=0;r{var um=su().parseMessage;function cm(t,e,r){var i=um(e),n=i.headers[":message-type"];if(n){if(n.value==="error")throw lm(i);if(n.value!=="event")return}var s=i.headers[":event-type"],o=r.members[s.value];if(!!o){var a={},u=o.eventPayloadMemberName;if(u){var c=o.members[u];c.type==="binary"?a[u]=i.body:a[u]=t.parse(i.body.toString(),c)}for(var l=o.eventHeaderMemberNames,h=0;h{var au=require("stream").Transform,fm=On().parseEvent;function Ln(t){t=t||{},t.readableObjectMode=!0,au.call(this,t),this._readableState.objectMode=!0,this.parser=t.parser,this.eventStreamModel=t.eventStreamModel}Ln.prototype=Object.create(au.prototype);Ln.prototype._transform=function(t,e,r){try{var i=fm(this.parser,t,this.eventStreamModel);return this.push(i),r()}catch(n){r(n)}};uu.exports={EventUnmarshallerStream:Ln}});var fu=I((Sg,lu)=>{var pm=Ga().EventMessageChunkerStream,dm=cu().EventUnmarshallerStream;function hm(t,e,r){var i=new dm({parser:e,eventStreamModel:r}),n=new pm;return t.pipe(n).pipe(i),t.on("error",function(s){n.emit("error",s)}),n.on("error",function(s){i.emit("error",s)}),i}lu.exports={createEventStream:hm}});var du=I((_g,pu)=>{function mm(t){for(var e=[],r=0;r{var vm=du().eventMessageChunker,ym=On().parseEvent;function gm(t,e,r){for(var i=vm(t),n=[],s=0;s{vu.exports={now:function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}}});var Eu=I((Tg,gu)=>{var Em=j().util,Sm=require("dgram"),_m=Em.buffer.toBuffer,wm=1024*8;function Lt(t){t=t||{},this.enabled=t.enabled||!1,this.port=t.port||31e3,this.clientId=t.clientId||"",this.address=t.host||"127.0.0.1",this.clientId.length>255&&(this.clientId=this.clientId.substr(0,255)),this.messagesInFlight=0}Lt.prototype.fieldsToTrim={UserAgent:256,SdkException:128,SdkExceptionMessage:512,AwsException:128,AwsExceptionMessage:512,FinalSdkException:128,FinalSdkExceptionMessage:512,FinalAwsException:128,FinalAwsExceptionMessage:512};Lt.prototype.trimFields=function(t){for(var e=Object.keys(this.fieldsToTrim),r=0,i=e.length;rs&&(t[n]=o.substr(0,s))}}return t};Lt.prototype.eventHandler=function(t){t.ClientId=this.clientId,this.trimFields(t);var e=_m(JSON.stringify(t));!this.enabled||e.length>wm||this.publishDatagram(e)};Lt.prototype.publishDatagram=function(t){var e=this,r=this.getClient();this.messagesInFlight++,this.client.send(t,0,t.length,this.port,this.address,function(i,n){--e.messagesInFlight<=0&&e.destroyClient()})};Lt.prototype.getClient=function(){return this.client||(this.client=Sm.createSocket("udp4")),this.client};Lt.prototype.destroyClient=function(){this.client&&(this.client.close(),this.client=void 0)};gu.exports={Publisher:Lt}});var wu=I((bg,_u)=>{var kn=j();function Cm(){var t={port:void 0,clientId:void 0,enabled:void 0,host:void 0};return Tm(t)||bm(t),Su(t)}function Tm(t){return t.port=t.port||process.env.AWS_CSM_PORT,t.enabled=t.enabled||process.env.AWS_CSM_ENABLED,t.clientId=t.clientId||process.env.AWS_CSM_CLIENT_ID,t.host=t.host||process.env.AWS_CSM_HOST,t.port&&t.enabled&&t.clientId&&t.host||["false","0"].indexOf(t.enabled)>=0}function bm(t){var e;try{var r=kn.util.iniLoader.loadFrom({isConfig:!0,filename:process.env[kn.util.sharedConfigFileEnv]}),e=r[process.env.AWS_PROFILE||kn.util.defaultProfile]}catch(i){return!1}return e?(t.port=t.port||e.csm_port,t.enabled=t.enabled||e.csm_enabled,t.clientId=t.clientId||e.csm_client_id,t.host=t.host||e.csm_host,t.port&&t.enabled&&t.clientId&&t.host):t}function Su(t){var e=["false","0",void 0];return!t.enabled||e.indexOf(t.enabled.toLowerCase())>=0?t.enabled=!1:t.enabled=!0,t.port=t.port?parseInt(t.port,10):void 0,t}_u.exports=Cm});var Mn=I((Ag,bu)=>{var Qt=j(),Cu=require("os"),Am=require("path");function Tu(t,e){var r=Qt.util.ini.parse(Qt.util.readFileSync(t)),i={};return Object.keys(r).forEach(function(n){var s=r[n];n=e?n.replace(/^profile\s/,""):n,Object.defineProperty(i,n,{value:s,enumerable:!0})}),i}Qt.IniLoader=Qt.util.inherit({constructor:function(){this.resolvedProfiles={}},clearCachedFiles:function(){this.resolvedProfiles={}},loadFrom:function(e){e=e||{};var r=e.isConfig===!0,i=e.filename||this.getDefaultFilePath(r);if(!this.resolvedProfiles[i]){var n=this.parseFile(i,r);Object.defineProperty(this.resolvedProfiles,i,{value:n})}return this.resolvedProfiles[i]},parseFile:Tu,getDefaultFilePath:function(e){return Am.join(this.getHomeDir(),".aws",e?"config":"credentials")},getHomeDir:function(){var e=process.env,r=e.HOME||e.USERPROFILE||(e.HOMEPATH?(e.HOMEDRIVE||"C:/")+e.HOMEPATH:null);if(r)return r;if(typeof Cu.homedir=="function")return Cu.homedir();throw Qt.util.error(new Error("Cannot load credentials, HOME path not set"))}});var xm=Qt.IniLoader;bu.exports={IniLoader:xm,parseFile:Tu}});var xu=I((xg,Au)=>{var Rm=Mn().IniLoader;Au.exports.iniLoader=new Rm});var Iu=I((Rg,Ru)=>{var gr=j();function Fn(t,e){if(typeof t=="string"){if(["legacy","regional"].indexOf(t.toLowerCase())>=0)return t.toLowerCase();throw gr.util.error(new Error,e)}}function Im(t,e){t=t||{};var r;if(t[e.clientConfig]&&(r=Fn(t[e.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+e.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+t[e.clientConfig]+'".'}),r)||!gr.util.isNode())return r;if(Object.prototype.hasOwnProperty.call(process.env,e.env)){var i=process.env[e.env];if(r=Fn(i,{code:"InvalidEnvironmentalVariable",message:"invalid "+e.env+' environmental variable. Expect "legacy" or "regional". Got "'+process.env[e.env]+'".'}),r)return r}var n={};try{var s=gr.util.getProfilesFromSharedConfig(gr.util.iniLoader);n=s[process.env.AWS_PROFILE||gr.util.defaultProfile]}catch(a){}if(n&&Object.prototype.hasOwnProperty.call(n,e.sharedConfig)){var o=n[e.sharedConfig];if(r=Fn(o,{code:"InvalidConfiguration",message:"invalid "+e.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+n[e.sharedConfig]+'".'}),r)return r}return r}Ru.exports=Im});var Du=I(()=>{var Ai=j(),Dm=Iu(),Nm="AWS_STS_REGIONAL_ENDPOINTS",Pm="sts_regional_endpoints";Ai.util.update(Ai.STS.prototype,{credentialsFrom:function(e,r){return e?(r||(r=new Ai.TemporaryCredentials),r.expired=!1,r.accessKeyId=e.Credentials.AccessKeyId,r.secretAccessKey=e.Credentials.SecretAccessKey,r.sessionToken=e.Credentials.SessionToken,r.expireTime=e.Credentials.Expiration,r):null},assumeRoleWithWebIdentity:function(e,r){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",e,r)},assumeRoleWithSAML:function(e,r){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",e,r)},setupRequestListeners:function(e){e.addListener("validate",this.optInRegionalEndpoint,!0)},optInRegionalEndpoint:function(e){var r=e.service,i=r.config;if(i.stsRegionalEndpoints=Dm(r._originalConfig,{env:Nm,sharedConfig:Pm,clientConfig:"stsRegionalEndpoints"}),i.stsRegionalEndpoints==="regional"&&r.isGlobalEndpoint){if(!i.region)throw Ai.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var n=i.endpoint.indexOf(".amazonaws.com"),s=i.endpoint.substring(0,n)+"."+i.region+i.endpoint.substring(n);e.httpRequest.updateEndpoint(s),e.httpRequest.region=i.region}}})});var Nu=I((Ng,qm)=>{qm.exports={version:"2.0",metadata:{apiVersion:"2011-06-15",endpointPrefix:"sts",globalEndpoint:"sts.amazonaws.com",protocol:"query",serviceAbbreviation:"AWS STS",serviceFullName:"AWS Security Token Service",serviceId:"STS",signatureVersion:"v4",uid:"sts-2011-06-15",xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/"},operations:{AssumeRole:{input:{type:"structure",required:["RoleArn","RoleSessionName"],members:{RoleArn:{},RoleSessionName:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"},Tags:{shape:"S8"},TransitiveTagKeys:{type:"list",member:{}},ExternalId:{},SerialNumber:{},TokenCode:{},SourceIdentity:{}}},output:{resultWrapper:"AssumeRoleResult",type:"structure",members:{Credentials:{shape:"Si"},AssumedRoleUser:{shape:"Sn"},PackedPolicySize:{type:"integer"},SourceIdentity:{}}}},AssumeRoleWithSAML:{input:{type:"structure",required:["RoleArn","PrincipalArn","SAMLAssertion"],members:{RoleArn:{},PrincipalArn:{},SAMLAssertion:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"AssumeRoleWithSAMLResult",type:"structure",members:{Credentials:{shape:"Si"},AssumedRoleUser:{shape:"Sn"},PackedPolicySize:{type:"integer"},Subject:{},SubjectType:{},Issuer:{},Audience:{},NameQualifier:{},SourceIdentity:{}}}},AssumeRoleWithWebIdentity:{input:{type:"structure",required:["RoleArn","RoleSessionName","WebIdentityToken"],members:{RoleArn:{},RoleSessionName:{},WebIdentityToken:{},ProviderId:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"AssumeRoleWithWebIdentityResult",type:"structure",members:{Credentials:{shape:"Si"},SubjectFromWebIdentityToken:{},AssumedRoleUser:{shape:"Sn"},PackedPolicySize:{type:"integer"},Provider:{},Audience:{},SourceIdentity:{}}}},DecodeAuthorizationMessage:{input:{type:"structure",required:["EncodedMessage"],members:{EncodedMessage:{}}},output:{resultWrapper:"DecodeAuthorizationMessageResult",type:"structure",members:{DecodedMessage:{}}}},GetAccessKeyInfo:{input:{type:"structure",required:["AccessKeyId"],members:{AccessKeyId:{}}},output:{resultWrapper:"GetAccessKeyInfoResult",type:"structure",members:{Account:{}}}},GetCallerIdentity:{input:{type:"structure",members:{}},output:{resultWrapper:"GetCallerIdentityResult",type:"structure",members:{UserId:{},Account:{},Arn:{}}}},GetFederationToken:{input:{type:"structure",required:["Name"],members:{Name:{},Policy:{},PolicyArns:{shape:"S4"},DurationSeconds:{type:"integer"},Tags:{shape:"S8"}}},output:{resultWrapper:"GetFederationTokenResult",type:"structure",members:{Credentials:{shape:"Si"},FederatedUser:{type:"structure",required:["FederatedUserId","Arn"],members:{FederatedUserId:{},Arn:{}}},PackedPolicySize:{type:"integer"}}}},GetSessionToken:{input:{type:"structure",members:{DurationSeconds:{type:"integer"},SerialNumber:{},TokenCode:{}}},output:{resultWrapper:"GetSessionTokenResult",type:"structure",members:{Credentials:{shape:"Si"}}}}},shapes:{S4:{type:"list",member:{type:"structure",members:{arn:{}}}},S8:{type:"list",member:{type:"structure",required:["Key","Value"],members:{Key:{},Value:{}}}},Si:{type:"structure",required:["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],members:{AccessKeyId:{},SecretAccessKey:{},SessionToken:{},Expiration:{type:"timestamp"}}},Sn:{type:"structure",required:["AssumedRoleId","Arn"],members:{AssumedRoleId:{},Arn:{}}}}}});var Pu=I((Pg,Om)=>{Om.exports={pagination:{}}});var Ct=I((qg,Ou)=>{Ri();var xi=j(),Lm=xi.Service,qu=xi.apiLoader;qu.services.sts={};xi.STS=Lm.defineService("sts",["2011-06-15"]);Du();Object.defineProperty(qu.services.sts,"2011-06-15",{get:function(){var e=Nu();return e.paginators=Pu().pagination,e},enumerable:!0,configurable:!0});Ou.exports=xi.STS});var Lu=I(()=>{var kt=j(),km=Ct();kt.TemporaryCredentials=kt.util.inherit(kt.Credentials,{constructor:function(e,r){kt.Credentials.call(this),this.loadMasterCredentials(r),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||kt.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.masterCredentials.get(function(){r.service.config.credentials=r.masterCredentials;var i=r.params.RoleArn?r.service.assumeRole:r.service.getSessionToken;i.call(r.service,function(n,s){n||r.service.credentialsFrom(s,r),e(n)})})},loadMasterCredentials:function(e){for(this.masterCredentials=e||kt.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;typeof this.masterCredentials.get!="function"&&(this.masterCredentials=new kt.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new km({params:this.params})}})});var ku=I(()=>{var et=j(),Mm=Ct();et.ChainableTemporaryCredentials=et.util.inherit(et.Credentials,{constructor:function(e){et.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var r=et.util.copy(e.params)||{};if(r.RoleArn&&(r.RoleSessionName=r.RoleSessionName||"temporary-credentials"),r.SerialNumber){if(!e.tokenCodeFn||typeof e.tokenCodeFn!="function")throw new et.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var i=et.util.merge({params:r,credentials:e.masterCredentials||et.config.credentials},e.stsConfig||{});this.service=new Mm(i)},refresh:function(e){this.coalesceRefresh(e||et.util.fn.callback)},load:function(e){var r=this,i=r.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(n,s){var o={};if(n){e(n);return}s&&(o.TokenCode=s),r.service[i](o,function(a,u){a||r.service.credentialsFrom(u,r),e(a)})})},getTokenCode:function(e){var r=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(i,n){if(i){var s=i;i instanceof Error&&(s=i.message),e(et.util.error(new Error("Error fetching MFA token: "+s),{code:r.errorCode}));return}e(null,n)}):e(null)}})});var Mu=I(()=>{var Mt=j(),Fm=Ct();Mt.WebIdentityCredentials=Mt.util.inherit(Mt.Credentials,{constructor:function(e,r){Mt.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=Mt.util.copy(r||{})},refresh:function(e){this.coalesceRefresh(e||Mt.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.service.assumeRoleWithWebIdentity(function(i,n){r.data=null,i||(r.data=n,r.service.credentialsFrom(n,r)),e(i)})},createClients:function(){if(!this.service){var t=Mt.util.merge({},this._clientConfig);t.params=this.params,this.service=new Fm(t)}}})});var Fu=I((Ug,Bm)=>{Bm.exports={version:"2.0",metadata:{apiVersion:"2014-06-30",endpointPrefix:"cognito-identity",jsonVersion:"1.1",protocol:"json",serviceFullName:"Amazon Cognito Identity",serviceId:"Cognito Identity",signatureVersion:"v4",targetPrefix:"AWSCognitoIdentityService",uid:"cognito-identity-2014-06-30"},operations:{CreateIdentityPool:{input:{type:"structure",required:["IdentityPoolName","AllowUnauthenticatedIdentities"],members:{IdentityPoolName:{},AllowUnauthenticatedIdentities:{type:"boolean"},AllowClassicFlow:{type:"boolean"},SupportedLoginProviders:{shape:"S5"},DeveloperProviderName:{},OpenIdConnectProviderARNs:{shape:"S9"},CognitoIdentityProviders:{shape:"Sb"},SamlProviderARNs:{shape:"Sg"},IdentityPoolTags:{shape:"Sh"}}},output:{shape:"Sk"}},DeleteIdentities:{input:{type:"structure",required:["IdentityIdsToDelete"],members:{IdentityIdsToDelete:{type:"list",member:{}}}},output:{type:"structure",members:{UnprocessedIdentityIds:{type:"list",member:{type:"structure",members:{IdentityId:{},ErrorCode:{}}}}}}},DeleteIdentityPool:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}}},DescribeIdentity:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{}}},output:{shape:"Sv"}},DescribeIdentityPool:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}},output:{shape:"Sk"}},GetCredentialsForIdentity:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{},Logins:{shape:"S10"},CustomRoleArn:{}}},output:{type:"structure",members:{IdentityId:{},Credentials:{type:"structure",members:{AccessKeyId:{},SecretKey:{},SessionToken:{},Expiration:{type:"timestamp"}}}}},authtype:"none"},GetId:{input:{type:"structure",required:["IdentityPoolId"],members:{AccountId:{},IdentityPoolId:{},Logins:{shape:"S10"}}},output:{type:"structure",members:{IdentityId:{}}},authtype:"none"},GetIdentityPoolRoles:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}},output:{type:"structure",members:{IdentityPoolId:{},Roles:{shape:"S1c"},RoleMappings:{shape:"S1e"}}}},GetOpenIdToken:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{},Logins:{shape:"S10"}}},output:{type:"structure",members:{IdentityId:{},Token:{}}},authtype:"none"},GetOpenIdTokenForDeveloperIdentity:{input:{type:"structure",required:["IdentityPoolId","Logins"],members:{IdentityPoolId:{},IdentityId:{},Logins:{shape:"S10"},PrincipalTags:{shape:"S1s"},TokenDuration:{type:"long"}}},output:{type:"structure",members:{IdentityId:{},Token:{}}}},GetPrincipalTagAttributeMap:{input:{type:"structure",required:["IdentityPoolId","IdentityProviderName"],members:{IdentityPoolId:{},IdentityProviderName:{}}},output:{type:"structure",members:{IdentityPoolId:{},IdentityProviderName:{},UseDefaults:{type:"boolean"},PrincipalTags:{shape:"S1s"}}}},ListIdentities:{input:{type:"structure",required:["IdentityPoolId","MaxResults"],members:{IdentityPoolId:{},MaxResults:{type:"integer"},NextToken:{},HideDisabled:{type:"boolean"}}},output:{type:"structure",members:{IdentityPoolId:{},Identities:{type:"list",member:{shape:"Sv"}},NextToken:{}}}},ListIdentityPools:{input:{type:"structure",required:["MaxResults"],members:{MaxResults:{type:"integer"},NextToken:{}}},output:{type:"structure",members:{IdentityPools:{type:"list",member:{type:"structure",members:{IdentityPoolId:{},IdentityPoolName:{}}}},NextToken:{}}}},ListTagsForResource:{input:{type:"structure",required:["ResourceArn"],members:{ResourceArn:{}}},output:{type:"structure",members:{Tags:{shape:"Sh"}}}},LookupDeveloperIdentity:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{},IdentityId:{},DeveloperUserIdentifier:{},MaxResults:{type:"integer"},NextToken:{}}},output:{type:"structure",members:{IdentityId:{},DeveloperUserIdentifierList:{type:"list",member:{}},NextToken:{}}}},MergeDeveloperIdentities:{input:{type:"structure",required:["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],members:{SourceUserIdentifier:{},DestinationUserIdentifier:{},DeveloperProviderName:{},IdentityPoolId:{}}},output:{type:"structure",members:{IdentityId:{}}}},SetIdentityPoolRoles:{input:{type:"structure",required:["IdentityPoolId","Roles"],members:{IdentityPoolId:{},Roles:{shape:"S1c"},RoleMappings:{shape:"S1e"}}}},SetPrincipalTagAttributeMap:{input:{type:"structure",required:["IdentityPoolId","IdentityProviderName"],members:{IdentityPoolId:{},IdentityProviderName:{},UseDefaults:{type:"boolean"},PrincipalTags:{shape:"S1s"}}},output:{type:"structure",members:{IdentityPoolId:{},IdentityProviderName:{},UseDefaults:{type:"boolean"},PrincipalTags:{shape:"S1s"}}}},TagResource:{input:{type:"structure",required:["ResourceArn","Tags"],members:{ResourceArn:{},Tags:{shape:"Sh"}}},output:{type:"structure",members:{}}},UnlinkDeveloperIdentity:{input:{type:"structure",required:["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],members:{IdentityId:{},IdentityPoolId:{},DeveloperProviderName:{},DeveloperUserIdentifier:{}}}},UnlinkIdentity:{input:{type:"structure",required:["IdentityId","Logins","LoginsToRemove"],members:{IdentityId:{},Logins:{shape:"S10"},LoginsToRemove:{shape:"Sw"}}},authtype:"none"},UntagResource:{input:{type:"structure",required:["ResourceArn","TagKeys"],members:{ResourceArn:{},TagKeys:{type:"list",member:{}}}},output:{type:"structure",members:{}}},UpdateIdentityPool:{input:{shape:"Sk"},output:{shape:"Sk"}}},shapes:{S5:{type:"map",key:{},value:{}},S9:{type:"list",member:{}},Sb:{type:"list",member:{type:"structure",members:{ProviderName:{},ClientId:{},ServerSideTokenCheck:{type:"boolean"}}}},Sg:{type:"list",member:{}},Sh:{type:"map",key:{},value:{}},Sk:{type:"structure",required:["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],members:{IdentityPoolId:{},IdentityPoolName:{},AllowUnauthenticatedIdentities:{type:"boolean"},AllowClassicFlow:{type:"boolean"},SupportedLoginProviders:{shape:"S5"},DeveloperProviderName:{},OpenIdConnectProviderARNs:{shape:"S9"},CognitoIdentityProviders:{shape:"Sb"},SamlProviderARNs:{shape:"Sg"},IdentityPoolTags:{shape:"Sh"}}},Sv:{type:"structure",members:{IdentityId:{},Logins:{shape:"Sw"},CreationDate:{type:"timestamp"},LastModifiedDate:{type:"timestamp"}}},Sw:{type:"list",member:{}},S10:{type:"map",key:{},value:{}},S1c:{type:"map",key:{},value:{}},S1e:{type:"map",key:{},value:{type:"structure",required:["Type"],members:{Type:{},AmbiguousRoleResolution:{},RulesConfiguration:{type:"structure",required:["Rules"],members:{Rules:{type:"list",member:{type:"structure",required:["Claim","MatchType","Value","RoleARN"],members:{Claim:{},MatchType:{},Value:{},RoleARN:{}}}}}}}}},S1s:{type:"map",key:{},value:{}}}}});var Bu=I((jg,Um)=>{Um.exports={pagination:{ListIdentityPools:{input_token:"NextToken",limit_key:"MaxResults",output_token:"NextToken",result_key:"IdentityPools"}}}});var Vu=I((Vg,ju)=>{Ri();var Ii=j(),jm=Ii.Service,Uu=Ii.apiLoader;Uu.services.cognitoidentity={};Ii.CognitoIdentity=jm.defineService("cognitoidentity",["2014-06-30"]);Object.defineProperty(Uu.services.cognitoidentity,"2014-06-30",{get:function(){var e=Fu();return e.paginators=Bu().pagination,e},enumerable:!0,configurable:!0});ju.exports=Ii.CognitoIdentity});var Xu=I(()=>{var Ke=j(),Vm=Vu(),Xm=Ct();Ke.CognitoIdentityCredentials=Ke.util.inherit(Ke.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,r){Ke.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=Ke.util.copy(r||{}),this.loadCachedId();var i=this;Object.defineProperty(this,"identityId",{get:function(){return i.loadCachedId(),i._identityId||i.params.IdentityId},set:function(n){i._identityId=n}})},refresh:function(e){this.coalesceRefresh(e||Ke.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.data=null,r._identityId=null,r.getId(function(i){i?(r.clearIdOnNotAuthorized(i),e(i)):r.params.RoleArn?r.getCredentialsFromSTS(e):r.getCredentialsForIdentity(e)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,r=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+r],delete this.storage[this.localStorageKey.providers+e+r]},clearIdOnNotAuthorized:function(e){var r=this;e.code=="NotAuthorizedException"&&r.clearCachedId()},getId:function(e){var r=this;if(typeof r.params.IdentityId=="string")return e(null,r.params.IdentityId);r.cognito.getId(function(i,n){!i&&n.IdentityId?(r.params.IdentityId=n.IdentityId,e(null,n.IdentityId)):e(i)})},loadCredentials:function(e,r){!e||!r||(r.expired=!1,r.accessKeyId=e.Credentials.AccessKeyId,r.secretAccessKey=e.Credentials.SecretKey,r.sessionToken=e.Credentials.SessionToken,r.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(e){var r=this;r.cognito.getCredentialsForIdentity(function(i,n){i?r.clearIdOnNotAuthorized(i):(r.cacheId(n),r.data=n,r.loadCredentials(r.data,r)),e(i)})},getCredentialsFromSTS:function(e){var r=this;r.cognito.getOpenIdToken(function(i,n){i?(r.clearIdOnNotAuthorized(i),e(i)):(r.cacheId(n),r.params.WebIdentityToken=n.Token,r.webIdentityCredentials.refresh(function(s){s||(r.data=r.webIdentityCredentials.data,r.sts.credentialsFrom(r.data,r)),e(s)}))})},loadCachedId:function(){var e=this;if(Ke.util.isBrowser()&&!e.params.IdentityId){var r=e.getStorage("id");if(r&&e.params.Logins){var i=Object.keys(e.params.Logins),n=(e.getStorage("providers")||"").split(","),s=n.filter(function(o){return i.indexOf(o)!==-1});s.length!==0&&(e.params.IdentityId=r)}else r&&(e.params.IdentityId=r)}},createClients:function(){var t=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new Ke.WebIdentityCredentials(this.params,t),!this.cognito){var e=Ke.util.merge({},t);e.params=this.params,this.cognito=new Vm(e)}this.sts=this.sts||new Xm(t)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,Ke.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,r){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=r}catch(i){}},storage:function(){try{var t=Ke.util.isBrowser()&&window.localStorage!==null&&typeof window.localStorage=="object"?window.localStorage:{};return t["aws.test-storage"]="foobar",delete t["aws.test-storage"],t}catch(e){return{}}}()})});var Wu=I(()=>{var Er=j(),Wm=Ct();Er.SAMLCredentials=Er.util.inherit(Er.Credentials,{constructor:function(e){Er.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||Er.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.service.assumeRoleWithSAML(function(i,n){i||r.service.credentialsFrom(n,r),e(i)})},createClients:function(){this.service=this.service||new Wm({params:this.params})}})});var Bn=I(()=>{var De=j(),Hm=require("child_process"),Hu=De.util.iniLoader;De.ProcessCredentials=De.util.inherit(De.Credentials,{constructor:function(e){De.Credentials.call(this),e=e||{},this.filename=e.filename,this.profile=e.profile||process.env.AWS_PROFILE||De.util.defaultProfile,this.get(e.callback||De.util.fn.noop)},load:function(e){var r=this;try{var i=De.util.getProfilesFromSharedConfig(Hu,this.filename),n=i[this.profile]||{};if(Object.keys(n).length===0)throw De.util.error(new Error("Profile "+this.profile+" not found"),{code:"ProcessCredentialsProviderFailure"});if(n.credential_process)this.loadViaCredentialProcess(n,function(s,o){s?e(s,null):(r.expired=!1,r.accessKeyId=o.AccessKeyId,r.secretAccessKey=o.SecretAccessKey,r.sessionToken=o.SessionToken,o.Expiration&&(r.expireTime=new Date(o.Expiration)),e(null))});else throw De.util.error(new Error("Profile "+this.profile+" did not include credential process"),{code:"ProcessCredentialsProviderFailure"})}catch(s){e(s)}},loadViaCredentialProcess:function(e,r){Hm.exec(e.credential_process,{env:process.env},function(i,n,s){if(i)r(De.util.error(new Error("credential_process returned error"),{code:"ProcessCredentialsProviderFailure"}),null);else try{var o=JSON.parse(n);if(o.Expiration){var a=De.util.date.getDate(),u=new Date(o.Expiration);if(u{(function(){Un.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:` -`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(Un)});var vt=I((zu,Ft)=>{(function(){var t,e,r,i,n,s,o=[].slice,a={}.hasOwnProperty;t=function(){var u,c,l,h,g,b;if(b=arguments[0],g=2<=arguments.length?o.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(u=0,l=g.length;u{(function(){var t;Gu.exports=t=function(){function e(r,i,n){if(this.options=r.options,this.stringify=r.stringify,i==null)throw new Error("Missing attribute name of element "+r.name);if(n==null)throw new Error("Missing attribute value for attribute "+i+" of element "+r.name);this.name=this.stringify.attName(i),this.value=this.stringify.attValue(n)}return e.prototype.clone=function(){return Object.create(this)},e.prototype.toString=function(r){return this.options.writer.set(r).attribute(this)},e}()}).call(Ku)});var Sr=I(($u,Yu)=>{(function(){var t,e,r,i,n,s,o=function(u,c){for(var l in c)a.call(c,l)&&(u[l]=c[l]);function h(){this.constructor=u}return h.prototype=c.prototype,u.prototype=new h,u.__super__=c.prototype,u},a={}.hasOwnProperty;s=vt(),n=s.isObject,i=s.isFunction,r=Ne(),t=jn(),Yu.exports=e=function(u){o(c,u);function c(l,h,g){if(c.__super__.constructor.call(this,l),h==null)throw new Error("Missing element name");this.name=this.stringify.eleName(h),this.attributes={},g!=null&&this.attribute(g),l.isDocument&&(this.isRoot=!0,this.documentObject=l,l.rootObject=this)}return c.prototype.clone=function(){var l,h,g,b;g=Object.create(this),g.isRoot&&(g.documentObject=null),g.attributes={},b=this.attributes;for(h in b)!a.call(b,h)||(l=b[h],g.attributes[h]=l.clone());return g.children=[],this.children.forEach(function(y){var E;return E=y.clone(),E.parent=g,g.children.push(E)}),g},c.prototype.attribute=function(l,h){var g,b;if(l!=null&&(l=l.valueOf()),n(l))for(g in l)!a.call(l,g)||(b=l[g],this.attribute(g,b));else i(h)&&(h=h.apply()),(!this.options.skipNullAttributes||h!=null)&&(this.attributes[l]=new t(this,l,h));return this},c.prototype.removeAttribute=function(l){var h,g,b;if(l==null)throw new Error("Missing attribute name");if(l=l.valueOf(),Array.isArray(l))for(g=0,b=l.length;g{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=Ne(),Qu.exports=t=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).cdata(this)},s}(e)}).call(Ju)});var wr=I((Zu,ec)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=Ne(),ec.exports=t=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing comment text");this.text=this.stringify.comment(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).comment(this)},s}(e)}).call(Zu)});var Cr=I((tc,rc)=>{(function(){var t,e,r,i=function(s,o){for(var a in o)n.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},n={}.hasOwnProperty;r=vt().isObject,e=Ne(),rc.exports=t=function(s){i(o,s);function o(a,u,c,l){var h;o.__super__.constructor.call(this,a),r(u)&&(h=u,u=h.version,c=h.encoding,l=h.standalone),u||(u="1.0"),this.version=this.stringify.xmlVersion(u),c!=null&&(this.encoding=this.stringify.xmlEncoding(c)),l!=null&&(this.standalone=this.stringify.xmlStandalone(l))}return o.prototype.toString=function(a){return this.options.writer.set(a).declaration(this)},o}(e)}).call(tc)});var Tr=I((ic,nc)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=Ne(),nc.exports=t=function(n){r(s,n);function s(o,a,u,c,l,h){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing DTD element name");if(u==null)throw new Error("Missing DTD attribute name");if(!c)throw new Error("Missing DTD attribute type");if(!l)throw new Error("Missing DTD attribute default");if(l.indexOf("#")!==0&&(l="#"+l),!l.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(h&&!l.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(a),this.attributeName=this.stringify.attName(u),this.attributeType=this.stringify.dtdAttType(c),this.defaultValue=this.stringify.dtdAttDefault(h),this.defaultValueType=l}return s.prototype.toString=function(o){return this.options.writer.set(o).dtdAttList(this)},s}(e)}).call(ic)});var br=I((sc,oc)=>{(function(){var t,e,r,i=function(s,o){for(var a in o)n.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},n={}.hasOwnProperty;r=vt().isObject,e=Ne(),oc.exports=t=function(s){i(o,s);function o(a,u,c,l){if(o.__super__.constructor.call(this,a),c==null)throw new Error("Missing entity name");if(l==null)throw new Error("Missing entity value");if(this.pe=!!u,this.name=this.stringify.eleName(c),!r(l))this.value=this.stringify.dtdEntityValue(l);else{if(!l.pubID&&!l.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(l.pubID&&!l.sysID)throw new Error("System identifier is required for a public external entity");if(l.pubID!=null&&(this.pubID=this.stringify.dtdPubID(l.pubID)),l.sysID!=null&&(this.sysID=this.stringify.dtdSysID(l.sysID)),l.nData!=null&&(this.nData=this.stringify.dtdNData(l.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}}return o.prototype.toString=function(a){return this.options.writer.set(a).dtdEntity(this)},o}(e)}).call(sc)});var Ar=I((ac,uc)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=Ne(),uc.exports=t=function(n){r(s,n);function s(o,a,u){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing DTD element name");u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.eleName(a),this.value=this.stringify.dtdElementValue(u)}return s.prototype.toString=function(o){return this.options.writer.set(o).dtdElement(this)},s}(e)}).call(ac)});var xr=I((cc,lc)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=Ne(),lc.exports=t=function(n){r(s,n);function s(o,a,u){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing notation name");if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(a),u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return s.prototype.toString=function(o){return this.options.writer.set(o).dtdNotation(this)},s}(e)}).call(cc)});var Rr=I((fc,pc)=>{(function(){var t,e,r,i,n,s,o,a=function(c,l){for(var h in l)u.call(l,h)&&(c[h]=l[h]);function g(){this.constructor=c}return g.prototype=l.prototype,c.prototype=new g,c.__super__=l.prototype,c},u={}.hasOwnProperty;o=vt().isObject,s=Ne(),t=Tr(),r=br(),e=Ar(),i=xr(),pc.exports=n=function(c){a(l,c);function l(h,g,b){var y,E;l.__super__.constructor.call(this,h),this.documentObject=h,o(g)&&(y=g,g=y.pubID,b=y.sysID),b==null&&(E=[g,b],b=E[0],g=E[1]),g!=null&&(this.pubID=this.stringify.dtdPubID(g)),b!=null&&(this.sysID=this.stringify.dtdSysID(b))}return l.prototype.element=function(h,g){var b;return b=new e(this,h,g),this.children.push(b),this},l.prototype.attList=function(h,g,b,y,E){var D;return D=new t(this,h,g,b,y,E),this.children.push(D),this},l.prototype.entity=function(h,g){var b;return b=new r(this,!1,h,g),this.children.push(b),this},l.prototype.pEntity=function(h,g){var b;return b=new r(this,!0,h,g),this.children.push(b),this},l.prototype.notation=function(h,g){var b;return b=new i(this,h,g),this.children.push(b),this},l.prototype.toString=function(h){return this.options.writer.set(h).docType(this)},l.prototype.ele=function(h,g){return this.element(h,g)},l.prototype.att=function(h,g,b,y,E){return this.attList(h,g,b,y,E)},l.prototype.ent=function(h,g){return this.entity(h,g)},l.prototype.pent=function(h,g){return this.pEntity(h,g)},l.prototype.not=function(h,g){return this.notation(h,g)},l.prototype.up=function(){return this.root()||this.documentObject},l}(s)}).call(fc)});var Ir=I((dc,hc)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;t=Ne(),hc.exports=e=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing raw text");this.value=this.stringify.raw(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).raw(this)},s}(t)}).call(dc)});var Dr=I((mc,vc)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;t=Ne(),vc.exports=e=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing element text");this.value=this.stringify.eleText(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).text(this)},s}(t)}).call(mc)});var Nr=I((yc,gc)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;t=Ne(),gc.exports=e=function(n){r(s,n);function s(o,a,u){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing instruction target");this.target=this.stringify.insTarget(a),u&&(this.value=this.stringify.insValue(u))}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).processingInstruction(this)},s}(t)}).call(yc)});var Ne=I((Ec,Sc)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,h,g,b={}.hasOwnProperty;g=vt(),h=g.isObject,l=g.isFunction,c=g.isEmpty,n=null,t=null,e=null,r=null,i=null,a=null,u=null,o=null,Sc.exports=s=function(){function y(E){this.parent=E,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.children=[],n||(n=Sr(),t=_r(),e=wr(),r=Cr(),i=Rr(),a=Ir(),u=Dr(),o=Nr())}return y.prototype.element=function(E,D,S){var d,_,R,N,C,T,L,X,M,W;if(T=null,D==null&&(D={}),D=D.valueOf(),h(D)||(M=[D,S],S=M[0],D=M[1]),E!=null&&(E=E.valueOf()),Array.isArray(E))for(R=0,L=E.length;R{(function(){var t,e=function(i,n){return function(){return i.apply(n,arguments)}},r={}.hasOwnProperty;wc.exports=t=function(){function i(n){this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;n||(n={}),this.noDoubleEncoding=n.noDoubleEncoding,o=n.stringify||{};for(s in o)!r.call(o,s)||(a=o[s],this[s]=a)}return i.prototype.eleName=function(n){return n=""+n||"",this.assertLegalChar(n)},i.prototype.eleText=function(n){return n=""+n||"",this.assertLegalChar(this.elEscape(n))},i.prototype.cdata=function(n){return n=""+n||"",n=n.replace("]]>","]]]]>"),this.assertLegalChar(n)},i.prototype.comment=function(n){if(n=""+n||"",n.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+n);return this.assertLegalChar(n)},i.prototype.raw=function(n){return""+n||""},i.prototype.attName=function(n){return n=""+n||""},i.prototype.attValue=function(n){return n=""+n||"",this.attEscape(n)},i.prototype.insTarget=function(n){return""+n||""},i.prototype.insValue=function(n){if(n=""+n||"",n.match(/\?>/))throw new Error("Invalid processing instruction value: "+n);return n},i.prototype.xmlVersion=function(n){if(n=""+n||"",!n.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+n);return n},i.prototype.xmlEncoding=function(n){if(n=""+n||"",!n.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+n);return n},i.prototype.xmlStandalone=function(n){return n?"yes":"no"},i.prototype.dtdPubID=function(n){return""+n||""},i.prototype.dtdSysID=function(n){return""+n||""},i.prototype.dtdElementValue=function(n){return""+n||""},i.prototype.dtdAttType=function(n){return""+n||""},i.prototype.dtdAttDefault=function(n){return n!=null?""+n||"":n},i.prototype.dtdEntityValue=function(n){return""+n||""},i.prototype.dtdNData=function(n){return""+n||""},i.prototype.convertAttKey="@",i.prototype.convertPIKey="?",i.prototype.convertTextKey="#text",i.prototype.convertCDataKey="#cdata",i.prototype.convertCommentKey="#comment",i.prototype.convertRawKey="#raw",i.prototype.assertLegalChar=function(n){var s;if(s=n.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),s)throw new Error("Invalid character in string: "+n+" at index "+s.index);return n},i.prototype.elEscape=function(n){var s;return s=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&").replace(//g,">").replace(/\r/g," ")},i.prototype.attEscape=function(n){var s;return s=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&").replace(/{(function(){var t,e={}.hasOwnProperty;Tc.exports=t=function(){function r(i){var n,s,o,a,u,c,l,h,g;i||(i={}),this.pretty=i.pretty||!1,this.allowEmpty=(s=i.allowEmpty)!=null?s:!1,this.pretty?(this.indent=(o=i.indent)!=null?o:" ",this.newline=(a=i.newline)!=null?a:` -`,this.offset=(u=i.offset)!=null?u:0,this.dontprettytextnodes=(c=i.dontprettytextnodes)!=null?c:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash=(l=i.spacebeforeslash)!=null?l:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,h=i.writer||{};for(n in h)!e.call(h,n)||(g=h[n],this[n]=g)}return r.prototype.set=function(i){var n,s,o;i||(i={}),"pretty"in i&&(this.pretty=i.pretty),"allowEmpty"in i&&(this.allowEmpty=i.allowEmpty),this.pretty?(this.indent="indent"in i?i.indent:" ",this.newline="newline"in i?i.newline:` -`,this.offset="offset"in i?i.offset:0,this.dontprettytextnodes="dontprettytextnodes"in i?i.dontprettytextnodes:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash="spacebeforeslash"in i?i.spacebeforeslash:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,s=i.writer||{};for(n in s)!e.call(s,n)||(o=s[n],this[n]=o);return this},r.prototype.space=function(i){var n;return this.pretty?(n=(i||0)+this.offset+1,n>0?new Array(n).join(this.indent):""):""},r}()}).call(Cc)});var Ni=I((bc,Ac)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,h,g,b,y=function(D,S){for(var d in S)E.call(S,d)&&(D[d]=S[d]);function _(){this.constructor=D}return _.prototype=S.prototype,D.prototype=new _,D.__super__=S.prototype,D},E={}.hasOwnProperty;o=Cr(),a=Rr(),t=_r(),e=wr(),u=Sr(),l=Ir(),g=Dr(),c=Nr(),r=Tr(),i=Ar(),n=br(),s=xr(),b=Xn(),Ac.exports=h=function(D){y(S,D);function S(d){S.__super__.constructor.call(this,d)}return S.prototype.document=function(d){var _,R,N,C,T;for(this.textispresent=!1,C="",T=d.children,R=0,N=T.length;R"+this.newline},S.prototype.comment=function(d,_){return this.space(_)+""+this.newline},S.prototype.declaration=function(d,_){var R;return R=this.space(_),R+='",R+=this.newline,R},S.prototype.docType=function(d,_){var R,N,C,T,L;if(_||(_=0),T=this.space(_),T+="0){for(T+=" [",T+=this.newline,L=d.children,N=0,C=L.length;N",T+=this.newline,T},S.prototype.element=function(d,_){var R,N,C,T,L,X,M,W,A,ve,fe,Q,Pe;_||(_=0),Pe=!1,this.textispresent?(this.newline="",this.pretty=!1):(this.newline=this.newlinedefault,this.pretty=this.prettydefault),Q=this.space(_),W="",W+=Q+"<"+d.name,A=d.attributes;for(M in A)!E.call(A,M)||(R=A[M],W+=this.attribute(R));if(d.children.length===0||d.children.every(function(it){return it.value===""}))this.allowEmpty?W+=">"+this.newline:W+=this.spacebeforeslash+"/>"+this.newline;else if(this.pretty&&d.children.length===1&&d.children[0].value!=null)W+=">",W+=d.children[0].value,W+=""+this.newline;else{if(this.dontprettytextnodes){for(ve=d.children,C=0,L=ve.length;C"+this.newline,fe=d.children,T=0,X=fe.length;T"+this.newline}return W},S.prototype.processingInstruction=function(d,_){var R;return R=this.space(_)+""+this.newline,R},S.prototype.raw=function(d,_){return this.space(_)+d.value+this.newline},S.prototype.text=function(d,_){return this.space(_)+d.value+this.newline},S.prototype.dtdAttList=function(d,_){var R;return R=this.space(_)+""+this.newline,R},S.prototype.dtdElement=function(d,_){return this.space(_)+""+this.newline},S.prototype.dtdEntity=function(d,_){var R;return R=this.space(_)+""+this.newline,R},S.prototype.dtdNotation=function(d,_){var R;return R=this.space(_)+""+this.newline,R},S.prototype.openNode=function(d,_){var R,N,C,T;if(_||(_=0),d instanceof u){C=this.space(_)+"<"+d.name,T=d.attributes;for(N in T)!E.call(T,N)||(R=T[N],C+=this.attribute(R));return C+=(d.children?">":"/>")+this.newline,C}else return C=this.space(_)+"")+this.newline,C},S.prototype.closeNode=function(d,_){switch(_||(_=0),!1){case!(d instanceof u):return this.space(_)+""+this.newline;case!(d instanceof a):return this.space(_)+"]>"+this.newline}},S}(b)}).call(bc)});var Ic=I((xc,Rc)=>{(function(){var t,e,r,i,n,s=function(a,u){for(var c in u)o.call(u,c)&&(a[c]=u[c]);function l(){this.constructor=a}return l.prototype=u.prototype,a.prototype=new l,a.__super__=u.prototype,a},o={}.hasOwnProperty;n=vt().isPlainObject,e=Ne(),i=Vn(),r=Ni(),Rc.exports=t=function(a){s(u,a);function u(c){u.__super__.constructor.call(this,null),c||(c={}),c.writer||(c.writer=new r),this.options=c,this.stringify=new i(c),this.isDocument=!0}return u.prototype.end=function(c){var l;return c?n(c)&&(l=c,c=this.options.writer.set(l)):c=this.options.writer,c.document(this)},u.prototype.toString=function(c){return this.options.writer.set(c).document(this)},u}(e)}).call(xc)});var Pc=I((Dc,Nc)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,h,g,b,y,E,D,S,d,_,R={}.hasOwnProperty;_=vt(),S=_.isObject,D=_.isFunction,d=_.isPlainObject,l=Sr(),e=_r(),r=wr(),g=Ir(),E=Dr(),h=Nr(),a=Cr(),u=Rr(),i=Tr(),s=br(),n=Ar(),o=xr(),t=jn(),y=Vn(),b=Ni(),Nc.exports=c=function(){function N(C,T,L){var X;C||(C={}),C.writer?d(C.writer)&&(X=C.writer,C.writer=new b(X)):C.writer=new b(C),this.options=C,this.writer=C.writer,this.stringify=new y(C),this.onDataCallback=T||function(){},this.onEndCallback=L||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return N.prototype.node=function(C,T,L){var X;if(C==null)throw new Error("Missing node name");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node");return this.openCurrent(),C=C.valueOf(),T==null&&(T={}),T=T.valueOf(),S(T)||(X=[T,L],L=X[0],T=X[1]),this.currentNode=new l(this,C,T),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,L!=null&&this.text(L),this},N.prototype.element=function(C,T,L){return this.currentNode&&this.currentNode instanceof u?this.dtdElement.apply(this,arguments):this.node(C,T,L)},N.prototype.attribute=function(C,T){var L,X;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode");if(C!=null&&(C=C.valueOf()),S(C))for(L in C)!R.call(C,L)||(X=C[L],this.attribute(L,X));else D(T)&&(T=T.apply()),(!this.options.skipNullAttributes||T!=null)&&(this.currentNode.attributes[C]=new t(this,C,T));return this},N.prototype.text=function(C){var T;return this.openCurrent(),T=new E(this,C),this.onData(this.writer.text(T,this.currentLevel+1)),this},N.prototype.cdata=function(C){var T;return this.openCurrent(),T=new e(this,C),this.onData(this.writer.cdata(T,this.currentLevel+1)),this},N.prototype.comment=function(C){var T;return this.openCurrent(),T=new r(this,C),this.onData(this.writer.comment(T,this.currentLevel+1)),this},N.prototype.raw=function(C){var T;return this.openCurrent(),T=new g(this,C),this.onData(this.writer.raw(T,this.currentLevel+1)),this},N.prototype.instruction=function(C,T){var L,X,M,W,A;if(this.openCurrent(),C!=null&&(C=C.valueOf()),T!=null&&(T=T.valueOf()),Array.isArray(C))for(L=0,W=C.length;L=0;)this.up();return this.onEnd()},N.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},N.prototype.openNode=function(C){if(!C.isOpen)return!this.root&&this.currentLevel===0&&C instanceof l&&(this.root=C),this.onData(this.writer.openNode(C,this.currentLevel)),C.isOpen=!0},N.prototype.closeNode=function(C){if(!C.isClosed)return this.onData(this.writer.closeNode(C,this.currentLevel)),C.isClosed=!0},N.prototype.onData=function(C){return this.documentStarted=!0,this.onDataCallback(C)},N.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},N.prototype.ele=function(){return this.element.apply(this,arguments)},N.prototype.nod=function(C,T,L){return this.node(C,T,L)},N.prototype.txt=function(C){return this.text(C)},N.prototype.dat=function(C){return this.cdata(C)},N.prototype.com=function(C){return this.comment(C)},N.prototype.ins=function(C,T){return this.instruction(C,T)},N.prototype.dec=function(C,T,L){return this.declaration(C,T,L)},N.prototype.dtd=function(C,T,L){return this.doctype(C,T,L)},N.prototype.e=function(C,T,L){return this.element(C,T,L)},N.prototype.n=function(C,T,L){return this.node(C,T,L)},N.prototype.t=function(C){return this.text(C)},N.prototype.d=function(C){return this.cdata(C)},N.prototype.c=function(C){return this.comment(C)},N.prototype.r=function(C){return this.raw(C)},N.prototype.i=function(C,T){return this.instruction(C,T)},N.prototype.att=function(){return this.currentNode&&this.currentNode instanceof u?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},N.prototype.a=function(){return this.currentNode&&this.currentNode instanceof u?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},N.prototype.ent=function(C,T){return this.entity(C,T)},N.prototype.pent=function(C,T){return this.pEntity(C,T)},N.prototype.not=function(C,T){return this.notation(C,T)},N}()}).call(Dc)});var Lc=I((qc,Oc)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,h,g,b,y=function(D,S){for(var d in S)E.call(S,d)&&(D[d]=S[d]);function _(){this.constructor=D}return _.prototype=S.prototype,D.prototype=new _,D.__super__=S.prototype,D},E={}.hasOwnProperty;o=Cr(),a=Rr(),t=_r(),e=wr(),u=Sr(),l=Ir(),g=Dr(),c=Nr(),r=Tr(),i=Ar(),n=br(),s=xr(),b=Xn(),Oc.exports=h=function(D){y(S,D);function S(d,_){S.__super__.constructor.call(this,_),this.stream=d}return S.prototype.document=function(d){var _,R,N,C,T,L,X,M;for(L=d.children,R=0,C=L.length;R"+this.endline(d))},S.prototype.comment=function(d,_){return this.stream.write(this.space(_)+""+this.endline(d))},S.prototype.declaration=function(d,_){return this.stream.write(this.space(_)),this.stream.write('"),this.stream.write(this.endline(d))},S.prototype.docType=function(d,_){var R,N,C,T;if(_||(_=0),this.stream.write(this.space(_)),this.stream.write("0){for(this.stream.write(" ["),this.stream.write(this.endline(d)),T=d.children,N=0,C=T.length;N"),this.stream.write(this.endline(d))},S.prototype.element=function(d,_){var R,N,C,T,L,X,M,W;_||(_=0),W=this.space(_),this.stream.write(W+"<"+d.name),X=d.attributes;for(L in X)!E.call(X,L)||(R=X[L],this.attribute(R));if(d.children.length===0||d.children.every(function(A){return A.value===""}))this.allowEmpty?this.stream.write(">"):this.stream.write(this.spacebeforeslash+"/>");else if(this.pretty&&d.children.length===1&&d.children[0].value!=null)this.stream.write(">"),this.stream.write(d.children[0].value),this.stream.write("");else{for(this.stream.write(">"+this.newline),M=d.children,C=0,T=M.length;C")}return this.stream.write(this.endline(d))},S.prototype.processingInstruction=function(d,_){return this.stream.write(this.space(_)+""+this.endline(d))},S.prototype.raw=function(d,_){return this.stream.write(this.space(_)+d.value+this.endline(d))},S.prototype.text=function(d,_){return this.stream.write(this.space(_)+d.value+this.endline(d))},S.prototype.dtdAttList=function(d,_){return this.stream.write(this.space(_)+""+this.endline(d))},S.prototype.dtdElement=function(d,_){return this.stream.write(this.space(_)+""+this.endline(d))},S.prototype.dtdEntity=function(d,_){return this.stream.write(this.space(_)+""+this.endline(d))},S.prototype.dtdNotation=function(d,_){return this.stream.write(this.space(_)+""+this.endline(d))},S.prototype.endline=function(d){return d.isLastRootNode?"":this.newline},S}(b)}).call(qc)});var Mc=I((kc,Pr)=>{(function(){var t,e,r,i,n,s,o;o=vt(),n=o.assign,s=o.isFunction,t=Ic(),e=Pc(),i=Ni(),r=Lc(),Pr.exports.create=function(a,u,c,l){var h,g;if(a==null)throw new Error("Root element needs a name");return l=n({},u,c,l),h=new t(l),g=h.element(a),l.headless||(h.declaration(l),(l.pubID!=null||l.sysID!=null)&&h.doctype(l)),g},Pr.exports.begin=function(a,u,c){var l;return s(a)&&(l=[a,u],u=l[0],c=l[1],a={}),u?new e(a,u,c):new t(a)},Pr.exports.stringWriter=function(a){return new i(a)},Pr.exports.streamWriter=function(a,u){return new r(a,u)}}).call(kc)});var Fc=I(Wn=>{(function(){"use strict";var t,e,r,i,n,s={}.hasOwnProperty;t=Mc(),e=Di().defaults,i=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},n=function(o){return""},r=function(o){return o.replace("]]>","]]]]>")},Wn.Builder=function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)!s.call(c,u)||(l=c[u],this.options[u]=l);for(u in a)!s.call(a,u)||(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,g;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(g=Object.keys(a)[0],a=a[g]):g=this.options.rootName,l=function(b){return function(y,E){var D,S,d,_,R,N;if(typeof E!="object")b.options.cdata&&i(E)?y.raw(n(E)):y.txt(E);else if(Array.isArray(E)){for(_ in E)if(!!s.call(E,_)){S=E[_];for(R in S)d=S[R],y=l(y.ele(R),d).up()}}else for(R in E)if(!!s.call(E,R))if(S=E[R],R===u){if(typeof S=="object")for(D in S)N=S[D],y=y.att(D,N)}else if(R===c)b.options.cdata&&i(S)?y=y.raw(n(S)):y=y.txt(S);else if(Array.isArray(S))for(_ in S)!s.call(S,_)||(d=S[_],typeof d=="string"?b.options.cdata&&i(d)?y=y.ele(R).raw(n(d)).up():y=y.ele(R,d).up():y=l(y.ele(R),d).up());else typeof S=="object"?y=l(y.ele(R),S).up():typeof S=="string"&&b.options.cdata&&i(S)?y=y.ele(R).raw(n(S)).up():(S==null&&(S=""),y=y.ele(R,S.toString()).up());return y}}(this),h=t.create(g,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o}()}).call(Wn)});var Bc=I(Pi=>{(function(t){t.parser=function(m,f){return new r(m,f)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(m,f){if(!(this instanceof r))return new r(m,f);var q=this;n(q),q.q=q.c="",q.bufferCheckPosition=t.MAX_BUFFER_LENGTH,q.opt=f||{},q.opt.lowercase=q.opt.lowercase||q.opt.lowercasetags,q.looseCase=q.opt.lowercase?"toLowerCase":"toUpperCase",q.tags=[],q.closed=q.closedRoot=q.sawRoot=!1,q.tag=q.error=null,q.strict=!!m,q.noscript=!!(m||q.opt.noscript),q.state=A.BEGIN,q.strictEntities=q.opt.strictEntities,q.ENTITIES=q.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),q.attribList=[],q.opt.xmlns&&(q.ns=Object.create(_)),q.trackPosition=q.opt.position!==!1,q.trackPosition&&(q.position=q.line=q.column=0),fe(q,"onready")}Object.create||(Object.create=function(m){function f(){}f.prototype=m;var q=new f;return q}),Object.keys||(Object.keys=function(m){var f=[];for(var q in m)m.hasOwnProperty(q)&&f.push(q);return f});function i(m){for(var f=Math.max(t.MAX_BUFFER_LENGTH,10),q=0,x=0,J=e.length;xf)switch(e[x]){case"textNode":Pe(m);break;case"cdata":Q(m,"oncdata",m.cdata),m.cdata="";break;case"script":Q(m,"onscript",m.script),m.script="";break;default:nt(m,"Max buffer length exceeded: "+e[x])}q=Math.max(q,ae)}var ue=t.MAX_BUFFER_LENGTH-q;m.bufferCheckPosition=ue+m.position}function n(m){for(var f=0,q=e.length;f",E="[CDATA[",D="DOCTYPE",S="http://www.w3.org/XML/1998/namespace",d="http://www.w3.org/2000/xmlns/",_={xml:S,xmlns:d};l=L(l),h=L(h),g=L(g);var R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,N=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,C=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;b=L(b),y=L(y);function L(m){return m.split("").reduce(function(f,q){return f[q]=!0,f},{})}function X(m){return Object.prototype.toString.call(m)==="[object RegExp]"}function M(m,f){return X(m)?!!f.match(m):m[f]}function W(m,f){return!M(m,f)}var A=0;t.STATE={BEGIN:A++,BEGIN_WHITESPACE:A++,TEXT:A++,TEXT_ENTITY:A++,OPEN_WAKA:A++,SGML_DECL:A++,SGML_DECL_QUOTED:A++,DOCTYPE:A++,DOCTYPE_QUOTED:A++,DOCTYPE_DTD:A++,DOCTYPE_DTD_QUOTED:A++,COMMENT_STARTING:A++,COMMENT:A++,COMMENT_ENDING:A++,COMMENT_ENDED:A++,CDATA:A++,CDATA_ENDING:A++,CDATA_ENDING_2:A++,PROC_INST:A++,PROC_INST_BODY:A++,PROC_INST_ENDING:A++,OPEN_TAG:A++,OPEN_TAG_SLASH:A++,ATTRIB:A++,ATTRIB_NAME:A++,ATTRIB_NAME_SAW_WHITE:A++,ATTRIB_VALUE:A++,ATTRIB_VALUE_QUOTED:A++,ATTRIB_VALUE_CLOSED:A++,ATTRIB_VALUE_UNQUOTED:A++,ATTRIB_VALUE_ENTITY_Q:A++,ATTRIB_VALUE_ENTITY_U:A++,CLOSE_TAG:A++,CLOSE_TAG_SAW_WHITE:A++,SCRIPT:A++,SCRIPT_ENDING:A++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var f=t.ENTITIES[m],q=typeof f=="number"?String.fromCharCode(f):f;t.ENTITIES[m]=q});for(var ve in t.STATE)t.STATE[t.STATE[ve]]=ve;A=t.STATE;function fe(m,f,q){m[f]&&m[f](q)}function Q(m,f,q){m.textNode&&Pe(m),fe(m,f,q)}function Pe(m){m.textNode=it(m.opt,m.textNode),m.textNode&&fe(m,"ontext",m.textNode),m.textNode=""}function it(m,f){return m.trim&&(f=f.trim()),m.normalize&&(f=f.replace(/\s+/g," ")),f}function nt(m,f){return Pe(m),m.trackPosition&&(f+=` +* `+n,Ye.util.error(new Error(n),{code:"MultipleValidationErrors",errors:this.errors})}else{if(this.errors.length===1)throw this.errors[0];return!0}},fail:function(e,r){this.errors.push(Ye.util.error(new Error(r),{code:e}))},validateStructure:function(e,r,i){if(e.isDocument)return!0;this.validateType(r,i,["object"],"structure");for(var n,s=0;e.required&&s= 1, but found "'+r+'" for '+i)},validatePattern:function(e,r,i){this.validation.pattern&&e.pattern!==void 0&&(new RegExp(e.pattern).test(r)||this.fail("PatternMatchError",'Provided value "'+r+'" does not match regex pattern /'+e.pattern+"/ for "+i))},validateRange:function(e,r,i,n){this.validation.min&&e.min!==void 0&&r= "+e.min+", but found "+r+" for "+i),this.validation.max&&e.max!==void 0&&r>e.max&&this.fail("MaxRangeError","Expected "+n+" <= "+e.max+", but found "+r+" for "+i)},validateEnum:function(e,r,i){this.validation.enum&&e.enum!==void 0&&e.enum.indexOf(r)===-1&&this.fail("EnumError","Found string value of "+r+", but expected "+e.enum.join("|")+" for "+i)},validateType:function(e,r,i,n){if(e==null)return!1;for(var s=!1,o=0;o{var Im=[`We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023. +`,"Please migrate your code to use AWS SDK for JavaScript (v3).","For more information, check the migration guide at https://a.co/7PzMCcy"].join(` +`);ss.exports={suppress:!1};function Pm(){typeof process<"u"&&typeof process.emitWarning=="function"&&process.emitWarning(Im,{type:"NOTE"})}setTimeout(function(){ss.exports.suppress||Pm()},0)});var V=I((vE,Nu)=>{var Et={util:le()},Nm={};Nm.toString();Nu.exports=Et;Et.util.update(Et,{VERSION:"2.1331.0",Signers:{},Protocol:{Json:mi(),Query:Mn(),Rest:yr(),RestJson:Un(),RestXml:jn()},XML:{Builder:ba(),Parser:null},JSON:{Builder:fi(),Parser:di()},Model:{Api:Xn(),Operation:Wn(),Shape:vr(),Paginator:Hn(),ResourceWaiter:zn()},apiLoader:La(),EndpointCache:Fa().EndpointCache});Yn();za();Ka();_i();iu();au();cu();fu();Ru();Iu();Pu();Et.events=new Et.SequentialExecutor;Et.util.memoizedProperty(Et,"endpointCache",function(){return new Et.EndpointCache(Et.config.endpointCacheSize)},!0)});var as=I(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.default=km;var Dm=qm(require("crypto"));function qm(t){return t&&t.__esModule?t:{default:t}}function km(){return Dm.default.randomBytes(16)}});var Oi=I(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.default=void 0;var Du=[];for(Rr=0;Rr<256;++Rr)Du[Rr]=(Rr+256).toString(16).substr(1);var Rr;function Om(t,e){var r=e||0,i=Du;return[i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]]].join("")}var Lm=Om;ki.default=Lm});var Ou=I(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.default=void 0;var Mm=ku(as()),Fm=ku(Oi());function ku(t){return t&&t.__esModule?t:{default:t}}var qu,us,cs=0,ls=0;function Bm(t,e,r){var i=e&&r||0,n=e||[];t=t||{};var s=t.node||qu,o=t.clockseq!==void 0?t.clockseq:us;if(s==null||o==null){var a=t.random||(t.rng||Mm.default)();s==null&&(s=qu=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=us=(a[6]<<8|a[7])&16383)}var u=t.msecs!==void 0?t.msecs:new Date().getTime(),c=t.nsecs!==void 0?t.nsecs:ls+1,l=u-cs+(c-ls)/1e4;if(l<0&&t.clockseq===void 0&&(o=o+1&16383),(l<0||u>cs)&&t.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");cs=u,ls=c,us=o,u+=122192928e5;var d=((u&268435455)*1e4+c)%4294967296;n[i++]=d>>>24&255,n[i++]=d>>>16&255,n[i++]=d>>>8&255,n[i++]=d&255;var v=u/4294967296*1e4&268435455;n[i++]=v>>>8&255,n[i++]=v&255,n[i++]=v>>>24&15|16,n[i++]=v>>>16&255,n[i++]=o>>>8|128,n[i++]=o&255;for(var A=0;A<6;++A)n[i+A]=s[A];return e||(0,Fm.default)(n)}var Um=Bm;Li.default=Um});var fs=I(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.default=zm;Vt.URL=Vt.DNS=void 0;var Vm=jm(Oi());function jm(t){return t&&t.__esModule?t:{default:t}}function Wm(t){var e=[];return t.replace(/[a-fA-F0-9]{2}/g,function(r){e.push(parseInt(r,16))}),e}function Hm(t){t=unescape(encodeURIComponent(t));for(var e=new Array(t.length),r=0;r{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.default=void 0;var Km=Xm(require("crypto"));function Xm(t){return t&&t.__esModule?t:{default:t}}function Gm(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),Km.default.createHash("md5").update(t).digest()}var $m=Gm;Mi.default=$m});var Uu=I(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.default=void 0;var Ym=Bu(fs()),Jm=Bu(Fu());function Bu(t){return t&&t.__esModule?t:{default:t}}var Qm=(0,Ym.default)("v3",48,Jm.default),Zm=Qm;Fi.default=Zm});var ju=I(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.default=void 0;var ev=Vu(as()),tv=Vu(Oi());function Vu(t){return t&&t.__esModule?t:{default:t}}function rv(t,e,r){var i=e&&r||0;typeof t=="string"&&(e=t==="binary"?new Array(16):null,t=null),t=t||{};var n=t.random||(t.rng||ev.default)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e)for(var s=0;s<16;++s)e[i+s]=n[s];return e||(0,tv.default)(n)}var iv=rv;Bi.default=iv});var Wu=I(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.default=void 0;var nv=sv(require("crypto"));function sv(t){return t&&t.__esModule?t:{default:t}}function ov(t){return Array.isArray(t)?t=Buffer.from(t):typeof t=="string"&&(t=Buffer.from(t,"utf8")),nv.default.createHash("sha1").update(t).digest()}var av=ov;Ui.default=av});var zu=I(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.default=void 0;var uv=Hu(fs()),cv=Hu(Wu());function Hu(t){return t&&t.__esModule?t:{default:t}}var lv=(0,uv.default)("v5",80,cv.default),fv=lv;Vi.default=fv});var Ku=I(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});Object.defineProperty(ar,"v1",{enumerable:!0,get:function(){return pv.default}});Object.defineProperty(ar,"v3",{enumerable:!0,get:function(){return dv.default}});Object.defineProperty(ar,"v4",{enumerable:!0,get:function(){return hv.default}});Object.defineProperty(ar,"v5",{enumerable:!0,get:function(){return mv.default}});var pv=ji(Ou()),dv=ji(Uu()),hv=ji(ju()),mv=ji(zu());function ji(t){return t&&t.__esModule?t:{default:t}}});var le=I((bE,Xu)=>{var He,L={environment:"nodejs",engine:function(){if(L.isBrowser()&&typeof navigator<"u")return navigator.userAgent;var e=process.platform+"/"+process.version;return process.env.AWS_EXECUTION_ENV&&(e+=" exec-env/"+process.env.AWS_EXECUTION_ENV),e},userAgent:function(){var e=L.environment,r="aws-sdk-"+e+"/"+V().VERSION;return e==="nodejs"&&(r+=" "+L.engine()),r},uriEscape:function(e){var r=encodeURIComponent(e);return r=r.replace(/[^A-Za-z0-9_.~\-%]+/g,escape),r=r.replace(/[*]/g,function(i){return"%"+i.charCodeAt(0).toString(16).toUpperCase()}),r},uriEscapePath:function(e){var r=[];return L.arrayEach(e.split("/"),function(i){r.push(L.uriEscape(i))}),r.join("/")},urlParse:function(e){return L.url.parse(e)},urlFormat:function(e){return L.url.format(e)},queryStringParse:function(e){return L.querystring.parse(e)},queryParamsToString:function(e){var r=[],i=L.uriEscape,n=Object.keys(e).sort();return L.arrayEach(n,function(s){var o=e[s],a=i(s),u=a+"=";if(Array.isArray(o)){var c=[];L.arrayEach(o,function(l){c.push(i(l))}),u=a+"="+c.sort().join("&"+a+"=")}else o!=null&&(u=a+"="+i(o));r.push(u)}),r.join("&")},readFileSync:function(e){return L.isBrowser()?null:require("fs").readFileSync(e,"utf-8")},base64:{encode:function(e){if(typeof e=="number")throw L.error(new Error("Cannot base64 encode number "+e));if(e===null||typeof e>"u")return e;var r=L.buffer.toBuffer(e);return r.toString("base64")},decode:function(e){if(typeof e=="number")throw L.error(new Error("Cannot base64 decode number "+e));return e===null||typeof e>"u"?e:L.buffer.toBuffer(e,"base64")}},buffer:{toBuffer:function(t,e){return typeof L.Buffer.from=="function"&&L.Buffer.from!==Uint8Array.from?L.Buffer.from(t,e):new L.Buffer(t,e)},alloc:function(t,e,r){if(typeof t!="number")throw new Error("size passed to alloc must be a number.");if(typeof L.Buffer.alloc=="function")return L.Buffer.alloc(t,e,r);var i=new L.Buffer(t);return e!==void 0&&typeof i.fill=="function"&&i.fill(e,void 0,void 0,r),i},toStream:function(e){L.Buffer.isBuffer(e)||(e=L.buffer.toBuffer(e));var r=new L.stream.Readable,i=0;return r._read=function(n){if(i>=e.length)return r.push(null);var s=i+n;s>e.length&&(s=e.length),r.push(e.slice(i,s)),i=s},r},concat:function(t){var e=0,r=0,i=null,n;for(n=0;n>>8^r[(i^s)&255]}return(i^-1)>>>0},hmac:function(e,r,i,n){return i||(i="binary"),i==="buffer"&&(i=void 0),n||(n="sha256"),typeof r=="string"&&(r=L.buffer.toBuffer(r)),L.crypto.lib.createHmac(n,e).update(r).digest(i)},md5:function(e,r,i){return L.crypto.hash("md5",e,r,i)},sha256:function(e,r,i){return L.crypto.hash("sha256",e,r,i)},hash:function(t,e,r,i){var n=L.crypto.createHash(t);r||(r="binary"),r==="buffer"&&(r=void 0),typeof e=="string"&&(e=L.buffer.toBuffer(e));var s=L.arraySliceFn(e),o=L.Buffer.isBuffer(e);if(L.isBrowser()&&typeof ArrayBuffer<"u"&&e&&e.buffer instanceof ArrayBuffer&&(o=!0),i&&typeof e=="object"&&typeof e.on=="function"&&!o)e.on("data",function(d){n.update(d)}),e.on("error",function(d){i(d)}),e.on("end",function(){i(null,n.digest(r))});else if(i&&s&&!o&&typeof FileReader<"u"){var a=0,u=1024*512,c=new FileReader;c.onerror=function(){i(new Error("Failed to read data."))},c.onload=function(){var d=new L.Buffer(new Uint8Array(c.result));n.update(d),a+=d.length,c._continueReading()},c._continueReading=function(){if(a>=e.size){i(null,n.digest(r));return}var d=a+u;d>e.size&&(d=e.size),c.readAsArrayBuffer(s.call(e,a,d))},c._continueReading()}else{L.isBrowser()&&typeof e=="object"&&!o&&(e=new L.Buffer(new Uint8Array(e)));var l=n.update(e).digest(r);return i&&i(null,l),l}},toHex:function(e){for(var r=[],i=0;i=3e5,!1),He.config.isClockSkewed},applyClockOffset:function(e){e&&(He.config.systemClockOffset=e-new Date().getTime())},extractRequestId:function(e){var r=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!r&&e.data&&e.data.ResponseMetadata&&(r=e.data.ResponseMetadata.RequestId),r&&(e.requestId=r),e.error&&(e.error.requestId=r)},addPromises:function(e,r){var i=!1;r===void 0&&He&&He.config&&(r=He.config.getPromisesDependency()),r===void 0&&typeof Promise<"u"&&(r=Promise),typeof r!="function"&&(i=!0),Array.isArray(e)||(e=[e]);for(var n=0;n=0){o++,setTimeout(u,d+(c.retryAfter||0));return}}i(c)},u=function(){var c="";n.handleRequest(e,s,function(l){l.on("data",function(d){c+=d.toString()}),l.on("end",function(){var d=l.statusCode;if(d<300)i(null,c);else{var v=parseInt(l.headers["retry-after"],10)*1e3||0,A=L.error(new Error,{statusCode:d,retryable:d>=500||d===429});v&&A.retryable&&(A.retryAfter=v),a(A)}})},a)};He.util.defer(u)},uuid:{v4:function(){return Ku().v4()}},convertPayloadToString:function(e){var r=e.request,i=r.operation,n=r.service.api.operations[i].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick(e):typeof setImmediate=="function"?setImmediate(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var r=e.service.api.operations;if(r){var i=(r||{})[e.operation];if(!(!i||!i.input||!i.input.payload))return i.input.members[i.input.payload]}},getProfilesFromSharedConfig:function(e,r){var i={},n={};if(process.env[L.configOptInEnv])var n=e.loadFrom({isConfig:!0,filename:process.env[L.sharedConfigFileEnv]});var s={};try{var s=e.loadFrom({filename:r||process.env[L.configOptInEnv]&&process.env[L.sharedCredentialsFileEnv]})}catch(c){if(!process.env[L.configOptInEnv])throw c}for(var o=0,a=Object.keys(n);o=6},parse:function(e){var r=e.split(":");return{partition:r[1],service:r[2],region:r[3],accountId:r[4],resource:r.slice(5).join(":")}},build:function(e){if(e.service===void 0||e.region===void 0||e.accountId===void 0||e.resource===void 0)throw L.error(new Error("Input ARN object is invalid"));return"arn:"+(e.partition||"aws")+":"+e.service+":"+e.region+":"+e.accountId+":"+e.resource}},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};Xu.exports=L});var Ju=I((RE,Yu)=>{var vv=V().util,Gu=require("stream").Transform,$u=vv.buffer.alloc;function Ir(t){Gu.call(this,t),this.currentMessageTotalLength=0,this.currentMessagePendingLength=0,this.currentMessage=null,this.messageLengthBuffer=null}Ir.prototype=Object.create(Gu.prototype);Ir.prototype._transform=function(t,e,r){for(var i=t.length,n=0;n{var Qu=V().util,gv=Qu.buffer.toBuffer;function Pr(t){if(t.length!==8)throw new Error("Int64 buffers must be exactly 8 bytes");Qu.Buffer.isBuffer(t)||(t=gv(t)),this.bytes=t}Pr.fromNumber=function(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(t+" is too large (or, if negative, too small) to represent as an Int64");for(var e=new Uint8Array(8),r=7,i=Math.abs(Math.round(t));r>-1&&i>0;r--,i/=256)e[r]=i;return t<0&&Zu(e),new Pr(e)};Pr.prototype.valueOf=function(){var t=this.bytes.slice(0),e=t[0]&128;return e&&Zu(t),parseInt(t.toString("hex"),16)*(e?-1:1)};Pr.prototype.toString=function(){return String(this.valueOf())};function Zu(t){for(var e=0;e<8;e++)t[e]^=255;for(var e=7;e>-1&&(t[e]++,t[e]===0);e--);}ec.exports={Int64:Pr}});var nc=I((PE,ic)=>{var Wi=V().util,yv=Wi.buffer.toBuffer,rc=4,Hi=rc*2,Nr=4,Ev=Hi+Nr*2;function Sv(t){if(Wi.Buffer.isBuffer(t)||(t=yv(t)),t.length{var sc=tc().Int64,wv=nc().splitMessage,oc="boolean",Cv="byte",Tv="short",_v="integer",Av="long",xv="binary",bv="string",Rv="timestamp",Iv="uuid";function Pv(t){for(var e={},r=0;r{var Dv=uc().parseMessage;function qv(t,e,r){var i=Dv(e),n=i.headers[":message-type"];if(n){if(n.value==="error")throw kv(i);if(n.value!=="event")return}var s=i.headers[":event-type"],o=r.members[s.value];if(o){var a={},u=o.eventPayloadMemberName;if(u){var c=o.members[u];c.type==="binary"?a[u]=i.body:a[u]=t.parse(i.body.toString(),c)}for(var l=o.eventHeaderMemberNames,d=0;d{var lc=require("stream").Transform,Ov=ps().parseEvent;function ds(t){t=t||{},t.readableObjectMode=!0,lc.call(this,t),this._readableState.objectMode=!0,this.parser=t.parser,this.eventStreamModel=t.eventStreamModel}ds.prototype=Object.create(lc.prototype);ds.prototype._transform=function(t,e,r){try{var i=Ov(this.parser,t,this.eventStreamModel);return this.push(i),r()}catch(n){r(n)}};fc.exports={EventUnmarshallerStream:ds}});var hc=I((kE,dc)=>{var Lv=Ju().EventMessageChunkerStream,Mv=pc().EventUnmarshallerStream;function Fv(t,e,r){var i=new Mv({parser:e,eventStreamModel:r}),n=new Lv;return t.pipe(n).pipe(i),t.on("error",function(s){n.emit("error",s)}),n.on("error",function(s){i.emit("error",s)}),i}dc.exports={createEventStream:Fv}});var vc=I((OE,mc)=>{function Bv(t){for(var e=[],r=0;r{var Uv=vc().eventMessageChunker,Vv=ps().parseEvent;function jv(t,e,r){for(var i=Uv(t),n=[],s=0;s{Ec.exports={now:function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}}});var Cc=I((FE,wc)=>{var Wv=V().util,Hv=require("dgram"),zv=Wv.buffer.toBuffer,Kv=1024*8;function jt(t){t=t||{},this.enabled=t.enabled||!1,this.port=t.port||31e3,this.clientId=t.clientId||"",this.address=t.host||"127.0.0.1",this.clientId.length>255&&(this.clientId=this.clientId.substr(0,255)),this.messagesInFlight=0}jt.prototype.fieldsToTrim={UserAgent:256,SdkException:128,SdkExceptionMessage:512,AwsException:128,AwsExceptionMessage:512,FinalSdkException:128,FinalSdkExceptionMessage:512,FinalAwsException:128,FinalAwsExceptionMessage:512};jt.prototype.trimFields=function(t){for(var e=Object.keys(this.fieldsToTrim),r=0,i=e.length;rs&&(t[n]=o.substr(0,s))}}return t};jt.prototype.eventHandler=function(t){t.ClientId=this.clientId,this.trimFields(t);var e=zv(JSON.stringify(t));!this.enabled||e.length>Kv||this.publishDatagram(e)};jt.prototype.publishDatagram=function(t){var e=this,r=this.getClient();this.messagesInFlight++,this.client.send(t,0,t.length,this.port,this.address,function(i,n){--e.messagesInFlight<=0&&e.destroyClient()})};jt.prototype.getClient=function(){return this.client||(this.client=Hv.createSocket("udp4")),this.client};jt.prototype.destroyClient=function(){this.client&&(this.client.close(),this.client=void 0)};wc.exports={Publisher:jt}});var Ac=I((BE,_c)=>{var hs=V();function Xv(){var t={port:void 0,clientId:void 0,enabled:void 0,host:void 0};return Gv(t)||$v(t),Tc(t)}function Gv(t){return t.port=t.port||process.env.AWS_CSM_PORT,t.enabled=t.enabled||process.env.AWS_CSM_ENABLED,t.clientId=t.clientId||process.env.AWS_CSM_CLIENT_ID,t.host=t.host||process.env.AWS_CSM_HOST,t.port&&t.enabled&&t.clientId&&t.host||["false","0"].indexOf(t.enabled)>=0}function $v(t){var e;try{var r=hs.util.iniLoader.loadFrom({isConfig:!0,filename:process.env[hs.util.sharedConfigFileEnv]}),e=r[process.env.AWS_PROFILE||hs.util.defaultProfile]}catch{return!1}return e?(t.port=t.port||e.csm_port,t.enabled=t.enabled||e.csm_enabled,t.clientId=t.clientId||e.csm_client_id,t.host=t.host||e.csm_host,t.port&&t.enabled&&t.clientId&&t.host):t}function Tc(t){var e=["false","0",void 0];return!t.enabled||e.indexOf(t.enabled.toLowerCase())>=0?t.enabled=!1:t.enabled=!0,t.port=t.port?parseInt(t.port,10):void 0,t}_c.exports=Xv});var ms=I((UE,Rc)=>{var ur=V(),xc=require("os"),Yv=require("path");function bc(t){return ur.util.ini.parse(ur.util.readFileSync(t))}function Jv(t){var e={};return Object.keys(t).forEach(function(r){/^sso-session\s/.test(r)||Object.defineProperty(e,r.replace(/^profile\s/,""),{value:t[r],enumerable:!0})}),e}function Qv(t){var e={};return Object.keys(t).forEach(function(r){/^sso-session\s/.test(r)&&Object.defineProperty(e,r.replace(/^sso-session\s/,""),{value:t[r],enumerable:!0})}),e}ur.IniLoader=ur.util.inherit({constructor:function(){this.resolvedProfiles={},this.resolvedSsoSessions={}},clearCachedFiles:function(){this.resolvedProfiles={},this.resolvedSsoSessions={}},loadFrom:function(e){e=e||{};var r=e.isConfig===!0,i=e.filename||this.getDefaultFilePath(r);if(!this.resolvedProfiles[i]){var n=bc(i);r?Object.defineProperty(this.resolvedProfiles,i,{value:Jv(n)}):Object.defineProperty(this.resolvedProfiles,i,{value:n})}return this.resolvedProfiles[i]},loadSsoSessionsFrom:function(e){e=e||{};var r=e.filename||this.getDefaultFilePath(!0);if(!this.resolvedSsoSessions[r]){var i=bc(r);Object.defineProperty(this.resolvedSsoSessions,r,{value:Qv(i)})}return this.resolvedSsoSessions[r]},getDefaultFilePath:function(e){return Yv.join(this.getHomeDir(),".aws",e?"config":"credentials")},getHomeDir:function(){var e=process.env,r=e.HOME||e.USERPROFILE||(e.HOMEPATH?(e.HOMEDRIVE||"C:/")+e.HOMEPATH:null);if(r)return r;if(typeof xc.homedir=="function")return xc.homedir();throw ur.util.error(new Error("Cannot load credentials, HOME path not set"))}});var Zv=ur.IniLoader;Rc.exports={IniLoader:Zv}});var Pc=I((VE,Ic)=>{var eg=ms().IniLoader;Ic.exports.iniLoader=new eg});var Dc=I((jE,Nc)=>{var Dr=V();function vs(t,e){if(typeof t=="string"){if(["legacy","regional"].indexOf(t.toLowerCase())>=0)return t.toLowerCase();throw Dr.util.error(new Error,e)}}function tg(t,e){t=t||{};var r;if(t[e.clientConfig]&&(r=vs(t[e.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+e.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+t[e.clientConfig]+'".'}),r)||!Dr.util.isNode())return r;if(Object.prototype.hasOwnProperty.call(process.env,e.env)){var i=process.env[e.env];if(r=vs(i,{code:"InvalidEnvironmentalVariable",message:"invalid "+e.env+' environmental variable. Expect "legacy" or "regional". Got "'+process.env[e.env]+'".'}),r)return r}var n={};try{var s=Dr.util.getProfilesFromSharedConfig(Dr.util.iniLoader);n=s[process.env.AWS_PROFILE||Dr.util.defaultProfile]}catch{}if(n&&Object.prototype.hasOwnProperty.call(n,e.sharedConfig)){var o=n[e.sharedConfig];if(r=vs(o,{code:"InvalidConfiguration",message:"invalid "+e.sharedConfig+' profile config. Expect "legacy" or "regional". Got "'+n[e.sharedConfig]+'".'}),r)return r}return r}Nc.exports=tg});var qc=I(()=>{var zi=V(),rg=Dc(),ig="AWS_STS_REGIONAL_ENDPOINTS",ng="sts_regional_endpoints";zi.util.update(zi.STS.prototype,{credentialsFrom:function(e,r){return e?(r||(r=new zi.TemporaryCredentials),r.expired=!1,r.accessKeyId=e.Credentials.AccessKeyId,r.secretAccessKey=e.Credentials.SecretAccessKey,r.sessionToken=e.Credentials.SessionToken,r.expireTime=e.Credentials.Expiration,r):null},assumeRoleWithWebIdentity:function(e,r){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",e,r)},assumeRoleWithSAML:function(e,r){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",e,r)},setupRequestListeners:function(e){e.addListener("validate",this.optInRegionalEndpoint,!0)},optInRegionalEndpoint:function(e){var r=e.service,i=r.config;if(i.stsRegionalEndpoints=rg(r._originalConfig,{env:ig,sharedConfig:ng,clientConfig:"stsRegionalEndpoints"}),i.stsRegionalEndpoints==="regional"&&r.isGlobalEndpoint){if(!i.region)throw zi.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var n=i.endpoint.indexOf(".amazonaws.com"),s=i.endpoint.substring(0,n)+"."+i.region+i.endpoint.substring(n);e.httpRequest.updateEndpoint(s),e.httpRequest.region=i.region}}})});var kc=I((zE,sg)=>{sg.exports={version:"2.0",metadata:{apiVersion:"2011-06-15",endpointPrefix:"sts",globalEndpoint:"sts.amazonaws.com",protocol:"query",serviceAbbreviation:"AWS STS",serviceFullName:"AWS Security Token Service",serviceId:"STS",signatureVersion:"v4",uid:"sts-2011-06-15",xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/"},operations:{AssumeRole:{input:{type:"structure",required:["RoleArn","RoleSessionName"],members:{RoleArn:{},RoleSessionName:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"},Tags:{shape:"S8"},TransitiveTagKeys:{type:"list",member:{}},ExternalId:{},SerialNumber:{},TokenCode:{},SourceIdentity:{}}},output:{resultWrapper:"AssumeRoleResult",type:"structure",members:{Credentials:{shape:"Si"},AssumedRoleUser:{shape:"Sn"},PackedPolicySize:{type:"integer"},SourceIdentity:{}}}},AssumeRoleWithSAML:{input:{type:"structure",required:["RoleArn","PrincipalArn","SAMLAssertion"],members:{RoleArn:{},PrincipalArn:{},SAMLAssertion:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"AssumeRoleWithSAMLResult",type:"structure",members:{Credentials:{shape:"Si"},AssumedRoleUser:{shape:"Sn"},PackedPolicySize:{type:"integer"},Subject:{},SubjectType:{},Issuer:{},Audience:{},NameQualifier:{},SourceIdentity:{}}}},AssumeRoleWithWebIdentity:{input:{type:"structure",required:["RoleArn","RoleSessionName","WebIdentityToken"],members:{RoleArn:{},RoleSessionName:{},WebIdentityToken:{},ProviderId:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"AssumeRoleWithWebIdentityResult",type:"structure",members:{Credentials:{shape:"Si"},SubjectFromWebIdentityToken:{},AssumedRoleUser:{shape:"Sn"},PackedPolicySize:{type:"integer"},Provider:{},Audience:{},SourceIdentity:{}}}},DecodeAuthorizationMessage:{input:{type:"structure",required:["EncodedMessage"],members:{EncodedMessage:{}}},output:{resultWrapper:"DecodeAuthorizationMessageResult",type:"structure",members:{DecodedMessage:{}}}},GetAccessKeyInfo:{input:{type:"structure",required:["AccessKeyId"],members:{AccessKeyId:{}}},output:{resultWrapper:"GetAccessKeyInfoResult",type:"structure",members:{Account:{}}}},GetCallerIdentity:{input:{type:"structure",members:{}},output:{resultWrapper:"GetCallerIdentityResult",type:"structure",members:{UserId:{},Account:{},Arn:{}}}},GetFederationToken:{input:{type:"structure",required:["Name"],members:{Name:{},Policy:{},PolicyArns:{shape:"S4"},DurationSeconds:{type:"integer"},Tags:{shape:"S8"}}},output:{resultWrapper:"GetFederationTokenResult",type:"structure",members:{Credentials:{shape:"Si"},FederatedUser:{type:"structure",required:["FederatedUserId","Arn"],members:{FederatedUserId:{},Arn:{}}},PackedPolicySize:{type:"integer"}}}},GetSessionToken:{input:{type:"structure",members:{DurationSeconds:{type:"integer"},SerialNumber:{},TokenCode:{}}},output:{resultWrapper:"GetSessionTokenResult",type:"structure",members:{Credentials:{shape:"Si"}}}}},shapes:{S4:{type:"list",member:{type:"structure",members:{arn:{}}}},S8:{type:"list",member:{type:"structure",required:["Key","Value"],members:{Key:{},Value:{}}}},Si:{type:"structure",required:["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],members:{AccessKeyId:{},SecretAccessKey:{},SessionToken:{},Expiration:{type:"timestamp"}}},Sn:{type:"structure",required:["AssumedRoleId","Arn"],members:{AssumedRoleId:{},Arn:{}}}}}});var Oc=I((KE,og)=>{og.exports={pagination:{}}});var Pt=I((XE,Mc)=>{Xi();var Ki=V(),ag=Ki.Service,Lc=Ki.apiLoader;Lc.services.sts={};Ki.STS=ag.defineService("sts",["2011-06-15"]);qc();Object.defineProperty(Lc.services.sts,"2011-06-15",{get:function(){var e=kc();return e.paginators=Oc().pagination,e},enumerable:!0,configurable:!0});Mc.exports=Ki.STS});var Fc=I(()=>{var Wt=V(),ug=Pt();Wt.TemporaryCredentials=Wt.util.inherit(Wt.Credentials,{constructor:function(e,r){Wt.Credentials.call(this),this.loadMasterCredentials(r),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||Wt.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.masterCredentials.get(function(){r.service.config.credentials=r.masterCredentials;var i=r.params.RoleArn?r.service.assumeRole:r.service.getSessionToken;i.call(r.service,function(n,s){n||r.service.credentialsFrom(s,r),e(n)})})},loadMasterCredentials:function(e){for(this.masterCredentials=e||Wt.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;typeof this.masterCredentials.get!="function"&&(this.masterCredentials=new Wt.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new ug({params:this.params})}})});var Bc=I(()=>{var ot=V(),cg=Pt();ot.ChainableTemporaryCredentials=ot.util.inherit(ot.Credentials,{constructor:function(e){ot.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var r=ot.util.copy(e.params)||{};if(r.RoleArn&&(r.RoleSessionName=r.RoleSessionName||"temporary-credentials"),r.SerialNumber){if(!e.tokenCodeFn||typeof e.tokenCodeFn!="function")throw new ot.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}var i=ot.util.merge({params:r,credentials:e.masterCredentials||ot.config.credentials},e.stsConfig||{});this.service=new cg(i)},refresh:function(e){this.coalesceRefresh(e||ot.util.fn.callback)},load:function(e){var r=this,i=r.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(n,s){var o={};if(n){e(n);return}s&&(o.TokenCode=s),r.service[i](o,function(a,u){a||r.service.credentialsFrom(u,r),e(a)})})},getTokenCode:function(e){var r=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(i,n){if(i){var s=i;i instanceof Error&&(s=i.message),e(ot.util.error(new Error("Error fetching MFA token: "+s),{code:r.errorCode}));return}e(null,n)}):e(null)}})});var Uc=I(()=>{var Ht=V(),lg=Pt();Ht.WebIdentityCredentials=Ht.util.inherit(Ht.Credentials,{constructor:function(e,r){Ht.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=Ht.util.copy(r||{})},refresh:function(e){this.coalesceRefresh(e||Ht.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.service.assumeRoleWithWebIdentity(function(i,n){r.data=null,i||(r.data=n,r.service.credentialsFrom(n,r)),e(i)})},createClients:function(){if(!this.service){var t=Ht.util.merge({},this._clientConfig);t.params=this.params,this.service=new lg(t)}}})});var Vc=I((eS,fg)=>{fg.exports={version:"2.0",metadata:{apiVersion:"2014-06-30",endpointPrefix:"cognito-identity",jsonVersion:"1.1",protocol:"json",serviceFullName:"Amazon Cognito Identity",serviceId:"Cognito Identity",signatureVersion:"v4",targetPrefix:"AWSCognitoIdentityService",uid:"cognito-identity-2014-06-30"},operations:{CreateIdentityPool:{input:{type:"structure",required:["IdentityPoolName","AllowUnauthenticatedIdentities"],members:{IdentityPoolName:{},AllowUnauthenticatedIdentities:{type:"boolean"},AllowClassicFlow:{type:"boolean"},SupportedLoginProviders:{shape:"S5"},DeveloperProviderName:{},OpenIdConnectProviderARNs:{shape:"S9"},CognitoIdentityProviders:{shape:"Sb"},SamlProviderARNs:{shape:"Sg"},IdentityPoolTags:{shape:"Sh"}}},output:{shape:"Sk"}},DeleteIdentities:{input:{type:"structure",required:["IdentityIdsToDelete"],members:{IdentityIdsToDelete:{type:"list",member:{}}}},output:{type:"structure",members:{UnprocessedIdentityIds:{type:"list",member:{type:"structure",members:{IdentityId:{},ErrorCode:{}}}}}}},DeleteIdentityPool:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}}},DescribeIdentity:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{}}},output:{shape:"Sv"}},DescribeIdentityPool:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}},output:{shape:"Sk"}},GetCredentialsForIdentity:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{},Logins:{shape:"S10"},CustomRoleArn:{}}},output:{type:"structure",members:{IdentityId:{},Credentials:{type:"structure",members:{AccessKeyId:{},SecretKey:{},SessionToken:{},Expiration:{type:"timestamp"}}}}},authtype:"none"},GetId:{input:{type:"structure",required:["IdentityPoolId"],members:{AccountId:{},IdentityPoolId:{},Logins:{shape:"S10"}}},output:{type:"structure",members:{IdentityId:{}}},authtype:"none"},GetIdentityPoolRoles:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}},output:{type:"structure",members:{IdentityPoolId:{},Roles:{shape:"S1c"},RoleMappings:{shape:"S1e"}}}},GetOpenIdToken:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{},Logins:{shape:"S10"}}},output:{type:"structure",members:{IdentityId:{},Token:{}}},authtype:"none"},GetOpenIdTokenForDeveloperIdentity:{input:{type:"structure",required:["IdentityPoolId","Logins"],members:{IdentityPoolId:{},IdentityId:{},Logins:{shape:"S10"},PrincipalTags:{shape:"S1s"},TokenDuration:{type:"long"}}},output:{type:"structure",members:{IdentityId:{},Token:{}}}},GetPrincipalTagAttributeMap:{input:{type:"structure",required:["IdentityPoolId","IdentityProviderName"],members:{IdentityPoolId:{},IdentityProviderName:{}}},output:{type:"structure",members:{IdentityPoolId:{},IdentityProviderName:{},UseDefaults:{type:"boolean"},PrincipalTags:{shape:"S1s"}}}},ListIdentities:{input:{type:"structure",required:["IdentityPoolId","MaxResults"],members:{IdentityPoolId:{},MaxResults:{type:"integer"},NextToken:{},HideDisabled:{type:"boolean"}}},output:{type:"structure",members:{IdentityPoolId:{},Identities:{type:"list",member:{shape:"Sv"}},NextToken:{}}}},ListIdentityPools:{input:{type:"structure",required:["MaxResults"],members:{MaxResults:{type:"integer"},NextToken:{}}},output:{type:"structure",members:{IdentityPools:{type:"list",member:{type:"structure",members:{IdentityPoolId:{},IdentityPoolName:{}}}},NextToken:{}}}},ListTagsForResource:{input:{type:"structure",required:["ResourceArn"],members:{ResourceArn:{}}},output:{type:"structure",members:{Tags:{shape:"Sh"}}}},LookupDeveloperIdentity:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{},IdentityId:{},DeveloperUserIdentifier:{},MaxResults:{type:"integer"},NextToken:{}}},output:{type:"structure",members:{IdentityId:{},DeveloperUserIdentifierList:{type:"list",member:{}},NextToken:{}}}},MergeDeveloperIdentities:{input:{type:"structure",required:["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],members:{SourceUserIdentifier:{},DestinationUserIdentifier:{},DeveloperProviderName:{},IdentityPoolId:{}}},output:{type:"structure",members:{IdentityId:{}}}},SetIdentityPoolRoles:{input:{type:"structure",required:["IdentityPoolId","Roles"],members:{IdentityPoolId:{},Roles:{shape:"S1c"},RoleMappings:{shape:"S1e"}}}},SetPrincipalTagAttributeMap:{input:{type:"structure",required:["IdentityPoolId","IdentityProviderName"],members:{IdentityPoolId:{},IdentityProviderName:{},UseDefaults:{type:"boolean"},PrincipalTags:{shape:"S1s"}}},output:{type:"structure",members:{IdentityPoolId:{},IdentityProviderName:{},UseDefaults:{type:"boolean"},PrincipalTags:{shape:"S1s"}}}},TagResource:{input:{type:"structure",required:["ResourceArn","Tags"],members:{ResourceArn:{},Tags:{shape:"Sh"}}},output:{type:"structure",members:{}}},UnlinkDeveloperIdentity:{input:{type:"structure",required:["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],members:{IdentityId:{},IdentityPoolId:{},DeveloperProviderName:{},DeveloperUserIdentifier:{}}}},UnlinkIdentity:{input:{type:"structure",required:["IdentityId","Logins","LoginsToRemove"],members:{IdentityId:{},Logins:{shape:"S10"},LoginsToRemove:{shape:"Sw"}}},authtype:"none"},UntagResource:{input:{type:"structure",required:["ResourceArn","TagKeys"],members:{ResourceArn:{},TagKeys:{type:"list",member:{}}}},output:{type:"structure",members:{}}},UpdateIdentityPool:{input:{shape:"Sk"},output:{shape:"Sk"}}},shapes:{S5:{type:"map",key:{},value:{}},S9:{type:"list",member:{}},Sb:{type:"list",member:{type:"structure",members:{ProviderName:{},ClientId:{},ServerSideTokenCheck:{type:"boolean"}}}},Sg:{type:"list",member:{}},Sh:{type:"map",key:{},value:{}},Sk:{type:"structure",required:["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],members:{IdentityPoolId:{},IdentityPoolName:{},AllowUnauthenticatedIdentities:{type:"boolean"},AllowClassicFlow:{type:"boolean"},SupportedLoginProviders:{shape:"S5"},DeveloperProviderName:{},OpenIdConnectProviderARNs:{shape:"S9"},CognitoIdentityProviders:{shape:"Sb"},SamlProviderARNs:{shape:"Sg"},IdentityPoolTags:{shape:"Sh"}}},Sv:{type:"structure",members:{IdentityId:{},Logins:{shape:"Sw"},CreationDate:{type:"timestamp"},LastModifiedDate:{type:"timestamp"}}},Sw:{type:"list",member:{}},S10:{type:"map",key:{},value:{}},S1c:{type:"map",key:{},value:{}},S1e:{type:"map",key:{},value:{type:"structure",required:["Type"],members:{Type:{},AmbiguousRoleResolution:{},RulesConfiguration:{type:"structure",required:["Rules"],members:{Rules:{type:"list",member:{type:"structure",required:["Claim","MatchType","Value","RoleARN"],members:{Claim:{},MatchType:{},Value:{},RoleARN:{}}}}}}}}},S1s:{type:"map",key:{},value:{}}}}});var jc=I((tS,pg)=>{pg.exports={pagination:{ListIdentityPools:{input_token:"NextToken",limit_key:"MaxResults",output_token:"NextToken",result_key:"IdentityPools"}}}});var zc=I((rS,Hc)=>{Xi();var Gi=V(),dg=Gi.Service,Wc=Gi.apiLoader;Wc.services.cognitoidentity={};Gi.CognitoIdentity=dg.defineService("cognitoidentity",["2014-06-30"]);Object.defineProperty(Wc.services.cognitoidentity,"2014-06-30",{get:function(){var e=Vc();return e.paginators=jc().pagination,e},enumerable:!0,configurable:!0});Hc.exports=Gi.CognitoIdentity});var Kc=I(()=>{var Je=V(),hg=zc(),mg=Pt();Je.CognitoIdentityCredentials=Je.util.inherit(Je.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,r){Je.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=Je.util.copy(r||{}),this.loadCachedId();var i=this;Object.defineProperty(this,"identityId",{get:function(){return i.loadCachedId(),i._identityId||i.params.IdentityId},set:function(n){i._identityId=n}})},refresh:function(e){this.coalesceRefresh(e||Je.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.data=null,r._identityId=null,r.getId(function(i){i?(r.clearIdOnNotAuthorized(i),e(i)):r.params.RoleArn?r.getCredentialsFromSTS(e):r.getCredentialsForIdentity(e)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,r=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+r],delete this.storage[this.localStorageKey.providers+e+r]},clearIdOnNotAuthorized:function(e){var r=this;e.code=="NotAuthorizedException"&&r.clearCachedId()},getId:function(e){var r=this;if(typeof r.params.IdentityId=="string")return e(null,r.params.IdentityId);r.cognito.getId(function(i,n){!i&&n.IdentityId?(r.params.IdentityId=n.IdentityId,e(null,n.IdentityId)):e(i)})},loadCredentials:function(e,r){!e||!r||(r.expired=!1,r.accessKeyId=e.Credentials.AccessKeyId,r.secretAccessKey=e.Credentials.SecretKey,r.sessionToken=e.Credentials.SessionToken,r.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(e){var r=this;r.cognito.getCredentialsForIdentity(function(i,n){i?r.clearIdOnNotAuthorized(i):(r.cacheId(n),r.data=n,r.loadCredentials(r.data,r)),e(i)})},getCredentialsFromSTS:function(e){var r=this;r.cognito.getOpenIdToken(function(i,n){i?(r.clearIdOnNotAuthorized(i),e(i)):(r.cacheId(n),r.params.WebIdentityToken=n.Token,r.webIdentityCredentials.refresh(function(s){s||(r.data=r.webIdentityCredentials.data,r.sts.credentialsFrom(r.data,r)),e(s)}))})},loadCachedId:function(){var e=this;if(Je.util.isBrowser()&&!e.params.IdentityId){var r=e.getStorage("id");if(r&&e.params.Logins){var i=Object.keys(e.params.Logins),n=(e.getStorage("providers")||"").split(","),s=n.filter(function(o){return i.indexOf(o)!==-1});s.length!==0&&(e.params.IdentityId=r)}else r&&(e.params.IdentityId=r)}},createClients:function(){var t=this._clientConfig;if(this.webIdentityCredentials=this.webIdentityCredentials||new Je.WebIdentityCredentials(this.params,t),!this.cognito){var e=Je.util.merge({},t);e.params=this.params,this.cognito=new hg(e)}this.sts=this.sts||new mg(t)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,Je.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,r){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=r}catch{}},storage:function(){try{var t=Je.util.isBrowser()&&window.localStorage!==null&&typeof window.localStorage=="object"?window.localStorage:{};return t["aws.test-storage"]="foobar",delete t["aws.test-storage"],t}catch{return{}}}()})});var Xc=I(()=>{var qr=V(),vg=Pt();qr.SAMLCredentials=qr.util.inherit(qr.Credentials,{constructor:function(e){qr.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||qr.util.fn.callback)},load:function(e){var r=this;r.createClients(),r.service.assumeRoleWithSAML(function(i,n){i||r.service.credentialsFrom(n,r),e(i)})},createClients:function(){this.service=this.service||new vg({params:this.params})}})});var gs=I(()=>{var qe=V(),gg=require("child_process"),Gc=qe.util.iniLoader;qe.ProcessCredentials=qe.util.inherit(qe.Credentials,{constructor:function(e){qe.Credentials.call(this),e=e||{},this.filename=e.filename,this.profile=e.profile||process.env.AWS_PROFILE||qe.util.defaultProfile,this.get(e.callback||qe.util.fn.noop)},load:function(e){var r=this;try{var i=qe.util.getProfilesFromSharedConfig(Gc,this.filename),n=i[this.profile]||{};if(Object.keys(n).length===0)throw qe.util.error(new Error("Profile "+this.profile+" not found"),{code:"ProcessCredentialsProviderFailure"});if(n.credential_process)this.loadViaCredentialProcess(n,function(s,o){s?e(s,null):(r.expired=!1,r.accessKeyId=o.AccessKeyId,r.secretAccessKey=o.SecretAccessKey,r.sessionToken=o.SessionToken,o.Expiration&&(r.expireTime=new Date(o.Expiration)),e(null))});else throw qe.util.error(new Error("Profile "+this.profile+" did not include credential process"),{code:"ProcessCredentialsProviderFailure"})}catch(s){e(s)}},loadViaCredentialProcess:function(e,r){gg.exec(e.credential_process,{env:process.env},function(i,n,s){if(i)r(qe.util.error(new Error("credential_process returned error"),{code:"ProcessCredentialsProviderFailure"}),null);else try{var o=JSON.parse(n);if(o.Expiration){var a=qe.util.date.getDate(),u=new Date(o.Expiration);if(u{(function(){ys.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:` +`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(ys)});var St=I(($c,zt)=>{(function(){var t,e,r,i,n,s,o=[].slice,a={}.hasOwnProperty;t=function(){var u,c,l,d,v,A;if(A=arguments[0],v=2<=arguments.length?o.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(u=0,l=v.length;u{(function(){var t;Jc.exports=t=function(){function e(r,i,n){if(this.options=r.options,this.stringify=r.stringify,i==null)throw new Error("Missing attribute name of element "+r.name);if(n==null)throw new Error("Missing attribute value for attribute "+i+" of element "+r.name);this.name=this.stringify.attName(i),this.value=this.stringify.attValue(n)}return e.prototype.clone=function(){return Object.create(this)},e.prototype.toString=function(r){return this.options.writer.set(r).attribute(this)},e}()}).call(Yc)});var kr=I((Qc,Zc)=>{(function(){var t,e,r,i,n,s,o=function(u,c){for(var l in c)a.call(c,l)&&(u[l]=c[l]);function d(){this.constructor=u}return d.prototype=c.prototype,u.prototype=new d,u.__super__=c.prototype,u},a={}.hasOwnProperty;s=St(),n=s.isObject,i=s.isFunction,r=ke(),t=Es(),Zc.exports=e=function(u){o(c,u);function c(l,d,v){if(c.__super__.constructor.call(this,l),d==null)throw new Error("Missing element name");this.name=this.stringify.eleName(d),this.attributes={},v!=null&&this.attribute(v),l.isDocument&&(this.isRoot=!0,this.documentObject=l,l.rootObject=this)}return c.prototype.clone=function(){var l,d,v,A;v=Object.create(this),v.isRoot&&(v.documentObject=null),v.attributes={},A=this.attributes;for(d in A)a.call(A,d)&&(l=A[d],v.attributes[d]=l.clone());return v.children=[],this.children.forEach(function(g){var E;return E=g.clone(),E.parent=v,v.children.push(E)}),v},c.prototype.attribute=function(l,d){var v,A;if(l!=null&&(l=l.valueOf()),n(l))for(v in l)a.call(l,v)&&(A=l[v],this.attribute(v,A));else i(d)&&(d=d.apply()),(!this.options.skipNullAttributes||d!=null)&&(this.attributes[l]=new t(this,l,d));return this},c.prototype.removeAttribute=function(l){var d,v,A;if(l==null)throw new Error("Missing attribute name");if(l=l.valueOf(),Array.isArray(l))for(v=0,A=l.length;v{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=ke(),tl.exports=t=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).cdata(this)},s}(e)}).call(el)});var Lr=I((rl,il)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=ke(),il.exports=t=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing comment text");this.text=this.stringify.comment(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).comment(this)},s}(e)}).call(rl)});var Mr=I((nl,sl)=>{(function(){var t,e,r,i=function(s,o){for(var a in o)n.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},n={}.hasOwnProperty;r=St().isObject,e=ke(),sl.exports=t=function(s){i(o,s);function o(a,u,c,l){var d;o.__super__.constructor.call(this,a),r(u)&&(d=u,u=d.version,c=d.encoding,l=d.standalone),u||(u="1.0"),this.version=this.stringify.xmlVersion(u),c!=null&&(this.encoding=this.stringify.xmlEncoding(c)),l!=null&&(this.standalone=this.stringify.xmlStandalone(l))}return o.prototype.toString=function(a){return this.options.writer.set(a).declaration(this)},o}(e)}).call(nl)});var Fr=I((ol,al)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=ke(),al.exports=t=function(n){r(s,n);function s(o,a,u,c,l,d){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing DTD element name");if(u==null)throw new Error("Missing DTD attribute name");if(!c)throw new Error("Missing DTD attribute type");if(!l)throw new Error("Missing DTD attribute default");if(l.indexOf("#")!==0&&(l="#"+l),!l.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(d&&!l.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(a),this.attributeName=this.stringify.attName(u),this.attributeType=this.stringify.dtdAttType(c),this.defaultValue=this.stringify.dtdAttDefault(d),this.defaultValueType=l}return s.prototype.toString=function(o){return this.options.writer.set(o).dtdAttList(this)},s}(e)}).call(ol)});var Br=I((ul,cl)=>{(function(){var t,e,r,i=function(s,o){for(var a in o)n.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},n={}.hasOwnProperty;r=St().isObject,e=ke(),cl.exports=t=function(s){i(o,s);function o(a,u,c,l){if(o.__super__.constructor.call(this,a),c==null)throw new Error("Missing entity name");if(l==null)throw new Error("Missing entity value");if(this.pe=!!u,this.name=this.stringify.eleName(c),!r(l))this.value=this.stringify.dtdEntityValue(l);else{if(!l.pubID&&!l.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(l.pubID&&!l.sysID)throw new Error("System identifier is required for a public external entity");if(l.pubID!=null&&(this.pubID=this.stringify.dtdPubID(l.pubID)),l.sysID!=null&&(this.sysID=this.stringify.dtdSysID(l.sysID)),l.nData!=null&&(this.nData=this.stringify.dtdNData(l.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}}return o.prototype.toString=function(a){return this.options.writer.set(a).dtdEntity(this)},o}(e)}).call(ul)});var Ur=I((ll,fl)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=ke(),fl.exports=t=function(n){r(s,n);function s(o,a,u){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing DTD element name");u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.eleName(a),this.value=this.stringify.dtdElementValue(u)}return s.prototype.toString=function(o){return this.options.writer.set(o).dtdElement(this)},s}(e)}).call(ll)});var Vr=I((pl,dl)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;e=ke(),dl.exports=t=function(n){r(s,n);function s(o,a,u){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing notation name");if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(a),u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return s.prototype.toString=function(o){return this.options.writer.set(o).dtdNotation(this)},s}(e)}).call(pl)});var jr=I((hl,ml)=>{(function(){var t,e,r,i,n,s,o,a=function(c,l){for(var d in l)u.call(l,d)&&(c[d]=l[d]);function v(){this.constructor=c}return v.prototype=l.prototype,c.prototype=new v,c.__super__=l.prototype,c},u={}.hasOwnProperty;o=St().isObject,s=ke(),t=Fr(),r=Br(),e=Ur(),i=Vr(),ml.exports=n=function(c){a(l,c);function l(d,v,A){var g,E;l.__super__.constructor.call(this,d),this.documentObject=d,o(v)&&(g=v,v=g.pubID,A=g.sysID),A==null&&(E=[v,A],A=E[0],v=E[1]),v!=null&&(this.pubID=this.stringify.dtdPubID(v)),A!=null&&(this.sysID=this.stringify.dtdSysID(A))}return l.prototype.element=function(d,v){var A;return A=new e(this,d,v),this.children.push(A),this},l.prototype.attList=function(d,v,A,g,E){var P;return P=new t(this,d,v,A,g,E),this.children.push(P),this},l.prototype.entity=function(d,v){var A;return A=new r(this,!1,d,v),this.children.push(A),this},l.prototype.pEntity=function(d,v){var A;return A=new r(this,!0,d,v),this.children.push(A),this},l.prototype.notation=function(d,v){var A;return A=new i(this,d,v),this.children.push(A),this},l.prototype.toString=function(d){return this.options.writer.set(d).docType(this)},l.prototype.ele=function(d,v){return this.element(d,v)},l.prototype.att=function(d,v,A,g,E){return this.attList(d,v,A,g,E)},l.prototype.ent=function(d,v){return this.entity(d,v)},l.prototype.pent=function(d,v){return this.pEntity(d,v)},l.prototype.not=function(d,v){return this.notation(d,v)},l.prototype.up=function(){return this.root()||this.documentObject},l}(s)}).call(hl)});var Wr=I((vl,gl)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;t=ke(),gl.exports=e=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing raw text");this.value=this.stringify.raw(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).raw(this)},s}(t)}).call(vl)});var Hr=I((yl,El)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;t=ke(),El.exports=e=function(n){r(s,n);function s(o,a){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing element text");this.value=this.stringify.eleText(a)}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).text(this)},s}(t)}).call(yl)});var zr=I((Sl,wl)=>{(function(){var t,e,r=function(n,s){for(var o in s)i.call(s,o)&&(n[o]=s[o]);function a(){this.constructor=n}return a.prototype=s.prototype,n.prototype=new a,n.__super__=s.prototype,n},i={}.hasOwnProperty;t=ke(),wl.exports=e=function(n){r(s,n);function s(o,a,u){if(s.__super__.constructor.call(this,o),a==null)throw new Error("Missing instruction target");this.target=this.stringify.insTarget(a),u&&(this.value=this.stringify.insValue(u))}return s.prototype.clone=function(){return Object.create(this)},s.prototype.toString=function(o){return this.options.writer.set(o).processingInstruction(this)},s}(t)}).call(Sl)});var ke=I((Cl,Tl)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,d,v,A={}.hasOwnProperty;v=St(),d=v.isObject,l=v.isFunction,c=v.isEmpty,n=null,t=null,e=null,r=null,i=null,a=null,u=null,o=null,Tl.exports=s=function(){function g(E){this.parent=E,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.children=[],n||(n=kr(),t=Or(),e=Lr(),r=Mr(),i=jr(),a=Wr(),u=Hr(),o=zr())}return g.prototype.element=function(E,P,S){var h,w,R,N,T,_,O,W,M,H;if(_=null,P==null&&(P={}),P=P.valueOf(),d(P)||(M=[P,S],S=M[0],P=M[1]),E!=null&&(E=E.valueOf()),Array.isArray(E))for(R=0,O=E.length;R{(function(){var t,e=function(i,n){return function(){return i.apply(n,arguments)}},r={}.hasOwnProperty;Al.exports=t=function(){function i(n){this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;n||(n={}),this.noDoubleEncoding=n.noDoubleEncoding,o=n.stringify||{};for(s in o)r.call(o,s)&&(a=o[s],this[s]=a)}return i.prototype.eleName=function(n){return n=""+n||"",this.assertLegalChar(n)},i.prototype.eleText=function(n){return n=""+n||"",this.assertLegalChar(this.elEscape(n))},i.prototype.cdata=function(n){return n=""+n||"",n=n.replace("]]>","]]]]>"),this.assertLegalChar(n)},i.prototype.comment=function(n){if(n=""+n||"",n.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+n);return this.assertLegalChar(n)},i.prototype.raw=function(n){return""+n||""},i.prototype.attName=function(n){return n=""+n||""},i.prototype.attValue=function(n){return n=""+n||"",this.attEscape(n)},i.prototype.insTarget=function(n){return""+n||""},i.prototype.insValue=function(n){if(n=""+n||"",n.match(/\?>/))throw new Error("Invalid processing instruction value: "+n);return n},i.prototype.xmlVersion=function(n){if(n=""+n||"",!n.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+n);return n},i.prototype.xmlEncoding=function(n){if(n=""+n||"",!n.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+n);return n},i.prototype.xmlStandalone=function(n){return n?"yes":"no"},i.prototype.dtdPubID=function(n){return""+n||""},i.prototype.dtdSysID=function(n){return""+n||""},i.prototype.dtdElementValue=function(n){return""+n||""},i.prototype.dtdAttType=function(n){return""+n||""},i.prototype.dtdAttDefault=function(n){return n!=null?""+n||"":n},i.prototype.dtdEntityValue=function(n){return""+n||""},i.prototype.dtdNData=function(n){return""+n||""},i.prototype.convertAttKey="@",i.prototype.convertPIKey="?",i.prototype.convertTextKey="#text",i.prototype.convertCDataKey="#cdata",i.prototype.convertCommentKey="#comment",i.prototype.convertRawKey="#raw",i.prototype.assertLegalChar=function(n){var s;if(s=n.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),s)throw new Error("Invalid character in string: "+n+" at index "+s.index);return n},i.prototype.elEscape=function(n){var s;return s=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&").replace(//g,">").replace(/\r/g," ")},i.prototype.attEscape=function(n){var s;return s=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&").replace(/{(function(){var t,e={}.hasOwnProperty;bl.exports=t=function(){function r(i){var n,s,o,a,u,c,l,d,v;i||(i={}),this.pretty=i.pretty||!1,this.allowEmpty=(s=i.allowEmpty)!=null?s:!1,this.pretty?(this.indent=(o=i.indent)!=null?o:" ",this.newline=(a=i.newline)!=null?a:` +`,this.offset=(u=i.offset)!=null?u:0,this.dontprettytextnodes=(c=i.dontprettytextnodes)!=null?c:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash=(l=i.spacebeforeslash)!=null?l:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,d=i.writer||{};for(n in d)e.call(d,n)&&(v=d[n],this[n]=v)}return r.prototype.set=function(i){var n,s,o;i||(i={}),"pretty"in i&&(this.pretty=i.pretty),"allowEmpty"in i&&(this.allowEmpty=i.allowEmpty),this.pretty?(this.indent="indent"in i?i.indent:" ",this.newline="newline"in i?i.newline:` +`,this.offset="offset"in i?i.offset:0,this.dontprettytextnodes="dontprettytextnodes"in i?i.dontprettytextnodes:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash="spacebeforeslash"in i?i.spacebeforeslash:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,s=i.writer||{};for(n in s)e.call(s,n)&&(o=s[n],this[n]=o);return this},r.prototype.space=function(i){var n;return this.pretty?(n=(i||0)+this.offset+1,n>0?new Array(n).join(this.indent):""):""},r}()}).call(xl)});var Yi=I((Rl,Il)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,d,v,A,g=function(P,S){for(var h in S)E.call(S,h)&&(P[h]=S[h]);function w(){this.constructor=P}return w.prototype=S.prototype,P.prototype=new w,P.__super__=S.prototype,P},E={}.hasOwnProperty;o=Mr(),a=jr(),t=Or(),e=Lr(),u=kr(),l=Wr(),v=Hr(),c=zr(),r=Fr(),i=Ur(),n=Br(),s=Vr(),A=ws(),Il.exports=d=function(P){g(S,P);function S(h){S.__super__.constructor.call(this,h)}return S.prototype.document=function(h){var w,R,N,T,_;for(this.textispresent=!1,T="",_=h.children,R=0,N=_.length;R"+this.newline},S.prototype.comment=function(h,w){return this.space(w)+""+this.newline},S.prototype.declaration=function(h,w){var R;return R=this.space(w),R+='",R+=this.newline,R},S.prototype.docType=function(h,w){var R,N,T,_,O;if(w||(w=0),_=this.space(w),_+="0){for(_+=" [",_+=this.newline,O=h.children,N=0,T=O.length;N",_+=this.newline,_},S.prototype.element=function(h,w){var R,N,T,_,O,W,M,H,x,ge,pe,Q,Oe;w||(w=0),Oe=!1,this.textispresent?(this.newline="",this.pretty=!1):(this.newline=this.newlinedefault,this.pretty=this.prettydefault),Q=this.space(w),H="",H+=Q+"<"+h.name,x=h.attributes;for(M in x)E.call(x,M)&&(R=x[M],H+=this.attribute(R));if(h.children.length===0||h.children.every(function(ut){return ut.value===""}))this.allowEmpty?H+=">"+this.newline:H+=this.spacebeforeslash+"/>"+this.newline;else if(this.pretty&&h.children.length===1&&h.children[0].value!=null)H+=">",H+=h.children[0].value,H+=""+this.newline;else{if(this.dontprettytextnodes){for(ge=h.children,T=0,O=ge.length;T"+this.newline,pe=h.children,_=0,W=pe.length;_"+this.newline}return H},S.prototype.processingInstruction=function(h,w){var R;return R=this.space(w)+""+this.newline,R},S.prototype.raw=function(h,w){return this.space(w)+h.value+this.newline},S.prototype.text=function(h,w){return this.space(w)+h.value+this.newline},S.prototype.dtdAttList=function(h,w){var R;return R=this.space(w)+""+this.newline,R},S.prototype.dtdElement=function(h,w){return this.space(w)+""+this.newline},S.prototype.dtdEntity=function(h,w){var R;return R=this.space(w)+""+this.newline,R},S.prototype.dtdNotation=function(h,w){var R;return R=this.space(w)+""+this.newline,R},S.prototype.openNode=function(h,w){var R,N,T,_;if(w||(w=0),h instanceof u){T=this.space(w)+"<"+h.name,_=h.attributes;for(N in _)E.call(_,N)&&(R=_[N],T+=this.attribute(R));return T+=(h.children?">":"/>")+this.newline,T}else return T=this.space(w)+"")+this.newline,T},S.prototype.closeNode=function(h,w){switch(w||(w=0),!1){case!(h instanceof u):return this.space(w)+""+this.newline;case!(h instanceof a):return this.space(w)+"]>"+this.newline}},S}(A)}).call(Rl)});var Dl=I((Pl,Nl)=>{(function(){var t,e,r,i,n,s=function(a,u){for(var c in u)o.call(u,c)&&(a[c]=u[c]);function l(){this.constructor=a}return l.prototype=u.prototype,a.prototype=new l,a.__super__=u.prototype,a},o={}.hasOwnProperty;n=St().isPlainObject,e=ke(),i=Ss(),r=Yi(),Nl.exports=t=function(a){s(u,a);function u(c){u.__super__.constructor.call(this,null),c||(c={}),c.writer||(c.writer=new r),this.options=c,this.stringify=new i(c),this.isDocument=!0}return u.prototype.end=function(c){var l;return c?n(c)&&(l=c,c=this.options.writer.set(l)):c=this.options.writer,c.document(this)},u.prototype.toString=function(c){return this.options.writer.set(c).document(this)},u}(e)}).call(Pl)});var Ol=I((ql,kl)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,d,v,A,g,E,P,S,h,w,R={}.hasOwnProperty;w=St(),S=w.isObject,P=w.isFunction,h=w.isPlainObject,l=kr(),e=Or(),r=Lr(),v=Wr(),E=Hr(),d=zr(),a=Mr(),u=jr(),i=Fr(),s=Br(),n=Ur(),o=Vr(),t=Es(),g=Ss(),A=Yi(),kl.exports=c=function(){function N(T,_,O){var W;T||(T={}),T.writer?h(T.writer)&&(W=T.writer,T.writer=new A(W)):T.writer=new A(T),this.options=T,this.writer=T.writer,this.stringify=new g(T),this.onDataCallback=_||function(){},this.onEndCallback=O||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return N.prototype.node=function(T,_,O){var W;if(T==null)throw new Error("Missing node name");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node");return this.openCurrent(),T=T.valueOf(),_==null&&(_={}),_=_.valueOf(),S(_)||(W=[_,O],O=W[0],_=W[1]),this.currentNode=new l(this,T,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,O!=null&&this.text(O),this},N.prototype.element=function(T,_,O){return this.currentNode&&this.currentNode instanceof u?this.dtdElement.apply(this,arguments):this.node(T,_,O)},N.prototype.attribute=function(T,_){var O,W;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode");if(T!=null&&(T=T.valueOf()),S(T))for(O in T)R.call(T,O)&&(W=T[O],this.attribute(O,W));else P(_)&&(_=_.apply()),(!this.options.skipNullAttributes||_!=null)&&(this.currentNode.attributes[T]=new t(this,T,_));return this},N.prototype.text=function(T){var _;return this.openCurrent(),_=new E(this,T),this.onData(this.writer.text(_,this.currentLevel+1)),this},N.prototype.cdata=function(T){var _;return this.openCurrent(),_=new e(this,T),this.onData(this.writer.cdata(_,this.currentLevel+1)),this},N.prototype.comment=function(T){var _;return this.openCurrent(),_=new r(this,T),this.onData(this.writer.comment(_,this.currentLevel+1)),this},N.prototype.raw=function(T){var _;return this.openCurrent(),_=new v(this,T),this.onData(this.writer.raw(_,this.currentLevel+1)),this},N.prototype.instruction=function(T,_){var O,W,M,H,x;if(this.openCurrent(),T!=null&&(T=T.valueOf()),_!=null&&(_=_.valueOf()),Array.isArray(T))for(O=0,H=T.length;O=0;)this.up();return this.onEnd()},N.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},N.prototype.openNode=function(T){if(!T.isOpen)return!this.root&&this.currentLevel===0&&T instanceof l&&(this.root=T),this.onData(this.writer.openNode(T,this.currentLevel)),T.isOpen=!0},N.prototype.closeNode=function(T){if(!T.isClosed)return this.onData(this.writer.closeNode(T,this.currentLevel)),T.isClosed=!0},N.prototype.onData=function(T){return this.documentStarted=!0,this.onDataCallback(T)},N.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},N.prototype.ele=function(){return this.element.apply(this,arguments)},N.prototype.nod=function(T,_,O){return this.node(T,_,O)},N.prototype.txt=function(T){return this.text(T)},N.prototype.dat=function(T){return this.cdata(T)},N.prototype.com=function(T){return this.comment(T)},N.prototype.ins=function(T,_){return this.instruction(T,_)},N.prototype.dec=function(T,_,O){return this.declaration(T,_,O)},N.prototype.dtd=function(T,_,O){return this.doctype(T,_,O)},N.prototype.e=function(T,_,O){return this.element(T,_,O)},N.prototype.n=function(T,_,O){return this.node(T,_,O)},N.prototype.t=function(T){return this.text(T)},N.prototype.d=function(T){return this.cdata(T)},N.prototype.c=function(T){return this.comment(T)},N.prototype.r=function(T){return this.raw(T)},N.prototype.i=function(T,_){return this.instruction(T,_)},N.prototype.att=function(){return this.currentNode&&this.currentNode instanceof u?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},N.prototype.a=function(){return this.currentNode&&this.currentNode instanceof u?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},N.prototype.ent=function(T,_){return this.entity(T,_)},N.prototype.pent=function(T,_){return this.pEntity(T,_)},N.prototype.not=function(T,_){return this.notation(T,_)},N}()}).call(ql)});var Fl=I((Ll,Ml)=>{(function(){var t,e,r,i,n,s,o,a,u,c,l,d,v,A,g=function(P,S){for(var h in S)E.call(S,h)&&(P[h]=S[h]);function w(){this.constructor=P}return w.prototype=S.prototype,P.prototype=new w,P.__super__=S.prototype,P},E={}.hasOwnProperty;o=Mr(),a=jr(),t=Or(),e=Lr(),u=kr(),l=Wr(),v=Hr(),c=zr(),r=Fr(),i=Ur(),n=Br(),s=Vr(),A=ws(),Ml.exports=d=function(P){g(S,P);function S(h,w){S.__super__.constructor.call(this,w),this.stream=h}return S.prototype.document=function(h){var w,R,N,T,_,O,W,M;for(O=h.children,R=0,T=O.length;R"+this.endline(h))},S.prototype.comment=function(h,w){return this.stream.write(this.space(w)+""+this.endline(h))},S.prototype.declaration=function(h,w){return this.stream.write(this.space(w)),this.stream.write('"),this.stream.write(this.endline(h))},S.prototype.docType=function(h,w){var R,N,T,_;if(w||(w=0),this.stream.write(this.space(w)),this.stream.write("0){for(this.stream.write(" ["),this.stream.write(this.endline(h)),_=h.children,N=0,T=_.length;N"),this.stream.write(this.endline(h))},S.prototype.element=function(h,w){var R,N,T,_,O,W,M,H;w||(w=0),H=this.space(w),this.stream.write(H+"<"+h.name),W=h.attributes;for(O in W)E.call(W,O)&&(R=W[O],this.attribute(R));if(h.children.length===0||h.children.every(function(x){return x.value===""}))this.allowEmpty?this.stream.write(">"):this.stream.write(this.spacebeforeslash+"/>");else if(this.pretty&&h.children.length===1&&h.children[0].value!=null)this.stream.write(">"),this.stream.write(h.children[0].value),this.stream.write("");else{for(this.stream.write(">"+this.newline),M=h.children,T=0,_=M.length;T<_;T++)switch(N=M[T],!1){case!(N instanceof t):this.cdata(N,w+1);break;case!(N instanceof e):this.comment(N,w+1);break;case!(N instanceof u):this.element(N,w+1);break;case!(N instanceof l):this.raw(N,w+1);break;case!(N instanceof v):this.text(N,w+1);break;case!(N instanceof c):this.processingInstruction(N,w+1);break;default:throw new Error("Unknown XML node type: "+N.constructor.name)}this.stream.write(H+"")}return this.stream.write(this.endline(h))},S.prototype.processingInstruction=function(h,w){return this.stream.write(this.space(w)+""+this.endline(h))},S.prototype.raw=function(h,w){return this.stream.write(this.space(w)+h.value+this.endline(h))},S.prototype.text=function(h,w){return this.stream.write(this.space(w)+h.value+this.endline(h))},S.prototype.dtdAttList=function(h,w){return this.stream.write(this.space(w)+""+this.endline(h))},S.prototype.dtdElement=function(h,w){return this.stream.write(this.space(w)+""+this.endline(h))},S.prototype.dtdEntity=function(h,w){return this.stream.write(this.space(w)+""+this.endline(h))},S.prototype.dtdNotation=function(h,w){return this.stream.write(this.space(w)+""+this.endline(h))},S.prototype.endline=function(h){return h.isLastRootNode?"":this.newline},S}(A)}).call(Ll)});var Ul=I((Bl,Kr)=>{(function(){var t,e,r,i,n,s,o;o=St(),n=o.assign,s=o.isFunction,t=Dl(),e=Ol(),i=Yi(),r=Fl(),Kr.exports.create=function(a,u,c,l){var d,v;if(a==null)throw new Error("Root element needs a name");return l=n({},u,c,l),d=new t(l),v=d.element(a),l.headless||(d.declaration(l),(l.pubID!=null||l.sysID!=null)&&d.doctype(l)),v},Kr.exports.begin=function(a,u,c){var l;return s(a)&&(l=[a,u],u=l[0],c=l[1],a={}),u?new e(a,u,c):new t(a)},Kr.exports.stringWriter=function(a){return new i(a)},Kr.exports.streamWriter=function(a,u){return new r(a,u)}}).call(Bl)});var Vl=I(Cs=>{(function(){"use strict";var t,e,r,i,n,s={}.hasOwnProperty;t=Ul(),e=$i().defaults,i=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},n=function(o){return""},r=function(o){return o.replace("]]>","]]]]>")},Cs.Builder=function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,d,v;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(v=Object.keys(a)[0],a=a[v]):v=this.options.rootName,l=function(A){return function(g,E){var P,S,h,w,R,N;if(typeof E!="object")A.options.cdata&&i(E)?g.raw(n(E)):g.txt(E);else if(Array.isArray(E)){for(w in E)if(s.call(E,w)){S=E[w];for(R in S)h=S[R],g=l(g.ele(R),h).up()}}else for(R in E)if(s.call(E,R))if(S=E[R],R===u){if(typeof S=="object")for(P in S)N=S[P],g=g.att(P,N)}else if(R===c)A.options.cdata&&i(S)?g=g.raw(n(S)):g=g.txt(S);else if(Array.isArray(S))for(w in S)s.call(S,w)&&(h=S[w],typeof h=="string"?A.options.cdata&&i(h)?g=g.ele(R).raw(n(h)).up():g=g.ele(R,h).up():g=l(g.ele(R),h).up());else typeof S=="object"?g=l(g.ele(R),S).up():typeof S=="string"&&A.options.cdata&&i(S)?g=g.ele(R).raw(n(S)).up():(S==null&&(S=""),g=g.ele(R,S.toString()).up());return g}}(this),d=t.create(v,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(d,a).end(this.options.renderOpts)},o}()}).call(Cs)});var jl=I(Ji=>{(function(t){t.parser=function(m,f){return new r(m,f)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(m,f){if(!(this instanceof r))return new r(m,f);var q=this;n(q),q.q=q.c="",q.bufferCheckPosition=t.MAX_BUFFER_LENGTH,q.opt=f||{},q.opt.lowercase=q.opt.lowercase||q.opt.lowercasetags,q.looseCase=q.opt.lowercase?"toLowerCase":"toUpperCase",q.tags=[],q.closed=q.closedRoot=q.sawRoot=!1,q.tag=q.error=null,q.strict=!!m,q.noscript=!!(m||q.opt.noscript),q.state=x.BEGIN,q.strictEntities=q.opt.strictEntities,q.ENTITIES=q.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),q.attribList=[],q.opt.xmlns&&(q.ns=Object.create(w)),q.trackPosition=q.opt.position!==!1,q.trackPosition&&(q.position=q.line=q.column=0),pe(q,"onready")}Object.create||(Object.create=function(m){function f(){}f.prototype=m;var q=new f;return q}),Object.keys||(Object.keys=function(m){var f=[];for(var q in m)m.hasOwnProperty(q)&&f.push(q);return f});function i(m){for(var f=Math.max(t.MAX_BUFFER_LENGTH,10),q=0,b=0,J=e.length;bf)switch(e[b]){case"textNode":Oe(m);break;case"cdata":Q(m,"oncdata",m.cdata),m.cdata="";break;case"script":Q(m,"onscript",m.script),m.script="";break;default:ct(m,"Max buffer length exceeded: "+e[b])}q=Math.max(q,ae)}var ue=t.MAX_BUFFER_LENGTH-q;m.bufferCheckPosition=ue+m.position}function n(m){for(var f=0,q=e.length;f",E="[CDATA[",P="DOCTYPE",S="http://www.w3.org/XML/1998/namespace",h="http://www.w3.org/2000/xmlns/",w={xml:S,xmlns:h};l=O(l),d=O(d),v=O(v);var R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,N=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,T=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;A=O(A),g=O(g);function O(m){return m.split("").reduce(function(f,q){return f[q]=!0,f},{})}function W(m){return Object.prototype.toString.call(m)==="[object RegExp]"}function M(m,f){return W(m)?!!f.match(m):m[f]}function H(m,f){return!M(m,f)}var x=0;t.STATE={BEGIN:x++,BEGIN_WHITESPACE:x++,TEXT:x++,TEXT_ENTITY:x++,OPEN_WAKA:x++,SGML_DECL:x++,SGML_DECL_QUOTED:x++,DOCTYPE:x++,DOCTYPE_QUOTED:x++,DOCTYPE_DTD:x++,DOCTYPE_DTD_QUOTED:x++,COMMENT_STARTING:x++,COMMENT:x++,COMMENT_ENDING:x++,COMMENT_ENDED:x++,CDATA:x++,CDATA_ENDING:x++,CDATA_ENDING_2:x++,PROC_INST:x++,PROC_INST_BODY:x++,PROC_INST_ENDING:x++,OPEN_TAG:x++,OPEN_TAG_SLASH:x++,ATTRIB:x++,ATTRIB_NAME:x++,ATTRIB_NAME_SAW_WHITE:x++,ATTRIB_VALUE:x++,ATTRIB_VALUE_QUOTED:x++,ATTRIB_VALUE_CLOSED:x++,ATTRIB_VALUE_UNQUOTED:x++,ATTRIB_VALUE_ENTITY_Q:x++,ATTRIB_VALUE_ENTITY_U:x++,CLOSE_TAG:x++,CLOSE_TAG_SAW_WHITE:x++,SCRIPT:x++,SCRIPT_ENDING:x++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var f=t.ENTITIES[m],q=typeof f=="number"?String.fromCharCode(f):f;t.ENTITIES[m]=q});for(var ge in t.STATE)t.STATE[t.STATE[ge]]=ge;x=t.STATE;function pe(m,f,q){m[f]&&m[f](q)}function Q(m,f,q){m.textNode&&Oe(m),pe(m,f,q)}function Oe(m){m.textNode=ut(m.opt,m.textNode),m.textNode&&pe(m,"ontext",m.textNode),m.textNode=""}function ut(m,f){return m.trim&&(f=f.trim()),m.normalize&&(f=f.replace(/\s+/g," ")),f}function ct(m,f){return Oe(m),m.trackPosition&&(f+=` Line: `+m.line+` Column: `+m.column+` -Char: `+m.c),f=new Error(f),m.error=f,fe(m,"onerror",f),m}function xt(m){return m.sawRoot&&!m.closedRoot&&$(m,"Unclosed root tag"),m.state!==A.BEGIN&&m.state!==A.BEGIN_WHITESPACE&&m.state!==A.TEXT&&nt(m,"Unexpected end"),Pe(m),m.c="",m.closed=!0,fe(m,"onend"),r.call(m,m.strict,m.opt),m}function $(m,f){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&nt(m,f)}function jt(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var f=m.tags[m.tags.length-1]||m,q=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(q.ns=f.ns),m.attribList.length=0,Q(m,"onopentagstart",q)}function gt(m,f){var q=m.indexOf(":"),x=q<0?["",m]:m.split(":"),J=x[0],ae=x[1];return f&&m==="xmlns"&&(J="xmlns",ae=""),{prefix:J,local:ae}}function Le(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var f=gt(m.attribName,!0),q=f.prefix,x=f.local;if(q==="xmlns")if(x==="xml"&&m.attribValue!==S)$(m,"xml: prefix must be bound to "+S+` -Actual: `+m.attribValue);else if(x==="xmlns"&&m.attribValue!==d)$(m,"xmlns: prefix must be bound to "+d+` -Actual: `+m.attribValue);else{var J=m.tag,ae=m.tags[m.tags.length-1]||m;J.ns===ae.ns&&(J.ns=Object.create(ae.ns)),J.ns[x]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,Q(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function Ce(m,f){if(m.opt.xmlns){var q=m.tag,x=gt(m.tagName);q.prefix=x.prefix,q.local=x.local,q.uri=q.ns[x.prefix]||"",q.prefix&&!q.uri&&($(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),q.uri=x.prefix);var J=m.tags[m.tags.length-1]||m;q.ns&&J.ns!==q.ns&&Object.keys(q.ns).forEach(function(Mr){Q(m,"onopennamespace",{prefix:Mr,uri:q.ns[Mr]})});for(var ae=0,ue=m.attribList.length;ae",m.tagName="",m.state=A.SCRIPT;return}Q(m,"onscript",m.script),m.script=""}var f=m.tags.length,q=m.tagName;m.strict||(q=q[m.looseCase]());for(var x=q;f--;){var J=m.tags[f];if(J.name!==x)$(m,"Unexpected close tag");else break}if(f<0){$(m,"Unmatched closing tag: "+m.tagName),m.textNode+="",m.state=A.TEXT;return}m.tagName=q;for(var ae=m.tags.length;ae-- >f;){var ue=m.tag=m.tags.pop();m.tagName=m.tag.name,Q(m,"onclosetag",m.tagName);var we={};for(var xe in ue.ns)we[xe]=ue.ns[xe];var H=m.tags[m.tags.length-1]||m;m.opt.xmlns&&ue.ns!==H.ns&&Object.keys(ue.ns).forEach(function(ce){var ke=ue.ns[ce];Q(m,"onclosenamespace",{prefix:ce,uri:ke})})}f===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=A.TEXT}function Rt(m){var f=m.entity,q=f.toLowerCase(),x,J="";return m.ENTITIES[f]?m.ENTITIES[f]:m.ENTITIES[q]?m.ENTITIES[q]:(f=q,f.charAt(0)==="#"&&(f.charAt(1)==="x"?(f=f.slice(2),x=parseInt(f,16),J=x.toString(16)):(f=f.slice(1),x=parseInt(f,10),J=x.toString(10))),f=f.replace(/^0+/,""),J.toLowerCase()!==f?($(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(x))}function Vt(m,f){f==="<"?(m.state=A.OPEN_WAKA,m.startTagPosition=m.position):W(l,f)&&($(m,"Non-whitespace before first tag."),m.textNode=f,m.state=A.TEXT)}function Et(m,f){var q="";return f"?(Q(f,"onsgmldeclaration",f.sgmlDecl),f.sgmlDecl="",f.state=A.TEXT):(M(b,x)&&(f.state=A.SGML_DECL_QUOTED),f.sgmlDecl+=x);continue;case A.SGML_DECL_QUOTED:x===f.q&&(f.state=A.SGML_DECL,f.q=""),f.sgmlDecl+=x;continue;case A.DOCTYPE:x===">"?(f.state=A.TEXT,Q(f,"ondoctype",f.doctype),f.doctype=!0):(f.doctype+=x,x==="["?f.state=A.DOCTYPE_DTD:M(b,x)&&(f.state=A.DOCTYPE_QUOTED,f.q=x));continue;case A.DOCTYPE_QUOTED:f.doctype+=x,x===f.q&&(f.q="",f.state=A.DOCTYPE);continue;case A.DOCTYPE_DTD:f.doctype+=x,x==="]"?f.state=A.DOCTYPE:M(b,x)&&(f.state=A.DOCTYPE_DTD_QUOTED,f.q=x);continue;case A.DOCTYPE_DTD_QUOTED:f.doctype+=x,x===f.q&&(f.state=A.DOCTYPE_DTD,f.q="");continue;case A.COMMENT:x==="-"?f.state=A.COMMENT_ENDING:f.comment+=x;continue;case A.COMMENT_ENDING:x==="-"?(f.state=A.COMMENT_ENDED,f.comment=it(f.opt,f.comment),f.comment&&Q(f,"oncomment",f.comment),f.comment=""):(f.comment+="-"+x,f.state=A.COMMENT);continue;case A.COMMENT_ENDED:x!==">"?($(f,"Malformed comment"),f.comment+="--"+x,f.state=A.COMMENT):f.state=A.TEXT;continue;case A.CDATA:x==="]"?f.state=A.CDATA_ENDING:f.cdata+=x;continue;case A.CDATA_ENDING:x==="]"?f.state=A.CDATA_ENDING_2:(f.cdata+="]"+x,f.state=A.CDATA);continue;case A.CDATA_ENDING_2:x===">"?(f.cdata&&Q(f,"oncdata",f.cdata),Q(f,"onclosecdata"),f.cdata="",f.state=A.TEXT):x==="]"?f.cdata+="]":(f.cdata+="]]"+x,f.state=A.CDATA);continue;case A.PROC_INST:x==="?"?f.state=A.PROC_INST_ENDING:M(l,x)?f.state=A.PROC_INST_BODY:f.procInstName+=x;continue;case A.PROC_INST_BODY:if(!f.procInstBody&&M(l,x))continue;x==="?"?f.state=A.PROC_INST_ENDING:f.procInstBody+=x;continue;case A.PROC_INST_ENDING:x===">"?(Q(f,"onprocessinginstruction",{name:f.procInstName,body:f.procInstBody}),f.procInstName=f.procInstBody="",f.state=A.TEXT):(f.procInstBody+="?"+x,f.state=A.PROC_INST_BODY);continue;case A.OPEN_TAG:M(N,x)?f.tagName+=x:(jt(f),x===">"?Ce(f):x==="/"?f.state=A.OPEN_TAG_SLASH:(W(l,x)&&$(f,"Invalid character in tag name"),f.state=A.ATTRIB));continue;case A.OPEN_TAG_SLASH:x===">"?(Ce(f,!0),st(f)):($(f,"Forward-slash in opening tag not followed by >"),f.state=A.ATTRIB);continue;case A.ATTRIB:if(M(l,x))continue;x===">"?Ce(f):x==="/"?f.state=A.OPEN_TAG_SLASH:M(R,x)?(f.attribName=x,f.attribValue="",f.state=A.ATTRIB_NAME):$(f,"Invalid attribute name");continue;case A.ATTRIB_NAME:x==="="?f.state=A.ATTRIB_VALUE:x===">"?($(f,"Attribute without value"),f.attribValue=f.attribName,Le(f),Ce(f)):M(l,x)?f.state=A.ATTRIB_NAME_SAW_WHITE:M(N,x)?f.attribName+=x:$(f,"Invalid attribute name");continue;case A.ATTRIB_NAME_SAW_WHITE:if(x==="=")f.state=A.ATTRIB_VALUE;else{if(M(l,x))continue;$(f,"Attribute without value"),f.tag.attributes[f.attribName]="",f.attribValue="",Q(f,"onattribute",{name:f.attribName,value:""}),f.attribName="",x===">"?Ce(f):M(R,x)?(f.attribName=x,f.state=A.ATTRIB_NAME):($(f,"Invalid attribute name"),f.state=A.ATTRIB)}continue;case A.ATTRIB_VALUE:if(M(l,x))continue;M(b,x)?(f.q=x,f.state=A.ATTRIB_VALUE_QUOTED):($(f,"Unquoted attribute value"),f.state=A.ATTRIB_VALUE_UNQUOTED,f.attribValue=x);continue;case A.ATTRIB_VALUE_QUOTED:if(x!==f.q){x==="&"?f.state=A.ATTRIB_VALUE_ENTITY_Q:f.attribValue+=x;continue}Le(f),f.q="",f.state=A.ATTRIB_VALUE_CLOSED;continue;case A.ATTRIB_VALUE_CLOSED:M(l,x)?f.state=A.ATTRIB:x===">"?Ce(f):x==="/"?f.state=A.OPEN_TAG_SLASH:M(R,x)?($(f,"No whitespace between attributes"),f.attribName=x,f.attribValue="",f.state=A.ATTRIB_NAME):$(f,"Invalid attribute name");continue;case A.ATTRIB_VALUE_UNQUOTED:if(W(y,x)){x==="&"?f.state=A.ATTRIB_VALUE_ENTITY_U:f.attribValue+=x;continue}Le(f),x===">"?Ce(f):f.state=A.ATTRIB;continue;case A.CLOSE_TAG:if(f.tagName)x===">"?st(f):M(N,x)?f.tagName+=x:f.script?(f.script+=""?st(f):$(f,"Invalid characters in closing tag");continue;case A.TEXT_ENTITY:case A.ATTRIB_VALUE_ENTITY_Q:case A.ATTRIB_VALUE_ENTITY_U:var ue,we;switch(f.state){case A.TEXT_ENTITY:ue=A.TEXT,we="textNode";break;case A.ATTRIB_VALUE_ENTITY_Q:ue=A.ATTRIB_VALUE_QUOTED,we="attribValue";break;case A.ATTRIB_VALUE_ENTITY_U:ue=A.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}x===";"?(f[we]+=Rt(f),f.entity="",f.state=ue):M(f.entity.length?T:C,x)?f.entity+=x:($(f,"Invalid character in entity name"),f[we]+="&"+f.entity+x,f.entity="",f.state=ue);continue;default:throw new Error(f,"Unknown state: "+f.state)}return f.position>=f.bufferCheckPosition&&i(f),f}String.fromCodePoint||function(){var m=String.fromCharCode,f=Math.floor,q=function(){var x=16384,J=[],ae,ue,we=-1,xe=arguments.length;if(!xe)return"";for(var H="";++we1114111||f(ce)!==ce)throw RangeError("Invalid code point: "+ce);ce<=65535?J.push(ce):(ce-=65536,ae=(ce>>10)+55296,ue=ce%1024+56320,J.push(ae,ue)),(we+1===xe||J.length>x)&&(H+=m.apply(null,J),J.length=0)}return H};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:q,configurable:!0,writable:!0}):String.fromCodePoint=q}()})(typeof Pi=="undefined"?Pi.sax={}:Pi)});var Uc=I(Hn=>{(function(){"use strict";Hn.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Hn)});var zn=I(Bt=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Bt.normalize=function(e){return e.toLowerCase()},Bt.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Bt.stripPrefix=function(e){return e.replace(t,"")},Bt.parseNumbers=function(e){return isNaN(e)||(e=e%1==0?parseInt(e,10):parseFloat(e)),e},Bt.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Bt)});var jc=I(Ut=>{(function(){"use strict";var t,e,r,i,n,s,o,a,u=function(h,g){return function(){return h.apply(g,arguments)}},c=function(h,g){for(var b in g)l.call(g,b)&&(h[b]=g[b]);function y(){this.constructor=h}return y.prototype=g.prototype,h.prototype=new y,h.__super__=g.prototype,h},l={}.hasOwnProperty;o=Bc(),r=require("events"),t=Uc(),s=zn(),a=require("timers").setImmediate,e=Di().defaults,i=function(h){return typeof h=="object"&&h!=null&&Object.keys(h).length===0},n=function(h,g,b){var y,E,D;for(y=0,E=h.length;y0&&(N[S.options.childkey]=T),T=N;else if(M){M[S.options.childkey]=M[S.options.childkey]||[],L={};for(R in T)!l.call(T,R)||(L[R]=T[R]);M[S.options.childkey].push(L),delete T["#name"],Object.keys(T).length===1&&y in T&&!S.EXPLICIT_CHARKEY&&(T=T[y])}}return D.length>0?S.assignOrPush(M,C,T):(S.options.explicitRoot&&(X=T,T={},T[C]=X),S.resultObject=T,S.saxParser.ended=!0,S.emit("end",S.resultObject))}}(this),E=function(S){return function(d){var _,R;if(R=D[D.length-1],R)return R[y]+=d,S.options.explicitChildren&&S.options.preserveChildrenOrder&&S.options.charsAsChildren&&(S.options.includeWhiteChars||d.replace(/\\n/g,"").trim()!=="")&&(R[S.options.childkey]=R[S.options.childkey]||[],_={"#name":"__text__"},_[y]=d,S.options.normalize&&(_[y]=_[y].replace(/\s{2,}/g," ").trim()),R[S.options.childkey].push(_)),R}}(this),this.saxParser.ontext=E,this.saxParser.oncdata=function(S){return function(d){var _;if(_=E(d),_)return _.cdata=!0}}(this)},g.prototype.parseString=function(b,y){var E;y!=null&&typeof y=="function"&&(this.on("end",function(D){return this.reset(),y(null,D)}),this.on("error",function(D){return this.reset(),y(D)}));try{return b=b.toString(),b.trim()===""?(this.emit("end",null),!0):(b=t.stripBOM(b),this.options.async?(this.remaining=b,a(this.processAsync),this.saxParser):this.saxParser.write(b).close())}catch(D){if(E=D,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw E}else return this.emit("error",E),this.saxParser.errThrown=!0}},g}(r.EventEmitter),Ut.parseString=function(h,g,b){var y,E,D;return b!=null?(typeof b=="function"&&(y=b),typeof g=="object"&&(E=g)):(typeof g=="function"&&(y=g),E={}),D=new Ut.Parser(E),D.parseString(h,y)}}).call(Ut)});var Vc=I(Tt=>{(function(){"use strict";var t,e,r,i,n=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Di(),t=Fc(),r=jc(),i=zn(),Tt.defaults=e.defaults,Tt.processors=i,Tt.ValidationError=function(o){n(a,o);function a(u){this.message=u}return a}(Error),Tt.Builder=t.Builder,Tt.Parser=r.Parser,Tt.parseString=r.parseString}).call(Tt)});var Gc=I((rE,Kc)=>{var Xc=j(),qr=Xc.util,zm=Xc.Model.Shape,Km=Vc(),Gm={explicitCharkey:!1,trim:!1,normalize:!1,explicitRoot:!1,emptyTag:null,explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,validator:null};function Wc(){}Wc.prototype.parse=function(t,e){e=e||{};var r=null,i=null,n=new Km.Parser(Gm);if(n.parseString(t,function(o,a){i=o,r=a}),r){var s=yt(r,e);return r.ResponseMetadata&&(s.ResponseMetadata=yt(r.ResponseMetadata[0],{})),s}else{if(i)throw qr.error(i,{code:"XMLParserError",retryable:!0});return yt({},e)}};function yt(t,e){switch(e.type){case"structure":return $m(t,e);case"map":return Ym(t,e);case"list":return Hc(t,e);case void 0:case null:return Jm(t);default:return zc(t,e)}}function $m(t,e){var r={};return t===null||qr.each(e.members,function(i,n){var s=n.name;if(Object.prototype.hasOwnProperty.call(t,s)&&Array.isArray(t[s])){var o=t[s];n.flattened||(o=o[0]),r[i]=yt(o,n)}else n.isXmlAttribute&&t.$&&Object.prototype.hasOwnProperty.call(t.$,s)?r[i]=zc(t.$[s],n):n.type==="list"&&!e.api.xmlNoDefaultLists&&(r[i]=n.defaultValue)}),r}function Ym(t,e){var r={};if(t===null)return r;var i=e.key.name||"key",n=e.value.name||"value",s=e.flattened?t:t.entry;return Array.isArray(s)&&qr.arrayEach(s,function(o){r[o[i][0]]=yt(o[n][0],e.value)}),r}function Hc(t,e){var r=[],i=e.member.name||"member";return e.flattened?qr.arrayEach(t,function(n){r.push(yt(n,e.member))}):t&&Array.isArray(t[i])&&qr.arrayEach(t[i],function(n){r.push(yt(n,e.member))}),r}function zc(t,e){return t&&t.$&&t.$.encoding==="base64"&&(e=new zm.create({type:t.$.encoding})),t&&t._&&(t=t._),typeof e.toType=="function"?e.toType(t):t}function Jm(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t)){var e=[];for(i=0;i1?n[s]=Hc(o,{member:{}}):n[s]=yt(o[0],{}))}return n}Kc.exports=Wc});var Yc=I(()=>{var se=j(),Qm=se.util.stream.Stream,$c=se.util.stream.Transform,Zm=se.util.stream.Readable;oi();var ev="AWS_NODEJS_CONNECTION_REUSE_ENABLED";se.NodeHttpClient=se.util.inherit({handleRequest:function(e,r,i,n){var s=this,o=e.endpoint,a="";r||(r={}),r.proxy&&(a=o.protocol+"//"+o.hostname,o.port!==80&&o.port!==443&&(a+=":"+o.port),o=new se.Endpoint(r.proxy));var u=o.protocol==="https:",c=u?require("https"):require("http"),l={host:o.hostname,port:o.port,method:e.method,headers:e.headers,path:a+e.path};r.agent||(l.agent=this.getAgent(u,{keepAlive:process.env[ev]==="1"})),se.util.update(l,r),delete l.proxy,delete l.timeout;var h=c.request(l,function(y){h.didCallback||(i(y),y.emit("headers",y.statusCode,y.headers,y.statusMessage))});if(e.stream=h,h.didCallback=!1,r.connectTimeout){var g;h.on("socket",function(y){y.connecting&&(g=setTimeout(function(){h.didCallback||(h.didCallback=!0,h.abort(),n(se.util.error(new Error("Socket timed out without establishing a connection"),{code:"TimeoutError"})))},r.connectTimeout),y.on("connect",function(){clearTimeout(g),g=null}))})}h.setTimeout(r.timeout||0,function(){if(!h.didCallback){h.didCallback=!0;var y="Connection timed out after "+r.timeout+"ms";n(se.util.error(new Error(y),{code:"TimeoutError"})),h.abort()}}),h.on("error",function(y){g&&(clearTimeout(g),g=null),!h.didCallback&&(h.didCallback=!0,y.code==="ECONNRESET"||y.code==="EPIPE"||y.code==="ETIMEDOUT"?n(se.util.error(y,{code:"TimeoutError"})):n(y))});var b=e.headers.Expect||e.headers.expect;return b==="100-continue"?h.once("continue",function(){s.writeBody(h,e)}):this.writeBody(h,e),h},writeBody:function(e,r){var i=r.body,n=parseInt(r.headers["Content-Length"],10);if(i instanceof Qm){var s=this.progressStream(e,n);s?i.pipe(s).pipe(e):i.pipe(e)}else i?(e.once("finish",function(){e.emit("sendProgress",{loaded:n,total:n})}),e.end(i)):e.end()},getAgent:function(e,r){var i=e?require("https"):require("http");return e?(se.NodeHttpClient.sslAgent||(se.NodeHttpClient.sslAgent=new i.Agent(se.util.merge({rejectUnauthorized:process.env.NODE_TLS_REJECT_UNAUTHORIZED!=="0"},r||{})),se.NodeHttpClient.sslAgent.setMaxListeners(0),Object.defineProperty(se.NodeHttpClient.sslAgent,"maxSockets",{enumerable:!0,get:function(){var n=50,s=i.globalAgent;return s&&s.maxSockets!==1/0&&typeof s.maxSockets=="number"?s.maxSockets:n}})),se.NodeHttpClient.sslAgent):(se.NodeHttpClient.agent||(se.NodeHttpClient.agent=new i.Agent(r)),se.NodeHttpClient.agent)},progressStream:function(e,r){if(typeof $c!="undefined"){var i=0,n=new $c;return n._transform=function(s,o,a){s&&(i+=s.length,e.emit("sendProgress",{loaded:i,total:r})),a(null,s)},n}},emitter:null});se.HttpClient.prototype=se.NodeHttpClient.prototype;se.HttpClient.streamsApiVersion=Zm?2:1});var Jc=I(()=>{var je=j(),tv=require("fs"),rv=Ct(),iv=je.util.iniLoader;je.TokenFileWebIdentityCredentials=je.util.inherit(je.Credentials,{constructor:function(e){je.Credentials.call(this),this.data=null,this.clientConfig=je.util.copy(e||{})},getParamsFromEnv:function(){var e="AWS_WEB_IDENTITY_TOKEN_FILE",r="AWS_ROLE_ARN";if(process.env[e]&&process.env[r])return[{envTokenFile:process.env[e],roleArn:process.env[r],roleSessionName:process.env.AWS_ROLE_SESSION_NAME}]},getParamsFromSharedConfig:function(){var e=je.util.getProfilesFromSharedConfig(iv),r=process.env.AWS_PROFILE||je.util.defaultProfile,i=e[r]||{};if(Object.keys(i).length===0)throw je.util.error(new Error("Profile "+r+" not found"),{code:"TokenFileWebIdentityCredentialsProviderFailure"});for(var n=[];!i.web_identity_token_file&&i.source_profile;){n.unshift({roleArn:i.role_arn,roleSessionName:i.role_session_name});var s=i.source_profile;i=e[s]}return n.unshift({envTokenFile:i.web_identity_token_file,roleArn:i.role_arn,roleSessionName:i.role_session_name}),n},refresh:function(e){this.coalesceRefresh(e||je.util.fn.callback)},assumeRoleChaining:function(e,r){var i=this;if(e.length===0)i.service.credentialsFrom(i.data,i),r();else{var n=e.shift();i.service.config.credentials=i.service.credentialsFrom(i.data,i),i.service.assumeRole({RoleArn:n.roleArn,RoleSessionName:n.roleSessionName||"token-file-web-identity"},function(s,o){i.data=null,s?r(s):(i.data=o,i.assumeRoleChaining(e,r))})}},load:function(e){var r=this;try{var i=r.getParamsFromEnv();if(i||(i=r.getParamsFromSharedConfig()),i){var n=i.shift(),s=tv.readFileSync(n.envTokenFile,{encoding:"ascii"});r.service||r.createClients(),r.service.assumeRoleWithWebIdentity({WebIdentityToken:s,RoleArn:n.roleArn,RoleSessionName:n.roleSessionName||"token-file-web-identity"},function(o,a){r.data=null,o?e(o):(r.data=a,r.assumeRoleChaining(i,e))})}}catch(o){e(o)}},createClients:function(){if(!this.service){var t=je.util.merge({},this.clientConfig);this.service=new rv(t),this.service.retryableError=function(e){return e.code==="IDPCommunicationErrorException"||e.code==="InvalidIdentityToken"?!0:je.Service.prototype.retryableError.call(this,e)}}}})});var Zc=I((aE,Qc)=>{var nv=function(){return{IPv4:"http://169.254.169.254",IPv6:"http://[fd00:ec2::254]"}};Qc.exports=nv});var Kn=I((uE,el)=>{var sv=function(){return{IPv4:"IPv4",IPv6:"IPv6"}};el.exports=sv});var rl=I((cE,tl)=>{var ov="AWS_EC2_METADATA_SERVICE_ENDPOINT",av="ec2_metadata_service_endpoint",uv=function(){return{environmentVariableSelector:function(t){return t[ov]},configFileSelector:function(t){return t[av]},default:void 0}};tl.exports=uv});var nl=I((lE,il)=>{var cv=Kn()(),lv="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",fv="ec2_metadata_service_endpoint_mode",pv=function(){return{environmentVariableSelector:function(t){return t[lv]},configFileSelector:function(t){return t[fv]},default:cv.IPv4}};il.exports=pv});var cl=I((fE,ul)=>{var sl=j(),ol=Zc()(),al=Kn()(),dv=rl()(),hv=nl()(),mv=function(){var t=sl.util.loadConfig(dv);if(t!==void 0)return t;var e=sl.util.loadConfig(hv);switch(e){case al.IPv4:return ol.IPv4;case al.IPv6:return ol.IPv6;default:throw new Error("Unsupported endpoint mode: "+e)}};ul.exports=mv});var pl=I((pE,fl)=>{var Ge=j();oi();var vv=Ge.util.inherit,yv=cl(),ll=require("url").URL;Ge.MetadataService=vv({endpoint:yv(),httpOptions:{timeout:0},disableFetchToken:!1,constructor:function(e){e&&e.host&&(e.endpoint="http://"+e.host,delete e.host),Ge.util.update(this,e)},request:function(e,r,i){if(arguments.length===2&&(i=r,r={}),process.env[Ge.util.imdsDisabledEnv]){i(new Error("EC2 Instance Metadata Service access disabled"));return}e=e||"/",ll&&new ll(this.endpoint);var n=new Ge.HttpRequest(this.endpoint+e);n.method=r.method||"GET",r.headers&&(n.headers=r.headers),Ge.util.handleRequestWithRetries(n,this,i)},loadCredentialsCallbacks:[],fetchMetadataToken:function(e){var r=this,i="/latest/api/token";r.request(i,{method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}},e)},fetchCredentials:function(e,r){var i=this,n="/latest/meta-data/iam/security-credentials/";i.request(n,e,function(s,o){if(s){i.disableFetchToken=s.statusCode!==401,r(Ge.util.error(s,{message:"EC2 Metadata roleName request returned error"}));return}o=o.split(` -`)[0],i.request(n+o,e,function(a,u){if(a){i.disableFetchToken=a.statusCode!==401,r(Ge.util.error(a,{message:"EC2 Metadata creds request returned error"}));return}try{var c=JSON.parse(u);r(null,c)}catch(l){r(l)}})})},loadCredentials:function(e){var r=this;if(r.loadCredentialsCallbacks.push(e),r.loadCredentialsCallbacks.length>1)return;function i(n,s){for(var o;(o=r.loadCredentialsCallbacks.shift())!==void 0;)o(n,s)}r.disableFetchToken?r.fetchCredentials({},i):r.fetchMetadataToken(function(n,s){if(n){if(n.code==="TimeoutError")r.disableFetchToken=!0;else if(n.retryable===!0){i(Ge.util.error(n,{message:"EC2 Metadata token request returned error"}));return}else if(n.statusCode===400){i(Ge.util.error(n,{message:"EC2 Metadata token request returned 400"}));return}}var o={};s&&(o.headers={"x-aws-ec2-metadata-token":s}),r.fetchCredentials(o,i)})}});fl.exports=Ge.MetadataService});var dl=I(()=>{var Oe=j();pl();Oe.EC2MetadataCredentials=Oe.util.inherit(Oe.Credentials,{constructor:function(e){Oe.Credentials.call(this),e=e?Oe.util.copy(e):{},e=Oe.util.merge({maxRetries:this.defaultMaxRetries},e),e.httpOptions||(e.httpOptions={}),e.httpOptions=Oe.util.merge({timeout:this.defaultTimeout,connectTimeout:this.defaultConnectTimeout},e.httpOptions),this.metadataService=new Oe.MetadataService(e),this.logger=e.logger||Oe.config&&Oe.config.logger},defaultTimeout:1e3,defaultConnectTimeout:1e3,defaultMaxRetries:3,originalExpiration:void 0,refresh:function(e){this.coalesceRefresh(e||Oe.util.fn.callback)},load:function(e){var r=this;r.metadataService.loadCredentials(function(i,n){i?r.hasLoadedCredentials()?(r.extendExpirationIfExpired(),e()):e(i):(r.setCredentials(n),r.extendExpirationIfExpired(),e())})},hasLoadedCredentials:function(){return this.AccessKeyId&&this.secretAccessKey},extendExpirationIfExpired:function(){if(this.needsRefresh()){this.originalExpiration=this.originalExpiration||this.expireTime,this.expired=!1;var e=15*60+Math.floor(Math.random()*5*60),r=Oe.util.date.getDate().getTime();this.expireTime=new Date(r+e*1e3),this.logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted again at "+this.expireTime+` -For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`)}},setCredentials:function(e){var r=Oe.util.date.getDate().getTime(),i=new Date(e.Expiration);this.expired=r>=i,this.metadata=e,this.accessKeyId=e.AccessKeyId,this.secretAccessKey=e.SecretAccessKey,this.sessionToken=e.Token,this.expireTime=i}})});var vl=I(()=>{var Se=j(),Gn="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",qi="AWS_CONTAINER_CREDENTIALS_FULL_URI",gv="AWS_CONTAINER_AUTHORIZATION_TOKEN",Ev=["https:"],hl=["http:","https:"],ml=["localhost","127.0.0.1"],Sv="169.254.170.2";Se.RemoteCredentials=Se.util.inherit(Se.Credentials,{constructor:function(e){Se.Credentials.call(this),e=e?Se.util.copy(e):{},e.httpOptions||(e.httpOptions={}),e.httpOptions=Se.util.merge(this.httpOptions,e.httpOptions),Se.util.update(this,e)},httpOptions:{timeout:1e3},maxRetries:3,isConfiguredForEcsCredentials:function(){return Boolean(process&&process.env&&(process.env[Gn]||process.env[qi]))},getECSFullUri:function(){if(process&&process.env){var e=process.env[Gn],r=process.env[qi];if(e)return"http://"+Sv+e;if(r){var i=Se.util.urlParse(r);if(hl.indexOf(i.protocol)<0)throw Se.util.error(new Error("Unsupported protocol: AWS.RemoteCredentials supports "+hl.join(",")+" only; "+i.protocol+" requested."),{code:"ECSCredentialsProviderFailure"});if(Ev.indexOf(i.protocol)<0&&ml.indexOf(i.hostname)<0)throw Se.util.error(new Error("Unsupported hostname: AWS.RemoteCredentials only supports "+ml.join(",")+" for "+i.protocol+"; "+i.protocol+"//"+i.hostname+" requested."),{code:"ECSCredentialsProviderFailure"});return r}else throw Se.util.error(new Error("Variable "+Gn+" or "+qi+" must be set to use AWS.RemoteCredentials."),{code:"ECSCredentialsProviderFailure"})}else throw Se.util.error(new Error("No process info available"),{code:"ECSCredentialsProviderFailure"})},getECSAuthToken:function(){if(process&&process.env&&process.env[qi])return process.env[gv]},credsFormatIsValid:function(e){return!!e.accessKeyId&&!!e.secretAccessKey&&!!e.sessionToken&&!!e.expireTime},formatCreds:function(e){return e.credentials&&(e=e.credentials),{expired:!1,accessKeyId:e.accessKeyId||e.AccessKeyId,secretAccessKey:e.secretAccessKey||e.SecretAccessKey,sessionToken:e.sessionToken||e.Token,expireTime:new Date(e.expiration||e.Expiration)}},request:function(e,r){var i=new Se.HttpRequest(e);i.method="GET",i.headers.Accept="application/json";var n=this.getECSAuthToken();n&&(i.headers.Authorization=n),Se.util.handleRequestWithRetries(i,this,r)},refresh:function(e){this.coalesceRefresh(e||Se.util.fn.callback)},load:function(e){var r=this,i;try{i=this.getECSFullUri()}catch(n){e(n);return}this.request(i,function(n,s){if(!n)try{s=JSON.parse(s);var o=r.formatCreds(s);if(!r.credsFormatIsValid(o))throw Se.util.error(new Error("Response data is not in valid format"),{code:"ECSCredentialsProviderFailure"});Se.util.update(r,o)}catch(a){n=a}e(n,o)})}})});var gl=I(()=>{var yl=j();yl.ECSCredentials=yl.RemoteCredentials});var El=I(()=>{var bt=j();bt.EnvironmentCredentials=bt.util.inherit(bt.Credentials,{constructor:function(e){bt.Credentials.call(this),this.envPrefix=e,this.get(function(){})},refresh:function(e){if(e||(e=bt.util.fn.callback),!process||!process.env){e(bt.util.error(new Error("No process info or environment variables available"),{code:"EnvironmentCredentialsProviderFailure"}));return}for(var r=["ACCESS_KEY_ID","SECRET_ACCESS_KEY","SESSION_TOKEN"],i=[],n=0;n{var At=j();At.FileSystemCredentials=At.util.inherit(At.Credentials,{constructor:function(e){At.Credentials.call(this),this.filename=e,this.get(function(){})},refresh:function(e){e||(e=At.util.fn.callback);try{var r=JSON.parse(At.util.readFileSync(this.filename));if(At.Credentials.call(this,r),!this.accessKeyId||!this.secretAccessKey)throw At.util.error(new Error("Credentials not set in "+this.filename),{code:"FileSystemCredentialsProviderFailure"});this.expired=!1,e()}catch(i){e(i)}}})});var wl=I(()=>{var _e=j(),_v=Ct(),_l=_e.util.iniLoader,wv="us-east-1";_e.SharedIniFileCredentials=_e.util.inherit(_e.Credentials,{constructor:function(e){_e.Credentials.call(this),e=e||{},this.filename=e.filename,this.profile=e.profile||process.env.AWS_PROFILE||_e.util.defaultProfile,this.disableAssumeRole=Boolean(e.disableAssumeRole),this.preferStaticCredentials=Boolean(e.preferStaticCredentials),this.tokenCodeFn=e.tokenCodeFn||null,this.httpOptions=e.httpOptions||null,this.get(e.callback||_e.util.fn.noop)},load:function(e){var r=this;try{var i=_e.util.getProfilesFromSharedConfig(_l,this.filename),n=i[this.profile]||{};if(Object.keys(n).length===0)throw _e.util.error(new Error("Profile "+this.profile+" not found"),{code:"SharedIniFileCredentialsProviderFailure"});var s=Boolean(this.preferStaticCredentials&&n.aws_access_key_id&&n.aws_secret_access_key);if(n.role_arn&&!s){this.loadRoleProfile(i,n,function(o,a){o?e(o):(r.expired=!1,r.accessKeyId=a.Credentials.AccessKeyId,r.secretAccessKey=a.Credentials.SecretAccessKey,r.sessionToken=a.Credentials.SessionToken,r.expireTime=a.Credentials.Expiration,e(null))});return}if(this.accessKeyId=n.aws_access_key_id,this.secretAccessKey=n.aws_secret_access_key,this.sessionToken=n.aws_session_token,!this.accessKeyId||!this.secretAccessKey)throw _e.util.error(new Error("Credentials not set for profile "+this.profile),{code:"SharedIniFileCredentialsProviderFailure"});this.expired=!1,e(null)}catch(o){e(o)}},refresh:function(e){_l.clearCachedFiles(),this.coalesceRefresh(e||_e.util.fn.callback,this.disableAssumeRole)},loadRoleProfile:function(e,r,i){if(this.disableAssumeRole)throw _e.util.error(new Error("Role assumption profiles are disabled. Failed to load profile "+this.profile+" from "+e.filename),{code:"SharedIniFileCredentialsProviderFailure"});var n=this,s=r.role_arn,o=r.role_session_name,a=r.external_id,u=r.mfa_serial,c=r.source_profile,l=r.region||wv;if(!c)throw _e.util.error(new Error("source_profile is not set using profile "+this.profile),{code:"SharedIniFileCredentialsProviderFailure"});var h=e[c];if(typeof h!="object")throw _e.util.error(new Error("source_profile "+c+" using profile "+this.profile+" does not exist"),{code:"SharedIniFileCredentialsProviderFailure"});var g=new _e.SharedIniFileCredentials(_e.util.merge(this.options||{},{profile:c,preferStaticCredentials:!0}));this.roleArn=s;var b=new _v({credentials:g,region:l,httpOptions:this.httpOptions}),y={RoleArn:s,RoleSessionName:o||"aws-sdk-js-"+Date.now()};if(a&&(y.ExternalId=a),u&&n.tokenCodeFn){y.SerialNumber=u,n.tokenCodeFn(u,function(E,D){if(E){var S;E instanceof Error?S=E.message:S=E,i(_e.util.error(new Error("Error fetching MFA token: "+S),{code:"SharedIniFileCredentialsProviderFailure"}));return}y.TokenCode=D,b.assumeRole(y,i)});return}b.assumeRole(y,i)}})});var Cl=I(()=>{var me=j(),Cv=require("path"),Tv=require("crypto"),$n=me.util.iniLoader;me.SsoCredentials=me.util.inherit(me.Credentials,{constructor:function(e){me.Credentials.call(this),e=e||{},this.errorCode="SsoCredentialsProviderFailure",this.expired=!0,this.filename=e.filename,this.profile=e.profile||process.env.AWS_PROFILE||me.util.defaultProfile,this.service=e.ssoClient,this.get(e.callback||me.util.fn.noop)},load:function(e){var r=15*60*1e3,i=this;try{var n=me.util.getProfilesFromSharedConfig($n,this.filename),s=n[this.profile]||{};if(Object.keys(s).length===0)throw me.util.error(new Error("Profile "+this.profile+" not found"),{code:i.errorCode});if(!s.sso_start_url||!s.sso_account_id||!s.sso_region||!s.sso_role_name)throw me.util.error(new Error("Profile "+this.profile+' does not have valid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html'),{code:i.errorCode});var o=Tv.createHash("sha1"),a=o.update(s.sso_start_url).digest("hex")+".json",u=Cv.join($n.getHomeDir(),".aws","sso","cache",a),c=me.util.readFileSync(u),l=null;if(c&&(l=JSON.parse(c)),!l)throw me.util.error(new Error("Cached credentials not found under "+this.profile+" profile. Please make sure you log in with aws sso login first"),{code:i.errorCode});if(!l.startUrl||!l.region||!l.accessToken||!l.expiresAt)throw me.util.error(new Error("Cached credentials are missing required properties. Try running aws sso login."));if(new Date(l.expiresAt).getTime()-Date.now()<=r)throw me.util.error(new Error("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile."));(!i.service||i.service.config.region!==s.sso_region)&&(i.service=new me.SSO({region:s.sso_region}));var h={accessToken:l.accessToken,accountId:s.sso_account_id,roleName:s.sso_role_name};i.service.getRoleCredentials(h,function(g,b){if(g||!b||!b.roleCredentials)e(me.util.error(g||new Error('Please log in using "aws sso login"'),{code:i.errorCode}),null);else{if(!b.roleCredentials.accessKeyId||!b.roleCredentials.secretAccessKey||!b.roleCredentials.sessionToken||!b.roleCredentials.expiration)throw me.util.error(new Error("SSO returns an invalid temporary credential."));i.expired=!1,i.accessKeyId=b.roleCredentials.accessKeyId,i.secretAccessKey=b.roleCredentials.secretAccessKey,i.sessionToken=b.roleCredentials.sessionToken,i.expireTime=new Date(b.roleCredentials.expiration),e(null)}})}catch(g){e(g)}},refresh:function(e){$n.clearCachedFiles(),this.coalesceRefresh(e||me.util.fn.callback)}})});var Ri=I((xE,Al)=>{var oe=le(),Tl=Sn(),bv=Tl.isFipsRegion,Av=Tl.getRealRegion;oe.isBrowser=function(){return!1};oe.isNode=function(){return!0};oe.crypto.lib=require("crypto");oe.Buffer=require("buffer").Buffer;oe.domain=require("domain");oe.stream=require("stream");oe.url=require("url");oe.querystring=require("querystring");oe.environment="nodejs";oe.createEventStream=oe.stream.Readable?fu().createEventStream:mu().createEventStream;oe.realClock=yu();oe.clientSideMonitoring={Publisher:Eu().Publisher,configProvider:wu()};oe.iniLoader=xu().iniLoader;oe.getSystemErrorName=require("util").getSystemErrorName;oe.loadConfig=function(t){var e=t.environmentVariableSelector(process.env);if(e!==void 0)return e;var r={};try{r=oe.iniLoader?oe.iniLoader.loadFrom({isConfig:!0,filename:process.env[oe.sharedConfigFileEnv]}):{}}catch(s){}var i=r[process.env.AWS_PROFILE||oe.defaultProfile]||{},n=t.configFileSelector(i);return n!==void 0?n:typeof t.default=="function"?t.default():t.default};var te;Al.exports=te=j();wn();Cn();Lu();ku();Mu();Xu();Wu();Bn();te.XML.Parser=Gc();Yc();Mn();Jc();dl();vl();gl();El();Sl();wl();Bn();Cl();te.CredentialProviderChain.defaultProviders=[function(){return new te.EnvironmentCredentials("AWS")},function(){return new te.EnvironmentCredentials("AMAZON")},function(){return new te.SsoCredentials},function(){return new te.SharedIniFileCredentials},function(){return new te.ECSCredentials},function(){return new te.ProcessCredentials},function(){return new te.TokenFileWebIdentityCredentials},function(){return new te.EC2MetadataCredentials}];var bl=function(){var t=process.env,e=t.AWS_REGION||t.AMAZON_REGION;if(t[te.util.configOptInEnv])for(var r=[{filename:t[te.util.sharedCredentialsFileEnv]},{isConfig:!0,filename:t[te.util.sharedConfigFileEnv]}],i=te.util.iniLoader;!e&&r.length;){var n={},s=r.shift();try{n=i.loadFrom(s)}catch(a){if(s.isConfig)throw a}var o=n[t.AWS_PROFILE||te.util.defaultProfile];e=o&&o.region}return e},Oi=function(t){return t==="true"?!0:t==="false"?!1:void 0},xv={environmentVariableSelector:function(t){return Oi(t.AWS_USE_FIPS_ENDPOINT)},configFileSelector:function(t){return Oi(t.use_fips_endpoint)},default:!1},Rv={environmentVariableSelector:function(t){return Oi(t.AWS_USE_DUALSTACK_ENDPOINT)},configFileSelector:function(t){return Oi(t.use_dualstack_endpoint)},default:!1};te.util.update(te.Config.prototype.keys,{credentials:function(){var t=null;return new te.CredentialProviderChain([function(){return new te.EnvironmentCredentials("AWS")},function(){return new te.EnvironmentCredentials("AMAZON")},function(){return new te.SharedIniFileCredentials({disableAssumeRole:!0})}]).resolve(function(e,r){e||(t=r)}),t},credentialProvider:function(){return new te.CredentialProviderChain},logger:function(){return process.env.AWSJS_DEBUG?console:null},region:function(){var t=bl();return t?Av(t):void 0},useFipsEndpoint:function(){var t=bl();return bv(t)?!0:oe.loadConfig(xv)},useDualstackEndpoint:function(){return oe.loadConfig(Rv)}});te.config=new te.Config});var xl=I((RE,Iv)=>{Iv.exports={version:"2.0",metadata:{apiVersion:"2018-09-22",endpointPrefix:"codeartifact",jsonVersion:"1.1",protocol:"rest-json",serviceFullName:"CodeArtifact",serviceId:"codeartifact",signatureVersion:"v4",signingName:"codeartifact",uid:"codeartifact-2018-09-22"},operations:{AssociateExternalConnection:{http:{requestUri:"/v1/repository/external-connection"},input:{type:"structure",required:["domain","repository","externalConnection"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},externalConnection:{location:"querystring",locationName:"external-connection"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},CopyPackageVersions:{http:{requestUri:"/v1/package/versions/copy"},input:{type:"structure",required:["domain","sourceRepository","destinationRepository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},sourceRepository:{location:"querystring",locationName:"source-repository"},destinationRepository:{location:"querystring",locationName:"destination-repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},versionRevisions:{shape:"Sl"},allowOverwrite:{type:"boolean"},includeFromUpstream:{type:"boolean"}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},CreateDomain:{http:{requestUri:"/v1/domain"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},encryptionKey:{},tags:{shape:"Sy"}}},output:{type:"structure",members:{domain:{shape:"S13"}}}},CreateRepository:{http:{requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},description:{},upstreams:{shape:"S19"},tags:{shape:"Sy"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DeleteDomain:{http:{method:"DELETE",requestUri:"/v1/domain"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"}}},output:{type:"structure",members:{domain:{shape:"S13"}}}},DeleteDomainPermissionsPolicy:{http:{method:"DELETE",requestUri:"/v1/domain/permissions/policy"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},policyRevision:{location:"querystring",locationName:"policy-revision"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},DeletePackageVersions:{http:{requestUri:"/v1/package/versions/delete"},input:{type:"structure",required:["domain","repository","format","package","versions"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},expectedStatus:{}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},DeleteRepository:{http:{method:"DELETE",requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DeleteRepositoryPermissionsPolicy:{http:{method:"DELETE",requestUri:"/v1/repository/permissions/policies"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},policyRevision:{location:"querystring",locationName:"policy-revision"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},DescribeDomain:{http:{method:"GET",requestUri:"/v1/domain"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"}}},output:{type:"structure",members:{domain:{shape:"S13"}}}},DescribePackage:{http:{method:"GET",requestUri:"/v1/package"},input:{type:"structure",required:["domain","repository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"}}},output:{type:"structure",required:["package"],members:{package:{type:"structure",members:{format:{},namespace:{},name:{},originConfiguration:{shape:"S1u"}}}}}},DescribePackageVersion:{http:{method:"GET",requestUri:"/v1/package/version"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"}}},output:{type:"structure",required:["packageVersion"],members:{packageVersion:{type:"structure",members:{format:{},namespace:{},packageName:{},displayName:{},version:{},summary:{},homePage:{},sourceCodeRepository:{},publishedTime:{type:"timestamp"},licenses:{type:"list",member:{type:"structure",members:{name:{},url:{}}}},revision:{},status:{},origin:{shape:"S24"}}}}}},DescribeRepository:{http:{method:"GET",requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DisassociateExternalConnection:{http:{method:"DELETE",requestUri:"/v1/repository/external-connection"},input:{type:"structure",required:["domain","repository","externalConnection"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},externalConnection:{location:"querystring",locationName:"external-connection"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DisposePackageVersions:{http:{requestUri:"/v1/package/versions/dispose"},input:{type:"structure",required:["domain","repository","format","package","versions"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},versionRevisions:{shape:"Sl"},expectedStatus:{}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},GetAuthorizationToken:{http:{requestUri:"/v1/authorization-token"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},durationSeconds:{location:"querystring",locationName:"duration",type:"long"}}},output:{type:"structure",members:{authorizationToken:{},expiration:{type:"timestamp"}}}},GetDomainPermissionsPolicy:{http:{method:"GET",requestUri:"/v1/domain/permissions/policy"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},GetPackageVersionAsset:{http:{method:"GET",requestUri:"/v1/package/version/asset"},input:{type:"structure",required:["domain","repository","format","package","packageVersion","asset"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"},asset:{location:"querystring",locationName:"asset"},packageVersionRevision:{location:"querystring",locationName:"revision"}}},output:{type:"structure",members:{asset:{type:"blob",streaming:!0},assetName:{location:"header",locationName:"X-AssetName"},packageVersion:{location:"header",locationName:"X-PackageVersion"},packageVersionRevision:{location:"header",locationName:"X-PackageVersionRevision"}},payload:"asset"}},GetPackageVersionReadme:{http:{method:"GET",requestUri:"/v1/package/version/readme"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"}}},output:{type:"structure",members:{format:{},namespace:{},package:{},version:{},versionRevision:{},readme:{}}}},GetRepositoryEndpoint:{http:{method:"GET",requestUri:"/v1/repository/endpoint"},input:{type:"structure",required:["domain","repository","format"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"}}},output:{type:"structure",members:{repositoryEndpoint:{}}}},GetRepositoryPermissionsPolicy:{http:{method:"GET",requestUri:"/v1/repository/permissions/policy"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},ListDomains:{http:{requestUri:"/v1/domains"},input:{type:"structure",members:{maxResults:{type:"integer"},nextToken:{}}},output:{type:"structure",members:{domains:{type:"list",member:{type:"structure",members:{name:{},owner:{},arn:{},status:{},createdTime:{type:"timestamp"},encryptionKey:{}}}},nextToken:{}}}},ListPackageVersionAssets:{http:{requestUri:"/v1/package/version/assets"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{format:{},namespace:{},package:{},version:{},versionRevision:{},nextToken:{},assets:{type:"list",member:{type:"structure",required:["name"],members:{name:{},size:{type:"long"},hashes:{type:"map",key:{},value:{}}}}}}}},ListPackageVersionDependencies:{http:{requestUri:"/v1/package/version/dependencies"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{format:{},namespace:{},package:{},version:{},versionRevision:{},nextToken:{},dependencies:{type:"list",member:{type:"structure",members:{namespace:{},package:{},dependencyType:{},versionRequirement:{}}}}}}},ListPackageVersions:{http:{requestUri:"/v1/package/versions"},input:{type:"structure",required:["domain","repository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},status:{location:"querystring",locationName:"status"},sortBy:{location:"querystring",locationName:"sortBy"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"},originType:{location:"querystring",locationName:"originType"}}},output:{type:"structure",members:{defaultDisplayVersion:{},format:{},namespace:{},package:{},versions:{type:"list",member:{type:"structure",required:["version","status"],members:{version:{},revision:{},status:{},origin:{shape:"S24"}}}},nextToken:{}}}},ListPackages:{http:{requestUri:"/v1/packages"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},packagePrefix:{location:"querystring",locationName:"package-prefix"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"},publish:{location:"querystring",locationName:"publish"},upstream:{location:"querystring",locationName:"upstream"}}},output:{type:"structure",members:{packages:{type:"list",member:{type:"structure",members:{format:{},namespace:{},package:{},originConfiguration:{shape:"S1u"}}}},nextToken:{}}}},ListRepositories:{http:{requestUri:"/v1/repositories"},input:{type:"structure",members:{repositoryPrefix:{location:"querystring",locationName:"repository-prefix"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{repositories:{shape:"S3p"},nextToken:{}}}},ListRepositoriesInDomain:{http:{requestUri:"/v1/domain/repositories"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},administratorAccount:{location:"querystring",locationName:"administrator-account"},repositoryPrefix:{location:"querystring",locationName:"repository-prefix"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{repositories:{shape:"S3p"},nextToken:{}}}},ListTagsForResource:{http:{requestUri:"/v1/tags"},input:{type:"structure",required:["resourceArn"],members:{resourceArn:{location:"querystring",locationName:"resourceArn"}}},output:{type:"structure",members:{tags:{shape:"Sy"}}}},PutDomainPermissionsPolicy:{http:{method:"PUT",requestUri:"/v1/domain/permissions/policy"},input:{type:"structure",required:["domain","policyDocument"],members:{domain:{},domainOwner:{},policyRevision:{},policyDocument:{}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},PutPackageOriginConfiguration:{http:{requestUri:"/v1/package"},input:{type:"structure",required:["domain","repository","format","package","restrictions"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},restrictions:{shape:"S1v"}}},output:{type:"structure",members:{originConfiguration:{shape:"S1u"}}}},PutRepositoryPermissionsPolicy:{http:{method:"PUT",requestUri:"/v1/repository/permissions/policy"},input:{type:"structure",required:["domain","repository","policyDocument"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},policyRevision:{},policyDocument:{}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},TagResource:{http:{requestUri:"/v1/tag"},input:{type:"structure",required:["resourceArn","tags"],members:{resourceArn:{location:"querystring",locationName:"resourceArn"},tags:{shape:"Sy"}}},output:{type:"structure",members:{}}},UntagResource:{http:{requestUri:"/v1/untag"},input:{type:"structure",required:["resourceArn","tagKeys"],members:{resourceArn:{location:"querystring",locationName:"resourceArn"},tagKeys:{type:"list",member:{}}}},output:{type:"structure",members:{}}},UpdatePackageVersionsStatus:{http:{requestUri:"/v1/package/versions/update_status"},input:{type:"structure",required:["domain","repository","format","package","versions","targetStatus"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},versionRevisions:{shape:"Sl"},expectedStatus:{},targetStatus:{}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},UpdateRepository:{http:{method:"PUT",requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},description:{},upstreams:{shape:"S19"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}}},shapes:{S7:{type:"structure",members:{name:{},administratorAccount:{},domainName:{},domainOwner:{},arn:{},description:{},upstreams:{type:"list",member:{type:"structure",members:{repositoryName:{}}}},externalConnections:{type:"list",member:{type:"structure",members:{externalConnectionName:{},packageFormat:{},status:{}}}}}},Sj:{type:"list",member:{}},Sl:{type:"map",key:{},value:{}},Sp:{type:"map",key:{},value:{type:"structure",members:{revision:{},status:{}}}},St:{type:"map",key:{},value:{type:"structure",members:{errorCode:{},errorMessage:{}}}},Sy:{type:"list",member:{type:"structure",required:["key","value"],members:{key:{},value:{}}}},S13:{type:"structure",members:{name:{},owner:{},arn:{},status:{},createdTime:{type:"timestamp"},encryptionKey:{},repositoryCount:{type:"integer"},assetSizeBytes:{type:"long"},s3BucketArn:{}}},S19:{type:"list",member:{type:"structure",required:["repositoryName"],members:{repositoryName:{}}}},S1h:{type:"structure",members:{resourceArn:{},revision:{},document:{}}},S1u:{type:"structure",members:{restrictions:{shape:"S1v"}}},S1v:{type:"structure",required:["publish","upstream"],members:{publish:{},upstream:{}}},S24:{type:"structure",members:{domainEntryPoint:{type:"structure",members:{repositoryName:{},externalConnectionName:{}}},originType:{}}},S3p:{type:"list",member:{type:"structure",members:{name:{},administratorAccount:{},domainName:{},domainOwner:{},arn:{},description:{}}}}}}});var Rl=I((IE,Dv)=>{Dv.exports={pagination:{ListDomains:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"domains"},ListPackageVersionAssets:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"assets"},ListPackageVersions:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"versions"},ListPackages:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"packages"},ListRepositories:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"repositories"},ListRepositoriesInDomain:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"repositories"}}}});var Nl=I((DE,Dl)=>{Ri();var Li=j(),Nv=Li.Service,Il=Li.apiLoader;Il.services.codeartifact={};Li.CodeArtifact=Nv.defineService("codeartifact",["2018-09-22"]);Object.defineProperty(Il.services.codeartifact,"2018-09-22",{get:function(){var e=xl();return e.paginators=Rl().pagination,e},enumerable:!0,configurable:!0});Dl.exports=Li.CodeArtifact});var rt=Xi($i());var Pl=Xi(Nl()),Or=Xi(require("child_process"));var tt;(function(r){r.npm="npm",r.poetry="poetry"})(tt||(tt={}));function Ve(t){console.error(t),process.exit(1)}function ql(t){return(t==null?void 0:t.domain)||Ve("Domain does not exist in package.json"),(t==null?void 0:t.accountId)||Ve("accountId does not exist in package.json"),(t==null?void 0:t.repository)||Ve("repository does not exist in package.json"),(t==null?void 0:t.region)||Ve("region does not exist in package.json"),(t==null?void 0:t.packageType)||Ve("packageType does not exist in package.json"),{domain:t.domain,accountId:t.accountId,repository:t.repository,region:t.region,scope:t.scope,packageType:t.packageType}}async function Ol(t,e){let r=new Pl.default,i={domain:t,domainOwner:e},n=await r.getAuthorizationToken(i).promise().catch(s=>Ve(s));if((n==null?void 0:n.authorizationToken)===void 0)throw Ve("Failed to retrieve auth token");return n.authorizationToken}function Pv(){process.env.AWS_REGION||Ve("Missing AWS region environment variable. Please make sure that you assume a role!"),process.env.AWS_SESSION_TOKEN||Ve("Missing AWS session token environment variable. Please make sure that you assume a role!"),process.env.AWS_SECRET_ACCESS_KEY||Ve("Missing AWS serect access key environment variable. Please make sure that you assume a role!"),process.env.AWS_ACCESS_KEY_ID||Ve("Missing AWS access key id environment variable. Please make sure that you assume a role!")}async function qv(t){let{domain:e,accountId:r,region:i,repository:n,scope:s}=ql(t);s||Ve("Missing Scope");let o=await Ol(e,r),a=`//${e}-${r}.d.codeartifact.${i}.amazonaws.com/npm/${n}/`;(0,Or.execSync)(`npm config set ${s}:registry https://${e}-${r}.d.codeartifact.${i}.amazonaws.com/npm/${n}/`),(0,Or.execSync)(`npm config set ${a}:_authToken=${o}`),(0,Or.execSync)(`npm config set ${a}:always-auth=true`),console.log(`Set npm credentials for ${s}`)}async function Ov(t){let{domain:e,accountId:r}=ql(t),i=await Ol(e,r);(0,Or.execSync)(`poetry config http-basic.mondo "aws" "${i}"`),console.log("Set codeartifact credentials for poetry")}async function Ll(t){if(Pv(),t.packageType===tt.npm)await qv(t);else if(t.packageType===tt.poetry)await Ov(t);else throw new Error(`invalid package type: ${t.packageType}, supported types: ${JSON.stringify(tt)}`)}function kl(t){if(t==="npm")return tt.npm;if(t==="poetry")return tt.poetry;throw new Error(`invalid package type: ${t}, supported types: ${JSON.stringify(tt)}`)}async function Lv(){try{let t=(0,rt.getInput)("domain"),e=(0,rt.getInput)("accountId"),r=(0,rt.getInput)("region"),i=(0,rt.getInput)("repository"),n=(0,rt.getInput)("scope"),s=(0,rt.getInput)("packageType"),o=kl(s);console.log("Input Config Details:"),console.log(t,e,r,i,n,o),Ll({domain:t,accountId:e,region:r,repository:i,scope:n,packageType:o})}catch(t){t instanceof Error?(0,rt.setFailed)(t.message):(console.error(t),(0,rt.setFailed)("Unknown error"))}}Lv(); -/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */ +Char: `+m.c),f=new Error(f),m.error=f,pe(m,"onerror",f),m}function kt(m){return m.sawRoot&&!m.closedRoot&&$(m,"Unclosed root tag"),m.state!==x.BEGIN&&m.state!==x.BEGIN_WHITESPACE&&m.state!==x.TEXT&&ct(m,"Unexpected end"),Oe(m),m.c="",m.closed=!0,pe(m,"onend"),r.call(m,m.strict,m.opt),m}function $(m,f){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&ct(m,f)}function $t(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var f=m.tags[m.tags.length-1]||m,q=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(q.ns=f.ns),m.attribList.length=0,Q(m,"onopentagstart",q)}function Ct(m,f){var q=m.indexOf(":"),b=q<0?["",m]:m.split(":"),J=b[0],ae=b[1];return f&&m==="xmlns"&&(J="xmlns",ae=""),{prefix:J,local:ae}}function Fe(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var f=Ct(m.attribName,!0),q=f.prefix,b=f.local;if(q==="xmlns")if(b==="xml"&&m.attribValue!==S)$(m,"xml: prefix must be bound to "+S+` +Actual: `+m.attribValue);else if(b==="xmlns"&&m.attribValue!==h)$(m,"xmlns: prefix must be bound to "+h+` +Actual: `+m.attribValue);else{var J=m.tag,ae=m.tags[m.tags.length-1]||m;J.ns===ae.ns&&(J.ns=Object.create(ae.ns)),J.ns[b]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,Q(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function Ae(m,f){if(m.opt.xmlns){var q=m.tag,b=Ct(m.tagName);q.prefix=b.prefix,q.local=b.local,q.uri=q.ns[b.prefix]||"",q.prefix&&!q.uri&&($(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),q.uri=b.prefix);var J=m.tags[m.tags.length-1]||m;q.ns&&J.ns!==q.ns&&Object.keys(q.ns).forEach(function(Jr){Q(m,"onopennamespace",{prefix:Jr,uri:q.ns[Jr]})});for(var ae=0,ue=m.attribList.length;ae",m.tagName="",m.state=x.SCRIPT;return}Q(m,"onscript",m.script),m.script=""}var f=m.tags.length,q=m.tagName;m.strict||(q=q[m.looseCase]());for(var b=q;f--;){var J=m.tags[f];if(J.name!==b)$(m,"Unexpected close tag");else break}if(f<0){$(m,"Unmatched closing tag: "+m.tagName),m.textNode+="",m.state=x.TEXT;return}m.tagName=q;for(var ae=m.tags.length;ae-- >f;){var ue=m.tag=m.tags.pop();m.tagName=m.tag.name,Q(m,"onclosetag",m.tagName);var _e={};for(var Pe in ue.ns)_e[Pe]=ue.ns[Pe];var z=m.tags[m.tags.length-1]||m;m.opt.xmlns&&ue.ns!==z.ns&&Object.keys(ue.ns).forEach(function(ce){var Be=ue.ns[ce];Q(m,"onclosenamespace",{prefix:ce,uri:Be})})}f===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=x.TEXT}function Ot(m){var f=m.entity,q=f.toLowerCase(),b,J="";return m.ENTITIES[f]?m.ENTITIES[f]:m.ENTITIES[q]?m.ENTITIES[q]:(f=q,f.charAt(0)==="#"&&(f.charAt(1)==="x"?(f=f.slice(2),b=parseInt(f,16),J=b.toString(16)):(f=f.slice(1),b=parseInt(f,10),J=b.toString(10))),f=f.replace(/^0+/,""),J.toLowerCase()!==f?($(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(b))}function Yt(m,f){f==="<"?(m.state=x.OPEN_WAKA,m.startTagPosition=m.position):H(l,f)&&($(m,"Non-whitespace before first tag."),m.textNode=f,m.state=x.TEXT)}function Tt(m,f){var q="";return f"?(Q(f,"onsgmldeclaration",f.sgmlDecl),f.sgmlDecl="",f.state=x.TEXT):(M(A,b)&&(f.state=x.SGML_DECL_QUOTED),f.sgmlDecl+=b);continue;case x.SGML_DECL_QUOTED:b===f.q&&(f.state=x.SGML_DECL,f.q=""),f.sgmlDecl+=b;continue;case x.DOCTYPE:b===">"?(f.state=x.TEXT,Q(f,"ondoctype",f.doctype),f.doctype=!0):(f.doctype+=b,b==="["?f.state=x.DOCTYPE_DTD:M(A,b)&&(f.state=x.DOCTYPE_QUOTED,f.q=b));continue;case x.DOCTYPE_QUOTED:f.doctype+=b,b===f.q&&(f.q="",f.state=x.DOCTYPE);continue;case x.DOCTYPE_DTD:f.doctype+=b,b==="]"?f.state=x.DOCTYPE:M(A,b)&&(f.state=x.DOCTYPE_DTD_QUOTED,f.q=b);continue;case x.DOCTYPE_DTD_QUOTED:f.doctype+=b,b===f.q&&(f.state=x.DOCTYPE_DTD,f.q="");continue;case x.COMMENT:b==="-"?f.state=x.COMMENT_ENDING:f.comment+=b;continue;case x.COMMENT_ENDING:b==="-"?(f.state=x.COMMENT_ENDED,f.comment=ut(f.opt,f.comment),f.comment&&Q(f,"oncomment",f.comment),f.comment=""):(f.comment+="-"+b,f.state=x.COMMENT);continue;case x.COMMENT_ENDED:b!==">"?($(f,"Malformed comment"),f.comment+="--"+b,f.state=x.COMMENT):f.state=x.TEXT;continue;case x.CDATA:b==="]"?f.state=x.CDATA_ENDING:f.cdata+=b;continue;case x.CDATA_ENDING:b==="]"?f.state=x.CDATA_ENDING_2:(f.cdata+="]"+b,f.state=x.CDATA);continue;case x.CDATA_ENDING_2:b===">"?(f.cdata&&Q(f,"oncdata",f.cdata),Q(f,"onclosecdata"),f.cdata="",f.state=x.TEXT):b==="]"?f.cdata+="]":(f.cdata+="]]"+b,f.state=x.CDATA);continue;case x.PROC_INST:b==="?"?f.state=x.PROC_INST_ENDING:M(l,b)?f.state=x.PROC_INST_BODY:f.procInstName+=b;continue;case x.PROC_INST_BODY:if(!f.procInstBody&&M(l,b))continue;b==="?"?f.state=x.PROC_INST_ENDING:f.procInstBody+=b;continue;case x.PROC_INST_ENDING:b===">"?(Q(f,"onprocessinginstruction",{name:f.procInstName,body:f.procInstBody}),f.procInstName=f.procInstBody="",f.state=x.TEXT):(f.procInstBody+="?"+b,f.state=x.PROC_INST_BODY);continue;case x.OPEN_TAG:M(N,b)?f.tagName+=b:($t(f),b===">"?Ae(f):b==="/"?f.state=x.OPEN_TAG_SLASH:(H(l,b)&&$(f,"Invalid character in tag name"),f.state=x.ATTRIB));continue;case x.OPEN_TAG_SLASH:b===">"?(Ae(f,!0),lt(f)):($(f,"Forward-slash in opening tag not followed by >"),f.state=x.ATTRIB);continue;case x.ATTRIB:if(M(l,b))continue;b===">"?Ae(f):b==="/"?f.state=x.OPEN_TAG_SLASH:M(R,b)?(f.attribName=b,f.attribValue="",f.state=x.ATTRIB_NAME):$(f,"Invalid attribute name");continue;case x.ATTRIB_NAME:b==="="?f.state=x.ATTRIB_VALUE:b===">"?($(f,"Attribute without value"),f.attribValue=f.attribName,Fe(f),Ae(f)):M(l,b)?f.state=x.ATTRIB_NAME_SAW_WHITE:M(N,b)?f.attribName+=b:$(f,"Invalid attribute name");continue;case x.ATTRIB_NAME_SAW_WHITE:if(b==="=")f.state=x.ATTRIB_VALUE;else{if(M(l,b))continue;$(f,"Attribute without value"),f.tag.attributes[f.attribName]="",f.attribValue="",Q(f,"onattribute",{name:f.attribName,value:""}),f.attribName="",b===">"?Ae(f):M(R,b)?(f.attribName=b,f.state=x.ATTRIB_NAME):($(f,"Invalid attribute name"),f.state=x.ATTRIB)}continue;case x.ATTRIB_VALUE:if(M(l,b))continue;M(A,b)?(f.q=b,f.state=x.ATTRIB_VALUE_QUOTED):($(f,"Unquoted attribute value"),f.state=x.ATTRIB_VALUE_UNQUOTED,f.attribValue=b);continue;case x.ATTRIB_VALUE_QUOTED:if(b!==f.q){b==="&"?f.state=x.ATTRIB_VALUE_ENTITY_Q:f.attribValue+=b;continue}Fe(f),f.q="",f.state=x.ATTRIB_VALUE_CLOSED;continue;case x.ATTRIB_VALUE_CLOSED:M(l,b)?f.state=x.ATTRIB:b===">"?Ae(f):b==="/"?f.state=x.OPEN_TAG_SLASH:M(R,b)?($(f,"No whitespace between attributes"),f.attribName=b,f.attribValue="",f.state=x.ATTRIB_NAME):$(f,"Invalid attribute name");continue;case x.ATTRIB_VALUE_UNQUOTED:if(H(g,b)){b==="&"?f.state=x.ATTRIB_VALUE_ENTITY_U:f.attribValue+=b;continue}Fe(f),b===">"?Ae(f):f.state=x.ATTRIB;continue;case x.CLOSE_TAG:if(f.tagName)b===">"?lt(f):M(N,b)?f.tagName+=b:f.script?(f.script+=""?lt(f):$(f,"Invalid characters in closing tag");continue;case x.TEXT_ENTITY:case x.ATTRIB_VALUE_ENTITY_Q:case x.ATTRIB_VALUE_ENTITY_U:var ue,_e;switch(f.state){case x.TEXT_ENTITY:ue=x.TEXT,_e="textNode";break;case x.ATTRIB_VALUE_ENTITY_Q:ue=x.ATTRIB_VALUE_QUOTED,_e="attribValue";break;case x.ATTRIB_VALUE_ENTITY_U:ue=x.ATTRIB_VALUE_UNQUOTED,_e="attribValue";break}b===";"?(f[_e]+=Ot(f),f.entity="",f.state=ue):M(f.entity.length?_:T,b)?f.entity+=b:($(f,"Invalid character in entity name"),f[_e]+="&"+f.entity+b,f.entity="",f.state=ue);continue;default:throw new Error(f,"Unknown state: "+f.state)}return f.position>=f.bufferCheckPosition&&i(f),f}String.fromCodePoint||function(){var m=String.fromCharCode,f=Math.floor,q=function(){var b=16384,J=[],ae,ue,_e=-1,Pe=arguments.length;if(!Pe)return"";for(var z="";++_e1114111||f(ce)!==ce)throw RangeError("Invalid code point: "+ce);ce<=65535?J.push(ce):(ce-=65536,ae=(ce>>10)+55296,ue=ce%1024+56320,J.push(ae,ue)),(_e+1===Pe||J.length>b)&&(z+=m.apply(null,J),J.length=0)}return z};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:q,configurable:!0,writable:!0}):String.fromCodePoint=q}()})(typeof Ji>"u"?Ji.sax={}:Ji)});var Wl=I(Ts=>{(function(){"use strict";Ts.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Ts)});var _s=I(Kt=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Kt.normalize=function(e){return e.toLowerCase()},Kt.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Kt.stripPrefix=function(e){return e.replace(t,"")},Kt.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Kt.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Kt)});var Hl=I(Xt=>{(function(){"use strict";var t,e,r,i,n,s,o,a,u=function(d,v){return function(){return d.apply(v,arguments)}},c=function(d,v){for(var A in v)l.call(v,A)&&(d[A]=v[A]);function g(){this.constructor=d}return g.prototype=v.prototype,d.prototype=new g,d.__super__=v.prototype,d},l={}.hasOwnProperty;o=jl(),r=require("events"),t=Wl(),s=_s(),a=require("timers").setImmediate,e=$i().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},n=function(d,v,A){var g,E,P;for(g=0,E=d.length;g0&&(N[S.options.childkey]=_),_=N;else if(M){M[S.options.childkey]=M[S.options.childkey]||[],O={};for(R in _)l.call(_,R)&&(O[R]=_[R]);M[S.options.childkey].push(O),delete _["#name"],Object.keys(_).length===1&&g in _&&!S.EXPLICIT_CHARKEY&&(_=_[g])}}return P.length>0?S.assignOrPush(M,T,_):(S.options.explicitRoot&&(W=_,_={},_[T]=W),S.resultObject=_,S.saxParser.ended=!0,S.emit("end",S.resultObject))}}(this),E=function(S){return function(h){var w,R;if(R=P[P.length-1],R)return R[g]+=h,S.options.explicitChildren&&S.options.preserveChildrenOrder&&S.options.charsAsChildren&&(S.options.includeWhiteChars||h.replace(/\\n/g,"").trim()!=="")&&(R[S.options.childkey]=R[S.options.childkey]||[],w={"#name":"__text__"},w[g]=h,S.options.normalize&&(w[g]=w[g].replace(/\s{2,}/g," ").trim()),R[S.options.childkey].push(w)),R}}(this),this.saxParser.ontext=E,this.saxParser.oncdata=function(S){return function(h){var w;if(w=E(h),w)return w.cdata=!0}}(this)},v.prototype.parseString=function(A,g){var E;g!=null&&typeof g=="function"&&(this.on("end",function(P){return this.reset(),g(null,P)}),this.on("error",function(P){return this.reset(),g(P)}));try{return A=A.toString(),A.trim()===""?(this.emit("end",null),!0):(A=t.stripBOM(A),this.options.async?(this.remaining=A,a(this.processAsync),this.saxParser):this.saxParser.write(A).close())}catch(P){if(E=P,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw E}else return this.emit("error",E),this.saxParser.errThrown=!0}},v}(r.EventEmitter),Xt.parseString=function(d,v,A){var g,E,P;return A!=null?(typeof A=="function"&&(g=A),typeof v=="object"&&(E=v)):(typeof v=="function"&&(g=v),E={}),P=new Xt.Parser(E),P.parseString(d,g)}}).call(Xt)});var zl=I(Nt=>{(function(){"use strict";var t,e,r,i,n=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=$i(),t=Vl(),r=Hl(),i=_s(),Nt.defaults=e.defaults,Nt.processors=i,Nt.ValidationError=function(o){n(a,o);function a(u){this.message=u}return a}(Error),Nt.Builder=t.Builder,Nt.Parser=r.Parser,Nt.parseString=r.parseString}).call(Nt)});var Jl=I((vS,Yl)=>{var Kl=V(),Xr=Kl.util,yg=Kl.Model.Shape,Eg=zl(),Sg={explicitCharkey:!1,trim:!1,normalize:!1,explicitRoot:!1,emptyTag:null,explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,validator:null};function Xl(){}Xl.prototype.parse=function(t,e){e=e||{};var r=null,i=null,n=new Eg.Parser(Sg);if(n.parseString(t,function(o,a){i=o,r=a}),r){var s=wt(r,e);return r.ResponseMetadata&&(s.ResponseMetadata=wt(r.ResponseMetadata[0],{})),s}else{if(i)throw Xr.error(i,{code:"XMLParserError",retryable:!0});return wt({},e)}};function wt(t,e){switch(e.type){case"structure":return wg(t,e);case"map":return Cg(t,e);case"list":return Gl(t,e);case void 0:case null:return Tg(t);default:return $l(t,e)}}function wg(t,e){var r={};return t===null||Xr.each(e.members,function(i,n){var s=n.name;if(Object.prototype.hasOwnProperty.call(t,s)&&Array.isArray(t[s])){var o=t[s];n.flattened||(o=o[0]),r[i]=wt(o,n)}else n.isXmlAttribute&&t.$&&Object.prototype.hasOwnProperty.call(t.$,s)?r[i]=$l(t.$[s],n):n.type==="list"&&!e.api.xmlNoDefaultLists&&(r[i]=n.defaultValue)}),r}function Cg(t,e){var r={};if(t===null)return r;var i=e.key.name||"key",n=e.value.name||"value",s=e.flattened?t:t.entry;return Array.isArray(s)&&Xr.arrayEach(s,function(o){r[o[i][0]]=wt(o[n][0],e.value)}),r}function Gl(t,e){var r=[],i=e.member.name||"member";return e.flattened?Xr.arrayEach(t,function(n){r.push(wt(n,e.member))}):t&&Array.isArray(t[i])&&Xr.arrayEach(t[i],function(n){r.push(wt(n,e.member))}),r}function $l(t,e){return t&&t.$&&t.$.encoding==="base64"&&(e=new yg.create({type:t.$.encoding})),t&&t._&&(t=t._),typeof e.toType=="function"?e.toType(t):t}function Tg(t){if(t==null)return"";if(typeof t=="string")return t;if(Array.isArray(t)){var e=[];for(i=0;i1?n[s]=Gl(o,{member:{}}):n[s]=wt(o[0],{}))}return n}Yl.exports=Xl});var Zl=I(()=>{var se=V(),_g=se.util.stream.Stream,Ql=se.util.stream.Transform,Ag=se.util.stream.Readable;_i();var xg="AWS_NODEJS_CONNECTION_REUSE_ENABLED";se.NodeHttpClient=se.util.inherit({handleRequest:function(e,r,i,n){var s=this,o=e.endpoint,a="";r||(r={}),r.proxy&&(a=o.protocol+"//"+o.hostname,o.port!==80&&o.port!==443&&(a+=":"+o.port),o=new se.Endpoint(r.proxy));var u=o.protocol==="https:",c=u?require("https"):require("http"),l={host:o.hostname,port:o.port,method:e.method,headers:e.headers,path:a+e.path};r.agent||(l.agent=this.getAgent(u,{keepAlive:process.env[xg]==="1"})),se.util.update(l,r),delete l.proxy,delete l.timeout;var d=c.request(l,function(g){d.didCallback||(i(g),g.emit("headers",g.statusCode,g.headers,g.statusMessage))});if(e.stream=d,d.didCallback=!1,r.connectTimeout){var v;d.on("socket",function(g){g.connecting&&(v=setTimeout(function(){d.didCallback||(d.didCallback=!0,d.abort(),n(se.util.error(new Error("Socket timed out without establishing a connection"),{code:"TimeoutError"})))},r.connectTimeout),g.on("connect",function(){clearTimeout(v),v=null}))})}d.setTimeout(r.timeout||0,function(){if(!d.didCallback){d.didCallback=!0;var g="Connection timed out after "+r.timeout+"ms";n(se.util.error(new Error(g),{code:"TimeoutError"})),d.abort()}}),d.on("error",function(g){v&&(clearTimeout(v),v=null),!d.didCallback&&(d.didCallback=!0,g.code==="ECONNRESET"||g.code==="EPIPE"||g.code==="ETIMEDOUT"?n(se.util.error(g,{code:"TimeoutError"})):n(g))});var A=e.headers.Expect||e.headers.expect;return A==="100-continue"?d.once("continue",function(){s.writeBody(d,e)}):this.writeBody(d,e),d},writeBody:function(e,r){var i=r.body,n=parseInt(r.headers["Content-Length"],10);if(i instanceof _g){var s=this.progressStream(e,n);s?i.pipe(s).pipe(e):i.pipe(e)}else i?(e.once("finish",function(){e.emit("sendProgress",{loaded:n,total:n})}),e.end(i)):e.end()},getAgent:function(e,r){var i=e?require("https"):require("http");return e?(se.NodeHttpClient.sslAgent||(se.NodeHttpClient.sslAgent=new i.Agent(se.util.merge({rejectUnauthorized:process.env.NODE_TLS_REJECT_UNAUTHORIZED!=="0"},r||{})),se.NodeHttpClient.sslAgent.setMaxListeners(0),Object.defineProperty(se.NodeHttpClient.sslAgent,"maxSockets",{enumerable:!0,get:function(){var n=50,s=i.globalAgent;return s&&s.maxSockets!==1/0&&typeof s.maxSockets=="number"?s.maxSockets:n}})),se.NodeHttpClient.sslAgent):(se.NodeHttpClient.agent||(se.NodeHttpClient.agent=new i.Agent(r)),se.NodeHttpClient.agent)},progressStream:function(e,r){if(!(typeof Ql>"u")){var i=0,n=new Ql;return n._transform=function(s,o,a){s&&(i+=s.length,e.emit("sendProgress",{loaded:i,total:r})),a(null,s)},n}},emitter:null});se.HttpClient.prototype=se.NodeHttpClient.prototype;se.HttpClient.streamsApiVersion=Ag?2:1});var ef=I(()=>{var ze=V(),bg=require("fs"),Rg=Pt(),Ig=ze.util.iniLoader;ze.TokenFileWebIdentityCredentials=ze.util.inherit(ze.Credentials,{constructor:function(e){ze.Credentials.call(this),this.data=null,this.clientConfig=ze.util.copy(e||{})},getParamsFromEnv:function(){var e="AWS_WEB_IDENTITY_TOKEN_FILE",r="AWS_ROLE_ARN";if(process.env[e]&&process.env[r])return[{envTokenFile:process.env[e],roleArn:process.env[r],roleSessionName:process.env.AWS_ROLE_SESSION_NAME}]},getParamsFromSharedConfig:function(){var e=ze.util.getProfilesFromSharedConfig(Ig),r=process.env.AWS_PROFILE||ze.util.defaultProfile,i=e[r]||{};if(Object.keys(i).length===0)throw ze.util.error(new Error("Profile "+r+" not found"),{code:"TokenFileWebIdentityCredentialsProviderFailure"});for(var n=[];!i.web_identity_token_file&&i.source_profile;){n.unshift({roleArn:i.role_arn,roleSessionName:i.role_session_name});var s=i.source_profile;i=e[s]}return n.unshift({envTokenFile:i.web_identity_token_file,roleArn:i.role_arn,roleSessionName:i.role_session_name}),n},refresh:function(e){this.coalesceRefresh(e||ze.util.fn.callback)},assumeRoleChaining:function(e,r){var i=this;if(e.length===0)i.service.credentialsFrom(i.data,i),r();else{var n=e.shift();i.service.config.credentials=i.service.credentialsFrom(i.data,i),i.service.assumeRole({RoleArn:n.roleArn,RoleSessionName:n.roleSessionName||"token-file-web-identity"},function(s,o){i.data=null,s?r(s):(i.data=o,i.assumeRoleChaining(e,r))})}},load:function(e){var r=this;try{var i=r.getParamsFromEnv();if(i||(i=r.getParamsFromSharedConfig()),i){var n=i.shift(),s=bg.readFileSync(n.envTokenFile,{encoding:"ascii"});r.service||r.createClients(),r.service.assumeRoleWithWebIdentity({WebIdentityToken:s,RoleArn:n.roleArn,RoleSessionName:n.roleSessionName||"token-file-web-identity"},function(o,a){r.data=null,o?e(o):(r.data=a,r.assumeRoleChaining(i,e))})}}catch(o){e(o)}},createClients:function(){if(!this.service){var t=ze.util.merge({},this.clientConfig);this.service=new Rg(t),this.service.retryableError=function(e){return e.code==="IDPCommunicationErrorException"||e.code==="InvalidIdentityToken"?!0:ze.Service.prototype.retryableError.call(this,e)}}}})});var rf=I((wS,tf)=>{var Pg=function(){return{IPv4:"http://169.254.169.254",IPv6:"http://[fd00:ec2::254]"}};tf.exports=Pg});var As=I((CS,nf)=>{var Ng=function(){return{IPv4:"IPv4",IPv6:"IPv6"}};nf.exports=Ng});var of=I((TS,sf)=>{var Dg="AWS_EC2_METADATA_SERVICE_ENDPOINT",qg="ec2_metadata_service_endpoint",kg=function(){return{environmentVariableSelector:function(t){return t[Dg]},configFileSelector:function(t){return t[qg]},default:void 0}};sf.exports=kg});var uf=I((_S,af)=>{var Og=As()(),Lg="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",Mg="ec2_metadata_service_endpoint_mode",Fg=function(){return{environmentVariableSelector:function(t){return t[Lg]},configFileSelector:function(t){return t[Mg]},default:Og.IPv4}};af.exports=Fg});var df=I((AS,pf)=>{var cf=V(),lf=rf()(),ff=As()(),Bg=of()(),Ug=uf()(),Vg=function(){var t=cf.util.loadConfig(Bg);if(t!==void 0)return t;var e=cf.util.loadConfig(Ug);switch(e){case ff.IPv4:return lf.IPv4;case ff.IPv6:return lf.IPv6;default:throw new Error("Unsupported endpoint mode: "+e)}};pf.exports=Vg});var vf=I((xS,mf)=>{var Qe=V();_i();var jg=Qe.util.inherit,Wg=df(),hf=require("url").URL;Qe.MetadataService=jg({endpoint:Wg(),httpOptions:{timeout:0},disableFetchToken:!1,constructor:function(e){e&&e.host&&(e.endpoint="http://"+e.host,delete e.host),Qe.util.update(this,e)},request:function(e,r,i){if(arguments.length===2&&(i=r,r={}),process.env[Qe.util.imdsDisabledEnv]){i(new Error("EC2 Instance Metadata Service access disabled"));return}e=e||"/",hf&&new hf(this.endpoint);var n=new Qe.HttpRequest(this.endpoint+e);n.method=r.method||"GET",r.headers&&(n.headers=r.headers),Qe.util.handleRequestWithRetries(n,this,i)},loadCredentialsCallbacks:[],fetchMetadataToken:function(e){var r=this,i="/latest/api/token";r.request(i,{method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}},e)},fetchCredentials:function(e,r){var i=this,n="/latest/meta-data/iam/security-credentials/";i.request(n,e,function(s,o){if(s){i.disableFetchToken=s.statusCode!==401,r(Qe.util.error(s,{message:"EC2 Metadata roleName request returned error"}));return}o=o.split(` +`)[0],i.request(n+o,e,function(a,u){if(a){i.disableFetchToken=a.statusCode!==401,r(Qe.util.error(a,{message:"EC2 Metadata creds request returned error"}));return}try{var c=JSON.parse(u);r(null,c)}catch(l){r(l)}})})},loadCredentials:function(e){var r=this;if(r.loadCredentialsCallbacks.push(e),r.loadCredentialsCallbacks.length>1)return;function i(n,s){for(var o;(o=r.loadCredentialsCallbacks.shift())!==void 0;)o(n,s)}r.disableFetchToken?r.fetchCredentials({},i):r.fetchMetadataToken(function(n,s){if(n){if(n.code==="TimeoutError")r.disableFetchToken=!0;else if(n.retryable===!0){i(Qe.util.error(n,{message:"EC2 Metadata token request returned error"}));return}else if(n.statusCode===400){i(Qe.util.error(n,{message:"EC2 Metadata token request returned 400"}));return}}var o={};s&&(o.headers={"x-aws-ec2-metadata-token":s}),r.fetchCredentials(o,i)})}});mf.exports=Qe.MetadataService});var gf=I(()=>{var Me=V();vf();Me.EC2MetadataCredentials=Me.util.inherit(Me.Credentials,{constructor:function(e){Me.Credentials.call(this),e=e?Me.util.copy(e):{},e=Me.util.merge({maxRetries:this.defaultMaxRetries},e),e.httpOptions||(e.httpOptions={}),e.httpOptions=Me.util.merge({timeout:this.defaultTimeout,connectTimeout:this.defaultConnectTimeout},e.httpOptions),this.metadataService=new Me.MetadataService(e),this.logger=e.logger||Me.config&&Me.config.logger},defaultTimeout:1e3,defaultConnectTimeout:1e3,defaultMaxRetries:3,originalExpiration:void 0,refresh:function(e){this.coalesceRefresh(e||Me.util.fn.callback)},load:function(e){var r=this;r.metadataService.loadCredentials(function(i,n){i?r.hasLoadedCredentials()?(r.extendExpirationIfExpired(),e()):e(i):(r.setCredentials(n),r.extendExpirationIfExpired(),e())})},hasLoadedCredentials:function(){return this.AccessKeyId&&this.secretAccessKey},extendExpirationIfExpired:function(){if(this.needsRefresh()){this.originalExpiration=this.originalExpiration||this.expireTime,this.expired=!1;var e=15*60+Math.floor(Math.random()*5*60),r=Me.util.date.getDate().getTime();this.expireTime=new Date(r+e*1e3),this.logger.warn("Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted again at "+this.expireTime+` +For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`)}},setCredentials:function(e){var r=Me.util.date.getDate().getTime(),i=new Date(e.Expiration);this.expired=r>=i,this.metadata=e,this.accessKeyId=e.AccessKeyId,this.secretAccessKey=e.SecretAccessKey,this.sessionToken=e.Token,this.expireTime=i}})});var Sf=I(()=>{var Ce=V(),xs="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",Qi="AWS_CONTAINER_CREDENTIALS_FULL_URI",Hg="AWS_CONTAINER_AUTHORIZATION_TOKEN",zg=["https:"],yf=["http:","https:"],Ef=["localhost","127.0.0.1"],Kg="169.254.170.2";Ce.RemoteCredentials=Ce.util.inherit(Ce.Credentials,{constructor:function(e){Ce.Credentials.call(this),e=e?Ce.util.copy(e):{},e.httpOptions||(e.httpOptions={}),e.httpOptions=Ce.util.merge(this.httpOptions,e.httpOptions),Ce.util.update(this,e)},httpOptions:{timeout:1e3},maxRetries:3,isConfiguredForEcsCredentials:function(){return!!(process&&process.env&&(process.env[xs]||process.env[Qi]))},getECSFullUri:function(){if(process&&process.env){var e=process.env[xs],r=process.env[Qi];if(e)return"http://"+Kg+e;if(r){var i=Ce.util.urlParse(r);if(yf.indexOf(i.protocol)<0)throw Ce.util.error(new Error("Unsupported protocol: AWS.RemoteCredentials supports "+yf.join(",")+" only; "+i.protocol+" requested."),{code:"ECSCredentialsProviderFailure"});if(zg.indexOf(i.protocol)<0&&Ef.indexOf(i.hostname)<0)throw Ce.util.error(new Error("Unsupported hostname: AWS.RemoteCredentials only supports "+Ef.join(",")+" for "+i.protocol+"; "+i.protocol+"//"+i.hostname+" requested."),{code:"ECSCredentialsProviderFailure"});return r}else throw Ce.util.error(new Error("Variable "+xs+" or "+Qi+" must be set to use AWS.RemoteCredentials."),{code:"ECSCredentialsProviderFailure"})}else throw Ce.util.error(new Error("No process info available"),{code:"ECSCredentialsProviderFailure"})},getECSAuthToken:function(){if(process&&process.env&&process.env[Qi])return process.env[Hg]},credsFormatIsValid:function(e){return!!e.accessKeyId&&!!e.secretAccessKey&&!!e.sessionToken&&!!e.expireTime},formatCreds:function(e){return e.credentials&&(e=e.credentials),{expired:!1,accessKeyId:e.accessKeyId||e.AccessKeyId,secretAccessKey:e.secretAccessKey||e.SecretAccessKey,sessionToken:e.sessionToken||e.Token,expireTime:new Date(e.expiration||e.Expiration)}},request:function(e,r){var i=new Ce.HttpRequest(e);i.method="GET",i.headers.Accept="application/json";var n=this.getECSAuthToken();n&&(i.headers.Authorization=n),Ce.util.handleRequestWithRetries(i,this,r)},refresh:function(e){this.coalesceRefresh(e||Ce.util.fn.callback)},load:function(e){var r=this,i;try{i=this.getECSFullUri()}catch(n){e(n);return}this.request(i,function(n,s){if(!n)try{s=JSON.parse(s);var o=r.formatCreds(s);if(!r.credsFormatIsValid(o))throw Ce.util.error(new Error("Response data is not in valid format"),{code:"ECSCredentialsProviderFailure"});Ce.util.update(r,o)}catch(a){n=a}e(n,o)})}})});var Cf=I(()=>{var wf=V();wf.ECSCredentials=wf.RemoteCredentials});var Tf=I(()=>{var Dt=V();Dt.EnvironmentCredentials=Dt.util.inherit(Dt.Credentials,{constructor:function(e){Dt.Credentials.call(this),this.envPrefix=e,this.get(function(){})},refresh:function(e){if(e||(e=Dt.util.fn.callback),!process||!process.env){e(Dt.util.error(new Error("No process info or environment variables available"),{code:"EnvironmentCredentialsProviderFailure"}));return}for(var r=["ACCESS_KEY_ID","SECRET_ACCESS_KEY","SESSION_TOKEN"],i=[],n=0;n{var qt=V();qt.FileSystemCredentials=qt.util.inherit(qt.Credentials,{constructor:function(e){qt.Credentials.call(this),this.filename=e,this.get(function(){})},refresh:function(e){e||(e=qt.util.fn.callback);try{var r=JSON.parse(qt.util.readFileSync(this.filename));if(qt.Credentials.call(this,r),!this.accessKeyId||!this.secretAccessKey)throw qt.util.error(new Error("Credentials not set in "+this.filename),{code:"FileSystemCredentialsProviderFailure"});this.expired=!1,e()}catch(i){e(i)}}})});var xf=I(()=>{var Te=V(),Xg=Pt(),Af=Te.util.iniLoader,Gg="us-east-1";Te.SharedIniFileCredentials=Te.util.inherit(Te.Credentials,{constructor:function(e){Te.Credentials.call(this),e=e||{},this.filename=e.filename,this.profile=e.profile||process.env.AWS_PROFILE||Te.util.defaultProfile,this.disableAssumeRole=!!e.disableAssumeRole,this.preferStaticCredentials=!!e.preferStaticCredentials,this.tokenCodeFn=e.tokenCodeFn||null,this.httpOptions=e.httpOptions||null,this.get(e.callback||Te.util.fn.noop)},load:function(e){var r=this;try{var i=Te.util.getProfilesFromSharedConfig(Af,this.filename),n=i[this.profile]||{};if(Object.keys(n).length===0)throw Te.util.error(new Error("Profile "+this.profile+" not found"),{code:"SharedIniFileCredentialsProviderFailure"});var s=!!(this.preferStaticCredentials&&n.aws_access_key_id&&n.aws_secret_access_key);if(n.role_arn&&!s){this.loadRoleProfile(i,n,function(o,a){o?e(o):(r.expired=!1,r.accessKeyId=a.Credentials.AccessKeyId,r.secretAccessKey=a.Credentials.SecretAccessKey,r.sessionToken=a.Credentials.SessionToken,r.expireTime=a.Credentials.Expiration,e(null))});return}if(this.accessKeyId=n.aws_access_key_id,this.secretAccessKey=n.aws_secret_access_key,this.sessionToken=n.aws_session_token,!this.accessKeyId||!this.secretAccessKey)throw Te.util.error(new Error("Credentials not set for profile "+this.profile),{code:"SharedIniFileCredentialsProviderFailure"});this.expired=!1,e(null)}catch(o){e(o)}},refresh:function(e){Af.clearCachedFiles(),this.coalesceRefresh(e||Te.util.fn.callback,this.disableAssumeRole)},loadRoleProfile:function(e,r,i){if(this.disableAssumeRole)throw Te.util.error(new Error("Role assumption profiles are disabled. Failed to load profile "+this.profile+" from "+e.filename),{code:"SharedIniFileCredentialsProviderFailure"});var n=this,s=r.role_arn,o=r.role_session_name,a=r.external_id,u=r.mfa_serial,c=r.source_profile,l=r.region||Gg;if(!c)throw Te.util.error(new Error("source_profile is not set using profile "+this.profile),{code:"SharedIniFileCredentialsProviderFailure"});var d=e[c];if(typeof d!="object")throw Te.util.error(new Error("source_profile "+c+" using profile "+this.profile+" does not exist"),{code:"SharedIniFileCredentialsProviderFailure"});var v=new Te.SharedIniFileCredentials(Te.util.merge(this.options||{},{profile:c,preferStaticCredentials:!0}));this.roleArn=s;var A=new Xg({credentials:v,region:l,httpOptions:this.httpOptions}),g={RoleArn:s,RoleSessionName:o||"aws-sdk-js-"+Date.now()};if(a&&(g.ExternalId=a),u&&n.tokenCodeFn){g.SerialNumber=u,n.tokenCodeFn(u,function(E,P){if(E){var S;E instanceof Error?S=E.message:S=E,i(Te.util.error(new Error("Error fetching MFA token: "+S),{code:"SharedIniFileCredentialsProviderFailure"}));return}g.TokenCode=P,A.assumeRole(g,i)});return}A.assumeRole(g,i)}})});var bf=I(()=>{var fe=V(),$g=require("path"),Yg=require("crypto"),bs=fe.util.iniLoader;fe.SsoCredentials=fe.util.inherit(fe.Credentials,{constructor:function(e){fe.Credentials.call(this),e=e||{},this.errorCode="SsoCredentialsProviderFailure",this.expired=!0,this.filename=e.filename,this.profile=e.profile||process.env.AWS_PROFILE||fe.util.defaultProfile,this.service=e.ssoClient,this.httpOptions=e.httpOptions||null,this.get(e.callback||fe.util.fn.noop)},load:function(e){var r=this;try{var i=fe.util.getProfilesFromSharedConfig(bs,this.filename),n=i[this.profile]||{};if(Object.keys(n).length===0)throw fe.util.error(new Error("Profile "+this.profile+" not found"),{code:r.errorCode});if(n.sso_session){if(!n.sso_account_id||!n.sso_role_name)throw fe.util.error(new Error("Profile "+this.profile+" with session "+n.sso_session+' does not have valid SSO credentials. Required parameters "sso_account_id", "sso_session", "sso_role_name". Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html'),{code:r.errorCode})}else if(!n.sso_start_url||!n.sso_account_id||!n.sso_region||!n.sso_role_name)throw fe.util.error(new Error("Profile "+this.profile+' does not have valid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html'),{code:r.errorCode});this.getToken(this.profile,n,function(s,o){if(s)return e(s);var a={accessToken:o,accountId:n.sso_account_id,roleName:n.sso_role_name};(!r.service||r.service.config.region!==n.sso_region)&&(r.service=new fe.SSO({region:n.sso_region,httpOptions:r.httpOptions})),r.service.getRoleCredentials(a,function(u,c){if(u||!c||!c.roleCredentials)e(fe.util.error(u||new Error('Please log in using "aws sso login"'),{code:r.errorCode}),null);else{if(!c.roleCredentials.accessKeyId||!c.roleCredentials.secretAccessKey||!c.roleCredentials.sessionToken||!c.roleCredentials.expiration)throw fe.util.error(new Error("SSO returns an invalid temporary credential."));r.expired=!1,r.accessKeyId=c.roleCredentials.accessKeyId,r.secretAccessKey=c.roleCredentials.secretAccessKey,r.sessionToken=c.roleCredentials.sessionToken,r.expireTime=new Date(c.roleCredentials.expiration),e(null)}})})}catch(s){e(s)}},getToken:function(e,r,i){var n=this;if(r.sso_session){var s=fe.util.iniLoader,o=s.loadSsoSessionsFrom(),a=o[r.sso_session];Object.assign(r,a);var u=new fe.SSOTokenProvider({profile:e});u.load(function(E){return E?i(E):i(null,u.token)});return}try{var c=9e5,l=Yg.createHash("sha1"),d=l.update(r.sso_start_url).digest("hex")+".json",v=$g.join(bs.getHomeDir(),".aws","sso","cache",d),A=fe.util.readFileSync(v),g=null;if(A&&(g=JSON.parse(A)),!g)throw fe.util.error(new Error("Cached credentials not found under "+this.profile+" profile. Please make sure you log in with aws sso login first"),{code:n.errorCode});if(!g.startUrl||!g.region||!g.accessToken||!g.expiresAt)throw fe.util.error(new Error("Cached credentials are missing required properties. Try running aws sso login."));if(new Date(g.expiresAt).getTime()-Date.now()<=c)throw fe.util.error(new Error("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile."));return i(null,g.accessToken)}catch(E){return i(E,null)}},refresh:function(e){bs.clearCachedFiles(),this.coalesceRefresh(e||fe.util.fn.callback)}})});var Rf=I(()=>{var Ke=V();Ke.Token=Ke.util.inherit({constructor:function(e){if(Ke.util.hideProperties(this,["token"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],arguments.length===1){var e=arguments[0];this.token=e.token,this.expireTime=e.expireTime}},expiryWindow:15,needsRefresh:function(){var e=Ke.util.date.getDate().getTime(),r=new Date(e+this.expiryWindow*1e3);return this.expireTime&&r>this.expireTime?!0:this.expired||!this.token},get:function(e){var r=this;this.needsRefresh()?this.refresh(function(i){i||(r.expired=!1),e&&e(i)}):e&&e()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,r){var i=this;i.refreshCallbacks.push(e)===1&&i.load(function(s){Ke.util.arrayEach(i.refreshCallbacks,function(o){r?o(s):Ke.util.defer(function(){o(s)})}),i.refreshCallbacks.length=0})},load:function(e){e()}});Ke.Token.addPromisesToClass=function(e){this.prototype.getPromise=Ke.util.promisifyMethod("get",e),this.prototype.refreshPromise=Ke.util.promisifyMethod("refresh",e)};Ke.Token.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise};Ke.util.addPromises(Ke.Token)});var If=I(()=>{var Ze=V();Ze.TokenProviderChain=Ze.util.inherit(Ze.Token,{constructor:function(e){e?this.providers=e:this.providers=Ze.TokenProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var r=this;if(r.providers.length===0)return e(new Error("No providers")),r;if(r.resolveCallbacks.push(e)===1){let o=function(a,u){if(!a&&u||i===n.length){Ze.util.arrayEach(r.resolveCallbacks,function(l){l(a,u)}),r.resolveCallbacks.length=0;return}var c=n[i++];typeof c=="function"?u=c.call():u=c,u.get?u.get(function(l){o(l,l?null:u)}):o(null,u)};var s=o,i=0,n=r.providers.slice(0);o()}return r}});Ze.TokenProviderChain.defaultProviders=[];Ze.TokenProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=Ze.util.promisifyMethod("resolve",e)};Ze.TokenProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise};Ze.util.addPromises(Ze.TokenProviderChain)});var Df=I(()=>{var ve=V(),Jg=require("crypto"),Pf=require("fs"),Qg=require("path"),Zi=ve.util.iniLoader,Nf=0,Gt=function(e,r){if(!e[r])throw ve.util.error(new Error('Key "'+r+'" not present in SSO Token'),{code:"SSOTokenProviderFailure"})},Rs=function(e,r,i){if(r>e)i(null);else throw ve.util.error(new Error('SSO Token refresh failed. Please log in using "aws sso login"'),{code:"SSOTokenProviderFailure"})};ve.SSOTokenProvider=ve.util.inherit(ve.Token,{expiryWindow:5*60,constructor:function(e){ve.Token.call(this),e=e||{},this.expired=!0,this.profile=e.profile||process.env.AWS_PROFILE||ve.util.defaultProfile,this.get(e.callback||ve.util.fn.noop)},load:function(e){var r=this,i=Zi.loadFrom({isConfig:!0}),n=i[this.profile]||{};if(Object.keys(n).length===0)throw ve.util.error(new Error('Profile "'+this.profile+'" not found'),{code:"SSOTokenProviderFailure"});if(!n.sso_session)throw ve.util.error(new Error('Profile "'+profileName+'" is missing required property "sso_session".'),{code:"SSOTokenProviderFailure"});var s=n.sso_session,o=Zi.loadSsoSessionsFrom(),a=o[s];if(a)if(a.sso_start_url){if(!a.sso_region)throw ve.util.error(new Error('Sso session "'+profileName+'" is missing required property "sso_region".'),{code:"SSOTokenProviderFailure"})}else throw ve.util.error(new Error('Sso session "'+profileName+'" is missing required property "sso_start_url".'),{code:"SSOTokenProviderFailure"});else throw ve.util.error(new Error('Sso session "'+s+'" not found'),{code:"SSOTokenProviderFailure"});var u=Jg.createHash("sha1"),c=u.update(s).digest("hex")+".json",l=Qg.join(Zi.getHomeDir(),".aws","sso","cache",c),d=JSON.parse(Pf.readFileSync(l));if(!d)throw ve.util.error(new Error('Cached token not found. Please log in using "aws sso login" for profile "'+this.profile+'".'),{code:"SSOTokenProviderFailure"});Gt(d,"accessToken"),Gt(d,"expiresAt");var v=ve.util.date.getDate().getTime(),A=new Date(v+this.expiryWindow*1e3),g=new Date(d.expiresAt);if(g>A){r.token=d.accessToken,r.expireTime=g,r.expired=!1,e(null);return}if(v-Nf<30*1e3){Rs(v,g,e);return}Gt(d,"clientId"),Gt(d,"clientSecret"),Gt(d,"refreshToken"),(!r.service||r.service.config.region!==a.sso_region)&&(r.service=new ve.SSOOIDC({region:a.sso_region}));var E={clientId:d.clientId,clientSecret:d.clientSecret,refreshToken:d.refreshToken,grantType:"refresh_token"};Nf=ve.util.date.getDate().getTime(),r.service.createToken(E,function(P,S){if(P||!S)Rs(v,g,e);else try{Gt(S,"accessToken"),Gt(S,"expiresIn"),r.expired=!1,r.token=S.accessToken,r.expireTime=new Date(Date.now()+S.expiresIn*1e3),e(null);try{d.accessToken=S.accessToken,d.expiresAt=r.expireTime.toISOString(),d.refreshToken=S.refreshToken,Pf.writeFileSync(l,JSON.stringify(d,null,2))}catch{}}catch{Rs(v,g,e)}})},refresh:function(e){Zi.clearCachedFiles(),this.coalesceRefresh(e||ve.util.fn.callback)}})});var Xi=I((XS,Of)=>{var oe=le(),kf=Jn(),Zg=kf.isFipsRegion,ey=kf.getRealRegion;oe.isBrowser=function(){return!1};oe.isNode=function(){return!0};oe.crypto.lib=require("crypto");oe.Buffer=require("buffer").Buffer;oe.domain=require("domain");oe.stream=require("stream");oe.url=require("url");oe.querystring=require("querystring");oe.environment="nodejs";oe.createEventStream=oe.stream.Readable?hc().createEventStream:yc().createEventStream;oe.realClock=Sc();oe.clientSideMonitoring={Publisher:Cc().Publisher,configProvider:Ac()};oe.iniLoader=Pc().iniLoader;oe.getSystemErrorName=require("util").getSystemErrorName;oe.loadConfig=function(t){var e=t.environmentVariableSelector(process.env);if(e!==void 0)return e;var r={};try{r=oe.iniLoader?oe.iniLoader.loadFrom({isConfig:!0,filename:process.env[oe.sharedConfigFileEnv]}):{}}catch{}var i=r[process.env.AWS_PROFILE||oe.defaultProfile]||{},n=t.configFileSelector(i);return n!==void 0?n:typeof t.default=="function"?t.default():t.default};var te;Of.exports=te=V();Zn();es();Fc();Bc();Uc();Kc();Xc();gs();te.XML.Parser=Jl();Zl();ms();ef();gf();Sf();Cf();Tf();_f();xf();gs();bf();te.CredentialProviderChain.defaultProviders=[function(){return new te.EnvironmentCredentials("AWS")},function(){return new te.EnvironmentCredentials("AMAZON")},function(){return new te.SsoCredentials},function(){return new te.SharedIniFileCredentials},function(){return new te.ECSCredentials},function(){return new te.ProcessCredentials},function(){return new te.TokenFileWebIdentityCredentials},function(){return new te.EC2MetadataCredentials}];Rf();If();Df();te.TokenProviderChain.defaultProviders=[function(){return new te.SSOTokenProvider}];var qf=function(){var t=process.env,e=t.AWS_REGION||t.AMAZON_REGION;if(t[te.util.configOptInEnv])for(var r=[{filename:t[te.util.sharedCredentialsFileEnv]},{isConfig:!0,filename:t[te.util.sharedConfigFileEnv]}],i=te.util.iniLoader;!e&&r.length;){var n={},s=r.shift();try{n=i.loadFrom(s)}catch(a){if(s.isConfig)throw a}var o=n[t.AWS_PROFILE||te.util.defaultProfile];e=o&&o.region}return e},en=function(t){return t==="true"?!0:t==="false"?!1:void 0},ty={environmentVariableSelector:function(t){return en(t.AWS_USE_FIPS_ENDPOINT)},configFileSelector:function(t){return en(t.use_fips_endpoint)},default:!1},ry={environmentVariableSelector:function(t){return en(t.AWS_USE_DUALSTACK_ENDPOINT)},configFileSelector:function(t){return en(t.use_dualstack_endpoint)},default:!1};te.util.update(te.Config.prototype.keys,{credentials:function(){var t=null;return new te.CredentialProviderChain([function(){return new te.EnvironmentCredentials("AWS")},function(){return new te.EnvironmentCredentials("AMAZON")},function(){return new te.SharedIniFileCredentials({disableAssumeRole:!0})}]).resolve(function(e,r){e||(t=r)}),t},credentialProvider:function(){return new te.CredentialProviderChain},logger:function(){return process.env.AWSJS_DEBUG?console:null},region:function(){var t=qf();return t?ey(t):void 0},tokenProvider:function(){return new te.TokenProviderChain},useFipsEndpoint:function(){var t=qf();return Zg(t)?!0:oe.loadConfig(ty)},useDualstackEndpoint:function(){return oe.loadConfig(ry)}});te.config=new te.Config});var Lf=I((GS,iy)=>{iy.exports={version:"2.0",metadata:{apiVersion:"2018-09-22",endpointPrefix:"codeartifact",jsonVersion:"1.1",protocol:"rest-json",serviceFullName:"CodeArtifact",serviceId:"codeartifact",signatureVersion:"v4",signingName:"codeartifact",uid:"codeartifact-2018-09-22"},operations:{AssociateExternalConnection:{http:{requestUri:"/v1/repository/external-connection"},input:{type:"structure",required:["domain","repository","externalConnection"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},externalConnection:{location:"querystring",locationName:"external-connection"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},CopyPackageVersions:{http:{requestUri:"/v1/package/versions/copy"},input:{type:"structure",required:["domain","sourceRepository","destinationRepository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},sourceRepository:{location:"querystring",locationName:"source-repository"},destinationRepository:{location:"querystring",locationName:"destination-repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},versionRevisions:{shape:"Sl"},allowOverwrite:{type:"boolean"},includeFromUpstream:{type:"boolean"}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},CreateDomain:{http:{requestUri:"/v1/domain"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},encryptionKey:{},tags:{shape:"Sy"}}},output:{type:"structure",members:{domain:{shape:"S13"}}}},CreateRepository:{http:{requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},description:{},upstreams:{shape:"S19"},tags:{shape:"Sy"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DeleteDomain:{http:{method:"DELETE",requestUri:"/v1/domain"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"}}},output:{type:"structure",members:{domain:{shape:"S13"}}}},DeleteDomainPermissionsPolicy:{http:{method:"DELETE",requestUri:"/v1/domain/permissions/policy"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},policyRevision:{location:"querystring",locationName:"policy-revision"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},DeletePackage:{http:{method:"DELETE",requestUri:"/v1/package"},input:{type:"structure",required:["domain","repository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"}}},output:{type:"structure",members:{deletedPackage:{shape:"S1l"}}}},DeletePackageVersions:{http:{requestUri:"/v1/package/versions/delete"},input:{type:"structure",required:["domain","repository","format","package","versions"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},expectedStatus:{}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},DeleteRepository:{http:{method:"DELETE",requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DeleteRepositoryPermissionsPolicy:{http:{method:"DELETE",requestUri:"/v1/repository/permissions/policies"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},policyRevision:{location:"querystring",locationName:"policy-revision"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},DescribeDomain:{http:{method:"GET",requestUri:"/v1/domain"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"}}},output:{type:"structure",members:{domain:{shape:"S13"}}}},DescribePackage:{http:{method:"GET",requestUri:"/v1/package"},input:{type:"structure",required:["domain","repository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"}}},output:{type:"structure",required:["package"],members:{package:{type:"structure",members:{format:{},namespace:{},name:{},originConfiguration:{shape:"S1m"}}}}}},DescribePackageVersion:{http:{method:"GET",requestUri:"/v1/package/version"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"}}},output:{type:"structure",required:["packageVersion"],members:{packageVersion:{type:"structure",members:{format:{},namespace:{},packageName:{},displayName:{},version:{},summary:{},homePage:{},sourceCodeRepository:{},publishedTime:{type:"timestamp"},licenses:{type:"list",member:{type:"structure",members:{name:{},url:{}}}},revision:{},status:{},origin:{shape:"S27"}}}}}},DescribeRepository:{http:{method:"GET",requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DisassociateExternalConnection:{http:{method:"DELETE",requestUri:"/v1/repository/external-connection"},input:{type:"structure",required:["domain","repository","externalConnection"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},externalConnection:{location:"querystring",locationName:"external-connection"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}},DisposePackageVersions:{http:{requestUri:"/v1/package/versions/dispose"},input:{type:"structure",required:["domain","repository","format","package","versions"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},versionRevisions:{shape:"Sl"},expectedStatus:{}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},GetAuthorizationToken:{http:{requestUri:"/v1/authorization-token"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},durationSeconds:{location:"querystring",locationName:"duration",type:"long"}}},output:{type:"structure",members:{authorizationToken:{},expiration:{type:"timestamp"}}}},GetDomainPermissionsPolicy:{http:{method:"GET",requestUri:"/v1/domain/permissions/policy"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},GetPackageVersionAsset:{http:{method:"GET",requestUri:"/v1/package/version/asset"},input:{type:"structure",required:["domain","repository","format","package","packageVersion","asset"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"},asset:{location:"querystring",locationName:"asset"},packageVersionRevision:{location:"querystring",locationName:"revision"}}},output:{type:"structure",members:{asset:{type:"blob",streaming:!0},assetName:{location:"header",locationName:"X-AssetName"},packageVersion:{location:"header",locationName:"X-PackageVersion"},packageVersionRevision:{location:"header",locationName:"X-PackageVersionRevision"}},payload:"asset"}},GetPackageVersionReadme:{http:{method:"GET",requestUri:"/v1/package/version/readme"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"}}},output:{type:"structure",members:{format:{},namespace:{},package:{},version:{},versionRevision:{},readme:{}}}},GetRepositoryEndpoint:{http:{method:"GET",requestUri:"/v1/repository/endpoint"},input:{type:"structure",required:["domain","repository","format"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"}}},output:{type:"structure",members:{repositoryEndpoint:{}}}},GetRepositoryPermissionsPolicy:{http:{method:"GET",requestUri:"/v1/repository/permissions/policy"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},ListDomains:{http:{requestUri:"/v1/domains"},input:{type:"structure",members:{maxResults:{type:"integer"},nextToken:{}}},output:{type:"structure",members:{domains:{type:"list",member:{type:"structure",members:{name:{},owner:{},arn:{},status:{},createdTime:{type:"timestamp"},encryptionKey:{}}}},nextToken:{}}}},ListPackageVersionAssets:{http:{requestUri:"/v1/package/version/assets"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{format:{},namespace:{},package:{},version:{},versionRevision:{},nextToken:{},assets:{type:"list",member:{type:"structure",required:["name"],members:{name:{},size:{type:"long"},hashes:{type:"map",key:{},value:{}}}}}}}},ListPackageVersionDependencies:{http:{requestUri:"/v1/package/version/dependencies"},input:{type:"structure",required:["domain","repository","format","package","packageVersion"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},packageVersion:{location:"querystring",locationName:"version"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{format:{},namespace:{},package:{},version:{},versionRevision:{},nextToken:{},dependencies:{type:"list",member:{type:"structure",members:{namespace:{},package:{},dependencyType:{},versionRequirement:{}}}}}}},ListPackageVersions:{http:{requestUri:"/v1/package/versions"},input:{type:"structure",required:["domain","repository","format","package"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},status:{location:"querystring",locationName:"status"},sortBy:{location:"querystring",locationName:"sortBy"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"},originType:{location:"querystring",locationName:"originType"}}},output:{type:"structure",members:{defaultDisplayVersion:{},format:{},namespace:{},package:{},versions:{type:"list",member:{type:"structure",required:["version","status"],members:{version:{},revision:{},status:{},origin:{shape:"S27"}}}},nextToken:{}}}},ListPackages:{http:{requestUri:"/v1/packages"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},packagePrefix:{location:"querystring",locationName:"package-prefix"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"},publish:{location:"querystring",locationName:"publish"},upstream:{location:"querystring",locationName:"upstream"}}},output:{type:"structure",members:{packages:{type:"list",member:{shape:"S1l"}},nextToken:{}}}},ListRepositories:{http:{requestUri:"/v1/repositories"},input:{type:"structure",members:{repositoryPrefix:{location:"querystring",locationName:"repository-prefix"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{repositories:{shape:"S3r"},nextToken:{}}}},ListRepositoriesInDomain:{http:{requestUri:"/v1/domain/repositories"},input:{type:"structure",required:["domain"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},administratorAccount:{location:"querystring",locationName:"administrator-account"},repositoryPrefix:{location:"querystring",locationName:"repository-prefix"},maxResults:{location:"querystring",locationName:"max-results",type:"integer"},nextToken:{location:"querystring",locationName:"next-token"}}},output:{type:"structure",members:{repositories:{shape:"S3r"},nextToken:{}}}},ListTagsForResource:{http:{requestUri:"/v1/tags"},input:{type:"structure",required:["resourceArn"],members:{resourceArn:{location:"querystring",locationName:"resourceArn"}}},output:{type:"structure",members:{tags:{shape:"Sy"}}}},PutDomainPermissionsPolicy:{http:{method:"PUT",requestUri:"/v1/domain/permissions/policy"},input:{type:"structure",required:["domain","policyDocument"],members:{domain:{},domainOwner:{},policyRevision:{},policyDocument:{}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},PutPackageOriginConfiguration:{http:{requestUri:"/v1/package"},input:{type:"structure",required:["domain","repository","format","package","restrictions"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},restrictions:{shape:"S1n"}}},output:{type:"structure",members:{originConfiguration:{shape:"S1m"}}}},PutRepositoryPermissionsPolicy:{http:{method:"PUT",requestUri:"/v1/repository/permissions/policy"},input:{type:"structure",required:["domain","repository","policyDocument"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},policyRevision:{},policyDocument:{}}},output:{type:"structure",members:{policy:{shape:"S1h"}}}},TagResource:{http:{requestUri:"/v1/tag"},input:{type:"structure",required:["resourceArn","tags"],members:{resourceArn:{location:"querystring",locationName:"resourceArn"},tags:{shape:"Sy"}}},output:{type:"structure",members:{}}},UntagResource:{http:{requestUri:"/v1/untag"},input:{type:"structure",required:["resourceArn","tagKeys"],members:{resourceArn:{location:"querystring",locationName:"resourceArn"},tagKeys:{type:"list",member:{}}}},output:{type:"structure",members:{}}},UpdatePackageVersionsStatus:{http:{requestUri:"/v1/package/versions/update_status"},input:{type:"structure",required:["domain","repository","format","package","versions","targetStatus"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},format:{location:"querystring",locationName:"format"},namespace:{location:"querystring",locationName:"namespace"},package:{location:"querystring",locationName:"package"},versions:{shape:"Sj"},versionRevisions:{shape:"Sl"},expectedStatus:{},targetStatus:{}}},output:{type:"structure",members:{successfulVersions:{shape:"Sp"},failedVersions:{shape:"St"}}}},UpdateRepository:{http:{method:"PUT",requestUri:"/v1/repository"},input:{type:"structure",required:["domain","repository"],members:{domain:{location:"querystring",locationName:"domain"},domainOwner:{location:"querystring",locationName:"domain-owner"},repository:{location:"querystring",locationName:"repository"},description:{},upstreams:{shape:"S19"}}},output:{type:"structure",members:{repository:{shape:"S7"}}}}},shapes:{S7:{type:"structure",members:{name:{},administratorAccount:{},domainName:{},domainOwner:{},arn:{},description:{},upstreams:{type:"list",member:{type:"structure",members:{repositoryName:{}}}},externalConnections:{type:"list",member:{type:"structure",members:{externalConnectionName:{},packageFormat:{},status:{}}}}}},Sj:{type:"list",member:{}},Sl:{type:"map",key:{},value:{}},Sp:{type:"map",key:{},value:{type:"structure",members:{revision:{},status:{}}}},St:{type:"map",key:{},value:{type:"structure",members:{errorCode:{},errorMessage:{}}}},Sy:{type:"list",member:{type:"structure",required:["key","value"],members:{key:{},value:{}}}},S13:{type:"structure",members:{name:{},owner:{},arn:{},status:{},createdTime:{type:"timestamp"},encryptionKey:{},repositoryCount:{type:"integer"},assetSizeBytes:{type:"long"},s3BucketArn:{}}},S19:{type:"list",member:{type:"structure",required:["repositoryName"],members:{repositoryName:{}}}},S1h:{type:"structure",members:{resourceArn:{},revision:{},document:{}}},S1l:{type:"structure",members:{format:{},namespace:{},package:{},originConfiguration:{shape:"S1m"}}},S1m:{type:"structure",members:{restrictions:{shape:"S1n"}}},S1n:{type:"structure",required:["publish","upstream"],members:{publish:{},upstream:{}}},S27:{type:"structure",members:{domainEntryPoint:{type:"structure",members:{repositoryName:{},externalConnectionName:{}}},originType:{}}},S3r:{type:"list",member:{type:"structure",members:{name:{},administratorAccount:{},domainName:{},domainOwner:{},arn:{},description:{}}}}}}});var Mf=I(($S,ny)=>{ny.exports={pagination:{ListDomains:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"domains"},ListPackageVersionAssets:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"assets"},ListPackageVersions:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"versions"},ListPackages:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"packages"},ListRepositories:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"repositories"},ListRepositoriesInDomain:{input_token:"nextToken",output_token:"nextToken",limit_key:"maxResults",result_key:"repositories"}}}});var Uf=I((YS,Bf)=>{Xi();var tn=V(),sy=tn.Service,Ff=tn.apiLoader;Ff.services.codeartifact={};tn.CodeArtifact=sy.defineService("codeartifact",["2018-09-22"]);Object.defineProperty(Ff.services.codeartifact,"2018-09-22",{get:function(){var e=Lf();return e.paginators=Mf().pagination,e},enumerable:!0,configurable:!0});Bf.exports=tn.CodeArtifact});var at=fr(An());var Vf=fr(Uf()),cr=require("child_process");var Gr=(r=>(r.npm="npm",r.poetry="poetry",r))(Gr||{});function et(t){console.error(t),process.exit(1)}function jf(t){return t!=null&&t.domain||et("Domain does not exist in package.json"),t!=null&&t.accountId||et("accountId does not exist in package.json"),t!=null&&t.repository||et("repository does not exist in package.json"),t!=null&&t.region||et("region does not exist in package.json"),t!=null&&t.packageType||et("packageType does not exist in package.json"),{domain:t.domain,accountId:t.accountId,repository:t.repository,region:t.region,scope:t.scope,packageType:t.packageType}}async function Wf(t,e){let r=new Vf.default,i={domain:t,domainOwner:e},n=await r.getAuthorizationToken(i).promise().catch(s=>et(s));if((n==null?void 0:n.authorizationToken)===void 0)throw et("Failed to retrieve auth token");return n.authorizationToken}function oy(){process.env.AWS_REGION||et("Missing AWS region environment variable. Please make sure that you assume a role!"),process.env.AWS_SESSION_TOKEN||et("Missing AWS session token environment variable. Please make sure that you assume a role!"),process.env.AWS_SECRET_ACCESS_KEY||et("Missing AWS serect access key environment variable. Please make sure that you assume a role!"),process.env.AWS_ACCESS_KEY_ID||et("Missing AWS access key id environment variable. Please make sure that you assume a role!")}async function ay(t){let{domain:e,accountId:r,region:i,repository:n,scope:s}=jf(t),o=await Wf(e,r),a=`//${e}-${r}.d.codeartifact.${i}.amazonaws.com/npm/${n}/`;s?(0,cr.execSync)(`npm config set ${s}:registry https://${e}-${r}.d.codeartifact.${i}.amazonaws.com/npm/${n}/`):(console.log("Scope has not been set"),(0,cr.execSync)(`npm config set registry https://${e}-${r}.d.codeartifact.${i}.amazonaws.com/npm/${n}/`)),(0,cr.execSync)(`npm config set ${a}:_authToken=${o}`),(0,cr.execSync)(`npm config set ${a}:always-auth=true`),console.log(`Set npm credentials${s?` for ${s}`:""}`)}async function uy(t){let{domain:e,accountId:r}=jf(t),i=await Wf(e,r);(0,cr.execSync)(`poetry config http-basic.mondo "aws" "${i}"`),console.log("Set codeartifact credentials for poetry")}async function Hf(t){if(oy(),t.packageType==="npm")await ay(t);else if(t.packageType==="poetry")await uy(t);else throw new Error(`invalid package type: ${t.packageType}, supported types: ${JSON.stringify(Gr)}`)}function zf(t){if(t==="npm")return"npm";if(t==="poetry")return"poetry";throw new Error(`invalid package type: ${t}, supported types: ${JSON.stringify(Gr)}`)}async function cy(){try{let t=(0,at.getInput)("domain"),e=(0,at.getInput)("accountId"),r=(0,at.getInput)("region"),i=(0,at.getInput)("repository"),n=(0,at.getInput)("scope"),s=(0,at.getInput)("packageType"),o=zf(s);console.log("Input Config Details:"),console.log(t,e,r,i,n,o),Hf({domain:t,accountId:e,region:r,repository:i,scope:n,packageType:o})}catch(t){t instanceof Error?(0,at.setFailed)(t.message):(console.error(t),(0,at.setFailed)("Unknown error"))}}cy(); +/*! Bundled license information: + +sax/lib/sax.js: + (*! http://mths.be/fromcodepoint v0.1.0 by @mathias *) +*/ //# sourceMappingURL=action.js.map diff --git a/action/action.js.map b/action/action.js.map index 7893ba9..5f24dea 100644 --- a/action/action.js.map +++ b/action/action.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../node_modules/@actions/core/src/utils.ts", "../node_modules/@actions/core/src/command.ts", "../node_modules/@actions/core/src/file-command.ts", "../node_modules/@actions/http-client/src/proxy.ts", "../node_modules/tunnel/lib/tunnel.js", "../node_modules/tunnel/index.js", "../node_modules/@actions/http-client/src/index.ts", "../node_modules/@actions/http-client/src/auth.ts", "../node_modules/@actions/core/src/oidc-utils.ts", "../node_modules/@actions/core/src/summary.ts", "../node_modules/@actions/core/src/path-utils.ts", "../node_modules/@actions/core/src/core.ts", "../node_modules/aws-sdk/lib/json/builder.js", "../node_modules/aws-sdk/lib/json/parser.js", "../node_modules/aws-sdk/lib/protocol/helpers.js", "../node_modules/aws-sdk/lib/protocol/json.js", "../node_modules/aws-sdk/lib/query/query_param_serializer.js", "../node_modules/aws-sdk/lib/model/collection.js", "../node_modules/aws-sdk/lib/model/shape.js", "../node_modules/aws-sdk/lib/protocol/query.js", "../node_modules/aws-sdk/lib/protocol/rest.js", "../node_modules/aws-sdk/lib/protocol/rest_json.js", "../node_modules/aws-sdk/lib/protocol/rest_xml.js", "../node_modules/aws-sdk/lib/xml/escape-attribute.js", "../node_modules/aws-sdk/lib/xml/xml-node.js", "../node_modules/aws-sdk/lib/xml/escape-element.js", "../node_modules/aws-sdk/lib/xml/xml-text.js", "../node_modules/aws-sdk/lib/xml/builder.js", "../node_modules/aws-sdk/lib/model/operation.js", "../node_modules/aws-sdk/lib/model/paginator.js", "../node_modules/aws-sdk/lib/model/resource_waiter.js", "../node_modules/aws-sdk/lib/model/api.js", "../node_modules/aws-sdk/lib/api_loader.js", "../node_modules/aws-sdk/vendor/endpoint-cache/utils/LRU.js", "../node_modules/aws-sdk/vendor/endpoint-cache/index.js", "../node_modules/aws-sdk/lib/sequential_executor.js", "../node_modules/aws-sdk/lib/region_config.js", "../node_modules/aws-sdk/lib/region/utils.js", "../node_modules/aws-sdk/lib/service.js", "../node_modules/aws-sdk/lib/credentials.js", "../node_modules/aws-sdk/lib/credentials/credential_provider_chain.js", "../node_modules/aws-sdk/lib/config.js", "../node_modules/aws-sdk/lib/http.js", "../node_modules/aws-sdk/lib/discover_endpoint.js", "../node_modules/aws-sdk/lib/event_listeners.js", "../node_modules/aws-sdk/lib/state_machine.js", "../node_modules/jmespath/jmespath.js", "../node_modules/aws-sdk/lib/request.js", "../node_modules/aws-sdk/lib/response.js", "../node_modules/aws-sdk/lib/resource_waiter.js", "../node_modules/aws-sdk/lib/signers/v2.js", "../node_modules/aws-sdk/lib/signers/v3.js", "../node_modules/aws-sdk/lib/signers/v3https.js", "../node_modules/aws-sdk/lib/signers/v4_credentials.js", "../node_modules/aws-sdk/lib/signers/v4.js", "../node_modules/aws-sdk/lib/signers/s3.js", "../node_modules/aws-sdk/lib/signers/presign.js", "../node_modules/aws-sdk/lib/signers/request_signer.js", "../node_modules/aws-sdk/lib/param_validator.js", "../node_modules/aws-sdk/lib/core.js", "../node_modules/uuid/dist/rng.js", "../node_modules/uuid/dist/bytesToUuid.js", "../node_modules/uuid/dist/v1.js", "../node_modules/uuid/dist/v35.js", "../node_modules/uuid/dist/md5.js", "../node_modules/uuid/dist/v3.js", "../node_modules/uuid/dist/v4.js", "../node_modules/uuid/dist/sha1.js", "../node_modules/uuid/dist/v5.js", "../node_modules/uuid/dist/index.js", "../node_modules/aws-sdk/lib/util.js", "../node_modules/aws-sdk/lib/event-stream/event-message-chunker-stream.js", "../node_modules/aws-sdk/lib/event-stream/int64.js", "../node_modules/aws-sdk/lib/event-stream/split-message.js", "../node_modules/aws-sdk/lib/event-stream/parse-message.js", "../node_modules/aws-sdk/lib/event-stream/parse-event.js", "../node_modules/aws-sdk/lib/event-stream/event-message-unmarshaller-stream.js", "../node_modules/aws-sdk/lib/event-stream/streaming-create-event-stream.js", "../node_modules/aws-sdk/lib/event-stream/event-message-chunker.js", "../node_modules/aws-sdk/lib/event-stream/buffered-create-event-stream.js", "../node_modules/aws-sdk/lib/realclock/nodeClock.js", "../node_modules/aws-sdk/lib/publisher/index.js", "../node_modules/aws-sdk/lib/publisher/configuration.js", "../node_modules/aws-sdk/lib/shared-ini/ini-loader.js", "../node_modules/aws-sdk/lib/shared-ini/index.js", "../node_modules/aws-sdk/lib/config_regional_endpoint.js", "../node_modules/aws-sdk/lib/services/sts.js", "../node_modules/aws-sdk/clients/sts.js", "../node_modules/aws-sdk/lib/credentials/temporary_credentials.js", "../node_modules/aws-sdk/lib/credentials/chainable_temporary_credentials.js", "../node_modules/aws-sdk/lib/credentials/web_identity_credentials.js", "../node_modules/aws-sdk/clients/cognitoidentity.js", "../node_modules/aws-sdk/lib/credentials/cognito_identity_credentials.js", "../node_modules/aws-sdk/lib/credentials/saml_credentials.js", "../node_modules/aws-sdk/lib/credentials/process_credentials.js", "../node_modules/xml2js/lib/defaults.js", "../node_modules/xmlbuilder/lib/Utility.js", "../node_modules/xmlbuilder/lib/XMLAttribute.js", "../node_modules/xmlbuilder/lib/XMLElement.js", "../node_modules/xmlbuilder/lib/XMLCData.js", "../node_modules/xmlbuilder/lib/XMLComment.js", "../node_modules/xmlbuilder/lib/XMLDeclaration.js", "../node_modules/xmlbuilder/lib/XMLDTDAttList.js", "../node_modules/xmlbuilder/lib/XMLDTDEntity.js", "../node_modules/xmlbuilder/lib/XMLDTDElement.js", "../node_modules/xmlbuilder/lib/XMLDTDNotation.js", "../node_modules/xmlbuilder/lib/XMLDocType.js", "../node_modules/xmlbuilder/lib/XMLRaw.js", "../node_modules/xmlbuilder/lib/XMLText.js", "../node_modules/xmlbuilder/lib/XMLProcessingInstruction.js", "../node_modules/xmlbuilder/lib/XMLNode.js", "../node_modules/xmlbuilder/lib/XMLStringifier.js", "../node_modules/xmlbuilder/lib/XMLWriterBase.js", "../node_modules/xmlbuilder/lib/XMLStringWriter.js", "../node_modules/xmlbuilder/lib/XMLDocument.js", "../node_modules/xmlbuilder/lib/XMLDocumentCB.js", "../node_modules/xmlbuilder/lib/XMLStreamWriter.js", "../node_modules/xmlbuilder/lib/index.js", "../node_modules/xml2js/lib/builder.js", "../node_modules/sax/lib/sax.js", "../node_modules/xml2js/lib/bom.js", "../node_modules/xml2js/lib/processors.js", "../node_modules/xml2js/lib/parser.js", "../node_modules/xml2js/lib/xml2js.js", "../node_modules/aws-sdk/lib/xml/node_parser.js", "../node_modules/aws-sdk/lib/http/node.js", "../node_modules/aws-sdk/lib/credentials/token_file_web_identity_credentials.js", "../node_modules/aws-sdk/lib/metadata_service/get_endpoint.js", "../node_modules/aws-sdk/lib/metadata_service/get_endpoint_mode.js", "../node_modules/aws-sdk/lib/metadata_service/get_endpoint_config_options.js", "../node_modules/aws-sdk/lib/metadata_service/get_endpoint_mode_config_options.js", "../node_modules/aws-sdk/lib/metadata_service/get_metadata_service_endpoint.js", "../node_modules/aws-sdk/lib/metadata_service.js", "../node_modules/aws-sdk/lib/credentials/ec2_metadata_credentials.js", "../node_modules/aws-sdk/lib/credentials/remote_credentials.js", "../node_modules/aws-sdk/lib/credentials/ecs_credentials.js", "../node_modules/aws-sdk/lib/credentials/environment_credentials.js", "../node_modules/aws-sdk/lib/credentials/file_system_credentials.js", "../node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.js", "../node_modules/aws-sdk/lib/credentials/sso_credentials.js", "../node_modules/aws-sdk/lib/node_loader.js", "../node_modules/aws-sdk/clients/codeartifact.js", "../src/action.ts", "../src/index.ts", "../src/types.ts", "../src/helpers.ts"], - "sourcesContent": [null, null, null, null, "'use strict';\n\nvar net = require('net');\nvar tls = require('tls');\nvar http = require('http');\nvar https = require('https');\nvar events = require('events');\nvar assert = require('assert');\nvar util = require('util');\n\n\nexports.httpOverHttp = httpOverHttp;\nexports.httpsOverHttp = httpsOverHttp;\nexports.httpOverHttps = httpOverHttps;\nexports.httpsOverHttps = httpsOverHttps;\n\n\nfunction httpOverHttp(options) {\n var agent = new TunnelingAgent(options);\n agent.request = http.request;\n return agent;\n}\n\nfunction httpsOverHttp(options) {\n var agent = new TunnelingAgent(options);\n agent.request = http.request;\n agent.createSocket = createSecureSocket;\n agent.defaultPort = 443;\n return agent;\n}\n\nfunction httpOverHttps(options) {\n var agent = new TunnelingAgent(options);\n agent.request = https.request;\n return agent;\n}\n\nfunction httpsOverHttps(options) {\n var agent = new TunnelingAgent(options);\n agent.request = https.request;\n agent.createSocket = createSecureSocket;\n agent.defaultPort = 443;\n return agent;\n}\n\n\nfunction TunnelingAgent(options) {\n var self = this;\n self.options = options || {};\n self.proxyOptions = self.options.proxy || {};\n self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;\n self.requests = [];\n self.sockets = [];\n\n self.on('free', function onFree(socket, host, port, localAddress) {\n var options = toOptions(host, port, localAddress);\n for (var i = 0, len = self.requests.length; i < len; ++i) {\n var pending = self.requests[i];\n if (pending.host === options.host && pending.port === options.port) {\n // Detect the request to connect same origin server,\n // reuse the connection.\n self.requests.splice(i, 1);\n pending.request.onSocket(socket);\n return;\n }\n }\n socket.destroy();\n self.removeSocket(socket);\n });\n}\nutil.inherits(TunnelingAgent, events.EventEmitter);\n\nTunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {\n var self = this;\n var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));\n\n if (self.sockets.length >= this.maxSockets) {\n // We are over limit so we'll add it to the queue.\n self.requests.push(options);\n return;\n }\n\n // If we are under maxSockets create a new one.\n self.createSocket(options, function(socket) {\n socket.on('free', onFree);\n socket.on('close', onCloseOrRemove);\n socket.on('agentRemove', onCloseOrRemove);\n req.onSocket(socket);\n\n function onFree() {\n self.emit('free', socket, options);\n }\n\n function onCloseOrRemove(err) {\n self.removeSocket(socket);\n socket.removeListener('free', onFree);\n socket.removeListener('close', onCloseOrRemove);\n socket.removeListener('agentRemove', onCloseOrRemove);\n }\n });\n};\n\nTunnelingAgent.prototype.createSocket = function createSocket(options, cb) {\n var self = this;\n var placeholder = {};\n self.sockets.push(placeholder);\n\n var connectOptions = mergeOptions({}, self.proxyOptions, {\n method: 'CONNECT',\n path: options.host + ':' + options.port,\n agent: false,\n headers: {\n host: options.host + ':' + options.port\n }\n });\n if (options.localAddress) {\n connectOptions.localAddress = options.localAddress;\n }\n if (connectOptions.proxyAuth) {\n connectOptions.headers = connectOptions.headers || {};\n connectOptions.headers['Proxy-Authorization'] = 'Basic ' +\n new Buffer(connectOptions.proxyAuth).toString('base64');\n }\n\n debug('making CONNECT request');\n var connectReq = self.request(connectOptions);\n connectReq.useChunkedEncodingByDefault = false; // for v0.6\n connectReq.once('response', onResponse); // for v0.6\n connectReq.once('upgrade', onUpgrade); // for v0.6\n connectReq.once('connect', onConnect); // for v0.7 or later\n connectReq.once('error', onError);\n connectReq.end();\n\n function onResponse(res) {\n // Very hacky. This is necessary to avoid http-parser leaks.\n res.upgrade = true;\n }\n\n function onUpgrade(res, socket, head) {\n // Hacky.\n process.nextTick(function() {\n onConnect(res, socket, head);\n });\n }\n\n function onConnect(res, socket, head) {\n connectReq.removeAllListeners();\n socket.removeAllListeners();\n\n if (res.statusCode !== 200) {\n debug('tunneling socket could not be established, statusCode=%d',\n res.statusCode);\n socket.destroy();\n var error = new Error('tunneling socket could not be established, ' +\n 'statusCode=' + res.statusCode);\n error.code = 'ECONNRESET';\n options.request.emit('error', error);\n self.removeSocket(placeholder);\n return;\n }\n if (head.length > 0) {\n debug('got illegal response body from proxy');\n socket.destroy();\n var error = new Error('got illegal response body from proxy');\n error.code = 'ECONNRESET';\n options.request.emit('error', error);\n self.removeSocket(placeholder);\n return;\n }\n debug('tunneling connection has established');\n self.sockets[self.sockets.indexOf(placeholder)] = socket;\n return cb(socket);\n }\n\n function onError(cause) {\n connectReq.removeAllListeners();\n\n debug('tunneling socket could not be established, cause=%s\\n',\n cause.message, cause.stack);\n var error = new Error('tunneling socket could not be established, ' +\n 'cause=' + cause.message);\n error.code = 'ECONNRESET';\n options.request.emit('error', error);\n self.removeSocket(placeholder);\n }\n};\n\nTunnelingAgent.prototype.removeSocket = function removeSocket(socket) {\n var pos = this.sockets.indexOf(socket)\n if (pos === -1) {\n return;\n }\n this.sockets.splice(pos, 1);\n\n var pending = this.requests.shift();\n if (pending) {\n // If we have pending requests and a socket gets closed a new one\n // needs to be created to take over in the pool for the one that closed.\n this.createSocket(pending, function(socket) {\n pending.request.onSocket(socket);\n });\n }\n};\n\nfunction createSecureSocket(options, cb) {\n var self = this;\n TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {\n var hostHeader = options.request.getHeader('host');\n var tlsOptions = mergeOptions({}, self.options, {\n socket: socket,\n servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host\n });\n\n // 0 is dummy port for v0.6\n var secureSocket = tls.connect(0, tlsOptions);\n self.sockets[self.sockets.indexOf(socket)] = secureSocket;\n cb(secureSocket);\n });\n}\n\n\nfunction toOptions(host, port, localAddress) {\n if (typeof host === 'string') { // since v0.10\n return {\n host: host,\n port: port,\n localAddress: localAddress\n };\n }\n return host; // for v0.11 or later\n}\n\nfunction mergeOptions(target) {\n for (var i = 1, len = arguments.length; i < len; ++i) {\n var overrides = arguments[i];\n if (typeof overrides === 'object') {\n var keys = Object.keys(overrides);\n for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {\n var k = keys[j];\n if (overrides[k] !== undefined) {\n target[k] = overrides[k];\n }\n }\n }\n }\n return target;\n}\n\n\nvar debug;\nif (process.env.NODE_DEBUG && /\\btunnel\\b/.test(process.env.NODE_DEBUG)) {\n debug = function() {\n var args = Array.prototype.slice.call(arguments);\n if (typeof args[0] === 'string') {\n args[0] = 'TUNNEL: ' + args[0];\n } else {\n args.unshift('TUNNEL:');\n }\n console.error.apply(console, args);\n }\n} else {\n debug = function() {};\n}\nexports.debug = debug; // for test\n", "module.exports = require('./lib/tunnel');\n", null, null, null, null, null, null, "var util = require('../util');\n\nfunction JsonBuilder() { }\n\nJsonBuilder.prototype.build = function(value, shape) {\n return JSON.stringify(translate(value, shape));\n};\n\nfunction translate(value, shape) {\n if (!shape || value === undefined || value === null) return undefined;\n\n switch (shape.type) {\n case 'structure': return translateStructure(value, shape);\n case 'map': return translateMap(value, shape);\n case 'list': return translateList(value, shape);\n default: return translateScalar(value, shape);\n }\n}\n\nfunction translateStructure(structure, shape) {\n if (shape.isDocument) {\n return structure;\n }\n var struct = {};\n util.each(structure, function(name, value) {\n var memberShape = shape.members[name];\n if (memberShape) {\n if (memberShape.location !== 'body') return;\n var locationName = memberShape.isLocationName ? memberShape.name : name;\n var result = translate(value, memberShape);\n if (result !== undefined) struct[locationName] = result;\n }\n });\n return struct;\n}\n\nfunction translateList(list, shape) {\n var out = [];\n util.arrayEach(list, function(value) {\n var result = translate(value, shape.member);\n if (result !== undefined) out.push(result);\n });\n return out;\n}\n\nfunction translateMap(map, shape) {\n var out = {};\n util.each(map, function(key, value) {\n var result = translate(value, shape.value);\n if (result !== undefined) out[key] = result;\n });\n return out;\n}\n\nfunction translateScalar(value, shape) {\n return shape.toWireFormat(value);\n}\n\n/**\n * @api private\n */\nmodule.exports = JsonBuilder;\n", "var util = require('../util');\n\nfunction JsonParser() { }\n\nJsonParser.prototype.parse = function(value, shape) {\n return translate(JSON.parse(value), shape);\n};\n\nfunction translate(value, shape) {\n if (!shape || value === undefined) return undefined;\n\n switch (shape.type) {\n case 'structure': return translateStructure(value, shape);\n case 'map': return translateMap(value, shape);\n case 'list': return translateList(value, shape);\n default: return translateScalar(value, shape);\n }\n}\n\nfunction translateStructure(structure, shape) {\n if (structure == null) return undefined;\n if (shape.isDocument) return structure;\n\n var struct = {};\n var shapeMembers = shape.members;\n util.each(shapeMembers, function(name, memberShape) {\n var locationName = memberShape.isLocationName ? memberShape.name : name;\n if (Object.prototype.hasOwnProperty.call(structure, locationName)) {\n var value = structure[locationName];\n var result = translate(value, memberShape);\n if (result !== undefined) struct[name] = result;\n }\n });\n return struct;\n}\n\nfunction translateList(list, shape) {\n if (list == null) return undefined;\n\n var out = [];\n util.arrayEach(list, function(value) {\n var result = translate(value, shape.member);\n if (result === undefined) out.push(null);\n else out.push(result);\n });\n return out;\n}\n\nfunction translateMap(map, shape) {\n if (map == null) return undefined;\n\n var out = {};\n util.each(map, function(key, value) {\n var result = translate(value, shape.value);\n if (result === undefined) out[key] = null;\n else out[key] = result;\n });\n return out;\n}\n\nfunction translateScalar(value, shape) {\n return shape.toType(value);\n}\n\n/**\n * @api private\n */\nmodule.exports = JsonParser;\n", "var util = require('../util');\nvar AWS = require('../core');\n\n/**\n * Prepend prefix defined by API model to endpoint that's already\n * constructed. This feature does not apply to operations using\n * endpoint discovery and can be disabled.\n * @api private\n */\nfunction populateHostPrefix(request) {\n var enabled = request.service.config.hostPrefixEnabled;\n if (!enabled) return request;\n var operationModel = request.service.api.operations[request.operation];\n //don't marshal host prefix when operation has endpoint discovery traits\n if (hasEndpointDiscover(request)) return request;\n if (operationModel.endpoint && operationModel.endpoint.hostPrefix) {\n var hostPrefixNotation = operationModel.endpoint.hostPrefix;\n var hostPrefix = expandHostPrefix(hostPrefixNotation, request.params, operationModel.input);\n prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix);\n validateHostname(request.httpRequest.endpoint.hostname);\n }\n return request;\n}\n\n/**\n * @api private\n */\nfunction hasEndpointDiscover(request) {\n var api = request.service.api;\n var operationModel = api.operations[request.operation];\n var isEndpointOperation = api.endpointOperation && (api.endpointOperation === util.string.lowerFirst(operationModel.name));\n return (operationModel.endpointDiscoveryRequired !== 'NULL' || isEndpointOperation === true);\n}\n\n/**\n * @api private\n */\nfunction expandHostPrefix(hostPrefixNotation, params, shape) {\n util.each(shape.members, function(name, member) {\n if (member.hostLabel === true) {\n if (typeof params[name] !== 'string' || params[name] === '') {\n throw util.error(new Error(), {\n message: 'Parameter ' + name + ' should be a non-empty string.',\n code: 'InvalidParameter'\n });\n }\n var regex = new RegExp('\\\\{' + name + '\\\\}', 'g');\n hostPrefixNotation = hostPrefixNotation.replace(regex, params[name]);\n }\n });\n return hostPrefixNotation;\n}\n\n/**\n * @api private\n */\nfunction prependEndpointPrefix(endpoint, prefix) {\n if (endpoint.host) {\n endpoint.host = prefix + endpoint.host;\n }\n if (endpoint.hostname) {\n endpoint.hostname = prefix + endpoint.hostname;\n }\n}\n\n/**\n * @api private\n */\nfunction validateHostname(hostname) {\n var labels = hostname.split('.');\n //Reference: https://tools.ietf.org/html/rfc1123#section-2\n var hostPattern = /^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9]$/;\n util.arrayEach(labels, function(label) {\n if (!label.length || label.length < 1 || label.length > 63) {\n throw util.error(new Error(), {\n code: 'ValidationError',\n message: 'Hostname label length should be between 1 to 63 characters, inclusive.'\n });\n }\n if (!hostPattern.test(label)) {\n throw AWS.util.error(new Error(),\n {code: 'ValidationError', message: label + ' is not hostname compatible.'});\n }\n });\n}\n\nmodule.exports = {\n populateHostPrefix: populateHostPrefix\n};\n", "var util = require('../util');\nvar JsonBuilder = require('../json/builder');\nvar JsonParser = require('../json/parser');\nvar populateHostPrefix = require('./helpers').populateHostPrefix;\n\nfunction buildRequest(req) {\n var httpRequest = req.httpRequest;\n var api = req.service.api;\n var target = api.targetPrefix + '.' + api.operations[req.operation].name;\n var version = api.jsonVersion || '1.0';\n var input = api.operations[req.operation].input;\n var builder = new JsonBuilder();\n\n if (version === 1) version = '1.0';\n httpRequest.body = builder.build(req.params || {}, input);\n httpRequest.headers['Content-Type'] = 'application/x-amz-json-' + version;\n httpRequest.headers['X-Amz-Target'] = target;\n\n populateHostPrefix(req);\n}\n\nfunction extractError(resp) {\n var error = {};\n var httpResponse = resp.httpResponse;\n\n error.code = httpResponse.headers['x-amzn-errortype'] || 'UnknownError';\n if (typeof error.code === 'string') {\n error.code = error.code.split(':')[0];\n }\n\n if (httpResponse.body.length > 0) {\n try {\n var e = JSON.parse(httpResponse.body.toString());\n var code = e.__type || e.code || e.Code;\n if (code) {\n error.code = code.split('#').pop();\n }\n if (error.code === 'RequestEntityTooLarge') {\n error.message = 'Request body must be less than 1 MB';\n } else {\n error.message = (e.message || e.Message || null);\n }\n } catch (e) {\n error.statusCode = httpResponse.statusCode;\n error.message = httpResponse.statusMessage;\n }\n } else {\n error.statusCode = httpResponse.statusCode;\n error.message = httpResponse.statusCode.toString();\n }\n\n resp.error = util.error(new Error(), error);\n}\n\nfunction extractData(resp) {\n var body = resp.httpResponse.body.toString() || '{}';\n if (resp.request.service.config.convertResponseTypes === false) {\n resp.data = JSON.parse(body);\n } else {\n var operation = resp.request.service.api.operations[resp.request.operation];\n var shape = operation.output || {};\n var parser = new JsonParser();\n resp.data = parser.parse(body, shape);\n }\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n buildRequest: buildRequest,\n extractError: extractError,\n extractData: extractData\n};\n", "var util = require('../util');\n\nfunction QueryParamSerializer() {\n}\n\nQueryParamSerializer.prototype.serialize = function(params, shape, fn) {\n serializeStructure('', params, shape, fn);\n};\n\nfunction ucfirst(shape) {\n if (shape.isQueryName || shape.api.protocol !== 'ec2') {\n return shape.name;\n } else {\n return shape.name[0].toUpperCase() + shape.name.substr(1);\n }\n}\n\nfunction serializeStructure(prefix, struct, rules, fn) {\n util.each(rules.members, function(name, member) {\n var value = struct[name];\n if (value === null || value === undefined) return;\n\n var memberName = ucfirst(member);\n memberName = prefix ? prefix + '.' + memberName : memberName;\n serializeMember(memberName, value, member, fn);\n });\n}\n\nfunction serializeMap(name, map, rules, fn) {\n var i = 1;\n util.each(map, function (key, value) {\n var prefix = rules.flattened ? '.' : '.entry.';\n var position = prefix + (i++) + '.';\n var keyName = position + (rules.key.name || 'key');\n var valueName = position + (rules.value.name || 'value');\n serializeMember(name + keyName, key, rules.key, fn);\n serializeMember(name + valueName, value, rules.value, fn);\n });\n}\n\nfunction serializeList(name, list, rules, fn) {\n var memberRules = rules.member || {};\n\n if (list.length === 0) {\n fn.call(this, name, null);\n return;\n }\n\n util.arrayEach(list, function (v, n) {\n var suffix = '.' + (n + 1);\n if (rules.api.protocol === 'ec2') {\n // Do nothing for EC2\n suffix = suffix + ''; // make linter happy\n } else if (rules.flattened) {\n if (memberRules.name) {\n var parts = name.split('.');\n parts.pop();\n parts.push(ucfirst(memberRules));\n name = parts.join('.');\n }\n } else {\n suffix = '.' + (memberRules.name ? memberRules.name : 'member') + suffix;\n }\n serializeMember(name + suffix, v, memberRules, fn);\n });\n}\n\nfunction serializeMember(name, value, rules, fn) {\n if (value === null || value === undefined) return;\n if (rules.type === 'structure') {\n serializeStructure(name, value, rules, fn);\n } else if (rules.type === 'list') {\n serializeList(name, value, rules, fn);\n } else if (rules.type === 'map') {\n serializeMap(name, value, rules, fn);\n } else {\n fn(name, rules.toWireFormat(value).toString());\n }\n}\n\n/**\n * @api private\n */\nmodule.exports = QueryParamSerializer;\n", "var memoizedProperty = require('../util').memoizedProperty;\n\nfunction memoize(name, value, factory, nameTr) {\n memoizedProperty(this, nameTr(name), function() {\n return factory(name, value);\n });\n}\n\nfunction Collection(iterable, options, factory, nameTr, callback) {\n nameTr = nameTr || String;\n var self = this;\n\n for (var id in iterable) {\n if (Object.prototype.hasOwnProperty.call(iterable, id)) {\n memoize.call(self, id, iterable[id], factory, nameTr);\n if (callback) callback(id, iterable[id]);\n }\n }\n}\n\n/**\n * @api private\n */\nmodule.exports = Collection;\n", "var Collection = require('./collection');\n\nvar util = require('../util');\n\nfunction property(obj, name, value) {\n if (value !== null && value !== undefined) {\n util.property.apply(this, arguments);\n }\n}\n\nfunction memoizedProperty(obj, name) {\n if (!obj.constructor.prototype[name]) {\n util.memoizedProperty.apply(this, arguments);\n }\n}\n\nfunction Shape(shape, options, memberName) {\n options = options || {};\n\n property(this, 'shape', shape.shape);\n property(this, 'api', options.api, false);\n property(this, 'type', shape.type);\n property(this, 'enum', shape.enum);\n property(this, 'min', shape.min);\n property(this, 'max', shape.max);\n property(this, 'pattern', shape.pattern);\n property(this, 'location', shape.location || this.location || 'body');\n property(this, 'name', this.name || shape.xmlName || shape.queryName ||\n shape.locationName || memberName);\n property(this, 'isStreaming', shape.streaming || this.isStreaming || false);\n property(this, 'requiresLength', shape.requiresLength, false);\n property(this, 'isComposite', shape.isComposite || false);\n property(this, 'isShape', true, false);\n property(this, 'isQueryName', Boolean(shape.queryName), false);\n property(this, 'isLocationName', Boolean(shape.locationName), false);\n property(this, 'isIdempotent', shape.idempotencyToken === true);\n property(this, 'isJsonValue', shape.jsonvalue === true);\n property(this, 'isSensitive', shape.sensitive === true || shape.prototype && shape.prototype.sensitive === true);\n property(this, 'isEventStream', Boolean(shape.eventstream), false);\n property(this, 'isEvent', Boolean(shape.event), false);\n property(this, 'isEventPayload', Boolean(shape.eventpayload), false);\n property(this, 'isEventHeader', Boolean(shape.eventheader), false);\n property(this, 'isTimestampFormatSet', Boolean(shape.timestampFormat) || shape.prototype && shape.prototype.isTimestampFormatSet === true, false);\n property(this, 'endpointDiscoveryId', Boolean(shape.endpointdiscoveryid), false);\n property(this, 'hostLabel', Boolean(shape.hostLabel), false);\n\n if (options.documentation) {\n property(this, 'documentation', shape.documentation);\n property(this, 'documentationUrl', shape.documentationUrl);\n }\n\n if (shape.xmlAttribute) {\n property(this, 'isXmlAttribute', shape.xmlAttribute || false);\n }\n\n // type conversion and parsing\n property(this, 'defaultValue', null);\n this.toWireFormat = function(value) {\n if (value === null || value === undefined) return '';\n return value;\n };\n this.toType = function(value) { return value; };\n}\n\n/**\n * @api private\n */\nShape.normalizedTypes = {\n character: 'string',\n double: 'float',\n long: 'integer',\n short: 'integer',\n biginteger: 'integer',\n bigdecimal: 'float',\n blob: 'binary'\n};\n\n/**\n * @api private\n */\nShape.types = {\n 'structure': StructureShape,\n 'list': ListShape,\n 'map': MapShape,\n 'boolean': BooleanShape,\n 'timestamp': TimestampShape,\n 'float': FloatShape,\n 'integer': IntegerShape,\n 'string': StringShape,\n 'base64': Base64Shape,\n 'binary': BinaryShape\n};\n\nShape.resolve = function resolve(shape, options) {\n if (shape.shape) {\n var refShape = options.api.shapes[shape.shape];\n if (!refShape) {\n throw new Error('Cannot find shape reference: ' + shape.shape);\n }\n\n return refShape;\n } else {\n return null;\n }\n};\n\nShape.create = function create(shape, options, memberName) {\n if (shape.isShape) return shape;\n\n var refShape = Shape.resolve(shape, options);\n if (refShape) {\n var filteredKeys = Object.keys(shape);\n if (!options.documentation) {\n filteredKeys = filteredKeys.filter(function(name) {\n return !name.match(/documentation/);\n });\n }\n\n // create an inline shape with extra members\n var InlineShape = function() {\n refShape.constructor.call(this, shape, options, memberName);\n };\n InlineShape.prototype = refShape;\n return new InlineShape();\n } else {\n // set type if not set\n if (!shape.type) {\n if (shape.members) shape.type = 'structure';\n else if (shape.member) shape.type = 'list';\n else if (shape.key) shape.type = 'map';\n else shape.type = 'string';\n }\n\n // normalize types\n var origType = shape.type;\n if (Shape.normalizedTypes[shape.type]) {\n shape.type = Shape.normalizedTypes[shape.type];\n }\n\n if (Shape.types[shape.type]) {\n return new Shape.types[shape.type](shape, options, memberName);\n } else {\n throw new Error('Unrecognized shape type: ' + origType);\n }\n }\n};\n\nfunction CompositeShape(shape) {\n Shape.apply(this, arguments);\n property(this, 'isComposite', true);\n\n if (shape.flattened) {\n property(this, 'flattened', shape.flattened || false);\n }\n}\n\nfunction StructureShape(shape, options) {\n var self = this;\n var requiredMap = null, firstInit = !this.isShape;\n\n CompositeShape.apply(this, arguments);\n\n if (firstInit) {\n property(this, 'defaultValue', function() { return {}; });\n property(this, 'members', {});\n property(this, 'memberNames', []);\n property(this, 'required', []);\n property(this, 'isRequired', function() { return false; });\n property(this, 'isDocument', Boolean(shape.document));\n }\n\n if (shape.members) {\n property(this, 'members', new Collection(shape.members, options, function(name, member) {\n return Shape.create(member, options, name);\n }));\n memoizedProperty(this, 'memberNames', function() {\n return shape.xmlOrder || Object.keys(shape.members);\n });\n\n if (shape.event) {\n memoizedProperty(this, 'eventPayloadMemberName', function() {\n var members = self.members;\n var memberNames = self.memberNames;\n // iterate over members to find ones that are event payloads\n for (var i = 0, iLen = memberNames.length; i < iLen; i++) {\n if (members[memberNames[i]].isEventPayload) {\n return memberNames[i];\n }\n }\n });\n\n memoizedProperty(this, 'eventHeaderMemberNames', function() {\n var members = self.members;\n var memberNames = self.memberNames;\n var eventHeaderMemberNames = [];\n // iterate over members to find ones that are event headers\n for (var i = 0, iLen = memberNames.length; i < iLen; i++) {\n if (members[memberNames[i]].isEventHeader) {\n eventHeaderMemberNames.push(memberNames[i]);\n }\n }\n return eventHeaderMemberNames;\n });\n }\n }\n\n if (shape.required) {\n property(this, 'required', shape.required);\n property(this, 'isRequired', function(name) {\n if (!requiredMap) {\n requiredMap = {};\n for (var i = 0; i < shape.required.length; i++) {\n requiredMap[shape.required[i]] = true;\n }\n }\n\n return requiredMap[name];\n }, false, true);\n }\n\n property(this, 'resultWrapper', shape.resultWrapper || null);\n\n if (shape.payload) {\n property(this, 'payload', shape.payload);\n }\n\n if (typeof shape.xmlNamespace === 'string') {\n property(this, 'xmlNamespaceUri', shape.xmlNamespace);\n } else if (typeof shape.xmlNamespace === 'object') {\n property(this, 'xmlNamespacePrefix', shape.xmlNamespace.prefix);\n property(this, 'xmlNamespaceUri', shape.xmlNamespace.uri);\n }\n}\n\nfunction ListShape(shape, options) {\n var self = this, firstInit = !this.isShape;\n CompositeShape.apply(this, arguments);\n\n if (firstInit) {\n property(this, 'defaultValue', function() { return []; });\n }\n\n if (shape.member) {\n memoizedProperty(this, 'member', function() {\n return Shape.create(shape.member, options);\n });\n }\n\n if (this.flattened) {\n var oldName = this.name;\n memoizedProperty(this, 'name', function() {\n return self.member.name || oldName;\n });\n }\n}\n\nfunction MapShape(shape, options) {\n var firstInit = !this.isShape;\n CompositeShape.apply(this, arguments);\n\n if (firstInit) {\n property(this, 'defaultValue', function() { return {}; });\n property(this, 'key', Shape.create({type: 'string'}, options));\n property(this, 'value', Shape.create({type: 'string'}, options));\n }\n\n if (shape.key) {\n memoizedProperty(this, 'key', function() {\n return Shape.create(shape.key, options);\n });\n }\n if (shape.value) {\n memoizedProperty(this, 'value', function() {\n return Shape.create(shape.value, options);\n });\n }\n}\n\nfunction TimestampShape(shape) {\n var self = this;\n Shape.apply(this, arguments);\n\n if (shape.timestampFormat) {\n property(this, 'timestampFormat', shape.timestampFormat);\n } else if (self.isTimestampFormatSet && this.timestampFormat) {\n property(this, 'timestampFormat', this.timestampFormat);\n } else if (this.location === 'header') {\n property(this, 'timestampFormat', 'rfc822');\n } else if (this.location === 'querystring') {\n property(this, 'timestampFormat', 'iso8601');\n } else if (this.api) {\n switch (this.api.protocol) {\n case 'json':\n case 'rest-json':\n property(this, 'timestampFormat', 'unixTimestamp');\n break;\n case 'rest-xml':\n case 'query':\n case 'ec2':\n property(this, 'timestampFormat', 'iso8601');\n break;\n }\n }\n\n this.toType = function(value) {\n if (value === null || value === undefined) return null;\n if (typeof value.toUTCString === 'function') return value;\n return typeof value === 'string' || typeof value === 'number' ?\n util.date.parseTimestamp(value) : null;\n };\n\n this.toWireFormat = function(value) {\n return util.date.format(value, self.timestampFormat);\n };\n}\n\nfunction StringShape() {\n Shape.apply(this, arguments);\n\n var nullLessProtocols = ['rest-xml', 'query', 'ec2'];\n this.toType = function(value) {\n value = this.api && nullLessProtocols.indexOf(this.api.protocol) > -1 ?\n value || '' : value;\n if (this.isJsonValue) {\n return JSON.parse(value);\n }\n\n return value && typeof value.toString === 'function' ?\n value.toString() : value;\n };\n\n this.toWireFormat = function(value) {\n return this.isJsonValue ? JSON.stringify(value) : value;\n };\n}\n\nfunction FloatShape() {\n Shape.apply(this, arguments);\n\n this.toType = function(value) {\n if (value === null || value === undefined) return null;\n return parseFloat(value);\n };\n this.toWireFormat = this.toType;\n}\n\nfunction IntegerShape() {\n Shape.apply(this, arguments);\n\n this.toType = function(value) {\n if (value === null || value === undefined) return null;\n return parseInt(value, 10);\n };\n this.toWireFormat = this.toType;\n}\n\nfunction BinaryShape() {\n Shape.apply(this, arguments);\n this.toType = function(value) {\n var buf = util.base64.decode(value);\n if (this.isSensitive && util.isNode() && typeof util.Buffer.alloc === 'function') {\n /* Node.js can create a Buffer that is not isolated.\n * i.e. buf.byteLength !== buf.buffer.byteLength\n * This means that the sensitive data is accessible to anyone with access to buf.buffer.\n * If this is the node shared Buffer, then other code within this process _could_ find this secret.\n * Copy sensitive data to an isolated Buffer and zero the sensitive data.\n * While this is safe to do here, copying this code somewhere else may produce unexpected results.\n */\n var secureBuf = util.Buffer.alloc(buf.length, buf);\n buf.fill(0);\n buf = secureBuf;\n }\n return buf;\n };\n this.toWireFormat = util.base64.encode;\n}\n\nfunction Base64Shape() {\n BinaryShape.apply(this, arguments);\n}\n\nfunction BooleanShape() {\n Shape.apply(this, arguments);\n\n this.toType = function(value) {\n if (typeof value === 'boolean') return value;\n if (value === null || value === undefined) return null;\n return value === 'true';\n };\n}\n\n/**\n * @api private\n */\nShape.shapes = {\n StructureShape: StructureShape,\n ListShape: ListShape,\n MapShape: MapShape,\n StringShape: StringShape,\n BooleanShape: BooleanShape,\n Base64Shape: Base64Shape\n};\n\n/**\n * @api private\n */\nmodule.exports = Shape;\n", "var AWS = require('../core');\nvar util = require('../util');\nvar QueryParamSerializer = require('../query/query_param_serializer');\nvar Shape = require('../model/shape');\nvar populateHostPrefix = require('./helpers').populateHostPrefix;\n\nfunction buildRequest(req) {\n var operation = req.service.api.operations[req.operation];\n var httpRequest = req.httpRequest;\n httpRequest.headers['Content-Type'] =\n 'application/x-www-form-urlencoded; charset=utf-8';\n httpRequest.params = {\n Version: req.service.api.apiVersion,\n Action: operation.name\n };\n\n // convert the request parameters into a list of query params,\n // e.g. Deeply.NestedParam.0.Name=value\n var builder = new QueryParamSerializer();\n builder.serialize(req.params, operation.input, function(name, value) {\n httpRequest.params[name] = value;\n });\n httpRequest.body = util.queryParamsToString(httpRequest.params);\n\n populateHostPrefix(req);\n}\n\nfunction extractError(resp) {\n var data, body = resp.httpResponse.body.toString();\n if (body.match('= 0 ? '&' : '?');\n var parts = [];\n util.arrayEach(Object.keys(queryString).sort(), function(key) {\n if (!Array.isArray(queryString[key])) {\n queryString[key] = [queryString[key]];\n }\n for (var i = 0; i < queryString[key].length; i++) {\n parts.push(util.uriEscape(String(key)) + '=' + queryString[key][i]);\n }\n });\n uri += parts.join('&');\n }\n\n return uri;\n}\n\nfunction populateURI(req) {\n var operation = req.service.api.operations[req.operation];\n var input = operation.input;\n\n var uri = generateURI(req.httpRequest.endpoint.path, operation.httpPath, input, req.params);\n req.httpRequest.path = uri;\n}\n\nfunction populateHeaders(req) {\n var operation = req.service.api.operations[req.operation];\n util.each(operation.input.members, function (name, member) {\n var value = req.params[name];\n if (value === null || value === undefined) return;\n\n if (member.location === 'headers' && member.type === 'map') {\n util.each(value, function(key, memberValue) {\n req.httpRequest.headers[member.name + key] = memberValue;\n });\n } else if (member.location === 'header') {\n value = member.toWireFormat(value).toString();\n if (member.isJsonValue) {\n value = util.base64.encode(value);\n }\n req.httpRequest.headers[member.name] = value;\n }\n });\n}\n\nfunction buildRequest(req) {\n populateMethod(req);\n populateURI(req);\n populateHeaders(req);\n populateHostPrefix(req);\n}\n\nfunction extractError() {\n}\n\nfunction extractData(resp) {\n var req = resp.request;\n var data = {};\n var r = resp.httpResponse;\n var operation = req.service.api.operations[req.operation];\n var output = operation.output;\n\n // normalize headers names to lower-cased keys for matching\n var headers = {};\n util.each(r.headers, function (k, v) {\n headers[k.toLowerCase()] = v;\n });\n\n util.each(output.members, function(name, member) {\n var header = (member.name || name).toLowerCase();\n if (member.location === 'headers' && member.type === 'map') {\n data[name] = {};\n var location = member.isLocationName ? member.name : '';\n var pattern = new RegExp('^' + location + '(.+)', 'i');\n util.each(r.headers, function (k, v) {\n var result = k.match(pattern);\n if (result !== null) {\n data[name][result[1]] = v;\n }\n });\n } else if (member.location === 'header') {\n if (headers[header] !== undefined) {\n var value = member.isJsonValue ?\n util.base64.decode(headers[header]) :\n headers[header];\n data[name] = member.toType(value);\n }\n } else if (member.location === 'statusCode') {\n data[name] = parseInt(r.statusCode, 10);\n }\n });\n\n resp.data = data;\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n buildRequest: buildRequest,\n extractError: extractError,\n extractData: extractData,\n generateURI: generateURI\n};\n", "var util = require('../util');\nvar Rest = require('./rest');\nvar Json = require('./json');\nvar JsonBuilder = require('../json/builder');\nvar JsonParser = require('../json/parser');\n\nfunction populateBody(req) {\n var builder = new JsonBuilder();\n var input = req.service.api.operations[req.operation].input;\n\n if (input.payload) {\n var params = {};\n var payloadShape = input.members[input.payload];\n params = req.params[input.payload];\n\n if (payloadShape.type === 'structure') {\n req.httpRequest.body = builder.build(params || {}, payloadShape);\n applyContentTypeHeader(req);\n } else if (params !== undefined) {\n // non-JSON payload\n req.httpRequest.body = params;\n if (payloadShape.type === 'binary' || payloadShape.isStreaming) {\n applyContentTypeHeader(req, true);\n }\n }\n } else {\n req.httpRequest.body = builder.build(req.params, input);\n applyContentTypeHeader(req);\n }\n}\n\nfunction applyContentTypeHeader(req, isBinary) {\n if (!req.httpRequest.headers['Content-Type']) {\n var type = isBinary ? 'binary/octet-stream' : 'application/json';\n req.httpRequest.headers['Content-Type'] = type;\n }\n}\n\nfunction buildRequest(req) {\n Rest.buildRequest(req);\n\n // never send body payload on GET/HEAD/DELETE\n if (['GET', 'HEAD', 'DELETE'].indexOf(req.httpRequest.method) < 0) {\n populateBody(req);\n }\n}\n\nfunction extractError(resp) {\n Json.extractError(resp);\n}\n\nfunction extractData(resp) {\n Rest.extractData(resp);\n\n var req = resp.request;\n var operation = req.service.api.operations[req.operation];\n var rules = req.service.api.operations[req.operation].output || {};\n var parser;\n var hasEventOutput = operation.hasEventOutput;\n\n if (rules.payload) {\n var payloadMember = rules.members[rules.payload];\n var body = resp.httpResponse.body;\n if (payloadMember.isEventStream) {\n parser = new JsonParser();\n resp.data[payload] = util.createEventStream(\n AWS.HttpClient.streamsApiVersion === 2 ? resp.httpResponse.stream : body,\n parser,\n payloadMember\n );\n } else if (payloadMember.type === 'structure' || payloadMember.type === 'list') {\n var parser = new JsonParser();\n resp.data[rules.payload] = parser.parse(body, payloadMember);\n } else if (payloadMember.type === 'binary' || payloadMember.isStreaming) {\n resp.data[rules.payload] = body;\n } else {\n resp.data[rules.payload] = payloadMember.toType(body);\n }\n } else {\n var data = resp.data;\n Json.extractData(resp);\n resp.data = util.merge(data, resp.data);\n }\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n buildRequest: buildRequest,\n extractError: extractError,\n extractData: extractData\n};\n", "var AWS = require('../core');\nvar util = require('../util');\nvar Rest = require('./rest');\n\nfunction populateBody(req) {\n var input = req.service.api.operations[req.operation].input;\n var builder = new AWS.XML.Builder();\n var params = req.params;\n\n var payload = input.payload;\n if (payload) {\n var payloadMember = input.members[payload];\n params = params[payload];\n if (params === undefined) return;\n\n if (payloadMember.type === 'structure') {\n var rootElement = payloadMember.name;\n req.httpRequest.body = builder.toXML(params, payloadMember, rootElement, true);\n } else { // non-xml payload\n req.httpRequest.body = params;\n }\n } else {\n req.httpRequest.body = builder.toXML(params, input, input.name ||\n input.shape || util.string.upperFirst(req.operation) + 'Request');\n }\n}\n\nfunction buildRequest(req) {\n Rest.buildRequest(req);\n\n // never send body payload on GET/HEAD\n if (['GET', 'HEAD'].indexOf(req.httpRequest.method) < 0) {\n populateBody(req);\n }\n}\n\nfunction extractError(resp) {\n Rest.extractError(resp);\n\n var data;\n try {\n data = new AWS.XML.Parser().parse(resp.httpResponse.body.toString());\n } catch (e) {\n data = {\n Code: resp.httpResponse.statusCode,\n Message: resp.httpResponse.statusMessage\n };\n }\n\n if (data.Errors) data = data.Errors;\n if (data.Error) data = data.Error;\n if (data.Code) {\n resp.error = util.error(new Error(), {\n code: data.Code,\n message: data.Message\n });\n } else {\n resp.error = util.error(new Error(), {\n code: resp.httpResponse.statusCode,\n message: null\n });\n }\n}\n\nfunction extractData(resp) {\n Rest.extractData(resp);\n\n var parser;\n var req = resp.request;\n var body = resp.httpResponse.body;\n var operation = req.service.api.operations[req.operation];\n var output = operation.output;\n\n var hasEventOutput = operation.hasEventOutput;\n\n var payload = output.payload;\n if (payload) {\n var payloadMember = output.members[payload];\n if (payloadMember.isEventStream) {\n parser = new AWS.XML.Parser();\n resp.data[payload] = util.createEventStream(\n AWS.HttpClient.streamsApiVersion === 2 ? resp.httpResponse.stream : resp.httpResponse.body,\n parser,\n payloadMember\n );\n } else if (payloadMember.type === 'structure') {\n parser = new AWS.XML.Parser();\n resp.data[payload] = parser.parse(body.toString(), payloadMember);\n } else if (payloadMember.type === 'binary' || payloadMember.isStreaming) {\n resp.data[payload] = body;\n } else {\n resp.data[payload] = payloadMember.toType(body);\n }\n } else if (body.length > 0) {\n parser = new AWS.XML.Parser();\n var data = parser.parse(body.toString(), output);\n util.update(resp.data, data);\n }\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n buildRequest: buildRequest,\n extractError: extractError,\n extractData: extractData\n};\n", "/**\n * Escapes characters that can not be in an XML attribute.\n */\nfunction escapeAttribute(value) {\n return value.replace(/&/g, '&').replace(/'/g, ''').replace(//g, '>').replace(/\"/g, '"');\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n escapeAttribute: escapeAttribute\n};\n", "var escapeAttribute = require('./escape-attribute').escapeAttribute;\n\n/**\n * Represents an XML node.\n * @api private\n */\nfunction XmlNode(name, children) {\n if (children === void 0) { children = []; }\n this.name = name;\n this.children = children;\n this.attributes = {};\n}\nXmlNode.prototype.addAttribute = function (name, value) {\n this.attributes[name] = value;\n return this;\n};\nXmlNode.prototype.addChildNode = function (child) {\n this.children.push(child);\n return this;\n};\nXmlNode.prototype.removeAttribute = function (name) {\n delete this.attributes[name];\n return this;\n};\nXmlNode.prototype.toString = function () {\n var hasChildren = Boolean(this.children.length);\n var xmlText = '<' + this.name;\n // add attributes\n var attributes = this.attributes;\n for (var i = 0, attributeNames = Object.keys(attributes); i < attributeNames.length; i++) {\n var attributeName = attributeNames[i];\n var attribute = attributes[attributeName];\n if (typeof attribute !== 'undefined' && attribute !== null) {\n xmlText += ' ' + attributeName + '=\\\"' + escapeAttribute('' + attribute) + '\\\"';\n }\n }\n return xmlText += !hasChildren ? '/>' : '>' + this.children.map(function (c) { return c.toString(); }).join('') + '';\n};\n\n/**\n * @api private\n */\nmodule.exports = {\n XmlNode: XmlNode\n};\n", "/**\n * Escapes characters that can not be in an XML element.\n */\nfunction escapeElement(value) {\n return value.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\\r/g, ' ')\n .replace(/\\n/g, ' ')\n .replace(/\\u0085/g, '…')\n .replace(/\\u2028/, '
');\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n escapeElement: escapeElement\n};\n", "var escapeElement = require('./escape-element').escapeElement;\n\n/**\n * Represents an XML text value.\n * @api private\n */\nfunction XmlText(value) {\n this.value = value;\n}\n\nXmlText.prototype.toString = function () {\n return escapeElement('' + this.value);\n};\n\n/**\n * @api private\n */\nmodule.exports = {\n XmlText: XmlText\n};\n", "var util = require('../util');\nvar XmlNode = require('./xml-node').XmlNode;\nvar XmlText = require('./xml-text').XmlText;\n\nfunction XmlBuilder() { }\n\nXmlBuilder.prototype.toXML = function(params, shape, rootElement, noEmpty) {\n var xml = new XmlNode(rootElement);\n applyNamespaces(xml, shape, true);\n serialize(xml, params, shape);\n return xml.children.length > 0 || noEmpty ? xml.toString() : '';\n};\n\nfunction serialize(xml, value, shape) {\n switch (shape.type) {\n case 'structure': return serializeStructure(xml, value, shape);\n case 'map': return serializeMap(xml, value, shape);\n case 'list': return serializeList(xml, value, shape);\n default: return serializeScalar(xml, value, shape);\n }\n}\n\nfunction serializeStructure(xml, params, shape) {\n util.arrayEach(shape.memberNames, function(memberName) {\n var memberShape = shape.members[memberName];\n if (memberShape.location !== 'body') return;\n\n var value = params[memberName];\n var name = memberShape.name;\n if (value !== undefined && value !== null) {\n if (memberShape.isXmlAttribute) {\n xml.addAttribute(name, value);\n } else if (memberShape.flattened) {\n serialize(xml, value, memberShape);\n } else {\n var element = new XmlNode(name);\n xml.addChildNode(element);\n applyNamespaces(element, memberShape);\n serialize(element, value, memberShape);\n }\n }\n });\n}\n\nfunction serializeMap(xml, map, shape) {\n var xmlKey = shape.key.name || 'key';\n var xmlValue = shape.value.name || 'value';\n\n util.each(map, function(key, value) {\n var entry = new XmlNode(shape.flattened ? shape.name : 'entry');\n xml.addChildNode(entry);\n\n var entryKey = new XmlNode(xmlKey);\n var entryValue = new XmlNode(xmlValue);\n entry.addChildNode(entryKey);\n entry.addChildNode(entryValue);\n\n serialize(entryKey, key, shape.key);\n serialize(entryValue, value, shape.value);\n });\n}\n\nfunction serializeList(xml, list, shape) {\n if (shape.flattened) {\n util.arrayEach(list, function(value) {\n var name = shape.member.name || shape.name;\n var element = new XmlNode(name);\n xml.addChildNode(element);\n serialize(element, value, shape.member);\n });\n } else {\n util.arrayEach(list, function(value) {\n var name = shape.member.name || 'member';\n var element = new XmlNode(name);\n xml.addChildNode(element);\n serialize(element, value, shape.member);\n });\n }\n}\n\nfunction serializeScalar(xml, value, shape) {\n xml.addChildNode(\n new XmlText(shape.toWireFormat(value))\n );\n}\n\nfunction applyNamespaces(xml, shape, isRoot) {\n var uri, prefix = 'xmlns';\n if (shape.xmlNamespaceUri) {\n uri = shape.xmlNamespaceUri;\n if (shape.xmlNamespacePrefix) prefix += ':' + shape.xmlNamespacePrefix;\n } else if (isRoot && shape.api.xmlNamespaceUri) {\n uri = shape.api.xmlNamespaceUri;\n }\n\n if (uri) xml.addAttribute(prefix, uri);\n}\n\n/**\n * @api private\n */\nmodule.exports = XmlBuilder;\n", "var Shape = require('./shape');\n\nvar util = require('../util');\nvar property = util.property;\nvar memoizedProperty = util.memoizedProperty;\n\nfunction Operation(name, operation, options) {\n var self = this;\n options = options || {};\n\n property(this, 'name', operation.name || name);\n property(this, 'api', options.api, false);\n\n operation.http = operation.http || {};\n property(this, 'endpoint', operation.endpoint);\n property(this, 'httpMethod', operation.http.method || 'POST');\n property(this, 'httpPath', operation.http.requestUri || '/');\n property(this, 'authtype', operation.authtype || '');\n property(\n this,\n 'endpointDiscoveryRequired',\n operation.endpointdiscovery ?\n (operation.endpointdiscovery.required ? 'REQUIRED' : 'OPTIONAL') :\n 'NULL'\n );\n\n // httpChecksum replaces usage of httpChecksumRequired, but some APIs\n // (s3control) still uses old trait.\n var httpChecksumRequired = operation.httpChecksumRequired\n || (operation.httpChecksum && operation.httpChecksum.requestChecksumRequired);\n property(this, 'httpChecksumRequired', httpChecksumRequired, false);\n\n memoizedProperty(this, 'input', function() {\n if (!operation.input) {\n return new Shape.create({type: 'structure'}, options);\n }\n return Shape.create(operation.input, options);\n });\n\n memoizedProperty(this, 'output', function() {\n if (!operation.output) {\n return new Shape.create({type: 'structure'}, options);\n }\n return Shape.create(operation.output, options);\n });\n\n memoizedProperty(this, 'errors', function() {\n var list = [];\n if (!operation.errors) return null;\n\n for (var i = 0; i < operation.errors.length; i++) {\n list.push(Shape.create(operation.errors[i], options));\n }\n\n return list;\n });\n\n memoizedProperty(this, 'paginator', function() {\n return options.api.paginators[name];\n });\n\n if (options.documentation) {\n property(this, 'documentation', operation.documentation);\n property(this, 'documentationUrl', operation.documentationUrl);\n }\n\n // idempotentMembers only tracks top-level input shapes\n memoizedProperty(this, 'idempotentMembers', function() {\n var idempotentMembers = [];\n var input = self.input;\n var members = input.members;\n if (!input.members) {\n return idempotentMembers;\n }\n for (var name in members) {\n if (!members.hasOwnProperty(name)) {\n continue;\n }\n if (members[name].isIdempotent === true) {\n idempotentMembers.push(name);\n }\n }\n return idempotentMembers;\n });\n\n memoizedProperty(this, 'hasEventOutput', function() {\n var output = self.output;\n return hasEventStream(output);\n });\n}\n\nfunction hasEventStream(topLevelShape) {\n var members = topLevelShape.members;\n var payload = topLevelShape.payload;\n\n if (!topLevelShape.members) {\n return false;\n }\n\n if (payload) {\n var payloadMember = members[payload];\n return payloadMember.isEventStream;\n }\n\n // check if any member is an event stream\n for (var name in members) {\n if (!members.hasOwnProperty(name)) {\n if (members[name].isEventStream === true) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * @api private\n */\nmodule.exports = Operation;\n", "var property = require('../util').property;\n\nfunction Paginator(name, paginator) {\n property(this, 'inputToken', paginator.input_token);\n property(this, 'limitKey', paginator.limit_key);\n property(this, 'moreResults', paginator.more_results);\n property(this, 'outputToken', paginator.output_token);\n property(this, 'resultKey', paginator.result_key);\n}\n\n/**\n * @api private\n */\nmodule.exports = Paginator;\n", "var util = require('../util');\nvar property = util.property;\n\nfunction ResourceWaiter(name, waiter, options) {\n options = options || {};\n property(this, 'name', name);\n property(this, 'api', options.api, false);\n\n if (waiter.operation) {\n property(this, 'operation', util.string.lowerFirst(waiter.operation));\n }\n\n var self = this;\n var keys = [\n 'type',\n 'description',\n 'delay',\n 'maxAttempts',\n 'acceptors'\n ];\n\n keys.forEach(function(key) {\n var value = waiter[key];\n if (value) {\n property(self, key, value);\n }\n });\n}\n\n/**\n * @api private\n */\nmodule.exports = ResourceWaiter;\n", "var Collection = require('./collection');\nvar Operation = require('./operation');\nvar Shape = require('./shape');\nvar Paginator = require('./paginator');\nvar ResourceWaiter = require('./resource_waiter');\nvar metadata = require('../../apis/metadata.json');\n\nvar util = require('../util');\nvar property = util.property;\nvar memoizedProperty = util.memoizedProperty;\n\nfunction Api(api, options) {\n var self = this;\n api = api || {};\n options = options || {};\n options.api = this;\n\n api.metadata = api.metadata || {};\n\n var serviceIdentifier = options.serviceIdentifier;\n delete options.serviceIdentifier;\n\n property(this, 'isApi', true, false);\n property(this, 'apiVersion', api.metadata.apiVersion);\n property(this, 'endpointPrefix', api.metadata.endpointPrefix);\n property(this, 'signingName', api.metadata.signingName);\n property(this, 'globalEndpoint', api.metadata.globalEndpoint);\n property(this, 'signatureVersion', api.metadata.signatureVersion);\n property(this, 'jsonVersion', api.metadata.jsonVersion);\n property(this, 'targetPrefix', api.metadata.targetPrefix);\n property(this, 'protocol', api.metadata.protocol);\n property(this, 'timestampFormat', api.metadata.timestampFormat);\n property(this, 'xmlNamespaceUri', api.metadata.xmlNamespace);\n property(this, 'abbreviation', api.metadata.serviceAbbreviation);\n property(this, 'fullName', api.metadata.serviceFullName);\n property(this, 'serviceId', api.metadata.serviceId);\n if (serviceIdentifier && metadata[serviceIdentifier]) {\n property(this, 'xmlNoDefaultLists', metadata[serviceIdentifier].xmlNoDefaultLists, false);\n }\n\n memoizedProperty(this, 'className', function() {\n var name = api.metadata.serviceAbbreviation || api.metadata.serviceFullName;\n if (!name) return null;\n\n name = name.replace(/^Amazon|AWS\\s*|\\(.*|\\s+|\\W+/g, '');\n if (name === 'ElasticLoadBalancing') name = 'ELB';\n return name;\n });\n\n function addEndpointOperation(name, operation) {\n if (operation.endpointoperation === true) {\n property(self, 'endpointOperation', util.string.lowerFirst(name));\n }\n if (operation.endpointdiscovery && !self.hasRequiredEndpointDiscovery) {\n property(\n self,\n 'hasRequiredEndpointDiscovery',\n operation.endpointdiscovery.required === true\n );\n }\n }\n\n property(this, 'operations', new Collection(api.operations, options, function(name, operation) {\n return new Operation(name, operation, options);\n }, util.string.lowerFirst, addEndpointOperation));\n\n property(this, 'shapes', new Collection(api.shapes, options, function(name, shape) {\n return Shape.create(shape, options);\n }));\n\n property(this, 'paginators', new Collection(api.paginators, options, function(name, paginator) {\n return new Paginator(name, paginator, options);\n }));\n\n property(this, 'waiters', new Collection(api.waiters, options, function(name, waiter) {\n return new ResourceWaiter(name, waiter, options);\n }, util.string.lowerFirst));\n\n if (options.documentation) {\n property(this, 'documentation', api.documentation);\n property(this, 'documentationUrl', api.documentationUrl);\n }\n property(this, 'errorCodeMapping', api.awsQueryCompatible);\n}\n\n/**\n * @api private\n */\nmodule.exports = Api;\n", "function apiLoader(svc, version) {\n if (!apiLoader.services.hasOwnProperty(svc)) {\n throw new Error('InvalidService: Failed to load api for ' + svc);\n }\n return apiLoader.services[svc][version];\n}\n\n/**\n * @api private\n *\n * This member of AWS.apiLoader is private, but changing it will necessitate a\n * change to ../scripts/services-table-generator.ts\n */\napiLoader.services = {};\n\n/**\n * @api private\n */\nmodule.exports = apiLoader;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar LinkedListNode = /** @class */ (function () {\n function LinkedListNode(key, value) {\n this.key = key;\n this.value = value;\n }\n return LinkedListNode;\n}());\nvar LRUCache = /** @class */ (function () {\n function LRUCache(size) {\n this.nodeMap = {};\n this.size = 0;\n if (typeof size !== 'number' || size < 1) {\n throw new Error('Cache size can only be positive number');\n }\n this.sizeLimit = size;\n }\n Object.defineProperty(LRUCache.prototype, \"length\", {\n get: function () {\n return this.size;\n },\n enumerable: true,\n configurable: true\n });\n LRUCache.prototype.prependToList = function (node) {\n if (!this.headerNode) {\n this.tailNode = node;\n }\n else {\n this.headerNode.prev = node;\n node.next = this.headerNode;\n }\n this.headerNode = node;\n this.size++;\n };\n LRUCache.prototype.removeFromTail = function () {\n if (!this.tailNode) {\n return undefined;\n }\n var node = this.tailNode;\n var prevNode = node.prev;\n if (prevNode) {\n prevNode.next = undefined;\n }\n node.prev = undefined;\n this.tailNode = prevNode;\n this.size--;\n return node;\n };\n LRUCache.prototype.detachFromList = function (node) {\n if (this.headerNode === node) {\n this.headerNode = node.next;\n }\n if (this.tailNode === node) {\n this.tailNode = node.prev;\n }\n if (node.prev) {\n node.prev.next = node.next;\n }\n if (node.next) {\n node.next.prev = node.prev;\n }\n node.next = undefined;\n node.prev = undefined;\n this.size--;\n };\n LRUCache.prototype.get = function (key) {\n if (this.nodeMap[key]) {\n var node = this.nodeMap[key];\n this.detachFromList(node);\n this.prependToList(node);\n return node.value;\n }\n };\n LRUCache.prototype.remove = function (key) {\n if (this.nodeMap[key]) {\n var node = this.nodeMap[key];\n this.detachFromList(node);\n delete this.nodeMap[key];\n }\n };\n LRUCache.prototype.put = function (key, value) {\n if (this.nodeMap[key]) {\n this.remove(key);\n }\n else if (this.size === this.sizeLimit) {\n var tailNode = this.removeFromTail();\n var key_1 = tailNode.key;\n delete this.nodeMap[key_1];\n }\n var newNode = new LinkedListNode(key, value);\n this.nodeMap[key] = newNode;\n this.prependToList(newNode);\n };\n LRUCache.prototype.empty = function () {\n var keys = Object.keys(this.nodeMap);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var node = this.nodeMap[key];\n this.detachFromList(node);\n delete this.nodeMap[key];\n }\n };\n return LRUCache;\n}());\nexports.LRUCache = LRUCache;", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar LRU_1 = require(\"./utils/LRU\");\nvar CACHE_SIZE = 1000;\n/**\n * Inspired node-lru-cache[https://github.com/isaacs/node-lru-cache]\n */\nvar EndpointCache = /** @class */ (function () {\n function EndpointCache(maxSize) {\n if (maxSize === void 0) { maxSize = CACHE_SIZE; }\n this.maxSize = maxSize;\n this.cache = new LRU_1.LRUCache(maxSize);\n }\n ;\n Object.defineProperty(EndpointCache.prototype, \"size\", {\n get: function () {\n return this.cache.length;\n },\n enumerable: true,\n configurable: true\n });\n EndpointCache.prototype.put = function (key, value) {\n var keyString = typeof key !== 'string' ? EndpointCache.getKeyString(key) : key;\n var endpointRecord = this.populateValue(value);\n this.cache.put(keyString, endpointRecord);\n };\n EndpointCache.prototype.get = function (key) {\n var keyString = typeof key !== 'string' ? EndpointCache.getKeyString(key) : key;\n var now = Date.now();\n var records = this.cache.get(keyString);\n if (records) {\n for (var i = records.length-1; i >= 0; i--) {\n var record = records[i];\n if (record.Expire < now) {\n records.splice(i, 1);\n }\n }\n if (records.length === 0) {\n this.cache.remove(keyString);\n return undefined;\n }\n }\n return records;\n };\n EndpointCache.getKeyString = function (key) {\n var identifiers = [];\n var identifierNames = Object.keys(key).sort();\n for (var i = 0; i < identifierNames.length; i++) {\n var identifierName = identifierNames[i];\n if (key[identifierName] === undefined)\n continue;\n identifiers.push(key[identifierName]);\n }\n return identifiers.join(' ');\n };\n EndpointCache.prototype.populateValue = function (endpoints) {\n var now = Date.now();\n return endpoints.map(function (endpoint) { return ({\n Address: endpoint.Address || '',\n Expire: now + (endpoint.CachePeriodInMinutes || 1) * 60 * 1000\n }); });\n };\n EndpointCache.prototype.empty = function () {\n this.cache.empty();\n };\n EndpointCache.prototype.remove = function (key) {\n var keyString = typeof key !== 'string' ? EndpointCache.getKeyString(key) : key;\n this.cache.remove(keyString);\n };\n return EndpointCache;\n}());\nexports.EndpointCache = EndpointCache;", "var AWS = require('./core');\n\n/**\n * @api private\n * @!method on(eventName, callback)\n * Registers an event listener callback for the event given by `eventName`.\n * Parameters passed to the callback function depend on the individual event\n * being triggered. See the event documentation for those parameters.\n *\n * @param eventName [String] the event name to register the listener for\n * @param callback [Function] the listener callback function\n * @param toHead [Boolean] attach the listener callback to the head of callback array if set to true.\n * Default to be false.\n * @return [AWS.SequentialExecutor] the same object for chaining\n */\nAWS.SequentialExecutor = AWS.util.inherit({\n\n constructor: function SequentialExecutor() {\n this._events = {};\n },\n\n /**\n * @api private\n */\n listeners: function listeners(eventName) {\n return this._events[eventName] ? this._events[eventName].slice(0) : [];\n },\n\n on: function on(eventName, listener, toHead) {\n if (this._events[eventName]) {\n toHead ?\n this._events[eventName].unshift(listener) :\n this._events[eventName].push(listener);\n } else {\n this._events[eventName] = [listener];\n }\n return this;\n },\n\n onAsync: function onAsync(eventName, listener, toHead) {\n listener._isAsync = true;\n return this.on(eventName, listener, toHead);\n },\n\n removeListener: function removeListener(eventName, listener) {\n var listeners = this._events[eventName];\n if (listeners) {\n var length = listeners.length;\n var position = -1;\n for (var i = 0; i < length; ++i) {\n if (listeners[i] === listener) {\n position = i;\n }\n }\n if (position > -1) {\n listeners.splice(position, 1);\n }\n }\n return this;\n },\n\n removeAllListeners: function removeAllListeners(eventName) {\n if (eventName) {\n delete this._events[eventName];\n } else {\n this._events = {};\n }\n return this;\n },\n\n /**\n * @api private\n */\n emit: function emit(eventName, eventArgs, doneCallback) {\n if (!doneCallback) doneCallback = function() { };\n var listeners = this.listeners(eventName);\n var count = listeners.length;\n this.callListeners(listeners, eventArgs, doneCallback);\n return count > 0;\n },\n\n /**\n * @api private\n */\n callListeners: function callListeners(listeners, args, doneCallback, prevError) {\n var self = this;\n var error = prevError || null;\n\n function callNextListener(err) {\n if (err) {\n error = AWS.util.error(error || new Error(), err);\n if (self._haltHandlersOnError) {\n return doneCallback.call(self, error);\n }\n }\n self.callListeners(listeners, args, doneCallback, error);\n }\n\n while (listeners.length > 0) {\n var listener = listeners.shift();\n if (listener._isAsync) { // asynchronous listener\n listener.apply(self, args.concat([callNextListener]));\n return; // stop here, callNextListener will continue\n } else { // synchronous listener\n try {\n listener.apply(self, args);\n } catch (err) {\n error = AWS.util.error(error || new Error(), err);\n }\n if (error && self._haltHandlersOnError) {\n doneCallback.call(self, error);\n return;\n }\n }\n }\n doneCallback.call(self, error);\n },\n\n /**\n * Adds or copies a set of listeners from another list of\n * listeners or SequentialExecutor object.\n *\n * @param listeners [map>, AWS.SequentialExecutor]\n * a list of events and callbacks, or an event emitter object\n * containing listeners to add to this emitter object.\n * @return [AWS.SequentialExecutor] the emitter object, for chaining.\n * @example Adding listeners from a map of listeners\n * emitter.addListeners({\n * event1: [function() { ... }, function() { ... }],\n * event2: [function() { ... }]\n * });\n * emitter.emit('event1'); // emitter has event1\n * emitter.emit('event2'); // emitter has event2\n * @example Adding listeners from another emitter object\n * var emitter1 = new AWS.SequentialExecutor();\n * emitter1.on('event1', function() { ... });\n * emitter1.on('event2', function() { ... });\n * var emitter2 = new AWS.SequentialExecutor();\n * emitter2.addListeners(emitter1);\n * emitter2.emit('event1'); // emitter2 has event1\n * emitter2.emit('event2'); // emitter2 has event2\n */\n addListeners: function addListeners(listeners) {\n var self = this;\n\n // extract listeners if parameter is an SequentialExecutor object\n if (listeners._events) listeners = listeners._events;\n\n AWS.util.each(listeners, function(event, callbacks) {\n if (typeof callbacks === 'function') callbacks = [callbacks];\n AWS.util.arrayEach(callbacks, function(callback) {\n self.on(event, callback);\n });\n });\n\n return self;\n },\n\n /**\n * Registers an event with {on} and saves the callback handle function\n * as a property on the emitter object using a given `name`.\n *\n * @param name [String] the property name to set on this object containing\n * the callback function handle so that the listener can be removed in\n * the future.\n * @param (see on)\n * @return (see on)\n * @example Adding a named listener DATA_CALLBACK\n * var listener = function() { doSomething(); };\n * emitter.addNamedListener('DATA_CALLBACK', 'data', listener);\n *\n * // the following prints: true\n * console.log(emitter.DATA_CALLBACK == listener);\n */\n addNamedListener: function addNamedListener(name, eventName, callback, toHead) {\n this[name] = callback;\n this.addListener(eventName, callback, toHead);\n return this;\n },\n\n /**\n * @api private\n */\n addNamedAsyncListener: function addNamedAsyncListener(name, eventName, callback, toHead) {\n callback._isAsync = true;\n return this.addNamedListener(name, eventName, callback, toHead);\n },\n\n /**\n * Helper method to add a set of named listeners using\n * {addNamedListener}. The callback contains a parameter\n * with a handle to the `addNamedListener` method.\n *\n * @callback callback function(add)\n * The callback function is called immediately in order to provide\n * the `add` function to the block. This simplifies the addition of\n * a large group of named listeners.\n * @param add [Function] the {addNamedListener} function to call\n * when registering listeners.\n * @example Adding a set of named listeners\n * emitter.addNamedListeners(function(add) {\n * add('DATA_CALLBACK', 'data', function() { ... });\n * add('OTHER', 'otherEvent', function() { ... });\n * add('LAST', 'lastEvent', function() { ... });\n * });\n *\n * // these properties are now set:\n * emitter.DATA_CALLBACK;\n * emitter.OTHER;\n * emitter.LAST;\n */\n addNamedListeners: function addNamedListeners(callback) {\n var self = this;\n callback(\n function() {\n self.addNamedListener.apply(self, arguments);\n },\n function() {\n self.addNamedAsyncListener.apply(self, arguments);\n }\n );\n return this;\n }\n});\n\n/**\n * {on} is the prefered method.\n * @api private\n */\nAWS.SequentialExecutor.prototype.addListener = AWS.SequentialExecutor.prototype.on;\n\n/**\n * @api private\n */\nmodule.exports = AWS.SequentialExecutor;\n", "var util = require('./util');\nvar regionConfig = require('./region_config_data.json');\n\nfunction generateRegionPrefix(region) {\n if (!region) return null;\n var parts = region.split('-');\n if (parts.length < 3) return null;\n return parts.slice(0, parts.length - 2).join('-') + '-*';\n}\n\nfunction derivedKeys(service) {\n var region = service.config.region;\n var regionPrefix = generateRegionPrefix(region);\n var endpointPrefix = service.api.endpointPrefix;\n\n return [\n [region, endpointPrefix],\n [regionPrefix, endpointPrefix],\n [region, '*'],\n [regionPrefix, '*'],\n ['*', endpointPrefix],\n ['*', '*']\n ].map(function(item) {\n return item[0] && item[1] ? item.join('/') : null;\n });\n}\n\nfunction applyConfig(service, config) {\n util.each(config, function(key, value) {\n if (key === 'globalEndpoint') return;\n if (service.config[key] === undefined || service.config[key] === null) {\n service.config[key] = value;\n }\n });\n}\n\nfunction configureEndpoint(service) {\n var keys = derivedKeys(service);\n var useFipsEndpoint = service.config.useFipsEndpoint;\n var useDualstackEndpoint = service.config.useDualstackEndpoint;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!key) continue;\n\n var rules = useFipsEndpoint\n ? useDualstackEndpoint\n ? regionConfig.dualstackFipsRules\n : regionConfig.fipsRules\n : useDualstackEndpoint\n ? regionConfig.dualstackRules\n : regionConfig.rules;\n\n if (Object.prototype.hasOwnProperty.call(rules, key)) {\n var config = rules[key];\n if (typeof config === 'string') {\n config = regionConfig.patterns[config];\n }\n\n // set global endpoint\n service.isGlobalEndpoint = !!config.globalEndpoint;\n if (config.signingRegion) {\n service.signingRegion = config.signingRegion;\n }\n\n // signature version\n if (!config.signatureVersion) config.signatureVersion = 'v4';\n\n // merge config\n applyConfig(service, config);\n return;\n }\n }\n}\n\nfunction getEndpointSuffix(region) {\n var regionRegexes = {\n '^(us|eu|ap|sa|ca|me)\\\\-\\\\w+\\\\-\\\\d+$': 'amazonaws.com',\n '^cn\\\\-\\\\w+\\\\-\\\\d+$': 'amazonaws.com.cn',\n '^us\\\\-gov\\\\-\\\\w+\\\\-\\\\d+$': 'amazonaws.com',\n '^us\\\\-iso\\\\-\\\\w+\\\\-\\\\d+$': 'c2s.ic.gov',\n '^us\\\\-isob\\\\-\\\\w+\\\\-\\\\d+$': 'sc2s.sgov.gov'\n };\n var defaultSuffix = 'amazonaws.com';\n var regexes = Object.keys(regionRegexes);\n for (var i = 0; i < regexes.length; i++) {\n var regionPattern = RegExp(regexes[i]);\n var dnsSuffix = regionRegexes[regexes[i]];\n if (regionPattern.test(region)) return dnsSuffix;\n }\n return defaultSuffix;\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n configureEndpoint: configureEndpoint,\n getEndpointSuffix: getEndpointSuffix,\n};\n", "function isFipsRegion(region) {\n return typeof region === 'string' && (region.startsWith('fips-') || region.endsWith('-fips'));\n}\n\nfunction isGlobalRegion(region) {\n return typeof region === 'string' && ['aws-global', 'aws-us-gov-global'].includes(region);\n}\n\nfunction getRealRegion(region) {\n return ['fips-aws-global', 'aws-fips', 'aws-global'].includes(region)\n ? 'us-east-1'\n : ['fips-aws-us-gov-global', 'aws-us-gov-global'].includes(region)\n ? 'us-gov-west-1'\n : region.replace(/fips-(dkr-|prod-)?|-fips/, '');\n}\n\nmodule.exports = {\n isFipsRegion: isFipsRegion,\n isGlobalRegion: isGlobalRegion,\n getRealRegion: getRealRegion\n};\n", "var AWS = require('./core');\nvar Api = require('./model/api');\nvar regionConfig = require('./region_config');\n\nvar inherit = AWS.util.inherit;\nvar clientCount = 0;\nvar region_utils = require('./region/utils');\n\n/**\n * The service class representing an AWS service.\n *\n * @class_abstract This class is an abstract class.\n *\n * @!attribute apiVersions\n * @return [Array] the list of API versions supported by this service.\n * @readonly\n */\nAWS.Service = inherit({\n /**\n * Create a new service object with a configuration object\n *\n * @param config [map] a map of configuration options\n */\n constructor: function Service(config) {\n if (!this.loadServiceClass) {\n throw AWS.util.error(new Error(),\n 'Service must be constructed with `new\\' operator');\n }\n\n if (config) {\n if (config.region) {\n var region = config.region;\n if (region_utils.isFipsRegion(region)) {\n config.region = region_utils.getRealRegion(region);\n config.useFipsEndpoint = true;\n }\n if (region_utils.isGlobalRegion(region)) {\n config.region = region_utils.getRealRegion(region);\n }\n }\n if (typeof config.useDualstack === 'boolean'\n && typeof config.useDualstackEndpoint !== 'boolean') {\n config.useDualstackEndpoint = config.useDualstack;\n }\n }\n\n var ServiceClass = this.loadServiceClass(config || {});\n if (ServiceClass) {\n var originalConfig = AWS.util.copy(config);\n var svc = new ServiceClass(config);\n Object.defineProperty(svc, '_originalConfig', {\n get: function() { return originalConfig; },\n enumerable: false,\n configurable: true\n });\n svc._clientId = ++clientCount;\n return svc;\n }\n this.initialize(config);\n },\n\n /**\n * @api private\n */\n initialize: function initialize(config) {\n var svcConfig = AWS.config[this.serviceIdentifier];\n this.config = new AWS.Config(AWS.config);\n if (svcConfig) this.config.update(svcConfig, true);\n if (config) this.config.update(config, true);\n\n this.validateService();\n if (!this.config.endpoint) regionConfig.configureEndpoint(this);\n\n this.config.endpoint = this.endpointFromTemplate(this.config.endpoint);\n this.setEndpoint(this.config.endpoint);\n //enable attaching listeners to service client\n AWS.SequentialExecutor.call(this);\n AWS.Service.addDefaultMonitoringListeners(this);\n if ((this.config.clientSideMonitoring || AWS.Service._clientSideMonitoring) && this.publisher) {\n var publisher = this.publisher;\n this.addNamedListener('PUBLISH_API_CALL', 'apiCall', function PUBLISH_API_CALL(event) {\n process.nextTick(function() {publisher.eventHandler(event);});\n });\n this.addNamedListener('PUBLISH_API_ATTEMPT', 'apiCallAttempt', function PUBLISH_API_ATTEMPT(event) {\n process.nextTick(function() {publisher.eventHandler(event);});\n });\n }\n },\n\n /**\n * @api private\n */\n validateService: function validateService() {\n },\n\n /**\n * @api private\n */\n loadServiceClass: function loadServiceClass(serviceConfig) {\n var config = serviceConfig;\n if (!AWS.util.isEmpty(this.api)) {\n return null;\n } else if (config.apiConfig) {\n return AWS.Service.defineServiceApi(this.constructor, config.apiConfig);\n } else if (!this.constructor.services) {\n return null;\n } else {\n config = new AWS.Config(AWS.config);\n config.update(serviceConfig, true);\n var version = config.apiVersions[this.constructor.serviceIdentifier];\n version = version || config.apiVersion;\n return this.getLatestServiceClass(version);\n }\n },\n\n /**\n * @api private\n */\n getLatestServiceClass: function getLatestServiceClass(version) {\n version = this.getLatestServiceVersion(version);\n if (this.constructor.services[version] === null) {\n AWS.Service.defineServiceApi(this.constructor, version);\n }\n\n return this.constructor.services[version];\n },\n\n /**\n * @api private\n */\n getLatestServiceVersion: function getLatestServiceVersion(version) {\n if (!this.constructor.services || this.constructor.services.length === 0) {\n throw new Error('No services defined on ' +\n this.constructor.serviceIdentifier);\n }\n\n if (!version) {\n version = 'latest';\n } else if (AWS.util.isType(version, Date)) {\n version = AWS.util.date.iso8601(version).split('T')[0];\n }\n\n if (Object.hasOwnProperty(this.constructor.services, version)) {\n return version;\n }\n\n var keys = Object.keys(this.constructor.services).sort();\n var selectedVersion = null;\n for (var i = keys.length - 1; i >= 0; i--) {\n // versions that end in \"*\" are not available on disk and can be\n // skipped, so do not choose these as selectedVersions\n if (keys[i][keys[i].length - 1] !== '*') {\n selectedVersion = keys[i];\n }\n if (keys[i].substr(0, 10) <= version) {\n return selectedVersion;\n }\n }\n\n throw new Error('Could not find ' + this.constructor.serviceIdentifier +\n ' API to satisfy version constraint `' + version + '\\'');\n },\n\n /**\n * @api private\n */\n api: {},\n\n /**\n * @api private\n */\n defaultRetryCount: 3,\n\n /**\n * @api private\n */\n customizeRequests: function customizeRequests(callback) {\n if (!callback) {\n this.customRequestHandler = null;\n } else if (typeof callback === 'function') {\n this.customRequestHandler = callback;\n } else {\n throw new Error('Invalid callback type \\'' + typeof callback + '\\' provided in customizeRequests');\n }\n },\n\n /**\n * Calls an operation on a service with the given input parameters.\n *\n * @param operation [String] the name of the operation to call on the service.\n * @param params [map] a map of input options for the operation\n * @callback callback function(err, data)\n * If a callback is supplied, it is called when a response is returned\n * from the service.\n * @param err [Error] the error object returned from the request.\n * Set to `null` if the request is successful.\n * @param data [Object] the de-serialized data returned from\n * the request. Set to `null` if a request error occurs.\n */\n makeRequest: function makeRequest(operation, params, callback) {\n if (typeof params === 'function') {\n callback = params;\n params = null;\n }\n\n params = params || {};\n if (this.config.params) { // copy only toplevel bound params\n var rules = this.api.operations[operation];\n if (rules) {\n params = AWS.util.copy(params);\n AWS.util.each(this.config.params, function(key, value) {\n if (rules.input.members[key]) {\n if (params[key] === undefined || params[key] === null) {\n params[key] = value;\n }\n }\n });\n }\n }\n\n var request = new AWS.Request(this, operation, params);\n this.addAllRequestListeners(request);\n this.attachMonitoringEmitter(request);\n if (callback) request.send(callback);\n return request;\n },\n\n /**\n * Calls an operation on a service with the given input parameters, without\n * any authentication data. This method is useful for \"public\" API operations.\n *\n * @param operation [String] the name of the operation to call on the service.\n * @param params [map] a map of input options for the operation\n * @callback callback function(err, data)\n * If a callback is supplied, it is called when a response is returned\n * from the service.\n * @param err [Error] the error object returned from the request.\n * Set to `null` if the request is successful.\n * @param data [Object] the de-serialized data returned from\n * the request. Set to `null` if a request error occurs.\n */\n makeUnauthenticatedRequest: function makeUnauthenticatedRequest(operation, params, callback) {\n if (typeof params === 'function') {\n callback = params;\n params = {};\n }\n\n var request = this.makeRequest(operation, params).toUnauthenticated();\n return callback ? request.send(callback) : request;\n },\n\n /**\n * Waits for a given state\n *\n * @param state [String] the state on the service to wait for\n * @param params [map] a map of parameters to pass with each request\n * @option params $waiter [map] a map of configuration options for the waiter\n * @option params $waiter.delay [Number] The number of seconds to wait between\n * requests\n * @option params $waiter.maxAttempts [Number] The maximum number of requests\n * to send while waiting\n * @callback callback function(err, data)\n * If a callback is supplied, it is called when a response is returned\n * from the service.\n * @param err [Error] the error object returned from the request.\n * Set to `null` if the request is successful.\n * @param data [Object] the de-serialized data returned from\n * the request. Set to `null` if a request error occurs.\n */\n waitFor: function waitFor(state, params, callback) {\n var waiter = new AWS.ResourceWaiter(this, state);\n return waiter.wait(params, callback);\n },\n\n /**\n * @api private\n */\n addAllRequestListeners: function addAllRequestListeners(request) {\n var list = [AWS.events, AWS.EventListeners.Core, this.serviceInterface(),\n AWS.EventListeners.CorePost];\n for (var i = 0; i < list.length; i++) {\n if (list[i]) request.addListeners(list[i]);\n }\n\n // disable parameter validation\n if (!this.config.paramValidation) {\n request.removeListener('validate',\n AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n }\n\n if (this.config.logger) { // add logging events\n request.addListeners(AWS.EventListeners.Logger);\n }\n\n this.setupRequestListeners(request);\n // call prototype's customRequestHandler\n if (typeof this.constructor.prototype.customRequestHandler === 'function') {\n this.constructor.prototype.customRequestHandler(request);\n }\n // call instance's customRequestHandler\n if (Object.prototype.hasOwnProperty.call(this, 'customRequestHandler') && typeof this.customRequestHandler === 'function') {\n this.customRequestHandler(request);\n }\n },\n\n /**\n * Event recording metrics for a whole API call.\n * @returns {object} a subset of api call metrics\n * @api private\n */\n apiCallEvent: function apiCallEvent(request) {\n var api = request.service.api.operations[request.operation];\n var monitoringEvent = {\n Type: 'ApiCall',\n Api: api ? api.name : request.operation,\n Version: 1,\n Service: request.service.api.serviceId || request.service.api.endpointPrefix,\n Region: request.httpRequest.region,\n MaxRetriesExceeded: 0,\n UserAgent: request.httpRequest.getUserAgent(),\n };\n var response = request.response;\n if (response.httpResponse.statusCode) {\n monitoringEvent.FinalHttpStatusCode = response.httpResponse.statusCode;\n }\n if (response.error) {\n var error = response.error;\n var statusCode = response.httpResponse.statusCode;\n if (statusCode > 299) {\n if (error.code) monitoringEvent.FinalAwsException = error.code;\n if (error.message) monitoringEvent.FinalAwsExceptionMessage = error.message;\n } else {\n if (error.code || error.name) monitoringEvent.FinalSdkException = error.code || error.name;\n if (error.message) monitoringEvent.FinalSdkExceptionMessage = error.message;\n }\n }\n return monitoringEvent;\n },\n\n /**\n * Event recording metrics for an API call attempt.\n * @returns {object} a subset of api call attempt metrics\n * @api private\n */\n apiAttemptEvent: function apiAttemptEvent(request) {\n var api = request.service.api.operations[request.operation];\n var monitoringEvent = {\n Type: 'ApiCallAttempt',\n Api: api ? api.name : request.operation,\n Version: 1,\n Service: request.service.api.serviceId || request.service.api.endpointPrefix,\n Fqdn: request.httpRequest.endpoint.hostname,\n UserAgent: request.httpRequest.getUserAgent(),\n };\n var response = request.response;\n if (response.httpResponse.statusCode) {\n monitoringEvent.HttpStatusCode = response.httpResponse.statusCode;\n }\n if (\n !request._unAuthenticated &&\n request.service.config.credentials &&\n request.service.config.credentials.accessKeyId\n ) {\n monitoringEvent.AccessKey = request.service.config.credentials.accessKeyId;\n }\n if (!response.httpResponse.headers) return monitoringEvent;\n if (request.httpRequest.headers['x-amz-security-token']) {\n monitoringEvent.SessionToken = request.httpRequest.headers['x-amz-security-token'];\n }\n if (response.httpResponse.headers['x-amzn-requestid']) {\n monitoringEvent.XAmznRequestId = response.httpResponse.headers['x-amzn-requestid'];\n }\n if (response.httpResponse.headers['x-amz-request-id']) {\n monitoringEvent.XAmzRequestId = response.httpResponse.headers['x-amz-request-id'];\n }\n if (response.httpResponse.headers['x-amz-id-2']) {\n monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2'];\n }\n return monitoringEvent;\n },\n\n /**\n * Add metrics of failed request.\n * @api private\n */\n attemptFailEvent: function attemptFailEvent(request) {\n var monitoringEvent = this.apiAttemptEvent(request);\n var response = request.response;\n var error = response.error;\n if (response.httpResponse.statusCode > 299 ) {\n if (error.code) monitoringEvent.AwsException = error.code;\n if (error.message) monitoringEvent.AwsExceptionMessage = error.message;\n } else {\n if (error.code || error.name) monitoringEvent.SdkException = error.code || error.name;\n if (error.message) monitoringEvent.SdkExceptionMessage = error.message;\n }\n return monitoringEvent;\n },\n\n /**\n * Attach listeners to request object to fetch metrics of each request\n * and emit data object through \\'ApiCall\\' and \\'ApiCallAttempt\\' events.\n * @api private\n */\n attachMonitoringEmitter: function attachMonitoringEmitter(request) {\n var attemptTimestamp; //timestamp marking the beginning of a request attempt\n var attemptStartRealTime; //Start time of request attempt. Used to calculating attemptLatency\n var attemptLatency; //latency from request sent out to http response reaching SDK\n var callStartRealTime; //Start time of API call. Used to calculating API call latency\n var attemptCount = 0; //request.retryCount is not reliable here\n var region; //region cache region for each attempt since it can be updated in plase (e.g. s3)\n var callTimestamp; //timestamp when the request is created\n var self = this;\n var addToHead = true;\n\n request.on('validate', function () {\n callStartRealTime = AWS.util.realClock.now();\n callTimestamp = Date.now();\n }, addToHead);\n request.on('sign', function () {\n attemptStartRealTime = AWS.util.realClock.now();\n attemptTimestamp = Date.now();\n region = request.httpRequest.region;\n attemptCount++;\n }, addToHead);\n request.on('validateResponse', function() {\n attemptLatency = Math.round(AWS.util.realClock.now() - attemptStartRealTime);\n });\n request.addNamedListener('API_CALL_ATTEMPT', 'success', function API_CALL_ATTEMPT() {\n var apiAttemptEvent = self.apiAttemptEvent(request);\n apiAttemptEvent.Timestamp = attemptTimestamp;\n apiAttemptEvent.AttemptLatency = attemptLatency >= 0 ? attemptLatency : 0;\n apiAttemptEvent.Region = region;\n self.emit('apiCallAttempt', [apiAttemptEvent]);\n });\n request.addNamedListener('API_CALL_ATTEMPT_RETRY', 'retry', function API_CALL_ATTEMPT_RETRY() {\n var apiAttemptEvent = self.attemptFailEvent(request);\n apiAttemptEvent.Timestamp = attemptTimestamp;\n //attemptLatency may not be available if fail before response\n attemptLatency = attemptLatency ||\n Math.round(AWS.util.realClock.now() - attemptStartRealTime);\n apiAttemptEvent.AttemptLatency = attemptLatency >= 0 ? attemptLatency : 0;\n apiAttemptEvent.Region = region;\n self.emit('apiCallAttempt', [apiAttemptEvent]);\n });\n request.addNamedListener('API_CALL', 'complete', function API_CALL() {\n var apiCallEvent = self.apiCallEvent(request);\n apiCallEvent.AttemptCount = attemptCount;\n if (apiCallEvent.AttemptCount <= 0) return;\n apiCallEvent.Timestamp = callTimestamp;\n var latency = Math.round(AWS.util.realClock.now() - callStartRealTime);\n apiCallEvent.Latency = latency >= 0 ? latency : 0;\n var response = request.response;\n if (\n response.error &&\n response.error.retryable &&\n typeof response.retryCount === 'number' &&\n typeof response.maxRetries === 'number' &&\n (response.retryCount >= response.maxRetries)\n ) {\n apiCallEvent.MaxRetriesExceeded = 1;\n }\n self.emit('apiCall', [apiCallEvent]);\n });\n },\n\n /**\n * Override this method to setup any custom request listeners for each\n * new request to the service.\n *\n * @method_abstract This is an abstract method.\n */\n setupRequestListeners: function setupRequestListeners(request) {\n },\n\n /**\n * Gets the signing name for a given request\n * @api private\n */\n getSigningName: function getSigningName() {\n return this.api.signingName || this.api.endpointPrefix;\n },\n\n /**\n * Gets the signer class for a given request\n * @api private\n */\n getSignerClass: function getSignerClass(request) {\n var version;\n // get operation authtype if present\n var operation = null;\n var authtype = '';\n if (request) {\n var operations = request.service.api.operations || {};\n operation = operations[request.operation] || null;\n authtype = operation ? operation.authtype : '';\n }\n if (this.config.signatureVersion) {\n version = this.config.signatureVersion;\n } else if (authtype === 'v4' || authtype === 'v4-unsigned-body') {\n version = 'v4';\n } else {\n version = this.api.signatureVersion;\n }\n return AWS.Signers.RequestSigner.getVersion(version);\n },\n\n /**\n * @api private\n */\n serviceInterface: function serviceInterface() {\n switch (this.api.protocol) {\n case 'ec2': return AWS.EventListeners.Query;\n case 'query': return AWS.EventListeners.Query;\n case 'json': return AWS.EventListeners.Json;\n case 'rest-json': return AWS.EventListeners.RestJson;\n case 'rest-xml': return AWS.EventListeners.RestXml;\n }\n if (this.api.protocol) {\n throw new Error('Invalid service `protocol\\' ' +\n this.api.protocol + ' in API config');\n }\n },\n\n /**\n * @api private\n */\n successfulResponse: function successfulResponse(resp) {\n return resp.httpResponse.statusCode < 300;\n },\n\n /**\n * How many times a failed request should be retried before giving up.\n * the defaultRetryCount can be overriden by service classes.\n *\n * @api private\n */\n numRetries: function numRetries() {\n if (this.config.maxRetries !== undefined) {\n return this.config.maxRetries;\n } else {\n return this.defaultRetryCount;\n }\n },\n\n /**\n * @api private\n */\n retryDelays: function retryDelays(retryCount, err) {\n return AWS.util.calculateRetryDelay(retryCount, this.config.retryDelayOptions, err);\n },\n\n /**\n * @api private\n */\n retryableError: function retryableError(error) {\n if (this.timeoutError(error)) return true;\n if (this.networkingError(error)) return true;\n if (this.expiredCredentialsError(error)) return true;\n if (this.throttledError(error)) return true;\n if (error.statusCode >= 500) return true;\n return false;\n },\n\n /**\n * @api private\n */\n networkingError: function networkingError(error) {\n return error.code === 'NetworkingError';\n },\n\n /**\n * @api private\n */\n timeoutError: function timeoutError(error) {\n return error.code === 'TimeoutError';\n },\n\n /**\n * @api private\n */\n expiredCredentialsError: function expiredCredentialsError(error) {\n // TODO : this only handles *one* of the expired credential codes\n return (error.code === 'ExpiredTokenException');\n },\n\n /**\n * @api private\n */\n clockSkewError: function clockSkewError(error) {\n switch (error.code) {\n case 'RequestTimeTooSkewed':\n case 'RequestExpired':\n case 'InvalidSignatureException':\n case 'SignatureDoesNotMatch':\n case 'AuthFailure':\n case 'RequestInTheFuture':\n return true;\n default: return false;\n }\n },\n\n /**\n * @api private\n */\n getSkewCorrectedDate: function getSkewCorrectedDate() {\n return new Date(Date.now() + this.config.systemClockOffset);\n },\n\n /**\n * @api private\n */\n applyClockOffset: function applyClockOffset(newServerTime) {\n if (newServerTime) {\n this.config.systemClockOffset = newServerTime - Date.now();\n }\n },\n\n /**\n * @api private\n */\n isClockSkewed: function isClockSkewed(newServerTime) {\n if (newServerTime) {\n return Math.abs(this.getSkewCorrectedDate().getTime() - newServerTime) >= 300000;\n }\n },\n\n /**\n * @api private\n */\n throttledError: function throttledError(error) {\n // this logic varies between services\n if (error.statusCode === 429) return true;\n switch (error.code) {\n case 'ProvisionedThroughputExceededException':\n case 'Throttling':\n case 'ThrottlingException':\n case 'RequestLimitExceeded':\n case 'RequestThrottled':\n case 'RequestThrottledException':\n case 'TooManyRequestsException':\n case 'TransactionInProgressException': //dynamodb\n case 'EC2ThrottledException':\n return true;\n default:\n return false;\n }\n },\n\n /**\n * @api private\n */\n endpointFromTemplate: function endpointFromTemplate(endpoint) {\n if (typeof endpoint !== 'string') return endpoint;\n\n var e = endpoint;\n e = e.replace(/\\{service\\}/g, this.api.endpointPrefix);\n e = e.replace(/\\{region\\}/g, this.config.region);\n e = e.replace(/\\{scheme\\}/g, this.config.sslEnabled ? 'https' : 'http');\n return e;\n },\n\n /**\n * @api private\n */\n setEndpoint: function setEndpoint(endpoint) {\n this.endpoint = new AWS.Endpoint(endpoint, this.config);\n },\n\n /**\n * @api private\n */\n paginationConfig: function paginationConfig(operation, throwException) {\n var paginator = this.api.operations[operation].paginator;\n if (!paginator) {\n if (throwException) {\n var e = new Error();\n throw AWS.util.error(e, 'No pagination configuration for ' + operation);\n }\n return null;\n }\n\n return paginator;\n }\n});\n\nAWS.util.update(AWS.Service, {\n\n /**\n * Adds one method for each operation described in the api configuration\n *\n * @api private\n */\n defineMethods: function defineMethods(svc) {\n AWS.util.each(svc.prototype.api.operations, function iterator(method) {\n if (svc.prototype[method]) return;\n var operation = svc.prototype.api.operations[method];\n if (operation.authtype === 'none') {\n svc.prototype[method] = function (params, callback) {\n return this.makeUnauthenticatedRequest(method, params, callback);\n };\n } else {\n svc.prototype[method] = function (params, callback) {\n return this.makeRequest(method, params, callback);\n };\n }\n });\n },\n\n /**\n * Defines a new Service class using a service identifier and list of versions\n * including an optional set of features (functions) to apply to the class\n * prototype.\n *\n * @param serviceIdentifier [String] the identifier for the service\n * @param versions [Array] a list of versions that work with this\n * service\n * @param features [Object] an object to attach to the prototype\n * @return [Class] the service class defined by this function.\n */\n defineService: function defineService(serviceIdentifier, versions, features) {\n AWS.Service._serviceMap[serviceIdentifier] = true;\n if (!Array.isArray(versions)) {\n features = versions;\n versions = [];\n }\n\n var svc = inherit(AWS.Service, features || {});\n\n if (typeof serviceIdentifier === 'string') {\n AWS.Service.addVersions(svc, versions);\n\n var identifier = svc.serviceIdentifier || serviceIdentifier;\n svc.serviceIdentifier = identifier;\n } else { // defineService called with an API\n svc.prototype.api = serviceIdentifier;\n AWS.Service.defineMethods(svc);\n }\n AWS.SequentialExecutor.call(this.prototype);\n //util.clientSideMonitoring is only available in node\n if (!this.prototype.publisher && AWS.util.clientSideMonitoring) {\n var Publisher = AWS.util.clientSideMonitoring.Publisher;\n var configProvider = AWS.util.clientSideMonitoring.configProvider;\n var publisherConfig = configProvider();\n this.prototype.publisher = new Publisher(publisherConfig);\n if (publisherConfig.enabled) {\n //if csm is enabled in environment, SDK should send all metrics\n AWS.Service._clientSideMonitoring = true;\n }\n }\n AWS.SequentialExecutor.call(svc.prototype);\n AWS.Service.addDefaultMonitoringListeners(svc.prototype);\n return svc;\n },\n\n /**\n * @api private\n */\n addVersions: function addVersions(svc, versions) {\n if (!Array.isArray(versions)) versions = [versions];\n\n svc.services = svc.services || {};\n for (var i = 0; i < versions.length; i++) {\n if (svc.services[versions[i]] === undefined) {\n svc.services[versions[i]] = null;\n }\n }\n\n svc.apiVersions = Object.keys(svc.services).sort();\n },\n\n /**\n * @api private\n */\n defineServiceApi: function defineServiceApi(superclass, version, apiConfig) {\n var svc = inherit(superclass, {\n serviceIdentifier: superclass.serviceIdentifier\n });\n\n function setApi(api) {\n if (api.isApi) {\n svc.prototype.api = api;\n } else {\n svc.prototype.api = new Api(api, {\n serviceIdentifier: superclass.serviceIdentifier\n });\n }\n }\n\n if (typeof version === 'string') {\n if (apiConfig) {\n setApi(apiConfig);\n } else {\n try {\n setApi(AWS.apiLoader(superclass.serviceIdentifier, version));\n } catch (err) {\n throw AWS.util.error(err, {\n message: 'Could not find API configuration ' +\n superclass.serviceIdentifier + '-' + version\n });\n }\n }\n if (!Object.prototype.hasOwnProperty.call(superclass.services, version)) {\n superclass.apiVersions = superclass.apiVersions.concat(version).sort();\n }\n superclass.services[version] = svc;\n } else {\n setApi(version);\n }\n\n AWS.Service.defineMethods(svc);\n return svc;\n },\n\n /**\n * @api private\n */\n hasService: function(identifier) {\n return Object.prototype.hasOwnProperty.call(AWS.Service._serviceMap, identifier);\n },\n\n /**\n * @param attachOn attach default monitoring listeners to object\n *\n * Each monitoring event should be emitted from service client to service constructor prototype and then\n * to global service prototype like bubbling up. These default monitoring events listener will transfer\n * the monitoring events to the upper layer.\n * @api private\n */\n addDefaultMonitoringListeners: function addDefaultMonitoringListeners(attachOn) {\n attachOn.addNamedListener('MONITOR_EVENTS_BUBBLE', 'apiCallAttempt', function EVENTS_BUBBLE(event) {\n var baseClass = Object.getPrototypeOf(attachOn);\n if (baseClass._events) baseClass.emit('apiCallAttempt', [event]);\n });\n attachOn.addNamedListener('CALL_EVENTS_BUBBLE', 'apiCall', function CALL_EVENTS_BUBBLE(event) {\n var baseClass = Object.getPrototypeOf(attachOn);\n if (baseClass._events) baseClass.emit('apiCall', [event]);\n });\n },\n\n /**\n * @api private\n */\n _serviceMap: {}\n});\n\nAWS.util.mixin(AWS.Service, AWS.SequentialExecutor);\n\n/**\n * @api private\n */\nmodule.exports = AWS.Service;\n", "var AWS = require('./core');\n\n/**\n * Represents your AWS security credentials, specifically the\n * {accessKeyId}, {secretAccessKey}, and optional {sessionToken}.\n * Creating a `Credentials` object allows you to pass around your\n * security information to configuration and service objects.\n *\n * Note that this class typically does not need to be constructed manually,\n * as the {AWS.Config} and {AWS.Service} classes both accept simple\n * options hashes with the three keys. These structures will be converted\n * into Credentials objects automatically.\n *\n * ## Expiring and Refreshing Credentials\n *\n * Occasionally credentials can expire in the middle of a long-running\n * application. In this case, the SDK will automatically attempt to\n * refresh the credentials from the storage location if the Credentials\n * class implements the {refresh} method.\n *\n * If you are implementing a credential storage location, you\n * will want to create a subclass of the `Credentials` class and\n * override the {refresh} method. This method allows credentials to be\n * retrieved from the backing store, be it a file system, database, or\n * some network storage. The method should reset the credential attributes\n * on the object.\n *\n * @!attribute expired\n * @return [Boolean] whether the credentials have been expired and\n * require a refresh. Used in conjunction with {expireTime}.\n * @!attribute expireTime\n * @return [Date] a time when credentials should be considered expired. Used\n * in conjunction with {expired}.\n * @!attribute accessKeyId\n * @return [String] the AWS access key ID\n * @!attribute secretAccessKey\n * @return [String] the AWS secret access key\n * @!attribute sessionToken\n * @return [String] an optional AWS session token\n */\nAWS.Credentials = AWS.util.inherit({\n /**\n * A credentials object can be created using positional arguments or an options\n * hash.\n *\n * @overload AWS.Credentials(accessKeyId, secretAccessKey, sessionToken=null)\n * Creates a Credentials object with a given set of credential information\n * as positional arguments.\n * @param accessKeyId [String] the AWS access key ID\n * @param secretAccessKey [String] the AWS secret access key\n * @param sessionToken [String] the optional AWS session token\n * @example Create a credentials object with AWS credentials\n * var creds = new AWS.Credentials('akid', 'secret', 'session');\n * @overload AWS.Credentials(options)\n * Creates a Credentials object with a given set of credential information\n * as an options hash.\n * @option options accessKeyId [String] the AWS access key ID\n * @option options secretAccessKey [String] the AWS secret access key\n * @option options sessionToken [String] the optional AWS session token\n * @example Create a credentials object with AWS credentials\n * var creds = new AWS.Credentials({\n * accessKeyId: 'akid', secretAccessKey: 'secret', sessionToken: 'session'\n * });\n */\n constructor: function Credentials() {\n // hide secretAccessKey from being displayed with util.inspect\n AWS.util.hideProperties(this, ['secretAccessKey']);\n\n this.expired = false;\n this.expireTime = null;\n this.refreshCallbacks = [];\n if (arguments.length === 1 && typeof arguments[0] === 'object') {\n var creds = arguments[0].credentials || arguments[0];\n this.accessKeyId = creds.accessKeyId;\n this.secretAccessKey = creds.secretAccessKey;\n this.sessionToken = creds.sessionToken;\n } else {\n this.accessKeyId = arguments[0];\n this.secretAccessKey = arguments[1];\n this.sessionToken = arguments[2];\n }\n },\n\n /**\n * @return [Integer] the number of seconds before {expireTime} during which\n * the credentials will be considered expired.\n */\n expiryWindow: 15,\n\n /**\n * @return [Boolean] whether the credentials object should call {refresh}\n * @note Subclasses should override this method to provide custom refresh\n * logic.\n */\n needsRefresh: function needsRefresh() {\n var currentTime = AWS.util.date.getDate().getTime();\n var adjustedTime = new Date(currentTime + this.expiryWindow * 1000);\n\n if (this.expireTime && adjustedTime > this.expireTime) {\n return true;\n } else {\n return this.expired || !this.accessKeyId || !this.secretAccessKey;\n }\n },\n\n /**\n * Gets the existing credentials, refreshing them if they are not yet loaded\n * or have expired. Users should call this method before using {refresh},\n * as this will not attempt to reload credentials when they are already\n * loaded into the object.\n *\n * @callback callback function(err)\n * When this callback is called with no error, it means either credentials\n * do not need to be refreshed or refreshed credentials information has\n * been loaded into the object (as the `accessKeyId`, `secretAccessKey`,\n * and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n */\n get: function get(callback) {\n var self = this;\n if (this.needsRefresh()) {\n this.refresh(function(err) {\n if (!err) self.expired = false; // reset expired flag\n if (callback) callback(err);\n });\n } else if (callback) {\n callback();\n }\n },\n\n /**\n * @!method getPromise()\n * Returns a 'thenable' promise.\n * Gets the existing credentials, refreshing them if they are not yet loaded\n * or have expired. Users should call this method before using {refresh},\n * as this will not attempt to reload credentials when they are already\n * loaded into the object.\n *\n * Two callbacks can be provided to the `then` method on the returned promise.\n * The first callback will be called if the promise is fulfilled, and the second\n * callback will be called if the promise is rejected.\n * @callback fulfilledCallback function()\n * Called if the promise is fulfilled. When this callback is called, it\n * means either credentials do not need to be refreshed or refreshed\n * credentials information has been loaded into the object (as the\n * `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).\n * @callback rejectedCallback function(err)\n * Called if the promise is rejected.\n * @param err [Error] if an error occurred, this value will be filled\n * @return [Promise] A promise that represents the state of the `get` call.\n * @example Calling the `getPromise` method.\n * var promise = credProvider.getPromise();\n * promise.then(function() { ... }, function(err) { ... });\n */\n\n /**\n * @!method refreshPromise()\n * Returns a 'thenable' promise.\n * Refreshes the credentials. Users should call {get} before attempting\n * to forcibly refresh credentials.\n *\n * Two callbacks can be provided to the `then` method on the returned promise.\n * The first callback will be called if the promise is fulfilled, and the second\n * callback will be called if the promise is rejected.\n * @callback fulfilledCallback function()\n * Called if the promise is fulfilled. When this callback is called, it\n * means refreshed credentials information has been loaded into the object\n * (as the `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).\n * @callback rejectedCallback function(err)\n * Called if the promise is rejected.\n * @param err [Error] if an error occurred, this value will be filled\n * @return [Promise] A promise that represents the state of the `refresh` call.\n * @example Calling the `refreshPromise` method.\n * var promise = credProvider.refreshPromise();\n * promise.then(function() { ... }, function(err) { ... });\n */\n\n /**\n * Refreshes the credentials. Users should call {get} before attempting\n * to forcibly refresh credentials.\n *\n * @callback callback function(err)\n * When this callback is called with no error, it means refreshed\n * credentials information has been loaded into the object (as the\n * `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @note Subclasses should override this class to reset the\n * {accessKeyId}, {secretAccessKey} and optional {sessionToken}\n * on the credentials object and then call the callback with\n * any error information.\n * @see get\n */\n refresh: function refresh(callback) {\n this.expired = false;\n callback();\n },\n\n /**\n * @api private\n * @param callback\n */\n coalesceRefresh: function coalesceRefresh(callback, sync) {\n var self = this;\n if (self.refreshCallbacks.push(callback) === 1) {\n self.load(function onLoad(err) {\n AWS.util.arrayEach(self.refreshCallbacks, function(callback) {\n if (sync) {\n callback(err);\n } else {\n // callback could throw, so defer to ensure all callbacks are notified\n AWS.util.defer(function () {\n callback(err);\n });\n }\n });\n self.refreshCallbacks.length = 0;\n });\n }\n },\n\n /**\n * @api private\n * @param callback\n */\n load: function load(callback) {\n callback();\n }\n});\n\n/**\n * @api private\n */\nAWS.Credentials.addPromisesToClass = function addPromisesToClass(PromiseDependency) {\n this.prototype.getPromise = AWS.util.promisifyMethod('get', PromiseDependency);\n this.prototype.refreshPromise = AWS.util.promisifyMethod('refresh', PromiseDependency);\n};\n\n/**\n * @api private\n */\nAWS.Credentials.deletePromisesFromClass = function deletePromisesFromClass() {\n delete this.prototype.getPromise;\n delete this.prototype.refreshPromise;\n};\n\nAWS.util.addPromises(AWS.Credentials);\n", "var AWS = require('../core');\n\n/**\n * Creates a credential provider chain that searches for AWS credentials\n * in a list of credential providers specified by the {providers} property.\n *\n * By default, the chain will use the {defaultProviders} to resolve credentials.\n * These providers will look in the environment using the\n * {AWS.EnvironmentCredentials} class with the 'AWS' and 'AMAZON' prefixes.\n *\n * ## Setting Providers\n *\n * Each provider in the {providers} list should be a function that returns\n * a {AWS.Credentials} object, or a hardcoded credentials object. The function\n * form allows for delayed execution of the credential construction.\n *\n * ## Resolving Credentials from a Chain\n *\n * Call {resolve} to return the first valid credential object that can be\n * loaded by the provider chain.\n *\n * For example, to resolve a chain with a custom provider that checks a file\n * on disk after the set of {defaultProviders}:\n *\n * ```javascript\n * var diskProvider = new AWS.FileSystemCredentials('./creds.json');\n * var chain = new AWS.CredentialProviderChain();\n * chain.providers.push(diskProvider);\n * chain.resolve();\n * ```\n *\n * The above code will return the `diskProvider` object if the\n * file contains credentials and the `defaultProviders` do not contain\n * any credential settings.\n *\n * @!attribute providers\n * @return [Array]\n * a list of credentials objects or functions that return credentials\n * objects. If the provider is a function, the function will be\n * executed lazily when the provider needs to be checked for valid\n * credentials. By default, this object will be set to the\n * {defaultProviders}.\n * @see defaultProviders\n */\nAWS.CredentialProviderChain = AWS.util.inherit(AWS.Credentials, {\n\n /**\n * Creates a new CredentialProviderChain with a default set of providers\n * specified by {defaultProviders}.\n */\n constructor: function CredentialProviderChain(providers) {\n if (providers) {\n this.providers = providers;\n } else {\n this.providers = AWS.CredentialProviderChain.defaultProviders.slice(0);\n }\n this.resolveCallbacks = [];\n },\n\n /**\n * @!method resolvePromise()\n * Returns a 'thenable' promise.\n * Resolves the provider chain by searching for the first set of\n * credentials in {providers}.\n *\n * Two callbacks can be provided to the `then` method on the returned promise.\n * The first callback will be called if the promise is fulfilled, and the second\n * callback will be called if the promise is rejected.\n * @callback fulfilledCallback function(credentials)\n * Called if the promise is fulfilled and the provider resolves the chain\n * to a credentials object\n * @param credentials [AWS.Credentials] the credentials object resolved\n * by the provider chain.\n * @callback rejectedCallback function(error)\n * Called if the promise is rejected.\n * @param err [Error] the error object returned if no credentials are found.\n * @return [Promise] A promise that represents the state of the `resolve` method call.\n * @example Calling the `resolvePromise` method.\n * var promise = chain.resolvePromise();\n * promise.then(function(credentials) { ... }, function(err) { ... });\n */\n\n /**\n * Resolves the provider chain by searching for the first set of\n * credentials in {providers}.\n *\n * @callback callback function(err, credentials)\n * Called when the provider resolves the chain to a credentials object\n * or null if no credentials can be found.\n *\n * @param err [Error] the error object returned if no credentials are\n * found.\n * @param credentials [AWS.Credentials] the credentials object resolved\n * by the provider chain.\n * @return [AWS.CredentialProviderChain] the provider, for chaining.\n */\n resolve: function resolve(callback) {\n var self = this;\n if (self.providers.length === 0) {\n callback(new Error('No providers'));\n return self;\n }\n\n if (self.resolveCallbacks.push(callback) === 1) {\n var index = 0;\n var providers = self.providers.slice(0);\n\n function resolveNext(err, creds) {\n if ((!err && creds) || index === providers.length) {\n AWS.util.arrayEach(self.resolveCallbacks, function (callback) {\n callback(err, creds);\n });\n self.resolveCallbacks.length = 0;\n return;\n }\n\n var provider = providers[index++];\n if (typeof provider === 'function') {\n creds = provider.call();\n } else {\n creds = provider;\n }\n\n if (creds.get) {\n creds.get(function (getErr) {\n resolveNext(getErr, getErr ? null : creds);\n });\n } else {\n resolveNext(null, creds);\n }\n }\n\n resolveNext();\n }\n\n return self;\n }\n});\n\n/**\n * The default set of providers used by a vanilla CredentialProviderChain.\n *\n * In the browser:\n *\n * ```javascript\n * AWS.CredentialProviderChain.defaultProviders = []\n * ```\n *\n * In Node.js:\n *\n * ```javascript\n * AWS.CredentialProviderChain.defaultProviders = [\n * function () { return new AWS.EnvironmentCredentials('AWS'); },\n * function () { return new AWS.EnvironmentCredentials('AMAZON'); },\n * function () { return new AWS.SsoCredentials(); },\n * function () { return new AWS.SharedIniFileCredentials(); },\n * function () { return new AWS.ECSCredentials(); },\n * function () { return new AWS.ProcessCredentials(); },\n * function () { return new AWS.TokenFileWebIdentityCredentials(); },\n * function () { return new AWS.EC2MetadataCredentials() }\n * ]\n * ```\n */\nAWS.CredentialProviderChain.defaultProviders = [];\n\n/**\n * @api private\n */\nAWS.CredentialProviderChain.addPromisesToClass = function addPromisesToClass(PromiseDependency) {\n this.prototype.resolvePromise = AWS.util.promisifyMethod('resolve', PromiseDependency);\n};\n\n/**\n * @api private\n */\nAWS.CredentialProviderChain.deletePromisesFromClass = function deletePromisesFromClass() {\n delete this.prototype.resolvePromise;\n};\n\nAWS.util.addPromises(AWS.CredentialProviderChain);\n", "var AWS = require('./core');\nrequire('./credentials');\nrequire('./credentials/credential_provider_chain');\nvar PromisesDependency;\n\n/**\n * The main configuration class used by all service objects to set\n * the region, credentials, and other options for requests.\n *\n * By default, credentials and region settings are left unconfigured.\n * This should be configured by the application before using any\n * AWS service APIs.\n *\n * In order to set global configuration options, properties should\n * be assigned to the global {AWS.config} object.\n *\n * @see AWS.config\n *\n * @!group General Configuration Options\n *\n * @!attribute credentials\n * @return [AWS.Credentials] the AWS credentials to sign requests with.\n *\n * @!attribute region\n * @example Set the global region setting to us-west-2\n * AWS.config.update({region: 'us-west-2'});\n * @return [AWS.Credentials] The region to send service requests to.\n * @see http://docs.amazonwebservices.com/general/latest/gr/rande.html\n * A list of available endpoints for each AWS service\n *\n * @!attribute maxRetries\n * @return [Integer] the maximum amount of retries to perform for a\n * service request. By default this value is calculated by the specific\n * service object that the request is being made to.\n *\n * @!attribute maxRedirects\n * @return [Integer] the maximum amount of redirects to follow for a\n * service request. Defaults to 10.\n *\n * @!attribute paramValidation\n * @return [Boolean|map] whether input parameters should be validated against\n * the operation description before sending the request. Defaults to true.\n * Pass a map to enable any of the following specific validation features:\n *\n * * **min** [Boolean] — Validates that a value meets the min\n * constraint. This is enabled by default when paramValidation is set\n * to `true`.\n * * **max** [Boolean] — Validates that a value meets the max\n * constraint.\n * * **pattern** [Boolean] — Validates that a string value matches a\n * regular expression.\n * * **enum** [Boolean] — Validates that a string value matches one\n * of the allowable enum values.\n *\n * @!attribute computeChecksums\n * @return [Boolean] whether to compute checksums for payload bodies when\n * the service accepts it (currently supported in S3 and SQS only).\n *\n * @!attribute convertResponseTypes\n * @return [Boolean] whether types are converted when parsing response data.\n * Currently only supported for JSON based services. Turning this off may\n * improve performance on large response payloads. Defaults to `true`.\n *\n * @!attribute correctClockSkew\n * @return [Boolean] whether to apply a clock skew correction and retry\n * requests that fail because of an skewed client clock. Defaults to\n * `false`.\n *\n * @!attribute sslEnabled\n * @return [Boolean] whether SSL is enabled for requests\n *\n * @!attribute s3ForcePathStyle\n * @return [Boolean] whether to force path style URLs for S3 objects\n *\n * @!attribute s3BucketEndpoint\n * @note Setting this configuration option requires an `endpoint` to be\n * provided explicitly to the service constructor.\n * @return [Boolean] whether the provided endpoint addresses an individual\n * bucket (false if it addresses the root API endpoint).\n *\n * @!attribute s3DisableBodySigning\n * @return [Boolean] whether to disable S3 body signing when using signature version `v4`.\n * Body signing can only be disabled when using https. Defaults to `true`.\n *\n * @!attribute s3UsEast1RegionalEndpoint\n * @return ['legacy'|'regional'] when region is set to 'us-east-1', whether to send s3\n * request to global endpoints or 'us-east-1' regional endpoints. This config is only\n * applicable to S3 client;\n * Defaults to 'legacy'\n * @!attribute s3UseArnRegion\n * @return [Boolean] whether to override the request region with the region inferred\n * from requested resource's ARN. Only available for S3 buckets\n * Defaults to `true`\n *\n * @!attribute useAccelerateEndpoint\n * @note This configuration option is only compatible with S3 while accessing\n * dns-compatible buckets.\n * @return [Boolean] Whether to use the Accelerate endpoint with the S3 service.\n * Defaults to `false`.\n *\n * @!attribute retryDelayOptions\n * @example Set the base retry delay for all services to 300 ms\n * AWS.config.update({retryDelayOptions: {base: 300}});\n * // Delays with maxRetries = 3: 300, 600, 1200\n * @example Set a custom backoff function to provide delay values on retries\n * AWS.config.update({retryDelayOptions: {customBackoff: function(retryCount, err) {\n * // returns delay in ms\n * }}});\n * @return [map] A set of options to configure the retry delay on retryable errors.\n * Currently supported options are:\n *\n * * **base** [Integer] — The base number of milliseconds to use in the\n * exponential backoff for operation retries. Defaults to 100 ms for all services except\n * DynamoDB, where it defaults to 50ms.\n *\n * * **customBackoff ** [function] — A custom function that accepts a\n * retry count and error and returns the amount of time to delay in\n * milliseconds. If the result is a non-zero negative value, no further\n * retry attempts will be made. The `base` option will be ignored if this\n * option is supplied. The function is only called for retryable errors.\n *\n * @!attribute httpOptions\n * @return [map] A set of options to pass to the low-level HTTP request.\n * Currently supported options are:\n *\n * * **proxy** [String] — the URL to proxy requests through\n * * **agent** [http.Agent, https.Agent] — the Agent object to perform\n * HTTP requests with. Used for connection pooling. Note that for\n * SSL connections, a special Agent object is used in order to enable\n * peer certificate verification. This feature is only supported in the\n * Node.js environment.\n * * **connectTimeout** [Integer] — Sets the socket to timeout after\n * failing to establish a connection with the server after\n * `connectTimeout` milliseconds. This timeout has no effect once a socket\n * connection has been established.\n * * **timeout** [Integer] — The number of milliseconds a request can\n * take before automatically being terminated.\n * Defaults to two minutes (120000).\n * * **xhrAsync** [Boolean] — Whether the SDK will send asynchronous\n * HTTP requests. Used in the browser environment only. Set to false to\n * send requests synchronously. Defaults to true (async on).\n * * **xhrWithCredentials** [Boolean] — Sets the \"withCredentials\"\n * property of an XMLHttpRequest object. Used in the browser environment\n * only. Defaults to false.\n * @!attribute logger\n * @return [#write,#log] an object that responds to .write() (like a stream)\n * or .log() (like the console object) in order to log information about\n * requests\n *\n * @!attribute systemClockOffset\n * @return [Number] an offset value in milliseconds to apply to all signing\n * times. Use this to compensate for clock skew when your system may be\n * out of sync with the service time. Note that this configuration option\n * can only be applied to the global `AWS.config` object and cannot be\n * overridden in service-specific configuration. Defaults to 0 milliseconds.\n *\n * @!attribute signatureVersion\n * @return [String] the signature version to sign requests with (overriding\n * the API configuration). Possible values are: 'v2', 'v3', 'v4'.\n *\n * @!attribute signatureCache\n * @return [Boolean] whether the signature to sign requests with (overriding\n * the API configuration) is cached. Only applies to the signature version 'v4'.\n * Defaults to `true`.\n *\n * @!attribute endpointDiscoveryEnabled\n * @return [Boolean|undefined] whether to call operations with endpoints\n * given by service dynamically. Setting this config to `true` will enable\n * endpoint discovery for all applicable operations. Setting it to `false`\n * will explicitly disable endpoint discovery even though operations that\n * require endpoint discovery will presumably fail. Leaving it to\n * `undefined` means SDK only do endpoint discovery when it's required.\n * Defaults to `undefined`\n *\n * @!attribute endpointCacheSize\n * @return [Number] the size of the global cache storing endpoints from endpoint\n * discovery operations. Once endpoint cache is created, updating this setting\n * cannot change existing cache size.\n * Defaults to 1000\n *\n * @!attribute hostPrefixEnabled\n * @return [Boolean] whether to marshal request parameters to the prefix of\n * hostname. Defaults to `true`.\n *\n * @!attribute stsRegionalEndpoints\n * @return ['legacy'|'regional'] whether to send sts request to global endpoints or\n * regional endpoints.\n * Defaults to 'legacy'.\n *\n * @!attribute useFipsEndpoint\n * @return [Boolean] Enables FIPS compatible endpoints. Defaults to `false`.\n *\n * @!attribute useDualstackEndpoint\n * @return [Boolean] Enables IPv6 dualstack endpoint. Defaults to `false`.\n */\nAWS.Config = AWS.util.inherit({\n /**\n * @!endgroup\n */\n\n /**\n * Creates a new configuration object. This is the object that passes\n * option data along to service requests, including credentials, security,\n * region information, and some service specific settings.\n *\n * @example Creating a new configuration object with credentials and region\n * var config = new AWS.Config({\n * accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2'\n * });\n * @option options accessKeyId [String] your AWS access key ID.\n * @option options secretAccessKey [String] your AWS secret access key.\n * @option options sessionToken [AWS.Credentials] the optional AWS\n * session token to sign requests with.\n * @option options credentials [AWS.Credentials] the AWS credentials\n * to sign requests with. You can either specify this object, or\n * specify the accessKeyId and secretAccessKey options directly.\n * @option options credentialProvider [AWS.CredentialProviderChain] the\n * provider chain used to resolve credentials if no static `credentials`\n * property is set.\n * @option options region [String] the region to send service requests to.\n * See {region} for more information.\n * @option options maxRetries [Integer] the maximum amount of retries to\n * attempt with a request. See {maxRetries} for more information.\n * @option options maxRedirects [Integer] the maximum amount of redirects to\n * follow with a request. See {maxRedirects} for more information.\n * @option options sslEnabled [Boolean] whether to enable SSL for\n * requests.\n * @option options paramValidation [Boolean|map] whether input parameters\n * should be validated against the operation description before sending\n * the request. Defaults to true. Pass a map to enable any of the\n * following specific validation features:\n *\n * * **min** [Boolean] — Validates that a value meets the min\n * constraint. This is enabled by default when paramValidation is set\n * to `true`.\n * * **max** [Boolean] — Validates that a value meets the max\n * constraint.\n * * **pattern** [Boolean] — Validates that a string value matches a\n * regular expression.\n * * **enum** [Boolean] — Validates that a string value matches one\n * of the allowable enum values.\n * @option options computeChecksums [Boolean] whether to compute checksums\n * for payload bodies when the service accepts it (currently supported\n * in S3 only)\n * @option options convertResponseTypes [Boolean] whether types are converted\n * when parsing response data. Currently only supported for JSON based\n * services. Turning this off may improve performance on large response\n * payloads. Defaults to `true`.\n * @option options correctClockSkew [Boolean] whether to apply a clock skew\n * correction and retry requests that fail because of an skewed client\n * clock. Defaults to `false`.\n * @option options s3ForcePathStyle [Boolean] whether to force path\n * style URLs for S3 objects.\n * @option options s3BucketEndpoint [Boolean] whether the provided endpoint\n * addresses an individual bucket (false if it addresses the root API\n * endpoint). Note that setting this configuration option requires an\n * `endpoint` to be provided explicitly to the service constructor.\n * @option options s3DisableBodySigning [Boolean] whether S3 body signing\n * should be disabled when using signature version `v4`. Body signing\n * can only be disabled when using https. Defaults to `true`.\n * @option options s3UsEast1RegionalEndpoint ['legacy'|'regional'] when region\n * is set to 'us-east-1', whether to send s3 request to global endpoints or\n * 'us-east-1' regional endpoints. This config is only applicable to S3 client.\n * Defaults to `legacy`\n * @option options s3UseArnRegion [Boolean] whether to override the request region\n * with the region inferred from requested resource's ARN. Only available for S3 buckets\n * Defaults to `true`\n *\n * @option options retryDelayOptions [map] A set of options to configure\n * the retry delay on retryable errors. Currently supported options are:\n *\n * * **base** [Integer] — The base number of milliseconds to use in the\n * exponential backoff for operation retries. Defaults to 100 ms for all\n * services except DynamoDB, where it defaults to 50ms.\n * * **customBackoff ** [function] — A custom function that accepts a\n * retry count and error and returns the amount of time to delay in\n * milliseconds. If the result is a non-zero negative value, no further\n * retry attempts will be made. The `base` option will be ignored if this\n * option is supplied. The function is only called for retryable errors.\n * @option options httpOptions [map] A set of options to pass to the low-level\n * HTTP request. Currently supported options are:\n *\n * * **proxy** [String] — the URL to proxy requests through\n * * **agent** [http.Agent, https.Agent] — the Agent object to perform\n * HTTP requests with. Used for connection pooling. Defaults to the global\n * agent (`http.globalAgent`) for non-SSL connections. Note that for\n * SSL connections, a special Agent object is used in order to enable\n * peer certificate verification. This feature is only available in the\n * Node.js environment.\n * * **connectTimeout** [Integer] — Sets the socket to timeout after\n * failing to establish a connection with the server after\n * `connectTimeout` milliseconds. This timeout has no effect once a socket\n * connection has been established.\n * * **timeout** [Integer] — Sets the socket to timeout after timeout\n * milliseconds of inactivity on the socket. Defaults to two minutes\n * (120000).\n * * **xhrAsync** [Boolean] — Whether the SDK will send asynchronous\n * HTTP requests. Used in the browser environment only. Set to false to\n * send requests synchronously. Defaults to true (async on).\n * * **xhrWithCredentials** [Boolean] — Sets the \"withCredentials\"\n * property of an XMLHttpRequest object. Used in the browser environment\n * only. Defaults to false.\n * @option options apiVersion [String, Date] a String in YYYY-MM-DD format\n * (or a date) that represents the latest possible API version that can be\n * used in all services (unless overridden by `apiVersions`). Specify\n * 'latest' to use the latest possible version.\n * @option options apiVersions [map] a map of service\n * identifiers (the lowercase service class name) with the API version to\n * use when instantiating a service. Specify 'latest' for each individual\n * that can use the latest available version.\n * @option options logger [#write,#log] an object that responds to .write()\n * (like a stream) or .log() (like the console object) in order to log\n * information about requests\n * @option options systemClockOffset [Number] an offset value in milliseconds\n * to apply to all signing times. Use this to compensate for clock skew\n * when your system may be out of sync with the service time. Note that\n * this configuration option can only be applied to the global `AWS.config`\n * object and cannot be overridden in service-specific configuration.\n * Defaults to 0 milliseconds.\n * @option options signatureVersion [String] the signature version to sign\n * requests with (overriding the API configuration). Possible values are:\n * 'v2', 'v3', 'v4'.\n * @option options signatureCache [Boolean] whether the signature to sign\n * requests with (overriding the API configuration) is cached. Only applies\n * to the signature version 'v4'. Defaults to `true`.\n * @option options dynamoDbCrc32 [Boolean] whether to validate the CRC32\n * checksum of HTTP response bodies returned by DynamoDB. Default: `true`.\n * @option options useAccelerateEndpoint [Boolean] Whether to use the\n * S3 Transfer Acceleration endpoint with the S3 service. Default: `false`.\n * @option options clientSideMonitoring [Boolean] whether to collect and\n * publish this client's performance metrics of all its API requests.\n * @option options endpointDiscoveryEnabled [Boolean|undefined] whether to\n * call operations with endpoints given by service dynamically. Setting this\n * config to `true` will enable endpoint discovery for all applicable operations.\n * Setting it to `false` will explicitly disable endpoint discovery even though\n * operations that require endpoint discovery will presumably fail. Leaving it\n * to `undefined` means SDK will only do endpoint discovery when it's required.\n * Defaults to `undefined`\n * @option options endpointCacheSize [Number] the size of the global cache storing\n * endpoints from endpoint discovery operations. Once endpoint cache is created,\n * updating this setting cannot change existing cache size.\n * Defaults to 1000\n * @option options hostPrefixEnabled [Boolean] whether to marshal request\n * parameters to the prefix of hostname.\n * Defaults to `true`.\n * @option options stsRegionalEndpoints ['legacy'|'regional'] whether to send sts request\n * to global endpoints or regional endpoints.\n * Defaults to 'legacy'.\n * @option options useFipsEndpoint [Boolean] Enables FIPS compatible endpoints.\n * Defaults to `false`.\n * @option options useDualstackEndpoint [Boolean] Enables IPv6 dualstack endpoint.\n * Defaults to `false`.\n */\n constructor: function Config(options) {\n if (options === undefined) options = {};\n options = this.extractCredentials(options);\n\n AWS.util.each.call(this, this.keys, function (key, value) {\n this.set(key, options[key], value);\n });\n },\n\n /**\n * @!group Managing Credentials\n */\n\n /**\n * Loads credentials from the configuration object. This is used internally\n * by the SDK to ensure that refreshable {Credentials} objects are properly\n * refreshed and loaded when sending a request. If you want to ensure that\n * your credentials are loaded prior to a request, you can use this method\n * directly to provide accurate credential data stored in the object.\n *\n * @note If you configure the SDK with static or environment credentials,\n * the credential data should already be present in {credentials} attribute.\n * This method is primarily necessary to load credentials from asynchronous\n * sources, or sources that can refresh credentials periodically.\n * @example Getting your access key\n * AWS.config.getCredentials(function(err) {\n * if (err) console.log(err.stack); // credentials not loaded\n * else console.log(\"Access Key:\", AWS.config.credentials.accessKeyId);\n * })\n * @callback callback function(err)\n * Called when the {credentials} have been properly set on the configuration\n * object.\n *\n * @param err [Error] if this is set, credentials were not successfully\n * loaded and this error provides information why.\n * @see credentials\n * @see Credentials\n */\n getCredentials: function getCredentials(callback) {\n var self = this;\n\n function finish(err) {\n callback(err, err ? null : self.credentials);\n }\n\n function credError(msg, err) {\n return new AWS.util.error(err || new Error(), {\n code: 'CredentialsError',\n message: msg,\n name: 'CredentialsError'\n });\n }\n\n function getAsyncCredentials() {\n self.credentials.get(function(err) {\n if (err) {\n var msg = 'Could not load credentials from ' +\n self.credentials.constructor.name;\n err = credError(msg, err);\n }\n finish(err);\n });\n }\n\n function getStaticCredentials() {\n var err = null;\n if (!self.credentials.accessKeyId || !self.credentials.secretAccessKey) {\n err = credError('Missing credentials');\n }\n finish(err);\n }\n\n if (self.credentials) {\n if (typeof self.credentials.get === 'function') {\n getAsyncCredentials();\n } else { // static credentials\n getStaticCredentials();\n }\n } else if (self.credentialProvider) {\n self.credentialProvider.resolve(function(err, creds) {\n if (err) {\n err = credError('Could not load credentials from any providers', err);\n }\n self.credentials = creds;\n finish(err);\n });\n } else {\n finish(credError('No credentials to load'));\n }\n },\n\n /**\n * @!group Loading and Setting Configuration Options\n */\n\n /**\n * @overload update(options, allowUnknownKeys = false)\n * Updates the current configuration object with new options.\n *\n * @example Update maxRetries property of a configuration object\n * config.update({maxRetries: 10});\n * @param [Object] options a map of option keys and values.\n * @param [Boolean] allowUnknownKeys whether unknown keys can be set on\n * the configuration object. Defaults to `false`.\n * @see constructor\n */\n update: function update(options, allowUnknownKeys) {\n allowUnknownKeys = allowUnknownKeys || false;\n options = this.extractCredentials(options);\n AWS.util.each.call(this, options, function (key, value) {\n if (allowUnknownKeys || Object.prototype.hasOwnProperty.call(this.keys, key) ||\n AWS.Service.hasService(key)) {\n this.set(key, value);\n }\n });\n },\n\n /**\n * Loads configuration data from a JSON file into this config object.\n * @note Loading configuration will reset all existing configuration\n * on the object.\n * @!macro nobrowser\n * @param path [String] the path relative to your process's current\n * working directory to load configuration from.\n * @return [AWS.Config] the same configuration object\n */\n loadFromPath: function loadFromPath(path) {\n this.clear();\n\n var options = JSON.parse(AWS.util.readFileSync(path));\n var fileSystemCreds = new AWS.FileSystemCredentials(path);\n var chain = new AWS.CredentialProviderChain();\n chain.providers.unshift(fileSystemCreds);\n chain.resolve(function (err, creds) {\n if (err) throw err;\n else options.credentials = creds;\n });\n\n this.constructor(options);\n\n return this;\n },\n\n /**\n * Clears configuration data on this object\n *\n * @api private\n */\n clear: function clear() {\n /*jshint forin:false */\n AWS.util.each.call(this, this.keys, function (key) {\n delete this[key];\n });\n\n // reset credential provider\n this.set('credentials', undefined);\n this.set('credentialProvider', undefined);\n },\n\n /**\n * Sets a property on the configuration object, allowing for a\n * default value\n * @api private\n */\n set: function set(property, value, defaultValue) {\n if (value === undefined) {\n if (defaultValue === undefined) {\n defaultValue = this.keys[property];\n }\n if (typeof defaultValue === 'function') {\n this[property] = defaultValue.call(this);\n } else {\n this[property] = defaultValue;\n }\n } else if (property === 'httpOptions' && this[property]) {\n // deep merge httpOptions\n this[property] = AWS.util.merge(this[property], value);\n } else {\n this[property] = value;\n }\n },\n\n /**\n * All of the keys with their default values.\n *\n * @constant\n * @api private\n */\n keys: {\n credentials: null,\n credentialProvider: null,\n region: null,\n logger: null,\n apiVersions: {},\n apiVersion: null,\n endpoint: undefined,\n httpOptions: {\n timeout: 120000\n },\n maxRetries: undefined,\n maxRedirects: 10,\n paramValidation: true,\n sslEnabled: true,\n s3ForcePathStyle: false,\n s3BucketEndpoint: false,\n s3DisableBodySigning: true,\n s3UsEast1RegionalEndpoint: 'legacy',\n s3UseArnRegion: undefined,\n computeChecksums: true,\n convertResponseTypes: true,\n correctClockSkew: false,\n customUserAgent: null,\n dynamoDbCrc32: true,\n systemClockOffset: 0,\n signatureVersion: null,\n signatureCache: true,\n retryDelayOptions: {},\n useAccelerateEndpoint: false,\n clientSideMonitoring: false,\n endpointDiscoveryEnabled: undefined,\n endpointCacheSize: 1000,\n hostPrefixEnabled: true,\n stsRegionalEndpoints: 'legacy',\n useFipsEndpoint: false,\n useDualstackEndpoint: false\n },\n\n /**\n * Extracts accessKeyId, secretAccessKey and sessionToken\n * from a configuration hash.\n *\n * @api private\n */\n extractCredentials: function extractCredentials(options) {\n if (options.accessKeyId && options.secretAccessKey) {\n options = AWS.util.copy(options);\n options.credentials = new AWS.Credentials(options);\n }\n return options;\n },\n\n /**\n * Sets the promise dependency the SDK will use wherever Promises are returned.\n * Passing `null` will force the SDK to use native Promises if they are available.\n * If native Promises are not available, passing `null` will have no effect.\n * @param [Constructor] dep A reference to a Promise constructor\n */\n setPromisesDependency: function setPromisesDependency(dep) {\n PromisesDependency = dep;\n // if null was passed in, we should try to use native promises\n if (dep === null && typeof Promise === 'function') {\n PromisesDependency = Promise;\n }\n var constructors = [AWS.Request, AWS.Credentials, AWS.CredentialProviderChain];\n if (AWS.S3) {\n constructors.push(AWS.S3);\n if (AWS.S3.ManagedUpload) {\n constructors.push(AWS.S3.ManagedUpload);\n }\n }\n AWS.util.addPromises(constructors, PromisesDependency);\n },\n\n /**\n * Gets the promise dependency set by `AWS.config.setPromisesDependency`.\n */\n getPromisesDependency: function getPromisesDependency() {\n return PromisesDependency;\n }\n});\n\n/**\n * @return [AWS.Config] The global configuration object singleton instance\n * @readonly\n * @see AWS.Config\n */\nAWS.config = new AWS.Config();\n", "var AWS = require('./core');\nvar inherit = AWS.util.inherit;\n\n/**\n * The endpoint that a service will talk to, for example,\n * `'https://ec2.ap-southeast-1.amazonaws.com'`. If\n * you need to override an endpoint for a service, you can\n * set the endpoint on a service by passing the endpoint\n * object with the `endpoint` option key:\n *\n * ```javascript\n * var ep = new AWS.Endpoint('awsproxy.example.com');\n * var s3 = new AWS.S3({endpoint: ep});\n * s3.service.endpoint.hostname == 'awsproxy.example.com'\n * ```\n *\n * Note that if you do not specify a protocol, the protocol will\n * be selected based on your current {AWS.config} configuration.\n *\n * @!attribute protocol\n * @return [String] the protocol (http or https) of the endpoint\n * URL\n * @!attribute hostname\n * @return [String] the host portion of the endpoint, e.g.,\n * example.com\n * @!attribute host\n * @return [String] the host portion of the endpoint including\n * the port, e.g., example.com:80\n * @!attribute port\n * @return [Integer] the port of the endpoint\n * @!attribute href\n * @return [String] the full URL of the endpoint\n */\nAWS.Endpoint = inherit({\n\n /**\n * @overload Endpoint(endpoint)\n * Constructs a new endpoint given an endpoint URL. If the\n * URL omits a protocol (http or https), the default protocol\n * set in the global {AWS.config} will be used.\n * @param endpoint [String] the URL to construct an endpoint from\n */\n constructor: function Endpoint(endpoint, config) {\n AWS.util.hideProperties(this, ['slashes', 'auth', 'hash', 'search', 'query']);\n\n if (typeof endpoint === 'undefined' || endpoint === null) {\n throw new Error('Invalid endpoint: ' + endpoint);\n } else if (typeof endpoint !== 'string') {\n return AWS.util.copy(endpoint);\n }\n\n if (!endpoint.match(/^http/)) {\n var useSSL = config && config.sslEnabled !== undefined ?\n config.sslEnabled : AWS.config.sslEnabled;\n endpoint = (useSSL ? 'https' : 'http') + '://' + endpoint;\n }\n\n AWS.util.update(this, AWS.util.urlParse(endpoint));\n\n // Ensure the port property is set as an integer\n if (this.port) {\n this.port = parseInt(this.port, 10);\n } else {\n this.port = this.protocol === 'https:' ? 443 : 80;\n }\n }\n\n});\n\n/**\n * The low level HTTP request object, encapsulating all HTTP header\n * and body data sent by a service request.\n *\n * @!attribute method\n * @return [String] the HTTP method of the request\n * @!attribute path\n * @return [String] the path portion of the URI, e.g.,\n * \"/list/?start=5&num=10\"\n * @!attribute headers\n * @return [map]\n * a map of header keys and their respective values\n * @!attribute body\n * @return [String] the request body payload\n * @!attribute endpoint\n * @return [AWS.Endpoint] the endpoint for the request\n * @!attribute region\n * @api private\n * @return [String] the region, for signing purposes only.\n */\nAWS.HttpRequest = inherit({\n\n /**\n * @api private\n */\n constructor: function HttpRequest(endpoint, region) {\n endpoint = new AWS.Endpoint(endpoint);\n this.method = 'POST';\n this.path = endpoint.path || '/';\n this.headers = {};\n this.body = '';\n this.endpoint = endpoint;\n this.region = region;\n this._userAgent = '';\n this.setUserAgent();\n },\n\n /**\n * @api private\n */\n setUserAgent: function setUserAgent() {\n this._userAgent = this.headers[this.getUserAgentHeaderName()] = AWS.util.userAgent();\n },\n\n getUserAgentHeaderName: function getUserAgentHeaderName() {\n var prefix = AWS.util.isBrowser() ? 'X-Amz-' : '';\n return prefix + 'User-Agent';\n },\n\n /**\n * @api private\n */\n appendToUserAgent: function appendToUserAgent(agentPartial) {\n if (typeof agentPartial === 'string' && agentPartial) {\n this._userAgent += ' ' + agentPartial;\n }\n this.headers[this.getUserAgentHeaderName()] = this._userAgent;\n },\n\n /**\n * @api private\n */\n getUserAgent: function getUserAgent() {\n return this._userAgent;\n },\n\n /**\n * @return [String] the part of the {path} excluding the\n * query string\n */\n pathname: function pathname() {\n return this.path.split('?', 1)[0];\n },\n\n /**\n * @return [String] the query string portion of the {path}\n */\n search: function search() {\n var query = this.path.split('?', 2)[1];\n if (query) {\n query = AWS.util.queryStringParse(query);\n return AWS.util.queryParamsToString(query);\n }\n return '';\n },\n\n /**\n * @api private\n * update httpRequest endpoint with endpoint string\n */\n updateEndpoint: function updateEndpoint(endpointStr) {\n var newEndpoint = new AWS.Endpoint(endpointStr);\n this.endpoint = newEndpoint;\n this.path = newEndpoint.path || '/';\n if (this.headers['Host']) {\n this.headers['Host'] = newEndpoint.host;\n }\n }\n});\n\n/**\n * The low level HTTP response object, encapsulating all HTTP header\n * and body data returned from the request.\n *\n * @!attribute statusCode\n * @return [Integer] the HTTP status code of the response (e.g., 200, 404)\n * @!attribute headers\n * @return [map]\n * a map of response header keys and their respective values\n * @!attribute body\n * @return [String] the response body payload\n * @!attribute [r] streaming\n * @return [Boolean] whether this response is being streamed at a low-level.\n * Defaults to `false` (buffered reads). Do not modify this manually, use\n * {createUnbufferedStream} to convert the stream to unbuffered mode\n * instead.\n */\nAWS.HttpResponse = inherit({\n\n /**\n * @api private\n */\n constructor: function HttpResponse() {\n this.statusCode = undefined;\n this.headers = {};\n this.body = undefined;\n this.streaming = false;\n this.stream = null;\n },\n\n /**\n * Disables buffering on the HTTP response and returns the stream for reading.\n * @return [Stream, XMLHttpRequest, null] the underlying stream object.\n * Use this object to directly read data off of the stream.\n * @note This object is only available after the {AWS.Request~httpHeaders}\n * event has fired. This method must be called prior to\n * {AWS.Request~httpData}.\n * @example Taking control of a stream\n * request.on('httpHeaders', function(statusCode, headers) {\n * if (statusCode < 300) {\n * if (headers.etag === 'xyz') {\n * // pipe the stream, disabling buffering\n * var stream = this.response.httpResponse.createUnbufferedStream();\n * stream.pipe(process.stdout);\n * } else { // abort this request and set a better error message\n * this.abort();\n * this.response.error = new Error('Invalid ETag');\n * }\n * }\n * }).send(console.log);\n */\n createUnbufferedStream: function createUnbufferedStream() {\n this.streaming = true;\n return this.stream;\n }\n});\n\n\nAWS.HttpClient = inherit({});\n\n/**\n * @api private\n */\nAWS.HttpClient.getInstance = function getInstance() {\n if (this.singleton === undefined) {\n this.singleton = new this();\n }\n return this.singleton;\n};\n", "var AWS = require('./core');\nvar util = require('./util');\nvar endpointDiscoveryEnabledEnvs = ['AWS_ENABLE_ENDPOINT_DISCOVERY', 'AWS_ENDPOINT_DISCOVERY_ENABLED'];\n\n/**\n * Generate key (except resources and operation part) to index the endpoints in the cache\n * If input shape has endpointdiscoveryid trait then use\n * accessKey + operation + resources + region + service as cache key\n * If input shape doesn't have endpointdiscoveryid trait then use\n * accessKey + region + service as cache key\n * @return [map] object with keys to index endpoints.\n * @api private\n */\nfunction getCacheKey(request) {\n var service = request.service;\n var api = service.api || {};\n var operations = api.operations;\n var identifiers = {};\n if (service.config.region) {\n identifiers.region = service.config.region;\n }\n if (api.serviceId) {\n identifiers.serviceId = api.serviceId;\n }\n if (service.config.credentials.accessKeyId) {\n identifiers.accessKeyId = service.config.credentials.accessKeyId;\n }\n return identifiers;\n}\n\n/**\n * Recursive helper for marshallCustomIdentifiers().\n * Looks for required string input members that have 'endpointdiscoveryid' trait.\n * @api private\n */\nfunction marshallCustomIdentifiersHelper(result, params, shape) {\n if (!shape || params === undefined || params === null) return;\n if (shape.type === 'structure' && shape.required && shape.required.length > 0) {\n util.arrayEach(shape.required, function(name) {\n var memberShape = shape.members[name];\n if (memberShape.endpointDiscoveryId === true) {\n var locationName = memberShape.isLocationName ? memberShape.name : name;\n result[locationName] = String(params[name]);\n } else {\n marshallCustomIdentifiersHelper(result, params[name], memberShape);\n }\n });\n }\n}\n\n/**\n * Get custom identifiers for cache key.\n * Identifies custom identifiers by checking each shape's `endpointDiscoveryId` trait.\n * @param [object] request object\n * @param [object] input shape of the given operation's api\n * @api private\n */\nfunction marshallCustomIdentifiers(request, shape) {\n var identifiers = {};\n marshallCustomIdentifiersHelper(identifiers, request.params, shape);\n return identifiers;\n}\n\n/**\n * Call endpoint discovery operation when it's optional.\n * When endpoint is available in cache then use the cached endpoints. If endpoints\n * are unavailable then use regional endpoints and call endpoint discovery operation\n * asynchronously. This is turned off by default.\n * @param [object] request object\n * @api private\n */\nfunction optionalDiscoverEndpoint(request) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var endpoints = AWS.endpointCache.get(cacheKey);\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //or endpoint operation just failed in 1 minute\n return;\n } else if (endpoints && endpoints.length > 0) {\n //found endpoint record from cache\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n } else {\n //endpoint record not in cache or outdated. make discovery operation\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n addApiVersionHeader(endpointRequest);\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1\n }]);\n endpointRequest.send(function(err, data) {\n if (data && data.Endpoints) {\n AWS.endpointCache.put(cacheKey, data.Endpoints);\n } else if (err) {\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute\n }]);\n }\n });\n }\n}\n\nvar requestQueue = {};\n\n/**\n * Call endpoint discovery operation when it's required.\n * When endpoint is available in cache then use cached ones. If endpoints are\n * unavailable then SDK should call endpoint operation then use returned new\n * endpoint for the api call. SDK will automatically attempt to do endpoint\n * discovery. This is turned off by default\n * @param [object] request object\n * @api private\n */\nfunction requiredDiscoverEndpoint(request, done) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var cacheKeyStr = AWS.EndpointCache.getKeyString(cacheKey);\n var endpoints = AWS.endpointCache.get(cacheKeyStr); //endpoint cache also accepts string keys\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //push request object to a pending queue\n if (!requestQueue[cacheKeyStr]) requestQueue[cacheKeyStr] = [];\n requestQueue[cacheKeyStr].push({request: request, callback: done});\n return;\n } else if (endpoints && endpoints.length > 0) {\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n done();\n } else {\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n addApiVersionHeader(endpointRequest);\n\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKeyStr, [{\n Address: '',\n CachePeriodInMinutes: 60 //long-live cache\n }]);\n endpointRequest.send(function(err, data) {\n if (err) {\n request.response.error = util.error(err, { retryable: false });\n AWS.endpointCache.remove(cacheKey);\n\n //fail all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.response.error = util.error(err, { retryable: false });\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n } else if (data) {\n AWS.endpointCache.put(cacheKeyStr, data.Endpoints);\n request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n\n //update the endpoint for all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n }\n done();\n });\n }\n}\n\n/**\n * add api version header to endpoint operation\n * @api private\n */\nfunction addApiVersionHeader(endpointRequest) {\n var api = endpointRequest.service.api;\n var apiVersion = api.apiVersion;\n if (apiVersion && !endpointRequest.httpRequest.headers['x-amz-api-version']) {\n endpointRequest.httpRequest.headers['x-amz-api-version'] = apiVersion;\n }\n}\n\n/**\n * If api call gets invalid endpoint exception, SDK should attempt to remove the invalid\n * endpoint from cache.\n * @api private\n */\nfunction invalidateCachedEndpoints(response) {\n var error = response.error;\n var httpResponse = response.httpResponse;\n if (error &&\n (error.code === 'InvalidEndpointException' || httpResponse.statusCode === 421)\n ) {\n var request = response.request;\n var operations = request.service.api.operations || {};\n var inputShape = operations[request.operation] ? operations[request.operation].input : undefined;\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operations[request.operation]) cacheKey.operation = operations[request.operation].name;\n }\n AWS.endpointCache.remove(cacheKey);\n }\n}\n\n/**\n * If endpoint is explicitly configured, SDK should not do endpoint discovery in anytime.\n * @param [object] client Service client object.\n * @api private\n */\nfunction hasCustomEndpoint(client) {\n //if set endpoint is set for specific client, enable endpoint discovery will raise an error.\n if (client._originalConfig && client._originalConfig.endpoint && client._originalConfig.endpointDiscoveryEnabled === true) {\n throw util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.'\n });\n };\n var svcConfig = AWS.config[client.serviceIdentifier] || {};\n return Boolean(AWS.config.endpoint || svcConfig.endpoint || (client._originalConfig && client._originalConfig.endpoint));\n}\n\n/**\n * @api private\n */\nfunction isFalsy(value) {\n return ['false', '0'].indexOf(value) >= 0;\n}\n\n/**\n * If endpoint discovery should perform for this request when no operation requires endpoint\n * discovery for the given service.\n * SDK performs config resolution in order like below:\n * 1. If set in client configuration.\n * 2. If set in env AWS_ENABLE_ENDPOINT_DISCOVERY.\n * 3. If set in shared ini config file with key 'endpoint_discovery_enabled'.\n * @param [object] request request object.\n * @returns [boolean|undefined] if endpoint discovery config is not set in any source, this\n * function returns undefined\n * @api private\n */\nfunction resolveEndpointDiscoveryConfig(request) {\n var service = request.service || {};\n if (service.config.endpointDiscoveryEnabled !== undefined) {\n return service.config.endpointDiscoveryEnabled;\n }\n\n //shared ini file is only available in Node\n //not to check env in browser\n if (util.isBrowser()) return undefined;\n\n // If any of recognized endpoint discovery config env is set\n for (var i = 0; i < endpointDiscoveryEnabledEnvs.length; i++) {\n var env = endpointDiscoveryEnabledEnvs[i];\n if (Object.prototype.hasOwnProperty.call(process.env, env)) {\n if (process.env[env] === '' || process.env[env] === undefined) {\n throw util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'environmental variable ' + env + ' cannot be set to nothing'\n });\n }\n return !isFalsy(process.env[env]);\n }\n }\n\n var configFile = {};\n try {\n configFile = AWS.util.iniLoader ? AWS.util.iniLoader.loadFrom({\n isConfig: true,\n filename: process.env[AWS.util.sharedConfigFileEnv]\n }) : {};\n } catch (e) {}\n var sharedFileConfig = configFile[\n process.env.AWS_PROFILE || AWS.util.defaultProfile\n ] || {};\n if (Object.prototype.hasOwnProperty.call(sharedFileConfig, 'endpoint_discovery_enabled')) {\n if (sharedFileConfig.endpoint_discovery_enabled === undefined) {\n throw util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'config file entry \\'endpoint_discovery_enabled\\' cannot be set to nothing'\n });\n }\n return !isFalsy(sharedFileConfig.endpoint_discovery_enabled);\n }\n return undefined;\n}\n\n/**\n * attach endpoint discovery logic to request object\n * @param [object] request\n * @api private\n */\nfunction discoverEndpoint(request, done) {\n var service = request.service || {};\n if (hasCustomEndpoint(service) || request.isPresigned()) return done();\n\n var operations = service.api.operations || {};\n var operationModel = operations[request.operation];\n var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';\n var isEnabled = resolveEndpointDiscoveryConfig(request);\n var hasRequiredEndpointDiscovery = service.api.hasRequiredEndpointDiscovery;\n if (isEnabled || hasRequiredEndpointDiscovery) {\n // Once a customer enables endpoint discovery, the SDK should start appending\n // the string endpoint-discovery to the user-agent on all requests.\n request.httpRequest.appendToUserAgent('endpoint-discovery');\n }\n switch (isEndpointDiscoveryRequired) {\n case 'OPTIONAL':\n if (isEnabled || hasRequiredEndpointDiscovery) {\n // For a given service; if at least one operation requires endpoint discovery then the SDK must enable endpoint discovery\n // by default for all operations of that service, including operations where endpoint discovery is optional.\n optionalDiscoverEndpoint(request);\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n }\n done();\n break;\n case 'REQUIRED':\n if (isEnabled === false) {\n // For a given operation; if endpoint discovery is required and it has been disabled on the SDK client,\n // then the SDK must return a clear and actionable exception.\n request.response.error = util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'Endpoint Discovery is disabled but ' + service.api.className + '.' + request.operation +\n '() requires it. Please check your configurations.'\n });\n done();\n break;\n }\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n requiredDiscoverEndpoint(request, done);\n break;\n case 'NULL':\n default:\n done();\n break;\n }\n}\n\nmodule.exports = {\n discoverEndpoint: discoverEndpoint,\n requiredDiscoverEndpoint: requiredDiscoverEndpoint,\n optionalDiscoverEndpoint: optionalDiscoverEndpoint,\n marshallCustomIdentifiers: marshallCustomIdentifiers,\n getCacheKey: getCacheKey,\n invalidateCachedEndpoint: invalidateCachedEndpoints,\n};\n", "var AWS = require('./core');\nvar SequentialExecutor = require('./sequential_executor');\nvar DISCOVER_ENDPOINT = require('./discover_endpoint').discoverEndpoint;\n/**\n * The namespace used to register global event listeners for request building\n * and sending.\n */\nAWS.EventListeners = {\n /**\n * @!attribute VALIDATE_CREDENTIALS\n * A request listener that validates whether the request is being\n * sent with credentials.\n * Handles the {AWS.Request~validate 'validate' Request event}\n * @example Sending a request without validating credentials\n * var listener = AWS.EventListeners.Core.VALIDATE_CREDENTIALS;\n * request.removeListener('validate', listener);\n * @readonly\n * @return [Function]\n * @!attribute VALIDATE_REGION\n * A request listener that validates whether the region is set\n * for a request.\n * Handles the {AWS.Request~validate 'validate' Request event}\n * @example Sending a request without validating region configuration\n * var listener = AWS.EventListeners.Core.VALIDATE_REGION;\n * request.removeListener('validate', listener);\n * @readonly\n * @return [Function]\n * @!attribute VALIDATE_PARAMETERS\n * A request listener that validates input parameters in a request.\n * Handles the {AWS.Request~validate 'validate' Request event}\n * @example Sending a request without validating parameters\n * var listener = AWS.EventListeners.Core.VALIDATE_PARAMETERS;\n * request.removeListener('validate', listener);\n * @example Disable parameter validation globally\n * AWS.EventListeners.Core.removeListener('validate',\n * AWS.EventListeners.Core.VALIDATE_REGION);\n * @readonly\n * @return [Function]\n * @!attribute SEND\n * A request listener that initiates the HTTP connection for a\n * request being sent. Handles the {AWS.Request~send 'send' Request event}\n * @example Replacing the HTTP handler\n * var listener = AWS.EventListeners.Core.SEND;\n * request.removeListener('send', listener);\n * request.on('send', function(response) {\n * customHandler.send(response);\n * });\n * @return [Function]\n * @readonly\n * @!attribute HTTP_DATA\n * A request listener that reads data from the HTTP connection in order\n * to build the response data.\n * Handles the {AWS.Request~httpData 'httpData' Request event}.\n * Remove this handler if you are overriding the 'httpData' event and\n * do not want extra data processing and buffering overhead.\n * @example Disabling default data processing\n * var listener = AWS.EventListeners.Core.HTTP_DATA;\n * request.removeListener('httpData', listener);\n * @return [Function]\n * @readonly\n */\n Core: {} /* doc hack */\n};\n\n/**\n * @api private\n */\nfunction getOperationAuthtype(req) {\n if (!req.service.api.operations) {\n return '';\n }\n var operation = req.service.api.operations[req.operation];\n return operation ? operation.authtype : '';\n}\n\nAWS.EventListeners = {\n Core: new SequentialExecutor().addNamedListeners(function(add, addAsync) {\n addAsync('VALIDATE_CREDENTIALS', 'validate',\n function VALIDATE_CREDENTIALS(req, done) {\n if (!req.service.api.signatureVersion && !req.service.config.signatureVersion) return done(); // none\n req.service.config.getCredentials(function(err) {\n if (err) {\n req.response.error = AWS.util.error(err,\n {code: 'CredentialsError', message: 'Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1'});\n }\n done();\n });\n });\n\n add('VALIDATE_REGION', 'validate', function VALIDATE_REGION(req) {\n if (!req.service.isGlobalEndpoint) {\n var dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);\n if (!req.service.config.region) {\n req.response.error = AWS.util.error(new Error(),\n {code: 'ConfigError', message: 'Missing region in config'});\n } else if (!dnsHostRegex.test(req.service.config.region)) {\n req.response.error = AWS.util.error(new Error(),\n {code: 'ConfigError', message: 'Invalid region in config'});\n }\n }\n });\n\n add('BUILD_IDEMPOTENCY_TOKENS', 'validate', function BUILD_IDEMPOTENCY_TOKENS(req) {\n if (!req.service.api.operations) {\n return;\n }\n var operation = req.service.api.operations[req.operation];\n if (!operation) {\n return;\n }\n var idempotentMembers = operation.idempotentMembers;\n if (!idempotentMembers.length) {\n return;\n }\n // creates a copy of params so user's param object isn't mutated\n var params = AWS.util.copy(req.params);\n for (var i = 0, iLen = idempotentMembers.length; i < iLen; i++) {\n if (!params[idempotentMembers[i]]) {\n // add the member\n params[idempotentMembers[i]] = AWS.util.uuid.v4();\n }\n }\n req.params = params;\n });\n\n add('VALIDATE_PARAMETERS', 'validate', function VALIDATE_PARAMETERS(req) {\n if (!req.service.api.operations) {\n return;\n }\n var rules = req.service.api.operations[req.operation].input;\n var validation = req.service.config.paramValidation;\n new AWS.ParamValidator(validation).validate(rules, req.params);\n });\n\n add('COMPUTE_CHECKSUM', 'afterBuild', function COMPUTE_CHECKSUM(req) {\n if (!req.service.api.operations) {\n return;\n }\n var operation = req.service.api.operations[req.operation];\n if (!operation) {\n return;\n }\n var body = req.httpRequest.body;\n var isNonStreamingPayload = body && (AWS.util.Buffer.isBuffer(body) || typeof body === 'string');\n var headers = req.httpRequest.headers;\n if (\n operation.httpChecksumRequired &&\n req.service.config.computeChecksums &&\n isNonStreamingPayload &&\n !headers['Content-MD5']\n ) {\n var md5 = AWS.util.crypto.md5(body, 'base64');\n headers['Content-MD5'] = md5;\n }\n });\n\n addAsync('COMPUTE_SHA256', 'afterBuild', function COMPUTE_SHA256(req, done) {\n req.haltHandlersOnError();\n if (!req.service.api.operations) {\n return;\n }\n var operation = req.service.api.operations[req.operation];\n var authtype = operation ? operation.authtype : '';\n if (!req.service.api.signatureVersion && !authtype && !req.service.config.signatureVersion) return done(); // none\n if (req.service.getSignerClass(req) === AWS.Signers.V4) {\n var body = req.httpRequest.body || '';\n if (authtype.indexOf('unsigned-body') >= 0) {\n req.httpRequest.headers['X-Amz-Content-Sha256'] = 'UNSIGNED-PAYLOAD';\n return done();\n }\n AWS.util.computeSha256(body, function(err, sha) {\n if (err) {\n done(err);\n }\n else {\n req.httpRequest.headers['X-Amz-Content-Sha256'] = sha;\n done();\n }\n });\n } else {\n done();\n }\n });\n\n add('SET_CONTENT_LENGTH', 'afterBuild', function SET_CONTENT_LENGTH(req) {\n var authtype = getOperationAuthtype(req);\n var payloadMember = AWS.util.getRequestPayloadShape(req);\n if (req.httpRequest.headers['Content-Length'] === undefined) {\n try {\n var length = AWS.util.string.byteLength(req.httpRequest.body);\n req.httpRequest.headers['Content-Length'] = length;\n } catch (err) {\n if (payloadMember && payloadMember.isStreaming) {\n if (payloadMember.requiresLength) {\n //streaming payload requires length(s3, glacier)\n throw err;\n } else if (authtype.indexOf('unsigned-body') >= 0) {\n //unbounded streaming payload(lex, mediastore)\n req.httpRequest.headers['Transfer-Encoding'] = 'chunked';\n return;\n } else {\n throw err;\n }\n }\n throw err;\n }\n }\n });\n\n add('SET_HTTP_HOST', 'afterBuild', function SET_HTTP_HOST(req) {\n req.httpRequest.headers['Host'] = req.httpRequest.endpoint.host;\n });\n\n add('SET_TRACE_ID', 'afterBuild', function SET_TRACE_ID(req) {\n var traceIdHeaderName = 'X-Amzn-Trace-Id';\n if (AWS.util.isNode() && !Object.hasOwnProperty.call(req.httpRequest.headers, traceIdHeaderName)) {\n var ENV_LAMBDA_FUNCTION_NAME = 'AWS_LAMBDA_FUNCTION_NAME';\n var ENV_TRACE_ID = '_X_AMZN_TRACE_ID';\n var functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];\n var traceId = process.env[ENV_TRACE_ID];\n if (\n typeof functionName === 'string' &&\n functionName.length > 0 &&\n typeof traceId === 'string' &&\n traceId.length > 0\n ) {\n req.httpRequest.headers[traceIdHeaderName] = traceId;\n }\n }\n });\n\n add('RESTART', 'restart', function RESTART() {\n var err = this.response.error;\n if (!err || !err.retryable) return;\n\n this.httpRequest = new AWS.HttpRequest(\n this.service.endpoint,\n this.service.region\n );\n\n if (this.response.retryCount < this.service.config.maxRetries) {\n this.response.retryCount++;\n } else {\n this.response.error = null;\n }\n });\n\n var addToHead = true;\n addAsync('DISCOVER_ENDPOINT', 'sign', DISCOVER_ENDPOINT, addToHead);\n\n addAsync('SIGN', 'sign', function SIGN(req, done) {\n var service = req.service;\n var operations = req.service.api.operations || {};\n var operation = operations[req.operation];\n var authtype = operation ? operation.authtype : '';\n if (!service.api.signatureVersion && !authtype && !service.config.signatureVersion) return done(); // none\n\n service.config.getCredentials(function (err, credentials) {\n if (err) {\n req.response.error = err;\n return done();\n }\n\n try {\n var date = service.getSkewCorrectedDate();\n var SignerClass = service.getSignerClass(req);\n var signer = new SignerClass(req.httpRequest,\n service.getSigningName(req),\n {\n signatureCache: service.config.signatureCache,\n operation: operation,\n signatureVersion: service.api.signatureVersion\n });\n signer.setServiceClientId(service._clientId);\n\n // clear old authorization headers\n delete req.httpRequest.headers['Authorization'];\n delete req.httpRequest.headers['Date'];\n delete req.httpRequest.headers['X-Amz-Date'];\n\n // add new authorization\n signer.addAuthorization(credentials, date);\n req.signedAt = date;\n } catch (e) {\n req.response.error = e;\n }\n done();\n });\n });\n\n add('VALIDATE_RESPONSE', 'validateResponse', function VALIDATE_RESPONSE(resp) {\n if (this.service.successfulResponse(resp, this)) {\n resp.data = {};\n resp.error = null;\n } else {\n resp.data = null;\n resp.error = AWS.util.error(new Error(),\n {code: 'UnknownError', message: 'An unknown error occurred.'});\n }\n });\n\n add('ERROR', 'error', function ERROR(err, resp) {\n var errorCodeMapping = resp.request.service.api.errorCodeMapping;\n if (errorCodeMapping && err && err.code) {\n var mapping = errorCodeMapping[err.code];\n if (mapping) {\n resp.error.code = mapping.code;\n }\n }\n }, true);\n\n addAsync('SEND', 'send', function SEND(resp, done) {\n resp.httpResponse._abortCallback = done;\n resp.error = null;\n resp.data = null;\n\n function callback(httpResp) {\n resp.httpResponse.stream = httpResp;\n var stream = resp.request.httpRequest.stream;\n var service = resp.request.service;\n var api = service.api;\n var operationName = resp.request.operation;\n var operation = api.operations[operationName] || {};\n\n httpResp.on('headers', function onHeaders(statusCode, headers, statusMessage) {\n resp.request.emit(\n 'httpHeaders',\n [statusCode, headers, resp, statusMessage]\n );\n\n if (!resp.httpResponse.streaming) {\n if (AWS.HttpClient.streamsApiVersion === 2) { // streams2 API check\n // if we detect event streams, we're going to have to\n // return the stream immediately\n if (operation.hasEventOutput && service.successfulResponse(resp)) {\n // skip reading the IncomingStream\n resp.request.emit('httpDone');\n done();\n return;\n }\n\n httpResp.on('readable', function onReadable() {\n var data = httpResp.read();\n if (data !== null) {\n resp.request.emit('httpData', [data, resp]);\n }\n });\n } else { // legacy streams API\n httpResp.on('data', function onData(data) {\n resp.request.emit('httpData', [data, resp]);\n });\n }\n }\n });\n\n httpResp.on('end', function onEnd() {\n if (!stream || !stream.didCallback) {\n if (AWS.HttpClient.streamsApiVersion === 2 && (operation.hasEventOutput && service.successfulResponse(resp))) {\n // don't concatenate response chunks when streaming event stream data when response is successful\n return;\n }\n resp.request.emit('httpDone');\n done();\n }\n });\n }\n\n function progress(httpResp) {\n httpResp.on('sendProgress', function onSendProgress(value) {\n resp.request.emit('httpUploadProgress', [value, resp]);\n });\n\n httpResp.on('receiveProgress', function onReceiveProgress(value) {\n resp.request.emit('httpDownloadProgress', [value, resp]);\n });\n }\n\n function error(err) {\n if (err.code !== 'RequestAbortedError') {\n var errCode = err.code === 'TimeoutError' ? err.code : 'NetworkingError';\n err = AWS.util.error(err, {\n code: errCode,\n region: resp.request.httpRequest.region,\n hostname: resp.request.httpRequest.endpoint.hostname,\n retryable: true\n });\n }\n resp.error = err;\n resp.request.emit('httpError', [resp.error, resp], function() {\n done();\n });\n }\n\n function executeSend() {\n var http = AWS.HttpClient.getInstance();\n var httpOptions = resp.request.service.config.httpOptions || {};\n try {\n var stream = http.handleRequest(resp.request.httpRequest, httpOptions,\n callback, error);\n progress(stream);\n } catch (err) {\n error(err);\n }\n }\n var timeDiff = (resp.request.service.getSkewCorrectedDate() - this.signedAt) / 1000;\n if (timeDiff >= 60 * 10) { // if we signed 10min ago, re-sign\n this.emit('sign', [this], function(err) {\n if (err) done(err);\n else executeSend();\n });\n } else {\n executeSend();\n }\n });\n\n add('HTTP_HEADERS', 'httpHeaders',\n function HTTP_HEADERS(statusCode, headers, resp, statusMessage) {\n resp.httpResponse.statusCode = statusCode;\n resp.httpResponse.statusMessage = statusMessage;\n resp.httpResponse.headers = headers;\n resp.httpResponse.body = AWS.util.buffer.toBuffer('');\n resp.httpResponse.buffers = [];\n resp.httpResponse.numBytes = 0;\n var dateHeader = headers.date || headers.Date;\n var service = resp.request.service;\n if (dateHeader) {\n var serverTime = Date.parse(dateHeader);\n if (service.config.correctClockSkew\n && service.isClockSkewed(serverTime)) {\n service.applyClockOffset(serverTime);\n }\n }\n });\n\n add('HTTP_DATA', 'httpData', function HTTP_DATA(chunk, resp) {\n if (chunk) {\n if (AWS.util.isNode()) {\n resp.httpResponse.numBytes += chunk.length;\n\n var total = resp.httpResponse.headers['content-length'];\n var progress = { loaded: resp.httpResponse.numBytes, total: total };\n resp.request.emit('httpDownloadProgress', [progress, resp]);\n }\n\n resp.httpResponse.buffers.push(AWS.util.buffer.toBuffer(chunk));\n }\n });\n\n add('HTTP_DONE', 'httpDone', function HTTP_DONE(resp) {\n // convert buffers array into single buffer\n if (resp.httpResponse.buffers && resp.httpResponse.buffers.length > 0) {\n var body = AWS.util.buffer.concat(resp.httpResponse.buffers);\n resp.httpResponse.body = body;\n }\n delete resp.httpResponse.numBytes;\n delete resp.httpResponse.buffers;\n });\n\n add('FINALIZE_ERROR', 'retry', function FINALIZE_ERROR(resp) {\n if (resp.httpResponse.statusCode) {\n resp.error.statusCode = resp.httpResponse.statusCode;\n if (resp.error.retryable === undefined) {\n resp.error.retryable = this.service.retryableError(resp.error, this);\n }\n }\n });\n\n add('INVALIDATE_CREDENTIALS', 'retry', function INVALIDATE_CREDENTIALS(resp) {\n if (!resp.error) return;\n switch (resp.error.code) {\n case 'RequestExpired': // EC2 only\n case 'ExpiredTokenException':\n case 'ExpiredToken':\n resp.error.retryable = true;\n resp.request.service.config.credentials.expired = true;\n }\n });\n\n add('EXPIRED_SIGNATURE', 'retry', function EXPIRED_SIGNATURE(resp) {\n var err = resp.error;\n if (!err) return;\n if (typeof err.code === 'string' && typeof err.message === 'string') {\n if (err.code.match(/Signature/) && err.message.match(/expired/)) {\n resp.error.retryable = true;\n }\n }\n });\n\n add('CLOCK_SKEWED', 'retry', function CLOCK_SKEWED(resp) {\n if (!resp.error) return;\n if (this.service.clockSkewError(resp.error)\n && this.service.config.correctClockSkew) {\n resp.error.retryable = true;\n }\n });\n\n add('REDIRECT', 'retry', function REDIRECT(resp) {\n if (resp.error && resp.error.statusCode >= 300 &&\n resp.error.statusCode < 400 && resp.httpResponse.headers['location']) {\n this.httpRequest.endpoint =\n new AWS.Endpoint(resp.httpResponse.headers['location']);\n this.httpRequest.headers['Host'] = this.httpRequest.endpoint.host;\n resp.error.redirect = true;\n resp.error.retryable = true;\n }\n });\n\n add('RETRY_CHECK', 'retry', function RETRY_CHECK(resp) {\n if (resp.error) {\n if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {\n resp.error.retryDelay = 0;\n } else if (resp.retryCount < resp.maxRetries) {\n resp.error.retryDelay = this.service.retryDelays(resp.retryCount, resp.error) || 0;\n }\n }\n });\n\n addAsync('RESET_RETRY_STATE', 'afterRetry', function RESET_RETRY_STATE(resp, done) {\n var delay, willRetry = false;\n\n if (resp.error) {\n delay = resp.error.retryDelay || 0;\n if (resp.error.retryable && resp.retryCount < resp.maxRetries) {\n resp.retryCount++;\n willRetry = true;\n } else if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {\n resp.redirectCount++;\n willRetry = true;\n }\n }\n\n // delay < 0 is a signal from customBackoff to skip retries\n if (willRetry && delay >= 0) {\n resp.error = null;\n setTimeout(done, delay);\n } else {\n done();\n }\n });\n }),\n\n CorePost: new SequentialExecutor().addNamedListeners(function(add) {\n add('EXTRACT_REQUEST_ID', 'extractData', AWS.util.extractRequestId);\n add('EXTRACT_REQUEST_ID', 'extractError', AWS.util.extractRequestId);\n\n add('ENOTFOUND_ERROR', 'httpError', function ENOTFOUND_ERROR(err) {\n function isDNSError(err) {\n return err.errno === 'ENOTFOUND' ||\n typeof err.errno === 'number' &&\n typeof AWS.util.getSystemErrorName === 'function' &&\n ['EAI_NONAME', 'EAI_NODATA'].indexOf(AWS.util.getSystemErrorName(err.errno) >= 0);\n }\n if (err.code === 'NetworkingError' && isDNSError(err)) {\n var message = 'Inaccessible host: `' + err.hostname + '\\' at port `' + err.port +\n '\\'. This service may not be available in the `' + err.region +\n '\\' region.';\n this.response.error = AWS.util.error(new Error(message), {\n code: 'UnknownEndpoint',\n region: err.region,\n hostname: err.hostname,\n retryable: true,\n originalError: err\n });\n }\n });\n }),\n\n Logger: new SequentialExecutor().addNamedListeners(function(add) {\n add('LOG_REQUEST', 'complete', function LOG_REQUEST(resp) {\n var req = resp.request;\n var logger = req.service.config.logger;\n if (!logger) return;\n function filterSensitiveLog(inputShape, shape) {\n if (!shape) {\n return shape;\n }\n if (inputShape.isSensitive) {\n return '***SensitiveInformation***';\n }\n switch (inputShape.type) {\n case 'structure':\n var struct = {};\n AWS.util.each(shape, function(subShapeName, subShape) {\n if (Object.prototype.hasOwnProperty.call(inputShape.members, subShapeName)) {\n struct[subShapeName] = filterSensitiveLog(inputShape.members[subShapeName], subShape);\n } else {\n struct[subShapeName] = subShape;\n }\n });\n return struct;\n case 'list':\n var list = [];\n AWS.util.arrayEach(shape, function(subShape, index) {\n list.push(filterSensitiveLog(inputShape.member, subShape));\n });\n return list;\n case 'map':\n var map = {};\n AWS.util.each(shape, function(key, value) {\n map[key] = filterSensitiveLog(inputShape.value, value);\n });\n return map;\n default:\n return shape;\n }\n }\n\n function buildMessage() {\n var time = resp.request.service.getSkewCorrectedDate().getTime();\n var delta = (time - req.startTime.getTime()) / 1000;\n var ansi = logger.isTTY ? true : false;\n var status = resp.httpResponse.statusCode;\n var censoredParams = req.params;\n if (\n req.service.api.operations &&\n req.service.api.operations[req.operation] &&\n req.service.api.operations[req.operation].input\n ) {\n var inputShape = req.service.api.operations[req.operation].input;\n censoredParams = filterSensitiveLog(inputShape, req.params);\n }\n var params = require('util').inspect(censoredParams, true, null);\n var message = '';\n if (ansi) message += '\\x1B[33m';\n message += '[AWS ' + req.service.serviceIdentifier + ' ' + status;\n message += ' ' + delta.toString() + 's ' + resp.retryCount + ' retries]';\n if (ansi) message += '\\x1B[0;1m';\n message += ' ' + AWS.util.string.lowerFirst(req.operation);\n message += '(' + params + ')';\n if (ansi) message += '\\x1B[0m';\n return message;\n }\n\n var line = buildMessage();\n if (typeof logger.log === 'function') {\n logger.log(line);\n } else if (typeof logger.write === 'function') {\n logger.write(line + '\\n');\n }\n });\n }),\n\n Json: new SequentialExecutor().addNamedListeners(function(add) {\n var svc = require('./protocol/json');\n add('BUILD', 'build', svc.buildRequest);\n add('EXTRACT_DATA', 'extractData', svc.extractData);\n add('EXTRACT_ERROR', 'extractError', svc.extractError);\n }),\n\n Rest: new SequentialExecutor().addNamedListeners(function(add) {\n var svc = require('./protocol/rest');\n add('BUILD', 'build', svc.buildRequest);\n add('EXTRACT_DATA', 'extractData', svc.extractData);\n add('EXTRACT_ERROR', 'extractError', svc.extractError);\n }),\n\n RestJson: new SequentialExecutor().addNamedListeners(function(add) {\n var svc = require('./protocol/rest_json');\n add('BUILD', 'build', svc.buildRequest);\n add('EXTRACT_DATA', 'extractData', svc.extractData);\n add('EXTRACT_ERROR', 'extractError', svc.extractError);\n }),\n\n RestXml: new SequentialExecutor().addNamedListeners(function(add) {\n var svc = require('./protocol/rest_xml');\n add('BUILD', 'build', svc.buildRequest);\n add('EXTRACT_DATA', 'extractData', svc.extractData);\n add('EXTRACT_ERROR', 'extractError', svc.extractError);\n }),\n\n Query: new SequentialExecutor().addNamedListeners(function(add) {\n var svc = require('./protocol/query');\n add('BUILD', 'build', svc.buildRequest);\n add('EXTRACT_DATA', 'extractData', svc.extractData);\n add('EXTRACT_ERROR', 'extractError', svc.extractError);\n })\n};\n", "function AcceptorStateMachine(states, state) {\n this.currentState = state || null;\n this.states = states || {};\n}\n\nAcceptorStateMachine.prototype.runTo = function runTo(finalState, done, bindObject, inputError) {\n if (typeof finalState === 'function') {\n inputError = bindObject; bindObject = done;\n done = finalState; finalState = null;\n }\n\n var self = this;\n var state = self.states[self.currentState];\n state.fn.call(bindObject || self, inputError, function(err) {\n if (err) {\n if (state.fail) self.currentState = state.fail;\n else return done ? done.call(bindObject, err) : null;\n } else {\n if (state.accept) self.currentState = state.accept;\n else return done ? done.call(bindObject) : null;\n }\n if (self.currentState === finalState) {\n return done ? done.call(bindObject, err) : null;\n }\n\n self.runTo(finalState, done, bindObject, err);\n });\n};\n\nAcceptorStateMachine.prototype.addState = function addState(name, acceptState, failState, fn) {\n if (typeof acceptState === 'function') {\n fn = acceptState; acceptState = null; failState = null;\n } else if (typeof failState === 'function') {\n fn = failState; failState = null;\n }\n\n if (!this.currentState) this.currentState = name;\n this.states[name] = { accept: acceptState, fail: failState, fn: fn };\n return this;\n};\n\n/**\n * @api private\n */\nmodule.exports = AcceptorStateMachine;\n", "(function(exports) {\n \"use strict\";\n\n function isArray(obj) {\n if (obj !== null) {\n return Object.prototype.toString.call(obj) === \"[object Array]\";\n } else {\n return false;\n }\n }\n\n function isObject(obj) {\n if (obj !== null) {\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n } else {\n return false;\n }\n }\n\n function strictDeepEqual(first, second) {\n // Check the scalar case first.\n if (first === second) {\n return true;\n }\n\n // Check if they are the same type.\n var firstType = Object.prototype.toString.call(first);\n if (firstType !== Object.prototype.toString.call(second)) {\n return false;\n }\n // We know that first and second have the same type so we can just check the\n // first type from now on.\n if (isArray(first) === true) {\n // Short circuit if they're not the same length;\n if (first.length !== second.length) {\n return false;\n }\n for (var i = 0; i < first.length; i++) {\n if (strictDeepEqual(first[i], second[i]) === false) {\n return false;\n }\n }\n return true;\n }\n if (isObject(first) === true) {\n // An object is equal if it has the same key/value pairs.\n var keysSeen = {};\n for (var key in first) {\n if (hasOwnProperty.call(first, key)) {\n if (strictDeepEqual(first[key], second[key]) === false) {\n return false;\n }\n keysSeen[key] = true;\n }\n }\n // Now check that there aren't any keys in second that weren't\n // in first.\n for (var key2 in second) {\n if (hasOwnProperty.call(second, key2)) {\n if (keysSeen[key2] !== true) {\n return false;\n }\n }\n }\n return true;\n }\n return false;\n }\n\n function isFalse(obj) {\n // From the spec:\n // A false value corresponds to the following values:\n // Empty list\n // Empty object\n // Empty string\n // False boolean\n // null value\n\n // First check the scalar values.\n if (obj === \"\" || obj === false || obj === null) {\n return true;\n } else if (isArray(obj) && obj.length === 0) {\n // Check for an empty array.\n return true;\n } else if (isObject(obj)) {\n // Check for an empty object.\n for (var key in obj) {\n // If there are any keys, then\n // the object is not empty so the object\n // is not false.\n if (obj.hasOwnProperty(key)) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n }\n\n function objValues(obj) {\n var keys = Object.keys(obj);\n var values = [];\n for (var i = 0; i < keys.length; i++) {\n values.push(obj[keys[i]]);\n }\n return values;\n }\n\n function merge(a, b) {\n var merged = {};\n for (var key in a) {\n merged[key] = a[key];\n }\n for (var key2 in b) {\n merged[key2] = b[key2];\n }\n return merged;\n }\n\n var trimLeft;\n if (typeof String.prototype.trimLeft === \"function\") {\n trimLeft = function(str) {\n return str.trimLeft();\n };\n } else {\n trimLeft = function(str) {\n return str.match(/^\\s*(.*)/)[1];\n };\n }\n\n // Type constants used to define functions.\n var TYPE_NUMBER = 0;\n var TYPE_ANY = 1;\n var TYPE_STRING = 2;\n var TYPE_ARRAY = 3;\n var TYPE_OBJECT = 4;\n var TYPE_BOOLEAN = 5;\n var TYPE_EXPREF = 6;\n var TYPE_NULL = 7;\n var TYPE_ARRAY_NUMBER = 8;\n var TYPE_ARRAY_STRING = 9;\n var TYPE_NAME_TABLE = {\n 0: 'number',\n 1: 'any',\n 2: 'string',\n 3: 'array',\n 4: 'object',\n 5: 'boolean',\n 6: 'expression',\n 7: 'null',\n 8: 'Array',\n 9: 'Array'\n };\n\n var TOK_EOF = \"EOF\";\n var TOK_UNQUOTEDIDENTIFIER = \"UnquotedIdentifier\";\n var TOK_QUOTEDIDENTIFIER = \"QuotedIdentifier\";\n var TOK_RBRACKET = \"Rbracket\";\n var TOK_RPAREN = \"Rparen\";\n var TOK_COMMA = \"Comma\";\n var TOK_COLON = \"Colon\";\n var TOK_RBRACE = \"Rbrace\";\n var TOK_NUMBER = \"Number\";\n var TOK_CURRENT = \"Current\";\n var TOK_EXPREF = \"Expref\";\n var TOK_PIPE = \"Pipe\";\n var TOK_OR = \"Or\";\n var TOK_AND = \"And\";\n var TOK_EQ = \"EQ\";\n var TOK_GT = \"GT\";\n var TOK_LT = \"LT\";\n var TOK_GTE = \"GTE\";\n var TOK_LTE = \"LTE\";\n var TOK_NE = \"NE\";\n var TOK_FLATTEN = \"Flatten\";\n var TOK_STAR = \"Star\";\n var TOK_FILTER = \"Filter\";\n var TOK_DOT = \"Dot\";\n var TOK_NOT = \"Not\";\n var TOK_LBRACE = \"Lbrace\";\n var TOK_LBRACKET = \"Lbracket\";\n var TOK_LPAREN= \"Lparen\";\n var TOK_LITERAL= \"Literal\";\n\n // The \"&\", \"[\", \"<\", \">\" tokens\n // are not in basicToken because\n // there are two token variants\n // (\"&&\", \"[?\", \"<=\", \">=\"). This is specially handled\n // below.\n\n var basicTokens = {\n \".\": TOK_DOT,\n \"*\": TOK_STAR,\n \",\": TOK_COMMA,\n \":\": TOK_COLON,\n \"{\": TOK_LBRACE,\n \"}\": TOK_RBRACE,\n \"]\": TOK_RBRACKET,\n \"(\": TOK_LPAREN,\n \")\": TOK_RPAREN,\n \"@\": TOK_CURRENT\n };\n\n var operatorStartToken = {\n \"<\": true,\n \">\": true,\n \"=\": true,\n \"!\": true\n };\n\n var skipChars = {\n \" \": true,\n \"\\t\": true,\n \"\\n\": true\n };\n\n\n function isAlpha(ch) {\n return (ch >= \"a\" && ch <= \"z\") ||\n (ch >= \"A\" && ch <= \"Z\") ||\n ch === \"_\";\n }\n\n function isNum(ch) {\n return (ch >= \"0\" && ch <= \"9\") ||\n ch === \"-\";\n }\n function isAlphaNum(ch) {\n return (ch >= \"a\" && ch <= \"z\") ||\n (ch >= \"A\" && ch <= \"Z\") ||\n (ch >= \"0\" && ch <= \"9\") ||\n ch === \"_\";\n }\n\n function Lexer() {\n }\n Lexer.prototype = {\n tokenize: function(stream) {\n var tokens = [];\n this._current = 0;\n var start;\n var identifier;\n var token;\n while (this._current < stream.length) {\n if (isAlpha(stream[this._current])) {\n start = this._current;\n identifier = this._consumeUnquotedIdentifier(stream);\n tokens.push({type: TOK_UNQUOTEDIDENTIFIER,\n value: identifier,\n start: start});\n } else if (basicTokens[stream[this._current]] !== undefined) {\n tokens.push({type: basicTokens[stream[this._current]],\n value: stream[this._current],\n start: this._current});\n this._current++;\n } else if (isNum(stream[this._current])) {\n token = this._consumeNumber(stream);\n tokens.push(token);\n } else if (stream[this._current] === \"[\") {\n // No need to increment this._current. This happens\n // in _consumeLBracket\n token = this._consumeLBracket(stream);\n tokens.push(token);\n } else if (stream[this._current] === \"\\\"\") {\n start = this._current;\n identifier = this._consumeQuotedIdentifier(stream);\n tokens.push({type: TOK_QUOTEDIDENTIFIER,\n value: identifier,\n start: start});\n } else if (stream[this._current] === \"'\") {\n start = this._current;\n identifier = this._consumeRawStringLiteral(stream);\n tokens.push({type: TOK_LITERAL,\n value: identifier,\n start: start});\n } else if (stream[this._current] === \"`\") {\n start = this._current;\n var literal = this._consumeLiteral(stream);\n tokens.push({type: TOK_LITERAL,\n value: literal,\n start: start});\n } else if (operatorStartToken[stream[this._current]] !== undefined) {\n tokens.push(this._consumeOperator(stream));\n } else if (skipChars[stream[this._current]] !== undefined) {\n // Ignore whitespace.\n this._current++;\n } else if (stream[this._current] === \"&\") {\n start = this._current;\n this._current++;\n if (stream[this._current] === \"&\") {\n this._current++;\n tokens.push({type: TOK_AND, value: \"&&\", start: start});\n } else {\n tokens.push({type: TOK_EXPREF, value: \"&\", start: start});\n }\n } else if (stream[this._current] === \"|\") {\n start = this._current;\n this._current++;\n if (stream[this._current] === \"|\") {\n this._current++;\n tokens.push({type: TOK_OR, value: \"||\", start: start});\n } else {\n tokens.push({type: TOK_PIPE, value: \"|\", start: start});\n }\n } else {\n var error = new Error(\"Unknown character:\" + stream[this._current]);\n error.name = \"LexerError\";\n throw error;\n }\n }\n return tokens;\n },\n\n _consumeUnquotedIdentifier: function(stream) {\n var start = this._current;\n this._current++;\n while (this._current < stream.length && isAlphaNum(stream[this._current])) {\n this._current++;\n }\n return stream.slice(start, this._current);\n },\n\n _consumeQuotedIdentifier: function(stream) {\n var start = this._current;\n this._current++;\n var maxLength = stream.length;\n while (stream[this._current] !== \"\\\"\" && this._current < maxLength) {\n // You can escape a double quote and you can escape an escape.\n var current = this._current;\n if (stream[current] === \"\\\\\" && (stream[current + 1] === \"\\\\\" ||\n stream[current + 1] === \"\\\"\")) {\n current += 2;\n } else {\n current++;\n }\n this._current = current;\n }\n this._current++;\n return JSON.parse(stream.slice(start, this._current));\n },\n\n _consumeRawStringLiteral: function(stream) {\n var start = this._current;\n this._current++;\n var maxLength = stream.length;\n while (stream[this._current] !== \"'\" && this._current < maxLength) {\n // You can escape a single quote and you can escape an escape.\n var current = this._current;\n if (stream[current] === \"\\\\\" && (stream[current + 1] === \"\\\\\" ||\n stream[current + 1] === \"'\")) {\n current += 2;\n } else {\n current++;\n }\n this._current = current;\n }\n this._current++;\n var literal = stream.slice(start + 1, this._current - 1);\n return literal.replace(\"\\\\'\", \"'\");\n },\n\n _consumeNumber: function(stream) {\n var start = this._current;\n this._current++;\n var maxLength = stream.length;\n while (isNum(stream[this._current]) && this._current < maxLength) {\n this._current++;\n }\n var value = parseInt(stream.slice(start, this._current));\n return {type: TOK_NUMBER, value: value, start: start};\n },\n\n _consumeLBracket: function(stream) {\n var start = this._current;\n this._current++;\n if (stream[this._current] === \"?\") {\n this._current++;\n return {type: TOK_FILTER, value: \"[?\", start: start};\n } else if (stream[this._current] === \"]\") {\n this._current++;\n return {type: TOK_FLATTEN, value: \"[]\", start: start};\n } else {\n return {type: TOK_LBRACKET, value: \"[\", start: start};\n }\n },\n\n _consumeOperator: function(stream) {\n var start = this._current;\n var startingChar = stream[start];\n this._current++;\n if (startingChar === \"!\") {\n if (stream[this._current] === \"=\") {\n this._current++;\n return {type: TOK_NE, value: \"!=\", start: start};\n } else {\n return {type: TOK_NOT, value: \"!\", start: start};\n }\n } else if (startingChar === \"<\") {\n if (stream[this._current] === \"=\") {\n this._current++;\n return {type: TOK_LTE, value: \"<=\", start: start};\n } else {\n return {type: TOK_LT, value: \"<\", start: start};\n }\n } else if (startingChar === \">\") {\n if (stream[this._current] === \"=\") {\n this._current++;\n return {type: TOK_GTE, value: \">=\", start: start};\n } else {\n return {type: TOK_GT, value: \">\", start: start};\n }\n } else if (startingChar === \"=\") {\n if (stream[this._current] === \"=\") {\n this._current++;\n return {type: TOK_EQ, value: \"==\", start: start};\n }\n }\n },\n\n _consumeLiteral: function(stream) {\n this._current++;\n var start = this._current;\n var maxLength = stream.length;\n var literal;\n while(stream[this._current] !== \"`\" && this._current < maxLength) {\n // You can escape a literal char or you can escape the escape.\n var current = this._current;\n if (stream[current] === \"\\\\\" && (stream[current + 1] === \"\\\\\" ||\n stream[current + 1] === \"`\")) {\n current += 2;\n } else {\n current++;\n }\n this._current = current;\n }\n var literalString = trimLeft(stream.slice(start, this._current));\n literalString = literalString.replace(\"\\\\`\", \"`\");\n if (this._looksLikeJSON(literalString)) {\n literal = JSON.parse(literalString);\n } else {\n // Try to JSON parse it as \"\"\n literal = JSON.parse(\"\\\"\" + literalString + \"\\\"\");\n }\n // +1 gets us to the ending \"`\", +1 to move on to the next char.\n this._current++;\n return literal;\n },\n\n _looksLikeJSON: function(literalString) {\n var startingChars = \"[{\\\"\";\n var jsonLiterals = [\"true\", \"false\", \"null\"];\n var numberLooking = \"-0123456789\";\n\n if (literalString === \"\") {\n return false;\n } else if (startingChars.indexOf(literalString[0]) >= 0) {\n return true;\n } else if (jsonLiterals.indexOf(literalString) >= 0) {\n return true;\n } else if (numberLooking.indexOf(literalString[0]) >= 0) {\n try {\n JSON.parse(literalString);\n return true;\n } catch (ex) {\n return false;\n }\n } else {\n return false;\n }\n }\n };\n\n var bindingPower = {};\n bindingPower[TOK_EOF] = 0;\n bindingPower[TOK_UNQUOTEDIDENTIFIER] = 0;\n bindingPower[TOK_QUOTEDIDENTIFIER] = 0;\n bindingPower[TOK_RBRACKET] = 0;\n bindingPower[TOK_RPAREN] = 0;\n bindingPower[TOK_COMMA] = 0;\n bindingPower[TOK_RBRACE] = 0;\n bindingPower[TOK_NUMBER] = 0;\n bindingPower[TOK_CURRENT] = 0;\n bindingPower[TOK_EXPREF] = 0;\n bindingPower[TOK_PIPE] = 1;\n bindingPower[TOK_OR] = 2;\n bindingPower[TOK_AND] = 3;\n bindingPower[TOK_EQ] = 5;\n bindingPower[TOK_GT] = 5;\n bindingPower[TOK_LT] = 5;\n bindingPower[TOK_GTE] = 5;\n bindingPower[TOK_LTE] = 5;\n bindingPower[TOK_NE] = 5;\n bindingPower[TOK_FLATTEN] = 9;\n bindingPower[TOK_STAR] = 20;\n bindingPower[TOK_FILTER] = 21;\n bindingPower[TOK_DOT] = 40;\n bindingPower[TOK_NOT] = 45;\n bindingPower[TOK_LBRACE] = 50;\n bindingPower[TOK_LBRACKET] = 55;\n bindingPower[TOK_LPAREN] = 60;\n\n function Parser() {\n }\n\n Parser.prototype = {\n parse: function(expression) {\n this._loadTokens(expression);\n this.index = 0;\n var ast = this.expression(0);\n if (this._lookahead(0) !== TOK_EOF) {\n var t = this._lookaheadToken(0);\n var error = new Error(\n \"Unexpected token type: \" + t.type + \", value: \" + t.value);\n error.name = \"ParserError\";\n throw error;\n }\n return ast;\n },\n\n _loadTokens: function(expression) {\n var lexer = new Lexer();\n var tokens = lexer.tokenize(expression);\n tokens.push({type: TOK_EOF, value: \"\", start: expression.length});\n this.tokens = tokens;\n },\n\n expression: function(rbp) {\n var leftToken = this._lookaheadToken(0);\n this._advance();\n var left = this.nud(leftToken);\n var currentToken = this._lookahead(0);\n while (rbp < bindingPower[currentToken]) {\n this._advance();\n left = this.led(currentToken, left);\n currentToken = this._lookahead(0);\n }\n return left;\n },\n\n _lookahead: function(number) {\n return this.tokens[this.index + number].type;\n },\n\n _lookaheadToken: function(number) {\n return this.tokens[this.index + number];\n },\n\n _advance: function() {\n this.index++;\n },\n\n nud: function(token) {\n var left;\n var right;\n var expression;\n switch (token.type) {\n case TOK_LITERAL:\n return {type: \"Literal\", value: token.value};\n case TOK_UNQUOTEDIDENTIFIER:\n return {type: \"Field\", name: token.value};\n case TOK_QUOTEDIDENTIFIER:\n var node = {type: \"Field\", name: token.value};\n if (this._lookahead(0) === TOK_LPAREN) {\n throw new Error(\"Quoted identifier not allowed for function names.\");\n }\n return node;\n case TOK_NOT:\n right = this.expression(bindingPower.Not);\n return {type: \"NotExpression\", children: [right]};\n case TOK_STAR:\n left = {type: \"Identity\"};\n right = null;\n if (this._lookahead(0) === TOK_RBRACKET) {\n // This can happen in a multiselect,\n // [a, b, *]\n right = {type: \"Identity\"};\n } else {\n right = this._parseProjectionRHS(bindingPower.Star);\n }\n return {type: \"ValueProjection\", children: [left, right]};\n case TOK_FILTER:\n return this.led(token.type, {type: \"Identity\"});\n case TOK_LBRACE:\n return this._parseMultiselectHash();\n case TOK_FLATTEN:\n left = {type: TOK_FLATTEN, children: [{type: \"Identity\"}]};\n right = this._parseProjectionRHS(bindingPower.Flatten);\n return {type: \"Projection\", children: [left, right]};\n case TOK_LBRACKET:\n if (this._lookahead(0) === TOK_NUMBER || this._lookahead(0) === TOK_COLON) {\n right = this._parseIndexExpression();\n return this._projectIfSlice({type: \"Identity\"}, right);\n } else if (this._lookahead(0) === TOK_STAR &&\n this._lookahead(1) === TOK_RBRACKET) {\n this._advance();\n this._advance();\n right = this._parseProjectionRHS(bindingPower.Star);\n return {type: \"Projection\",\n children: [{type: \"Identity\"}, right]};\n }\n return this._parseMultiselectList();\n case TOK_CURRENT:\n return {type: TOK_CURRENT};\n case TOK_EXPREF:\n expression = this.expression(bindingPower.Expref);\n return {type: \"ExpressionReference\", children: [expression]};\n case TOK_LPAREN:\n var args = [];\n while (this._lookahead(0) !== TOK_RPAREN) {\n if (this._lookahead(0) === TOK_CURRENT) {\n expression = {type: TOK_CURRENT};\n this._advance();\n } else {\n expression = this.expression(0);\n }\n args.push(expression);\n }\n this._match(TOK_RPAREN);\n return args[0];\n default:\n this._errorToken(token);\n }\n },\n\n led: function(tokenName, left) {\n var right;\n switch(tokenName) {\n case TOK_DOT:\n var rbp = bindingPower.Dot;\n if (this._lookahead(0) !== TOK_STAR) {\n right = this._parseDotRHS(rbp);\n return {type: \"Subexpression\", children: [left, right]};\n }\n // Creating a projection.\n this._advance();\n right = this._parseProjectionRHS(rbp);\n return {type: \"ValueProjection\", children: [left, right]};\n case TOK_PIPE:\n right = this.expression(bindingPower.Pipe);\n return {type: TOK_PIPE, children: [left, right]};\n case TOK_OR:\n right = this.expression(bindingPower.Or);\n return {type: \"OrExpression\", children: [left, right]};\n case TOK_AND:\n right = this.expression(bindingPower.And);\n return {type: \"AndExpression\", children: [left, right]};\n case TOK_LPAREN:\n var name = left.name;\n var args = [];\n var expression, node;\n while (this._lookahead(0) !== TOK_RPAREN) {\n if (this._lookahead(0) === TOK_CURRENT) {\n expression = {type: TOK_CURRENT};\n this._advance();\n } else {\n expression = this.expression(0);\n }\n if (this._lookahead(0) === TOK_COMMA) {\n this._match(TOK_COMMA);\n }\n args.push(expression);\n }\n this._match(TOK_RPAREN);\n node = {type: \"Function\", name: name, children: args};\n return node;\n case TOK_FILTER:\n var condition = this.expression(0);\n this._match(TOK_RBRACKET);\n if (this._lookahead(0) === TOK_FLATTEN) {\n right = {type: \"Identity\"};\n } else {\n right = this._parseProjectionRHS(bindingPower.Filter);\n }\n return {type: \"FilterProjection\", children: [left, right, condition]};\n case TOK_FLATTEN:\n var leftNode = {type: TOK_FLATTEN, children: [left]};\n var rightNode = this._parseProjectionRHS(bindingPower.Flatten);\n return {type: \"Projection\", children: [leftNode, rightNode]};\n case TOK_EQ:\n case TOK_NE:\n case TOK_GT:\n case TOK_GTE:\n case TOK_LT:\n case TOK_LTE:\n return this._parseComparator(left, tokenName);\n case TOK_LBRACKET:\n var token = this._lookaheadToken(0);\n if (token.type === TOK_NUMBER || token.type === TOK_COLON) {\n right = this._parseIndexExpression();\n return this._projectIfSlice(left, right);\n }\n this._match(TOK_STAR);\n this._match(TOK_RBRACKET);\n right = this._parseProjectionRHS(bindingPower.Star);\n return {type: \"Projection\", children: [left, right]};\n default:\n this._errorToken(this._lookaheadToken(0));\n }\n },\n\n _match: function(tokenType) {\n if (this._lookahead(0) === tokenType) {\n this._advance();\n } else {\n var t = this._lookaheadToken(0);\n var error = new Error(\"Expected \" + tokenType + \", got: \" + t.type);\n error.name = \"ParserError\";\n throw error;\n }\n },\n\n _errorToken: function(token) {\n var error = new Error(\"Invalid token (\" +\n token.type + \"): \\\"\" +\n token.value + \"\\\"\");\n error.name = \"ParserError\";\n throw error;\n },\n\n\n _parseIndexExpression: function() {\n if (this._lookahead(0) === TOK_COLON || this._lookahead(1) === TOK_COLON) {\n return this._parseSliceExpression();\n } else {\n var node = {\n type: \"Index\",\n value: this._lookaheadToken(0).value};\n this._advance();\n this._match(TOK_RBRACKET);\n return node;\n }\n },\n\n _projectIfSlice: function(left, right) {\n var indexExpr = {type: \"IndexExpression\", children: [left, right]};\n if (right.type === \"Slice\") {\n return {\n type: \"Projection\",\n children: [indexExpr, this._parseProjectionRHS(bindingPower.Star)]\n };\n } else {\n return indexExpr;\n }\n },\n\n _parseSliceExpression: function() {\n // [start:end:step] where each part is optional, as well as the last\n // colon.\n var parts = [null, null, null];\n var index = 0;\n var currentToken = this._lookahead(0);\n while (currentToken !== TOK_RBRACKET && index < 3) {\n if (currentToken === TOK_COLON) {\n index++;\n this._advance();\n } else if (currentToken === TOK_NUMBER) {\n parts[index] = this._lookaheadToken(0).value;\n this._advance();\n } else {\n var t = this._lookahead(0);\n var error = new Error(\"Syntax error, unexpected token: \" +\n t.value + \"(\" + t.type + \")\");\n error.name = \"Parsererror\";\n throw error;\n }\n currentToken = this._lookahead(0);\n }\n this._match(TOK_RBRACKET);\n return {\n type: \"Slice\",\n children: parts\n };\n },\n\n _parseComparator: function(left, comparator) {\n var right = this.expression(bindingPower[comparator]);\n return {type: \"Comparator\", name: comparator, children: [left, right]};\n },\n\n _parseDotRHS: function(rbp) {\n var lookahead = this._lookahead(0);\n var exprTokens = [TOK_UNQUOTEDIDENTIFIER, TOK_QUOTEDIDENTIFIER, TOK_STAR];\n if (exprTokens.indexOf(lookahead) >= 0) {\n return this.expression(rbp);\n } else if (lookahead === TOK_LBRACKET) {\n this._match(TOK_LBRACKET);\n return this._parseMultiselectList();\n } else if (lookahead === TOK_LBRACE) {\n this._match(TOK_LBRACE);\n return this._parseMultiselectHash();\n }\n },\n\n _parseProjectionRHS: function(rbp) {\n var right;\n if (bindingPower[this._lookahead(0)] < 10) {\n right = {type: \"Identity\"};\n } else if (this._lookahead(0) === TOK_LBRACKET) {\n right = this.expression(rbp);\n } else if (this._lookahead(0) === TOK_FILTER) {\n right = this.expression(rbp);\n } else if (this._lookahead(0) === TOK_DOT) {\n this._match(TOK_DOT);\n right = this._parseDotRHS(rbp);\n } else {\n var t = this._lookaheadToken(0);\n var error = new Error(\"Sytanx error, unexpected token: \" +\n t.value + \"(\" + t.type + \")\");\n error.name = \"ParserError\";\n throw error;\n }\n return right;\n },\n\n _parseMultiselectList: function() {\n var expressions = [];\n while (this._lookahead(0) !== TOK_RBRACKET) {\n var expression = this.expression(0);\n expressions.push(expression);\n if (this._lookahead(0) === TOK_COMMA) {\n this._match(TOK_COMMA);\n if (this._lookahead(0) === TOK_RBRACKET) {\n throw new Error(\"Unexpected token Rbracket\");\n }\n }\n }\n this._match(TOK_RBRACKET);\n return {type: \"MultiSelectList\", children: expressions};\n },\n\n _parseMultiselectHash: function() {\n var pairs = [];\n var identifierTypes = [TOK_UNQUOTEDIDENTIFIER, TOK_QUOTEDIDENTIFIER];\n var keyToken, keyName, value, node;\n for (;;) {\n keyToken = this._lookaheadToken(0);\n if (identifierTypes.indexOf(keyToken.type) < 0) {\n throw new Error(\"Expecting an identifier token, got: \" +\n keyToken.type);\n }\n keyName = keyToken.value;\n this._advance();\n this._match(TOK_COLON);\n value = this.expression(0);\n node = {type: \"KeyValuePair\", name: keyName, value: value};\n pairs.push(node);\n if (this._lookahead(0) === TOK_COMMA) {\n this._match(TOK_COMMA);\n } else if (this._lookahead(0) === TOK_RBRACE) {\n this._match(TOK_RBRACE);\n break;\n }\n }\n return {type: \"MultiSelectHash\", children: pairs};\n }\n };\n\n\n function TreeInterpreter(runtime) {\n this.runtime = runtime;\n }\n\n TreeInterpreter.prototype = {\n search: function(node, value) {\n return this.visit(node, value);\n },\n\n visit: function(node, value) {\n var matched, current, result, first, second, field, left, right, collected, i;\n switch (node.type) {\n case \"Field\":\n if (value !== null && isObject(value)) {\n field = value[node.name];\n if (field === undefined) {\n return null;\n } else {\n return field;\n }\n }\n return null;\n case \"Subexpression\":\n result = this.visit(node.children[0], value);\n for (i = 1; i < node.children.length; i++) {\n result = this.visit(node.children[1], result);\n if (result === null) {\n return null;\n }\n }\n return result;\n case \"IndexExpression\":\n left = this.visit(node.children[0], value);\n right = this.visit(node.children[1], left);\n return right;\n case \"Index\":\n if (!isArray(value)) {\n return null;\n }\n var index = node.value;\n if (index < 0) {\n index = value.length + index;\n }\n result = value[index];\n if (result === undefined) {\n result = null;\n }\n return result;\n case \"Slice\":\n if (!isArray(value)) {\n return null;\n }\n var sliceParams = node.children.slice(0);\n var computed = this.computeSliceParams(value.length, sliceParams);\n var start = computed[0];\n var stop = computed[1];\n var step = computed[2];\n result = [];\n if (step > 0) {\n for (i = start; i < stop; i += step) {\n result.push(value[i]);\n }\n } else {\n for (i = start; i > stop; i += step) {\n result.push(value[i]);\n }\n }\n return result;\n case \"Projection\":\n // Evaluate left child.\n var base = this.visit(node.children[0], value);\n if (!isArray(base)) {\n return null;\n }\n collected = [];\n for (i = 0; i < base.length; i++) {\n current = this.visit(node.children[1], base[i]);\n if (current !== null) {\n collected.push(current);\n }\n }\n return collected;\n case \"ValueProjection\":\n // Evaluate left child.\n base = this.visit(node.children[0], value);\n if (!isObject(base)) {\n return null;\n }\n collected = [];\n var values = objValues(base);\n for (i = 0; i < values.length; i++) {\n current = this.visit(node.children[1], values[i]);\n if (current !== null) {\n collected.push(current);\n }\n }\n return collected;\n case \"FilterProjection\":\n base = this.visit(node.children[0], value);\n if (!isArray(base)) {\n return null;\n }\n var filtered = [];\n var finalResults = [];\n for (i = 0; i < base.length; i++) {\n matched = this.visit(node.children[2], base[i]);\n if (!isFalse(matched)) {\n filtered.push(base[i]);\n }\n }\n for (var j = 0; j < filtered.length; j++) {\n current = this.visit(node.children[1], filtered[j]);\n if (current !== null) {\n finalResults.push(current);\n }\n }\n return finalResults;\n case \"Comparator\":\n first = this.visit(node.children[0], value);\n second = this.visit(node.children[1], value);\n switch(node.name) {\n case TOK_EQ:\n result = strictDeepEqual(first, second);\n break;\n case TOK_NE:\n result = !strictDeepEqual(first, second);\n break;\n case TOK_GT:\n result = first > second;\n break;\n case TOK_GTE:\n result = first >= second;\n break;\n case TOK_LT:\n result = first < second;\n break;\n case TOK_LTE:\n result = first <= second;\n break;\n default:\n throw new Error(\"Unknown comparator: \" + node.name);\n }\n return result;\n case TOK_FLATTEN:\n var original = this.visit(node.children[0], value);\n if (!isArray(original)) {\n return null;\n }\n var merged = [];\n for (i = 0; i < original.length; i++) {\n current = original[i];\n if (isArray(current)) {\n merged.push.apply(merged, current);\n } else {\n merged.push(current);\n }\n }\n return merged;\n case \"Identity\":\n return value;\n case \"MultiSelectList\":\n if (value === null) {\n return null;\n }\n collected = [];\n for (i = 0; i < node.children.length; i++) {\n collected.push(this.visit(node.children[i], value));\n }\n return collected;\n case \"MultiSelectHash\":\n if (value === null) {\n return null;\n }\n collected = {};\n var child;\n for (i = 0; i < node.children.length; i++) {\n child = node.children[i];\n collected[child.name] = this.visit(child.value, value);\n }\n return collected;\n case \"OrExpression\":\n matched = this.visit(node.children[0], value);\n if (isFalse(matched)) {\n matched = this.visit(node.children[1], value);\n }\n return matched;\n case \"AndExpression\":\n first = this.visit(node.children[0], value);\n\n if (isFalse(first) === true) {\n return first;\n }\n return this.visit(node.children[1], value);\n case \"NotExpression\":\n first = this.visit(node.children[0], value);\n return isFalse(first);\n case \"Literal\":\n return node.value;\n case TOK_PIPE:\n left = this.visit(node.children[0], value);\n return this.visit(node.children[1], left);\n case TOK_CURRENT:\n return value;\n case \"Function\":\n var resolvedArgs = [];\n for (i = 0; i < node.children.length; i++) {\n resolvedArgs.push(this.visit(node.children[i], value));\n }\n return this.runtime.callFunction(node.name, resolvedArgs);\n case \"ExpressionReference\":\n var refNode = node.children[0];\n // Tag the node with a specific attribute so the type\n // checker verify the type.\n refNode.jmespathType = TOK_EXPREF;\n return refNode;\n default:\n throw new Error(\"Unknown node type: \" + node.type);\n }\n },\n\n computeSliceParams: function(arrayLength, sliceParams) {\n var start = sliceParams[0];\n var stop = sliceParams[1];\n var step = sliceParams[2];\n var computed = [null, null, null];\n if (step === null) {\n step = 1;\n } else if (step === 0) {\n var error = new Error(\"Invalid slice, step cannot be 0\");\n error.name = \"RuntimeError\";\n throw error;\n }\n var stepValueNegative = step < 0 ? true : false;\n\n if (start === null) {\n start = stepValueNegative ? arrayLength - 1 : 0;\n } else {\n start = this.capSliceRange(arrayLength, start, step);\n }\n\n if (stop === null) {\n stop = stepValueNegative ? -1 : arrayLength;\n } else {\n stop = this.capSliceRange(arrayLength, stop, step);\n }\n computed[0] = start;\n computed[1] = stop;\n computed[2] = step;\n return computed;\n },\n\n capSliceRange: function(arrayLength, actualValue, step) {\n if (actualValue < 0) {\n actualValue += arrayLength;\n if (actualValue < 0) {\n actualValue = step < 0 ? -1 : 0;\n }\n } else if (actualValue >= arrayLength) {\n actualValue = step < 0 ? arrayLength - 1 : arrayLength;\n }\n return actualValue;\n }\n\n };\n\n function Runtime(interpreter) {\n this._interpreter = interpreter;\n this.functionTable = {\n // name: [function, ]\n // The can be:\n //\n // {\n // args: [[type1, type2], [type1, type2]],\n // variadic: true|false\n // }\n //\n // Each arg in the arg list is a list of valid types\n // (if the function is overloaded and supports multiple\n // types. If the type is \"any\" then no type checking\n // occurs on the argument. Variadic is optional\n // and if not provided is assumed to be false.\n abs: {_func: this._functionAbs, _signature: [{types: [TYPE_NUMBER]}]},\n avg: {_func: this._functionAvg, _signature: [{types: [TYPE_ARRAY_NUMBER]}]},\n ceil: {_func: this._functionCeil, _signature: [{types: [TYPE_NUMBER]}]},\n contains: {\n _func: this._functionContains,\n _signature: [{types: [TYPE_STRING, TYPE_ARRAY]},\n {types: [TYPE_ANY]}]},\n \"ends_with\": {\n _func: this._functionEndsWith,\n _signature: [{types: [TYPE_STRING]}, {types: [TYPE_STRING]}]},\n floor: {_func: this._functionFloor, _signature: [{types: [TYPE_NUMBER]}]},\n length: {\n _func: this._functionLength,\n _signature: [{types: [TYPE_STRING, TYPE_ARRAY, TYPE_OBJECT]}]},\n map: {\n _func: this._functionMap,\n _signature: [{types: [TYPE_EXPREF]}, {types: [TYPE_ARRAY]}]},\n max: {\n _func: this._functionMax,\n _signature: [{types: [TYPE_ARRAY_NUMBER, TYPE_ARRAY_STRING]}]},\n \"merge\": {\n _func: this._functionMerge,\n _signature: [{types: [TYPE_OBJECT], variadic: true}]\n },\n \"max_by\": {\n _func: this._functionMaxBy,\n _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]\n },\n sum: {_func: this._functionSum, _signature: [{types: [TYPE_ARRAY_NUMBER]}]},\n \"starts_with\": {\n _func: this._functionStartsWith,\n _signature: [{types: [TYPE_STRING]}, {types: [TYPE_STRING]}]},\n min: {\n _func: this._functionMin,\n _signature: [{types: [TYPE_ARRAY_NUMBER, TYPE_ARRAY_STRING]}]},\n \"min_by\": {\n _func: this._functionMinBy,\n _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]\n },\n type: {_func: this._functionType, _signature: [{types: [TYPE_ANY]}]},\n keys: {_func: this._functionKeys, _signature: [{types: [TYPE_OBJECT]}]},\n values: {_func: this._functionValues, _signature: [{types: [TYPE_OBJECT]}]},\n sort: {_func: this._functionSort, _signature: [{types: [TYPE_ARRAY_STRING, TYPE_ARRAY_NUMBER]}]},\n \"sort_by\": {\n _func: this._functionSortBy,\n _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]\n },\n join: {\n _func: this._functionJoin,\n _signature: [\n {types: [TYPE_STRING]},\n {types: [TYPE_ARRAY_STRING]}\n ]\n },\n reverse: {\n _func: this._functionReverse,\n _signature: [{types: [TYPE_STRING, TYPE_ARRAY]}]},\n \"to_array\": {_func: this._functionToArray, _signature: [{types: [TYPE_ANY]}]},\n \"to_string\": {_func: this._functionToString, _signature: [{types: [TYPE_ANY]}]},\n \"to_number\": {_func: this._functionToNumber, _signature: [{types: [TYPE_ANY]}]},\n \"not_null\": {\n _func: this._functionNotNull,\n _signature: [{types: [TYPE_ANY], variadic: true}]\n }\n };\n }\n\n Runtime.prototype = {\n callFunction: function(name, resolvedArgs) {\n var functionEntry = this.functionTable[name];\n if (functionEntry === undefined) {\n throw new Error(\"Unknown function: \" + name + \"()\");\n }\n this._validateArgs(name, resolvedArgs, functionEntry._signature);\n return functionEntry._func.call(this, resolvedArgs);\n },\n\n _validateArgs: function(name, args, signature) {\n // Validating the args requires validating\n // the correct arity and the correct type of each arg.\n // If the last argument is declared as variadic, then we need\n // a minimum number of args to be required. Otherwise it has to\n // be an exact amount.\n var pluralized;\n if (signature[signature.length - 1].variadic) {\n if (args.length < signature.length) {\n pluralized = signature.length === 1 ? \" argument\" : \" arguments\";\n throw new Error(\"ArgumentError: \" + name + \"() \" +\n \"takes at least\" + signature.length + pluralized +\n \" but received \" + args.length);\n }\n } else if (args.length !== signature.length) {\n pluralized = signature.length === 1 ? \" argument\" : \" arguments\";\n throw new Error(\"ArgumentError: \" + name + \"() \" +\n \"takes \" + signature.length + pluralized +\n \" but received \" + args.length);\n }\n var currentSpec;\n var actualType;\n var typeMatched;\n for (var i = 0; i < signature.length; i++) {\n typeMatched = false;\n currentSpec = signature[i].types;\n actualType = this._getTypeName(args[i]);\n for (var j = 0; j < currentSpec.length; j++) {\n if (this._typeMatches(actualType, currentSpec[j], args[i])) {\n typeMatched = true;\n break;\n }\n }\n if (!typeMatched) {\n var expected = currentSpec\n .map(function(typeIdentifier) {\n return TYPE_NAME_TABLE[typeIdentifier];\n })\n .join(',');\n throw new Error(\"TypeError: \" + name + \"() \" +\n \"expected argument \" + (i + 1) +\n \" to be type \" + expected +\n \" but received type \" +\n TYPE_NAME_TABLE[actualType] + \" instead.\");\n }\n }\n },\n\n _typeMatches: function(actual, expected, argValue) {\n if (expected === TYPE_ANY) {\n return true;\n }\n if (expected === TYPE_ARRAY_STRING ||\n expected === TYPE_ARRAY_NUMBER ||\n expected === TYPE_ARRAY) {\n // The expected type can either just be array,\n // or it can require a specific subtype (array of numbers).\n //\n // The simplest case is if \"array\" with no subtype is specified.\n if (expected === TYPE_ARRAY) {\n return actual === TYPE_ARRAY;\n } else if (actual === TYPE_ARRAY) {\n // Otherwise we need to check subtypes.\n // I think this has potential to be improved.\n var subtype;\n if (expected === TYPE_ARRAY_NUMBER) {\n subtype = TYPE_NUMBER;\n } else if (expected === TYPE_ARRAY_STRING) {\n subtype = TYPE_STRING;\n }\n for (var i = 0; i < argValue.length; i++) {\n if (!this._typeMatches(\n this._getTypeName(argValue[i]), subtype,\n argValue[i])) {\n return false;\n }\n }\n return true;\n }\n } else {\n return actual === expected;\n }\n },\n _getTypeName: function(obj) {\n switch (Object.prototype.toString.call(obj)) {\n case \"[object String]\":\n return TYPE_STRING;\n case \"[object Number]\":\n return TYPE_NUMBER;\n case \"[object Array]\":\n return TYPE_ARRAY;\n case \"[object Boolean]\":\n return TYPE_BOOLEAN;\n case \"[object Null]\":\n return TYPE_NULL;\n case \"[object Object]\":\n // Check if it's an expref. If it has, it's been\n // tagged with a jmespathType attr of 'Expref';\n if (obj.jmespathType === TOK_EXPREF) {\n return TYPE_EXPREF;\n } else {\n return TYPE_OBJECT;\n }\n }\n },\n\n _functionStartsWith: function(resolvedArgs) {\n return resolvedArgs[0].lastIndexOf(resolvedArgs[1]) === 0;\n },\n\n _functionEndsWith: function(resolvedArgs) {\n var searchStr = resolvedArgs[0];\n var suffix = resolvedArgs[1];\n return searchStr.indexOf(suffix, searchStr.length - suffix.length) !== -1;\n },\n\n _functionReverse: function(resolvedArgs) {\n var typeName = this._getTypeName(resolvedArgs[0]);\n if (typeName === TYPE_STRING) {\n var originalStr = resolvedArgs[0];\n var reversedStr = \"\";\n for (var i = originalStr.length - 1; i >= 0; i--) {\n reversedStr += originalStr[i];\n }\n return reversedStr;\n } else {\n var reversedArray = resolvedArgs[0].slice(0);\n reversedArray.reverse();\n return reversedArray;\n }\n },\n\n _functionAbs: function(resolvedArgs) {\n return Math.abs(resolvedArgs[0]);\n },\n\n _functionCeil: function(resolvedArgs) {\n return Math.ceil(resolvedArgs[0]);\n },\n\n _functionAvg: function(resolvedArgs) {\n var sum = 0;\n var inputArray = resolvedArgs[0];\n for (var i = 0; i < inputArray.length; i++) {\n sum += inputArray[i];\n }\n return sum / inputArray.length;\n },\n\n _functionContains: function(resolvedArgs) {\n return resolvedArgs[0].indexOf(resolvedArgs[1]) >= 0;\n },\n\n _functionFloor: function(resolvedArgs) {\n return Math.floor(resolvedArgs[0]);\n },\n\n _functionLength: function(resolvedArgs) {\n if (!isObject(resolvedArgs[0])) {\n return resolvedArgs[0].length;\n } else {\n // As far as I can tell, there's no way to get the length\n // of an object without O(n) iteration through the object.\n return Object.keys(resolvedArgs[0]).length;\n }\n },\n\n _functionMap: function(resolvedArgs) {\n var mapped = [];\n var interpreter = this._interpreter;\n var exprefNode = resolvedArgs[0];\n var elements = resolvedArgs[1];\n for (var i = 0; i < elements.length; i++) {\n mapped.push(interpreter.visit(exprefNode, elements[i]));\n }\n return mapped;\n },\n\n _functionMerge: function(resolvedArgs) {\n var merged = {};\n for (var i = 0; i < resolvedArgs.length; i++) {\n var current = resolvedArgs[i];\n for (var key in current) {\n merged[key] = current[key];\n }\n }\n return merged;\n },\n\n _functionMax: function(resolvedArgs) {\n if (resolvedArgs[0].length > 0) {\n var typeName = this._getTypeName(resolvedArgs[0][0]);\n if (typeName === TYPE_NUMBER) {\n return Math.max.apply(Math, resolvedArgs[0]);\n } else {\n var elements = resolvedArgs[0];\n var maxElement = elements[0];\n for (var i = 1; i < elements.length; i++) {\n if (maxElement.localeCompare(elements[i]) < 0) {\n maxElement = elements[i];\n }\n }\n return maxElement;\n }\n } else {\n return null;\n }\n },\n\n _functionMin: function(resolvedArgs) {\n if (resolvedArgs[0].length > 0) {\n var typeName = this._getTypeName(resolvedArgs[0][0]);\n if (typeName === TYPE_NUMBER) {\n return Math.min.apply(Math, resolvedArgs[0]);\n } else {\n var elements = resolvedArgs[0];\n var minElement = elements[0];\n for (var i = 1; i < elements.length; i++) {\n if (elements[i].localeCompare(minElement) < 0) {\n minElement = elements[i];\n }\n }\n return minElement;\n }\n } else {\n return null;\n }\n },\n\n _functionSum: function(resolvedArgs) {\n var sum = 0;\n var listToSum = resolvedArgs[0];\n for (var i = 0; i < listToSum.length; i++) {\n sum += listToSum[i];\n }\n return sum;\n },\n\n _functionType: function(resolvedArgs) {\n switch (this._getTypeName(resolvedArgs[0])) {\n case TYPE_NUMBER:\n return \"number\";\n case TYPE_STRING:\n return \"string\";\n case TYPE_ARRAY:\n return \"array\";\n case TYPE_OBJECT:\n return \"object\";\n case TYPE_BOOLEAN:\n return \"boolean\";\n case TYPE_EXPREF:\n return \"expref\";\n case TYPE_NULL:\n return \"null\";\n }\n },\n\n _functionKeys: function(resolvedArgs) {\n return Object.keys(resolvedArgs[0]);\n },\n\n _functionValues: function(resolvedArgs) {\n var obj = resolvedArgs[0];\n var keys = Object.keys(obj);\n var values = [];\n for (var i = 0; i < keys.length; i++) {\n values.push(obj[keys[i]]);\n }\n return values;\n },\n\n _functionJoin: function(resolvedArgs) {\n var joinChar = resolvedArgs[0];\n var listJoin = resolvedArgs[1];\n return listJoin.join(joinChar);\n },\n\n _functionToArray: function(resolvedArgs) {\n if (this._getTypeName(resolvedArgs[0]) === TYPE_ARRAY) {\n return resolvedArgs[0];\n } else {\n return [resolvedArgs[0]];\n }\n },\n\n _functionToString: function(resolvedArgs) {\n if (this._getTypeName(resolvedArgs[0]) === TYPE_STRING) {\n return resolvedArgs[0];\n } else {\n return JSON.stringify(resolvedArgs[0]);\n }\n },\n\n _functionToNumber: function(resolvedArgs) {\n var typeName = this._getTypeName(resolvedArgs[0]);\n var convertedValue;\n if (typeName === TYPE_NUMBER) {\n return resolvedArgs[0];\n } else if (typeName === TYPE_STRING) {\n convertedValue = +resolvedArgs[0];\n if (!isNaN(convertedValue)) {\n return convertedValue;\n }\n }\n return null;\n },\n\n _functionNotNull: function(resolvedArgs) {\n for (var i = 0; i < resolvedArgs.length; i++) {\n if (this._getTypeName(resolvedArgs[i]) !== TYPE_NULL) {\n return resolvedArgs[i];\n }\n }\n return null;\n },\n\n _functionSort: function(resolvedArgs) {\n var sortedArray = resolvedArgs[0].slice(0);\n sortedArray.sort();\n return sortedArray;\n },\n\n _functionSortBy: function(resolvedArgs) {\n var sortedArray = resolvedArgs[0].slice(0);\n if (sortedArray.length === 0) {\n return sortedArray;\n }\n var interpreter = this._interpreter;\n var exprefNode = resolvedArgs[1];\n var requiredType = this._getTypeName(\n interpreter.visit(exprefNode, sortedArray[0]));\n if ([TYPE_NUMBER, TYPE_STRING].indexOf(requiredType) < 0) {\n throw new Error(\"TypeError\");\n }\n var that = this;\n // In order to get a stable sort out of an unstable\n // sort algorithm, we decorate/sort/undecorate (DSU)\n // by creating a new list of [index, element] pairs.\n // In the cmp function, if the evaluated elements are\n // equal, then the index will be used as the tiebreaker.\n // After the decorated list has been sorted, it will be\n // undecorated to extract the original elements.\n var decorated = [];\n for (var i = 0; i < sortedArray.length; i++) {\n decorated.push([i, sortedArray[i]]);\n }\n decorated.sort(function(a, b) {\n var exprA = interpreter.visit(exprefNode, a[1]);\n var exprB = interpreter.visit(exprefNode, b[1]);\n if (that._getTypeName(exprA) !== requiredType) {\n throw new Error(\n \"TypeError: expected \" + requiredType + \", received \" +\n that._getTypeName(exprA));\n } else if (that._getTypeName(exprB) !== requiredType) {\n throw new Error(\n \"TypeError: expected \" + requiredType + \", received \" +\n that._getTypeName(exprB));\n }\n if (exprA > exprB) {\n return 1;\n } else if (exprA < exprB) {\n return -1;\n } else {\n // If they're equal compare the items by their\n // order to maintain relative order of equal keys\n // (i.e. to get a stable sort).\n return a[0] - b[0];\n }\n });\n // Undecorate: extract out the original list elements.\n for (var j = 0; j < decorated.length; j++) {\n sortedArray[j] = decorated[j][1];\n }\n return sortedArray;\n },\n\n _functionMaxBy: function(resolvedArgs) {\n var exprefNode = resolvedArgs[1];\n var resolvedArray = resolvedArgs[0];\n var keyFunction = this.createKeyFunction(exprefNode, [TYPE_NUMBER, TYPE_STRING]);\n var maxNumber = -Infinity;\n var maxRecord;\n var current;\n for (var i = 0; i < resolvedArray.length; i++) {\n current = keyFunction(resolvedArray[i]);\n if (current > maxNumber) {\n maxNumber = current;\n maxRecord = resolvedArray[i];\n }\n }\n return maxRecord;\n },\n\n _functionMinBy: function(resolvedArgs) {\n var exprefNode = resolvedArgs[1];\n var resolvedArray = resolvedArgs[0];\n var keyFunction = this.createKeyFunction(exprefNode, [TYPE_NUMBER, TYPE_STRING]);\n var minNumber = Infinity;\n var minRecord;\n var current;\n for (var i = 0; i < resolvedArray.length; i++) {\n current = keyFunction(resolvedArray[i]);\n if (current < minNumber) {\n minNumber = current;\n minRecord = resolvedArray[i];\n }\n }\n return minRecord;\n },\n\n createKeyFunction: function(exprefNode, allowedTypes) {\n var that = this;\n var interpreter = this._interpreter;\n var keyFunc = function(x) {\n var current = interpreter.visit(exprefNode, x);\n if (allowedTypes.indexOf(that._getTypeName(current)) < 0) {\n var msg = \"TypeError: expected one of \" + allowedTypes +\n \", received \" + that._getTypeName(current);\n throw new Error(msg);\n }\n return current;\n };\n return keyFunc;\n }\n\n };\n\n function compile(stream) {\n var parser = new Parser();\n var ast = parser.parse(stream);\n return ast;\n }\n\n function tokenize(stream) {\n var lexer = new Lexer();\n return lexer.tokenize(stream);\n }\n\n function search(data, expression) {\n var parser = new Parser();\n // This needs to be improved. Both the interpreter and runtime depend on\n // each other. The runtime needs the interpreter to support exprefs.\n // There's likely a clean way to avoid the cyclic dependency.\n var runtime = new Runtime();\n var interpreter = new TreeInterpreter(runtime);\n runtime._interpreter = interpreter;\n var node = parser.parse(expression);\n return interpreter.search(node, data);\n }\n\n exports.tokenize = tokenize;\n exports.compile = compile;\n exports.search = search;\n exports.strictDeepEqual = strictDeepEqual;\n})(typeof exports === \"undefined\" ? this.jmespath = {} : exports);\n", "var AWS = require('./core');\nvar AcceptorStateMachine = require('./state_machine');\nvar inherit = AWS.util.inherit;\nvar domain = AWS.util.domain;\nvar jmespath = require('jmespath');\n\n/**\n * @api private\n */\nvar hardErrorStates = {success: 1, error: 1, complete: 1};\n\nfunction isTerminalState(machine) {\n return Object.prototype.hasOwnProperty.call(hardErrorStates, machine._asm.currentState);\n}\n\nvar fsm = new AcceptorStateMachine();\nfsm.setupStates = function() {\n var transition = function(_, done) {\n var self = this;\n self._haltHandlersOnError = false;\n\n self.emit(self._asm.currentState, function(err) {\n if (err) {\n if (isTerminalState(self)) {\n if (domain && self.domain instanceof domain.Domain) {\n err.domainEmitter = self;\n err.domain = self.domain;\n err.domainThrown = false;\n self.domain.emit('error', err);\n } else {\n throw err;\n }\n } else {\n self.response.error = err;\n done(err);\n }\n } else {\n done(self.response.error);\n }\n });\n\n };\n\n this.addState('validate', 'build', 'error', transition);\n this.addState('build', 'afterBuild', 'restart', transition);\n this.addState('afterBuild', 'sign', 'restart', transition);\n this.addState('sign', 'send', 'retry', transition);\n this.addState('retry', 'afterRetry', 'afterRetry', transition);\n this.addState('afterRetry', 'sign', 'error', transition);\n this.addState('send', 'validateResponse', 'retry', transition);\n this.addState('validateResponse', 'extractData', 'extractError', transition);\n this.addState('extractError', 'extractData', 'retry', transition);\n this.addState('extractData', 'success', 'retry', transition);\n this.addState('restart', 'build', 'error', transition);\n this.addState('success', 'complete', 'complete', transition);\n this.addState('error', 'complete', 'complete', transition);\n this.addState('complete', null, null, transition);\n};\nfsm.setupStates();\n\n/**\n * ## Asynchronous Requests\n *\n * All requests made through the SDK are asynchronous and use a\n * callback interface. Each service method that kicks off a request\n * returns an `AWS.Request` object that you can use to register\n * callbacks.\n *\n * For example, the following service method returns the request\n * object as \"request\", which can be used to register callbacks:\n *\n * ```javascript\n * // request is an AWS.Request object\n * var request = ec2.describeInstances();\n *\n * // register callbacks on request to retrieve response data\n * request.on('success', function(response) {\n * console.log(response.data);\n * });\n * ```\n *\n * When a request is ready to be sent, the {send} method should\n * be called:\n *\n * ```javascript\n * request.send();\n * ```\n *\n * Since registered callbacks may or may not be idempotent, requests should only\n * be sent once. To perform the same operation multiple times, you will need to\n * create multiple request objects, each with its own registered callbacks.\n *\n * ## Removing Default Listeners for Events\n *\n * Request objects are built with default listeners for the various events,\n * depending on the service type. In some cases, you may want to remove\n * some built-in listeners to customize behaviour. Doing this requires\n * access to the built-in listener functions, which are exposed through\n * the {AWS.EventListeners.Core} namespace. For instance, you may\n * want to customize the HTTP handler used when sending a request. In this\n * case, you can remove the built-in listener associated with the 'send'\n * event, the {AWS.EventListeners.Core.SEND} listener and add your own.\n *\n * ## Multiple Callbacks and Chaining\n *\n * You can register multiple callbacks on any request object. The\n * callbacks can be registered for different events, or all for the\n * same event. In addition, you can chain callback registration, for\n * example:\n *\n * ```javascript\n * request.\n * on('success', function(response) {\n * console.log(\"Success!\");\n * }).\n * on('error', function(error, response) {\n * console.log(\"Error!\");\n * }).\n * on('complete', function(response) {\n * console.log(\"Always!\");\n * }).\n * send();\n * ```\n *\n * The above example will print either \"Success! Always!\", or \"Error! Always!\",\n * depending on whether the request succeeded or not.\n *\n * @!attribute httpRequest\n * @readonly\n * @!group HTTP Properties\n * @return [AWS.HttpRequest] the raw HTTP request object\n * containing request headers and body information\n * sent by the service.\n *\n * @!attribute startTime\n * @readonly\n * @!group Operation Properties\n * @return [Date] the time that the request started\n *\n * @!group Request Building Events\n *\n * @!event validate(request)\n * Triggered when a request is being validated. Listeners\n * should throw an error if the request should not be sent.\n * @param request [Request] the request object being sent\n * @see AWS.EventListeners.Core.VALIDATE_CREDENTIALS\n * @see AWS.EventListeners.Core.VALIDATE_REGION\n * @example Ensuring that a certain parameter is set before sending a request\n * var req = s3.putObject(params);\n * req.on('validate', function() {\n * if (!req.params.Body.match(/^Hello\\s/)) {\n * throw new Error('Body must start with \"Hello \"');\n * }\n * });\n * req.send(function(err, data) { ... });\n *\n * @!event build(request)\n * Triggered when the request payload is being built. Listeners\n * should fill the necessary information to send the request\n * over HTTP.\n * @param (see AWS.Request~validate)\n * @example Add a custom HTTP header to a request\n * var req = s3.putObject(params);\n * req.on('build', function() {\n * req.httpRequest.headers['Custom-Header'] = 'value';\n * });\n * req.send(function(err, data) { ... });\n *\n * @!event sign(request)\n * Triggered when the request is being signed. Listeners should\n * add the correct authentication headers and/or adjust the body,\n * depending on the authentication mechanism being used.\n * @param (see AWS.Request~validate)\n *\n * @!group Request Sending Events\n *\n * @!event send(response)\n * Triggered when the request is ready to be sent. Listeners\n * should call the underlying transport layer to initiate\n * the sending of the request.\n * @param response [Response] the response object\n * @context [Request] the request object that was sent\n * @see AWS.EventListeners.Core.SEND\n *\n * @!event retry(response)\n * Triggered when a request failed and might need to be retried or redirected.\n * If the response is retryable, the listener should set the\n * `response.error.retryable` property to `true`, and optionally set\n * `response.error.retryDelay` to the millisecond delay for the next attempt.\n * In the case of a redirect, `response.error.redirect` should be set to\n * `true` with `retryDelay` set to an optional delay on the next request.\n *\n * If a listener decides that a request should not be retried,\n * it should set both `retryable` and `redirect` to false.\n *\n * Note that a retryable error will be retried at most\n * {AWS.Config.maxRetries} times (based on the service object's config).\n * Similarly, a request that is redirected will only redirect at most\n * {AWS.Config.maxRedirects} times.\n *\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n * @example Adding a custom retry for a 404 response\n * request.on('retry', function(response) {\n * // this resource is not yet available, wait 10 seconds to get it again\n * if (response.httpResponse.statusCode === 404 && response.error) {\n * response.error.retryable = true; // retry this error\n * response.error.retryDelay = 10000; // wait 10 seconds\n * }\n * });\n *\n * @!group Data Parsing Events\n *\n * @!event extractError(response)\n * Triggered on all non-2xx requests so that listeners can extract\n * error details from the response body. Listeners to this event\n * should set the `response.error` property.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @!event extractData(response)\n * Triggered in successful requests to allow listeners to\n * de-serialize the response body into `response.data`.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @!group Completion Events\n *\n * @!event success(response)\n * Triggered when the request completed successfully.\n * `response.data` will contain the response data and\n * `response.error` will be null.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @!event error(error, response)\n * Triggered when an error occurs at any point during the\n * request. `response.error` will contain details about the error\n * that occurred. `response.data` will be null.\n * @param error [Error] the error object containing details about\n * the error that occurred.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @!event complete(response)\n * Triggered whenever a request cycle completes. `response.error`\n * should be checked, since the request may have failed.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @!group HTTP Events\n *\n * @!event httpHeaders(statusCode, headers, response, statusMessage)\n * Triggered when headers are sent by the remote server\n * @param statusCode [Integer] the HTTP response code\n * @param headers [map] the response headers\n * @param (see AWS.Request~send)\n * @param statusMessage [String] A status message corresponding to the HTTP\n * response code\n * @context (see AWS.Request~send)\n *\n * @!event httpData(chunk, response)\n * Triggered when data is sent by the remote server\n * @param chunk [Buffer] the buffer data containing the next data chunk\n * from the server\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n * @see AWS.EventListeners.Core.HTTP_DATA\n *\n * @!event httpUploadProgress(progress, response)\n * Triggered when the HTTP request has uploaded more data\n * @param progress [map] An object containing the `loaded` and `total` bytes\n * of the request.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n * @note This event will not be emitted in Node.js 0.8.x.\n *\n * @!event httpDownloadProgress(progress, response)\n * Triggered when the HTTP request has downloaded more data\n * @param progress [map] An object containing the `loaded` and `total` bytes\n * of the request.\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n * @note This event will not be emitted in Node.js 0.8.x.\n *\n * @!event httpError(error, response)\n * Triggered when the HTTP request failed\n * @param error [Error] the error object that was thrown\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @!event httpDone(response)\n * Triggered when the server is finished sending data\n * @param (see AWS.Request~send)\n * @context (see AWS.Request~send)\n *\n * @see AWS.Response\n */\nAWS.Request = inherit({\n\n /**\n * Creates a request for an operation on a given service with\n * a set of input parameters.\n *\n * @param service [AWS.Service] the service to perform the operation on\n * @param operation [String] the operation to perform on the service\n * @param params [Object] parameters to send to the operation.\n * See the operation's documentation for the format of the\n * parameters.\n */\n constructor: function Request(service, operation, params) {\n var endpoint = service.endpoint;\n var region = service.config.region;\n var customUserAgent = service.config.customUserAgent;\n\n if (service.signingRegion) {\n region = service.signingRegion;\n } else if (service.isGlobalEndpoint) {\n region = 'us-east-1';\n }\n\n this.domain = domain && domain.active;\n this.service = service;\n this.operation = operation;\n this.params = params || {};\n this.httpRequest = new AWS.HttpRequest(endpoint, region);\n this.httpRequest.appendToUserAgent(customUserAgent);\n this.startTime = service.getSkewCorrectedDate();\n\n this.response = new AWS.Response(this);\n this._asm = new AcceptorStateMachine(fsm.states, 'validate');\n this._haltHandlersOnError = false;\n\n AWS.SequentialExecutor.call(this);\n this.emit = this.emitEvent;\n },\n\n /**\n * @!group Sending a Request\n */\n\n /**\n * @overload send(callback = null)\n * Sends the request object.\n *\n * @callback callback function(err, data)\n * If a callback is supplied, it is called when a response is returned\n * from the service.\n * @context [AWS.Request] the request object being sent.\n * @param err [Error] the error object returned from the request.\n * Set to `null` if the request is successful.\n * @param data [Object] the de-serialized data returned from\n * the request. Set to `null` if a request error occurs.\n * @example Sending a request with a callback\n * request = s3.putObject({Bucket: 'bucket', Key: 'key'});\n * request.send(function(err, data) { console.log(err, data); });\n * @example Sending a request with no callback (using event handlers)\n * request = s3.putObject({Bucket: 'bucket', Key: 'key'});\n * request.on('complete', function(response) { ... }); // register a callback\n * request.send();\n */\n send: function send(callback) {\n if (callback) {\n // append to user agent\n this.httpRequest.appendToUserAgent('callback');\n this.on('complete', function (resp) {\n callback.call(resp, resp.error, resp.data);\n });\n }\n this.runTo();\n\n return this.response;\n },\n\n /**\n * @!method promise()\n * Sends the request and returns a 'thenable' promise.\n *\n * Two callbacks can be provided to the `then` method on the returned promise.\n * The first callback will be called if the promise is fulfilled, and the second\n * callback will be called if the promise is rejected.\n * @callback fulfilledCallback function(data)\n * Called if the promise is fulfilled.\n * @param data [Object] the de-serialized data returned from the request.\n * @callback rejectedCallback function(error)\n * Called if the promise is rejected.\n * @param error [Error] the error object returned from the request.\n * @return [Promise] A promise that represents the state of the request.\n * @example Sending a request using promises.\n * var request = s3.putObject({Bucket: 'bucket', Key: 'key'});\n * var result = request.promise();\n * result.then(function(data) { ... }, function(error) { ... });\n */\n\n /**\n * @api private\n */\n build: function build(callback) {\n return this.runTo('send', callback);\n },\n\n /**\n * @api private\n */\n runTo: function runTo(state, done) {\n this._asm.runTo(state, done, this);\n return this;\n },\n\n /**\n * Aborts a request, emitting the error and complete events.\n *\n * @!macro nobrowser\n * @example Aborting a request after sending\n * var params = {\n * Bucket: 'bucket', Key: 'key',\n * Body: Buffer.alloc(1024 * 1024 * 5) // 5MB payload\n * };\n * var request = s3.putObject(params);\n * request.send(function (err, data) {\n * if (err) console.log(\"Error:\", err.code, err.message);\n * else console.log(data);\n * });\n *\n * // abort request in 1 second\n * setTimeout(request.abort.bind(request), 1000);\n *\n * // prints \"Error: RequestAbortedError Request aborted by user\"\n * @return [AWS.Request] the same request object, for chaining.\n * @since v1.4.0\n */\n abort: function abort() {\n this.removeAllListeners('validateResponse');\n this.removeAllListeners('extractError');\n this.on('validateResponse', function addAbortedError(resp) {\n resp.error = AWS.util.error(new Error('Request aborted by user'), {\n code: 'RequestAbortedError', retryable: false\n });\n });\n\n if (this.httpRequest.stream && !this.httpRequest.stream.didCallback) { // abort HTTP stream\n this.httpRequest.stream.abort();\n if (this.httpRequest._abortCallback) {\n this.httpRequest._abortCallback();\n } else {\n this.removeAllListeners('send'); // haven't sent yet, so let's not\n }\n }\n\n return this;\n },\n\n /**\n * Iterates over each page of results given a pageable request, calling\n * the provided callback with each page of data. After all pages have been\n * retrieved, the callback is called with `null` data.\n *\n * @note This operation can generate multiple requests to a service.\n * @example Iterating over multiple pages of objects in an S3 bucket\n * var pages = 1;\n * s3.listObjects().eachPage(function(err, data) {\n * if (err) return;\n * console.log(\"Page\", pages++);\n * console.log(data);\n * });\n * @example Iterating over multiple pages with an asynchronous callback\n * s3.listObjects(params).eachPage(function(err, data, done) {\n * doSomethingAsyncAndOrExpensive(function() {\n * // The next page of results isn't fetched until done is called\n * done();\n * });\n * });\n * @callback callback function(err, data, [doneCallback])\n * Called with each page of resulting data from the request. If the\n * optional `doneCallback` is provided in the function, it must be called\n * when the callback is complete.\n *\n * @param err [Error] an error object, if an error occurred.\n * @param data [Object] a single page of response data. If there is no\n * more data, this object will be `null`.\n * @param doneCallback [Function] an optional done callback. If this\n * argument is defined in the function declaration, it should be called\n * when the next page is ready to be retrieved. This is useful for\n * controlling serial pagination across asynchronous operations.\n * @return [Boolean] if the callback returns `false`, pagination will\n * stop.\n *\n * @see AWS.Request.eachItem\n * @see AWS.Response.nextPage\n * @since v1.4.0\n */\n eachPage: function eachPage(callback) {\n // Make all callbacks async-ish\n callback = AWS.util.fn.makeAsync(callback, 3);\n\n function wrappedCallback(response) {\n callback.call(response, response.error, response.data, function (result) {\n if (result === false) return;\n\n if (response.hasNextPage()) {\n response.nextPage().on('complete', wrappedCallback).send();\n } else {\n callback.call(response, null, null, AWS.util.fn.noop);\n }\n });\n }\n\n this.on('complete', wrappedCallback).send();\n },\n\n /**\n * Enumerates over individual items of a request, paging the responses if\n * necessary.\n *\n * @api experimental\n * @since v1.4.0\n */\n eachItem: function eachItem(callback) {\n var self = this;\n function wrappedCallback(err, data) {\n if (err) return callback(err, null);\n if (data === null) return callback(null, null);\n\n var config = self.service.paginationConfig(self.operation);\n var resultKey = config.resultKey;\n if (Array.isArray(resultKey)) resultKey = resultKey[0];\n var items = jmespath.search(data, resultKey);\n var continueIteration = true;\n AWS.util.arrayEach(items, function(item) {\n continueIteration = callback(null, item);\n if (continueIteration === false) {\n return AWS.util.abort;\n }\n });\n return continueIteration;\n }\n\n this.eachPage(wrappedCallback);\n },\n\n /**\n * @return [Boolean] whether the operation can return multiple pages of\n * response data.\n * @see AWS.Response.eachPage\n * @since v1.4.0\n */\n isPageable: function isPageable() {\n return this.service.paginationConfig(this.operation) ? true : false;\n },\n\n /**\n * Sends the request and converts the request object into a readable stream\n * that can be read from or piped into a writable stream.\n *\n * @note The data read from a readable stream contains only\n * the raw HTTP body contents.\n * @example Manually reading from a stream\n * request.createReadStream().on('data', function(data) {\n * console.log(\"Got data:\", data.toString());\n * });\n * @example Piping a request body into a file\n * var out = fs.createWriteStream('/path/to/outfile.jpg');\n * s3.service.getObject(params).createReadStream().pipe(out);\n * @return [Stream] the readable stream object that can be piped\n * or read from (by registering 'data' event listeners).\n * @!macro nobrowser\n */\n createReadStream: function createReadStream() {\n var streams = AWS.util.stream;\n var req = this;\n var stream = null;\n\n if (AWS.HttpClient.streamsApiVersion === 2) {\n stream = new streams.PassThrough();\n process.nextTick(function() { req.send(); });\n } else {\n stream = new streams.Stream();\n stream.readable = true;\n\n stream.sent = false;\n stream.on('newListener', function(event) {\n if (!stream.sent && event === 'data') {\n stream.sent = true;\n process.nextTick(function() { req.send(); });\n }\n });\n }\n\n this.on('error', function(err) {\n stream.emit('error', err);\n });\n\n this.on('httpHeaders', function streamHeaders(statusCode, headers, resp) {\n if (statusCode < 300) {\n req.removeListener('httpData', AWS.EventListeners.Core.HTTP_DATA);\n req.removeListener('httpError', AWS.EventListeners.Core.HTTP_ERROR);\n req.on('httpError', function streamHttpError(error) {\n resp.error = error;\n resp.error.retryable = false;\n });\n\n var shouldCheckContentLength = false;\n var expectedLen;\n if (req.httpRequest.method !== 'HEAD') {\n expectedLen = parseInt(headers['content-length'], 10);\n }\n if (expectedLen !== undefined && !isNaN(expectedLen) && expectedLen >= 0) {\n shouldCheckContentLength = true;\n var receivedLen = 0;\n }\n\n var checkContentLengthAndEmit = function checkContentLengthAndEmit() {\n if (shouldCheckContentLength && receivedLen !== expectedLen) {\n stream.emit('error', AWS.util.error(\n new Error('Stream content length mismatch. Received ' +\n receivedLen + ' of ' + expectedLen + ' bytes.'),\n { code: 'StreamContentLengthMismatch' }\n ));\n } else if (AWS.HttpClient.streamsApiVersion === 2) {\n stream.end();\n } else {\n stream.emit('end');\n }\n };\n\n var httpStream = resp.httpResponse.createUnbufferedStream();\n\n if (AWS.HttpClient.streamsApiVersion === 2) {\n if (shouldCheckContentLength) {\n var lengthAccumulator = new streams.PassThrough();\n lengthAccumulator._write = function(chunk) {\n if (chunk && chunk.length) {\n receivedLen += chunk.length;\n }\n return streams.PassThrough.prototype._write.apply(this, arguments);\n };\n\n lengthAccumulator.on('end', checkContentLengthAndEmit);\n stream.on('error', function(err) {\n shouldCheckContentLength = false;\n httpStream.unpipe(lengthAccumulator);\n lengthAccumulator.emit('end');\n lengthAccumulator.end();\n });\n httpStream.pipe(lengthAccumulator).pipe(stream, { end: false });\n } else {\n httpStream.pipe(stream);\n }\n } else {\n\n if (shouldCheckContentLength) {\n httpStream.on('data', function(arg) {\n if (arg && arg.length) {\n receivedLen += arg.length;\n }\n });\n }\n\n httpStream.on('data', function(arg) {\n stream.emit('data', arg);\n });\n httpStream.on('end', checkContentLengthAndEmit);\n }\n\n httpStream.on('error', function(err) {\n shouldCheckContentLength = false;\n stream.emit('error', err);\n });\n }\n });\n\n return stream;\n },\n\n /**\n * @param [Array,Response] args This should be the response object,\n * or an array of args to send to the event.\n * @api private\n */\n emitEvent: function emit(eventName, args, done) {\n if (typeof args === 'function') { done = args; args = null; }\n if (!done) done = function() { };\n if (!args) args = this.eventParameters(eventName, this.response);\n\n var origEmit = AWS.SequentialExecutor.prototype.emit;\n origEmit.call(this, eventName, args, function (err) {\n if (err) this.response.error = err;\n done.call(this, err);\n });\n },\n\n /**\n * @api private\n */\n eventParameters: function eventParameters(eventName) {\n switch (eventName) {\n case 'restart':\n case 'validate':\n case 'sign':\n case 'build':\n case 'afterValidate':\n case 'afterBuild':\n return [this];\n case 'error':\n return [this.response.error, this.response];\n default:\n return [this.response];\n }\n },\n\n /**\n * @api private\n */\n presign: function presign(expires, callback) {\n if (!callback && typeof expires === 'function') {\n callback = expires;\n expires = null;\n }\n return new AWS.Signers.Presign().sign(this.toGet(), expires, callback);\n },\n\n /**\n * @api private\n */\n isPresigned: function isPresigned() {\n return Object.prototype.hasOwnProperty.call(this.httpRequest.headers, 'presigned-expires');\n },\n\n /**\n * @api private\n */\n toUnauthenticated: function toUnauthenticated() {\n this._unAuthenticated = true;\n this.removeListener('validate', AWS.EventListeners.Core.VALIDATE_CREDENTIALS);\n this.removeListener('sign', AWS.EventListeners.Core.SIGN);\n return this;\n },\n\n /**\n * @api private\n */\n toGet: function toGet() {\n if (this.service.api.protocol === 'query' ||\n this.service.api.protocol === 'ec2') {\n this.removeListener('build', this.buildAsGet);\n this.addListener('build', this.buildAsGet);\n }\n return this;\n },\n\n /**\n * @api private\n */\n buildAsGet: function buildAsGet(request) {\n request.httpRequest.method = 'GET';\n request.httpRequest.path = request.service.endpoint.path +\n '?' + request.httpRequest.body;\n request.httpRequest.body = '';\n\n // don't need these headers on a GET request\n delete request.httpRequest.headers['Content-Length'];\n delete request.httpRequest.headers['Content-Type'];\n },\n\n /**\n * @api private\n */\n haltHandlersOnError: function haltHandlersOnError() {\n this._haltHandlersOnError = true;\n }\n});\n\n/**\n * @api private\n */\nAWS.Request.addPromisesToClass = function addPromisesToClass(PromiseDependency) {\n this.prototype.promise = function promise() {\n var self = this;\n // append to user agent\n this.httpRequest.appendToUserAgent('promise');\n return new PromiseDependency(function(resolve, reject) {\n self.on('complete', function(resp) {\n if (resp.error) {\n reject(resp.error);\n } else {\n // define $response property so that it is not enumerable\n // this prevents circular reference errors when stringifying the JSON object\n resolve(Object.defineProperty(\n resp.data || {},\n '$response',\n {value: resp}\n ));\n }\n });\n self.runTo();\n });\n };\n};\n\n/**\n * @api private\n */\nAWS.Request.deletePromisesFromClass = function deletePromisesFromClass() {\n delete this.prototype.promise;\n};\n\nAWS.util.addPromises(AWS.Request);\n\nAWS.util.mixin(AWS.Request, AWS.SequentialExecutor);\n", "var AWS = require('./core');\nvar inherit = AWS.util.inherit;\nvar jmespath = require('jmespath');\n\n/**\n * This class encapsulates the response information\n * from a service request operation sent through {AWS.Request}.\n * The response object has two main properties for getting information\n * back from a request:\n *\n * ## The `data` property\n *\n * The `response.data` property contains the serialized object data\n * retrieved from the service request. For instance, for an\n * Amazon DynamoDB `listTables` method call, the response data might\n * look like:\n *\n * ```\n * > resp.data\n * { TableNames:\n * [ 'table1', 'table2', ... ] }\n * ```\n *\n * The `data` property can be null if an error occurs (see below).\n *\n * ## The `error` property\n *\n * In the event of a service error (or transfer error), the\n * `response.error` property will be filled with the given\n * error data in the form:\n *\n * ```\n * { code: 'SHORT_UNIQUE_ERROR_CODE',\n * message: 'Some human readable error message' }\n * ```\n *\n * In the case of an error, the `data` property will be `null`.\n * Note that if you handle events that can be in a failure state,\n * you should always check whether `response.error` is set\n * before attempting to access the `response.data` property.\n *\n * @!attribute data\n * @readonly\n * @!group Data Properties\n * @note Inside of a {AWS.Request~httpData} event, this\n * property contains a single raw packet instead of the\n * full de-serialized service response.\n * @return [Object] the de-serialized response data\n * from the service.\n *\n * @!attribute error\n * An structure containing information about a service\n * or networking error.\n * @readonly\n * @!group Data Properties\n * @note This attribute is only filled if a service or\n * networking error occurs.\n * @return [Error]\n * * code [String] a unique short code representing the\n * error that was emitted.\n * * message [String] a longer human readable error message\n * * retryable [Boolean] whether the error message is\n * retryable.\n * * statusCode [Numeric] in the case of a request that reached the service,\n * this value contains the response status code.\n * * time [Date] the date time object when the error occurred.\n * * hostname [String] set when a networking error occurs to easily\n * identify the endpoint of the request.\n * * region [String] set when a networking error occurs to easily\n * identify the region of the request.\n *\n * @!attribute requestId\n * @readonly\n * @!group Data Properties\n * @return [String] the unique request ID associated with the response.\n * Log this value when debugging requests for AWS support.\n *\n * @!attribute retryCount\n * @readonly\n * @!group Operation Properties\n * @return [Integer] the number of retries that were\n * attempted before the request was completed.\n *\n * @!attribute redirectCount\n * @readonly\n * @!group Operation Properties\n * @return [Integer] the number of redirects that were\n * followed before the request was completed.\n *\n * @!attribute httpResponse\n * @readonly\n * @!group HTTP Properties\n * @return [AWS.HttpResponse] the raw HTTP response object\n * containing the response headers and body information\n * from the server.\n *\n * @see AWS.Request\n */\nAWS.Response = inherit({\n\n /**\n * @api private\n */\n constructor: function Response(request) {\n this.request = request;\n this.data = null;\n this.error = null;\n this.retryCount = 0;\n this.redirectCount = 0;\n this.httpResponse = new AWS.HttpResponse();\n if (request) {\n this.maxRetries = request.service.numRetries();\n this.maxRedirects = request.service.config.maxRedirects;\n }\n },\n\n /**\n * Creates a new request for the next page of response data, calling the\n * callback with the page data if a callback is provided.\n *\n * @callback callback function(err, data)\n * Called when a page of data is returned from the next request.\n *\n * @param err [Error] an error object, if an error occurred in the request\n * @param data [Object] the next page of data, or null, if there are no\n * more pages left.\n * @return [AWS.Request] the request object for the next page of data\n * @return [null] if no callback is provided and there are no pages left\n * to retrieve.\n * @since v1.4.0\n */\n nextPage: function nextPage(callback) {\n var config;\n var service = this.request.service;\n var operation = this.request.operation;\n try {\n config = service.paginationConfig(operation, true);\n } catch (e) { this.error = e; }\n\n if (!this.hasNextPage()) {\n if (callback) callback(this.error, null);\n else if (this.error) throw this.error;\n return null;\n }\n\n var params = AWS.util.copy(this.request.params);\n if (!this.nextPageTokens) {\n return callback ? callback(null, null) : null;\n } else {\n var inputTokens = config.inputToken;\n if (typeof inputTokens === 'string') inputTokens = [inputTokens];\n for (var i = 0; i < inputTokens.length; i++) {\n params[inputTokens[i]] = this.nextPageTokens[i];\n }\n return service.makeRequest(this.request.operation, params, callback);\n }\n },\n\n /**\n * @return [Boolean] whether more pages of data can be returned by further\n * requests\n * @since v1.4.0\n */\n hasNextPage: function hasNextPage() {\n this.cacheNextPageTokens();\n if (this.nextPageTokens) return true;\n if (this.nextPageTokens === undefined) return undefined;\n else return false;\n },\n\n /**\n * @api private\n */\n cacheNextPageTokens: function cacheNextPageTokens() {\n if (Object.prototype.hasOwnProperty.call(this, 'nextPageTokens')) return this.nextPageTokens;\n this.nextPageTokens = undefined;\n\n var config = this.request.service.paginationConfig(this.request.operation);\n if (!config) return this.nextPageTokens;\n\n this.nextPageTokens = null;\n if (config.moreResults) {\n if (!jmespath.search(this.data, config.moreResults)) {\n return this.nextPageTokens;\n }\n }\n\n var exprs = config.outputToken;\n if (typeof exprs === 'string') exprs = [exprs];\n AWS.util.arrayEach.call(this, exprs, function (expr) {\n var output = jmespath.search(this.data, expr);\n if (output) {\n this.nextPageTokens = this.nextPageTokens || [];\n this.nextPageTokens.push(output);\n }\n });\n\n return this.nextPageTokens;\n }\n\n});\n", "/**\n * Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You\n * may not use this file except in compliance with the License. A copy of\n * the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific\n * language governing permissions and limitations under the License.\n */\n\nvar AWS = require('./core');\nvar inherit = AWS.util.inherit;\nvar jmespath = require('jmespath');\n\n/**\n * @api private\n */\nfunction CHECK_ACCEPTORS(resp) {\n var waiter = resp.request._waiter;\n var acceptors = waiter.config.acceptors;\n var acceptorMatched = false;\n var state = 'retry';\n\n acceptors.forEach(function(acceptor) {\n if (!acceptorMatched) {\n var matcher = waiter.matchers[acceptor.matcher];\n if (matcher && matcher(resp, acceptor.expected, acceptor.argument)) {\n acceptorMatched = true;\n state = acceptor.state;\n }\n }\n });\n\n if (!acceptorMatched && resp.error) state = 'failure';\n\n if (state === 'success') {\n waiter.setSuccess(resp);\n } else {\n waiter.setError(resp, state === 'retry');\n }\n}\n\n/**\n * @api private\n */\nAWS.ResourceWaiter = inherit({\n /**\n * Waits for a given state on a service object\n * @param service [Service] the service object to wait on\n * @param state [String] the state (defined in waiter configuration) to wait\n * for.\n * @example Create a waiter for running EC2 instances\n * var ec2 = new AWS.EC2;\n * var waiter = new AWS.ResourceWaiter(ec2, 'instanceRunning');\n */\n constructor: function constructor(service, state) {\n this.service = service;\n this.state = state;\n this.loadWaiterConfig(this.state);\n },\n\n service: null,\n\n state: null,\n\n config: null,\n\n matchers: {\n path: function(resp, expected, argument) {\n try {\n var result = jmespath.search(resp.data, argument);\n } catch (err) {\n return false;\n }\n\n return jmespath.strictDeepEqual(result,expected);\n },\n\n pathAll: function(resp, expected, argument) {\n try {\n var results = jmespath.search(resp.data, argument);\n } catch (err) {\n return false;\n }\n\n if (!Array.isArray(results)) results = [results];\n var numResults = results.length;\n if (!numResults) return false;\n for (var ind = 0 ; ind < numResults; ind++) {\n if (!jmespath.strictDeepEqual(results[ind], expected)) {\n return false;\n }\n }\n return true;\n },\n\n pathAny: function(resp, expected, argument) {\n try {\n var results = jmespath.search(resp.data, argument);\n } catch (err) {\n return false;\n }\n\n if (!Array.isArray(results)) results = [results];\n var numResults = results.length;\n for (var ind = 0 ; ind < numResults; ind++) {\n if (jmespath.strictDeepEqual(results[ind], expected)) {\n return true;\n }\n }\n return false;\n },\n\n status: function(resp, expected) {\n var statusCode = resp.httpResponse.statusCode;\n return (typeof statusCode === 'number') && (statusCode === expected);\n },\n\n error: function(resp, expected) {\n if (typeof expected === 'string' && resp.error) {\n return expected === resp.error.code;\n }\n // if expected is not string, can be boolean indicating presence of error\n return expected === !!resp.error;\n }\n },\n\n listeners: new AWS.SequentialExecutor().addNamedListeners(function(add) {\n add('RETRY_CHECK', 'retry', function(resp) {\n var waiter = resp.request._waiter;\n if (resp.error && resp.error.code === 'ResourceNotReady') {\n resp.error.retryDelay = (waiter.config.delay || 0) * 1000;\n }\n });\n\n add('CHECK_OUTPUT', 'extractData', CHECK_ACCEPTORS);\n\n add('CHECK_ERROR', 'extractError', CHECK_ACCEPTORS);\n }),\n\n /**\n * @return [AWS.Request]\n */\n wait: function wait(params, callback) {\n if (typeof params === 'function') {\n callback = params; params = undefined;\n }\n\n if (params && params.$waiter) {\n params = AWS.util.copy(params);\n if (typeof params.$waiter.delay === 'number') {\n this.config.delay = params.$waiter.delay;\n }\n if (typeof params.$waiter.maxAttempts === 'number') {\n this.config.maxAttempts = params.$waiter.maxAttempts;\n }\n delete params.$waiter;\n }\n\n var request = this.service.makeRequest(this.config.operation, params);\n request._waiter = this;\n request.response.maxRetries = this.config.maxAttempts;\n request.addListeners(this.listeners);\n\n if (callback) request.send(callback);\n return request;\n },\n\n setSuccess: function setSuccess(resp) {\n resp.error = null;\n resp.data = resp.data || {};\n resp.request.removeAllListeners('extractData');\n },\n\n setError: function setError(resp, retryable) {\n resp.data = null;\n resp.error = AWS.util.error(resp.error || new Error(), {\n code: 'ResourceNotReady',\n message: 'Resource is not in the state ' + this.state,\n retryable: retryable\n });\n },\n\n /**\n * Loads waiter configuration from API configuration\n *\n * @api private\n */\n loadWaiterConfig: function loadWaiterConfig(state) {\n if (!this.service.api.waiters[state]) {\n throw new AWS.util.error(new Error(), {\n code: 'StateNotFoundError',\n message: 'State ' + state + ' not found.'\n });\n }\n\n this.config = AWS.util.copy(this.service.api.waiters[state]);\n }\n});\n", "var AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n/**\n * @api private\n */\nAWS.Signers.V2 = inherit(AWS.Signers.RequestSigner, {\n addAuthorization: function addAuthorization(credentials, date) {\n\n if (!date) date = AWS.util.date.getDate();\n\n var r = this.request;\n\n r.params.Timestamp = AWS.util.date.iso8601(date);\n r.params.SignatureVersion = '2';\n r.params.SignatureMethod = 'HmacSHA256';\n r.params.AWSAccessKeyId = credentials.accessKeyId;\n\n if (credentials.sessionToken) {\n r.params.SecurityToken = credentials.sessionToken;\n }\n\n delete r.params.Signature; // delete old Signature for re-signing\n r.params.Signature = this.signature(credentials);\n\n r.body = AWS.util.queryParamsToString(r.params);\n r.headers['Content-Length'] = r.body.length;\n },\n\n signature: function signature(credentials) {\n return AWS.util.crypto.hmac(credentials.secretAccessKey, this.stringToSign(), 'base64');\n },\n\n stringToSign: function stringToSign() {\n var parts = [];\n parts.push(this.request.method);\n parts.push(this.request.endpoint.host.toLowerCase());\n parts.push(this.request.pathname());\n parts.push(AWS.util.queryParamsToString(this.request.params));\n return parts.join('\\n');\n }\n\n});\n\n/**\n * @api private\n */\nmodule.exports = AWS.Signers.V2;\n", "var AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n/**\n * @api private\n */\nAWS.Signers.V3 = inherit(AWS.Signers.RequestSigner, {\n addAuthorization: function addAuthorization(credentials, date) {\n\n var datetime = AWS.util.date.rfc822(date);\n\n this.request.headers['X-Amz-Date'] = datetime;\n\n if (credentials.sessionToken) {\n this.request.headers['x-amz-security-token'] = credentials.sessionToken;\n }\n\n this.request.headers['X-Amzn-Authorization'] =\n this.authorization(credentials, datetime);\n\n },\n\n authorization: function authorization(credentials) {\n return 'AWS3 ' +\n 'AWSAccessKeyId=' + credentials.accessKeyId + ',' +\n 'Algorithm=HmacSHA256,' +\n 'SignedHeaders=' + this.signedHeaders() + ',' +\n 'Signature=' + this.signature(credentials);\n },\n\n signedHeaders: function signedHeaders() {\n var headers = [];\n AWS.util.arrayEach(this.headersToSign(), function iterator(h) {\n headers.push(h.toLowerCase());\n });\n return headers.sort().join(';');\n },\n\n canonicalHeaders: function canonicalHeaders() {\n var headers = this.request.headers;\n var parts = [];\n AWS.util.arrayEach(this.headersToSign(), function iterator(h) {\n parts.push(h.toLowerCase().trim() + ':' + String(headers[h]).trim());\n });\n return parts.sort().join('\\n') + '\\n';\n },\n\n headersToSign: function headersToSign() {\n var headers = [];\n AWS.util.each(this.request.headers, function iterator(k) {\n if (k === 'Host' || k === 'Content-Encoding' || k.match(/^X-Amz/i)) {\n headers.push(k);\n }\n });\n return headers;\n },\n\n signature: function signature(credentials) {\n return AWS.util.crypto.hmac(credentials.secretAccessKey, this.stringToSign(), 'base64');\n },\n\n stringToSign: function stringToSign() {\n var parts = [];\n parts.push(this.request.method);\n parts.push('/');\n parts.push('');\n parts.push(this.canonicalHeaders());\n parts.push(this.request.body);\n return AWS.util.crypto.sha256(parts.join('\\n'));\n }\n\n});\n\n/**\n * @api private\n */\nmodule.exports = AWS.Signers.V3;\n", "var AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\nrequire('./v3');\n\n/**\n * @api private\n */\nAWS.Signers.V3Https = inherit(AWS.Signers.V3, {\n authorization: function authorization(credentials) {\n return 'AWS3-HTTPS ' +\n 'AWSAccessKeyId=' + credentials.accessKeyId + ',' +\n 'Algorithm=HmacSHA256,' +\n 'Signature=' + this.signature(credentials);\n },\n\n stringToSign: function stringToSign() {\n return this.request.headers['X-Amz-Date'];\n }\n});\n\n/**\n * @api private\n */\nmodule.exports = AWS.Signers.V3Https;\n", "var AWS = require('../core');\n\n/**\n * @api private\n */\nvar cachedSecret = {};\n\n/**\n * @api private\n */\nvar cacheQueue = [];\n\n/**\n * @api private\n */\nvar maxCacheEntries = 50;\n\n/**\n * @api private\n */\nvar v4Identifier = 'aws4_request';\n\n/**\n * @api private\n */\nmodule.exports = {\n /**\n * @api private\n *\n * @param date [String]\n * @param region [String]\n * @param serviceName [String]\n * @return [String]\n */\n createScope: function createScope(date, region, serviceName) {\n return [\n date.substr(0, 8),\n region,\n serviceName,\n v4Identifier\n ].join('/');\n },\n\n /**\n * @api private\n *\n * @param credentials [Credentials]\n * @param date [String]\n * @param region [String]\n * @param service [String]\n * @param shouldCache [Boolean]\n * @return [String]\n */\n getSigningKey: function getSigningKey(\n credentials,\n date,\n region,\n service,\n shouldCache\n ) {\n var credsIdentifier = AWS.util.crypto\n .hmac(credentials.secretAccessKey, credentials.accessKeyId, 'base64');\n var cacheKey = [credsIdentifier, date, region, service].join('_');\n shouldCache = shouldCache !== false;\n if (shouldCache && (cacheKey in cachedSecret)) {\n return cachedSecret[cacheKey];\n }\n\n var kDate = AWS.util.crypto.hmac(\n 'AWS4' + credentials.secretAccessKey,\n date,\n 'buffer'\n );\n var kRegion = AWS.util.crypto.hmac(kDate, region, 'buffer');\n var kService = AWS.util.crypto.hmac(kRegion, service, 'buffer');\n\n var signingKey = AWS.util.crypto.hmac(kService, v4Identifier, 'buffer');\n if (shouldCache) {\n cachedSecret[cacheKey] = signingKey;\n cacheQueue.push(cacheKey);\n if (cacheQueue.length > maxCacheEntries) {\n // remove the oldest entry (not the least recently used)\n delete cachedSecret[cacheQueue.shift()];\n }\n }\n\n return signingKey;\n },\n\n /**\n * @api private\n *\n * Empties the derived signing key cache. Made available for testing purposes\n * only.\n */\n emptyCache: function emptyCache() {\n cachedSecret = {};\n cacheQueue = [];\n }\n};\n", "var AWS = require('../core');\nvar v4Credentials = require('./v4_credentials');\nvar inherit = AWS.util.inherit;\n\n/**\n * @api private\n */\nvar expiresHeader = 'presigned-expires';\n\n/**\n * @api private\n */\nAWS.Signers.V4 = inherit(AWS.Signers.RequestSigner, {\n constructor: function V4(request, serviceName, options) {\n AWS.Signers.RequestSigner.call(this, request);\n this.serviceName = serviceName;\n options = options || {};\n this.signatureCache = typeof options.signatureCache === 'boolean' ? options.signatureCache : true;\n this.operation = options.operation;\n this.signatureVersion = options.signatureVersion;\n },\n\n algorithm: 'AWS4-HMAC-SHA256',\n\n addAuthorization: function addAuthorization(credentials, date) {\n var datetime = AWS.util.date.iso8601(date).replace(/[:\\-]|\\.\\d{3}/g, '');\n\n if (this.isPresigned()) {\n this.updateForPresigned(credentials, datetime);\n } else {\n this.addHeaders(credentials, datetime);\n }\n\n this.request.headers['Authorization'] =\n this.authorization(credentials, datetime);\n },\n\n addHeaders: function addHeaders(credentials, datetime) {\n this.request.headers['X-Amz-Date'] = datetime;\n if (credentials.sessionToken) {\n this.request.headers['x-amz-security-token'] = credentials.sessionToken;\n }\n },\n\n updateForPresigned: function updateForPresigned(credentials, datetime) {\n var credString = this.credentialString(datetime);\n var qs = {\n 'X-Amz-Date': datetime,\n 'X-Amz-Algorithm': this.algorithm,\n 'X-Amz-Credential': credentials.accessKeyId + '/' + credString,\n 'X-Amz-Expires': this.request.headers[expiresHeader],\n 'X-Amz-SignedHeaders': this.signedHeaders()\n };\n\n if (credentials.sessionToken) {\n qs['X-Amz-Security-Token'] = credentials.sessionToken;\n }\n\n if (this.request.headers['Content-Type']) {\n qs['Content-Type'] = this.request.headers['Content-Type'];\n }\n if (this.request.headers['Content-MD5']) {\n qs['Content-MD5'] = this.request.headers['Content-MD5'];\n }\n if (this.request.headers['Cache-Control']) {\n qs['Cache-Control'] = this.request.headers['Cache-Control'];\n }\n\n // need to pull in any other X-Amz-* headers\n AWS.util.each.call(this, this.request.headers, function(key, value) {\n if (key === expiresHeader) return;\n if (this.isSignableHeader(key)) {\n var lowerKey = key.toLowerCase();\n // Metadata should be normalized\n if (lowerKey.indexOf('x-amz-meta-') === 0) {\n qs[lowerKey] = value;\n } else if (lowerKey.indexOf('x-amz-') === 0) {\n qs[key] = value;\n }\n }\n });\n\n var sep = this.request.path.indexOf('?') >= 0 ? '&' : '?';\n this.request.path += sep + AWS.util.queryParamsToString(qs);\n },\n\n authorization: function authorization(credentials, datetime) {\n var parts = [];\n var credString = this.credentialString(datetime);\n parts.push(this.algorithm + ' Credential=' +\n credentials.accessKeyId + '/' + credString);\n parts.push('SignedHeaders=' + this.signedHeaders());\n parts.push('Signature=' + this.signature(credentials, datetime));\n return parts.join(', ');\n },\n\n signature: function signature(credentials, datetime) {\n var signingKey = v4Credentials.getSigningKey(\n credentials,\n datetime.substr(0, 8),\n this.request.region,\n this.serviceName,\n this.signatureCache\n );\n return AWS.util.crypto.hmac(signingKey, this.stringToSign(datetime), 'hex');\n },\n\n stringToSign: function stringToSign(datetime) {\n var parts = [];\n parts.push('AWS4-HMAC-SHA256');\n parts.push(datetime);\n parts.push(this.credentialString(datetime));\n parts.push(this.hexEncodedHash(this.canonicalString()));\n return parts.join('\\n');\n },\n\n canonicalString: function canonicalString() {\n var parts = [], pathname = this.request.pathname();\n if (this.serviceName !== 's3' && this.signatureVersion !== 's3v4') pathname = AWS.util.uriEscapePath(pathname);\n\n parts.push(this.request.method);\n parts.push(pathname);\n parts.push(this.request.search());\n parts.push(this.canonicalHeaders() + '\\n');\n parts.push(this.signedHeaders());\n parts.push(this.hexEncodedBodyHash());\n return parts.join('\\n');\n },\n\n canonicalHeaders: function canonicalHeaders() {\n var headers = [];\n AWS.util.each.call(this, this.request.headers, function (key, item) {\n headers.push([key, item]);\n });\n headers.sort(function (a, b) {\n return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1;\n });\n var parts = [];\n AWS.util.arrayEach.call(this, headers, function (item) {\n var key = item[0].toLowerCase();\n if (this.isSignableHeader(key)) {\n var value = item[1];\n if (typeof value === 'undefined' || value === null || typeof value.toString !== 'function') {\n throw AWS.util.error(new Error('Header ' + key + ' contains invalid value'), {\n code: 'InvalidHeader'\n });\n }\n parts.push(key + ':' +\n this.canonicalHeaderValues(value.toString()));\n }\n });\n return parts.join('\\n');\n },\n\n canonicalHeaderValues: function canonicalHeaderValues(values) {\n return values.replace(/\\s+/g, ' ').replace(/^\\s+|\\s+$/g, '');\n },\n\n signedHeaders: function signedHeaders() {\n var keys = [];\n AWS.util.each.call(this, this.request.headers, function (key) {\n key = key.toLowerCase();\n if (this.isSignableHeader(key)) keys.push(key);\n });\n return keys.sort().join(';');\n },\n\n credentialString: function credentialString(datetime) {\n return v4Credentials.createScope(\n datetime.substr(0, 8),\n this.request.region,\n this.serviceName\n );\n },\n\n hexEncodedHash: function hash(string) {\n return AWS.util.crypto.sha256(string, 'hex');\n },\n\n hexEncodedBodyHash: function hexEncodedBodyHash() {\n var request = this.request;\n if (this.isPresigned() && (['s3', 's3-object-lambda'].indexOf(this.serviceName) > -1) && !request.body) {\n return 'UNSIGNED-PAYLOAD';\n } else if (request.headers['X-Amz-Content-Sha256']) {\n return request.headers['X-Amz-Content-Sha256'];\n } else {\n return this.hexEncodedHash(this.request.body || '');\n }\n },\n\n unsignableHeaders: [\n 'authorization',\n 'content-type',\n 'content-length',\n 'user-agent',\n expiresHeader,\n 'expect',\n 'x-amzn-trace-id'\n ],\n\n isSignableHeader: function isSignableHeader(key) {\n if (key.toLowerCase().indexOf('x-amz-') === 0) return true;\n return this.unsignableHeaders.indexOf(key) < 0;\n },\n\n isPresigned: function isPresigned() {\n return this.request.headers[expiresHeader] ? true : false;\n }\n\n});\n\n/**\n * @api private\n */\nmodule.exports = AWS.Signers.V4;\n", "var AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n/**\n * @api private\n */\nAWS.Signers.S3 = inherit(AWS.Signers.RequestSigner, {\n /**\n * When building the stringToSign, these sub resource params should be\n * part of the canonical resource string with their NON-decoded values\n */\n subResources: {\n 'acl': 1,\n 'accelerate': 1,\n 'analytics': 1,\n 'cors': 1,\n 'lifecycle': 1,\n 'delete': 1,\n 'inventory': 1,\n 'location': 1,\n 'logging': 1,\n 'metrics': 1,\n 'notification': 1,\n 'partNumber': 1,\n 'policy': 1,\n 'requestPayment': 1,\n 'replication': 1,\n 'restore': 1,\n 'tagging': 1,\n 'torrent': 1,\n 'uploadId': 1,\n 'uploads': 1,\n 'versionId': 1,\n 'versioning': 1,\n 'versions': 1,\n 'website': 1\n },\n\n // when building the stringToSign, these querystring params should be\n // part of the canonical resource string with their NON-encoded values\n responseHeaders: {\n 'response-content-type': 1,\n 'response-content-language': 1,\n 'response-expires': 1,\n 'response-cache-control': 1,\n 'response-content-disposition': 1,\n 'response-content-encoding': 1\n },\n\n addAuthorization: function addAuthorization(credentials, date) {\n if (!this.request.headers['presigned-expires']) {\n this.request.headers['X-Amz-Date'] = AWS.util.date.rfc822(date);\n }\n\n if (credentials.sessionToken) {\n // presigned URLs require this header to be lowercased\n this.request.headers['x-amz-security-token'] = credentials.sessionToken;\n }\n\n var signature = this.sign(credentials.secretAccessKey, this.stringToSign());\n var auth = 'AWS ' + credentials.accessKeyId + ':' + signature;\n\n this.request.headers['Authorization'] = auth;\n },\n\n stringToSign: function stringToSign() {\n var r = this.request;\n\n var parts = [];\n parts.push(r.method);\n parts.push(r.headers['Content-MD5'] || '');\n parts.push(r.headers['Content-Type'] || '');\n\n // This is the \"Date\" header, but we use X-Amz-Date.\n // The S3 signing mechanism requires us to pass an empty\n // string for this Date header regardless.\n parts.push(r.headers['presigned-expires'] || '');\n\n var headers = this.canonicalizedAmzHeaders();\n if (headers) parts.push(headers);\n parts.push(this.canonicalizedResource());\n\n return parts.join('\\n');\n\n },\n\n canonicalizedAmzHeaders: function canonicalizedAmzHeaders() {\n\n var amzHeaders = [];\n\n AWS.util.each(this.request.headers, function (name) {\n if (name.match(/^x-amz-/i))\n amzHeaders.push(name);\n });\n\n amzHeaders.sort(function (a, b) {\n return a.toLowerCase() < b.toLowerCase() ? -1 : 1;\n });\n\n var parts = [];\n AWS.util.arrayEach.call(this, amzHeaders, function (name) {\n parts.push(name.toLowerCase() + ':' + String(this.request.headers[name]));\n });\n\n return parts.join('\\n');\n\n },\n\n canonicalizedResource: function canonicalizedResource() {\n\n var r = this.request;\n\n var parts = r.path.split('?');\n var path = parts[0];\n var querystring = parts[1];\n\n var resource = '';\n\n if (r.virtualHostedBucket)\n resource += '/' + r.virtualHostedBucket;\n\n resource += path;\n\n if (querystring) {\n\n // collect a list of sub resources and query params that need to be signed\n var resources = [];\n\n AWS.util.arrayEach.call(this, querystring.split('&'), function (param) {\n var name = param.split('=')[0];\n var value = param.split('=')[1];\n if (this.subResources[name] || this.responseHeaders[name]) {\n var subresource = { name: name };\n if (value !== undefined) {\n if (this.subResources[name]) {\n subresource.value = value;\n } else {\n subresource.value = decodeURIComponent(value);\n }\n }\n resources.push(subresource);\n }\n });\n\n resources.sort(function (a, b) { return a.name < b.name ? -1 : 1; });\n\n if (resources.length) {\n\n querystring = [];\n AWS.util.arrayEach(resources, function (res) {\n if (res.value === undefined) {\n querystring.push(res.name);\n } else {\n querystring.push(res.name + '=' + res.value);\n }\n });\n\n resource += '?' + querystring.join('&');\n }\n\n }\n\n return resource;\n\n },\n\n sign: function sign(secret, string) {\n return AWS.util.crypto.hmac(secret, string, 'base64', 'sha1');\n }\n});\n\n/**\n * @api private\n */\nmodule.exports = AWS.Signers.S3;\n", "var AWS = require('../core');\nvar inherit = AWS.util.inherit;\n\n/**\n * @api private\n */\nvar expiresHeader = 'presigned-expires';\n\n/**\n * @api private\n */\nfunction signedUrlBuilder(request) {\n var expires = request.httpRequest.headers[expiresHeader];\n var signerClass = request.service.getSignerClass(request);\n\n delete request.httpRequest.headers['User-Agent'];\n delete request.httpRequest.headers['X-Amz-User-Agent'];\n\n if (signerClass === AWS.Signers.V4) {\n if (expires > 604800) { // one week expiry is invalid\n var message = 'Presigning does not support expiry time greater ' +\n 'than a week with SigV4 signing.';\n throw AWS.util.error(new Error(), {\n code: 'InvalidExpiryTime', message: message, retryable: false\n });\n }\n request.httpRequest.headers[expiresHeader] = expires;\n } else if (signerClass === AWS.Signers.S3) {\n var now = request.service ? request.service.getSkewCorrectedDate() : AWS.util.date.getDate();\n request.httpRequest.headers[expiresHeader] = parseInt(\n AWS.util.date.unixTimestamp(now) + expires, 10).toString();\n } else {\n throw AWS.util.error(new Error(), {\n message: 'Presigning only supports S3 or SigV4 signing.',\n code: 'UnsupportedSigner', retryable: false\n });\n }\n}\n\n/**\n * @api private\n */\nfunction signedUrlSigner(request) {\n var endpoint = request.httpRequest.endpoint;\n var parsedUrl = AWS.util.urlParse(request.httpRequest.path);\n var queryParams = {};\n\n if (parsedUrl.search) {\n queryParams = AWS.util.queryStringParse(parsedUrl.search.substr(1));\n }\n\n var auth = request.httpRequest.headers['Authorization'].split(' ');\n if (auth[0] === 'AWS') {\n auth = auth[1].split(':');\n queryParams['Signature'] = auth.pop();\n queryParams['AWSAccessKeyId'] = auth.join(':');\n\n AWS.util.each(request.httpRequest.headers, function (key, value) {\n if (key === expiresHeader) key = 'Expires';\n if (key.indexOf('x-amz-meta-') === 0) {\n // Delete existing, potentially not normalized key\n delete queryParams[key];\n key = key.toLowerCase();\n }\n queryParams[key] = value;\n });\n delete request.httpRequest.headers[expiresHeader];\n delete queryParams['Authorization'];\n delete queryParams['Host'];\n } else if (auth[0] === 'AWS4-HMAC-SHA256') { // SigV4 signing\n auth.shift();\n var rest = auth.join(' ');\n var signature = rest.match(/Signature=(.*?)(?:,|\\s|\\r?\\n|$)/)[1];\n queryParams['X-Amz-Signature'] = signature;\n delete queryParams['Expires'];\n }\n\n // build URL\n endpoint.pathname = parsedUrl.pathname;\n endpoint.search = AWS.util.queryParamsToString(queryParams);\n}\n\n/**\n * @api private\n */\nAWS.Signers.Presign = inherit({\n /**\n * @api private\n */\n sign: function sign(request, expireTime, callback) {\n request.httpRequest.headers[expiresHeader] = expireTime || 3600;\n request.on('build', signedUrlBuilder);\n request.on('sign', signedUrlSigner);\n request.removeListener('afterBuild',\n AWS.EventListeners.Core.SET_CONTENT_LENGTH);\n request.removeListener('afterBuild',\n AWS.EventListeners.Core.COMPUTE_SHA256);\n\n request.emit('beforePresign', [request]);\n\n if (callback) {\n request.build(function() {\n if (this.response.error) callback(this.response.error);\n else {\n callback(null, AWS.util.urlFormat(request.httpRequest.endpoint));\n }\n });\n } else {\n request.build();\n if (request.response.error) throw request.response.error;\n return AWS.util.urlFormat(request.httpRequest.endpoint);\n }\n }\n});\n\n/**\n * @api private\n */\nmodule.exports = AWS.Signers.Presign;\n", "var AWS = require('../core');\n\nvar inherit = AWS.util.inherit;\n\n/**\n * @api private\n */\nAWS.Signers.RequestSigner = inherit({\n constructor: function RequestSigner(request) {\n this.request = request;\n },\n\n setServiceClientId: function setServiceClientId(id) {\n this.serviceClientId = id;\n },\n\n getServiceClientId: function getServiceClientId() {\n return this.serviceClientId;\n }\n});\n\nAWS.Signers.RequestSigner.getVersion = function getVersion(version) {\n switch (version) {\n case 'v2': return AWS.Signers.V2;\n case 'v3': return AWS.Signers.V3;\n case 's3v4': return AWS.Signers.V4;\n case 'v4': return AWS.Signers.V4;\n case 's3': return AWS.Signers.S3;\n case 'v3https': return AWS.Signers.V3Https;\n }\n throw new Error('Unknown signing version ' + version);\n};\n\nrequire('./v2');\nrequire('./v3');\nrequire('./v3https');\nrequire('./v4');\nrequire('./s3');\nrequire('./presign');\n", "var AWS = require('./core');\n\n/**\n * @api private\n */\nAWS.ParamValidator = AWS.util.inherit({\n /**\n * Create a new validator object.\n *\n * @param validation [Boolean|map] whether input parameters should be\n * validated against the operation description before sending the\n * request. Pass a map to enable any of the following specific\n * validation features:\n *\n * * **min** [Boolean] — Validates that a value meets the min\n * constraint. This is enabled by default when paramValidation is set\n * to `true`.\n * * **max** [Boolean] — Validates that a value meets the max\n * constraint.\n * * **pattern** [Boolean] — Validates that a string value matches a\n * regular expression.\n * * **enum** [Boolean] — Validates that a string value matches one\n * of the allowable enum values.\n */\n constructor: function ParamValidator(validation) {\n if (validation === true || validation === undefined) {\n validation = {'min': true};\n }\n this.validation = validation;\n },\n\n validate: function validate(shape, params, context) {\n this.errors = [];\n this.validateMember(shape, params || {}, context || 'params');\n\n if (this.errors.length > 1) {\n var msg = this.errors.join('\\n* ');\n msg = 'There were ' + this.errors.length +\n ' validation errors:\\n* ' + msg;\n throw AWS.util.error(new Error(msg),\n {code: 'MultipleValidationErrors', errors: this.errors});\n } else if (this.errors.length === 1) {\n throw this.errors[0];\n } else {\n return true;\n }\n },\n\n fail: function fail(code, message) {\n this.errors.push(AWS.util.error(new Error(message), {code: code}));\n },\n\n validateStructure: function validateStructure(shape, params, context) {\n if (shape.isDocument) return true;\n\n this.validateType(params, context, ['object'], 'structure');\n var paramName;\n for (var i = 0; shape.required && i < shape.required.length; i++) {\n paramName = shape.required[i];\n var value = params[paramName];\n if (value === undefined || value === null) {\n this.fail('MissingRequiredParameter',\n 'Missing required key \\'' + paramName + '\\' in ' + context);\n }\n }\n\n // validate hash members\n for (paramName in params) {\n if (!Object.prototype.hasOwnProperty.call(params, paramName)) continue;\n\n var paramValue = params[paramName],\n memberShape = shape.members[paramName];\n\n if (memberShape !== undefined) {\n var memberContext = [context, paramName].join('.');\n this.validateMember(memberShape, paramValue, memberContext);\n } else if (paramValue !== undefined && paramValue !== null) {\n this.fail('UnexpectedParameter',\n 'Unexpected key \\'' + paramName + '\\' found in ' + context);\n }\n }\n\n return true;\n },\n\n validateMember: function validateMember(shape, param, context) {\n switch (shape.type) {\n case 'structure':\n return this.validateStructure(shape, param, context);\n case 'list':\n return this.validateList(shape, param, context);\n case 'map':\n return this.validateMap(shape, param, context);\n default:\n return this.validateScalar(shape, param, context);\n }\n },\n\n validateList: function validateList(shape, params, context) {\n if (this.validateType(params, context, [Array])) {\n this.validateRange(shape, params.length, context, 'list member count');\n // validate array members\n for (var i = 0; i < params.length; i++) {\n this.validateMember(shape.member, params[i], context + '[' + i + ']');\n }\n }\n },\n\n validateMap: function validateMap(shape, params, context) {\n if (this.validateType(params, context, ['object'], 'map')) {\n // Build up a count of map members to validate range traits.\n var mapCount = 0;\n for (var param in params) {\n if (!Object.prototype.hasOwnProperty.call(params, param)) continue;\n // Validate any map key trait constraints\n this.validateMember(shape.key, param,\n context + '[key=\\'' + param + '\\']');\n this.validateMember(shape.value, params[param],\n context + '[\\'' + param + '\\']');\n mapCount++;\n }\n this.validateRange(shape, mapCount, context, 'map member count');\n }\n },\n\n validateScalar: function validateScalar(shape, value, context) {\n switch (shape.type) {\n case null:\n case undefined:\n case 'string':\n return this.validateString(shape, value, context);\n case 'base64':\n case 'binary':\n return this.validatePayload(value, context);\n case 'integer':\n case 'float':\n return this.validateNumber(shape, value, context);\n case 'boolean':\n return this.validateType(value, context, ['boolean']);\n case 'timestamp':\n return this.validateType(value, context, [Date,\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$/, 'number'],\n 'Date object, ISO-8601 string, or a UNIX timestamp');\n default:\n return this.fail('UnkownType', 'Unhandled type ' +\n shape.type + ' for ' + context);\n }\n },\n\n validateString: function validateString(shape, value, context) {\n var validTypes = ['string'];\n if (shape.isJsonValue) {\n validTypes = validTypes.concat(['number', 'object', 'boolean']);\n }\n if (value !== null && this.validateType(value, context, validTypes)) {\n this.validateEnum(shape, value, context);\n this.validateRange(shape, value.length, context, 'string length');\n this.validatePattern(shape, value, context);\n this.validateUri(shape, value, context);\n }\n },\n\n validateUri: function validateUri(shape, value, context) {\n if (shape['location'] === 'uri') {\n if (value.length === 0) {\n this.fail('UriParameterError', 'Expected uri parameter to have length >= 1,'\n + ' but found \"' + value +'\" for ' + context);\n }\n }\n },\n\n validatePattern: function validatePattern(shape, value, context) {\n if (this.validation['pattern'] && shape['pattern'] !== undefined) {\n if (!(new RegExp(shape['pattern'])).test(value)) {\n this.fail('PatternMatchError', 'Provided value \"' + value + '\" '\n + 'does not match regex pattern /' + shape['pattern'] + '/ for '\n + context);\n }\n }\n },\n\n validateRange: function validateRange(shape, value, context, descriptor) {\n if (this.validation['min']) {\n if (shape['min'] !== undefined && value < shape['min']) {\n this.fail('MinRangeError', 'Expected ' + descriptor + ' >= '\n + shape['min'] + ', but found ' + value + ' for ' + context);\n }\n }\n if (this.validation['max']) {\n if (shape['max'] !== undefined && value > shape['max']) {\n this.fail('MaxRangeError', 'Expected ' + descriptor + ' <= '\n + shape['max'] + ', but found ' + value + ' for ' + context);\n }\n }\n },\n\n validateEnum: function validateRange(shape, value, context) {\n if (this.validation['enum'] && shape['enum'] !== undefined) {\n // Fail if the string value is not present in the enum list\n if (shape['enum'].indexOf(value) === -1) {\n this.fail('EnumError', 'Found string value of ' + value + ', but '\n + 'expected ' + shape['enum'].join('|') + ' for ' + context);\n }\n }\n },\n\n validateType: function validateType(value, context, acceptedTypes, type) {\n // We will not log an error for null or undefined, but we will return\n // false so that callers know that the expected type was not strictly met.\n if (value === null || value === undefined) return false;\n\n var foundInvalidType = false;\n for (var i = 0; i < acceptedTypes.length; i++) {\n if (typeof acceptedTypes[i] === 'string') {\n if (typeof value === acceptedTypes[i]) return true;\n } else if (acceptedTypes[i] instanceof RegExp) {\n if ((value || '').toString().match(acceptedTypes[i])) return true;\n } else {\n if (value instanceof acceptedTypes[i]) return true;\n if (AWS.util.isType(value, acceptedTypes[i])) return true;\n if (!type && !foundInvalidType) acceptedTypes = acceptedTypes.slice();\n acceptedTypes[i] = AWS.util.typeName(acceptedTypes[i]);\n }\n foundInvalidType = true;\n }\n\n var acceptedType = type;\n if (!acceptedType) {\n acceptedType = acceptedTypes.join(', ').replace(/,([^,]+)$/, ', or$1');\n }\n\n var vowel = acceptedType.match(/^[aeiou]/i) ? 'n' : '';\n this.fail('InvalidParameterType', 'Expected ' + context + ' to be a' +\n vowel + ' ' + acceptedType);\n return false;\n },\n\n validateNumber: function validateNumber(shape, value, context) {\n if (value === null || value === undefined) return;\n if (typeof value === 'string') {\n var castedValue = parseFloat(value);\n if (castedValue.toString() === value) value = castedValue;\n }\n if (this.validateType(value, context, ['number'])) {\n this.validateRange(shape, value, context, 'numeric value');\n }\n },\n\n validatePayload: function validatePayload(value, context) {\n if (value === null || value === undefined) return;\n if (typeof value === 'string') return;\n if (value && typeof value.byteLength === 'number') return; // typed arrays\n if (AWS.util.isNode()) { // special check for buffer/stream in Node.js\n var Stream = AWS.util.stream.Stream;\n if (AWS.util.Buffer.isBuffer(value) || value instanceof Stream) return;\n } else {\n if (typeof Blob !== void 0 && value instanceof Blob) return;\n }\n\n var types = ['Buffer', 'Stream', 'File', 'Blob', 'ArrayBuffer', 'DataView'];\n if (value) {\n for (var i = 0; i < types.length; i++) {\n if (AWS.util.isType(value, types[i])) return;\n if (AWS.util.typeName(value.constructor) === types[i]) return;\n }\n }\n\n this.fail('InvalidParameterType', 'Expected ' + context + ' to be a ' +\n 'string, Buffer, Stream, Blob, or typed array object');\n }\n});\n", "/**\n * The main AWS namespace\n */\nvar AWS = { util: require('./util') };\n\n/**\n * @api private\n * @!macro [new] nobrowser\n * @note This feature is not supported in the browser environment of the SDK.\n */\nvar _hidden = {}; _hidden.toString(); // hack to parse macro\n\n/**\n * @api private\n */\nmodule.exports = AWS;\n\nAWS.util.update(AWS, {\n\n /**\n * @constant\n */\n VERSION: '2.1188.0',\n\n /**\n * @api private\n */\n Signers: {},\n\n /**\n * @api private\n */\n Protocol: {\n Json: require('./protocol/json'),\n Query: require('./protocol/query'),\n Rest: require('./protocol/rest'),\n RestJson: require('./protocol/rest_json'),\n RestXml: require('./protocol/rest_xml')\n },\n\n /**\n * @api private\n */\n XML: {\n Builder: require('./xml/builder'),\n Parser: null // conditionally set based on environment\n },\n\n /**\n * @api private\n */\n JSON: {\n Builder: require('./json/builder'),\n Parser: require('./json/parser')\n },\n\n /**\n * @api private\n */\n Model: {\n Api: require('./model/api'),\n Operation: require('./model/operation'),\n Shape: require('./model/shape'),\n Paginator: require('./model/paginator'),\n ResourceWaiter: require('./model/resource_waiter')\n },\n\n /**\n * @api private\n */\n apiLoader: require('./api_loader'),\n\n /**\n * @api private\n */\n EndpointCache: require('../vendor/endpoint-cache').EndpointCache\n});\nrequire('./sequential_executor');\nrequire('./service');\nrequire('./config');\nrequire('./http');\nrequire('./event_listeners');\nrequire('./request');\nrequire('./response');\nrequire('./resource_waiter');\nrequire('./signers/request_signer');\nrequire('./param_validator');\n\n/**\n * @readonly\n * @return [AWS.SequentialExecutor] a collection of global event listeners that\n * are attached to every sent request.\n * @see AWS.Request AWS.Request for a list of events to listen for\n * @example Logging the time taken to send a request\n * AWS.events.on('send', function startSend(resp) {\n * resp.startTime = new Date().getTime();\n * }).on('complete', function calculateTime(resp) {\n * var time = (new Date().getTime() - resp.startTime) / 1000;\n * console.log('Request took ' + time + ' seconds');\n * });\n *\n * new AWS.S3().listBuckets(); // prints 'Request took 0.285 seconds'\n */\nAWS.events = new AWS.SequentialExecutor();\n\n//create endpoint cache lazily\nAWS.util.memoizedProperty(AWS, 'endpointCache', function() {\n return new AWS.EndpointCache(AWS.config.endpointCacheSize);\n}, true);\n", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = rng;\n\nvar _crypto = _interopRequireDefault(require(\"crypto\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction rng() {\n return _crypto.default.randomBytes(16);\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n\n return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');\n}\n\nvar _default = bytesToUuid;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _bytesToUuid = _interopRequireDefault(require(\"./bytesToUuid.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nvar _nodeId;\n\nvar _clockseq; // Previous uuid creation time\n\n\nvar _lastMSecs = 0;\nvar _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n var seedBytes = options.random || (options.rng || _rng.default)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : (0, _bytesToUuid.default)(b);\n}\n\nvar _default = v1;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nexports.URL = exports.DNS = void 0;\n\nvar _bytesToUuid = _interopRequireDefault(require(\"./bytesToUuid.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction uuidToBytes(uuid) {\n // Note: We assume we're being passed a valid uuid string\n var bytes = [];\n uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {\n bytes.push(parseInt(hex, 16));\n });\n return bytes;\n}\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n var bytes = new Array(str.length);\n\n for (var i = 0; i < str.length; i++) {\n bytes[i] = str.charCodeAt(i);\n }\n\n return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction _default(name, version, hashfunc) {\n var generateUUID = function (value, namespace, buf, offset) {\n var off = buf && offset || 0;\n if (typeof value == 'string') value = stringToBytes(value);\n if (typeof namespace == 'string') namespace = uuidToBytes(namespace);\n if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');\n if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); // Per 4.3\n\n var bytes = hashfunc(namespace.concat(value));\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n for (var idx = 0; idx < 16; ++idx) {\n buf[off + idx] = bytes[idx];\n }\n }\n\n return buf || (0, _bytesToUuid.default)(bytes);\n }; // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name;\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _crypto = _interopRequireDefault(require(\"crypto\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction md5(bytes) {\n if (Array.isArray(bytes)) {\n bytes = Buffer.from(bytes);\n } else if (typeof bytes === 'string') {\n bytes = Buffer.from(bytes, 'utf8');\n }\n\n return _crypto.default.createHash('md5').update(bytes).digest();\n}\n\nvar _default = md5;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _bytesToUuid = _interopRequireDefault(require(\"./bytesToUuid.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof options == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n\n options = options || {};\n\n var rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || (0, _bytesToUuid.default)(rnds);\n}\n\nvar _default = v4;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _crypto = _interopRequireDefault(require(\"crypto\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction sha1(bytes) {\n if (Array.isArray(bytes)) {\n bytes = Buffer.from(bytes);\n } else if (typeof bytes === 'string') {\n bytes = Buffer.from(bytes, 'utf8');\n }\n\n return _crypto.default.createHash('sha1').update(bytes).digest();\n}\n\nvar _default = sha1;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _sha = _interopRequireDefault(require(\"./sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports.default = _default;", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"v1\", {\n enumerable: true,\n get: function () {\n return _v.default;\n }\n});\nObject.defineProperty(exports, \"v3\", {\n enumerable: true,\n get: function () {\n return _v2.default;\n }\n});\nObject.defineProperty(exports, \"v4\", {\n enumerable: true,\n get: function () {\n return _v3.default;\n }\n});\nObject.defineProperty(exports, \"v5\", {\n enumerable: true,\n get: function () {\n return _v4.default;\n }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }", "/* eslint guard-for-in:0 */\nvar AWS;\n\n/**\n * A set of utility methods for use with the AWS SDK.\n *\n * @!attribute abort\n * Return this value from an iterator function {each} or {arrayEach}\n * to break out of the iteration.\n * @example Breaking out of an iterator function\n * AWS.util.each({a: 1, b: 2, c: 3}, function(key, value) {\n * if (key == 'b') return AWS.util.abort;\n * });\n * @see each\n * @see arrayEach\n * @api private\n */\nvar util = {\n environment: 'nodejs',\n engine: function engine() {\n if (util.isBrowser() && typeof navigator !== 'undefined') {\n return navigator.userAgent;\n } else {\n var engine = process.platform + '/' + process.version;\n if (process.env.AWS_EXECUTION_ENV) {\n engine += ' exec-env/' + process.env.AWS_EXECUTION_ENV;\n }\n return engine;\n }\n },\n\n userAgent: function userAgent() {\n var name = util.environment;\n var agent = 'aws-sdk-' + name + '/' + require('./core').VERSION;\n if (name === 'nodejs') agent += ' ' + util.engine();\n return agent;\n },\n\n uriEscape: function uriEscape(string) {\n var output = encodeURIComponent(string);\n output = output.replace(/[^A-Za-z0-9_.~\\-%]+/g, escape);\n\n // AWS percent-encodes some extra non-standard characters in a URI\n output = output.replace(/[*]/g, function(ch) {\n return '%' + ch.charCodeAt(0).toString(16).toUpperCase();\n });\n\n return output;\n },\n\n uriEscapePath: function uriEscapePath(string) {\n var parts = [];\n util.arrayEach(string.split('/'), function (part) {\n parts.push(util.uriEscape(part));\n });\n return parts.join('/');\n },\n\n urlParse: function urlParse(url) {\n return util.url.parse(url);\n },\n\n urlFormat: function urlFormat(url) {\n return util.url.format(url);\n },\n\n queryStringParse: function queryStringParse(qs) {\n return util.querystring.parse(qs);\n },\n\n queryParamsToString: function queryParamsToString(params) {\n var items = [];\n var escape = util.uriEscape;\n var sortedKeys = Object.keys(params).sort();\n\n util.arrayEach(sortedKeys, function(name) {\n var value = params[name];\n var ename = escape(name);\n var result = ename + '=';\n if (Array.isArray(value)) {\n var vals = [];\n util.arrayEach(value, function(item) { vals.push(escape(item)); });\n result = ename + '=' + vals.sort().join('&' + ename + '=');\n } else if (value !== undefined && value !== null) {\n result = ename + '=' + escape(value);\n }\n items.push(result);\n });\n\n return items.join('&');\n },\n\n readFileSync: function readFileSync(path) {\n if (util.isBrowser()) return null;\n return require('fs').readFileSync(path, 'utf-8');\n },\n\n base64: {\n encode: function encode64(string) {\n if (typeof string === 'number') {\n throw util.error(new Error('Cannot base64 encode number ' + string));\n }\n if (string === null || typeof string === 'undefined') {\n return string;\n }\n var buf = util.buffer.toBuffer(string);\n return buf.toString('base64');\n },\n\n decode: function decode64(string) {\n if (typeof string === 'number') {\n throw util.error(new Error('Cannot base64 decode number ' + string));\n }\n if (string === null || typeof string === 'undefined') {\n return string;\n }\n return util.buffer.toBuffer(string, 'base64');\n }\n\n },\n\n buffer: {\n /**\n * Buffer constructor for Node buffer and buffer pollyfill\n */\n toBuffer: function(data, encoding) {\n return (typeof util.Buffer.from === 'function' && util.Buffer.from !== Uint8Array.from) ?\n util.Buffer.from(data, encoding) : new util.Buffer(data, encoding);\n },\n\n alloc: function(size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new Error('size passed to alloc must be a number.');\n }\n if (typeof util.Buffer.alloc === 'function') {\n return util.Buffer.alloc(size, fill, encoding);\n } else {\n var buf = new util.Buffer(size);\n if (fill !== undefined && typeof buf.fill === 'function') {\n buf.fill(fill, undefined, undefined, encoding);\n }\n return buf;\n }\n },\n\n toStream: function toStream(buffer) {\n if (!util.Buffer.isBuffer(buffer)) buffer = util.buffer.toBuffer(buffer);\n\n var readable = new (util.stream.Readable)();\n var pos = 0;\n readable._read = function(size) {\n if (pos >= buffer.length) return readable.push(null);\n\n var end = pos + size;\n if (end > buffer.length) end = buffer.length;\n readable.push(buffer.slice(pos, end));\n pos = end;\n };\n\n return readable;\n },\n\n /**\n * Concatenates a list of Buffer objects.\n */\n concat: function(buffers) {\n var length = 0,\n offset = 0,\n buffer = null, i;\n\n for (i = 0; i < buffers.length; i++) {\n length += buffers[i].length;\n }\n\n buffer = util.buffer.alloc(length);\n\n for (i = 0; i < buffers.length; i++) {\n buffers[i].copy(buffer, offset);\n offset += buffers[i].length;\n }\n\n return buffer;\n }\n },\n\n string: {\n byteLength: function byteLength(string) {\n if (string === null || string === undefined) return 0;\n if (typeof string === 'string') string = util.buffer.toBuffer(string);\n\n if (typeof string.byteLength === 'number') {\n return string.byteLength;\n } else if (typeof string.length === 'number') {\n return string.length;\n } else if (typeof string.size === 'number') {\n return string.size;\n } else if (typeof string.path === 'string') {\n return require('fs').lstatSync(string.path).size;\n } else {\n throw util.error(new Error('Cannot determine length of ' + string),\n { object: string });\n }\n },\n\n upperFirst: function upperFirst(string) {\n return string[0].toUpperCase() + string.substr(1);\n },\n\n lowerFirst: function lowerFirst(string) {\n return string[0].toLowerCase() + string.substr(1);\n }\n },\n\n ini: {\n parse: function string(ini) {\n var currentSection, map = {};\n util.arrayEach(ini.split(/\\r?\\n/), function(line) {\n line = line.split(/(^|\\s)[;#]/)[0].trim(); // remove comments and trim\n var isSection = line[0] === '[' && line[line.length - 1] === ']';\n if (isSection) {\n currentSection = line.substring(1, line.length - 1);\n if (currentSection === '__proto__' || currentSection.split(/\\s/)[1] === '__proto__') {\n throw util.error(\n new Error('Cannot load profile name \\'' + currentSection + '\\' from shared ini file.')\n );\n }\n } else if (currentSection) {\n var indexOfEqualsSign = line.indexOf('=');\n var start = 0;\n var end = line.length - 1;\n var isAssignment =\n indexOfEqualsSign !== -1 && indexOfEqualsSign !== start && indexOfEqualsSign !== end;\n\n if (isAssignment) {\n var name = line.substring(0, indexOfEqualsSign).trim();\n var value = line.substring(indexOfEqualsSign + 1).trim();\n\n map[currentSection] = map[currentSection] || {};\n map[currentSection][name] = value;\n }\n }\n });\n\n return map;\n }\n },\n\n fn: {\n noop: function() {},\n callback: function (err) { if (err) throw err; },\n\n /**\n * Turn a synchronous function into as \"async\" function by making it call\n * a callback. The underlying function is called with all but the last argument,\n * which is treated as the callback. The callback is passed passed a first argument\n * of null on success to mimick standard node callbacks.\n */\n makeAsync: function makeAsync(fn, expectedArgs) {\n if (expectedArgs && expectedArgs <= fn.length) {\n return fn;\n }\n\n return function() {\n var args = Array.prototype.slice.call(arguments, 0);\n var callback = args.pop();\n var result = fn.apply(null, args);\n callback(result);\n };\n }\n },\n\n /**\n * Date and time utility functions.\n */\n date: {\n\n /**\n * @return [Date] the current JavaScript date object. Since all\n * AWS services rely on this date object, you can override\n * this function to provide a special time value to AWS service\n * requests.\n */\n getDate: function getDate() {\n if (!AWS) AWS = require('./core');\n if (AWS.config.systemClockOffset) { // use offset when non-zero\n return new Date(new Date().getTime() + AWS.config.systemClockOffset);\n } else {\n return new Date();\n }\n },\n\n /**\n * @return [String] the date in ISO-8601 format\n */\n iso8601: function iso8601(date) {\n if (date === undefined) { date = util.date.getDate(); }\n return date.toISOString().replace(/\\.\\d{3}Z$/, 'Z');\n },\n\n /**\n * @return [String] the date in RFC 822 format\n */\n rfc822: function rfc822(date) {\n if (date === undefined) { date = util.date.getDate(); }\n return date.toUTCString();\n },\n\n /**\n * @return [Integer] the UNIX timestamp value for the current time\n */\n unixTimestamp: function unixTimestamp(date) {\n if (date === undefined) { date = util.date.getDate(); }\n return date.getTime() / 1000;\n },\n\n /**\n * @param [String,number,Date] date\n * @return [Date]\n */\n from: function format(date) {\n if (typeof date === 'number') {\n return new Date(date * 1000); // unix timestamp\n } else {\n return new Date(date);\n }\n },\n\n /**\n * Given a Date or date-like value, this function formats the\n * date into a string of the requested value.\n * @param [String,number,Date] date\n * @param [String] formatter Valid formats are:\n # * 'iso8601'\n # * 'rfc822'\n # * 'unixTimestamp'\n * @return [String]\n */\n format: function format(date, formatter) {\n if (!formatter) formatter = 'iso8601';\n return util.date[formatter](util.date.from(date));\n },\n\n parseTimestamp: function parseTimestamp(value) {\n if (typeof value === 'number') { // unix timestamp (number)\n return new Date(value * 1000);\n } else if (value.match(/^\\d+$/)) { // unix timestamp\n return new Date(value * 1000);\n } else if (value.match(/^\\d{4}/)) { // iso8601\n return new Date(value);\n } else if (value.match(/^\\w{3},/)) { // rfc822\n return new Date(value);\n } else {\n throw util.error(\n new Error('unhandled timestamp format: ' + value),\n {code: 'TimestampParserError'});\n }\n }\n\n },\n\n crypto: {\n crc32Table: [\n 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419,\n 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4,\n 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07,\n 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,\n 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856,\n 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,\n 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,\n 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,\n 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,\n 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A,\n 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599,\n 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,\n 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190,\n 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,\n 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E,\n 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,\n 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED,\n 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,\n 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3,\n 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,\n 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A,\n 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,\n 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010,\n 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,\n 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17,\n 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6,\n 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,\n 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,\n 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344,\n 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,\n 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A,\n 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,\n 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1,\n 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C,\n 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,\n 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,\n 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE,\n 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,\n 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C,\n 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,\n 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B,\n 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,\n 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1,\n 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,\n 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,\n 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,\n 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66,\n 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,\n 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605,\n 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8,\n 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B,\n 0x2D02EF8D],\n\n crc32: function crc32(data) {\n var tbl = util.crypto.crc32Table;\n var crc = 0 ^ -1;\n\n if (typeof data === 'string') {\n data = util.buffer.toBuffer(data);\n }\n\n for (var i = 0; i < data.length; i++) {\n var code = data.readUInt8(i);\n crc = (crc >>> 8) ^ tbl[(crc ^ code) & 0xFF];\n }\n return (crc ^ -1) >>> 0;\n },\n\n hmac: function hmac(key, string, digest, fn) {\n if (!digest) digest = 'binary';\n if (digest === 'buffer') { digest = undefined; }\n if (!fn) fn = 'sha256';\n if (typeof string === 'string') string = util.buffer.toBuffer(string);\n return util.crypto.lib.createHmac(fn, key).update(string).digest(digest);\n },\n\n md5: function md5(data, digest, callback) {\n return util.crypto.hash('md5', data, digest, callback);\n },\n\n sha256: function sha256(data, digest, callback) {\n return util.crypto.hash('sha256', data, digest, callback);\n },\n\n hash: function(algorithm, data, digest, callback) {\n var hash = util.crypto.createHash(algorithm);\n if (!digest) { digest = 'binary'; }\n if (digest === 'buffer') { digest = undefined; }\n if (typeof data === 'string') data = util.buffer.toBuffer(data);\n var sliceFn = util.arraySliceFn(data);\n var isBuffer = util.Buffer.isBuffer(data);\n //Identifying objects with an ArrayBuffer as buffers\n if (util.isBrowser() && typeof ArrayBuffer !== 'undefined' && data && data.buffer instanceof ArrayBuffer) isBuffer = true;\n\n if (callback && typeof data === 'object' &&\n typeof data.on === 'function' && !isBuffer) {\n data.on('data', function(chunk) { hash.update(chunk); });\n data.on('error', function(err) { callback(err); });\n data.on('end', function() { callback(null, hash.digest(digest)); });\n } else if (callback && sliceFn && !isBuffer &&\n typeof FileReader !== 'undefined') {\n // this might be a File/Blob\n var index = 0, size = 1024 * 512;\n var reader = new FileReader();\n reader.onerror = function() {\n callback(new Error('Failed to read data.'));\n };\n reader.onload = function() {\n var buf = new util.Buffer(new Uint8Array(reader.result));\n hash.update(buf);\n index += buf.length;\n reader._continueReading();\n };\n reader._continueReading = function() {\n if (index >= data.size) {\n callback(null, hash.digest(digest));\n return;\n }\n\n var back = index + size;\n if (back > data.size) back = data.size;\n reader.readAsArrayBuffer(sliceFn.call(data, index, back));\n };\n\n reader._continueReading();\n } else {\n if (util.isBrowser() && typeof data === 'object' && !isBuffer) {\n data = new util.Buffer(new Uint8Array(data));\n }\n var out = hash.update(data).digest(digest);\n if (callback) callback(null, out);\n return out;\n }\n },\n\n toHex: function toHex(data) {\n var out = [];\n for (var i = 0; i < data.length; i++) {\n out.push(('0' + data.charCodeAt(i).toString(16)).substr(-2, 2));\n }\n return out.join('');\n },\n\n createHash: function createHash(algorithm) {\n return util.crypto.lib.createHash(algorithm);\n }\n\n },\n\n /** @!ignore */\n\n /* Abort constant */\n abort: {},\n\n each: function each(object, iterFunction) {\n for (var key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n var ret = iterFunction.call(this, key, object[key]);\n if (ret === util.abort) break;\n }\n }\n },\n\n arrayEach: function arrayEach(array, iterFunction) {\n for (var idx in array) {\n if (Object.prototype.hasOwnProperty.call(array, idx)) {\n var ret = iterFunction.call(this, array[idx], parseInt(idx, 10));\n if (ret === util.abort) break;\n }\n }\n },\n\n update: function update(obj1, obj2) {\n util.each(obj2, function iterator(key, item) {\n obj1[key] = item;\n });\n return obj1;\n },\n\n merge: function merge(obj1, obj2) {\n return util.update(util.copy(obj1), obj2);\n },\n\n copy: function copy(object) {\n if (object === null || object === undefined) return object;\n var dupe = {};\n // jshint forin:false\n for (var key in object) {\n dupe[key] = object[key];\n }\n return dupe;\n },\n\n isEmpty: function isEmpty(obj) {\n for (var prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n return false;\n }\n }\n return true;\n },\n\n arraySliceFn: function arraySliceFn(obj) {\n var fn = obj.slice || obj.webkitSlice || obj.mozSlice;\n return typeof fn === 'function' ? fn : null;\n },\n\n isType: function isType(obj, type) {\n // handle cross-\"frame\" objects\n if (typeof type === 'function') type = util.typeName(type);\n return Object.prototype.toString.call(obj) === '[object ' + type + ']';\n },\n\n typeName: function typeName(type) {\n if (Object.prototype.hasOwnProperty.call(type, 'name')) return type.name;\n var str = type.toString();\n var match = str.match(/^\\s*function (.+)\\(/);\n return match ? match[1] : str;\n },\n\n error: function error(err, options) {\n var originalError = null;\n if (typeof err.message === 'string' && err.message !== '') {\n if (typeof options === 'string' || (options && options.message)) {\n originalError = util.copy(err);\n originalError.message = err.message;\n }\n }\n err.message = err.message || null;\n\n if (typeof options === 'string') {\n err.message = options;\n } else if (typeof options === 'object' && options !== null) {\n util.update(err, options);\n if (options.message)\n err.message = options.message;\n if (options.code || options.name)\n err.code = options.code || options.name;\n if (options.stack)\n err.stack = options.stack;\n }\n\n if (typeof Object.defineProperty === 'function') {\n Object.defineProperty(err, 'name', {writable: true, enumerable: false});\n Object.defineProperty(err, 'message', {enumerable: true});\n }\n\n err.name = String(options && options.name || err.name || err.code || 'Error');\n err.time = new Date();\n\n if (originalError) err.originalError = originalError;\n\n return err;\n },\n\n /**\n * @api private\n */\n inherit: function inherit(klass, features) {\n var newObject = null;\n if (features === undefined) {\n features = klass;\n klass = Object;\n newObject = {};\n } else {\n var ctor = function ConstructorWrapper() {};\n ctor.prototype = klass.prototype;\n newObject = new ctor();\n }\n\n // constructor not supplied, create pass-through ctor\n if (features.constructor === Object) {\n features.constructor = function() {\n if (klass !== Object) {\n return klass.apply(this, arguments);\n }\n };\n }\n\n features.constructor.prototype = newObject;\n util.update(features.constructor.prototype, features);\n features.constructor.__super__ = klass;\n return features.constructor;\n },\n\n /**\n * @api private\n */\n mixin: function mixin() {\n var klass = arguments[0];\n for (var i = 1; i < arguments.length; i++) {\n // jshint forin:false\n for (var prop in arguments[i].prototype) {\n var fn = arguments[i].prototype[prop];\n if (prop !== 'constructor') {\n klass.prototype[prop] = fn;\n }\n }\n }\n return klass;\n },\n\n /**\n * @api private\n */\n hideProperties: function hideProperties(obj, props) {\n if (typeof Object.defineProperty !== 'function') return;\n\n util.arrayEach(props, function (key) {\n Object.defineProperty(obj, key, {\n enumerable: false, writable: true, configurable: true });\n });\n },\n\n /**\n * @api private\n */\n property: function property(obj, name, value, enumerable, isValue) {\n var opts = {\n configurable: true,\n enumerable: enumerable !== undefined ? enumerable : true\n };\n if (typeof value === 'function' && !isValue) {\n opts.get = value;\n }\n else {\n opts.value = value; opts.writable = true;\n }\n\n Object.defineProperty(obj, name, opts);\n },\n\n /**\n * @api private\n */\n memoizedProperty: function memoizedProperty(obj, name, get, enumerable) {\n var cachedValue = null;\n\n // build enumerable attribute for each value with lazy accessor.\n util.property(obj, name, function() {\n if (cachedValue === null) {\n cachedValue = get();\n }\n return cachedValue;\n }, enumerable);\n },\n\n /**\n * TODO Remove in major version revision\n * This backfill populates response data without the\n * top-level payload name.\n *\n * @api private\n */\n hoistPayloadMember: function hoistPayloadMember(resp) {\n var req = resp.request;\n var operationName = req.operation;\n var operation = req.service.api.operations[operationName];\n var output = operation.output;\n if (output.payload && !operation.hasEventOutput) {\n var payloadMember = output.members[output.payload];\n var responsePayload = resp.data[output.payload];\n if (payloadMember.type === 'structure') {\n util.each(responsePayload, function(key, value) {\n util.property(resp.data, key, value, false);\n });\n }\n }\n },\n\n /**\n * Compute SHA-256 checksums of streams\n *\n * @api private\n */\n computeSha256: function computeSha256(body, done) {\n if (util.isNode()) {\n var Stream = util.stream.Stream;\n var fs = require('fs');\n if (typeof Stream === 'function' && body instanceof Stream) {\n if (typeof body.path === 'string') { // assume file object\n var settings = {};\n if (typeof body.start === 'number') {\n settings.start = body.start;\n }\n if (typeof body.end === 'number') {\n settings.end = body.end;\n }\n body = fs.createReadStream(body.path, settings);\n } else { // TODO support other stream types\n return done(new Error('Non-file stream objects are ' +\n 'not supported with SigV4'));\n }\n }\n }\n\n util.crypto.sha256(body, 'hex', function(err, sha) {\n if (err) done(err);\n else done(null, sha);\n });\n },\n\n /**\n * @api private\n */\n isClockSkewed: function isClockSkewed(serverTime) {\n if (serverTime) {\n util.property(AWS.config, 'isClockSkewed',\n Math.abs(new Date().getTime() - serverTime) >= 300000, false);\n return AWS.config.isClockSkewed;\n }\n },\n\n applyClockOffset: function applyClockOffset(serverTime) {\n if (serverTime)\n AWS.config.systemClockOffset = serverTime - new Date().getTime();\n },\n\n /**\n * @api private\n */\n extractRequestId: function extractRequestId(resp) {\n var requestId = resp.httpResponse.headers['x-amz-request-id'] ||\n resp.httpResponse.headers['x-amzn-requestid'];\n\n if (!requestId && resp.data && resp.data.ResponseMetadata) {\n requestId = resp.data.ResponseMetadata.RequestId;\n }\n\n if (requestId) {\n resp.requestId = requestId;\n }\n\n if (resp.error) {\n resp.error.requestId = requestId;\n }\n },\n\n /**\n * @api private\n */\n addPromises: function addPromises(constructors, PromiseDependency) {\n var deletePromises = false;\n if (PromiseDependency === undefined && AWS && AWS.config) {\n PromiseDependency = AWS.config.getPromisesDependency();\n }\n if (PromiseDependency === undefined && typeof Promise !== 'undefined') {\n PromiseDependency = Promise;\n }\n if (typeof PromiseDependency !== 'function') deletePromises = true;\n if (!Array.isArray(constructors)) constructors = [constructors];\n\n for (var ind = 0; ind < constructors.length; ind++) {\n var constructor = constructors[ind];\n if (deletePromises) {\n if (constructor.deletePromisesFromClass) {\n constructor.deletePromisesFromClass();\n }\n } else if (constructor.addPromisesToClass) {\n constructor.addPromisesToClass(PromiseDependency);\n }\n }\n },\n\n /**\n * @api private\n * Return a function that will return a promise whose fate is decided by the\n * callback behavior of the given method with `methodName`. The method to be\n * promisified should conform to node.js convention of accepting a callback as\n * last argument and calling that callback with error as the first argument\n * and success value on the second argument.\n */\n promisifyMethod: function promisifyMethod(methodName, PromiseDependency) {\n return function promise() {\n var self = this;\n var args = Array.prototype.slice.call(arguments);\n return new PromiseDependency(function(resolve, reject) {\n args.push(function(err, data) {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n });\n self[methodName].apply(self, args);\n });\n };\n },\n\n /**\n * @api private\n */\n isDualstackAvailable: function isDualstackAvailable(service) {\n if (!service) return false;\n var metadata = require('../apis/metadata.json');\n if (typeof service !== 'string') service = service.serviceIdentifier;\n if (typeof service !== 'string' || !metadata.hasOwnProperty(service)) return false;\n return !!metadata[service].dualstackAvailable;\n },\n\n /**\n * @api private\n */\n calculateRetryDelay: function calculateRetryDelay(retryCount, retryDelayOptions, err) {\n if (!retryDelayOptions) retryDelayOptions = {};\n var customBackoff = retryDelayOptions.customBackoff || null;\n if (typeof customBackoff === 'function') {\n return customBackoff(retryCount, err);\n }\n var base = typeof retryDelayOptions.base === 'number' ? retryDelayOptions.base : 100;\n var delay = Math.random() * (Math.pow(2, retryCount) * base);\n return delay;\n },\n\n /**\n * @api private\n */\n handleRequestWithRetries: function handleRequestWithRetries(httpRequest, options, cb) {\n if (!options) options = {};\n var http = AWS.HttpClient.getInstance();\n var httpOptions = options.httpOptions || {};\n var retryCount = 0;\n\n var errCallback = function(err) {\n var maxRetries = options.maxRetries || 0;\n if (err && err.code === 'TimeoutError') err.retryable = true;\n\n // Call `calculateRetryDelay()` only when relevant, see #3401\n if (err && err.retryable && retryCount < maxRetries) {\n var delay = util.calculateRetryDelay(retryCount, options.retryDelayOptions, err);\n if (delay >= 0) {\n retryCount++;\n setTimeout(sendRequest, delay + (err.retryAfter || 0));\n return;\n }\n }\n cb(err);\n };\n\n var sendRequest = function() {\n var data = '';\n http.handleRequest(httpRequest, httpOptions, function(httpResponse) {\n httpResponse.on('data', function(chunk) { data += chunk.toString(); });\n httpResponse.on('end', function() {\n var statusCode = httpResponse.statusCode;\n if (statusCode < 300) {\n cb(null, data);\n } else {\n var retryAfter = parseInt(httpResponse.headers['retry-after'], 10) * 1000 || 0;\n var err = util.error(new Error(),\n {\n statusCode: statusCode,\n retryable: statusCode >= 500 || statusCode === 429\n }\n );\n if (retryAfter && err.retryable) err.retryAfter = retryAfter;\n errCallback(err);\n }\n });\n }, errCallback);\n };\n\n AWS.util.defer(sendRequest);\n },\n\n /**\n * @api private\n */\n uuid: {\n v4: function uuidV4() {\n return require('uuid').v4();\n }\n },\n\n /**\n * @api private\n */\n convertPayloadToString: function convertPayloadToString(resp) {\n var req = resp.request;\n var operation = req.operation;\n var rules = req.service.api.operations[operation].output || {};\n if (rules.payload && resp.data[rules.payload]) {\n resp.data[rules.payload] = resp.data[rules.payload].toString();\n }\n },\n\n /**\n * @api private\n */\n defer: function defer(callback) {\n if (typeof process === 'object' && typeof process.nextTick === 'function') {\n process.nextTick(callback);\n } else if (typeof setImmediate === 'function') {\n setImmediate(callback);\n } else {\n setTimeout(callback, 0);\n }\n },\n\n /**\n * @api private\n */\n getRequestPayloadShape: function getRequestPayloadShape(req) {\n var operations = req.service.api.operations;\n if (!operations) return undefined;\n var operation = (operations || {})[req.operation];\n if (!operation || !operation.input || !operation.input.payload) return undefined;\n return operation.input.members[operation.input.payload];\n },\n\n getProfilesFromSharedConfig: function getProfilesFromSharedConfig(iniLoader, filename) {\n var profiles = {};\n var profilesFromConfig = {};\n if (process.env[util.configOptInEnv]) {\n var profilesFromConfig = iniLoader.loadFrom({\n isConfig: true,\n filename: process.env[util.sharedConfigFileEnv]\n });\n }\n var profilesFromCreds= {};\n try {\n var profilesFromCreds = iniLoader.loadFrom({\n filename: filename ||\n (process.env[util.configOptInEnv] && process.env[util.sharedCredentialsFileEnv])\n });\n } catch (error) {\n // if using config, assume it is fully descriptive without a credentials file:\n if (!process.env[util.configOptInEnv]) throw error;\n }\n for (var i = 0, profileNames = Object.keys(profilesFromConfig); i < profileNames.length; i++) {\n profiles[profileNames[i]] = objectAssign(profiles[profileNames[i]] || {}, profilesFromConfig[profileNames[i]]);\n }\n for (var i = 0, profileNames = Object.keys(profilesFromCreds); i < profileNames.length; i++) {\n profiles[profileNames[i]] = objectAssign(profiles[profileNames[i]] || {}, profilesFromCreds[profileNames[i]]);\n }\n return profiles;\n\n /**\n * Roughly the semantics of `Object.assign(target, source)`\n */\n function objectAssign(target, source) {\n for (var i = 0, keys = Object.keys(source); i < keys.length; i++) {\n target[keys[i]] = source[keys[i]];\n }\n return target;\n }\n },\n\n /**\n * @api private\n */\n ARN: {\n validate: function validateARN(str) {\n return str && str.indexOf('arn:') === 0 && str.split(':').length >= 6;\n },\n parse: function parseARN(arn) {\n var matched = arn.split(':');\n return {\n partition: matched[1],\n service: matched[2],\n region: matched[3],\n accountId: matched[4],\n resource: matched.slice(5).join(':')\n };\n },\n build: function buildARN(arnObject) {\n if (\n arnObject.service === undefined ||\n arnObject.region === undefined ||\n arnObject.accountId === undefined ||\n arnObject.resource === undefined\n ) throw util.error(new Error('Input ARN object is invalid'));\n return 'arn:'+ (arnObject.partition || 'aws') + ':' + arnObject.service +\n ':' + arnObject.region + ':' + arnObject.accountId + ':' + arnObject.resource;\n }\n },\n\n /**\n * @api private\n */\n defaultProfile: 'default',\n\n /**\n * @api private\n */\n configOptInEnv: 'AWS_SDK_LOAD_CONFIG',\n\n /**\n * @api private\n */\n sharedCredentialsFileEnv: 'AWS_SHARED_CREDENTIALS_FILE',\n\n /**\n * @api private\n */\n sharedConfigFileEnv: 'AWS_CONFIG_FILE',\n\n /**\n * @api private\n */\n imdsDisabledEnv: 'AWS_EC2_METADATA_DISABLED'\n};\n\n/**\n * @api private\n */\nmodule.exports = util;\n", "var util = require('../core').util;\nvar Transform = require('stream').Transform;\nvar allocBuffer = util.buffer.alloc;\n\n/** @type {Transform} */\nfunction EventMessageChunkerStream(options) {\n Transform.call(this, options);\n\n this.currentMessageTotalLength = 0;\n this.currentMessagePendingLength = 0;\n /** @type {Buffer} */\n this.currentMessage = null;\n\n /** @type {Buffer} */\n this.messageLengthBuffer = null;\n}\n\nEventMessageChunkerStream.prototype = Object.create(Transform.prototype);\n\n/**\n *\n * @param {Buffer} chunk\n * @param {string} encoding\n * @param {*} callback\n */\nEventMessageChunkerStream.prototype._transform = function(chunk, encoding, callback) {\n var chunkLength = chunk.length;\n var currentOffset = 0;\n\n while (currentOffset < chunkLength) {\n // create new message if necessary\n if (!this.currentMessage) {\n // working on a new message, determine total length\n var bytesRemaining = chunkLength - currentOffset;\n // prevent edge case where total length spans 2 chunks\n if (!this.messageLengthBuffer) {\n this.messageLengthBuffer = allocBuffer(4);\n }\n var numBytesForTotal = Math.min(\n 4 - this.currentMessagePendingLength, // remaining bytes to fill the messageLengthBuffer\n bytesRemaining // bytes left in chunk\n );\n\n chunk.copy(\n this.messageLengthBuffer,\n this.currentMessagePendingLength,\n currentOffset,\n currentOffset + numBytesForTotal\n );\n\n this.currentMessagePendingLength += numBytesForTotal;\n currentOffset += numBytesForTotal;\n\n if (this.currentMessagePendingLength < 4) {\n // not enough information to create the current message\n break;\n }\n this.allocateMessage(this.messageLengthBuffer.readUInt32BE(0));\n this.messageLengthBuffer = null;\n }\n\n // write data into current message\n var numBytesToWrite = Math.min(\n this.currentMessageTotalLength - this.currentMessagePendingLength, // number of bytes left to complete message\n chunkLength - currentOffset // number of bytes left in the original chunk\n );\n chunk.copy(\n this.currentMessage, // target buffer\n this.currentMessagePendingLength, // target offset\n currentOffset, // chunk offset\n currentOffset + numBytesToWrite // chunk end to write\n );\n this.currentMessagePendingLength += numBytesToWrite;\n currentOffset += numBytesToWrite;\n\n // check if a message is ready to be pushed\n if (this.currentMessageTotalLength && this.currentMessageTotalLength === this.currentMessagePendingLength) {\n // push out the message\n this.push(this.currentMessage);\n // cleanup\n this.currentMessage = null;\n this.currentMessageTotalLength = 0;\n this.currentMessagePendingLength = 0;\n }\n }\n\n callback();\n};\n\nEventMessageChunkerStream.prototype._flush = function(callback) {\n if (this.currentMessageTotalLength) {\n if (this.currentMessageTotalLength === this.currentMessagePendingLength) {\n callback(null, this.currentMessage);\n } else {\n callback(new Error('Truncated event message received.'));\n }\n } else {\n callback();\n }\n};\n\n/**\n * @param {number} size Size of the message to be allocated.\n * @api private\n */\nEventMessageChunkerStream.prototype.allocateMessage = function(size) {\n if (typeof size !== 'number') {\n throw new Error('Attempted to allocate an event message where size was not a number: ' + size);\n }\n this.currentMessageTotalLength = size;\n this.currentMessagePendingLength = 4;\n this.currentMessage = allocBuffer(size);\n this.currentMessage.writeUInt32BE(size, 0);\n};\n\n/**\n * @api private\n */\nmodule.exports = {\n EventMessageChunkerStream: EventMessageChunkerStream\n};\n", "var util = require('../core').util;\nvar toBuffer = util.buffer.toBuffer;\n\n/**\n * A lossless representation of a signed, 64-bit integer. Instances of this\n * class may be used in arithmetic expressions as if they were numeric\n * primitives, but the binary representation will be preserved unchanged as the\n * `bytes` property of the object. The bytes should be encoded as big-endian,\n * two's complement integers.\n * @param {Buffer} bytes\n *\n * @api private\n */\nfunction Int64(bytes) {\n if (bytes.length !== 8) {\n throw new Error('Int64 buffers must be exactly 8 bytes');\n }\n if (!util.Buffer.isBuffer(bytes)) bytes = toBuffer(bytes);\n\n this.bytes = bytes;\n}\n\n/**\n * @param {number} number\n * @returns {Int64}\n *\n * @api private\n */\nInt64.fromNumber = function(number) {\n if (number > 9223372036854775807 || number < -9223372036854775808) {\n throw new Error(\n number + ' is too large (or, if negative, too small) to represent as an Int64'\n );\n }\n\n var bytes = new Uint8Array(8);\n for (\n var i = 7, remaining = Math.abs(Math.round(number));\n i > -1 && remaining > 0;\n i--, remaining /= 256\n ) {\n bytes[i] = remaining;\n }\n\n if (number < 0) {\n negate(bytes);\n }\n\n return new Int64(bytes);\n};\n\n/**\n * @returns {number}\n *\n * @api private\n */\nInt64.prototype.valueOf = function() {\n var bytes = this.bytes.slice(0);\n var negative = bytes[0] & 128;\n if (negative) {\n negate(bytes);\n }\n\n return parseInt(bytes.toString('hex'), 16) * (negative ? -1 : 1);\n};\n\nInt64.prototype.toString = function() {\n return String(this.valueOf());\n};\n\n/**\n * @param {Buffer} bytes\n *\n * @api private\n */\nfunction negate(bytes) {\n for (var i = 0; i < 8; i++) {\n bytes[i] ^= 0xFF;\n }\n for (var i = 7; i > -1; i--) {\n bytes[i]++;\n if (bytes[i] !== 0) {\n break;\n }\n }\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n Int64: Int64\n};\n", "var util = require('../core').util;\nvar toBuffer = util.buffer.toBuffer;\n\n// All prelude components are unsigned, 32-bit integers\nvar PRELUDE_MEMBER_LENGTH = 4;\n// The prelude consists of two components\nvar PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;\n// Checksums are always CRC32 hashes.\nvar CHECKSUM_LENGTH = 4;\n// Messages must include a full prelude, a prelude checksum, and a message checksum\nvar MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;\n\n/**\n * @api private\n *\n * @param {Buffer} message\n */\nfunction splitMessage(message) {\n if (!util.Buffer.isBuffer(message)) message = toBuffer(message);\n\n if (message.length < MINIMUM_MESSAGE_LENGTH) {\n throw new Error('Provided message too short to accommodate event stream message overhead');\n }\n\n if (message.length !== message.readUInt32BE(0)) {\n throw new Error('Reported message length does not match received message length');\n }\n\n var expectedPreludeChecksum = message.readUInt32BE(PRELUDE_LENGTH);\n\n if (\n expectedPreludeChecksum !== util.crypto.crc32(\n message.slice(0, PRELUDE_LENGTH)\n )\n ) {\n throw new Error(\n 'The prelude checksum specified in the message (' +\n expectedPreludeChecksum +\n ') does not match the calculated CRC32 checksum.'\n );\n }\n\n var expectedMessageChecksum = message.readUInt32BE(message.length - CHECKSUM_LENGTH);\n\n if (\n expectedMessageChecksum !== util.crypto.crc32(\n message.slice(0, message.length - CHECKSUM_LENGTH)\n )\n ) {\n throw new Error(\n 'The message checksum did not match the expected value of ' +\n expectedMessageChecksum\n );\n }\n\n var headersStart = PRELUDE_LENGTH + CHECKSUM_LENGTH;\n var headersEnd = headersStart + message.readUInt32BE(PRELUDE_MEMBER_LENGTH);\n\n return {\n headers: message.slice(headersStart, headersEnd),\n body: message.slice(headersEnd, message.length - CHECKSUM_LENGTH),\n };\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n splitMessage: splitMessage\n};\n", "var Int64 = require('./int64').Int64;\n\nvar splitMessage = require('./split-message').splitMessage;\n\nvar BOOLEAN_TAG = 'boolean';\nvar BYTE_TAG = 'byte';\nvar SHORT_TAG = 'short';\nvar INT_TAG = 'integer';\nvar LONG_TAG = 'long';\nvar BINARY_TAG = 'binary';\nvar STRING_TAG = 'string';\nvar TIMESTAMP_TAG = 'timestamp';\nvar UUID_TAG = 'uuid';\n\n/**\n * @api private\n *\n * @param {Buffer} headers\n */\nfunction parseHeaders(headers) {\n var out = {};\n var position = 0;\n while (position < headers.length) {\n var nameLength = headers.readUInt8(position++);\n var name = headers.slice(position, position + nameLength).toString();\n position += nameLength;\n switch (headers.readUInt8(position++)) {\n case 0 /* boolTrue */:\n out[name] = {\n type: BOOLEAN_TAG,\n value: true\n };\n break;\n case 1 /* boolFalse */:\n out[name] = {\n type: BOOLEAN_TAG,\n value: false\n };\n break;\n case 2 /* byte */:\n out[name] = {\n type: BYTE_TAG,\n value: headers.readInt8(position++)\n };\n break;\n case 3 /* short */:\n out[name] = {\n type: SHORT_TAG,\n value: headers.readInt16BE(position)\n };\n position += 2;\n break;\n case 4 /* integer */:\n out[name] = {\n type: INT_TAG,\n value: headers.readInt32BE(position)\n };\n position += 4;\n break;\n case 5 /* long */:\n out[name] = {\n type: LONG_TAG,\n value: new Int64(headers.slice(position, position + 8))\n };\n position += 8;\n break;\n case 6 /* byteArray */:\n var binaryLength = headers.readUInt16BE(position);\n position += 2;\n out[name] = {\n type: BINARY_TAG,\n value: headers.slice(position, position + binaryLength)\n };\n position += binaryLength;\n break;\n case 7 /* string */:\n var stringLength = headers.readUInt16BE(position);\n position += 2;\n out[name] = {\n type: STRING_TAG,\n value: headers.slice(\n position,\n position + stringLength\n ).toString()\n };\n position += stringLength;\n break;\n case 8 /* timestamp */:\n out[name] = {\n type: TIMESTAMP_TAG,\n value: new Date(\n new Int64(headers.slice(position, position + 8))\n .valueOf()\n )\n };\n position += 8;\n break;\n case 9 /* uuid */:\n var uuidChars = headers.slice(position, position + 16)\n .toString('hex');\n position += 16;\n out[name] = {\n type: UUID_TAG,\n value: uuidChars.substr(0, 8) + '-' +\n uuidChars.substr(8, 4) + '-' +\n uuidChars.substr(12, 4) + '-' +\n uuidChars.substr(16, 4) + '-' +\n uuidChars.substr(20)\n };\n break;\n default:\n throw new Error('Unrecognized header type tag');\n }\n }\n return out;\n}\n\nfunction parseMessage(message) {\n var parsed = splitMessage(message);\n return { headers: parseHeaders(parsed.headers), body: parsed.body };\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n parseMessage: parseMessage\n};\n", "var parseMessage = require('./parse-message').parseMessage;\n\n/**\n *\n * @param {*} parser\n * @param {Buffer} message\n * @param {*} shape\n * @api private\n */\nfunction parseEvent(parser, message, shape) {\n var parsedMessage = parseMessage(message);\n\n // check if message is an event or error\n var messageType = parsedMessage.headers[':message-type'];\n if (messageType) {\n if (messageType.value === 'error') {\n throw parseError(parsedMessage);\n } else if (messageType.value !== 'event') {\n // not sure how to parse non-events/non-errors, ignore for now\n return;\n }\n }\n\n // determine event type\n var eventType = parsedMessage.headers[':event-type'];\n // check that the event type is modeled\n var eventModel = shape.members[eventType.value];\n if (!eventModel) {\n return;\n }\n\n var result = {};\n // check if an event payload exists\n var eventPayloadMemberName = eventModel.eventPayloadMemberName;\n if (eventPayloadMemberName) {\n var payloadShape = eventModel.members[eventPayloadMemberName];\n // if the shape is binary, return the byte array\n if (payloadShape.type === 'binary') {\n result[eventPayloadMemberName] = parsedMessage.body;\n } else {\n result[eventPayloadMemberName] = parser.parse(parsedMessage.body.toString(), payloadShape);\n }\n }\n\n // read event headers\n var eventHeaderNames = eventModel.eventHeaderMemberNames;\n for (var i = 0; i < eventHeaderNames.length; i++) {\n var name = eventHeaderNames[i];\n if (parsedMessage.headers[name]) {\n // parse the header!\n result[name] = eventModel.members[name].toType(parsedMessage.headers[name].value);\n }\n }\n\n var output = {};\n output[eventType.value] = result;\n return output;\n}\n\nfunction parseError(message) {\n var errorCode = message.headers[':error-code'];\n var errorMessage = message.headers[':error-message'];\n var error = new Error(errorMessage.value || errorMessage);\n error.code = error.name = errorCode.value || errorCode;\n return error;\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n parseEvent: parseEvent\n};\n", "var Transform = require('stream').Transform;\nvar parseEvent = require('./parse-event').parseEvent;\n\n/** @type {Transform} */\nfunction EventUnmarshallerStream(options) {\n options = options || {};\n // set output to object mode\n options.readableObjectMode = true;\n Transform.call(this, options);\n this._readableState.objectMode = true;\n\n this.parser = options.parser;\n this.eventStreamModel = options.eventStreamModel;\n}\n\nEventUnmarshallerStream.prototype = Object.create(Transform.prototype);\n\n/**\n *\n * @param {Buffer} chunk\n * @param {string} encoding\n * @param {*} callback\n */\nEventUnmarshallerStream.prototype._transform = function(chunk, encoding, callback) {\n try {\n var event = parseEvent(this.parser, chunk, this.eventStreamModel);\n this.push(event);\n return callback();\n } catch (err) {\n callback(err);\n }\n};\n\n/**\n * @api private\n */\nmodule.exports = {\n EventUnmarshallerStream: EventUnmarshallerStream\n};\n", "/**\n * What is necessary to create an event stream in node?\n * - http response stream\n * - parser\n * - event stream model\n */\n\nvar EventMessageChunkerStream = require('../event-stream/event-message-chunker-stream').EventMessageChunkerStream;\nvar EventUnmarshallerStream = require('../event-stream/event-message-unmarshaller-stream').EventUnmarshallerStream;\n\nfunction createEventStream(stream, parser, model) {\n var eventStream = new EventUnmarshallerStream({\n parser: parser,\n eventStreamModel: model\n });\n\n var eventMessageChunker = new EventMessageChunkerStream();\n\n stream.pipe(\n eventMessageChunker\n ).pipe(eventStream);\n\n stream.on('error', function(err) {\n eventMessageChunker.emit('error', err);\n });\n\n eventMessageChunker.on('error', function(err) {\n eventStream.emit('error', err);\n });\n\n return eventStream;\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n createEventStream: createEventStream\n};\n", "/**\n * Takes in a buffer of event messages and splits them into individual messages.\n * @param {Buffer} buffer\n * @api private\n */\nfunction eventMessageChunker(buffer) {\n /** @type Buffer[] */\n var messages = [];\n var offset = 0;\n\n while (offset < buffer.length) {\n var totalLength = buffer.readInt32BE(offset);\n\n // create new buffer for individual message (shares memory with original)\n var message = buffer.slice(offset, totalLength + offset);\n // increment offset to it starts at the next message\n offset += totalLength;\n\n messages.push(message);\n }\n\n return messages;\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n eventMessageChunker: eventMessageChunker\n};\n", "var eventMessageChunker = require('../event-stream/event-message-chunker').eventMessageChunker;\nvar parseEvent = require('./parse-event').parseEvent;\n\nfunction createEventStream(body, parser, model) {\n var eventMessages = eventMessageChunker(body);\n\n var events = [];\n\n for (var i = 0; i < eventMessages.length; i++) {\n events.push(parseEvent(parser, eventMessages[i], model));\n }\n\n return events;\n}\n\n/**\n * @api private\n */\nmodule.exports = {\n createEventStream: createEventStream\n};\n", "module.exports = {\n //provide realtime clock for performance measurement\n now: function now() {\n var second = process.hrtime();\n return second[0] * 1000 + (second[1] / 1000000);\n }\n};\n", "var util = require('../core').util;\nvar dgram = require('dgram');\nvar stringToBuffer = util.buffer.toBuffer;\n\nvar MAX_MESSAGE_SIZE = 1024 * 8; // 8 KB\n\n/**\n * Publishes metrics via udp.\n * @param {object} options Paramters for Publisher constructor\n * @param {number} [options.port = 31000] Port number\n * @param {string} [options.clientId = ''] Client Identifier\n * @param {boolean} [options.enabled = false] enable sending metrics datagram\n * @api private\n */\nfunction Publisher(options) {\n // handle configuration\n options = options || {};\n this.enabled = options.enabled || false;\n this.port = options.port || 31000;\n this.clientId = options.clientId || '';\n this.address = options.host || '127.0.0.1';\n if (this.clientId.length > 255) {\n // ClientId has a max length of 255\n this.clientId = this.clientId.substr(0, 255);\n }\n this.messagesInFlight = 0;\n}\n\nPublisher.prototype.fieldsToTrim = {\n UserAgent: 256,\n SdkException: 128,\n SdkExceptionMessage: 512,\n AwsException: 128,\n AwsExceptionMessage: 512,\n FinalSdkException: 128,\n FinalSdkExceptionMessage: 512,\n FinalAwsException: 128,\n FinalAwsExceptionMessage: 512\n\n};\n\n/**\n * Trims fields that have a specified max length.\n * @param {object} event ApiCall or ApiCallAttempt event.\n * @returns {object}\n * @api private\n */\nPublisher.prototype.trimFields = function(event) {\n var trimmableFields = Object.keys(this.fieldsToTrim);\n for (var i = 0, iLen = trimmableFields.length; i < iLen; i++) {\n var field = trimmableFields[i];\n if (event.hasOwnProperty(field)) {\n var maxLength = this.fieldsToTrim[field];\n var value = event[field];\n if (value && value.length > maxLength) {\n event[field] = value.substr(0, maxLength);\n }\n }\n }\n return event;\n};\n\n/**\n * Handles ApiCall and ApiCallAttempt events.\n * @param {Object} event apiCall or apiCallAttempt event.\n * @api private\n */\nPublisher.prototype.eventHandler = function(event) {\n // set the clientId\n event.ClientId = this.clientId;\n\n this.trimFields(event);\n\n var message = stringToBuffer(JSON.stringify(event));\n if (!this.enabled || message.length > MAX_MESSAGE_SIZE) {\n // drop the message if publisher not enabled or it is too large\n return;\n }\n\n this.publishDatagram(message);\n};\n\n/**\n * Publishes message to an agent.\n * @param {Buffer} message JSON message to send to agent.\n * @api private\n */\nPublisher.prototype.publishDatagram = function(message) {\n var self = this;\n var client = this.getClient();\n\n this.messagesInFlight++;\n this.client.send(message, 0, message.length, this.port, this.address, function(err, bytes) {\n if (--self.messagesInFlight <= 0) {\n // destroy existing client so the event loop isn't kept open\n self.destroyClient();\n }\n });\n};\n\n/**\n * Returns an existing udp socket, or creates one if it doesn't already exist.\n * @api private\n */\nPublisher.prototype.getClient = function() {\n if (!this.client) {\n this.client = dgram.createSocket('udp4');\n }\n return this.client;\n};\n\n/**\n * Destroys the udp socket.\n * @api private\n */\nPublisher.prototype.destroyClient = function() {\n if (this.client) {\n this.client.close();\n this.client = void 0;\n }\n};\n\nmodule.exports = {\n Publisher: Publisher\n};\n", "var AWS = require('../core');\n\n/**\n * Resolve client-side monitoring configuration from either environmental variables\n * or shared config file. Configurations from environmental variables have higher priority\n * than those from shared config file. The resolver will try to read the shared config file\n * no matter whether the AWS_SDK_LOAD_CONFIG variable is set.\n * @api private\n */\nfunction resolveMonitoringConfig() {\n var config = {\n port: undefined,\n clientId: undefined,\n enabled: undefined,\n host: undefined\n };\n if (fromEnvironment(config) || fromConfigFile(config)) return toJSType(config);\n return toJSType(config);\n}\n\n/**\n * Resolve configurations from environmental variables.\n * @param {object} client side monitoring config object needs to be resolved\n * @returns {boolean} whether resolving configurations is done\n * @api private\n */\nfunction fromEnvironment(config) {\n config.port = config.port || process.env.AWS_CSM_PORT;\n config.enabled = config.enabled || process.env.AWS_CSM_ENABLED;\n config.clientId = config.clientId || process.env.AWS_CSM_CLIENT_ID;\n config.host = config.host || process.env.AWS_CSM_HOST;\n return config.port && config.enabled && config.clientId && config.host ||\n ['false', '0'].indexOf(config.enabled) >= 0; //no need to read shared config file if explicitely disabled\n}\n\n/**\n * Resolve cofigurations from shared config file with specified role name\n * @param {object} client side monitoring config object needs to be resolved\n * @returns {boolean} whether resolving configurations is done\n * @api private\n */\nfunction fromConfigFile(config) {\n var sharedFileConfig;\n try {\n var configFile = AWS.util.iniLoader.loadFrom({\n isConfig: true,\n filename: process.env[AWS.util.sharedConfigFileEnv]\n });\n var sharedFileConfig = configFile[\n process.env.AWS_PROFILE || AWS.util.defaultProfile\n ];\n } catch (err) {\n return false;\n }\n if (!sharedFileConfig) return config;\n config.port = config.port || sharedFileConfig.csm_port;\n config.enabled = config.enabled || sharedFileConfig.csm_enabled;\n config.clientId = config.clientId || sharedFileConfig.csm_client_id;\n config.host = config.host || sharedFileConfig.csm_host;\n return config.port && config.enabled && config.clientId && config.host;\n}\n\n/**\n * Transfer the resolved configuration value to proper types: port as number, enabled\n * as boolean and clientId as string. The 'enabled' flag is valued to false when set\n * to 'false' or '0'.\n * @param {object} resolved client side monitoring config\n * @api private\n */\nfunction toJSType(config) {\n //config.XXX is either undefined or string\n var falsyNotations = ['false', '0', undefined];\n if (!config.enabled || falsyNotations.indexOf(config.enabled.toLowerCase()) >= 0) {\n config.enabled = false;\n } else {\n config.enabled = true;\n }\n config.port = config.port ? parseInt(config.port, 10) : undefined;\n return config;\n}\n\nmodule.exports = resolveMonitoringConfig;\n", "var AWS = require('../core');\nvar os = require('os');\nvar path = require('path');\n\nfunction parseFile(filename, isConfig) {\n var content = AWS.util.ini.parse(AWS.util.readFileSync(filename));\n var tmpContent = {};\n Object.keys(content).forEach(function(profileName) {\n var profileContent = content[profileName];\n profileName = isConfig ? profileName.replace(/^profile\\s/, '') : profileName;\n Object.defineProperty(tmpContent, profileName, {\n value: profileContent,\n enumerable: true\n });\n });\n return tmpContent;\n}\n\n/**\n * Ini file loader class the same as that used in the SDK. It loads and\n * parses config and credentials files in .ini format and cache the content\n * to assure files are only read once.\n * Note that calling operations on the instance instantiated from this class\n * won't affect the behavior of SDK since SDK uses an internal singleton of\n * this class.\n * @!macro nobrowser\n */\nAWS.IniLoader = AWS.util.inherit({\n constructor: function IniLoader() {\n this.resolvedProfiles = {};\n },\n\n /** Remove all cached files. Used after config files are updated. */\n clearCachedFiles: function clearCachedFiles() {\n this.resolvedProfiles = {};\n },\n\n/**\n * Load configurations from config/credentials files and cache them\n * for later use. If no file is specified it will try to load default\n * files.\n * @param options [map] information describing the file\n * @option options filename [String] ('~/.aws/credentials' or defined by\n * AWS_SHARED_CREDENTIALS_FILE process env var or '~/.aws/config' if\n * isConfig is set to true)\n * path to the file to be read.\n * @option options isConfig [Boolean] (false) True to read config file.\n * @return [map] object containing contents from file in key-value\n * pairs.\n */\n loadFrom: function loadFrom(options) {\n options = options || {};\n var isConfig = options.isConfig === true;\n var filename = options.filename || this.getDefaultFilePath(isConfig);\n if (!this.resolvedProfiles[filename]) {\n var fileContent = this.parseFile(filename, isConfig);\n Object.defineProperty(this.resolvedProfiles, filename, { value: fileContent });\n }\n return this.resolvedProfiles[filename];\n },\n\n /**\n * @api private\n */\n parseFile: parseFile,\n\n /**\n * @api private\n */\n getDefaultFilePath: function getDefaultFilePath(isConfig) {\n return path.join(\n this.getHomeDir(),\n '.aws',\n isConfig ? 'config' : 'credentials'\n );\n },\n\n /**\n * @api private\n */\n getHomeDir: function getHomeDir() {\n var env = process.env;\n var home = env.HOME ||\n env.USERPROFILE ||\n (env.HOMEPATH ? ((env.HOMEDRIVE || 'C:/') + env.HOMEPATH) : null);\n\n if (home) {\n return home;\n }\n\n if (typeof os.homedir === 'function') {\n return os.homedir();\n }\n\n throw AWS.util.error(\n new Error('Cannot load credentials, HOME path not set')\n );\n }\n});\n\nvar IniLoader = AWS.IniLoader;\n\nmodule.exports = {\n IniLoader: IniLoader,\n parseFile: parseFile,\n};\n", "var IniLoader = require('./ini-loader').IniLoader;\n/**\n * Singleton object to load specified config/credentials files.\n * It will cache all the files ever loaded;\n */\nmodule.exports.iniLoader = new IniLoader();\n", "var AWS = require('./core');\n/**\n * @api private\n */\nfunction validateRegionalEndpointsFlagValue(configValue, errorOptions) {\n if (typeof configValue !== 'string') return undefined;\n else if (['legacy', 'regional'].indexOf(configValue.toLowerCase()) >= 0) {\n return configValue.toLowerCase();\n } else {\n throw AWS.util.error(new Error(), errorOptions);\n }\n}\n\n/**\n * Resolve the configuration value for regional endpoint from difference sources: client\n * config, environmental variable, shared config file. Value can be case-insensitive\n * 'legacy' or 'reginal'.\n * @param originalConfig user-supplied config object to resolve\n * @param options a map of config property names from individual configuration source\n * - env: name of environmental variable that refers to the config\n * - sharedConfig: name of shared configuration file property that refers to the config\n * - clientConfig: name of client configuration property that refers to the config\n *\n * @api private\n */\nfunction resolveRegionalEndpointsFlag(originalConfig, options) {\n originalConfig = originalConfig || {};\n //validate config value\n var resolved;\n if (originalConfig[options.clientConfig]) {\n resolved = validateRegionalEndpointsFlagValue(originalConfig[options.clientConfig], {\n code: 'InvalidConfiguration',\n message: 'invalid \"' + options.clientConfig + '\" configuration. Expect \"legacy\" ' +\n ' or \"regional\". Got \"' + originalConfig[options.clientConfig] + '\".'\n });\n if (resolved) return resolved;\n }\n if (!AWS.util.isNode()) return resolved;\n //validate environmental variable\n if (Object.prototype.hasOwnProperty.call(process.env, options.env)) {\n var envFlag = process.env[options.env];\n resolved = validateRegionalEndpointsFlagValue(envFlag, {\n code: 'InvalidEnvironmentalVariable',\n message: 'invalid ' + options.env + ' environmental variable. Expect \"legacy\" ' +\n ' or \"regional\". Got \"' + process.env[options.env] + '\".'\n });\n if (resolved) return resolved;\n }\n //validate shared config file\n var profile = {};\n try {\n var profiles = AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader);\n profile = profiles[process.env.AWS_PROFILE || AWS.util.defaultProfile];\n } catch (e) {};\n if (profile && Object.prototype.hasOwnProperty.call(profile, options.sharedConfig)) {\n var fileFlag = profile[options.sharedConfig];\n resolved = validateRegionalEndpointsFlagValue(fileFlag, {\n code: 'InvalidConfiguration',\n message: 'invalid ' + options.sharedConfig + ' profile config. Expect \"legacy\" ' +\n ' or \"regional\". Got \"' + profile[options.sharedConfig] + '\".'\n });\n if (resolved) return resolved;\n }\n return resolved;\n}\n\nmodule.exports = resolveRegionalEndpointsFlag;\n", "var AWS = require('../core');\nvar resolveRegionalEndpointsFlag = require('../config_regional_endpoint');\nvar ENV_REGIONAL_ENDPOINT_ENABLED = 'AWS_STS_REGIONAL_ENDPOINTS';\nvar CONFIG_REGIONAL_ENDPOINT_ENABLED = 'sts_regional_endpoints';\n\nAWS.util.update(AWS.STS.prototype, {\n /**\n * @overload credentialsFrom(data, credentials = null)\n * Creates a credentials object from STS response data containing\n * credentials information. Useful for quickly setting AWS credentials.\n *\n * @note This is a low-level utility function. If you want to load temporary\n * credentials into your process for subsequent requests to AWS resources,\n * you should use {AWS.TemporaryCredentials} instead.\n * @param data [map] data retrieved from a call to {getFederatedToken},\n * {getSessionToken}, {assumeRole}, or {assumeRoleWithWebIdentity}.\n * @param credentials [AWS.Credentials] an optional credentials object to\n * fill instead of creating a new object. Useful when modifying an\n * existing credentials object from a refresh call.\n * @return [AWS.TemporaryCredentials] the set of temporary credentials\n * loaded from a raw STS operation response.\n * @example Using credentialsFrom to load global AWS credentials\n * var sts = new AWS.STS();\n * sts.getSessionToken(function (err, data) {\n * if (err) console.log(\"Error getting credentials\");\n * else {\n * AWS.config.credentials = sts.credentialsFrom(data);\n * }\n * });\n * @see AWS.TemporaryCredentials\n */\n credentialsFrom: function credentialsFrom(data, credentials) {\n if (!data) return null;\n if (!credentials) credentials = new AWS.TemporaryCredentials();\n credentials.expired = false;\n credentials.accessKeyId = data.Credentials.AccessKeyId;\n credentials.secretAccessKey = data.Credentials.SecretAccessKey;\n credentials.sessionToken = data.Credentials.SessionToken;\n credentials.expireTime = data.Credentials.Expiration;\n return credentials;\n },\n\n assumeRoleWithWebIdentity: function assumeRoleWithWebIdentity(params, callback) {\n return this.makeUnauthenticatedRequest('assumeRoleWithWebIdentity', params, callback);\n },\n\n assumeRoleWithSAML: function assumeRoleWithSAML(params, callback) {\n return this.makeUnauthenticatedRequest('assumeRoleWithSAML', params, callback);\n },\n\n /**\n * @api private\n */\n setupRequestListeners: function setupRequestListeners(request) {\n request.addListener('validate', this.optInRegionalEndpoint, true);\n },\n\n /**\n * @api private\n */\n optInRegionalEndpoint: function optInRegionalEndpoint(req) {\n var service = req.service;\n var config = service.config;\n config.stsRegionalEndpoints = resolveRegionalEndpointsFlag(service._originalConfig, {\n env: ENV_REGIONAL_ENDPOINT_ENABLED,\n sharedConfig: CONFIG_REGIONAL_ENDPOINT_ENABLED,\n clientConfig: 'stsRegionalEndpoints'\n });\n if (\n config.stsRegionalEndpoints === 'regional' &&\n service.isGlobalEndpoint\n ) {\n //client will throw if region is not supplied; request will be signed with specified region\n if (!config.region) {\n throw AWS.util.error(new Error(),\n {code: 'ConfigError', message: 'Missing region in config'});\n }\n var insertPoint = config.endpoint.indexOf('.amazonaws.com');\n var regionalEndpoint = config.endpoint.substring(0, insertPoint) +\n '.' + config.region + config.endpoint.substring(insertPoint);\n req.httpRequest.updateEndpoint(regionalEndpoint);\n req.httpRequest.region = config.region;\n }\n }\n\n});\n", "require('../lib/node_loader');\nvar AWS = require('../lib/core');\nvar Service = AWS.Service;\nvar apiLoader = AWS.apiLoader;\n\napiLoader.services['sts'] = {};\nAWS.STS = Service.defineService('sts', ['2011-06-15']);\nrequire('../lib/services/sts');\nObject.defineProperty(apiLoader.services['sts'], '2011-06-15', {\n get: function get() {\n var model = require('../apis/sts-2011-06-15.min.json');\n model.paginators = require('../apis/sts-2011-06-15.paginators.json').pagination;\n return model;\n },\n enumerable: true,\n configurable: true\n});\n\nmodule.exports = AWS.STS;\n", "var AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n/**\n * Represents temporary credentials retrieved from {AWS.STS}. Without any\n * extra parameters, credentials will be fetched from the\n * {AWS.STS.getSessionToken} operation. If an IAM role is provided, the\n * {AWS.STS.assumeRole} operation will be used to fetch credentials for the\n * role instead.\n *\n * @note AWS.TemporaryCredentials is deprecated, but remains available for\n * backwards compatibility. {AWS.ChainableTemporaryCredentials} is the\n * preferred class for temporary credentials.\n *\n * To setup temporary credentials, configure a set of master credentials\n * using the standard credentials providers (environment, EC2 instance metadata,\n * or from the filesystem), then set the global credentials to a new\n * temporary credentials object:\n *\n * ```javascript\n * // Note that environment credentials are loaded by default,\n * // the following line is shown for clarity:\n * AWS.config.credentials = new AWS.EnvironmentCredentials('AWS');\n *\n * // Now set temporary credentials seeded from the master credentials\n * AWS.config.credentials = new AWS.TemporaryCredentials();\n *\n * // subsequent requests will now use temporary credentials from AWS STS.\n * new AWS.S3().listBucket(function(err, data) { ... });\n * ```\n *\n * @!attribute masterCredentials\n * @return [AWS.Credentials] the master (non-temporary) credentials used to\n * get and refresh temporary credentials from AWS STS.\n * @note (see constructor)\n */\nAWS.TemporaryCredentials = AWS.util.inherit(AWS.Credentials, {\n /**\n * Creates a new temporary credentials object.\n *\n * @note In order to create temporary credentials, you first need to have\n * \"master\" credentials configured in {AWS.Config.credentials}. These\n * master credentials are necessary to retrieve the temporary credentials,\n * as well as refresh the credentials when they expire.\n * @param params [map] a map of options that are passed to the\n * {AWS.STS.assumeRole} or {AWS.STS.getSessionToken} operations.\n * If a `RoleArn` parameter is passed in, credentials will be based on the\n * IAM role.\n * @param masterCredentials [AWS.Credentials] the master (non-temporary) credentials\n * used to get and refresh temporary credentials from AWS STS.\n * @example Creating a new credentials object for generic temporary credentials\n * AWS.config.credentials = new AWS.TemporaryCredentials();\n * @example Creating a new credentials object for an IAM role\n * AWS.config.credentials = new AWS.TemporaryCredentials({\n * RoleArn: 'arn:aws:iam::1234567890:role/TemporaryCredentials',\n * });\n * @see AWS.STS.assumeRole\n * @see AWS.STS.getSessionToken\n */\n constructor: function TemporaryCredentials(params, masterCredentials) {\n AWS.Credentials.call(this);\n this.loadMasterCredentials(masterCredentials);\n this.expired = true;\n\n this.params = params || {};\n if (this.params.RoleArn) {\n this.params.RoleSessionName =\n this.params.RoleSessionName || 'temporary-credentials';\n }\n },\n\n /**\n * Refreshes credentials using {AWS.STS.assumeRole} or\n * {AWS.STS.getSessionToken}, depending on whether an IAM role ARN was passed\n * to the credentials {constructor}.\n *\n * @callback callback function(err)\n * Called when the STS service responds (or fails). When\n * this callback is called with no error, it means that the credentials\n * information has been loaded into the object (as the `accessKeyId`,\n * `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @see get\n */\n refresh: function refresh (callback) {\n this.coalesceRefresh(callback || AWS.util.fn.callback);\n },\n\n /**\n * @api private\n */\n load: function load (callback) {\n var self = this;\n self.createClients();\n self.masterCredentials.get(function () {\n self.service.config.credentials = self.masterCredentials;\n var operation = self.params.RoleArn ?\n self.service.assumeRole : self.service.getSessionToken;\n operation.call(self.service, function (err, data) {\n if (!err) {\n self.service.credentialsFrom(data, self);\n }\n callback(err);\n });\n });\n },\n\n /**\n * @api private\n */\n loadMasterCredentials: function loadMasterCredentials (masterCredentials) {\n this.masterCredentials = masterCredentials || AWS.config.credentials;\n while (this.masterCredentials.masterCredentials) {\n this.masterCredentials = this.masterCredentials.masterCredentials;\n }\n\n if (typeof this.masterCredentials.get !== 'function') {\n this.masterCredentials = new AWS.Credentials(this.masterCredentials);\n }\n },\n\n /**\n * @api private\n */\n createClients: function () {\n this.service = this.service || new STS({params: this.params});\n }\n\n});\n", "var AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n/**\n * Represents temporary credentials retrieved from {AWS.STS}. Without any\n * extra parameters, credentials will be fetched from the\n * {AWS.STS.getSessionToken} operation. If an IAM role is provided, the\n * {AWS.STS.assumeRole} operation will be used to fetch credentials for the\n * role instead.\n *\n * AWS.ChainableTemporaryCredentials differs from AWS.TemporaryCredentials in\n * the way masterCredentials and refreshes are handled.\n * AWS.ChainableTemporaryCredentials refreshes expired credentials using the\n * masterCredentials passed by the user to support chaining of STS credentials.\n * However, AWS.TemporaryCredentials recursively collapses the masterCredentials\n * during instantiation, precluding the ability to refresh credentials which\n * require intermediate, temporary credentials.\n *\n * For example, if the application should use RoleA, which must be assumed from\n * RoleB, and the environment provides credentials which can assume RoleB, then\n * AWS.ChainableTemporaryCredentials must be used to support refreshing the\n * temporary credentials for RoleA:\n *\n * ```javascript\n * var roleACreds = new AWS.ChainableTemporaryCredentials({\n * params: {RoleArn: 'RoleA'},\n * masterCredentials: new AWS.ChainableTemporaryCredentials({\n * params: {RoleArn: 'RoleB'},\n * masterCredentials: new AWS.EnvironmentCredentials('AWS')\n * })\n * });\n * ```\n *\n * If AWS.TemporaryCredentials had been used in the previous example,\n * `roleACreds` would fail to refresh because `roleACreds` would\n * use the environment credentials for the AssumeRole request.\n *\n * Another difference is that AWS.ChainableTemporaryCredentials creates the STS\n * service instance during instantiation while AWS.TemporaryCredentials creates\n * the STS service instance during the first refresh. Creating the service\n * instance during instantiation effectively captures the master credentials\n * from the global config, so that subsequent changes to the global config do\n * not affect the master credentials used to refresh the temporary credentials.\n *\n * This allows an instance of AWS.ChainableTemporaryCredentials to be assigned\n * to AWS.config.credentials:\n *\n * ```javascript\n * var envCreds = new AWS.EnvironmentCredentials('AWS');\n * AWS.config.credentials = envCreds;\n * // masterCredentials will be envCreds\n * AWS.config.credentials = new AWS.ChainableTemporaryCredentials({\n * params: {RoleArn: '...'}\n * });\n * ```\n *\n * Similarly, to use the CredentialProviderChain's default providers as the\n * master credentials, simply create a new instance of\n * AWS.ChainableTemporaryCredentials:\n *\n * ```javascript\n * AWS.config.credentials = new ChainableTemporaryCredentials({\n * params: {RoleArn: '...'}\n * });\n * ```\n *\n * @!attribute service\n * @return [AWS.STS] the STS service instance used to\n * get and refresh temporary credentials from AWS STS.\n * @note (see constructor)\n */\nAWS.ChainableTemporaryCredentials = AWS.util.inherit(AWS.Credentials, {\n /**\n * Creates a new temporary credentials object.\n *\n * @param options [map] a set of options\n * @option options params [map] ({}) a map of options that are passed to the\n * {AWS.STS.assumeRole} or {AWS.STS.getSessionToken} operations.\n * If a `RoleArn` parameter is passed in, credentials will be based on the\n * IAM role. If a `SerialNumber` parameter is passed in, {tokenCodeFn} must\n * also be passed in or an error will be thrown.\n * @option options masterCredentials [AWS.Credentials] the master credentials\n * used to get and refresh temporary credentials from AWS STS. By default,\n * AWS.config.credentials or AWS.config.credentialProvider will be used.\n * @option options tokenCodeFn [Function] (null) Function to provide\n * `TokenCode`, if `SerialNumber` is provided for profile in {params}. Function\n * is called with value of `SerialNumber` and `callback`, and should provide\n * the `TokenCode` or an error to the callback in the format\n * `callback(err, token)`.\n * @example Creating a new credentials object for generic temporary credentials\n * AWS.config.credentials = new AWS.ChainableTemporaryCredentials();\n * @example Creating a new credentials object for an IAM role\n * AWS.config.credentials = new AWS.ChainableTemporaryCredentials({\n * params: {\n * RoleArn: 'arn:aws:iam::1234567890:role/TemporaryCredentials'\n * }\n * });\n * @see AWS.STS.assumeRole\n * @see AWS.STS.getSessionToken\n */\n constructor: function ChainableTemporaryCredentials(options) {\n AWS.Credentials.call(this);\n options = options || {};\n this.errorCode = 'ChainableTemporaryCredentialsProviderFailure';\n this.expired = true;\n this.tokenCodeFn = null;\n\n var params = AWS.util.copy(options.params) || {};\n if (params.RoleArn) {\n params.RoleSessionName = params.RoleSessionName || 'temporary-credentials';\n }\n if (params.SerialNumber) {\n if (!options.tokenCodeFn || (typeof options.tokenCodeFn !== 'function')) {\n throw new AWS.util.error(\n new Error('tokenCodeFn must be a function when params.SerialNumber is given'),\n {code: this.errorCode}\n );\n } else {\n this.tokenCodeFn = options.tokenCodeFn;\n }\n }\n var config = AWS.util.merge(\n {\n params: params,\n credentials: options.masterCredentials || AWS.config.credentials\n },\n options.stsConfig || {}\n );\n this.service = new STS(config);\n },\n\n /**\n * Refreshes credentials using {AWS.STS.assumeRole} or\n * {AWS.STS.getSessionToken}, depending on whether an IAM role ARN was passed\n * to the credentials {constructor}.\n *\n * @callback callback function(err)\n * Called when the STS service responds (or fails). When\n * this callback is called with no error, it means that the credentials\n * information has been loaded into the object (as the `accessKeyId`,\n * `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @see AWS.Credentials.get\n */\n refresh: function refresh(callback) {\n this.coalesceRefresh(callback || AWS.util.fn.callback);\n },\n\n /**\n * @api private\n * @param callback\n */\n load: function load(callback) {\n var self = this;\n var operation = self.service.config.params.RoleArn ? 'assumeRole' : 'getSessionToken';\n this.getTokenCode(function (err, tokenCode) {\n var params = {};\n if (err) {\n callback(err);\n return;\n }\n if (tokenCode) {\n params.TokenCode = tokenCode;\n }\n self.service[operation](params, function (err, data) {\n if (!err) {\n self.service.credentialsFrom(data, self);\n }\n callback(err);\n });\n });\n },\n\n /**\n * @api private\n */\n getTokenCode: function getTokenCode(callback) {\n var self = this;\n if (this.tokenCodeFn) {\n this.tokenCodeFn(this.service.config.params.SerialNumber, function (err, token) {\n if (err) {\n var message = err;\n if (err instanceof Error) {\n message = err.message;\n }\n callback(\n AWS.util.error(\n new Error('Error fetching MFA token: ' + message),\n { code: self.errorCode}\n )\n );\n return;\n }\n callback(null, token);\n });\n } else {\n callback(null);\n }\n }\n});\n", "var AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n/**\n * Represents credentials retrieved from STS Web Identity Federation support.\n *\n * By default this provider gets credentials using the\n * {AWS.STS.assumeRoleWithWebIdentity} service operation. This operation\n * requires a `RoleArn` containing the ARN of the IAM trust policy for the\n * application for which credentials will be given. In addition, the\n * `WebIdentityToken` must be set to the token provided by the identity\n * provider. See {constructor} for an example on creating a credentials\n * object with proper `RoleArn` and `WebIdentityToken` values.\n *\n * ## Refreshing Credentials from Identity Service\n *\n * In addition to AWS credentials expiring after a given amount of time, the\n * login token from the identity provider will also expire. Once this token\n * expires, it will not be usable to refresh AWS credentials, and another\n * token will be needed. The SDK does not manage refreshing of the token value,\n * but this can be done through a \"refresh token\" supported by most identity\n * providers. Consult the documentation for the identity provider for refreshing\n * tokens. Once the refreshed token is acquired, you should make sure to update\n * this new token in the credentials object's {params} property. The following\n * code will update the WebIdentityToken, assuming you have retrieved an updated\n * token from the identity provider:\n *\n * ```javascript\n * AWS.config.credentials.params.WebIdentityToken = updatedToken;\n * ```\n *\n * Future calls to `credentials.refresh()` will now use the new token.\n *\n * @!attribute params\n * @return [map] the map of params passed to\n * {AWS.STS.assumeRoleWithWebIdentity}. To update the token, set the\n * `params.WebIdentityToken` property.\n * @!attribute data\n * @return [map] the raw data response from the call to\n * {AWS.STS.assumeRoleWithWebIdentity}. Use this if you want to get\n * access to other properties from the response.\n */\nAWS.WebIdentityCredentials = AWS.util.inherit(AWS.Credentials, {\n /**\n * Creates a new credentials object.\n * @param (see AWS.STS.assumeRoleWithWebIdentity)\n * @example Creating a new credentials object\n * AWS.config.credentials = new AWS.WebIdentityCredentials({\n * RoleArn: 'arn:aws:iam::1234567890:role/WebIdentity',\n * WebIdentityToken: 'ABCDEFGHIJKLMNOP', // token from identity service\n * RoleSessionName: 'web' // optional name, defaults to web-identity\n * }, {\n * // optionally provide configuration to apply to the underlying AWS.STS service client\n * // if configuration is not provided, then configuration will be pulled from AWS.config\n *\n * // specify timeout options\n * httpOptions: {\n * timeout: 100\n * }\n * });\n * @see AWS.STS.assumeRoleWithWebIdentity\n * @see AWS.Config\n */\n constructor: function WebIdentityCredentials(params, clientConfig) {\n AWS.Credentials.call(this);\n this.expired = true;\n this.params = params;\n this.params.RoleSessionName = this.params.RoleSessionName || 'web-identity';\n this.data = null;\n this._clientConfig = AWS.util.copy(clientConfig || {});\n },\n\n /**\n * Refreshes credentials using {AWS.STS.assumeRoleWithWebIdentity}\n *\n * @callback callback function(err)\n * Called when the STS service responds (or fails). When\n * this callback is called with no error, it means that the credentials\n * information has been loaded into the object (as the `accessKeyId`,\n * `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @see get\n */\n refresh: function refresh(callback) {\n this.coalesceRefresh(callback || AWS.util.fn.callback);\n },\n\n /**\n * @api private\n */\n load: function load(callback) {\n var self = this;\n self.createClients();\n self.service.assumeRoleWithWebIdentity(function (err, data) {\n self.data = null;\n if (!err) {\n self.data = data;\n self.service.credentialsFrom(data, self);\n }\n callback(err);\n });\n },\n\n /**\n * @api private\n */\n createClients: function() {\n if (!this.service) {\n var stsConfig = AWS.util.merge({}, this._clientConfig);\n stsConfig.params = this.params;\n this.service = new STS(stsConfig);\n }\n }\n\n});\n", "require('../lib/node_loader');\nvar AWS = require('../lib/core');\nvar Service = AWS.Service;\nvar apiLoader = AWS.apiLoader;\n\napiLoader.services['cognitoidentity'] = {};\nAWS.CognitoIdentity = Service.defineService('cognitoidentity', ['2014-06-30']);\nObject.defineProperty(apiLoader.services['cognitoidentity'], '2014-06-30', {\n get: function get() {\n var model = require('../apis/cognito-identity-2014-06-30.min.json');\n model.paginators = require('../apis/cognito-identity-2014-06-30.paginators.json').pagination;\n return model;\n },\n enumerable: true,\n configurable: true\n});\n\nmodule.exports = AWS.CognitoIdentity;\n", "var AWS = require('../core');\nvar CognitoIdentity = require('../../clients/cognitoidentity');\nvar STS = require('../../clients/sts');\n\n/**\n * Represents credentials retrieved from STS Web Identity Federation using\n * the Amazon Cognito Identity service.\n *\n * By default this provider gets credentials using the\n * {AWS.CognitoIdentity.getCredentialsForIdentity} service operation, which\n * requires either an `IdentityId` or an `IdentityPoolId` (Amazon Cognito\n * Identity Pool ID), which is used to call {AWS.CognitoIdentity.getId} to\n * obtain an `IdentityId`. If the identity or identity pool is not configured in\n * the Amazon Cognito Console to use IAM roles with the appropriate permissions,\n * then additionally a `RoleArn` is required containing the ARN of the IAM trust\n * policy for the Amazon Cognito role that the user will log into. If a `RoleArn`\n * is provided, then this provider gets credentials using the\n * {AWS.STS.assumeRoleWithWebIdentity} service operation, after first getting an\n * Open ID token from {AWS.CognitoIdentity.getOpenIdToken}.\n *\n * In addition, if this credential provider is used to provide authenticated\n * login, the `Logins` map may be set to the tokens provided by the respective\n * identity providers. See {constructor} for an example on creating a credentials\n * object with proper property values.\n *\n * ## Refreshing Credentials from Identity Service\n *\n * In addition to AWS credentials expiring after a given amount of time, the\n * login token from the identity provider will also expire. Once this token\n * expires, it will not be usable to refresh AWS credentials, and another\n * token will be needed. The SDK does not manage refreshing of the token value,\n * but this can be done through a \"refresh token\" supported by most identity\n * providers. Consult the documentation for the identity provider for refreshing\n * tokens. Once the refreshed token is acquired, you should make sure to update\n * this new token in the credentials object's {params} property. The following\n * code will update the WebIdentityToken, assuming you have retrieved an updated\n * token from the identity provider:\n *\n * ```javascript\n * AWS.config.credentials.params.Logins['graph.facebook.com'] = updatedToken;\n * ```\n *\n * Future calls to `credentials.refresh()` will now use the new token.\n *\n * @!attribute params\n * @return [map] the map of params passed to\n * {AWS.CognitoIdentity.getId},\n * {AWS.CognitoIdentity.getOpenIdToken}, and\n * {AWS.STS.assumeRoleWithWebIdentity}. To update the token, set the\n * `params.WebIdentityToken` property.\n * @!attribute data\n * @return [map] the raw data response from the call to\n * {AWS.CognitoIdentity.getCredentialsForIdentity}, or\n * {AWS.STS.assumeRoleWithWebIdentity}. Use this if you want to get\n * access to other properties from the response.\n * @!attribute identityId\n * @return [String] the Cognito ID returned by the last call to\n * {AWS.CognitoIdentity.getOpenIdToken}. This ID represents the actual\n * final resolved identity ID from Amazon Cognito.\n */\nAWS.CognitoIdentityCredentials = AWS.util.inherit(AWS.Credentials, {\n /**\n * @api private\n */\n localStorageKey: {\n id: 'aws.cognito.identity-id.',\n providers: 'aws.cognito.identity-providers.'\n },\n\n /**\n * Creates a new credentials object.\n * @example Creating a new credentials object\n * AWS.config.credentials = new AWS.CognitoIdentityCredentials({\n *\n * // either IdentityPoolId or IdentityId is required\n * // See the IdentityPoolId param for AWS.CognitoIdentity.getID (linked below)\n * // See the IdentityId param for AWS.CognitoIdentity.getCredentialsForIdentity\n * // or AWS.CognitoIdentity.getOpenIdToken (linked below)\n * IdentityPoolId: 'us-east-1:1699ebc0-7900-4099-b910-2df94f52a030',\n * IdentityId: 'us-east-1:128d0a74-c82f-4553-916d-90053e4a8b0f'\n *\n * // optional, only necessary when the identity pool is not configured\n * // to use IAM roles in the Amazon Cognito Console\n * // See the RoleArn param for AWS.STS.assumeRoleWithWebIdentity (linked below)\n * RoleArn: 'arn:aws:iam::1234567890:role/MYAPP-CognitoIdentity',\n *\n * // optional tokens, used for authenticated login\n * // See the Logins param for AWS.CognitoIdentity.getID (linked below)\n * Logins: {\n * 'graph.facebook.com': 'FBTOKEN',\n * 'www.amazon.com': 'AMAZONTOKEN',\n * 'accounts.google.com': 'GOOGLETOKEN',\n * 'api.twitter.com': 'TWITTERTOKEN',\n * 'www.digits.com': 'DIGITSTOKEN'\n * },\n *\n * // optional name, defaults to web-identity\n * // See the RoleSessionName param for AWS.STS.assumeRoleWithWebIdentity (linked below)\n * RoleSessionName: 'web',\n *\n * // optional, only necessary when application runs in a browser\n * // and multiple users are signed in at once, used for caching\n * LoginId: 'example@gmail.com'\n *\n * }, {\n * // optionally provide configuration to apply to the underlying service clients\n * // if configuration is not provided, then configuration will be pulled from AWS.config\n *\n * // region should match the region your identity pool is located in\n * region: 'us-east-1',\n *\n * // specify timeout options\n * httpOptions: {\n * timeout: 100\n * }\n * });\n * @see AWS.CognitoIdentity.getId\n * @see AWS.CognitoIdentity.getCredentialsForIdentity\n * @see AWS.STS.assumeRoleWithWebIdentity\n * @see AWS.CognitoIdentity.getOpenIdToken\n * @see AWS.Config\n * @note If a region is not provided in the global AWS.config, or\n * specified in the `clientConfig` to the CognitoIdentityCredentials\n * constructor, you may encounter a 'Missing credentials in config' error\n * when calling making a service call.\n */\n constructor: function CognitoIdentityCredentials(params, clientConfig) {\n AWS.Credentials.call(this);\n this.expired = true;\n this.params = params;\n this.data = null;\n this._identityId = null;\n this._clientConfig = AWS.util.copy(clientConfig || {});\n this.loadCachedId();\n var self = this;\n Object.defineProperty(this, 'identityId', {\n get: function() {\n self.loadCachedId();\n return self._identityId || self.params.IdentityId;\n },\n set: function(identityId) {\n self._identityId = identityId;\n }\n });\n },\n\n /**\n * Refreshes credentials using {AWS.CognitoIdentity.getCredentialsForIdentity},\n * or {AWS.STS.assumeRoleWithWebIdentity}.\n *\n * @callback callback function(err)\n * Called when the STS service responds (or fails). When\n * this callback is called with no error, it means that the credentials\n * information has been loaded into the object (as the `accessKeyId`,\n * `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @see AWS.Credentials.get\n */\n refresh: function refresh(callback) {\n this.coalesceRefresh(callback || AWS.util.fn.callback);\n },\n\n /**\n * @api private\n * @param callback\n */\n load: function load(callback) {\n var self = this;\n self.createClients();\n self.data = null;\n self._identityId = null;\n self.getId(function(err) {\n if (!err) {\n if (!self.params.RoleArn) {\n self.getCredentialsForIdentity(callback);\n } else {\n self.getCredentialsFromSTS(callback);\n }\n } else {\n self.clearIdOnNotAuthorized(err);\n callback(err);\n }\n });\n },\n\n /**\n * Clears the cached Cognito ID associated with the currently configured\n * identity pool ID. Use this to manually invalidate your cache if\n * the identity pool ID was deleted.\n */\n clearCachedId: function clearCache() {\n this._identityId = null;\n delete this.params.IdentityId;\n\n var poolId = this.params.IdentityPoolId;\n var loginId = this.params.LoginId || '';\n delete this.storage[this.localStorageKey.id + poolId + loginId];\n delete this.storage[this.localStorageKey.providers + poolId + loginId];\n },\n\n /**\n * @api private\n */\n clearIdOnNotAuthorized: function clearIdOnNotAuthorized(err) {\n var self = this;\n if (err.code == 'NotAuthorizedException') {\n self.clearCachedId();\n }\n },\n\n /**\n * Retrieves a Cognito ID, loading from cache if it was already retrieved\n * on this device.\n *\n * @callback callback function(err, identityId)\n * @param err [Error, null] an error object if the call failed or null if\n * it succeeded.\n * @param identityId [String, null] if successful, the callback will return\n * the Cognito ID.\n * @note If not loaded explicitly, the Cognito ID is loaded and stored in\n * localStorage in the browser environment of a device.\n * @api private\n */\n getId: function getId(callback) {\n var self = this;\n if (typeof self.params.IdentityId === 'string') {\n return callback(null, self.params.IdentityId);\n }\n\n self.cognito.getId(function(err, data) {\n if (!err && data.IdentityId) {\n self.params.IdentityId = data.IdentityId;\n callback(null, data.IdentityId);\n } else {\n callback(err);\n }\n });\n },\n\n\n /**\n * @api private\n */\n loadCredentials: function loadCredentials(data, credentials) {\n if (!data || !credentials) return;\n credentials.expired = false;\n credentials.accessKeyId = data.Credentials.AccessKeyId;\n credentials.secretAccessKey = data.Credentials.SecretKey;\n credentials.sessionToken = data.Credentials.SessionToken;\n credentials.expireTime = data.Credentials.Expiration;\n },\n\n /**\n * @api private\n */\n getCredentialsForIdentity: function getCredentialsForIdentity(callback) {\n var self = this;\n self.cognito.getCredentialsForIdentity(function(err, data) {\n if (!err) {\n self.cacheId(data);\n self.data = data;\n self.loadCredentials(self.data, self);\n } else {\n self.clearIdOnNotAuthorized(err);\n }\n callback(err);\n });\n },\n\n /**\n * @api private\n */\n getCredentialsFromSTS: function getCredentialsFromSTS(callback) {\n var self = this;\n self.cognito.getOpenIdToken(function(err, data) {\n if (!err) {\n self.cacheId(data);\n self.params.WebIdentityToken = data.Token;\n self.webIdentityCredentials.refresh(function(webErr) {\n if (!webErr) {\n self.data = self.webIdentityCredentials.data;\n self.sts.credentialsFrom(self.data, self);\n }\n callback(webErr);\n });\n } else {\n self.clearIdOnNotAuthorized(err);\n callback(err);\n }\n });\n },\n\n /**\n * @api private\n */\n loadCachedId: function loadCachedId() {\n var self = this;\n\n // in the browser we source default IdentityId from localStorage\n if (AWS.util.isBrowser() && !self.params.IdentityId) {\n var id = self.getStorage('id');\n if (id && self.params.Logins) {\n var actualProviders = Object.keys(self.params.Logins);\n var cachedProviders =\n (self.getStorage('providers') || '').split(',');\n\n // only load ID if at least one provider used this ID before\n var intersect = cachedProviders.filter(function(n) {\n return actualProviders.indexOf(n) !== -1;\n });\n if (intersect.length !== 0) {\n self.params.IdentityId = id;\n }\n } else if (id) {\n self.params.IdentityId = id;\n }\n }\n },\n\n /**\n * @api private\n */\n createClients: function() {\n var clientConfig = this._clientConfig;\n this.webIdentityCredentials = this.webIdentityCredentials ||\n new AWS.WebIdentityCredentials(this.params, clientConfig);\n if (!this.cognito) {\n var cognitoConfig = AWS.util.merge({}, clientConfig);\n cognitoConfig.params = this.params;\n this.cognito = new CognitoIdentity(cognitoConfig);\n }\n this.sts = this.sts || new STS(clientConfig);\n },\n\n /**\n * @api private\n */\n cacheId: function cacheId(data) {\n this._identityId = data.IdentityId;\n this.params.IdentityId = this._identityId;\n\n // cache this IdentityId in browser localStorage if possible\n if (AWS.util.isBrowser()) {\n this.setStorage('id', data.IdentityId);\n\n if (this.params.Logins) {\n this.setStorage('providers', Object.keys(this.params.Logins).join(','));\n }\n }\n },\n\n /**\n * @api private\n */\n getStorage: function getStorage(key) {\n return this.storage[this.localStorageKey[key] + this.params.IdentityPoolId + (this.params.LoginId || '')];\n },\n\n /**\n * @api private\n */\n setStorage: function setStorage(key, val) {\n try {\n this.storage[this.localStorageKey[key] + this.params.IdentityPoolId + (this.params.LoginId || '')] = val;\n } catch (_) {}\n },\n\n /**\n * @api private\n */\n storage: (function() {\n try {\n var storage = AWS.util.isBrowser() && window.localStorage !== null && typeof window.localStorage === 'object' ?\n window.localStorage : {};\n\n // Test set/remove which would throw an error in Safari's private browsing\n storage['aws.test-storage'] = 'foobar';\n delete storage['aws.test-storage'];\n\n return storage;\n } catch (_) {\n return {};\n }\n })()\n});\n", "var AWS = require('../core');\nvar STS = require('../../clients/sts');\n\n/**\n * Represents credentials retrieved from STS SAML support.\n *\n * By default this provider gets credentials using the\n * {AWS.STS.assumeRoleWithSAML} service operation. This operation\n * requires a `RoleArn` containing the ARN of the IAM trust policy for the\n * application for which credentials will be given, as well as a `PrincipalArn`\n * representing the ARN for the SAML identity provider. In addition, the\n * `SAMLAssertion` must be set to the token provided by the identity\n * provider. See {constructor} for an example on creating a credentials\n * object with proper `RoleArn`, `PrincipalArn`, and `SAMLAssertion` values.\n *\n * ## Refreshing Credentials from Identity Service\n *\n * In addition to AWS credentials expiring after a given amount of time, the\n * login token from the identity provider will also expire. Once this token\n * expires, it will not be usable to refresh AWS credentials, and another\n * token will be needed. The SDK does not manage refreshing of the token value,\n * but this can be done through a \"refresh token\" supported by most identity\n * providers. Consult the documentation for the identity provider for refreshing\n * tokens. Once the refreshed token is acquired, you should make sure to update\n * this new token in the credentials object's {params} property. The following\n * code will update the SAMLAssertion, assuming you have retrieved an updated\n * token from the identity provider:\n *\n * ```javascript\n * AWS.config.credentials.params.SAMLAssertion = updatedToken;\n * ```\n *\n * Future calls to `credentials.refresh()` will now use the new token.\n *\n * @!attribute params\n * @return [map] the map of params passed to\n * {AWS.STS.assumeRoleWithSAML}. To update the token, set the\n * `params.SAMLAssertion` property.\n */\nAWS.SAMLCredentials = AWS.util.inherit(AWS.Credentials, {\n /**\n * Creates a new credentials object.\n * @param (see AWS.STS.assumeRoleWithSAML)\n * @example Creating a new credentials object\n * AWS.config.credentials = new AWS.SAMLCredentials({\n * RoleArn: 'arn:aws:iam::1234567890:role/SAMLRole',\n * PrincipalArn: 'arn:aws:iam::1234567890:role/SAMLPrincipal',\n * SAMLAssertion: 'base64-token', // base64-encoded token from IdP\n * });\n * @see AWS.STS.assumeRoleWithSAML\n */\n constructor: function SAMLCredentials(params) {\n AWS.Credentials.call(this);\n this.expired = true;\n this.params = params;\n },\n\n /**\n * Refreshes credentials using {AWS.STS.assumeRoleWithSAML}\n *\n * @callback callback function(err)\n * Called when the STS service responds (or fails). When\n * this callback is called with no error, it means that the credentials\n * information has been loaded into the object (as the `accessKeyId`,\n * `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @see get\n */\n refresh: function refresh(callback) {\n this.coalesceRefresh(callback || AWS.util.fn.callback);\n },\n\n /**\n * @api private\n */\n load: function load(callback) {\n var self = this;\n self.createClients();\n self.service.assumeRoleWithSAML(function (err, data) {\n if (!err) {\n self.service.credentialsFrom(data, self);\n }\n callback(err);\n });\n },\n\n /**\n * @api private\n */\n createClients: function() {\n this.service = this.service || new STS({params: this.params});\n }\n\n});\n", "var AWS = require('../core');\nvar proc = require('child_process');\nvar iniLoader = AWS.util.iniLoader;\n\n/**\n * Represents credentials loaded from shared credentials file\n * (defaulting to ~/.aws/credentials or defined by the\n * `AWS_SHARED_CREDENTIALS_FILE` environment variable).\n *\n * ## Using process credentials\n *\n * The credentials file can specify a credential provider that executes\n * a given process and attempts to read its stdout to recieve a JSON payload\n * containing the credentials:\n *\n * [default]\n * credential_process = /usr/bin/credential_proc\n *\n * Automatically handles refreshing credentials if an Expiration time is\n * provided in the credentials payload. Credentials supplied in the same profile\n * will take precedence over the credential_process.\n *\n * Sourcing credentials from an external process can potentially be dangerous,\n * so proceed with caution. Other credential providers should be preferred if\n * at all possible. If using this option, you should make sure that the shared\n * credentials file is as locked down as possible using security best practices\n * for your operating system.\n *\n * ## Using custom profiles\n *\n * The SDK supports loading credentials for separate profiles. This can be done\n * in two ways:\n *\n * 1. Set the `AWS_PROFILE` environment variable in your process prior to\n * loading the SDK.\n * 2. Directly load the AWS.ProcessCredentials provider:\n *\n * ```javascript\n * var creds = new AWS.ProcessCredentials({profile: 'myprofile'});\n * AWS.config.credentials = creds;\n * ```\n *\n * @!macro nobrowser\n */\nAWS.ProcessCredentials = AWS.util.inherit(AWS.Credentials, {\n /**\n * Creates a new ProcessCredentials object.\n *\n * @param options [map] a set of options\n * @option options profile [String] (AWS_PROFILE env var or 'default')\n * the name of the profile to load.\n * @option options filename [String] ('~/.aws/credentials' or defined by\n * AWS_SHARED_CREDENTIALS_FILE process env var)\n * the filename to use when loading credentials.\n * @option options callback [Function] (err) Credentials are eagerly loaded\n * by the constructor. When the callback is called with no error, the\n * credentials have been loaded successfully.\n */\n constructor: function ProcessCredentials(options) {\n AWS.Credentials.call(this);\n\n options = options || {};\n\n this.filename = options.filename;\n this.profile = options.profile || process.env.AWS_PROFILE || AWS.util.defaultProfile;\n this.get(options.callback || AWS.util.fn.noop);\n },\n\n /**\n * @api private\n */\n load: function load(callback) {\n var self = this;\n try {\n var profiles = AWS.util.getProfilesFromSharedConfig(iniLoader, this.filename);\n var profile = profiles[this.profile] || {};\n\n if (Object.keys(profile).length === 0) {\n throw AWS.util.error(\n new Error('Profile ' + this.profile + ' not found'),\n { code: 'ProcessCredentialsProviderFailure' }\n );\n }\n\n if (profile['credential_process']) {\n this.loadViaCredentialProcess(profile, function(err, data) {\n if (err) {\n callback(err, null);\n } else {\n self.expired = false;\n self.accessKeyId = data.AccessKeyId;\n self.secretAccessKey = data.SecretAccessKey;\n self.sessionToken = data.SessionToken;\n if (data.Expiration) {\n self.expireTime = new Date(data.Expiration);\n }\n callback(null);\n }\n });\n } else {\n throw AWS.util.error(\n new Error('Profile ' + this.profile + ' did not include credential process'),\n { code: 'ProcessCredentialsProviderFailure' }\n );\n }\n } catch (err) {\n callback(err);\n }\n },\n\n /**\n * Executes the credential_process and retrieves\n * credentials from the output\n * @api private\n * @param profile [map] credentials profile\n * @throws ProcessCredentialsProviderFailure\n */\n loadViaCredentialProcess: function loadViaCredentialProcess(profile, callback) {\n proc.exec(profile['credential_process'], { env: process.env }, function(err, stdOut, stdErr) {\n if (err) {\n callback(AWS.util.error(\n new Error('credential_process returned error'),\n { code: 'ProcessCredentialsProviderFailure'}\n ), null);\n } else {\n try {\n var credData = JSON.parse(stdOut);\n if (credData.Expiration) {\n var currentTime = AWS.util.date.getDate();\n var expireTime = new Date(credData.Expiration);\n if (expireTime < currentTime) {\n throw Error('credential_process returned expired credentials');\n }\n }\n\n if (credData.Version !== 1) {\n throw Error('credential_process does not return Version == 1');\n }\n callback(null, credData);\n } catch (err) {\n callback(AWS.util.error(\n new Error(err.message),\n { code: 'ProcessCredentialsProviderFailure'}\n ), null);\n }\n }\n });\n },\n\n /**\n * Loads the credentials from the credential process\n *\n * @callback callback function(err)\n * Called after the credential process has been executed. When this\n * callback is called with no error, it means that the credentials\n * information has been loaded into the object (as the `accessKeyId`,\n * `secretAccessKey`, and `sessionToken` properties).\n * @param err [Error] if an error occurred, this value will be filled\n * @see get\n */\n refresh: function refresh(callback) {\n iniLoader.clearCachedFiles();\n this.coalesceRefresh(callback || AWS.util.fn.callback);\n }\n});\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n exports.defaults = {\n \"0.1\": {\n explicitCharkey: false,\n trim: true,\n normalize: true,\n normalizeTags: false,\n attrkey: \"@\",\n charkey: \"#\",\n explicitArray: false,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: false,\n validator: null,\n xmlns: false,\n explicitChildren: false,\n childkey: '@@',\n charsAsChildren: false,\n includeWhiteChars: false,\n async: false,\n strict: true,\n attrNameProcessors: null,\n attrValueProcessors: null,\n tagNameProcessors: null,\n valueProcessors: null,\n emptyTag: ''\n },\n \"0.2\": {\n explicitCharkey: false,\n trim: false,\n normalize: false,\n normalizeTags: false,\n attrkey: \"$\",\n charkey: \"_\",\n explicitArray: true,\n ignoreAttrs: false,\n mergeAttrs: false,\n explicitRoot: true,\n validator: null,\n xmlns: false,\n explicitChildren: false,\n preserveChildrenOrder: false,\n childkey: '$$',\n charsAsChildren: false,\n includeWhiteChars: false,\n async: false,\n strict: true,\n attrNameProcessors: null,\n attrValueProcessors: null,\n tagNameProcessors: null,\n valueProcessors: null,\n rootName: 'root',\n xmldec: {\n 'version': '1.0',\n 'encoding': 'UTF-8',\n 'standalone': true\n },\n doctype: null,\n renderOpts: {\n 'pretty': true,\n 'indent': ' ',\n 'newline': '\\n'\n },\n headless: false,\n chunkSize: 10000,\n emptyTag: '',\n cdata: false\n }\n };\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var assign, isArray, isEmpty, isFunction, isObject, isPlainObject,\n slice = [].slice,\n hasProp = {}.hasOwnProperty;\n\n assign = function() {\n var i, key, len, source, sources, target;\n target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];\n if (isFunction(Object.assign)) {\n Object.assign.apply(null, arguments);\n } else {\n for (i = 0, len = sources.length; i < len; i++) {\n source = sources[i];\n if (source != null) {\n for (key in source) {\n if (!hasProp.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n }\n }\n return target;\n };\n\n isFunction = function(val) {\n return !!val && Object.prototype.toString.call(val) === '[object Function]';\n };\n\n isObject = function(val) {\n var ref;\n return !!val && ((ref = typeof val) === 'function' || ref === 'object');\n };\n\n isArray = function(val) {\n if (isFunction(Array.isArray)) {\n return Array.isArray(val);\n } else {\n return Object.prototype.toString.call(val) === '[object Array]';\n }\n };\n\n isEmpty = function(val) {\n var key;\n if (isArray(val)) {\n return !val.length;\n } else {\n for (key in val) {\n if (!hasProp.call(val, key)) continue;\n return false;\n }\n return true;\n }\n };\n\n isPlainObject = function(val) {\n var ctor, proto;\n return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));\n };\n\n module.exports.assign = assign;\n\n module.exports.isFunction = isFunction;\n\n module.exports.isObject = isObject;\n\n module.exports.isArray = isArray;\n\n module.exports.isEmpty = isEmpty;\n\n module.exports.isPlainObject = isPlainObject;\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLAttribute;\n\n module.exports = XMLAttribute = (function() {\n function XMLAttribute(parent, name, value) {\n this.options = parent.options;\n this.stringify = parent.stringify;\n if (name == null) {\n throw new Error(\"Missing attribute name of element \" + parent.name);\n }\n if (value == null) {\n throw new Error(\"Missing attribute value for attribute \" + name + \" of element \" + parent.name);\n }\n this.name = this.stringify.attName(name);\n this.value = this.stringify.attValue(value);\n }\n\n XMLAttribute.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLAttribute.prototype.toString = function(options) {\n return this.options.writer.set(options).attribute(this);\n };\n\n return XMLAttribute;\n\n })();\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLAttribute, XMLElement, XMLNode, isFunction, isObject, ref,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction;\n\n XMLNode = require('./XMLNode');\n\n XMLAttribute = require('./XMLAttribute');\n\n module.exports = XMLElement = (function(superClass) {\n extend(XMLElement, superClass);\n\n function XMLElement(parent, name, attributes) {\n XMLElement.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing element name\");\n }\n this.name = this.stringify.eleName(name);\n this.attributes = {};\n if (attributes != null) {\n this.attribute(attributes);\n }\n if (parent.isDocument) {\n this.isRoot = true;\n this.documentObject = parent;\n parent.rootObject = this;\n }\n }\n\n XMLElement.prototype.clone = function() {\n var att, attName, clonedSelf, ref1;\n clonedSelf = Object.create(this);\n if (clonedSelf.isRoot) {\n clonedSelf.documentObject = null;\n }\n clonedSelf.attributes = {};\n ref1 = this.attributes;\n for (attName in ref1) {\n if (!hasProp.call(ref1, attName)) continue;\n att = ref1[attName];\n clonedSelf.attributes[attName] = att.clone();\n }\n clonedSelf.children = [];\n this.children.forEach(function(child) {\n var clonedChild;\n clonedChild = child.clone();\n clonedChild.parent = clonedSelf;\n return clonedSelf.children.push(clonedChild);\n });\n return clonedSelf;\n };\n\n XMLElement.prototype.attribute = function(name, value) {\n var attName, attValue;\n if (name != null) {\n name = name.valueOf();\n }\n if (isObject(name)) {\n for (attName in name) {\n if (!hasProp.call(name, attName)) continue;\n attValue = name[attName];\n this.attribute(attName, attValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n if (!this.options.skipNullAttributes || (value != null)) {\n this.attributes[name] = new XMLAttribute(this, name, value);\n }\n }\n return this;\n };\n\n XMLElement.prototype.removeAttribute = function(name) {\n var attName, i, len;\n if (name == null) {\n throw new Error(\"Missing attribute name\");\n }\n name = name.valueOf();\n if (Array.isArray(name)) {\n for (i = 0, len = name.length; i < len; i++) {\n attName = name[i];\n delete this.attributes[attName];\n }\n } else {\n delete this.attributes[name];\n }\n return this;\n };\n\n XMLElement.prototype.toString = function(options) {\n return this.options.writer.set(options).element(this);\n };\n\n XMLElement.prototype.att = function(name, value) {\n return this.attribute(name, value);\n };\n\n XMLElement.prototype.a = function(name, value) {\n return this.attribute(name, value);\n };\n\n return XMLElement;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLCData = (function(superClass) {\n extend(XMLCData, superClass);\n\n function XMLCData(parent, text) {\n XMLCData.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing CDATA text\");\n }\n this.text = this.stringify.cdata(text);\n }\n\n XMLCData.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLCData.prototype.toString = function(options) {\n return this.options.writer.set(options).cdata(this);\n };\n\n return XMLCData;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLComment, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLComment = (function(superClass) {\n extend(XMLComment, superClass);\n\n function XMLComment(parent, text) {\n XMLComment.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing comment text\");\n }\n this.text = this.stringify.comment(text);\n }\n\n XMLComment.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLComment.prototype.toString = function(options) {\n return this.options.writer.set(options).comment(this);\n };\n\n return XMLComment;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDeclaration, XMLNode, isObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isObject = require('./Utility').isObject;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLDeclaration = (function(superClass) {\n extend(XMLDeclaration, superClass);\n\n function XMLDeclaration(parent, version, encoding, standalone) {\n var ref;\n XMLDeclaration.__super__.constructor.call(this, parent);\n if (isObject(version)) {\n ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;\n }\n if (!version) {\n version = '1.0';\n }\n this.version = this.stringify.xmlVersion(version);\n if (encoding != null) {\n this.encoding = this.stringify.xmlEncoding(encoding);\n }\n if (standalone != null) {\n this.standalone = this.stringify.xmlStandalone(standalone);\n }\n }\n\n XMLDeclaration.prototype.toString = function(options) {\n return this.options.writer.set(options).declaration(this);\n };\n\n return XMLDeclaration;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDAttList, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLDTDAttList = (function(superClass) {\n extend(XMLDTDAttList, superClass);\n\n function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n XMLDTDAttList.__super__.constructor.call(this, parent);\n if (elementName == null) {\n throw new Error(\"Missing DTD element name\");\n }\n if (attributeName == null) {\n throw new Error(\"Missing DTD attribute name\");\n }\n if (!attributeType) {\n throw new Error(\"Missing DTD attribute type\");\n }\n if (!defaultValueType) {\n throw new Error(\"Missing DTD attribute default\");\n }\n if (defaultValueType.indexOf('#') !== 0) {\n defaultValueType = '#' + defaultValueType;\n }\n if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {\n throw new Error(\"Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT\");\n }\n if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {\n throw new Error(\"Default value only applies to #FIXED or #DEFAULT\");\n }\n this.elementName = this.stringify.eleName(elementName);\n this.attributeName = this.stringify.attName(attributeName);\n this.attributeType = this.stringify.dtdAttType(attributeType);\n this.defaultValue = this.stringify.dtdAttDefault(defaultValue);\n this.defaultValueType = defaultValueType;\n }\n\n XMLDTDAttList.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdAttList(this);\n };\n\n return XMLDTDAttList;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDEntity, XMLNode, isObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isObject = require('./Utility').isObject;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLDTDEntity = (function(superClass) {\n extend(XMLDTDEntity, superClass);\n\n function XMLDTDEntity(parent, pe, name, value) {\n XMLDTDEntity.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing entity name\");\n }\n if (value == null) {\n throw new Error(\"Missing entity value\");\n }\n this.pe = !!pe;\n this.name = this.stringify.eleName(name);\n if (!isObject(value)) {\n this.value = this.stringify.dtdEntityValue(value);\n } else {\n if (!value.pubID && !value.sysID) {\n throw new Error(\"Public and/or system identifiers are required for an external entity\");\n }\n if (value.pubID && !value.sysID) {\n throw new Error(\"System identifier is required for a public external entity\");\n }\n if (value.pubID != null) {\n this.pubID = this.stringify.dtdPubID(value.pubID);\n }\n if (value.sysID != null) {\n this.sysID = this.stringify.dtdSysID(value.sysID);\n }\n if (value.nData != null) {\n this.nData = this.stringify.dtdNData(value.nData);\n }\n if (this.pe && this.nData) {\n throw new Error(\"Notation declaration is not allowed in a parameter entity\");\n }\n }\n }\n\n XMLDTDEntity.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdEntity(this);\n };\n\n return XMLDTDEntity;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDElement, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLDTDElement = (function(superClass) {\n extend(XMLDTDElement, superClass);\n\n function XMLDTDElement(parent, name, value) {\n XMLDTDElement.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing DTD element name\");\n }\n if (!value) {\n value = '(#PCDATA)';\n }\n if (Array.isArray(value)) {\n value = '(' + value.join(',') + ')';\n }\n this.name = this.stringify.eleName(name);\n this.value = this.stringify.dtdElementValue(value);\n }\n\n XMLDTDElement.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdElement(this);\n };\n\n return XMLDTDElement;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDNotation, XMLNode,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLDTDNotation = (function(superClass) {\n extend(XMLDTDNotation, superClass);\n\n function XMLDTDNotation(parent, name, value) {\n XMLDTDNotation.__super__.constructor.call(this, parent);\n if (name == null) {\n throw new Error(\"Missing notation name\");\n }\n if (!value.pubID && !value.sysID) {\n throw new Error(\"Public or system identifiers are required for an external entity\");\n }\n this.name = this.stringify.eleName(name);\n if (value.pubID != null) {\n this.pubID = this.stringify.dtdPubID(value.pubID);\n }\n if (value.sysID != null) {\n this.sysID = this.stringify.dtdSysID(value.sysID);\n }\n }\n\n XMLDTDNotation.prototype.toString = function(options) {\n return this.options.writer.set(options).dtdNotation(this);\n };\n\n return XMLDTDNotation;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNode, isObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isObject = require('./Utility').isObject;\n\n XMLNode = require('./XMLNode');\n\n XMLDTDAttList = require('./XMLDTDAttList');\n\n XMLDTDEntity = require('./XMLDTDEntity');\n\n XMLDTDElement = require('./XMLDTDElement');\n\n XMLDTDNotation = require('./XMLDTDNotation');\n\n module.exports = XMLDocType = (function(superClass) {\n extend(XMLDocType, superClass);\n\n function XMLDocType(parent, pubID, sysID) {\n var ref, ref1;\n XMLDocType.__super__.constructor.call(this, parent);\n this.documentObject = parent;\n if (isObject(pubID)) {\n ref = pubID, pubID = ref.pubID, sysID = ref.sysID;\n }\n if (sysID == null) {\n ref1 = [pubID, sysID], sysID = ref1[0], pubID = ref1[1];\n }\n if (pubID != null) {\n this.pubID = this.stringify.dtdPubID(pubID);\n }\n if (sysID != null) {\n this.sysID = this.stringify.dtdSysID(sysID);\n }\n }\n\n XMLDocType.prototype.element = function(name, value) {\n var child;\n child = new XMLDTDElement(this, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var child;\n child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.entity = function(name, value) {\n var child;\n child = new XMLDTDEntity(this, false, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.pEntity = function(name, value) {\n var child;\n child = new XMLDTDEntity(this, true, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.notation = function(name, value) {\n var child;\n child = new XMLDTDNotation(this, name, value);\n this.children.push(child);\n return this;\n };\n\n XMLDocType.prototype.toString = function(options) {\n return this.options.writer.set(options).docType(this);\n };\n\n XMLDocType.prototype.ele = function(name, value) {\n return this.element(name, value);\n };\n\n XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);\n };\n\n XMLDocType.prototype.ent = function(name, value) {\n return this.entity(name, value);\n };\n\n XMLDocType.prototype.pent = function(name, value) {\n return this.pEntity(name, value);\n };\n\n XMLDocType.prototype.not = function(name, value) {\n return this.notation(name, value);\n };\n\n XMLDocType.prototype.up = function() {\n return this.root() || this.documentObject;\n };\n\n return XMLDocType;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLNode, XMLRaw,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLRaw = (function(superClass) {\n extend(XMLRaw, superClass);\n\n function XMLRaw(parent, text) {\n XMLRaw.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing raw text\");\n }\n this.value = this.stringify.raw(text);\n }\n\n XMLRaw.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLRaw.prototype.toString = function(options) {\n return this.options.writer.set(options).raw(this);\n };\n\n return XMLRaw;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLNode, XMLText,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLText = (function(superClass) {\n extend(XMLText, superClass);\n\n function XMLText(parent, text) {\n XMLText.__super__.constructor.call(this, parent);\n if (text == null) {\n throw new Error(\"Missing element text\");\n }\n this.value = this.stringify.eleText(text);\n }\n\n XMLText.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLText.prototype.toString = function(options) {\n return this.options.writer.set(options).text(this);\n };\n\n return XMLText;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLNode, XMLProcessingInstruction,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLNode = require('./XMLNode');\n\n module.exports = XMLProcessingInstruction = (function(superClass) {\n extend(XMLProcessingInstruction, superClass);\n\n function XMLProcessingInstruction(parent, target, value) {\n XMLProcessingInstruction.__super__.constructor.call(this, parent);\n if (target == null) {\n throw new Error(\"Missing instruction target\");\n }\n this.target = this.stringify.insTarget(target);\n if (value) {\n this.value = this.stringify.insValue(value);\n }\n }\n\n XMLProcessingInstruction.prototype.clone = function() {\n return Object.create(this);\n };\n\n XMLProcessingInstruction.prototype.toString = function(options) {\n return this.options.writer.set(options).processingInstruction(this);\n };\n\n return XMLProcessingInstruction;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLElement, XMLNode, XMLProcessingInstruction, XMLRaw, XMLText, isEmpty, isFunction, isObject, ref,\n hasProp = {}.hasOwnProperty;\n\n ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isEmpty = ref.isEmpty;\n\n XMLElement = null;\n\n XMLCData = null;\n\n XMLComment = null;\n\n XMLDeclaration = null;\n\n XMLDocType = null;\n\n XMLRaw = null;\n\n XMLText = null;\n\n XMLProcessingInstruction = null;\n\n module.exports = XMLNode = (function() {\n function XMLNode(parent) {\n this.parent = parent;\n if (this.parent) {\n this.options = this.parent.options;\n this.stringify = this.parent.stringify;\n }\n this.children = [];\n if (!XMLElement) {\n XMLElement = require('./XMLElement');\n XMLCData = require('./XMLCData');\n XMLComment = require('./XMLComment');\n XMLDeclaration = require('./XMLDeclaration');\n XMLDocType = require('./XMLDocType');\n XMLRaw = require('./XMLRaw');\n XMLText = require('./XMLText');\n XMLProcessingInstruction = require('./XMLProcessingInstruction');\n }\n }\n\n XMLNode.prototype.element = function(name, attributes, text) {\n var childNode, item, j, k, key, lastChild, len, len1, ref1, val;\n lastChild = null;\n if (attributes == null) {\n attributes = {};\n }\n attributes = attributes.valueOf();\n if (!isObject(attributes)) {\n ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];\n }\n if (name != null) {\n name = name.valueOf();\n }\n if (Array.isArray(name)) {\n for (j = 0, len = name.length; j < len; j++) {\n item = name[j];\n lastChild = this.element(item);\n }\n } else if (isFunction(name)) {\n lastChild = this.element(name.apply());\n } else if (isObject(name)) {\n for (key in name) {\n if (!hasProp.call(name, key)) continue;\n val = name[key];\n if (isFunction(val)) {\n val = val.apply();\n }\n if ((isObject(val)) && (isEmpty(val))) {\n val = null;\n }\n if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {\n lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);\n } else if (!this.options.separateArrayItems && Array.isArray(val)) {\n for (k = 0, len1 = val.length; k < len1; k++) {\n item = val[k];\n childNode = {};\n childNode[key] = item;\n lastChild = this.element(childNode);\n }\n } else if (isObject(val)) {\n lastChild = this.element(key);\n lastChild.element(val);\n } else {\n lastChild = this.element(key, val);\n }\n }\n } else {\n if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {\n lastChild = this.text(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {\n lastChild = this.cdata(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {\n lastChild = this.comment(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {\n lastChild = this.raw(text);\n } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {\n lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);\n } else {\n lastChild = this.node(name, attributes, text);\n }\n }\n if (lastChild == null) {\n throw new Error(\"Could not create any elements with: \" + name);\n }\n return lastChild;\n };\n\n XMLNode.prototype.insertBefore = function(name, attributes, text) {\n var child, i, removed;\n if (this.isRoot) {\n throw new Error(\"Cannot insert elements at root level\");\n }\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i);\n child = this.parent.element(name, attributes, text);\n Array.prototype.push.apply(this.parent.children, removed);\n return child;\n };\n\n XMLNode.prototype.insertAfter = function(name, attributes, text) {\n var child, i, removed;\n if (this.isRoot) {\n throw new Error(\"Cannot insert elements at root level\");\n }\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i + 1);\n child = this.parent.element(name, attributes, text);\n Array.prototype.push.apply(this.parent.children, removed);\n return child;\n };\n\n XMLNode.prototype.remove = function() {\n var i, ref1;\n if (this.isRoot) {\n throw new Error(\"Cannot remove the root element\");\n }\n i = this.parent.children.indexOf(this);\n [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref1 = [])), ref1;\n return this.parent;\n };\n\n XMLNode.prototype.node = function(name, attributes, text) {\n var child, ref1;\n if (name != null) {\n name = name.valueOf();\n }\n attributes || (attributes = {});\n attributes = attributes.valueOf();\n if (!isObject(attributes)) {\n ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];\n }\n child = new XMLElement(this, name, attributes);\n if (text != null) {\n child.text(text);\n }\n this.children.push(child);\n return child;\n };\n\n XMLNode.prototype.text = function(value) {\n var child;\n child = new XMLText(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.cdata = function(value) {\n var child;\n child = new XMLCData(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.comment = function(value) {\n var child;\n child = new XMLComment(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.commentBefore = function(value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i);\n child = this.parent.comment(value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.commentAfter = function(value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i + 1);\n child = this.parent.comment(value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.raw = function(value) {\n var child;\n child = new XMLRaw(this, value);\n this.children.push(child);\n return this;\n };\n\n XMLNode.prototype.instruction = function(target, value) {\n var insTarget, insValue, instruction, j, len;\n if (target != null) {\n target = target.valueOf();\n }\n if (value != null) {\n value = value.valueOf();\n }\n if (Array.isArray(target)) {\n for (j = 0, len = target.length; j < len; j++) {\n insTarget = target[j];\n this.instruction(insTarget);\n }\n } else if (isObject(target)) {\n for (insTarget in target) {\n if (!hasProp.call(target, insTarget)) continue;\n insValue = target[insTarget];\n this.instruction(insTarget, insValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n instruction = new XMLProcessingInstruction(this, target, value);\n this.children.push(instruction);\n }\n return this;\n };\n\n XMLNode.prototype.instructionBefore = function(target, value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i);\n child = this.parent.instruction(target, value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.instructionAfter = function(target, value) {\n var child, i, removed;\n i = this.parent.children.indexOf(this);\n removed = this.parent.children.splice(i + 1);\n child = this.parent.instruction(target, value);\n Array.prototype.push.apply(this.parent.children, removed);\n return this;\n };\n\n XMLNode.prototype.declaration = function(version, encoding, standalone) {\n var doc, xmldec;\n doc = this.document();\n xmldec = new XMLDeclaration(doc, version, encoding, standalone);\n if (doc.children[0] instanceof XMLDeclaration) {\n doc.children[0] = xmldec;\n } else {\n doc.children.unshift(xmldec);\n }\n return doc.root() || doc;\n };\n\n XMLNode.prototype.doctype = function(pubID, sysID) {\n var child, doc, doctype, i, j, k, len, len1, ref1, ref2;\n doc = this.document();\n doctype = new XMLDocType(doc, pubID, sysID);\n ref1 = doc.children;\n for (i = j = 0, len = ref1.length; j < len; i = ++j) {\n child = ref1[i];\n if (child instanceof XMLDocType) {\n doc.children[i] = doctype;\n return doctype;\n }\n }\n ref2 = doc.children;\n for (i = k = 0, len1 = ref2.length; k < len1; i = ++k) {\n child = ref2[i];\n if (child.isRoot) {\n doc.children.splice(i, 0, doctype);\n return doctype;\n }\n }\n doc.children.push(doctype);\n return doctype;\n };\n\n XMLNode.prototype.up = function() {\n if (this.isRoot) {\n throw new Error(\"The root node has no parent. Use doc() if you need to get the document object.\");\n }\n return this.parent;\n };\n\n XMLNode.prototype.root = function() {\n var node;\n node = this;\n while (node) {\n if (node.isDocument) {\n return node.rootObject;\n } else if (node.isRoot) {\n return node;\n } else {\n node = node.parent;\n }\n }\n };\n\n XMLNode.prototype.document = function() {\n var node;\n node = this;\n while (node) {\n if (node.isDocument) {\n return node;\n } else {\n node = node.parent;\n }\n }\n };\n\n XMLNode.prototype.end = function(options) {\n return this.document().end(options);\n };\n\n XMLNode.prototype.prev = function() {\n var i;\n i = this.parent.children.indexOf(this);\n if (i < 1) {\n throw new Error(\"Already at the first node\");\n }\n return this.parent.children[i - 1];\n };\n\n XMLNode.prototype.next = function() {\n var i;\n i = this.parent.children.indexOf(this);\n if (i === -1 || i === this.parent.children.length - 1) {\n throw new Error(\"Already at the last node\");\n }\n return this.parent.children[i + 1];\n };\n\n XMLNode.prototype.importDocument = function(doc) {\n var clonedRoot;\n clonedRoot = doc.root().clone();\n clonedRoot.parent = this;\n clonedRoot.isRoot = false;\n this.children.push(clonedRoot);\n return this;\n };\n\n XMLNode.prototype.ele = function(name, attributes, text) {\n return this.element(name, attributes, text);\n };\n\n XMLNode.prototype.nod = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLNode.prototype.txt = function(value) {\n return this.text(value);\n };\n\n XMLNode.prototype.dat = function(value) {\n return this.cdata(value);\n };\n\n XMLNode.prototype.com = function(value) {\n return this.comment(value);\n };\n\n XMLNode.prototype.ins = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLNode.prototype.doc = function() {\n return this.document();\n };\n\n XMLNode.prototype.dec = function(version, encoding, standalone) {\n return this.declaration(version, encoding, standalone);\n };\n\n XMLNode.prototype.dtd = function(pubID, sysID) {\n return this.doctype(pubID, sysID);\n };\n\n XMLNode.prototype.e = function(name, attributes, text) {\n return this.element(name, attributes, text);\n };\n\n XMLNode.prototype.n = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLNode.prototype.t = function(value) {\n return this.text(value);\n };\n\n XMLNode.prototype.d = function(value) {\n return this.cdata(value);\n };\n\n XMLNode.prototype.c = function(value) {\n return this.comment(value);\n };\n\n XMLNode.prototype.r = function(value) {\n return this.raw(value);\n };\n\n XMLNode.prototype.i = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLNode.prototype.u = function() {\n return this.up();\n };\n\n XMLNode.prototype.importXMLBuilder = function(doc) {\n return this.importDocument(doc);\n };\n\n return XMLNode;\n\n })();\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLStringifier,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\n hasProp = {}.hasOwnProperty;\n\n module.exports = XMLStringifier = (function() {\n function XMLStringifier(options) {\n this.assertLegalChar = bind(this.assertLegalChar, this);\n var key, ref, value;\n options || (options = {});\n this.noDoubleEncoding = options.noDoubleEncoding;\n ref = options.stringify || {};\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n value = ref[key];\n this[key] = value;\n }\n }\n\n XMLStringifier.prototype.eleName = function(val) {\n val = '' + val || '';\n return this.assertLegalChar(val);\n };\n\n XMLStringifier.prototype.eleText = function(val) {\n val = '' + val || '';\n return this.assertLegalChar(this.elEscape(val));\n };\n\n XMLStringifier.prototype.cdata = function(val) {\n val = '' + val || '';\n val = val.replace(']]>', ']]]]>');\n return this.assertLegalChar(val);\n };\n\n XMLStringifier.prototype.comment = function(val) {\n val = '' + val || '';\n if (val.match(/--/)) {\n throw new Error(\"Comment text cannot contain double-hypen: \" + val);\n }\n return this.assertLegalChar(val);\n };\n\n XMLStringifier.prototype.raw = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.attName = function(val) {\n return val = '' + val || '';\n };\n\n XMLStringifier.prototype.attValue = function(val) {\n val = '' + val || '';\n return this.attEscape(val);\n };\n\n XMLStringifier.prototype.insTarget = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.insValue = function(val) {\n val = '' + val || '';\n if (val.match(/\\?>/)) {\n throw new Error(\"Invalid processing instruction value: \" + val);\n }\n return val;\n };\n\n XMLStringifier.prototype.xmlVersion = function(val) {\n val = '' + val || '';\n if (!val.match(/1\\.[0-9]+/)) {\n throw new Error(\"Invalid version number: \" + val);\n }\n return val;\n };\n\n XMLStringifier.prototype.xmlEncoding = function(val) {\n val = '' + val || '';\n if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {\n throw new Error(\"Invalid encoding: \" + val);\n }\n return val;\n };\n\n XMLStringifier.prototype.xmlStandalone = function(val) {\n if (val) {\n return \"yes\";\n } else {\n return \"no\";\n }\n };\n\n XMLStringifier.prototype.dtdPubID = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdSysID = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdElementValue = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdAttType = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdAttDefault = function(val) {\n if (val != null) {\n return '' + val || '';\n } else {\n return val;\n }\n };\n\n XMLStringifier.prototype.dtdEntityValue = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.dtdNData = function(val) {\n return '' + val || '';\n };\n\n XMLStringifier.prototype.convertAttKey = '@';\n\n XMLStringifier.prototype.convertPIKey = '?';\n\n XMLStringifier.prototype.convertTextKey = '#text';\n\n XMLStringifier.prototype.convertCDataKey = '#cdata';\n\n XMLStringifier.prototype.convertCommentKey = '#comment';\n\n XMLStringifier.prototype.convertRawKey = '#raw';\n\n XMLStringifier.prototype.assertLegalChar = function(str) {\n var res;\n res = str.match(/[\\0\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/);\n if (res) {\n throw new Error(\"Invalid character in string: \" + str + \" at index \" + res.index);\n }\n return str;\n };\n\n XMLStringifier.prototype.elEscape = function(str) {\n var ampregex;\n ampregex = this.noDoubleEncoding ? /(?!&\\S+;)&/g : /&/g;\n return str.replace(ampregex, '&').replace(//g, '>').replace(/\\r/g, ' ');\n };\n\n XMLStringifier.prototype.attEscape = function(str) {\n var ampregex;\n ampregex = this.noDoubleEncoding ? /(?!&\\S+;)&/g : /&/g;\n return str.replace(ampregex, '&').replace(/ 0) {\n return new Array(indent).join(this.indent);\n } else {\n return '';\n }\n } else {\n return '';\n }\n };\n\n return XMLWriterBase;\n\n })();\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLText, XMLWriterBase,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLDeclaration = require('./XMLDeclaration');\n\n XMLDocType = require('./XMLDocType');\n\n XMLCData = require('./XMLCData');\n\n XMLComment = require('./XMLComment');\n\n XMLElement = require('./XMLElement');\n\n XMLRaw = require('./XMLRaw');\n\n XMLText = require('./XMLText');\n\n XMLProcessingInstruction = require('./XMLProcessingInstruction');\n\n XMLDTDAttList = require('./XMLDTDAttList');\n\n XMLDTDElement = require('./XMLDTDElement');\n\n XMLDTDEntity = require('./XMLDTDEntity');\n\n XMLDTDNotation = require('./XMLDTDNotation');\n\n XMLWriterBase = require('./XMLWriterBase');\n\n module.exports = XMLStringWriter = (function(superClass) {\n extend(XMLStringWriter, superClass);\n\n function XMLStringWriter(options) {\n XMLStringWriter.__super__.constructor.call(this, options);\n }\n\n XMLStringWriter.prototype.document = function(doc) {\n var child, i, len, r, ref;\n this.textispresent = false;\n r = '';\n ref = doc.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n r += (function() {\n switch (false) {\n case !(child instanceof XMLDeclaration):\n return this.declaration(child);\n case !(child instanceof XMLDocType):\n return this.docType(child);\n case !(child instanceof XMLComment):\n return this.comment(child);\n case !(child instanceof XMLProcessingInstruction):\n return this.processingInstruction(child);\n default:\n return this.element(child, 0);\n }\n }).call(this);\n }\n if (this.pretty && r.slice(-this.newline.length) === this.newline) {\n r = r.slice(0, -this.newline.length);\n }\n return r;\n };\n\n XMLStringWriter.prototype.attribute = function(att) {\n return ' ' + att.name + '=\"' + att.value + '\"';\n };\n\n XMLStringWriter.prototype.cdata = function(node, level) {\n return this.space(level) + '' + this.newline;\n };\n\n XMLStringWriter.prototype.comment = function(node, level) {\n return this.space(level) + '' + this.newline;\n };\n\n XMLStringWriter.prototype.declaration = function(node, level) {\n var r;\n r = this.space(level);\n r += '';\n r += this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.docType = function(node, level) {\n var child, i, len, r, ref;\n level || (level = 0);\n r = this.space(level);\n r += ' 0) {\n r += ' [';\n r += this.newline;\n ref = node.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n r += (function() {\n switch (false) {\n case !(child instanceof XMLDTDAttList):\n return this.dtdAttList(child, level + 1);\n case !(child instanceof XMLDTDElement):\n return this.dtdElement(child, level + 1);\n case !(child instanceof XMLDTDEntity):\n return this.dtdEntity(child, level + 1);\n case !(child instanceof XMLDTDNotation):\n return this.dtdNotation(child, level + 1);\n case !(child instanceof XMLCData):\n return this.cdata(child, level + 1);\n case !(child instanceof XMLComment):\n return this.comment(child, level + 1);\n case !(child instanceof XMLProcessingInstruction):\n return this.processingInstruction(child, level + 1);\n default:\n throw new Error(\"Unknown DTD node type: \" + child.constructor.name);\n }\n }).call(this);\n }\n r += ']';\n }\n r += this.spacebeforeslash + '>';\n r += this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.element = function(node, level) {\n var att, child, i, j, len, len1, name, r, ref, ref1, ref2, space, textispresentwasset;\n level || (level = 0);\n textispresentwasset = false;\n if (this.textispresent) {\n this.newline = '';\n this.pretty = false;\n } else {\n this.newline = this.newlinedefault;\n this.pretty = this.prettydefault;\n }\n space = this.space(level);\n r = '';\n r += space + '<' + node.name;\n ref = node.attributes;\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n att = ref[name];\n r += this.attribute(att);\n }\n if (node.children.length === 0 || node.children.every(function(e) {\n return e.value === '';\n })) {\n if (this.allowEmpty) {\n r += '>' + this.newline;\n } else {\n r += this.spacebeforeslash + '/>' + this.newline;\n }\n } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {\n r += '>';\n r += node.children[0].value;\n r += '' + this.newline;\n } else {\n if (this.dontprettytextnodes) {\n ref1 = node.children;\n for (i = 0, len = ref1.length; i < len; i++) {\n child = ref1[i];\n if (child.value != null) {\n this.textispresent++;\n textispresentwasset = true;\n break;\n }\n }\n }\n if (this.textispresent) {\n this.newline = '';\n this.pretty = false;\n space = this.space(level);\n }\n r += '>' + this.newline;\n ref2 = node.children;\n for (j = 0, len1 = ref2.length; j < len1; j++) {\n child = ref2[j];\n r += (function() {\n switch (false) {\n case !(child instanceof XMLCData):\n return this.cdata(child, level + 1);\n case !(child instanceof XMLComment):\n return this.comment(child, level + 1);\n case !(child instanceof XMLElement):\n return this.element(child, level + 1);\n case !(child instanceof XMLRaw):\n return this.raw(child, level + 1);\n case !(child instanceof XMLText):\n return this.text(child, level + 1);\n case !(child instanceof XMLProcessingInstruction):\n return this.processingInstruction(child, level + 1);\n default:\n throw new Error(\"Unknown XML node type: \" + child.constructor.name);\n }\n }).call(this);\n }\n if (textispresentwasset) {\n this.textispresent--;\n }\n if (!this.textispresent) {\n this.newline = this.newlinedefault;\n this.pretty = this.prettydefault;\n }\n r += space + '' + this.newline;\n }\n return r;\n };\n\n XMLStringWriter.prototype.processingInstruction = function(node, level) {\n var r;\n r = this.space(level) + '' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.raw = function(node, level) {\n return this.space(level) + node.value + this.newline;\n };\n\n XMLStringWriter.prototype.text = function(node, level) {\n return this.space(level) + node.value + this.newline;\n };\n\n XMLStringWriter.prototype.dtdAttList = function(node, level) {\n var r;\n r = this.space(level) + '' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.dtdElement = function(node, level) {\n return this.space(level) + '' + this.newline;\n };\n\n XMLStringWriter.prototype.dtdEntity = function(node, level) {\n var r;\n r = this.space(level) + '' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.dtdNotation = function(node, level) {\n var r;\n r = this.space(level) + '' + this.newline;\n return r;\n };\n\n XMLStringWriter.prototype.openNode = function(node, level) {\n var att, name, r, ref;\n level || (level = 0);\n if (node instanceof XMLElement) {\n r = this.space(level) + '<' + node.name;\n ref = node.attributes;\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n att = ref[name];\n r += this.attribute(att);\n }\n r += (node.children ? '>' : '/>') + this.newline;\n return r;\n } else {\n r = this.space(level) + '') + this.newline;\n return r;\n }\n };\n\n XMLStringWriter.prototype.closeNode = function(node, level) {\n level || (level = 0);\n switch (false) {\n case !(node instanceof XMLElement):\n return this.space(level) + '' + this.newline;\n case !(node instanceof XMLDocType):\n return this.space(level) + ']>' + this.newline;\n }\n };\n\n return XMLStringWriter;\n\n })(XMLWriterBase);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n isPlainObject = require('./Utility').isPlainObject;\n\n XMLNode = require('./XMLNode');\n\n XMLStringifier = require('./XMLStringifier');\n\n XMLStringWriter = require('./XMLStringWriter');\n\n module.exports = XMLDocument = (function(superClass) {\n extend(XMLDocument, superClass);\n\n function XMLDocument(options) {\n XMLDocument.__super__.constructor.call(this, null);\n options || (options = {});\n if (!options.writer) {\n options.writer = new XMLStringWriter();\n }\n this.options = options;\n this.stringify = new XMLStringifier(options);\n this.isDocument = true;\n }\n\n XMLDocument.prototype.end = function(writer) {\n var writerOptions;\n if (!writer) {\n writer = this.options.writer;\n } else if (isPlainObject(writer)) {\n writerOptions = writer;\n writer = this.options.writer.set(writerOptions);\n }\n return writer.document(this);\n };\n\n XMLDocument.prototype.toString = function(options) {\n return this.options.writer.set(options).document(this);\n };\n\n return XMLDocument;\n\n })(XMLNode);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, isFunction, isObject, isPlainObject, ref,\n hasProp = {}.hasOwnProperty;\n\n ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject;\n\n XMLElement = require('./XMLElement');\n\n XMLCData = require('./XMLCData');\n\n XMLComment = require('./XMLComment');\n\n XMLRaw = require('./XMLRaw');\n\n XMLText = require('./XMLText');\n\n XMLProcessingInstruction = require('./XMLProcessingInstruction');\n\n XMLDeclaration = require('./XMLDeclaration');\n\n XMLDocType = require('./XMLDocType');\n\n XMLDTDAttList = require('./XMLDTDAttList');\n\n XMLDTDEntity = require('./XMLDTDEntity');\n\n XMLDTDElement = require('./XMLDTDElement');\n\n XMLDTDNotation = require('./XMLDTDNotation');\n\n XMLAttribute = require('./XMLAttribute');\n\n XMLStringifier = require('./XMLStringifier');\n\n XMLStringWriter = require('./XMLStringWriter');\n\n module.exports = XMLDocumentCB = (function() {\n function XMLDocumentCB(options, onData, onEnd) {\n var writerOptions;\n options || (options = {});\n if (!options.writer) {\n options.writer = new XMLStringWriter(options);\n } else if (isPlainObject(options.writer)) {\n writerOptions = options.writer;\n options.writer = new XMLStringWriter(writerOptions);\n }\n this.options = options;\n this.writer = options.writer;\n this.stringify = new XMLStringifier(options);\n this.onDataCallback = onData || function() {};\n this.onEndCallback = onEnd || function() {};\n this.currentNode = null;\n this.currentLevel = -1;\n this.openTags = {};\n this.documentStarted = false;\n this.documentCompleted = false;\n this.root = null;\n }\n\n XMLDocumentCB.prototype.node = function(name, attributes, text) {\n var ref1;\n if (name == null) {\n throw new Error(\"Missing node name\");\n }\n if (this.root && this.currentLevel === -1) {\n throw new Error(\"Document can only have one root node\");\n }\n this.openCurrent();\n name = name.valueOf();\n if (attributes == null) {\n attributes = {};\n }\n attributes = attributes.valueOf();\n if (!isObject(attributes)) {\n ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];\n }\n this.currentNode = new XMLElement(this, name, attributes);\n this.currentNode.children = false;\n this.currentLevel++;\n this.openTags[this.currentLevel] = this.currentNode;\n if (text != null) {\n this.text(text);\n }\n return this;\n };\n\n XMLDocumentCB.prototype.element = function(name, attributes, text) {\n if (this.currentNode && this.currentNode instanceof XMLDocType) {\n return this.dtdElement.apply(this, arguments);\n } else {\n return this.node(name, attributes, text);\n }\n };\n\n XMLDocumentCB.prototype.attribute = function(name, value) {\n var attName, attValue;\n if (!this.currentNode || this.currentNode.children) {\n throw new Error(\"att() can only be used immediately after an ele() call in callback mode\");\n }\n if (name != null) {\n name = name.valueOf();\n }\n if (isObject(name)) {\n for (attName in name) {\n if (!hasProp.call(name, attName)) continue;\n attValue = name[attName];\n this.attribute(attName, attValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n if (!this.options.skipNullAttributes || (value != null)) {\n this.currentNode.attributes[name] = new XMLAttribute(this, name, value);\n }\n }\n return this;\n };\n\n XMLDocumentCB.prototype.text = function(value) {\n var node;\n this.openCurrent();\n node = new XMLText(this, value);\n this.onData(this.writer.text(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.cdata = function(value) {\n var node;\n this.openCurrent();\n node = new XMLCData(this, value);\n this.onData(this.writer.cdata(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.comment = function(value) {\n var node;\n this.openCurrent();\n node = new XMLComment(this, value);\n this.onData(this.writer.comment(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.raw = function(value) {\n var node;\n this.openCurrent();\n node = new XMLRaw(this, value);\n this.onData(this.writer.raw(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.instruction = function(target, value) {\n var i, insTarget, insValue, len, node;\n this.openCurrent();\n if (target != null) {\n target = target.valueOf();\n }\n if (value != null) {\n value = value.valueOf();\n }\n if (Array.isArray(target)) {\n for (i = 0, len = target.length; i < len; i++) {\n insTarget = target[i];\n this.instruction(insTarget);\n }\n } else if (isObject(target)) {\n for (insTarget in target) {\n if (!hasProp.call(target, insTarget)) continue;\n insValue = target[insTarget];\n this.instruction(insTarget, insValue);\n }\n } else {\n if (isFunction(value)) {\n value = value.apply();\n }\n node = new XMLProcessingInstruction(this, target, value);\n this.onData(this.writer.processingInstruction(node, this.currentLevel + 1));\n }\n return this;\n };\n\n XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {\n var node;\n this.openCurrent();\n if (this.documentStarted) {\n throw new Error(\"declaration() must be the first node\");\n }\n node = new XMLDeclaration(this, version, encoding, standalone);\n this.onData(this.writer.declaration(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {\n this.openCurrent();\n if (root == null) {\n throw new Error(\"Missing root node name\");\n }\n if (this.root) {\n throw new Error(\"dtd() must come before the root node\");\n }\n this.currentNode = new XMLDocType(this, pubID, sysID);\n this.currentNode.rootNodeName = root;\n this.currentNode.children = false;\n this.currentLevel++;\n this.openTags[this.currentLevel] = this.currentNode;\n return this;\n };\n\n XMLDocumentCB.prototype.dtdElement = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDElement(this, name, value);\n this.onData(this.writer.dtdElement(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {\n var node;\n this.openCurrent();\n node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);\n this.onData(this.writer.dtdAttList(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.entity = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDEntity(this, false, name, value);\n this.onData(this.writer.dtdEntity(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.pEntity = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDEntity(this, true, name, value);\n this.onData(this.writer.dtdEntity(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.notation = function(name, value) {\n var node;\n this.openCurrent();\n node = new XMLDTDNotation(this, name, value);\n this.onData(this.writer.dtdNotation(node, this.currentLevel + 1));\n return this;\n };\n\n XMLDocumentCB.prototype.up = function() {\n if (this.currentLevel < 0) {\n throw new Error(\"The document node has no parent\");\n }\n if (this.currentNode) {\n if (this.currentNode.children) {\n this.closeNode(this.currentNode);\n } else {\n this.openNode(this.currentNode);\n }\n this.currentNode = null;\n } else {\n this.closeNode(this.openTags[this.currentLevel]);\n }\n delete this.openTags[this.currentLevel];\n this.currentLevel--;\n return this;\n };\n\n XMLDocumentCB.prototype.end = function() {\n while (this.currentLevel >= 0) {\n this.up();\n }\n return this.onEnd();\n };\n\n XMLDocumentCB.prototype.openCurrent = function() {\n if (this.currentNode) {\n this.currentNode.children = true;\n return this.openNode(this.currentNode);\n }\n };\n\n XMLDocumentCB.prototype.openNode = function(node) {\n if (!node.isOpen) {\n if (!this.root && this.currentLevel === 0 && node instanceof XMLElement) {\n this.root = node;\n }\n this.onData(this.writer.openNode(node, this.currentLevel));\n return node.isOpen = true;\n }\n };\n\n XMLDocumentCB.prototype.closeNode = function(node) {\n if (!node.isClosed) {\n this.onData(this.writer.closeNode(node, this.currentLevel));\n return node.isClosed = true;\n }\n };\n\n XMLDocumentCB.prototype.onData = function(chunk) {\n this.documentStarted = true;\n return this.onDataCallback(chunk);\n };\n\n XMLDocumentCB.prototype.onEnd = function() {\n this.documentCompleted = true;\n return this.onEndCallback();\n };\n\n XMLDocumentCB.prototype.ele = function() {\n return this.element.apply(this, arguments);\n };\n\n XMLDocumentCB.prototype.nod = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLDocumentCB.prototype.txt = function(value) {\n return this.text(value);\n };\n\n XMLDocumentCB.prototype.dat = function(value) {\n return this.cdata(value);\n };\n\n XMLDocumentCB.prototype.com = function(value) {\n return this.comment(value);\n };\n\n XMLDocumentCB.prototype.ins = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {\n return this.declaration(version, encoding, standalone);\n };\n\n XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {\n return this.doctype(root, pubID, sysID);\n };\n\n XMLDocumentCB.prototype.e = function(name, attributes, text) {\n return this.element(name, attributes, text);\n };\n\n XMLDocumentCB.prototype.n = function(name, attributes, text) {\n return this.node(name, attributes, text);\n };\n\n XMLDocumentCB.prototype.t = function(value) {\n return this.text(value);\n };\n\n XMLDocumentCB.prototype.d = function(value) {\n return this.cdata(value);\n };\n\n XMLDocumentCB.prototype.c = function(value) {\n return this.comment(value);\n };\n\n XMLDocumentCB.prototype.r = function(value) {\n return this.raw(value);\n };\n\n XMLDocumentCB.prototype.i = function(target, value) {\n return this.instruction(target, value);\n };\n\n XMLDocumentCB.prototype.att = function() {\n if (this.currentNode && this.currentNode instanceof XMLDocType) {\n return this.attList.apply(this, arguments);\n } else {\n return this.attribute.apply(this, arguments);\n }\n };\n\n XMLDocumentCB.prototype.a = function() {\n if (this.currentNode && this.currentNode instanceof XMLDocType) {\n return this.attList.apply(this, arguments);\n } else {\n return this.attribute.apply(this, arguments);\n }\n };\n\n XMLDocumentCB.prototype.ent = function(name, value) {\n return this.entity(name, value);\n };\n\n XMLDocumentCB.prototype.pent = function(name, value) {\n return this.pEntity(name, value);\n };\n\n XMLDocumentCB.prototype.not = function(name, value) {\n return this.notation(name, value);\n };\n\n return XMLDocumentCB;\n\n })();\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStreamWriter, XMLText, XMLWriterBase,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\n XMLDeclaration = require('./XMLDeclaration');\n\n XMLDocType = require('./XMLDocType');\n\n XMLCData = require('./XMLCData');\n\n XMLComment = require('./XMLComment');\n\n XMLElement = require('./XMLElement');\n\n XMLRaw = require('./XMLRaw');\n\n XMLText = require('./XMLText');\n\n XMLProcessingInstruction = require('./XMLProcessingInstruction');\n\n XMLDTDAttList = require('./XMLDTDAttList');\n\n XMLDTDElement = require('./XMLDTDElement');\n\n XMLDTDEntity = require('./XMLDTDEntity');\n\n XMLDTDNotation = require('./XMLDTDNotation');\n\n XMLWriterBase = require('./XMLWriterBase');\n\n module.exports = XMLStreamWriter = (function(superClass) {\n extend(XMLStreamWriter, superClass);\n\n function XMLStreamWriter(stream, options) {\n XMLStreamWriter.__super__.constructor.call(this, options);\n this.stream = stream;\n }\n\n XMLStreamWriter.prototype.document = function(doc) {\n var child, i, j, len, len1, ref, ref1, results;\n ref = doc.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n child.isLastRootNode = false;\n }\n doc.children[doc.children.length - 1].isLastRootNode = true;\n ref1 = doc.children;\n results = [];\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n child = ref1[j];\n switch (false) {\n case !(child instanceof XMLDeclaration):\n results.push(this.declaration(child));\n break;\n case !(child instanceof XMLDocType):\n results.push(this.docType(child));\n break;\n case !(child instanceof XMLComment):\n results.push(this.comment(child));\n break;\n case !(child instanceof XMLProcessingInstruction):\n results.push(this.processingInstruction(child));\n break;\n default:\n results.push(this.element(child));\n }\n }\n return results;\n };\n\n XMLStreamWriter.prototype.attribute = function(att) {\n return this.stream.write(' ' + att.name + '=\"' + att.value + '\"');\n };\n\n XMLStreamWriter.prototype.cdata = function(node, level) {\n return this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.comment = function(node, level) {\n return this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.declaration = function(node, level) {\n this.stream.write(this.space(level));\n this.stream.write('');\n return this.stream.write(this.endline(node));\n };\n\n XMLStreamWriter.prototype.docType = function(node, level) {\n var child, i, len, ref;\n level || (level = 0);\n this.stream.write(this.space(level));\n this.stream.write(' 0) {\n this.stream.write(' [');\n this.stream.write(this.endline(node));\n ref = node.children;\n for (i = 0, len = ref.length; i < len; i++) {\n child = ref[i];\n switch (false) {\n case !(child instanceof XMLDTDAttList):\n this.dtdAttList(child, level + 1);\n break;\n case !(child instanceof XMLDTDElement):\n this.dtdElement(child, level + 1);\n break;\n case !(child instanceof XMLDTDEntity):\n this.dtdEntity(child, level + 1);\n break;\n case !(child instanceof XMLDTDNotation):\n this.dtdNotation(child, level + 1);\n break;\n case !(child instanceof XMLCData):\n this.cdata(child, level + 1);\n break;\n case !(child instanceof XMLComment):\n this.comment(child, level + 1);\n break;\n case !(child instanceof XMLProcessingInstruction):\n this.processingInstruction(child, level + 1);\n break;\n default:\n throw new Error(\"Unknown DTD node type: \" + child.constructor.name);\n }\n }\n this.stream.write(']');\n }\n this.stream.write(this.spacebeforeslash + '>');\n return this.stream.write(this.endline(node));\n };\n\n XMLStreamWriter.prototype.element = function(node, level) {\n var att, child, i, len, name, ref, ref1, space;\n level || (level = 0);\n space = this.space(level);\n this.stream.write(space + '<' + node.name);\n ref = node.attributes;\n for (name in ref) {\n if (!hasProp.call(ref, name)) continue;\n att = ref[name];\n this.attribute(att);\n }\n if (node.children.length === 0 || node.children.every(function(e) {\n return e.value === '';\n })) {\n if (this.allowEmpty) {\n this.stream.write('>');\n } else {\n this.stream.write(this.spacebeforeslash + '/>');\n }\n } else if (this.pretty && node.children.length === 1 && (node.children[0].value != null)) {\n this.stream.write('>');\n this.stream.write(node.children[0].value);\n this.stream.write('');\n } else {\n this.stream.write('>' + this.newline);\n ref1 = node.children;\n for (i = 0, len = ref1.length; i < len; i++) {\n child = ref1[i];\n switch (false) {\n case !(child instanceof XMLCData):\n this.cdata(child, level + 1);\n break;\n case !(child instanceof XMLComment):\n this.comment(child, level + 1);\n break;\n case !(child instanceof XMLElement):\n this.element(child, level + 1);\n break;\n case !(child instanceof XMLRaw):\n this.raw(child, level + 1);\n break;\n case !(child instanceof XMLText):\n this.text(child, level + 1);\n break;\n case !(child instanceof XMLProcessingInstruction):\n this.processingInstruction(child, level + 1);\n break;\n default:\n throw new Error(\"Unknown XML node type: \" + child.constructor.name);\n }\n }\n this.stream.write(space + '');\n }\n return this.stream.write(this.endline(node));\n };\n\n XMLStreamWriter.prototype.processingInstruction = function(node, level) {\n this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.raw = function(node, level) {\n return this.stream.write(this.space(level) + node.value + this.endline(node));\n };\n\n XMLStreamWriter.prototype.text = function(node, level) {\n return this.stream.write(this.space(level) + node.value + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdAttList = function(node, level) {\n this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdElement = function(node, level) {\n this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdEntity = function(node, level) {\n this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.dtdNotation = function(node, level) {\n this.stream.write(this.space(level) + '' + this.endline(node));\n };\n\n XMLStreamWriter.prototype.endline = function(node) {\n if (!node.isLastRootNode) {\n return this.newline;\n } else {\n return '';\n }\n };\n\n return XMLStreamWriter;\n\n })(XMLWriterBase);\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n var XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;\n\n ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;\n\n XMLDocument = require('./XMLDocument');\n\n XMLDocumentCB = require('./XMLDocumentCB');\n\n XMLStringWriter = require('./XMLStringWriter');\n\n XMLStreamWriter = require('./XMLStreamWriter');\n\n module.exports.create = function(name, xmldec, doctype, options) {\n var doc, root;\n if (name == null) {\n throw new Error(\"Root element needs a name\");\n }\n options = assign({}, xmldec, doctype, options);\n doc = new XMLDocument(options);\n root = doc.element(name);\n if (!options.headless) {\n doc.declaration(options);\n if ((options.pubID != null) || (options.sysID != null)) {\n doc.doctype(options);\n }\n }\n return root;\n };\n\n module.exports.begin = function(options, onData, onEnd) {\n var ref1;\n if (isFunction(options)) {\n ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];\n options = {};\n }\n if (onData) {\n return new XMLDocumentCB(options, onData, onEnd);\n } else {\n return new XMLDocument(options);\n }\n };\n\n module.exports.stringWriter = function(options) {\n return new XMLStringWriter(options);\n };\n\n module.exports.streamWriter = function(stream, options) {\n return new XMLStreamWriter(stream, options);\n };\n\n}).call(this);\n", "// Generated by CoffeeScript 1.12.7\n(function() {\n \"use strict\";\n var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,\n hasProp = {}.hasOwnProperty;\n\n builder = require('xmlbuilder');\n\n defaults = require('./defaults').defaults;\n\n requiresCDATA = function(entry) {\n return typeof entry === \"string\" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);\n };\n\n wrapCDATA = function(entry) {\n return \"\";\n };\n\n escapeCDATA = function(entry) {\n return entry.replace(']]>', ']]]]>');\n };\n\n exports.Builder = (function() {\n function Builder(opts) {\n var key, ref, value;\n this.options = {};\n ref = defaults[\"0.2\"];\n for (key in ref) {\n if (!hasProp.call(ref, key)) continue;\n value = ref[key];\n this.options[key] = value;\n }\n for (key in opts) {\n if (!hasProp.call(opts, key)) continue;\n value = opts[key];\n this.options[key] = value;\n }\n }\n\n Builder.prototype.buildObject = function(rootObj) {\n var attrkey, charkey, render, rootElement, rootName;\n attrkey = this.options.attrkey;\n charkey = this.options.charkey;\n if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {\n rootName = Object.keys(rootObj)[0];\n rootObj = rootObj[rootName];\n } else {\n rootName = this.options.rootName;\n }\n render = (function(_this) {\n return function(element, obj) {\n var attr, child, entry, index, key, value;\n if (typeof obj !== 'object') {\n if (_this.options.cdata && requiresCDATA(obj)) {\n element.raw(wrapCDATA(obj));\n } else {\n element.txt(obj);\n }\n } else if (Array.isArray(obj)) {\n for (index in obj) {\n if (!hasProp.call(obj, index)) continue;\n child = obj[index];\n for (key in child) {\n entry = child[key];\n element = render(element.ele(key), entry).up();\n }\n }\n } else {\n for (key in obj) {\n if (!hasProp.call(obj, key)) continue;\n child = obj[key];\n if (key === attrkey) {\n if (typeof child === \"object\") {\n for (attr in child) {\n value = child[attr];\n element = element.att(attr, value);\n }\n }\n } else if (key === charkey) {\n if (_this.options.cdata && requiresCDATA(child)) {\n element = element.raw(wrapCDATA(child));\n } else {\n element = element.txt(child);\n }\n } else if (Array.isArray(child)) {\n for (index in child) {\n if (!hasProp.call(child, index)) continue;\n entry = child[index];\n if (typeof entry === 'string') {\n if (_this.options.cdata && requiresCDATA(entry)) {\n element = element.ele(key).raw(wrapCDATA(entry)).up();\n } else {\n element = element.ele(key, entry).up();\n }\n } else {\n element = render(element.ele(key), entry).up();\n }\n }\n } else if (typeof child === \"object\") {\n element = render(element.ele(key), child).up();\n } else {\n if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {\n element = element.ele(key).raw(wrapCDATA(child)).up();\n } else {\n if (child == null) {\n child = '';\n }\n element = element.ele(key, child.toString()).up();\n }\n }\n }\n }\n return element;\n };\n })(this);\n rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {\n headless: this.options.headless,\n allowSurrogateChars: this.options.allowSurrogateChars\n });\n return render(rootElement, rootObj).end(this.options.renderOpts);\n };\n\n return Builder;\n\n })();\n\n}).call(this);\n", ";(function (sax) { // wrapper for non-node envs\n sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }\n sax.SAXParser = SAXParser\n sax.SAXStream = SAXStream\n sax.createStream = createStream\n\n // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.\n // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),\n // since that's the earliest that a buffer overrun could occur. This way, checks are\n // as rare as required, but as often as necessary to ensure never crossing this bound.\n // Furthermore, buffers are only tested at most once per write(), so passing a very\n // large string into write() might have undesirable effects, but this is manageable by\n // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme\n // edge case, result in creating at most one complete copy of the string passed in.\n // Set to Infinity to have unlimited buffers.\n sax.MAX_BUFFER_LENGTH = 64 * 1024\n\n var buffers = [\n 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',\n 'procInstName', 'procInstBody', 'entity', 'attribName',\n 'attribValue', 'cdata', 'script'\n ]\n\n sax.EVENTS = [\n 'text',\n 'processinginstruction',\n 'sgmldeclaration',\n 'doctype',\n 'comment',\n 'opentagstart',\n 'attribute',\n 'opentag',\n 'closetag',\n 'opencdata',\n 'cdata',\n 'closecdata',\n 'error',\n 'end',\n 'ready',\n 'script',\n 'opennamespace',\n 'closenamespace'\n ]\n\n function SAXParser (strict, opt) {\n if (!(this instanceof SAXParser)) {\n return new SAXParser(strict, opt)\n }\n\n var parser = this\n clearBuffers(parser)\n parser.q = parser.c = ''\n parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH\n parser.opt = opt || {}\n parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags\n parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'\n parser.tags = []\n parser.closed = parser.closedRoot = parser.sawRoot = false\n parser.tag = parser.error = null\n parser.strict = !!strict\n parser.noscript = !!(strict || parser.opt.noscript)\n parser.state = S.BEGIN\n parser.strictEntities = parser.opt.strictEntities\n parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)\n parser.attribList = []\n\n // namespaces form a prototype chain.\n // it always points at the current tag,\n // which protos to its parent tag.\n if (parser.opt.xmlns) {\n parser.ns = Object.create(rootNS)\n }\n\n // mostly just for error reporting\n parser.trackPosition = parser.opt.position !== false\n if (parser.trackPosition) {\n parser.position = parser.line = parser.column = 0\n }\n emit(parser, 'onready')\n }\n\n if (!Object.create) {\n Object.create = function (o) {\n function F () {}\n F.prototype = o\n var newf = new F()\n return newf\n }\n }\n\n if (!Object.keys) {\n Object.keys = function (o) {\n var a = []\n for (var i in o) if (o.hasOwnProperty(i)) a.push(i)\n return a\n }\n }\n\n function checkBufferLength (parser) {\n var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)\n var maxActual = 0\n for (var i = 0, l = buffers.length; i < l; i++) {\n var len = parser[buffers[i]].length\n if (len > maxAllowed) {\n // Text/cdata nodes can get big, and since they're buffered,\n // we can get here under normal conditions.\n // Avoid issues by emitting the text node now,\n // so at least it won't get any bigger.\n switch (buffers[i]) {\n case 'textNode':\n closeText(parser)\n break\n\n case 'cdata':\n emitNode(parser, 'oncdata', parser.cdata)\n parser.cdata = ''\n break\n\n case 'script':\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n break\n\n default:\n error(parser, 'Max buffer length exceeded: ' + buffers[i])\n }\n }\n maxActual = Math.max(maxActual, len)\n }\n // schedule the next check for the earliest possible buffer overrun.\n var m = sax.MAX_BUFFER_LENGTH - maxActual\n parser.bufferCheckPosition = m + parser.position\n }\n\n function clearBuffers (parser) {\n for (var i = 0, l = buffers.length; i < l; i++) {\n parser[buffers[i]] = ''\n }\n }\n\n function flushBuffers (parser) {\n closeText(parser)\n if (parser.cdata !== '') {\n emitNode(parser, 'oncdata', parser.cdata)\n parser.cdata = ''\n }\n if (parser.script !== '') {\n emitNode(parser, 'onscript', parser.script)\n parser.script = ''\n }\n }\n\n SAXParser.prototype = {\n end: function () { end(this) },\n write: write,\n resume: function () { this.error = null; return this },\n close: function () { return this.write(null) },\n flush: function () { flushBuffers(this) }\n }\n\n var Stream\n try {\n Stream = require('stream').Stream\n } catch (ex) {\n Stream = function () {}\n }\n\n var streamWraps = sax.EVENTS.filter(function (ev) {\n return ev !== 'error' && ev !== 'end'\n })\n\n function createStream (strict, opt) {\n return new SAXStream(strict, opt)\n }\n\n function SAXStream (strict, opt) {\n if (!(this instanceof SAXStream)) {\n return new SAXStream(strict, opt)\n }\n\n Stream.apply(this)\n\n this._parser = new SAXParser(strict, opt)\n this.writable = true\n this.readable = true\n\n var me = this\n\n this._parser.onend = function () {\n me.emit('end')\n }\n\n this._parser.onerror = function (er) {\n me.emit('error', er)\n\n // if didn't throw, then means error was handled.\n // go ahead and clear error, so we can write again.\n me._parser.error = null\n }\n\n this._decoder = null\n\n streamWraps.forEach(function (ev) {\n Object.defineProperty(me, 'on' + ev, {\n get: function () {\n return me._parser['on' + ev]\n },\n set: function (h) {\n if (!h) {\n me.removeAllListeners(ev)\n me._parser['on' + ev] = h\n return h\n }\n me.on(ev, h)\n },\n enumerable: true,\n configurable: false\n })\n })\n }\n\n SAXStream.prototype = Object.create(Stream.prototype, {\n constructor: {\n value: SAXStream\n }\n })\n\n SAXStream.prototype.write = function (data) {\n if (typeof Buffer === 'function' &&\n typeof Buffer.isBuffer === 'function' &&\n Buffer.isBuffer(data)) {\n if (!this._decoder) {\n var SD = require('string_decoder').StringDecoder\n this._decoder = new SD('utf8')\n }\n data = this._decoder.write(data)\n }\n\n this._parser.write(data.toString())\n this.emit('data', data)\n return true\n }\n\n SAXStream.prototype.end = function (chunk) {\n if (chunk && chunk.length) {\n this.write(chunk)\n }\n this._parser.end()\n return true\n }\n\n SAXStream.prototype.on = function (ev, handler) {\n var me = this\n if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {\n me._parser['on' + ev] = function () {\n var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)\n args.splice(0, 0, ev)\n me.emit.apply(me, args)\n }\n }\n\n return Stream.prototype.on.call(me, ev, handler)\n }\n\n // character classes and tokens\n var whitespace = '\\r\\n\\t '\n\n // this really needs to be replaced with character classes.\n // XML allows all manner of ridiculous numbers and digits.\n var number = '0124356789'\n var letter = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n // (Letter | \"_\" | \":\")\n var quote = '\\'\"'\n var attribEnd = whitespace + '>'\n var CDATA = '[CDATA['\n var DOCTYPE = 'DOCTYPE'\n var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'\n var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'\n var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }\n\n // turn all the string character sets into character class objects.\n whitespace = charClass(whitespace)\n number = charClass(number)\n letter = charClass(letter)\n\n // http://www.w3.org/TR/REC-xml/#NT-NameStartChar\n // This implementation works on strings, a single character at a time\n // as such, it cannot ever support astral-plane characters (10000-EFFFF)\n // without a significant breaking change to either this parser, or the\n // JavaScript language. Implementation of an emoji-capable xml parser\n // is left as an exercise for the reader.\n var nameStart = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n\n var nameBody = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/\n\n var entityStart = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/\n var entityBody = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/\n\n quote = charClass(quote)\n attribEnd = charClass(attribEnd)\n\n function charClass (str) {\n return str.split('').reduce(function (s, c) {\n s[c] = true\n return s\n }, {})\n }\n\n function isRegExp (c) {\n return Object.prototype.toString.call(c) === '[object RegExp]'\n }\n\n function is (charclass, c) {\n return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]\n }\n\n function not (charclass, c) {\n return !is(charclass, c)\n }\n\n var S = 0\n sax.STATE = {\n BEGIN: S++, // leading byte order mark or whitespace\n BEGIN_WHITESPACE: S++, // leading whitespace\n TEXT: S++, // general stuff\n TEXT_ENTITY: S++, // & and such.\n OPEN_WAKA: S++, // <\n SGML_DECL: S++, // \n SCRIPT: S++, //