@ampt/cli 1.0.37-beta.4 → 1.0.37-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -139,7 +139,7 @@ Url: `+yE(e)),!0)}Iv._shouldDropEvent=Mie;function aft(e,t){return!t||!t.length?
139
139
  `;n.auth&&(o["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:c,port:f,secureEndpoint:p}=r;Yft(f,p)||(c+=`:${f}`),o.Host=c,o.Connection="close";for(let b of Object.keys(o))u+=`${b}: ${o[b]}\r
140
140
  `;let d=Kft.default(s);s.write(`${u}\r
141
141
  `);let{statusCode:m,buffered:v}=yield d;if(m===200){if(t.once("socket",Xft),r.secureEndpoint){qv("Upgrading socket connection to TLS");let b=r.servername||r.host;return Zie.default.connect(Object.assign(Object.assign({},Jft(r,"host","hostname","path","port")),{socket:s,servername:b}))}return s}s.destroy();let y=new Yie.default.Socket({writable:!1});return y.readable=!0,t.once("socket",b=>{qv("replaying proxy buffer for failed request"),zft.default(b.listenerCount("data")>0),b.push(v),b.push(null)}),y})}};hf.default=RP;function Xft(e){e.resume()}function Yft(e,t){return!!(!t&&e===80||t&&e===443)}function Zft(e){return typeof e=="string"?/^https:?$/i.test(e):!1}function Jft(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}});var EE=g((qP,Qie)=>{"use strict";var Qft=qP&&qP.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},NP=Qft(Jie());function kP(e){return new NP.default(e)}(function(e){e.HttpsProxyAgent=NP.default,e.prototype=NP.default.prototype})(kP||(kP={}));Qie.exports=kP});var rse=g(PP=>{Object.defineProperty(PP,"__esModule",{value:!0});var ept=(jn(),vt(Mn)),ese=gn(),tse=require("http"),tpt=bE(),rpt=function(e){ept.__extends(t,e);function t(r){var n=e.call(this,r)||this;n.options=r;var i=n._getProxy("http");return n.module=tse,n.client=i?new(EE())(i):new tse.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),n}return t.prototype.sendEvent=function(r){return this._send(ese.eventToSentryRequest(r,this._api),r)},t.prototype.sendSession=function(r){return this._send(ese.sessionToSentryRequest(r,this._api),r)},t}(tpt.BaseTransport);PP.HTTPTransport=rpt});var sse=g(DP=>{Object.defineProperty(DP,"__esModule",{value:!0});var npt=(jn(),vt(Mn)),nse=gn(),ise=require("https"),ipt=bE(),spt=function(e){npt.__extends(t,e);function t(r){var n=e.call(this,r)||this;n.options=r;var i=n._getProxy("https");return n.module=ise,n.client=i?new(EE())(i):new ise.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),n}return t.prototype.sendEvent=function(r){return this._send(nse.eventToSentryRequest(r,this._api),r)},t.prototype.sendSession=function(r){return this._send(nse.sessionToSentryRequest(r,this._api),r)},t}(ipt.BaseTransport);DP.HTTPSTransport=spt});var ase=g(LP=>{Object.defineProperty(LP,"__esModule",{value:!0});var opt=gn(),apt=Lt(),upt=require("http"),cpt=require("https"),ose=require("url");function lpt(e){var t,r=new ose.URL(e.url),n=r.protocol==="https:",i=fpt(r,e.proxy||(n?process.env.https_proxy:void 0)||process.env.http_proxy),s=n?cpt:upt,o=i?new(EE())(i):new s.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),a=ppt(e,(t=e.httpModule,t??s),o);return opt.createTransport({bufferSize:e.bufferSize},a)}LP.makeNodeTransport=lpt;function fpt(e,t){var r=process.env.no_proxy,n=r&&r.split(",").some(function(i){return e.host.endsWith(i)||e.hostname.endsWith(i)});if(!n)return t}function ppt(e,t,r){var n=new ose.URL(e.url),i=n.hostname,s=n.pathname,o=n.port,a=n.protocol,u=n.search;return function(f){return new Promise(function(p,d){var m=t.request({method:"POST",agent:r,headers:e.headers,hostname:i,path:""+s+u,port:o,protocol:a,ca:e.caCerts},function(v){var y,b,_;v.on("data",function(){}),v.on("end",function(){});var E=(y=v.statusCode,y??500),S=apt.eventStatusFromHttpCode(E);v.setEncoding("utf8");var w=(b=v.headers["retry-after"],b??null),C=(_=v.headers["x-sentry-rate-limits"],_??null);p({headers:{"retry-after":w,"x-sentry-rate-limits":Array.isArray(C)?C[0]:C},reason:S,statusCode:E})});m.on("error",d),m.end(f.body)})}}});var FP=g(th=>{Object.defineProperty(th,"__esModule",{value:!0});var dpt=bE();th.BaseTransport=dpt.BaseTransport;var hpt=rse();th.HTTPTransport=hpt.HTTPTransport;var mpt=sse();th.HTTPSTransport=mpt.HTTPSTransport;var gpt=ase();th.makeNodeTransport=gpt.makeNodeTransport});var $P=g(UP=>{Object.defineProperty(UP,"__esModule",{value:!0});var rh=(jn(),vt(Mn)),MP=gn(),vpt=jd(),jP=Lt(),use=_P(),BP=FP(),xpt=function(e){rh.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.eventFromException=function(r,n){return jP.resolvedSyncPromise(use.eventFromUnknownInput(r,n))},t.prototype.eventFromMessage=function(r,n,i){return n===void 0&&(n=vpt.Severity.Info),jP.resolvedSyncPromise(use.eventFromMessage(r,n,i,this._options.attachStacktrace))},t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var r=jP.makeDsn(this._options.dsn),n=rh.__assign(rh.__assign(rh.__assign(rh.__assign(rh.__assign({},this._options.transportOptions),this._options.httpProxy&&{httpProxy:this._options.httpProxy}),this._options.httpsProxy&&{httpsProxy:this._options.httpsProxy}),this._options.caCerts&&{caCerts:this._options.caCerts}),{dsn:this._options.dsn,tunnel:this._options.tunnel,_metadata:this._options._metadata});if(this._options.transport)return new this._options.transport(n);var i=MP.initAPIDetails(n.dsn,n._metadata,n.tunnel),s=MP.getEnvelopeEndpointWithUrlEncodedAuth(i.dsn,i.tunnel);return this._newTransport=BP.makeNodeTransport({url:s,headers:n.headers,proxy:n.httpProxy,caCerts:n.caCerts}),r.protocol==="http"?new BP.HTTPTransport(n):new BP.HTTPSTransport(n)},t}(MP.BaseBackend);UP.NodeBackend=xpt});var zP=g(WP=>{Object.defineProperty(WP,"__esModule",{value:!0});var ypt=(jn(),vt(Mn)),HP=gn(),_pt=ea(),cse=Lt(),bpt=$P(),lse=Rc(),wpt=function(e){ypt.__extends(t,e);function t(r){var n=this;return r._metadata=r._metadata||{},r._metadata.sdk=r._metadata.sdk||{name:"sentry.javascript.node",packages:[{name:"npm:@sentry/node",version:HP.SDK_VERSION}],version:HP.SDK_VERSION},n=e.call(this,bpt.NodeBackend,r)||this,n}return t.prototype.captureException=function(r,n,i){if(this._options.autoSessionTracking&&this._sessionFlusher&&i){var s=i.getRequestSession();s&&s.status==="ok"&&(s.status="errored")}return e.prototype.captureException.call(this,r,n,i)},t.prototype.captureEvent=function(r,n,i){if(this._options.autoSessionTracking&&this._sessionFlusher&&i){var s=r.type||"exception",o=s==="exception"&&r.exception&&r.exception.values&&r.exception.values.length>0;if(o){var a=i.getRequestSession();a&&a.status==="ok"&&(a.status="errored")}}return e.prototype.captureEvent.call(this,r,n,i)},t.prototype.close=function(r){var n;return(n=this._sessionFlusher)===null||n===void 0||n.close(),e.prototype.close.call(this,r)},t.prototype.initSessionFlusher=function(){var r=this._options,n=r.release,i=r.environment;n?this._sessionFlusher=new _pt.SessionFlusher(this.getTransport(),{release:n,environment:i}):lse.IS_DEBUG_BUILD&&cse.logger.warn("Cannot initialise an instance of SessionFlusher if no release is provided!")},t.prototype._prepareEvent=function(r,n,i){return r.platform=r.platform||"node",this.getOptions().serverName&&(r.server_name=this.getOptions().serverName),e.prototype._prepareEvent.call(this,r,n,i)},t.prototype._captureRequestSession=function(){this._sessionFlusher?this._sessionFlusher.incrementSessionStatusCount():lse.IS_DEBUG_BUILD&&cse.logger.warn("Discarded request mode session because autoSessionTracking option was disabled")},t}(HP.BaseClient);WP.NodeClient=wpt});var mse=g(GP=>{Object.defineProperty(GP,"__esModule",{value:!0});var pse=(jn(),vt(Mn)),fse=gn(),dse=Lt(),Ept=require("util"),hse=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(){var t,r;try{for(var n=pse.__values(["debug","info","warn","error","log"]),i=n.next();!i.done;i=n.next()){var s=i.value;dse.fill(console,s,Spt(s))}}catch(o){t={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.id="Console",e}();GP.Console=hse;function Spt(e){return function(r){var n=dse.severityFromString(e);return function(){fse.getCurrentHub().getIntegration(hse)&&fse.getCurrentHub().addBreadcrumb({category:"console",level:n,message:Ept.format.apply(void 0,arguments)},{input:pse.__spread(arguments),level:e}),r.apply(this,arguments)}}}});var yse=g(mf=>{Object.defineProperty(mf,"__esModule",{value:!0});var VP=(jn(),vt(Mn)),Tpt=gn(),Cpt=Lt(),gse=require("url"),vse=Cpt.parseSemver(process.versions.node);function Apt(e){var t,r=(t=Tpt.getCurrentHub().getClient())===null||t===void 0?void 0:t.getDsn();return r?e.includes(r.host):!1}mf.isSentryRequest=Apt;function xse(e){var t=e.protocol||"",r=e.hostname||e.host||"",n=!e.port||e.port===80||e.port===443?"":":"+e.port,i=e.path?e.path:"/";return t+"//"+r+n+i}mf.extractUrl=xse;function Opt(e,t,r){var n,i,s;if(!e)return e;var o=VP.__read(e.split(" "),2),a=o[0],u=o[1];return t.host&&!t.protocol&&(t.protocol=(i=(n=r)===null||n===void 0?void 0:n.agent)===null||i===void 0?void 0:i.protocol,u=xse(t)),!((s=u)===null||s===void 0)&&s.startsWith("///")&&(u=u.slice(2)),a+" "+u}mf.cleanSpanDescription=Opt;function KP(e){var t={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:""+(e.pathname||"")+(e.search||""),href:e.href};return e.port!==""&&(t.port=Number(e.port)),(e.username||e.password)&&(t.auth=e.username+":"+e.password),t}mf.urlToOptions=KP;function Ipt(e,t){var r,n,i,s,o,a,u,c,f,p;return typeof t[t.length-1]=="function"&&(f=t.pop()),typeof t[0]=="string"?p=KP(new gse.URL(t[0])):t[0]instanceof gse.URL?p=KP(t[0]):p=t[0],t.length===2&&(p=VP.__assign(VP.__assign({},p),t[1])),p.protocol===void 0&&(vse.major&&vse.major>8?p.protocol=((n=(r=e)===null||r===void 0?void 0:r.globalAgent)===null||n===void 0?void 0:n.protocol)||((i=p.agent)===null||i===void 0?void 0:i.protocol)||((s=p._defaultAgent)===null||s===void 0?void 0:s.protocol):p.protocol=((o=p.agent)===null||o===void 0?void 0:o.protocol)||((a=p._defaultAgent)===null||a===void 0?void 0:a.protocol)||((c=(u=e)===null||u===void 0?void 0:u.globalAgent)===null||c===void 0?void 0:c.protocol)),f?[p,f]:[p]}mf.normalizeRequestArgs=Ipt});var Sse=g(YP=>{Object.defineProperty(YP,"__esModule",{value:!0});var _se=(jn(),vt(Mn)),XP=gn(),nh=Lt(),Rpt=Rc(),Pv=yse(),bse=nh.parseSemver(process.versions.node),Ese=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._breadcrumbs=typeof t.breadcrumbs>"u"?!0:t.breadcrumbs,this._tracing=typeof t.tracing>"u"?!1:t.tracing}return e.prototype.setupOnce=function(){if(!(!this._breadcrumbs&&!this._tracing)){var t=Npt(this._breadcrumbs,this._tracing),r=require("http");if(nh.fill(r,"get",t),nh.fill(r,"request",t),bse.major&&bse.major>8){var n=require("https");nh.fill(n,"get",t),nh.fill(n,"request",t)}}},e.id="Http",e}();YP.Http=Ese;function Npt(e,t){return function(n){return function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var a=this,u=Pv.normalizeRequestArgs(this,s),c=u[0],f=Pv.extractUrl(c);if(Pv.isSentryRequest(f))return n.apply(a,u);var p,d,m=XP.getCurrentHub().getScope();if(m&&t&&(d=m.getSpan(),d)){p=d.startChild({description:(c.method||"GET")+" "+f,op:"http.client"});var v=p.toTraceparent();Rpt.IS_DEBUG_BUILD&&nh.logger.log("[Tracing] Adding sentry-trace header "+v+" to outgoing request to "+f+": "),c.headers=_se.__assign(_se.__assign({},c.headers),{"sentry-trace":v})}return n.apply(a,u).once("response",function(y){var b=this;e&&wse("response",f,b,y),t&&p&&(y.statusCode&&p.setHttpStatus(y.statusCode),p.description=Pv.cleanSpanDescription(p.description,c,b),p.finish())}).once("error",function(){var y=this;e&&wse("error",f,y),t&&p&&(p.setHttpStatus(500),p.description=Pv.cleanSpanDescription(p.description,c,y),p.finish())})}}}function wse(e,t,r,n){XP.getCurrentHub().getIntegration(Ese)&&XP.getCurrentHub().addBreadcrumb({category:"http",data:{method:r.method,status_code:n&&n.statusCode,url:t},type:"http"},{event:e,request:r,response:n})}});var QP=g(JP=>{Object.defineProperty(JP,"__esModule",{value:!0});var kpt=gn(),ZP=Lt(),Tse=Rc(),qpt=2e3;function Ppt(e){console.error(e&&e.stack?e.stack:e);var t=kpt.getCurrentHub().getClient();t===void 0&&(Tse.IS_DEBUG_BUILD&&ZP.logger.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1));var r=t.getOptions(),n=r&&r.shutdownTimeout&&r.shutdownTimeout>0&&r.shutdownTimeout||qpt;ZP.forget(t.close(n).then(function(i){i||Tse.IS_DEBUG_BUILD&&ZP.logger.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)}))}JP.logAndExitProcess=Ppt});var Ose=g(eD=>{Object.defineProperty(eD,"__esModule",{value:!0});var Cse=gn(),Dpt=jd(),Lpt=Lt(),Fpt=Rc(),Ase=QP(),Mpt=function(){function e(t){t===void 0&&(t={}),this._options=t,this.name=e.id,this.handler=this._makeErrorHandler()}return e.prototype.setupOnce=function(){global.process.on("uncaughtException",this.handler.bind(this))},e.prototype._makeErrorHandler=function(){var t=this,r=2e3,n=!1,i=!1,s=!1,o;return function(a){var u=Ase.logAndExitProcess,c=Cse.getCurrentHub().getClient();if(t._options.onFatalError?u=t._options.onFatalError:c&&c.getOptions().onFatalError&&(u=c.getOptions().onFatalError),n)s?(Fpt.IS_DEBUG_BUILD&&Lpt.logger.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Ase.logAndExitProcess(a)):i||(i=!0,setTimeout(function(){s||(s=!0,u(o,a))},r));else{var f=Cse.getCurrentHub();o=a,n=!0,f.getIntegration(e)?f.withScope(function(p){p.setLevel(Dpt.Severity.Fatal),f.captureException(a,{originalException:a,data:{mechanism:{handled:!1,type:"onuncaughtexception"}}}),s||(s=!0,u(a))}):s||(s=!0,u(a))}}},e.id="OnUncaughtException",e}();eD.OnUncaughtException=Mpt});var Rse=g(tD=>{Object.defineProperty(tD,"__esModule",{value:!0});var jpt=gn(),Ise=Lt(),Bpt=QP(),Upt=function(){function e(t){t===void 0&&(t={mode:"warn"}),this._options=t,this.name=e.id}return e.prototype.setupOnce=function(){global.process.on("unhandledRejection",this.sendUnhandledPromise.bind(this))},e.prototype.sendUnhandledPromise=function(t,r){var n=jpt.getCurrentHub();if(!n.getIntegration(e)){this._handleRejection(t);return}var i=r.domain&&r.domain.sentryContext||{};n.withScope(function(s){s.setExtra("unhandledPromiseRejection",!0),i.user&&s.setUser(i.user),i.tags&&s.setTags(i.tags),i.extra&&s.setExtras(i.extra),n.captureException(t,{originalException:r,data:{mechanism:{handled:!1,type:"onunhandledrejection"}}})}),this._handleRejection(t)},e.prototype._handleRejection=function(t){var r="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";this._options.mode==="warn"?Ise.consoleSandbox(function(){console.warn(r),console.error(t&&t.stack?t.stack:t)}):this._options.mode==="strict"&&(Ise.consoleSandbox(function(){console.warn(r)}),Bpt.logAndExitProcess(t))},e.id="OnUnhandledRejection",e}();tD.OnUnhandledRejection=Upt});var Nse=g(SE=>{(function(e,t){let r=typeof SE=="object"?SE:typeof e=="object"?e:{};t(r),typeof define=="function"&&define.amd&&define("lru",r)})(SE,function(e){let t=Symbol("newer"),r=Symbol("older");function n(u,c){typeof u!="number"&&(c=u,u=0),this.size=0,this.limit=u,this.oldest=this.newest=void 0,this._keymap=new Map,c&&(this.assign(c),u<1&&(this.limit=this.size))}e.LRUMap=n;function i(u,c){this.key=u,this.value=c,this[t]=void 0,this[r]=void 0}n.prototype._markEntryAsUsed=function(u){u!==this.newest&&(u[t]&&(u===this.oldest&&(this.oldest=u[t]),u[t][r]=u[r]),u[r]&&(u[r][t]=u[t]),u[t]=void 0,u[r]=this.newest,this.newest&&(this.newest[t]=u),this.newest=u)},n.prototype.assign=function(u){let c,f=this.limit||Number.MAX_VALUE;this._keymap.clear();let p=u[Symbol.iterator]();for(let d=p.next();!d.done;d=p.next()){let m=new i(d.value[0],d.value[1]);if(this._keymap.set(m.key,m),c?(c[t]=m,m[r]=c):this.oldest=m,c=m,f--==0)throw new Error("overflow")}this.newest=c,this.size=this._keymap.size},n.prototype.get=function(u){var c=this._keymap.get(u);if(c)return this._markEntryAsUsed(c),c.value},n.prototype.set=function(u,c){var f=this._keymap.get(u);return f?(f.value=c,this._markEntryAsUsed(f),this):(this._keymap.set(u,f=new i(u,c)),this.newest?(this.newest[t]=f,f[r]=this.newest):this.oldest=f,this.newest=f,++this.size,this.size>this.limit&&this.shift(),this)},n.prototype.shift=function(){var u=this.oldest;if(u)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[r]=void 0):(this.oldest=void 0,this.newest=void 0),u[t]=u[r]=void 0,this._keymap.delete(u.key),--this.size,[u.key,u.value]},n.prototype.find=function(u){let c=this._keymap.get(u);return c?c.value:void 0},n.prototype.has=function(u){return this._keymap.has(u)},n.prototype.delete=function(u){var c=this._keymap.get(u);if(c)return this._keymap.delete(c.key),c[t]&&c[r]?(c[r][t]=c[t],c[t][r]=c[r]):c[t]?(c[t][r]=void 0,this.oldest=c[t]):c[r]?(c[r][t]=void 0,this.newest=c[r]):this.oldest=this.newest=void 0,this.size--,c.value},n.prototype.clear=function(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()};function s(u){this.entry=u}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let u=this.entry;return u?(this.entry=u[t],{done:!1,value:[u.key,u.value]}):{done:!0,value:void 0}};function o(u){this.entry=u}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let u=this.entry;return u?(this.entry=u[t],{done:!1,value:u.key}):{done:!0,value:void 0}};function a(u){this.entry=u}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let u=this.entry;return u?(this.entry=u[t],{done:!1,value:u.value}):{done:!0,value:void 0}},n.prototype.keys=function(){return new o(this.oldest)},n.prototype.values=function(){return new a(this.oldest)},n.prototype.entries=function(){return this},n.prototype[Symbol.iterator]=function(){return new s(this.oldest)},n.prototype.forEach=function(u,c){typeof c!="object"&&(c=this);let f=this.oldest;for(;f;)u.call(c,f.value,f.key,this),f=f[t]},n.prototype.toJSON=function(){for(var u=new Array(this.size),c=0,f=this.oldest;f;)u[c++]={key:f.key,value:f.value},f=f[t];return u},n.prototype.toString=function(){for(var u="",c=this.oldest;c;)u+=String(c.key)+":"+c.value,c=c[t],c&&(u+=" < ");return u}})});var nD=g(TE=>{Object.defineProperty(TE,"__esModule",{value:!0});var kc=(jn(),vt(Mn)),$pt=gn(),Hpt=Lt(),Wpt=require("fs"),zpt=Nse(),rD=new zpt.LRUMap(100),Gpt=7;function Vpt(e){return new Promise(function(t,r){Wpt.readFile(e,"utf8",function(n,i){n?r(n):t(i)})})}function Kpt(){rD.clear()}TE.resetFileContentCache=Kpt;var Xpt=function(){function e(t){t===void 0&&(t={}),this._options=t,this.name=e.id}return Object.defineProperty(e.prototype,"_contextLines",{get:function(){var t,r;if(this._options.frameContextLines===void 0){var n=(t=$pt.getCurrentHub().getClient())===null||t===void 0?void 0:t.getOptions();this._options.frameContextLines=(r=n)===null||r===void 0?void 0:r.frameContextLines}return this._options.frameContextLines!==void 0?this._options.frameContextLines:Gpt},enumerable:!0,configurable:!0}),e.prototype.setupOnce=function(t){var r=this;t(function(n){return r.addSourceContext(n)})},e.prototype.addSourceContext=function(t){var r,n;return kc.__awaiter(this,void 0,void 0,function(){var i,s,o,a,u,c;return kc.__generator(this,function(f){switch(f.label){case 0:if(!(this._contextLines>0&&(!((r=t.exception)===null||r===void 0)&&r.values)))return[3,8];f.label=1;case 1:f.trys.push([1,6,7,8]),i=kc.__values(t.exception.values),s=i.next(),f.label=2;case 2:return s.done?[3,5]:(o=s.value,!((n=o.stacktrace)===null||n===void 0)&&n.frames?[4,this.addSourceContextToFrames(o.stacktrace.frames)]:[3,4]);case 3:f.sent(),f.label=4;case 4:return s=i.next(),[3,2];case 5:return[3,8];case 6:return a=f.sent(),u={error:a},[3,8];case 7:try{s&&!s.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}return[7];case 8:return[2,t]}})})},e.prototype.addSourceContextToFrames=function(t){return kc.__awaiter(this,void 0,void 0,function(){var r,n,i,s,o,a,u,c,f;return kc.__generator(this,function(p){switch(p.label){case 0:r=this._contextLines,p.label=1;case 1:p.trys.push([1,6,7,8]),n=kc.__values(t),i=n.next(),p.label=2;case 2:return i.done?[3,5]:(s=i.value,s.filename&&s.context_line===void 0?[4,Ypt(s.filename)]:[3,4]);case 3:if(o=p.sent(),o)try{a=o.split(`
142
- `),Hpt.addContextToFrame(a,s,r)}catch{}p.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return u=p.sent(),c={error:u},[3,8];case 7:try{i&&!i.done&&(f=n.return)&&f.call(n)}finally{if(c)throw c.error}return[7];case 8:return[2]}})})},e.id="ContextLines",e}();TE.ContextLines=Xpt;function Ypt(e){return kc.__awaiter(this,void 0,void 0,function(){var t,r,n;return kc.__generator(this,function(i){switch(i.label){case 0:if(t=rD.get(e),t!==void 0)return[2,t];r=null,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,Vpt(e)];case 2:return r=i.sent(),[3,4];case 3:return n=i.sent(),[3,4];case 4:return rD.set(e,r),[2,r]}})})}});var kse=g(sD=>{Object.defineProperty(sD,"__esModule",{value:!0});var CE=(jn(),vt(Mn)),iD=gn(),AE=Lt(),Zpt=_P(),Jpt=nD(),Qpt="cause",edt=5,tdt=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._key=t.key||Qpt,this._limit=t.limit||edt}return e.prototype.setupOnce=function(){iD.addGlobalEventProcessor(function(t,r){var n=iD.getCurrentHub().getIntegration(e);if(n){var i=n._handler&&n._handler.bind(n);return typeof i=="function"?i(t,r):t}return t})},e.prototype._handler=function(t,r){var n=this;return!t.exception||!t.exception.values||!r||!AE.isInstanceOf(r.originalException,Error)?AE.resolvedSyncPromise(t):new AE.SyncPromise(function(i){n._walkErrorTree(r.originalException,n._key).then(function(s){t&&t.exception&&t.exception.values&&(t.exception.values=CE.__spread(s,t.exception.values)),i(t)}).then(null,function(){i(t)})})},e.prototype._walkErrorTree=function(t,r,n){n===void 0&&(n=[]);var i;return CE.__awaiter(this,void 0,void 0,function(){var s,o,a=this;return CE.__generator(this,function(u){switch(u.label){case 0:return!AE.isInstanceOf(t[r],Error)||n.length+1>=this._limit?[2,Promise.resolve(n)]:(s=Zpt.exceptionFromError(t[r]),o=iD.getCurrentHub().getIntegration(Jpt.ContextLines),o&&(!((i=s.stacktrace)===null||i===void 0)&&i.frames)?[4,o.addSourceContextToFrames(s.stacktrace.frames)]:[3,2]);case 1:u.sent(),u.label=2;case 2:return[2,new Promise(function(c,f){a._walkErrorTree(t[r],r,CE.__spread([s],n)).then(c).then(null,function(){f()})})]}})})},e.id="LinkedErrors",e}();sD.LinkedErrors=tdt});var Lse=g(aD=>{Object.defineProperty(aD,"__esModule",{value:!0});var qse=(jn(),vt(Mn)),Pse=require("fs"),Dse=require("path"),oD;function rdt(){try{return require.cache?Object.keys(require.cache):[]}catch{return[]}}function ndt(){var e=require.main&&require.main.paths||[],t=rdt(),r={},n={};return t.forEach(function(i){var s=i,o=function(){var a=s;if(s=Dse.dirname(a),!(!s||a===s||n[a])){if(e.indexOf(s)<0)return o();var u=Dse.join(a,"package.json");if(n[a]=!0,!Pse.existsSync(u))return o();try{var c=JSON.parse(Pse.readFileSync(u,"utf8"));r[c.name]=c.version}catch{}}};o()}),r}var idt=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(t,r){var n=this;t(function(i){return r().getIntegration(e)?qse.__assign(qse.__assign({},i),{modules:n._getModules()}):i})},e.prototype._getModules=function(){return oD||(oD=ndt()),oD},e.id="Modules",e}();aD.Modules=idt});var uD=g(uu=>{Object.defineProperty(uu,"__esModule",{value:!0});var sdt=mse();uu.Console=sdt.Console;var odt=Sse();uu.Http=odt.Http;var adt=Ose();uu.OnUncaughtException=adt.OnUncaughtException;var udt=Rse();uu.OnUnhandledRejection=udt.OnUnhandledRejection;var cdt=kse();uu.LinkedErrors=cdt.LinkedErrors;var ldt=Lse();uu.Modules=ldt.Modules;var fdt=nD();uu.ContextLines=fdt.ContextLines});var lD=g(ra=>{Object.defineProperty(ra,"__esModule",{value:!0});var Dv=(jn(),vt(Mn)),qc=gn(),Fse=ea(),cD=Lt(),pdt=require("domain"),ddt=zP(),Mse=Rc(),ih=uD();ra.defaultIntegrations=[new qc.Integrations.InboundFilters,new qc.Integrations.FunctionToString,new ih.ContextLines,new ih.Console,new ih.Http,new ih.OnUncaughtException,new ih.OnUnhandledRejection,new ih.LinkedErrors];function hdt(e){e===void 0&&(e={});var t,r=Fse.getMainCarrier(),n=((t=r.__SENTRY__)===null||t===void 0?void 0:t.integrations)||[];if(e.defaultIntegrations=e.defaultIntegrations===!1?[]:Dv.__spread(Array.isArray(e.defaultIntegrations)?e.defaultIntegrations:ra.defaultIntegrations,n),e.dsn===void 0&&process.env.SENTRY_DSN&&(e.dsn=process.env.SENTRY_DSN),e.tracesSampleRate===void 0&&process.env.SENTRY_TRACES_SAMPLE_RATE){var i=parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE);isFinite(i)&&(e.tracesSampleRate=i)}if(e.release===void 0){var s=jse();s!==void 0?e.release=s:e.autoSessionTracking=!1}e.environment===void 0&&process.env.SENTRY_ENVIRONMENT&&(e.environment=process.env.SENTRY_ENVIRONMENT),e.autoSessionTracking===void 0&&e.dsn!==void 0&&(e.autoSessionTracking=!0),pdt.active&&Fse.setHubOnCarrier(r,qc.getCurrentHub()),qc.initAndBind(ddt.NodeClient,e),e.autoSessionTracking&&ydt()}ra.init=hdt;function mdt(){return qc.getCurrentHub().lastEventId()}ra.lastEventId=mdt;function gdt(e){return Dv.__awaiter(this,void 0,void 0,function(){var t;return Dv.__generator(this,function(r){return t=qc.getCurrentHub().getClient(),t?[2,t.flush(e)]:(Mse.IS_DEBUG_BUILD&&cD.logger.warn("Cannot flush events. No client defined."),[2,Promise.resolve(!1)])})})}ra.flush=gdt;function vdt(e){return Dv.__awaiter(this,void 0,void 0,function(){var t;return Dv.__generator(this,function(r){return t=qc.getCurrentHub().getClient(),t?[2,t.close(e)]:(Mse.IS_DEBUG_BUILD&&cD.logger.warn("Cannot flush events and disable SDK. No client defined."),[2,Promise.resolve(!1)])})})}ra.close=vdt;function xdt(e){if(e===void 0)return!1;var t=e&&e.getOptions();return t&&t.autoSessionTracking!==void 0?t.autoSessionTracking:!1}ra.isAutoSessionTrackingEnabled=xdt;function jse(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;var t=cD.getGlobalObject();return t.SENTRY_RELEASE&&t.SENTRY_RELEASE.id?t.SENTRY_RELEASE.id:process.env.GITHUB_SHA||process.env.COMMIT_REF||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA||e}ra.getSentryRelease=jse;function ydt(){var e=qc.getCurrentHub();e.startSession(),process.on("beforeExit",function(){var t,r=(t=e.getScope())===null||t===void 0?void 0:t.getSession(),n=["exited","crashed"];r&&!n.includes(r.status)&&e.endSession()})}});var Use=g(pD=>{Object.defineProperty(pD,"__esModule",{value:!0});var Bse=(jn(),vt(Mn)),OE=require("fs"),fD=require("path");function _dt(e){var t=fD.resolve(e);if(!OE.existsSync(t))throw new Error("Cannot read contents of "+t+". Directory does not exist.");if(!OE.statSync(t).isDirectory())throw new Error("Cannot read contents of "+t+", because it is not a directory.");var r=function(n){return OE.readdirSync(n).reduce(function(i,s){var o=fD.join(n,s);return OE.statSync(o).isDirectory()?Bse.__spread(i,r(o)):Bse.__spread(i,[o])},[])};return r(t).map(function(n){return fD.relative(t,n)})}pD.deepReadDirSync=_dt});var $se=g(dD=>{"use strict";dD.parse=Edt;dD.serialize=Sdt;var bdt=decodeURIComponent,wdt=encodeURIComponent,IE=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function Edt(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var r={},n=t||{},i=e.split(";"),s=n.decode||bdt,o=0;o<i.length;o++){var a=i[o],u=a.indexOf("=");if(!(u<0)){var c=a.substring(0,u).trim();if(r[c]==null){var f=a.substring(u+1,a.length).trim();f[0]==='"'&&(f=f.slice(1,-1)),r[c]=Tdt(f,s)}}}return r}function Sdt(e,t,r){var n=r||{},i=n.encode||wdt;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!IE.test(e))throw new TypeError("argument name is invalid");var s=i(t);if(s&&!IE.test(s))throw new TypeError("argument val is invalid");var o=e+"="+s;if(n.maxAge!=null){var a=n.maxAge-0;if(isNaN(a)||!isFinite(a))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(a)}if(n.domain){if(!IE.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!IE.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite){var u=typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite;switch(u){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}function Tdt(e,t){try{return t(e)}catch{return e}}});var Wse=g(xf=>{Object.defineProperty(xf,"__esModule",{value:!0});var na=(jn(),vt(Mn)),gf=gn(),vf=Lt(),Cdt=$se(),Adt=require("domain"),Odt=require("os"),Idt=require("url"),Rdt=Rc(),Lv=lD();function Ndt(){return function(t,r,n){var i;t.headers&&vf.isString(t.headers["sentry-trace"])&&(i=vf.extractTraceparentData(t.headers["sentry-trace"]));var s=gf.startTransaction(na.__assign({name:RE(t,{path:!0,method:!0}),op:"http.server"},i),{request:NE(t)});gf.getCurrentHub().configureScope(function(o){o.setSpan(s)}),r.__sentry_transaction=s,r.once("finish",function(){setImmediate(function(){kdt(s,t),s.setHttpStatus(r.statusCode),s.finish()})}),n()}}xf.tracingHandler=Ndt;function kdt(e,t){e&&(e.name=RE(t,{path:!0,method:!0}),e.setData("url",t.originalUrl),e.setData("baseUrl",t.baseUrl),e.setData("query",t.query))}function RE(e,t){t===void 0&&(t={});var r,n=(r=e.method)===null||r===void 0?void 0:r.toUpperCase(),i="";e.route?i=""+(e.baseUrl||"")+e.route.path:(e.originalUrl||e.url)&&(i=vf.stripUrlQueryAndFragment(e.originalUrl||e.url||""));var s="";return t.method&&n&&(s+=n),t.method&&t.path&&(s+=" "),t.path&&i&&(s+=i),s}function qdt(e,t){var r;switch(t){case"path":return RE(e,{path:!0});case"handler":return((r=e.route)===null||r===void 0?void 0:r.stack[0].name)||"<anonymous>";case"methodPath":default:return RE(e,{path:!0,method:!0})}}var Pdt=["id","username","email"];function Ddt(e,t){var r={},n=Array.isArray(t)?t:Pdt;return n.forEach(function(i){e&&i in e&&(r[i]=e[i])}),r}var Ldt=["cookies","data","headers","method","query_string","url"];function NE(e,t){t===void 0&&(t=Ldt);var r={},n=e.headers||e.header||{},i=e.method,s=e.hostname||e.host||n.host||"<no host>",o=e.protocol==="https"||e.secure||(e.socket||{}).encrypted?"https":"http",a=e.originalUrl||e.url||"",u=o+"://"+s+a;return t.forEach(function(c){switch(c){case"headers":r.headers=n;break;case"method":r.method=i;break;case"url":r.url=u;break;case"cookies":r.cookies=e.cookies||Cdt.parse(n.cookie||"");break;case"query_string":r.query_string=e.query||Idt.parse(a||"",!1).query;break;case"data":if(i==="GET"||i==="HEAD")break;e.body!==void 0&&(r.data=vf.isString(e.body)?e.body:JSON.stringify(vf.normalize(e.body)));break;default:({}).hasOwnProperty.call(e,c)&&(r[c]=e[c])}}),r}xf.extractRequestData=NE;function Hse(e,t,r){if(r=na.__assign({ip:!1,request:!0,serverName:!0,transaction:!0,user:!0,version:!0},r),r.version&&(e.contexts=na.__assign(na.__assign({},e.contexts),{runtime:{name:"node",version:global.process.version}})),r.request){var n=Array.isArray(r.request)?NE(t,r.request):NE(t);e.request=na.__assign(na.__assign({},e.request),n)}if(r.serverName&&!e.server_name&&(e.server_name=global.process.env.SENTRY_NAME||Odt.hostname()),r.user){var i=t.user&&vf.isPlainObject(t.user)?Ddt(t.user,r.user):{};Object.keys(i)&&(e.user=na.__assign(na.__assign({},e.user),i))}if(r.ip){var s=t.ip||t.connection&&t.connection.remoteAddress;s&&(e.user=na.__assign(na.__assign({},e.user),{ip_address:s}))}return r.transaction&&!e.transaction&&(e.transaction=qdt(t,r.transaction)),e}xf.parseRequest=Hse;function Fdt(e){var t=gf.getCurrentHub(),r=t.getClient();if(r&&Lv.isAutoSessionTrackingEnabled(r)){r.initSessionFlusher();var n=t.getScope();n&&n.getSession()&&n.setSession()}return function(s,o,a){if(e&&e.flushTimeout&&e.flushTimeout>0){var u=o.end;o.end=function(f,p,d){var m=this;Lv.flush(e.flushTimeout).then(function(){u.call(m,f,p,d)}).then(null,function(v){Rdt.IS_DEBUG_BUILD&&vf.logger.error(v),u.call(m,f,p,d)})}}var c=Adt.create();c.add(s),c.add(o),c.on("error",a),c.run(function(){var f=gf.getCurrentHub();f.configureScope(function(p){p.addEventProcessor(function(v){return Hse(v,s,e)});var d=f.getClient();if(Lv.isAutoSessionTrackingEnabled(d)){var m=f.getScope();m&&m.setRequestSession({status:"ok"})}}),o.once("finish",function(){var p=f.getClient();Lv.isAutoSessionTrackingEnabled(p)&&setImmediate(function(){p&&p._captureRequestSession&&p._captureRequestSession()})}),a()})}}xf.requestHandler=Fdt;function Mdt(e){var t=e.status||e.statusCode||e.status_code||e.output&&e.output.statusCode;return t?parseInt(t,10):500}function jdt(e){var t=Mdt(e);return t>=500}function Bdt(e){return function(r,n,i,s){var o=e&&e.shouldHandleError||jdt;if(o(r)){gf.withScope(function(a){var u=i.__sentry_transaction;u&&a.getSpan()===void 0&&a.setSpan(u);var c=gf.getCurrentHub().getClient();if(c&&Lv.isAutoSessionTrackingEnabled(c)){var f=c._sessionFlusher!==void 0;if(f){var p=a.getRequestSession();p&&p.status!==void 0&&(p.status="crashed")}}var d=gf.captureException(r);i.sentry=d,s(r)});return}s(r)}}xf.errorHandler=Bdt});var Gse=g(yt=>{Object.defineProperty(yt,"__esModule",{value:!0});var zse=(jn(),vt(Mn)),Udt=jd();yt.Severity=Udt.Severity;var Vr=gn();yt.addGlobalEventProcessor=Vr.addGlobalEventProcessor;yt.addBreadcrumb=Vr.addBreadcrumb;yt.captureException=Vr.captureException;yt.captureEvent=Vr.captureEvent;yt.captureMessage=Vr.captureMessage;yt.configureScope=Vr.configureScope;yt.getHubFromCarrier=Vr.getHubFromCarrier;yt.getCurrentHub=Vr.getCurrentHub;yt.Hub=Vr.Hub;yt.makeMain=Vr.makeMain;yt.Scope=Vr.Scope;yt.Session=Vr.Session;yt.startTransaction=Vr.startTransaction;yt.SDK_VERSION=Vr.SDK_VERSION;yt.setContext=Vr.setContext;yt.setExtra=Vr.setExtra;yt.setExtras=Vr.setExtras;yt.setTag=Vr.setTag;yt.setTags=Vr.setTags;yt.setUser=Vr.setUser;yt.withScope=Vr.withScope;var $dt=$P();yt.NodeBackend=$dt.NodeBackend;var Hdt=zP();yt.NodeClient=Hdt.NodeClient;var sh=lD();yt.defaultIntegrations=sh.defaultIntegrations;yt.init=sh.init;yt.lastEventId=sh.lastEventId;yt.flush=sh.flush;yt.close=sh.close;yt.getSentryRelease=sh.getSentryRelease;var Wdt=Use();yt.deepReadDirSync=Wdt.deepReadDirSync;var zdt=EP();yt.SDK_NAME=zdt.SDK_NAME;var Gdt=gn(),Vdt=ea(),Kdt=require("domain"),Xdt=Wse();yt.Handlers=Xdt;var Ydt=uD(),Zdt=FP();yt.Transports=Zdt;var Jdt=zse.__assign(zse.__assign({},Gdt.Integrations),Ydt);yt.Integrations=Jdt;var Fv=Vdt.getMainCarrier();Fv.__SENTRY__&&(Fv.__SENTRY__.extensions=Fv.__SENTRY__.extensions||{},Fv.__SENTRY__.extensions.domain=Fv.__SENTRY__.extensions.domain||Kdt)});var Vse,jv,Kse,Mv,hD,fr,cu=ae(()=>{"use strict";Vse=xe(rne()),jv=xe(Gse());oh();Kse=()=>{var e;return(process.env.AMPT_STAGE==="prod"||((e=process.env.AMPT_ENDPOINT)==null?void 0:e.endsWith("ampt.dev")))&&!process.env.JEST_WORKER_ID};Kse()&&jv.init({dsn:"https://5f27cbf3265a475abff6b7999ae73179@o1265020.ingest.sentry.io/6448443",tracesSampleRate:1});hD=class{constructor(){tn(this,"orgName");tn(this,"user");tn(this,"config");Xm(this,Mv,(0,Vse.ulid)());tn(this,"auth");tn(this,"captureException",t=>{Bv.error({err:t},"captureException"),Kse()&&jv&&jv.captureException(t,{tags:{sessionId:po(this,Mv)}})})}getSessionId(){return po(this,Mv)}storeAuth(t){this.auth=t}setUser(t){this.user=t,t.config&&(this.config=t.config)}shouldPromptTutorial(){var t,r,n,i;if(this.config){let s=((t=this.config)==null?void 0:t.connectedCount)>=3,o=((r=this.user)==null?void 0:r.userAgeDays)&&((n=this.user)==null?void 0:n.userAgeDays)>30;return{showTutorial:((i=this.config)==null?void 0:i.showTutorial)??!1,allowDismiss:o?!0:s}}return{showTutorial:!1,allowDismiss:!1}}};Mv=new WeakMap;fr=new hD});var kE,qE,Pc,mD,Ie,Bv,oh=ae(()=>{"use strict";kE=xe(ene()),qE=xe(require("path")),Pc=xe(Dl());cu();mD=class{logger;enabled;logFilePath;logToConsole;pinoArgs;pinoDestination;initLogDestination(){try{(0,Pc.removeSync)(this.logFilePath)}catch(t){process.env.AMPT_DEBUG&&console.error("Error removing log file: ",t)}finally{if(this.enabled)try{(0,Pc.ensureFileSync)(this.logFilePath)}catch{this.enabled=!1}}this.pinoDestination=this.enabled&&!this.logToConsole?kE.default.destination({dest:this.logFilePath,sync:process.platform!=="win32"}):void 0}constructor(){this.enabled=!process.env.AMPT_DISABLE_LOGS,this.logFilePath=process.env.AMPT_LOG_DIR||qE.default.join(process.cwd(),".ampt","logs"),this.logToConsole=process.env.AMPT_LOG_TO_CONSOLE==="true",this.initLogDestination(),this.pinoArgs={enabled:this.enabled,level:process.env.AMPT_LOG_LEVEL||"info",mixin:()=>({sessionId:fr.getSessionId()}),redact:{remove:!0,paths:["credentials","accessKey","token","idToken","refreshToken","accessToken"]}},this.logger=(0,kE.default)(this.pinoArgs,this.pinoDestination)}disable(){this.enabled=!1}enable(){this.enabled=!0;let t=qE.default.join(process.cwd(),".ampt");this.logFilePath=process.env.AMPT_LOG_DIR||qE.default.join(t,"logs"),(0,Pc.existsSync)(t)||(0,Pc.mkdirSync)(t),this.initLogDestination(),this.pinoArgs={...this.pinoArgs,enabled:this.enabled},this.logger=(0,kE.default)(this.pinoArgs,this.pinoDestination)}child(t){return this.logger.child(t)}debug(...t){this.enabled&&this.logger.debug(...t)}warn(...t){this.enabled&&this.logger.warn(...t)}error(...t){this.enabled&&this.logger.error(...t)}info(...t){this.enabled&&this.logger.info(...t)}fatal(...t){this.enabled&&this.logger.fatal(...t)}trace(...t){this.enabled&&this.logger.trace(...t)}},Ie=new mD,Bv=Ie});var Uv=g((Krr,Qdt)=>{Qdt.exports={name:"@ampt/cli",version:"1.0.37-beta.4",description:"Ampt command line interface",main:"./dist/index.js",types:"./types/index.d.ts",engines:{node:">=16.0.0"},publishConfig:{access:"public"},bin:{ampt:"./bin/bin"},scripts:{prepublishOnly:"npm run build",build:"node esbuild.mjs",watch:"node esbuild.mjs --watch",test:'LOG_LEVEL=silent AWS_REGION=us-east-1 NODE_OPTIONS="--no-warnings --experimental-vm-modules" jest',eslint:"eslint .",prettier:"prettier --check ."},author:"Ampt Inc <hello@getampt.com>",license:"Apache-2.0",optionalDependencies:{fsevents:"~2.3.2"},babel:{presets:["@babel/preset-typescript"]},devDependencies:{"@astrojs/webapi":"^1.1.1","@sentry/node":"^6.16.1","@types/express":"^4.17.13","@types/http-proxy":"^1.17.8","@types/write-file-atomic":"^4.0.0","@types/ws":"^8.5.3","adm-zip":"^0.5.5","ansi-escapes":"^4.3.1",axios:"^1.6.5","axios-retry":"^4.0.0",chalk:"^4.1.0","child-process-ext":"^2.1.1",chokidar:"^3.5.0",chunk:"^0.0.3",dayjs:"^1.10.4",debounce:"^1.2.1",del:"^6.0.0",download:"^8.0.0","download-git-repo":"^3.0.2",figures:"^3.2.0","fs-extra":"^9.0.1","get-port":"^5.0.0","git-list-updated":"^1.2.1","github-release-from-cc-changelog":"^2.2.0","http-proxy":"^1.18.1",ignore:"^5.2.0","is-git-url":"^1.0.0","is-installed-globally":"^0.4.0","it-parallel":"^2.0.1","jwt-decode":"^3.1.2",keypress:"^0.2.1","lz4-wasm-nodejs":"^0.9.2",minimist:"^1.2.5","node-emoji":"^1.10.0","node-resolve":"^1.3.4","normalize-path":"^3.0.0",open:"^8.2.0","parse-packagejson-name":"^1.0.1",pluralize:"^8.0.0",ramda:"^0.27.2",semver:"^5.7.1","strip-ansi":"^6.0.0",terminate:"^2.5.0","tree-kill":"^1.2.2",ulid:"^2.3.0",which:"^2.0.2","write-file-atomic":"^4.0.2"},dependencies:{esbuild:"^0.19.5",joycon:"^3.1.1",pirates:"^4.0.5","source-map-support":"^0.5.21","tsconfig-paths":"^4.1.2"}}});var Yse,Xse,eht,gD,vD,ze,enr,xD=ae(()=>{"use strict";Yse=xe(require("https"));Aw();Kee();oh();cu();({version:Xse}=Uv()),eht=new Yse.default.Agent({keepAlive:!0}),gD=class e{axios;static config(){return{apiEndpoint:process.env.AMPT_ENDPOINT,apiKey:process.env.AMPT_API_KEY}}constructor(){this.axios=Yo.create({httpsAgent:eht}),Ow(this.axios,{retries:10,retryDelay:Ow.exponentialDelay,retryCondition:t=>{var s;let r=t.response&&t.response.status||"unknown",n=t.response&&t.response.data&&t.response.data.message||"unknown",i=Ow.isNetworkOrIdempotentRequestError(t)&&r!==500||r===429||r===503;return i&&Bv.debug({status:r,message:n,response:(s=t.response)==null?void 0:s.data},"retryable request error"),i}}),this.axios.defaults.headers.common={},this.axios.defaults.headers.put={},this.axios.defaults.headers.get={}}async request(t={}){var y,b,_,E,S,w,C,I,j,q,D,N;let{apiEndpoint:r,apiKey:n}=e.config(),i=t.root||r,s=(y=fr.auth)==null?void 0:y.accessToken,{method:o="POST",params:a,headers:u={},body:c,endpoint:f}=t,{url:p=`${i}${f}`,responseType:d}=t;n&&p.startsWith(r)?u.Authorization=`Basic ${n}`:s&&p.startsWith(r)&&(u.Authorization=`Bearer ${s}`),c&&f&&(u["Content-Type"]="application/json");let m=fr.getSessionId();f&&(u["User-Agent"]=`ampt-cli/${Xse}`,u["ampt-version"]=Xse,u["ampt-session-id"]=m);let v={url:p,method:o,headers:u,params:a,data:c,maxContentLength:1/0,maxBodyLength:1/0,onUploadProgress:t.onUploadProgress};d&&(v.responseType=d);try{return Bv.debug({method:o,url:p,sessionId:m},"request"),(await this.axios(v)).data}catch(k){if(((b=k.response)==null?void 0:b.status)===403&&((E=(_=k.response)==null?void 0:_.data)==null?void 0:E.code)==="EXPIRED_TOKEN")return await((S=fr.user)==null?void 0:S.refreshAccessToken()),this.request(t);if(((w=k.response)==null?void 0:w.status)===403){let R=new Error("Forbidden");throw R.message="You do not have permission to access this resource.",R.name="ForbiddenError",R}if(((C=k.response)==null?void 0:C.status)===404)return;if(((I=k.response)==null?void 0:I.status)===409){let R=new Error("Conflict");throw R.message="Conflict",R.name="ConflictError",R}if(k.response&&k.response.data){let R=new Error(k.response.data.message||k.response.data);throw(j=k.response.data.message)!=null&&j.includes("Request Entity Too Large")?(R.message="Your code size is too large. Try reducing it by adding to .deployignore",R.name="EntityTooLargeError"):(q=k.response.data.message)!=null&&q.includes("User disabled")?(R.message=k.response.data.detail||"Your account has been disabled. Please contact support@getampt.com for more information.",R.name="UserDisabledError"):(D=k.response.data.message)!=null&&D.includes("App limit reached")?(R.message="You have reached your Organization's app limit. Please upgrade your plan or delete an app.",R.name="AppLimitReachedError"):(N=k.response.data.message)!=null&&N.includes("Instance limit reached")?(R.message="You have reached your Organization's environment limit. Please upgrade your plan or delete an environment.",R.name="EnvironmentLimitReachedError"):R.name=k.response.data.name||null,R.statusCode=k.response.data.statusCode||k.response.status||null,R}throw k}}},vD=new gD,ze=vD.request.bind(vD),enr=vD.request});var Zse,Jse=ae(()=>{"use strict";Zse=async(e,t)=>{let r,n=new Promise(i=>{r=setTimeout(()=>i(null),t)});return Promise.race([e,n]).then(i=>(clearTimeout(r),i))}});var PE,Qse=ae(()=>{"use strict";PE=e=>e?e===0?"less than a second":e===1?"1 second":`${e} seconds`:"a few seconds"});var ia,yD=ae(()=>{"use strict";ia=async e=>new Promise(t=>setTimeout(t,e).unref())});var mr,_D,bD=ae(()=>{"use strict";wr();cu();mr=e=>{(async()=>{let{eventName:t,eventData:r={}}=e,n=fr.orgName;if(!n){Ie.warn({eventName:t},"Could not send report - no org name found");return}try{await ze({method:"POST",body:{eventName:t,eventData:{...r,shell:!0}},endpoint:`/orgs/${n}/analytics`})}catch(i){fr.captureException(i),process.env.AMPT_DEBUG&&console.error(i)}})()},_D=mr});async function wD(e){try{let t="https://ampt.dev/public/templates/manifest-tags.json",{data:r}=await Yo.get(t);return r.filter(n=>n.tags.includes("starter"))}catch(t){return process.env.AMPT_DEBUG&&e.logError(t),[]}}var ED=ae(()=>{"use strict";Aw()});var SD,eoe,TD=ae(()=>{"use strict";SD=e=>{try{return process.kill(e,0)}catch(t){return t.code==="EPERM"}},eoe=SD});async function DE(e,t){let r=e.eventNames(),n=new Map;for(let i of r)n.set(i,e.listeners(i));try{return await t()}finally{e.removeAllListeners();for(let i of r)for(let s of n.get(i))e.on(i,s)}}var toe=ae(()=>{"use strict"});function roe(e){e=e.trim();let t=0,r=null,n=null,i=null,s=[];for(let o=0;o<e.length;o++){if(r=n,n=e.charAt(o),n===" "&&!i){r!==" "&&t++;continue}if(n===i){i=null;continue}else if((n==="'"||n==='"')&&!i){i=n;continue}s[t]||(s[t]=""),s[t]+=n}return s}var noe=ae(()=>{"use strict"});var ioe=ae(()=>{"use strict"});var soe=g((ah,$v)=>{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",a=500,u="__lodash_placeholder__",c=1,f=2,p=4,d=1,m=2,v=1,y=2,b=4,_=8,E=16,S=32,w=64,C=128,I=256,j=512,q=30,D="...",N=800,k=16,R=1,z=2,X=3,B=1/0,U=9007199254740991,Q=17976931348623157e292,G=0/0,re=4294967295,oe=re-1,he=re>>>1,Ne=[["ary",C],["bind",v],["bindKey",y],["curry",_],["curryRight",E],["flip",j],["partial",S],["partialRight",w],["rearg",I]],Qe="[object Arguments]",$e="[object Array]",Je="[object AsyncFunction]",Ae="[object Boolean]",$t="[object Date]",at="[object DOMException]",ye="[object Error]",F="[object Function]",A="[object GeneratorFunction]",te="[object Map]",Y="[object Number]",Xe="[object Null]",He="[object Object]",Jt="[object Promise]",Ir="[object Proxy]",en="[object RegExp]",ke="[object Set]",rr="[object String]",qn="[object Symbol]",gp="[object Undefined]",Lo="[object WeakMap]",ul="[object WeakSet]",Fo="[object ArrayBuffer]",L="[object DataView]",W="[object Float32Array]",K="[object Float64Array]",se="[object Int8Array]",le="[object Int16Array]",Ee="[object Int32Array]",et="[object Uint8Array]",mt="[object Uint8ClampedArray]",ln="[object Uint16Array]",Ji="[object Uint32Array]",Wr=/\b__p \+= '';/g,Ge=/\b(__p \+=) '' \+/g,ao=/(__e\(.*?\)|\b__t\)) \+\n'';/g,vy=/&(?:amp|lt|gt|quot|#39);/g,vp=/[&<>"']/g,xy=RegExp(vy.source),yy=RegExp(vp.source),Im=/<%-([\s\S]+?)%>/g,Qi=/<%([\s\S]+?)%>/g,Rm=/<%=([\s\S]+?)%>/g,Nm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_y=/^\w*$/,km=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cl=/[\\^$.*+?()[\]{}|]/g,xp=RegExp(cl.source),ll=/^\s+/,by=/\s/,wy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oFe=/\{\n\/\* \[wrapped with (.+)\] \*/,aFe=/,? & /,uFe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,cFe=/[()=,{}\[\]\/\s]/,lFe=/\\(\\)?/g,fFe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,YB=/\w*$/,pFe=/^[-+]0x[0-9a-f]+$/i,dFe=/^0b[01]+$/i,hFe=/^\[object .+?Constructor\]$/,mFe=/^0o[0-7]+$/i,gFe=/^(?:0|[1-9]\d*)$/,vFe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ey=/($^)/,xFe=/['\n\r\u2028\u2029\\]/g,Sy="\\ud800-\\udfff",yFe="\\u0300-\\u036f",_Fe="\\ufe20-\\ufe2f",bFe="\\u20d0-\\u20ff",ZB=yFe+_Fe+bFe,JB="\\u2700-\\u27bf",QB="a-z\\xdf-\\xf6\\xf8-\\xff",wFe="\\xac\\xb1\\xd7\\xf7",EFe="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SFe="\\u2000-\\u206f",TFe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",eU="A-Z\\xc0-\\xd6\\xd8-\\xde",tU="\\ufe0e\\ufe0f",rU=wFe+EFe+SFe+TFe,cA="['\u2019]",CFe="["+Sy+"]",nU="["+rU+"]",Ty="["+ZB+"]",iU="\\d+",AFe="["+JB+"]",sU="["+QB+"]",oU="[^"+Sy+rU+iU+JB+QB+eU+"]",lA="\\ud83c[\\udffb-\\udfff]",OFe="(?:"+Ty+"|"+lA+")",aU="[^"+Sy+"]",fA="(?:\\ud83c[\\udde6-\\uddff]){2}",pA="[\\ud800-\\udbff][\\udc00-\\udfff]",yp="["+eU+"]",uU="\\u200d",cU="(?:"+sU+"|"+oU+")",IFe="(?:"+yp+"|"+oU+")",lU="(?:"+cA+"(?:d|ll|m|re|s|t|ve))?",fU="(?:"+cA+"(?:D|LL|M|RE|S|T|VE))?",pU=OFe+"?",dU="["+tU+"]?",RFe="(?:"+uU+"(?:"+[aU,fA,pA].join("|")+")"+dU+pU+")*",NFe="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kFe="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hU=dU+pU+RFe,qFe="(?:"+[AFe,fA,pA].join("|")+")"+hU,PFe="(?:"+[aU+Ty+"?",Ty,fA,pA,CFe].join("|")+")",DFe=RegExp(cA,"g"),LFe=RegExp(Ty,"g"),dA=RegExp(lA+"(?="+lA+")|"+PFe+hU,"g"),FFe=RegExp([yp+"?"+sU+"+"+lU+"(?="+[nU,yp,"$"].join("|")+")",IFe+"+"+fU+"(?="+[nU,yp+cU,"$"].join("|")+")",yp+"?"+cU+"+"+lU,yp+"+"+fU,kFe,NFe,iU,qFe].join("|"),"g"),MFe=RegExp("["+uU+Sy+ZB+tU+"]"),jFe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,BFe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],UFe=-1,dr={};dr[W]=dr[K]=dr[se]=dr[le]=dr[Ee]=dr[et]=dr[mt]=dr[ln]=dr[Ji]=!0,dr[Qe]=dr[$e]=dr[Fo]=dr[Ae]=dr[L]=dr[$t]=dr[ye]=dr[F]=dr[te]=dr[Y]=dr[He]=dr[en]=dr[ke]=dr[rr]=dr[Lo]=!1;var lr={};lr[Qe]=lr[$e]=lr[Fo]=lr[L]=lr[Ae]=lr[$t]=lr[W]=lr[K]=lr[se]=lr[le]=lr[Ee]=lr[te]=lr[Y]=lr[He]=lr[en]=lr[ke]=lr[rr]=lr[qn]=lr[et]=lr[mt]=lr[ln]=lr[Ji]=!0,lr[ye]=lr[F]=lr[Lo]=!1;var $Fe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},HFe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},WFe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},zFe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},GFe=parseFloat,VFe=parseInt,mU=typeof global=="object"&&global&&global.Object===Object&&global,KFe=typeof self=="object"&&self&&self.Object===Object&&self,En=mU||KFe||Function("return this")(),hA=typeof ah=="object"&&ah&&!ah.nodeType&&ah,fl=hA&&typeof $v=="object"&&$v&&!$v.nodeType&&$v,gU=fl&&fl.exports===hA,mA=gU&&mU.process,As=function(){try{var Z=fl&&fl.require&&fl.require("util").types;return Z||mA&&mA.binding&&mA.binding("util")}catch{}}(),vU=As&&As.isArrayBuffer,xU=As&&As.isDate,yU=As&&As.isMap,_U=As&&As.isRegExp,bU=As&&As.isSet,wU=As&&As.isTypedArray;function es(Z,ue,ie){switch(ie.length){case 0:return Z.call(ue);case 1:return Z.call(ue,ie[0]);case 2:return Z.call(ue,ie[0],ie[1]);case 3:return Z.call(ue,ie[0],ie[1],ie[2])}return Z.apply(ue,ie)}function XFe(Z,ue,ie,Te){for(var tt=-1,Dt=Z==null?0:Z.length;++tt<Dt;){var fn=Z[tt];ue(Te,fn,ie(fn),Z)}return Te}function Os(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length;++ie<Te&&ue(Z[ie],ie,Z)!==!1;);return Z}function YFe(Z,ue){for(var ie=Z==null?0:Z.length;ie--&&ue(Z[ie],ie,Z)!==!1;);return Z}function EU(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length;++ie<Te;)if(!ue(Z[ie],ie,Z))return!1;return!0}function Hu(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length,tt=0,Dt=[];++ie<Te;){var fn=Z[ie];ue(fn,ie,Z)&&(Dt[tt++]=fn)}return Dt}function Cy(Z,ue){var ie=Z==null?0:Z.length;return!!ie&&_p(Z,ue,0)>-1}function gA(Z,ue,ie){for(var Te=-1,tt=Z==null?0:Z.length;++Te<tt;)if(ie(ue,Z[Te]))return!0;return!1}function yr(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length,tt=Array(Te);++ie<Te;)tt[ie]=ue(Z[ie],ie,Z);return tt}function Wu(Z,ue){for(var ie=-1,Te=ue.length,tt=Z.length;++ie<Te;)Z[tt+ie]=ue[ie];return Z}function vA(Z,ue,ie,Te){var tt=-1,Dt=Z==null?0:Z.length;for(Te&&Dt&&(ie=Z[++tt]);++tt<Dt;)ie=ue(ie,Z[tt],tt,Z);return ie}function ZFe(Z,ue,ie,Te){var tt=Z==null?0:Z.length;for(Te&&tt&&(ie=Z[--tt]);tt--;)ie=ue(ie,Z[tt],tt,Z);return ie}function xA(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length;++ie<Te;)if(ue(Z[ie],ie,Z))return!0;return!1}var JFe=yA("length");function QFe(Z){return Z.split("")}function e4e(Z){return Z.match(uFe)||[]}function SU(Z,ue,ie){var Te;return ie(Z,function(tt,Dt,fn){if(ue(tt,Dt,fn))return Te=Dt,!1}),Te}function Ay(Z,ue,ie,Te){for(var tt=Z.length,Dt=ie+(Te?1:-1);Te?Dt--:++Dt<tt;)if(ue(Z[Dt],Dt,Z))return Dt;return-1}function _p(Z,ue,ie){return ue===ue?p4e(Z,ue,ie):Ay(Z,TU,ie)}function t4e(Z,ue,ie,Te){for(var tt=ie-1,Dt=Z.length;++tt<Dt;)if(Te(Z[tt],ue))return tt;return-1}function TU(Z){return Z!==Z}function CU(Z,ue){var ie=Z==null?0:Z.length;return ie?bA(Z,ue)/ie:G}function yA(Z){return function(ue){return ue==null?e:ue[Z]}}function _A(Z){return function(ue){return Z==null?e:Z[ue]}}function AU(Z,ue,ie,Te,tt){return tt(Z,function(Dt,fn,nr){ie=Te?(Te=!1,Dt):ue(ie,Dt,fn,nr)}),ie}function r4e(Z,ue){var ie=Z.length;for(Z.sort(ue);ie--;)Z[ie]=Z[ie].value;return Z}function bA(Z,ue){for(var ie,Te=-1,tt=Z.length;++Te<tt;){var Dt=ue(Z[Te]);Dt!==e&&(ie=ie===e?Dt:ie+Dt)}return ie}function wA(Z,ue){for(var ie=-1,Te=Array(Z);++ie<Z;)Te[ie]=ue(ie);return Te}function n4e(Z,ue){return yr(ue,function(ie){return[ie,Z[ie]]})}function OU(Z){return Z&&Z.slice(0,kU(Z)+1).replace(ll,"")}function ts(Z){return function(ue){return Z(ue)}}function EA(Z,ue){return yr(ue,function(ie){return Z[ie]})}function qm(Z,ue){return Z.has(ue)}function IU(Z,ue){for(var ie=-1,Te=Z.length;++ie<Te&&_p(ue,Z[ie],0)>-1;);return ie}function RU(Z,ue){for(var ie=Z.length;ie--&&_p(ue,Z[ie],0)>-1;);return ie}function i4e(Z,ue){for(var ie=Z.length,Te=0;ie--;)Z[ie]===ue&&++Te;return Te}var s4e=_A($Fe),o4e=_A(HFe);function a4e(Z){return"\\"+zFe[Z]}function u4e(Z,ue){return Z==null?e:Z[ue]}function bp(Z){return MFe.test(Z)}function c4e(Z){return jFe.test(Z)}function l4e(Z){for(var ue,ie=[];!(ue=Z.next()).done;)ie.push(ue.value);return ie}function SA(Z){var ue=-1,ie=Array(Z.size);return Z.forEach(function(Te,tt){ie[++ue]=[tt,Te]}),ie}function NU(Z,ue){return function(ie){return Z(ue(ie))}}function zu(Z,ue){for(var ie=-1,Te=Z.length,tt=0,Dt=[];++ie<Te;){var fn=Z[ie];(fn===ue||fn===u)&&(Z[ie]=u,Dt[tt++]=ie)}return Dt}function Oy(Z){var ue=-1,ie=Array(Z.size);return Z.forEach(function(Te){ie[++ue]=Te}),ie}function f4e(Z){var ue=-1,ie=Array(Z.size);return Z.forEach(function(Te){ie[++ue]=[Te,Te]}),ie}function p4e(Z,ue,ie){for(var Te=ie-1,tt=Z.length;++Te<tt;)if(Z[Te]===ue)return Te;return-1}function d4e(Z,ue,ie){for(var Te=ie+1;Te--;)if(Z[Te]===ue)return Te;return Te}function wp(Z){return bp(Z)?m4e(Z):JFe(Z)}function uo(Z){return bp(Z)?g4e(Z):QFe(Z)}function kU(Z){for(var ue=Z.length;ue--&&by.test(Z.charAt(ue)););return ue}var h4e=_A(WFe);function m4e(Z){for(var ue=dA.lastIndex=0;dA.test(Z);)++ue;return ue}function g4e(Z){return Z.match(dA)||[]}function v4e(Z){return Z.match(FFe)||[]}var x4e=function Z(ue){ue=ue==null?En:Gu.defaults(En.Object(),ue,Gu.pick(En,BFe));var ie=ue.Array,Te=ue.Date,tt=ue.Error,Dt=ue.Function,fn=ue.Math,nr=ue.Object,TA=ue.RegExp,y4e=ue.String,Is=ue.TypeError,Iy=ie.prototype,_4e=Dt.prototype,Ep=nr.prototype,Ry=ue["__core-js_shared__"],Ny=_4e.toString,Ht=Ep.hasOwnProperty,b4e=0,qU=function(){var l=/[^.]+$/.exec(Ry&&Ry.keys&&Ry.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),ky=Ep.toString,w4e=Ny.call(nr),E4e=En._,S4e=TA("^"+Ny.call(Ht).replace(cl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qy=gU?ue.Buffer:e,Vu=ue.Symbol,Py=ue.Uint8Array,PU=qy?qy.allocUnsafe:e,Dy=NU(nr.getPrototypeOf,nr),DU=nr.create,LU=Ep.propertyIsEnumerable,Ly=Iy.splice,FU=Vu?Vu.isConcatSpreadable:e,Pm=Vu?Vu.iterator:e,pl=Vu?Vu.toStringTag:e,Fy=function(){try{var l=vl(nr,"defineProperty");return l({},"",{}),l}catch{}}(),T4e=ue.clearTimeout!==En.clearTimeout&&ue.clearTimeout,C4e=Te&&Te.now!==En.Date.now&&Te.now,A4e=ue.setTimeout!==En.setTimeout&&ue.setTimeout,My=fn.ceil,jy=fn.floor,CA=nr.getOwnPropertySymbols,O4e=qy?qy.isBuffer:e,MU=ue.isFinite,I4e=Iy.join,R4e=NU(nr.keys,nr),pn=fn.max,ri=fn.min,N4e=Te.now,k4e=ue.parseInt,jU=fn.random,q4e=Iy.reverse,AA=vl(ue,"DataView"),Dm=vl(ue,"Map"),OA=vl(ue,"Promise"),Sp=vl(ue,"Set"),Lm=vl(ue,"WeakMap"),Fm=vl(nr,"create"),By=Lm&&new Lm,Tp={},P4e=xl(AA),D4e=xl(Dm),L4e=xl(OA),F4e=xl(Sp),M4e=xl(Lm),Uy=Vu?Vu.prototype:e,Mm=Uy?Uy.valueOf:e,BU=Uy?Uy.toString:e;function P(l){if(Lr(l)&&!ut(l)&&!(l instanceof _t)){if(l instanceof Rs)return l;if(Ht.call(l,"__wrapped__"))return U5(l)}return new Rs(l)}var Cp=function(){function l(){}return function(h){if(!Rr(h))return{};if(DU)return DU(h);l.prototype=h;var x=new l;return l.prototype=e,x}}();function $y(){}function Rs(l,h){this.__wrapped__=l,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=e}P.templateSettings={escape:Im,evaluate:Qi,interpolate:Rm,variable:"",imports:{_:P}},P.prototype=$y.prototype,P.prototype.constructor=P,Rs.prototype=Cp($y.prototype),Rs.prototype.constructor=Rs;function _t(l){this.__wrapped__=l,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=re,this.__views__=[]}function j4e(){var l=new _t(this.__wrapped__);return l.__actions__=ki(this.__actions__),l.__dir__=this.__dir__,l.__filtered__=this.__filtered__,l.__iteratees__=ki(this.__iteratees__),l.__takeCount__=this.__takeCount__,l.__views__=ki(this.__views__),l}function B4e(){if(this.__filtered__){var l=new _t(this);l.__dir__=-1,l.__filtered__=!0}else l=this.clone(),l.__dir__*=-1;return l}function U4e(){var l=this.__wrapped__.value(),h=this.__dir__,x=ut(l),T=h<0,O=x?l.length:0,M=QMe(0,O,this.__views__),H=M.start,V=M.end,J=V-H,ce=T?V:H-1,fe=this.__iteratees__,de=fe.length,we=0,Le=ri(J,this.__takeCount__);if(!x||!T&&O==J&&Le==J)return l5(l,this.__actions__);var Ve=[];e:for(;J--&&we<Le;){ce+=h;for(var pt=-1,Ke=l[ce];++pt<de;){var gt=fe[pt],Ct=gt.iteratee,is=gt.type,xi=Ct(Ke);if(is==z)Ke=xi;else if(!xi){if(is==R)continue e;break e}}Ve[we++]=Ke}return Ve}_t.prototype=Cp($y.prototype),_t.prototype.constructor=_t;function dl(l){var h=-1,x=l==null?0:l.length;for(this.clear();++h<x;){var T=l[h];this.set(T[0],T[1])}}function $4e(){this.__data__=Fm?Fm(null):{},this.size=0}function H4e(l){var h=this.has(l)&&delete this.__data__[l];return this.size-=h?1:0,h}function W4e(l){var h=this.__data__;if(Fm){var x=h[l];return x===o?e:x}return Ht.call(h,l)?h[l]:e}function z4e(l){var h=this.__data__;return Fm?h[l]!==e:Ht.call(h,l)}function G4e(l,h){var x=this.__data__;return this.size+=this.has(l)?0:1,x[l]=Fm&&h===e?o:h,this}dl.prototype.clear=$4e,dl.prototype.delete=H4e,dl.prototype.get=W4e,dl.prototype.has=z4e,dl.prototype.set=G4e;function ka(l){var h=-1,x=l==null?0:l.length;for(this.clear();++h<x;){var T=l[h];this.set(T[0],T[1])}}function V4e(){this.__data__=[],this.size=0}function K4e(l){var h=this.__data__,x=Hy(h,l);if(x<0)return!1;var T=h.length-1;return x==T?h.pop():Ly.call(h,x,1),--this.size,!0}function X4e(l){var h=this.__data__,x=Hy(h,l);return x<0?e:h[x][1]}function Y4e(l){return Hy(this.__data__,l)>-1}function Z4e(l,h){var x=this.__data__,T=Hy(x,l);return T<0?(++this.size,x.push([l,h])):x[T][1]=h,this}ka.prototype.clear=V4e,ka.prototype.delete=K4e,ka.prototype.get=X4e,ka.prototype.has=Y4e,ka.prototype.set=Z4e;function qa(l){var h=-1,x=l==null?0:l.length;for(this.clear();++h<x;){var T=l[h];this.set(T[0],T[1])}}function J4e(){this.size=0,this.__data__={hash:new dl,map:new(Dm||ka),string:new dl}}function Q4e(l){var h=t_(this,l).delete(l);return this.size-=h?1:0,h}function eMe(l){return t_(this,l).get(l)}function tMe(l){return t_(this,l).has(l)}function rMe(l,h){var x=t_(this,l),T=x.size;return x.set(l,h),this.size+=x.size==T?0:1,this}qa.prototype.clear=J4e,qa.prototype.delete=Q4e,qa.prototype.get=eMe,qa.prototype.has=tMe,qa.prototype.set=rMe;function hl(l){var h=-1,x=l==null?0:l.length;for(this.__data__=new qa;++h<x;)this.add(l[h])}function nMe(l){return this.__data__.set(l,o),this}function iMe(l){return this.__data__.has(l)}hl.prototype.add=hl.prototype.push=nMe,hl.prototype.has=iMe;function co(l){var h=this.__data__=new ka(l);this.size=h.size}function sMe(){this.__data__=new ka,this.size=0}function oMe(l){var h=this.__data__,x=h.delete(l);return this.size=h.size,x}function aMe(l){return this.__data__.get(l)}function uMe(l){return this.__data__.has(l)}function cMe(l,h){var x=this.__data__;if(x instanceof ka){var T=x.__data__;if(!Dm||T.length<r-1)return T.push([l,h]),this.size=++x.size,this;x=this.__data__=new qa(T)}return x.set(l,h),this.size=x.size,this}co.prototype.clear=sMe,co.prototype.delete=oMe,co.prototype.get=aMe,co.prototype.has=uMe,co.prototype.set=cMe;function UU(l,h){var x=ut(l),T=!x&&yl(l),O=!x&&!T&&Ju(l),M=!x&&!T&&!O&&Rp(l),H=x||T||O||M,V=H?wA(l.length,y4e):[],J=V.length;for(var ce in l)(h||Ht.call(l,ce))&&!(H&&(ce=="length"||O&&(ce=="offset"||ce=="parent")||M&&(ce=="buffer"||ce=="byteLength"||ce=="byteOffset")||Fa(ce,J)))&&V.push(ce);return V}function $U(l){var h=l.length;return h?l[jA(0,h-1)]:e}function lMe(l,h){return r_(ki(l),ml(h,0,l.length))}function fMe(l){return r_(ki(l))}function IA(l,h,x){(x!==e&&!lo(l[h],x)||x===e&&!(h in l))&&Pa(l,h,x)}function jm(l,h,x){var T=l[h];(!(Ht.call(l,h)&&lo(T,x))||x===e&&!(h in l))&&Pa(l,h,x)}function Hy(l,h){for(var x=l.length;x--;)if(lo(l[x][0],h))return x;return-1}function pMe(l,h,x,T){return Ku(l,function(O,M,H){h(T,O,x(O),H)}),T}function HU(l,h){return l&&jo(h,Sn(h),l)}function dMe(l,h){return l&&jo(h,Pi(h),l)}function Pa(l,h,x){h=="__proto__"&&Fy?Fy(l,h,{configurable:!0,enumerable:!0,value:x,writable:!0}):l[h]=x}function RA(l,h){for(var x=-1,T=h.length,O=ie(T),M=l==null;++x<T;)O[x]=M?e:lO(l,h[x]);return O}function ml(l,h,x){return l===l&&(x!==e&&(l=l<=x?l:x),h!==e&&(l=l>=h?l:h)),l}function Ns(l,h,x,T,O,M){var H,V=h&c,J=h&f,ce=h&p;if(x&&(H=O?x(l,T,O,M):x(l)),H!==e)return H;if(!Rr(l))return l;var fe=ut(l);if(fe){if(H=t3e(l),!V)return ki(l,H)}else{var de=ni(l),we=de==F||de==A;if(Ju(l))return d5(l,V);if(de==He||de==Qe||we&&!O){if(H=J||we?{}:k5(l),!V)return J?WMe(l,dMe(H,l)):HMe(l,HU(H,l))}else{if(!lr[de])return O?l:{};H=r3e(l,de,V)}}M||(M=new co);var Le=M.get(l);if(Le)return Le;M.set(l,H),a8(l)?l.forEach(function(Ke){H.add(Ns(Ke,h,x,Ke,l,M))}):s8(l)&&l.forEach(function(Ke,gt){H.set(gt,Ns(Ke,h,x,gt,l,M))});var Ve=ce?J?YA:XA:J?Pi:Sn,pt=fe?e:Ve(l);return Os(pt||l,function(Ke,gt){pt&&(gt=Ke,Ke=l[gt]),jm(H,gt,Ns(Ke,h,x,gt,l,M))}),H}function hMe(l){var h=Sn(l);return function(x){return WU(x,l,h)}}function WU(l,h,x){var T=x.length;if(l==null)return!T;for(l=nr(l);T--;){var O=x[T],M=h[O],H=l[O];if(H===e&&!(O in l)||!M(H))return!1}return!0}function zU(l,h,x){if(typeof l!="function")throw new Is(i);return Gm(function(){l.apply(e,x)},h)}function Bm(l,h,x,T){var O=-1,M=Cy,H=!0,V=l.length,J=[],ce=h.length;if(!V)return J;x&&(h=yr(h,ts(x))),T?(M=gA,H=!1):h.length>=r&&(M=qm,H=!1,h=new hl(h));e:for(;++O<V;){var fe=l[O],de=x==null?fe:x(fe);if(fe=T||fe!==0?fe:0,H&&de===de){for(var we=ce;we--;)if(h[we]===de)continue e;J.push(fe)}else M(h,de,T)||J.push(fe)}return J}var Ku=x5(Mo),GU=x5(kA,!0);function mMe(l,h){var x=!0;return Ku(l,function(T,O,M){return x=!!h(T,O,M),x}),x}function Wy(l,h,x){for(var T=-1,O=l.length;++T<O;){var M=l[T],H=h(M);if(H!=null&&(V===e?H===H&&!ns(H):x(H,V)))var V=H,J=M}return J}function gMe(l,h,x,T){var O=l.length;for(x=ft(x),x<0&&(x=-x>O?0:O+x),T=T===e||T>O?O:ft(T),T<0&&(T+=O),T=x>T?0:c8(T);x<T;)l[x++]=h;return l}function VU(l,h){var x=[];return Ku(l,function(T,O,M){h(T,O,M)&&x.push(T)}),x}function Pn(l,h,x,T,O){var M=-1,H=l.length;for(x||(x=i3e),O||(O=[]);++M<H;){var V=l[M];h>0&&x(V)?h>1?Pn(V,h-1,x,T,O):Wu(O,V):T||(O[O.length]=V)}return O}var NA=y5(),KU=y5(!0);function Mo(l,h){return l&&NA(l,h,Sn)}function kA(l,h){return l&&KU(l,h,Sn)}function zy(l,h){return Hu(h,function(x){return Ma(l[x])})}function gl(l,h){h=Yu(h,l);for(var x=0,T=h.length;l!=null&&x<T;)l=l[Bo(h[x++])];return x&&x==T?l:e}function XU(l,h,x){var T=h(l);return ut(l)?T:Wu(T,x(l))}function gi(l){return l==null?l===e?gp:Xe:pl&&pl in nr(l)?JMe(l):f3e(l)}function qA(l,h){return l>h}function vMe(l,h){return l!=null&&Ht.call(l,h)}function xMe(l,h){return l!=null&&h in nr(l)}function yMe(l,h,x){return l>=ri(h,x)&&l<pn(h,x)}function PA(l,h,x){for(var T=x?gA:Cy,O=l[0].length,M=l.length,H=M,V=ie(M),J=1/0,ce=[];H--;){var fe=l[H];H&&h&&(fe=yr(fe,ts(h))),J=ri(fe.length,J),V[H]=!x&&(h||O>=120&&fe.length>=120)?new hl(H&&fe):e}fe=l[0];var de=-1,we=V[0];e:for(;++de<O&&ce.length<J;){var Le=fe[de],Ve=h?h(Le):Le;if(Le=x||Le!==0?Le:0,!(we?qm(we,Ve):T(ce,Ve,x))){for(H=M;--H;){var pt=V[H];if(!(pt?qm(pt,Ve):T(l[H],Ve,x)))continue e}we&&we.push(Ve),ce.push(Le)}}return ce}function _Me(l,h,x,T){return Mo(l,function(O,M,H){h(T,x(O),M,H)}),T}function Um(l,h,x){h=Yu(h,l),l=L5(l,h);var T=l==null?l:l[Bo(qs(h))];return T==null?e:es(T,l,x)}function YU(l){return Lr(l)&&gi(l)==Qe}function bMe(l){return Lr(l)&&gi(l)==Fo}function wMe(l){return Lr(l)&&gi(l)==$t}function $m(l,h,x,T,O){return l===h?!0:l==null||h==null||!Lr(l)&&!Lr(h)?l!==l&&h!==h:EMe(l,h,x,T,$m,O)}function EMe(l,h,x,T,O,M){var H=ut(l),V=ut(h),J=H?$e:ni(l),ce=V?$e:ni(h);J=J==Qe?He:J,ce=ce==Qe?He:ce;var fe=J==He,de=ce==He,we=J==ce;if(we&&Ju(l)){if(!Ju(h))return!1;H=!0,fe=!1}if(we&&!fe)return M||(M=new co),H||Rp(l)?I5(l,h,x,T,O,M):YMe(l,h,J,x,T,O,M);if(!(x&d)){var Le=fe&&Ht.call(l,"__wrapped__"),Ve=de&&Ht.call(h,"__wrapped__");if(Le||Ve){var pt=Le?l.value():l,Ke=Ve?h.value():h;return M||(M=new co),O(pt,Ke,x,T,M)}}return we?(M||(M=new co),ZMe(l,h,x,T,O,M)):!1}function SMe(l){return Lr(l)&&ni(l)==te}function DA(l,h,x,T){var O=x.length,M=O,H=!T;if(l==null)return!M;for(l=nr(l);O--;){var V=x[O];if(H&&V[2]?V[1]!==l[V[0]]:!(V[0]in l))return!1}for(;++O<M;){V=x[O];var J=V[0],ce=l[J],fe=V[1];if(H&&V[2]){if(ce===e&&!(J in l))return!1}else{var de=new co;if(T)var we=T(ce,fe,J,l,h,de);if(!(we===e?$m(fe,ce,d|m,T,de):we))return!1}}return!0}function ZU(l){if(!Rr(l)||o3e(l))return!1;var h=Ma(l)?S4e:hFe;return h.test(xl(l))}function TMe(l){return Lr(l)&&gi(l)==en}function CMe(l){return Lr(l)&&ni(l)==ke}function AMe(l){return Lr(l)&&u_(l.length)&&!!dr[gi(l)]}function JU(l){return typeof l=="function"?l:l==null?Di:typeof l=="object"?ut(l)?t5(l[0],l[1]):e5(l):_8(l)}function LA(l){if(!zm(l))return R4e(l);var h=[];for(var x in nr(l))Ht.call(l,x)&&x!="constructor"&&h.push(x);return h}function OMe(l){if(!Rr(l))return l3e(l);var h=zm(l),x=[];for(var T in l)T=="constructor"&&(h||!Ht.call(l,T))||x.push(T);return x}function FA(l,h){return l<h}function QU(l,h){var x=-1,T=qi(l)?ie(l.length):[];return Ku(l,function(O,M,H){T[++x]=h(O,M,H)}),T}function e5(l){var h=JA(l);return h.length==1&&h[0][2]?P5(h[0][0],h[0][1]):function(x){return x===l||DA(x,l,h)}}function t5(l,h){return eO(l)&&q5(h)?P5(Bo(l),h):function(x){var T=lO(x,l);return T===e&&T===h?fO(x,l):$m(h,T,d|m)}}function Gy(l,h,x,T,O){l!==h&&NA(h,function(M,H){if(O||(O=new co),Rr(M))IMe(l,h,H,x,Gy,T,O);else{var V=T?T(rO(l,H),M,H+"",l,h,O):e;V===e&&(V=M),IA(l,H,V)}},Pi)}function IMe(l,h,x,T,O,M,H){var V=rO(l,x),J=rO(h,x),ce=H.get(J);if(ce){IA(l,x,ce);return}var fe=M?M(V,J,x+"",l,h,H):e,de=fe===e;if(de){var we=ut(J),Le=!we&&Ju(J),Ve=!we&&!Le&&Rp(J);fe=J,we||Le||Ve?ut(V)?fe=V:zr(V)?fe=ki(V):Le?(de=!1,fe=d5(J,!0)):Ve?(de=!1,fe=h5(J,!0)):fe=[]:Vm(J)||yl(J)?(fe=V,yl(V)?fe=l8(V):(!Rr(V)||Ma(V))&&(fe=k5(J))):de=!1}de&&(H.set(J,fe),O(fe,J,T,M,H),H.delete(J)),IA(l,x,fe)}function r5(l,h){var x=l.length;if(x)return h+=h<0?x:0,Fa(h,x)?l[h]:e}function n5(l,h,x){h.length?h=yr(h,function(M){return ut(M)?function(H){return gl(H,M.length===1?M[0]:M)}:M}):h=[Di];var T=-1;h=yr(h,ts(We()));var O=QU(l,function(M,H,V){var J=yr(h,function(ce){return ce(M)});return{criteria:J,index:++T,value:M}});return r4e(O,function(M,H){return $Me(M,H,x)})}function RMe(l,h){return i5(l,h,function(x,T){return fO(l,T)})}function i5(l,h,x){for(var T=-1,O=h.length,M={};++T<O;){var H=h[T],V=gl(l,H);x(V,H)&&Hm(M,Yu(H,l),V)}return M}function NMe(l){return function(h){return gl(h,l)}}function MA(l,h,x,T){var O=T?t4e:_p,M=-1,H=h.length,V=l;for(l===h&&(h=ki(h)),x&&(V=yr(l,ts(x)));++M<H;)for(var J=0,ce=h[M],fe=x?x(ce):ce;(J=O(V,fe,J,T))>-1;)V!==l&&Ly.call(V,J,1),Ly.call(l,J,1);return l}function s5(l,h){for(var x=l?h.length:0,T=x-1;x--;){var O=h[x];if(x==T||O!==M){var M=O;Fa(O)?Ly.call(l,O,1):$A(l,O)}}return l}function jA(l,h){return l+jy(jU()*(h-l+1))}function kMe(l,h,x,T){for(var O=-1,M=pn(My((h-l)/(x||1)),0),H=ie(M);M--;)H[T?M:++O]=l,l+=x;return H}function BA(l,h){var x="";if(!l||h<1||h>U)return x;do h%2&&(x+=l),h=jy(h/2),h&&(l+=l);while(h);return x}function dt(l,h){return nO(D5(l,h,Di),l+"")}function qMe(l){return $U(Np(l))}function PMe(l,h){var x=Np(l);return r_(x,ml(h,0,x.length))}function Hm(l,h,x,T){if(!Rr(l))return l;h=Yu(h,l);for(var O=-1,M=h.length,H=M-1,V=l;V!=null&&++O<M;){var J=Bo(h[O]),ce=x;if(J==="__proto__"||J==="constructor"||J==="prototype")return l;if(O!=H){var fe=V[J];ce=T?T(fe,J,V):e,ce===e&&(ce=Rr(fe)?fe:Fa(h[O+1])?[]:{})}jm(V,J,ce),V=V[J]}return l}var o5=By?function(l,h){return By.set(l,h),l}:Di,DMe=Fy?function(l,h){return Fy(l,"toString",{configurable:!0,enumerable:!1,value:dO(h),writable:!0})}:Di;function LMe(l){return r_(Np(l))}function ks(l,h,x){var T=-1,O=l.length;h<0&&(h=-h>O?0:O+h),x=x>O?O:x,x<0&&(x+=O),O=h>x?0:x-h>>>0,h>>>=0;for(var M=ie(O);++T<O;)M[T]=l[T+h];return M}function FMe(l,h){var x;return Ku(l,function(T,O,M){return x=h(T,O,M),!x}),!!x}function Vy(l,h,x){var T=0,O=l==null?T:l.length;if(typeof h=="number"&&h===h&&O<=he){for(;T<O;){var M=T+O>>>1,H=l[M];H!==null&&!ns(H)&&(x?H<=h:H<h)?T=M+1:O=M}return O}return UA(l,h,Di,x)}function UA(l,h,x,T){var O=0,M=l==null?0:l.length;if(M===0)return 0;h=x(h);for(var H=h!==h,V=h===null,J=ns(h),ce=h===e;O<M;){var fe=jy((O+M)/2),de=x(l[fe]),we=de!==e,Le=de===null,Ve=de===de,pt=ns(de);if(H)var Ke=T||Ve;else ce?Ke=Ve&&(T||we):V?Ke=Ve&&we&&(T||!Le):J?Ke=Ve&&we&&!Le&&(T||!pt):Le||pt?Ke=!1:Ke=T?de<=h:de<h;Ke?O=fe+1:M=fe}return ri(M,oe)}function a5(l,h){for(var x=-1,T=l.length,O=0,M=[];++x<T;){var H=l[x],V=h?h(H):H;if(!x||!lo(V,J)){var J=V;M[O++]=H===0?0:H}}return M}function u5(l){return typeof l=="number"?l:ns(l)?G:+l}function rs(l){if(typeof l=="string")return l;if(ut(l))return yr(l,rs)+"";if(ns(l))return BU?BU.call(l):"";var h=l+"";return h=="0"&&1/l==-B?"-0":h}function Xu(l,h,x){var T=-1,O=Cy,M=l.length,H=!0,V=[],J=V;if(x)H=!1,O=gA;else if(M>=r){var ce=h?null:KMe(l);if(ce)return Oy(ce);H=!1,O=qm,J=new hl}else J=h?[]:V;e:for(;++T<M;){var fe=l[T],de=h?h(fe):fe;if(fe=x||fe!==0?fe:0,H&&de===de){for(var we=J.length;we--;)if(J[we]===de)continue e;h&&J.push(de),V.push(fe)}else O(J,de,x)||(J!==V&&J.push(de),V.push(fe))}return V}function $A(l,h){return h=Yu(h,l),l=L5(l,h),l==null||delete l[Bo(qs(h))]}function c5(l,h,x,T){return Hm(l,h,x(gl(l,h)),T)}function Ky(l,h,x,T){for(var O=l.length,M=T?O:-1;(T?M--:++M<O)&&h(l[M],M,l););return x?ks(l,T?0:M,T?M+1:O):ks(l,T?M+1:0,T?O:M)}function l5(l,h){var x=l;return x instanceof _t&&(x=x.value()),vA(h,function(T,O){return O.func.apply(O.thisArg,Wu([T],O.args))},x)}function HA(l,h,x){var T=l.length;if(T<2)return T?Xu(l[0]):[];for(var O=-1,M=ie(T);++O<T;)for(var H=l[O],V=-1;++V<T;)V!=O&&(M[O]=Bm(M[O]||H,l[V],h,x));return Xu(Pn(M,1),h,x)}function f5(l,h,x){for(var T=-1,O=l.length,M=h.length,H={};++T<O;){var V=T<M?h[T]:e;x(H,l[T],V)}return H}function WA(l){return zr(l)?l:[]}function zA(l){return typeof l=="function"?l:Di}function Yu(l,h){return ut(l)?l:eO(l,h)?[l]:B5(jt(l))}var MMe=dt;function Zu(l,h,x){var T=l.length;return x=x===e?T:x,!h&&x>=T?l:ks(l,h,x)}var p5=T4e||function(l){return En.clearTimeout(l)};function d5(l,h){if(h)return l.slice();var x=l.length,T=PU?PU(x):new l.constructor(x);return l.copy(T),T}function GA(l){var h=new l.constructor(l.byteLength);return new Py(h).set(new Py(l)),h}function jMe(l,h){var x=h?GA(l.buffer):l.buffer;return new l.constructor(x,l.byteOffset,l.byteLength)}function BMe(l){var h=new l.constructor(l.source,YB.exec(l));return h.lastIndex=l.lastIndex,h}function UMe(l){return Mm?nr(Mm.call(l)):{}}function h5(l,h){var x=h?GA(l.buffer):l.buffer;return new l.constructor(x,l.byteOffset,l.length)}function m5(l,h){if(l!==h){var x=l!==e,T=l===null,O=l===l,M=ns(l),H=h!==e,V=h===null,J=h===h,ce=ns(h);if(!V&&!ce&&!M&&l>h||M&&H&&J&&!V&&!ce||T&&H&&J||!x&&J||!O)return 1;if(!T&&!M&&!ce&&l<h||ce&&x&&O&&!T&&!M||V&&x&&O||!H&&O||!J)return-1}return 0}function $Me(l,h,x){for(var T=-1,O=l.criteria,M=h.criteria,H=O.length,V=x.length;++T<H;){var J=m5(O[T],M[T]);if(J){if(T>=V)return J;var ce=x[T];return J*(ce=="desc"?-1:1)}}return l.index-h.index}function g5(l,h,x,T){for(var O=-1,M=l.length,H=x.length,V=-1,J=h.length,ce=pn(M-H,0),fe=ie(J+ce),de=!T;++V<J;)fe[V]=h[V];for(;++O<H;)(de||O<M)&&(fe[x[O]]=l[O]);for(;ce--;)fe[V++]=l[O++];return fe}function v5(l,h,x,T){for(var O=-1,M=l.length,H=-1,V=x.length,J=-1,ce=h.length,fe=pn(M-V,0),de=ie(fe+ce),we=!T;++O<fe;)de[O]=l[O];for(var Le=O;++J<ce;)de[Le+J]=h[J];for(;++H<V;)(we||O<M)&&(de[Le+x[H]]=l[O++]);return de}function ki(l,h){var x=-1,T=l.length;for(h||(h=ie(T));++x<T;)h[x]=l[x];return h}function jo(l,h,x,T){var O=!x;x||(x={});for(var M=-1,H=h.length;++M<H;){var V=h[M],J=T?T(x[V],l[V],V,x,l):e;J===e&&(J=l[V]),O?Pa(x,V,J):jm(x,V,J)}return x}function HMe(l,h){return jo(l,QA(l),h)}function WMe(l,h){return jo(l,R5(l),h)}function Xy(l,h){return function(x,T){var O=ut(x)?XFe:pMe,M=h?h():{};return O(x,l,We(T,2),M)}}function Ap(l){return dt(function(h,x){var T=-1,O=x.length,M=O>1?x[O-1]:e,H=O>2?x[2]:e;for(M=l.length>3&&typeof M=="function"?(O--,M):e,H&&vi(x[0],x[1],H)&&(M=O<3?e:M,O=1),h=nr(h);++T<O;){var V=x[T];V&&l(h,V,T,M)}return h})}function x5(l,h){return function(x,T){if(x==null)return x;if(!qi(x))return l(x,T);for(var O=x.length,M=h?O:-1,H=nr(x);(h?M--:++M<O)&&T(H[M],M,H)!==!1;);return x}}function y5(l){return function(h,x,T){for(var O=-1,M=nr(h),H=T(h),V=H.length;V--;){var J=H[l?V:++O];if(x(M[J],J,M)===!1)break}return h}}function zMe(l,h,x){var T=h&v,O=Wm(l);function M(){var H=this&&this!==En&&this instanceof M?O:l;return H.apply(T?x:this,arguments)}return M}function _5(l){return function(h){h=jt(h);var x=bp(h)?uo(h):e,T=x?x[0]:h.charAt(0),O=x?Zu(x,1).join(""):h.slice(1);return T[l]()+O}}function Op(l){return function(h){return vA(x8(v8(h).replace(DFe,"")),l,"")}}function Wm(l){return function(){var h=arguments;switch(h.length){case 0:return new l;case 1:return new l(h[0]);case 2:return new l(h[0],h[1]);case 3:return new l(h[0],h[1],h[2]);case 4:return new l(h[0],h[1],h[2],h[3]);case 5:return new l(h[0],h[1],h[2],h[3],h[4]);case 6:return new l(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new l(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var x=Cp(l.prototype),T=l.apply(x,h);return Rr(T)?T:x}}function GMe(l,h,x){var T=Wm(l);function O(){for(var M=arguments.length,H=ie(M),V=M,J=Ip(O);V--;)H[V]=arguments[V];var ce=M<3&&H[0]!==J&&H[M-1]!==J?[]:zu(H,J);if(M-=ce.length,M<x)return T5(l,h,Yy,O.placeholder,e,H,ce,e,e,x-M);var fe=this&&this!==En&&this instanceof O?T:l;return es(fe,this,H)}return O}function b5(l){return function(h,x,T){var O=nr(h);if(!qi(h)){var M=We(x,3);h=Sn(h),x=function(V){return M(O[V],V,O)}}var H=l(h,x,T);return H>-1?O[M?h[H]:H]:e}}function w5(l){return La(function(h){var x=h.length,T=x,O=Rs.prototype.thru;for(l&&h.reverse();T--;){var M=h[T];if(typeof M!="function")throw new Is(i);if(O&&!H&&e_(M)=="wrapper")var H=new Rs([],!0)}for(T=H?T:x;++T<x;){M=h[T];var V=e_(M),J=V=="wrapper"?ZA(M):e;J&&tO(J[0])&&J[1]==(C|_|S|I)&&!J[4].length&&J[9]==1?H=H[e_(J[0])].apply(H,J[3]):H=M.length==1&&tO(M)?H[V]():H.thru(M)}return function(){var ce=arguments,fe=ce[0];if(H&&ce.length==1&&ut(fe))return H.plant(fe).value();for(var de=0,we=x?h[de].apply(this,ce):fe;++de<x;)we=h[de].call(this,we);return we}})}function Yy(l,h,x,T,O,M,H,V,J,ce){var fe=h&C,de=h&v,we=h&y,Le=h&(_|E),Ve=h&j,pt=we?e:Wm(l);function Ke(){for(var gt=arguments.length,Ct=ie(gt),is=gt;is--;)Ct[is]=arguments[is];if(Le)var xi=Ip(Ke),ss=i4e(Ct,xi);if(T&&(Ct=g5(Ct,T,O,Le)),M&&(Ct=v5(Ct,M,H,Le)),gt-=ss,Le&&gt<ce){var Gr=zu(Ct,xi);return T5(l,h,Yy,Ke.placeholder,x,Ct,Gr,V,J,ce-gt)}var fo=de?x:this,Ba=we?fo[l]:l;return gt=Ct.length,V?Ct=p3e(Ct,V):Ve&&gt>1&&Ct.reverse(),fe&&J<gt&&(Ct.length=J),this&&this!==En&&this instanceof Ke&&(Ba=pt||Wm(Ba)),Ba.apply(fo,Ct)}return Ke}function E5(l,h){return function(x,T){return _Me(x,l,h(T),{})}}function Zy(l,h){return function(x,T){var O;if(x===e&&T===e)return h;if(x!==e&&(O=x),T!==e){if(O===e)return T;typeof x=="string"||typeof T=="string"?(x=rs(x),T=rs(T)):(x=u5(x),T=u5(T)),O=l(x,T)}return O}}function VA(l){return La(function(h){return h=yr(h,ts(We())),dt(function(x){var T=this;return l(h,function(O){return es(O,T,x)})})})}function Jy(l,h){h=h===e?" ":rs(h);var x=h.length;if(x<2)return x?BA(h,l):h;var T=BA(h,My(l/wp(h)));return bp(h)?Zu(uo(T),0,l).join(""):T.slice(0,l)}function VMe(l,h,x,T){var O=h&v,M=Wm(l);function H(){for(var V=-1,J=arguments.length,ce=-1,fe=T.length,de=ie(fe+J),we=this&&this!==En&&this instanceof H?M:l;++ce<fe;)de[ce]=T[ce];for(;J--;)de[ce++]=arguments[++V];return es(we,O?x:this,de)}return H}function S5(l){return function(h,x,T){return T&&typeof T!="number"&&vi(h,x,T)&&(x=T=e),h=ja(h),x===e?(x=h,h=0):x=ja(x),T=T===e?h<x?1:-1:ja(T),kMe(h,x,T,l)}}function Qy(l){return function(h,x){return typeof h=="string"&&typeof x=="string"||(h=Ps(h),x=Ps(x)),l(h,x)}}function T5(l,h,x,T,O,M,H,V,J,ce){var fe=h&_,de=fe?H:e,we=fe?e:H,Le=fe?M:e,Ve=fe?e:M;h|=fe?S:w,h&=~(fe?w:S),h&b||(h&=~(v|y));var pt=[l,h,O,Le,de,Ve,we,V,J,ce],Ke=x.apply(e,pt);return tO(l)&&F5(Ke,pt),Ke.placeholder=T,M5(Ke,l,h)}function KA(l){var h=fn[l];return function(x,T){if(x=Ps(x),T=T==null?0:ri(ft(T),292),T&&MU(x)){var O=(jt(x)+"e").split("e"),M=h(O[0]+"e"+(+O[1]+T));return O=(jt(M)+"e").split("e"),+(O[0]+"e"+(+O[1]-T))}return h(x)}}var KMe=Sp&&1/Oy(new Sp([,-0]))[1]==B?function(l){return new Sp(l)}:gO;function C5(l){return function(h){var x=ni(h);return x==te?SA(h):x==ke?f4e(h):n4e(h,l(h))}}function Da(l,h,x,T,O,M,H,V){var J=h&y;if(!J&&typeof l!="function")throw new Is(i);var ce=T?T.length:0;if(ce||(h&=~(S|w),T=O=e),H=H===e?H:pn(ft(H),0),V=V===e?V:ft(V),ce-=O?O.length:0,h&w){var fe=T,de=O;T=O=e}var we=J?e:ZA(l),Le=[l,h,x,T,O,fe,de,M,H,V];if(we&&c3e(Le,we),l=Le[0],h=Le[1],x=Le[2],T=Le[3],O=Le[4],V=Le[9]=Le[9]===e?J?0:l.length:pn(Le[9]-ce,0),!V&&h&(_|E)&&(h&=~(_|E)),!h||h==v)var Ve=zMe(l,h,x);else h==_||h==E?Ve=GMe(l,h,V):(h==S||h==(v|S))&&!O.length?Ve=VMe(l,h,x,T):Ve=Yy.apply(e,Le);var pt=we?o5:F5;return M5(pt(Ve,Le),l,h)}function A5(l,h,x,T){return l===e||lo(l,Ep[x])&&!Ht.call(T,x)?h:l}function O5(l,h,x,T,O,M){return Rr(l)&&Rr(h)&&(M.set(h,l),Gy(l,h,e,O5,M),M.delete(h)),l}function XMe(l){return Vm(l)?e:l}function I5(l,h,x,T,O,M){var H=x&d,V=l.length,J=h.length;if(V!=J&&!(H&&J>V))return!1;var ce=M.get(l),fe=M.get(h);if(ce&&fe)return ce==h&&fe==l;var de=-1,we=!0,Le=x&m?new hl:e;for(M.set(l,h),M.set(h,l);++de<V;){var Ve=l[de],pt=h[de];if(T)var Ke=H?T(pt,Ve,de,h,l,M):T(Ve,pt,de,l,h,M);if(Ke!==e){if(Ke)continue;we=!1;break}if(Le){if(!xA(h,function(gt,Ct){if(!qm(Le,Ct)&&(Ve===gt||O(Ve,gt,x,T,M)))return Le.push(Ct)})){we=!1;break}}else if(!(Ve===pt||O(Ve,pt,x,T,M))){we=!1;break}}return M.delete(l),M.delete(h),we}function YMe(l,h,x,T,O,M,H){switch(x){case L:if(l.byteLength!=h.byteLength||l.byteOffset!=h.byteOffset)return!1;l=l.buffer,h=h.buffer;case Fo:return!(l.byteLength!=h.byteLength||!M(new Py(l),new Py(h)));case Ae:case $t:case Y:return lo(+l,+h);case ye:return l.name==h.name&&l.message==h.message;case en:case rr:return l==h+"";case te:var V=SA;case ke:var J=T&d;if(V||(V=Oy),l.size!=h.size&&!J)return!1;var ce=H.get(l);if(ce)return ce==h;T|=m,H.set(l,h);var fe=I5(V(l),V(h),T,O,M,H);return H.delete(l),fe;case qn:if(Mm)return Mm.call(l)==Mm.call(h)}return!1}function ZMe(l,h,x,T,O,M){var H=x&d,V=XA(l),J=V.length,ce=XA(h),fe=ce.length;if(J!=fe&&!H)return!1;for(var de=J;de--;){var we=V[de];if(!(H?we in h:Ht.call(h,we)))return!1}var Le=M.get(l),Ve=M.get(h);if(Le&&Ve)return Le==h&&Ve==l;var pt=!0;M.set(l,h),M.set(h,l);for(var Ke=H;++de<J;){we=V[de];var gt=l[we],Ct=h[we];if(T)var is=H?T(Ct,gt,we,h,l,M):T(gt,Ct,we,l,h,M);if(!(is===e?gt===Ct||O(gt,Ct,x,T,M):is)){pt=!1;break}Ke||(Ke=we=="constructor")}if(pt&&!Ke){var xi=l.constructor,ss=h.constructor;xi!=ss&&"constructor"in l&&"constructor"in h&&!(typeof xi=="function"&&xi instanceof xi&&typeof ss=="function"&&ss instanceof ss)&&(pt=!1)}return M.delete(l),M.delete(h),pt}function La(l){return nO(D5(l,e,W5),l+"")}function XA(l){return XU(l,Sn,QA)}function YA(l){return XU(l,Pi,R5)}var ZA=By?function(l){return By.get(l)}:gO;function e_(l){for(var h=l.name+"",x=Tp[h],T=Ht.call(Tp,h)?x.length:0;T--;){var O=x[T],M=O.func;if(M==null||M==l)return O.name}return h}function Ip(l){var h=Ht.call(P,"placeholder")?P:l;return h.placeholder}function We(){var l=P.iteratee||hO;return l=l===hO?JU:l,arguments.length?l(arguments[0],arguments[1]):l}function t_(l,h){var x=l.__data__;return s3e(h)?x[typeof h=="string"?"string":"hash"]:x.map}function JA(l){for(var h=Sn(l),x=h.length;x--;){var T=h[x],O=l[T];h[x]=[T,O,q5(O)]}return h}function vl(l,h){var x=u4e(l,h);return ZU(x)?x:e}function JMe(l){var h=Ht.call(l,pl),x=l[pl];try{l[pl]=e;var T=!0}catch{}var O=ky.call(l);return T&&(h?l[pl]=x:delete l[pl]),O}var QA=CA?function(l){return l==null?[]:(l=nr(l),Hu(CA(l),function(h){return LU.call(l,h)}))}:vO,R5=CA?function(l){for(var h=[];l;)Wu(h,QA(l)),l=Dy(l);return h}:vO,ni=gi;(AA&&ni(new AA(new ArrayBuffer(1)))!=L||Dm&&ni(new Dm)!=te||OA&&ni(OA.resolve())!=Jt||Sp&&ni(new Sp)!=ke||Lm&&ni(new Lm)!=Lo)&&(ni=function(l){var h=gi(l),x=h==He?l.constructor:e,T=x?xl(x):"";if(T)switch(T){case P4e:return L;case D4e:return te;case L4e:return Jt;case F4e:return ke;case M4e:return Lo}return h});function QMe(l,h,x){for(var T=-1,O=x.length;++T<O;){var M=x[T],H=M.size;switch(M.type){case"drop":l+=H;break;case"dropRight":h-=H;break;case"take":h=ri(h,l+H);break;case"takeRight":l=pn(l,h-H);break}}return{start:l,end:h}}function e3e(l){var h=l.match(oFe);return h?h[1].split(aFe):[]}function N5(l,h,x){h=Yu(h,l);for(var T=-1,O=h.length,M=!1;++T<O;){var H=Bo(h[T]);if(!(M=l!=null&&x(l,H)))break;l=l[H]}return M||++T!=O?M:(O=l==null?0:l.length,!!O&&u_(O)&&Fa(H,O)&&(ut(l)||yl(l)))}function t3e(l){var h=l.length,x=new l.constructor(h);return h&&typeof l[0]=="string"&&Ht.call(l,"index")&&(x.index=l.index,x.input=l.input),x}function k5(l){return typeof l.constructor=="function"&&!zm(l)?Cp(Dy(l)):{}}function r3e(l,h,x){var T=l.constructor;switch(h){case Fo:return GA(l);case Ae:case $t:return new T(+l);case L:return jMe(l,x);case W:case K:case se:case le:case Ee:case et:case mt:case ln:case Ji:return h5(l,x);case te:return new T;case Y:case rr:return new T(l);case en:return BMe(l);case ke:return new T;case qn:return UMe(l)}}function n3e(l,h){var x=h.length;if(!x)return l;var T=x-1;return h[T]=(x>1?"& ":"")+h[T],h=h.join(x>2?", ":" "),l.replace(wy,`{
142
+ `),Hpt.addContextToFrame(a,s,r)}catch{}p.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return u=p.sent(),c={error:u},[3,8];case 7:try{i&&!i.done&&(f=n.return)&&f.call(n)}finally{if(c)throw c.error}return[7];case 8:return[2]}})})},e.id="ContextLines",e}();TE.ContextLines=Xpt;function Ypt(e){return kc.__awaiter(this,void 0,void 0,function(){var t,r,n;return kc.__generator(this,function(i){switch(i.label){case 0:if(t=rD.get(e),t!==void 0)return[2,t];r=null,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,Vpt(e)];case 2:return r=i.sent(),[3,4];case 3:return n=i.sent(),[3,4];case 4:return rD.set(e,r),[2,r]}})})}});var kse=g(sD=>{Object.defineProperty(sD,"__esModule",{value:!0});var CE=(jn(),vt(Mn)),iD=gn(),AE=Lt(),Zpt=_P(),Jpt=nD(),Qpt="cause",edt=5,tdt=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._key=t.key||Qpt,this._limit=t.limit||edt}return e.prototype.setupOnce=function(){iD.addGlobalEventProcessor(function(t,r){var n=iD.getCurrentHub().getIntegration(e);if(n){var i=n._handler&&n._handler.bind(n);return typeof i=="function"?i(t,r):t}return t})},e.prototype._handler=function(t,r){var n=this;return!t.exception||!t.exception.values||!r||!AE.isInstanceOf(r.originalException,Error)?AE.resolvedSyncPromise(t):new AE.SyncPromise(function(i){n._walkErrorTree(r.originalException,n._key).then(function(s){t&&t.exception&&t.exception.values&&(t.exception.values=CE.__spread(s,t.exception.values)),i(t)}).then(null,function(){i(t)})})},e.prototype._walkErrorTree=function(t,r,n){n===void 0&&(n=[]);var i;return CE.__awaiter(this,void 0,void 0,function(){var s,o,a=this;return CE.__generator(this,function(u){switch(u.label){case 0:return!AE.isInstanceOf(t[r],Error)||n.length+1>=this._limit?[2,Promise.resolve(n)]:(s=Zpt.exceptionFromError(t[r]),o=iD.getCurrentHub().getIntegration(Jpt.ContextLines),o&&(!((i=s.stacktrace)===null||i===void 0)&&i.frames)?[4,o.addSourceContextToFrames(s.stacktrace.frames)]:[3,2]);case 1:u.sent(),u.label=2;case 2:return[2,new Promise(function(c,f){a._walkErrorTree(t[r],r,CE.__spread([s],n)).then(c).then(null,function(){f()})})]}})})},e.id="LinkedErrors",e}();sD.LinkedErrors=tdt});var Lse=g(aD=>{Object.defineProperty(aD,"__esModule",{value:!0});var qse=(jn(),vt(Mn)),Pse=require("fs"),Dse=require("path"),oD;function rdt(){try{return require.cache?Object.keys(require.cache):[]}catch{return[]}}function ndt(){var e=require.main&&require.main.paths||[],t=rdt(),r={},n={};return t.forEach(function(i){var s=i,o=function(){var a=s;if(s=Dse.dirname(a),!(!s||a===s||n[a])){if(e.indexOf(s)<0)return o();var u=Dse.join(a,"package.json");if(n[a]=!0,!Pse.existsSync(u))return o();try{var c=JSON.parse(Pse.readFileSync(u,"utf8"));r[c.name]=c.version}catch{}}};o()}),r}var idt=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(t,r){var n=this;t(function(i){return r().getIntegration(e)?qse.__assign(qse.__assign({},i),{modules:n._getModules()}):i})},e.prototype._getModules=function(){return oD||(oD=ndt()),oD},e.id="Modules",e}();aD.Modules=idt});var uD=g(uu=>{Object.defineProperty(uu,"__esModule",{value:!0});var sdt=mse();uu.Console=sdt.Console;var odt=Sse();uu.Http=odt.Http;var adt=Ose();uu.OnUncaughtException=adt.OnUncaughtException;var udt=Rse();uu.OnUnhandledRejection=udt.OnUnhandledRejection;var cdt=kse();uu.LinkedErrors=cdt.LinkedErrors;var ldt=Lse();uu.Modules=ldt.Modules;var fdt=nD();uu.ContextLines=fdt.ContextLines});var lD=g(ra=>{Object.defineProperty(ra,"__esModule",{value:!0});var Dv=(jn(),vt(Mn)),qc=gn(),Fse=ea(),cD=Lt(),pdt=require("domain"),ddt=zP(),Mse=Rc(),ih=uD();ra.defaultIntegrations=[new qc.Integrations.InboundFilters,new qc.Integrations.FunctionToString,new ih.ContextLines,new ih.Console,new ih.Http,new ih.OnUncaughtException,new ih.OnUnhandledRejection,new ih.LinkedErrors];function hdt(e){e===void 0&&(e={});var t,r=Fse.getMainCarrier(),n=((t=r.__SENTRY__)===null||t===void 0?void 0:t.integrations)||[];if(e.defaultIntegrations=e.defaultIntegrations===!1?[]:Dv.__spread(Array.isArray(e.defaultIntegrations)?e.defaultIntegrations:ra.defaultIntegrations,n),e.dsn===void 0&&process.env.SENTRY_DSN&&(e.dsn=process.env.SENTRY_DSN),e.tracesSampleRate===void 0&&process.env.SENTRY_TRACES_SAMPLE_RATE){var i=parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE);isFinite(i)&&(e.tracesSampleRate=i)}if(e.release===void 0){var s=jse();s!==void 0?e.release=s:e.autoSessionTracking=!1}e.environment===void 0&&process.env.SENTRY_ENVIRONMENT&&(e.environment=process.env.SENTRY_ENVIRONMENT),e.autoSessionTracking===void 0&&e.dsn!==void 0&&(e.autoSessionTracking=!0),pdt.active&&Fse.setHubOnCarrier(r,qc.getCurrentHub()),qc.initAndBind(ddt.NodeClient,e),e.autoSessionTracking&&ydt()}ra.init=hdt;function mdt(){return qc.getCurrentHub().lastEventId()}ra.lastEventId=mdt;function gdt(e){return Dv.__awaiter(this,void 0,void 0,function(){var t;return Dv.__generator(this,function(r){return t=qc.getCurrentHub().getClient(),t?[2,t.flush(e)]:(Mse.IS_DEBUG_BUILD&&cD.logger.warn("Cannot flush events. No client defined."),[2,Promise.resolve(!1)])})})}ra.flush=gdt;function vdt(e){return Dv.__awaiter(this,void 0,void 0,function(){var t;return Dv.__generator(this,function(r){return t=qc.getCurrentHub().getClient(),t?[2,t.close(e)]:(Mse.IS_DEBUG_BUILD&&cD.logger.warn("Cannot flush events and disable SDK. No client defined."),[2,Promise.resolve(!1)])})})}ra.close=vdt;function xdt(e){if(e===void 0)return!1;var t=e&&e.getOptions();return t&&t.autoSessionTracking!==void 0?t.autoSessionTracking:!1}ra.isAutoSessionTrackingEnabled=xdt;function jse(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;var t=cD.getGlobalObject();return t.SENTRY_RELEASE&&t.SENTRY_RELEASE.id?t.SENTRY_RELEASE.id:process.env.GITHUB_SHA||process.env.COMMIT_REF||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA||e}ra.getSentryRelease=jse;function ydt(){var e=qc.getCurrentHub();e.startSession(),process.on("beforeExit",function(){var t,r=(t=e.getScope())===null||t===void 0?void 0:t.getSession(),n=["exited","crashed"];r&&!n.includes(r.status)&&e.endSession()})}});var Use=g(pD=>{Object.defineProperty(pD,"__esModule",{value:!0});var Bse=(jn(),vt(Mn)),OE=require("fs"),fD=require("path");function _dt(e){var t=fD.resolve(e);if(!OE.existsSync(t))throw new Error("Cannot read contents of "+t+". Directory does not exist.");if(!OE.statSync(t).isDirectory())throw new Error("Cannot read contents of "+t+", because it is not a directory.");var r=function(n){return OE.readdirSync(n).reduce(function(i,s){var o=fD.join(n,s);return OE.statSync(o).isDirectory()?Bse.__spread(i,r(o)):Bse.__spread(i,[o])},[])};return r(t).map(function(n){return fD.relative(t,n)})}pD.deepReadDirSync=_dt});var $se=g(dD=>{"use strict";dD.parse=Edt;dD.serialize=Sdt;var bdt=decodeURIComponent,wdt=encodeURIComponent,IE=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function Edt(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var r={},n=t||{},i=e.split(";"),s=n.decode||bdt,o=0;o<i.length;o++){var a=i[o],u=a.indexOf("=");if(!(u<0)){var c=a.substring(0,u).trim();if(r[c]==null){var f=a.substring(u+1,a.length).trim();f[0]==='"'&&(f=f.slice(1,-1)),r[c]=Tdt(f,s)}}}return r}function Sdt(e,t,r){var n=r||{},i=n.encode||wdt;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!IE.test(e))throw new TypeError("argument name is invalid");var s=i(t);if(s&&!IE.test(s))throw new TypeError("argument val is invalid");var o=e+"="+s;if(n.maxAge!=null){var a=n.maxAge-0;if(isNaN(a)||!isFinite(a))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(a)}if(n.domain){if(!IE.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!IE.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite){var u=typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite;switch(u){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}function Tdt(e,t){try{return t(e)}catch{return e}}});var Wse=g(xf=>{Object.defineProperty(xf,"__esModule",{value:!0});var na=(jn(),vt(Mn)),gf=gn(),vf=Lt(),Cdt=$se(),Adt=require("domain"),Odt=require("os"),Idt=require("url"),Rdt=Rc(),Lv=lD();function Ndt(){return function(t,r,n){var i;t.headers&&vf.isString(t.headers["sentry-trace"])&&(i=vf.extractTraceparentData(t.headers["sentry-trace"]));var s=gf.startTransaction(na.__assign({name:RE(t,{path:!0,method:!0}),op:"http.server"},i),{request:NE(t)});gf.getCurrentHub().configureScope(function(o){o.setSpan(s)}),r.__sentry_transaction=s,r.once("finish",function(){setImmediate(function(){kdt(s,t),s.setHttpStatus(r.statusCode),s.finish()})}),n()}}xf.tracingHandler=Ndt;function kdt(e,t){e&&(e.name=RE(t,{path:!0,method:!0}),e.setData("url",t.originalUrl),e.setData("baseUrl",t.baseUrl),e.setData("query",t.query))}function RE(e,t){t===void 0&&(t={});var r,n=(r=e.method)===null||r===void 0?void 0:r.toUpperCase(),i="";e.route?i=""+(e.baseUrl||"")+e.route.path:(e.originalUrl||e.url)&&(i=vf.stripUrlQueryAndFragment(e.originalUrl||e.url||""));var s="";return t.method&&n&&(s+=n),t.method&&t.path&&(s+=" "),t.path&&i&&(s+=i),s}function qdt(e,t){var r;switch(t){case"path":return RE(e,{path:!0});case"handler":return((r=e.route)===null||r===void 0?void 0:r.stack[0].name)||"<anonymous>";case"methodPath":default:return RE(e,{path:!0,method:!0})}}var Pdt=["id","username","email"];function Ddt(e,t){var r={},n=Array.isArray(t)?t:Pdt;return n.forEach(function(i){e&&i in e&&(r[i]=e[i])}),r}var Ldt=["cookies","data","headers","method","query_string","url"];function NE(e,t){t===void 0&&(t=Ldt);var r={},n=e.headers||e.header||{},i=e.method,s=e.hostname||e.host||n.host||"<no host>",o=e.protocol==="https"||e.secure||(e.socket||{}).encrypted?"https":"http",a=e.originalUrl||e.url||"",u=o+"://"+s+a;return t.forEach(function(c){switch(c){case"headers":r.headers=n;break;case"method":r.method=i;break;case"url":r.url=u;break;case"cookies":r.cookies=e.cookies||Cdt.parse(n.cookie||"");break;case"query_string":r.query_string=e.query||Idt.parse(a||"",!1).query;break;case"data":if(i==="GET"||i==="HEAD")break;e.body!==void 0&&(r.data=vf.isString(e.body)?e.body:JSON.stringify(vf.normalize(e.body)));break;default:({}).hasOwnProperty.call(e,c)&&(r[c]=e[c])}}),r}xf.extractRequestData=NE;function Hse(e,t,r){if(r=na.__assign({ip:!1,request:!0,serverName:!0,transaction:!0,user:!0,version:!0},r),r.version&&(e.contexts=na.__assign(na.__assign({},e.contexts),{runtime:{name:"node",version:global.process.version}})),r.request){var n=Array.isArray(r.request)?NE(t,r.request):NE(t);e.request=na.__assign(na.__assign({},e.request),n)}if(r.serverName&&!e.server_name&&(e.server_name=global.process.env.SENTRY_NAME||Odt.hostname()),r.user){var i=t.user&&vf.isPlainObject(t.user)?Ddt(t.user,r.user):{};Object.keys(i)&&(e.user=na.__assign(na.__assign({},e.user),i))}if(r.ip){var s=t.ip||t.connection&&t.connection.remoteAddress;s&&(e.user=na.__assign(na.__assign({},e.user),{ip_address:s}))}return r.transaction&&!e.transaction&&(e.transaction=qdt(t,r.transaction)),e}xf.parseRequest=Hse;function Fdt(e){var t=gf.getCurrentHub(),r=t.getClient();if(r&&Lv.isAutoSessionTrackingEnabled(r)){r.initSessionFlusher();var n=t.getScope();n&&n.getSession()&&n.setSession()}return function(s,o,a){if(e&&e.flushTimeout&&e.flushTimeout>0){var u=o.end;o.end=function(f,p,d){var m=this;Lv.flush(e.flushTimeout).then(function(){u.call(m,f,p,d)}).then(null,function(v){Rdt.IS_DEBUG_BUILD&&vf.logger.error(v),u.call(m,f,p,d)})}}var c=Adt.create();c.add(s),c.add(o),c.on("error",a),c.run(function(){var f=gf.getCurrentHub();f.configureScope(function(p){p.addEventProcessor(function(v){return Hse(v,s,e)});var d=f.getClient();if(Lv.isAutoSessionTrackingEnabled(d)){var m=f.getScope();m&&m.setRequestSession({status:"ok"})}}),o.once("finish",function(){var p=f.getClient();Lv.isAutoSessionTrackingEnabled(p)&&setImmediate(function(){p&&p._captureRequestSession&&p._captureRequestSession()})}),a()})}}xf.requestHandler=Fdt;function Mdt(e){var t=e.status||e.statusCode||e.status_code||e.output&&e.output.statusCode;return t?parseInt(t,10):500}function jdt(e){var t=Mdt(e);return t>=500}function Bdt(e){return function(r,n,i,s){var o=e&&e.shouldHandleError||jdt;if(o(r)){gf.withScope(function(a){var u=i.__sentry_transaction;u&&a.getSpan()===void 0&&a.setSpan(u);var c=gf.getCurrentHub().getClient();if(c&&Lv.isAutoSessionTrackingEnabled(c)){var f=c._sessionFlusher!==void 0;if(f){var p=a.getRequestSession();p&&p.status!==void 0&&(p.status="crashed")}}var d=gf.captureException(r);i.sentry=d,s(r)});return}s(r)}}xf.errorHandler=Bdt});var Gse=g(yt=>{Object.defineProperty(yt,"__esModule",{value:!0});var zse=(jn(),vt(Mn)),Udt=jd();yt.Severity=Udt.Severity;var Vr=gn();yt.addGlobalEventProcessor=Vr.addGlobalEventProcessor;yt.addBreadcrumb=Vr.addBreadcrumb;yt.captureException=Vr.captureException;yt.captureEvent=Vr.captureEvent;yt.captureMessage=Vr.captureMessage;yt.configureScope=Vr.configureScope;yt.getHubFromCarrier=Vr.getHubFromCarrier;yt.getCurrentHub=Vr.getCurrentHub;yt.Hub=Vr.Hub;yt.makeMain=Vr.makeMain;yt.Scope=Vr.Scope;yt.Session=Vr.Session;yt.startTransaction=Vr.startTransaction;yt.SDK_VERSION=Vr.SDK_VERSION;yt.setContext=Vr.setContext;yt.setExtra=Vr.setExtra;yt.setExtras=Vr.setExtras;yt.setTag=Vr.setTag;yt.setTags=Vr.setTags;yt.setUser=Vr.setUser;yt.withScope=Vr.withScope;var $dt=$P();yt.NodeBackend=$dt.NodeBackend;var Hdt=zP();yt.NodeClient=Hdt.NodeClient;var sh=lD();yt.defaultIntegrations=sh.defaultIntegrations;yt.init=sh.init;yt.lastEventId=sh.lastEventId;yt.flush=sh.flush;yt.close=sh.close;yt.getSentryRelease=sh.getSentryRelease;var Wdt=Use();yt.deepReadDirSync=Wdt.deepReadDirSync;var zdt=EP();yt.SDK_NAME=zdt.SDK_NAME;var Gdt=gn(),Vdt=ea(),Kdt=require("domain"),Xdt=Wse();yt.Handlers=Xdt;var Ydt=uD(),Zdt=FP();yt.Transports=Zdt;var Jdt=zse.__assign(zse.__assign({},Gdt.Integrations),Ydt);yt.Integrations=Jdt;var Fv=Vdt.getMainCarrier();Fv.__SENTRY__&&(Fv.__SENTRY__.extensions=Fv.__SENTRY__.extensions||{},Fv.__SENTRY__.extensions.domain=Fv.__SENTRY__.extensions.domain||Kdt)});var Vse,jv,Kse,Mv,hD,fr,cu=ae(()=>{"use strict";Vse=xe(rne()),jv=xe(Gse());oh();Kse=()=>{var e;return(process.env.AMPT_STAGE==="prod"||((e=process.env.AMPT_ENDPOINT)==null?void 0:e.endsWith("ampt.dev")))&&!process.env.JEST_WORKER_ID};Kse()&&jv.init({dsn:"https://5f27cbf3265a475abff6b7999ae73179@o1265020.ingest.sentry.io/6448443",tracesSampleRate:1});hD=class{constructor(){tn(this,"orgName");tn(this,"user");tn(this,"config");Xm(this,Mv,(0,Vse.ulid)());tn(this,"auth");tn(this,"captureException",t=>{Bv.error({err:t},"captureException"),Kse()&&jv&&jv.captureException(t,{tags:{sessionId:po(this,Mv)}})})}getSessionId(){return po(this,Mv)}storeAuth(t){this.auth=t}setUser(t){this.user=t,t.config&&(this.config=t.config)}shouldPromptTutorial(){var t,r,n,i;if(this.config){let s=((t=this.config)==null?void 0:t.connectedCount)>=3,o=((r=this.user)==null?void 0:r.userAgeDays)&&((n=this.user)==null?void 0:n.userAgeDays)>30;return{showTutorial:((i=this.config)==null?void 0:i.showTutorial)??!1,allowDismiss:o?!0:s}}return{showTutorial:!1,allowDismiss:!1}}};Mv=new WeakMap;fr=new hD});var kE,qE,Pc,mD,Ie,Bv,oh=ae(()=>{"use strict";kE=xe(ene()),qE=xe(require("path")),Pc=xe(Dl());cu();mD=class{logger;enabled;logFilePath;logToConsole;pinoArgs;pinoDestination;initLogDestination(){try{(0,Pc.removeSync)(this.logFilePath)}catch(t){process.env.AMPT_DEBUG&&console.error("Error removing log file: ",t)}finally{if(this.enabled)try{(0,Pc.ensureFileSync)(this.logFilePath)}catch{this.enabled=!1}}this.pinoDestination=this.enabled&&!this.logToConsole?kE.default.destination({dest:this.logFilePath,sync:process.platform!=="win32"}):void 0}constructor(){this.enabled=!process.env.AMPT_DISABLE_LOGS,this.logFilePath=process.env.AMPT_LOG_DIR||qE.default.join(process.cwd(),".ampt","logs"),this.logToConsole=process.env.AMPT_LOG_TO_CONSOLE==="true",this.initLogDestination(),this.pinoArgs={enabled:this.enabled,level:process.env.AMPT_LOG_LEVEL||"info",mixin:()=>({sessionId:fr.getSessionId()}),redact:{remove:!0,paths:["credentials","accessKey","token","idToken","refreshToken","accessToken"]}},this.logger=(0,kE.default)(this.pinoArgs,this.pinoDestination)}disable(){this.enabled=!1}enable(){this.enabled=!0;let t=qE.default.join(process.cwd(),".ampt");this.logFilePath=process.env.AMPT_LOG_DIR||qE.default.join(t,"logs"),(0,Pc.existsSync)(t)||(0,Pc.mkdirSync)(t),this.initLogDestination(),this.pinoArgs={...this.pinoArgs,enabled:this.enabled},this.logger=(0,kE.default)(this.pinoArgs,this.pinoDestination)}child(t){return this.logger.child(t)}debug(...t){this.enabled&&this.logger.debug(...t)}warn(...t){this.enabled&&this.logger.warn(...t)}error(...t){this.enabled&&this.logger.error(...t)}info(...t){this.enabled&&this.logger.info(...t)}fatal(...t){this.enabled&&this.logger.fatal(...t)}trace(...t){this.enabled&&this.logger.trace(...t)}},Ie=new mD,Bv=Ie});var Uv=g((Krr,Qdt)=>{Qdt.exports={name:"@ampt/cli",version:"1.0.37-beta.5",description:"Ampt command line interface",main:"./dist/index.js",types:"./types/index.d.ts",engines:{node:">=16.0.0 <=18.19.1"},publishConfig:{access:"public"},bin:{ampt:"./bin/bin"},scripts:{prepublishOnly:"npm run build",build:"node esbuild.mjs",watch:"node esbuild.mjs --watch",test:'LOG_LEVEL=silent AWS_REGION=us-east-1 NODE_OPTIONS="--no-warnings --experimental-vm-modules" jest',eslint:"eslint .",prettier:"prettier --check ."},author:"Ampt Inc <hello@getampt.com>",license:"Apache-2.0",optionalDependencies:{fsevents:"~2.3.2"},babel:{presets:["@babel/preset-typescript"]},devDependencies:{"@astrojs/webapi":"^1.1.1","@sentry/node":"^6.16.1","@types/express":"^4.17.13","@types/http-proxy":"^1.17.8","@types/write-file-atomic":"^4.0.0","@types/ws":"^8.5.3","adm-zip":"^0.5.5","ansi-escapes":"^4.3.1",axios:"^1.6.5","axios-retry":"^4.0.0",chalk:"^4.1.0","child-process-ext":"^2.1.1",chokidar:"^3.5.0",chunk:"^0.0.3",dayjs:"^1.10.4",debounce:"^1.2.1",del:"^6.0.0",download:"^8.0.0","download-git-repo":"^3.0.2",figures:"^3.2.0","fs-extra":"^9.0.1","get-port":"^5.0.0","git-list-updated":"^1.2.1","github-release-from-cc-changelog":"^2.2.0","http-proxy":"^1.18.1",ignore:"^5.2.0","is-git-url":"^1.0.0","is-installed-globally":"^0.4.0","it-parallel":"^2.0.1","jwt-decode":"^3.1.2",keypress:"^0.2.1","lz4-wasm-nodejs":"^0.9.2",minimist:"^1.2.5","node-emoji":"^1.10.0","node-resolve":"^1.3.4","normalize-path":"^3.0.0",open:"^8.2.0","parse-packagejson-name":"^1.0.1",pluralize:"^8.0.0",ramda:"^0.27.2",semver:"^5.7.1","strip-ansi":"^6.0.0",terminate:"^2.5.0","tree-kill":"^1.2.2",ulid:"^2.3.0",which:"^2.0.2","write-file-atomic":"^4.0.2"},dependencies:{esbuild:"^0.19.5",joycon:"^3.1.1",pirates:"^4.0.6","source-map-support":"^0.5.21","tsconfig-paths":"^4.2.0"}}});var Yse,Xse,eht,gD,vD,ze,enr,xD=ae(()=>{"use strict";Yse=xe(require("https"));Aw();Kee();oh();cu();({version:Xse}=Uv()),eht=new Yse.default.Agent({keepAlive:!0}),gD=class e{axios;static config(){return{apiEndpoint:process.env.AMPT_ENDPOINT,apiKey:process.env.AMPT_API_KEY}}constructor(){this.axios=Yo.create({httpsAgent:eht}),Ow(this.axios,{retries:10,retryDelay:Ow.exponentialDelay,retryCondition:t=>{var s;let r=t.response&&t.response.status||"unknown",n=t.response&&t.response.data&&t.response.data.message||"unknown",i=Ow.isNetworkOrIdempotentRequestError(t)&&r!==500||r===429||r===503;return i&&Bv.debug({status:r,message:n,response:(s=t.response)==null?void 0:s.data},"retryable request error"),i}}),this.axios.defaults.headers.common={},this.axios.defaults.headers.put={},this.axios.defaults.headers.get={}}async request(t={}){var y,b,_,E,S,w,C,I,j,q,D,N;let{apiEndpoint:r,apiKey:n}=e.config(),i=t.root||r,s=(y=fr.auth)==null?void 0:y.accessToken,{method:o="POST",params:a,headers:u={},body:c,endpoint:f}=t,{url:p=`${i}${f}`,responseType:d}=t;n&&p.startsWith(r)?u.Authorization=`Basic ${n}`:s&&p.startsWith(r)&&(u.Authorization=`Bearer ${s}`),c&&f&&(u["Content-Type"]="application/json");let m=fr.getSessionId();f&&(u["User-Agent"]=`ampt-cli/${Xse}`,u["ampt-version"]=Xse,u["ampt-session-id"]=m);let v={url:p,method:o,headers:u,params:a,data:c,maxContentLength:1/0,maxBodyLength:1/0,onUploadProgress:t.onUploadProgress};d&&(v.responseType=d);try{return Bv.debug({method:o,url:p,sessionId:m},"request"),(await this.axios(v)).data}catch(k){if(((b=k.response)==null?void 0:b.status)===403&&((E=(_=k.response)==null?void 0:_.data)==null?void 0:E.code)==="EXPIRED_TOKEN")return await((S=fr.user)==null?void 0:S.refreshAccessToken()),this.request(t);if(((w=k.response)==null?void 0:w.status)===403){let R=new Error("Forbidden");throw R.message="You do not have permission to access this resource.",R.name="ForbiddenError",R}if(((C=k.response)==null?void 0:C.status)===404)return;if(((I=k.response)==null?void 0:I.status)===409){let R=new Error("Conflict");throw R.message="Conflict",R.name="ConflictError",R}if(k.response&&k.response.data){let R=new Error(k.response.data.message||k.response.data);throw(j=k.response.data.message)!=null&&j.includes("Request Entity Too Large")?(R.message="Your code size is too large. Try reducing it by adding to .deployignore",R.name="EntityTooLargeError"):(q=k.response.data.message)!=null&&q.includes("User disabled")?(R.message=k.response.data.detail||"Your account has been disabled. Please contact support@getampt.com for more information.",R.name="UserDisabledError"):(D=k.response.data.message)!=null&&D.includes("App limit reached")?(R.message="You have reached your Organization's app limit. Please upgrade your plan or delete an app.",R.name="AppLimitReachedError"):(N=k.response.data.message)!=null&&N.includes("Instance limit reached")?(R.message="You have reached your Organization's environment limit. Please upgrade your plan or delete an environment.",R.name="EnvironmentLimitReachedError"):R.name=k.response.data.name||null,R.statusCode=k.response.data.statusCode||k.response.status||null,R}throw k}}},vD=new gD,ze=vD.request.bind(vD),enr=vD.request});var Zse,Jse=ae(()=>{"use strict";Zse=async(e,t)=>{let r,n=new Promise(i=>{r=setTimeout(()=>i(null),t)});return Promise.race([e,n]).then(i=>(clearTimeout(r),i))}});var PE,Qse=ae(()=>{"use strict";PE=e=>e?e===0?"less than a second":e===1?"1 second":`${e} seconds`:"a few seconds"});var ia,yD=ae(()=>{"use strict";ia=async e=>new Promise(t=>setTimeout(t,e).unref())});var mr,_D,bD=ae(()=>{"use strict";wr();cu();mr=e=>{(async()=>{let{eventName:t,eventData:r={}}=e,n=fr.orgName;if(!n){Ie.warn({eventName:t},"Could not send report - no org name found");return}try{await ze({method:"POST",body:{eventName:t,eventData:{...r,shell:!0}},endpoint:`/orgs/${n}/analytics`})}catch(i){fr.captureException(i),process.env.AMPT_DEBUG&&console.error(i)}})()},_D=mr});async function wD(e){try{let t="https://ampt.dev/public/templates/manifest-tags.json",{data:r}=await Yo.get(t);return r.filter(n=>n.tags.includes("starter"))}catch(t){return process.env.AMPT_DEBUG&&e.logError(t),[]}}var ED=ae(()=>{"use strict";Aw()});var SD,eoe,TD=ae(()=>{"use strict";SD=e=>{try{return process.kill(e,0)}catch(t){return t.code==="EPERM"}},eoe=SD});async function DE(e,t){let r=e.eventNames(),n=new Map;for(let i of r)n.set(i,e.listeners(i));try{return await t()}finally{e.removeAllListeners();for(let i of r)for(let s of n.get(i))e.on(i,s)}}var toe=ae(()=>{"use strict"});function roe(e){e=e.trim();let t=0,r=null,n=null,i=null,s=[];for(let o=0;o<e.length;o++){if(r=n,n=e.charAt(o),n===" "&&!i){r!==" "&&t++;continue}if(n===i){i=null;continue}else if((n==="'"||n==='"')&&!i){i=n;continue}s[t]||(s[t]=""),s[t]+=n}return s}var noe=ae(()=>{"use strict"});var ioe=ae(()=>{"use strict"});var soe=g((ah,$v)=>{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",s="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",a=500,u="__lodash_placeholder__",c=1,f=2,p=4,d=1,m=2,v=1,y=2,b=4,_=8,E=16,S=32,w=64,C=128,I=256,j=512,q=30,D="...",N=800,k=16,R=1,z=2,X=3,B=1/0,U=9007199254740991,Q=17976931348623157e292,G=0/0,re=4294967295,oe=re-1,he=re>>>1,Ne=[["ary",C],["bind",v],["bindKey",y],["curry",_],["curryRight",E],["flip",j],["partial",S],["partialRight",w],["rearg",I]],Qe="[object Arguments]",$e="[object Array]",Je="[object AsyncFunction]",Ae="[object Boolean]",$t="[object Date]",at="[object DOMException]",ye="[object Error]",F="[object Function]",A="[object GeneratorFunction]",te="[object Map]",Y="[object Number]",Xe="[object Null]",He="[object Object]",Jt="[object Promise]",Ir="[object Proxy]",en="[object RegExp]",ke="[object Set]",rr="[object String]",qn="[object Symbol]",gp="[object Undefined]",Lo="[object WeakMap]",ul="[object WeakSet]",Fo="[object ArrayBuffer]",L="[object DataView]",W="[object Float32Array]",K="[object Float64Array]",se="[object Int8Array]",le="[object Int16Array]",Ee="[object Int32Array]",et="[object Uint8Array]",mt="[object Uint8ClampedArray]",ln="[object Uint16Array]",Ji="[object Uint32Array]",Wr=/\b__p \+= '';/g,Ge=/\b(__p \+=) '' \+/g,ao=/(__e\(.*?\)|\b__t\)) \+\n'';/g,vy=/&(?:amp|lt|gt|quot|#39);/g,vp=/[&<>"']/g,xy=RegExp(vy.source),yy=RegExp(vp.source),Im=/<%-([\s\S]+?)%>/g,Qi=/<%([\s\S]+?)%>/g,Rm=/<%=([\s\S]+?)%>/g,Nm=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_y=/^\w*$/,km=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cl=/[\\^$.*+?()[\]{}|]/g,xp=RegExp(cl.source),ll=/^\s+/,by=/\s/,wy=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oFe=/\{\n\/\* \[wrapped with (.+)\] \*/,aFe=/,? & /,uFe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,cFe=/[()=,{}\[\]\/\s]/,lFe=/\\(\\)?/g,fFe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,YB=/\w*$/,pFe=/^[-+]0x[0-9a-f]+$/i,dFe=/^0b[01]+$/i,hFe=/^\[object .+?Constructor\]$/,mFe=/^0o[0-7]+$/i,gFe=/^(?:0|[1-9]\d*)$/,vFe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ey=/($^)/,xFe=/['\n\r\u2028\u2029\\]/g,Sy="\\ud800-\\udfff",yFe="\\u0300-\\u036f",_Fe="\\ufe20-\\ufe2f",bFe="\\u20d0-\\u20ff",ZB=yFe+_Fe+bFe,JB="\\u2700-\\u27bf",QB="a-z\\xdf-\\xf6\\xf8-\\xff",wFe="\\xac\\xb1\\xd7\\xf7",EFe="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",SFe="\\u2000-\\u206f",TFe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",eU="A-Z\\xc0-\\xd6\\xd8-\\xde",tU="\\ufe0e\\ufe0f",rU=wFe+EFe+SFe+TFe,cA="['\u2019]",CFe="["+Sy+"]",nU="["+rU+"]",Ty="["+ZB+"]",iU="\\d+",AFe="["+JB+"]",sU="["+QB+"]",oU="[^"+Sy+rU+iU+JB+QB+eU+"]",lA="\\ud83c[\\udffb-\\udfff]",OFe="(?:"+Ty+"|"+lA+")",aU="[^"+Sy+"]",fA="(?:\\ud83c[\\udde6-\\uddff]){2}",pA="[\\ud800-\\udbff][\\udc00-\\udfff]",yp="["+eU+"]",uU="\\u200d",cU="(?:"+sU+"|"+oU+")",IFe="(?:"+yp+"|"+oU+")",lU="(?:"+cA+"(?:d|ll|m|re|s|t|ve))?",fU="(?:"+cA+"(?:D|LL|M|RE|S|T|VE))?",pU=OFe+"?",dU="["+tU+"]?",RFe="(?:"+uU+"(?:"+[aU,fA,pA].join("|")+")"+dU+pU+")*",NFe="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kFe="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hU=dU+pU+RFe,qFe="(?:"+[AFe,fA,pA].join("|")+")"+hU,PFe="(?:"+[aU+Ty+"?",Ty,fA,pA,CFe].join("|")+")",DFe=RegExp(cA,"g"),LFe=RegExp(Ty,"g"),dA=RegExp(lA+"(?="+lA+")|"+PFe+hU,"g"),FFe=RegExp([yp+"?"+sU+"+"+lU+"(?="+[nU,yp,"$"].join("|")+")",IFe+"+"+fU+"(?="+[nU,yp+cU,"$"].join("|")+")",yp+"?"+cU+"+"+lU,yp+"+"+fU,kFe,NFe,iU,qFe].join("|"),"g"),MFe=RegExp("["+uU+Sy+ZB+tU+"]"),jFe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,BFe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],UFe=-1,dr={};dr[W]=dr[K]=dr[se]=dr[le]=dr[Ee]=dr[et]=dr[mt]=dr[ln]=dr[Ji]=!0,dr[Qe]=dr[$e]=dr[Fo]=dr[Ae]=dr[L]=dr[$t]=dr[ye]=dr[F]=dr[te]=dr[Y]=dr[He]=dr[en]=dr[ke]=dr[rr]=dr[Lo]=!1;var lr={};lr[Qe]=lr[$e]=lr[Fo]=lr[L]=lr[Ae]=lr[$t]=lr[W]=lr[K]=lr[se]=lr[le]=lr[Ee]=lr[te]=lr[Y]=lr[He]=lr[en]=lr[ke]=lr[rr]=lr[qn]=lr[et]=lr[mt]=lr[ln]=lr[Ji]=!0,lr[ye]=lr[F]=lr[Lo]=!1;var $Fe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},HFe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},WFe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},zFe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},GFe=parseFloat,VFe=parseInt,mU=typeof global=="object"&&global&&global.Object===Object&&global,KFe=typeof self=="object"&&self&&self.Object===Object&&self,En=mU||KFe||Function("return this")(),hA=typeof ah=="object"&&ah&&!ah.nodeType&&ah,fl=hA&&typeof $v=="object"&&$v&&!$v.nodeType&&$v,gU=fl&&fl.exports===hA,mA=gU&&mU.process,As=function(){try{var Z=fl&&fl.require&&fl.require("util").types;return Z||mA&&mA.binding&&mA.binding("util")}catch{}}(),vU=As&&As.isArrayBuffer,xU=As&&As.isDate,yU=As&&As.isMap,_U=As&&As.isRegExp,bU=As&&As.isSet,wU=As&&As.isTypedArray;function es(Z,ue,ie){switch(ie.length){case 0:return Z.call(ue);case 1:return Z.call(ue,ie[0]);case 2:return Z.call(ue,ie[0],ie[1]);case 3:return Z.call(ue,ie[0],ie[1],ie[2])}return Z.apply(ue,ie)}function XFe(Z,ue,ie,Te){for(var tt=-1,Dt=Z==null?0:Z.length;++tt<Dt;){var fn=Z[tt];ue(Te,fn,ie(fn),Z)}return Te}function Os(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length;++ie<Te&&ue(Z[ie],ie,Z)!==!1;);return Z}function YFe(Z,ue){for(var ie=Z==null?0:Z.length;ie--&&ue(Z[ie],ie,Z)!==!1;);return Z}function EU(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length;++ie<Te;)if(!ue(Z[ie],ie,Z))return!1;return!0}function Hu(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length,tt=0,Dt=[];++ie<Te;){var fn=Z[ie];ue(fn,ie,Z)&&(Dt[tt++]=fn)}return Dt}function Cy(Z,ue){var ie=Z==null?0:Z.length;return!!ie&&_p(Z,ue,0)>-1}function gA(Z,ue,ie){for(var Te=-1,tt=Z==null?0:Z.length;++Te<tt;)if(ie(ue,Z[Te]))return!0;return!1}function yr(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length,tt=Array(Te);++ie<Te;)tt[ie]=ue(Z[ie],ie,Z);return tt}function Wu(Z,ue){for(var ie=-1,Te=ue.length,tt=Z.length;++ie<Te;)Z[tt+ie]=ue[ie];return Z}function vA(Z,ue,ie,Te){var tt=-1,Dt=Z==null?0:Z.length;for(Te&&Dt&&(ie=Z[++tt]);++tt<Dt;)ie=ue(ie,Z[tt],tt,Z);return ie}function ZFe(Z,ue,ie,Te){var tt=Z==null?0:Z.length;for(Te&&tt&&(ie=Z[--tt]);tt--;)ie=ue(ie,Z[tt],tt,Z);return ie}function xA(Z,ue){for(var ie=-1,Te=Z==null?0:Z.length;++ie<Te;)if(ue(Z[ie],ie,Z))return!0;return!1}var JFe=yA("length");function QFe(Z){return Z.split("")}function e4e(Z){return Z.match(uFe)||[]}function SU(Z,ue,ie){var Te;return ie(Z,function(tt,Dt,fn){if(ue(tt,Dt,fn))return Te=Dt,!1}),Te}function Ay(Z,ue,ie,Te){for(var tt=Z.length,Dt=ie+(Te?1:-1);Te?Dt--:++Dt<tt;)if(ue(Z[Dt],Dt,Z))return Dt;return-1}function _p(Z,ue,ie){return ue===ue?p4e(Z,ue,ie):Ay(Z,TU,ie)}function t4e(Z,ue,ie,Te){for(var tt=ie-1,Dt=Z.length;++tt<Dt;)if(Te(Z[tt],ue))return tt;return-1}function TU(Z){return Z!==Z}function CU(Z,ue){var ie=Z==null?0:Z.length;return ie?bA(Z,ue)/ie:G}function yA(Z){return function(ue){return ue==null?e:ue[Z]}}function _A(Z){return function(ue){return Z==null?e:Z[ue]}}function AU(Z,ue,ie,Te,tt){return tt(Z,function(Dt,fn,nr){ie=Te?(Te=!1,Dt):ue(ie,Dt,fn,nr)}),ie}function r4e(Z,ue){var ie=Z.length;for(Z.sort(ue);ie--;)Z[ie]=Z[ie].value;return Z}function bA(Z,ue){for(var ie,Te=-1,tt=Z.length;++Te<tt;){var Dt=ue(Z[Te]);Dt!==e&&(ie=ie===e?Dt:ie+Dt)}return ie}function wA(Z,ue){for(var ie=-1,Te=Array(Z);++ie<Z;)Te[ie]=ue(ie);return Te}function n4e(Z,ue){return yr(ue,function(ie){return[ie,Z[ie]]})}function OU(Z){return Z&&Z.slice(0,kU(Z)+1).replace(ll,"")}function ts(Z){return function(ue){return Z(ue)}}function EA(Z,ue){return yr(ue,function(ie){return Z[ie]})}function qm(Z,ue){return Z.has(ue)}function IU(Z,ue){for(var ie=-1,Te=Z.length;++ie<Te&&_p(ue,Z[ie],0)>-1;);return ie}function RU(Z,ue){for(var ie=Z.length;ie--&&_p(ue,Z[ie],0)>-1;);return ie}function i4e(Z,ue){for(var ie=Z.length,Te=0;ie--;)Z[ie]===ue&&++Te;return Te}var s4e=_A($Fe),o4e=_A(HFe);function a4e(Z){return"\\"+zFe[Z]}function u4e(Z,ue){return Z==null?e:Z[ue]}function bp(Z){return MFe.test(Z)}function c4e(Z){return jFe.test(Z)}function l4e(Z){for(var ue,ie=[];!(ue=Z.next()).done;)ie.push(ue.value);return ie}function SA(Z){var ue=-1,ie=Array(Z.size);return Z.forEach(function(Te,tt){ie[++ue]=[tt,Te]}),ie}function NU(Z,ue){return function(ie){return Z(ue(ie))}}function zu(Z,ue){for(var ie=-1,Te=Z.length,tt=0,Dt=[];++ie<Te;){var fn=Z[ie];(fn===ue||fn===u)&&(Z[ie]=u,Dt[tt++]=ie)}return Dt}function Oy(Z){var ue=-1,ie=Array(Z.size);return Z.forEach(function(Te){ie[++ue]=Te}),ie}function f4e(Z){var ue=-1,ie=Array(Z.size);return Z.forEach(function(Te){ie[++ue]=[Te,Te]}),ie}function p4e(Z,ue,ie){for(var Te=ie-1,tt=Z.length;++Te<tt;)if(Z[Te]===ue)return Te;return-1}function d4e(Z,ue,ie){for(var Te=ie+1;Te--;)if(Z[Te]===ue)return Te;return Te}function wp(Z){return bp(Z)?m4e(Z):JFe(Z)}function uo(Z){return bp(Z)?g4e(Z):QFe(Z)}function kU(Z){for(var ue=Z.length;ue--&&by.test(Z.charAt(ue)););return ue}var h4e=_A(WFe);function m4e(Z){for(var ue=dA.lastIndex=0;dA.test(Z);)++ue;return ue}function g4e(Z){return Z.match(dA)||[]}function v4e(Z){return Z.match(FFe)||[]}var x4e=function Z(ue){ue=ue==null?En:Gu.defaults(En.Object(),ue,Gu.pick(En,BFe));var ie=ue.Array,Te=ue.Date,tt=ue.Error,Dt=ue.Function,fn=ue.Math,nr=ue.Object,TA=ue.RegExp,y4e=ue.String,Is=ue.TypeError,Iy=ie.prototype,_4e=Dt.prototype,Ep=nr.prototype,Ry=ue["__core-js_shared__"],Ny=_4e.toString,Ht=Ep.hasOwnProperty,b4e=0,qU=function(){var l=/[^.]+$/.exec(Ry&&Ry.keys&&Ry.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),ky=Ep.toString,w4e=Ny.call(nr),E4e=En._,S4e=TA("^"+Ny.call(Ht).replace(cl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qy=gU?ue.Buffer:e,Vu=ue.Symbol,Py=ue.Uint8Array,PU=qy?qy.allocUnsafe:e,Dy=NU(nr.getPrototypeOf,nr),DU=nr.create,LU=Ep.propertyIsEnumerable,Ly=Iy.splice,FU=Vu?Vu.isConcatSpreadable:e,Pm=Vu?Vu.iterator:e,pl=Vu?Vu.toStringTag:e,Fy=function(){try{var l=vl(nr,"defineProperty");return l({},"",{}),l}catch{}}(),T4e=ue.clearTimeout!==En.clearTimeout&&ue.clearTimeout,C4e=Te&&Te.now!==En.Date.now&&Te.now,A4e=ue.setTimeout!==En.setTimeout&&ue.setTimeout,My=fn.ceil,jy=fn.floor,CA=nr.getOwnPropertySymbols,O4e=qy?qy.isBuffer:e,MU=ue.isFinite,I4e=Iy.join,R4e=NU(nr.keys,nr),pn=fn.max,ri=fn.min,N4e=Te.now,k4e=ue.parseInt,jU=fn.random,q4e=Iy.reverse,AA=vl(ue,"DataView"),Dm=vl(ue,"Map"),OA=vl(ue,"Promise"),Sp=vl(ue,"Set"),Lm=vl(ue,"WeakMap"),Fm=vl(nr,"create"),By=Lm&&new Lm,Tp={},P4e=xl(AA),D4e=xl(Dm),L4e=xl(OA),F4e=xl(Sp),M4e=xl(Lm),Uy=Vu?Vu.prototype:e,Mm=Uy?Uy.valueOf:e,BU=Uy?Uy.toString:e;function P(l){if(Lr(l)&&!ut(l)&&!(l instanceof _t)){if(l instanceof Rs)return l;if(Ht.call(l,"__wrapped__"))return U5(l)}return new Rs(l)}var Cp=function(){function l(){}return function(h){if(!Rr(h))return{};if(DU)return DU(h);l.prototype=h;var x=new l;return l.prototype=e,x}}();function $y(){}function Rs(l,h){this.__wrapped__=l,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=e}P.templateSettings={escape:Im,evaluate:Qi,interpolate:Rm,variable:"",imports:{_:P}},P.prototype=$y.prototype,P.prototype.constructor=P,Rs.prototype=Cp($y.prototype),Rs.prototype.constructor=Rs;function _t(l){this.__wrapped__=l,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=re,this.__views__=[]}function j4e(){var l=new _t(this.__wrapped__);return l.__actions__=ki(this.__actions__),l.__dir__=this.__dir__,l.__filtered__=this.__filtered__,l.__iteratees__=ki(this.__iteratees__),l.__takeCount__=this.__takeCount__,l.__views__=ki(this.__views__),l}function B4e(){if(this.__filtered__){var l=new _t(this);l.__dir__=-1,l.__filtered__=!0}else l=this.clone(),l.__dir__*=-1;return l}function U4e(){var l=this.__wrapped__.value(),h=this.__dir__,x=ut(l),T=h<0,O=x?l.length:0,M=QMe(0,O,this.__views__),H=M.start,V=M.end,J=V-H,ce=T?V:H-1,fe=this.__iteratees__,de=fe.length,we=0,Le=ri(J,this.__takeCount__);if(!x||!T&&O==J&&Le==J)return l5(l,this.__actions__);var Ve=[];e:for(;J--&&we<Le;){ce+=h;for(var pt=-1,Ke=l[ce];++pt<de;){var gt=fe[pt],Ct=gt.iteratee,is=gt.type,xi=Ct(Ke);if(is==z)Ke=xi;else if(!xi){if(is==R)continue e;break e}}Ve[we++]=Ke}return Ve}_t.prototype=Cp($y.prototype),_t.prototype.constructor=_t;function dl(l){var h=-1,x=l==null?0:l.length;for(this.clear();++h<x;){var T=l[h];this.set(T[0],T[1])}}function $4e(){this.__data__=Fm?Fm(null):{},this.size=0}function H4e(l){var h=this.has(l)&&delete this.__data__[l];return this.size-=h?1:0,h}function W4e(l){var h=this.__data__;if(Fm){var x=h[l];return x===o?e:x}return Ht.call(h,l)?h[l]:e}function z4e(l){var h=this.__data__;return Fm?h[l]!==e:Ht.call(h,l)}function G4e(l,h){var x=this.__data__;return this.size+=this.has(l)?0:1,x[l]=Fm&&h===e?o:h,this}dl.prototype.clear=$4e,dl.prototype.delete=H4e,dl.prototype.get=W4e,dl.prototype.has=z4e,dl.prototype.set=G4e;function ka(l){var h=-1,x=l==null?0:l.length;for(this.clear();++h<x;){var T=l[h];this.set(T[0],T[1])}}function V4e(){this.__data__=[],this.size=0}function K4e(l){var h=this.__data__,x=Hy(h,l);if(x<0)return!1;var T=h.length-1;return x==T?h.pop():Ly.call(h,x,1),--this.size,!0}function X4e(l){var h=this.__data__,x=Hy(h,l);return x<0?e:h[x][1]}function Y4e(l){return Hy(this.__data__,l)>-1}function Z4e(l,h){var x=this.__data__,T=Hy(x,l);return T<0?(++this.size,x.push([l,h])):x[T][1]=h,this}ka.prototype.clear=V4e,ka.prototype.delete=K4e,ka.prototype.get=X4e,ka.prototype.has=Y4e,ka.prototype.set=Z4e;function qa(l){var h=-1,x=l==null?0:l.length;for(this.clear();++h<x;){var T=l[h];this.set(T[0],T[1])}}function J4e(){this.size=0,this.__data__={hash:new dl,map:new(Dm||ka),string:new dl}}function Q4e(l){var h=t_(this,l).delete(l);return this.size-=h?1:0,h}function eMe(l){return t_(this,l).get(l)}function tMe(l){return t_(this,l).has(l)}function rMe(l,h){var x=t_(this,l),T=x.size;return x.set(l,h),this.size+=x.size==T?0:1,this}qa.prototype.clear=J4e,qa.prototype.delete=Q4e,qa.prototype.get=eMe,qa.prototype.has=tMe,qa.prototype.set=rMe;function hl(l){var h=-1,x=l==null?0:l.length;for(this.__data__=new qa;++h<x;)this.add(l[h])}function nMe(l){return this.__data__.set(l,o),this}function iMe(l){return this.__data__.has(l)}hl.prototype.add=hl.prototype.push=nMe,hl.prototype.has=iMe;function co(l){var h=this.__data__=new ka(l);this.size=h.size}function sMe(){this.__data__=new ka,this.size=0}function oMe(l){var h=this.__data__,x=h.delete(l);return this.size=h.size,x}function aMe(l){return this.__data__.get(l)}function uMe(l){return this.__data__.has(l)}function cMe(l,h){var x=this.__data__;if(x instanceof ka){var T=x.__data__;if(!Dm||T.length<r-1)return T.push([l,h]),this.size=++x.size,this;x=this.__data__=new qa(T)}return x.set(l,h),this.size=x.size,this}co.prototype.clear=sMe,co.prototype.delete=oMe,co.prototype.get=aMe,co.prototype.has=uMe,co.prototype.set=cMe;function UU(l,h){var x=ut(l),T=!x&&yl(l),O=!x&&!T&&Ju(l),M=!x&&!T&&!O&&Rp(l),H=x||T||O||M,V=H?wA(l.length,y4e):[],J=V.length;for(var ce in l)(h||Ht.call(l,ce))&&!(H&&(ce=="length"||O&&(ce=="offset"||ce=="parent")||M&&(ce=="buffer"||ce=="byteLength"||ce=="byteOffset")||Fa(ce,J)))&&V.push(ce);return V}function $U(l){var h=l.length;return h?l[jA(0,h-1)]:e}function lMe(l,h){return r_(ki(l),ml(h,0,l.length))}function fMe(l){return r_(ki(l))}function IA(l,h,x){(x!==e&&!lo(l[h],x)||x===e&&!(h in l))&&Pa(l,h,x)}function jm(l,h,x){var T=l[h];(!(Ht.call(l,h)&&lo(T,x))||x===e&&!(h in l))&&Pa(l,h,x)}function Hy(l,h){for(var x=l.length;x--;)if(lo(l[x][0],h))return x;return-1}function pMe(l,h,x,T){return Ku(l,function(O,M,H){h(T,O,x(O),H)}),T}function HU(l,h){return l&&jo(h,Sn(h),l)}function dMe(l,h){return l&&jo(h,Pi(h),l)}function Pa(l,h,x){h=="__proto__"&&Fy?Fy(l,h,{configurable:!0,enumerable:!0,value:x,writable:!0}):l[h]=x}function RA(l,h){for(var x=-1,T=h.length,O=ie(T),M=l==null;++x<T;)O[x]=M?e:lO(l,h[x]);return O}function ml(l,h,x){return l===l&&(x!==e&&(l=l<=x?l:x),h!==e&&(l=l>=h?l:h)),l}function Ns(l,h,x,T,O,M){var H,V=h&c,J=h&f,ce=h&p;if(x&&(H=O?x(l,T,O,M):x(l)),H!==e)return H;if(!Rr(l))return l;var fe=ut(l);if(fe){if(H=t3e(l),!V)return ki(l,H)}else{var de=ni(l),we=de==F||de==A;if(Ju(l))return d5(l,V);if(de==He||de==Qe||we&&!O){if(H=J||we?{}:k5(l),!V)return J?WMe(l,dMe(H,l)):HMe(l,HU(H,l))}else{if(!lr[de])return O?l:{};H=r3e(l,de,V)}}M||(M=new co);var Le=M.get(l);if(Le)return Le;M.set(l,H),a8(l)?l.forEach(function(Ke){H.add(Ns(Ke,h,x,Ke,l,M))}):s8(l)&&l.forEach(function(Ke,gt){H.set(gt,Ns(Ke,h,x,gt,l,M))});var Ve=ce?J?YA:XA:J?Pi:Sn,pt=fe?e:Ve(l);return Os(pt||l,function(Ke,gt){pt&&(gt=Ke,Ke=l[gt]),jm(H,gt,Ns(Ke,h,x,gt,l,M))}),H}function hMe(l){var h=Sn(l);return function(x){return WU(x,l,h)}}function WU(l,h,x){var T=x.length;if(l==null)return!T;for(l=nr(l);T--;){var O=x[T],M=h[O],H=l[O];if(H===e&&!(O in l)||!M(H))return!1}return!0}function zU(l,h,x){if(typeof l!="function")throw new Is(i);return Gm(function(){l.apply(e,x)},h)}function Bm(l,h,x,T){var O=-1,M=Cy,H=!0,V=l.length,J=[],ce=h.length;if(!V)return J;x&&(h=yr(h,ts(x))),T?(M=gA,H=!1):h.length>=r&&(M=qm,H=!1,h=new hl(h));e:for(;++O<V;){var fe=l[O],de=x==null?fe:x(fe);if(fe=T||fe!==0?fe:0,H&&de===de){for(var we=ce;we--;)if(h[we]===de)continue e;J.push(fe)}else M(h,de,T)||J.push(fe)}return J}var Ku=x5(Mo),GU=x5(kA,!0);function mMe(l,h){var x=!0;return Ku(l,function(T,O,M){return x=!!h(T,O,M),x}),x}function Wy(l,h,x){for(var T=-1,O=l.length;++T<O;){var M=l[T],H=h(M);if(H!=null&&(V===e?H===H&&!ns(H):x(H,V)))var V=H,J=M}return J}function gMe(l,h,x,T){var O=l.length;for(x=ft(x),x<0&&(x=-x>O?0:O+x),T=T===e||T>O?O:ft(T),T<0&&(T+=O),T=x>T?0:c8(T);x<T;)l[x++]=h;return l}function VU(l,h){var x=[];return Ku(l,function(T,O,M){h(T,O,M)&&x.push(T)}),x}function Pn(l,h,x,T,O){var M=-1,H=l.length;for(x||(x=i3e),O||(O=[]);++M<H;){var V=l[M];h>0&&x(V)?h>1?Pn(V,h-1,x,T,O):Wu(O,V):T||(O[O.length]=V)}return O}var NA=y5(),KU=y5(!0);function Mo(l,h){return l&&NA(l,h,Sn)}function kA(l,h){return l&&KU(l,h,Sn)}function zy(l,h){return Hu(h,function(x){return Ma(l[x])})}function gl(l,h){h=Yu(h,l);for(var x=0,T=h.length;l!=null&&x<T;)l=l[Bo(h[x++])];return x&&x==T?l:e}function XU(l,h,x){var T=h(l);return ut(l)?T:Wu(T,x(l))}function gi(l){return l==null?l===e?gp:Xe:pl&&pl in nr(l)?JMe(l):f3e(l)}function qA(l,h){return l>h}function vMe(l,h){return l!=null&&Ht.call(l,h)}function xMe(l,h){return l!=null&&h in nr(l)}function yMe(l,h,x){return l>=ri(h,x)&&l<pn(h,x)}function PA(l,h,x){for(var T=x?gA:Cy,O=l[0].length,M=l.length,H=M,V=ie(M),J=1/0,ce=[];H--;){var fe=l[H];H&&h&&(fe=yr(fe,ts(h))),J=ri(fe.length,J),V[H]=!x&&(h||O>=120&&fe.length>=120)?new hl(H&&fe):e}fe=l[0];var de=-1,we=V[0];e:for(;++de<O&&ce.length<J;){var Le=fe[de],Ve=h?h(Le):Le;if(Le=x||Le!==0?Le:0,!(we?qm(we,Ve):T(ce,Ve,x))){for(H=M;--H;){var pt=V[H];if(!(pt?qm(pt,Ve):T(l[H],Ve,x)))continue e}we&&we.push(Ve),ce.push(Le)}}return ce}function _Me(l,h,x,T){return Mo(l,function(O,M,H){h(T,x(O),M,H)}),T}function Um(l,h,x){h=Yu(h,l),l=L5(l,h);var T=l==null?l:l[Bo(qs(h))];return T==null?e:es(T,l,x)}function YU(l){return Lr(l)&&gi(l)==Qe}function bMe(l){return Lr(l)&&gi(l)==Fo}function wMe(l){return Lr(l)&&gi(l)==$t}function $m(l,h,x,T,O){return l===h?!0:l==null||h==null||!Lr(l)&&!Lr(h)?l!==l&&h!==h:EMe(l,h,x,T,$m,O)}function EMe(l,h,x,T,O,M){var H=ut(l),V=ut(h),J=H?$e:ni(l),ce=V?$e:ni(h);J=J==Qe?He:J,ce=ce==Qe?He:ce;var fe=J==He,de=ce==He,we=J==ce;if(we&&Ju(l)){if(!Ju(h))return!1;H=!0,fe=!1}if(we&&!fe)return M||(M=new co),H||Rp(l)?I5(l,h,x,T,O,M):YMe(l,h,J,x,T,O,M);if(!(x&d)){var Le=fe&&Ht.call(l,"__wrapped__"),Ve=de&&Ht.call(h,"__wrapped__");if(Le||Ve){var pt=Le?l.value():l,Ke=Ve?h.value():h;return M||(M=new co),O(pt,Ke,x,T,M)}}return we?(M||(M=new co),ZMe(l,h,x,T,O,M)):!1}function SMe(l){return Lr(l)&&ni(l)==te}function DA(l,h,x,T){var O=x.length,M=O,H=!T;if(l==null)return!M;for(l=nr(l);O--;){var V=x[O];if(H&&V[2]?V[1]!==l[V[0]]:!(V[0]in l))return!1}for(;++O<M;){V=x[O];var J=V[0],ce=l[J],fe=V[1];if(H&&V[2]){if(ce===e&&!(J in l))return!1}else{var de=new co;if(T)var we=T(ce,fe,J,l,h,de);if(!(we===e?$m(fe,ce,d|m,T,de):we))return!1}}return!0}function ZU(l){if(!Rr(l)||o3e(l))return!1;var h=Ma(l)?S4e:hFe;return h.test(xl(l))}function TMe(l){return Lr(l)&&gi(l)==en}function CMe(l){return Lr(l)&&ni(l)==ke}function AMe(l){return Lr(l)&&u_(l.length)&&!!dr[gi(l)]}function JU(l){return typeof l=="function"?l:l==null?Di:typeof l=="object"?ut(l)?t5(l[0],l[1]):e5(l):_8(l)}function LA(l){if(!zm(l))return R4e(l);var h=[];for(var x in nr(l))Ht.call(l,x)&&x!="constructor"&&h.push(x);return h}function OMe(l){if(!Rr(l))return l3e(l);var h=zm(l),x=[];for(var T in l)T=="constructor"&&(h||!Ht.call(l,T))||x.push(T);return x}function FA(l,h){return l<h}function QU(l,h){var x=-1,T=qi(l)?ie(l.length):[];return Ku(l,function(O,M,H){T[++x]=h(O,M,H)}),T}function e5(l){var h=JA(l);return h.length==1&&h[0][2]?P5(h[0][0],h[0][1]):function(x){return x===l||DA(x,l,h)}}function t5(l,h){return eO(l)&&q5(h)?P5(Bo(l),h):function(x){var T=lO(x,l);return T===e&&T===h?fO(x,l):$m(h,T,d|m)}}function Gy(l,h,x,T,O){l!==h&&NA(h,function(M,H){if(O||(O=new co),Rr(M))IMe(l,h,H,x,Gy,T,O);else{var V=T?T(rO(l,H),M,H+"",l,h,O):e;V===e&&(V=M),IA(l,H,V)}},Pi)}function IMe(l,h,x,T,O,M,H){var V=rO(l,x),J=rO(h,x),ce=H.get(J);if(ce){IA(l,x,ce);return}var fe=M?M(V,J,x+"",l,h,H):e,de=fe===e;if(de){var we=ut(J),Le=!we&&Ju(J),Ve=!we&&!Le&&Rp(J);fe=J,we||Le||Ve?ut(V)?fe=V:zr(V)?fe=ki(V):Le?(de=!1,fe=d5(J,!0)):Ve?(de=!1,fe=h5(J,!0)):fe=[]:Vm(J)||yl(J)?(fe=V,yl(V)?fe=l8(V):(!Rr(V)||Ma(V))&&(fe=k5(J))):de=!1}de&&(H.set(J,fe),O(fe,J,T,M,H),H.delete(J)),IA(l,x,fe)}function r5(l,h){var x=l.length;if(x)return h+=h<0?x:0,Fa(h,x)?l[h]:e}function n5(l,h,x){h.length?h=yr(h,function(M){return ut(M)?function(H){return gl(H,M.length===1?M[0]:M)}:M}):h=[Di];var T=-1;h=yr(h,ts(We()));var O=QU(l,function(M,H,V){var J=yr(h,function(ce){return ce(M)});return{criteria:J,index:++T,value:M}});return r4e(O,function(M,H){return $Me(M,H,x)})}function RMe(l,h){return i5(l,h,function(x,T){return fO(l,T)})}function i5(l,h,x){for(var T=-1,O=h.length,M={};++T<O;){var H=h[T],V=gl(l,H);x(V,H)&&Hm(M,Yu(H,l),V)}return M}function NMe(l){return function(h){return gl(h,l)}}function MA(l,h,x,T){var O=T?t4e:_p,M=-1,H=h.length,V=l;for(l===h&&(h=ki(h)),x&&(V=yr(l,ts(x)));++M<H;)for(var J=0,ce=h[M],fe=x?x(ce):ce;(J=O(V,fe,J,T))>-1;)V!==l&&Ly.call(V,J,1),Ly.call(l,J,1);return l}function s5(l,h){for(var x=l?h.length:0,T=x-1;x--;){var O=h[x];if(x==T||O!==M){var M=O;Fa(O)?Ly.call(l,O,1):$A(l,O)}}return l}function jA(l,h){return l+jy(jU()*(h-l+1))}function kMe(l,h,x,T){for(var O=-1,M=pn(My((h-l)/(x||1)),0),H=ie(M);M--;)H[T?M:++O]=l,l+=x;return H}function BA(l,h){var x="";if(!l||h<1||h>U)return x;do h%2&&(x+=l),h=jy(h/2),h&&(l+=l);while(h);return x}function dt(l,h){return nO(D5(l,h,Di),l+"")}function qMe(l){return $U(Np(l))}function PMe(l,h){var x=Np(l);return r_(x,ml(h,0,x.length))}function Hm(l,h,x,T){if(!Rr(l))return l;h=Yu(h,l);for(var O=-1,M=h.length,H=M-1,V=l;V!=null&&++O<M;){var J=Bo(h[O]),ce=x;if(J==="__proto__"||J==="constructor"||J==="prototype")return l;if(O!=H){var fe=V[J];ce=T?T(fe,J,V):e,ce===e&&(ce=Rr(fe)?fe:Fa(h[O+1])?[]:{})}jm(V,J,ce),V=V[J]}return l}var o5=By?function(l,h){return By.set(l,h),l}:Di,DMe=Fy?function(l,h){return Fy(l,"toString",{configurable:!0,enumerable:!1,value:dO(h),writable:!0})}:Di;function LMe(l){return r_(Np(l))}function ks(l,h,x){var T=-1,O=l.length;h<0&&(h=-h>O?0:O+h),x=x>O?O:x,x<0&&(x+=O),O=h>x?0:x-h>>>0,h>>>=0;for(var M=ie(O);++T<O;)M[T]=l[T+h];return M}function FMe(l,h){var x;return Ku(l,function(T,O,M){return x=h(T,O,M),!x}),!!x}function Vy(l,h,x){var T=0,O=l==null?T:l.length;if(typeof h=="number"&&h===h&&O<=he){for(;T<O;){var M=T+O>>>1,H=l[M];H!==null&&!ns(H)&&(x?H<=h:H<h)?T=M+1:O=M}return O}return UA(l,h,Di,x)}function UA(l,h,x,T){var O=0,M=l==null?0:l.length;if(M===0)return 0;h=x(h);for(var H=h!==h,V=h===null,J=ns(h),ce=h===e;O<M;){var fe=jy((O+M)/2),de=x(l[fe]),we=de!==e,Le=de===null,Ve=de===de,pt=ns(de);if(H)var Ke=T||Ve;else ce?Ke=Ve&&(T||we):V?Ke=Ve&&we&&(T||!Le):J?Ke=Ve&&we&&!Le&&(T||!pt):Le||pt?Ke=!1:Ke=T?de<=h:de<h;Ke?O=fe+1:M=fe}return ri(M,oe)}function a5(l,h){for(var x=-1,T=l.length,O=0,M=[];++x<T;){var H=l[x],V=h?h(H):H;if(!x||!lo(V,J)){var J=V;M[O++]=H===0?0:H}}return M}function u5(l){return typeof l=="number"?l:ns(l)?G:+l}function rs(l){if(typeof l=="string")return l;if(ut(l))return yr(l,rs)+"";if(ns(l))return BU?BU.call(l):"";var h=l+"";return h=="0"&&1/l==-B?"-0":h}function Xu(l,h,x){var T=-1,O=Cy,M=l.length,H=!0,V=[],J=V;if(x)H=!1,O=gA;else if(M>=r){var ce=h?null:KMe(l);if(ce)return Oy(ce);H=!1,O=qm,J=new hl}else J=h?[]:V;e:for(;++T<M;){var fe=l[T],de=h?h(fe):fe;if(fe=x||fe!==0?fe:0,H&&de===de){for(var we=J.length;we--;)if(J[we]===de)continue e;h&&J.push(de),V.push(fe)}else O(J,de,x)||(J!==V&&J.push(de),V.push(fe))}return V}function $A(l,h){return h=Yu(h,l),l=L5(l,h),l==null||delete l[Bo(qs(h))]}function c5(l,h,x,T){return Hm(l,h,x(gl(l,h)),T)}function Ky(l,h,x,T){for(var O=l.length,M=T?O:-1;(T?M--:++M<O)&&h(l[M],M,l););return x?ks(l,T?0:M,T?M+1:O):ks(l,T?M+1:0,T?O:M)}function l5(l,h){var x=l;return x instanceof _t&&(x=x.value()),vA(h,function(T,O){return O.func.apply(O.thisArg,Wu([T],O.args))},x)}function HA(l,h,x){var T=l.length;if(T<2)return T?Xu(l[0]):[];for(var O=-1,M=ie(T);++O<T;)for(var H=l[O],V=-1;++V<T;)V!=O&&(M[O]=Bm(M[O]||H,l[V],h,x));return Xu(Pn(M,1),h,x)}function f5(l,h,x){for(var T=-1,O=l.length,M=h.length,H={};++T<O;){var V=T<M?h[T]:e;x(H,l[T],V)}return H}function WA(l){return zr(l)?l:[]}function zA(l){return typeof l=="function"?l:Di}function Yu(l,h){return ut(l)?l:eO(l,h)?[l]:B5(jt(l))}var MMe=dt;function Zu(l,h,x){var T=l.length;return x=x===e?T:x,!h&&x>=T?l:ks(l,h,x)}var p5=T4e||function(l){return En.clearTimeout(l)};function d5(l,h){if(h)return l.slice();var x=l.length,T=PU?PU(x):new l.constructor(x);return l.copy(T),T}function GA(l){var h=new l.constructor(l.byteLength);return new Py(h).set(new Py(l)),h}function jMe(l,h){var x=h?GA(l.buffer):l.buffer;return new l.constructor(x,l.byteOffset,l.byteLength)}function BMe(l){var h=new l.constructor(l.source,YB.exec(l));return h.lastIndex=l.lastIndex,h}function UMe(l){return Mm?nr(Mm.call(l)):{}}function h5(l,h){var x=h?GA(l.buffer):l.buffer;return new l.constructor(x,l.byteOffset,l.length)}function m5(l,h){if(l!==h){var x=l!==e,T=l===null,O=l===l,M=ns(l),H=h!==e,V=h===null,J=h===h,ce=ns(h);if(!V&&!ce&&!M&&l>h||M&&H&&J&&!V&&!ce||T&&H&&J||!x&&J||!O)return 1;if(!T&&!M&&!ce&&l<h||ce&&x&&O&&!T&&!M||V&&x&&O||!H&&O||!J)return-1}return 0}function $Me(l,h,x){for(var T=-1,O=l.criteria,M=h.criteria,H=O.length,V=x.length;++T<H;){var J=m5(O[T],M[T]);if(J){if(T>=V)return J;var ce=x[T];return J*(ce=="desc"?-1:1)}}return l.index-h.index}function g5(l,h,x,T){for(var O=-1,M=l.length,H=x.length,V=-1,J=h.length,ce=pn(M-H,0),fe=ie(J+ce),de=!T;++V<J;)fe[V]=h[V];for(;++O<H;)(de||O<M)&&(fe[x[O]]=l[O]);for(;ce--;)fe[V++]=l[O++];return fe}function v5(l,h,x,T){for(var O=-1,M=l.length,H=-1,V=x.length,J=-1,ce=h.length,fe=pn(M-V,0),de=ie(fe+ce),we=!T;++O<fe;)de[O]=l[O];for(var Le=O;++J<ce;)de[Le+J]=h[J];for(;++H<V;)(we||O<M)&&(de[Le+x[H]]=l[O++]);return de}function ki(l,h){var x=-1,T=l.length;for(h||(h=ie(T));++x<T;)h[x]=l[x];return h}function jo(l,h,x,T){var O=!x;x||(x={});for(var M=-1,H=h.length;++M<H;){var V=h[M],J=T?T(x[V],l[V],V,x,l):e;J===e&&(J=l[V]),O?Pa(x,V,J):jm(x,V,J)}return x}function HMe(l,h){return jo(l,QA(l),h)}function WMe(l,h){return jo(l,R5(l),h)}function Xy(l,h){return function(x,T){var O=ut(x)?XFe:pMe,M=h?h():{};return O(x,l,We(T,2),M)}}function Ap(l){return dt(function(h,x){var T=-1,O=x.length,M=O>1?x[O-1]:e,H=O>2?x[2]:e;for(M=l.length>3&&typeof M=="function"?(O--,M):e,H&&vi(x[0],x[1],H)&&(M=O<3?e:M,O=1),h=nr(h);++T<O;){var V=x[T];V&&l(h,V,T,M)}return h})}function x5(l,h){return function(x,T){if(x==null)return x;if(!qi(x))return l(x,T);for(var O=x.length,M=h?O:-1,H=nr(x);(h?M--:++M<O)&&T(H[M],M,H)!==!1;);return x}}function y5(l){return function(h,x,T){for(var O=-1,M=nr(h),H=T(h),V=H.length;V--;){var J=H[l?V:++O];if(x(M[J],J,M)===!1)break}return h}}function zMe(l,h,x){var T=h&v,O=Wm(l);function M(){var H=this&&this!==En&&this instanceof M?O:l;return H.apply(T?x:this,arguments)}return M}function _5(l){return function(h){h=jt(h);var x=bp(h)?uo(h):e,T=x?x[0]:h.charAt(0),O=x?Zu(x,1).join(""):h.slice(1);return T[l]()+O}}function Op(l){return function(h){return vA(x8(v8(h).replace(DFe,"")),l,"")}}function Wm(l){return function(){var h=arguments;switch(h.length){case 0:return new l;case 1:return new l(h[0]);case 2:return new l(h[0],h[1]);case 3:return new l(h[0],h[1],h[2]);case 4:return new l(h[0],h[1],h[2],h[3]);case 5:return new l(h[0],h[1],h[2],h[3],h[4]);case 6:return new l(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new l(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var x=Cp(l.prototype),T=l.apply(x,h);return Rr(T)?T:x}}function GMe(l,h,x){var T=Wm(l);function O(){for(var M=arguments.length,H=ie(M),V=M,J=Ip(O);V--;)H[V]=arguments[V];var ce=M<3&&H[0]!==J&&H[M-1]!==J?[]:zu(H,J);if(M-=ce.length,M<x)return T5(l,h,Yy,O.placeholder,e,H,ce,e,e,x-M);var fe=this&&this!==En&&this instanceof O?T:l;return es(fe,this,H)}return O}function b5(l){return function(h,x,T){var O=nr(h);if(!qi(h)){var M=We(x,3);h=Sn(h),x=function(V){return M(O[V],V,O)}}var H=l(h,x,T);return H>-1?O[M?h[H]:H]:e}}function w5(l){return La(function(h){var x=h.length,T=x,O=Rs.prototype.thru;for(l&&h.reverse();T--;){var M=h[T];if(typeof M!="function")throw new Is(i);if(O&&!H&&e_(M)=="wrapper")var H=new Rs([],!0)}for(T=H?T:x;++T<x;){M=h[T];var V=e_(M),J=V=="wrapper"?ZA(M):e;J&&tO(J[0])&&J[1]==(C|_|S|I)&&!J[4].length&&J[9]==1?H=H[e_(J[0])].apply(H,J[3]):H=M.length==1&&tO(M)?H[V]():H.thru(M)}return function(){var ce=arguments,fe=ce[0];if(H&&ce.length==1&&ut(fe))return H.plant(fe).value();for(var de=0,we=x?h[de].apply(this,ce):fe;++de<x;)we=h[de].call(this,we);return we}})}function Yy(l,h,x,T,O,M,H,V,J,ce){var fe=h&C,de=h&v,we=h&y,Le=h&(_|E),Ve=h&j,pt=we?e:Wm(l);function Ke(){for(var gt=arguments.length,Ct=ie(gt),is=gt;is--;)Ct[is]=arguments[is];if(Le)var xi=Ip(Ke),ss=i4e(Ct,xi);if(T&&(Ct=g5(Ct,T,O,Le)),M&&(Ct=v5(Ct,M,H,Le)),gt-=ss,Le&&gt<ce){var Gr=zu(Ct,xi);return T5(l,h,Yy,Ke.placeholder,x,Ct,Gr,V,J,ce-gt)}var fo=de?x:this,Ba=we?fo[l]:l;return gt=Ct.length,V?Ct=p3e(Ct,V):Ve&&gt>1&&Ct.reverse(),fe&&J<gt&&(Ct.length=J),this&&this!==En&&this instanceof Ke&&(Ba=pt||Wm(Ba)),Ba.apply(fo,Ct)}return Ke}function E5(l,h){return function(x,T){return _Me(x,l,h(T),{})}}function Zy(l,h){return function(x,T){var O;if(x===e&&T===e)return h;if(x!==e&&(O=x),T!==e){if(O===e)return T;typeof x=="string"||typeof T=="string"?(x=rs(x),T=rs(T)):(x=u5(x),T=u5(T)),O=l(x,T)}return O}}function VA(l){return La(function(h){return h=yr(h,ts(We())),dt(function(x){var T=this;return l(h,function(O){return es(O,T,x)})})})}function Jy(l,h){h=h===e?" ":rs(h);var x=h.length;if(x<2)return x?BA(h,l):h;var T=BA(h,My(l/wp(h)));return bp(h)?Zu(uo(T),0,l).join(""):T.slice(0,l)}function VMe(l,h,x,T){var O=h&v,M=Wm(l);function H(){for(var V=-1,J=arguments.length,ce=-1,fe=T.length,de=ie(fe+J),we=this&&this!==En&&this instanceof H?M:l;++ce<fe;)de[ce]=T[ce];for(;J--;)de[ce++]=arguments[++V];return es(we,O?x:this,de)}return H}function S5(l){return function(h,x,T){return T&&typeof T!="number"&&vi(h,x,T)&&(x=T=e),h=ja(h),x===e?(x=h,h=0):x=ja(x),T=T===e?h<x?1:-1:ja(T),kMe(h,x,T,l)}}function Qy(l){return function(h,x){return typeof h=="string"&&typeof x=="string"||(h=Ps(h),x=Ps(x)),l(h,x)}}function T5(l,h,x,T,O,M,H,V,J,ce){var fe=h&_,de=fe?H:e,we=fe?e:H,Le=fe?M:e,Ve=fe?e:M;h|=fe?S:w,h&=~(fe?w:S),h&b||(h&=~(v|y));var pt=[l,h,O,Le,de,Ve,we,V,J,ce],Ke=x.apply(e,pt);return tO(l)&&F5(Ke,pt),Ke.placeholder=T,M5(Ke,l,h)}function KA(l){var h=fn[l];return function(x,T){if(x=Ps(x),T=T==null?0:ri(ft(T),292),T&&MU(x)){var O=(jt(x)+"e").split("e"),M=h(O[0]+"e"+(+O[1]+T));return O=(jt(M)+"e").split("e"),+(O[0]+"e"+(+O[1]-T))}return h(x)}}var KMe=Sp&&1/Oy(new Sp([,-0]))[1]==B?function(l){return new Sp(l)}:gO;function C5(l){return function(h){var x=ni(h);return x==te?SA(h):x==ke?f4e(h):n4e(h,l(h))}}function Da(l,h,x,T,O,M,H,V){var J=h&y;if(!J&&typeof l!="function")throw new Is(i);var ce=T?T.length:0;if(ce||(h&=~(S|w),T=O=e),H=H===e?H:pn(ft(H),0),V=V===e?V:ft(V),ce-=O?O.length:0,h&w){var fe=T,de=O;T=O=e}var we=J?e:ZA(l),Le=[l,h,x,T,O,fe,de,M,H,V];if(we&&c3e(Le,we),l=Le[0],h=Le[1],x=Le[2],T=Le[3],O=Le[4],V=Le[9]=Le[9]===e?J?0:l.length:pn(Le[9]-ce,0),!V&&h&(_|E)&&(h&=~(_|E)),!h||h==v)var Ve=zMe(l,h,x);else h==_||h==E?Ve=GMe(l,h,V):(h==S||h==(v|S))&&!O.length?Ve=VMe(l,h,x,T):Ve=Yy.apply(e,Le);var pt=we?o5:F5;return M5(pt(Ve,Le),l,h)}function A5(l,h,x,T){return l===e||lo(l,Ep[x])&&!Ht.call(T,x)?h:l}function O5(l,h,x,T,O,M){return Rr(l)&&Rr(h)&&(M.set(h,l),Gy(l,h,e,O5,M),M.delete(h)),l}function XMe(l){return Vm(l)?e:l}function I5(l,h,x,T,O,M){var H=x&d,V=l.length,J=h.length;if(V!=J&&!(H&&J>V))return!1;var ce=M.get(l),fe=M.get(h);if(ce&&fe)return ce==h&&fe==l;var de=-1,we=!0,Le=x&m?new hl:e;for(M.set(l,h),M.set(h,l);++de<V;){var Ve=l[de],pt=h[de];if(T)var Ke=H?T(pt,Ve,de,h,l,M):T(Ve,pt,de,l,h,M);if(Ke!==e){if(Ke)continue;we=!1;break}if(Le){if(!xA(h,function(gt,Ct){if(!qm(Le,Ct)&&(Ve===gt||O(Ve,gt,x,T,M)))return Le.push(Ct)})){we=!1;break}}else if(!(Ve===pt||O(Ve,pt,x,T,M))){we=!1;break}}return M.delete(l),M.delete(h),we}function YMe(l,h,x,T,O,M,H){switch(x){case L:if(l.byteLength!=h.byteLength||l.byteOffset!=h.byteOffset)return!1;l=l.buffer,h=h.buffer;case Fo:return!(l.byteLength!=h.byteLength||!M(new Py(l),new Py(h)));case Ae:case $t:case Y:return lo(+l,+h);case ye:return l.name==h.name&&l.message==h.message;case en:case rr:return l==h+"";case te:var V=SA;case ke:var J=T&d;if(V||(V=Oy),l.size!=h.size&&!J)return!1;var ce=H.get(l);if(ce)return ce==h;T|=m,H.set(l,h);var fe=I5(V(l),V(h),T,O,M,H);return H.delete(l),fe;case qn:if(Mm)return Mm.call(l)==Mm.call(h)}return!1}function ZMe(l,h,x,T,O,M){var H=x&d,V=XA(l),J=V.length,ce=XA(h),fe=ce.length;if(J!=fe&&!H)return!1;for(var de=J;de--;){var we=V[de];if(!(H?we in h:Ht.call(h,we)))return!1}var Le=M.get(l),Ve=M.get(h);if(Le&&Ve)return Le==h&&Ve==l;var pt=!0;M.set(l,h),M.set(h,l);for(var Ke=H;++de<J;){we=V[de];var gt=l[we],Ct=h[we];if(T)var is=H?T(Ct,gt,we,h,l,M):T(gt,Ct,we,l,h,M);if(!(is===e?gt===Ct||O(gt,Ct,x,T,M):is)){pt=!1;break}Ke||(Ke=we=="constructor")}if(pt&&!Ke){var xi=l.constructor,ss=h.constructor;xi!=ss&&"constructor"in l&&"constructor"in h&&!(typeof xi=="function"&&xi instanceof xi&&typeof ss=="function"&&ss instanceof ss)&&(pt=!1)}return M.delete(l),M.delete(h),pt}function La(l){return nO(D5(l,e,W5),l+"")}function XA(l){return XU(l,Sn,QA)}function YA(l){return XU(l,Pi,R5)}var ZA=By?function(l){return By.get(l)}:gO;function e_(l){for(var h=l.name+"",x=Tp[h],T=Ht.call(Tp,h)?x.length:0;T--;){var O=x[T],M=O.func;if(M==null||M==l)return O.name}return h}function Ip(l){var h=Ht.call(P,"placeholder")?P:l;return h.placeholder}function We(){var l=P.iteratee||hO;return l=l===hO?JU:l,arguments.length?l(arguments[0],arguments[1]):l}function t_(l,h){var x=l.__data__;return s3e(h)?x[typeof h=="string"?"string":"hash"]:x.map}function JA(l){for(var h=Sn(l),x=h.length;x--;){var T=h[x],O=l[T];h[x]=[T,O,q5(O)]}return h}function vl(l,h){var x=u4e(l,h);return ZU(x)?x:e}function JMe(l){var h=Ht.call(l,pl),x=l[pl];try{l[pl]=e;var T=!0}catch{}var O=ky.call(l);return T&&(h?l[pl]=x:delete l[pl]),O}var QA=CA?function(l){return l==null?[]:(l=nr(l),Hu(CA(l),function(h){return LU.call(l,h)}))}:vO,R5=CA?function(l){for(var h=[];l;)Wu(h,QA(l)),l=Dy(l);return h}:vO,ni=gi;(AA&&ni(new AA(new ArrayBuffer(1)))!=L||Dm&&ni(new Dm)!=te||OA&&ni(OA.resolve())!=Jt||Sp&&ni(new Sp)!=ke||Lm&&ni(new Lm)!=Lo)&&(ni=function(l){var h=gi(l),x=h==He?l.constructor:e,T=x?xl(x):"";if(T)switch(T){case P4e:return L;case D4e:return te;case L4e:return Jt;case F4e:return ke;case M4e:return Lo}return h});function QMe(l,h,x){for(var T=-1,O=x.length;++T<O;){var M=x[T],H=M.size;switch(M.type){case"drop":l+=H;break;case"dropRight":h-=H;break;case"take":h=ri(h,l+H);break;case"takeRight":l=pn(l,h-H);break}}return{start:l,end:h}}function e3e(l){var h=l.match(oFe);return h?h[1].split(aFe):[]}function N5(l,h,x){h=Yu(h,l);for(var T=-1,O=h.length,M=!1;++T<O;){var H=Bo(h[T]);if(!(M=l!=null&&x(l,H)))break;l=l[H]}return M||++T!=O?M:(O=l==null?0:l.length,!!O&&u_(O)&&Fa(H,O)&&(ut(l)||yl(l)))}function t3e(l){var h=l.length,x=new l.constructor(h);return h&&typeof l[0]=="string"&&Ht.call(l,"index")&&(x.index=l.index,x.input=l.input),x}function k5(l){return typeof l.constructor=="function"&&!zm(l)?Cp(Dy(l)):{}}function r3e(l,h,x){var T=l.constructor;switch(h){case Fo:return GA(l);case Ae:case $t:return new T(+l);case L:return jMe(l,x);case W:case K:case se:case le:case Ee:case et:case mt:case ln:case Ji:return h5(l,x);case te:return new T;case Y:case rr:return new T(l);case en:return BMe(l);case ke:return new T;case qn:return UMe(l)}}function n3e(l,h){var x=h.length;if(!x)return l;var T=x-1;return h[T]=(x>1?"& ":"")+h[T],h=h.join(x>2?", ":" "),l.replace(wy,`{
143
143
  /* [wrapped with `+h+`] */
144
144
  `)}function i3e(l){return ut(l)||yl(l)||!!(FU&&l&&l[FU])}function Fa(l,h){var x=typeof l;return h=h??U,!!h&&(x=="number"||x!="symbol"&&gFe.test(l))&&l>-1&&l%1==0&&l<h}function vi(l,h,x){if(!Rr(x))return!1;var T=typeof h;return(T=="number"?qi(x)&&Fa(h,x.length):T=="string"&&h in x)?lo(x[h],l):!1}function eO(l,h){if(ut(l))return!1;var x=typeof l;return x=="number"||x=="symbol"||x=="boolean"||l==null||ns(l)?!0:_y.test(l)||!Nm.test(l)||h!=null&&l in nr(h)}function s3e(l){var h=typeof l;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?l!=="__proto__":l===null}function tO(l){var h=e_(l),x=P[h];if(typeof x!="function"||!(h in _t.prototype))return!1;if(l===x)return!0;var T=ZA(x);return!!T&&l===T[0]}function o3e(l){return!!qU&&qU in l}var a3e=Ry?Ma:xO;function zm(l){var h=l&&l.constructor,x=typeof h=="function"&&h.prototype||Ep;return l===x}function q5(l){return l===l&&!Rr(l)}function P5(l,h){return function(x){return x==null?!1:x[l]===h&&(h!==e||l in nr(x))}}function u3e(l){var h=o_(l,function(T){return x.size===a&&x.clear(),T}),x=h.cache;return h}function c3e(l,h){var x=l[1],T=h[1],O=x|T,M=O<(v|y|C),H=T==C&&x==_||T==C&&x==I&&l[7].length<=h[8]||T==(C|I)&&h[7].length<=h[8]&&x==_;if(!(M||H))return l;T&v&&(l[2]=h[2],O|=x&v?0:b);var V=h[3];if(V){var J=l[3];l[3]=J?g5(J,V,h[4]):V,l[4]=J?zu(l[3],u):h[4]}return V=h[5],V&&(J=l[5],l[5]=J?v5(J,V,h[6]):V,l[6]=J?zu(l[5],u):h[6]),V=h[7],V&&(l[7]=V),T&C&&(l[8]=l[8]==null?h[8]:ri(l[8],h[8])),l[9]==null&&(l[9]=h[9]),l[0]=h[0],l[1]=O,l}function l3e(l){var h=[];if(l!=null)for(var x in nr(l))h.push(x);return h}function f3e(l){return ky.call(l)}function D5(l,h,x){return h=pn(h===e?l.length-1:h,0),function(){for(var T=arguments,O=-1,M=pn(T.length-h,0),H=ie(M);++O<M;)H[O]=T[h+O];O=-1;for(var V=ie(h+1);++O<h;)V[O]=T[O];return V[h]=x(H),es(l,this,V)}}function L5(l,h){return h.length<2?l:gl(l,ks(h,0,-1))}function p3e(l,h){for(var x=l.length,T=ri(h.length,x),O=ki(l);T--;){var M=h[T];l[T]=Fa(M,x)?O[M]:e}return l}function rO(l,h){if(!(h==="constructor"&&typeof l[h]=="function")&&h!="__proto__")return l[h]}var F5=j5(o5),Gm=A4e||function(l,h){return En.setTimeout(l,h)},nO=j5(DMe);function M5(l,h,x){var T=h+"";return nO(l,n3e(T,d3e(e3e(T),x)))}function j5(l){var h=0,x=0;return function(){var T=N4e(),O=k-(T-x);if(x=T,O>0){if(++h>=N)return arguments[0]}else h=0;return l.apply(e,arguments)}}function r_(l,h){var x=-1,T=l.length,O=T-1;for(h=h===e?T:h;++x<h;){var M=jA(x,O),H=l[M];l[M]=l[x],l[x]=H}return l.length=h,l}var B5=u3e(function(l){var h=[];return l.charCodeAt(0)===46&&h.push(""),l.replace(km,function(x,T,O,M){h.push(O?M.replace(lFe,"$1"):T||x)}),h});function Bo(l){if(typeof l=="string"||ns(l))return l;var h=l+"";return h=="0"&&1/l==-B?"-0":h}function xl(l){if(l!=null){try{return Ny.call(l)}catch{}try{return l+""}catch{}}return""}function d3e(l,h){return Os(Ne,function(x){var T="_."+x[0];h&x[1]&&!Cy(l,T)&&l.push(T)}),l.sort()}function U5(l){if(l instanceof _t)return l.clone();var h=new Rs(l.__wrapped__,l.__chain__);return h.__actions__=ki(l.__actions__),h.__index__=l.__index__,h.__values__=l.__values__,h}function h3e(l,h,x){(x?vi(l,h,x):h===e)?h=1:h=pn(ft(h),0);var T=l==null?0:l.length;if(!T||h<1)return[];for(var O=0,M=0,H=ie(My(T/h));O<T;)H[M++]=ks(l,O,O+=h);return H}function m3e(l){for(var h=-1,x=l==null?0:l.length,T=0,O=[];++h<x;){var M=l[h];M&&(O[T++]=M)}return O}function g3e(){var l=arguments.length;if(!l)return[];for(var h=ie(l-1),x=arguments[0],T=l;T--;)h[T-1]=arguments[T];return Wu(ut(x)?ki(x):[x],Pn(h,1))}var v3e=dt(function(l,h){return zr(l)?Bm(l,Pn(h,1,zr,!0)):[]}),x3e=dt(function(l,h){var x=qs(h);return zr(x)&&(x=e),zr(l)?Bm(l,Pn(h,1,zr,!0),We(x,2)):[]}),y3e=dt(function(l,h){var x=qs(h);return zr(x)&&(x=e),zr(l)?Bm(l,Pn(h,1,zr,!0),e,x):[]});function _3e(l,h,x){var T=l==null?0:l.length;return T?(h=x||h===e?1:ft(h),ks(l,h<0?0:h,T)):[]}function b3e(l,h,x){var T=l==null?0:l.length;return T?(h=x||h===e?1:ft(h),h=T-h,ks(l,0,h<0?0:h)):[]}function w3e(l,h){return l&&l.length?Ky(l,We(h,3),!0,!0):[]}function E3e(l,h){return l&&l.length?Ky(l,We(h,3),!0):[]}function S3e(l,h,x,T){var O=l==null?0:l.length;return O?(x&&typeof x!="number"&&vi(l,h,x)&&(x=0,T=O),gMe(l,h,x,T)):[]}function $5(l,h,x){var T=l==null?0:l.length;if(!T)return-1;var O=x==null?0:ft(x);return O<0&&(O=pn(T+O,0)),Ay(l,We(h,3),O)}function H5(l,h,x){var T=l==null?0:l.length;if(!T)return-1;var O=T-1;return x!==e&&(O=ft(x),O=x<0?pn(T+O,0):ri(O,T-1)),Ay(l,We(h,3),O,!0)}function W5(l){var h=l==null?0:l.length;return h?Pn(l,1):[]}function T3e(l){var h=l==null?0:l.length;return h?Pn(l,B):[]}function C3e(l,h){var x=l==null?0:l.length;return x?(h=h===e?1:ft(h),Pn(l,h)):[]}function A3e(l){for(var h=-1,x=l==null?0:l.length,T={};++h<x;){var O=l[h];T[O[0]]=O[1]}return T}function z5(l){return l&&l.length?l[0]:e}function O3e(l,h,x){var T=l==null?0:l.length;if(!T)return-1;var O=x==null?0:ft(x);return O<0&&(O=pn(T+O,0)),_p(l,h,O)}function I3e(l){var h=l==null?0:l.length;return h?ks(l,0,-1):[]}var R3e=dt(function(l){var h=yr(l,WA);return h.length&&h[0]===l[0]?PA(h):[]}),N3e=dt(function(l){var h=qs(l),x=yr(l,WA);return h===qs(x)?h=e:x.pop(),x.length&&x[0]===l[0]?PA(x,We(h,2)):[]}),k3e=dt(function(l){var h=qs(l),x=yr(l,WA);return h=typeof h=="function"?h:e,h&&x.pop(),x.length&&x[0]===l[0]?PA(x,e,h):[]});function q3e(l,h){return l==null?"":I4e.call(l,h)}function qs(l){var h=l==null?0:l.length;return h?l[h-1]:e}function P3e(l,h,x){var T=l==null?0:l.length;if(!T)return-1;var O=T;return x!==e&&(O=ft(x),O=O<0?pn(T+O,0):ri(O,T-1)),h===h?d4e(l,h,O):Ay(l,TU,O,!0)}function D3e(l,h){return l&&l.length?r5(l,ft(h)):e}var L3e=dt(G5);function G5(l,h){return l&&l.length&&h&&h.length?MA(l,h):l}function F3e(l,h,x){return l&&l.length&&h&&h.length?MA(l,h,We(x,2)):l}function M3e(l,h,x){return l&&l.length&&h&&h.length?MA(l,h,e,x):l}var j3e=La(function(l,h){var x=l==null?0:l.length,T=RA(l,h);return s5(l,yr(h,function(O){return Fa(O,x)?+O:O}).sort(m5)),T});function B3e(l,h){var x=[];if(!(l&&l.length))return x;var T=-1,O=[],M=l.length;for(h=We(h,3);++T<M;){var H=l[T];h(H,T,l)&&(x.push(H),O.push(T))}return s5(l,O),x}function iO(l){return l==null?l:q4e.call(l)}function U3e(l,h,x){var T=l==null?0:l.length;return T?(x&&typeof x!="number"&&vi(l,h,x)?(h=0,x=T):(h=h==null?0:ft(h),x=x===e?T:ft(x)),ks(l,h,x)):[]}function $3e(l,h){return Vy(l,h)}function H3e(l,h,x){return UA(l,h,We(x,2))}function W3e(l,h){var x=l==null?0:l.length;if(x){var T=Vy(l,h);if(T<x&&lo(l[T],h))return T}return-1}function z3e(l,h){return Vy(l,h,!0)}function G3e(l,h,x){return UA(l,h,We(x,2),!0)}function V3e(l,h){var x=l==null?0:l.length;if(x){var T=Vy(l,h,!0)-1;if(lo(l[T],h))return T}return-1}function K3e(l){return l&&l.length?a5(l):[]}function X3e(l,h){return l&&l.length?a5(l,We(h,2)):[]}function Y3e(l){var h=l==null?0:l.length;return h?ks(l,1,h):[]}function Z3e(l,h,x){return l&&l.length?(h=x||h===e?1:ft(h),ks(l,0,h<0?0:h)):[]}function J3e(l,h,x){var T=l==null?0:l.length;return T?(h=x||h===e?1:ft(h),h=T-h,ks(l,h<0?0:h,T)):[]}function Q3e(l,h){return l&&l.length?Ky(l,We(h,3),!1,!0):[]}function e6e(l,h){return l&&l.length?Ky(l,We(h,3)):[]}var t6e=dt(function(l){return Xu(Pn(l,1,zr,!0))}),r6e=dt(function(l){var h=qs(l);return zr(h)&&(h=e),Xu(Pn(l,1,zr,!0),We(h,2))}),n6e=dt(function(l){var h=qs(l);return h=typeof h=="function"?h:e,Xu(Pn(l,1,zr,!0),e,h)});function i6e(l){return l&&l.length?Xu(l):[]}function s6e(l,h){return l&&l.length?Xu(l,We(h,2)):[]}function o6e(l,h){return h=typeof h=="function"?h:e,l&&l.length?Xu(l,e,h):[]}function sO(l){if(!(l&&l.length))return[];var h=0;return l=Hu(l,function(x){if(zr(x))return h=pn(x.length,h),!0}),wA(h,function(x){return yr(l,yA(x))})}function V5(l,h){if(!(l&&l.length))return[];var x=sO(l);return h==null?x:yr(x,function(T){return es(h,e,T)})}var a6e=dt(function(l,h){return zr(l)?Bm(l,h):[]}),u6e=dt(function(l){return HA(Hu(l,zr))}),c6e=dt(function(l){var h=qs(l);return zr(h)&&(h=e),HA(Hu(l,zr),We(h,2))}),l6e=dt(function(l){var h=qs(l);return h=typeof h=="function"?h:e,HA(Hu(l,zr),e,h)}),f6e=dt(sO);function p6e(l,h){return f5(l||[],h||[],jm)}function d6e(l,h){return f5(l||[],h||[],Hm)}var h6e=dt(function(l){var h=l.length,x=h>1?l[h-1]:e;return x=typeof x=="function"?(l.pop(),x):e,V5(l,x)});function K5(l){var h=P(l);return h.__chain__=!0,h}function m6e(l,h){return h(l),l}function n_(l,h){return h(l)}var g6e=La(function(l){var h=l.length,x=h?l[0]:0,T=this.__wrapped__,O=function(M){return RA(M,l)};return h>1||this.__actions__.length||!(T instanceof _t)||!Fa(x)?this.thru(O):(T=T.slice(x,+x+(h?1:0)),T.__actions__.push({func:n_,args:[O],thisArg:e}),new Rs(T,this.__chain__).thru(function(M){return h&&!M.length&&M.push(e),M}))});function v6e(){return K5(this)}function x6e(){return new Rs(this.value(),this.__chain__)}function y6e(){this.__values__===e&&(this.__values__=u8(this.value()));var l=this.__index__>=this.__values__.length,h=l?e:this.__values__[this.__index__++];return{done:l,value:h}}function _6e(){return this}function b6e(l){for(var h,x=this;x instanceof $y;){var T=U5(x);T.__index__=0,T.__values__=e,h?O.__wrapped__=T:h=T;var O=T;x=x.__wrapped__}return O.__wrapped__=l,h}function w6e(){var l=this.__wrapped__;if(l instanceof _t){var h=l;return this.__actions__.length&&(h=new _t(this)),h=h.reverse(),h.__actions__.push({func:n_,args:[iO],thisArg:e}),new Rs(h,this.__chain__)}return this.thru(iO)}function E6e(){return l5(this.__wrapped__,this.__actions__)}var S6e=Xy(function(l,h,x){Ht.call(l,x)?++l[x]:Pa(l,x,1)});function T6e(l,h,x){var T=ut(l)?EU:mMe;return x&&vi(l,h,x)&&(h=e),T(l,We(h,3))}function C6e(l,h){var x=ut(l)?Hu:VU;return x(l,We(h,3))}var A6e=b5($5),O6e=b5(H5);function I6e(l,h){return Pn(i_(l,h),1)}function R6e(l,h){return Pn(i_(l,h),B)}function N6e(l,h,x){return x=x===e?1:ft(x),Pn(i_(l,h),x)}function X5(l,h){var x=ut(l)?Os:Ku;return x(l,We(h,3))}function Y5(l,h){var x=ut(l)?YFe:GU;return x(l,We(h,3))}var k6e=Xy(function(l,h,x){Ht.call(l,x)?l[x].push(h):Pa(l,x,[h])});function q6e(l,h,x,T){l=qi(l)?l:Np(l),x=x&&!T?ft(x):0;var O=l.length;return x<0&&(x=pn(O+x,0)),c_(l)?x<=O&&l.indexOf(h,x)>-1:!!O&&_p(l,h,x)>-1}var P6e=dt(function(l,h,x){var T=-1,O=typeof h=="function",M=qi(l)?ie(l.length):[];return Ku(l,function(H){M[++T]=O?es(h,H,x):Um(H,h,x)}),M}),D6e=Xy(function(l,h,x){Pa(l,x,h)});function i_(l,h){var x=ut(l)?yr:QU;return x(l,We(h,3))}function L6e(l,h,x,T){return l==null?[]:(ut(h)||(h=h==null?[]:[h]),x=T?e:x,ut(x)||(x=x==null?[]:[x]),n5(l,h,x))}var F6e=Xy(function(l,h,x){l[x?0:1].push(h)},function(){return[[],[]]});function M6e(l,h,x){var T=ut(l)?vA:AU,O=arguments.length<3;return T(l,We(h,4),x,O,Ku)}function j6e(l,h,x){var T=ut(l)?ZFe:AU,O=arguments.length<3;return T(l,We(h,4),x,O,GU)}function B6e(l,h){var x=ut(l)?Hu:VU;return x(l,a_(We(h,3)))}function U6e(l){var h=ut(l)?$U:qMe;return h(l)}function $6e(l,h,x){(x?vi(l,h,x):h===e)?h=1:h=ft(h);var T=ut(l)?lMe:PMe;return T(l,h)}function H6e(l){var h=ut(l)?fMe:LMe;return h(l)}function W6e(l){if(l==null)return 0;if(qi(l))return c_(l)?wp(l):l.length;var h=ni(l);return h==te||h==ke?l.size:LA(l).length}function z6e(l,h,x){var T=ut(l)?xA:FMe;return x&&vi(l,h,x)&&(h=e),T(l,We(h,3))}var G6e=dt(function(l,h){if(l==null)return[];var x=h.length;return x>1&&vi(l,h[0],h[1])?h=[]:x>2&&vi(h[0],h[1],h[2])&&(h=[h[0]]),n5(l,Pn(h,1),[])}),s_=C4e||function(){return En.Date.now()};function V6e(l,h){if(typeof h!="function")throw new Is(i);return l=ft(l),function(){if(--l<1)return h.apply(this,arguments)}}function Z5(l,h,x){return h=x?e:h,h=l&&h==null?l.length:h,Da(l,C,e,e,e,e,h)}function J5(l,h){var x;if(typeof h!="function")throw new Is(i);return l=ft(l),function(){return--l>0&&(x=h.apply(this,arguments)),l<=1&&(h=e),x}}var oO=dt(function(l,h,x){var T=v;if(x.length){var O=zu(x,Ip(oO));T|=S}return Da(l,T,h,x,O)}),Q5=dt(function(l,h,x){var T=v|y;if(x.length){var O=zu(x,Ip(Q5));T|=S}return Da(h,T,l,x,O)});function e8(l,h,x){h=x?e:h;var T=Da(l,_,e,e,e,e,e,h);return T.placeholder=e8.placeholder,T}function t8(l,h,x){h=x?e:h;var T=Da(l,E,e,e,e,e,e,h);return T.placeholder=t8.placeholder,T}function r8(l,h,x){var T,O,M,H,V,J,ce=0,fe=!1,de=!1,we=!0;if(typeof l!="function")throw new Is(i);h=Ps(h)||0,Rr(x)&&(fe=!!x.leading,de="maxWait"in x,M=de?pn(Ps(x.maxWait)||0,h):M,we="trailing"in x?!!x.trailing:we);function Le(Gr){var fo=T,Ba=O;return T=O=e,ce=Gr,H=l.apply(Ba,fo),H}function Ve(Gr){return ce=Gr,V=Gm(gt,h),fe?Le(Gr):H}function pt(Gr){var fo=Gr-J,Ba=Gr-ce,b8=h-fo;return de?ri(b8,M-Ba):b8}function Ke(Gr){var fo=Gr-J,Ba=Gr-ce;return J===e||fo>=h||fo<0||de&&Ba>=M}function gt(){var Gr=s_();if(Ke(Gr))return Ct(Gr);V=Gm(gt,pt(Gr))}function Ct(Gr){return V=e,we&&T?Le(Gr):(T=O=e,H)}function is(){V!==e&&p5(V),ce=0,T=J=O=V=e}function xi(){return V===e?H:Ct(s_())}function ss(){var Gr=s_(),fo=Ke(Gr);if(T=arguments,O=this,J=Gr,fo){if(V===e)return Ve(J);if(de)return p5(V),V=Gm(gt,h),Le(J)}return V===e&&(V=Gm(gt,h)),H}return ss.cancel=is,ss.flush=xi,ss}var K6e=dt(function(l,h){return zU(l,1,h)}),X6e=dt(function(l,h,x){return zU(l,Ps(h)||0,x)});function Y6e(l){return Da(l,j)}function o_(l,h){if(typeof l!="function"||h!=null&&typeof h!="function")throw new Is(i);var x=function(){var T=arguments,O=h?h.apply(this,T):T[0],M=x.cache;if(M.has(O))return M.get(O);var H=l.apply(this,T);return x.cache=M.set(O,H)||M,H};return x.cache=new(o_.Cache||qa),x}o_.Cache=qa;function a_(l){if(typeof l!="function")throw new Is(i);return function(){var h=arguments;switch(h.length){case 0:return!l.call(this);case 1:return!l.call(this,h[0]);case 2:return!l.call(this,h[0],h[1]);case 3:return!l.call(this,h[0],h[1],h[2])}return!l.apply(this,h)}}function Z6e(l){return J5(2,l)}var J6e=MMe(function(l,h){h=h.length==1&&ut(h[0])?yr(h[0],ts(We())):yr(Pn(h,1),ts(We()));var x=h.length;return dt(function(T){for(var O=-1,M=ri(T.length,x);++O<M;)T[O]=h[O].call(this,T[O]);return es(l,this,T)})}),aO=dt(function(l,h){var x=zu(h,Ip(aO));return Da(l,S,e,h,x)}),n8=dt(function(l,h){var x=zu(h,Ip(n8));return Da(l,w,e,h,x)}),Q6e=La(function(l,h){return Da(l,I,e,e,e,h)});function eje(l,h){if(typeof l!="function")throw new Is(i);return h=h===e?h:ft(h),dt(l,h)}function tje(l,h){if(typeof l!="function")throw new Is(i);return h=h==null?0:pn(ft(h),0),dt(function(x){var T=x[h],O=Zu(x,0,h);return T&&Wu(O,T),es(l,this,O)})}function rje(l,h,x){var T=!0,O=!0;if(typeof l!="function")throw new Is(i);return Rr(x)&&(T="leading"in x?!!x.leading:T,O="trailing"in x?!!x.trailing:O),r8(l,h,{leading:T,maxWait:h,trailing:O})}function nje(l){return Z5(l,1)}function ije(l,h){return aO(zA(h),l)}function sje(){if(!arguments.length)return[];var l=arguments[0];return ut(l)?l:[l]}function oje(l){return Ns(l,p)}function aje(l,h){return h=typeof h=="function"?h:e,Ns(l,p,h)}function uje(l){return Ns(l,c|p)}function cje(l,h){return h=typeof h=="function"?h:e,Ns(l,c|p,h)}function lje(l,h){return h==null||WU(l,h,Sn(h))}function lo(l,h){return l===h||l!==l&&h!==h}var fje=Qy(qA),pje=Qy(function(l,h){return l>=h}),yl=YU(function(){return arguments}())?YU:function(l){return Lr(l)&&Ht.call(l,"callee")&&!LU.call(l,"callee")},ut=ie.isArray,dje=vU?ts(vU):bMe;function qi(l){return l!=null&&u_(l.length)&&!Ma(l)}function zr(l){return Lr(l)&&qi(l)}function hje(l){return l===!0||l===!1||Lr(l)&&gi(l)==Ae}var Ju=O4e||xO,mje=xU?ts(xU):wMe;function gje(l){return Lr(l)&&l.nodeType===1&&!Vm(l)}function vje(l){if(l==null)return!0;if(qi(l)&&(ut(l)||typeof l=="string"||typeof l.splice=="function"||Ju(l)||Rp(l)||yl(l)))return!l.length;var h=ni(l);if(h==te||h==ke)return!l.size;if(zm(l))return!LA(l).length;for(var x in l)if(Ht.call(l,x))return!1;return!0}function xje(l,h){return $m(l,h)}function yje(l,h,x){x=typeof x=="function"?x:e;var T=x?x(l,h):e;return T===e?$m(l,h,e,x):!!T}function uO(l){if(!Lr(l))return!1;var h=gi(l);return h==ye||h==at||typeof l.message=="string"&&typeof l.name=="string"&&!Vm(l)}function _je(l){return typeof l=="number"&&MU(l)}function Ma(l){if(!Rr(l))return!1;var h=gi(l);return h==F||h==A||h==Je||h==Ir}function i8(l){return typeof l=="number"&&l==ft(l)}function u_(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=U}function Rr(l){var h=typeof l;return l!=null&&(h=="object"||h=="function")}function Lr(l){return l!=null&&typeof l=="object"}var s8=yU?ts(yU):SMe;function bje(l,h){return l===h||DA(l,h,JA(h))}function wje(l,h,x){return x=typeof x=="function"?x:e,DA(l,h,JA(h),x)}function Eje(l){return o8(l)&&l!=+l}function Sje(l){if(a3e(l))throw new tt(n);return ZU(l)}function Tje(l){return l===null}function Cje(l){return l==null}function o8(l){return typeof l=="number"||Lr(l)&&gi(l)==Y}function Vm(l){if(!Lr(l)||gi(l)!=He)return!1;var h=Dy(l);if(h===null)return!0;var x=Ht.call(h,"constructor")&&h.constructor;return typeof x=="function"&&x instanceof x&&Ny.call(x)==w4e}var cO=_U?ts(_U):TMe;function Aje(l){return i8(l)&&l>=-U&&l<=U}var a8=bU?ts(bU):CMe;function c_(l){return typeof l=="string"||!ut(l)&&Lr(l)&&gi(l)==rr}function ns(l){return typeof l=="symbol"||Lr(l)&&gi(l)==qn}var Rp=wU?ts(wU):AMe;function Oje(l){return l===e}function Ije(l){return Lr(l)&&ni(l)==Lo}function Rje(l){return Lr(l)&&gi(l)==ul}var Nje=Qy(FA),kje=Qy(function(l,h){return l<=h});function u8(l){if(!l)return[];if(qi(l))return c_(l)?uo(l):ki(l);if(Pm&&l[Pm])return l4e(l[Pm]());var h=ni(l),x=h==te?SA:h==ke?Oy:Np;return x(l)}function ja(l){if(!l)return l===0?l:0;if(l=Ps(l),l===B||l===-B){var h=l<0?-1:1;return h*Q}return l===l?l:0}function ft(l){var h=ja(l),x=h%1;return h===h?x?h-x:h:0}function c8(l){return l?ml(ft(l),0,re):0}function Ps(l){if(typeof l=="number")return l;if(ns(l))return G;if(Rr(l)){var h=typeof l.valueOf=="function"?l.valueOf():l;l=Rr(h)?h+"":h}if(typeof l!="string")return l===0?l:+l;l=OU(l);var x=dFe.test(l);return x||mFe.test(l)?VFe(l.slice(2),x?2:8):pFe.test(l)?G:+l}function l8(l){return jo(l,Pi(l))}function qje(l){return l?ml(ft(l),-U,U):l===0?l:0}function jt(l){return l==null?"":rs(l)}var Pje=Ap(function(l,h){if(zm(h)||qi(h)){jo(h,Sn(h),l);return}for(var x in h)Ht.call(h,x)&&jm(l,x,h[x])}),f8=Ap(function(l,h){jo(h,Pi(h),l)}),l_=Ap(function(l,h,x,T){jo(h,Pi(h),l,T)}),Dje=Ap(function(l,h,x,T){jo(h,Sn(h),l,T)}),Lje=La(RA);function Fje(l,h){var x=Cp(l);return h==null?x:HU(x,h)}var Mje=dt(function(l,h){l=nr(l);var x=-1,T=h.length,O=T>2?h[2]:e;for(O&&vi(h[0],h[1],O)&&(T=1);++x<T;)for(var M=h[x],H=Pi(M),V=-1,J=H.length;++V<J;){var ce=H[V],fe=l[ce];(fe===e||lo(fe,Ep[ce])&&!Ht.call(l,ce))&&(l[ce]=M[ce])}return l}),jje=dt(function(l){return l.push(e,O5),es(p8,e,l)});function Bje(l,h){return SU(l,We(h,3),Mo)}function Uje(l,h){return SU(l,We(h,3),kA)}function $je(l,h){return l==null?l:NA(l,We(h,3),Pi)}function Hje(l,h){return l==null?l:KU(l,We(h,3),Pi)}function Wje(l,h){return l&&Mo(l,We(h,3))}function zje(l,h){return l&&kA(l,We(h,3))}function Gje(l){return l==null?[]:zy(l,Sn(l))}function Vje(l){return l==null?[]:zy(l,Pi(l))}function lO(l,h,x){var T=l==null?e:gl(l,h);return T===e?x:T}function Kje(l,h){return l!=null&&N5(l,h,vMe)}function fO(l,h){return l!=null&&N5(l,h,xMe)}var Xje=E5(function(l,h,x){h!=null&&typeof h.toString!="function"&&(h=ky.call(h)),l[h]=x},dO(Di)),Yje=E5(function(l,h,x){h!=null&&typeof h.toString!="function"&&(h=ky.call(h)),Ht.call(l,h)?l[h].push(x):l[h]=[x]},We),Zje=dt(Um);function Sn(l){return qi(l)?UU(l):LA(l)}function Pi(l){return qi(l)?UU(l,!0):OMe(l)}function Jje(l,h){var x={};return h=We(h,3),Mo(l,function(T,O,M){Pa(x,h(T,O,M),T)}),x}function Qje(l,h){var x={};return h=We(h,3),Mo(l,function(T,O,M){Pa(x,O,h(T,O,M))}),x}var eBe=Ap(function(l,h,x){Gy(l,h,x)}),p8=Ap(function(l,h,x,T){Gy(l,h,x,T)}),tBe=La(function(l,h){var x={};if(l==null)return x;var T=!1;h=yr(h,function(M){return M=Yu(M,l),T||(T=M.length>1),M}),jo(l,YA(l),x),T&&(x=Ns(x,c|f|p,XMe));for(var O=h.length;O--;)$A(x,h[O]);return x});function rBe(l,h){return d8(l,a_(We(h)))}var nBe=La(function(l,h){return l==null?{}:RMe(l,h)});function d8(l,h){if(l==null)return{};var x=yr(YA(l),function(T){return[T]});return h=We(h),i5(l,x,function(T,O){return h(T,O[0])})}function iBe(l,h,x){h=Yu(h,l);var T=-1,O=h.length;for(O||(O=1,l=e);++T<O;){var M=l==null?e:l[Bo(h[T])];M===e&&(T=O,M=x),l=Ma(M)?M.call(l):M}return l}function sBe(l,h,x){return l==null?l:Hm(l,h,x)}function oBe(l,h,x,T){return T=typeof T=="function"?T:e,l==null?l:Hm(l,h,x,T)}var h8=C5(Sn),m8=C5(Pi);function aBe(l,h,x){var T=ut(l),O=T||Ju(l)||Rp(l);if(h=We(h,4),x==null){var M=l&&l.constructor;O?x=T?new M:[]:Rr(l)?x=Ma(M)?Cp(Dy(l)):{}:x={}}return(O?Os:Mo)(l,function(H,V,J){return h(x,H,V,J)}),x}function uBe(l,h){return l==null?!0:$A(l,h)}function cBe(l,h,x){return l==null?l:c5(l,h,zA(x))}function lBe(l,h,x,T){return T=typeof T=="function"?T:e,l==null?l:c5(l,h,zA(x),T)}function Np(l){return l==null?[]:EA(l,Sn(l))}function fBe(l){return l==null?[]:EA(l,Pi(l))}function pBe(l,h,x){return x===e&&(x=h,h=e),x!==e&&(x=Ps(x),x=x===x?x:0),h!==e&&(h=Ps(h),h=h===h?h:0),ml(Ps(l),h,x)}function dBe(l,h,x){return h=ja(h),x===e?(x=h,h=0):x=ja(x),l=Ps(l),yMe(l,h,x)}function hBe(l,h,x){if(x&&typeof x!="boolean"&&vi(l,h,x)&&(h=x=e),x===e&&(typeof h=="boolean"?(x=h,h=e):typeof l=="boolean"&&(x=l,l=e)),l===e&&h===e?(l=0,h=1):(l=ja(l),h===e?(h=l,l=0):h=ja(h)),l>h){var T=l;l=h,h=T}if(x||l%1||h%1){var O=jU();return ri(l+O*(h-l+GFe("1e-"+((O+"").length-1))),h)}return jA(l,h)}var mBe=Op(function(l,h,x){return h=h.toLowerCase(),l+(x?g8(h):h)});function g8(l){return pO(jt(l).toLowerCase())}function v8(l){return l=jt(l),l&&l.replace(vFe,s4e).replace(LFe,"")}function gBe(l,h,x){l=jt(l),h=rs(h);var T=l.length;x=x===e?T:ml(ft(x),0,T);var O=x;return x-=h.length,x>=0&&l.slice(x,O)==h}function vBe(l){return l=jt(l),l&&yy.test(l)?l.replace(vp,o4e):l}function xBe(l){return l=jt(l),l&&xp.test(l)?l.replace(cl,"\\$&"):l}var yBe=Op(function(l,h,x){return l+(x?"-":"")+h.toLowerCase()}),_Be=Op(function(l,h,x){return l+(x?" ":"")+h.toLowerCase()}),bBe=_5("toLowerCase");function wBe(l,h,x){l=jt(l),h=ft(h);var T=h?wp(l):0;if(!h||T>=h)return l;var O=(h-T)/2;return Jy(jy(O),x)+l+Jy(My(O),x)}function EBe(l,h,x){l=jt(l),h=ft(h);var T=h?wp(l):0;return h&&T<h?l+Jy(h-T,x):l}function SBe(l,h,x){l=jt(l),h=ft(h);var T=h?wp(l):0;return h&&T<h?Jy(h-T,x)+l:l}function TBe(l,h,x){return x||h==null?h=0:h&&(h=+h),k4e(jt(l).replace(ll,""),h||0)}function CBe(l,h,x){return(x?vi(l,h,x):h===e)?h=1:h=ft(h),BA(jt(l),h)}function ABe(){var l=arguments,h=jt(l[0]);return l.length<3?h:h.replace(l[1],l[2])}var OBe=Op(function(l,h,x){return l+(x?"_":"")+h.toLowerCase()});function IBe(l,h,x){return x&&typeof x!="number"&&vi(l,h,x)&&(h=x=e),x=x===e?re:x>>>0,x?(l=jt(l),l&&(typeof h=="string"||h!=null&&!cO(h))&&(h=rs(h),!h&&bp(l))?Zu(uo(l),0,x):l.split(h,x)):[]}var RBe=Op(function(l,h,x){return l+(x?" ":"")+pO(h)});function NBe(l,h,x){return l=jt(l),x=x==null?0:ml(ft(x),0,l.length),h=rs(h),l.slice(x,x+h.length)==h}function kBe(l,h,x){var T=P.templateSettings;x&&vi(l,h,x)&&(h=e),l=jt(l),h=l_({},h,T,A5);var O=l_({},h.imports,T.imports,A5),M=Sn(O),H=EA(O,M),V,J,ce=0,fe=h.interpolate||Ey,de="__p += '",we=TA((h.escape||Ey).source+"|"+fe.source+"|"+(fe===Rm?fFe:Ey).source+"|"+(h.evaluate||Ey).source+"|$","g"),Le="//# sourceURL="+(Ht.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++UFe+"]")+`
145
145
  `;l.replace(we,function(Ke,gt,Ct,is,xi,ss){return Ct||(Ct=is),de+=l.slice(ce,ss).replace(xFe,a4e),gt&&(V=!0,de+=`' +
@@ -176,10 +176,10 @@ globstar while`,e,f,t,p,d),this.matchOne(e.slice(f),t.slice(p),r))return this.de
176
176
  See: https://github.com/isaacs/node-glob/issues/167`);return new xn(e,t).found}function xn(e,t){if(!e)throw new Error("must provide pattern");if(typeof t=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
177
177
  See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof xn))return new xn(e,t);if(iTt(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}xn.prototype._finish=function(){if(zve.ok(this instanceof xn),this.realpath){var e=this;this.matches.forEach(function(t,r){var n=e.matches[r]=Object.create(null);for(var i in t)try{i=e._makeAbs(i);var s=nTt.realpathSync(i,e.realpathCache);n[s]=!0}catch(o){if(o.syscall==="stat")n[e._makeAbs(i)]=!0;else throw o}})}Hf.finish(this)};xn.prototype._process=function(e,t,r){zve.ok(this instanceof xn);for(var n=0;typeof e[n]=="string";)n++;var i;switch(n){case e.length:this._processSimple(e.join("/"),t);return;case 0:i=null;break;default:i=e.slice(0,n).join("/");break}var s=e.slice(n),o;i===null?o=".":((W1(i)||W1(e.map(function(c){return typeof c=="string"?c:"[*]"}).join("/")))&&(!i||!W1(i))&&(i="/"+i),o=i);var a=this._makeAbs(o);if(!sTt(this,o)){var u=s[0]===Wve.GLOBSTAR;u?this._processGlobStar(i,o,a,s,t,r):this._processReaddir(i,o,a,s,t,r)}};xn.prototype._processReaddir=function(e,t,r,n,i,s){var o=this._readdir(r,s);if(o){for(var a=n[0],u=!!this.minimatch.negate,c=a._glob,f=this.dot||c.charAt(0)===".",p=[],d=0;d<o.length;d++){var m=o[d];if(m.charAt(0)!=="."||f){var v;u&&!e?v=!m.match(a):v=m.match(a),v&&p.push(m)}}var y=p.length;if(y!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var d=0;d<y;d++){var m=p[d];e&&(e.slice(-1)!=="/"?m=e+"/"+m:m=e+m),m.charAt(0)==="/"&&!this.nomount&&(m=BM.join(this.root,m)),this._emitMatch(i,m)}return}n.shift();for(var d=0;d<y;d++){var m=p[d],b;e?b=[e,m]:b=[m],this._process(b.concat(n),i,s)}}}};xn.prototype._emitMatch=function(e,t){if(!oTt(this,t)){var r=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}};xn.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r,n;try{r=this.fs.lstatSync(e)}catch(s){if(s.code==="ENOENT")return null}var i=r&&r.isSymbolicLink();return this.symlinks[e]=i,!i&&r&&!r.isDirectory()?this.cache[e]="FILE":t=this._readdir(e,!1),t};xn.prototype._readdir=function(e,t){var r;if(t&&!UM(this.symlinks,e))return this._readdirInGlobStar(e);if(UM(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(i){return this._readdirError(e,i),null}};xn.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var n=t[r];e==="/"?n=e+n:n=e+"/"+n,this.cache[n]=!0}return this.cache[e]=t,t};xn.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var n=new Error(t.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=t.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error("glob error",t);break}};xn.prototype._processGlobStar=function(e,t,r,n,i,s){var o=this._readdir(r,s);if(o){var a=n.slice(1),u=e?[e]:[],c=u.concat(a);this._process(c,i,!1);var f=o.length,p=this.symlinks[r];if(!(p&&s))for(var d=0;d<f;d++){var m=o[d];if(!(m.charAt(0)==="."&&!this.dot)){var v=u.concat(o[d],a);this._process(v,i,!0);var y=u.concat(o[d],n);this._process(y,i,!0)}}}};xn.prototype._processSimple=function(e,t){var r=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),!!r){if(e&&W1(e)&&!this.nomount){var n=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=BM.join(this.root,e):(e=BM.resolve(this.root,e),n&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e)}};xn.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&UM(this.cache,t)){var o=this.cache[t];if(Array.isArray(o)&&(o="DIR"),!r||o==="DIR")return o;if(r&&o==="FILE")return!1}var n,i=this.statCache[t];if(!i){var s;try{s=this.fs.lstatSync(t)}catch(a){if(a&&(a.code==="ENOENT"||a.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(s&&s.isSymbolicLink())try{i=this.fs.statSync(t)}catch{i=s}else i=s}this.statCache[t]=i;var o=!0;return i&&(o=i.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,r&&o==="FILE"?!1:o};xn.prototype._mark=function(e){return Hf.mark(this,e)};xn.prototype._makeAbs=function(e){return Hf.makeAbs(this,e)}});var Yve=g((Var,Xve)=>{var aTt=wL(),Y0=Object.create(null),uTt=r0();Xve.exports=aTt(cTt);function cTt(e,t){return Y0[e]?(Y0[e].push(t),null):(Y0[e]=[t],lTt(e))}function lTt(e){return uTt(function t(){var r=Y0[e],n=r.length,i=fTt(arguments);try{for(var s=0;s<n;s++)r[s].apply(null,i)}finally{r.length>n?(r.splice(0,n),process.nextTick(function(){t.apply(null,i)})):delete Y0[e]}})}function fTt(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n]=e[n];return r}});var $M=g((Yar,Jve)=>{Jve.exports=Wf;var pTt=kM(),Zve=U1(),Kar=Zve.Minimatch,dTt=Cn(),hTt=require("events").EventEmitter,HM=require("path"),WM=require("assert"),Z0=H1(),GM=Kve(),zf=jM(),mTt=zf.setopts,zM=zf.ownProp,VM=Yve(),Xar=require("util"),gTt=zf.childrenIgnored,vTt=zf.isIgnored,xTt=r0();function Wf(e,t,r){if(typeof t=="function"&&(r=t,t={}),t||(t={}),t.sync){if(r)throw new TypeError("callback provided to sync glob");return GM(e,t)}return new Ut(e,t,r)}Wf.sync=GM;var yTt=Wf.GlobSync=GM.GlobSync;Wf.glob=Wf;function _Tt(e,t){if(t===null||typeof t!="object")return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}Wf.hasMagic=function(e,t){var r=_Tt({},t);r.noprocess=!0;var n=new Ut(e,r),i=n.minimatch.set;if(!e)return!1;if(i.length>1)return!0;for(var s=0;s<i[0].length;s++)if(typeof i[0][s]!="string")return!0;return!1};Wf.Glob=Ut;dTt(Ut,hTt);function Ut(e,t,r){if(typeof t=="function"&&(r=t,t=null),t&&t.sync){if(r)throw new TypeError("callback provided to sync glob");return new yTt(e,t)}if(!(this instanceof Ut))return new Ut(e,t,r);mTt(this,e,t),this._didRealPath=!1;var n=this.minimatch.set.length;this.matches=new Array(n),typeof r=="function"&&(r=xTt(r),this.on("error",r),this.on("end",function(u){r(null,u)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(n===0)return a();for(var s=!0,o=0;o<n;o++)this._process(this.minimatch.set[o],o,!1,a);s=!1;function a(){--i._processing,i._processing<=0&&(s?process.nextTick(function(){i._finish()}):i._finish())}}Ut.prototype._finish=function(){if(WM(this instanceof Ut),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();zf.finish(this),this.emit("end",this.found)}};Ut.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){--e===0&&t._finish()}};Ut.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var n=Object.keys(r),i=this,s=n.length;if(s===0)return t();var o=this.matches[e]=Object.create(null);n.forEach(function(a,u){a=i._makeAbs(a),pTt.realpath(a,i.realpathCache,function(c,f){c?c.syscall==="stat"?o[a]=!0:i.emit("error",c):o[f]=!0,--s===0&&(i.matches[e]=o,t())})})};Ut.prototype._mark=function(e){return zf.mark(this,e)};Ut.prototype._makeAbs=function(e){return zf.makeAbs(this,e)};Ut.prototype.abort=function(){this.aborted=!0,this.emit("abort")};Ut.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};Ut.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<n.length;t++){var i=n[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}};Ut.prototype._process=function(e,t,r,n){if(WM(this instanceof Ut),WM(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,r,n]);return}for(var i=0;typeof e[i]=="string";)i++;var s;switch(i){case e.length:this._processSimple(e.join("/"),t,n);return;case 0:s=null;break;default:s=e.slice(0,i).join("/");break}var o=e.slice(i),a;s===null?a=".":((Z0(s)||Z0(e.map(function(f){return typeof f=="string"?f:"[*]"}).join("/")))&&(!s||!Z0(s))&&(s="/"+s),a=s);var u=this._makeAbs(a);if(gTt(this,a))return n();var c=o[0]===Zve.GLOBSTAR;c?this._processGlobStar(s,a,u,o,t,r,n):this._processReaddir(s,a,u,o,t,r,n)}};Ut.prototype._processReaddir=function(e,t,r,n,i,s,o){var a=this;this._readdir(r,s,function(u,c){return a._processReaddir2(e,t,r,n,i,s,c,o)})};Ut.prototype._processReaddir2=function(e,t,r,n,i,s,o,a){if(!o)return a();for(var u=n[0],c=!!this.minimatch.negate,f=u._glob,p=this.dot||f.charAt(0)===".",d=[],m=0;m<o.length;m++){var v=o[m];if(v.charAt(0)!=="."||p){var y;c&&!e?y=!v.match(u):y=v.match(u),y&&d.push(v)}}var b=d.length;if(b===0)return a();if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var m=0;m<b;m++){var v=d[m];e&&(e!=="/"?v=e+"/"+v:v=e+v),v.charAt(0)==="/"&&!this.nomount&&(v=HM.join(this.root,v)),this._emitMatch(i,v)}return a()}n.shift();for(var m=0;m<b;m++){var v=d[m],_;e&&(e!=="/"?v=e+"/"+v:v=e+v),this._process([v].concat(n),i,s,a)}a()};Ut.prototype._emitMatch=function(e,t){if(!this.aborted&&!vTt(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var r=Z0(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=r),!this.matches[e][t]){if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0;var i=this.statCache[r];i&&this.emit("stat",t,i),this.emit("match",t)}}};Ut.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\0"+e,n=this,i=VM(r,s);i&&n.fs.lstat(e,i);function s(o,a){if(o&&o.code==="ENOENT")return t();var u=a&&a.isSymbolicLink();n.symlinks[e]=u,!u&&a&&!a.isDirectory()?(n.cache[e]="FILE",t()):n._readdir(e,!1,t)}};Ut.prototype._readdir=function(e,t,r){if(!this.aborted&&(r=VM("readdir\0"+e+"\0"+t,r),!!r)){if(t&&!zM(this.symlinks,e))return this._readdirInGlobStar(e,r);if(zM(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}var i=this;i.fs.readdir(e,bTt(this,e,r))}};function bTt(e,t,r){return function(n,i){n?e._readdirError(t,n,r):e._readdirEntries(t,i,r)}}Ut.prototype._readdirEntries=function(e,t,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var i=t[n];e==="/"?i=e+i:i=e+"/"+i,this.cache[i]=!0}return this.cache[e]=t,r(null,t)}};Ut.prototype._readdirError=function(e,t,r){if(!this.aborted){switch(t.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(e);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(t.code+" invalid cwd "+this.cwd);i.path=this.cwd,i.code=t.code,this.emit("error",i),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit("error",t),this.abort()),this.silent||console.error("glob error",t);break}return r()}};Ut.prototype._processGlobStar=function(e,t,r,n,i,s,o){var a=this;this._readdir(r,s,function(u,c){a._processGlobStar2(e,t,r,n,i,s,c,o)})};Ut.prototype._processGlobStar2=function(e,t,r,n,i,s,o,a){if(!o)return a();var u=n.slice(1),c=e?[e]:[],f=c.concat(u);this._process(f,i,!1,a);var p=this.symlinks[r],d=o.length;if(p&&s)return a();for(var m=0;m<d;m++){var v=o[m];if(!(v.charAt(0)==="."&&!this.dot)){var y=c.concat(o[m],u);this._process(y,i,!0,a);var b=c.concat(o[m],n);this._process(b,i,!0,a)}}a()};Ut.prototype._processSimple=function(e,t,r){var n=this;this._stat(e,function(i,s){n._processSimple2(e,t,i,s,r)})};Ut.prototype._processSimple2=function(e,t,r,n,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!n)return i();if(e&&Z0(e)&&!this.nomount){var s=/[\/\\]$/.test(e);e.charAt(0)==="/"?e=HM.join(this.root,e):(e=HM.resolve(this.root,e),s&&(e+="/"))}process.platform==="win32"&&(e=e.replace(/\\/g,"/")),this._emitMatch(t,e),i()};Ut.prototype._stat=function(e,t){var r=this._makeAbs(e),n=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&zM(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||i==="DIR")return t(null,i);if(n&&i==="FILE")return t()}var s,o=this.statCache[r];if(o!==void 0){if(o===!1)return t(null,o);var a=o.isDirectory()?"DIR":"FILE";return n&&a==="FILE"?t():t(null,a,o)}var u=this,c=VM("stat\0"+r,f);c&&u.fs.lstat(r,c);function f(p,d){if(d&&d.isSymbolicLink())return u.fs.stat(r,function(m,v){m?u._stat2(e,r,null,d,t):u._stat2(e,r,m,v,t)});u._stat2(e,r,p,d,t)}};Ut.prototype._stat2=function(e,t,r,n,i){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,i();var s=e.slice(-1)==="/";if(this.statCache[t]=n,t.slice(-1)==="/"&&n&&!n.isDirectory())return i(null,!1,n);var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[t]=this.cache[t]||o,s&&o==="FILE"?i():i(null,o,n)}});var o0e=g((Zar,s0e)=>{var ur=require("assert"),r0e=require("path"),Qve=require("fs"),Kh;try{Kh=$M()}catch{}var wTt={nosort:!0,silent:!0},KM=0,J0=process.platform==="win32",n0e=e=>{if(["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{e[r]=e[r]||Qve[r],r=r+"Sync",e[r]=e[r]||Qve[r]}),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,e.glob===!1&&(e.disableGlob=!0),e.disableGlob!==!0&&Kh===void 0)throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");e.disableGlob=e.disableGlob||!1,e.glob=e.glob||wTt},YM=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),ur(e,"rimraf: missing path"),ur.equal(typeof e,"string","rimraf: path should be a string"),ur.equal(typeof r,"function","rimraf: callback function required"),ur(t,"rimraf: invalid options argument provided"),ur.equal(typeof t,"object","rimraf: options should be object"),n0e(t);let n=0,i=null,s=0,o=u=>{i=i||u,--s===0&&r(i)},a=(u,c)=>{if(u)return r(u);if(s=c.length,s===0)return r();c.forEach(f=>{let p=d=>{if(d){if((d.code==="EBUSY"||d.code==="ENOTEMPTY"||d.code==="EPERM")&&n<t.maxBusyTries)return n++,setTimeout(()=>XM(f,t,p),n*100);if(d.code==="EMFILE"&&KM<t.emfileWait)return setTimeout(()=>XM(f,t,p),KM++);d.code==="ENOENT"&&(d=null)}KM=0,o(d)};XM(f,t,p)})};if(t.disableGlob||!Kh.hasMagic(e))return a(null,[e]);t.lstat(e,(u,c)=>{if(!u)return a(null,[e]);Kh(e,t.glob,a)})},XM=(e,t,r)=>{ur(e),ur(t),ur(typeof r=="function"),t.lstat(e,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&J0&&e0e(e,t,n,r),i&&i.isDirectory())return z1(e,t,n,r);t.unlink(e,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return J0?e0e(e,t,s,r):z1(e,t,s,r);if(s.code==="EISDIR")return z1(e,t,s,r)}return r(s)})})},e0e=(e,t,r,n)=>{ur(e),ur(t),ur(typeof n=="function"),t.chmod(e,438,i=>{i?n(i.code==="ENOENT"?null:r):t.stat(e,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?z1(e,t,r,n):t.unlink(e,n)})})},t0e=(e,t,r)=>{ur(e),ur(t);try{t.chmodSync(e,438)}catch(i){if(i.code==="ENOENT")return;throw r}let n;try{n=t.statSync(e)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?G1(e,t,r):t.unlinkSync(e)},z1=(e,t,r,n)=>{ur(e),ur(t),ur(typeof n=="function"),t.rmdir(e,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?ETt(e,t,n):i&&i.code==="ENOTDIR"?n(r):n(i)})},ETt=(e,t,r)=>{ur(e),ur(t),ur(typeof r=="function"),t.readdir(e,(n,i)=>{if(n)return r(n);let s=i.length;if(s===0)return t.rmdir(e,r);let o;i.forEach(a=>{YM(r0e.join(e,a),t,u=>{if(!o){if(u)return r(o=u);--s===0&&t.rmdir(e,r)}})})})},i0e=(e,t)=>{t=t||{},n0e(t),ur(e,"rimraf: missing path"),ur.equal(typeof e,"string","rimraf: path should be a string"),ur(t,"rimraf: missing options"),ur.equal(typeof t,"object","rimraf: options should be object");let r;if(t.disableGlob||!Kh.hasMagic(e))r=[e];else try{t.lstatSync(e),r=[e]}catch{r=Kh.sync(e,t.glob)}if(r.length)for(let n=0;n<r.length;n++){let i=r[n],s;try{s=t.lstatSync(i)}catch(o){if(o.code==="ENOENT")return;o.code==="EPERM"&&J0&&t0e(i,t,o)}try{s&&s.isDirectory()?G1(i,t,null):t.unlinkSync(i)}catch(o){if(o.code==="ENOENT")return;if(o.code==="EPERM")return J0?t0e(i,t,o):G1(i,t,o);if(o.code!=="EISDIR")throw o;G1(i,t,o)}}},G1=(e,t,r)=>{ur(e),ur(t);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR")throw r;(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")&&STt(e,t)}},STt=(e,t)=>{ur(e),ur(t),t.readdirSync(e).forEach(i=>i0e(r0e.join(e,i),t));let r=J0?100:1,n=0;do{let i=!0;try{let s=t.rmdirSync(e,t);return i=!1,s}finally{if(++n<r&&i)continue}}while(!0)};s0e.exports=YM;YM.sync=i0e});var u0e=g((Jar,a0e)=>{var TTt=lve(),CTt=dve(),ATt=o0e().sync;a0e.exports=OTt;function OTt(e,t,r,n){typeof r=="function"&&(n=r,r=null),r=r||{};var i=r.clone||!1;delete r.clone,e=ITt(e);var s=e.url||NTt(e,i);if(i){var o={checkout:e.checkout,shallow:e.checkout==="master",...r};CTt(s,t,o,function(u){u===void 0?(ATt(t+"/.git"),n()):n(u)})}else{var a={extract:!0,strip:1,mode:"666",...r,headers:{accept:"application/zip",...r.headers||{}}};TTt(s,t,a).then(function(u){n()}).catch(function(u){n(u)})}}function ITt(e){var t=/^(?:(direct):([^#]+)(?:#(.+))?)$/,r=t.exec(e);if(r){var n=r[2],i=r[3]||"master";return{type:"direct",url:n,checkout:i}}else{t=/^(?:(github|gitlab|bitbucket):)?(?:(.+):)?([^/]+)\/([^#]+)(?:#(.+))?$/,r=t.exec(e);var s=r[1]||"github",o=r[2]||null,a=r[3],u=r[4],c=r[5]||"master";return o==null&&(s==="github"?o="github.com":s==="gitlab"?o="gitlab.com":s==="bitbucket"&&(o="bitbucket.org")),{type:s,origin:o,owner:a,name:u,checkout:c}}}function RTt(e,t){return/^(f|ht)tps?:\/\//i.test(e)||(t?e="git@"+e:e="https://"+e),e}function NTt(e,t){var r,n=RTt(e.origin,t);return/^git@/i.test(n)?n=n+":":n=n+"/",t?r=n+e.owner+"/"+e.name+".git":e.type==="github"?r=n+e.owner+"/"+e.name+"/archive/"+e.checkout+".zip":e.type==="gitlab"?r=n+e.owner+"/"+e.name+"/repository/archive.zip?ref="+e.checkout:e.type==="bitbucket"&&(r=n+e.owner+"/"+e.name+"/get/"+e.checkout+".zip"),r}});var c0e=g((Q0,V1)=>{"use strict";(function(){function e(t,r){var n=[];r=parseInt(r)||2;for(var i=0;i<Math.ceil(t.length/r);i++){var s=i*r,o=s+r;n.push(t.slice(s,o))}return n}typeof Q0<"u"?(typeof V1<"u"&&V1.exports&&(Q0=V1.exports=e),Q0.chunk=e):this.chunk=e}).call(Q0)});var f0e=g((Qar,l0e)=>{"use strict";var kTt=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};l0e.exports=kTt});var d0e=g((eur,p0e)=>{"use strict";var K1=f0e(),X1=globalThis.CustomEvent||Event;async function*qTt(e,t={}){let r=t.concurrency||1/0;r<1&&(r=1/0);let n=t.ordered==null?!1:t.ordered,i=new EventTarget,s=[],o=K1(),a=K1(),u=!1,c,f=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let v of e){if(s.length===r&&(o=K1(),await o.promise),f)break;let y={done:!1};s.push(y),v().then(b=>{y.done=!0,y.ok=!0,y.value=b,i.dispatchEvent(new X1("task-complete"))},b=>{y.done=!0,y.err=b,i.dispatchEvent(new X1("task-complete"))})}u=!0,i.dispatchEvent(new X1("task-complete"))}catch(v){c=v,i.dispatchEvent(new X1("task-complete"))}});function p(){return n?!!(s[0]&&s[0].done):!!s.find(v=>v.done)}function*d(){for(;s.length&&s[0].done;){let v=s[0];if(s.shift(),v.ok)yield v.value;else throw f=!0,o.resolve(),v.err;o.resolve()}}function*m(){for(;p();)for(let v=0;v<s.length;v++)if(s[v].done){let y=s[v];if(s.splice(v,1),v--,y.ok)yield y.value;else throw f=!0,o.resolve(),y.err;o.resolve()}}for(;;){if(p()||(a=K1(),await a.promise),c)throw c;if(n?yield*d():yield*m(),u&&s.length===0)break}}p0e.exports=qTt});var r3=g((tur,w0e)=>{function h0e(e){return Array.isArray(e)?e:[e]}var x0e="",m0e=" ",ZM="\\",PTt=/^\s+$/,DTt=/(?:[^\\]|^)\\$/,LTt=/^\\!/,FTt=/^\\#/,MTt=/\r?\n/g,jTt=/^\.*\/|^\.+$/,JM="/",y0e="node-ignore";typeof Symbol<"u"&&(y0e=Symbol.for("node-ignore"));var g0e=y0e,BTt=(e,t,r)=>Object.defineProperty(e,t,{value:r}),UTt=/([0-z])-([0-z])/g,_0e=()=>!1,$Tt=e=>e.replace(UTt,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:x0e),HTt=e=>{let{length:t}=e;return e.slice(0,t-t%2)},WTt=[[/\\?\s+$/,e=>e.indexOf("\\")===0?m0e:x0e],[/\\\s/g,()=>m0e],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ZM],[/\\\\/g,()=>ZM],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,i)=>t===ZM?`\\[${r}${HTt(n)}${i}`:i==="]"&&n.length%2===0?`[${$Tt(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],v0e=Object.create(null),zTt=(e,t)=>{let r=v0e[e];return r||(r=WTt.reduce((n,i)=>n.replace(i[0],i[1].bind(e)),e),v0e[e]=r),t?new RegExp(r,"i"):new RegExp(r)},t3=e=>typeof e=="string",GTt=e=>e&&t3(e)&&!PTt.test(e)&&!DTt.test(e)&&e.indexOf("#")!==0,VTt=e=>e.split(MTt),QM=class{constructor(t,r,n,i){this.origin=t,this.pattern=r,this.negative=n,this.regex=i}},KTt=(e,t)=>{let r=e,n=!1;e.indexOf("!")===0&&(n=!0,e=e.substr(1)),e=e.replace(LTt,"!").replace(FTt,"#");let i=zTt(e,t);return new QM(r,e,n,i)},XTt=(e,t)=>{throw new t(e)},Cu=(e,t,r)=>t3(e)?e?Cu.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),b0e=e=>jTt.test(e);Cu.isNotRelative=b0e;Cu.convert=e=>e;var e3=class{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){BTt(this,g0e,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[g0e]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(GTt(t)){let r=KTt(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,h0e(t3(t)?VTt(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,r){let n=!1,i=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(i===o&&n!==i||o&&!n&&!i&&!r)return;s.regex.test(t)&&(n=!o,i=o)}),{ignored:n,unignored:i}}_test(t,r,n,i){let s=t&&Cu.convert(t);return Cu(s,t,this._allowRelativePaths?_0e:XTt),this._t(s,r,n,i)}_t(t,r,n,i){if(t in r)return r[t];if(i||(i=t.split(JM)),i.pop(),!i.length)return r[t]=this._testOne(t,n);let s=this._t(i.join(JM)+JM,r,n,i);return r[t]=s.ignored?s:this._testOne(t,n)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return h0e(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},Y1=e=>new e3(e),YTt=e=>Cu(e&&Cu.convert(e),e,_0e);Y1.isPathValid=YTt;Y1.default=Y1;w0e.exports=Y1;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Cu.convert=e;let t=/^[a-z]:\//i;Cu.isNotRelative=r=>t.test(r)||b0e(r)}});var Gf,Xh,Yh,Zh,Jh,Vf=ae(()=>{"use strict";Gf=class extends Error{},Xh=class extends Error{},Yh=class extends Error{},Zh=class extends Error{name;constructor(){super("Git is not installed."),this.name="GitNotInstalledError"}},Jh=class extends Error{name;constructor(){super("Exceeded wait time."),this.name="ExceededWaitTimeError"}}});var Ur,ex,E0e,S0e,T0e,C0e,cr,A0e,O0e,xa,I0e,R0e,N0e,k0e,q0e,tx,Qh,n3,ZTt,JTt,ya,rx,Z1,i3=ae(()=>{"use strict";Ur=xe(require("path")),ex=xe(Dl()),E0e=xe(zD()),S0e=xe(uhe()),T0e=xe(sge()),C0e=xe(age()),cr=xe(require("fs")),A0e=require("fs/promises"),O0e=xe(JR()),xa=xe(YR()),I0e=xe(u0e()),R0e=xe(c0e()),N0e=xe(require("os")),k0e=require("worker_threads"),q0e=xe(d0e()),tx=xe(jN()),Qh=xe(r3()),n3=xe(require("assert"));Vf();wr();ZTt=N0e.default.cpus(),JTt=__dirname.indexOf("/src/models")===-1?Ur.default.resolve(__dirname,"workers","hash.js"):Ur.default.resolve(__dirname,"..","workers","hash.mjs"),Z1=class{constructor(t){Xm(this,ya,void 0);Xm(this,rx,void 0);tn(this,"serviceRoot");tn(this,"serviceFileName");tn(this,"serviceFilePath");tn(this,"serviceFile");tn(this,"dataFileName");tn(this,"dataFilePath");tn(this,"dataFile");tn(this,"defaults");tn(this,"servicePackageManager","npm");tn(this,"nodeModulesInstalled",null);tn(this,"ignored",(0,Qh.default)());tn(this,"exclude",(0,Qh.default)());tn(this,"verbose");yO(this,ya,t.session),yO(this,rx,!!t.syncNodeModules),this.serviceRoot=process.cwd(),this.verbose=t.verbose??!1,this.update(t)}update(t={}){this.serviceRoot=t.serviceRoot||this.serviceRoot||process.cwd(),this.serviceFileName=t.serviceFileName||this.serviceFileName||"package.json",this.serviceFilePath=Ur.default.join(this.serviceRoot,this.serviceFileName),this.serviceFile=t.serviceFile||this.serviceFile,this.dataFileName=t.dataFileName||this.dataFileName||"data.json",this.dataFilePath=Ur.default.join(this.serviceRoot,this.dataFileName),this.dataFile=t.dataFile||this.dataFile,this.setIgnoredFiles()}updateCwd(){if(!this.serviceRoot)throw new Error("serviceRoot is not set");process.chdir(this.serviceRoot)}setIgnoredFiles(){let t=["node_modules/.bin","node_modules/.cache",".git",".ampt","node_modules/@ampt/cli","node_modules/fsevents","node_modules/.vite/","node_modules/.prisma/client/libquery_engine-debian*","coverage/",".svelte-kit","npm-debug.log",".cache",".nuxt",".next/cache",".DS_Store"],r=(0,Qh.default)().add(t),n=(0,Qh.default)().add(t);if(po(this,rx)||r.add("node_modules/"),cr.default.existsSync(".serverlessignore")){let i=cr.default.readFileSync(".serverlessignore",{encoding:"utf8"});n.add(i),r.add(i)}if(cr.default.existsSync(".amptignore")){let i=cr.default.readFileSync(".amptignore",{encoding:"utf8"});n.add(i),r.add(i)}if(cr.default.existsSync(".syncignore")){let i=cr.default.readFileSync(".syncignore",{encoding:"utf8"});n.add(i),r.add(i)}this.exclude=n,this.ignored=r}dirExists(t){return cr.default.existsSync(Ur.default.resolve(process.cwd(),t))}fileExists(t){return cr.default.existsSync(Ur.default.resolve(this.serviceRoot,t))}createServiceDir(t){let r=Ur.default.resolve(process.cwd(),t);if(cr.default.existsSync(r))throw new Yh(`Directory "${t}" already exists`);cr.default.mkdirSync(r),process.chdir(r),this.nodeModulesInstalled=null,this.update({serviceRoot:r})}deleteServiceDir(t){let r=Ur.default.resolve(process.cwd(),t);cr.default.existsSync(r)&&cr.default.rmSync(r,{recursive:!0,force:!0})}deleteLogsDirectory(){let t=Ur.default.resolve(process.cwd(),".ampt");cr.default.existsSync(t)&&cr.default.rmSync(t,{recursive:!0,force:!0})}deleteGitDirectory(){let t=Ur.default.resolve(process.cwd(),".git");cr.default.existsSync(t)&&cr.default.rmSync(t,{recursive:!0,force:!0})}async read(t){let[r]=await Promise.all([this.readServiceFileIfExists(t),this.readDataFileIfExists({dataFileName:t==null?void 0:t.dataFileName}),this.detectPackageManager()]);return await this.detectNodeModules(),r}async listAmptPackages(){let t=[];if(this.serviceFile&&this.serviceFile.dependencies&&(t=Object.entries(this.serviceFile.dependencies).filter(([i,s])=>i.startsWith("@ampt/")&&!i.includes("cli")&&!s.startsWith("file:")).map(([i])=>[i,!1])),this.serviceFile&&this.serviceFile.devDependencies){let n=Object.entries(this.serviceFile.devDependencies).filter(([i,s])=>i.startsWith("@ampt/")&&!s.startsWith("file:"));t=t.concat(n.map(([i])=>[i,!0]))}return(await Promise.all(t.map(async([r,n])=>{if(this.serviceRoot&&cr.default.existsSync(Ur.default.join(this.serviceRoot,"node_modules",r))){let{version:i}=await ex.default.readJSON(Ur.default.join(this.serviceRoot,"node_modules",r,"package.json"));return[r,i,n]}}))).filter(r=>r!==void 0)}async listValidSubdirectories(){let t=this.serviceRoot||process.cwd(),r=cr.default.readdirSync(t,{withFileTypes:!0});return(await Promise.all(r.filter(i=>i.isDirectory()).map(async i=>{if(await this.readJsonFileIfExists(Ur.default.join(t,i.name,"package.json")))return i.name}))).filter(i=>!!i)}async isCwdEmpty(){let t=cr.default.readdirSync(this.serviceRoot);return(0,Qh.default)().add([".ampt"]).filter(t).length===0}async readJsonFileIfExists(t){if(cr.default.existsSync(t))try{return await ex.default.readJson(t,{throws:!1})}catch(r){return Ie.warn(`Failed to read ${t} due to the following error:
178
178
  ${r}`),null}return null}async readServiceFileIfExists(t){var n,i,s,o;let r=await this.readJsonFileIfExists(this.serviceFilePath);if(r){let a=!1;this.serviceFile=r,(0,n3.default)(this.serviceFile,"failed to read package.json"),Ie.debug(r,"service file found"),r.name&&(this.defaults=this._parseNameProperty(this.serviceFile.name)),this.serviceFile.ampt=this.serviceFile.ampt||{},this.serviceFile.serverless&&(this.serviceFile.serverless.app=this.serviceFile.serverless.app||this.serviceFile.serverless.service,this.serviceFile.ampt.org||(this.serviceFile.ampt.org=this.serviceFile.serverless.org,a=!0),this.serviceFile.ampt.app||(this.serviceFile.ampt.app=this.serviceFile.serverless.app,a=!0)),(!this.serviceFile.ampt.org||this.serviceFile.ampt.org!==(t==null?void 0:t.orgName))&&(t!=null&&t.orgName)&&(this.serviceFile.ampt.org=t.orgName,a=!0),(!this.serviceFile.ampt.app||this.serviceFile.ampt.app!==(t==null?void 0:t.appName))&&(t!=null&&t.appName)&&(this.serviceFile.ampt.app=t.appName,a=!0),a&&await this.writeServiceFile();let u=((n=this.serviceFile)==null?void 0:n.dependencies)||{},c=((i=this.serviceFile)==null?void 0:i.devDependencies)||{},f=!!((o=(s=this.serviceFile)==null?void 0:s.scripts)!=null&&o["ampt:dev"])||!1;return{serviceFile:this.serviceFile,dependencies:u,devDependencies:c,hasDevScript:f}}Ie.info("service file not found")}async readDataFileIfExists(t){let{dataFileName:r}=t||{dataFileName:null};this.dataFileName=r||this.dataFileName;let n=r?Ur.default.join(this.serviceRoot,r):this.dataFilePath;return this.dataFile=await this.readJsonFileIfExists(n),this.dataFile}async readDataFile(){if(this.dataFile=await this.readDataFileIfExists(),!this.dataFile)throw new Error(`Data file "${this.dataFileName}" does not exist in the cwd`);return this.dataFile}async cloneFromServiceRepository(t){let{currentDir:r=!1,repoUrl:n}=t,i=["clone",n];r&&(i.push("."),this.deleteLogsDirectory());try{await(0,xa.default)("git",i)}catch(s){throw po(this,ya).captureException(s),new Error(`Failed to clone service repository due to the following error:
179
- ${s}`)}}async detectPackageManager(){let t=cr.default.existsSync(Ur.default.join(this.serviceRoot,"yarn.lock"));cr.default.existsSync(Ur.default.join(this.serviceRoot,"pnpm-lock.yaml"))?this.servicePackageManager="pnpm":t?this.servicePackageManager="yarn":this.servicePackageManager="npm"}async detectGit(){try{if((await(0,xa.default)("git",["--version"])).code===0)return!0}catch{return!1}}async detectVsCode(){try{if((await(0,xa.default)("code",["--version"])).code===0)return!0}catch{return!1}}detectNodeModules(){var t,r;if(this.nodeModulesInstalled===null){let n=cr.default.existsSync(Ur.default.join(this.serviceRoot,"node_modules")),i=((t=this.serviceFile)==null?void 0:t.dependencies)&&Object.keys(this.serviceFile.dependencies).length>0,s=((r=this.serviceFile)==null?void 0:r.devDependencies)&&Object.keys(this.serviceFile.devDependencies).length>0;if(!i&&!s){this.nodeModulesInstalled=!0;return}if(n){let o=cr.default.readdirSync(Ur.default.join(this.serviceRoot,"node_modules"));if(o.length===1&&o[0]==="@ampt"){this.nodeModulesInstalled=!1;return}}this.nodeModulesInstalled=n}return this.nodeModulesInstalled}async detectOutdatedAmptDependencies(){let t=await this.listAmptPackages();return(await Promise.all(t.map(async([n,i,s])=>{let o=await $E(n);if(!o)return;let a=Ur.default.join(this.serviceRoot,"node_modules",n),u=i;if(cr.default.existsSync(a)){let m=await(0,A0e.readFile)(Ur.default.join(a,"package.json"),{encoding:"utf8"});u=JSON.parse(m).version}let c=(0,tx.major)(u),f=(0,tx.major)(o),p=f>c&&f>1;if(o&&(0,tx.gt)(o,u))return{name:n,currentVersion:u,latestVersion:o,isDevDep:s,majorChange:p}}))).filter(n=>n!==void 0)}async updateOutdatedAmptDependencies(t,r){for(let n of r){let i=this.servicePackageManager;t.viewSpinner(`[${i}] Updating ${n.name} to ${n.latestVersion}`);try{let{command:s,additionalArgs:o}=this.getPackageManagerCommand("install",n.isDevDep);await(0,xa.default)(i,[s,`${n.name}@${n.latestVersion}`,...o],{cwd:this.serviceRoot})}catch(s){t.logError(`Failed to update ${n.name} to ${n.latestVersion} due to the following error:`),t.logError(s.message)}}}async runScriptIfExists(t){var r,n;try{(n=(r=this.serviceFile)==null?void 0:r.scripts)!=null&&n[t]&&await(0,xa.default)(this.servicePackageManager,["run",t],{cwd:this.serviceRoot})}catch(i){throw po(this,ya).captureException(i),new Error(`Failed to run script ${t} due to the following error:
179
+ ${s}`)}}async detectPackageManager(){let t=cr.default.existsSync(Ur.default.join(this.serviceRoot,"yarn.lock"));cr.default.existsSync(Ur.default.join(this.serviceRoot,"pnpm-lock.yaml"))?this.servicePackageManager="pnpm":t?this.servicePackageManager="yarn":this.servicePackageManager="npm"}async detectGit(){try{if((await(0,xa.default)("git",["--version"])).code===0)return!0}catch{return!1}}async detectVsCode(){try{if((await(0,xa.default)("code",["--version"])).code===0)return!0}catch{return!1}}detectNodeModules(){var t,r,n,i;if(this.nodeModulesInstalled===null&&this.serviceFile){let s=cr.default.existsSync(Ur.default.join(this.serviceRoot,"node_modules")),o=((t=this.serviceFile)==null?void 0:t.dependencies)&&Object.keys(((r=this.serviceFile)==null?void 0:r.dependencies)||{}).length>0,a=((n=this.serviceFile)==null?void 0:n.devDependencies)&&Object.keys(((i=this.serviceFile)==null?void 0:i.devDependencies)||{}).length>0;if(!o&&!a){this.nodeModulesInstalled=!0;return}if(s){let u=cr.default.readdirSync(Ur.default.join(this.serviceRoot,"node_modules"));if(u.length===1&&u[0]==="@ampt"){this.nodeModulesInstalled=!1;return}}this.nodeModulesInstalled=s}else this.serviceFile||(this.nodeModulesInstalled=!0);return this.nodeModulesInstalled}async detectOutdatedAmptDependencies(){let t=await this.listAmptPackages();return(await Promise.all(t.map(async([n,i,s])=>{let o=await $E(n);if(!o)return;let a=Ur.default.join(this.serviceRoot,"node_modules",n),u=i;if(cr.default.existsSync(a)){let m=await(0,A0e.readFile)(Ur.default.join(a,"package.json"),{encoding:"utf8"});u=JSON.parse(m).version}let c=(0,tx.major)(u),f=(0,tx.major)(o),p=f>c&&f>1;if(o&&(0,tx.gt)(o,u))return{name:n,currentVersion:u,latestVersion:o,isDevDep:s,majorChange:p}}))).filter(n=>n!==void 0)}async updateOutdatedAmptDependencies(t,r){for(let n of r){let i=this.servicePackageManager;t.viewSpinner(`[${i}] Updating ${n.name} to ${n.latestVersion}`);try{let{command:s,additionalArgs:o}=this.getPackageManagerCommand("install",n.isDevDep);await(0,xa.default)(i,[s,`${n.name}@${n.latestVersion}`,...o],{cwd:this.serviceRoot})}catch(s){t.logError(`Failed to update ${n.name} to ${n.latestVersion} due to the following error:`),t.logError(s.message)}}}async runScriptIfExists(t){var r,n;try{(n=(r=this.serviceFile)==null?void 0:r.scripts)!=null&&n[t]&&await(0,xa.default)(this.servicePackageManager,["run",t],{cwd:this.serviceRoot})}catch(i){throw po(this,ya).captureException(i),new Error(`Failed to run script ${t} due to the following error:
180
180
  ${i}`)}}async writeServiceFile(t){var i;let{serviceName:r,orgName:n}=t||{};return(0,n3.default)(this.serviceFile,"service file must be read before writing"),r&&(this.serviceFile.ampt.app=r),n&&(this.serviceFile.ampt.org=n),this.serviceFile.ampt.service&&delete this.serviceFile.ampt.service,(i=this.serviceFile.serverless)!=null&&i.service&&delete this.serviceFile.serverless.service,Ie.debug({...this.serviceFile},"writing service file"),await ex.default.writeJson(this.serviceFilePath,this.serviceFile,{spaces:2}),this.serviceFile}async writeDataFile(t){this.dataFile=t||this.dataFile,await ex.default.writeJson(this.dataFilePath,this.dataFile,{spaces:2})}_normalizePotentialGitUrl(t){return t.endsWith(".git")?t:`${t}.git`}async cloneGitRepo(t){try{this.deleteLogsDirectory(),await(0,xa.default)("git",["clone","--depth 1",t.repoUrl,"."],{cwd:this.serviceRoot,shell:!0}),this.deleteGitDirectory(),Ie.enable()}catch(r){throw po(this,ya).captureException(r),new Error(`Failed to clone git repo due to the following error:
181
- ${r}`)}}async initService({orgName:t,serviceName:r,template:n,existingProject:i}){if(Ie.debug({orgName:t,serviceName:r,template:n},"initializing service"),!await this.detectGit())throw new Zh;!i&&n&&n.url&&await this.cloneGitRepo({repoUrl:n.url}),await this.readServiceFileIfExists(),await this.writeServiceFile({orgName:t,serviceName:r})}async downloadUserTemplate(t){return new Promise((r,n)=>{(0,I0e.default)(`direct:${t}`,this.serviceRoot,{clone:!0},i=>i?n(i):r(void 0))})}async downloadCoreTemplate(t="default"){let o=`https://raw.githubusercontent.com/getampt/templates/build/build/${t}.zip`,a=await(0,S0e.default)(o);new E0e.default(a).extractAllTo(this.serviceRoot)}async installDependenciesIfExists(t){let{cleanInstall:r=!0}=t||{},n=this.serviceFile.dependencies&&Object.keys(this.serviceFile.dependencies).length!==0,i=this.serviceFile.devDependencies&&Object.keys(this.serviceFile.devDependencies).length!==0;if(n||i)try{r&&cr.default.rmSync(Ur.default.join(this.serviceRoot,"node_modules"),{recursive:!0,force:!0});let s=this.servicePackageManager;await(0,xa.default)(s,["install"],{cwd:this.serviceRoot})}catch(s){po(this,ya).captureException(s);let o=s.message||s.stdBuffer.toString();throw new Error(`Failed to install app dependencies due to the following error:
182
- ${o}`)}}async installDependency(t,r=!1){try{let n=this.servicePackageManager,{command:i,additionalArgs:s}=this.getPackageManagerCommand("install",r),o=Array.isArray(t)?t:[t];await(0,xa.default)(n,[i,...o,...s],{cwd:this.serviceRoot})}catch(n){po(this,ya).captureException(n);let i=n.stdBuffer.toString(),s=i!=null&&i.length?`Failed to install ${t} due to the following error:
181
+ ${r}`)}}async initService({orgName:t,serviceName:r,template:n,existingProject:i}){if(Ie.debug({orgName:t,serviceName:r,template:n},"initializing service"),!await this.detectGit())throw new Zh;!i&&n&&n.url&&await this.cloneGitRepo({repoUrl:n.url}),await this.readServiceFileIfExists(),await this.writeServiceFile({orgName:t,serviceName:r})}async downloadUserTemplate(t){return new Promise((r,n)=>{(0,I0e.default)(`direct:${t}`,this.serviceRoot,{clone:!0},i=>i?n(i):r(void 0))})}async downloadCoreTemplate(t="default"){let o=`https://raw.githubusercontent.com/getampt/templates/build/build/${t}.zip`,a=await(0,S0e.default)(o);new E0e.default(a).extractAllTo(this.serviceRoot)}async installDependenciesIfExists(t){let{cleanInstall:r=!0}=t||{};if(this.serviceFile&&this.serviceRoot){let n=this.serviceFile.dependencies&&Object.keys(this.serviceFile.dependencies).length!==0,i=this.serviceFile.devDependencies&&Object.keys(this.serviceFile.devDependencies).length!==0;if(n||i)try{r&&cr.default.rmSync(Ur.default.join(this.serviceRoot,"node_modules"),{recursive:!0,force:!0});let s=this.servicePackageManager;await(0,xa.default)(s,["install"],{cwd:this.serviceRoot})}catch(s){po(this,ya).captureException(s);let o=s.message||s.stdBuffer.toString();throw new Error(`Failed to install app dependencies due to the following error:
182
+ ${o}`)}}}async installDependency(t,r=!1){try{let n=this.servicePackageManager,{command:i,additionalArgs:s}=this.getPackageManagerCommand("install",r),o=Array.isArray(t)?t:[t];await(0,xa.default)(n,[i,...o,...s],{cwd:this.serviceRoot})}catch(n){po(this,ya).captureException(n);let i=n.stdBuffer.toString(),s=i!=null&&i.length?`Failed to install ${t} due to the following error:
183
183
  ${i}`:`Failed to install ${t}`;throw new Error(s)}}async removeDependency(t,r=!1){try{let n=this.servicePackageManager,{command:i,additionalArgs:s}=this.getPackageManagerCommand("uninstall",r),o=Array.isArray(t)?t:[t];await(0,xa.default)(n,[i,...o,...s],{cwd:this.serviceRoot})}catch(n){po(this,ya).captureException(n);let i=n.stdBuffer.toString();throw new Error(`Failed to remove ${t} the following error:
184
184
  ${i}`)}}getPackageManagerCommand(t,r=!1){let n=this.servicePackageManager,i=n!=="npm"?"add":"install",s=n!=="npm"?"remove":"uninstall",o=n!=="npm"?[]:[r?"--save-dev":"--save"];return r&&n!=="npm"&&o.push("-D"),{command:t==="install"?i:s,additionalArgs:o}}_parseNameProperty(t){let{scope:r,fullName:n}=(0,C0e.default)(t);return{org:r,app:n}}watch(t,r){this.setIgnoredFiles();let n=T0e.default.watch(t,{ignored:[/node_modules\//,/\.git\//,/\.ampt\//],cwd:t}),i=new Set,s=(0,O0e.default)(()=>{let a=new Set(i);r(a),i.clear()},50,!1),o=a=>{a&&this.ignored.ignores(a)||(Ie.trace({filePath:a},"watcher event"),i.add(a),s())};n.on("ready",()=>{n.on("add",o),n.on("change",o),n.on("unlink",o)})}excludes(t){return this.exclude.ignores(t)}hash(t,r,n){let i=Math.ceil((t.length+1)/ZTt.length)*2,s=(0,R0e.default)(t,i),o=s.length;return(0,q0e.default)(s.map(a=>async()=>{if(a.length===0)return[];let u=new k0e.Worker(JTt,{execArgv:[]}),c=process.hrtime();try{return this.verbose?Ie.info({workspaceRoot:r,task:a},"worker hashing files"):Ie.debug({workspaceRoot:r,task:a},"worker hashing files"),await new Promise((f,p)=>{u.on("message",({err:d,res:m})=>{d?p(d):f(m)}),u.on("error",d=>{p(d)}),u.postMessage({workspaceRoot:r,task:a})})}finally{o--,o===0&&n&&n();let f=process.hrtime(c),p=f[0]*1e3+f[1]/1e6;this.verbose?Ie.info({ms:p},"worker hashing files duration"):Ie.debug({ms:p},"worker hashing files duration"),u.removeAllListeners(),await u.terminate(),u.unref()}},{concurrency:i}))}};ya=new WeakMap,rx=new WeakMap});async function*P0e(e,t){let r=Buffer.alloc(em),n=Buffer.from(JSON.stringify({entries:e})),i=n.length;r.writeInt32BE(i,0);let s=[r,n],o=r.length+n.length,a=new Set(Object.values(e).map(u=>u.hash));for await(let u of t)for(let{hash:c,data:f}of u)if(a.has(c)){a.delete(c);let p=Buffer.alloc(J1);p.writeInt32BE(f.length,0);let d=Buffer.from(c,"hex");if(d.length!==D0e)throw new Error("Bad hash");d.copy(p,em),s.push(p),s.push(f),o+=p.length+f.length,o>256*1024&&(yield Buffer.concat(s),s=[],o=0)}if(a.size>0)throw new Error(`Missing ${a.size} records: ${Array.from(a).slice(0,10).join(", ")}`);s.length&&(yield Buffer.concat(s))}var Q1,em,D0e,J1,nx,L0e=ae(()=>{"use strict";Q1=require("stream"),em=4,D0e=16,J1=em+D0e;nx=class e{entries={};contents={};static async from(t){let r=new e;for await(let n of t)for(let{name:i,hash:s,mode:o,data:a}of n)r.entries[i]={hash:s,mode:o},r.contents[s]=a;return r}static parse(t,r=1e3){let n={},i=[],s=[],o=0,a=0,u=0,c={},f,p="";function d(v){let y=Buffer.alloc(v);for(let b=v;b>0;){let _=s.shift();if(_)b>=_.length?(_.copy(y,v-b),b-=_.length):(_.copy(y,v-b,0,b),s.unshift(_.subarray(b)),b=0);else throw new Error("Not enough data")}return a-=v,y}let m=new Q1.Transform({objectMode:!0,transform(v,y,b){s.push(v),a+=v.length;try{if(o===0&&a>=em&&(u=d(em).readInt32BE(0),o=1),o===1&&a>=u){let E=d(u).toString("utf8");c=JSON.parse(E).entries;for(let[w,{hash:C}]of Object.entries(c))n[C]=n[C]||[],n[C].push(w);o=2}if(o===2){let _=a>=(f===void 0?J1:f);for(;_;)if(f===void 0){let E=d(J1);f=E.readInt32BE(0),p=E.toString("hex",em),_=a>=f}else{let E=d(f),S=n[p];if(S)for(let w of S){let{hash:C,mode:I}=c[w];i.push({name:w,hash:C,mode:I,data:E})}else throw new Error("Unexpected content with no entry pointing to it");f=void 0,p="",_=a>=J1}}for(;i.length>=r;)this.push(i.splice(0,r));b()}catch(_){b(_)}},flush(v){i.length?v(null,i):v()}});return t.on("error",v=>{v.code==="NoSuchKey"?(m.push(null),m.destroy()):m.destroy(v)}),t.pipe(m)}static concat(t,r){let n=new e;n.entries=t;let i=Q1.Readable.from(P0e(t,async function*(){for(let s of r)for await(let o of s){for(let{hash:a,data:u}of o)n.contents[a]=u;yield o}}()),{objectMode:!1});return Object.assign(i,{result:n}),i}getEntries(){return this.entries}getContents(){return this.contents}*content(t=1e3){let r=[];for(let[n,i]of Object.entries(this.contents))r.push({hash:n,data:i}),r.length===t&&(yield r,r=[]);r.length&&(yield r)}async toBuffer(){let t=[];for await(let r of P0e(this.entries,this.content()))t.push(r);return Buffer.concat(t)}}});var tT=g((uur,M0e)=>{var s3=Xr();function F0e(){}F0e.prototype.build=function(e,t){return JSON.stringify(eT(e,t))};function eT(e,t){if(!(!t||e===void 0||e===null))switch(t.type){case"structure":return QTt(e,t);case"map":return tCt(e,t);case"list":return eCt(e,t);default:return rCt(e,t)}}function QTt(e,t){if(t.isDocument)return e;var r={};return s3.each(e,function(n,i){var s=t.members[n];if(s){if(s.location!=="body")return;var o=s.isLocationName?s.name:n,a=eT(i,s);a!==void 0&&(r[o]=a)}}),r}function eCt(e,t){var r=[];return s3.arrayEach(e,function(n){var i=eT(n,t.member);i!==void 0&&r.push(i)}),r}function tCt(e,t){var r={};return s3.each(e,function(n,i){var s=eT(i,t.value);s!==void 0&&(r[n]=s)}),r}function rCt(e,t){return t.toWireFormat(e)}M0e.exports=F0e});var nT=g((cur,B0e)=>{var o3=Xr();function j0e(){}j0e.prototype.parse=function(e,t){return rT(JSON.parse(e),t)};function rT(e,t){if(!(!t||e===void 0))switch(t.type){case"structure":return nCt(e,t);case"map":return sCt(e,t);case"list":return iCt(e,t);default:return oCt(e,t)}}function nCt(e,t){if(e!=null){if(t.isDocument)return e;var r={},n=t.members,i=t.api&&t.api.awsQueryCompatible;return o3.each(n,function(s,o){var a=o.isLocationName?o.name:s;if(Object.prototype.hasOwnProperty.call(e,a)){var u=e[a],c=rT(u,o);c!==void 0&&(r[s]=c)}else i&&o.defaultValue&&o.type==="list"&&(r[s]=typeof o.defaultValue=="function"?o.defaultValue():o.defaultValue)}),r}}function iCt(e,t){if(e!=null){var r=[];return o3.arrayEach(e,function(n){var i=rT(n,t.member);i===void 0?r.push(null):r.push(i)}),r}}function sCt(e,t){if(e!=null){var r={};return o3.each(e,function(n,i){var s=rT(i,t.value);s===void 0?r[n]=null:r[n]=s}),r}}function oCt(e,t){return t.toType(e)}B0e.exports=j0e});var iT=g((lur,U0e)=>{var ix=Xr(),aCt=De();function uCt(e){var t=e.service.config.hostPrefixEnabled;if(!t)return e;var r=e.service.api.operations[e.operation];if(cCt(e))return e;if(r.endpoint&&r.endpoint.hostPrefix){var n=r.endpoint.hostPrefix,i=lCt(n,e.params,r.input);fCt(e.httpRequest.endpoint,i),pCt(e.httpRequest.endpoint.hostname)}return e}function cCt(e){var t=e.service.api,r=t.operations[e.operation],n=t.endpointOperation&&t.endpointOperation===ix.string.lowerFirst(r.name);return r.endpointDiscoveryRequired!=="NULL"||n===!0}function lCt(e,t,r){return ix.each(r.members,function(n,i){if(i.hostLabel===!0){if(typeof t[n]!="string"||t[n]==="")throw ix.error(new Error,{message:"Parameter "+n+" should be a non-empty string.",code:"InvalidParameter"});var s=new RegExp("\\{"+n+"\\}","g");e=e.replace(s,t[n])}}),e}function fCt(e,t){e.host&&(e.host=t+e.host),e.hostname&&(e.hostname=t+e.hostname)}function pCt(e){var t=e.split("."),r=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;ix.arrayEach(t,function(n){if(!n.length||n.length<1||n.length>63)throw ix.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!r.test(n))throw aCt.util.error(new Error,{code:"ValidationError",message:n+" is not hostname compatible."})})}U0e.exports={populateHostPrefix:uCt}});var sT=g((fur,$0e)=>{var dCt=Xr(),hCt=tT(),mCt=nT(),gCt=iT().populateHostPrefix;function vCt(e){var t=e.httpRequest,r=e.service.api,n=r.targetPrefix+"."+r.operations[e.operation].name,i=r.jsonVersion||"1.0",s=r.operations[e.operation].input,o=new hCt;i===1&&(i="1.0"),r.awsQueryCompatible&&(t.params||(t.params={}),Object.assign(t.params,e.params)),t.body=o.build(e.params||{},s),t.headers["Content-Type"]="application/x-amz-json-"+i,t.headers["X-Amz-Target"]=n,gCt(e)}function xCt(e){var t={},r=e.httpResponse;if(t.code=r.headers["x-amzn-errortype"]||"UnknownError",typeof t.code=="string"&&(t.code=t.code.split(":")[0]),r.body.length>0)try{var n=JSON.parse(r.body.toString()),i=n.__type||n.code||n.Code;i&&(t.code=i.split("#").pop()),t.code==="RequestEntityTooLarge"?t.message="Request body must be less than 1 MB":t.message=n.message||n.Message||null;for(var s in n||{})s==="code"||s==="message"||(t["["+s+"]"]="See error."+s+" for details.",Object.defineProperty(t,s,{value:n[s],enumerable:!1,writable:!0}))}catch{t.statusCode=r.statusCode,t.message=r.statusMessage}else t.statusCode=r.statusCode,t.message=r.statusCode.toString();e.error=dCt.error(new Error,t)}function yCt(e){var t=e.httpResponse.body.toString()||"{}";if(e.request.service.config.convertResponseTypes===!1)e.data=JSON.parse(t);else{var r=e.request.service.api.operations[e.request.operation],n=r.output||{},i=new mCt;e.data=i.parse(t,n)}}$0e.exports={buildRequest:vCt,extractError:xCt,extractData:yCt}});var V0e=g((pur,G0e)=>{var a3=Xr();function H0e(){}H0e.prototype.serialize=function(e,t,r){z0e("",e,t,r)};function W0e(e){return e.isQueryName||e.api.protocol!=="ec2"?e.name:e.name[0].toUpperCase()+e.name.substr(1)}function z0e(e,t,r,n){a3.each(r.members,function(i,s){var o=t[i];if(o!=null){var a=W0e(s);a=e?e+"."+a:a,oT(a,o,s,n)}})}function _Ct(e,t,r,n){var i=1;a3.each(t,function(s,o){var a=r.flattened?".":".entry.",u=a+i+++".",c=u+(r.key.name||"key"),f=u+(r.value.name||"value");oT(e+c,s,r.key,n),oT(e+f,o,r.value,n)})}function bCt(e,t,r,n){var i=r.member||{};if(t.length===0){n.call(this,e,null);return}a3.arrayEach(t,function(s,o){var a="."+(o+1);if(r.api.protocol==="ec2")a=a+"";else if(r.flattened){if(i.name){var u=e.split(".");u.pop(),u.push(W0e(i)),e=u.join(".")}}else a="."+(i.name?i.name:"member")+a;oT(e+a,s,i,n)})}function oT(e,t,r,n){t!=null&&(r.type==="structure"?z0e(e,t,r,n):r.type==="list"?bCt(e,t,r,n):r.type==="map"?_Ct(e,t,r,n):n(e,r.toWireFormat(t).toString()))}G0e.exports=H0e});var u3=g((dur,K0e)=>{var wCt=Xr().memoizedProperty;function ECt(e,t,r,n){wCt(this,n(e),function(){return r(e,t)})}function SCt(e,t,r,n,i){n=n||String;var s=this;for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(ECt.call(s,o,e[o],r,n),i&&i(o,e[o]))}K0e.exports=SCt});var sx=g((hur,rxe)=>{var TCt=u3(),Au=Xr();function Be(e,t,r){r!=null&&Au.property.apply(this,arguments)}function Kf(e,t){e.constructor.prototype[t]||Au.memoizedProperty.apply(this,arguments)}function Tr(e,t,r){t=t||{},Be(this,"shape",e.shape),Be(this,"api",t.api,!1),Be(this,"type",e.type),Be(this,"enum",e.enum),Be(this,"min",e.min),Be(this,"max",e.max),Be(this,"pattern",e.pattern),Be(this,"location",e.location||this.location||"body"),Be(this,"name",this.name||e.xmlName||e.queryName||e.locationName||r),Be(this,"isStreaming",e.streaming||this.isStreaming||!1),Be(this,"requiresLength",e.requiresLength,!1),Be(this,"isComposite",e.isComposite||!1),Be(this,"isShape",!0,!1),Be(this,"isQueryName",!!e.queryName,!1),Be(this,"isLocationName",!!e.locationName,!1),Be(this,"isIdempotent",e.idempotencyToken===!0),Be(this,"isJsonValue",e.jsonvalue===!0),Be(this,"isSensitive",e.sensitive===!0||e.prototype&&e.prototype.sensitive===!0),Be(this,"isEventStream",!!e.eventstream,!1),Be(this,"isEvent",!!e.event,!1),Be(this,"isEventPayload",!!e.eventpayload,!1),Be(this,"isEventHeader",!!e.eventheader,!1),Be(this,"isTimestampFormatSet",!!e.timestampFormat||e.prototype&&e.prototype.isTimestampFormatSet===!0,!1),Be(this,"endpointDiscoveryId",!!e.endpointdiscoveryid,!1),Be(this,"hostLabel",!!e.hostLabel,!1),t.documentation&&(Be(this,"documentation",e.documentation),Be(this,"documentationUrl",e.documentationUrl)),e.xmlAttribute&&Be(this,"isXmlAttribute",e.xmlAttribute||!1),Be(this,"defaultValue",null),this.toWireFormat=function(n){return n??""},this.toType=function(n){return n}}Tr.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"};Tr.types={structure:X0e,list:Y0e,map:Z0e,boolean:txe,timestamp:CCt,float:ACt,integer:OCt,string:J0e,base64:exe,binary:Q0e};Tr.resolve=function(t,r){if(t.shape){var n=r.api.shapes[t.shape];if(!n)throw new Error("Cannot find shape reference: "+t.shape);return n}else return null};Tr.create=function(t,r,n){if(t.isShape)return t;var i=Tr.resolve(t,r);if(i){var s=Object.keys(t);r.documentation||(s=s.filter(function(u){return!u.match(/documentation/)}));var o=function(){i.constructor.call(this,t,r,n)};return o.prototype=i,new o}else{t.type||(t.members?t.type="structure":t.member?t.type="list":t.key?t.type="map":t.type="string");var a=t.type;if(Tr.normalizedTypes[t.type]&&(t.type=Tr.normalizedTypes[t.type]),Tr.types[t.type])return new Tr.types[t.type](t,r,n);throw new Error("Unrecognized shape type: "+a)}};function c3(e){Tr.apply(this,arguments),Be(this,"isComposite",!0),e.flattened&&Be(this,"flattened",e.flattened||!1)}function X0e(e,t){var r=this,n=null,i=!this.isShape;c3.apply(this,arguments),i&&(Be(this,"defaultValue",function(){return{}}),Be(this,"members",{}),Be(this,"memberNames",[]),Be(this,"required",[]),Be(this,"isRequired",function(){return!1}),Be(this,"isDocument",!!e.document)),e.members&&(Be(this,"members",new TCt(e.members,t,function(s,o){return Tr.create(o,t,s)})),Kf(this,"memberNames",function(){return e.xmlOrder||Object.keys(e.members)}),e.event&&(Kf(this,"eventPayloadMemberName",function(){for(var s=r.members,o=r.memberNames,a=0,u=o.length;a<u;a++)if(s[o[a]].isEventPayload)return o[a]}),Kf(this,"eventHeaderMemberNames",function(){for(var s=r.members,o=r.memberNames,a=[],u=0,c=o.length;u<c;u++)s[o[u]].isEventHeader&&a.push(o[u]);return a}))),e.required&&(Be(this,"required",e.required),Be(this,"isRequired",function(s){if(!n){n={};for(var o=0;o<e.required.length;o++)n[e.required[o]]=!0}return n[s]},!1,!0)),Be(this,"resultWrapper",e.resultWrapper||null),e.payload&&Be(this,"payload",e.payload),typeof e.xmlNamespace=="string"?Be(this,"xmlNamespaceUri",e.xmlNamespace):typeof e.xmlNamespace=="object"&&(Be(this,"xmlNamespacePrefix",e.xmlNamespace.prefix),Be(this,"xmlNamespaceUri",e.xmlNamespace.uri))}function Y0e(e,t){var r=this,n=!this.isShape;if(c3.apply(this,arguments),n&&Be(this,"defaultValue",function(){return[]}),e.member&&Kf(this,"member",function(){return Tr.create(e.member,t)}),this.flattened){var i=this.name;Kf(this,"name",function(){return r.member.name||i})}}function Z0e(e,t){var r=!this.isShape;c3.apply(this,arguments),r&&(Be(this,"defaultValue",function(){return{}}),Be(this,"key",Tr.create({type:"string"},t)),Be(this,"value",Tr.create({type:"string"},t))),e.key&&Kf(this,"key",function(){return Tr.create(e.key,t)}),e.value&&Kf(this,"value",function(){return Tr.create(e.value,t)})}function CCt(e){var t=this;if(Tr.apply(this,arguments),e.timestampFormat)Be(this,"timestampFormat",e.timestampFormat);else if(t.isTimestampFormatSet&&this.timestampFormat)Be(this,"timestampFormat",this.timestampFormat);else if(this.location==="header")Be(this,"timestampFormat","rfc822");else if(this.location==="querystring")Be(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":Be(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":Be(this,"timestampFormat","iso8601");break}this.toType=function(r){return r==null?null:typeof r.toUTCString=="function"?r:typeof r=="string"||typeof r=="number"?Au.date.parseTimestamp(r):null},this.toWireFormat=function(r){return Au.date.format(r,t.timestampFormat)}}function J0e(){Tr.apply(this,arguments);var e=["rest-xml","query","ec2"];this.toType=function(t){return t=this.api&&e.indexOf(this.api.protocol)>-1?t||"":t,this.isJsonValue?JSON.parse(t):t&&typeof t.toString=="function"?t.toString():t},this.toWireFormat=function(t){return this.isJsonValue?JSON.stringify(t):t}}function ACt(){Tr.apply(this,arguments),this.toType=function(e){return e==null?null:parseFloat(e)},this.toWireFormat=this.toType}function OCt(){Tr.apply(this,arguments),this.toType=function(e){return e==null?null:parseInt(e,10)},this.toWireFormat=this.toType}function Q0e(){Tr.apply(this,arguments),this.toType=function(e){var t=Au.base64.decode(e);if(this.isSensitive&&Au.isNode()&&typeof Au.Buffer.alloc=="function"){var r=Au.Buffer.alloc(t.length,t);t.fill(0),t=r}return t},this.toWireFormat=Au.base64.encode}function exe(){Q0e.apply(this,arguments)}function txe(){Tr.apply(this,arguments),this.toType=function(e){return typeof e=="boolean"?e:e==null?null:e==="true"}}Tr.shapes={StructureShape:X0e,ListShape:Y0e,MapShape:Z0e,StringShape:J0e,BooleanShape:txe,Base64Shape:exe};rxe.exports=Tr});var l3=g((mur,sxe)=>{var ixe=De(),ox=Xr(),ICt=V0e(),nxe=sx(),RCt=iT().populateHostPrefix;function NCt(e){var t=e.service.api.operations[e.operation],r=e.httpRequest;r.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",r.params={Version:e.service.api.apiVersion,Action:t.name};var n=new ICt;n.serialize(e.params,t.input,function(i,s){r.params[i]=s}),r.body=ox.queryParamsToString(r.params),RCt(e)}function kCt(e){var t,r=e.httpResponse.body.toString();if(r.match("<UnknownOperationException"))t={Code:"UnknownOperation",Message:"Unknown operation "+e.request.operation};else try{t=new ixe.XML.Parser().parse(r)}catch{t={Code:e.httpResponse.statusCode,Message:e.httpResponse.statusMessage}}t.requestId&&!e.requestId&&(e.requestId=t.requestId),t.Errors&&(t=t.Errors),t.Error&&(t=t.Error),t.Code?e.error=ox.error(new Error,{code:t.Code,message:t.Message}):e.error=ox.error(new Error,{code:e.httpResponse.statusCode,message:null})}function qCt(e){var t=e.request,r=t.service.api.operations[t.operation],n=r.output||{},i=n;if(i.resultWrapper){var s=nxe.create({type:"structure"});s.members[i.resultWrapper]=n,s.memberNames=[i.resultWrapper],ox.property(n,"name",n.resultWrapper),n=s}var o=new ixe.XML.Parser;if(n&&n.members&&!n.members._XAMZRequestId){var a=nxe.create({type:"string"},{api:{protocol:"query"}},"requestId");n.members._XAMZRequestId=a}var u=o.parse(e.httpResponse.body.toString(),n);e.requestId=u._XAMZRequestId||u.requestId,u._XAMZRequestId&&delete u._XAMZRequestId,i.resultWrapper&&u[i.resultWrapper]&&(ox.update(u,u[i.resultWrapper]),delete u[i.resultWrapper]),e.data=u}sxe.exports={buildRequest:NCt,extractError:kCt,extractData:qCt}});var ax=g((gur,axe)=>{var Vn=Xr(),PCt=iT().populateHostPrefix;function DCt(e){e.httpRequest.method=e.service.api.operations[e.operation].httpMethod}function oxe(e,t,r,n){var i=[e,t].join("/");i=i.replace(/\/+/g,"/");var s={},o=!1;if(Vn.each(r.members,function(u,c){var f=n[u];if(f!=null)if(c.location==="uri"){var p=new RegExp("\\{"+c.name+"(\\+)?\\}");i=i.replace(p,function(d,m){var v=m?Vn.uriEscapePath:Vn.uriEscape;return v(String(f))})}else c.location==="querystring"&&(o=!0,c.type==="list"?s[c.name]=f.map(function(d){return Vn.uriEscape(c.member.toWireFormat(d).toString())}):c.type==="map"?Vn.each(f,function(d,m){Array.isArray(m)?s[d]=m.map(function(v){return Vn.uriEscape(String(v))}):s[d]=Vn.uriEscape(String(m))}):s[c.name]=Vn.uriEscape(c.toWireFormat(f).toString()))}),o){i+=i.indexOf("?")>=0?"&":"?";var a=[];Vn.arrayEach(Object.keys(s).sort(),function(u){Array.isArray(s[u])||(s[u]=[s[u]]);for(var c=0;c<s[u].length;c++)a.push(Vn.uriEscape(String(u))+"="+s[u][c])}),i+=a.join("&")}return i}function LCt(e){var t=e.service.api.operations[e.operation],r=t.input,n=oxe(e.httpRequest.endpoint.path,t.httpPath,r,e.params);e.httpRequest.path=n}function FCt(e){var t=e.service.api.operations[e.operation];Vn.each(t.input.members,function(r,n){var i=e.params[r];i!=null&&(n.location==="headers"&&n.type==="map"?Vn.each(i,function(s,o){e.httpRequest.headers[n.name+s]=o}):n.location==="header"&&(i=n.toWireFormat(i).toString(),n.isJsonValue&&(i=Vn.base64.encode(i)),e.httpRequest.headers[n.name]=i))})}function MCt(e){DCt(e),LCt(e),FCt(e),PCt(e)}function jCt(){}function BCt(e){var t=e.request,r={},n=e.httpResponse,i=t.service.api.operations[t.operation],s=i.output,o={};Vn.each(n.headers,function(a,u){o[a.toLowerCase()]=u}),Vn.each(s.members,function(a,u){var c=(u.name||a).toLowerCase();if(u.location==="headers"&&u.type==="map"){r[a]={};var f=u.isLocationName?u.name:"",p=new RegExp("^"+f+"(.+)","i");Vn.each(n.headers,function(m,v){var y=m.match(p);y!==null&&(r[a][y[1]]=v)})}else if(u.location==="header"){if(o[c]!==void 0){var d=u.isJsonValue?Vn.base64.decode(o[c]):o[c];r[a]=u.toType(d)}}else u.location==="statusCode"&&(r[a]=parseInt(n.statusCode,10))}),e.data=r}axe.exports={buildRequest:MCt,extractError:jCt,extractData:BCt,generateURI:oxe}});var d3=g((vur,pxe)=>{var p3=Xr(),cxe=ax(),lxe=sT(),UCt=tT(),uxe=nT(),fxe=["GET","HEAD","DELETE"];function $Ct(e){var t=p3.getRequestPayloadShape(e);t===void 0&&fxe.indexOf(e.httpRequest.method)>=0&&delete e.httpRequest.headers["Content-Length"]}function HCt(e){var t=new UCt,r=e.service.api.operations[e.operation].input;if(r.payload){var n={},i=r.members[r.payload];n=e.params[r.payload],i.type==="structure"?(e.httpRequest.body=t.build(n||{},i),f3(e)):n!==void 0&&(e.httpRequest.body=n,(i.type==="binary"||i.isStreaming)&&f3(e,!0))}else e.httpRequest.body=t.build(e.params,r),f3(e)}function f3(e,t){if(!e.httpRequest.headers["Content-Type"]){var r=t?"binary/octet-stream":"application/json";e.httpRequest.headers["Content-Type"]=r}}function WCt(e){cxe.buildRequest(e),fxe.indexOf(e.httpRequest.method)<0&&HCt(e)}function zCt(e){lxe.extractError(e)}function GCt(e){cxe.extractData(e);var t=e.request,r=t.service.api.operations[t.operation],n=t.service.api.operations[t.operation].output||{},i,s=r.hasEventOutput;if(n.payload){var o=n.members[n.payload],a=e.httpResponse.body;if(o.isEventStream)i=new uxe,e.data[payload]=p3.createEventStream(AWS.HttpClient.streamsApiVersion===2?e.httpResponse.stream:a,i,o);else if(o.type==="structure"||o.type==="list"){var i=new uxe;e.data[n.payload]=i.parse(a,o)}else o.type==="binary"||o.isStreaming?e.data[n.payload]=a:e.data[n.payload]=o.toType(a)}else{var u=e.data;lxe.extractData(e),e.data=p3.merge(u,e.data)}}pxe.exports={buildRequest:WCt,extractError:zCt,extractData:GCt,unsetContentLength:$Ct}});var m3=g((xur,dxe)=>{var tm=De(),ux=Xr(),h3=ax();function VCt(e){var t=e.service.api.operations[e.operation].input,r=new tm.XML.Builder,n=e.params,i=t.payload;if(i){var s=t.members[i];if(n=n[i],n===void 0)return;if(s.type==="structure"){var o=s.name;e.httpRequest.body=r.toXML(n,s,o,!0)}else e.httpRequest.body=n}else e.httpRequest.body=r.toXML(n,t,t.name||t.shape||ux.string.upperFirst(e.operation)+"Request")}function KCt(e){h3.buildRequest(e),["GET","HEAD"].indexOf(e.httpRequest.method)<0&&VCt(e)}function XCt(e){h3.extractError(e);var t;try{t=new tm.XML.Parser().parse(e.httpResponse.body.toString())}catch{t={Code:e.httpResponse.statusCode,Message:e.httpResponse.statusMessage}}t.Errors&&(t=t.Errors),t.Error&&(t=t.Error),t.Code?e.error=ux.error(new Error,{code:t.Code,message:t.Message}):e.error=ux.error(new Error,{code:e.httpResponse.statusCode,message:null})}function YCt(e){h3.extractData(e);var t,r=e.request,n=e.httpResponse.body,i=r.service.api.operations[r.operation],s=i.output,o=i.hasEventOutput,a=s.payload;if(a){var u=s.members[a];u.isEventStream?(t=new tm.XML.Parser,e.data[a]=ux.createEventStream(tm.HttpClient.streamsApiVersion===2?e.httpResponse.stream:e.httpResponse.body,t,u)):u.type==="structure"?(t=new tm.XML.Parser,e.data[a]=t.parse(n.toString(),u)):u.type==="binary"||u.isStreaming?e.data[a]=n:e.data[a]=u.toType(n)}else if(n.length>0){t=new tm.XML.Parser;var c=t.parse(n.toString(),s);ux.update(e.data,c)}}dxe.exports={buildRequest:KCt,extractError:XCt,extractData:YCt}});var mxe=g((yur,hxe)=>{function ZCt(e){return e.replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}hxe.exports={escapeAttribute:ZCt}});var vxe=g((_ur,gxe)=>{var JCt=mxe().escapeAttribute;function cx(e,t){t===void 0&&(t=[]),this.name=e,this.children=t,this.attributes={}}cx.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this};cx.prototype.addChildNode=function(e){return this.children.push(e),this};cx.prototype.removeAttribute=function(e){return delete this.attributes[e],this};cx.prototype.toString=function(){for(var e=!!this.children.length,t="<"+this.name,r=this.attributes,n=0,i=Object.keys(r);n<i.length;n++){var s=i[n],o=r[s];typeof o<"u"&&o!==null&&(t+=" "+s+'="'+JCt(""+o)+'"')}return t+=e?">"+this.children.map(function(a){return a.toString()}).join("")+"</"+this.name+">":"/>"};gxe.exports={XmlNode:cx}});var yxe=g((bur,xxe)=>{function QCt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#x0D;").replace(/\n/g,"&#x0A;").replace(/\u0085/g,"&#x85;").replace(/\u2028/,"&#x2028;")}xxe.exports={escapeElement:QCt}});var wxe=g((wur,bxe)=>{var eAt=yxe().escapeElement;function _xe(e){this.value=e}_xe.prototype.toString=function(){return eAt(""+this.value)};bxe.exports={XmlText:_xe}});var Cxe=g((Eur,Txe)=>{var aT=Xr(),Xf=vxe().XmlNode,tAt=wxe().XmlText;function Exe(){}Exe.prototype.toXML=function(e,t,r,n){var i=new Xf(r);return Sxe(i,t,!0),Yf(i,e,t),i.children.length>0||n?i.toString():""};function Yf(e,t,r){switch(r.type){case"structure":return rAt(e,t,r);case"map":return nAt(e,t,r);case"list":return iAt(e,t,r);default:return sAt(e,t,r)}}function rAt(e,t,r){aT.arrayEach(r.memberNames,function(n){var i=r.members[n];if(i.location==="body"){var s=t[n],o=i.name;if(s!=null)if(i.isXmlAttribute)e.addAttribute(o,s);else if(i.flattened)Yf(e,s,i);else{var a=new Xf(o);e.addChildNode(a),Sxe(a,i),Yf(a,s,i)}}})}function nAt(e,t,r){var n=r.key.name||"key",i=r.value.name||"value";aT.each(t,function(s,o){var a=new Xf(r.flattened?r.name:"entry");e.addChildNode(a);var u=new Xf(n),c=new Xf(i);a.addChildNode(u),a.addChildNode(c),Yf(u,s,r.key),Yf(c,o,r.value)})}function iAt(e,t,r){r.flattened?aT.arrayEach(t,function(n){var i=r.member.name||r.name,s=new Xf(i);e.addChildNode(s),Yf(s,n,r.member)}):aT.arrayEach(t,function(n){var i=r.member.name||"member",s=new Xf(i);e.addChildNode(s),Yf(s,n,r.member)})}function sAt(e,t,r){e.addChildNode(new tAt(r.toWireFormat(t)))}function Sxe(e,t,r){var n,i="xmlns";t.xmlNamespaceUri?(n=t.xmlNamespaceUri,t.xmlNamespacePrefix&&(i+=":"+t.xmlNamespacePrefix)):r&&t.api.xmlNamespaceUri&&(n=t.api.xmlNamespaceUri),n&&e.addAttribute(i,n)}Txe.exports=Exe});var g3=g((Sur,Oxe)=>{var lx=sx(),Axe=Xr(),_a=Axe.property,rm=Axe.memoizedProperty;function oAt(e,t,r){var n=this;r=r||{},_a(this,"name",t.name||e),_a(this,"api",r.api,!1),t.http=t.http||{},_a(this,"endpoint",t.endpoint),_a(this,"httpMethod",t.http.method||"POST"),_a(this,"httpPath",t.http.requestUri||"/"),_a(this,"authtype",t.authtype||""),_a(this,"endpointDiscoveryRequired",t.endpointdiscovery?t.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL");var i=t.httpChecksumRequired||t.httpChecksum&&t.httpChecksum.requestChecksumRequired;_a(this,"httpChecksumRequired",i,!1),rm(this,"input",function(){return t.input?lx.create(t.input,r):new lx.create({type:"structure"},r)}),rm(this,"output",function(){return t.output?lx.create(t.output,r):new lx.create({type:"structure"},r)}),rm(this,"errors",function(){var s=[];if(!t.errors)return null;for(var o=0;o<t.errors.length;o++)s.push(lx.create(t.errors[o],r));return s}),rm(this,"paginator",function(){return r.api.paginators[e]}),r.documentation&&(_a(this,"documentation",t.documentation),_a(this,"documentationUrl",t.documentationUrl)),rm(this,"idempotentMembers",function(){var s=[],o=n.input,a=o.members;if(!o.members)return s;for(var u in a)a.hasOwnProperty(u)&&a[u].isIdempotent===!0&&s.push(u);return s}),rm(this,"hasEventOutput",function(){var s=n.output;return aAt(s)})}function aAt(e){var t=e.members,r=e.payload;if(!e.members)return!1;if(r){var n=t[r];return n.isEventStream}for(var i in t)if(!t.hasOwnProperty(i)&&t[i].isEventStream===!0)return!0;return!1}Oxe.exports=oAt});var v3=g((Tur,Ixe)=>{var fx=Xr().property;function uAt(e,t){fx(this,"inputToken",t.input_token),fx(this,"limitKey",t.limit_key),fx(this,"moreResults",t.more_results),fx(this,"outputToken",t.output_token),fx(this,"resultKey",t.result_key)}Ixe.exports=uAt});var x3=g((Cur,Nxe)=>{var Rxe=Xr(),uT=Rxe.property;function cAt(e,t,r){r=r||{},uT(this,"name",e),uT(this,"api",r.api,!1),t.operation&&uT(this,"operation",Rxe.string.lowerFirst(t.operation));var n=this,i=["type","description","delay","maxAttempts","acceptors"];i.forEach(function(s){var o=t[s];o&&uT(n,s,o)})}Nxe.exports=cAt});var y3=g((Aur,lAt)=>{lAt.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"},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",cors:!0},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"},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"},ivsrealtime:{prefix:"ivs-realtime",name:"IVSRealTime"},vpclattice:{prefix:"vpc-lattice",name:"VPCLattice"},osis:{name:"OSIS"},mediapackagev2:{name:"MediaPackageV2"},paymentcryptography:{prefix:"payment-cryptography",name:"PaymentCryptography"},paymentcryptographydata:{prefix:"payment-cryptography-data",name:"PaymentCryptographyData"},codegurusecurity:{prefix:"codeguru-security",name:"CodeGuruSecurity"},verifiedpermissions:{name:"VerifiedPermissions"},appfabric:{name:"AppFabric"},medicalimaging:{prefix:"medical-imaging",name:"MedicalImaging"},entityresolution:{name:"EntityResolution"},managedblockchainquery:{prefix:"managedblockchain-query",name:"ManagedBlockchainQuery"},neptunedata:{name:"Neptunedata"},pcaconnectorad:{prefix:"pca-connector-ad",name:"PcaConnectorAd"},bedrock:{name:"Bedrock"},bedrockruntime:{prefix:"bedrock-runtime",name:"BedrockRuntime"},datazone:{name:"DataZone"},launchwizard:{prefix:"launch-wizard",name:"LaunchWizard"},trustedadvisor:{name:"TrustedAdvisor"},inspectorscan:{prefix:"inspector-scan",name:"InspectorScan"},bcmdataexports:{prefix:"bcm-data-exports",name:"BCMDataExports"},costoptimizationhub:{prefix:"cost-optimization-hub",name:"CostOptimizationHub"},eksauth:{prefix:"eks-auth",name:"EKSAuth"},freetier:{name:"FreeTier"},repostspace:{name:"Repostspace"},workspacesthinclient:{prefix:"workspaces-thin-client",name:"WorkSpacesThinClient"},b2bi:{name:"B2bi"},bedrockagent:{prefix:"bedrock-agent",name:"BedrockAgent"},bedrockagentruntime:{prefix:"bedrock-agent-runtime",name:"BedrockAgentRuntime"},qbusiness:{name:"QBusiness"},qconnect:{name:"QConnect"},cleanroomsml:{name:"CleanRoomsML"},marketplaceagreement:{prefix:"marketplace-agreement",name:"MarketplaceAgreement"},marketplacedeployment:{prefix:"marketplace-deployment",name:"MarketplaceDeployment"},networkmonitor:{name:"NetworkMonitor"},supplychain:{name:"SupplyChain"}}});var _3=g((Our,qxe)=>{var cT=u3(),fAt=g3(),pAt=sx(),dAt=v3(),hAt=x3(),kxe=y3(),px=Xr(),Cr=px.property,mAt=px.memoizedProperty;function gAt(e,t){var r=this;e=e||{},t=t||{},t.api=this,e.metadata=e.metadata||{};var n=t.serviceIdentifier;delete t.serviceIdentifier,Cr(this,"isApi",!0,!1),Cr(this,"apiVersion",e.metadata.apiVersion),Cr(this,"endpointPrefix",e.metadata.endpointPrefix),Cr(this,"signingName",e.metadata.signingName),Cr(this,"globalEndpoint",e.metadata.globalEndpoint),Cr(this,"signatureVersion",e.metadata.signatureVersion),Cr(this,"jsonVersion",e.metadata.jsonVersion),Cr(this,"targetPrefix",e.metadata.targetPrefix),Cr(this,"protocol",e.metadata.protocol),Cr(this,"timestampFormat",e.metadata.timestampFormat),Cr(this,"xmlNamespaceUri",e.metadata.xmlNamespace),Cr(this,"abbreviation",e.metadata.serviceAbbreviation),Cr(this,"fullName",e.metadata.serviceFullName),Cr(this,"serviceId",e.metadata.serviceId),n&&kxe[n]&&Cr(this,"xmlNoDefaultLists",kxe[n].xmlNoDefaultLists,!1),mAt(this,"className",function(){var s=e.metadata.serviceAbbreviation||e.metadata.serviceFullName;return s?(s=s.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""),s==="ElasticLoadBalancing"&&(s="ELB"),s):null});function i(s,o){o.endpointoperation===!0&&Cr(r,"endpointOperation",px.string.lowerFirst(s)),o.endpointdiscovery&&!r.hasRequiredEndpointDiscovery&&Cr(r,"hasRequiredEndpointDiscovery",o.endpointdiscovery.required===!0)}Cr(this,"operations",new cT(e.operations,t,function(s,o){return new fAt(s,o,t)},px.string.lowerFirst,i)),Cr(this,"shapes",new cT(e.shapes,t,function(s,o){return pAt.create(o,t)})),Cr(this,"paginators",new cT(e.paginators,t,function(s,o){return new dAt(s,o,t)})),Cr(this,"waiters",new cT(e.waiters,t,function(s,o){return new hAt(s,o,t)},px.string.lowerFirst)),t.documentation&&(Cr(this,"documentation",e.documentation),Cr(this,"documentationUrl",e.documentationUrl)),Cr(this,"awsQueryCompatible",e.metadata.awsQueryCompatible)}qxe.exports=gAt});var Dxe=g((Iur,Pxe)=>{function lT(e,t){if(!lT.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return lT.services[e][t]}lT.services={};Pxe.exports=lT});var Lxe=g(b3=>{"use strict";Object.defineProperty(b3,"__esModule",{value:!0});var vAt=function(){function e(t,r){this.key=t,this.value=r}return e}(),xAt=function(){function e(t){if(this.nodeMap={},this.size=0,typeof t!="number"||t<1)throw new Error("Cache size can only be positive number");this.sizeLimit=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this.size},enumerable:!0,configurable:!0}),e.prototype.prependToList=function(t){this.headerNode?(this.headerNode.prev=t,t.next=this.headerNode):this.tailNode=t,this.headerNode=t,this.size++},e.prototype.removeFromTail=function(){if(this.tailNode){var t=this.tailNode,r=t.prev;return r&&(r.next=void 0),t.prev=void 0,this.tailNode=r,this.size--,t}},e.prototype.detachFromList=function(t){this.headerNode===t&&(this.headerNode=t.next),this.tailNode===t&&(this.tailNode=t.prev),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.next=void 0,t.prev=void 0,this.size--},e.prototype.get=function(t){if(this.nodeMap[t]){var r=this.nodeMap[t];return this.detachFromList(r),this.prependToList(r),r.value}},e.prototype.remove=function(t){if(this.nodeMap[t]){var r=this.nodeMap[t];this.detachFromList(r),delete this.nodeMap[t]}},e.prototype.put=function(t,r){if(this.nodeMap[t])this.remove(t);else if(this.size===this.sizeLimit){var n=this.removeFromTail(),i=n.key;delete this.nodeMap[i]}var s=new vAt(t,r);this.nodeMap[t]=s,this.prependToList(s)},e.prototype.empty=function(){for(var t=Object.keys(this.nodeMap),r=0;r<t.length;r++){var n=t[r],i=this.nodeMap[n];this.detachFromList(i),delete this.nodeMap[n]}},e}();b3.LRUCache=xAt});var Fxe=g(w3=>{"use strict";Object.defineProperty(w3,"__esModule",{value:!0});var yAt=Lxe(),_At=1e3,bAt=function(){function e(t){t===void 0&&(t=_At),this.maxSize=t,this.cache=new yAt.LRUCache(t)}return Object.defineProperty(e.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),e.prototype.put=function(t,r){var n=typeof t!="string"?e.getKeyString(t):t,i=this.populateValue(r);this.cache.put(n,i)},e.prototype.get=function(t){var r=typeof t!="string"?e.getKeyString(t):t,n=Date.now(),i=this.cache.get(r);if(i){for(var s=i.length-1;s>=0;s--){var o=i[s];o.Expire<n&&i.splice(s,1)}if(i.length===0){this.cache.remove(r);return}}return i},e.getKeyString=function(t){for(var r=[],n=Object.keys(t).sort(),i=0;i<n.length;i++){var s=n[i];t[s]!==void 0&&r.push(t[s])}return r.join(" ")},e.prototype.populateValue=function(t){var r=Date.now();return t.map(function(n){return{Address:n.Address||"",Expire:r+(n.CachePeriodInMinutes||1)*60*1e3}})},e.prototype.empty=function(){this.cache.empty()},e.prototype.remove=function(t){var r=typeof t!="string"?e.getKeyString(t):t;this.cache.remove(r)},e}();w3.EndpointCache=bAt});var E3=g((kur,Mxe)=>{var Ou=De();Ou.SequentialExecutor=Ou.util.inherit({constructor:function(){this._events={}},listeners:function(t){return this._events[t]?this._events[t].slice(0):[]},on:function(t,r,n){return this._events[t]?n?this._events[t].unshift(r):this._events[t].push(r):this._events[t]=[r],this},onAsync:function(t,r,n){return r._isAsync=!0,this.on(t,r,n)},removeListener:function(t,r){var n=this._events[t];if(n){for(var i=n.length,s=-1,o=0;o<i;++o)n[o]===r&&(s=o);s>-1&&n.splice(s,1)}return this},removeAllListeners:function(t){return t?delete this._events[t]:this._events={},this},emit:function(t,r,n){n||(n=function(){});var i=this.listeners(t),s=i.length;return this.callListeners(i,r,n),s>0},callListeners:function(t,r,n,i){var s=this,o=i||null;function a(c){if(c&&(o=Ou.util.error(o||new Error,c),s._haltHandlersOnError))return n.call(s,o);s.callListeners(t,r,n,o)}for(;t.length>0;){var u=t.shift();if(u._isAsync){u.apply(s,r.concat([a]));return}else{try{u.apply(s,r)}catch(c){o=Ou.util.error(o||new Error,c)}if(o&&s._haltHandlersOnError){n.call(s,o);return}}}n.call(s,o)},addListeners:function(t){var r=this;return t._events&&(t=t._events),Ou.util.each(t,function(n,i){typeof i=="function"&&(i=[i]),Ou.util.arrayEach(i,function(s){r.on(n,s)})}),r},addNamedListener:function(t,r,n,i){return this[t]=n,this.addListener(r,n,i),this},addNamedAsyncListener:function(t,r,n,i){return n._isAsync=!0,this.addNamedListener(t,r,n,i)},addNamedListeners:function(t){var r=this;return t(function(){r.addNamedListener.apply(r,arguments)},function(){r.addNamedAsyncListener.apply(r,arguments)}),this}});Ou.SequentialExecutor.prototype.addListener=Ou.SequentialExecutor.prototype.on;Mxe.exports=Ou.SequentialExecutor});var jxe=g((qur,wAt)=>{wAt.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-iso-*/iam":{endpoint:"{service}.us-iso-east-1.c2s.ic.gov",globalEndpoint:!0,signingRegion:"us-iso-east-1"},"us-gov-*/iam":"globalGovCloud","*/ce":{endpoint:"{service}.us-east-1.amazonaws.com",globalEndpoint:!0,signingRegion:"us-east-1"},"cn-*/ce":{endpoint:"{service}.cn-northwest-1.amazonaws.com.cn",globalEndpoint:!0,signingRegion:"cn-northwest-1"},"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-*/models.lex":"fips.models.lex","us-gov-*/runtime.lex":"fips.runtime.lex","us-gov-*/access-analyzer":"fipsWithServiceOnly","us-gov-*/acm":"fipsWithServiceOnly","us-gov-*/acm-pca":"fipsWithServiceOnly","us-gov-*/api.sagemaker":"fipsWithServiceOnly","us-gov-*/appconfig":"fipsWithServiceOnly","us-gov-*/application-autoscaling":"fipsWithServiceOnly","us-gov-*/autoscaling":"fipsWithServiceOnly","us-gov-*/autoscaling-plans":"fipsWithServiceOnly","us-gov-*/batch":"fipsWithServiceOnly","us-gov-*/cassandra":"fipsWithServiceOnly","us-gov-*/clouddirectory":"fipsWithServiceOnly","us-gov-*/cloudformation":"fipsWithServiceOnly","us-gov-*/cloudshell":"fipsWithServiceOnly","us-gov-*/cloudtrail":"fipsWithServiceOnly","us-gov-*/config":"fipsWithServiceOnly","us-gov-*/connect":"fipsWithServiceOnly","us-gov-*/databrew":"fipsWithServiceOnly","us-gov-*/dlm":"fipsWithServiceOnly","us-gov-*/dms":"fipsWithServiceOnly","us-gov-*/dynamodb":"fipsWithServiceOnly","us-gov-*/ec2":"fipsWithServiceOnly","us-gov-*/eks":"fipsWithServiceOnly","us-gov-*/elasticache":"fipsWithServiceOnly","us-gov-*/elasticbeanstalk":"fipsWithServiceOnly","us-gov-*/elasticloadbalancing":"fipsWithServiceOnly","us-gov-*/elasticmapreduce":"fipsWithServiceOnly","us-gov-*/events":"fipsWithServiceOnly","us-gov-*/fis":"fipsWithServiceOnly","us-gov-*/glacier":"fipsWithServiceOnly","us-gov-*/greengrass":"fipsWithServiceOnly","us-gov-*/guardduty":"fipsWithServiceOnly","us-gov-*/identitystore":"fipsWithServiceOnly","us-gov-*/imagebuilder":"fipsWithServiceOnly","us-gov-*/kafka":"fipsWithServiceOnly","us-gov-*/kinesis":"fipsWithServiceOnly","us-gov-*/logs":"fipsWithServiceOnly","us-gov-*/mediaconvert":"fipsWithServiceOnly","us-gov-*/monitoring":"fipsWithServiceOnly","us-gov-*/networkmanager":"fipsWithServiceOnly","us-gov-*/organizations":"fipsWithServiceOnly","us-gov-*/outposts":"fipsWithServiceOnly","us-gov-*/participant.connect":"fipsWithServiceOnly","us-gov-*/ram":"fipsWithServiceOnly","us-gov-*/rds":"fipsWithServiceOnly","us-gov-*/redshift":"fipsWithServiceOnly","us-gov-*/resource-groups":"fipsWithServiceOnly","us-gov-*/runtime.sagemaker":"fipsWithServiceOnly","us-gov-*/serverlessrepo":"fipsWithServiceOnly","us-gov-*/servicecatalog-appregistry":"fipsWithServiceOnly","us-gov-*/servicequotas":"fipsWithServiceOnly","us-gov-*/sns":"fipsWithServiceOnly","us-gov-*/sqs":"fipsWithServiceOnly","us-gov-*/ssm":"fipsWithServiceOnly","us-gov-*/streams.dynamodb":"fipsWithServiceOnly","us-gov-*/sts":"fipsWithServiceOnly","us-gov-*/support":"fipsWithServiceOnly","us-gov-*/swf":"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 Uxe=g((Pur,Bxe)=>{var EAt=Xr(),dx=jxe();function SAt(e){if(!e)return null;var t=e.split("-");return t.length<3?null:t.slice(0,t.length-2).join("-")+"-*"}function TAt(e){var t=e.config.region,r=SAt(t),n=e.api.endpointPrefix;return[[t,n],[r,n],[t,"*"],[r,"*"],["*",n],[t,"internal-*"],["*","*"]].map(function(i){return i[0]&&i[1]?i.join("/"):null})}function CAt(e,t){EAt.each(t,function(r,n){r!=="globalEndpoint"&&(e.config[r]===void 0||e.config[r]===null)&&(e.config[r]=n)})}function AAt(e){for(var t=TAt(e),r=e.config.useFipsEndpoint,n=e.config.useDualstackEndpoint,i=0;i<t.length;i++){var s=t[i];if(s){var o=r?n?dx.dualstackFipsRules:dx.fipsRules:n?dx.dualstackRules:dx.rules;if(Object.prototype.hasOwnProperty.call(o,s)){var a=o[s];typeof a=="string"&&(a=dx.patterns[a]),e.isGlobalEndpoint=!!a.globalEndpoint,a.signingRegion&&(e.signingRegion=a.signingRegion),a.signatureVersion||(a.signatureVersion="v4");var u=(e.api&&e.api.signatureVersion)==="bearer";CAt(e,Object.assign({},a,{signatureVersion:u?"bearer":a.signatureVersion}));return}}}}function OAt(e){for(var t={"^(us|eu|ap|sa|ca|me)\\-\\w+\\-\\d+$":"amazonaws.com","^cn\\-\\w+\\-\\d+$":"amazonaws.com.cn","^us\\-gov\\-\\w+\\-\\d+$":"amazonaws.com","^us\\-iso\\-\\w+\\-\\d+$":"c2s.ic.gov","^us\\-isob\\-\\w+\\-\\d+$":"sc2s.sgov.gov"},r="amazonaws.com",n=Object.keys(t),i=0;i<n.length;i++){var s=RegExp(n[i]),o=t[n[i]];if(s.test(e))return o}return r}Bxe.exports={configureEndpoint:AAt,getEndpointSuffix:OAt}});var S3=g((Dur,$xe)=>{function IAt(e){return typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips"))}function RAt(e){return typeof e=="string"&&["aws-global","aws-us-gov-global"].includes(e)}function NAt(e){return["fips-aws-global","aws-fips","aws-global"].includes(e)?"us-east-1":["fips-aws-us-gov-global","aws-us-gov-global"].includes(e)?"us-gov-west-1":e.replace(/fips-(dkr-|prod-)?|-fips/,"")}$xe.exports={isFipsRegion:IAt,isGlobalRegion:RAt,getRealRegion:NAt}});var Wxe=g((Lur,Hxe)=>{var qe=De(),kAt=_3(),qAt=Uxe(),T3=qe.util.inherit,PAt=0,fT=S3();qe.Service=T3({constructor:function(t){if(!this.loadServiceClass)throw qe.util.error(new Error,"Service must be constructed with `new' operator");if(t){if(t.region){var r=t.region;fT.isFipsRegion(r)&&(t.region=fT.getRealRegion(r),t.useFipsEndpoint=!0),fT.isGlobalRegion(r)&&(t.region=fT.getRealRegion(r))}typeof t.useDualstack=="boolean"&&typeof t.useDualstackEndpoint!="boolean"&&(t.useDualstackEndpoint=t.useDualstack)}var n=this.loadServiceClass(t||{});if(n){var i=qe.util.copy(t),s=new n(t);return Object.defineProperty(s,"_originalConfig",{get:function(){return i},enumerable:!1,configurable:!0}),s._clientId=++PAt,s}this.initialize(t)},initialize:function(t){var r=qe.config[this.serviceIdentifier];if(this.config=new qe.Config(qe.config),r&&this.config.update(r,!0),t&&this.config.update(t,!0),this.validateService(),this.config.endpoint||qAt.configureEndpoint(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint),qe.SequentialExecutor.call(this),qe.Service.addDefaultMonitoringListeners(this),(this.config.clientSideMonitoring||qe.Service._clientSideMonitoring)&&this.publisher){var n=this.publisher;this.addNamedListener("PUBLISH_API_CALL","apiCall",function(s){process.nextTick(function(){n.eventHandler(s)})}),this.addNamedListener("PUBLISH_API_ATTEMPT","apiCallAttempt",function(s){process.nextTick(function(){n.eventHandler(s)})})}},validateService:function(){},loadServiceClass:function(t){var r=t;if(qe.util.isEmpty(this.api)){if(r.apiConfig)return qe.Service.defineServiceApi(this.constructor,r.apiConfig);if(this.constructor.services){r=new qe.Config(qe.config),r.update(t,!0);var n=r.apiVersions[this.constructor.serviceIdentifier];return n=n||r.apiVersion,this.getLatestServiceClass(n)}else return null}else return null},getLatestServiceClass:function(t){return t=this.getLatestServiceVersion(t),this.constructor.services[t]===null&&qe.Service.defineServiceApi(this.constructor,t),this.constructor.services[t]},getLatestServiceVersion:function(t){if(!this.constructor.services||this.constructor.services.length===0)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(t?qe.util.isType(t,Date)&&(t=qe.util.date.iso8601(t).split("T")[0]):t="latest",Object.hasOwnProperty(this.constructor.services,t))return t;for(var r=Object.keys(this.constructor.services).sort(),n=null,i=r.length-1;i>=0;i--)if(r[i][r[i].length-1]!=="*"&&(n=r[i]),r[i].substr(0,10)<=t)return n;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+t+"'")},api:{},defaultRetryCount:3,customizeRequests:function(t){if(!t)this.customRequestHandler=null;else if(typeof t=="function")this.customRequestHandler=t;else throw new Error("Invalid callback type '"+typeof t+"' provided in customizeRequests")},makeRequest:function(t,r,n){if(typeof r=="function"&&(n=r,r=null),r=r||{},this.config.params){var i=this.api.operations[t];i&&(r=qe.util.copy(r),qe.util.each(this.config.params,function(o,a){i.input.members[o]&&(r[o]===void 0||r[o]===null)&&(r[o]=a)}))}var s=new qe.Request(this,t,r);return this.addAllRequestListeners(s),this.attachMonitoringEmitter(s),n&&s.send(n),s},makeUnauthenticatedRequest:function(t,r,n){typeof r=="function"&&(n=r,r={});var i=this.makeRequest(t,r).toUnauthenticated();return n?i.send(n):i},waitFor:function(t,r,n){var i=new qe.ResourceWaiter(this,t);return i.wait(r,n)},addAllRequestListeners:function(t){for(var r=[qe.events,qe.EventListeners.Core,this.serviceInterface(),qe.EventListeners.CorePost],n=0;n<r.length;n++)r[n]&&t.addListeners(r[n]);this.config.paramValidation||t.removeListener("validate",qe.EventListeners.Core.VALIDATE_PARAMETERS),this.config.logger&&t.addListeners(qe.EventListeners.Logger),this.setupRequestListeners(t),typeof this.constructor.prototype.customRequestHandler=="function"&&this.constructor.prototype.customRequestHandler(t),Object.prototype.hasOwnProperty.call(this,"customRequestHandler")&&typeof this.customRequestHandler=="function"&&this.customRequestHandler(t)},apiCallEvent:function(t){var r=t.service.api.operations[t.operation],n={Type:"ApiCall",Api:r?r.name:t.operation,Version:1,Service:t.service.api.serviceId||t.service.api.endpointPrefix,Region:t.httpRequest.region,MaxRetriesExceeded:0,UserAgent:t.httpRequest.getUserAgent()},i=t.response;if(i.httpResponse.statusCode&&(n.FinalHttpStatusCode=i.httpResponse.statusCode),i.error){var s=i.error,o=i.httpResponse.statusCode;o>299?(s.code&&(n.FinalAwsException=s.code),s.message&&(n.FinalAwsExceptionMessage=s.message)):((s.code||s.name)&&(n.FinalSdkException=s.code||s.name),s.message&&(n.FinalSdkExceptionMessage=s.message))}return n},apiAttemptEvent:function(t){var r=t.service.api.operations[t.operation],n={Type:"ApiCallAttempt",Api:r?r.name:t.operation,Version:1,Service:t.service.api.serviceId||t.service.api.endpointPrefix,Fqdn:t.httpRequest.endpoint.hostname,UserAgent:t.httpRequest.getUserAgent()},i=t.response;return i.httpResponse.statusCode&&(n.HttpStatusCode=i.httpResponse.statusCode),!t._unAuthenticated&&t.service.config.credentials&&t.service.config.credentials.accessKeyId&&(n.AccessKey=t.service.config.credentials.accessKeyId),i.httpResponse.headers&&(t.httpRequest.headers["x-amz-security-token"]&&(n.SessionToken=t.httpRequest.headers["x-amz-security-token"]),i.httpResponse.headers["x-amzn-requestid"]&&(n.XAmznRequestId=i.httpResponse.headers["x-amzn-requestid"]),i.httpResponse.headers["x-amz-request-id"]&&(n.XAmzRequestId=i.httpResponse.headers["x-amz-request-id"]),i.httpResponse.headers["x-amz-id-2"]&&(n.XAmzId2=i.httpResponse.headers["x-amz-id-2"])),n},attemptFailEvent:function(t){var r=this.apiAttemptEvent(t),n=t.response,i=n.error;return n.httpResponse.statusCode>299?(i.code&&(r.AwsException=i.code),i.message&&(r.AwsExceptionMessage=i.message)):((i.code||i.name)&&(r.SdkException=i.code||i.name),i.message&&(r.SdkExceptionMessage=i.message)),r},attachMonitoringEmitter:function(t){var r,n,i,s,o=0,a,u,c=this,f=!0;t.on("validate",function(){s=qe.util.realClock.now(),u=Date.now()},f),t.on("sign",function(){n=qe.util.realClock.now(),r=Date.now(),a=t.httpRequest.region,o++},f),t.on("validateResponse",function(){i=Math.round(qe.util.realClock.now()-n)}),t.addNamedListener("API_CALL_ATTEMPT","success",function(){var d=c.apiAttemptEvent(t);d.Timestamp=r,d.AttemptLatency=i>=0?i:0,d.Region=a,c.emit("apiCallAttempt",[d])}),t.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var d=c.attemptFailEvent(t);d.Timestamp=r,i=i||Math.round(qe.util.realClock.now()-n),d.AttemptLatency=i>=0?i:0,d.Region=a,c.emit("apiCallAttempt",[d])}),t.addNamedListener("API_CALL","complete",function(){var d=c.apiCallEvent(t);if(d.AttemptCount=o,!(d.AttemptCount<=0)){d.Timestamp=u;var m=Math.round(qe.util.realClock.now()-s);d.Latency=m>=0?m:0;var v=t.response;v.error&&v.error.retryable&&typeof v.retryCount=="number"&&typeof v.maxRetries=="number"&&v.retryCount>=v.maxRetries&&(d.MaxRetriesExceeded=1),c.emit("apiCall",[d])}})},setupRequestListeners:function(t){},getSigningName:function(){return this.api.signingName||this.api.endpointPrefix},getSignerClass:function(t){var r,n=null,i="";if(t){var s=t.service.api.operations||{};n=s[t.operation]||null,i=n?n.authtype:""}return this.config.signatureVersion?r=this.config.signatureVersion:i==="v4"||i==="v4-unsigned-body"?r="v4":i==="bearer"?r="bearer":r=this.api.signatureVersion,qe.Signers.RequestSigner.getVersion(r)},serviceInterface:function(){switch(this.api.protocol){case"ec2":return qe.EventListeners.Query;case"query":return qe.EventListeners.Query;case"json":return qe.EventListeners.Json;case"rest-json":return qe.EventListeners.RestJson;case"rest-xml":return qe.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(t){return t.httpResponse.statusCode<300},numRetries:function(){return this.config.maxRetries!==void 0?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(t,r){return qe.util.calculateRetryDelay(t,this.config.retryDelayOptions,r)},retryableError:function(t){return!!(this.timeoutError(t)||this.networkingError(t)||this.expiredCredentialsError(t)||this.throttledError(t)||t.statusCode>=500)},networkingError:function(t){return t.code==="NetworkingError"},timeoutError:function(t){return t.code==="TimeoutError"},expiredCredentialsError:function(t){return t.code==="ExpiredTokenException"},clockSkewError:function(t){switch(t.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(t){t&&(this.config.systemClockOffset=t-Date.now())},isClockSkewed:function(t){if(t)return Math.abs(this.getSkewCorrectedDate().getTime()-t)>=3e5},throttledError:function(t){if(t.statusCode===429)return!0;switch(t.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(t){if(typeof t!="string")return t;var r=t;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(t){this.endpoint=new qe.Endpoint(t,this.config)},paginationConfig:function(t,r){var n=this.api.operations[t].paginator;if(!n){if(r){var i=new Error;throw qe.util.error(i,"No pagination configuration for "+t)}return null}return n}});qe.util.update(qe.Service,{defineMethods:function(t){qe.util.each(t.prototype.api.operations,function(n){if(!t.prototype[n]){var i=t.prototype.api.operations[n];i.authtype==="none"?t.prototype[n]=function(s,o){return this.makeUnauthenticatedRequest(n,s,o)}:t.prototype[n]=function(s,o){return this.makeRequest(n,s,o)}}})},defineService:function(t,r,n){qe.Service._serviceMap[t]=!0,Array.isArray(r)||(n=r,r=[]);var i=T3(qe.Service,n||{});if(typeof t=="string"){qe.Service.addVersions(i,r);var s=i.serviceIdentifier||t;i.serviceIdentifier=s}else i.prototype.api=t,qe.Service.defineMethods(i);if(qe.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&qe.util.clientSideMonitoring){var o=qe.util.clientSideMonitoring.Publisher,a=qe.util.clientSideMonitoring.configProvider,u=a();this.prototype.publisher=new o(u),u.enabled&&(qe.Service._clientSideMonitoring=!0)}return qe.SequentialExecutor.call(i.prototype),qe.Service.addDefaultMonitoringListeners(i.prototype),i},addVersions:function(t,r){Array.isArray(r)||(r=[r]),t.services=t.services||{};for(var n=0;n<r.length;n++)t.services[r[n]]===void 0&&(t.services[r[n]]=null);t.apiVersions=Object.keys(t.services).sort()},defineServiceApi:function(t,r,n){var i=T3(t,{serviceIdentifier:t.serviceIdentifier});function s(o){o.isApi?i.prototype.api=o:i.prototype.api=new kAt(o,{serviceIdentifier:t.serviceIdentifier})}if(typeof r=="string"){if(n)s(n);else try{s(qe.apiLoader(t.serviceIdentifier,r))}catch(o){throw qe.util.error(o,{message:"Could not find API configuration "+t.serviceIdentifier+"-"+r})}Object.prototype.hasOwnProperty.call(t.services,r)||(t.apiVersions=t.apiVersions.concat(r).sort()),t.services[r]=i}else s(r);return qe.Service.defineMethods(i),i},hasService:function(e){return Object.prototype.hasOwnProperty.call(qe.Service._serviceMap,e)},addDefaultMonitoringListeners:function(t){t.addNamedListener("MONITOR_EVENTS_BUBBLE","apiCallAttempt",function(n){var i=Object.getPrototypeOf(t);i._events&&i.emit("apiCallAttempt",[n])}),t.addNamedListener("CALL_EVENTS_BUBBLE","apiCall",function(n){var i=Object.getPrototypeOf(t);i._events&&i.emit("apiCall",[n])})},_serviceMap:{}});qe.util.mixin(qe.Service,qe.SequentialExecutor);Hxe.exports=qe.Service});var C3=g(()=>{var Js=De();Js.Credentials=Js.util.inherit({constructor:function(){if(Js.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],arguments.length===1&&typeof arguments[0]=="object"){var t=arguments[0].credentials||arguments[0];this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,this.sessionToken=t.sessionToken}else this.accessKeyId=arguments[0],this.secretAccessKey=arguments[1],this.sessionToken=arguments[2]},expiryWindow:15,needsRefresh:function(){var t=Js.util.date.getDate().getTime(),r=new Date(t+this.expiryWindow*1e3);return this.expireTime&&r>this.expireTime?!0:this.expired||!this.accessKeyId||!this.secretAccessKey},get:function(t){var r=this;this.needsRefresh()?this.refresh(function(n){n||(r.expired=!1),t&&t(n)}):t&&t()},refresh:function(t){this.expired=!1,t()},coalesceRefresh:function(t,r){var n=this;n.refreshCallbacks.push(t)===1&&n.load(function(s){Js.util.arrayEach(n.refreshCallbacks,function(o){r?o(s):Js.util.defer(function(){o(s)})}),n.refreshCallbacks.length=0})},load:function(t){t()}});Js.Credentials.addPromisesToClass=function(t){this.prototype.getPromise=Js.util.promisifyMethod("get",t),this.prototype.refreshPromise=Js.util.promisifyMethod("refresh",t)};Js.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise};Js.util.addPromises(Js.Credentials)});var A3=g(()=>{var Ro=De();Ro.CredentialProviderChain=Ro.util.inherit(Ro.Credentials,{constructor:function(t){t?this.providers=t:this.providers=Ro.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(t){var r=this;if(r.providers.length===0)return t(new Error("No providers")),r;if(r.resolveCallbacks.push(t)===1){let o=function(a,u){if(!a&&u||n===i.length){Ro.util.arrayEach(r.resolveCallbacks,function(f){f(a,u)}),r.resolveCallbacks.length=0;return}var c=i[n++];typeof c=="function"?u=c.call():u=c,u.get?u.get(function(f){o(f,f?null:u)}):o(null,u)};var s=o,n=0,i=r.providers.slice(0);o()}return r}});Ro.CredentialProviderChain.defaultProviders=[];Ro.CredentialProviderChain.addPromisesToClass=function(t){this.prototype.resolvePromise=Ro.util.promisifyMethod("resolve",t)};Ro.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise};Ro.util.addPromises(Ro.CredentialProviderChain)});var zxe=g(()=>{var Ar=De();C3();A3();var pT;Ar.Config=Ar.util.inherit({constructor:function(t){t===void 0&&(t={}),t=this.extractCredentials(t),Ar.util.each.call(this,this.keys,function(r,n){this.set(r,t[r],n)})},getCredentials:function(t){var r=this;function n(a){t(a,a?null:r.credentials)}function i(a,u){return new Ar.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=i(u,a)}n(a)})}function o(){var a=null;(!r.credentials.accessKeyId||!r.credentials.secretAccessKey)&&(a=i("Missing credentials")),n(a)}r.credentials?typeof r.credentials.get=="function"?s():o():r.credentialProvider?r.credentialProvider.resolve(function(a,u){a&&(a=i("Could not load credentials from any providers",a)),r.credentials=u,n(a)}):n(i("No credentials to load"))},getToken:function(t){var r=this;function n(a){t(a,a?null:r.token)}function i(a,u){return new Ar.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=i(u,a)}n(a)})}function o(){var a=null;r.token.token||(a=i("Missing token")),n(a)}r.token?typeof r.token.get=="function"?s():o():r.tokenProvider?r.tokenProvider.resolve(function(a,u){a&&(a=i("Could not load token from any providers",a)),r.token=u,n(a)}):n(i("No token to load"))},update:function(t,r){r=r||!1,t=this.extractCredentials(t),Ar.util.each.call(this,t,function(n,i){(r||Object.prototype.hasOwnProperty.call(this.keys,n)||Ar.Service.hasService(n))&&this.set(n,i)})},loadFromPath:function(t){this.clear();var r=JSON.parse(Ar.util.readFileSync(t)),n=new Ar.FileSystemCredentials(t),i=new Ar.CredentialProviderChain;return i.providers.unshift(n),i.resolve(function(s,o){if(s)throw s;r.credentials=o}),this.constructor(r),this},clear:function(){Ar.util.each.call(this,this.keys,function(t){delete this[t]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(t,r,n){r===void 0?(n===void 0&&(n=this.keys[t]),typeof n=="function"?this[t]=n.call(this):this[t]=n):t==="httpOptions"&&this[t]?this[t]=Ar.util.merge(this[t],r):this[t]=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(t){return t.accessKeyId&&t.secretAccessKey&&(t=Ar.util.copy(t),t.credentials=new Ar.Credentials(t)),t},setPromisesDependency:function(t){pT=t,t===null&&typeof Promise=="function"&&(pT=Promise);var r=[Ar.Request,Ar.Credentials,Ar.CredentialProviderChain];Ar.S3&&(r.push(Ar.S3),Ar.S3.ManagedUpload&&r.push(Ar.S3.ManagedUpload)),Ar.util.addPromises(r,pT)},getPromisesDependency:function(){return pT}});Ar.config=new Ar.Config});var hT=g(()=>{var Kn=De(),dT=Kn.util.inherit;Kn.Endpoint=dT({constructor:function(t,r){if(Kn.util.hideProperties(this,["slashes","auth","hash","search","query"]),typeof t>"u"||t===null)throw new Error("Invalid endpoint: "+t);if(typeof t!="string")return Kn.util.copy(t);if(!t.match(/^http/)){var n=r&&r.sslEnabled!==void 0?r.sslEnabled:Kn.config.sslEnabled;t=(n?"https":"http")+"://"+t}Kn.util.update(this,Kn.util.urlParse(t)),this.port?this.port=parseInt(this.port,10):this.port=this.protocol==="https:"?443:80}});Kn.HttpRequest=dT({constructor:function(t,r){t=new Kn.Endpoint(t),this.method="POST",this.path=t.path||"/",this.headers={},this.body="",this.endpoint=t,this.region=r,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=Kn.util.userAgent()},getUserAgentHeaderName:function(){var t=Kn.util.isBrowser()?"X-Amz-":"";return t+"User-Agent"},appendToUserAgent:function(t){typeof t=="string"&&t&&(this._userAgent+=" "+t),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var t=this.path.split("?",2)[1];return t?(t=Kn.util.queryStringParse(t),Kn.util.queryParamsToString(t)):""},updateEndpoint:function(t){var r=new Kn.Endpoint(t);this.endpoint=r,this.path=r.path||"/",this.headers.Host&&(this.headers.Host=r.host)}});Kn.HttpResponse=dT({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}});Kn.HttpClient=dT({});Kn.HttpClient.getInstance=function(){return this.singleton===void 0&&(this.singleton=new this),this.singleton}});var Qxe=g((zur,Jxe)=>{var yn=De(),ys=Xr(),Gxe=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function mT(e){var t=e.service,r=t.api||{},n=r.operations,i={};return t.config.region&&(i.region=t.config.region),r.serviceId&&(i.serviceId=r.serviceId),t.config.credentials.accessKeyId&&(i.accessKeyId=t.config.credentials.accessKeyId),i}function Kxe(e,t,r){!r||t===void 0||t===null||r.type==="structure"&&r.required&&r.required.length>0&&ys.arrayEach(r.required,function(n){var i=r.members[n];if(i.endpointDiscoveryId===!0){var s=i.isLocationName?i.name:n;e[s]=String(t[n])}else Kxe(e,t[n],i)})}function gT(e,t){var r={};return Kxe(r,e.params,t),r}function Xxe(e){var t=e.service,r=t.api,n=r.operations?r.operations[e.operation]:void 0,i=n?n.input:void 0,s=gT(e,i),o=mT(e);Object.keys(s).length>0&&(o=ys.update(o,s),n&&(o.operation=n.name));var a=yn.endpointCache.get(o);if(!(a&&a.length===1&&a[0].Address===""))if(a&&a.length>0)e.httpRequest.updateEndpoint(a[0].Address);else{var u=t.makeRequest(r.endpointOperation,{Operation:n.name,Identifiers:s});Zxe(u),u.removeListener("validate",yn.EventListeners.Core.VALIDATE_PARAMETERS),u.removeListener("retry",yn.EventListeners.Core.RETRY_CHECK),yn.endpointCache.put(o,[{Address:"",CachePeriodInMinutes:1}]),u.send(function(c,f){f&&f.Endpoints?yn.endpointCache.put(o,f.Endpoints):c&&yn.endpointCache.put(o,[{Address:"",CachePeriodInMinutes:1}])})}}var Iu={};function Yxe(e,t){var r=e.service,n=r.api,i=n.operations?n.operations[e.operation]:void 0,s=i?i.input:void 0,o=gT(e,s),a=mT(e);Object.keys(o).length>0&&(a=ys.update(a,o),i&&(a.operation=i.name));var u=yn.EndpointCache.getKeyString(a),c=yn.endpointCache.get(u);if(c&&c.length===1&&c[0].Address===""){Iu[u]||(Iu[u]=[]),Iu[u].push({request:e,callback:t});return}else if(c&&c.length>0)e.httpRequest.updateEndpoint(c[0].Address),t();else{var f=r.makeRequest(n.endpointOperation,{Operation:i.name,Identifiers:o});f.removeListener("validate",yn.EventListeners.Core.VALIDATE_PARAMETERS),Zxe(f),yn.endpointCache.put(u,[{Address:"",CachePeriodInMinutes:60}]),f.send(function(p,d){if(p){if(e.response.error=ys.error(p,{retryable:!1}),yn.endpointCache.remove(a),Iu[u]){var m=Iu[u];ys.arrayEach(m,function(v){v.request.response.error=ys.error(p,{retryable:!1}),v.callback()}),delete Iu[u]}}else if(d&&(yn.endpointCache.put(u,d.Endpoints),e.httpRequest.updateEndpoint(d.Endpoints[0].Address),Iu[u])){var m=Iu[u];ys.arrayEach(m,function(y){y.request.httpRequest.updateEndpoint(d.Endpoints[0].Address),y.callback()}),delete Iu[u]}t()})}}function Zxe(e){var t=e.service.api,r=t.apiVersion;r&&!e.httpRequest.headers["x-amz-api-version"]&&(e.httpRequest.headers["x-amz-api-version"]=r)}function O3(e){var t=e.error,r=e.httpResponse;if(t&&(t.code==="InvalidEndpointException"||r.statusCode===421)){var n=e.request,i=n.service.api.operations||{},s=i[n.operation]?i[n.operation].input:void 0,o=gT(n,s),a=mT(n);Object.keys(o).length>0&&(a=ys.update(a,o),i[n.operation]&&(a.operation=i[n.operation].name)),yn.endpointCache.remove(a)}}function DAt(e){if(e._originalConfig&&e._originalConfig.endpoint&&e._originalConfig.endpointDiscoveryEnabled===!0)throw ys.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var t=yn.config[e.serviceIdentifier]||{};return!!(yn.config.endpoint||t.endpoint||e._originalConfig&&e._originalConfig.endpoint)}function Vxe(e){return["false","0"].indexOf(e)>=0}function LAt(e){var t=e.service||{};if(t.config.endpointDiscoveryEnabled!==void 0)return t.config.endpointDiscoveryEnabled;if(!ys.isBrowser()){for(var r=0;r<Gxe.length;r++){var n=Gxe[r];if(Object.prototype.hasOwnProperty.call(process.env,n)){if(process.env[n]===""||process.env[n]===void 0)throw ys.error(new Error,{code:"ConfigurationException",message:"environmental variable "+n+" cannot be set to nothing"});return!Vxe(process.env[n])}}var i={};try{i=yn.util.iniLoader?yn.util.iniLoader.loadFrom({isConfig:!0,filename:process.env[yn.util.sharedConfigFileEnv]}):{}}catch{}var s=i[process.env.AWS_PROFILE||yn.util.defaultProfile]||{};if(Object.prototype.hasOwnProperty.call(s,"endpoint_discovery_enabled")){if(s.endpoint_discovery_enabled===void 0)throw ys.error(new Error,{code:"ConfigurationException",message:"config file entry 'endpoint_discovery_enabled' cannot be set to nothing"});return!Vxe(s.endpoint_discovery_enabled)}}}function FAt(e,t){var r=e.service||{};if(DAt(r)||e.isPresigned())return t();var n=r.api.operations||{},i=n[e.operation],s=i?i.endpointDiscoveryRequired:"NULL",o=LAt(e),a=r.api.hasRequiredEndpointDiscovery;switch((o||a)&&e.httpRequest.appendToUserAgent("endpoint-discovery"),s){case"OPTIONAL":(o||a)&&(Xxe(e),e.addNamedListener("INVALIDATE_CACHED_ENDPOINTS","extractError",O3)),t();break;case"REQUIRED":if(o===!1){e.response.error=ys.error(new Error,{code:"ConfigurationException",message:"Endpoint Discovery is disabled but "+r.api.className+"."+e.operation+"() requires it. Please check your configurations."}),t();break}e.addNamedListener("INVALIDATE_CACHED_ENDPOINTS","extractError",O3),Yxe(e,t);break;case"NULL":default:t();break}}Jxe.exports={discoverEndpoint:FAt,requiredDiscoverEndpoint:Yxe,optionalDiscoverEndpoint:Xxe,marshallCustomIdentifiers:gT,getCacheKey:mT,invalidateCachedEndpoint:O3}});var rye=g(()=>{var Tt=De(),Xc=E3(),MAt=Qxe().discoverEndpoint;Tt.EventListeners={Core:{}};function tye(e){if(!e.service.api.operations)return"";var t=e.service.api.operations[e.operation];return t?t.authtype:""}function eye(e){var t=e.service;return t.config.signatureVersion?t.config.signatureVersion:t.api.signatureVersion?t.api.signatureVersion:tye(e)}Tt.EventListeners={Core:new Xc().addNamedListeners(function(e,t){t("VALIDATE_CREDENTIALS","validate",function(i,s){if(!i.service.api.signatureVersion&&!i.service.config.signatureVersion)return s();var o=eye(i);if(o==="bearer"){i.service.config.getToken(function(a){a&&(i.response.error=Tt.util.error(a,{code:"TokenError"})),s()});return}i.service.config.getCredentials(function(a){a&&(i.response.error=Tt.util.error(a,{code:"CredentialsError",message:"Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1"})),s()})}),e("VALIDATE_REGION","validate",function(i){if(!i.service.isGlobalEndpoint){var s=new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);i.service.config.region?s.test(i.service.config.region)||(i.response.error=Tt.util.error(new Error,{code:"ConfigError",message:"Invalid region in config"})):i.response.error=Tt.util.error(new Error,{code:"ConfigError",message:"Missing region in config"})}}),e("BUILD_IDEMPOTENCY_TOKENS","validate",function(i){if(i.service.api.operations){var s=i.service.api.operations[i.operation];if(s){var o=s.idempotentMembers;if(o.length){for(var a=Tt.util.copy(i.params),u=0,c=o.length;u<c;u++)a[o[u]]||(a[o[u]]=Tt.util.uuid.v4());i.params=a}}}}),e("VALIDATE_PARAMETERS","validate",function(i){if(i.service.api.operations){var s=i.service.api.operations[i.operation].input,o=i.service.config.paramValidation;new Tt.ParamValidator(o).validate(s,i.params)}}),e("COMPUTE_CHECKSUM","afterBuild",function(i){if(i.service.api.operations){var s=i.service.api.operations[i.operation];if(s){var o=i.httpRequest.body,a=o&&(Tt.util.Buffer.isBuffer(o)||typeof o=="string"),u=i.httpRequest.headers;if(s.httpChecksumRequired&&i.service.config.computeChecksums&&a&&!u["Content-MD5"]){var c=Tt.util.crypto.md5(o,"base64");u["Content-MD5"]=c}}}}),t("COMPUTE_SHA256","afterBuild",function(i,s){if(i.haltHandlersOnError(),!!i.service.api.operations){var o=i.service.api.operations[i.operation],a=o?o.authtype:"";if(!i.service.api.signatureVersion&&!a&&!i.service.config.signatureVersion)return s();if(i.service.getSignerClass(i)===Tt.Signers.V4){var u=i.httpRequest.body||"";if(a.indexOf("unsigned-body")>=0)return i.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",s();Tt.util.computeSha256(u,function(c,f){c?s(c):(i.httpRequest.headers["X-Amz-Content-Sha256"]=f,s())})}else s()}}),e("SET_CONTENT_LENGTH","afterBuild",function(i){var s=tye(i),o=Tt.util.getRequestPayloadShape(i);if(i.httpRequest.headers["Content-Length"]===void 0)try{var a=Tt.util.string.byteLength(i.httpRequest.body);i.httpRequest.headers["Content-Length"]=a}catch(u){if(o&&o.isStreaming){if(o.requiresLength)throw u;if(s.indexOf("unsigned-body")>=0){i.httpRequest.headers["Transfer-Encoding"]="chunked";return}else throw u}throw u}}),e("SET_HTTP_HOST","afterBuild",function(i){i.httpRequest.headers.Host=i.httpRequest.endpoint.host}),e("SET_TRACE_ID","afterBuild",function(i){var s="X-Amzn-Trace-Id";if(Tt.util.isNode()&&!Object.hasOwnProperty.call(i.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&&(i.httpRequest.headers[s]=c)}}),e("RESTART","restart",function(){var i=this.response.error;!i||!i.retryable||(this.httpRequest=new Tt.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount<this.service.config.maxRetries?this.response.retryCount++:this.response.error=null)});var r=!0;t("DISCOVER_ENDPOINT","sign",MAt,r),t("SIGN","sign",function(i,s){var o=i.service,a=eye(i);if(!a||a.length===0)return s();a==="bearer"?o.config.getToken(function(u,c){if(u)return i.response.error=u,s();try{var f=o.getSignerClass(i),p=new f(i.httpRequest);p.addAuthorization(c)}catch(d){i.response.error=d}s()}):o.config.getCredentials(function(u,c){if(u)return i.response.error=u,s();try{var f=o.getSkewCorrectedDate(),p=o.getSignerClass(i),d=i.service.api.operations||{},m=d[i.operation],v=new p(i.httpRequest,o.getSigningName(i),{signatureCache:o.config.signatureCache,operation:m,signatureVersion:o.api.signatureVersion});v.setServiceClientId(o._clientId),delete i.httpRequest.headers.Authorization,delete i.httpRequest.headers.Date,delete i.httpRequest.headers["X-Amz-Date"],v.addAuthorization(c,f),i.signedAt=f}catch(y){i.response.error=y}s()})}),e("VALIDATE_RESPONSE","validateResponse",function(i){this.service.successfulResponse(i,this)?(i.data={},i.error=null):(i.data=null,i.error=Tt.util.error(new Error,{code:"UnknownError",message:"An unknown error occurred."}))}),e("ERROR","error",function(i,s){var o=s.request.service.api.awsQueryCompatible;if(o){var a=s.httpResponse.headers,u=a?a["x-amzn-query-error"]:void 0;u&&u.includes(";")&&(s.error.code=u.split(";")[0])}},!0),t("SEND","send",function(i,s){i.httpResponse._abortCallback=s,i.error=null,i.data=null;function o(p){i.httpResponse.stream=p;var d=i.request.httpRequest.stream,m=i.request.service,v=m.api,y=i.request.operation,b=v.operations[y]||{};p.on("headers",function(E,S,w){if(i.request.emit("httpHeaders",[E,S,i,w]),!i.httpResponse.streaming)if(Tt.HttpClient.streamsApiVersion===2){if(b.hasEventOutput&&m.successfulResponse(i)){i.request.emit("httpDone"),s();return}p.on("readable",function(){var I=p.read();I!==null&&i.request.emit("httpData",[I,i])})}else p.on("data",function(I){i.request.emit("httpData",[I,i])})}),p.on("end",function(){if(!d||!d.didCallback){if(Tt.HttpClient.streamsApiVersion===2&&b.hasEventOutput&&m.successfulResponse(i))return;i.request.emit("httpDone"),s()}})}function a(p){p.on("sendProgress",function(m){i.request.emit("httpUploadProgress",[m,i])}),p.on("receiveProgress",function(m){i.request.emit("httpDownloadProgress",[m,i])})}function u(p){if(p.code!=="RequestAbortedError"){var d=p.code==="TimeoutError"?p.code:"NetworkingError";p=Tt.util.error(p,{code:d,region:i.request.httpRequest.region,hostname:i.request.httpRequest.endpoint.hostname,retryable:!0})}i.error=p,i.request.emit("httpError",[i.error,i],function(){s()})}function c(){var p=Tt.HttpClient.getInstance(),d=i.request.service.config.httpOptions||{};try{var m=p.handleRequest(i.request.httpRequest,d,o,u);a(m)}catch(v){u(v)}}var f=(i.request.service.getSkewCorrectedDate()-this.signedAt)/1e3;f>=60*10?this.emit("sign",[this],function(p){p?s(p):c()}):c()}),e("HTTP_HEADERS","httpHeaders",function(i,s,o,a){o.httpResponse.statusCode=i,o.httpResponse.statusMessage=a,o.httpResponse.headers=s,o.httpResponse.body=Tt.util.buffer.toBuffer(""),o.httpResponse.buffers=[],o.httpResponse.numBytes=0;var u=s.date||s.Date,c=o.request.service;if(u){var f=Date.parse(u);c.config.correctClockSkew&&c.isClockSkewed(f)&&c.applyClockOffset(f)}}),e("HTTP_DATA","httpData",function(i,s){if(i){if(Tt.util.isNode()){s.httpResponse.numBytes+=i.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(Tt.util.buffer.toBuffer(i))}}),e("HTTP_DONE","httpDone",function(i){if(i.httpResponse.buffers&&i.httpResponse.buffers.length>0){var s=Tt.util.buffer.concat(i.httpResponse.buffers);i.httpResponse.body=s}delete i.httpResponse.numBytes,delete i.httpResponse.buffers}),e("FINALIZE_ERROR","retry",function(i){i.httpResponse.statusCode&&(i.error.statusCode=i.httpResponse.statusCode,i.error.retryable===void 0&&(i.error.retryable=this.service.retryableError(i.error,this)))}),e("INVALIDATE_CREDENTIALS","retry",function(i){if(i.error)switch(i.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":i.error.retryable=!0,i.request.service.config.credentials.expired=!0}}),e("EXPIRED_SIGNATURE","retry",function(i){var s=i.error;s&&typeof s.code=="string"&&typeof s.message=="string"&&s.code.match(/Signature/)&&s.message.match(/expired/)&&(i.error.retryable=!0)}),e("CLOCK_SKEWED","retry",function(i){i.error&&this.service.clockSkewError(i.error)&&this.service.config.correctClockSkew&&(i.error.retryable=!0)}),e("REDIRECT","retry",function(i){i.error&&i.error.statusCode>=300&&i.error.statusCode<400&&i.httpResponse.headers.location&&(this.httpRequest.endpoint=new Tt.Endpoint(i.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,i.error.redirect=!0,i.error.retryable=!0)}),e("RETRY_CHECK","retry",function(i){i.error&&(i.error.redirect&&i.redirectCount<i.maxRedirects?i.error.retryDelay=0:i.retryCount<i.maxRetries&&(i.error.retryDelay=this.service.retryDelays(i.retryCount,i.error)||0))}),t("RESET_RETRY_STATE","afterRetry",function(i,s){var o,a=!1;i.error&&(o=i.error.retryDelay||0,i.error.retryable&&i.retryCount<i.maxRetries?(i.retryCount++,a=!0):i.error.redirect&&i.redirectCount<i.maxRedirects&&(i.redirectCount++,a=!0)),a&&o>=0?(i.error=null,setTimeout(s,o)):s()})}),CorePost:new Xc().addNamedListeners(function(e){e("EXTRACT_REQUEST_ID","extractData",Tt.util.extractRequestId),e("EXTRACT_REQUEST_ID","extractError",Tt.util.extractRequestId),e("ENOTFOUND_ERROR","httpError",function(r){function n(s){return s.errno==="ENOTFOUND"||typeof s.errno=="number"&&typeof Tt.util.getSystemErrorName=="function"&&["EAI_NONAME","EAI_NODATA"].indexOf(Tt.util.getSystemErrorName(s.errno)>=0)}if(r.code==="NetworkingError"&&n(r)){var i="Inaccessible host: `"+r.hostname+"' at port `"+r.port+"'. This service may not be available in the `"+r.region+"' region.";this.response.error=Tt.util.error(new Error(i),{code:"UnknownEndpoint",region:r.region,hostname:r.hostname,retryable:!0,originalError:r})}})}),Logger:new Xc().addNamedListeners(function(e){e("LOG_REQUEST","complete",function(r){var n=r.request,i=n.service.config.logger;if(!i)return;function s(u,c){if(!c)return c;if(u.isSensitive)return"***SensitiveInformation***";switch(u.type){case"structure":var f={};return Tt.util.each(c,function(m,v){Object.prototype.hasOwnProperty.call(u.members,m)?f[m]=s(u.members[m],v):f[m]=v}),f;case"list":var p=[];return Tt.util.arrayEach(c,function(m,v){p.push(s(u.member,m))}),p;case"map":var d={};return Tt.util.each(c,function(m,v){d[m]=s(u.value,v)}),d;default:return c}}function o(){var u=r.request.service.getSkewCorrectedDate().getTime(),c=(u-n.startTime.getTime())/1e3,f=!!i.isTTY,p=r.httpResponse.statusCode,d=n.params;if(n.service.api.operations&&n.service.api.operations[n.operation]&&n.service.api.operations[n.operation].input){var m=n.service.api.operations[n.operation].input;d=s(m,n.params)}var v=require("util").inspect(d,!0,null),y="";return f&&(y+="\x1B[33m"),y+="[AWS "+n.service.serviceIdentifier+" "+p,y+=" "+c.toString()+"s "+r.retryCount+" retries]",f&&(y+="\x1B[0;1m"),y+=" "+Tt.util.string.lowerFirst(n.operation),y+="("+v+")",f&&(y+="\x1B[0m"),y}var a=o();typeof i.log=="function"?i.log(a):typeof i.write=="function"&&i.write(a+`
185
185
  `)})}),Json:new Xc().addNamedListeners(function(e){var t=sT();e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Rest:new Xc().addNamedListeners(function(e){var t=ax();e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestJson:new Xc().addNamedListeners(function(e){var t=d3();e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError),e("UNSET_CONTENT_LENGTH","afterBuild",t.unsetContentLength)}),RestXml:new Xc().addNamedListeners(function(e){var t=m3();e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Query:new Xc().addNamedListeners(function(e){var t=l3();e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})}});var iye=g((Kur,nye)=>{function I3(e,t){this.currentState=t||null,this.states=e||{}}I3.prototype.runTo=function(t,r,n,i){typeof t=="function"&&(i=n,n=r,r=t,t=null);var s=this,o=s.states[s.currentState];o.fn.call(n||s,i,function(a){if(a)if(o.fail)s.currentState=o.fail;else return r?r.call(n,a):null;else if(o.accept)s.currentState=o.accept;else return r?r.call(n):null;if(s.currentState===t)return r?r.call(n,a):null;s.runTo(t,r,n,a)})};I3.prototype.addState=function(t,r,n,i){return typeof r=="function"?(i=r,r=null,n=null):typeof n=="function"&&(i=n,n=null),this.currentState||(this.currentState=t),this.states[t]={accept:r,fail:n,fn:i},this};nye.exports=I3});var xT=g(vT=>{(function(e){"use strict";function t(L){return L!==null?Object.prototype.toString.call(L)==="[object Array]":!1}function r(L){return L!==null?Object.prototype.toString.call(L)==="[object Object]":!1}function n(L,W){if(L===W)return!0;var K=Object.prototype.toString.call(L);if(K!==Object.prototype.toString.call(W))return!1;if(t(L)===!0){if(L.length!==W.length)return!1;for(var se=0;se<L.length;se++)if(n(L[se],W[se])===!1)return!1;return!0}if(r(L)===!0){var le={};for(var Ee in L)if(hasOwnProperty.call(L,Ee)){if(n(L[Ee],W[Ee])===!1)return!1;le[Ee]=!0}for(var et in W)if(hasOwnProperty.call(W,et)&&le[et]!==!0)return!1;return!0}return!1}function i(L){if(L===""||L===!1||L===null)return!0;if(t(L)&&L.length===0)return!0;if(r(L)){for(var W in L)if(L.hasOwnProperty(W))return!1;return!0}else return!1}function s(L){for(var W=Object.keys(L),K=[],se=0;se<W.length;se++)K.push(L[W[se]]);return K}function o(L,W){var K={};for(var se in L)K[se]=L[se];for(var le in W)K[le]=W[le];return K}var a;typeof String.prototype.trimLeft=="function"?a=function(L){return L.trimLeft()}:a=function(L){return L.match(/^\s*(.*)/)[1]};var u=0,c=1,f=2,p=3,d=4,m=5,v=6,y=7,b=8,_=9,E={0:"number",1:"any",2:"string",3:"array",4:"object",5:"boolean",6:"expression",7:"null",8:"Array<number>",9:"Array<string>"},S="EOF",w="UnquotedIdentifier",C="QuotedIdentifier",I="Rbracket",j="Rparen",q="Comma",D="Colon",N="Rbrace",k="Number",R="Current",z="Expref",X="Pipe",B="Or",U="And",Q="EQ",G="GT",re="LT",oe="GTE",he="LTE",Ne="NE",Qe="Flatten",$e="Star",Je="Filter",Ae="Dot",$t="Not",at="Lbrace",ye="Lbracket",F="Lparen",A="Literal",te={".":Ae,"*":$e,",":q,":":D,"{":at,"}":N,"]":I,"(":F,")":j,"@":R},Y={"<":!0,">":!0,"=":!0,"!":!0},Xe={" ":!0," ":!0,"\n":!0};function He(L){return L>="a"&&L<="z"||L>="A"&&L<="Z"||L==="_"}function Jt(L){return L>="0"&&L<="9"||L==="-"}function Ir(L){return L>="a"&&L<="z"||L>="A"&&L<="Z"||L>="0"&&L<="9"||L==="_"}function en(){}en.prototype={tokenize:function(L){var W=[];this._current=0;for(var K,se,le;this._current<L.length;)if(He(L[this._current]))K=this._current,se=this._consumeUnquotedIdentifier(L),W.push({type:w,value:se,start:K});else if(te[L[this._current]]!==void 0)W.push({type:te[L[this._current]],value:L[this._current],start:this._current}),this._current++;else if(Jt(L[this._current]))le=this._consumeNumber(L),W.push(le);else if(L[this._current]==="[")le=this._consumeLBracket(L),W.push(le);else if(L[this._current]==='"')K=this._current,se=this._consumeQuotedIdentifier(L),W.push({type:C,value:se,start:K});else if(L[this._current]==="'")K=this._current,se=this._consumeRawStringLiteral(L),W.push({type:A,value:se,start:K});else if(L[this._current]==="`"){K=this._current;var Ee=this._consumeLiteral(L);W.push({type:A,value:Ee,start:K})}else if(Y[L[this._current]]!==void 0)W.push(this._consumeOperator(L));else if(Xe[L[this._current]]!==void 0)this._current++;else if(L[this._current]==="&")K=this._current,this._current++,L[this._current]==="&"?(this._current++,W.push({type:U,value:"&&",start:K})):W.push({type:z,value:"&",start:K});else if(L[this._current]==="|")K=this._current,this._current++,L[this._current]==="|"?(this._current++,W.push({type:B,value:"||",start:K})):W.push({type:X,value:"|",start:K});else{var et=new Error("Unknown character:"+L[this._current]);throw et.name="LexerError",et}return W},_consumeUnquotedIdentifier:function(L){var W=this._current;for(this._current++;this._current<L.length&&Ir(L[this._current]);)this._current++;return L.slice(W,this._current)},_consumeQuotedIdentifier:function(L){var W=this._current;this._current++;for(var K=L.length;L[this._current]!=='"'&&this._current<K;){var se=this._current;L[se]==="\\"&&(L[se+1]==="\\"||L[se+1]==='"')?se+=2:se++,this._current=se}return this._current++,JSON.parse(L.slice(W,this._current))},_consumeRawStringLiteral:function(L){var W=this._current;this._current++;for(var K=L.length;L[this._current]!=="'"&&this._current<K;){var se=this._current;L[se]==="\\"&&(L[se+1]==="\\"||L[se+1]==="'")?se+=2:se++,this._current=se}this._current++;var le=L.slice(W+1,this._current-1);return le.replace("\\'","'")},_consumeNumber:function(L){var W=this._current;this._current++;for(var K=L.length;Jt(L[this._current])&&this._current<K;)this._current++;var se=parseInt(L.slice(W,this._current));return{type:k,value:se,start:W}},_consumeLBracket:function(L){var W=this._current;return this._current++,L[this._current]==="?"?(this._current++,{type:Je,value:"[?",start:W}):L[this._current]==="]"?(this._current++,{type:Qe,value:"[]",start:W}):{type:ye,value:"[",start:W}},_consumeOperator:function(L){var W=this._current,K=L[W];if(this._current++,K==="!")return L[this._current]==="="?(this._current++,{type:Ne,value:"!=",start:W}):{type:$t,value:"!",start:W};if(K==="<")return L[this._current]==="="?(this._current++,{type:he,value:"<=",start:W}):{type:re,value:"<",start:W};if(K===">")return L[this._current]==="="?(this._current++,{type:oe,value:">=",start:W}):{type:G,value:">",start:W};if(K==="="&&L[this._current]==="=")return this._current++,{type:Q,value:"==",start:W}},_consumeLiteral:function(L){this._current++;for(var W=this._current,K=L.length,se;L[this._current]!=="`"&&this._current<K;){var le=this._current;L[le]==="\\"&&(L[le+1]==="\\"||L[le+1]==="`")?le+=2:le++,this._current=le}var Ee=a(L.slice(W,this._current));return Ee=Ee.replace("\\`","`"),this._looksLikeJSON(Ee)?se=JSON.parse(Ee):se=JSON.parse('"'+Ee+'"'),this._current++,se},_looksLikeJSON:function(L){var W='[{"',K=["true","false","null"],se="-0123456789";if(L==="")return!1;if(W.indexOf(L[0])>=0)return!0;if(K.indexOf(L)>=0)return!0;if(se.indexOf(L[0])>=0)try{return JSON.parse(L),!0}catch{return!1}else return!1}};var ke={};ke[S]=0,ke[w]=0,ke[C]=0,ke[I]=0,ke[j]=0,ke[q]=0,ke[N]=0,ke[k]=0,ke[R]=0,ke[z]=0,ke[X]=1,ke[B]=2,ke[U]=3,ke[Q]=5,ke[G]=5,ke[re]=5,ke[oe]=5,ke[he]=5,ke[Ne]=5,ke[Qe]=9,ke[$e]=20,ke[Je]=21,ke[Ae]=40,ke[$t]=45,ke[at]=50,ke[ye]=55,ke[F]=60;function rr(){}rr.prototype={parse:function(L){this._loadTokens(L),this.index=0;var W=this.expression(0);if(this._lookahead(0)!==S){var K=this._lookaheadToken(0),se=new Error("Unexpected token type: "+K.type+", value: "+K.value);throw se.name="ParserError",se}return W},_loadTokens:function(L){var W=new en,K=W.tokenize(L);K.push({type:S,value:"",start:L.length}),this.tokens=K},expression:function(L){var W=this._lookaheadToken(0);this._advance();for(var K=this.nud(W),se=this._lookahead(0);L<ke[se];)this._advance(),K=this.led(se,K),se=this._lookahead(0);return K},_lookahead:function(L){return this.tokens[this.index+L].type},_lookaheadToken:function(L){return this.tokens[this.index+L]},_advance:function(){this.index++},nud:function(L){var W,K,se;switch(L.type){case A:return{type:"Literal",value:L.value};case w:return{type:"Field",name:L.value};case C:var le={type:"Field",name:L.value};if(this._lookahead(0)===F)throw new Error("Quoted identifier not allowed for function names.");return le;case $t:return K=this.expression(ke.Not),{type:"NotExpression",children:[K]};case $e:return W={type:"Identity"},K=null,this._lookahead(0)===I?K={type:"Identity"}:K=this._parseProjectionRHS(ke.Star),{type:"ValueProjection",children:[W,K]};case Je:return this.led(L.type,{type:"Identity"});case at:return this._parseMultiselectHash();case Qe:return W={type:Qe,children:[{type:"Identity"}]},K=this._parseProjectionRHS(ke.Flatten),{type:"Projection",children:[W,K]};case ye:return this._lookahead(0)===k||this._lookahead(0)===D?(K=this._parseIndexExpression(),this._projectIfSlice({type:"Identity"},K)):this._lookahead(0)===$e&&this._lookahead(1)===I?(this._advance(),this._advance(),K=this._parseProjectionRHS(ke.Star),{type:"Projection",children:[{type:"Identity"},K]}):this._parseMultiselectList();case R:return{type:R};case z:return se=this.expression(ke.Expref),{type:"ExpressionReference",children:[se]};case F:for(var Ee=[];this._lookahead(0)!==j;)this._lookahead(0)===R?(se={type:R},this._advance()):se=this.expression(0),Ee.push(se);return this._match(j),Ee[0];default:this._errorToken(L)}},led:function(L,W){var K;switch(L){case Ae:var se=ke.Dot;return this._lookahead(0)!==$e?(K=this._parseDotRHS(se),{type:"Subexpression",children:[W,K]}):(this._advance(),K=this._parseProjectionRHS(se),{type:"ValueProjection",children:[W,K]});case X:return K=this.expression(ke.Pipe),{type:X,children:[W,K]};case B:return K=this.expression(ke.Or),{type:"OrExpression",children:[W,K]};case U:return K=this.expression(ke.And),{type:"AndExpression",children:[W,K]};case F:for(var le=W.name,Ee=[],et,mt;this._lookahead(0)!==j;)this._lookahead(0)===R?(et={type:R},this._advance()):et=this.expression(0),this._lookahead(0)===q&&this._match(q),Ee.push(et);return this._match(j),mt={type:"Function",name:le,children:Ee},mt;case Je:var ln=this.expression(0);return this._match(I),this._lookahead(0)===Qe?K={type:"Identity"}:K=this._parseProjectionRHS(ke.Filter),{type:"FilterProjection",children:[W,K,ln]};case Qe:var Ji={type:Qe,children:[W]},Wr=this._parseProjectionRHS(ke.Flatten);return{type:"Projection",children:[Ji,Wr]};case Q:case Ne:case G:case oe:case re:case he:return this._parseComparator(W,L);case ye:var Ge=this._lookaheadToken(0);return Ge.type===k||Ge.type===D?(K=this._parseIndexExpression(),this._projectIfSlice(W,K)):(this._match($e),this._match(I),K=this._parseProjectionRHS(ke.Star),{type:"Projection",children:[W,K]});default:this._errorToken(this._lookaheadToken(0))}},_match:function(L){if(this._lookahead(0)===L)this._advance();else{var W=this._lookaheadToken(0),K=new Error("Expected "+L+", got: "+W.type);throw K.name="ParserError",K}},_errorToken:function(L){var W=new Error("Invalid token ("+L.type+'): "'+L.value+'"');throw W.name="ParserError",W},_parseIndexExpression:function(){if(this._lookahead(0)===D||this._lookahead(1)===D)return this._parseSliceExpression();var L={type:"Index",value:this._lookaheadToken(0).value};return this._advance(),this._match(I),L},_projectIfSlice:function(L,W){var K={type:"IndexExpression",children:[L,W]};return W.type==="Slice"?{type:"Projection",children:[K,this._parseProjectionRHS(ke.Star)]}:K},_parseSliceExpression:function(){for(var L=[null,null,null],W=0,K=this._lookahead(0);K!==I&&W<3;){if(K===D)W++,this._advance();else if(K===k)L[W]=this._lookaheadToken(0).value,this._advance();else{var se=this._lookahead(0),le=new Error("Syntax error, unexpected token: "+se.value+"("+se.type+")");throw le.name="Parsererror",le}K=this._lookahead(0)}return this._match(I),{type:"Slice",children:L}},_parseComparator:function(L,W){var K=this.expression(ke[W]);return{type:"Comparator",name:W,children:[L,K]}},_parseDotRHS:function(L){var W=this._lookahead(0),K=[w,C,$e];if(K.indexOf(W)>=0)return this.expression(L);if(W===ye)return this._match(ye),this._parseMultiselectList();if(W===at)return this._match(at),this._parseMultiselectHash()},_parseProjectionRHS:function(L){var W;if(ke[this._lookahead(0)]<10)W={type:"Identity"};else if(this._lookahead(0)===ye)W=this.expression(L);else if(this._lookahead(0)===Je)W=this.expression(L);else if(this._lookahead(0)===Ae)this._match(Ae),W=this._parseDotRHS(L);else{var K=this._lookaheadToken(0),se=new Error("Sytanx error, unexpected token: "+K.value+"("+K.type+")");throw se.name="ParserError",se}return W},_parseMultiselectList:function(){for(var L=[];this._lookahead(0)!==I;){var W=this.expression(0);if(L.push(W),this._lookahead(0)===q&&(this._match(q),this._lookahead(0)===I))throw new Error("Unexpected token Rbracket")}return this._match(I),{type:"MultiSelectList",children:L}},_parseMultiselectHash:function(){for(var L=[],W=[w,C],K,se,le,Ee;;){if(K=this._lookaheadToken(0),W.indexOf(K.type)<0)throw new Error("Expecting an identifier token, got: "+K.type);if(se=K.value,this._advance(),this._match(D),le=this.expression(0),Ee={type:"KeyValuePair",name:se,value:le},L.push(Ee),this._lookahead(0)===q)this._match(q);else if(this._lookahead(0)===N){this._match(N);break}}return{type:"MultiSelectHash",children:L}}};function qn(L){this.runtime=L}qn.prototype={search:function(L,W){return this.visit(L,W)},visit:function(L,W){var K,se,le,Ee,et,mt,ln,Ji,Wr,Ge;switch(L.type){case"Field":return W!==null&&r(W)?(mt=W[L.name],mt===void 0?null:mt):null;case"Subexpression":for(le=this.visit(L.children[0],W),Ge=1;Ge<L.children.length;Ge++)if(le=this.visit(L.children[1],le),le===null)return null;return le;case"IndexExpression":return ln=this.visit(L.children[0],W),Ji=this.visit(L.children[1],ln),Ji;case"Index":if(!t(W))return null;var ao=L.value;return ao<0&&(ao=W.length+ao),le=W[ao],le===void 0&&(le=null),le;case"Slice":if(!t(W))return null;var vy=L.children.slice(0),vp=this.computeSliceParams(W.length,vy),xy=vp[0],yy=vp[1],Im=vp[2];if(le=[],Im>0)for(Ge=xy;Ge<yy;Ge+=Im)le.push(W[Ge]);else for(Ge=xy;Ge>yy;Ge+=Im)le.push(W[Ge]);return le;case"Projection":var Qi=this.visit(L.children[0],W);if(!t(Qi))return null;for(Wr=[],Ge=0;Ge<Qi.length;Ge++)se=this.visit(L.children[1],Qi[Ge]),se!==null&&Wr.push(se);return Wr;case"ValueProjection":if(Qi=this.visit(L.children[0],W),!r(Qi))return null;Wr=[];var Rm=s(Qi);for(Ge=0;Ge<Rm.length;Ge++)se=this.visit(L.children[1],Rm[Ge]),se!==null&&Wr.push(se);return Wr;case"FilterProjection":if(Qi=this.visit(L.children[0],W),!t(Qi))return null;var Nm=[],_y=[];for(Ge=0;Ge<Qi.length;Ge++)K=this.visit(L.children[2],Qi[Ge]),i(K)||Nm.push(Qi[Ge]);for(var km=0;km<Nm.length;km++)se=this.visit(L.children[1],Nm[km]),se!==null&&_y.push(se);return _y;case"Comparator":switch(Ee=this.visit(L.children[0],W),et=this.visit(L.children[1],W),L.name){case Q:le=n(Ee,et);break;case Ne:le=!n(Ee,et);break;case G:le=Ee>et;break;case oe:le=Ee>=et;break;case re:le=Ee<et;break;case he:le=Ee<=et;break;default:throw new Error("Unknown comparator: "+L.name)}return le;case Qe:var cl=this.visit(L.children[0],W);if(!t(cl))return null;var xp=[];for(Ge=0;Ge<cl.length;Ge++)se=cl[Ge],t(se)?xp.push.apply(xp,se):xp.push(se);return xp;case"Identity":return W;case"MultiSelectList":if(W===null)return null;for(Wr=[],Ge=0;Ge<L.children.length;Ge++)Wr.push(this.visit(L.children[Ge],W));return Wr;case"MultiSelectHash":if(W===null)return null;Wr={};var ll;for(Ge=0;Ge<L.children.length;Ge++)ll=L.children[Ge],Wr[ll.name]=this.visit(ll.value,W);return Wr;case"OrExpression":return K=this.visit(L.children[0],W),i(K)&&(K=this.visit(L.children[1],W)),K;case"AndExpression":return Ee=this.visit(L.children[0],W),i(Ee)===!0?Ee:this.visit(L.children[1],W);case"NotExpression":return Ee=this.visit(L.children[0],W),i(Ee);case"Literal":return L.value;case X:return ln=this.visit(L.children[0],W),this.visit(L.children[1],ln);case R:return W;case"Function":var by=[];for(Ge=0;Ge<L.children.length;Ge++)by.push(this.visit(L.children[Ge],W));return this.runtime.callFunction(L.name,by);case"ExpressionReference":var wy=L.children[0];return wy.jmespathType=z,wy;default:throw new Error("Unknown node type: "+L.type)}},computeSliceParams:function(L,W){var K=W[0],se=W[1],le=W[2],Ee=[null,null,null];if(le===null)le=1;else if(le===0){var et=new Error("Invalid slice, step cannot be 0");throw et.name="RuntimeError",et}var mt=le<0;return K===null?K=mt?L-1:0:K=this.capSliceRange(L,K,le),se===null?se=mt?-1:L:se=this.capSliceRange(L,se,le),Ee[0]=K,Ee[1]=se,Ee[2]=le,Ee},capSliceRange:function(L,W,K){return W<0?(W+=L,W<0&&(W=K<0?-1:0)):W>=L&&(W=K<0?L-1:L),W}};function gp(L){this._interpreter=L,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[u]}]},avg:{_func:this._functionAvg,_signature:[{types:[b]}]},ceil:{_func:this._functionCeil,_signature:[{types:[u]}]},contains:{_func:this._functionContains,_signature:[{types:[f,p]},{types:[c]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[f]},{types:[f]}]},floor:{_func:this._functionFloor,_signature:[{types:[u]}]},length:{_func:this._functionLength,_signature:[{types:[f,p,d]}]},map:{_func:this._functionMap,_signature:[{types:[v]},{types:[p]}]},max:{_func:this._functionMax,_signature:[{types:[b,_]}]},merge:{_func:this._functionMerge,_signature:[{types:[d],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[p]},{types:[v]}]},sum:{_func:this._functionSum,_signature:[{types:[b]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[f]},{types:[f]}]},min:{_func:this._functionMin,_signature:[{types:[b,_]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[p]},{types:[v]}]},type:{_func:this._functionType,_signature:[{types:[c]}]},keys:{_func:this._functionKeys,_signature:[{types:[d]}]},values:{_func:this._functionValues,_signature:[{types:[d]}]},sort:{_func:this._functionSort,_signature:[{types:[_,b]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[p]},{types:[v]}]},join:{_func:this._functionJoin,_signature:[{types:[f]},{types:[_]}]},reverse:{_func:this._functionReverse,_signature:[{types:[f,p]}]},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}]}}}gp.prototype={callFunction:function(L,W){var K=this.functionTable[L];if(K===void 0)throw new Error("Unknown function: "+L+"()");return this._validateArgs(L,W,K._signature),K._func.call(this,W)},_validateArgs:function(L,W,K){var se;if(K[K.length-1].variadic){if(W.length<K.length)throw se=K.length===1?" argument":" arguments",new Error("ArgumentError: "+L+"() takes at least"+K.length+se+" but received "+W.length)}else if(W.length!==K.length)throw se=K.length===1?" argument":" arguments",new Error("ArgumentError: "+L+"() takes "+K.length+se+" but received "+W.length);for(var le,Ee,et,mt=0;mt<K.length;mt++){et=!1,le=K[mt].types,Ee=this._getTypeName(W[mt]);for(var ln=0;ln<le.length;ln++)if(this._typeMatches(Ee,le[ln],W[mt])){et=!0;break}if(!et){var Ji=le.map(function(Wr){return E[Wr]}).join(",");throw new Error("TypeError: "+L+"() expected argument "+(mt+1)+" to be type "+Ji+" but received type "+E[Ee]+" instead.")}}},_typeMatches:function(L,W,K){if(W===c)return!0;if(W===_||W===b||W===p){if(W===p)return L===p;if(L===p){var se;W===b?se=u:W===_&&(se=f);for(var le=0;le<K.length;le++)if(!this._typeMatches(this._getTypeName(K[le]),se,K[le]))return!1;return!0}}else return L===W},_getTypeName:function(L){switch(Object.prototype.toString.call(L)){case"[object String]":return f;case"[object Number]":return u;case"[object Array]":return p;case"[object Boolean]":return m;case"[object Null]":return y;case"[object Object]":return L.jmespathType===z?v:d}},_functionStartsWith:function(L){return L[0].lastIndexOf(L[1])===0},_functionEndsWith:function(L){var W=L[0],K=L[1];return W.indexOf(K,W.length-K.length)!==-1},_functionReverse:function(L){var W=this._getTypeName(L[0]);if(W===f){for(var K=L[0],se="",le=K.length-1;le>=0;le--)se+=K[le];return se}else{var Ee=L[0].slice(0);return Ee.reverse(),Ee}},_functionAbs:function(L){return Math.abs(L[0])},_functionCeil:function(L){return Math.ceil(L[0])},_functionAvg:function(L){for(var W=0,K=L[0],se=0;se<K.length;se++)W+=K[se];return W/K.length},_functionContains:function(L){return L[0].indexOf(L[1])>=0},_functionFloor:function(L){return Math.floor(L[0])},_functionLength:function(L){return r(L[0])?Object.keys(L[0]).length:L[0].length},_functionMap:function(L){for(var W=[],K=this._interpreter,se=L[0],le=L[1],Ee=0;Ee<le.length;Ee++)W.push(K.visit(se,le[Ee]));return W},_functionMerge:function(L){for(var W={},K=0;K<L.length;K++){var se=L[K];for(var le in se)W[le]=se[le]}return W},_functionMax:function(L){if(L[0].length>0){var W=this._getTypeName(L[0][0]);if(W===u)return Math.max.apply(Math,L[0]);for(var K=L[0],se=K[0],le=1;le<K.length;le++)se.localeCompare(K[le])<0&&(se=K[le]);return se}else return null},_functionMin:function(L){if(L[0].length>0){var W=this._getTypeName(L[0][0]);if(W===u)return Math.min.apply(Math,L[0]);for(var K=L[0],se=K[0],le=1;le<K.length;le++)K[le].localeCompare(se)<0&&(se=K[le]);return se}else return null},_functionSum:function(L){for(var W=0,K=L[0],se=0;se<K.length;se++)W+=K[se];return W},_functionType:function(L){switch(this._getTypeName(L[0])){case u:return"number";case f:return"string";case p:return"array";case d:return"object";case m:return"boolean";case v:return"expref";case y:return"null"}},_functionKeys:function(L){return Object.keys(L[0])},_functionValues:function(L){for(var W=L[0],K=Object.keys(W),se=[],le=0;le<K.length;le++)se.push(W[K[le]]);return se},_functionJoin:function(L){var W=L[0],K=L[1];return K.join(W)},_functionToArray:function(L){return this._getTypeName(L[0])===p?L[0]:[L[0]]},_functionToString:function(L){return this._getTypeName(L[0])===f?L[0]:JSON.stringify(L[0])},_functionToNumber:function(L){var W=this._getTypeName(L[0]),K;return W===u?L[0]:W===f&&(K=+L[0],!isNaN(K))?K:null},_functionNotNull:function(L){for(var W=0;W<L.length;W++)if(this._getTypeName(L[W])!==y)return L[W];return null},_functionSort:function(L){var W=L[0].slice(0);return W.sort(),W},_functionSortBy:function(L){var W=L[0].slice(0);if(W.length===0)return W;var K=this._interpreter,se=L[1],le=this._getTypeName(K.visit(se,W[0]));if([u,f].indexOf(le)<0)throw new Error("TypeError");for(var Ee=this,et=[],mt=0;mt<W.length;mt++)et.push([mt,W[mt]]);et.sort(function(Ji,Wr){var Ge=K.visit(se,Ji[1]),ao=K.visit(se,Wr[1]);if(Ee._getTypeName(Ge)!==le)throw new Error("TypeError: expected "+le+", received "+Ee._getTypeName(Ge));if(Ee._getTypeName(ao)!==le)throw new Error("TypeError: expected "+le+", received "+Ee._getTypeName(ao));return Ge>ao?1:Ge<ao?-1:Ji[0]-Wr[0]});for(var ln=0;ln<et.length;ln++)W[ln]=et[ln][1];return W},_functionMaxBy:function(L){for(var W=L[1],K=L[0],se=this.createKeyFunction(W,[u,f]),le=-1/0,Ee,et,mt=0;mt<K.length;mt++)et=se(K[mt]),et>le&&(le=et,Ee=K[mt]);return Ee},_functionMinBy:function(L){for(var W=L[1],K=L[0],se=this.createKeyFunction(W,[u,f]),le=1/0,Ee,et,mt=0;mt<K.length;mt++)et=se(K[mt]),et<le&&(le=et,Ee=K[mt]);return Ee},createKeyFunction:function(L,W){var K=this,se=this._interpreter,le=function(Ee){var et=se.visit(L,Ee);if(W.indexOf(K._getTypeName(et))<0){var mt="TypeError: expected one of "+W+", received "+K._getTypeName(et);throw new Error(mt)}return et};return le}};function Lo(L){var W=new rr,K=W.parse(L);return K}function ul(L){var W=new en;return W.tokenize(L)}function Fo(L,W){var K=new rr,se=new gp,le=new qn(se);se._interpreter=le;var Ee=K.parse(W);return le.search(Ee,L)}e.tokenize=ul,e.compile=Lo,e.search=Fo,e.strictDeepEqual=n})(typeof vT>"u"?vT.jmespath={}:vT)});var oye=g(()=>{var Yt=De(),sye=iye(),jAt=Yt.util.inherit,yT=Yt.util.domain,BAt=xT(),UAt={success:1,error:1,complete:1};function $At(e){return Object.prototype.hasOwnProperty.call(UAt,e._asm.currentState)}var R3=new sye;R3.setupStates=function(){var e=function(t,r){var n=this;n._haltHandlersOnError=!1,n.emit(n._asm.currentState,function(i){if(i)if($At(n))if(yT&&n.domain instanceof yT.Domain)i.domainEmitter=n,i.domain=n.domain,i.domainThrown=!1,n.domain.emit("error",i);else throw i;else n.response.error=i,r(i);else r(n.response.error)})};this.addState("validate","build","error",e),this.addState("build","afterBuild","restart",e),this.addState("afterBuild","sign","restart",e),this.addState("sign","send","retry",e),this.addState("retry","afterRetry","afterRetry",e),this.addState("afterRetry","sign","error",e),this.addState("send","validateResponse","retry",e),this.addState("validateResponse","extractData","extractError",e),this.addState("extractError","extractData","retry",e),this.addState("extractData","success","retry",e),this.addState("restart","build","error",e),this.addState("success","complete","complete",e),this.addState("error","complete","complete",e),this.addState("complete",null,null,e)};R3.setupStates();Yt.Request=jAt({constructor:function(t,r,n){var i=t.endpoint,s=t.config.region,o=t.config.customUserAgent;t.signingRegion?s=t.signingRegion:t.isGlobalEndpoint&&(s="us-east-1"),this.domain=yT&&yT.active,this.service=t,this.operation=r,this.params=n||{},this.httpRequest=new Yt.HttpRequest(i,s),this.httpRequest.appendToUserAgent(o),this.startTime=t.getSkewCorrectedDate(),this.response=new Yt.Response(this),this._asm=new sye(R3.states,"validate"),this._haltHandlersOnError=!1,Yt.SequentialExecutor.call(this),this.emit=this.emitEvent},send:function(t){return t&&(this.httpRequest.appendToUserAgent("callback"),this.on("complete",function(r){t.call(r,r.error,r.data)})),this.runTo(),this.response},build:function(t){return this.runTo("send",t)},runTo:function(t,r){return this._asm.runTo(t,r,this),this},abort:function(){return this.removeAllListeners("validateResponse"),this.removeAllListeners("extractError"),this.on("validateResponse",function(r){r.error=Yt.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(t){t=Yt.util.fn.makeAsync(t,3);function r(n){t.call(n,n.error,n.data,function(i){i!==!1&&(n.hasNextPage()?n.nextPage().on("complete",r).send():t.call(n,null,null,Yt.util.fn.noop))})}this.on("complete",r).send()},eachItem:function(t){var r=this;function n(i,s){if(i)return t(i,null);if(s===null)return t(null,null);var o=r.service.paginationConfig(r.operation),a=o.resultKey;Array.isArray(a)&&(a=a[0]);var u=BAt.search(s,a),c=!0;return Yt.util.arrayEach(u,function(f){if(c=t(null,f),c===!1)return Yt.util.abort}),c}this.eachPage(n)},isPageable:function(){return!!this.service.paginationConfig(this.operation)},createReadStream:function(){var t=Yt.util.stream,r=this,n=null;return Yt.HttpClient.streamsApiVersion===2?(n=new t.PassThrough,process.nextTick(function(){r.send()})):(n=new t.Stream,n.readable=!0,n.sent=!1,n.on("newListener",function(i){!n.sent&&i==="data"&&(n.sent=!0,process.nextTick(function(){r.send()}))})),this.on("error",function(i){n.emit("error",i)}),this.on("httpHeaders",function(s,o,a){if(s<300){r.removeListener("httpData",Yt.EventListeners.Core.HTTP_DATA),r.removeListener("httpError",Yt.EventListeners.Core.HTTP_ERROR),r.on("httpError",function(y){a.error=y,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 f=0}var p=function(){u&&f!==c?n.emit("error",Yt.util.error(new Error("Stream content length mismatch. Received "+f+" of "+c+" bytes."),{code:"StreamContentLengthMismatch"})):Yt.HttpClient.streamsApiVersion===2?n.end():n.emit("end")},d=a.httpResponse.createUnbufferedStream();if(Yt.HttpClient.streamsApiVersion===2)if(u){var m=new t.PassThrough;m._write=function(v){return v&&v.length&&(f+=v.length),t.PassThrough.prototype._write.apply(this,arguments)},m.on("end",p),n.on("error",function(v){u=!1,d.unpipe(m),m.emit("end"),m.end()}),d.pipe(m).pipe(n,{end:!1})}else d.pipe(n);else u&&d.on("data",function(v){v&&v.length&&(f+=v.length)}),d.on("data",function(v){n.emit("data",v)}),d.on("end",p);d.on("error",function(v){u=!1,n.emit("error",v)})}}),n},emitEvent:function(t,r,n){typeof r=="function"&&(n=r,r=null),n||(n=function(){}),r||(r=this.eventParameters(t,this.response));var i=Yt.SequentialExecutor.prototype.emit;i.call(this,t,r,function(s){s&&(this.response.error=s),n.call(this,s)})},eventParameters:function(t){switch(t){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(t,r){return!r&&typeof t=="function"&&(r=t,t=null),new Yt.Signers.Presign().sign(this.toGet(),t,r)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",Yt.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",Yt.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(t){t.httpRequest.method="GET",t.httpRequest.path=t.service.endpoint.path+"?"+t.httpRequest.body,t.httpRequest.body="",delete t.httpRequest.headers["Content-Length"],delete t.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}});Yt.Request.addPromisesToClass=function(t){this.prototype.promise=function(){var n=this;return this.httpRequest.appendToUserAgent("promise"),new t(function(i,s){n.on("complete",function(o){o.error?s(o.error):i(Object.defineProperty(o.data||{},"$response",{value:o}))}),n.runTo()})}};Yt.Request.deletePromisesFromClass=function(){delete this.prototype.promise};Yt.util.addPromises(Yt.Request);Yt.util.mixin(Yt.Request,Yt.SequentialExecutor)});var uye=g(()=>{var hx=De(),HAt=hx.util.inherit,aye=xT();hx.Response=HAt({constructor:function(t){this.request=t,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new hx.HttpResponse,t&&(this.maxRetries=t.service.numRetries(),this.maxRedirects=t.service.config.maxRedirects)},nextPage:function(t){var r,n=this.request.service,i=this.request.operation;try{r=n.paginationConfig(i,!0)}catch(u){this.error=u}if(!this.hasNextPage()){if(t)t(this.error,null);else if(this.error)throw this.error;return null}var s=hx.util.copy(this.request.params);if(this.nextPageTokens){var o=r.inputToken;typeof o=="string"&&(o=[o]);for(var a=0;a<o.length;a++)s[o[a]]=this.nextPageTokens[a];return n.makeRequest(this.request.operation,s,t)}else return t?t(null,null):null},hasNextPage:function(){if(this.cacheNextPageTokens(),this.nextPageTokens)return!0;if(this.nextPageTokens!==void 0)return!1},cacheNextPageTokens:function(){if(Object.prototype.hasOwnProperty.call(this,"nextPageTokens"))return this.nextPageTokens;this.nextPageTokens=void 0;var t=this.request.service.paginationConfig(this.request.operation);if(!t)return this.nextPageTokens;if(this.nextPageTokens=null,t.moreResults&&!aye.search(this.data,t.moreResults))return this.nextPageTokens;var r=t.outputToken;return typeof r=="string"&&(r=[r]),hx.util.arrayEach.call(this,r,function(n){var i=aye.search(this.data,n);i&&(this.nextPageTokens=this.nextPageTokens||[],this.nextPageTokens.push(i))}),this.nextPageTokens}})});var lye=g(()=>{var Zf=De(),WAt=Zf.util.inherit,nm=xT();function cye(e){var t=e.request._waiter,r=t.config.acceptors,n=!1,i="retry";r.forEach(function(s){if(!n){var o=t.matchers[s.matcher];o&&o(e,s.expected,s.argument)&&(n=!0,i=s.state)}}),!n&&e.error&&(i="failure"),i==="success"?t.setSuccess(e):t.setError(e,i==="retry")}Zf.ResourceWaiter=WAt({constructor:function(t,r){this.service=t,this.state=r,this.loadWaiterConfig(this.state)},service:null,state:null,config:null,matchers:{path:function(e,t,r){try{var n=nm.search(e.data,r)}catch{return!1}return nm.strictDeepEqual(n,t)},pathAll:function(e,t,r){try{var n=nm.search(e.data,r)}catch{return!1}Array.isArray(n)||(n=[n]);var i=n.length;if(!i)return!1;for(var s=0;s<i;s++)if(!nm.strictDeepEqual(n[s],t))return!1;return!0},pathAny:function(e,t,r){try{var n=nm.search(e.data,r)}catch{return!1}Array.isArray(n)||(n=[n]);for(var i=n.length,s=0;s<i;s++)if(nm.strictDeepEqual(n[s],t))return!0;return!1},status:function(e,t){var r=e.httpResponse.statusCode;return typeof r=="number"&&r===t},error:function(e,t){return typeof t=="string"&&e.error?t===e.error.code:t===!!e.error}},listeners:new Zf.SequentialExecutor().addNamedListeners(function(e){e("RETRY_CHECK","retry",function(t){var r=t.request._waiter;t.error&&t.error.code==="ResourceNotReady"&&(t.error.retryDelay=(r.config.delay||0)*1e3)}),e("CHECK_OUTPUT","extractData",cye),e("CHECK_ERROR","extractError",cye)}),wait:function(t,r){typeof t=="function"&&(r=t,t=void 0),t&&t.$waiter&&(t=Zf.util.copy(t),typeof t.$waiter.delay=="number"&&(this.config.delay=t.$waiter.delay),typeof t.$waiter.maxAttempts=="number"&&(this.config.maxAttempts=t.$waiter.maxAttempts),delete t.$waiter);var n=this.service.makeRequest(this.config.operation,t);return n._waiter=this,n.response.maxRetries=this.config.maxAttempts,n.addListeners(this.listeners),r&&n.send(r),n},setSuccess:function(t){t.error=null,t.data=t.data||{},t.request.removeAllListeners("extractData")},setError:function(t,r){t.data=null,t.error=Zf.util.error(t.error||new Error,{code:"ResourceNotReady",message:"Resource is not in the state "+this.state,retryable:r})},loadWaiterConfig:function(t){if(!this.service.api.waiters[t])throw new Zf.util.error(new Error,{code:"StateNotFoundError",message:"State "+t+" not found."});this.config=Zf.util.copy(this.service.api.waiters[t])}})});var pye=g((rcr,fye)=>{var Ru=De(),zAt=Ru.util.inherit;Ru.Signers.V2=zAt(Ru.Signers.RequestSigner,{addAuthorization:function(t,r){r||(r=Ru.util.date.getDate());var n=this.request;n.params.Timestamp=Ru.util.date.iso8601(r),n.params.SignatureVersion="2",n.params.SignatureMethod="HmacSHA256",n.params.AWSAccessKeyId=t.accessKeyId,t.sessionToken&&(n.params.SecurityToken=t.sessionToken),delete n.params.Signature,n.params.Signature=this.signature(t),n.body=Ru.util.queryParamsToString(n.params),n.headers["Content-Length"]=n.body.length},signature:function(t){return Ru.util.crypto.hmac(t.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var t=[];return t.push(this.request.method),t.push(this.request.endpoint.host.toLowerCase()),t.push(this.request.pathname()),t.push(Ru.util.queryParamsToString(this.request.params)),t.join(`
@@ -290,7 +290,7 @@ ${s}`)}}});var Szt,OLe=ae(()=>{"use strict";ti();Szt=async e=>{if(e.user&&e.user
290
290
  Install @ampt/cloud to allow it to run on Ampt, or migrate
291
291
  your project to use the Ampt SDK.
292
292
  `),e.logQuestion("Install @ampt/cloud?"),await e.confirm(!0)&&(e.viewSpinner("Installing @ampt/cloud"),await t.installDependency("@ampt/cloud"),e.logInfo("Installed @ampt/cloud")),e.logInfo("Check out the Ampt migration guide for more info:"),e.logUrl("https://getampt.com/docs/migrate-serverless-cloud/"))),n.astro?n["@ampt/astro"]:n.next&&(n["@ampt/nextjs"]||(e.logInfo("This looks like a NextJS project."),e.logQuestion("Install @ampt/nextjs?"),await e.confirm(!0)&&(e.viewSpinner("Installing @ampt/nextjs"),await t.installDependency("@ampt/nextjs"),e.logInfo("Installed @ampt/nextjs")),e.logInfo("For more information on running NextJS on Ampt, check out the docs:"),e.logUrl("https://www.getampt.com/docs/frameworks/next"))),t.nodeModulesInstalled===!1){let i=t.servicePackageManager;e.viewSpinner(`[${i}] Installing dependencies`);try{await t.installDependenciesIfExists(),e.logInfo("Installed project dependencies")}catch(s){e.logWarning("Failed to install dependencies"),e.logError(s)}}process.platform==="win32"&&Ie.enable()}var ULe,UB=ae(()=>{"use strict";ULe=xe(require("assert"));wr()});var kzt,$Le=ae(()=>{"use strict";ti();kzt=async e=>{var C;e.viewSpinner("Loading");let t=e.fs;if(await t.read(),!t.serviceFile)throw new Error("You must be inside an Ampt app directory to run this command.");let{user:r}=e,n=e.options.overwrite,i=r.username,s=((C=e.args)==null?void 0:C[0])||`${i}-${Math.random().toString(36).substr(2,5)}`,o=e.options.app||t.serviceFile.ampt.app,a=e.options.org||t.serviceFile.ampt.org;a||(a=await e.selectOrg(r)),e.viewSpinner("Loading");let u=new tr({orgName:a});await u.isAuthorized()||(e.logError(`You don't have access to the "${a}" org.`),a=await e.selectOrg(r)),u.update({orgName:a});let c=new Zt({org:u,serviceName:o}),p=(await c.listInstances()).find(I=>I.instanceName===s);if(p&&p.instanceType!=="preview")throw new Error(`You cannot overwrite an existing ${p.instanceType} environment.`);if(p&&!n&&(e.logInfo("This preview environment already exists. Are you sure you want to overwrite it?"),n=await e.confirm(),!n))if(e.isShellActive){await e.logCancelled();return}else await e.quit();let d=r.username,m=new pr({org:u,service:c,instanceName:d}),[v,y,b,_]=await Promise.all([c.get().catch(()=>({serviceName:o})),u.fetch(),p?m.get().catch(()=>{}):void 0,u.getRegions()]),E=await e.selectRegion({orgInfo:y,instanceInfo:b,serviceInfo:v,regions:_});if(!E)return e.logWarning("Deployment cancelled.");let S=new ws({org:u,service:c,instance:m,fullSync:e.options["full-sync"],cli:e});e.viewSpinner(`Creating new preview environment ${s} (${E.name})`,{timer:!0}),e.updateSpinnerStep("syncing"),await S.sync();let w=new pr({org:u,service:c,instanceName:s});if(i!==s){let{operationId:I}=await c.copy({sourceInstanceName:i,targetInstanceName:s,copyCode:!0,copyData:!0,copyStorage:!0,instanceType:"preview",region:E.code}),{success:j,message:q}=await e.messenger.waitForOperation({operationId:I,context:e,orgName:a,appName:o});if(q&&(j?e.logInfo(q):e.logError(q)),!j){e.logError("Share command failed"),e.setExitCode(1);return}}await w.get(),e.logSuccess(`Successfully created preview environment ${e.styles.bold(s)} (${E.name}).`),e.logUrl(w.url)}});var qzt,HLe=ae(()=>{"use strict";qzt=async e=>{await e.startSession()}});var Pzt,WLe=ae(()=>{"use strict";ti();Pzt=async e=>{e.viewSpinner("Loading");let t=e.fs;if(await t.read(),!t.serviceFile||!t.serviceFile.ampt||!t.serviceFile.ampt.app||!t.serviceFile.ampt.org){e.logInfo("This command must be run inside a service directory.");return}let{org:r,app:n}=t.serviceFile.ampt;if(!await Ni.isRunning({orgName:r,serviceName:n})){e.logInfo(`There's no dev server running for app "${n}" in org "${r}" at the moment.`);return}await Ni.stop(e,{orgName:r,serviceName:n}),e.logSuccess(`Successfully stopped the dev server for app "${n}" in org "${r}".`)}});var Dzt,zLe=ae(()=>{"use strict";wr();ti();Us();Dzt=async e=>{e.viewSpinner("Loading");let t=new Na,r=e.fs;if(await r.read(),!r.serviceFile)throw new Error("You must be inside an Ampt app directory to run this command.");let n=e.options.org||r.serviceFile.ampt.org,i=e.options.service||r.serviceFile.ampt.app||r.serviceFile.ampt.service,s=e.isShellActive?e.user.username:`test-${Math.random().toString(36).substring(2,7)}`;n||(n=await e.selectOrg(t)),e.viewSpinner("Loading");let o=new tr({orgName:n});await o.isAuthorized()||(e.logError(`You don't have access to the "${n}" org.`),n=await e.selectOrg(t)),o.update({orgName:n}),e.isShellActive||e.viewSpinner(`Starting test stage (${s})`);let a=new Zt({org:o,serviceName:i}),u=new pr({org:o,service:a,instanceType:"test",instanceName:s,cli:e});e.isShellActive||(await new ws({org:o,service:a,instance:u,fullSync:e.options["full-sync"],cli:e}).sync(),e.logSuccess(`Test instance started: ${u.url}`)),await u.get();let c=await u.connect({cli:e});try{e.viewSpinner("Running tests");let f=e.options.coverage||e.options.collectCoverage,p=e.args[0],d=e.options.workers,{timeout:m=3e5}=await u.test({coverage:f,pattern:p,workers:d}),v=await(c==null?void 0:c.waitForEvent({eventType:"ampt.test.completed",timeout:m+5e3}));fJ(e,v),v.data.coverage&&v.data.coverage.length&&f&&(e.viewSpinner("Collecting test coverage report"),await u.downloadTestCoverage(r.serviceRoot),e.logSuccess("Coverage report saved")),process.exitCode=v.data.results&&v.data.results.success?0:1}catch(f){e.logError(f)}e.isShellActive||(c==null||c.close(),e.viewSpinner("Deleting instance"),await u.delete(),e.logSuccess("Test instance deleted"),e.log(`Exiting with status code ${process.exitCode}`))}});var Lzt,GLe=ae(()=>{"use strict";Lzt=async e=>{var n;let t=e.fs;if(await t.read(),!t.serviceFile)throw new Error("You must be inside an Ampt app directory to run this command.");if(e.args.length===0){e.logInfo("Please enter the name of the npm package you want to uninstall.");let i=await e.prompt("type a package name");e.args.push(i)}let r=t.servicePackageManager;e.args.length===1?e.viewSpinner(`[${r}] Uninstalling ${e.args[0]}`):e.args.length>1&&e.viewSpinner(`[${r}] Uninstalling ${String(e.args.length)} packages`);try{let i=e.argv.includes("--dev");i&&(e.argv=e.argv.filter(s=>s!=="--dev")),await t.removeDependency(e.argv.slice(1),i),e.args.length===1?e.logSuccess(`Successfully uninstalled the ${(n=e.styles)==null?void 0:n.bold(e.args[0])} package.`):e.args.length>1&&e.logSuccess(`Successfully uninstalled ${String(e.args.length)} packages.`)}catch(i){e.session.captureException(i);let s=i.stdBuffer.toString();throw new Error(`Failed to uninstall due to the following error:
293
- ${s}`)}}});var Fzt,VLe=ae(()=>{"use strict";ti();Fzt=async e=>{e.viewSpinner("Loading");let t=e.fs;if(await t.read(),!t.serviceFile)throw new Error("You must be inside an Ampt app directory to run this command.");let{user:r}=e,n=e.options.org||t.serviceFile.ampt.org,i=e.options.app||t.serviceFile.ampt.app,s=e.args[0]||r.username;n||(n=await e.selectOrg(r)),e.viewSpinner("Loading");let o=new tr({orgName:n});await o.isAuthorized()||(e.logError(`You don't have access to the "${n}" org.`),n=await e.selectOrg(r)),o.update({orgName:n}),e.viewSpinner("Loading");let a=new Zt({org:o,serviceName:i}),u=new pr({org:o,service:a,instanceName:s});await u.get(),e.logUrl(u.url)}});var KLe,Mzt,XLe=ae(()=>{"use strict";KLe=xe(Uv()),Mzt=async e=>{e.log(`v${KLe.version}`)}});var $B={};_l($B,{bash:()=>hzt,clone:()=>mzt,dashboard:()=>gzt,delete:()=>vzt,deploy:()=>xzt,docs:()=>yzt,export:()=>_zt,help:()=>bzt,import:()=>wzt,install:()=>Ezt,login:()=>Szt,logout:()=>Tzt,open:()=>Czt,promote:()=>Azt,run:()=>Izt,sandbox:()=>Rzt,serverless:()=>Nzt,setup:()=>BB,share:()=>kzt,start:()=>qzt,stop:()=>Pzt,test:()=>Dzt,uninstall:()=>Lzt,url:()=>Fzt,version:()=>Mzt});var HB=ae(()=>{"use strict";gLe();xLe();yLe();_Le();bLe();wLe();ELe();TLe();CLe();ALe();OLe();ILe();RLe();NLe();LLe();FLe();BLe();UB();$Le();HLe();WLe();zLe();GLe();VLe();XLe()});var zB=xe(require("os")),Am=xe(f_()),QLe=xe(S8()),eFe=xe(T8()),oo=xe(R8()),tFe=xe(W8()),Do=xe(w7()),rFe=xe(T7()),mp=xe(A7()),nFe=xe(N7()),GB=xe(D7()),iFe=xe(J$()),VB=xe(YR()),KB=xe(JR()),XB=require("child_process"),oA=xe(AX()),sFe=require("fs/promises"),Om=xe(Dl()),uA=xe(jN());wr();i3();ti();Vf();ti();wr();Us();var YLe=(HB(),vt($B));var Cm=class extends Error{function=null;constructor(t,r){super(t),this.function=r}},nA=class e{static tutorialGitUrl="https://github.com/ampt-templates/tutorial";static logger=Ie.child({class:"Tutorial"});static exitCmd="end";static iterationCmds=["skip","next","done"];static fullTutorialSteps=["editor","sandbox","postSandbox","importData","postImportData","staticAssets","postStaticAssets","runningScripts","postRunningScripts","deploy","postDeploy","dashboard"];static basicTutorialSteps=["editor","sandbox","postSandbox"];welcomeMessage=["Welcome to Ampt!","This Ampt CLI tutorial allows you to exit anytime with 'end' and skip steps using 'skip'."];cli;name;type="basic";inProgress=!1;tutorialModeStart=void 0;nextCommand;activeStepIndex=null;stepOrder=["editor","sandbox","postSandbox","importData","postImportData","staticAssets","postStaticAssets","runningScripts","postRunningScripts","deploy","postDeploy","dashboard"];steps={editor:async t=>{let r=await(t==null?void 0:t()),n="To begin, let's open the project in a code editor.";return{title:"Open the project in an editor",pre:r?[n,'Run `code .` in the terminal to open the project in Visual Studio Code or type "done" to continue']:[n,'Open the project in your favorite code editor and type "done" to continue'],command:"code"}},sandbox:()=>Promise.resolve({title:"The Developer Sandbox",pre:["The URL above is your developer sandbox. Code changes are synced here in real-time","Your sandbox goes offline when you disconnect from the CLI","Open the URL in your favorite browser to see your app in action","Try making a change to the code, refresh, and see the changes in real-time!"],event:"sync"}),postSandbox:async()=>({title:"Sandbox Synced",pre:["Sandbox synced!","Any logs or errors from your sandbox are displayed here"],postAction:!0}),staticAssets:async()=>({title:"Static Assets",pre:["The `static` directory is automatically synced and served from your Ampt environment","This is useful for serving images, fonts, and other static assets",'Try moving "test.html" into the "static" directory and see it update in the sandbox'],event:"sync"}),postStaticAssets:async()=>{let t=this.cli.project.getSandboxUrl();return{postAction:!0,title:"Static Assets Synced",pre:["Static assets synced!",t?`Now, try navigating to ${t}/test.html to see the changes`:"Try navigating to the /test.html route to see the changes"]}},importData:async()=>({title:"Importing Data to @ampt/data",pre:['You can import data into your Ampt environment using the "import" command',"This command is useful for seeding your database with data for development and testing","Try running the import command now by typing `import` into the terminal"],post:["Data imported!","Now, try refreshing the sandbox to see the changes in the environment"],command:"import"}),postImportData:async()=>({title:"Data Imported!",pre:["Data imported!",this.type==="full"?"Now, try refreshing the sandbox to see the changes in the environment":"Data seeded from your data file is now available in your environment"],postAction:!0}),runningScripts:()=>Promise.resolve({title:"Running scripts within the Ampt context",pre:["The Ampt shell allows you to run scripts within the context of your app","For scripts within your package.json, prefix them with 'ampt', e.g. 'ampt:test'","Try running the test script by typing 'run test' into the terminal"],command:"run",runArg:"test"}),postRunningScripts:()=>Promise.resolve({title:"Scripts Run!",pre:["Nice, you just ran the test script!",'Ampt also automatically handles JS or TS files, just provide the path after the "run" command, e.g. "run scripts/list-todos.ts"'],postAction:!0}),deploy:()=>Promise.resolve({title:"Deploying to a permanent environment",pre:["To deploy your current sandbox, use the 'deploy prod' command to create a new stage environment named 'prod'"],post:["Stage deployed!","The URL above is a stage environment, and is always available."],command:"deploy"}),postDeploy:()=>Promise.resolve({title:"Stage Deployed!",pre:["Stage deployed!","The URL above is a stage environment, and is always available",'Updates to the stage environment are made using the "deploy" command, or automatically using Git CI/CD.'],postAction:!0}),dashboard:()=>Promise.resolve({title:"The Ampt Dashboard",pre:["The dashboard is where you can manage your Ampt environments, view logs, data, and more",'Try opening the your sandbox with the "dashboard" command'],command:"dashboard"}),build:()=>Promise.resolve({title:"Building the app",pre:["For projects with a build step, use 'build' to execute the ampt:build script in package.json","Build output is automatically synced and is available at your sandbox url"],command:"run",runArg:"build"})};constructor(t){if(!t.project)throw new Cm("Project should be set before Tutorial is initialized","constructor");this.cli=t}isExitCmd(t){return t===e.exitCmd}isIterationCmd(t){return e.iterationCmds.includes(t)}async iterateStep(t){let{skip:r=!1}=t||{skip:!1};if(this.inProgress&&this.activeStepIndex!==null){let n=this.activeStepIndex+1;if(this.activeStepIndex===0&&!this.cli.project.sandboxActive&&(this.cli.logSpace(),await this.cli.project.dev({logDashboard:!1})),this.reportAnalytics({exit:!1,step:this.stepOrder[this.activeStepIndex],event:"ampt.tutorial.step_completed"}),n<this.stepOrder.length){this.activeStepIndex=n;let i=await this.steps[this.stepOrder[this.activeStepIndex]]();r&&i.postAction&&n+1<this.stepOrder.length&&(this.activeStepIndex=n+1,i=await this.steps[this.stepOrder[this.activeStepIndex]]()),this.nextCommand=i.command||void 0,this.logStep({step:i}),!i.command&&!i.event&&!i.postAction&&await this.iterateStep()}else await this.complete()}}async onSync(t){if(this.inProgress&&this.activeStepIndex!==null){let r=this.stepOrder[this.activeStepIndex];((await this.steps[r]()).event==="sync"||r==="staticAssets"&&t.has("static"))&&await this.iterateStep()}}async handle(t){var r;if(this.inProgress&&this.activeStepIndex!==null){let n=this.stepOrder[this.activeStepIndex],i=await this.steps[n]();if(this.isExitCmd(t))return this.cli.project.sandboxActive||await this.cli.project.dev(),await this.complete({exit:!0});if(i.postAction&&(this.cli._staticViewInputMsg=void 0),this.isIterationCmd(t))return this.reportAnalytics({exit:!1,step:this.stepOrder[this.activeStepIndex]}),await this.iterateStep({skip:!0});if(i.command==="run"&&t==="run"&&(!this.cli.args[0]||i.runArg&&i.runArg!==this.cli.args[0])){this.cli.logWarning(`Invalid command: "${this.cli.styles.bold(this.cli.styles.red(t))}" - expected "${i.runArg}"`);return}else if(i.command&&t!==i.command){let s=this.cli.styles.purple(n==="build"?"build":i.command);this.cli.logWarning(`Invalid command: "${this.cli.styles.bold(this.cli.styles.red(t))}" - expected "${this.cli.styles.bold(s)}"`);return}else{if(i.command==="deploy"&&t==="deploy"&&!((r=this.cli.names)!=null&&r.instanceName)){this.cli.logWarning('You must provide a stage name to deploy to. Example: "deploy prod"');return}if(n==="editor"&&t==="code")await YLe.bash(this.cli);else{let s=YLe[t];if(t&&i.event==="sync"){this.cli.logWarning("Waiting for changes to sync to the sandbox...");return}if(!s){this.cli.logError(`Command "${t}" not found - expected "${i.command}"`);return}this.cli.logSpace(),await s(this.cli)}try{return this.cli.viewInput(),this.iterateStep()}catch(s){throw new Cm(s.message,"handle")}}}}async initTutorial(t="full"){var o,a,u,c;if(this.cli.project.org||await this.cli.project.authorize(),!this.cli.user)return await this.cli.quit("You must be logged in to start the Ampt tutorial");this.name=`${(o=this.cli.user)==null?void 0:o.username}-ampt-tutorial`,this.inProgress=!0,this.tutorialModeStart=process.hrtime.bigint(),this.type=t;let r=this.cli.project.org;if(this.type==="full"){if(!await this.cli.fs.detectGit())return await this.cli.quit("Git is required to start the Ampt tutorial");let f=async()=>{this.name=await this.cli.promptServiceName(this.name);let v=new Zt({org:this.cli.project.org,serviceName:this.name});if(await v.get().catch(()=>{}))return this.cli.logWarning(`App ${this.cli.styles.bold(this.cli.styles.purple(this.name))} already exists in ${this.cli.styles.bold(this.cli.styles.darkPurple(r.orgName))}`),await this.cli.confirm(!0,"Would you like to overwrite it?")?v:f();let b=await this.cli.fs.isCwdEmpty(),_=!1;if(b&&(_=await this.cli.confirm(!0,"Would you like to start the tutorial in the current directory?")),!_){if(await this.cli.fs.dirExists(this.name))if(this.cli.logWarning(`Directory "./${this.name}" already exists.`),await this.cli.confirm(!0,"Would you like to overwrite it?"))this.cli.logInfo(`Overwriting directory: ${this.cli.styles.bold(this.name)}`),await this.cli.fs.deleteServiceDir(this.name);else return f();await this.cli.fs.createServiceDir(this.name),this.cli.logInfo(`Created directory: ${this.cli.styles.bold(this.name)}`)}return v},p=await f(),d=(a=this.cli.user)==null?void 0:a.generateSandboxName();this.cli.viewSpinner("Cloning @ampt-templates/tutorial"),await this.cli.fs.cloneGitRepo({repoUrl:e.tutorialGitUrl}),await this.cli.fs.read({orgName:r.orgName,appName:this.name});let m=new pr({org:r,service:p,instanceName:d,cli:this.cli});this.cli.project.service=p,this.cli.project.instance=m}if(this.cli.viewSpinner("Installing dependencies"),await this.cli.fs.installDependenciesIfExists({cleanInstall:!0}),this.type==="basic"){let f=!!this.cli.fs.dataFile,p=(c=(u=this.cli.fs.serviceFile)==null?void 0:u.scripts)==null?void 0:c["ampt:build"],d=this.stepOrder.reduce((m,v)=>(v==="importData"||v==="postImportData")&&!f||v==="build"&&!p||v==="staticAssets"||v==="postStaticAssets"?m:[...m,v],[]);this.stepOrder=d,await this.cli.project.analyze(),await this.cli.project.detect(),await this.cli.project.connect()}else await this.cli.project.connect();this.cli.logGroup(this.welcomeMessage),this.activeStepIndex=0;let n=this.cli.fs.detectVsCode.bind(this.cli.fs),i=this.stepOrder[this.activeStepIndex],s=await this.steps[i](n);this.reportAnalytics({exit:!1,event:"ampt.tutorial.started",step:i}),this.logStep({step:s})}logStep(t){let{step:r}=t;this.cli.logSpace(),r.postAction?(this.cli.logGroup([r.pre].flat(),!0),this.cli._staticViewInputMsg='Type "next" or hit enter to continue',this.cli.viewInput()):this.cli.logGroup([r.title,r.pre].flat(),!0)}setType(t){this.type=t}getDurationMins(){let t=process.hrtime.bigint()-this.tutorialModeStart;return Math.round(Number(t)/6e10)}async complete(t){var i,s;let{exit:r=!1}=t||{exit:!1},n=this.stepOrder[this.activeStepIndex];this.reportAnalytics({exit:r,step:r?n:void 0}),this.inProgress=!1,this.activeStepIndex=null,await((s=(i=this.cli)==null?void 0:i.user)==null?void 0:s.updatePreferences({showTutorial:!1})),this.completeMsg()}reportAnalytics(t){var s,o,a;let{event:r,step:n,exit:i=!1}=t;mr({eventName:r||(i?"ampt.tutorial.skipped":"ampt.tutorial.completed"),eventData:{type:this.type,step:n,durationMinutes:r?void 0:this.getDurationMins(),userName:(s=this.cli.user)==null?void 0:s.username,orgName:(o=this.cli.project.org)==null?void 0:o.orgName,serviceName:(a=this.cli.project.service)==null?void 0:a.serviceName}})}completeMsg(){this.cli.logGroup([this.cli.styles.bold("We hope you enjoy using Ampt!"),"If you have any questions or feedback, join our discord: https://getampt.com/discord","To read up on everything Ampt, check out our docs: https://getampt.com/docs",`You can always re-run this tutorial with the command "${this.cli.styles.bold("tutorial")}"`,`You can clear this output with the command "${this.cli.styles.bold("clear")}"`,"Happy coding! \u{1F680}"])}};var JLe=xe(Dl()),iA=xe(require("assert"));ti();wr();var my=xe(require("path"));wr();ED();Us();Vf();var jzt=async e=>{var p,d,m,v,y,b,_,E,S;e.viewSpinner("Loading");let t=wD(e),r=e.fs;await r.read(),e.project.org||await e.project.authorize();let n=e.project.org,i=n.orgName,s=((d=(p=r.serviceFile)==null?void 0:p.ampt)==null?void 0:d.app)||((m=e.options)==null?void 0:m.app),o=(v=e.options)==null?void 0:v.template,a=[],u;e.viewSpinner("Loading");let c=(await n.listServices()).map(w=>w.serviceName),f;if(!s){if(e.viewSpinner("Loading"),c.length===0||e.options.template)f=!0;else{mr({eventName:"ampt.dev.prompt",eventData:{promptName:"createOrClone"}});let w=await r.readJsonFileIfExists(my.default.join(r.serviceRoot,"package.json"));if(w&&!(w!=null&&w.ampt)){s=await e.promptServiceName(e.isGitPod?o:my.default.basename(r.serviceRoot)),e.viewSpinner(`Migrating ${s} to ampt`),await r.initService({orgName:i,serviceName:s,existingProject:!0}),e.viewSpinner("Installing dependencies"),await r.installDependenciesIfExists(),e.logInfo(`Successfully migrated ${(y=e.styles)==null?void 0:y.bold(s)} to ampt!`);return}else if(!w){if(e.logQuestion("Do you want to create a new app?"),!await e.confirm()){await e.quit();return}f=!0}}if(f){let{serviceExceeded:w,instanceExceeded:C}=await n.validateLimits();if(w)return e.handleServiceLimitExceeded();if(C)return e.handleInstanceLimitExceeded();if(e.viewSpinner("Loading"),mr({eventName:"ampt.dev.prompt",eventData:{promptName:"template"}}),a=await t||[],Ie.trace({coreTemplates:a},"templates list"),!o)e.logInfo("Please choose an app template to generate in this directory."),o=(await e.select(a)).name;else if(!a.find(I=>I.name===o)){e.logError(`Template "${o}" not found.`),await e.quit();return}for(u=a.find(I=>I.name===o),s=await e.promptServiceName(e.isGitPod||o?o:my.default.basename(r.serviceRoot));c.includes(s)&&(e.logWarning(`App ${(_=e.styles)==null?void 0:_.purple((b=e.styles)==null?void 0:b.bold(`"${s}"`))} already exists for this org.`),e.logQuestion("Would you like to overwrite it?"),!await e.confirm());)s=await e.promptServiceName(s);if(Ie.trace({serviceName:s},"entered service name"),!e.isWebIde&&!await r.isCwdEmpty())if(e.logWarning("This directory is not empty."),e.logInfo(`Would you like to make a new subdirectory for ${(E=e.styles)==null?void 0:E.bold(s)}?`),await e.confirm()){let j=async()=>{try{r.createServiceDir(s)}catch(q){if(q instanceof Yh)if(e.logWarning(`Directory "./${s}" already exists.`),await e.confirm(!1,"Would you like to overwrite it?"))r.deleteServiceDir(s),r.createServiceDir(s);else return s=await e.promptServiceName(s||e.isGitPod?o:my.default.basename(r.serviceRoot)),j()}};await j(),await r.read({orgName:i})}else{await e.quit();return}e.viewSpinner("Generating app files");try{await r.initService({orgName:i,serviceName:s,template:u}),r.dataFile&&(e.project.isSeedingEnabled=!0)}catch(I){if(I instanceof Zh){await e.quit("Git was not detected on your system. Please install it and try again.");return}throw I}e.viewSpinner("Installing dependencies"),await r.installDependenciesIfExists(),e.logSuccess(`Successfully generated app ${(S=e.styles)==null?void 0:S.bold(s)}.`)}else await r.initService({orgName:i,existingProject:!0});f&&e.logInfo("Join our Discord! https://getampt.com/discord")}},ZLe=jzt;UB();wr();cu();function WB(e){(async()=>{let{orgName:t,serviceName:r,instanceName:n}=e;try{await ze({method:"POST",body:e,endpoint:`/orgs/${t}/services/${r}/instances/${n}/metrics`})}catch(i){fr.captureException(i),process.env.AMPT_DEBUG&&console.error(i)}})()}var sA=class e{cli;org;service;instance;data;code;isSeedingEnabled=!1;isReseedingEnabled=!1;devModeStart=void 0;messenger;sandboxActive=!1;syncInProgress=!1;queuedFilePaths=new Set;static logger=Ie.child({class:"Ampt"});constructor(t){this.cli=t}getSandboxUrl(){if(this.instance)return this.instance.url}getDashboardUrl(){if(this.org&&this.service&&this.instance)return`${process.env.AMPT_DASHBOARD_URL_ROOT}/orgs/${this.org.orgName}/apps/${this.service.serviceName}/environments/${this.instance.instanceName}`}async boot(){await this.analyze(),await this.detect(),await this.connect(),await this.dev()}async selectOrg(){var s,o,a;let t=this.cli,r=t.user;if(!r)return await this.cli.quit("You must be logged in to use this command.");if(await r.listOrgs(),((s=r.orgs)==null?void 0:s.length)===0)return await t.quit("You do not have access to any organizations.");let n=t.options.org;((o=r.orgs)==null?void 0:o.length)===1&&!n?n=r.orgs[0].orgName:((a=r.orgs)==null?void 0:a.length)>1&&!n&&(n=await t.selectOrg(r));let i=new tr({orgName:n});i.update({orgName:n}),this.org=i}async authorize(){var n,i,s;this.cli.viewSpinner("Authorizing");let t=this.cli.user,r=this.cli.options.org||((i=(n=this.cli.fs.serviceFile)==null?void 0:n.ampt)==null?void 0:i.org);if(r&&!t.hasAccessToOrg(r)&&(this.cli.logWarning(`Org "${r}" has either been deleted, renamed, or you no longer have access to it.`),r=void 0),r?this.org=new tr({orgName:r}):(mr({eventName:"ampt.dev.prompt",eventData:{promptName:"org"}}),await this.selectOrg(),await this.cli.fs.readServiceFileIfExists({orgName:r||((s=this.org)==null?void 0:s.orgName)})),!this.org)return await this.cli.quit("Ampt Organization is required");await this.org.isAuthorized()||(this.cli.logError(`You don't have access to the "${r}" org.`),await this.selectOrg()),this.cli._activeOrgName=this.org.orgName}async analyze(){this.cli.viewSpinner("Analyzing Project"),await BB(this.cli),await this.cli.checkForAmptPackageUpdates()}async hydrate(){if(!this.org){await this.cli.quit("Ampt Organization is required");return}if(!this.service){await this.cli.quit("Ampt App is required");return}if(!this.instance){await this.cli.quit("Ampt Environment is required");return}let[t,r,n,i]=await Promise.all([this.instance.get().catch(()=>{}),this.service.get().catch(()=>{}),this.org.fetch(),this.org.getRegions()]),s=await this.cli.selectRegion({orgInfo:n,serviceInfo:r,instanceInfo:t,regions:i});if(!s){this.cli.logError("No region selected."),await this.cli.quit();return}this.instance.region=s.code}async detect(t){var i,s,o;let{serviceName:r}=t||{serviceName:void 0};this.cli.viewSpinner("Starting");let n=r||this.cli.options.app||((s=(i=this.cli.fs.serviceFile)==null?void 0:i.ampt)==null?void 0:s.app);n||(mr({eventName:"ampt.dev.prompt",eventData:{promptName:"service"}}),n=await this.cli.promptServiceName(),this.cli.viewSpinner("Saving"),await this.cli.fs.writeServiceFile({serviceName:n})),this.cli._activeServiceName=n,this.service=new Zt({org:this.org,serviceName:n}),this.instance=new pr({org:this.org,service:this.service,instanceName:(o=this.cli.user)==null?void 0:o.generateSandboxName()}),await this.hydrate()}async connect(){if((0,iA.default)(this.org,"Org is required"),(0,iA.default)(this.service,"Service is required"),(0,iA.default)(this.instance,"Instance is required"),!this.cli.user)return await this.cli.quit("You must be logged in");let t=this.org.orgName,r=this.service.serviceName;if(this.cli.viewSpinner("Connecting to your personal sandbox environment..."),this.devModeStart=process.hrtime.bigint(),await this.cli.isAmptShellRunning({orgName:t,serviceName:r}))return this.cli.logError(`The Ampt shell for app "${r}" in org "${t}" is already running in another terminal.`),await this.cli.quit();await this.cli.writeAmptShellActivityFile({orgName:t,serviceName:r}),this.cli.bindService({orgName:t,serviceName:r}),this.cli.onQuit(async()=>{var f;(0,JLe.removeSync)(ph(t,r)),await Ni.stop(this.cli,{hasQuit:!0,orgName:t,serviceName:r});let u=await this.cli.fs.readJsonFileIfExists(this.cli.fs.serviceFilePath),c=process.hrtime.bigint();(f=this.messenger)==null||f.close(),mr({eventName:"ampt.dev.ended",eventData:{source:this.cli.isGitPod?"gitpod":"local",timeInSeconds:this.devModeStart?Number(c-this.devModeStart)/1e9:0,dependencies:Object.keys((u==null?void 0:u.dependencies)||{}),appName:`${t}:${r}`}})}),this.code=new ws({org:this.org,service:this.service,instance:this.instance,user:this.cli.user,fullSync:this.cli.options["full-sync"],cli:this.cli,verbose:this.cli.options.verbose}),this.data=new nl({fs:this.cli.fs,org:this.org,service:this.service,instance:this.instance}),this.cli.viewSpinner("Syncing");let i=this.cli.viewSpinner.bind(this.cli),s=u=>i(`Syncing (${u})`),o=await this.code.sync(void 0,s);this.cli.updateLastSyncedAt(Date.now()),WB({...o,source:this.cli.isGitPod?"gitpod":"local",orgName:t,serviceName:this.service.serviceName,instanceName:this.instance.instanceName,appName:`${t}:${r}`,region:this.instance.region}),this.cli.viewSpinner("Connecting to real time logs");let[a]=await Promise.all([this.instance.connect({cli:this.cli}),this.cli.messenger.subscribe({userUid:this.cli.user.userId,orgName:t,appName:r,instanceName:this.instance.instanceName})]);this.messenger=a}async dev(t){var f,p;let{logDashboard:r=!0}=t||{logDashboard:!0},n=this.org,i=this.service,s=this.instance,o=this.code,a=n.orgName,u=i.serviceName,c=s.instanceName;if(this.cli.logSuccess(`Connected to your personal sandbox of ${(f=this.cli.styles)==null?void 0:f.blue(u)} app`),this.cli.logUrl(s.url),r){this.cli.logSpace(),this.cli.logInfo("View your app in the dashboard");let d=`${process.env.AMPT_DASHBOARD_URL_ROOT}/orgs/${a}/apps/${u}/environments/${c}`;this.cli.logUrl(d)}if(this.isReseedingEnabled&&this.cli.logSuccess("Enabled automatic data reseeding"),this.cli.viewInput(),this.cli.options.dev){let{url:d,region:m}=s,{credentials:v,env:y}=o;Ni.start({credentials:v,env:y,url:d,cli:this.cli,fs:this.cli.fs,user:this.cli.user,scriptName:"dev",ifPresent:!1,orgName:a,serviceName:u,region:m}).catch(b=>{e.logger.error({err:b},"Error starting dev server"),this.cli.logError("Something went wrong starting the dev server.")})}mr({eventName:"ampt.dev.enabled",eventData:{dependencies:Object.keys(((p=this.cli.fs.serviceFile)==null?void 0:p.dependencies)||{}),appName:`${a}:${u}`}}),this.isSeedingEnabled&&await this.seed(),this.cli.fs.watch(o.workspaceRoot,this.onFileChange.bind(this)),this.sandboxActive=!0}async onFileChange(t){(async()=>{let r=this.org.orgName,n=this.service.serviceName,i=this.instance.instanceName;if(!this.code)return await this.cli.quit("Code is not initialized");for(let u of t)this.queuedFilePaths.add(u);let s=await Ni.isRunning({orgName:r,serviceName:n}),o=this.cli.buildRunningInShell;if(this.cli.isCommandRunningInShell&&!s&&(e.logger.trace("waiting for command to finish"),await this.cli.commandRunningInShellPromise,e.logger.trace("command finished")),this.syncInProgress){e.logger.trace("sync in progress, skipping");return}this.syncInProgress=!0;let a;if(o)await this.cli.commandRunningInShellPromise,a=await this.code.sync();else for(;this.queuedFilePaths.size>0;){let u=this.queuedFilePaths;this.queuedFilePaths=new Set,this.isReseedingEnabled&&this.cli.fs.dataFilePath&&u.has(this.cli.fs.dataFilePath)&&(this.cli.viewSpinner("Seeding",{timer:!0}),await this.seed()),(!this.cli.isCommandRunningInShell||s)&&this.cli.spinInput(),e.logger.trace({size:u.size,queued:this.queuedFilePaths.size},"starting sync"),a=await this.code.sync(u),e.logger.trace({size:u.size,queued:this.queuedFilePaths.size},"sync complete")}WB({...a,source:this.cli.isGitPod?"gitpod":"local",orgName:r,serviceName:n,instanceName:i,appName:`${r}:${n}`,region:this.instance.region}),this.syncInProgress=!1,e.logger.trace("sync callback complete"),this.cli.updateLastSyncedAt(Date.now()),this.cli.isAnimationEnabled||this.cli.logSuccess("Successfully updated your code"),(!this.cli.isCommandRunningInShell||s)&&this.cli.stopSpinningInput(),this.cli.tutorial.inProgress&&await this.cli.tutorial.onSync(this.queuedFilePaths)})().catch(r=>{e.logger.error({method:"sync-callback",err:r},"Error syncing code"),this.cli.logError("Something went wrong syncing your code. Please try again.")})}async seed(){var t;this.data&&(this.cli.viewSpinner("Seeding"),await this.data.import(),this.cli.logSuccess(`Seeded data from the ${(t=this.cli.styles)==null?void 0:t.bold(this.cli.fs.dataFileName)} file.`),this.cli.viewInput())}async init(){var u,c;let{cli:t}=this,r=t.fs,n=t.user,i=t.session;t.isGitPod&&t.options.initial?await ia(1e4):t.isGitPod&&!t.options.initial&&(t.isAnimationEnabled=t.options.animation!==!1),t.viewSpinner("Initializing"),await t.fs.read();let s=t.options.seed||t.options.s;if(!n)return await t.quit("You must be logged in to use this command.");if(!n.orgs||!n.orgs.length)return await t.quit("You do not have access to any organizations.");t.project.isSeedingEnabled=s,t.project.isReseedingEnabled=t.options.reseed||t.options.rs,e.logger.debug("set project");let o=t.options.tutorial??!1,a=t.options.template??!1;if(!r.serviceFile&&!a&&!o){let{showTutorial:f,allowDismiss:p}=i.shouldPromptTutorial();if(e.logger.debug({showTutorial:f,allowDismiss:p,tutorialPassed:o},"no service file, checking for tutorial state"),o&&t.tutorial)return await t.tutorial.initTutorial();if(f){let d=["Yes","Skip for now"];p&&d.push("Don't show again"),t.logQuestion("Would you like to start the tutorial?");let m=await t.select(d);if(m==="Yes"&&t.tutorial)return t.project.isSeedingEnabled=!0,await t.tutorial.initTutorial();if(m=="Don't show again"){t.logInfo(`You can always run ${(u=t.styles)==null?void 0:u.bold("ampt tutorial")} to go through the tutorial.`),t.viewSpinner("Saving Preferences");try{await((c=t.user)==null?void 0:c.updatePreferences({showTutorial:!1}))}catch{t.logError("Failed to save preferences")}}}}else if(o)return await t.tutorial.initTutorial("basic");try{await ZLe(t)}catch(f){return await t.quit(f.message)}}};Am.default.extend(QLe.default);Am.default.extend(eFe.default);Am.default.updateLocale("en",{relativeTime:{future:"in %s",past:"%s ago",s:(e,t,r,n)=>e<=10?`${e} seconds`:e<=30?"several seconds":e<60?"less than a minute":`${e} seconds`,m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"}});var gy=(HB(),vt($B)),{version:hp}=Uv(),Bzt={dim:Do.default.dim,darkPurple:Do.default.hex("#B367FF"),purple:Do.default.hex("#F952FF"),yellow:Do.default.hex("#FFC700"),blue:Do.default.hex("#727aff"),red:Do.default.rgb(255,99,99),grey:Do.default.hex("#324f59"),pastel:Do.default.hex("#dbd8ca"),bold:Do.default.bold,green:Do.default.hex("#22b9b7")},aA=class{session;messenger;user;fs;tutorial;project;showLogo=!0;fromClone=!1;inputValue;timer;isShellActive;isInteractive;isDevServerActive;isAnimationEnabled=!1;isCommandRunningInShell;buildRunningInShell;commandRunningInShellPromise;styles;icons;argv;startupOptions;options;args;names;command;orgName;org;service;serviceName;_exitCode=0;isGitPod=!1;isWebIde=!1;isBeta=!1;_lastSyncedAt;_lastSyncedAtInterval;_staticViewInputMsg;_activeOrgName;_activeServiceName;_allowedInputCharacter;_isLoggedTopPadding;_commandsHistory;_viewType;_viewMessage;_spinnerMessage;_spinnerStep;_isPromptActive;_promptResponse;_timerInterval;_spinnerInterval;_inputSpinnerInterval;_inputSpinnerStartedAt;_inputSpinnerStoppedAt;_tipsInterval;_tipsFrequency;_tipsCollectionIndex;_spinnerFrequency;_spinnerFrames;_spinnerFrameIndex;_selectItems;_selectedItemIndex;_selectedItem;_onQuit;_quitting;_suggestions;_commandsHistoryIndex;_devTipsCollection=["type `dev` to start running the dev server","type `stop` to stop a running dev server"];_cloudScriptsCollection=["add a `ampt:dev` script to package.json to run code within the Ampt context"];_tipsCollection=[];version=hp;constructor(t){process.title="Ampt CLI",this.session=t,this.messenger=new IC,this.messenger.on("offline",(0,KB.default)(()=>{this.logError("Event Messenger offline")},1e3,!0)),this.messenger.on("online",(0,KB.default)(()=>{this.logInfo("Event Messenger online")},1e3,!0)),this.inputValue="",this.startupOptions={},this.options={},this.args=[],this.argv=[],this.command=void 0,this.names=void 0,this.icons={},this.commandRunningInShellPromise=null,this._allowedInputCharacter=/^[a-zA-Z0-9 ~:!@#$%^&*()-_=+.<>{}[\]"'/]+$/,this._viewType=null,this._viewMessage=void 0,this._spinnerMessage=null,this._spinnerStep=null,this._isPromptActive=void 0,this._promptResponse=void 0,this._commandsHistory=[],this._spinnerFrequency=100,this._spinnerFrames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],this._spinnerFrameIndex=0,this.showLogo=!process.env.IS_CHILD_PROCESS&&!this.isGitPod&&this._canRenderBolt(),this.styles=Bzt,this._startLastSyncedAtInterval(),this._initIcons(),this._initSuggestions(),process.env.GITPOD_HOST&&process.env.GITPOD_IDE_ALIAS&&(this.isGitPod=!0,this.isWebIde=!0,this.isAnimationEnabled=!1),this.isBeta=hp.includes("beta"),this.isInteractive=process.stdin.isTTY,this.fs=new Z1({session:this.session}),this.project=new sA(this),this.tutorial=new nA(this)}async login(){return new Na}setExitCode(t){this._exitCode=t}async start(t){let{_:r,...n}=(0,GB.default)(process.argv);if(this.startupOptions=n,this.fs.verbose=this.startupOptions.verbose,this.fromClone=(t==null?void 0:t.fromClone)||!1,r[2]!=="clone"&&process.platform!=="win32")try{Ie.enable()}catch(i){console.error(i)}return this.run()}async run(t){try{if(this._parseCommand(t),this.tutorial.inProgress)return await this.tutorial.handle(this.command);if(this.command==="sandbox")return await gy.sandbox(this);if(this.command==="git"||this.command==="code")return await gy.bash(this);this.isShellActive||(this._hideCursor(),this._logLogo(),this.viewSpinner("Loading"),await this._autoUpdate()),await this.messenger.connect(),this._watchKeyboard();let r=["clone"],n=["promote","test"];if((this.command==="start"||this.command==="tutorial")&&(this.isShellActive=!0),this.isShellActive&&r.includes(this.command))throw new Gf(`Command "${this.command}" is currently not supported in the shell`);if(n.includes(this.command))throw new Gf(`Command "${this.command}" is not available.`);if(!gy[this.command]&&this.command!=="tutorial")throw new Gf(`Command "${this.command}" is not a valid command`);if(!this.user&&(this.user=await Na.init(),!this.user.isLoggedIn())){this.logInfo("You must login to proceeed.");try{await this.user.performLogin(this)}catch(i){if(i.name==="UserDisabledError")return this.logError(i.message||"Your account has been disabled. Please contact support."),this._stop(0);throw i}}this.command==="tutorial"&&(this.command="start",this.options.tutorial=!0),await gy[this.command](this),this.options={}}catch(r){if(r instanceof Cm||r instanceof Gf)this.logError(r.message);else{if(r instanceof Xh)return this.logError(r.message),this._stop(this._exitCode);if(r.name==="InstancesLimitError"){let n=["share","deploy"].includes(this.command);return this.handleInstanceLimitExceeded({isDeploying:n})}else return r.name==="ServicesLimitError"?this.handleServiceLimitExceeded():(this.logError(`Something went wrong - please contact support and provide ${this.session.getSessionId()} as a reference ID`),this.session.captureException(r),this._stop(1))}}return this.isShellActive?this.viewInput():this._stop(this._exitCode)}handleServiceLimitExceeded(){let t="You have reached your app limit. Please upgrade your plan or delete an app.";return this.quit(t)}handleInstanceLimitExceeded(t){let{isDeploying:r=!1}=t||{},n="You have reached your environment limit. Please upgrade your plan or delete an environment.";if(!r)return this.quit(n);this.logWarning("Deployment failed"),this.logError(n),this.viewInput()}setProject(t){this.project=t}viewInput(t=this._formatLastSyncedAt()){this._timerInterval=clearInterval(this._timerInterval),this._spinnerInterval=clearInterval(this._spinnerInterval),this._startLastSyncedAtInterval(),this._switchView({viewType:"input",viewMessage:t})}spinInput(){if(this._viewType!=="input"){Ie.error({_viewType:this._viewType},"wrong viewType in spinInput");return}this.isAnimationEnabled&&(this._inputSpinnerStartedAt=Date.now(),clearInterval(this._inputSpinnerInterval),this._inputSpinnerInterval=setInterval(()=>this.updateInputSpinner(),this._spinnerFrequency).unref())}viewSpinner(t="Loading",{timer:r=!1}={}){if(!this.isInteractive){console.log(t);return}if(!this.isAnimationEnabled){this._switchView({viewType:"spinner",viewMessage:t});return}this._spinnerMessage=t,this._spinnerStep="",clearInterval(this._timerInterval),clearInterval(this._spinnerInterval),clearInterval(this._inputSpinnerInterval),this._timerInterval=void 0,this._spinnerInterval=void 0,this._inputSpinnerInterval=void 0,r&&(this.timer=0,this._timerInterval=setInterval(()=>this.timer=+this.timer+1,1e3).unref()),this._spinnerInterval=setInterval(()=>this._updateSpinner((this._spinnerMessage||"Loading")+(this._spinnerStep?` (${this._spinnerStep})`:""),{timer:r}),this._spinnerFrequency).unref()}updateLastSyncedAt(t){this._lastSyncedAt=t}updateInputSpinner(){this._spinnerFrameIndex=++this._spinnerFrameIndex%this._spinnerFrames.length,this._switchView({viewType:"input"})}stopSpinningInput(){this._inputSpinnerInterval&&(clearInterval(this._inputSpinnerInterval),this._inputSpinnerStoppedAt=Date.now(),this._inputSpinnerInterval=void 0),this.viewInput()}updateSpinnerStep(t){if(!process.stdin.isTTY){console.log(t);return}this._spinnerStep=t}pause(){this._clearIntervals(),this._switchView({viewType:"pause"}),this._eraseCursorLineAndBelow()}async prompt(t,r={}){for(this._isPromptActive=!0,r.default&&(this.inputValue=r.default),this.viewInput(t);!this._promptResponse;)await ia(50);let n=this._promptResponse;return this.logInfo(`You've entered ${this.styles.bold(n)}.`),this._promptResponse=null,this._isPromptActive=!1,n}async promptServiceName(t=null){let r=await this.prompt("Enter a name for your app",{default:t});return r.match(/^[a-z0-9-]+$/)?r:(this.logError("App name must consist only of lowercase characters and hyphens. Please try again."),await this.promptServiceName())}async confirm(t=!1,r){r&&this.logQuestion(r);let n=["no","yes"],i=await this.select(t?n.reverse():n);return i==="yes"}async select(t=[],r=0){if(clearInterval(this._timerInterval),clearInterval(this._spinnerInterval),clearInterval(this._inputSpinnerInterval),this._timerInterval=void 0,this._spinnerInterval=void 0,this._inputSpinnerInterval=void 0,this._selectItems=t,this._selectedItemIndex=r,this._switchView({viewType:"select"}),this._selectItems.length===1)return this._selectedItem=this._selectItems[0],this._selectedItem;for(;!this._selectedItem;)await ia(50);let n=this._selectedItem;return typeof n=="object"?this.logInfo(`You've selected ${this.styles.bold(n.title)}.`):this.logInfo(`You've selected ${this.styles.bold(n)}.`),this._selectedItem=null,this._selectedItemIndex=null,this._selectItems=[],n}async selectOrg(t,r){this.viewSpinner("Loading");let n,i=(t.orgs||[]).map(s=>s.orgName);return i.length>1?(this.logInfo(r||"Please select an organization."),n=await this.select(i)):n=i[0],n}async selectService(t,r){let n;this.viewSpinner("Loading");let i=(await t.listServicesWithInstances()).map(s=>s.serviceName);return Ie.debug({servicesList:i},"select service"),i.length>1?(this.logInfo(r||"Please select a service."),n=await this.select(i)):n=i[0],n}async selectInstance({service:t,instanceType:r,instanceName:n,message:i}){let o=(await(t==null?void 0:t.listInstances().catch(()=>[]))||[]).filter(c=>!r||c.instanceType===r).map(c=>({instanceName:c.instanceName,region:c.region,displayRegion:c.region||"",display:`${c.instanceName} (${c.region})`}));if(n)return o.find(c=>c.instanceName===n)||{instanceName:n,isNewInstance:!0};if(o.length===0)return{instanceName:void 0};this.logInfo(i||"Please select an instance.");let a=await this.select(o.map(c=>c.display));return{instanceName:o.find(c=>c.display===a).instanceName,isNewInstance:!1}}logSuccess(t,r=0){this.log(`${this.icons.tick} ${t}`,r)}logError(t,r=0){this.log(`${this.icons.cross} ${this.styles.bold(this.styles.red(t))}`,r)}logCancelled(){this.logError("Cancelled")}logInfo(t,r=0){this.log(`${this.icons.info} ${t}`,r)}logWarning(t,r=0){this.log(`${this.icons.warning} ${t}`,r)}logQuestion(t,r=0){this.log(`${this.icons.question} ${t}`,r)}logGroup(t,r=!0){t.forEach((n,i)=>{let o=r&&i===0?`${this.icons.arrow} ${this.styles.bold(n)}`:` ${this.icons.dot} ${n}`;this.log(o,i>0?2:0)})}logUrl(t,r=0){this.log(`${this.icons.arrow} ${t}`,r)}logTime(t,r=0){this.log(`${this.styles.dim(`${new Date(Date.now()).toLocaleTimeString()} ${this.icons.line}`)} ${t}`,r)}log(t="",r=0){this._ensureTopPadding(),this._eraseCursorLineAndBelow(),this._log(`${" ".repeat(r)}${t}
293
+ ${s}`)}}});var Fzt,VLe=ae(()=>{"use strict";ti();Fzt=async e=>{e.viewSpinner("Loading");let t=e.fs;if(await t.read(),!t.serviceFile)throw new Error("You must be inside an Ampt app directory to run this command.");let{user:r}=e,n=e.options.org||t.serviceFile.ampt.org,i=e.options.app||t.serviceFile.ampt.app,s=e.args[0]||r.username;n||(n=await e.selectOrg(r)),e.viewSpinner("Loading");let o=new tr({orgName:n});await o.isAuthorized()||(e.logError(`You don't have access to the "${n}" org.`),n=await e.selectOrg(r)),o.update({orgName:n}),e.viewSpinner("Loading");let a=new Zt({org:o,serviceName:i}),u=new pr({org:o,service:a,instanceName:s});await u.get(),e.logUrl(u.url)}});var KLe,Mzt,XLe=ae(()=>{"use strict";KLe=xe(Uv()),Mzt=async e=>{e.log(`v${KLe.version}`)}});var $B={};_l($B,{bash:()=>hzt,clone:()=>mzt,dashboard:()=>gzt,delete:()=>vzt,deploy:()=>xzt,docs:()=>yzt,export:()=>_zt,help:()=>bzt,import:()=>wzt,install:()=>Ezt,login:()=>Szt,logout:()=>Tzt,open:()=>Czt,promote:()=>Azt,run:()=>Izt,sandbox:()=>Rzt,serverless:()=>Nzt,setup:()=>BB,share:()=>kzt,start:()=>qzt,stop:()=>Pzt,test:()=>Dzt,uninstall:()=>Lzt,url:()=>Fzt,version:()=>Mzt});var HB=ae(()=>{"use strict";gLe();xLe();yLe();_Le();bLe();wLe();ELe();TLe();CLe();ALe();OLe();ILe();RLe();NLe();LLe();FLe();BLe();UB();$Le();HLe();WLe();zLe();GLe();VLe();XLe()});var zB=xe(require("os")),Am=xe(f_()),QLe=xe(S8()),eFe=xe(T8()),oo=xe(R8()),tFe=xe(W8()),Do=xe(w7()),rFe=xe(T7()),mp=xe(A7()),nFe=xe(N7()),GB=xe(D7()),iFe=xe(J$()),VB=xe(YR()),KB=xe(JR()),XB=require("child_process"),oA=xe(AX()),sFe=require("fs/promises"),Om=xe(Dl()),uA=xe(jN());wr();i3();ti();Vf();ti();wr();Us();var YLe=(HB(),vt($B));var Cm=class extends Error{function=null;constructor(t,r){super(t),this.function=r}},nA=class e{static tutorialGitUrl="https://github.com/ampt-templates/tutorial";static logger=Ie.child({class:"Tutorial"});static exitCmd="end";static iterationCmds=["skip","next","done"];static fullTutorialSteps=["editor","sandbox","postSandbox","importData","postImportData","staticAssets","postStaticAssets","runningScripts","postRunningScripts","deploy","postDeploy","dashboard"];static basicTutorialSteps=["editor","sandbox","postSandbox"];welcomeMessage=["Welcome to Ampt!","This Ampt CLI tutorial allows you to exit anytime with 'end' and skip steps using 'skip'."];cli;name;type="basic";inProgress=!1;tutorialModeStart=void 0;nextCommand;activeStepIndex=null;stepOrder=["editor","sandbox","postSandbox","importData","postImportData","staticAssets","postStaticAssets","runningScripts","postRunningScripts","deploy","postDeploy","dashboard"];steps={editor:async t=>{let r=await(t==null?void 0:t()),n="To begin, let's open the project in a code editor.";return{title:"Open the project in an editor",pre:r?[n,'Run `code .` in the terminal to open the project in Visual Studio Code or type "done" to continue']:[n,'Open the project in your favorite code editor and type "done" to continue'],command:"code"}},sandbox:()=>Promise.resolve({title:"The Developer Sandbox",pre:["The URL above is your developer sandbox. Code changes are synced here in real-time","Your sandbox goes offline when you disconnect from the CLI","Open the URL in your favorite browser to see your app in action","Try making a change to the code, refresh, and see the changes in real-time!"],event:"sync"}),postSandbox:async()=>({title:"Sandbox Synced",pre:["Sandbox synced!","Any logs or errors from your sandbox are displayed here"],postAction:!0}),staticAssets:async()=>({title:"Static Assets",pre:["The `static` directory is automatically synced and served from your Ampt environment","This is useful for serving images, fonts, and other static assets",'Try moving "test.html" into the "static" directory and see it update in the sandbox'],event:"sync"}),postStaticAssets:async()=>{let t=this.cli.project.getSandboxUrl();return{postAction:!0,title:"Static Assets Synced",pre:["Static assets synced!",t?`Now, try navigating to ${t}/test.html to see the changes`:"Try navigating to the /test.html route to see the changes"]}},importData:async()=>({title:"Importing Data to @ampt/data",pre:['You can import data into your Ampt environment using the "import" command',"This command is useful for seeding your database with data for development and testing","Try running the import command now by typing `import` into the terminal"],post:["Data imported!","Now, try refreshing the sandbox to see the changes in the environment"],command:"import"}),postImportData:async()=>({title:"Data Imported!",pre:["Data imported!",this.type==="full"?"Now, try refreshing the sandbox to see the changes in the environment":"Data seeded from your data file is now available in your environment"],postAction:!0}),runningScripts:()=>Promise.resolve({title:"Running scripts within the Ampt context",pre:["The Ampt shell allows you to run scripts within the context of your app","For scripts within your package.json, prefix them with 'ampt', e.g. 'ampt:test'","Try running the test script by typing 'run test' into the terminal"],command:"run",runArg:"test"}),postRunningScripts:()=>Promise.resolve({title:"Scripts Run!",pre:["Nice, you just ran the test script!",'Ampt also automatically handles JS or TS files, just provide the path after the "run" command, e.g. "run scripts/list-todos.ts"'],postAction:!0}),deploy:()=>Promise.resolve({title:"Deploying to a permanent environment",pre:["To deploy your current sandbox, use the 'deploy prod' command to create a new stage environment named 'prod'"],post:["Stage deployed!","The URL above is a stage environment, and is always available."],command:"deploy"}),postDeploy:()=>Promise.resolve({title:"Stage Deployed!",pre:["Stage deployed!","The URL above is a stage environment, and is always available",'Updates to the stage environment are made using the "deploy" command, or automatically using Git CI/CD.'],postAction:!0}),dashboard:()=>Promise.resolve({title:"The Ampt Dashboard",pre:["The dashboard is where you can manage your Ampt environments, view logs, data, and more",'Try opening the your sandbox with the "dashboard" command'],command:"dashboard"}),build:()=>Promise.resolve({title:"Building the app",pre:["For projects with a build step, use 'build' to execute the ampt:build script in package.json","Build output is automatically synced and is available at your sandbox url"],command:"run",runArg:"build"})};constructor(t){if(!t.project)throw new Cm("Project should be set before Tutorial is initialized","constructor");this.cli=t}isExitCmd(t){return t===e.exitCmd}isIterationCmd(t){return e.iterationCmds.includes(t)}async iterateStep(t){let{skip:r=!1}=t||{skip:!1};if(this.inProgress&&this.activeStepIndex!==null){let n=this.activeStepIndex+1;if(this.activeStepIndex===0&&!this.cli.project.sandboxActive&&(this.cli.logSpace(),await this.cli.project.dev({logDashboard:!1})),this.reportAnalytics({exit:!1,step:this.stepOrder[this.activeStepIndex],event:"ampt.tutorial.step_completed"}),n<this.stepOrder.length){this.activeStepIndex=n;let i=await this.steps[this.stepOrder[this.activeStepIndex]]();r&&i.postAction&&n+1<this.stepOrder.length&&(this.activeStepIndex=n+1,i=await this.steps[this.stepOrder[this.activeStepIndex]]()),this.nextCommand=i.command||void 0,this.logStep({step:i}),!i.command&&!i.event&&!i.postAction&&await this.iterateStep()}else await this.complete()}}async onSync(t){if(this.inProgress&&this.activeStepIndex!==null){let r=this.stepOrder[this.activeStepIndex];((await this.steps[r]()).event==="sync"||r==="staticAssets"&&t.has("static"))&&await this.iterateStep()}}async handle(t){var r;if(this.inProgress&&this.activeStepIndex!==null){let n=this.stepOrder[this.activeStepIndex],i=await this.steps[n]();if(this.isExitCmd(t))return this.cli.project.sandboxActive||await this.cli.project.dev(),await this.complete({exit:!0});if(i.postAction&&(this.cli._staticViewInputMsg=void 0),this.isIterationCmd(t))return this.reportAnalytics({exit:!1,step:this.stepOrder[this.activeStepIndex]}),await this.iterateStep({skip:!0});if(i.command==="run"&&t==="run"&&(!this.cli.args[0]||i.runArg&&i.runArg!==this.cli.args[0])){this.cli.logWarning(`Invalid command: "${this.cli.styles.bold(this.cli.styles.red(t))}" - expected "${i.runArg}"`);return}else if(i.command&&t!==i.command){let s=this.cli.styles.purple(n==="build"?"build":i.command);this.cli.logWarning(`Invalid command: "${this.cli.styles.bold(this.cli.styles.red(t))}" - expected "${this.cli.styles.bold(s)}"`);return}else{if(i.command==="deploy"&&t==="deploy"&&!((r=this.cli.names)!=null&&r.instanceName)){this.cli.logWarning('You must provide a stage name to deploy to. Example: "deploy prod"');return}if(n==="editor"&&t==="code")await YLe.bash(this.cli);else{let s=YLe[t];if(t&&i.event==="sync"){this.cli.logWarning("Waiting for changes to sync to the sandbox...");return}if(!s){this.cli.logError(`Command "${t}" not found - expected "${i.command}"`);return}this.cli.logSpace(),await s(this.cli)}try{return this.cli.viewInput(),this.iterateStep()}catch(s){throw new Cm(s.message,"handle")}}}}async initTutorial(t="full"){var o,a,u,c;if(this.cli.project.org||await this.cli.project.authorize(),!this.cli.user)return await this.cli.quit("You must be logged in to start the Ampt tutorial");this.name=`${(o=this.cli.user)==null?void 0:o.username}-ampt-tutorial`,this.inProgress=!0,this.tutorialModeStart=process.hrtime.bigint(),this.type=t;let r=this.cli.project.org;if(this.type==="full"){if(!await this.cli.fs.detectGit())return await this.cli.quit("Git is required to start the Ampt tutorial");let f=async()=>{this.name=await this.cli.promptServiceName(this.name);let v=new Zt({org:this.cli.project.org,serviceName:this.name});if(await v.get().catch(()=>{}))return this.cli.logWarning(`App ${this.cli.styles.bold(this.cli.styles.purple(this.name))} already exists in ${this.cli.styles.bold(this.cli.styles.darkPurple(r.orgName))}`),await this.cli.confirm(!0,"Would you like to overwrite it?")?v:f();let b=await this.cli.fs.isCwdEmpty(),_=!1;if(b&&(_=await this.cli.confirm(!0,"Would you like to start the tutorial in the current directory?")),!_){if(await this.cli.fs.dirExists(this.name))if(this.cli.logWarning(`Directory "./${this.name}" already exists.`),await this.cli.confirm(!0,"Would you like to overwrite it?"))this.cli.logInfo(`Overwriting directory: ${this.cli.styles.bold(this.name)}`),await this.cli.fs.deleteServiceDir(this.name);else return f();await this.cli.fs.createServiceDir(this.name),this.cli.logInfo(`Created directory: ${this.cli.styles.bold(this.name)}`)}return v},p=await f(),d=(a=this.cli.user)==null?void 0:a.generateSandboxName();this.cli.viewSpinner("Cloning @ampt-templates/tutorial"),await this.cli.fs.cloneGitRepo({repoUrl:e.tutorialGitUrl}),await this.cli.fs.read({orgName:r.orgName,appName:this.name});let m=new pr({org:r,service:p,instanceName:d,cli:this.cli});this.cli.project.service=p,this.cli.project.instance=m}if(this.cli.viewSpinner("Installing dependencies"),await this.cli.fs.installDependenciesIfExists({cleanInstall:!0}),this.type==="basic"){let f=!!this.cli.fs.dataFile,p=(c=(u=this.cli.fs.serviceFile)==null?void 0:u.scripts)==null?void 0:c["ampt:build"],d=this.stepOrder.reduce((m,v)=>(v==="importData"||v==="postImportData")&&!f||v==="build"&&!p||v==="staticAssets"||v==="postStaticAssets"?m:[...m,v],[]);this.stepOrder=d,await this.cli.project.analyze(),await this.cli.project.detect(),await this.cli.project.connect()}else await this.cli.project.connect();this.cli.logGroup(this.welcomeMessage),this.activeStepIndex=0;let n=this.cli.fs.detectVsCode.bind(this.cli.fs),i=this.stepOrder[this.activeStepIndex],s=await this.steps[i](n);this.reportAnalytics({exit:!1,event:"ampt.tutorial.started",step:i}),this.logStep({step:s})}logStep(t){let{step:r}=t;this.cli.logSpace(),r.postAction?(this.cli.logGroup([r.pre].flat(),!0),this.cli._staticViewInputMsg='Type "next" or hit enter to continue',this.cli.viewInput()):this.cli.logGroup([r.title,r.pre].flat(),!0)}setType(t){this.type=t}getDurationMins(){let t=process.hrtime.bigint()-this.tutorialModeStart;return Math.round(Number(t)/6e10)}async complete(t){var i,s;let{exit:r=!1}=t||{exit:!1},n=this.stepOrder[this.activeStepIndex];this.reportAnalytics({exit:r,step:r?n:void 0}),this.inProgress=!1,this.activeStepIndex=null,await((s=(i=this.cli)==null?void 0:i.user)==null?void 0:s.updatePreferences({showTutorial:!1})),this.completeMsg()}reportAnalytics(t){var s,o,a;let{event:r,step:n,exit:i=!1}=t;mr({eventName:r||(i?"ampt.tutorial.skipped":"ampt.tutorial.completed"),eventData:{type:this.type,step:n,durationMinutes:r?void 0:this.getDurationMins(),userName:(s=this.cli.user)==null?void 0:s.username,orgName:(o=this.cli.project.org)==null?void 0:o.orgName,serviceName:(a=this.cli.project.service)==null?void 0:a.serviceName}})}completeMsg(){this.cli.logGroup([this.cli.styles.bold("We hope you enjoy using Ampt!"),"If you have any questions or feedback, join our discord: https://getampt.com/discord","To read up on everything Ampt, check out our docs: https://getampt.com/docs",`You can always re-run this tutorial with the command "${this.cli.styles.bold("tutorial")}"`,`You can clear this output with the command "${this.cli.styles.bold("clear")}"`,"Happy coding! \u{1F680}"])}};var JLe=xe(Dl()),iA=xe(require("assert"));ti();wr();var my=xe(require("path"));wr();ED();Us();Vf();var jzt=async e=>{var p,d,m,v,y,b,_,E,S;e.viewSpinner("Loading");let t=wD(e),r=e.fs;await r.read(),e.project.org||await e.project.authorize();let n=e.project.org,i=n.orgName,s=((d=(p=r.serviceFile)==null?void 0:p.ampt)==null?void 0:d.app)||((m=e.options)==null?void 0:m.app),o=(v=e.options)==null?void 0:v.template,a=[],u;e.viewSpinner("Loading");let c=(await n.listServices()).map(w=>w.serviceName),f;if(!s){if(e.viewSpinner("Loading"),c.length===0||e.options.template)f=!0;else{mr({eventName:"ampt.dev.prompt",eventData:{promptName:"createOrClone"}});let w=await r.readJsonFileIfExists(my.default.join(r.serviceRoot,"package.json"));if(w&&!(w!=null&&w.ampt)){s=await e.promptServiceName(e.isGitPod?o:my.default.basename(r.serviceRoot)),e.viewSpinner(`Migrating ${s} to ampt`),await r.initService({orgName:i,serviceName:s,existingProject:!0}),e.viewSpinner("Installing dependencies"),await r.installDependenciesIfExists(),e.logInfo(`Successfully migrated ${(y=e.styles)==null?void 0:y.bold(s)} to ampt!`);return}else if(!w){if(e.logQuestion("Do you want to create a new app?"),!await e.confirm()){await e.quit();return}f=!0}}if(f){let{serviceExceeded:w,instanceExceeded:C}=await n.validateLimits();if(w)return e.handleServiceLimitExceeded();if(C)return e.handleInstanceLimitExceeded();if(e.viewSpinner("Loading"),mr({eventName:"ampt.dev.prompt",eventData:{promptName:"template"}}),a=await t||[],Ie.trace({coreTemplates:a},"templates list"),!o)e.logInfo("Please choose an app template to generate in this directory."),o=(await e.select(a)).name;else if(!a.find(I=>I.name===o)){e.logError(`Template "${o}" not found.`),await e.quit();return}for(u=a.find(I=>I.name===o),s=await e.promptServiceName(e.isGitPod||o?o:my.default.basename(r.serviceRoot));c.includes(s)&&(e.logWarning(`App ${(_=e.styles)==null?void 0:_.purple((b=e.styles)==null?void 0:b.bold(`"${s}"`))} already exists for this org.`),e.logQuestion("Would you like to overwrite it?"),!await e.confirm());)s=await e.promptServiceName(s);if(Ie.trace({serviceName:s},"entered service name"),!e.isWebIde&&!await r.isCwdEmpty())if(e.logWarning("This directory is not empty."),e.logInfo(`Would you like to make a new subdirectory for ${(E=e.styles)==null?void 0:E.bold(s)}?`),await e.confirm()){let j=async()=>{try{r.createServiceDir(s)}catch(q){if(q instanceof Yh)if(e.logWarning(`Directory "./${s}" already exists.`),await e.confirm(!1,"Would you like to overwrite it?"))r.deleteServiceDir(s),r.createServiceDir(s);else return s=await e.promptServiceName(s||e.isGitPod?o:my.default.basename(r.serviceRoot)),j()}};await j(),await r.read({orgName:i})}else{await e.quit();return}e.viewSpinner("Generating app files");try{await r.initService({orgName:i,serviceName:s,template:u}),r.dataFile&&(e.project.isSeedingEnabled=!0)}catch(I){if(I instanceof Zh){await e.quit("Git was not detected on your system. Please install it and try again.");return}throw I}e.viewSpinner("Installing dependencies"),await r.installDependenciesIfExists(),e.logSuccess(`Successfully generated app ${(S=e.styles)==null?void 0:S.bold(s)}.`)}else await r.initService({orgName:i,existingProject:!0});f&&e.logInfo("Join our Discord! https://getampt.com/discord")}},ZLe=jzt;UB();wr();cu();function WB(e){(async()=>{let{orgName:t,serviceName:r,instanceName:n}=e;try{await ze({method:"POST",body:e,endpoint:`/orgs/${t}/services/${r}/instances/${n}/metrics`})}catch(i){fr.captureException(i),process.env.AMPT_DEBUG&&console.error(i)}})()}var sA=class e{cli;org;service;instance;data;code;isSeedingEnabled=!1;isReseedingEnabled=!1;devModeStart=void 0;messenger;sandboxActive=!1;syncInProgress=!1;queuedFilePaths=new Set;static logger=Ie.child({class:"Ampt"});constructor(t){this.cli=t}getSandboxUrl(){if(this.instance)return this.instance.url}getDashboardUrl(){if(this.org&&this.service&&this.instance)return`${process.env.AMPT_DASHBOARD_URL_ROOT}/orgs/${this.org.orgName}/apps/${this.service.serviceName}/environments/${this.instance.instanceName}`}async boot(){await this.analyze(),await this.detect(),await this.connect(),await this.dev()}async selectOrg(){var s,o,a;let t=this.cli,r=t.user;if(!r)return await this.cli.quit("You must be logged in to use this command.");if(await r.listOrgs(),((s=r.orgs)==null?void 0:s.length)===0)return await t.quit("You do not have access to any organizations.");let n=t.options.org;((o=r.orgs)==null?void 0:o.length)===1&&!n?n=r.orgs[0].orgName:((a=r.orgs)==null?void 0:a.length)>1&&!n&&(n=await t.selectOrg(r));let i=new tr({orgName:n});i.update({orgName:n}),this.org=i}async authorize(){var n,i,s;this.cli.viewSpinner("Authorizing");let t=this.cli.user,r=this.cli.options.org||((i=(n=this.cli.fs.serviceFile)==null?void 0:n.ampt)==null?void 0:i.org);if(r&&!t.hasAccessToOrg(r)&&(this.cli.logWarning(`Org "${r}" has either been deleted, renamed, or you no longer have access to it.`),r=void 0),r?this.org=new tr({orgName:r}):(mr({eventName:"ampt.dev.prompt",eventData:{promptName:"org"}}),await this.selectOrg(),await this.cli.fs.readServiceFileIfExists({orgName:r||((s=this.org)==null?void 0:s.orgName)})),!this.org)return await this.cli.quit("Ampt Organization is required");await this.org.isAuthorized()||(this.cli.logError(`You don't have access to the "${r}" org.`),await this.selectOrg()),this.cli._activeOrgName=this.org.orgName}async analyze(){this.cli.viewSpinner("Analyzing Project"),await BB(this.cli),await this.cli.checkForAmptPackageUpdates()}async hydrate(){if(!this.org){await this.cli.quit("Ampt Organization is required");return}if(!this.service){await this.cli.quit("Ampt App is required");return}if(!this.instance){await this.cli.quit("Ampt Environment is required");return}let[t,r,n,i]=await Promise.all([this.instance.get().catch(()=>{}),this.service.get().catch(()=>{}),this.org.fetch(),this.org.getRegions()]),s=await this.cli.selectRegion({orgInfo:n,serviceInfo:r,instanceInfo:t,regions:i});if(!s){this.cli.logError("No region selected."),await this.cli.quit();return}this.instance.region=s.code}async detect(t){var i,s,o;let{serviceName:r}=t||{serviceName:void 0};this.cli.viewSpinner("Starting");let n=r||this.cli.options.app||((s=(i=this.cli.fs.serviceFile)==null?void 0:i.ampt)==null?void 0:s.app);n||(mr({eventName:"ampt.dev.prompt",eventData:{promptName:"service"}}),n=await this.cli.promptServiceName(),this.cli.viewSpinner("Saving"),await this.cli.fs.writeServiceFile({serviceName:n})),this.cli._activeServiceName=n,this.service=new Zt({org:this.org,serviceName:n}),this.instance=new pr({org:this.org,service:this.service,instanceName:(o=this.cli.user)==null?void 0:o.generateSandboxName()}),await this.hydrate()}async connect(){if((0,iA.default)(this.org,"Org is required"),(0,iA.default)(this.service,"Service is required"),(0,iA.default)(this.instance,"Instance is required"),!this.cli.user)return await this.cli.quit("You must be logged in");let t=this.org.orgName,r=this.service.serviceName;if(this.cli.viewSpinner("Connecting to your personal sandbox environment..."),this.devModeStart=process.hrtime.bigint(),await this.cli.isAmptShellRunning({orgName:t,serviceName:r}))return this.cli.logError(`The Ampt shell for app "${r}" in org "${t}" is already running in another terminal.`),await this.cli.quit();await this.cli.writeAmptShellActivityFile({orgName:t,serviceName:r}),this.cli.bindService({orgName:t,serviceName:r}),this.cli.onQuit(async()=>{var f;(0,JLe.removeSync)(ph(t,r)),await Ni.stop(this.cli,{hasQuit:!0,orgName:t,serviceName:r});let u=await this.cli.fs.readJsonFileIfExists(this.cli.fs.serviceFilePath),c=process.hrtime.bigint();(f=this.messenger)==null||f.close(),mr({eventName:"ampt.dev.ended",eventData:{source:this.cli.isGitPod?"gitpod":"local",timeInSeconds:this.devModeStart?Number(c-this.devModeStart)/1e9:0,dependencies:Object.keys((u==null?void 0:u.dependencies)||{}),appName:`${t}:${r}`}})}),this.code=new ws({org:this.org,service:this.service,instance:this.instance,user:this.cli.user,fullSync:this.cli.options["full-sync"],cli:this.cli,verbose:this.cli.options.verbose}),this.data=new nl({fs:this.cli.fs,org:this.org,service:this.service,instance:this.instance}),this.cli.viewSpinner("Syncing");let i=this.cli.viewSpinner.bind(this.cli),s=u=>i(`Syncing (${u})`),o=await this.code.sync(void 0,s);this.cli.updateLastSyncedAt(Date.now()),WB({...o,source:this.cli.isGitPod?"gitpod":"local",orgName:t,serviceName:this.service.serviceName,instanceName:this.instance.instanceName,appName:`${t}:${r}`,region:this.instance.region}),this.cli.viewSpinner("Connecting to real time logs");let[a]=await Promise.all([this.instance.connect({cli:this.cli}),this.cli.messenger.subscribe({userUid:this.cli.user.userId,orgName:t,appName:r,instanceName:this.instance.instanceName})]);this.messenger=a}async dev(t){var f,p;let{logDashboard:r=!0}=t||{logDashboard:!0},n=this.org,i=this.service,s=this.instance,o=this.code,a=n.orgName,u=i.serviceName,c=s.instanceName;if(this.cli.logSuccess(`Connected to your personal sandbox of ${(f=this.cli.styles)==null?void 0:f.blue(u)} app`),this.cli.logUrl(s.url),r){this.cli.logSpace(),this.cli.logInfo("View your app in the dashboard");let d=`${process.env.AMPT_DASHBOARD_URL_ROOT}/orgs/${a}/apps/${u}/environments/${c}`;this.cli.logUrl(d)}if(this.isReseedingEnabled&&this.cli.logSuccess("Enabled automatic data reseeding"),this.cli.viewInput(),this.cli.options.dev){let{url:d,region:m}=s,{credentials:v,env:y}=o;Ni.start({credentials:v,env:y,url:d,cli:this.cli,fs:this.cli.fs,user:this.cli.user,scriptName:"dev",ifPresent:!1,orgName:a,serviceName:u,region:m}).catch(b=>{e.logger.error({err:b},"Error starting dev server"),this.cli.logError("Something went wrong starting the dev server.")})}mr({eventName:"ampt.dev.enabled",eventData:{dependencies:Object.keys(((p=this.cli.fs.serviceFile)==null?void 0:p.dependencies)||{}),appName:`${a}:${u}`}}),this.isSeedingEnabled&&await this.seed(),this.cli.fs.watch(o.workspaceRoot,this.onFileChange.bind(this)),this.sandboxActive=!0}async onFileChange(t){(async()=>{let r=this.org.orgName,n=this.service.serviceName,i=this.instance.instanceName;if(!this.code)return await this.cli.quit("Code is not initialized");for(let u of t)this.queuedFilePaths.add(u);let s=await Ni.isRunning({orgName:r,serviceName:n}),o=this.cli.buildRunningInShell;if(this.cli.isCommandRunningInShell&&!s&&(e.logger.trace("waiting for command to finish"),await this.cli.commandRunningInShellPromise,e.logger.trace("command finished")),this.syncInProgress){e.logger.trace("sync in progress, skipping");return}this.syncInProgress=!0;let a;if(o)await this.cli.commandRunningInShellPromise,a=await this.code.sync();else for(;this.queuedFilePaths.size>0;){let u=this.queuedFilePaths;this.queuedFilePaths=new Set,this.isReseedingEnabled&&this.cli.fs.dataFilePath&&u.has(this.cli.fs.dataFilePath)&&(this.cli.viewSpinner("Seeding",{timer:!0}),await this.seed()),(!this.cli.isCommandRunningInShell||s)&&this.cli.spinInput(),e.logger.trace({size:u.size,queued:this.queuedFilePaths.size},"starting sync"),a=await this.code.sync(u),e.logger.trace({size:u.size,queued:this.queuedFilePaths.size},"sync complete")}WB({...a,source:this.cli.isGitPod?"gitpod":"local",orgName:r,serviceName:n,instanceName:i,appName:`${r}:${n}`,region:this.instance.region}),this.syncInProgress=!1,e.logger.trace("sync callback complete"),this.cli.updateLastSyncedAt(Date.now()),this.cli.isAnimationEnabled||this.cli.logSuccess("Successfully updated your code"),(!this.cli.isCommandRunningInShell||s)&&this.cli.stopSpinningInput(),this.cli.tutorial.inProgress&&await this.cli.tutorial.onSync(this.queuedFilePaths)})().catch(r=>{e.logger.error({method:"sync-callback",err:r},"Error syncing code"),this.cli.logError("Something went wrong syncing your code. Please try again.")})}async seed(){var t;this.data&&(this.cli.viewSpinner("Seeding"),await this.data.import(),this.cli.logSuccess(`Seeded data from the ${(t=this.cli.styles)==null?void 0:t.bold(this.cli.fs.dataFileName)} file.`),this.cli.viewInput())}async init(){var u,c;let{cli:t}=this,r=t.fs,n=t.user,i=t.session;t.isGitPod&&t.options.initial?await ia(1e4):t.isGitPod&&!t.options.initial&&(t.isAnimationEnabled=t.options.animation!==!1),t.viewSpinner("Initializing"),await t.fs.read();let s=t.options.seed||t.options.s;if(!n)return await t.quit("You must be logged in to use this command.");if(!n.orgs||!n.orgs.length)return await t.quit("You do not have access to any organizations.");t.project.isSeedingEnabled=s,t.project.isReseedingEnabled=t.options.reseed||t.options.rs,e.logger.debug("set project");let o=t.options.tutorial??!1,a=t.options.template??!1;if(!r.serviceFile&&!a){let{showTutorial:f,allowDismiss:p}=i.shouldPromptTutorial();if(e.logger.debug({showTutorial:f,allowDismiss:p,tutorialPassed:o},"no service file, checking for tutorial state"),o&&t.tutorial)return await t.tutorial.initTutorial();if(f){let d=["Yes","Skip for now"];p&&d.push("Don't show again"),t.logQuestion("Would you like to start the tutorial?");let m=await t.select(d);if(m==="Yes"&&t.tutorial)return t.project.isSeedingEnabled=!0,await t.tutorial.initTutorial();if(m=="Don't show again"){t.logInfo(`You can always run ${(u=t.styles)==null?void 0:u.bold("ampt tutorial")} to go through the tutorial.`),t.viewSpinner("Saving Preferences");try{await((c=t.user)==null?void 0:c.updatePreferences({showTutorial:!1}))}catch{t.logError("Failed to save preferences")}}}}try{await ZLe(t)}catch(f){return await t.quit(f.message)}}};Am.default.extend(QLe.default);Am.default.extend(eFe.default);Am.default.updateLocale("en",{relativeTime:{future:"in %s",past:"%s ago",s:(e,t,r,n)=>e<=10?`${e} seconds`:e<=30?"several seconds":e<60?"less than a minute":`${e} seconds`,m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"}});var gy=(HB(),vt($B)),{version:hp}=Uv(),Bzt={dim:Do.default.dim,darkPurple:Do.default.hex("#B367FF"),purple:Do.default.hex("#F952FF"),yellow:Do.default.hex("#FFC700"),blue:Do.default.hex("#727aff"),red:Do.default.rgb(255,99,99),grey:Do.default.hex("#324f59"),pastel:Do.default.hex("#dbd8ca"),bold:Do.default.bold,green:Do.default.hex("#22b9b7")},aA=class{session;messenger;user;fs;tutorial;project;showLogo=!0;fromClone=!1;inputValue;timer;isShellActive;isInteractive;isDevServerActive;isAnimationEnabled=!1;isCommandRunningInShell;buildRunningInShell;commandRunningInShellPromise;styles;icons;argv;startupOptions;options;args;names;command;orgName;org;service;serviceName;_exitCode=0;isGitPod=!1;isWebIde=!1;isBeta=!1;_lastSyncedAt;_lastSyncedAtInterval;_staticViewInputMsg;_activeOrgName;_activeServiceName;_allowedInputCharacter;_isLoggedTopPadding;_commandsHistory;_viewType;_viewMessage;_spinnerMessage;_spinnerStep;_isPromptActive;_promptResponse;_timerInterval;_spinnerInterval;_inputSpinnerInterval;_inputSpinnerStartedAt;_inputSpinnerStoppedAt;_tipsInterval;_tipsFrequency;_tipsCollectionIndex;_spinnerFrequency;_spinnerFrames;_spinnerFrameIndex;_selectItems;_selectedItemIndex;_selectedItem;_onQuit;_quitting;_suggestions;_commandsHistoryIndex;_devTipsCollection=["type `dev` to start running the dev server","type `stop` to stop a running dev server"];_cloudScriptsCollection=["add a `ampt:dev` script to package.json to run code within the Ampt context"];_tipsCollection=[];version=hp;constructor(t){process.title="Ampt CLI",this.session=t,this.messenger=new IC,this.messenger.on("offline",(0,KB.default)(()=>{this.logError("Event Messenger offline")},1e3,!0)),this.messenger.on("online",(0,KB.default)(()=>{this.logInfo("Event Messenger online")},1e3,!0)),this.inputValue="",this.startupOptions={},this.options={},this.args=[],this.argv=[],this.command=void 0,this.names=void 0,this.icons={},this.commandRunningInShellPromise=null,this._allowedInputCharacter=/^[a-zA-Z0-9 ~:!@#$%^&*()-_=+.<>{}[\]"'/]+$/,this._viewType=null,this._viewMessage=void 0,this._spinnerMessage=null,this._spinnerStep=null,this._isPromptActive=void 0,this._promptResponse=void 0,this._commandsHistory=[],this._spinnerFrequency=100,this._spinnerFrames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],this._spinnerFrameIndex=0,this.showLogo=!process.env.IS_CHILD_PROCESS&&!this.isGitPod&&this._canRenderBolt(),this.styles=Bzt,this._startLastSyncedAtInterval(),this._initIcons(),this._initSuggestions(),process.env.GITPOD_HOST&&process.env.GITPOD_IDE_ALIAS&&(this.isGitPod=!0,this.isWebIde=!0,this.isAnimationEnabled=!1),this.isBeta=hp.includes("beta"),this.isInteractive=process.stdin.isTTY,this.fs=new Z1({session:this.session}),this.project=new sA(this),this.tutorial=new nA(this)}async login(){return new Na}setExitCode(t){this._exitCode=t}async start(t){let{_:r,...n}=(0,GB.default)(process.argv);if(this.startupOptions=n,this.fs.verbose=this.startupOptions.verbose,this.fromClone=(t==null?void 0:t.fromClone)||!1,r[2]!=="clone"&&process.platform!=="win32")try{Ie.enable()}catch(i){console.error(i)}return this.run()}async run(t){try{if(this._parseCommand(t),this.tutorial.inProgress)return await this.tutorial.handle(this.command);if(this.command==="sandbox")return await gy.sandbox(this);if(this.command==="git"||this.command==="code")return await gy.bash(this);this.isShellActive||(this._hideCursor(),this._logLogo(),this.viewSpinner("Loading"),await this._autoUpdate()),await this.messenger.connect(),this._watchKeyboard();let r=["clone"],n=["promote","test"];if((this.command==="start"||this.command==="tutorial")&&(this.isShellActive=!0),this.isShellActive&&r.includes(this.command))throw new Gf(`Command "${this.command}" is currently not supported in the shell`);if(n.includes(this.command))throw new Gf(`Command "${this.command}" is not available.`);if(!gy[this.command]&&this.command!=="tutorial")throw new Gf(`Command "${this.command}" is not a valid command`);if(!this.user&&(this.user=await Na.init(),!this.user.isLoggedIn())){this.logInfo("You must login to proceeed.");try{await this.user.performLogin(this)}catch(i){if(i.name==="UserDisabledError")return this.logError(i.message||"Your account has been disabled. Please contact support."),this._stop(0);throw i}}this.command==="tutorial"&&(this.command="start",this.options.tutorial=!0),await gy[this.command](this),this.options={}}catch(r){if(r instanceof Cm||r instanceof Gf)this.logError(r.message);else{if(r instanceof Xh)return this.logError(r.message),this._stop(this._exitCode);if(r.name==="InstancesLimitError"){let n=["share","deploy"].includes(this.command);return this.handleInstanceLimitExceeded({isDeploying:n})}else return r.name==="ServicesLimitError"?this.handleServiceLimitExceeded():(this.logError(`Something went wrong - please contact support and provide ${this.session.getSessionId()} as a reference ID`),this.session.captureException(r),this._stop(1))}}return this.isShellActive?this.viewInput():this._stop(this._exitCode)}handleServiceLimitExceeded(){let t="You have reached your app limit. Please upgrade your plan or delete an app.";return this.quit(t)}handleInstanceLimitExceeded(t){let{isDeploying:r=!1}=t||{},n="You have reached your environment limit. Please upgrade your plan or delete an environment.";if(!r)return this.quit(n);this.logWarning("Deployment failed"),this.logError(n),this.viewInput()}setProject(t){this.project=t}viewInput(t=this._formatLastSyncedAt()){this._timerInterval=clearInterval(this._timerInterval),this._spinnerInterval=clearInterval(this._spinnerInterval),this._startLastSyncedAtInterval(),this._switchView({viewType:"input",viewMessage:t})}spinInput(){if(this._viewType!=="input"){Ie.error({_viewType:this._viewType},"wrong viewType in spinInput");return}this.isAnimationEnabled&&(this._inputSpinnerStartedAt=Date.now(),clearInterval(this._inputSpinnerInterval),this._inputSpinnerInterval=setInterval(()=>this.updateInputSpinner(),this._spinnerFrequency).unref())}viewSpinner(t="Loading",{timer:r=!1}={}){if(!this.isInteractive){console.log(t);return}if(!this.isAnimationEnabled){this._switchView({viewType:"spinner",viewMessage:t});return}this._spinnerMessage=t,this._spinnerStep="",clearInterval(this._timerInterval),clearInterval(this._spinnerInterval),clearInterval(this._inputSpinnerInterval),this._timerInterval=void 0,this._spinnerInterval=void 0,this._inputSpinnerInterval=void 0,r&&(this.timer=0,this._timerInterval=setInterval(()=>this.timer=+this.timer+1,1e3).unref()),this._spinnerInterval=setInterval(()=>this._updateSpinner((this._spinnerMessage||"Loading")+(this._spinnerStep?` (${this._spinnerStep})`:""),{timer:r}),this._spinnerFrequency).unref()}updateLastSyncedAt(t){this._lastSyncedAt=t}updateInputSpinner(){this._spinnerFrameIndex=++this._spinnerFrameIndex%this._spinnerFrames.length,this._switchView({viewType:"input"})}stopSpinningInput(){this._inputSpinnerInterval&&(clearInterval(this._inputSpinnerInterval),this._inputSpinnerStoppedAt=Date.now(),this._inputSpinnerInterval=void 0),this.viewInput()}updateSpinnerStep(t){if(!process.stdin.isTTY){console.log(t);return}this._spinnerStep=t}pause(){this._clearIntervals(),this._switchView({viewType:"pause"}),this._eraseCursorLineAndBelow()}async prompt(t,r={}){for(this._isPromptActive=!0,r.default&&(this.inputValue=r.default),this.viewInput(t);!this._promptResponse;)await ia(50);let n=this._promptResponse;return this.logInfo(`You've entered ${this.styles.bold(n)}.`),this._promptResponse=null,this._isPromptActive=!1,n}async promptServiceName(t=null){let r=await this.prompt("Enter a name for your app",{default:t});return r.match(/^[a-z0-9-]+$/)?r:(this.logError("App name must consist only of lowercase characters and hyphens. Please try again."),await this.promptServiceName())}async confirm(t=!1,r){r&&this.logQuestion(r);let n=["no","yes"],i=await this.select(t?n.reverse():n);return i==="yes"}async select(t=[],r=0){if(clearInterval(this._timerInterval),clearInterval(this._spinnerInterval),clearInterval(this._inputSpinnerInterval),this._timerInterval=void 0,this._spinnerInterval=void 0,this._inputSpinnerInterval=void 0,this._selectItems=t,this._selectedItemIndex=r,this._switchView({viewType:"select"}),this._selectItems.length===1)return this._selectedItem=this._selectItems[0],this._selectedItem;for(;!this._selectedItem;)await ia(50);let n=this._selectedItem;return typeof n=="object"?this.logInfo(`You've selected ${this.styles.bold(n.title)}.`):this.logInfo(`You've selected ${this.styles.bold(n)}.`),this._selectedItem=null,this._selectedItemIndex=null,this._selectItems=[],n}async selectOrg(t,r){this.viewSpinner("Loading");let n,i=(t.orgs||[]).map(s=>s.orgName);return i.length>1?(this.logInfo(r||"Please select an organization."),n=await this.select(i)):n=i[0],n}async selectService(t,r){let n;this.viewSpinner("Loading");let i=(await t.listServicesWithInstances()).map(s=>s.serviceName);return Ie.debug({servicesList:i},"select service"),i.length>1?(this.logInfo(r||"Please select a service."),n=await this.select(i)):n=i[0],n}async selectInstance({service:t,instanceType:r,instanceName:n,message:i}){let o=(await(t==null?void 0:t.listInstances().catch(()=>[]))||[]).filter(c=>!r||c.instanceType===r).map(c=>({instanceName:c.instanceName,region:c.region,displayRegion:c.region||"",display:`${c.instanceName} (${c.region})`}));if(n)return o.find(c=>c.instanceName===n)||{instanceName:n,isNewInstance:!0};if(o.length===0)return{instanceName:void 0};this.logInfo(i||"Please select an instance.");let a=await this.select(o.map(c=>c.display));return{instanceName:o.find(c=>c.display===a).instanceName,isNewInstance:!1}}logSuccess(t,r=0){this.log(`${this.icons.tick} ${t}`,r)}logError(t,r=0){this.log(`${this.icons.cross} ${this.styles.bold(this.styles.red(t))}`,r)}logCancelled(){this.logError("Cancelled")}logInfo(t,r=0){this.log(`${this.icons.info} ${t}`,r)}logWarning(t,r=0){this.log(`${this.icons.warning} ${t}`,r)}logQuestion(t,r=0){this.log(`${this.icons.question} ${t}`,r)}logGroup(t,r=!0){t.forEach((n,i)=>{let o=r&&i===0?`${this.icons.arrow} ${this.styles.bold(n)}`:` ${this.icons.dot} ${n}`;this.log(o,i>0?2:0)})}logUrl(t,r=0){this.log(`${this.icons.arrow} ${t}`,r)}logTime(t,r=0){this.log(`${this.styles.dim(`${new Date(Date.now()).toLocaleTimeString()} ${this.icons.line}`)} ${t}`,r)}log(t="",r=0){this._ensureTopPadding(),this._eraseCursorLineAndBelow(),this._log(`${" ".repeat(r)}${t}
294
294
  `),this._view()}logSpace(){this.log(" ")}write(t=""){this._ensureTopPadding(),this._eraseCursorLineAndBelow(),this._log(t),this._view()}onQuit(t){this._onQuit=t}async quit(t="Stopped"){return this.inputValue="",this._clearIntervals(),this._quitting||this.logError(t),this._eraseCursorLineAndBelow(),!this._quitting&&this._onQuit&&(this._quitting=!0,await Zse(this._onQuit(),1e3)),this.isDevServerActive&&await Ni.stop(this,{orgName:this.orgName,serviceName:this.serviceName}),this._stop()}async startSession(){var t;try{await this.project.init()}catch(r){return await this.quit(`Something went wrong while starting the session: ${r.message}`)}if(!this.project)return await this.quit("Project was not initialized");this.tutorial.inProgress&&((t=this._suggestions)==null||t.push("skip","next","done")),this.tutorial.inProgress||await this.project.boot()}async checkForAmptPackageUpdates(){this.viewSpinner("Checking for package updates");let t=await this.fs.detectOutdatedAmptDependencies();if(t.length&&!this.fromClone){this._printOutOfDatePackages(t),this.logSpace();let r=t.filter(n=>!n.majorChange);r.length&&(this.logQuestion("Would you like to update them now?"),await this.confirm(!0)?await this.fs.updateOutdatedAmptDependencies(this,r):(this.logInfo("Skipping package updates"),this.logWarning("You may experience issues using outdated @ampt packages.")))}}async isAmptShellRunning(t){let{orgName:r,serviceName:n}=t;try{let i=ph(r,n),s=JSON.parse(await(0,sFe.readFile)(i,"utf8"));return SD(s.pid)?!0:((0,Om.removeSync)(ph(r,n)),!1)}catch{return!1}}async writeAmptShellActivityFile(t){let{orgName:r,serviceName:n}=t,i=ph(r,n);(0,Om.ensureFileSync)(i),(0,Om.writeFileSync)(i,JSON.stringify({pid:process.pid},null,4))}devServerOn(){this.isDevServerActive=!0,this.viewInput()}devServerOff(){this.isDevServerActive=!1,this.viewInput()}buildRunning(t){this.buildRunningInShell=t}bindService({orgName:t,serviceName:r}){this.orgName=t,this.serviceName=r}_switchView({viewType:t,viewMessage:r}){return t&&(this._viewType=t),typeof r<"u"&&(this._viewMessage=r),this._staticViewInputMsg&&(this._viewMessage=this._staticViewInputMsg),this._view()}_stop(t=0){this._clearIntervals(),process.stdin.pause(),this._eraseCursorLineAndBelow(),t===0&&this._log(`
295
295
  `),this._showCursor();try{if(/^win/.test(process.platform))(0,XB.execSync)(`taskkill /PID ${process.pid} /T /F`);else try{process.kill(-process.pid,"SIGINT")}catch{process.kill(-process.ppid,"SIGINT")}}catch(r){Ie.debug({error:r.message},"process.kill failed"),process.env.SLS_DEBUG&&this._log(r.message)}process.exit(t)}_clearIntervals(){clearInterval(this._timerInterval),clearInterval(this._spinnerInterval),clearInterval(this._inputSpinnerInterval),clearInterval(this._tipsInterval),clearInterval(this._lastSyncedAtInterval),this._timerInterval=void 0,this._spinnerInterval=void 0,this._inputSpinnerInterval=void 0,this._tipsInterval=void 0,this._lastSyncedAtInterval=void 0}_parseCommand(t){var a,u;let r=t?roe(t):process.argv.slice(2),n=(0,GB.default)(r);this.command=(a=n._[0])==null?void 0:a.toLowerCase(),this.args=(u=n._)==null?void 0:u.slice(1);let{_:i,...s}=n;this.options=Object.assign({},this.startupOptions,s),this.argv=r,(this.options.help||this.options.h)&&(this.command="help"),(this.options.version||this.options.v)&&(this.command="version"),this.names=dJ(this.args[0]),this.names.orgName=this.names.orgName||this.options.org,this.names.serviceName=this.names.serviceName||this.options.app,this.names.instanceName=this.names.instanceName||this.options.stage||this.options.instance,t==="start"&&delete gy.start,!t&&(!this.command||this.command==="start")&&(this.command="start"),this.command==="dev"&&(this.isShellActive?(this.args[0]=this.command,this.command="run"):(this.command="start",this.options.dev=!0)),this.command==="build"&&(this.args[0]=this.command,this.command="run"),this.command==="npm"&&(this.command=this.args[0],this.args.shift(),this.argv.shift()),this.isAnimationEnabled=this.options.animation!==!1,Ie.debug({args:this.args},"cli args"),Ie.debug({...this.options},"cli options"),Ie.debug({...this.names},"cli names")}_logLogo(){if(!this.showLogo)return;let t=zB.default.EOL;t+="ampt ",t+=`${this.icons.bolt}`,process.env.AMPT_STAGE!=="prod"&&(t+=`(${process.env.AMPT_STAGE})`),this.isBeta&&(t+=`(${this.styles.dim("beta")})`),t+=zB.default.EOL,this._log(t)}_log(t){process.stdout.write(t)}_showCursor(){this._log(mp.default.cursorShow)}_hideCursor(){this._log(mp.default.cursorHide)}_moveCursorLeft(){this._log(mp.default.cursorLeft)}_moveCursorUp(t){this._log(mp.default.cursorUp(t))}_eraseCursorLineAndBelow(){this._log(mp.default.eraseDown)}_restorCursorPosition(t){let r=this._getRelativeVerticalCursorPosition(t);this._moveCursorUp(r),this._moveCursorLeft()}_getRelativeVerticalCursorPosition(t){let n=(0,nFe.default)(t).split(`
296
296
  `),i=n.length;for(let o of n){let a=Number(o.length),u=Number(process.stdout.columns),c=Math.floor(a/u);i+=c}return 1+i}_view(){this._hideCursor();let t=this._getView();t&&(this._eraseCursorLineAndBelow(),this._log(`