@zuplo/core 5.1753.0 → 5.1755.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create.index.minified.js +1 -1
- package/index.minified.js +1 -1
- package/package.json +1 -1
package/create.index.minified.js
CHANGED
|
@@ -407,5 +407,5 @@ ${p}
|
|
|
407
407
|
${f}`;const m=`${a}/${t.region}/${n}/${NNt}`;const g=`${PSe}
|
|
408
408
|
${s}
|
|
409
409
|
${m}
|
|
410
|
-
`+await t.crypto.sha256DigestHex(h);const y=await INt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await K6(t.crypto,y,g);const w=`${PSe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,DSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(PNt,"generateAuthenticationHeaderMap")});var mG=_(BA=>{"use strict";Object.defineProperty(BA,"__esModule",{value:true});BA.AwsClient=void 0;var DNt=kSe();var kNt=cf();var Y6=class extends kNt.BaseExternalAccountClient{static{o(this,"AwsClient")}constructor(e,r){super(e,r);this.environmentId=e.credential_source.environment_id;this.regionUrl=e.credential_source.region_url;this.securityCredentialsUrl=e.credential_source.url;this.regionalCredVerificationUrl=e.credential_source.regional_cred_verification_url;this.imdsV2SessionTokenUrl=e.credential_source.imdsv2_session_token_url;this.awsRequestSigner=null;this.region="";this.validateEnvironmentId()}validateEnvironmentId(){var e;const r=(e=this.environmentId)===null||e===void 0?void 0:e.match(/^(aws)(\d+)$/);if(!r||!this.regionalCredVerificationUrl){throw new Error('No valid AWS "credential_source" provided')}else if(parseInt(r[2],10)!==1){throw new Error(`aws version "${r[2]}" is not supported in the current build.`)}}async retrieveSubjectToken(){if(!this.awsRequestSigner){const i={};if(this.shouldUseMetadataServer()&&this.imdsV2SessionTokenUrl){i["x-aws-ec2-metadata-token"]=await this.getImdsV2SessionToken()}this.region=await this.getAwsRegion(i);this.awsRequestSigner=new DNt.AwsRequestSigner(async()=>{if(this.securityCredentialsFromEnv){return this.securityCredentialsFromEnv}const s=await this.getAwsRoleName(i);const a=await this.getAwsSecurityCredentials(s,i);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,token:a.Token}},this.region)}const e=await this.awsRequestSigner.getRequestOptions({url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"});const r=[];const n=Object.assign({"x-goog-cloud-target-resource":this.audience},e.headers);for(const i in n){r.push({key:i,value:n[i]})}return encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:r}))}async getImdsV2SessionToken(){const e={url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};const r=await this.transporter.request(e);return r.data}async getAwsRegion(e){if(this.regionFromEnv){return this.regionFromEnv}if(!this.regionUrl){throw new Error('Unable to determine AWS region due to missing "options.credential_source.region_url"')}const r={url:this.regionUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data.substr(0,n.data.length-1)}async getAwsRoleName(e){if(!this.securityCredentialsUrl){throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"')}const r={url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data}async getAwsSecurityCredentials(e,r){const n=await this.transporter.request({url:`${this.securityCredentialsUrl}/${e}`,responseType:"json",headers:r});return n.data}shouldUseMetadataServer(){return!this.regionFromEnv||!this.securityCredentialsFromEnv}get regionFromEnv(){return process.env["AWS_REGION"]||process.env["AWS_DEFAULT_REGION"]||null}get securityCredentialsFromEnv(){if(process.env["AWS_ACCESS_KEY_ID"]&&process.env["AWS_SECRET_ACCESS_KEY"]){return{accessKeyId:process.env["AWS_ACCESS_KEY_ID"],secretAccessKey:process.env["AWS_SECRET_ACCESS_KEY"],token:process.env["AWS_SESSION_TOKEN"]}}return null}};BA.AwsClient=Y6;Y6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";Y6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var EG=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:true});pi.InvalidSubjectTokenError=pi.InvalidMessageFieldError=pi.InvalidCodeFieldError=pi.InvalidTokenTypeFieldError=pi.InvalidExpirationTimeFieldError=pi.InvalidSuccessFieldError=pi.InvalidVersionFieldError=pi.ExecutableResponseError=pi.ExecutableResponse=void 0;var VA="urn:ietf:params:oauth:token-type:saml2";var gG="urn:ietf:params:oauth:token-type:id_token";var yG="urn:ietf:params:oauth:token-type:jwt";var vG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new HA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new zA("Executable response must contain a 'success' field.")}this.version=e.version;this.success=e.success;if(this.success){this.expirationTime=e.expiration_time;this.tokenType=e.token_type;if(this.tokenType!==VA&&this.tokenType!==gG&&this.tokenType!==yG){throw new GA(`Executable response must contain a 'token_type' field when successful and it must be one of ${gG}, ${yG}, or ${VA}.`)}if(this.tokenType===VA){if(!e.saml_response){throw new W6(`Executable response must contain a 'saml_response' field when token_type=${VA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new W6(`Executable response must contain a 'id_token' field when token_type=${gG} or ${yG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new KA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new YA("Executable response must contain a 'message' field when unsuccessful.")}this.errorCode=e.code;this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};pi.ExecutableResponse=vG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var HA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=HA;var zA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=zA;var _G=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=_G;var GA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=GA;var KA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=KA;var YA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=YA;var W6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=W6});var $Se=_(WA=>{"use strict";Object.defineProperty(WA,"__esModule",{value:true});WA.PluggableAuthHandler=void 0;var $Nt=JA();var Nm=EG();var LNt=require("child_process");var bG=require("fs");var wG=class t{static{o(this,"PluggableAuthHandler")}constructor(e){if(!e.command){throw new Error("No command provided.")}this.commandComponents=t.parseCommand(e.command);this.timeoutMillis=e.timeoutMillis;if(!this.timeoutMillis){throw new Error("No timeoutMillis provided.")}this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((r,n)=>{const i=LNt.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}});let s="";i.stdout.on("data",u=>{s+=u});i.stderr.on("data",u=>{s+=u});const a=setTimeout(()=>{i.removeAllListeners();i.kill();return n(new Error("The executable failed to finish within the timeout specified."))},this.timeoutMillis);i.on("close",u=>{clearTimeout(a);if(u===0){try{const l=JSON.parse(s);const c=new Nm.ExecutableResponse(l);return r(c)}catch(l){if(l instanceof Nm.ExecutableResponseError){return n(l)}return n(new Nm.ExecutableResponseError(`The executable returned an invalid response: ${s}`))}}else{return n(new $Nt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await bG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await bG.promises.lstat(e)).isFile()){return void 0}const r=await bG.promises.readFile(e,{encoding:"utf8"});if(r===""){return void 0}try{const n=JSON.parse(r);const i=new Nm.ExecutableResponse(n);if(i.isValid()){return new Nm.ExecutableResponse(n)}return void 0}catch(n){if(n instanceof Nm.ExecutableResponseError){throw n}throw new Nm.ExecutableResponseError(`The output file contained an invalid response: ${r}`)}}static parseCommand(e){const r=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!r){throw new Error(`Provided command: "${e}" could not be parsed.`)}for(let n=0;n<r.length;n++){if(r[n][0]==='"'&&r[n].slice(-1)==='"'){r[n]=r[n].slice(1,-1)}}return r}};WA.PluggableAuthHandler=wG});var JA=_(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:true});Sy.PluggableAuthClient=Sy.ExecutableError=void 0;var qNt=cf();var jNt=EG();var UNt=$Se();var QA=class extends Error{static{o(this,"ExecutableError")}constructor(e,r){super(`The executable failed with exit code: ${r} and error message: ${e}.`);this.code=r;Object.setPrototypeOf(this,new.target.prototype)}};Sy.ExecutableError=QA;var FNt=30*1e3;var LSe=5*1e3;var qSe=120*1e3;var MNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var jSe=1;var SG=class extends qNt.BaseExternalAccountClient{static{o(this,"PluggableAuthClient")}constructor(e,r){super(e,r);if(!e.credential_source.executable){throw new Error('No valid Pluggable Auth "credential_source" provided.')}this.command=e.credential_source.executable.command;if(!this.command){throw new Error('No valid Pluggable Auth "credential_source" provided.')}if(e.credential_source.executable.timeout_millis===void 0){this.timeoutMillis=FNt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<LSe||this.timeoutMillis>qSe){throw new Error(`Timeout must be between ${LSe} and ${qSe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new UNt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[MNt]!=="1"){throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.")}let e=void 0;if(this.outputFile){e=await this.handler.retrieveCachedResponse()}if(!e){const r=new Map;r.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience);r.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType);r.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0");if(this.outputFile){r.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile)}const n=this.getServiceAccountEmail();if(n){r.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",n)}e=await this.handler.retrieveResponseFromExecutable(r)}if(e.version>jSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${jSe}.`)}if(!e.success){throw new QA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new jNt.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}}if(e.isExpired()){throw new Error("Executable response is expired.")}return e.subjectToken}};Sy.PluggableAuthClient=SG});var AG=_(XA=>{"use strict";Object.defineProperty(XA,"__esModule",{value:true});XA.ExternalAccountClient=void 0;var BNt=cf();var VNt=fG();var HNt=mG();var zNt=JA();var TG=class{static{o(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e,r){var n,i;if(e&&e.type===BNt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new HNt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new zNt.PluggableAuthClient(e,r)}else{return new VNt.IdentityPoolClient(e,r)}}else{return null}}};XA.ExternalAccountClient=TG});var FSe=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.ExternalAccountAuthorizedUserClient=Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var GNt=ny();var USe=rG();var KNt=Jc();var YNt=require("stream");var WNt=cf();Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var xG=class extends USe.OAuthClientAuthHandler{static{o(this,"ExternalAccountAuthorizedUserHandler")}constructor(e,r,n){super(n);this.url=e;this.transporter=r}async refreshToken(e,r){const n=new URLSearchParams({grant_type:"refresh_token",refresh_token:e});const i={"Content-Type":"application/x-www-form-urlencoded",...r};const s={url:this.url,method:"POST",headers:i,data:n.toString(),responseType:"json"};this.applyClientAuthenticationOptions(s);try{const a=await this.transporter.request(s);const u=a.data;u.res=a;return u}catch(a){if(a instanceof KNt.GaxiosError&&a.response){throw(0,USe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var CG=class extends GNt.AuthClient{static{o(this,"ExternalAccountAuthorizedUserClient")}constructor(e,r){super();this.refreshToken=e.refresh_token;const n={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new xG(e.token_url,this.transporter,n);this.cachedAccessToken=null;this.quotaProjectId=e.quota_project_id;if(typeof(r===null||r===void 0?void 0:r.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=WNt.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=r.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(r===null||r===void 0?void 0:r.forceRefreshOnFailure)}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof YNt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){const e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res};if(e.refresh_token!==void 0){this.refreshToken=e.refresh_token}return this.cachedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Ty.ExternalAccountAuthorizedUserClient=CG});var VSe=_(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:true});xy.GoogleAuth=xy.CLOUD_SDK_CLIENT_ID=void 0;var JNt=require("child_process");var J6=require("fs");var RG=z7();var QNt=require("os");var OG=require("path");var XNt=ty();var ZNt=N6();var eIt=jH();var tIt=FH();var rIt=MH();var Ay=Jz();var NG=Xz();var ZA=eG();var nIt=AG();var Q6=cf();var MSe=FSe();xy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var BSe={NO_PROJECT_ID_FOUND:"Unable to detect a Project Id in the current environment. \nTo learn more about authentication and Google APIs, visit: \nhttps://cloud.google.com/docs/authentication/getting-started"};var ex=class{static{o(this,"GoogleAuth")}get isGCE(){return this.checkIsGCE}constructor(e){this.checkIsGCE=void 0;this.jsonContent=null;this.cachedCredential=null;e=e||{};this._cachedProjectId=e.projectId||null;this.cachedCredential=e.authClient||null;this.keyFilename=e.keyFilename||e.keyFile;this.scopes=e.scopes;this.jsonContent=e.credentials||null;this.clientOptions=e.clientOptions}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath;e.useJWTAccessWithScope=this.useJWTAccessWithScope;e.defaultScopes=this.defaultScopes}getProjectId(e){if(e){this.getProjectIdAsync().then(r=>e(null,r),e)}else{return this.getProjectIdAsync()}}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===BSe.NO_PROJECT_ID_FOUND){return null}else{throw e}}}async findAndCacheProjectId(){let e=null;e||(e=await this.getProductionProjectId());e||(e=await this.getFileProjectId());e||(e=await this.getDefaultServiceProjectId());e||(e=await this.getGCEProjectId());e||(e=await this.getExternalAccountClientProjectId());if(e){this._cachedProjectId=e;return e}else{throw new Error(BSe.NO_PROJECT_ID_FOUND)}}async getProjectIdAsync(){if(this._cachedProjectId){return this._cachedProjectId}if(!this._findProjectIdPromise){this._findProjectIdPromise=this.findAndCacheProjectId()}return this._findProjectIdPromise}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},r){let n;if(typeof e==="function"){r=e}else{n=e}if(r){this.getApplicationDefaultAsync(n).then(i=>r(null,i.credential,i.projectId),r)}else{return this.getApplicationDefaultAsync(n)}}async getApplicationDefaultAsync(e={}){if(this.cachedCredential){return await this.prepareAndCacheADC(this.cachedCredential)}const r=process.env["GOOGLE_CLOUD_QUOTA_PROJECT"];let n;n=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Q6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}n=await this._tryGetApplicationCredentialsFromWellKnownFile(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Q6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}let i;try{i=await this._checkIsGCE()}catch(s){if(s instanceof Error){s.message=`Unexpected error determining execution environment: ${s.message}`}throw s}if(!i){throw new Error("Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.")}e.scopes=this.getAnyScopes();return await this.prepareAndCacheADC(new eIt.Compute(e),r)}async prepareAndCacheADC(e,r){const n=await this.getProjectIdOptional();if(r){e.quotaProjectId=r}this.cachedCredential=e;return{credential:e,projectId:n}}async _checkIsGCE(){if(this.checkIsGCE===void 0){this.checkIsGCE=await RG.isAvailable()}return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){const r=process.env["GOOGLE_APPLICATION_CREDENTIALS"]||process.env["google_application_credentials"];if(!r||r.length===0){return null}try{return this._getApplicationCredentialsFromFilePath(r,e)}catch(n){if(n instanceof Error){n.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${n.message}`}throw n}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let r=null;if(this._isWindows()){r=process.env["APPDATA"]}else{const i=process.env["HOME"];if(i){r=OG.join(i,".config")}}if(r){r=OG.join(r,"gcloud","application_default_credentials.json");if(!J6.existsSync(r)){r=null}}if(!r){return null}const n=await this._getApplicationCredentialsFromFilePath(r,e);return n}async _getApplicationCredentialsFromFilePath(e,r={}){if(!e||e.length===0){throw new Error("The file path is invalid.")}try{e=J6.realpathSync(e);if(!J6.lstatSync(e).isFile()){throw new Error}}catch(i){if(i instanceof Error){i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`}throw i}const n=J6.createReadStream(e);return this.fromStream(n,r)}fromImpersonatedJSON(e){var r,n,i,s;if(!e){throw new Error("Must pass in a JSON object containing an impersonated refresh token")}if(e.type!==ZA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${ZA.IMPERSONATED_ACCOUNT_TYPE}" type`)}if(!e.source_credentials){throw new Error("The incoming JSON object does not contain a source_credentials field")}if(!e.service_account_impersonation_url){throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field")}const a=new NG.UserRefreshClient(e.source_credentials.client_id,e.source_credentials.client_secret,e.source_credentials.refresh_token);const u=(n=(r=/(?<target>[^/]+):generateAccessToken$/.exec(e.service_account_impersonation_url))===null||r===void 0?void 0:r.groups)===null||n===void 0?void 0:n.target;if(!u){throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`)}const l=(i=this.getAnyScopes())!==null&&i!==void 0?i:[];const c=new ZA.Impersonated({delegates:(s=e.delegates)!==null&&s!==void 0?s:[],sourceClient:a,targetPrincipal:u,targetScopes:Array.isArray(l)?l:[l]});return c}fromJSON(e,r={}){let n;r=r||{};if(e.type===NG.USER_REFRESH_ACCOUNT_TYPE){n=new NG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===ZA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===Q6.EXTERNAL_ACCOUNT_TYPE){n=nIt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===MSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new MSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new Ay.JWT(r);this.setGapicJWTValues(n);n.fromJSON(e)}return n}_cacheClientFromJSON(e,r){const n=this.fromJSON(e,r);this.jsonContent=e;this.cachedCredential=n;return n}fromStream(e,r={},n){let i={};if(typeof r==="function"){n=r}else{i=r}if(n){this.fromStreamAsync(e,i).then(s=>n(null,s),n)}else{return this.fromStreamAsync(e,i)}}fromStreamAsync(e,r){return new Promise((n,i)=>{if(!e){throw new Error("Must pass in a stream containing the Google auth settings.")}let s="";e.setEncoding("utf8").on("error",i).on("data",a=>s+=a).on("end",()=>{try{try{const a=JSON.parse(s);const u=this._cacheClientFromJSON(a,r);return n(u)}catch(a){if(!this.keyFilename)throw a;const u=new Ay.JWT({...this.clientOptions,keyFile:this.keyFilename});this.cachedCredential=u;this.setGapicJWTValues(u);return n(u)}}catch(a){return i(a)}})})}fromAPIKey(e,r){r=r||{};const n=new Ay.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=QNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,JNt.exec)("gcloud config config-helper --format json",(r,n)=>{if(!r&&n){try{const i=JSON.parse(n).configuration.properties.core.project;e(i);return}catch(i){}}e(null)})})}getProductionProjectId(){return process.env["GCLOUD_PROJECT"]||process.env["GOOGLE_CLOUD_PROJECT"]||process.env["gcloud_project"]||process.env["google_cloud_project"]}async getFileProjectId(){if(this.cachedCredential){return this.cachedCredential.projectId}if(this.keyFilename){const r=await this.getClient();if(r&&r.projectId){return r.projectId}}const e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(e){return e.projectId}else{return null}}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==Q6.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await RG.project("project-id");return e}catch(e){return null}}getCredentials(e){if(e){this.getCredentialsAsync().then(r=>e(null,r),e)}else{return this.getCredentialsAsync()}}async getCredentialsAsync(){const e=await this.getClient();if(e instanceof Q6.BaseExternalAccountClient){const i=e.getServiceAccountEmail();if(i){return{client_email:i}}}if(this.jsonContent){const i={client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key};return i}const r=await this._checkIsGCE();if(!r){throw new Error("Unknown error.")}const n=await RG.instance({property:"service-accounts/",params:{recursive:"true"}});if(!n||!n.default||!n.default.email){throw new Error("Failure from metadata server.")}return{client_email:n.default.email}}async getClient(){if(!this.cachedCredential){if(this.jsonContent){this._cacheClientFromJSON(this.jsonContent,this.clientOptions)}else if(this.keyFilename){const e=OG.resolve(this.keyFilename);const r=J6.createReadStream(e);await this.fromStreamAsync(r,this.clientOptions)}else{await this.getApplicationDefaultAsync(this.clientOptions)}}return this.cachedCredential}async getIdTokenClient(e){const r=await this.getClient();if(!("fetchIdToken"in r)){throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.")}return new tIt.IdTokenClient({targetAudience:e,idTokenProvider:r})}async getAccessToken(){const e=await this.getClient();return(await e.getAccessToken()).token}async getRequestHeaders(e){const r=await this.getClient();return r.getRequestHeaders(e)}async authorizeRequest(e){e=e||{};const r=e.url||e.uri;const n=await this.getClient();const i=await n.getRequestHeaders(r);e.headers=Object.assign(e.headers||{},i);return e}async request(e){const r=await this.getClient();return r.request(e)}getEnv(){return(0,rIt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,XNt.createCrypto)();if(r instanceof Ay.JWT&&r.key){const s=await n.sign(r.key,e);return s}const i=await this.getCredentials();if(!i.client_email){throw new Error("Cannot sign data without `client_email`.")}return this.signBlob(n,i.client_email,e)}async signBlob(e,r,n){const i=`https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${r}:signBlob`;const s=await this.request({method:"POST",url:i,data:{payload:e.encodeBase64StringUtf8(n)}});return s.data.signedBlob}};xy.GoogleAuth=ex;ex.DefaultTransporter=ZNt.DefaultTransporter});var HSe=_(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:true});tx.IAMAuth=void 0;var IG=class{static{o(this,"IAMAuth")}constructor(e,r){this.selector=e;this.token=r;this.selector=e;this.token=r}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};tx.IAMAuth=IG});var zSe=_(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:true});Du.DownscopedClient=Du.EXPIRATION_TIME_OFFSET=Du.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var iIt=require("stream");var sIt=ny();var aIt=iG();var oIt="urn:ietf:params:oauth:grant-type:token-exchange";var uIt="urn:ietf:params:oauth:token-type:access_token";var lIt="urn:ietf:params:oauth:token-type:access_token";var cIt="https://sts.googleapis.com/v1/token";Du.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Du.EXPIRATION_TIME_OFFSET=5*60*1e3;var PG=class extends sIt.AuthClient{static{o(this,"DownscopedClient")}constructor(e,r,n,i){super();this.authClient=e;this.credentialAccessBoundary=r;if(r.accessBoundary.accessBoundaryRules.length===0){throw new Error("At least one access boundary rule needs to be defined.")}else if(r.accessBoundary.accessBoundaryRules.length>Du.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Du.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`)}for(const s of r.accessBoundary.accessBoundaryRules){if(s.availablePermissions.length===0){throw new Error("At least one permission should be defined in access boundary rules.")}}this.stsCredential=new aIt.StsCredentials(cIt);this.cachedDownscopedAccessToken=null;if(typeof(n===null||n===void 0?void 0:n.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=Du.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=n.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(n===null||n===void 0?void 0:n.forceRefreshOnFailure);this.quotaProjectId=i}setCredentials(e){if(!e.expiry_date){throw new Error("The access token expiry_date field is missing in the provided credentials.")}super.setCredentials(e);this.cachedDownscopedAccessToken=e}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof iIt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){var e;const r=(await this.authClient.getAccessToken()).token;const n={grantType:oIt,requestedTokenType:uIt,subjectToken:r,subjectTokenType:lIt};const i=await this.stsCredential.exchangeToken(n,void 0,this.credentialAccessBoundary);const s=((e=this.authClient.credentials)===null||e===void 0?void 0:e.expiry_date)||null;const a=i.expires_in?new Date().getTime()+i.expires_in*1e3:s;this.cachedDownscopedAccessToken={access_token:i.access_token,expiry_date:a,res:i.res};this.credentials={};Object.assign(this.credentials,this.cachedDownscopedAccessToken);delete this.credentials.res;this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null});return this.cachedDownscopedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Du.DownscopedClient=PG});var DG=_(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:true});Ot.GoogleAuth=Ot.auth=Ot.DefaultTransporter=Ot.PluggableAuthClient=Ot.DownscopedClient=Ot.BaseExternalAccountClient=Ot.ExternalAccountClient=Ot.IdentityPoolClient=Ot.AwsClient=Ot.UserRefreshClient=Ot.LoginTicket=Ot.OAuth2Client=Ot.CodeChallengeMethod=Ot.Impersonated=Ot.JWT=Ot.JWTAccess=Ot.IdTokenClient=Ot.IAMAuth=Ot.GCPEnv=Ot.Compute=Ot.AuthClient=void 0;var GSe=VSe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return GSe.GoogleAuth}});var dIt=ny();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return dIt.AuthClient}});var pIt=jH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return pIt.Compute}});var fIt=MH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return fIt.GCPEnv}});var hIt=HSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return hIt.IAMAuth}});var mIt=FH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return mIt.IdTokenClient}});var gIt=Yz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return gIt.JWTAccess}});var yIt=Jz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return yIt.JWT}});var vIt=eG();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return vIt.Impersonated}});var KSe=Em();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return KSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return KSe.OAuth2Client}});var _It=$H();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return _It.LoginTicket}});var EIt=Xz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return EIt.UserRefreshClient}});var bIt=mG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return bIt.AwsClient}});var wIt=fG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return wIt.IdentityPoolClient}});var SIt=AG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return SIt.ExternalAccountClient}});var TIt=cf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return TIt.BaseExternalAccountClient}});var AIt=zSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return AIt.DownscopedClient}});var xIt=JA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return xIt.PluggableAuthClient}});var CIt=N6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return CIt.DefaultTransporter}});var RIt=new GSe.GoogleAuth;Ot.auth=RIt});var Ry=_(Cy=>{"use strict";var OIt=Cy&&Cy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Cy,"__esModule",{value:true});Cy.getServiceAccountIdToken=void 0;var NIt=DG();var IIt=OIt(ru());var PIt=new NIt.GoogleAuth;var YSe=new IIt.default({max:50,maxAge:1e3*60*50});async function DIt(t){let e=YSe.get(t);if(!e){const r=await PIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);YSe.set(t,e)}return e}o(DIt,"getServiceAccountIdToken");Cy.getServiceAccountIdToken=DIt});var ZSe=_(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:true});Mo.mergeHeaders=Mo.createFinalURL=Mo.defaultBodySerializer=Mo.defaultQuerySerializer=Mo.createClient=void 0;var Oy=As();var kIt=Ry();var $It=/\/*$/;async function LIt(t){const{baseUrl:e,fetch:r=globalThis.fetch,querySerializer:n,bodySerializer:i,zuploExtensions:s,...a}=t;const u=s?.fastifyRequest.log;const l=s?.fastifyRequest.id;const c=s?.options?.userSub??s?.fastifyRequest.getUserSub();const d=new Headers({"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,kIt.getServiceAccountIdToken)(e);d.set("Authorization",`Bearer ${p}`);if(["GET","DELETE","HEAD","OPTIONS","TRACE"].includes(s.fastifyRequest.method)){}else{d.set("Content-Type","application/json")}async function f(h,m){const{headers:g,body:y,params:v={},parseAs:w="json",querySerializer:E=n??WSe,bodySerializer:b=i??JSe,...S}=m||{};const T=QSe(h,{baseUrl:e,params:v,querySerializer:E});const A=XSe(d,g,v.header);const R={redirect:"follow",...a,...S,headers:A};if(y)R.body=b(y);if(R.body instanceof FormData)A.delete("Content-Type");const O=await r(T,R);if(O.status===404){const j=await O.json();if(j&&j.hasOwnProperty("type")&&j.hasOwnProperty("title")&&j.hasOwnProperty("status")){throw new Oy.ApiError(j)}throw new Oy.ApiError(Oy.Problems.NOT_FOUND)}if(O.status===204||O.headers.get("Content-Length")==="0"){return O.ok?{data:{},response:O}:{error:{},response:O}}if(O.ok){let j=O.body;if(w!=="stream"){const B=O.clone();j=typeof B[w]==="function"?await B[w]():await B.text()}return{data:j,response:O}}else{u.debug(`Error on internal api: path: ${T}, status: ${O.status}, headers: ${JSON.stringify(O.headers)}, body: ${await O.clone().text()}`);let j={};try{j=await O.clone().json();if(j.type&&j.status&&j.title){throw new Oy.ApiError(j)}}catch(B){}throw new Oy.ApiError(Oy.Problems.INTERNAL_SERVER_ERROR)}}o(f,"coreFetch");return{async GET(h,m){return f(h,{...m,method:"GET"})},async PUT(h,m){return f(h,{...m,method:"PUT"})},async POST(h,m){return f(h,{...m,method:"POST"})},async DELETE(h,m){return f(h,{...m,method:"DELETE"})},async OPTIONS(h,m){return f(h,{...m,method:"OPTIONS"})},async HEAD(h,m){return f(h,{...m,method:"HEAD"})},async PATCH(h,m){return f(h,{...m,method:"PATCH"})},async TRACE(h,m){return f(h,{...m,method:"TRACE"})}}}o(LIt,"createClient");Mo.createClient=LIt;function WSe(t){const e=new URLSearchParams;if(t&&typeof t==="object"){for(const[r,n]of Object.entries(t)){if(n===void 0||n===null)continue;e.set(r,n)}}return e.toString()}o(WSe,"defaultQuerySerializer");Mo.defaultQuerySerializer=WSe;function JSe(t){return JSON.stringify(t)}o(JSe,"defaultBodySerializer");Mo.defaultBodySerializer=JSe;function QSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace($It,""):""}${t}`;if(e.params.path){for(const[n,i]of Object.entries(e.params.path))r=r.replace(`{${n}}`,encodeURIComponent(String(i)))}if(e.params.query){const n=e.querySerializer(e.params.query);if(n)r+=`?${n}`}return r}o(QSe,"createFinalURL");Mo.createFinalURL=QSe;function XSe(...t){const e=new Headers;for(const r of t){if(!r||typeof r!=="object")continue;const n=r instanceof Headers?r.entries():Object.entries(r);for(const[i,s]of n){if(s!==void 0&&s!==null){e.set(i,s)}}}return e}o(XSe,"mergeHeaders");Mo.mergeHeaders=XSe});var eTe=_(df=>{"use strict";var qIt=df&&df.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(df,"__esModule",{value:true});df.ApiKeyService=df.createApiKeyServiceClient=void 0;var Ny=As();var jIt=DG();var rx=qIt(Oa());var UIt=ZSe();async function FIt(t){return(0,UIt.createClient)({baseUrl:rx.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(FIt,"createApiKeyServiceClient");df.createApiKeyServiceClient=FIt;var kG=class{static{o(this,"ApiKeyService")}logger;requestId;constructor(e){this.logger=e.log;this.requestId=e.id}async fetchGCP(e,r={}){this.logger.info(`Fetching with GCP JWT ${r.method} ${e} from Api Key Service API.`);const n=new jIt.GoogleAuth;const i=await n.getIdTokenClient(rx.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${rx.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:"GET",body:r.body,headers:{...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}}})}`);const s=await i.getRequestHeaders();const a=await i.request({url:`${rx.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:r.method||"GET",body:r.body,headers:{...s,...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}},validateStatus:u=>u>=200&&u<500});if(a.status===404){const u=await a.data;if(u&&u.hasOwnProperty("type")&&u.hasOwnProperty("title")&&u.hasOwnProperty("status")){throw new Ny.ApiError(u)}throw new Ny.ApiError(Ny.Problems.NOT_FOUND)}if(a.status>=300){this.logger.debug(`Error on api-key-service: path: ${e}, status: ${a.status}, headers: ${JSON.stringify(a.headers)}, body: ${JSON.stringify(a.data)}`);const u=a.data;if(u.type&&u.status&&u.title){throw new Ny.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Ny.ApiError(Ny.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};df.ApiKeyService=kG});var rTe=_(Iy=>{"use strict";var MIt=Iy&&Iy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Iy,"__esModule",{value:true});Iy.AuthApiService=void 0;var Im=As();var tTe=MIt(Oa());var BIt=Ry();var $G=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!tTe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=tTe.default.AUTH_API_URL}async getClientJWT(e,r){let n;try{n=await this.fetch(`/v1/clients/${e}`,{method:"GET"})}catch(s){if(s.status===Im.Problems.NOT_FOUND.status){n=await this.fetch(`/v1/clients`,{method:"POST",body:JSON.stringify({client_id:e})})}else{throw s}}const i=await this.fetch(`/v1/oauth/token`,{method:"POST",body:JSON.stringify({client_id:e,client_secret:n.client_secret,grant_type:"client_credentials",custom_claims:r})});return i.access_token}async fetch(e,r){this.logger.info(`Fetching internally ${e} from Auth API V2.`);const n=new Headers({"content-type":"application/json","zp-rid":this.requestId,authorization:""});if(process.env.K_SERVICE){const s=await(0,BIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===Im.HttpStatusCode.NOT_FOUND){throw new Im.ApiError(Im.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on auth-api: path: ${e}, status: ${i.status}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Im.ApiError(s)}this.logger.error(`Error not handled on auth-api: path: ${e}, status: ${i.status}`);throw new Im.ApiError(Im.Problems.INTERNAL_SERVER_ERROR)}return i.clone().json()}};Iy.AuthApiService=$G});var X6=_(nx=>{"use strict";Object.defineProperty(nx,"__esModule",{value:true});nx.ApiServiceClient=void 0;var Py=As();var VIt=Ry();var LG=class{static{o(this,"ApiServiceClient")}userSub;logger;requestId;baseUrl;cache;targetAudience;constructor(e,r,n){this.userSub=n.userSub;this.logger=n.logger;this.requestId=n.requestId;this.baseUrl=e;this.cache=r;this.targetAudience=n.targetAudience}async cachedFetch(e,r,n){if(!this.userSub||!n){throw new Error("userSub and cacheKey parameters are required to use cachedFetch")}const i=`${this.userSub}@${n}`;if(this.cache.has(i)){return this.cache.get(i)}const s=await this.fetchInternally(e,r);this.cache.set(i,s);return s}async fetchInternally(e,r){this.logger.info(`Fetching internally ${r.method} ${this.baseUrl}${e}`);const n=new Headers({...r.headers,"zuplo-user":this.userSub,"content-type":"application/json","zp-rid":this.requestId});if(process.env.K_SERVICE){const s=await(0,VIt.getServiceAccountIdToken)(this.targetAudience??this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===404){this.logger.debug(`Error on internal api: path: ${e}, status: ${i.status}, body: ${JSON.stringify(i.clone().text())}`);const s=await i.json();if(s&&s.hasOwnProperty("type")&&s.hasOwnProperty("title")&&s.hasOwnProperty("status")){throw new Py.ApiError(s)}throw new Py.ApiError(Py.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on internal api: path: ${e}, status: ${i.status}, body: ${JSON.stringify(i.clone().text())}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Py.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Py.ApiError(Py.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};nx.ApiServiceClient=LG});var aTe=_(Vl=>{"use strict";var iTe=Vl&&Vl.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Vl,"__esModule",{value:true});Vl.ContentApiService=Vl.getContentApiStorageTarballPath=Vl.contentApiTarballFileName=void 0;var HIt=iTe(ru());var nTe=iTe(Oa());var zIt=X6();var GIt=new HIt.default({max:500,maxAge:1e3*60*50});function sTe(t,e){return`${t}--${e}.tar.gz`}o(sTe,"contentApiTarballFileName");Vl.contentApiTarballFileName=sTe;function KIt(t,e){const r=sTe(t,e);return`${t}/builds/${r}`}o(KIt,"getContentApiStorageTarballPath");Vl.getContentApiStorageTarballPath=KIt;var qG=class extends zIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!nTe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(nTe.default.CONTENT_API_URL,GIt,e)}};Vl.ContentApiService=qG});var lTe=_(Dy=>{"use strict";var uTe=Dy&&Dy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Dy,"__esModule",{value:true});Dy.DevApiService=void 0;var YIt=uTe(ru());var oTe=uTe(Oa());var WIt=X6();var JIt=new YIt.default({max:500,maxAge:1e3*60*50});var jG=class extends WIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!oTe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(oTe.default.DEV_API_URL,JIt,{userSub:n,logger:e.log,requestId:e.id})}};Dy.DevApiService=jG});var pTe=_((Nhr,dTe)=>{var cTe=require("stream").Stream;var QIt=require("util");dTe.exports=ku;function ku(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(ku,"DelayedStream");QIt.inherits(ku,cTe);ku.create=function(t,e){var r=new this;e=e||{};for(var n in e){r[n]=e[n]}r.source=t;var i=t.emit;t.emit=function(){r._handleEmit(arguments);return i.apply(t,arguments)};t.on("error",function(){});if(r.pauseStream){t.pause()}return r};Object.defineProperty(ku.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});ku.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};ku.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};ku.prototype.pause=function(){this.source.pause()};ku.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};ku.prototype.pipe=function(){var t=cTe.prototype.pipe.apply(this,arguments);this.resume();return t};ku.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}if(t[0]==="data"){this.dataSize+=t[1].length;this._checkIfMaxDataSizeExceeded()}this._bufferedEvents.push(t)};ku.prototype._checkIfMaxDataSizeExceeded=function(){if(this._maxDataSizeExceeded){return}if(this.dataSize<=this.maxDataSize){return}this._maxDataSizeExceeded=true;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}});var gTe=_((Phr,mTe)=>{var XIt=require("util");var hTe=require("stream").Stream;var fTe=pTe();mTe.exports=Xn;function Xn(){this.writable=false;this.readable=true;this.dataSize=0;this.maxDataSize=2*1024*1024;this.pauseStreams=true;this._released=false;this._streams=[];this._currentStream=null;this._insideLoop=false;this._pendingNext=false}o(Xn,"CombinedStream");XIt.inherits(Xn,hTe);Xn.create=function(t){var e=new this;t=t||{};for(var r in t){e[r]=t[r]}return e};Xn.isStreamLike=function(t){return typeof t!=="function"&&typeof t!=="string"&&typeof t!=="boolean"&&typeof t!=="number"&&!Buffer.isBuffer(t)};Xn.prototype.append=function(t){var e=Xn.isStreamLike(t);if(e){if(!(t instanceof fTe)){var r=fTe.create(t,{maxDataSize:Infinity,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this));t=r}this._handleErrors(t);if(this.pauseStreams){t.pause()}}this._streams.push(t);return this};Xn.prototype.pipe=function(t,e){hTe.prototype.pipe.call(this,t,e);this.resume();return t};Xn.prototype._getNext=function(){this._currentStream=null;if(this._insideLoop){this._pendingNext=true;return}this._insideLoop=true;try{do{this._pendingNext=false;this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=false}};Xn.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t=="undefined"){this.end();return}if(typeof t!=="function"){this._pipeNext(t);return}var e=t;e(function(r){var n=Xn.isStreamLike(r);if(n){r.on("data",this._checkDataSize.bind(this));this._handleErrors(r)}this._pipeNext(r)}.bind(this))};Xn.prototype._pipeNext=function(t){this._currentStream=t;var e=Xn.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this));t.pipe(this,{end:false});return}var r=t;this.write(r);this._getNext()};Xn.prototype._handleErrors=function(t){var e=this;t.on("error",function(r){e._emitError(r)})};Xn.prototype.write=function(t){this.emit("data",t)};Xn.prototype.pause=function(){if(!this.pauseStreams){return}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function")this._currentStream.pause();this.emit("pause")};Xn.prototype.resume=function(){if(!this._released){this._released=true;this.writable=true;this._getNext()}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function")this._currentStream.resume();this.emit("resume")};Xn.prototype.end=function(){this._reset();this.emit("end")};Xn.prototype.destroy=function(){this._reset();this.emit("close")};Xn.prototype._reset=function(){this.writable=false;this._streams=[];this._currentStream=null};Xn.prototype._checkDataSize=function(){this._updateDataSize();if(this.dataSize<=this.maxDataSize){return}var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))};Xn.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){if(!e.dataSize){return}t.dataSize+=e.dataSize});if(this._currentStream&&this._currentStream.dataSize){this.dataSize+=this._currentStream.dataSize}};Xn.prototype._emitError=function(t){this._reset();this.emit("error",t)}});var vTe=_((khr,yTe)=>{yTe.exports=ZIt;function ZIt(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;if(e){e(t)}else{setTimeout(t,0)}}o(ZIt,"defer")});var UG=_((Lhr,ETe)=>{var _Te=vTe();ETe.exports=ePt;function ePt(t){var e=false;_Te(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{_Te(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(ePt,"async")});var FG=_((jhr,bTe)=>{bTe.exports=tPt;function tPt(t){Object.keys(t.jobs).forEach(rPt.bind(t));t.jobs={}}o(tPt,"abort");function rPt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(rPt,"clean")});var MG=_((Fhr,STe)=>{var wTe=UG();var nPt=FG();STe.exports=iPt;function iPt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=sPt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){nPt(r)}else{r.results[i]=a}n(s,r.results)})}o(iPt,"iterate");function sPt(t,e,r,n){var i;if(t.length==2){i=t(r,wTe(n))}else{i=t(r,e,wTe(n))}return i}o(sPt,"runJob")});var BG=_((Bhr,TTe)=>{TTe.exports=aPt;function aPt(t,e){var r=!Array.isArray(t),n={index:0,keyedList:r||e?Object.keys(t):null,jobs:{},results:r?{}:[],size:r?Object.keys(t).length:t.length};if(e){n.keyedList.sort(r?e:function(i,s){return e(t[i],t[s])})}return n}o(aPt,"state")});var VG=_((Hhr,ATe)=>{var oPt=FG();var uPt=UG();ATe.exports=lPt;function lPt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;oPt(this);uPt(t)(null,this.results)}o(lPt,"terminator")});var CTe=_((Ghr,xTe)=>{var cPt=MG();var dPt=BG();var pPt=VG();xTe.exports=fPt;function fPt(t,e,r){var n=dPt(t);while(n.index<(n["keyedList"]||t).length){cPt(t,e,n,function(i,s){if(i){r(i,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}});n.index++}return pPt.bind(n,r)}o(fPt,"parallel")});var HG=_((Yhr,ix)=>{var RTe=MG();var hPt=BG();var mPt=VG();ix.exports=gPt;ix.exports.ascending=OTe;ix.exports.descending=yPt;function gPt(t,e,r,n){var i=hPt(t,r);RTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){RTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return mPt.bind(i,n)}o(gPt,"serialOrdered");function OTe(t,e){return t<e?-1:t>e?1:0}o(OTe,"ascending");function yPt(t,e){return-1*OTe(t,e)}o(yPt,"descending")});var ITe=_((Jhr,NTe)=>{var vPt=HG();NTe.exports=_Pt;function _Pt(t,e,r){return vPt(t,e,null,r)}o(_Pt,"serial")});var DTe=_((Xhr,PTe)=>{PTe.exports={parallel:CTe(),serial:ITe(),serialOrdered:HG()}});var $Te=_((Zhr,kTe)=>{kTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var jTe=_((emr,qTe)=>{var YG=gTe();var LTe=require("util");var zG=require("path");var EPt=require("http");var bPt=require("https");var wPt=require("url").parse;var SPt=require("fs");var TPt=require("stream").Stream;var GG=RM();var APt=DTe();var KG=$Te();qTe.exports=Fr;LTe.inherits(Fr,YG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];YG.call(this);t=t||{};for(var e in t){this[e]=t[e]}}o(Fr,"FormData");Fr.LINE_BREAK="\r\n";Fr.DEFAULT_CONTENT_TYPE="application/octet-stream";Fr.prototype.append=function(t,e,r){r=r||{};if(typeof r=="string"){r={filename:r}}var n=YG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(LTe.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(t,e,r);var s=this._multiPartFooter();n(i);n(e);n(s);this._trackLength(i,e,r)};Fr.prototype._trackLength=function(t,e,r){var n=0;if(r.knownLength!=null){n+=+r.knownLength}else if(Buffer.isBuffer(e)){n=e.length}else if(typeof e==="string"){n=Buffer.byteLength(e)}this._valueLength+=n;this._overheadLength+=Buffer.byteLength(t)+Fr.LINE_BREAK.length;if(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof TPt)){return}if(!r.knownLength){this._valuesToMeasure.push(e)}};Fr.prototype._lengthRetriever=function(t,e){if(t.hasOwnProperty("fd")){if(t.end!=void 0&&t.end!=Infinity&&t.start!=void 0){e(null,t.end+1-(t.start?t.start:0))}else{SPt.stat(t.path,function(r,n){var i;if(r){e(r);return}i=n.size-(t.start?t.start:0);e(null,i)})}}else if(t.hasOwnProperty("httpVersion")){e(null,+t.headers["content-length"])}else if(t.hasOwnProperty("httpModule")){t.on("response",function(r){t.pause();e(null,+r.headers["content-length"])});t.resume()}else{e("Unknown stream")}};Fr.prototype._multiPartHeader=function(t,e,r){if(typeof r.header=="string"){return r.header}var n=this._getContentDisposition(e,r);var i=this._getContentType(e,r);var s="";var a={"Content-Disposition":["form-data",'name="'+t+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};if(typeof r.header=="object"){KG(a,r.header)}var u;for(var l in a){if(!a.hasOwnProperty(l))continue;u=a[l];if(u==null){continue}if(!Array.isArray(u)){u=[u]}if(u.length){s+=l+": "+u.join("; ")+Fr.LINE_BREAK}}return"--"+this.getBoundary()+Fr.LINE_BREAK+s+Fr.LINE_BREAK};Fr.prototype._getContentDisposition=function(t,e){var r,n;if(typeof e.filepath==="string"){r=zG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=zG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=zG.basename(t.client._httpMessage.path||"")}if(r){n='filename="'+r+'"'}return n};Fr.prototype._getContentType=function(t,e){var r=e.contentType;if(!r&&t.name){r=GG.lookup(t.name)}if(!r&&t.path){r=GG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=GG.lookup(e.filepath||e.filename)}if(!r&&typeof t=="object"){r=Fr.DEFAULT_CONTENT_TYPE}return r};Fr.prototype._multiPartFooter=function(){return function(t){var e=Fr.LINE_BREAK;var r=this._streams.length===0;if(r){e+=this._lastBoundary()}t(e)}.bind(this)};Fr.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Fr.LINE_BREAK};Fr.prototype.getHeaders=function(t){var e;var r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t){if(t.hasOwnProperty(e)){r[e.toLowerCase()]=t[e]}}return r};Fr.prototype.setBoundary=function(t){this._boundary=t};Fr.prototype.getBoundary=function(){if(!this._boundary){this._generateBoundary()}return this._boundary};Fr.prototype.getBuffer=function(){var t=new Buffer.alloc(0);var e=this.getBoundary();for(var r=0,n=this._streams.length;r<n;r++){if(typeof this._streams[r]!=="function"){if(Buffer.isBuffer(this._streams[r])){t=Buffer.concat([t,this._streams[r]])}else{t=Buffer.concat([t,Buffer.from(this._streams[r])])}if(typeof this._streams[r]!=="string"||this._streams[r].substring(2,e.length+2)!==e){t=Buffer.concat([t,Buffer.from(Fr.LINE_BREAK)])}}}return Buffer.concat([t,Buffer.from(this._lastBoundary())])};Fr.prototype._generateBoundary=function(){var t="--------------------------";for(var e=0;e<24;e++){t+=Math.floor(Math.random()*10).toString(16)}this._boundary=t};Fr.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;if(this._streams.length){t+=this._lastBoundary().length}if(!this.hasKnownLength()){this._error(new Error("Cannot calculate proper length in synchronous way."))}return t};Fr.prototype.hasKnownLength=function(){var t=true;if(this._valuesToMeasure.length){t=false}return t};Fr.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length){e+=this._lastBoundary().length}if(!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}APt.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){t(r);return}n.forEach(function(i){e+=i});t(null,e)})};Fr.prototype.submit=function(t,e){var r,n,i={method:"post"};if(typeof t=="string"){t=wPt(t);n=KG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=KG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=bPt.request(n)}else{r=EPt.request(n)}this.getLength(function(s,a){if(s&&s!=="Unknown stream"){this._error(s);return}if(a){r.setHeader("Content-Length",a)}this.pipe(r);if(e){var u;var l=o(function(c,d){r.removeListener("error",l);r.removeListener("response",u);return e.call(this,c,d)},"callback");u=l.bind(this,null);r.on("error",l);r.on("response",u)}}.bind(this));return r};Fr.prototype._error=function(t){if(!this.error){this.error=t;this.pause();this.emit("error",t)}};Fr.prototype.toString=function(){return"[object FormData]"}});var FTe=_(UTe=>{"use strict";var xPt=require("url").parse;var CPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var RPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function OPt(t){var e=typeof t==="string"?xPt(t):t||{};var r=e.protocol;var n=e.host;var i=e.port;if(typeof n!=="string"||!n||typeof r!=="string"){return""}r=r.split(":",1)[0];n=n.replace(/:\d*$/,"");i=parseInt(i)||CPt[r]||0;if(!NPt(n,i)){return""}var s=ky("npm_config_"+r+"_proxy")||ky(r+"_proxy")||ky("npm_config_proxy")||ky("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(OPt,"getProxyForUrl");function NPt(t,e){var r=(ky("npm_config_no_proxy")||ky("no_proxy")).toLowerCase();if(!r){return true}if(r==="*"){return false}return r.split(/[,\s]/).every(function(n){if(!n){return true}var i=n.match(/^(.+):(\d+)$/);var s=i?i[1]:n;var a=i?parseInt(i[2]):0;if(a&&a!==e){return true}if(!/^[.*]/.test(s)){return t!==s}if(s.charAt(0)==="*"){s=s.slice(1)}return!RPt.call(t,s)})}o(NPt,"shouldProxy");function ky(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o(ky,"getEnv");UTe.getProxyForUrl=OPt});var BTe=_((imr,MTe)=>{var Z6;MTe.exports=function(){if(!Z6){try{Z6=Ja()("follow-redirects")}catch(t){}if(typeof Z6!=="function"){Z6=o(function(){},"debug")}}Z6.apply(null,arguments)}});var KTe=_((amr,aK)=>{var rb=require("url");var eb=rb.URL;var IPt=require("http");var PPt=require("https");var ZG=require("stream").Writable;var eK=require("assert");var VTe=BTe();var tK=false;try{eK(new eb)}catch(t){tK=t.code==="ERR_INVALID_URL"}var DPt=["auth","host","hostname","href","path","pathname","port","protocol","query","search"];var rK=["abort","aborted","connect","error","socket","timeout"];var nK=Object.create(null);rK.forEach(function(t){nK[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var JG=nb("ERR_INVALID_URL","Invalid URL",TypeError);var QG=nb("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var kPt=nb("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",QG);var $Pt=nb("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var LPt=nb("ERR_STREAM_WRITE_AFTER_END","write after end");var qPt=ZG.prototype.destroy||zTe;function Ta(t,e){ZG.call(this);this._sanitizeOptions(t);this._options=t;this._ended=false;this._ending=false;this._redirectCount=0;this._redirects=[];this._requestBodyLength=0;this._requestBodyBuffers=[];if(e){this.on("response",e)}var r=this;this._onNativeResponse=function(n){try{r._processResponse(n)}catch(i){r.emit("error",i instanceof QG?i:new QG({cause:i}))}};this._performRequest()}o(Ta,"RedirectableRequest");Ta.prototype=Object.create(ZG.prototype);Ta.prototype.abort=function(){sK(this._currentRequest);this._currentRequest.abort();this.emit("abort")};Ta.prototype.destroy=function(t){sK(this._currentRequest,t);qPt.call(this,t);return this};Ta.prototype.write=function(t,e,r){if(this._ending){throw new LPt}if(!Pm(t)&&!FPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(tb(e)){r=e;e=null}if(t.length===0){if(r){r()}return}if(this._requestBodyLength+t.length<=this._options.maxBodyLength){this._requestBodyLength+=t.length;this._requestBodyBuffers.push({data:t,encoding:e});this._currentRequest.write(t,e,r)}else{this.emit("error",new $Pt);this.abort()}};Ta.prototype.end=function(t,e,r){if(tb(t)){r=t;t=e=null}else if(tb(e)){r=e;e=null}if(!t){this._ended=this._ending=true;this._currentRequest.end(null,null,r)}else{var n=this;var i=this._currentRequest;this.write(t,e,function(){n._ended=true;i.end(null,null,r)});this._ending=true}};Ta.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Ta.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Ta.prototype.setTimeout=function(t,e){var r=this;function n(a){a.setTimeout(t);a.removeListener("timeout",a.destroy);a.addListener("timeout",a.destroy)}o(n,"destroyOnTimeout");function i(a){if(r._timeout){clearTimeout(r._timeout)}r._timeout=setTimeout(function(){r.emit("timeout");s()},t);n(a)}o(i,"startTimer");function s(){if(r._timeout){clearTimeout(r._timeout);r._timeout=null}r.removeListener("abort",s);r.removeListener("error",s);r.removeListener("response",s);r.removeListener("close",s);if(e){r.removeListener("timeout",e)}if(!r.socket){r._currentRequest.removeListener("socket",i)}}o(s,"clearTimer");if(e){this.on("timeout",e)}if(this.socket){i(this.socket)}else{this._currentRequest.once("socket",i)}this.on("socket",n);this.on("abort",s);this.on("error",s);this.on("response",s);this.on("close",s);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ta.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ta.prototype,t,{get:function(){return this._currentRequest[t]}})});Ta.prototype._sanitizeOptions=function(t){if(!t.headers){t.headers={}}if(t.host){if(!t.hostname){t.hostname=t.host}delete t.host}if(!t.pathname&&t.path){var e=t.path.indexOf("?");if(e<0){t.pathname=t.path}else{t.pathname=t.path.substring(0,e);t.search=t.path.substring(e)}}};Ta.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){throw new TypeError("Unsupported protocol "+t)}if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var i of rK){n.on(i,nK[i])}this._currentUrl=/^\//.test(this._options.path)?rb.format(this._options):this._options.path;if(this._isRedirect){var s=0;var a=this;var u=this._requestBodyBuffers;o(function l(c){if(n===a._currentRequest){if(c){a.emit("error",c)}else if(s<u.length){var d=u[s++];if(!n.finished){n.write(d.data,d.encoding,l)}}else if(a._ended){n.end()}}},"writeNext")()}};Ta.prototype._processResponse=function(t){var e=t.statusCode;if(this._options.trackRedirects){this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e})}var r=t.headers.location;if(!r||this._options.followRedirects===false||e<300||e>=400){t.responseUrl=this._currentUrl;t.redirects=this._redirects;this.emit("response",t);this._requestBodyBuffers=[];return}sK(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){throw new kPt}var n;var i=this._options.beforeRedirect;if(i){n=Object.assign({Host:t.req.getHeader("host")},this._options.headers)}var s=this._options.method;if((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method)){this._options.method="GET";this._requestBodyBuffers=[];WG(/^content-/i,this._options.headers)}var a=WG(/^host$/i,this._options.headers);var u=iK(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:rb.format(Object.assign(u,{host:l}));var d=jPt(r,c);VTe("redirecting to",d.href);this._isRedirect=true;XG(d,this._options);if(d.protocol!==u.protocol&&d.protocol!=="https:"||d.host!==l&&!UPt(d.host,l)){WG(/^(?:authorization|cookie)$/i,this._options.headers)}if(tb(i)){var p={headers:t.headers,statusCode:e};var f={url:c,method:s,headers:n};i(this._options,p,f);this._sanitizeOptions(this._options)}this._performRequest()};function HTe(t){var e={maxRedirects:21,maxBodyLength:10*1024*1024};var r={};Object.keys(t).forEach(function(n){var i=n+":";var s=r[i]=t[n];var a=e[n]=Object.create(s);function u(c,d,p){if(MPt(c)){c=XG(c)}else if(Pm(c)){c=XG(iK(c))}else{p=d;d=GTe(c);c={protocol:i}}if(tb(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Pm(d.host)&&!Pm(d.hostname)){d.hostname="::1"}eK.equal(d.protocol,i,"protocol mismatch");VTe("options",d);return new Ta(d,p)}o(u,"request");function l(c,d,p){var f=a.request(c,d,p);f.end();return f}o(l,"get");Object.defineProperties(a,{request:{value:u,configurable:true,enumerable:true,writable:true},get:{value:l,configurable:true,enumerable:true,writable:true}})});return e}o(HTe,"wrap");function zTe(){}o(zTe,"noop");function iK(t){var e;if(tK){e=new eb(t)}else{e=GTe(rb.parse(t));if(!Pm(e.protocol)){throw new JG({input:t})}}return e}o(iK,"parseUrl");function jPt(t,e){return tK?new eb(t,e):iK(rb.resolve(e,t))}o(jPt,"resolveUrl");function GTe(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname)){throw new JG({input:t.href||t})}if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host)){throw new JG({input:t.href||t})}return t}o(GTe,"validateUrl");function XG(t,e){var r=e||{};for(var n of DPt){r[n]=t[n]}if(r.hostname.startsWith("[")){r.hostname=r.hostname.slice(1,-1)}if(r.port!==""){r.port=Number(r.port)}r.path=r.search?r.pathname+r.search:r.pathname;return r}o(XG,"spreadUrlObject");function WG(t,e){var r;for(var n in e){if(t.test(n)){r=e[n];delete e[n]}}return r===null||typeof r==="undefined"?void 0:String(r).trim()}o(WG,"removeMatchingHeaders");function nb(t,e,r){function n(i){Error.captureStackTrace(this,this.constructor);Object.assign(this,i||{});this.code=t;this.message=this.cause?e+": "+this.cause.message:e}o(n,"CustomError");n.prototype=new(r||Error);Object.defineProperties(n.prototype,{constructor:{value:n,enumerable:false},name:{value:"Error ["+t+"]",enumerable:false}});return n}o(nb,"createErrorType");function sK(t,e){for(var r of rK){t.removeListener(r,nK[r])}t.on("error",zTe);t.destroy(e)}o(sK,"destroyRequest");function UPt(t,e){eK(Pm(t)&&Pm(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(UPt,"isSubdomain");function Pm(t){return typeof t==="string"||t instanceof String}o(Pm,"isString");function tb(t){return typeof t==="function"}o(tb,"isFunction");function FPt(t){return typeof t==="object"&&"length"in t}o(FPt,"isBuffer");function MPt(t){return eb&&t instanceof eb}o(MPt,"isURL");aK.exports=HTe({http:IPt,https:PPt});aK.exports.wrap=HTe});var hx=_((umr,L7e)=>{"use strict";var BPt=jTe();var VPt=require("url");var HPt=FTe();var zPt=require("http");var GPt=require("https");var d7e=require("util");var KPt=KTe();var YPt=require("zlib");var p7e=require("stream");var WPt=require("events");function rd(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(rd,"_interopDefaultLegacy");var f7e=rd(BPt);var JPt=rd(VPt);var QPt=rd(zPt);var XPt=rd(GPt);var ZPt=rd(d7e);var eDt=rd(KPt);var mf=rd(YPt);var ff=rd(p7e);var tDt=rd(WPt);function h7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(h7e,"bind");var{toString:rDt}=Object.prototype;var{getPrototypeOf:bK}=Object;var cx=(t=>e=>{const r=rDt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Hl=o(t=>{t=t.toLowerCase();return e=>cx(e)===t},"kindOfTest");var dx=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:jy}=Array;var ab=dx("undefined");function nDt(t){return t!==null&&!ab(t)&&t.constructor!==null&&!ab(t.constructor)&&Vo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(nDt,"isBuffer");var m7e=Hl("ArrayBuffer");function iDt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&m7e(t.buffer)}return e}o(iDt,"isArrayBufferView");var sDt=dx("string");var Vo=dx("function");var g7e=dx("number");var px=o(t=>t!==null&&typeof t==="object","isObject");var aDt=o(t=>t===true||t===false,"isBoolean");var ax=o(t=>{if(cx(t)!=="object"){return false}const e=bK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var oDt=Hl("Date");var uDt=Hl("File");var lDt=Hl("Blob");var cDt=Hl("FileList");var dDt=o(t=>px(t)&&Vo(t.pipe),"isStream");var pDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Vo(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Vo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var fDt=Hl("URLSearchParams");var hDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ub(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(jy(t)){for(n=0,i=t.length;n<i;n++){e.call(null,t[n],n,t)}}else{const s=r?Object.getOwnPropertyNames(t):Object.keys(t);const a=s.length;let u;for(n=0;n<a;n++){u=s[n];e.call(null,t[u],u,t)}}}o(ub,"forEach");function y7e(t,e){e=e.toLowerCase();const r=Object.keys(t);let n=r.length;let i;while(n-- >0){i=r[n];if(e===i.toLowerCase()){return i}}return null}o(y7e,"findKey");var v7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var _7e=o(t=>!ab(t)&&t!==v7e,"isContextDefined");function dK(){const{caseless:t}=_7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&y7e(e,i)||i;if(ax(e[s])&&ax(n)){e[s]=dK(e[s],n)}else if(ax(n)){e[s]=dK({},n)}else if(jy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&ub(arguments[n],r)}return e}o(dK,"merge");var mDt=o((t,e,r,{allOwnKeys:n}={})=>{ub(e,(i,s)=>{if(r&&Vo(i)){t[s]=h7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var gDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var yDt=o((t,e,r,n)=>{t.prototype=Object.create(e.prototype,n);t.prototype.constructor=t;Object.defineProperty(t,"super",{value:e.prototype});r&&Object.assign(t.prototype,r)},"inherits");var vDt=o((t,e,r,n)=>{let i;let s;let a;const u={};e=e||{};if(t==null)return e;do{i=Object.getOwnPropertyNames(t);s=i.length;while(s-- >0){a=i[s];if((!n||n(a,t,e))&&!u[a]){e[a]=t[a];u[a]=true}}t=r!==false&&bK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var _Dt=o((t,e,r)=>{t=String(t);if(r===void 0||r>t.length){r=t.length}r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},"endsWith");var EDt=o(t=>{if(!t)return null;if(jy(t))return t;let e=t.length;if(!g7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var bDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&bK(Uint8Array));var wDt=o((t,e)=>{const r=t&&t[Symbol.iterator];const n=r.call(t);let i;while((i=n.next())&&!i.done){const s=i.value;e.call(t,s[0],s[1])}},"forEachEntry");var SDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var TDt=Hl("HTMLFormElement");var ADt=o(t=>{return t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function e(r,n,i){return n.toUpperCase()+i},"replacer"))},"toCamelCase");var YTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var xDt=Hl("RegExp");var E7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};ub(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var CDt=o(t=>{E7e(t,(e,r)=>{if(Vo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Vo(n))return;e.enumerable=false;if("writable"in e){e.writable=false;return}if(!e.set){e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}}})},"freezeMethods");var RDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");jy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var ODt=o(()=>{},"noop");var NDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var oK="abcdefghijklmnopqrstuvwxyz";var WTe="0123456789";var b7e={DIGIT:WTe,ALPHA:oK,ALPHA_DIGIT:oK+oK.toUpperCase()+WTe};var IDt=o((t=16,e=b7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function PDt(t){return!!(t&&Vo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(PDt,"isSpecCompliantForm");var DDt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(px(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=jy(n)?[]:{};ub(n,(a,u)=>{const l=r(a,i+1);!ab(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var kDt=Hl("AsyncFunction");var $Dt=o(t=>t&&(px(t)||Vo(t))&&Vo(t.then)&&Vo(t.catch),"isThenable");var fe={isArray:jy,isArrayBuffer:m7e,isBuffer:nDt,isFormData:pDt,isArrayBufferView:iDt,isString:sDt,isNumber:g7e,isBoolean:aDt,isObject:px,isPlainObject:ax,isUndefined:ab,isDate:oDt,isFile:uDt,isBlob:lDt,isRegExp:xDt,isFunction:Vo,isStream:dDt,isURLSearchParams:fDt,isTypedArray:bDt,isFileList:cDt,forEach:ub,merge:dK,extend:mDt,trim:hDt,stripBOM:gDt,inherits:yDt,toFlatObject:vDt,kindOf:cx,kindOfTest:Hl,endsWith:_Dt,toArray:EDt,forEachEntry:wDt,matchAll:SDt,isHTMLForm:TDt,hasOwnProperty:YTe,hasOwnProp:YTe,reduceDescriptors:E7e,freezeMethods:CDt,toObjectSet:RDt,toCamelCase:ADt,noop:ODt,toFiniteNumber:NDt,findKey:y7e,global:v7e,isContextDefined:_7e,ALPHABET:b7e,generateString:IDt,isSpecCompliantForm:PDt,toJSONObject:DDt,isAsyncFn:kDt,isThenable:$Dt};function nt(t,e,r,n,i){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=new Error().stack}this.message=t;this.name="AxiosError";e&&(this.code=e);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}o(nt,"AxiosError");fe.inherits(nt,Error,{toJSON:o(function t(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}},"toJSON")});var w7e=nt.prototype;var S7e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{S7e[t]={value:t}});Object.defineProperties(nt,S7e);Object.defineProperty(w7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(w7e);fe.toFlatObject(t,a,o(function u(l){return l!==Error.prototype},"filter"),u=>{return u!=="isAxiosError"});nt.call(a,t.message,e,r,n,i);a.cause=t;a.name=t.name;s&&Object.assign(a,s);return a};function pK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(pK,"isVisitable");function T7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(T7e,"removeBrackets");function JTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=T7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(JTe,"renderKey");function LDt(t){return fe.isArray(t)&&!t.some(pK)}o(LDt,"isFlatArray");var qDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function fx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(f7e["default"]||FormData);r=fe.toFlatObject(r,{metaTokens:true,dots:false,indexes:false},false,o(function m(g,y){return!fe.isUndefined(y[g])},"defined"));const n=r.metaTokens;const i=r.visitor||d;const s=r.dots;const a=r.indexes;const u=r.Blob||typeof Blob!=="undefined"&&Blob;const l=u&&fe.isSpecCompliantForm(e);if(!fe.isFunction(i)){throw new TypeError("visitor must be a function")}function c(m){if(m===null)return"";if(fe.isDate(m)){return m.toISOString()}if(!l&&fe.isBlob(m)){throw new nt("Blob is not supported. Use a Buffer instead.")}if(fe.isArrayBuffer(m)||fe.isTypedArray(m)){return l&&typeof Blob==="function"?new Blob([m]):Buffer.from(m)}return m}o(c,"convertValue");function d(m,g,y){let v=m;if(m&&!y&&typeof m==="object"){if(fe.endsWith(g,"{}")){g=n?g:g.slice(0,-2);m=JSON.stringify(m)}else if(fe.isArray(m)&&LDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=T7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?JTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(pK(m)){return true}e.append(JTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(qDt,{defaultVisitor:d,convertValue:c,isVisitable:pK});function h(m,g){if(fe.isUndefined(m))return;if(p.indexOf(m)!==-1){throw Error("Circular reference detected in "+g.join("."))}p.push(m);fe.forEach(m,o(function y(v,w){const E=!(fe.isUndefined(v)||v===null)&&i.call(e,v,fe.isString(w)?w.trim():w,g,f);if(E===true){h(v,g?g.concat(w):[w])}},"each"));p.pop()}o(h,"build");if(!fe.isObject(t)){throw new TypeError("data must be an object")}h(t);return e}o(fx,"toFormData");function QTe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,o(function r(n){return e[n]},"replacer"))}o(QTe,"encode$1");function A7e(t,e){this._pairs=[];t&&fx(t,this,e)}o(A7e,"AxiosURLSearchParams");var x7e=A7e.prototype;x7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");x7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,QTe)}:QTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function jDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(jDt,"encode");function wK(t,e,r){if(!e){return t}const n=r&&r.encode||jDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new A7e(e,r).toString(n)}if(s){const a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+s}return t}o(wK,"buildURL");var fK=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,r,n){this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(e){fe.forEach(this.handlers,o(function r(n){if(n!==null){e(n)}},"forEachHandler"))}};var XTe=fK;var SK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var UDt=JPt["default"].URLSearchParams;var FDt={isNode:true,classes:{URLSearchParams:UDt,FormData:f7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var C7e=typeof window!=="undefined"&&typeof document!=="undefined";var MDt=(t=>{return C7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var BDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var VDt=Object.freeze({__proto__:null,hasBrowserEnv:C7e,hasStandardBrowserWebWorkerEnv:BDt,hasStandardBrowserEnv:MDt});var Bo={...VDt,...FDt};function HDt(t,e){return fx(t,new Bo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Bo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(HDt,"toURLEncodedForm");function zDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(zDt,"parsePropPath");function GDt(t){const e={};const r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++){s=r[n];e[s]=t[s]}return e}o(GDt,"arrayToObject");function R7e(t){function e(r,n,i,s){let a=r[s++];const u=Number.isFinite(+a);const l=s>=r.length;a=!a&&fe.isArray(i)?i.length:a;if(l){if(fe.hasOwnProp(i,a)){i[a]=[i[a],n]}else{i[a]=n}return!u}if(!i[a]||!fe.isObject(i[a])){i[a]=[]}const c=e(r,n,i[a],s);if(c&&fe.isArray(i[a])){i[a]=GDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(zDt(n),i,r,0)});return r}return null}o(R7e,"formDataToJSON");function KDt(t,e,r){if(fe.isString(t)){try{(e||JSON.parse)(t);return fe.trim(t)}catch(n){if(n.name!=="SyntaxError"){throw n}}}return(r||JSON.stringify)(t)}o(KDt,"stringifySafely");var TK={transitional:SK,adapter:["xhr","http"],transformRequest:[o(function t(e,r){const n=r.getContentType()||"";const i=n.indexOf("application/json")>-1;const s=fe.isObject(e);if(s&&fe.isHTMLForm(e)){e=new FormData(e)}const a=fe.isFormData(e);if(a){if(!i){return e}return i?JSON.stringify(R7e(e)):e}if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)){return e}if(fe.isArrayBufferView(e)){return e.buffer}if(fe.isURLSearchParams(e)){r.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1){return HDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return fx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return KDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||TK.transitional;const n=r&&r.forcedJSONParsing;const i=this.responseType==="json";if(e&&fe.isString(e)&&(n&&!this.responseType||i)){const s=r&&r.silentJSONParsing;const a=!s&&i;try{return JSON.parse(e)}catch(u){if(a){if(u.name==="SyntaxError"){throw nt.from(u,nt.ERR_BAD_RESPONSE,this,null,this.response)}throw u}}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bo.classes.FormData,Blob:Bo.classes.Blob},validateStatus:o(function t(e){return e>=200&&e<300},"validateStatus"),headers:{common:{"Accept":"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{TK.headers[t]={}});var AK=TK;var YDt=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var WDt=o(t=>{const e={};let r;let n;let i;t&&t.split("\n").forEach(o(function s(a){i=a.indexOf(":");r=a.substring(0,i).trim().toLowerCase();n=a.substring(i+1).trim();if(!r||e[r]&&YDt[r]){return}if(r==="set-cookie"){if(e[r]){e[r].push(n)}else{e[r]=[n]}}else{e[r]=e[r]?e[r]+", "+n:n}},"parser"));return e},"parseHeaders");var ZTe=Symbol("internals");function ib(t){return t&&String(t).trim().toLowerCase()}o(ib,"normalizeHeader");function ox(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(ox):String(t)}o(ox,"normalizeValue");function JDt(t){const e=Object.create(null);const r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;while(n=r.exec(t)){e[n[1]]=n[2]}return e}o(JDt,"parseTokens");var QDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function uK(t,e,r,n,i){if(fe.isFunction(n)){return n.call(this,e,r)}if(i){e=r}if(!fe.isString(e))return;if(fe.isString(n)){return e.indexOf(n)!==-1}if(fe.isRegExp(n)){return n.test(e)}}o(uK,"matchHeaderValue");function XDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(XDt,"formatHeader");function ZDt(t,e){const r=fe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:true})})}o(ZDt,"buildAccessors");var $y=class{static{o(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(u,l,c){const d=ib(l);if(!d){throw new Error("header name must be a non-empty string")}const p=fe.findKey(i,d);if(!p||i[p]===void 0||c===true||c===void 0&&i[p]!==false){i[p||l]=ox(u)}}o(s,"setHeader");const a=o((u,l)=>fe.forEach(u,(c,d)=>s(c,d,l)),"setHeaders");if(fe.isPlainObject(e)||e instanceof this.constructor){a(e,r)}else if(fe.isString(e)&&(e=e.trim())&&!QDt(e)){a(WDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=ib(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return JDt(i)}if(fe.isFunction(r)){return r.call(this,i,n)}if(fe.isRegExp(r)){return r.exec(i)}throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){e=ib(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||uK(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=ib(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||uK(n,n[u],u,r))){delete n[u];i=true}}}o(s,"deleteHeader");if(fe.isArray(e)){e.forEach(s)}else{s(e)}return i}clear(e){const r=Object.keys(this);let n=r.length;let i=false;while(n--){const s=r[n];if(!e||uK(this,this[s],s,e,true)){delete this[s];i=true}}return i}normalize(e){const r=this;const n={};fe.forEach(this,(i,s)=>{const a=fe.findKey(n,s);if(a){r[a]=ox(i);delete r[s];return}const u=e?XDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=ox(i);n[u]=true});return this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);fe.forEach(this,(n,i)=>{n!=null&&n!==false&&(r[i]=e&&fe.isArray(n)?n.join(", "):n)});return r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);r.forEach(i=>n.set(i));return n}static accessor(e){const r=this[ZTe]=this[ZTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=ib(a);if(!n[u]){ZDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};$y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors($y.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods($y);var Ho=$y;function lK(t,e){const r=this||AK;const n=e||r;const i=Ho.from(n.headers);let s=n.data;fe.forEach(t,o(function a(u){s=u.call(r,s,i.normalize(),e?e.status:void 0)},"transform"));i.normalize();return s}o(lK,"transformData");function O7e(t){return!!(t&&t.__CANCEL__)}o(O7e,"isCancel");function Dm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Dm,"CanceledError");fe.inherits(Dm,nt,{__CANCEL__:true});function sb(t,e,r){const n=r.config.validateStatus;if(!r.status||!n||n(r.status)){t(r)}else{e(new nt("Request failed with status code "+r.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}}o(sb,"settle");function ekt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(ekt,"isAbsoluteURL");function tkt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(tkt,"combineURLs");function xK(t,e){if(t&&!ekt(e)){return tkt(t,e)}return e}o(xK,"buildFullPath");var lx="1.6.2";function N7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(N7e,"parseProtocol");var rkt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function nkt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=N7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=rkt.exec(t);if(!s){throw new nt("Invalid URL",nt.ERR_INVALID_URL)}const a=s[1];const u=s[2];const l=s[3];const c=Buffer.from(decodeURIComponent(l),u?"base64":"utf8");if(e){if(!n){throw new nt("Blob is not supported",nt.ERR_NOT_SUPPORT)}return new n([c],{type:a})}return c}throw new nt("Unsupported protocol "+i,nt.ERR_NOT_SUPPORT)}o(nkt,"fromDataURI");function ikt(t,e){let r=0;const n=1e3/e;let i=null;return o(function s(a,u){const l=Date.now();if(a||l-r>n){if(i){clearTimeout(i);i=null}r=l;return t.apply(null,u)}if(!i){i=setTimeout(()=>{i=null;r=Date.now();return t.apply(null,u)},n-(l-r))}},"throttled")}o(ikt,"throttle");function I7e(t,e){t=t||10;const r=new Array(t);const n=new Array(t);let i=0;let s=0;let a;e=e!==void 0?e:1e3;return o(function u(l){const c=Date.now();const d=n[s];if(!a){a=c}r[i]=l;n[i]=c;let p=s;let f=0;while(p!==i){f+=r[p++];p=p%t}i=(i+1)%t;if(i===s){s=(s+1)%t}if(c-a<e){return}const h=d&&c-d;return h?Math.round(f*1e3/h):void 0},"push")}o(I7e,"speedometer");var sx=Symbol("internals");var hK=class extends ff["default"].Transform{static{o(this,"AxiosTransformStream")}constructor(e){e=fe.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(u,l)=>{return!fe.isUndefined(l[u])});super({readableHighWaterMark:e.chunkSize});const r=this;const n=this[sx]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:false,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};const i=I7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=ikt(o(function u(){const l=n.length;const c=n.bytesSeen;const d=c-s;if(!d||r.destroyed)return;const p=i(d);s=c;process.nextTick(()=>{r.emit("progress",{"loaded":c,"total":l,"progress":l?c/l:void 0,"bytes":d,"rate":p?p:void 0,"estimated":p&&l&&c<=l?(l-c)/p:void 0})})},"throttledHandler"),n.ticksRate);const a=o(()=>{n.updateProgress(true)},"onFinish");this.once("end",a);this.once("error",a)}_read(e){const r=this[sx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[sx];const a=s.maxRate;const u=this.readableHighWaterMark;const l=s.timeWindow;const c=1e3/l;const d=a/c;const p=s.minChunkSize!==false?Math.max(s.minChunkSize,d*.01):0;function f(m,g){const y=Buffer.byteLength(m);s.bytesSeen+=y;s.bytes+=y;if(s.isCaptured){s.updateProgress()}if(i.push(m)){process.nextTick(g)}else{s.onReadCallback=()=>{s.onReadCallback=null;process.nextTick(g)}}}o(f,"pushChunk");const h=o((m,g)=>{const y=Buffer.byteLength(m);let v=null;let w=u;let E;let b=0;if(a){const S=Date.now();if(!s.ts||(b=S-s.ts)>=l){s.ts=S;E=d-s.bytes;s.bytes=E<0?-E:0;b=0}E=d-s.bytes}if(a){if(E<=0){return setTimeout(()=>{g(null,m)},l-b)}if(E<w){w=E}}if(w&&y>w&&y-w>p){v=m.subarray(w);m=m.subarray(0,w)}f(m,v?()=>{process.nextTick(g,null,v)}:g)},"transformChunk");h(e,o(function m(g,y){if(g){return n(g)}if(y){h(y,m)}else{n(null)}},"transformNextChunk"))}setLength(e){this[sx].length=+e;return this}};var e7e=hK;var{asyncIterator:t7e}=Symbol;var skt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[t7e]){yield*t[t7e]()}else{yield t}},"readBlob");var P7e=skt;var akt=fe.ALPHABET.ALPHA_DIGIT+"-_";var ob=new d7e.TextEncoder;var hf="\r\n";var okt=ob.encode(hf);var ukt=2;var mK=class{static{o(this,"FormDataPart")}constructor(e,r){const{escapeName:n}=this.constructor;const i=fe.isString(r);let s=`Content-Disposition: form-data; name="${n(e)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${hf}`;if(i){r=ob.encode(String(r).replace(/\r?\n|\r\n?/g,hf))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${hf}`}this.headers=ob.encode(s+hf);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+ukt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*P7e(e)}yield okt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var lkt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,akt)}=r||{};if(!fe.isFormData(t)){throw TypeError("FormData instance required")}if(s.length<1||s.length>70){throw Error("boundary must be 10-70 characters long")}const a=ob.encode("--"+s+hf);const u=ob.encode("--"+s+"--"+hf+hf);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new mK(p,f);l+=h.size;return h});l+=a.byteLength*c.length;l=fe.toFiniteNumber(l);const d={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(l)){d["Content-Length"]=l}e&&e(d);return p7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var ckt=lkt;var gK=class extends ff["default"].Transform{static{o(this,"ZlibHeaderTransformStream")}__transform(e,r,n){this.push(e);n()}_transform(e,r,n){if(e.length!==0){this._transform=this.__transform;if(e[0]!==120){const i=Buffer.alloc(2);i[0]=120;i[1]=156;this.push(i,r)}}this.__transform(e,r,n)}};var dkt=gK;var pkt=o((t,e)=>{return fe.isAsyncFn(t)?function(...r){const n=r.pop();t.apply(this,r).then(i=>{try{e?n(null,...e(i)):n(null,i)}catch(s){n(s)}},n)}:t},"callbackify");var fkt=pkt;var r7e={flush:mf["default"].constants.Z_SYNC_FLUSH,finishFlush:mf["default"].constants.Z_SYNC_FLUSH};var hkt={flush:mf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:mf["default"].constants.BROTLI_OPERATION_FLUSH};var n7e=fe.isFunction(mf["default"].createBrotliDecompress);var{http:mkt,https:gkt}=eDt["default"];var ykt=/https:?/;var i7e=Bo.protocols.map(t=>{return t+":"});function vkt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(vkt,"dispatchBeforeRedirect");function D7e(t,e,r){let n=e;if(!n&&n!==false){const i=HPt.getProxyForUrl(r);if(i){n=new URL(i)}}if(n){if(n.username){n.auth=(n.username||"")+":"+(n.password||"")}if(n.auth){if(n.auth.username||n.auth.password){n.auth=(n.auth.username||"")+":"+(n.auth.password||"")}const s=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+s}t.headers.host=t.hostname+(t.port?":"+t.port:"");const i=n.hostname||n.host;t.hostname=i;t.host=i;t.port=n.port;t.path=r;if(n.protocol){t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`}}t.beforeRedirects.proxy=o(function i(s){D7e(s,e,s.href)},"beforeRedirect")}o(D7e,"setProxy");var _kt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var Ekt=o(t=>{return new Promise((e,r)=>{let n;let i;const s=o((l,c)=>{if(i)return;i=true;n&&n(l,c)},"done");const a=o(l=>{s(l);e(l)},"_resolve");const u=o(l=>{s(l,true);r(l)},"_reject");t(a,u,l=>n=l).catch(u)})},"wrapAsync");var bkt=o(({address:t,family:e})=>{if(!fe.isString(t)){throw TypeError("address must be a string")}return{address:t,family:e||(t.indexOf(".")<0?6:4)}},"resolveFamily");var s7e=o((t,e)=>bkt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var wkt=_kt&&o(function t(e){return Ekt(o(async function r(n,i,s){let{data:a,lookup:u,family:l}=e;const{responseType:c,responseEncoding:d}=e;const p=e.method.toUpperCase();let f;let h=false;let m;if(u){const ue=fkt(u,xe=>fe.isArray(xe)?xe:[xe]);u=o((xe,we,Pe)=>{ue(xe,we,(Ue,$e,ge)=>{const Je=fe.isArray($e)?$e.map(Le=>s7e(Le)):[s7e($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new tDt["default"];const y=o(()=>{if(e.cancelToken){e.cancelToken.unsubscribe(v)}if(e.signal){e.signal.removeEventListener("abort",v)}g.removeAllListeners()},"onFinished");s((ue,xe)=>{f=true;if(xe){h=true;y()}});function v(ue){g.emit("abort",!ue||ue.type?new Dm(null,e,m):ue)}o(v,"abort");g.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(v);if(e.signal){e.signal.aborted?v():e.signal.addEventListener("abort",v)}}const w=xK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||i7e[0];if(b==="data:"){let ue;if(p!=="GET"){return sb(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=nkt(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(xe){throw nt.from(xe,nt.ERR_BAD_REQUEST,e)}if(c==="text"){ue=ue.toString(d);if(!d||d==="utf8"){ue=fe.stripBOM(ue)}}else if(c==="stream"){ue=ff["default"].Readable.from(ue)}return sb(n,i,{data:ue,status:200,statusText:"OK",headers:new Ho,config:e})}if(i7e.indexOf(b)===-1){return i(new nt("Unsupported protocol "+b,nt.ERR_BAD_REQUEST,e))}const S=Ho.from(e.headers).normalize();S.set("User-Agent","axios/"+lx,false);const T=e.onDownloadProgress;const A=e.onUploadProgress;const R=e.maxRate;let O=void 0;let j=void 0;if(fe.isSpecCompliantForm(a)){const ue=S.getContentType(/boundary=([-_\w\d]{10,70})/i);a=ckt(a,xe=>{S.set(xe)},{tag:`axios-${lx}-boundary`,boundary:ue&&ue[1]||void 0})}else if(fe.isFormData(a)&&fe.isFunction(a.getHeaders)){S.set(a.getHeaders());if(!S.hasContentLength()){try{const ue=await ZPt["default"].promisify(a.getLength).call(a);Number.isFinite(ue)&&ue>=0&&S.setContentLength(ue)}catch(ue){}}}else if(fe.isBlob(a)){a.size&&S.setContentType(a.type||"application/octet-stream");S.setContentLength(a.size||0);a=ff["default"].Readable.from(P7e(a))}else if(a&&!fe.isStream(a)){if(Buffer.isBuffer(a));else if(fe.isArrayBuffer(a)){a=Buffer.from(new Uint8Array(a))}else if(fe.isString(a)){a=Buffer.from(a,"utf-8")}else{return i(new nt("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",nt.ERR_BAD_REQUEST,e))}S.setContentLength(a.length,false);if(e.maxBodyLength>-1&&a.length>e.maxBodyLength){return i(new nt("Request body larger than maxBodyLength limit",nt.ERR_BAD_REQUEST,e))}}const B=fe.toFiniteNumber(S.getContentLength());if(fe.isArray(R)){O=R[0];j=R[1]}else{O=j=R}if(a&&(A||O)){if(!fe.isStream(a)){a=ff["default"].Readable.from(a,{objectMode:false})}a=ff["default"].pipeline([a,new e7e({length:B,maxRate:fe.toFiniteNumber(O)})],fe.noop);A&&a.on("progress",ue=>{A(Object.assign(ue,{upload:true}))})}let U=void 0;if(e.auth){const ue=e.auth.username||"";const xe=e.auth.password||"";U=ue+":"+xe}if(!U&&E.username){const ue=E.username;const xe=E.password;U=ue+":"+xe}U&&S.delete("authorization");let Q;try{Q=wK(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ue){const xe=new Error(ue.message);xe.config=e;xe.url=e.url;xe.exists=true;return i(xe)}S.set("Accept-Encoding","gzip, compress, deflate"+(n7e?", br":""),false);const oe={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:U,protocol:b,family:l,beforeRedirect:vkt,beforeRedirects:{}};!fe.isUndefined(u)&&(oe.lookup=u);if(e.socketPath){oe.socketPath=e.socketPath}else{oe.hostname=E.hostname;oe.port=E.port;D7e(oe,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+oe.path)}let Te;const le=ykt.test(oe.protocol);oe.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?XPt["default"]:QPt["default"]}else{if(e.maxRedirects){oe.maxRedirects=e.maxRedirects}if(e.beforeRedirect){oe.beforeRedirects.config=e.beforeRedirect}Te=le?gkt:mkt}if(e.maxBodyLength>-1){oe.maxBodyLength=e.maxBodyLength}else{oe.maxBodyLength=Infinity}if(e.insecureHTTPParser){oe.insecureHTTPParser=e.insecureHTTPParser}m=Te.request(oe,o(function ue(xe){if(m.destroyed)return;const we=[xe];const Pe=+xe.headers["content-length"];if(T){const Le=new e7e({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(j)});T&&Le.on("progress",Ie=>{T(Object.assign(Ie,{download:true}))});we.push(Le)}let Ue=xe;const $e=xe.req||m;if(e.decompress!==false&&xe.headers["content-encoding"]){if(p==="HEAD"||xe.statusCode===204){delete xe.headers["content-encoding"]}switch((xe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":we.push(mf["default"].createUnzip(r7e));delete xe.headers["content-encoding"];break;case"deflate":we.push(new dkt);we.push(mf["default"].createUnzip(r7e));delete xe.headers["content-encoding"];break;case"br":if(n7e){we.push(mf["default"].createBrotliDecompress(hkt));delete xe.headers["content-encoding"]}}}Ue=we.length>1?ff["default"].pipeline(we,fe.noop):we[0];const ge=ff["default"].finished(Ue,()=>{ge();y()});const Je={status:xe.statusCode,statusText:xe.statusMessage,headers:new Ho(xe.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;sb(n,i,Je)}else{const Le=[];let Ie=0;Ue.on("data",o(function Qe(qe){Le.push(qe);Ie+=qe.length;if(e.maxContentLength>-1&&Ie>e.maxContentLength){h=true;Ue.destroy();i(new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e))}},"handleStreamData"));Ue.on("aborted",o(function Qe(){if(h){return}const qe=new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e);Ue.destroy(qe);i(qe)},"handlerStreamAborted"));Ue.on("error",o(function Qe(qe){if(m.destroyed)return;i(nt.from(qe,null,e,$e))},"handleStreamError"));Ue.on("end",o(function Qe(){try{let qe=Le.length===1?Le[0]:Buffer.concat(Le);if(c!=="arraybuffer"){qe=qe.toString(d);if(!d||d==="utf8"){qe=fe.stripBOM(qe)}}Je.data=qe}catch(qe){return i(nt.from(qe,null,e,Je.request,Je))}sb(n,i,Je)},"handleStreamEnd"))}g.once("abort",Le=>{if(!Ue.destroyed){Ue.emit("error",Le);Ue.destroy()}})},"handleResponse"));g.once("abort",ue=>{i(ue);m.destroy(ue)});m.on("error",o(function ue(xe){i(nt.from(xe,null,e,m))},"handleRequestError"));m.on("socket",o(function ue(xe){xe.setKeepAlive(true,1e3*60)},"handleRequestSocket"));if(e.timeout){const ue=parseInt(e.timeout,10);if(Number.isNaN(ue)){i(new nt("error trying to parse `config.timeout` to int",nt.ERR_BAD_OPTION_VALUE,e,m));return}m.setTimeout(ue,o(function xe(){if(f)return;let we=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const Pe=e.transitional||SK;if(e.timeoutErrorMessage){we=e.timeoutErrorMessage}i(new nt(we,Pe.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,m));v()},"handleRequestTimeout"))}if(fe.isStream(a)){let ue=false;let xe=false;a.on("end",()=>{ue=true});a.once("error",we=>{xe=true;m.destroy(we)});a.on("close",()=>{if(!ue&&!xe){v(new Dm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var Skt=Bo.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];fe.isNumber(r)&&a.push("expires="+new Date(r).toGMTString());fe.isString(n)&&a.push("path="+n);fe.isString(i)&&a.push("domain="+i);s===true&&a.push("secure");document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Tkt=Bo.hasStandardBrowserEnv?o(function t(){const e=/(msie|trident)/i.test(navigator.userAgent);const r=document.createElement("a");let n;function i(s){let a=s;if(e){r.setAttribute("href",a);a=r.href}r.setAttribute("href",a);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}o(i,"resolveURL");n=i(window.location.href);return o(function s(a){const u=fe.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():o(function t(){return o(function e(){return true},"isURLSameOrigin")},"nonStandardBrowserEnv")();function a7e(t,e){let r=0;const n=I7e(50,250);return i=>{const s=i.loaded;const a=i.lengthComputable?i.total:void 0;const u=s-r;const l=n(u);const c=s<=a;r=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:u,rate:l?l:void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:i};d[e?"download":"upload"]=true;t(d)}}o(a7e,"progressEventReducer");var Akt=typeof XMLHttpRequest!=="undefined";var xkt=Akt&&function(t){return new Promise(o(function e(r,n){let i=t.data;const s=Ho.from(t.headers).normalize();let{responseType:a,withXSRFToken:u}=t;let l;function c(){if(t.cancelToken){t.cancelToken.unsubscribe(l)}if(t.signal){t.signal.removeEventListener("abort",l)}}o(c,"done");let d;if(fe.isFormData(i)){if(Bo.hasStandardBrowserEnv||Bo.hasStandardBrowserWebWorkerEnv){s.setContentType(false)}else if((d=s.getContentType())!==false){const[g,...y]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"";const y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=xK(t.baseURL,t.url);p.open(t.method.toUpperCase(),wK(f,t.params,t.paramsSerializer),true);p.timeout=t.timeout;function h(){if(!p){return}const g=Ho.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());const y=!a||a==="text"||a==="json"?p.responseText:p.response;const v={data:y,status:p.status,statusText:p.statusText,headers:g,config:t,request:p};sb(o(function w(E){r(E);c()},"_resolve"),o(function w(E){n(E);c()},"_reject"),v);p=null}o(h,"onloadend");if("onloadend"in p){p.onloadend=h}else{p.onreadystatechange=o(function g(){if(!p||p.readyState!==4){return}if(p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)){return}setTimeout(h)},"handleLoad")}p.onabort=o(function g(){if(!p){return}n(new nt("Request aborted",nt.ECONNABORTED,t,p));p=null},"handleAbort");p.onerror=o(function g(){n(new nt("Network Error",nt.ERR_NETWORK,t,p));p=null},"handleError");p.ontimeout=o(function g(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const v=t.transitional||SK;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Bo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&Tkt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&Skt.read(t.xsrfCookieName);if(g){s.set(t.xsrfHeaderName,g)}}}i===void 0&&s.setContentType(null);if("setRequestHeader"in p){fe.forEach(s.toJSON(),o(function g(y,v){p.setRequestHeader(v,y)},"setRequestHeader"))}if(!fe.isUndefined(t.withCredentials)){p.withCredentials=!!t.withCredentials}if(a&&a!=="json"){p.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){p.addEventListener("progress",a7e(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",a7e(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Dm(null,t,p):g);p.abort();p=null},"onCanceled");t.cancelToken&&t.cancelToken.subscribe(l);if(t.signal){t.signal.aborted?l():t.signal.addEventListener("abort",l)}}const m=N7e(f);if(m&&Bo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var yK={http:wkt,xhr:xkt};fe.forEach(yK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var o7e=o(t=>`- ${t}`,"renderReason");var Ckt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var k7e={getAdapter:t=>{t=fe.isArray(t)?t:[t];const{length:e}=t;let r;let n;const i={};for(let s=0;s<e;s++){r=t[s];let a;n=r;if(!Ckt(r)){n=yK[(a=String(r)).toLowerCase()];if(n===void 0){throw new nt(`Unknown adapter '${a}'`)}}if(n){break}i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(([u,l])=>`adapter ${u} `+(l===false?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?"since :\n"+s.map(o7e).join("\n"):" "+o7e(s[0]):"as no adapter specified";throw new nt(`There is no suitable adapter to dispatch the request `+a,"ERR_NOT_SUPPORT")}return n},adapters:yK};function cK(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Dm(null,t)}}o(cK,"throwIfCancellationRequested");function u7e(t){cK(t);t.headers=Ho.from(t.headers);t.data=lK.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=k7e.getAdapter(t.adapter||AK.adapter);return e(t).then(o(function r(n){cK(t);n.data=lK.call(t,t.transformResponse,n);n.headers=Ho.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!O7e(n)){cK(t);if(n&&n.response){n.response.data=lK.call(t,t.transformResponse,n.response);n.response.headers=Ho.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(u7e,"dispatchRequest");var l7e=o(t=>t instanceof Ho?t.toJSON():t,"headersToObject");function Ly(t,e){e=e||{};const r={};function n(c,d,p){if(fe.isPlainObject(c)&&fe.isPlainObject(d)){return fe.merge.call({caseless:p},c,d)}else if(fe.isPlainObject(d)){return fe.merge({},d)}else if(fe.isArray(d)){return d.slice()}return d}o(n,"getMergedValue");function i(c,d,p){if(!fe.isUndefined(d)){return n(c,d,p)}else if(!fe.isUndefined(c)){return n(void 0,c,p)}}o(i,"mergeDeepProperties");function s(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}}o(s,"valueFromConfig2");function a(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}else if(!fe.isUndefined(c)){return n(void 0,c)}}o(a,"defaultToConfig2");function u(c,d,p){if(p in e){return n(c,d)}else if(p in t){return n(void 0,c)}}o(u,"mergeDirectKeys");const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u,headers:(c,d)=>i(l7e(c),l7e(d),true)};fe.forEach(Object.keys(Object.assign({},t,e)),o(function c(d){const p=l[d]||i;const f=p(t[d],e[d],d);fe.isUndefined(f)&&p!==u||(r[d]=f)},"computeConfigValue"));return r}o(Ly,"mergeConfig");var CK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{CK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var c7e={};CK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+lx+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}o(i,"formatMessage");return(s,a,u)=>{if(e===false){throw new nt(i(a," has been removed"+(r?" in "+r:"")),nt.ERR_DEPRECATED)}if(r&&!c7e[a]){c7e[a]=true;console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))}return e?e(s,a,u):true}},"transitional");function Rkt(t,e,r){if(typeof t!=="object"){throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE)}const n=Object.keys(t);let i=n.length;while(i-- >0){const s=n[i];const a=e[s];if(a){const u=t[s];const l=u===void 0||a(u,s,t);if(l!==true){throw new nt("option "+s+" must be "+l,nt.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new nt("Unknown option "+s,nt.ERR_BAD_OPTION)}}}o(Rkt,"assertOptions");var vK={assertOptions:Rkt,validators:CK};var pf=vK.validators;var qy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new XTe,response:new XTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=Ly(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){vK.assertOptions(n,{silentJSONParsing:pf.transitional(pf.boolean),forcedJSONParsing:pf.transitional(pf.boolean),clarifyTimeoutError:pf.transitional(pf.boolean)},false)}if(i!=null){if(fe.isFunction(i)){r.paramsSerializer={serialize:i}}else{vK.assertOptions(i,{encode:pf.function,serialize:pf.function},true)}}r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]});r.headers=Ho.concat(a,s);const u=[];let l=true;this.interceptors.request.forEach(o(function m(g){if(typeof g.runWhen==="function"&&g.runWhen(r)===false){return}l=l&&g.synchronous;u.unshift(g.fulfilled,g.rejected)},"unshiftRequestInterceptors"));const c=[];this.interceptors.response.forEach(o(function m(g){c.push(g.fulfilled,g.rejected)},"pushResponseInterceptors"));let d;let p=0;let f;if(!l){const m=[u7e.bind(this),void 0];m.unshift.apply(m,u);m.push.apply(m,c);f=m.length;d=Promise.resolve(r);while(p<f){d=d.then(m[p++],m[p++])}return d}f=u.length;let h=r;p=0;while(p<f){const m=u[p++];const g=u[p++];try{h=m(h)}catch(y){g.call(this,y);break}}try{d=u7e.call(this,h)}catch(m){return Promise.reject(m)}p=0;f=c.length;while(p<f){d=d.then(c[p++],c[p++])}return d}getUri(e){e=Ly(this.defaults,e);const r=xK(e.baseURL,e.url);return wK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){qy.prototype[e]=function(r,n){return this.request(Ly(n||{},{method:e,url:r,data:(n||{}).data}))}},"forEachMethodNoData"));fe.forEach(["post","put","patch"],o(function t(e){function r(n){return o(function i(s,a,u){return this.request(Ly(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");qy.prototype[e]=r();qy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var ux=qy;var _K=class t{static{o(this,"CancelToken")}constructor(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}let r;this.promise=new Promise(o(function i(s){r=s},"promiseExecutor"));const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;while(s-- >0){n._listeners[s](i)}n._listeners=null});this.promise.then=i=>{let s;const a=new Promise(u=>{n.subscribe(u);s=u}).then(i);a.cancel=o(function u(){n.unsubscribe(s)},"reject");return a};e(o(function i(s,a,u){if(n.reason){return}n.reason=new Dm(s,a,u);r(n.reason)},"cancel"))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const r=this._listeners.indexOf(e);if(r!==-1){this._listeners.splice(r,1)}}static source(){let e;const r=new t(o(function n(i){e=i},"executor"));return{token:r,cancel:e}}};var Okt=_K;function Nkt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(Nkt,"spread");function Ikt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Ikt,"isAxiosError");var EK={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(EK).forEach(([t,e])=>{EK[e]=t});var Pkt=EK;function $7e(t){const e=new ux(t);const r=h7e(ux.prototype.request,e);fe.extend(r,ux.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return $7e(Ly(t,i))},"create");return r}o($7e,"createInstance");var fi=$7e(AK);fi.Axios=ux;fi.CanceledError=Dm;fi.CancelToken=Okt;fi.isCancel=O7e;fi.VERSION=lx;fi.toFormData=fx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=Nkt;fi.isAxiosError=Ikt;fi.mergeConfig=Ly;fi.AxiosHeaders=Ho;fi.formToJSON=t=>R7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=k7e.getAdapter;fi.HttpStatusCode=Pkt;fi.default=fi;L7e.exports=fi});var gx=_(mx=>{"use strict";Object.defineProperty(mx,"__esModule",{value:true});mx.CredentialsMethod=void 0;var q7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(q7e||(mx.CredentialsMethod=q7e={}))});var $m=_(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:true});hi.FgaRequiredParamError=hi.FgaValidationError=hi.FgaApiAuthenticationError=hi.FgaApiInternalError=hi.FgaApiRateLimitExceededError=hi.FgaApiNotFoundError=hi.FgaApiValidationError=hi.FgaApiError=hi.FgaError=void 0;var Uy=class extends Error{static{o(this,"FgaError")}constructor(e,r){super(r||typeof e==="string"?e:`FGA Error${(e===null||e===void 0?void 0:e.message)?`: ${e.message}`:""}`);this.name="FgaError";if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaError=Uy;function vx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(vx,"getRequestMetadataFromPath");var j7e="fga-request-id";function kK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(kK,"getResponseHeaders");var km=class extends Uy{static{o(this,"FgaApiError")}constructor(e,r){var n,i,s,a,u,l,c,d,p,f;super(r?r:e);this.name="FgaApiError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestData=(s=e.config)===null||s===void 0?void 0:s.data;this.requestURL=(a=e.config)===null||a===void 0?void 0:a.url;this.method=(u=e.config)===null||u===void 0?void 0:u.method;const{storeId:h,endpointCategory:m}=vx((l=e.request)===null||l===void 0?void 0:l.path);this.storeId=h;this.endpointCategory=m;this.apiErrorMessage=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message;this.responseData=(p=e.response)===null||p===void 0?void 0:p.data;this.responseHeader=(f=e.response)===null||f===void 0?void 0:f.headers;const g=kK(e);this.requestId=g[j7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=km;var RK=class extends km{static{o(this,"FgaApiValidationError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiValidationError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:p}=vx((s=e.request)===null||s===void 0?void 0:s.path);this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Validation Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiValidationError=RK;var OK=class extends km{static{o(this,"FgaApiNotFoundError")}constructor(e,r){var n,i,s,a,u,l,c;super(e);this.name="FgaApiNotFoundError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;this.message=r?r:((a=(s=e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)?`FGA API NotFound Error: ${(u=e.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=e.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:e.message}};hi.FgaApiNotFoundError=OK;var NK=class extends km{static{o(this,"FgaApiRateLimitExceededError")}constructor(e,r){var n,i,s;super(e);this.name="FgaApiRateLimitExceededError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:a}=vx((s=e.request)===null||s===void 0?void 0:s.path);const u=kK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=NK;var IK=class extends km{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=vx((n=e.request)===null||n===void 0?void 0:n.path);this.apiErrorCode=(s=(i=e.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.code;this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Internal Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiInternalError=IK;var PK=class extends Uy{static{o(this,"FgaApiAuthenticationError")}constructor(e){var r,n,i,s,a,u,l,c,d,p;super(`FGA Authentication Error.${((r=e.response)===null||r===void 0?void 0:r.statusText)?` ${e.response.statusText}`:""}`);this.name="FgaApiAuthenticationError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestURL=(s=e.config)===null||s===void 0?void 0:s.url;this.method=(a=e.config)===null||a===void 0?void 0:a.method;this.responseData=(u=e.response)===null||u===void 0?void 0:u.data;this.responseHeader=(l=e.response)===null||l===void 0?void 0:l.headers;this.apiErrorCode=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.code;const f=kK(e);this.requestId=f[j7e];let h;try{h=JSON.parse(((p=e.config)===null||p===void 0?void 0:p.data)||"{}")}catch(m){}this.clientId=h===null||h===void 0?void 0:h.client_id;this.audience=h===null||h===void 0?void 0:h.audience;this.grantType=h===null||h===void 0?void 0:h.grant_type;if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiAuthenticationError=PK;var yx=class extends Uy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=yx;var DK=class extends yx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=DK});var lb=_(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:true});gf.isWellFormedUlidString=gf.isWellFormedUriString=gf.assertParamExists=void 0;var Dkt=$m();var kkt=o(function(t,e,r){if(r===null||r===void 0){throw new Dkt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");gf.assertParamExists=kkt;var $kt=o(t=>{try{const e=new URL(t);return(e.toString()===t||e.toString()===`${t}/`)&&(e.protocol==="https:"||e.protocol==="http:")}catch(e){return false}},"isWellFormedUriString");gf.isWellFormedUriString=$kt;var Lkt=o(t=>{var e;const r=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;return!!(typeof t==="string"&&((e=t.match(r))===null||e===void 0?void 0:e.length))},"isWellFormedUlidString");gf.isWellFormedUlidString=Lkt});var LK=_(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:true});Fy.Configuration=Fy.GetDefaultRetryParams=void 0;var cb=gx();var $K=$m();var _x=lb();var qkt=15;var jkt=100;var Ukt="openfga-sdk js/0.3.0";function Fkt(t=qkt,e=jkt){return{maxRetry:t,minWaitInMs:e}}o(Fkt,"GetDefaultRetryParams");Fy.GetDefaultRetryParams=Fkt;var Ex=class{static{o(this,"Configuration")}constructor(e={}){this.apiScheme="https";this.getBasePath=()=>`${this.apiScheme}://${this.apiHost}`;this.apiScheme=e.apiScheme||this.apiScheme;this.apiHost=e.apiHost;this.storeId=e.storeId;const r=e.credentials;if(r){switch(r===null||r===void 0?void 0:r.method){case cb.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case cb.CredentialsMethod.ClientCredentials:this.credentials={method:cb.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case cb.CredentialsMethod.None:default:this.credentials={method:cb.CredentialsMethod.None};break}}const n=e.baseOptions||{};n.headers=n.headers||{};if(typeof process==="object"&&process.title==="node"&&!n.headers["User-Agent"]){n.headers["User-Agent"]=Ukt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,_x.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,_x.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,_x.isWellFormedUriString)(this.getBasePath())){throw new $K.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,_x.isWellFormedUlidString)(this.storeId)){throw new $K.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new $K.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};Fy.Configuration=Ex;Ex.sdkVersion="0.3.0"});var U7e=_(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:true});bx.assertNever=void 0;function Mkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Mkt,"assertNever");bx.assertNever=Mkt});var F7e=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.chunkArray=void 0;function Bkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Bkt,"chunkArray");wx.chunkArray=Bkt});var B7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var Sx=require("crypto");function M7e(){if(typeof Sx.randomUUID==="function"){return(0,Sx.randomUUID)()}if(typeof Sx.randomBytes==="function"){return(0,Sx.randomBytes)(20).toString("hex")}return}o(M7e,"generateRandomId");My.generateRandomId=M7e;function Vkt(){return M7e()||"00000000-0000-0000-0000-000000000000"}o(Vkt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Vkt});var V7e=_(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:true});Tx.setHeaderIfNotSet=void 0;function Hkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Hkt,"setHeaderIfNotSet");Tx.setHeaderIfNotSet=Hkt});var H7e=_(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:true});Ax.setNotEnumerableProperty=void 0;function zkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(zkt,"setNotEnumerableProperty");Ax.setNotEnumerableProperty=zkt});var qK=_($u=>{"use strict";var Gkt=$u&&$u.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var db=$u&&$u.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Gkt(e,t,r)};Object.defineProperty($u,"__esModule",{value:true});db(U7e(),$u);db(F7e(),$u);db(B7e(),$u);db(V7e(),$u);db(H7e(),$u)});var UK=_(yi=>{"use strict";var jK=yi&&yi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(yi,"__esModule",{value:true});yi.createRequestFunction=yi.attemptHttpRequest=yi.toPathString=yi.serializeDataIfNeeded=yi.setSearchParams=yi.setBearerAuthToObject=yi.DUMMY_BASE_URL=void 0;var Kkt=xx();var Lm=$m();var Ykt=qK();yi.DUMMY_BASE_URL="https://example.com";var Wkt=o(function(t,e){return jK(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=Wkt;var Jkt=o(function(t,...e){const r=new URLSearchParams(t.search);for(const n of e){for(const i in n){if(Array.isArray(n[i])){r.delete(i);for(const s of n[i]){r.append(i,s)}}else{r.set(i,n[i])}}}t.search=r.toString()},"setSearchParams");yi.setSearchParams=Jkt;var Qkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Xkt=o(function(t,e){const r=typeof t!=="string";const n=r?Qkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Xkt;var Zkt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Zkt;function e$t(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(e$t,"isAxiosError");function t$t(t,e){const r=Math.ceil(Math.pow(2,t)*e);const n=Math.ceil(Math.pow(2,t+1)*e);return Math.floor(Math.random()*(n-r)+r)}o(t$t,"randomTime");function z7e(t,e,r){var n;return jK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!e$t(s)){throw new Lm.FgaError(s)}const a=(n=s===null||s===void 0?void 0:s.response)===null||n===void 0?void 0:n.status;if(a===400||a===422){throw new Lm.FgaApiValidationError(s)}else if(a===401||a===403){throw new Lm.FgaApiAuthenticationError(s)}else if(a===404){throw new Lm.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new Lm.FgaApiRateLimitExceededError(s)}else{throw new Lm.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,t$t(i,e.minWaitInMs)))}else{throw new Lm.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(z7e,"attemptHttpRequest");yi.attemptHttpRequest=z7e;var r$t=o(function(t,e,r,n){var i,s;r.isValid();const a=((i=t.options)===null||i===void 0?void 0:i.retryParams)?(s=t.options)===null||s===void 0?void 0:s.retryParams:r.retryParams;const u=a?a.maxRetry:0;const l=a?a.minWaitInMs:0;if(!n){n=Kkt.Credentials.init(r)}return(c=e)=>jK(this,void 0,void 0,function*(){yield(0,yi.setBearerAuthToObject)(t.options.headers,n);const d=Object.assign(Object.assign({},t.options),{url:r.getBasePath()+t.url});const p=yield z7e(d,{maxRetry:u,minWaitInMs:l},c);const f=typeof(p===null||p===void 0?void 0:p.data)==="undefined"?{}:p===null||p===void 0?void 0:p.data;const h=Object.assign({},f);(0,Ykt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=r$t});var K7e=_(By=>{"use strict";var FK=By&&By.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(By,"__esModule",{value:true});By.Credentials=void 0;var G7e=hx();var yf=lb();var MK=$m();var n$t=UK();var zo=gx();var BK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=G7e.default){this.authConfig=e;this.axios=r;this.initConfig();this.isValid()}initConfig(){var e;switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case zo.CredentialsMethod.ApiToken:if(this.authConfig.config){if(!this.authConfig.config.headerName){this.authConfig.config.headerName="Authorization"}if(!this.authConfig.config.headerValuePrefix){this.authConfig.config.headerValuePrefix="Bearer"}}break;case zo.CredentialsMethod.ClientCredentials:case zo.CredentialsMethod.None:default:break}}isValid(){var e,r,n,i,s,a,u,l,c;const{authConfig:d}=this;switch(d===null||d===void 0?void 0:d.method){case zo.CredentialsMethod.None:break;case zo.CredentialsMethod.ApiToken:(0,yf.assertParamExists)("Credentials","config.token",(e=d.config)===null||e===void 0?void 0:e.token);(0,yf.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName);(0,yf.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case zo.CredentialsMethod.ClientCredentials:(0,yf.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId);(0,yf.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret);(0,yf.assertParamExists)("Credentials","config.apiTokenIssuer",(a=d.config)===null||a===void 0?void 0:a.apiTokenIssuer);(0,yf.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience);if(!(0,yf.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`)){throw new MK.FgaValidationError(`Configuration.apiTokenIssuer does not form a valid URI (https://${(c=d.config)===null||c===void 0?void 0:c.apiTokenIssuer})`)}break}}getAccessTokenHeader(){var e;return FK(this,void 0,void 0,function*(){const r=yield this.getAccessTokenValue();switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case zo.CredentialsMethod.None:return;case zo.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case zo.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var e;return FK(this,void 0,void 0,function*(){switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case zo.CredentialsMethod.None:return;case zo.CredentialsMethod.ApiToken:return this.authConfig.config.token;case zo.CredentialsMethod.ClientCredentials:if(this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)){return this.accessToken}return this.refreshAccessToken()}})}refreshAccessToken(){var e;return FK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,n$t.attemptHttpRequest)({url:`https://${r.apiTokenIssuer}/oauth/token`,method:"post",data:{client_id:r.clientId,client_secret:r.clientSecret,audience:r.apiAudience,grant_type:"client_credentials"}},{maxRetry:3,minWaitInMs:100},G7e.default);if(n){this.accessToken=n.data.access_token;this.accessTokenExpiryDate=new Date(Date.now()+n.data.expires_in*1e3)}return this.accessToken}catch(n){if(n instanceof MK.FgaApiError){n.constructor=MK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};By.Credentials=BK});var xx=_(vf=>{"use strict";var i$t=vf&&vf.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var Y7e=vf&&vf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))i$t(e,t,r)};Object.defineProperty(vf,"__esModule",{value:true});Y7e(K7e(),vf);Y7e(gx(),vf)});var HK=_(Cx=>{"use strict";Object.defineProperty(Cx,"__esModule",{value:true});Cx.BaseAPI=void 0;var s$t=hx();var a$t=require("http");var o$t=require("https");var W7e=LK();var u$t=xx();var l$t=1e4;var VK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof W7e.Configuration){this.configuration=e}else{this.configuration=new W7e.Configuration(e)}this.configuration.isValid();this.credentials=u$t.Credentials.init(this.configuration);if(!this.axios){const i=new a$t.Agent({keepAlive:true});const s=new o$t.Agent({keepAlive:true});this.axios=s$t.default.create({httpAgent:i,httpsAgent:s,timeout:l$t,headers:(n=this.configuration.baseOptions)===null||n===void 0?void 0:n.headers})}}get storeId(){return this.configuration.storeId}set storeId(e){this.configuration.storeId=e}};Cx.BaseAPI=VK});var GK=_(tn=>{"use strict";var Zr=tn&&tn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(tn,"__esModule",{value:true});tn.OpenFgaApi=tn.OpenFgaApiFactory=tn.OpenFgaApiFp=tn.OpenFgaApiAxiosParamCreator=void 0;var zs=hx();var c$t=HK();var We=UK();var Vn=lb();var d$t=o(function(t,e){return{check:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("check","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/check".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),createStore:(r,n={})=>Zr(this,void 0,void 0,function*(){const i="/stores";const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),deleteStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"DELETE"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),expand:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("expand","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/expand".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),getStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"GET"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),listObjects:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("listObjects","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/list-objects".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),listStores:(r,n,i={})=>Zr(this,void 0,void 0,function*(){const s="/stores";const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),read:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("read","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/read".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),readAssertions:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAuthorizationModel","id",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models/{id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModels:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),readChanges:(r,n,i,s={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const a="/stores/{store_id}/changes".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const u=new URL(a,We.DUMMY_BASE_URL);let l;if(t){l=t.baseOptions}const c=Object.assign(Object.assign({method:"GET"},l),s);const d={};const p={};if(r!==void 0){p["type"]=r}if(n!==void 0){p["page_size"]=n}if(i!==void 0){p["continuation_token"]=i}(0,We.setSearchParams)(u,p,s.query);c.headers=Object.assign(Object.assign({},d),s.headers);return{url:(0,We.toPathString)(u),options:c}}),write:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("write","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/write".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),writeAssertions:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("writeAssertions","body",n);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"PUT"},u),i);const c={};const d={};c["Content-Type"]="application/json";(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);l.data=(0,We.serializeDataIfNeeded)(n,l);return{url:(0,We.toPathString)(a),options:l}}),writeAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAuthorizationModel","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}})}},"OpenFgaApiAxiosParamCreator");tn.OpenFgaApiAxiosParamCreator=d$t;var p$t=o(function(t,e){const r=(0,tn.OpenFgaApiAxiosParamCreator)(t,e);return{check(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.check(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},createStore(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.createStore(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},deleteStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.deleteStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},expand(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.expand(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},getStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.getStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},listObjects(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.listObjects(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},listStores(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.listStores(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},read(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.read(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAssertions(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAssertions(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModels(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.readAuthorizationModels(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},readChanges(n,i,s,a){return Zr(this,void 0,void 0,function*(){const u=yield r.readChanges(n,i,s,a);return(0,We.createRequestFunction)(u,zs.default,t,e)})},write(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.write(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},writeAssertions(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.writeAssertions(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},writeAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.writeAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})}}},"OpenFgaApiFp");tn.OpenFgaApiFp=p$t;var f$t=o(function(t,e,r){const n=(0,tn.OpenFgaApiFp)(t,e);return{check(i,s){return n.check(i,s).then(a=>a(r))},createStore(i,s){return n.createStore(i,s).then(a=>a(r))},deleteStore(i){return n.deleteStore(i).then(s=>s(r))},expand(i,s){return n.expand(i,s).then(a=>a(r))},getStore(i){return n.getStore(i).then(s=>s(r))},listObjects(i,s){return n.listObjects(i,s).then(a=>a(r))},listStores(i,s,a){return n.listStores(i,s,a).then(u=>u(r))},read(i,s){return n.read(i,s).then(a=>a(r))},readAssertions(i,s){return n.readAssertions(i,s).then(a=>a(r))},readAuthorizationModel(i,s){return n.readAuthorizationModel(i,s).then(a=>a(r))},readAuthorizationModels(i,s,a){return n.readAuthorizationModels(i,s,a).then(u=>u(r))},readChanges(i,s,a,u){return n.readChanges(i,s,a,u).then(l=>l(r))},write(i,s){return n.write(i,s).then(a=>a(r))},writeAssertions(i,s,a){return n.writeAssertions(i,s,a).then(u=>u(r))},writeAuthorizationModel(i,s){return n.writeAuthorizationModel(i,s).then(a=>a(r))}}},"OpenFgaApiFactory");tn.OpenFgaApiFactory=f$t;var zK=class extends c$t.BaseAPI{static{o(this,"OpenFgaApi")}check(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).check(e,r).then(n=>n(this.axios))}createStore(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).createStore(e,r).then(n=>n(this.axios))}deleteStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).deleteStore(e).then(r=>r(this.axios))}expand(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).expand(e,r).then(n=>n(this.axios))}getStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).getStore(e).then(r=>r(this.axios))}listObjects(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listObjects(e,r).then(n=>n(this.axios))}listStores(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listStores(e,r,n).then(i=>i(this.axios))}read(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).read(e,r).then(n=>n(this.axios))}readAssertions(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAssertions(e,r).then(n=>n(this.axios))}readAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModel(e,r).then(n=>n(this.axios))}readAuthorizationModels(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModels(e,r,n).then(i=>i(this.axios))}readChanges(e,r,n,i){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readChanges(e,r,n,i).then(s=>s(this.axios))}write(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).write(e,r).then(n=>n(this.axios))}writeAssertions(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAssertions(e,r,n).then(i=>i(this.axios))}writeAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAuthorizationModel(e,r).then(n=>n(this.axios))}};tn.OpenFgaApi=zK});var Q7e=_((qmr,J7e)=>{async function*h$t(t,e,r){const n=new Set;async function i(){const[s,a]=await Promise.race(n);n.delete(s);return a}o(i,"consume");for(const s of e){const a=(async()=>await r(s,e))().then(u=>[a,u]);n.add(a);if(n.size>=t){yield await i()}}while(n.size){yield await i()}}o(h$t,"asyncPool");J7e.exports=h$t});var X7e=_(zl=>{"use strict";var Hn=zl&&zl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};var KK=zl&&zl.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values==="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(a){return new Promise(function(u,l){a=t[s](a),i(u,l,a.done,a.value)})}}o(n,"verb");function i(s,a,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},a)}o(i,"settle")};Object.defineProperty(zl,"__esModule",{value:true});zl.OpenFgaClient=zl.ClientWriteStatus=void 0;var YK=Q7e();var m$t=GK();var g$t=HK();var WK=$m();var Aa=qK();var y$t=lb();var JK=10;var Vy="X-OpenFGA-Client-Method";var QK="X-OpenFGA-Client-Bulk-Request-Id";var Hy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(Hy||(zl.ClientWriteStatus=Hy={}));var XK=class extends g$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new m$t.OpenFgaApi(this.configuration,r);this.authorizationModelId=e.authorizationModelId;this.getAuthorizationModelId()}getAuthorizationModelId(e={}){const r=(e===null||e===void 0?void 0:e.authorizationModelId)||this.authorizationModelId;if(r&&!(0,y$t.isWellFormedUlidString)(r)){throw new WK.FgaValidationError("authorizationModelId")}return r}checkValidApiConnection(e={}){return Hn(this,void 0,void 0,function*(){if(this.getAuthorizationModelId(e)){yield this.readAuthorizationModel(e)}else{yield this.readLatestAuthorizationModel(e)}})}listStores(e={}){return Hn(this,void 0,void 0,function*(){return this.api.listStores(e.pageSize,e.continuationToken,e)})}createStore(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.createStore(e,r)})}getStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.getStore(e)})}deleteStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.deleteStore(e)})}readAuthorizationModels(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAuthorizationModels(e.pageSize,e.continuationToken,e)})}writeAuthorizationModel(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAuthorizationModel(e,r)})}readAuthorizationModel(e={}){return Hn(this,void 0,void 0,function*(){const r=this.getAuthorizationModelId(e);if(!r){throw new WK.FgaRequiredParamError("ClientConfiguration","authorizationModelId")}return this.api.readAuthorizationModel(r,e)})}readLatestAuthorizationModel(e={}){var r;return Hn(this,void 0,void 0,function*(){const{headers:n={}}=e;(0,Aa.setHeaderIfNotSet)(n,Vy,"ReadLatestAuthorizationModel");const i=yield this.readAuthorizationModels(Object.assign(Object.assign({},e),{pageSize:1,headers:n}));const s=i;s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0];delete s.authorization_models;return s})}readChanges(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.readChanges(e.type,r.pageSize,r.continuationToken,r)})}read(e={},r={}){return Hn(this,void 0,void 0,function*(){const n={page_size:r.pageSize,continuation_token:r.continuationToken};if(e.user||e.object||e.relation){n.tuple_key=e}return this.api.read(n,r)})}write(e,r={}){return Hn(this,void 0,void 0,function*(){const{transaction:n={},headers:i={}}=r;const{maxPerChunk:s=1,maxParallelRequests:a=JK}=n;const{writes:u,deletes:l}=e;const c=this.getAuthorizationModelId(r);if(!(n===null||n===void 0?void 0:n.disable)){const d={authorization_model_id:c};if(u===null||u===void 0?void 0:u.length){d.writes={tuple_keys:u}}if(l===null||l===void 0?void 0:l.length){d.deletes={tuple_keys:l}}yield this.api.write(d,r);return{writes:(u===null||u===void 0?void 0:u.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Aa.setHeaderIfNotSet)(i,Vy,"Write");(0,Aa.setHeaderIfNotSet)(i,QK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=KK(YK(a,(0,Aa.chunkArray)(u,s),j=>this.writeTuples(j,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(B=>({writes:j.map(U=>({tuple_key:U,status:Hy.FAILURE,err:B})),deletes:[]})))),S;S=yield b.next(),d=S.done,!d;E=true){h=S.value;E=false;const j=h;w.push(j.writes)}}catch(j){p={error:j}}finally{try{if(!E&&!d&&(f=b.return))yield f.call(b)}finally{if(p)throw p.error}}}const T=[];if(l===null||l===void 0?void 0:l.length){try{for(var A=true,R=KK(YK(a,(0,Aa.chunkArray)(l,s),j=>this.deleteTuples(j,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(B=>({writes:[],deletes:j.map(U=>({tuple_key:U,status:Hy.FAILURE,err:B}))})))),O;O=yield R.next(),m=O.done,!m;A=true){v=O.value;A=false;const j=v;T.push(j.deletes)}}catch(j){g={error:j}}finally{try{if(!A&&!m&&(y=R.return))yield y.call(R)}finally{if(g)throw g.error}}}return{writes:w.flat(),deletes:T.flat()}}))(),this.checkValidApiConnection(r)]).then(d=>d[0])})}writeTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"WriteTuples");return this.write({writes:e},Object.assign(Object.assign({},r),{headers:n}))})}deleteTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"DeleteTuples");return this.write({deletes:e},Object.assign(Object.assign({},r),{headers:n}))})}check(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:e.user,relation:e.relation,object:e.object},context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(e,r={}){return Hn(this,void 0,void 0,function*(){return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var n,i,s,a;const{headers:u={},maxParallelRequests:l=JK}=r;(0,Aa.setHeaderIfNotSet)(u,Vy,"BatchCheck");(0,Aa.setHeaderIfNotSet)(u,QK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=KK(YK(l,e,h=>this.check(h,Object.assign(Object.assign({},r),{headers:u})).then(m=>{m._request=h;return m}).catch(m=>{return{allowed:void 0,error:m,_request:h}}))),f;f=yield p.next(),n=f.done,!n;d=true){a=f.value;d=false;const h=a;c.push(h)}}catch(h){i={error:h}}finally{try{if(!d&&!n&&(s=p.return))yield s.call(p)}finally{if(i)throw i.error}}return{responses:c}}))(),this.checkValidApiConnection(r)]).then(n=>n[0])})}expand(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:e},r)})}listObjects(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:e.user,relation:e.relation,type:e.type,context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]}},r)})}listRelations(e,r={}){return Hn(this,void 0,void 0,function*(){const{user:n,object:i,relations:s,contextualTuples:a,context:u}=e;const{headers:l={},maxParallelRequests:c=JK}=r;(0,Aa.setHeaderIfNotSet)(l,Vy,"ListRelations");(0,Aa.setHeaderIfNotSet)(l,QK,(0,Aa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new WK.FgaValidationError("relations","When calling listRelations, at least one relation must be passed in the relations field")}const d=yield this.batchCheck(s.map(f=>({user:n,relation:f,object:i,contextualTuples:a,context:u})),Object.assign(Object.assign({},r),{headers:l,maxParallelRequests:c}));const p=d.responses.find(f=>f.error);if(p){throw p.error}return{relations:d.responses.filter(f=>f.allowed).map(f=>f._request.relation)}})}readAssertions(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAssertions(this.getAuthorizationModelId(e),e)})}writeAssertions(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAssertions(this.getAuthorizationModelId(r),{assertions:e.map(n=>({tuple_key:{user:n.user,relation:n.relation,object:n.object},expectation:n.expectation}))},r)})}};zl.OpenFgaClient=XK});var sAe=_(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:true});xa.TypeName=xa.TupleOperation=xa.NullValue=xa.NotFoundErrorCode=xa.InternalErrorCode=xa.ErrorCode=void 0;var Z7e;(function(t){t["NoError"]="no_error";t["ValidationError"]="validation_error";t["AuthorizationModelNotFound"]="authorization_model_not_found";t["AuthorizationModelResolutionTooComplex"]="authorization_model_resolution_too_complex";t["InvalidWriteInput"]="invalid_write_input";t["CannotAllowDuplicateTuplesInOneRequest"]="cannot_allow_duplicate_tuples_in_one_request";t["CannotAllowDuplicateTypesInOneRequest"]="cannot_allow_duplicate_types_in_one_request";t["CannotAllowMultipleReferencesToOneRelation"]="cannot_allow_multiple_references_to_one_relation";t["InvalidContinuationToken"]="invalid_continuation_token";t["InvalidTupleSet"]="invalid_tuple_set";t["InvalidCheckInput"]="invalid_check_input";t["InvalidExpandInput"]="invalid_expand_input";t["UnsupportedUserSet"]="unsupported_user_set";t["InvalidObjectFormat"]="invalid_object_format";t["WriteFailedDueToInvalidInput"]="write_failed_due_to_invalid_input";t["AuthorizationModelAssertionsNotFound"]="authorization_model_assertions_not_found";t["LatestAuthorizationModelNotFound"]="latest_authorization_model_not_found";t["TypeNotFound"]="type_not_found";t["RelationNotFound"]="relation_not_found";t["EmptyRelationDefinition"]="empty_relation_definition";t["InvalidUser"]="invalid_user";t["InvalidTuple"]="invalid_tuple";t["UnknownRelation"]="unknown_relation";t["StoreIdInvalidLength"]="store_id_invalid_length";t["AssertionsTooManyItems"]="assertions_too_many_items";t["IdTooLong"]="id_too_long";t["AuthorizationModelIdTooLong"]="authorization_model_id_too_long";t["TupleKeyValueNotSpecified"]="tuple_key_value_not_specified";t["TupleKeysTooManyOrTooFewItems"]="tuple_keys_too_many_or_too_few_items";t["PageSizeInvalid"]="page_size_invalid";t["ParamMissingValue"]="param_missing_value";t["DifferenceBaseMissingValue"]="difference_base_missing_value";t["SubtractBaseMissingValue"]="subtract_base_missing_value";t["ObjectTooLong"]="object_too_long";t["RelationTooLong"]="relation_too_long";t["TypeDefinitionsTooFewItems"]="type_definitions_too_few_items";t["TypeInvalidLength"]="type_invalid_length";t["TypeInvalidPattern"]="type_invalid_pattern";t["RelationsTooFewItems"]="relations_too_few_items";t["RelationsTooLong"]="relations_too_long";t["RelationsInvalidPattern"]="relations_invalid_pattern";t["ObjectInvalidPattern"]="object_invalid_pattern";t["QueryStringTypeContinuationTokenMismatch"]="query_string_type_continuation_token_mismatch";t["ExceededEntityLimit"]="exceeded_entity_limit";t["InvalidContextualTuple"]="invalid_contextual_tuple";t["DuplicateContextualTuple"]="duplicate_contextual_tuple";t["InvalidAuthorizationModel"]="invalid_authorization_model";t["UnsupportedSchemaVersion"]="unsupported_schema_version"})(Z7e||(xa.ErrorCode=Z7e={}));var eAe;(function(t){t["NoInternalError"]="no_internal_error";t["InternalError"]="internal_error";t["Cancelled"]="cancelled";t["DeadlineExceeded"]="deadline_exceeded";t["AlreadyExists"]="already_exists";t["ResourceExhausted"]="resource_exhausted";t["FailedPrecondition"]="failed_precondition";t["Aborted"]="aborted";t["OutOfRange"]="out_of_range";t["Unavailable"]="unavailable";t["DataLoss"]="data_loss"})(eAe||(xa.InternalErrorCode=eAe={}));var tAe;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(tAe||(xa.NotFoundErrorCode=tAe={}));var rAe;(function(t){t["NullValue"]="NULL_VALUE"})(rAe||(xa.NullValue=rAe={}));var nAe;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(nAe||(xa.TupleOperation=nAe={}));var iAe;(function(t){t["Unspecified"]="TYPE_NAME_UNSPECIFIED";t["Any"]="TYPE_NAME_ANY";t["Bool"]="TYPE_NAME_BOOL";t["String"]="TYPE_NAME_STRING";t["Int"]="TYPE_NAME_INT";t["Uint"]="TYPE_NAME_UINT";t["Double"]="TYPE_NAME_DOUBLE";t["Duration"]="TYPE_NAME_DURATION";t["Timestamp"]="TYPE_NAME_TIMESTAMP";t["Map"]="TYPE_NAME_MAP";t["List"]="TYPE_NAME_LIST";t["Ipaddress"]="TYPE_NAME_IPADDRESS"})(iAe||(xa.TypeName=iAe={}))});var uAe=_($i=>{"use strict";var v$t=$i&&$i.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var Rx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))v$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Rx(GK(),$i);Rx(X7e(),$i);Rx(sAe(),$i);var aAe=LK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return aAe.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return aAe.GetDefaultRetryParams}});var oAe=xx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return oAe.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return oAe.CredentialsMethod}});Rx($m(),$i)});var cAe=_(zy=>{"use strict";var _$t=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zy,"__esModule",{value:true});zy.OpenFGAService=void 0;var pb=_$t(Oa());var lAe=uAe();var E$t=Ry();var ZK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!pb.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=pb.default.OPENFGA_SERVICE_URL;this.apiHost=pb.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=pb.default.OPENFGA_STORE_ID;this.modelId=pb.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,E$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new lAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:lAe.CredentialsMethod.ApiToken,config:{token:e}}})}return this.openFGAClient}async createAccountMember(e){try{const r=await this.getOpenFgaClient();await r.write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${e}`}]})}catch(r){this.logger.warn(`RBAC failed to create account membership. Error: ${r.message}`)}}async getAccountMemberships(){const e=await this.getOpenFgaClient();const r=await e.listObjects({user:`user:${this.userSub}`,relation:"member",type:"account"});if(r){return r.objects.map(n=>n.replace(/^(account:)/,""))}return[]}async isAccountMember(e){try{const r=await this.getOpenFgaClient();const{allowed:n}=await r.check({user:`user:${this.userSub}`,relation:"member",object:`account:${e}`});if(!n){return false}return n}catch(r){this.logger.warn(`RBAC failed to check account membership. Error: ${r.message}`);return false}}async isZuploAdmin(){try{const e=await this.getOpenFgaClient();const{tuples:r}=await e.read({object:"role:zuplo-admin"});const n=[];r.forEach(i=>{const s=i.key.user.replace(/^(user:)/,"");n.push(s)});return n.includes(this.userSub)}catch(e){this.logger.warn(`RBAC failed to check for zuplo admin. Error: ${e.message}`);return false}}async isDeployerServiceAccount(){try{const e=await this.getOpenFgaClient();const{tuples:r}=await e.read({object:"role:zuplo-deployer"});const n=[];r.forEach(i=>{const s=i.key.user.replace(/^(user:)/,"");n.push(s)});return n.includes(this.userSub)}catch(e){this.logger.warn(`RBAC failed to check for zuplo deployer. Error: ${e.message}`);return false}}async createProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({writes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to create account-project association. Error: ${n.message}`)}}async deleteProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({deletes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to delete account-project association. Error: ${n.message}`)}}};zy.OpenFGAService=ZK});var fAe=_(Gy=>{"use strict";var pAe=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.TenantService=void 0;var b$t=pAe(ru());var dAe=pAe(Oa());var w$t=X6();var S$t=new b$t.default({max:500,maxAge:1e3*60*50});var eY=class extends w$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!dAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(dAe.default.TENANT_API_URL,S$t,{userSub:n,logger:e.log,requestId:e.id})}};Gy.TenantService=eY});var gAe=_(Ky=>{"use strict";var mAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.MeteringService=void 0;var T$t=mAe(ru());var hAe=mAe(Oa());var A$t=X6();var x$t=new T$t.default({max:500,maxAge:1e3*60*50});var tY=class extends A$t.ApiServiceClient{static{o(this,"MeteringService")}constructor(e,r){if(!hAe.default.METERING_SERVICE_URL){throw new Error("METERING_SERVICE_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(hAe.default.METERING_SERVICE_URL,x$t,{userSub:n,logger:e.log,requestId:e.id,targetAudience:"https://meters.zuplo.com"})}};Ky.MeteringService=tY});var yAe=_(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:true});Gl.validateHostname=Gl.kebabCase=Gl.snakeCase=Gl.sizeInBytes=void 0;function C$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(C$t,"sizeInBytes");Gl.sizeInBytes=C$t;function R$t(t){if(!t||t===null){return""}return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(e=>e.toLowerCase()).join("_")}o(R$t,"snakeCase");Gl.snakeCase=R$t;function O$t(t){if(!t||t===null){return""}const e=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);if(e===null){return""}return e.map(r=>r.toLowerCase()).join("-")}o(O$t,"kebabCase");Gl.kebabCase=O$t;function N$t(t){try{const e=/^(?!https?:\/\/)([a-zA-Z0-9.-]*|(\*))*\.[a-zA-Z]+$/;if(t&&!e.test(t)){return false}return true}catch(e){}return false}o(N$t,"validateHostname");Gl.validateHostname=N$t});var EAe=_(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:true});G.Type=G.JsonType=G.JavaScriptTypeBuilder=G.JsonTypeBuilder=G.TypeBuilder=G.TypeBuilderError=G.TransformEncodeBuilder=G.TransformDecodeBuilder=G.TemplateLiteralDslParser=G.TemplateLiteralGenerator=G.TemplateLiteralGeneratorError=G.TemplateLiteralFinite=G.TemplateLiteralFiniteError=G.TemplateLiteralParser=G.TemplateLiteralParserError=G.TemplateLiteralResolver=G.TemplateLiteralPattern=G.TemplateLiteralPatternError=G.UnionResolver=G.KeyArrayResolver=G.KeyArrayResolverError=G.KeyResolver=G.ObjectMap=G.Intrinsic=G.IndexedAccessor=G.TypeClone=G.TypeExtends=G.TypeExtendsResult=G.TypeExtendsError=G.ExtendsUndefined=G.TypeGuard=G.TypeGuardUnknownTypeError=G.ValueGuard=G.FormatRegistry=G.TypeBoxError=G.TypeRegistry=G.PatternStringExact=G.PatternNumberExact=G.PatternBooleanExact=G.PatternString=G.PatternNumber=G.PatternBoolean=G.Kind=G.Hint=G.Optional=G.Readonly=G.Transform=void 0;G.Transform=Symbol.for("TypeBox.Transform");G.Readonly=Symbol.for("TypeBox.Readonly");G.Optional=Symbol.for("TypeBox.Optional");G.Hint=Symbol.for("TypeBox.Hint");G.Kind=Symbol.for("TypeBox.Kind");G.PatternBoolean="(true|false)";G.PatternNumber="(0|[1-9][0-9]*)";G.PatternString="(.*)";G.PatternBooleanExact=`^${G.PatternBoolean}$`;G.PatternNumberExact=`^${G.PatternNumber}$`;G.PatternStringExact=`^${G.PatternString}$`;var rY;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(rY||(G.TypeRegistry=rY={}));var Lu=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Lu;var vAe;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(vAe||(G.FormatRegistry=vAe={}));var Be;(function(t){function e(c){return Array.isArray(c)}o(e,"IsArray");t.IsArray=e;function r(c){return typeof c==="bigint"}o(r,"IsBigInt");t.IsBigInt=r;function n(c){return typeof c==="boolean"}o(n,"IsBoolean");t.IsBoolean=n;function i(c){return c===null}o(i,"IsNull");t.IsNull=i;function s(c){return typeof c==="number"}o(s,"IsNumber");t.IsNumber=s;function a(c){return typeof c==="object"&&c!==null}o(a,"IsObject");t.IsObject=a;function u(c){return typeof c==="string"}o(u,"IsString");t.IsString=u;function l(c){return c===void 0}o(l,"IsUndefined");t.IsUndefined=l})(Be||(G.ValueGuard=Be={}));var nY=class extends Lu{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=nY;var Y;(function(t){function e(x){try{new RegExp(x);return true}catch{return false}}o(e,"IsPattern");function r(x){if(!Be.IsString(x))return false;for(let ie=0;ie<x.length;ie++){const ce=x.charCodeAt(ie);if(ce>=7&&ce<=13||ce===27||ce===127){return false}}return true}o(r,"IsControlCharacterFree");function n(x){return a(x)||J(x)}o(n,"IsAdditionalProperties");function i(x){return Be.IsUndefined(x)||Be.IsBigInt(x)}o(i,"IsOptionalBigInt");function s(x){return Be.IsUndefined(x)||Be.IsNumber(x)}o(s,"IsOptionalNumber");function a(x){return Be.IsUndefined(x)||Be.IsBoolean(x)}o(a,"IsOptionalBoolean");function u(x){return Be.IsUndefined(x)||Be.IsString(x)}o(u,"IsOptionalString");function l(x){return Be.IsUndefined(x)||Be.IsString(x)&&r(x)&&e(x)}o(l,"IsOptionalPattern");function c(x){return Be.IsUndefined(x)||Be.IsString(x)&&r(x)}o(c,"IsOptionalFormat");function d(x){return Be.IsUndefined(x)||J(x)}o(d,"IsOptionalSchema");function p(x){return T(x,"Any")&&u(x.$id)}o(p,"TAny");t.TAny=p;function f(x){return T(x,"Array")&&x.type==="array"&&u(x.$id)&&J(x.items)&&s(x.minItems)&&s(x.maxItems)&&a(x.uniqueItems)&&d(x.contains)&&s(x.minContains)&&s(x.maxContains)}o(f,"TArray");t.TArray=f;function h(x){return T(x,"AsyncIterator")&&x.type==="AsyncIterator"&&u(x.$id)&&J(x.items)}o(h,"TAsyncIterator");t.TAsyncIterator=h;function m(x){return T(x,"BigInt")&&x.type==="bigint"&&u(x.$id)&&i(x.exclusiveMaximum)&&i(x.exclusiveMinimum)&&i(x.maximum)&&i(x.minimum)&&i(x.multipleOf)}o(m,"TBigInt");t.TBigInt=m;function g(x){return T(x,"Boolean")&&x.type==="boolean"&&u(x.$id)}o(g,"TBoolean");t.TBoolean=g;function y(x){return T(x,"Constructor")&&x.type==="constructor"&&u(x.$id)&&Be.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(y,"TConstructor");t.TConstructor=y;function v(x){return T(x,"Date")&&x.type==="Date"&&u(x.$id)&&s(x.exclusiveMaximumTimestamp)&&s(x.exclusiveMinimumTimestamp)&&s(x.maximumTimestamp)&&s(x.minimumTimestamp)&&s(x.multipleOfTimestamp)}o(v,"TDate");t.TDate=v;function w(x){return T(x,"Function")&&x.type==="function"&&u(x.$id)&&Be.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(w,"TFunction");t.TFunction=w;function E(x){return T(x,"Integer")&&x.type==="integer"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(E,"TInteger");t.TInteger=E;function b(x){return T(x,"Intersect")&&(Be.IsString(x.type)&&x.type!=="object"?false:true)&&Be.IsArray(x.allOf)&&x.allOf.every(ie=>J(ie)&&!Le(ie))&&u(x.type)&&(a(x.unevaluatedProperties)||d(x.unevaluatedProperties))&&u(x.$id)}o(b,"TIntersect");t.TIntersect=b;function S(x){return T(x,"Iterator")&&x.type==="Iterator"&&u(x.$id)&&J(x.items)}o(S,"TIterator");t.TIterator=S;function T(x,ie){return A(x)&&x[G.Kind]===ie}o(T,"TKindOf");t.TKindOf=T;function A(x){return Be.IsObject(x)&&G.Kind in x&&Be.IsString(x[G.Kind])}o(A,"TKind");t.TKind=A;function R(x){return B(x)&&Be.IsString(x.const)}o(R,"TLiteralString");t.TLiteralString=R;function O(x){return B(x)&&Be.IsNumber(x.const)}o(O,"TLiteralNumber");t.TLiteralNumber=O;function j(x){return B(x)&&Be.IsBoolean(x.const)}o(j,"TLiteralBoolean");t.TLiteralBoolean=j;function B(x){return T(x,"Literal")&&u(x.$id)&&(Be.IsBoolean(x.const)||Be.IsNumber(x.const)||Be.IsString(x.const))}o(B,"TLiteral");t.TLiteral=B;function U(x){return T(x,"Never")&&Be.IsObject(x.not)&&Object.getOwnPropertyNames(x.not).length===0}o(U,"TNever");t.TNever=U;function Q(x){return T(x,"Not")&&J(x.not)}o(Q,"TNot");t.TNot=Q;function oe(x){return T(x,"Null")&&x.type==="null"&&u(x.$id)}o(oe,"TNull");t.TNull=oe;function Te(x){return T(x,"Number")&&x.type==="number"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(Te,"TNumber");t.TNumber=Te;function le(x){return T(x,"Object")&&x.type==="object"&&u(x.$id)&&Be.IsObject(x.properties)&&n(x.additionalProperties)&&s(x.minProperties)&&s(x.maxProperties)&&Object.entries(x.properties).every(([ie,ce])=>r(ie)&&J(ce))}o(le,"TObject");t.TObject=le;function ue(x){return T(x,"Promise")&&x.type==="Promise"&&u(x.$id)&&J(x.item)}o(ue,"TPromise");t.TPromise=ue;function xe(x){return T(x,"Record")&&x.type==="object"&&u(x.$id)&&n(x.additionalProperties)&&Be.IsObject(x.patternProperties)&&(ie=>{const ce=Object.getOwnPropertyNames(ie.patternProperties);return ce.length===1&&e(ce[0])&&Be.IsObject(ie.patternProperties)&&J(ie.patternProperties[ce[0]])})(x)}o(xe,"TRecord");t.TRecord=xe;function we(x){return Be.IsObject(x)&&G.Hint in x&&x[G.Hint]==="Recursive"}o(we,"TRecursive");t.TRecursive=we;function Pe(x){return T(x,"Ref")&&u(x.$id)&&Be.IsString(x.$ref)}o(Pe,"TRef");t.TRef=Pe;function Ue(x){return T(x,"String")&&x.type==="string"&&u(x.$id)&&s(x.minLength)&&s(x.maxLength)&&l(x.pattern)&&c(x.format)}o(Ue,"TString");t.TString=Ue;function $e(x){return T(x,"Symbol")&&x.type==="symbol"&&u(x.$id)}o($e,"TSymbol");t.TSymbol=$e;function ge(x){return T(x,"TemplateLiteral")&&x.type==="string"&&Be.IsString(x.pattern)&&x.pattern[0]==="^"&&x.pattern[x.pattern.length-1]==="$"}o(ge,"TTemplateLiteral");t.TTemplateLiteral=ge;function Je(x){return T(x,"This")&&u(x.$id)&&Be.IsString(x.$ref)}o(Je,"TThis");t.TThis=Je;function Le(x){return Be.IsObject(x)&&G.Transform in x}o(Le,"TTransform");t.TTransform=Le;function Ie(x){return T(x,"Tuple")&&x.type==="array"&&u(x.$id)&&Be.IsNumber(x.minItems)&&Be.IsNumber(x.maxItems)&&x.minItems===x.maxItems&&(Be.IsUndefined(x.items)&&Be.IsUndefined(x.additionalItems)&&x.minItems===0||Be.IsArray(x.items)&&x.items.every(ie=>J(ie)))}o(Ie,"TTuple");t.TTuple=Ie;function Qe(x){return T(x,"Undefined")&&x.type==="undefined"&&u(x.$id)}o(Qe,"TUndefined");t.TUndefined=Qe;function qe(x){return C(x)&&x.anyOf.every(ie=>R(ie)||O(ie))}o(qe,"TUnionLiteral");t.TUnionLiteral=qe;function C(x){return T(x,"Union")&&u(x.$id)&&Be.IsObject(x)&&Be.IsArray(x.anyOf)&&x.anyOf.every(ie=>J(ie))}o(C,"TUnion");t.TUnion=C;function P(x){return T(x,"Uint8Array")&&x.type==="Uint8Array"&&u(x.$id)&&s(x.minByteLength)&&s(x.maxByteLength)}o(P,"TUint8Array");t.TUint8Array=P;function q(x){return T(x,"Unknown")&&u(x.$id)}o(q,"TUnknown");t.TUnknown=q;function z(x){return T(x,"Unsafe")}o(z,"TUnsafe");t.TUnsafe=z;function W(x){return T(x,"Void")&&x.type==="void"&&u(x.$id)}o(W,"TVoid");t.TVoid=W;function K(x){return Be.IsObject(x)&&x[G.Readonly]==="Readonly"}o(K,"TReadonly");t.TReadonly=K;function se(x){return Be.IsObject(x)&&x[G.Optional]==="Optional"}o(se,"TOptional");t.TOptional=se;function J(x){return Be.IsObject(x)&&(p(x)||f(x)||g(x)||m(x)||h(x)||y(x)||v(x)||w(x)||E(x)||b(x)||S(x)||B(x)||U(x)||Q(x)||oe(x)||Te(x)||le(x)||ue(x)||xe(x)||Pe(x)||Ue(x)||$e(x)||ge(x)||Je(x)||Ie(x)||Qe(x)||C(x)||P(x)||q(x)||z(x)||W(x)||A(x)&&rY.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var _Ae;(function(t){function e(r){return r[G.Kind]==="Intersect"?r.allOf.every(n=>e(n)):r[G.Kind]==="Union"?r.anyOf.some(n=>e(n)):r[G.Kind]==="Undefined"?true:r[G.Kind]==="Not"?!e(r.not):false}o(e,"Check");t.Check=e})(_Ae||(G.ExtendsUndefined=_Ae={}));var Ox=class extends Lu{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Ox;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var qm;(function(t){function e(F){return F===Ee.False?F:Ee.True}o(e,"IntoBooleanResult");function r(F){throw new Ox(F)}o(r,"Throw");function n(F){return Y.TNever(F)||Y.TIntersect(F)||Y.TUnion(F)||Y.TUnknown(F)||Y.TAny(F)}o(n,"IsStructuralRight");function i(F,$){return Y.TNever($)?T(F,$):Y.TIntersect($)?w(F,$):Y.TUnion($)?Xe(F,$):Y.TUnknown($)?tr(F,$):Y.TAny($)?s(F,$):r("StructuralRight")}o(i,"StructuralRight");function s(F,$){return Ee.True}o(s,"TAnyRight");function a(F,$){return Y.TIntersect($)?w(F,$):Y.TUnion($)&&$.anyOf.some(Ye=>Y.TAny(Ye)||Y.TUnknown(Ye))?Ee.True:Y.TUnion($)?Ee.Union:Y.TUnknown($)?Ee.True:Y.TAny($)?Ee.True:Ee.Union}o(a,"TAny");function u(F,$){return Y.TUnknown(F)?Ee.False:Y.TAny(F)?Ee.Union:Y.TNever(F)?Ee.True:Ee.False}o(u,"TArrayRight");function l(F,$){return Y.TObject($)&&ge($)?Ee.True:n($)?i(F,$):!Y.TArray($)?Ee.False:e(ft(F.items,$.items))}o(l,"TArray");function c(F,$){return n($)?i(F,$):!Y.TAsyncIterator($)?Ee.False:e(ft(F.items,$.items))}o(c,"TAsyncIterator");function d(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TBigInt($)?Ee.True:Ee.False}o(d,"TBigInt");function p(F,$){return Y.TLiteral(F)&&Be.IsBoolean(F.const)?Ee.True:Y.TBoolean(F)?Ee.True:Ee.False}o(p,"TBooleanRight");function f(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TBoolean($)?Ee.True:Ee.False}o(f,"TBoolean");function h(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):!Y.TConstructor($)?Ee.False:F.parameters.length>$.parameters.length?Ee.False:!F.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(F.returns,$.returns))}o(h,"TConstructor");function m(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TDate($)?Ee.True:Ee.False}o(m,"TDate");function g(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):!Y.TFunction($)?Ee.False:F.parameters.length>$.parameters.length?Ee.False:!F.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(F.returns,$.returns))}o(g,"TFunction");function y(F,$){return Y.TLiteral(F)&&Be.IsNumber(F.const)?Ee.True:Y.TNumber(F)||Y.TInteger(F)?Ee.True:Ee.False}o(y,"TIntegerRight");function v(F,$){return Y.TInteger($)||Y.TNumber($)?Ee.True:n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Ee.False}o(v,"TInteger");function w(F,$){return $.allOf.every(Ye=>ft(F,Ye)===Ee.True)?Ee.True:Ee.False}o(w,"TIntersectRight");function E(F,$){return F.allOf.some(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(E,"TIntersect");function b(F,$){return n($)?i(F,$):!Y.TIterator($)?Ee.False:e(ft(F.items,$.items))}o(b,"TIterator");function S(F,$){return Y.TLiteral($)&&$.const===F.const?Ee.True:n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TString($)?W(F,$):Y.TNumber($)?B(F,$):Y.TInteger($)?y(F,$):Y.TBoolean($)?p(F,$):Ee.False}o(S,"TLiteral");function T(F,$){return Ee.False}o(T,"TNeverRight");function A(F,$){return Ee.True}o(A,"TNever");function R(F){let[$,Ye]=[F,0];while(true){if(!Y.TNot($))break;$=$.not;Ye+=1}return Ye%2===0?$:G.Type.Unknown()}o(R,"UnwrapTNot");function O(F,$){return Y.TNot(F)?ft(R(F),$):Y.TNot($)?ft(F,R($)):r("Invalid fallthrough for Not")}o(O,"TNot");function j(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TNull($)?Ee.True:Ee.False}o(j,"TNull");function B(F,$){return Y.TLiteralNumber(F)?Ee.True:Y.TNumber(F)||Y.TInteger(F)?Ee.True:Ee.False}o(B,"TNumberRight");function U(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TInteger($)||Y.TNumber($)?Ee.True:Ee.False}o(U,"TNumber");function Q(F,$){return Object.getOwnPropertyNames(F.properties).length===$}o(Q,"IsObjectPropertyCount");function oe(F){return ge(F)}o(oe,"IsObjectStringLike");function Te(F){return Q(F,0)||Q(F,1)&&"description"in F.properties&&Y.TUnion(F.properties.description)&&F.properties.description.anyOf.length===2&&(Y.TString(F.properties.description.anyOf[0])&&Y.TUndefined(F.properties.description.anyOf[1])||Y.TString(F.properties.description.anyOf[1])&&Y.TUndefined(F.properties.description.anyOf[0]))}o(Te,"IsObjectSymbolLike");function le(F){return Q(F,0)}o(le,"IsObjectNumberLike");function ue(F){return Q(F,0)}o(ue,"IsObjectBooleanLike");function xe(F){return Q(F,0)}o(xe,"IsObjectBigIntLike");function we(F){return Q(F,0)}o(we,"IsObjectDateLike");function Pe(F){return ge(F)}o(Pe,"IsObjectUint8ArrayLike");function Ue(F){const $=G.Type.Number();return Q(F,0)||Q(F,1)&&"length"in F.properties&&e(ft(F.properties["length"],$))===Ee.True}o(Ue,"IsObjectFunctionLike");function $e(F){return Q(F,0)}o($e,"IsObjectConstructorLike");function ge(F){const $=G.Type.Number();return Q(F,0)||Q(F,1)&&"length"in F.properties&&e(ft(F.properties["length"],$))===Ee.True}o(ge,"IsObjectArrayLike");function Je(F){const $=G.Type.Function([G.Type.Any()],G.Type.Any());return Q(F,0)||Q(F,1)&&"then"in F.properties&&e(ft(F.properties["then"],$))===Ee.True}o(Je,"IsObjectPromiseLike");function Le(F,$){return ft(F,$)===Ee.False?Ee.False:Y.TOptional(F)&&!Y.TOptional($)?Ee.False:Ee.True}o(Le,"Property");function Ie(F,$){return Y.TUnknown(F)?Ee.False:Y.TAny(F)?Ee.Union:Y.TNever(F)||Y.TLiteralString(F)&&oe($)||Y.TLiteralNumber(F)&&le($)||Y.TLiteralBoolean(F)&&ue($)||Y.TSymbol(F)&&Te($)||Y.TBigInt(F)&&xe($)||Y.TString(F)&&oe($)||Y.TSymbol(F)&&Te($)||Y.TNumber(F)&&le($)||Y.TInteger(F)&&le($)||Y.TBoolean(F)&&ue($)||Y.TUint8Array(F)&&Pe($)||Y.TDate(F)&&we($)||Y.TConstructor(F)&&$e($)||Y.TFunction(F)&&Ue($)?Ee.True:Y.TRecord(F)&&Y.TString(C(F))?(()=>{return $[G.Hint]==="Record"?Ee.True:Ee.False})():Y.TRecord(F)&&Y.TNumber(C(F))?(()=>{return Q($,0)?Ee.True:Ee.False})():Ee.False}o(Ie,"TObjectRight");function Qe(F,$){return n($)?i(F,$):Y.TRecord($)?q(F,$):!Y.TObject($)?Ee.False:(()=>{for(const Ye of Object.getOwnPropertyNames($.properties)){if(!(Ye in F.properties))return Ee.False;if(Le(F.properties[Ye],$.properties[Ye])===Ee.False){return Ee.False}}return Ee.True})()}o(Qe,"TObject");function qe(F,$){return n($)?i(F,$):Y.TObject($)&&Je($)?Ee.True:!Y.TPromise($)?Ee.False:e(ft(F.item,$.item))}o(qe,"TPromise");function C(F){return G.PatternNumberExact in F.patternProperties?G.Type.Number():G.PatternStringExact in F.patternProperties?G.Type.String():r("Unknown record key pattern")}o(C,"RecordKey");function P(F){return G.PatternNumberExact in F.patternProperties?F.patternProperties[G.PatternNumberExact]:G.PatternStringExact in F.patternProperties?F.patternProperties[G.PatternStringExact]:r("Unable to get record value schema")}o(P,"RecordValue");function q(F,$){const[Ye,cr]=[C($),P($)];return Y.TLiteralString(F)&&Y.TNumber(Ye)&&e(ft(F,cr))===Ee.True?Ee.True:Y.TUint8Array(F)&&Y.TNumber(Ye)?ft(F,cr):Y.TString(F)&&Y.TNumber(Ye)?ft(F,cr):Y.TArray(F)&&Y.TNumber(Ye)?ft(F,cr):Y.TObject(F)?(()=>{for(const vi of Object.getOwnPropertyNames(F.properties)){if(Le(cr,F.properties[vi])===Ee.False){return Ee.False}}return Ee.True})():Ee.False}o(q,"TRecordRight");function z(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):!Y.TRecord($)?Ee.False:ft(P(F),P($))}o(z,"TRecord");function W(F,$){return Y.TLiteral(F)&&Be.IsString(F.const)?Ee.True:Y.TString(F)?Ee.True:Ee.False}o(W,"TStringRight");function K(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TString($)?Ee.True:Ee.False}o(K,"TString");function se(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TSymbol($)?Ee.True:Ee.False}o(se,"TSymbol");function J(F,$){return Y.TTemplateLiteral(F)?ft(nd.Resolve(F),$):Y.TTemplateLiteral($)?ft(F,nd.Resolve($)):r("Invalid fallthrough for TemplateLiteral")}o(J,"TTemplateLiteral");function x(F,$){return Y.TArray($)&&F.items!==void 0&&F.items.every(Ye=>ft(Ye,$.items)===Ee.True)}o(x,"IsArrayOfTuple");function ie(F,$){return Y.TNever(F)?Ee.True:Y.TUnknown(F)?Ee.False:Y.TAny(F)?Ee.Union:Ee.False}o(ie,"TTupleRight");function ce(F,$){return n($)?i(F,$):Y.TObject($)&&ge($)?Ee.True:Y.TArray($)&&x(F,$)?Ee.True:!Y.TTuple($)?Ee.False:Be.IsUndefined(F.items)&&!Be.IsUndefined($.items)||!Be.IsUndefined(F.items)&&Be.IsUndefined($.items)?Ee.False:Be.IsUndefined(F.items)&&!Be.IsUndefined($.items)?Ee.True:F.items.every((Ye,cr)=>ft(Ye,$.items[cr])===Ee.True)?Ee.True:Ee.False}o(ce,"TTuple");function ve(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TUint8Array($)?Ee.True:Ee.False}o(ve,"TUint8Array");function je(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TVoid($)?Et(F,$):Y.TUndefined($)?Ee.True:Ee.False}o(je,"TUndefined");function Xe(F,$){return $.anyOf.some(Ye=>ft(F,Ye)===Ee.True)?Ee.True:Ee.False}o(Xe,"TUnionRight");function _t(F,$){return F.anyOf.every(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(_t,"TUnion");function tr(F,$){return Ee.True}o(tr,"TUnknownRight");function lr(F,$){return Y.TNever($)?T(F,$):Y.TIntersect($)?w(F,$):Y.TUnion($)?Xe(F,$):Y.TAny($)?s(F,$):Y.TString($)?W(F,$):Y.TNumber($)?B(F,$):Y.TInteger($)?y(F,$):Y.TBoolean($)?p(F,$):Y.TArray($)?u(F,$):Y.TTuple($)?ie(F,$):Y.TObject($)?Ie(F,$):Y.TUnknown($)?Ee.True:Ee.False}o(lr,"TUnknown");function Et(F,$){return Y.TUndefined(F)?Ee.True:Y.TUndefined(F)?Ee.True:Ee.False}o(Et,"VoidRight");function xt(F,$){return Y.TIntersect($)?w(F,$):Y.TUnion($)?Xe(F,$):Y.TUnknown($)?tr(F,$):Y.TAny($)?s(F,$):Y.TObject($)?Ie(F,$):Y.TVoid($)?Ee.True:Ee.False}o(xt,"TVoid");function ft(F,$){return Y.TTemplateLiteral(F)||Y.TTemplateLiteral($)?J(F,$):Y.TNot(F)||Y.TNot($)?O(F,$):Y.TAny(F)?a(F,$):Y.TArray(F)?l(F,$):Y.TBigInt(F)?d(F,$):Y.TBoolean(F)?f(F,$):Y.TAsyncIterator(F)?c(F,$):Y.TConstructor(F)?h(F,$):Y.TDate(F)?m(F,$):Y.TFunction(F)?g(F,$):Y.TInteger(F)?v(F,$):Y.TIntersect(F)?E(F,$):Y.TIterator(F)?b(F,$):Y.TLiteral(F)?S(F,$):Y.TNever(F)?A(F,$):Y.TNull(F)?j(F,$):Y.TNumber(F)?U(F,$):Y.TObject(F)?Qe(F,$):Y.TRecord(F)?z(F,$):Y.TString(F)?K(F,$):Y.TSymbol(F)?se(F,$):Y.TTuple(F)?ce(F,$):Y.TPromise(F)?qe(F,$):Y.TUint8Array(F)?ve(F,$):Y.TUndefined(F)?je(F,$):Y.TUnion(F)?_t(F,$):Y.TUnknown(F)?lr(F,$):Y.TVoid(F)?xt(F,$):r(`Unknown left type operand '${F[G.Kind]}'`)}o(ft,"Visit");function en(F,$){return ft(F,$)}o(en,"Extends");t.Extends=en})(qm||(G.TypeExtends=qm={}));var ct;(function(t){function e(a){const u=Object.getOwnPropertyNames(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});const l=Object.getOwnPropertySymbols(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});return{...u,...l}}o(e,"ObjectType");function r(a){return a.map(u=>n(u))}o(r,"ArrayType");function n(a){return Be.IsArray(a)?r(a):Be.IsObject(a)?e(a):a}o(n,"Visit");function i(a){return a.map(u=>s(u))}o(i,"Rest");t.Rest=i;function s(a,u={}){return{...n(a),...u}}o(s,"Type");t.Type=s})(ct||(G.TypeClone=ct={}));var iY;(function(t){function e(h){return h.map(m=>{const{[G.Optional]:g,...y}=ct.Type(m);return y})}o(e,"OptionalUnwrap");function r(h){return h.every(m=>Y.TOptional(m))}o(r,"IsIntersectOptional");function n(h){return h.some(m=>Y.TOptional(m))}o(n,"IsUnionOptional");function i(h){return r(h.allOf)?G.Type.Optional(G.Type.Intersect(e(h.allOf))):h}o(i,"ResolveIntersect");function s(h){return n(h.anyOf)?G.Type.Optional(G.Type.Union(e(h.anyOf))):h}o(s,"ResolveUnion");function a(h){return h[G.Kind]==="Intersect"?i(h):h[G.Kind]==="Union"?s(h):h}o(a,"ResolveOptional");function u(h,m){const g=h.allOf.reduce((y,v)=>{const w=p(v,m);return w[G.Kind]==="Never"?y:[...y,w]},[]);return a(G.Type.Intersect(g))}o(u,"TIntersect");function l(h,m){const g=h.anyOf.map(y=>p(y,m));return a(G.Type.Union(g))}o(l,"TUnion");function c(h,m){const g=h.properties[m];return Be.IsUndefined(g)?G.Type.Never():G.Type.Union([g])}o(c,"TObject");function d(h,m){const g=h.items;if(Be.IsUndefined(g))return G.Type.Never();const y=g[m];if(Be.IsUndefined(y))return G.Type.Never();return y}o(d,"TTuple");function p(h,m){return h[G.Kind]==="Intersect"?u(h,m):h[G.Kind]==="Union"?l(h,m):h[G.Kind]==="Object"?c(h,m):h[G.Kind]==="Tuple"?d(h,m):G.Type.Never()}o(p,"Visit");function f(h,m,g={}){const y=m.map(v=>p(h,v.toString()));return a(G.Type.Union(y,g))}o(f,"Resolve");t.Resolve=f})(iY||(G.IndexedAccessor=iY={}));var Yy;(function(t){function e(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toLowerCase()}${f}`}o(e,"Uncapitalize");function r(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toUpperCase()}${f}`}o(r,"Capitalize");function n(d){return d.toUpperCase()}o(n,"Uppercase");function i(d){return d.toLowerCase()}o(i,"Lowercase");function s(d,p){const f=Jy.ParseExact(d.pattern);const h=Qy.Check(f);if(!h)return{...d,pattern:a(d.pattern,p)};const m=[...Xy.Generate(f)];const g=m.map(w=>G.Type.Literal(w));const y=u(g,p);const v=G.Type.Union(y);return G.Type.TemplateLiteral([v])}o(s,"IntrinsicTemplateLiteral");function a(d,p){return typeof d==="string"?p==="Uncapitalize"?e(d):p==="Capitalize"?r(d):p==="Uppercase"?n(d):p==="Lowercase"?i(d):d:d.toString()}o(a,"IntrinsicLiteral");function u(d,p){if(d.length===0)return[];const[f,...h]=d;return[c(f,p),...u(h,p)]}o(u,"IntrinsicRest");function l(d,p){return Y.TTemplateLiteral(d)?s(d,p):Y.TUnion(d)?G.Type.Union(u(d.anyOf,p)):Y.TLiteral(d)?G.Type.Literal(a(d.const,p)):d}o(l,"Visit");function c(d,p){return l(d,p)}o(c,"Map");t.Map=c})(Yy||(G.Intrinsic=Yy={}));var Wy;(function(t){function e(a,u){return G.Type.Intersect(a.allOf.map(l=>i(l,u)),{...a})}o(e,"TIntersect");function r(a,u){return G.Type.Union(a.anyOf.map(l=>i(l,u)),{...a})}o(r,"TUnion");function n(a,u){return u(a)}o(n,"TObject");function i(a,u){return a[G.Kind]==="Intersect"?e(a,u):a[G.Kind]==="Union"?r(a,u):a[G.Kind]==="Object"?n(a,u):a}o(i,"Visit");function s(a,u,l){return{...i(ct.Type(a),u),...l}}o(s,"Map");t.Map=s})(Wy||(G.ObjectMap=Wy={}));var Nx;(function(t){function e(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}o(e,"UnwrapPattern");function r(c,d){return c.allOf.reduce((p,f)=>[...p,...a(f,d)],[])}o(r,"TIntersect");function n(c,d){const p=c.anyOf.map(f=>a(f,d));return[...p.reduce((f,h)=>h.map(m=>p.every(g=>g.includes(m))?f.add(m):f)[0],new Set)]}o(n,"TUnion");function i(c,d){return Object.getOwnPropertyNames(c.properties)}o(i,"TObject");function s(c,d){return d.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}o(s,"TRecord");function a(c,d){return Y.TIntersect(c)?r(c,d):Y.TUnion(c)?n(c,d):Y.TObject(c)?i(c,d):Y.TRecord(c)?s(c,d):[]}o(a,"Visit");function u(c,d){return[...new Set(a(c,d))]}o(u,"ResolveKeys");t.ResolveKeys=u;function l(c){const d=u(c,{includePatterns:true});const p=d.map(f=>`(${e(f)})`);return`^(${p.join("|")})$`}o(l,"ResolvePattern");t.ResolvePattern=l})(Nx||(G.KeyResolver=Nx={}));var Ix=class extends Lu{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Ix;var fb;(function(t){function e(r){return Array.isArray(r)?r:Y.TUnionLiteral(r)?r.anyOf.map(n=>n.const.toString()):Y.TLiteral(r)?[r.const]:Y.TTemplateLiteral(r)?(()=>{const n=Jy.ParseExact(r.pattern);if(!Qy.Check(n))throw new Ix("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(fb||(G.KeyArrayResolver=fb={}));var sY;(function(t){function*e(n){for(const i of n.anyOf){if(i[G.Kind]==="Union"){yield*e(i)}else{yield i}}}o(e,"TUnion");function r(n){return G.Type.Union([...e(n)],{...n})}o(r,"Resolve");t.Resolve=r})(sY||(G.UnionResolver=sY={}));var Px=class extends Lu{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Px;var Dx;(function(t){function e(s){throw new Px(s)}o(e,"Throw");function r(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(r,"Escape");function n(s,a){return Y.TTemplateLiteral(s)?s.pattern.slice(1,s.pattern.length-1):Y.TUnion(s)?`(${s.anyOf.map(u=>n(u,a)).join("|")})`:Y.TNumber(s)?`${a}${G.PatternNumber}`:Y.TInteger(s)?`${a}${G.PatternNumber}`:Y.TBigInt(s)?`${a}${G.PatternNumber}`:Y.TString(s)?`${a}${G.PatternString}`:Y.TLiteral(s)?`${a}${r(s.const.toString())}`:Y.TBoolean(s)?`${a}${G.PatternBoolean}`:e(`Unexpected Kind '${s[G.Kind]}'`)}o(n,"Visit");function i(s){return`^${s.map(a=>n(a,"")).join("")}$`}o(i,"Create");t.Create=i})(Dx||(G.TemplateLiteralPattern=Dx={}));var nd;(function(t){function e(r){const n=Jy.ParseExact(r.pattern);if(!Qy.Check(n))return G.Type.String();const i=[...Xy.Generate(n)].map(s=>G.Type.Literal(s));return G.Type.Union(i)}o(e,"Resolve");t.Resolve=e})(nd||(G.TemplateLiteralResolver=nd={}));var hb=class extends Lu{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=hb;var Jy;(function(t){function e(h,m,g){return h[m]===g&&h.charCodeAt(m-1)!==92}o(e,"IsNonEscaped");function r(h,m){return e(h,m,"(")}o(r,"IsOpenParen");function n(h,m){return e(h,m,")")}o(n,"IsCloseParen");function i(h,m){return e(h,m,"|")}o(i,"IsSeparator");function s(h){if(!(r(h,0)&&n(h,h.length-1)))return false;let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(m===0&&g!==h.length-1)return false}return true}o(s,"IsGroup");function a(h){return h.slice(1,h.length-1)}o(a,"InGroup");function u(h){let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(i(h,g)&&m===0)return true}return false}o(u,"IsPrecedenceOr");function l(h){for(let m=0;m<h.length;m++){if(r(h,m))return true}return false}o(l,"IsPrecedenceAnd");function c(h){let[m,g]=[0,0];const y=[];for(let w=0;w<h.length;w++){if(r(h,w))m+=1;if(n(h,w))m-=1;if(i(h,w)&&m===0){const E=h.slice(g,w);if(E.length>0)y.push(p(E));g=w+1}}const v=h.slice(g);if(v.length>0)y.push(p(v));if(y.length===0)return{type:"const",const:""};if(y.length===1)return y[0];return{type:"or",expr:y}}o(c,"Or");function d(h){function m(v,w){if(!r(v,w))throw new hb(`TemplateLiteralParser: Index must point to open parens`);let E=0;for(let b=w;b<v.length;b++){if(r(v,b))E+=1;if(n(v,b))E-=1;if(E===0)return[w,b]}throw new hb(`TemplateLiteralParser: Unclosed group parens in expression`)}o(m,"Group");function g(v,w){for(let E=w;E<v.length;E++){if(r(v,E))return[w,E]}return[w,v.length]}o(g,"Range");const y=[];for(let v=0;v<h.length;v++){if(r(h,v)){const[w,E]=m(h,v);const b=h.slice(w,E+1);y.push(p(b));v=E}else{const[w,E]=g(h,v);const b=h.slice(w,E);if(b.length>0)y.push(p(b));v=E-1}}return y.length===0?{type:"const",const:""}:y.length===1?y[0]:{type:"and",expr:y}}o(d,"And");function p(h){return s(h)?p(a(h)):u(h)?c(h):l(h)?d(h):{type:"const",const:h}}o(p,"Parse");t.Parse=p;function f(h){return p(h.slice(1,h.length-1))}o(f,"ParseExact");t.ParseExact=f})(Jy||(G.TemplateLiteralParser=Jy={}));var kx=class extends Lu{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=kx;var Qy;(function(t){function e(a){throw new kx(a)}o(e,"Throw");function r(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="0"&&a.expr[1].type==="const"&&a.expr[1].const==="[1-9][0-9]*"}o(r,"IsNumber");function n(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="true"&&a.expr[1].type==="const"&&a.expr[1].const==="false"}o(n,"IsBoolean");function i(a){return a.type==="const"&&a.const===".*"}o(i,"IsString");function s(a){return n(a)?true:r(a)||i(a)?false:a.type==="and"?a.expr.every(u=>s(u)):a.type==="or"?a.expr.every(u=>s(u)):a.type==="const"?true:e(`Unknown expression type`)}o(s,"Check");t.Check=s})(Qy||(G.TemplateLiteralFinite=Qy={}));var $x=class extends Lu{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=$x;var Xy;(function(t){function*e(a){if(a.length===1)return yield*a[0];for(const u of a[0]){for(const l of e(a.slice(1))){yield`${u}${l}`}}}o(e,"Reduce");function*r(a){return yield*e(a.expr.map(u=>[...s(u)]))}o(r,"And");function*n(a){for(const u of a.expr)yield*s(u)}o(n,"Or");function*i(a){return yield a.const}o(i,"Const");function*s(a){return a.type==="and"?yield*r(a):a.type==="or"?yield*n(a):a.type==="const"?yield*i(a):(()=>{throw new $x("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var aY;(function(t){function*e(s){const a=s.trim().replace(/"|'/g,"");return a==="boolean"?yield G.Type.Boolean():a==="number"?yield G.Type.Number():a==="bigint"?yield G.Type.BigInt():a==="string"?yield G.Type.String():yield(()=>{const u=a.split("|").map(l=>G.Type.Literal(l.trim()));return u.length===0?G.Type.Never():u.length===1?u[0]:G.Type.Union(u)})()}o(e,"ParseUnion");function*r(s){if(s[1]!=="{"){const a=G.Type.Literal("$");const u=n(s.slice(1));return yield*[a,...u]}for(let a=2;a<s.length;a++){if(s[a]==="}"){const u=e(s.slice(2,a));const l=n(s.slice(a+1));return yield*[...u,...l]}}yield G.Type.Literal(s)}o(r,"ParseTerminal");function*n(s){for(let a=0;a<s.length;a++){if(s[a]==="$"){const u=G.Type.Literal(s.slice(0,a));const l=r(s.slice(a));return yield*[u,...l]}}yield G.Type.Literal(s)}o(n,"ParseLiteral");function i(s){return[...n(s)]}o(i,"Parse");t.Parse=i})(aY||(G.TemplateLiteralDslParser=aY={}));var Lx=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new qx(this.schema,e)}};G.TransformDecodeBuilder=Lx;var qx=class{static{o(this,"TransformEncodeBuilder")}constructor(e,r){this.schema=e;this.decode=r}Encode(e){const r=ct.Type(this.schema);return Y.TTransform(r)?(()=>{const n=o(a=>r[G.Transform].Encode(e(a)),"Encode");const i=o(a=>this.decode(r[G.Transform].Decode(a)),"Decode");const s={Encode:n,Decode:i};return{...r,[G.Transform]:s}})():(()=>{const n={Decode:this.decode,Encode:e};return{...r,[G.Transform]:n}})()}};G.TransformEncodeBuilder=qx;var I$t=0;var jx=class extends Lu{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=jx;var Ux=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new jx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=Ux;var mb=class extends Ux{static{o(this,"JsonTypeBuilder")}ReadonlyOptional(e){return this.Readonly(this.Optional(e))}Readonly(e){return{...ct.Type(e),[G.Readonly]:"Readonly"}}Optional(e){return{...ct.Type(e),[G.Optional]:"Optional"}}Any(e={}){return this.Create({...e,[G.Kind]:"Any"})}Array(e,r={}){return this.Create({...r,[G.Kind]:"Array",type:"array",items:ct.Type(e)})}Boolean(e={}){return this.Create({...e,[G.Kind]:"Boolean",type:"boolean"})}Capitalize(e,r={}){return{...Yy.Map(ct.Type(e),"Capitalize"),...r}}Composite(e,r){const n=G.Type.Intersect(e,{});const i=Nx.ResolveKeys(n,{includePatterns:false});const s=i.reduce((a,u)=>({...a,[u]:G.Type.Index(n,[u])}),{});return G.Type.Object(s,r)}Enum(e,r={}){const n=Object.getOwnPropertyNames(e).filter(s=>isNaN(s)).map(s=>e[s]);const i=n.map(s=>Be.IsString(s)?{[G.Kind]:"Literal",type:"string",const:s}:{[G.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[G.Kind]:"Union",anyOf:i})}Extends(e,r,n,i,s={}){switch(qm.Extends(e,r)){case Ee.Union:return this.Union([ct.Type(n,s),ct.Type(i,s)]);case Ee.True:return ct.Type(n,s);case Ee.False:return ct.Type(i,s)}}Exclude(e,r,n={}){return Y.TTemplateLiteral(e)?this.Exclude(nd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,nd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(nd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,nd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?ct.Type(e,n):this.Never(n)}Index(e,r,n={}){return Y.TArray(e)&&Y.TNumber(r)?(()=>{return ct.Type(e.items,n)})():Y.TTuple(e)&&Y.TNumber(r)?(()=>{const i=Be.IsUndefined(e.items)?[]:e.items;const s=i.map(a=>ct.Type(a));return this.Union(s,n)})():(()=>{const i=fb.Resolve(r);const s=ct.Type(e);return iY.Resolve(s,i,n)})()}Integer(e={}){return this.Create({...e,[G.Kind]:"Integer",type:"integer"})}Intersect(e,r={}){if(e.length===0)return G.Type.Never();if(e.length===1)return ct.Type(e[0],r);if(e.some(a=>Y.TTransform(a)))this.Throw("Cannot intersect transform types");const n=e.every(a=>Y.TObject(a));const i=ct.Rest(e);const s=Y.TSchema(r.unevaluatedProperties)?{unevaluatedProperties:ct.Type(r.unevaluatedProperties)}:{};return r.unevaluatedProperties===false||Y.TSchema(r.unevaluatedProperties)||n?this.Create({...r,...s,[G.Kind]:"Intersect",type:"object",allOf:i}):this.Create({...r,...s,[G.Kind]:"Intersect",allOf:i})}KeyOf(e,r={}){return Y.TRecord(e)?(()=>{const n=Object.getOwnPropertyNames(e.patternProperties)[0];return n===G.PatternNumberExact?this.Number(r):n===G.PatternStringExact?this.String(r):this.Throw("Unable to resolve key type from Record key pattern")})():Y.TTuple(e)?(()=>{const n=Be.IsUndefined(e.items)?[]:e.items;const i=n.map((s,a)=>G.Type.Literal(a.toString()));return this.Union(i,r)})():Y.TArray(e)?(()=>{return this.Number(r)})():(()=>{const n=Nx.ResolveKeys(e,{includePatterns:false});if(n.length===0)return this.Never(r);const i=n.map(s=>this.Literal(s));return this.Union(i,r)})()}Literal(e,r={}){return this.Create({...r,[G.Kind]:"Literal",const:e,type:typeof e})}Lowercase(e,r={}){return{...Yy.Map(ct.Type(e),"Lowercase"),...r}}Never(e={}){return this.Create({...e,[G.Kind]:"Never",not:{}})}Not(e,r){return this.Create({...r,[G.Kind]:"Not",not:ct.Type(e)})}Null(e={}){return this.Create({...e,[G.Kind]:"Null",type:"null"})}Number(e={}){return this.Create({...e,[G.Kind]:"Number",type:"number"})}Object(e,r={}){const n=Object.getOwnPropertyNames(e);const i=n.filter(l=>Y.TOptional(e[l]));const s=n.filter(l=>!i.includes(l));const a=Y.TSchema(r.additionalProperties)?{additionalProperties:ct.Type(r.additionalProperties)}:{};const u=n.reduce((l,c)=>({...l,[c]:ct.Type(e[c])}),{});return s.length>0?this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u,required:s}):this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u})}Omit(e,r,n={}){const i=fb.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Be.IsArray(s.required)){s.required=s.required.filter(a=>!i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Partial(e,r={}){return Wy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Optional(n.properties[a])}},{});return this.Object(i,this.Discard(n,"required"))},r)}Pick(e,r,n={}){const i=fb.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Be.IsArray(s.required)){s.required=s.required.filter(a=>i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(!i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Record(e,r,n={}){return Y.TTemplateLiteral(e)?(()=>{const i=Jy.ParseExact(e.pattern);return Qy.Check(i)?this.Object([...Xy.Generate(i)].reduce((s,a)=>({...s,[a]:ct.Type(r)}),{}),n):this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[e.pattern]:ct.Type(r)}})})():Y.TUnion(e)?(()=>{const i=sY.Resolve(e);if(Y.TUnionLiteral(i)){const s=i.anyOf.reduce((a,u)=>({...a,[u.const]:ct.Type(r)}),{});return this.Object(s,{...n,[G.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():Y.TLiteral(e)?(()=>{return Be.IsString(e.const)||Be.IsNumber(e.const)?this.Object({[e.const]:ct.Type(r)},n):this.Throw("Record key of type literal is not of type string or number")})():Y.TInteger(e)||Y.TNumber(e)?(()=>{return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[G.PatternNumberExact]:ct.Type(r)}})})():Y.TString(e)?(()=>{const i=Be.IsUndefined(e.pattern)?G.PatternStringExact:e.pattern;return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[i]:ct.Type(r)}})})():this.Never()}Recursive(e,r={}){if(Be.IsUndefined(r.$id))r.$id=`T${I$t++}`;const n=e({[G.Kind]:"This",$ref:`${r.$id}`});n.$id=r.$id;return this.Create({...r,[G.Hint]:"Recursive",...n})}Ref(e,r={}){if(Be.IsString(e))return this.Create({...r,[G.Kind]:"Ref",$ref:e});if(Be.IsUndefined(e.$id))this.Throw("Reference target type must specify an $id");return this.Create({...r,[G.Kind]:"Ref",$ref:e.$id})}Required(e,r={}){return Wy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Discard(n.properties[a],G.Optional)}},{});return this.Object(i,n)},r)}Rest(e){return Y.TTuple(e)&&!Be.IsUndefined(e.items)?ct.Rest(e.items):Y.TIntersect(e)?ct.Rest(e.allOf):Y.TUnion(e)?ct.Rest(e.anyOf):[]}String(e={}){return this.Create({...e,[G.Kind]:"String",type:"string"})}TemplateLiteral(e,r={}){const n=Be.IsString(e)?Dx.Create(aY.Parse(e)):Dx.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Lx(e)}Tuple(e,r={}){const[n,i,s]=[false,e.length,e.length];const a=ct.Rest(e);const u=e.length>0?{...r,[G.Kind]:"Tuple",type:"array",items:a,additionalItems:n,minItems:i,maxItems:s}:{...r,[G.Kind]:"Tuple",type:"array",minItems:i,maxItems:s};return this.Create(u)}Uncapitalize(e,r={}){return{...Yy.Map(ct.Type(e),"Uncapitalize"),...r}}Union(e,r={}){return Y.TTemplateLiteral(e)?nd.Resolve(e):(()=>{const n=e;if(n.length===0)return this.Never(r);if(n.length===1)return this.Create(ct.Type(n[0],r));const i=ct.Rest(n);return this.Create({...r,[G.Kind]:"Union",anyOf:i})})()}Unknown(e={}){return this.Create({...e,[G.Kind]:"Unknown"})}Unsafe(e={}){return this.Create({...e,[G.Kind]:e[G.Kind]||"Unsafe"})}Uppercase(e,r={}){return{...Yy.Map(ct.Type(e),"Uppercase"),...r}}};G.JsonTypeBuilder=mb;var Fx=class extends mb{static{o(this,"JavaScriptTypeBuilder")}AsyncIterator(e,r={}){return this.Create({...r,[G.Kind]:"AsyncIterator",type:"AsyncIterator",items:ct.Type(e)})}Awaited(e,r={}){const n=o(i=>i.length>0?(()=>{const[s,...a]=i;return[this.Awaited(s),...n(a)]})():i,"Unwrap");return Y.TIntersect(e)?G.Type.Intersect(n(e.allOf)):Y.TUnion(e)?G.Type.Union(n(e.anyOf)):Y.TPromise(e)?this.Awaited(e.item):ct.Type(e,r)}BigInt(e={}){return this.Create({...e,[G.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(e,r={}){return this.Tuple([...e.parameters],{...r})}Constructor(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Constructor",type:"constructor",parameters:i,returns:s})}Date(e={}){return this.Create({...e,[G.Kind]:"Date",type:"Date"})}Function(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Function",type:"function",parameters:i,returns:s})}InstanceType(e,r={}){return ct.Type(e.returns,r)}Iterator(e,r={}){return this.Create({...r,[G.Kind]:"Iterator",type:"Iterator",items:ct.Type(e)})}Parameters(e,r={}){return this.Tuple(e.parameters,{...r})}Promise(e,r={}){return this.Create({...r,[G.Kind]:"Promise",type:"Promise",item:ct.Type(e)})}RegExp(e,r={}){const n=Be.IsString(e)?e:e.source;return this.Create({...r,[G.Kind]:"String",type:"string",pattern:n})}RegEx(e,r={}){return this.RegExp(e,r)}ReturnType(e,r={}){return ct.Type(e.returns,r)}Symbol(e){return this.Create({...e,[G.Kind]:"Symbol",type:"symbol"})}Undefined(e={}){return this.Create({...e,[G.Kind]:"Undefined",type:"undefined"})}Uint8Array(e={}){return this.Create({...e,[G.Kind]:"Uint8Array",type:"Uint8Array"})}Void(e={}){return this.Create({...e,[G.Kind]:"Void",type:"void"})}};G.JavaScriptTypeBuilder=Fx;G.JsonType=new mb;G.Type=new Fx});var bAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.CustomTypeBuilder=void 0;var gb=EAe();var oY=class extends gb.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return gb.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return gb.Type.Union([e,gb.Type.Null()])}static StringEnum(e){return gb.Type.Unsafe({type:"string",enum:e})}};Mx.CustomTypeBuilder=oY});var AAe=_(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:true});lt.throwIfNotNumber=lt.throwIfNotString=lt.throwIfUndefinedOrNull=lt.throwIfUndefined=lt.ArgumentTypeError=lt.ArgumentUndefinedError=lt.ValidationError=lt.withUndefinedAsNull=lt.withNullAsUndefined=lt.validateConstraint=lt.validateConstraints=lt.areFunctions=lt.isFunction=lt.isEmptyObject=lt.assertAllDefined=lt.assertIsDefined=lt.assertType=lt.isUndefinedOrNull=lt.isDefined=lt.isUndefined=lt.isBoolean=lt.isIterable=lt.isNumber=lt.isTypedArray=lt.isObject=lt.isStringArray=lt.isString=void 0;function Bx(t){return typeof t==="string"}o(Bx,"isString");lt.isString=Bx;function P$t(t){return Array.isArray(t)&&t.every(e=>Bx(e))}o(P$t,"isStringArray");lt.isStringArray=P$t;function wAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(wAe,"isObject");lt.isObject=wAe;function D$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(D$t,"isTypedArray");lt.isTypedArray=D$t;function SAe(t){return typeof t==="number"&&!isNaN(t)}o(SAe,"isNumber");lt.isNumber=SAe;function k$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(k$t,"isIterable");lt.isIterable=k$t;function $$t(t){return t===true||t===false}o($$t,"isBoolean");lt.isBoolean=$$t;function uY(t){return typeof t==="undefined"}o(uY,"isUndefined");lt.isUndefined=uY;function L$t(t){return!Zy(t)}o(L$t,"isDefined");lt.isDefined=L$t;function Zy(t){return uY(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function q$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(q$t,"assertType");lt.assertType=q$t;function j$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(j$t,"assertIsDefined");lt.assertIsDefined=j$t;function U$t(...t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(Zy(n)){throw new Error(`Assertion Failed: argument at index ${r} is undefined or null`)}e.push(n)}return e}o(U$t,"assertAllDefined");lt.assertAllDefined=U$t;var F$t=Object.prototype.hasOwnProperty;function M$t(t){if(!wAe(t)){return false}for(const e in t){if(F$t.call(t,e)){return false}}return true}o(M$t,"isEmptyObject");lt.isEmptyObject=M$t;function lY(t){return typeof t==="function"}o(lY,"isFunction");lt.isFunction=lY;function B$t(...t){return t.length>0&&t.every(lY)}o(B$t,"areFunctions");lt.areFunctions=B$t;function V$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){TAe(t[n],e[n])}}o(V$t,"validateConstraints");lt.validateConstraints=V$t;function TAe(t,e){if(Bx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(lY(e)){try{if(t instanceof e){return}}catch{}if(!Zy(t)&&t.constructor===e){return}if(e.length===1&&e.call(void 0,t)===true){return}throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`)}}o(TAe,"validateConstraint");lt.validateConstraint=TAe;function H$t(t){return t===null?void 0:t}o(H$t,"withNullAsUndefined");lt.withNullAsUndefined=H$t;function z$t(t){return typeof t==="undefined"?null:t}o(z$t,"withUndefinedAsNull");lt.withUndefinedAsNull=z$t;var yb=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=yb;var vb=class extends yb{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=vb;var _b=class extends yb{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=_b;function G$t(t,e){if(uY(t)){throw new vb(e)}return true}o(G$t,"throwIfUndefined");lt.throwIfUndefined=G$t;function cY(t,e){if(Zy(t)){throw new vb(e)}}o(cY,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=cY;function K$t(t,e){cY(t,e);if(!Bx(t)){throw new _b(e,"string")}return true}o(K$t,"throwIfNotString");lt.throwIfNotString=K$t;function Y$t(t,e){cY(t,e);if(!SAe(t)){throw new _b(e,"number")}return true}o(Y$t,"throwIfNotNumber");lt.throwIfNotNumber=Y$t});var bb=_(Ae=>{"use strict";var xAe=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var W$t=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Vx=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null){for(var r in t)if(r!=="default"&&Object.prototype.hasOwnProperty.call(t,r))xAe(e,t,r)}W$t(e,t);return e};var _f=Ae&&Ae.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))xAe(e,t,r)};Object.defineProperty(Ae,"__esModule",{value:true});Ae.getRequiredEnvVar=Ae.env=Ae.EnvironmentalVariableRequiredError=Ae.xfs=Ae.RouteValidator=Ae.JsonValidator=Ae.MeteringService=Ae.TenantService=Ae.OpenFGAService=Ae.DevApiService=Ae.getContentApiStorageTarballPath=Ae.contentApiTarballFileName=Ae.ContentApiService=Ae.AuthApiService=Ae.getServiceAccountIdToken=Ae.createApiKeyServiceClient=Ae.ApiKeyService=Ae.RouteVersions=Ae.startsWithReservedKeyword=Ae.logger=Ae.createNewLogger=Ae.graphQL=Ae.CloudStorage=Ae.fly=Ae.ApiServer=Ae.featureFlagsPlugin=Ae.ensureZuploUserPlugin=Ae.ensureZuploAdminPlugin=Ae.ensureServiceAccountPlugin=Ae.apiKeyAuthPlugin=Ae.errorHandler=Ae.DeploymentLogState=Ae.signString=Ae.FeatureFlags=Ae.VALID_COMPATIBILITY_DATES=Ae.DEFAULT_COMPATIBILITY_DATE=Ae.COMPATIBILITY_FLAG_MAPPINGS=Ae.WARNING_STATUS=Ae.WARNING_SEVERITY=Ae.GOOD_STATUS=Ae.FAILURE_STATUS=Ae.ERROR_SEVERITY=Ae.BuildIssueError=Ae.hasBlockedNotifications=Ae.getDefaultFlags=Ae.getBuildFlagsForDeployment=Ae.CommonAuth=void 0;var dY=Vx(Oa());Ae.env=dY.default;Object.defineProperty(Ae,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return dY.EnvironmentalVariableRequiredError}});Object.defineProperty(Ae,"getRequiredEnvVar",{enumerable:true,get:function(){return dY.getRequiredEnvVar}});_f(As(),Ae);var J$t=iC();Object.defineProperty(Ae,"CommonAuth",{enumerable:true,get:function(){return J$t.CommonAuth}});var pY=BY();Object.defineProperty(Ae,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return pY.getBuildFlagsForDeployment}});Object.defineProperty(Ae,"getDefaultFlags",{enumerable:true,get:function(){return pY.getDefaultFlags}});Object.defineProperty(Ae,"hasBlockedNotifications",{enumerable:true,get:function(){return pY.hasBlockedNotifications}});var e2=VY();Object.defineProperty(Ae,"BuildIssueError",{enumerable:true,get:function(){return e2.BuildIssueError}});Object.defineProperty(Ae,"ERROR_SEVERITY",{enumerable:true,get:function(){return e2.ERROR_SEVERITY}});Object.defineProperty(Ae,"FAILURE_STATUS",{enumerable:true,get:function(){return e2.FAILURE_STATUS}});Object.defineProperty(Ae,"GOOD_STATUS",{enumerable:true,get:function(){return e2.GOOD_STATUS}});Object.defineProperty(Ae,"WARNING_SEVERITY",{enumerable:true,get:function(){return e2.WARNING_SEVERITY}});Object.defineProperty(Ae,"WARNING_STATUS",{enumerable:true,get:function(){return e2.WARNING_STATUS}});var Q$t=HY();Object.defineProperty(Ae,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return Q$t.COMPATIBILITY_FLAG_MAPPINGS}});var CAe=KY();Object.defineProperty(Ae,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return CAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(Ae,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return CAe.VALID_COMPATIBILITY_DATES}});var X$t=sC();Object.defineProperty(Ae,"FeatureFlags",{enumerable:true,get:function(){return X$t.FeatureFlags}});var Z$t=YY();Object.defineProperty(Ae,"signString",{enumerable:true,get:function(){return Z$t.signString}});_f(WY(),Ae);var eLt=uC();Object.defineProperty(Ae,"DeploymentLogState",{enumerable:true,get:function(){return eLt.DeploymentLogState}});_f(nW(),Ae);_f(lC(),Ae);var tLt=cC();Object.defineProperty(Ae,"errorHandler",{enumerable:true,get:function(){return tLt.errorHandler}});var Eb=mC();Object.defineProperty(Ae,"apiKeyAuthPlugin",{enumerable:true,get:function(){return Eb.apiKeyAuthPlugin}});Object.defineProperty(Ae,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return Eb.ensureServiceAccountPlugin}});Object.defineProperty(Ae,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return Eb.ensureZuploAdminPlugin}});Object.defineProperty(Ae,"ensureZuploUserPlugin",{enumerable:true,get:function(){return Eb.ensureZuploUserPlugin}});Object.defineProperty(Ae,"featureFlagsPlugin",{enumerable:true,get:function(){return Eb.featureFlagsPlugin}});var rLt=hge();Object.defineProperty(Ae,"ApiServer",{enumerable:true,get:function(){return rLt.ApiServer}});Ae.fly=Vx(yge());Ae.CloudStorage=Vx(sbe());var nLt=abe();Object.defineProperty(Ae,"graphQL",{enumerable:true,get:function(){return nLt.graphQL}});_f(O5e(),Ae);var RAe=Sj();Object.defineProperty(Ae,"createNewLogger",{enumerable:true,get:function(){return RAe.createNewLogger}});Object.defineProperty(Ae,"logger",{enumerable:true,get:function(){return RAe.logger}});var iLt=fH();Object.defineProperty(Ae,"startsWithReservedKeyword",{enumerable:true,get:function(){return iLt.startsWithReservedKeyword}});var sLt=N5e();Object.defineProperty(Ae,"RouteVersions",{enumerable:true,get:function(){return sLt.RouteVersions}});var OAe=eTe();Object.defineProperty(Ae,"ApiKeyService",{enumerable:true,get:function(){return OAe.ApiKeyService}});Object.defineProperty(Ae,"createApiKeyServiceClient",{enumerable:true,get:function(){return OAe.createApiKeyServiceClient}});var aLt=Ry();Object.defineProperty(Ae,"getServiceAccountIdToken",{enumerable:true,get:function(){return aLt.getServiceAccountIdToken}});var oLt=rTe();Object.defineProperty(Ae,"AuthApiService",{enumerable:true,get:function(){return oLt.AuthApiService}});var fY=aTe();Object.defineProperty(Ae,"ContentApiService",{enumerable:true,get:function(){return fY.ContentApiService}});Object.defineProperty(Ae,"contentApiTarballFileName",{enumerable:true,get:function(){return fY.contentApiTarballFileName}});Object.defineProperty(Ae,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return fY.getContentApiStorageTarballPath}});var uLt=lTe();Object.defineProperty(Ae,"DevApiService",{enumerable:true,get:function(){return uLt.DevApiService}});var lLt=cAe();Object.defineProperty(Ae,"OpenFGAService",{enumerable:true,get:function(){return lLt.OpenFGAService}});var cLt=fAe();Object.defineProperty(Ae,"TenantService",{enumerable:true,get:function(){return cLt.TenantService}});var dLt=gAe();Object.defineProperty(Ae,"MeteringService",{enumerable:true,get:function(){return dLt.MeteringService}});_f(yAe(),Ae);_f(bAe(),Ae);_f(AAe(),Ae);var pLt=k7();Object.defineProperty(Ae,"JsonValidator",{enumerable:true,get:function(){return pLt.JsonValidator}});var fLt=EH();Object.defineProperty(Ae,"RouteValidator",{enumerable:true,get:function(){return fLt.RouteValidator}});Ae.xfs=Vx(yB())});var wb=_(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:true});t2.runPlugins=t2.PluginResult=void 0;var hY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};t2.PluginResult=hY;async function hLt(t,e){const r=[];const n=[];const i=new Map;for await(const s of t){try{const a=await s(e,i);n.push(...a.errors.map(u=>{if(u.pluginName===""){u.pluginName=s.name}return u}));r.push(...a.warnings);if(a.errors.length>0){break}}catch(a){n.push(a);break}}return{errors:n,warnings:r}}o(hLt,"runPlugins");t2.runPlugins=hLt});var IAe=_((a0r,NAe)=>{"use strict";function mLt(t){return t>=55296&&t<=56319}o(mLt,"isHighSurrogate");function gLt(t){return t>=56320&&t<=57343}o(gLt,"isLowSurrogate");NAe.exports=o(function t(e,r,n){if(typeof r!=="string"){throw new Error("Input must be string")}var i=r.length;var s=0;var a;var u;for(var l=0;l<i;l+=1){a=r.charCodeAt(l);u=r[l];if(mLt(a)&&gLt(r.charCodeAt(l+1))){l+=1;u+=r[l]}s+=e(u);if(s===n){return r.slice(0,l+1)}else if(s>n){return r.slice(0,l-u.length+1)}}return r},"truncate")});var DAe=_((u0r,PAe)=>{"use strict";var yLt=IAe();var vLt=Buffer.byteLength.bind(Buffer);PAe.exports=yLt.bind(null,vLt)});var kAe=_(r2=>{"use strict";var _Lt=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.sanitize=void 0;var ELt=_Lt(DAe());var bLt=/[/?<>\\:*|"]/g;var wLt=/[\x00-\x1f\x80-\x9f]/g;var SLt=/^\.+$/;var TLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var ALt=/[. ]+$/;function xLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(bLt,e).replace(wLt,e).replace(SLt,e).replace(TLt,e).replace(ALt,e);return(0,ELt.default)(r,255)}o(xLt,"sanitize");r2.sanitize=xLt});var Kl=_(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:true});Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.NODE_BUILD_OUTPUT_FILE=Fe.NODE_ENTRY_NAME=Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE=Fe.WORKER_BUILD_OUTPUT_FILE=Fe.WORKER_ENTRY_NAME=Fe.ENV_MODULE_FILE=Fe.ZUPLO_SYSTEM_ENV_FILE=Fe.ENV_FILE=Fe.CACHE_DIRECTORY=Fe.BUILD_CACHE_FILE=Fe.ZUPLO_FILE_SCHEMA=Fe.NON_STANDARD_NODE_ENV=Fe.GENERATED_TYPES_DIR_NAME=Fe.GENERATED_BUILD_JSON_FILE=Fe.GENERATED_SOURCE_DIR_NAME=Fe.BUILD_OUTPUT_DIR=Fe.DEFAULT_TEST_FILE=Fe.DEFAULT_DOCS_MARKDOWN_FILE=Fe.DOCS_THEME_FILE=Fe.DOCS_SIDEBAR_FILE=Fe.ZUPLO_FALLBACK_JSON_FILE=Fe.ZUPLO_PREFERRED_JSON_FILE=Fe.DEFAULT_MODULE_FILE=Fe.OPEN_API_FILE_SUFFIX=Fe.OPEN_API_CONFIG_FILE=Fe.OPEN_API_UNVERSIONED_DIR_NAME=Fe.DEV_PORTAL_OUTPUT_DIR_NAME=Fe.DEV_PORTAL_CONFIG_FILE=Fe.POLICIES_CONFIG_FILE=Fe.ROUTES_OAS_CONFIG_FILE=Fe.LOCAL_API_KEYS_CONFIG_FILE=Fe.DEV_PORTAL_V4_PATH=Fe.USER_DOCS_DIR_NAME=Fe.USER_SCHEMAS_DIR_NAME=Fe.USER_CONFIG_DIR_NAME=Fe.USER_TEST_DIR_NAME=Fe.USER_MODULES_DIR_NAME=void 0;Fe.USER_MODULES_DIR_NAME="modules";Fe.USER_TEST_DIR_NAME="tests";Fe.USER_CONFIG_DIR_NAME="config";Fe.USER_SCHEMAS_DIR_NAME="schemas";Fe.USER_DOCS_DIR_NAME="docs";Fe.DEV_PORTAL_V4_PATH="v4";Fe.LOCAL_API_KEYS_CONFIG_FILE="api-keys.json";Fe.ROUTES_OAS_CONFIG_FILE="routes.oas.json";Fe.POLICIES_CONFIG_FILE="policies.json";Fe.DEV_PORTAL_CONFIG_FILE="dev-portal.json";Fe.DEV_PORTAL_OUTPUT_DIR_NAME="dev-portal";Fe.OPEN_API_UNVERSIONED_DIR_NAME="unversioned";Fe.OPEN_API_CONFIG_FILE="open-api.json";Fe.OPEN_API_FILE_SUFFIX=".oas.json";Fe.DEFAULT_MODULE_FILE="hello-world.ts";Fe.ZUPLO_PREFERRED_JSON_FILE="zuplo.jsonc";Fe.ZUPLO_FALLBACK_JSON_FILE="zuplo.json";Fe.DOCS_SIDEBAR_FILE="sidebar.json";Fe.DOCS_THEME_FILE="theme.css";Fe.DEFAULT_DOCS_MARKDOWN_FILE="index.md";Fe.DEFAULT_TEST_FILE="hello-world.json";Fe.BUILD_OUTPUT_DIR="dist";Fe.GENERATED_SOURCE_DIR_NAME=".zuplo";Fe.GENERATED_BUILD_JSON_FILE="build.json";Fe.GENERATED_TYPES_DIR_NAME="types";Fe.NON_STANDARD_NODE_ENV=`You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against.`;Fe.ZUPLO_FILE_SCHEMA="zuplo";Fe.BUILD_CACHE_FILE="buildstate.json";Fe.CACHE_DIRECTORY=".cache";Fe.ENV_FILE=".env";Fe.ZUPLO_SYSTEM_ENV_FILE=".env.zuplo";Fe.ENV_MODULE_FILE="environment.ts";Fe.WORKER_ENTRY_NAME="worker.ts";Fe.WORKER_BUILD_OUTPUT_FILE="worker.js";Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE="worker.js.map";Fe.NODE_ENTRY_NAME="server.ts";Fe.NODE_BUILD_OUTPUT_FILE="main.js";Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.OPEN_API_CONFIG_FILE});var jAe=_(n2=>{"use strict";var qAe=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.createProjectDirs=void 0;var $Ae=qAe(require("fs/promises"));var CLt=qAe(require("path"));var Sb=Kl();var LAe=wb();var RLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[Sb.USER_MODULES_DIR_NAME,Sb.USER_CONFIG_DIR_NAME,Sb.USER_TEST_DIR_NAME,Sb.USER_SCHEMAS_DIR_NAME,Sb.USER_DOCS_DIR_NAME,".vscode"];try{await $Ae.default.mkdir(t);for(const n of r){await $Ae.default.mkdir(CLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new LAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new LAe.PluginResult},"createProjectDirs");n2.createProjectDirs=RLt});var UAe=_(gY=>{"use strict";Object.defineProperty(gY,"__esModule",{value:true});var Hx=require("perf_hooks");var mY=[];async function OLt(t,e){const r=Hx.performance.timerify(e);const n=new Hx.PerformanceObserver(i=>{const s=i.getEntries()[0];mY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(OLt,"timeFn");var NLt={mark:t=>{Hx.performance.mark(t)},measure:(t,e,r)=>{Hx.performance.measure(t,e,r)},timeFn:OLt,report:()=>{if(mY.length>0){console.table(mY)}}};gY.default=NLt});var VAe=_(i2=>{"use strict";var BAe=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFromTemplate=void 0;var ILt=require("fs");var FAe=BAe(require("fs/promises"));var MAe=BAe(require("path"));async function PLt(t){const e=MAe.default.resolve(__dirname,"..","templates",t);if((0,ILt.existsSync)(e)){const r=await FAe.default.readFile(e,"utf-8");return r}else{const r=MAe.default.resolve(__dirname,"templates",t);const n=await FAe.default.readFile(r,"utf-8");return n}}o(PLt,"generateFromTemplate");i2.generateFromTemplate=PLt});var Ca=_(s2=>{"use strict";var yY=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateFileFromTemplate=void 0;var DLt=bb();var kLt=yY(require("fs/promises"));var $Lt=yY(require("path"));var LLt=yY(UAe());var qLt=VAe();var jLt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return LLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=$Lt.default.join(r,t);if(await DLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return ULt(i,e,n)})}},"generateFileFromTemplate");s2.generateFileFromTemplate=jLt;async function ULt(t,e,r){const n=await(0,qLt.generateFromTemplate)(e);try{await kLt.default.writeFile(t,n,"utf-8");r.debug(`File written to ${t}`)}catch(i){r.error(i);const s={message:`Error creating file at ${t}`,pluginName:"generate-file",severity:"error"};return{warnings:[],errors:[s]}}return{warnings:[],errors:[]}}o(ULt,"writeTemplate")});var zAe=_(a2=>{"use strict";var FLt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsMarkdown=void 0;var MLt=FLt(require("path"));var HAe=Kl();var BLt=Ca();a2.generateDefaultDocsMarkdown=(0,BLt.generateFileFromTemplate)(MLt.default.join(HAe.USER_DOCS_DIR_NAME,HAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var KAe=_(o2=>{"use strict";var VLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsSidebar=void 0;var HLt=VLt(require("path"));var GAe=Kl();var zLt=Ca();o2.generateDefaultDocsSidebar=(0,zLt.generateFileFromTemplate)(HLt.default.join(GAe.USER_DOCS_DIR_NAME,GAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var WAe=_(u2=>{"use strict";var GLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultDocsTheme=void 0;var KLt=GLt(require("path"));var YAe=Kl();var YLt=Ca();u2.generateDefaultDocsTheme=(0,YLt.generateFileFromTemplate)(KLt.default.join(YAe.USER_DOCS_DIR_NAME,YAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var QAe=_(l2=>{"use strict";var WLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDefaultModule=void 0;var JLt=WLt(require("path"));var JAe=Kl();var QLt=Ca();l2.generateDefaultModule=(0,QLt.generateFileFromTemplate)(JLt.default.join(JAe.USER_MODULES_DIR_NAME,JAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var ZAe=_(c2=>{"use strict";var XLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateDevPortalConfigJson=void 0;var ZLt=XLt(require("path"));var XAe=Kl();var eqt=Ca();c2.generateDevPortalConfigJson=(0,eqt.generateFileFromTemplate)(ZLt.default.join(XAe.USER_CONFIG_DIR_NAME,XAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var exe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generateEnvironment=void 0;var tqt=Ca();zx.generateEnvironment=(0,tqt.generateFileFromTemplate)(".env","env.template")});var txe=_(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:true});Gx.generateESLint=void 0;var rqt=Ca();Gx.generateESLint=(0,rqt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var rxe=_(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:true});Kx.generateGitignore=void 0;var nqt=Ca();Kx.generateGitignore=(0,nqt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var nxe=_(d2=>{"use strict";var iqt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateLaunchJson=void 0;var sqt=iqt(require("path"));var aqt=Ca();d2.generateLaunchJson=(0,aqt.generateFileFromTemplate)(sqt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var ixe=_(p2=>{"use strict";var oqt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateSettingsJson=void 0;var uqt=oqt(require("path"));var lqt=Ca();p2.generateSettingsJson=(0,lqt.generateFileFromTemplate)(uqt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var axe=_(f2=>{"use strict";var cqt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generateRouteOasConfig=void 0;var dqt=cqt(require("path"));var sxe=Kl();var pqt=Ca();f2.generateRouteOasConfig=(0,pqt.generateFileFromTemplate)(dqt.default.join(sxe.USER_CONFIG_DIR_NAME,sxe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var cxe=_(Go=>{"use strict";var oxe=Go&&Go.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Go,"__esModule",{value:true});Go.updateProjectPackageJson=Go.getProjectPackageJson=Go.getPackageOverrides=Go.generateDefaultPackageJson=void 0;var fqt=bb();var uxe=oxe(require("fs/promises"));var vY=oxe(require("path"));async function hqt(t,e=fqt.env.USE_MONOREPO_PACKAGES){const r={name:t,version:"1.0.0",author:"",copyright:"",scripts:{dev:"zup dev",test:"zup test"},dependencies:{zuplo:"latest"}};if(e){const n=lxe();r.overrides=n;r.dependencies["@zuplo/runtime"]=n["@zuplo/runtime"];if(r.devDependencies&&"@zuplo/core"in r.devDependencies){r.devDependencies["@zuplo/core"]=n["@zuplo/core"]}if("@zuplo/core"in r.dependencies){r.dependencies["@zuplo/core"]=n["@zuplo/core"]}}return r}o(hqt,"generateDefaultPackageJson");Go.generateDefaultPackageJson=hqt;function lxe(){const t=vY.default.resolve(__dirname,"..","..");return{"@zuplo/core":`file:${t}/core`,"@zuplo/runtime":`file:${t}/runtime`,"@zuplo/debug":`file:${t}/debug`,"@zuplo/errors":`file:${t}/errors`}}o(lxe,"getPackageOverrides");Go.getPackageOverrides=lxe;async function mqt(t){const e=vY.default.join(t,"package.json");const r=await uxe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(mqt,"getProjectPackageJson");Go.getProjectPackageJson=mqt;async function gqt(t,e){const r=vY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await uxe.default.writeFile(r,n,"utf-8")}o(gqt,"updateProjectPackageJson");Go.updateProjectPackageJson=gqt});var fxe=_(Yx=>{"use strict";Object.defineProperty(Yx,"__esModule",{value:true});Yx.generatePackageJson=void 0;var dxe=cxe();var pxe=wb();var yqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,dxe.generateDefaultPackageJson)(e);try{await(0,dxe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new pxe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new pxe.PluginResult},"generatePackageJson");Yx.generatePackageJson=yqt});var mxe=_(h2=>{"use strict";var vqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generatePoliciesConfig=void 0;var _qt=vqt(require("path"));var hxe=Kl();var Eqt=Ca();h2.generatePoliciesConfig=(0,Eqt.generateFileFromTemplate)(_qt.default.join(hxe.USER_CONFIG_DIR_NAME,hxe.POLICIES_CONFIG_FILE),"policies.template.json")});var gxe=_(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:true});Wx.generateTSConfig=void 0;var bqt=Ca();Wx.generateTSConfig=(0,bqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var vxe=_(m2=>{"use strict";var wqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.generateZuploJson=void 0;var Sqt=bb();var Tqt=require("fs/promises");var Aqt=wqt(require("path"));var xqt=Kl();var yxe=wb();var Cqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:Sqt.DEFAULT_COMPATIBILITY_DATE};const i=Aqt.default.join(e,xqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,Tqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new yxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new yxe.PluginResult},"generateZuploJson");m2.generateZuploJson=Cqt});var Exe=_(g2=>{"use strict";var Rqt=g2&&g2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(g2,"__esModule",{value:true});g2.create=void 0;var _Y=bb();var Oqt=require("fs/promises");var Nqt=Rqt(require("path"));var Iqt=wb();var _xe=kAe();var Pqt=jAe();var Dqt=zAe();var kqt=KAe();var $qt=WAe();var Lqt=QAe();var qqt=ZAe();var jqt=exe();var Uqt=txe();var Fqt=rxe();var Mqt=nxe();var Bqt=ixe();var Vqt=axe();var Hqt=fxe();var zqt=mxe();var Gqt=gxe();var Kqt=vxe();async function Yqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,_xe.sanitize)(t);const s=(0,_xe.sanitize)(e);const a=Nqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await _Y.xfs.dirExists(a)){throw new _Y.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:_Y.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[Pqt.createProjectDirs,Vqt.generateRouteOasConfig,Kqt.generateZuploJson,qqt.generateDevPortalConfigJson,Lqt.generateDefaultModule,kqt.generateDefaultDocsSidebar,Dqt.generateDefaultDocsMarkdown,$qt.generateDefaultDocsTheme,zqt.generatePoliciesConfig]);l.push(...[Gqt.generateTSConfig,Fqt.generateGitignore,Hqt.generatePackageJson,jqt.generateEnvironment,Uqt.generateESLint,Mqt.generateLaunchJson,Bqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,Iqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,Oqt.rm)(a,{recursive:true,force:true});const f=c[0];if(f instanceof Error){throw f}else{throw new Error(f.message)}}const p={sourceDirectory:a,projectName:t};return p}o(Yqt,"create");g2.create=Yqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Wqt=Exe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Wqt.create}});
|
|
410
|
+
`+await t.crypto.sha256DigestHex(h);const y=await INt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await K6(t.crypto,y,g);const w=`${PSe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,DSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(PNt,"generateAuthenticationHeaderMap")});var mG=_(BA=>{"use strict";Object.defineProperty(BA,"__esModule",{value:true});BA.AwsClient=void 0;var DNt=kSe();var kNt=cf();var Y6=class extends kNt.BaseExternalAccountClient{static{o(this,"AwsClient")}constructor(e,r){super(e,r);this.environmentId=e.credential_source.environment_id;this.regionUrl=e.credential_source.region_url;this.securityCredentialsUrl=e.credential_source.url;this.regionalCredVerificationUrl=e.credential_source.regional_cred_verification_url;this.imdsV2SessionTokenUrl=e.credential_source.imdsv2_session_token_url;this.awsRequestSigner=null;this.region="";this.validateEnvironmentId()}validateEnvironmentId(){var e;const r=(e=this.environmentId)===null||e===void 0?void 0:e.match(/^(aws)(\d+)$/);if(!r||!this.regionalCredVerificationUrl){throw new Error('No valid AWS "credential_source" provided')}else if(parseInt(r[2],10)!==1){throw new Error(`aws version "${r[2]}" is not supported in the current build.`)}}async retrieveSubjectToken(){if(!this.awsRequestSigner){const i={};if(this.shouldUseMetadataServer()&&this.imdsV2SessionTokenUrl){i["x-aws-ec2-metadata-token"]=await this.getImdsV2SessionToken()}this.region=await this.getAwsRegion(i);this.awsRequestSigner=new DNt.AwsRequestSigner(async()=>{if(this.securityCredentialsFromEnv){return this.securityCredentialsFromEnv}const s=await this.getAwsRoleName(i);const a=await this.getAwsSecurityCredentials(s,i);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,token:a.Token}},this.region)}const e=await this.awsRequestSigner.getRequestOptions({url:this.regionalCredVerificationUrl.replace("{region}",this.region),method:"POST"});const r=[];const n=Object.assign({"x-goog-cloud-target-resource":this.audience},e.headers);for(const i in n){r.push({key:i,value:n[i]})}return encodeURIComponent(JSON.stringify({url:e.url,method:e.method,headers:r}))}async getImdsV2SessionToken(){const e={url:this.imdsV2SessionTokenUrl,method:"PUT",responseType:"text",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"300"}};const r=await this.transporter.request(e);return r.data}async getAwsRegion(e){if(this.regionFromEnv){return this.regionFromEnv}if(!this.regionUrl){throw new Error('Unable to determine AWS region due to missing "options.credential_source.region_url"')}const r={url:this.regionUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data.substr(0,n.data.length-1)}async getAwsRoleName(e){if(!this.securityCredentialsUrl){throw new Error('Unable to determine AWS role name due to missing "options.credential_source.url"')}const r={url:this.securityCredentialsUrl,method:"GET",responseType:"text",headers:e};const n=await this.transporter.request(r);return n.data}async getAwsSecurityCredentials(e,r){const n=await this.transporter.request({url:`${this.securityCredentialsUrl}/${e}`,responseType:"json",headers:r});return n.data}shouldUseMetadataServer(){return!this.regionFromEnv||!this.securityCredentialsFromEnv}get regionFromEnv(){return process.env["AWS_REGION"]||process.env["AWS_DEFAULT_REGION"]||null}get securityCredentialsFromEnv(){if(process.env["AWS_ACCESS_KEY_ID"]&&process.env["AWS_SECRET_ACCESS_KEY"]){return{accessKeyId:process.env["AWS_ACCESS_KEY_ID"],secretAccessKey:process.env["AWS_SECRET_ACCESS_KEY"],token:process.env["AWS_SESSION_TOKEN"]}}return null}};BA.AwsClient=Y6;Y6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";Y6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var EG=_(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:true});pi.InvalidSubjectTokenError=pi.InvalidMessageFieldError=pi.InvalidCodeFieldError=pi.InvalidTokenTypeFieldError=pi.InvalidExpirationTimeFieldError=pi.InvalidSuccessFieldError=pi.InvalidVersionFieldError=pi.ExecutableResponseError=pi.ExecutableResponse=void 0;var VA="urn:ietf:params:oauth:token-type:saml2";var gG="urn:ietf:params:oauth:token-type:id_token";var yG="urn:ietf:params:oauth:token-type:jwt";var vG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new HA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new zA("Executable response must contain a 'success' field.")}this.version=e.version;this.success=e.success;if(this.success){this.expirationTime=e.expiration_time;this.tokenType=e.token_type;if(this.tokenType!==VA&&this.tokenType!==gG&&this.tokenType!==yG){throw new GA(`Executable response must contain a 'token_type' field when successful and it must be one of ${gG}, ${yG}, or ${VA}.`)}if(this.tokenType===VA){if(!e.saml_response){throw new W6(`Executable response must contain a 'saml_response' field when token_type=${VA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new W6(`Executable response must contain a 'id_token' field when token_type=${gG} or ${yG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new KA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new YA("Executable response must contain a 'message' field when unsuccessful.")}this.errorCode=e.code;this.errorMessage=e.message}}isValid(){return!this.isExpired()&&this.success}isExpired(){return this.expirationTime!==void 0&&this.expirationTime<Math.round(Date.now()/1e3)}};pi.ExecutableResponse=vG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var HA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=HA;var zA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=zA;var _G=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=_G;var GA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=GA;var KA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=KA;var YA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=YA;var W6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=W6});var $Se=_(WA=>{"use strict";Object.defineProperty(WA,"__esModule",{value:true});WA.PluggableAuthHandler=void 0;var $Nt=JA();var Nm=EG();var LNt=require("child_process");var bG=require("fs");var wG=class t{static{o(this,"PluggableAuthHandler")}constructor(e){if(!e.command){throw new Error("No command provided.")}this.commandComponents=t.parseCommand(e.command);this.timeoutMillis=e.timeoutMillis;if(!this.timeoutMillis){throw new Error("No timeoutMillis provided.")}this.outputFile=e.outputFile}retrieveResponseFromExecutable(e){return new Promise((r,n)=>{const i=LNt.spawn(this.commandComponents[0],this.commandComponents.slice(1),{env:{...process.env,...Object.fromEntries(e)}});let s="";i.stdout.on("data",u=>{s+=u});i.stderr.on("data",u=>{s+=u});const a=setTimeout(()=>{i.removeAllListeners();i.kill();return n(new Error("The executable failed to finish within the timeout specified."))},this.timeoutMillis);i.on("close",u=>{clearTimeout(a);if(u===0){try{const l=JSON.parse(s);const c=new Nm.ExecutableResponse(l);return r(c)}catch(l){if(l instanceof Nm.ExecutableResponseError){return n(l)}return n(new Nm.ExecutableResponseError(`The executable returned an invalid response: ${s}`))}}else{return n(new $Nt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await bG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await bG.promises.lstat(e)).isFile()){return void 0}const r=await bG.promises.readFile(e,{encoding:"utf8"});if(r===""){return void 0}try{const n=JSON.parse(r);const i=new Nm.ExecutableResponse(n);if(i.isValid()){return new Nm.ExecutableResponse(n)}return void 0}catch(n){if(n instanceof Nm.ExecutableResponseError){throw n}throw new Nm.ExecutableResponseError(`The output file contained an invalid response: ${r}`)}}static parseCommand(e){const r=e.match(/(?:[^\s"]+|"[^"]*")+/g);if(!r){throw new Error(`Provided command: "${e}" could not be parsed.`)}for(let n=0;n<r.length;n++){if(r[n][0]==='"'&&r[n].slice(-1)==='"'){r[n]=r[n].slice(1,-1)}}return r}};WA.PluggableAuthHandler=wG});var JA=_(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:true});Sy.PluggableAuthClient=Sy.ExecutableError=void 0;var qNt=cf();var jNt=EG();var UNt=$Se();var QA=class extends Error{static{o(this,"ExecutableError")}constructor(e,r){super(`The executable failed with exit code: ${r} and error message: ${e}.`);this.code=r;Object.setPrototypeOf(this,new.target.prototype)}};Sy.ExecutableError=QA;var FNt=30*1e3;var LSe=5*1e3;var qSe=120*1e3;var MNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var jSe=1;var SG=class extends qNt.BaseExternalAccountClient{static{o(this,"PluggableAuthClient")}constructor(e,r){super(e,r);if(!e.credential_source.executable){throw new Error('No valid Pluggable Auth "credential_source" provided.')}this.command=e.credential_source.executable.command;if(!this.command){throw new Error('No valid Pluggable Auth "credential_source" provided.')}if(e.credential_source.executable.timeout_millis===void 0){this.timeoutMillis=FNt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<LSe||this.timeoutMillis>qSe){throw new Error(`Timeout must be between ${LSe} and ${qSe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new UNt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[MNt]!=="1"){throw new Error("Pluggable Auth executables need to be explicitly allowed to run by setting the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment Variable to 1.")}let e=void 0;if(this.outputFile){e=await this.handler.retrieveCachedResponse()}if(!e){const r=new Map;r.set("GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE",this.audience);r.set("GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE",this.subjectTokenType);r.set("GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE","0");if(this.outputFile){r.set("GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE",this.outputFile)}const n=this.getServiceAccountEmail();if(n){r.set("GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL",n)}e=await this.handler.retrieveResponseFromExecutable(r)}if(e.version>jSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${jSe}.`)}if(!e.success){throw new QA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new jNt.InvalidExpirationTimeFieldError("The executable response must contain the `expiration_time` field for successful responses when an output_file has been specified in the configuration.")}}if(e.isExpired()){throw new Error("Executable response is expired.")}return e.subjectToken}};Sy.PluggableAuthClient=SG});var AG=_(XA=>{"use strict";Object.defineProperty(XA,"__esModule",{value:true});XA.ExternalAccountClient=void 0;var BNt=cf();var VNt=fG();var HNt=mG();var zNt=JA();var TG=class{static{o(this,"ExternalAccountClient")}constructor(){throw new Error("ExternalAccountClients should be initialized via: ExternalAccountClient.fromJSON(), directly via explicit constructors, eg. new AwsClient(options), new IdentityPoolClient(options), newPluggableAuthClientOptions, or via new GoogleAuth(options).getClient()")}static fromJSON(e,r){var n,i;if(e&&e.type===BNt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new HNt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new zNt.PluggableAuthClient(e,r)}else{return new VNt.IdentityPoolClient(e,r)}}else{return null}}};XA.ExternalAccountClient=TG});var FSe=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.ExternalAccountAuthorizedUserClient=Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var GNt=ny();var USe=rG();var KNt=Jc();var YNt=require("stream");var WNt=cf();Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var xG=class extends USe.OAuthClientAuthHandler{static{o(this,"ExternalAccountAuthorizedUserHandler")}constructor(e,r,n){super(n);this.url=e;this.transporter=r}async refreshToken(e,r){const n=new URLSearchParams({grant_type:"refresh_token",refresh_token:e});const i={"Content-Type":"application/x-www-form-urlencoded",...r};const s={url:this.url,method:"POST",headers:i,data:n.toString(),responseType:"json"};this.applyClientAuthenticationOptions(s);try{const a=await this.transporter.request(s);const u=a.data;u.res=a;return u}catch(a){if(a instanceof KNt.GaxiosError&&a.response){throw(0,USe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var CG=class extends GNt.AuthClient{static{o(this,"ExternalAccountAuthorizedUserClient")}constructor(e,r){super();this.refreshToken=e.refresh_token;const n={confidentialClientType:"basic",clientId:e.client_id,clientSecret:e.client_secret};this.externalAccountAuthorizedUserHandler=new xG(e.token_url,this.transporter,n);this.cachedAccessToken=null;this.quotaProjectId=e.quota_project_id;if(typeof(r===null||r===void 0?void 0:r.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=WNt.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=r.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(r===null||r===void 0?void 0:r.forceRefreshOnFailure)}async getAccessToken(){if(!this.cachedAccessToken||this.isExpired(this.cachedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedAccessToken.access_token,res:this.cachedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof YNt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){const e=await this.externalAccountAuthorizedUserHandler.refreshToken(this.refreshToken);this.cachedAccessToken={access_token:e.access_token,expiry_date:new Date().getTime()+e.expires_in*1e3,res:e.res};if(e.refresh_token!==void 0){this.refreshToken=e.refresh_token}return this.cachedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Ty.ExternalAccountAuthorizedUserClient=CG});var VSe=_(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:true});xy.GoogleAuth=xy.CLOUD_SDK_CLIENT_ID=void 0;var JNt=require("child_process");var J6=require("fs");var RG=z7();var QNt=require("os");var OG=require("path");var XNt=ty();var ZNt=N6();var eIt=jH();var tIt=FH();var rIt=MH();var Ay=Jz();var NG=Xz();var ZA=eG();var nIt=AG();var Q6=cf();var MSe=FSe();xy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var BSe={NO_PROJECT_ID_FOUND:"Unable to detect a Project Id in the current environment. \nTo learn more about authentication and Google APIs, visit: \nhttps://cloud.google.com/docs/authentication/getting-started"};var ex=class{static{o(this,"GoogleAuth")}get isGCE(){return this.checkIsGCE}constructor(e){this.checkIsGCE=void 0;this.jsonContent=null;this.cachedCredential=null;e=e||{};this._cachedProjectId=e.projectId||null;this.cachedCredential=e.authClient||null;this.keyFilename=e.keyFilename||e.keyFile;this.scopes=e.scopes;this.jsonContent=e.credentials||null;this.clientOptions=e.clientOptions}setGapicJWTValues(e){e.defaultServicePath=this.defaultServicePath;e.useJWTAccessWithScope=this.useJWTAccessWithScope;e.defaultScopes=this.defaultScopes}getProjectId(e){if(e){this.getProjectIdAsync().then(r=>e(null,r),e)}else{return this.getProjectIdAsync()}}async getProjectIdOptional(){try{return await this.getProjectId()}catch(e){if(e instanceof Error&&e.message===BSe.NO_PROJECT_ID_FOUND){return null}else{throw e}}}async findAndCacheProjectId(){let e=null;e||(e=await this.getProductionProjectId());e||(e=await this.getFileProjectId());e||(e=await this.getDefaultServiceProjectId());e||(e=await this.getGCEProjectId());e||(e=await this.getExternalAccountClientProjectId());if(e){this._cachedProjectId=e;return e}else{throw new Error(BSe.NO_PROJECT_ID_FOUND)}}async getProjectIdAsync(){if(this._cachedProjectId){return this._cachedProjectId}if(!this._findProjectIdPromise){this._findProjectIdPromise=this.findAndCacheProjectId()}return this._findProjectIdPromise}getAnyScopes(){return this.scopes||this.defaultScopes}getApplicationDefault(e={},r){let n;if(typeof e==="function"){r=e}else{n=e}if(r){this.getApplicationDefaultAsync(n).then(i=>r(null,i.credential,i.projectId),r)}else{return this.getApplicationDefaultAsync(n)}}async getApplicationDefaultAsync(e={}){if(this.cachedCredential){return await this.prepareAndCacheADC(this.cachedCredential)}const r=process.env["GOOGLE_CLOUD_QUOTA_PROJECT"];let n;n=await this._tryGetApplicationCredentialsFromEnvironmentVariable(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Q6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}n=await this._tryGetApplicationCredentialsFromWellKnownFile(e);if(n){if(n instanceof Ay.JWT){n.scopes=this.scopes}else if(n instanceof Q6.BaseExternalAccountClient){n.scopes=this.getAnyScopes()}return await this.prepareAndCacheADC(n,r)}let i;try{i=await this._checkIsGCE()}catch(s){if(s instanceof Error){s.message=`Unexpected error determining execution environment: ${s.message}`}throw s}if(!i){throw new Error("Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.")}e.scopes=this.getAnyScopes();return await this.prepareAndCacheADC(new eIt.Compute(e),r)}async prepareAndCacheADC(e,r){const n=await this.getProjectIdOptional();if(r){e.quotaProjectId=r}this.cachedCredential=e;return{credential:e,projectId:n}}async _checkIsGCE(){if(this.checkIsGCE===void 0){this.checkIsGCE=await RG.isAvailable()}return this.checkIsGCE}async _tryGetApplicationCredentialsFromEnvironmentVariable(e){const r=process.env["GOOGLE_APPLICATION_CREDENTIALS"]||process.env["google_application_credentials"];if(!r||r.length===0){return null}try{return this._getApplicationCredentialsFromFilePath(r,e)}catch(n){if(n instanceof Error){n.message=`Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${n.message}`}throw n}}async _tryGetApplicationCredentialsFromWellKnownFile(e){let r=null;if(this._isWindows()){r=process.env["APPDATA"]}else{const i=process.env["HOME"];if(i){r=OG.join(i,".config")}}if(r){r=OG.join(r,"gcloud","application_default_credentials.json");if(!J6.existsSync(r)){r=null}}if(!r){return null}const n=await this._getApplicationCredentialsFromFilePath(r,e);return n}async _getApplicationCredentialsFromFilePath(e,r={}){if(!e||e.length===0){throw new Error("The file path is invalid.")}try{e=J6.realpathSync(e);if(!J6.lstatSync(e).isFile()){throw new Error}}catch(i){if(i instanceof Error){i.message=`The file at ${e} does not exist, or it is not a file. ${i.message}`}throw i}const n=J6.createReadStream(e);return this.fromStream(n,r)}fromImpersonatedJSON(e){var r,n,i,s;if(!e){throw new Error("Must pass in a JSON object containing an impersonated refresh token")}if(e.type!==ZA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${ZA.IMPERSONATED_ACCOUNT_TYPE}" type`)}if(!e.source_credentials){throw new Error("The incoming JSON object does not contain a source_credentials field")}if(!e.service_account_impersonation_url){throw new Error("The incoming JSON object does not contain a service_account_impersonation_url field")}const a=new NG.UserRefreshClient(e.source_credentials.client_id,e.source_credentials.client_secret,e.source_credentials.refresh_token);const u=(n=(r=/(?<target>[^/]+):generateAccessToken$/.exec(e.service_account_impersonation_url))===null||r===void 0?void 0:r.groups)===null||n===void 0?void 0:n.target;if(!u){throw new RangeError(`Cannot extract target principal from ${e.service_account_impersonation_url}`)}const l=(i=this.getAnyScopes())!==null&&i!==void 0?i:[];const c=new ZA.Impersonated({delegates:(s=e.delegates)!==null&&s!==void 0?s:[],sourceClient:a,targetPrincipal:u,targetScopes:Array.isArray(l)?l:[l]});return c}fromJSON(e,r={}){let n;r=r||{};if(e.type===NG.USER_REFRESH_ACCOUNT_TYPE){n=new NG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===ZA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===Q6.EXTERNAL_ACCOUNT_TYPE){n=nIt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===MSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new MSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new Ay.JWT(r);this.setGapicJWTValues(n);n.fromJSON(e)}return n}_cacheClientFromJSON(e,r){const n=this.fromJSON(e,r);this.jsonContent=e;this.cachedCredential=n;return n}fromStream(e,r={},n){let i={};if(typeof r==="function"){n=r}else{i=r}if(n){this.fromStreamAsync(e,i).then(s=>n(null,s),n)}else{return this.fromStreamAsync(e,i)}}fromStreamAsync(e,r){return new Promise((n,i)=>{if(!e){throw new Error("Must pass in a stream containing the Google auth settings.")}let s="";e.setEncoding("utf8").on("error",i).on("data",a=>s+=a).on("end",()=>{try{try{const a=JSON.parse(s);const u=this._cacheClientFromJSON(a,r);return n(u)}catch(a){if(!this.keyFilename)throw a;const u=new Ay.JWT({...this.clientOptions,keyFile:this.keyFilename});this.cachedCredential=u;this.setGapicJWTValues(u);return n(u)}}catch(a){return i(a)}})})}fromAPIKey(e,r){r=r||{};const n=new Ay.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=QNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,JNt.exec)("gcloud config config-helper --format json",(r,n)=>{if(!r&&n){try{const i=JSON.parse(n).configuration.properties.core.project;e(i);return}catch(i){}}e(null)})})}getProductionProjectId(){return process.env["GCLOUD_PROJECT"]||process.env["GOOGLE_CLOUD_PROJECT"]||process.env["gcloud_project"]||process.env["google_cloud_project"]}async getFileProjectId(){if(this.cachedCredential){return this.cachedCredential.projectId}if(this.keyFilename){const r=await this.getClient();if(r&&r.projectId){return r.projectId}}const e=await this._tryGetApplicationCredentialsFromEnvironmentVariable();if(e){return e.projectId}else{return null}}async getExternalAccountClientProjectId(){if(!this.jsonContent||this.jsonContent.type!==Q6.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await RG.project("project-id");return e}catch(e){return null}}getCredentials(e){if(e){this.getCredentialsAsync().then(r=>e(null,r),e)}else{return this.getCredentialsAsync()}}async getCredentialsAsync(){const e=await this.getClient();if(e instanceof Q6.BaseExternalAccountClient){const i=e.getServiceAccountEmail();if(i){return{client_email:i}}}if(this.jsonContent){const i={client_email:this.jsonContent.client_email,private_key:this.jsonContent.private_key};return i}const r=await this._checkIsGCE();if(!r){throw new Error("Unknown error.")}const n=await RG.instance({property:"service-accounts/",params:{recursive:"true"}});if(!n||!n.default||!n.default.email){throw new Error("Failure from metadata server.")}return{client_email:n.default.email}}async getClient(){if(!this.cachedCredential){if(this.jsonContent){this._cacheClientFromJSON(this.jsonContent,this.clientOptions)}else if(this.keyFilename){const e=OG.resolve(this.keyFilename);const r=J6.createReadStream(e);await this.fromStreamAsync(r,this.clientOptions)}else{await this.getApplicationDefaultAsync(this.clientOptions)}}return this.cachedCredential}async getIdTokenClient(e){const r=await this.getClient();if(!("fetchIdToken"in r)){throw new Error("Cannot fetch ID token in this environment, use GCE or set the GOOGLE_APPLICATION_CREDENTIALS environment variable to a service account credentials JSON file.")}return new tIt.IdTokenClient({targetAudience:e,idTokenProvider:r})}async getAccessToken(){const e=await this.getClient();return(await e.getAccessToken()).token}async getRequestHeaders(e){const r=await this.getClient();return r.getRequestHeaders(e)}async authorizeRequest(e){e=e||{};const r=e.url||e.uri;const n=await this.getClient();const i=await n.getRequestHeaders(r);e.headers=Object.assign(e.headers||{},i);return e}async request(e){const r=await this.getClient();return r.request(e)}getEnv(){return(0,rIt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,XNt.createCrypto)();if(r instanceof Ay.JWT&&r.key){const s=await n.sign(r.key,e);return s}const i=await this.getCredentials();if(!i.client_email){throw new Error("Cannot sign data without `client_email`.")}return this.signBlob(n,i.client_email,e)}async signBlob(e,r,n){const i=`https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${r}:signBlob`;const s=await this.request({method:"POST",url:i,data:{payload:e.encodeBase64StringUtf8(n)}});return s.data.signedBlob}};xy.GoogleAuth=ex;ex.DefaultTransporter=ZNt.DefaultTransporter});var HSe=_(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:true});tx.IAMAuth=void 0;var IG=class{static{o(this,"IAMAuth")}constructor(e,r){this.selector=e;this.token=r;this.selector=e;this.token=r}getRequestHeaders(){return{"x-goog-iam-authority-selector":this.selector,"x-goog-iam-authorization-token":this.token}}};tx.IAMAuth=IG});var zSe=_(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:true});Du.DownscopedClient=Du.EXPIRATION_TIME_OFFSET=Du.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var iIt=require("stream");var sIt=ny();var aIt=iG();var oIt="urn:ietf:params:oauth:grant-type:token-exchange";var uIt="urn:ietf:params:oauth:token-type:access_token";var lIt="urn:ietf:params:oauth:token-type:access_token";var cIt="https://sts.googleapis.com/v1/token";Du.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Du.EXPIRATION_TIME_OFFSET=5*60*1e3;var PG=class extends sIt.AuthClient{static{o(this,"DownscopedClient")}constructor(e,r,n,i){super();this.authClient=e;this.credentialAccessBoundary=r;if(r.accessBoundary.accessBoundaryRules.length===0){throw new Error("At least one access boundary rule needs to be defined.")}else if(r.accessBoundary.accessBoundaryRules.length>Du.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Du.MAX_ACCESS_BOUNDARY_RULES_COUNT} access boundary rules.`)}for(const s of r.accessBoundary.accessBoundaryRules){if(s.availablePermissions.length===0){throw new Error("At least one permission should be defined in access boundary rules.")}}this.stsCredential=new aIt.StsCredentials(cIt);this.cachedDownscopedAccessToken=null;if(typeof(n===null||n===void 0?void 0:n.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=Du.EXPIRATION_TIME_OFFSET}else{this.eagerRefreshThresholdMillis=n.eagerRefreshThresholdMillis}this.forceRefreshOnFailure=!!(n===null||n===void 0?void 0:n.forceRefreshOnFailure);this.quotaProjectId=i}setCredentials(e){if(!e.expiry_date){throw new Error("The access token expiry_date field is missing in the provided credentials.")}super.setCredentials(e);this.cachedDownscopedAccessToken=e}async getAccessToken(){if(!this.cachedDownscopedAccessToken||this.isExpired(this.cachedDownscopedAccessToken)){await this.refreshAccessTokenAsync()}return{token:this.cachedDownscopedAccessToken.access_token,expirationTime:this.cachedDownscopedAccessToken.expiry_date,res:this.cachedDownscopedAccessToken.res}}async getRequestHeaders(){const e=await this.getAccessToken();const r={Authorization:`Bearer ${e.token}`};return this.addSharedMetadataHeaders(r)}request(e,r){if(r){this.requestAsync(e).then(n=>r(null,n),n=>{return r(n,n.response)})}else{return this.requestAsync(e)}}async requestAsync(e,r=false){let n;try{const i=await this.getRequestHeaders();e.headers=e.headers||{};if(i&&i["x-goog-user-project"]){e.headers["x-goog-user-project"]=i["x-goog-user-project"]}if(i&&i.Authorization){e.headers.Authorization=i.Authorization}n=await this.transporter.request(e)}catch(i){const s=i.response;if(s){const a=s.status;const u=s.config.data instanceof iIt.Readable;const l=a===401||a===403;if(!r&&l&&!u&&this.forceRefreshOnFailure){await this.refreshAccessTokenAsync();return await this.requestAsync(e,true)}}throw i}return n}async refreshAccessTokenAsync(){var e;const r=(await this.authClient.getAccessToken()).token;const n={grantType:oIt,requestedTokenType:uIt,subjectToken:r,subjectTokenType:lIt};const i=await this.stsCredential.exchangeToken(n,void 0,this.credentialAccessBoundary);const s=((e=this.authClient.credentials)===null||e===void 0?void 0:e.expiry_date)||null;const a=i.expires_in?new Date().getTime()+i.expires_in*1e3:s;this.cachedDownscopedAccessToken={access_token:i.access_token,expiry_date:a,res:i.res};this.credentials={};Object.assign(this.credentials,this.cachedDownscopedAccessToken);delete this.credentials.res;this.emit("tokens",{refresh_token:null,expiry_date:this.cachedDownscopedAccessToken.expiry_date,access_token:this.cachedDownscopedAccessToken.access_token,token_type:"Bearer",id_token:null});return this.cachedDownscopedAccessToken}isExpired(e){const r=new Date().getTime();return e.expiry_date?r>=e.expiry_date-this.eagerRefreshThresholdMillis:false}};Du.DownscopedClient=PG});var DG=_(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:true});Ot.GoogleAuth=Ot.auth=Ot.DefaultTransporter=Ot.PluggableAuthClient=Ot.DownscopedClient=Ot.BaseExternalAccountClient=Ot.ExternalAccountClient=Ot.IdentityPoolClient=Ot.AwsClient=Ot.UserRefreshClient=Ot.LoginTicket=Ot.OAuth2Client=Ot.CodeChallengeMethod=Ot.Impersonated=Ot.JWT=Ot.JWTAccess=Ot.IdTokenClient=Ot.IAMAuth=Ot.GCPEnv=Ot.Compute=Ot.AuthClient=void 0;var GSe=VSe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return GSe.GoogleAuth}});var dIt=ny();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return dIt.AuthClient}});var pIt=jH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return pIt.Compute}});var fIt=MH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return fIt.GCPEnv}});var hIt=HSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return hIt.IAMAuth}});var mIt=FH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return mIt.IdTokenClient}});var gIt=Yz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return gIt.JWTAccess}});var yIt=Jz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return yIt.JWT}});var vIt=eG();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return vIt.Impersonated}});var KSe=Em();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return KSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return KSe.OAuth2Client}});var _It=$H();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return _It.LoginTicket}});var EIt=Xz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return EIt.UserRefreshClient}});var bIt=mG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return bIt.AwsClient}});var wIt=fG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return wIt.IdentityPoolClient}});var SIt=AG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return SIt.ExternalAccountClient}});var TIt=cf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return TIt.BaseExternalAccountClient}});var AIt=zSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return AIt.DownscopedClient}});var xIt=JA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return xIt.PluggableAuthClient}});var CIt=N6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return CIt.DefaultTransporter}});var RIt=new GSe.GoogleAuth;Ot.auth=RIt});var Ry=_(Cy=>{"use strict";var OIt=Cy&&Cy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Cy,"__esModule",{value:true});Cy.getServiceAccountIdToken=void 0;var NIt=DG();var IIt=OIt(ru());var PIt=new NIt.GoogleAuth;var YSe=new IIt.default({max:50,maxAge:1e3*60*50});async function DIt(t){let e=YSe.get(t);if(!e){const r=await PIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);YSe.set(t,e)}return e}o(DIt,"getServiceAccountIdToken");Cy.getServiceAccountIdToken=DIt});var ZSe=_(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:true});Mo.mergeHeaders=Mo.createFinalURL=Mo.defaultBodySerializer=Mo.defaultQuerySerializer=Mo.createClient=void 0;var Oy=As();var kIt=Ry();var $It=/\/*$/;async function LIt(t){const{baseUrl:e,fetch:r=globalThis.fetch,querySerializer:n,bodySerializer:i,zuploExtensions:s,...a}=t;const u=s?.fastifyRequest.log;const l=s?.fastifyRequest.id;const c=s?.options?.userSub??s?.fastifyRequest.getUserSub();const d=new Headers({"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,kIt.getServiceAccountIdToken)(e);d.set("Authorization",`Bearer ${p}`);if(["GET","DELETE","HEAD","OPTIONS","TRACE"].includes(a.method?.toUpperCase()??"")){}else{d.set("Content-Type","application/json")}async function f(h,m){const{headers:g,body:y,params:v={},parseAs:w="json",querySerializer:E=n??WSe,bodySerializer:b=i??JSe,...S}=m||{};const T=QSe(h,{baseUrl:e,params:v,querySerializer:E});const A=XSe(d,g,v.header);const R={redirect:"follow",...a,...S,headers:A};if(y)R.body=b(y);if(R.body instanceof FormData)A.delete("Content-Type");const O=await r(T,R);if(O.status===404){const j=await O.json();if(j&&j.hasOwnProperty("type")&&j.hasOwnProperty("title")&&j.hasOwnProperty("status")){throw new Oy.ApiError(j)}throw new Oy.ApiError(Oy.Problems.NOT_FOUND)}if(O.status===204||O.headers.get("Content-Length")==="0"){return O.ok?{data:{},response:O}:{error:{},response:O}}if(O.ok){let j=O.body;if(w!=="stream"){const B=O.clone();j=typeof B[w]==="function"?await B[w]():await B.text()}return{data:j,response:O}}else{u.debug(`Error on internal api: path: ${T}, status: ${O.status}, headers: ${JSON.stringify(O.headers)}, body: ${await O.clone().text()}`);let j={};try{j=await O.clone().json();if(j.type&&j.status&&j.title){throw new Oy.ApiError(j)}}catch(B){}throw new Oy.ApiError(Oy.Problems.INTERNAL_SERVER_ERROR)}}o(f,"coreFetch");return{async GET(h,m){return f(h,{...m,method:"GET"})},async PUT(h,m){return f(h,{...m,method:"PUT"})},async POST(h,m){return f(h,{...m,method:"POST"})},async DELETE(h,m){return f(h,{...m,method:"DELETE"})},async OPTIONS(h,m){return f(h,{...m,method:"OPTIONS"})},async HEAD(h,m){return f(h,{...m,method:"HEAD"})},async PATCH(h,m){return f(h,{...m,method:"PATCH"})},async TRACE(h,m){return f(h,{...m,method:"TRACE"})}}}o(LIt,"createClient");Mo.createClient=LIt;function WSe(t){const e=new URLSearchParams;if(t&&typeof t==="object"){for(const[r,n]of Object.entries(t)){if(n===void 0||n===null)continue;e.set(r,n)}}return e.toString()}o(WSe,"defaultQuerySerializer");Mo.defaultQuerySerializer=WSe;function JSe(t){return JSON.stringify(t)}o(JSe,"defaultBodySerializer");Mo.defaultBodySerializer=JSe;function QSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace($It,""):""}${t}`;if(e.params.path){for(const[n,i]of Object.entries(e.params.path))r=r.replace(`{${n}}`,encodeURIComponent(String(i)))}if(e.params.query){const n=e.querySerializer(e.params.query);if(n)r+=`?${n}`}return r}o(QSe,"createFinalURL");Mo.createFinalURL=QSe;function XSe(...t){const e=new Headers;for(const r of t){if(!r||typeof r!=="object")continue;const n=r instanceof Headers?r.entries():Object.entries(r);for(const[i,s]of n){if(s!==void 0&&s!==null){e.set(i,s)}}}return e}o(XSe,"mergeHeaders");Mo.mergeHeaders=XSe});var eTe=_(df=>{"use strict";var qIt=df&&df.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(df,"__esModule",{value:true});df.ApiKeyService=df.createApiKeyServiceClient=void 0;var Ny=As();var jIt=DG();var rx=qIt(Oa());var UIt=ZSe();async function FIt(t){return(0,UIt.createClient)({baseUrl:rx.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(FIt,"createApiKeyServiceClient");df.createApiKeyServiceClient=FIt;var kG=class{static{o(this,"ApiKeyService")}logger;requestId;constructor(e){this.logger=e.log;this.requestId=e.id}async fetchGCP(e,r={}){this.logger.info(`Fetching with GCP JWT ${r.method} ${e} from Api Key Service API.`);const n=new jIt.GoogleAuth;const i=await n.getIdTokenClient(rx.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${rx.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:"GET",body:r.body,headers:{...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}}})}`);const s=await i.getRequestHeaders();const a=await i.request({url:`${rx.default.API_KEY_MANAGEMENT_SERVICE_URL}/${e}`,method:r.method||"GET",body:r.body,headers:{...s,...r.headers,...r.method!=="DELETE"&&{"content-type":"application/json"}},validateStatus:u=>u>=200&&u<500});if(a.status===404){const u=await a.data;if(u&&u.hasOwnProperty("type")&&u.hasOwnProperty("title")&&u.hasOwnProperty("status")){throw new Ny.ApiError(u)}throw new Ny.ApiError(Ny.Problems.NOT_FOUND)}if(a.status>=300){this.logger.debug(`Error on api-key-service: path: ${e}, status: ${a.status}, headers: ${JSON.stringify(a.headers)}, body: ${JSON.stringify(a.data)}`);const u=a.data;if(u.type&&u.status&&u.title){throw new Ny.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Ny.ApiError(Ny.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};df.ApiKeyService=kG});var rTe=_(Iy=>{"use strict";var MIt=Iy&&Iy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Iy,"__esModule",{value:true});Iy.AuthApiService=void 0;var Im=As();var tTe=MIt(Oa());var BIt=Ry();var $G=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!tTe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=tTe.default.AUTH_API_URL}async getClientJWT(e,r){let n;try{n=await this.fetch(`/v1/clients/${e}`,{method:"GET"})}catch(s){if(s.status===Im.Problems.NOT_FOUND.status){n=await this.fetch(`/v1/clients`,{method:"POST",body:JSON.stringify({client_id:e})})}else{throw s}}const i=await this.fetch(`/v1/oauth/token`,{method:"POST",body:JSON.stringify({client_id:e,client_secret:n.client_secret,grant_type:"client_credentials",custom_claims:r})});return i.access_token}async fetch(e,r){this.logger.info(`Fetching internally ${e} from Auth API V2.`);const n=new Headers({"content-type":"application/json","zp-rid":this.requestId,authorization:""});if(process.env.K_SERVICE){const s=await(0,BIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===Im.HttpStatusCode.NOT_FOUND){throw new Im.ApiError(Im.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on auth-api: path: ${e}, status: ${i.status}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Im.ApiError(s)}this.logger.error(`Error not handled on auth-api: path: ${e}, status: ${i.status}`);throw new Im.ApiError(Im.Problems.INTERNAL_SERVER_ERROR)}return i.clone().json()}};Iy.AuthApiService=$G});var X6=_(nx=>{"use strict";Object.defineProperty(nx,"__esModule",{value:true});nx.ApiServiceClient=void 0;var Py=As();var VIt=Ry();var LG=class{static{o(this,"ApiServiceClient")}userSub;logger;requestId;baseUrl;cache;targetAudience;constructor(e,r,n){this.userSub=n.userSub;this.logger=n.logger;this.requestId=n.requestId;this.baseUrl=e;this.cache=r;this.targetAudience=n.targetAudience}async cachedFetch(e,r,n){if(!this.userSub||!n){throw new Error("userSub and cacheKey parameters are required to use cachedFetch")}const i=`${this.userSub}@${n}`;if(this.cache.has(i)){return this.cache.get(i)}const s=await this.fetchInternally(e,r);this.cache.set(i,s);return s}async fetchInternally(e,r){this.logger.info(`Fetching internally ${r.method} ${this.baseUrl}${e}`);const n=new Headers({...r.headers,"zuplo-user":this.userSub,"content-type":"application/json","zp-rid":this.requestId});if(process.env.K_SERVICE){const s=await(0,VIt.getServiceAccountIdToken)(this.targetAudience??this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===404){this.logger.debug(`Error on internal api: path: ${e}, status: ${i.status}, body: ${JSON.stringify(i.clone().text())}`);const s=await i.json();if(s&&s.hasOwnProperty("type")&&s.hasOwnProperty("title")&&s.hasOwnProperty("status")){throw new Py.ApiError(s)}throw new Py.ApiError(Py.Problems.NOT_FOUND)}if(!i.ok){this.logger.debug(`Error on internal api: path: ${e}, status: ${i.status}, body: ${JSON.stringify(i.clone().text())}`);const s=await i.clone().json();if(s.type&&s.status&&s.title){throw new Py.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Py.ApiError(Py.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};nx.ApiServiceClient=LG});var aTe=_(Vl=>{"use strict";var iTe=Vl&&Vl.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Vl,"__esModule",{value:true});Vl.ContentApiService=Vl.getContentApiStorageTarballPath=Vl.contentApiTarballFileName=void 0;var HIt=iTe(ru());var nTe=iTe(Oa());var zIt=X6();var GIt=new HIt.default({max:500,maxAge:1e3*60*50});function sTe(t,e){return`${t}--${e}.tar.gz`}o(sTe,"contentApiTarballFileName");Vl.contentApiTarballFileName=sTe;function KIt(t,e){const r=sTe(t,e);return`${t}/builds/${r}`}o(KIt,"getContentApiStorageTarballPath");Vl.getContentApiStorageTarballPath=KIt;var qG=class extends zIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!nTe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(nTe.default.CONTENT_API_URL,GIt,e)}};Vl.ContentApiService=qG});var lTe=_(Dy=>{"use strict";var uTe=Dy&&Dy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Dy,"__esModule",{value:true});Dy.DevApiService=void 0;var YIt=uTe(ru());var oTe=uTe(Oa());var WIt=X6();var JIt=new YIt.default({max:500,maxAge:1e3*60*50});var jG=class extends WIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!oTe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(oTe.default.DEV_API_URL,JIt,{userSub:n,logger:e.log,requestId:e.id})}};Dy.DevApiService=jG});var pTe=_((Nhr,dTe)=>{var cTe=require("stream").Stream;var QIt=require("util");dTe.exports=ku;function ku(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(ku,"DelayedStream");QIt.inherits(ku,cTe);ku.create=function(t,e){var r=new this;e=e||{};for(var n in e){r[n]=e[n]}r.source=t;var i=t.emit;t.emit=function(){r._handleEmit(arguments);return i.apply(t,arguments)};t.on("error",function(){});if(r.pauseStream){t.pause()}return r};Object.defineProperty(ku.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});ku.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};ku.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};ku.prototype.pause=function(){this.source.pause()};ku.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};ku.prototype.pipe=function(){var t=cTe.prototype.pipe.apply(this,arguments);this.resume();return t};ku.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}if(t[0]==="data"){this.dataSize+=t[1].length;this._checkIfMaxDataSizeExceeded()}this._bufferedEvents.push(t)};ku.prototype._checkIfMaxDataSizeExceeded=function(){if(this._maxDataSizeExceeded){return}if(this.dataSize<=this.maxDataSize){return}this._maxDataSizeExceeded=true;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}});var gTe=_((Phr,mTe)=>{var XIt=require("util");var hTe=require("stream").Stream;var fTe=pTe();mTe.exports=Xn;function Xn(){this.writable=false;this.readable=true;this.dataSize=0;this.maxDataSize=2*1024*1024;this.pauseStreams=true;this._released=false;this._streams=[];this._currentStream=null;this._insideLoop=false;this._pendingNext=false}o(Xn,"CombinedStream");XIt.inherits(Xn,hTe);Xn.create=function(t){var e=new this;t=t||{};for(var r in t){e[r]=t[r]}return e};Xn.isStreamLike=function(t){return typeof t!=="function"&&typeof t!=="string"&&typeof t!=="boolean"&&typeof t!=="number"&&!Buffer.isBuffer(t)};Xn.prototype.append=function(t){var e=Xn.isStreamLike(t);if(e){if(!(t instanceof fTe)){var r=fTe.create(t,{maxDataSize:Infinity,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this));t=r}this._handleErrors(t);if(this.pauseStreams){t.pause()}}this._streams.push(t);return this};Xn.prototype.pipe=function(t,e){hTe.prototype.pipe.call(this,t,e);this.resume();return t};Xn.prototype._getNext=function(){this._currentStream=null;if(this._insideLoop){this._pendingNext=true;return}this._insideLoop=true;try{do{this._pendingNext=false;this._realGetNext()}while(this._pendingNext)}finally{this._insideLoop=false}};Xn.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t=="undefined"){this.end();return}if(typeof t!=="function"){this._pipeNext(t);return}var e=t;e(function(r){var n=Xn.isStreamLike(r);if(n){r.on("data",this._checkDataSize.bind(this));this._handleErrors(r)}this._pipeNext(r)}.bind(this))};Xn.prototype._pipeNext=function(t){this._currentStream=t;var e=Xn.isStreamLike(t);if(e){t.on("end",this._getNext.bind(this));t.pipe(this,{end:false});return}var r=t;this.write(r);this._getNext()};Xn.prototype._handleErrors=function(t){var e=this;t.on("error",function(r){e._emitError(r)})};Xn.prototype.write=function(t){this.emit("data",t)};Xn.prototype.pause=function(){if(!this.pauseStreams){return}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function")this._currentStream.pause();this.emit("pause")};Xn.prototype.resume=function(){if(!this._released){this._released=true;this.writable=true;this._getNext()}if(this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function")this._currentStream.resume();this.emit("resume")};Xn.prototype.end=function(){this._reset();this.emit("end")};Xn.prototype.destroy=function(){this._reset();this.emit("close")};Xn.prototype._reset=function(){this.writable=false;this._streams=[];this._currentStream=null};Xn.prototype._checkDataSize=function(){this._updateDataSize();if(this.dataSize<=this.maxDataSize){return}var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(t))};Xn.prototype._updateDataSize=function(){this.dataSize=0;var t=this;this._streams.forEach(function(e){if(!e.dataSize){return}t.dataSize+=e.dataSize});if(this._currentStream&&this._currentStream.dataSize){this.dataSize+=this._currentStream.dataSize}};Xn.prototype._emitError=function(t){this._reset();this.emit("error",t)}});var vTe=_((khr,yTe)=>{yTe.exports=ZIt;function ZIt(t){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;if(e){e(t)}else{setTimeout(t,0)}}o(ZIt,"defer")});var UG=_((Lhr,ETe)=>{var _Te=vTe();ETe.exports=ePt;function ePt(t){var e=false;_Te(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{_Te(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(ePt,"async")});var FG=_((jhr,bTe)=>{bTe.exports=tPt;function tPt(t){Object.keys(t.jobs).forEach(rPt.bind(t));t.jobs={}}o(tPt,"abort");function rPt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(rPt,"clean")});var MG=_((Fhr,STe)=>{var wTe=UG();var nPt=FG();STe.exports=iPt;function iPt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=sPt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){nPt(r)}else{r.results[i]=a}n(s,r.results)})}o(iPt,"iterate");function sPt(t,e,r,n){var i;if(t.length==2){i=t(r,wTe(n))}else{i=t(r,e,wTe(n))}return i}o(sPt,"runJob")});var BG=_((Bhr,TTe)=>{TTe.exports=aPt;function aPt(t,e){var r=!Array.isArray(t),n={index:0,keyedList:r||e?Object.keys(t):null,jobs:{},results:r?{}:[],size:r?Object.keys(t).length:t.length};if(e){n.keyedList.sort(r?e:function(i,s){return e(t[i],t[s])})}return n}o(aPt,"state")});var VG=_((Hhr,ATe)=>{var oPt=FG();var uPt=UG();ATe.exports=lPt;function lPt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;oPt(this);uPt(t)(null,this.results)}o(lPt,"terminator")});var CTe=_((Ghr,xTe)=>{var cPt=MG();var dPt=BG();var pPt=VG();xTe.exports=fPt;function fPt(t,e,r){var n=dPt(t);while(n.index<(n["keyedList"]||t).length){cPt(t,e,n,function(i,s){if(i){r(i,s);return}if(Object.keys(n.jobs).length===0){r(null,n.results);return}});n.index++}return pPt.bind(n,r)}o(fPt,"parallel")});var HG=_((Yhr,ix)=>{var RTe=MG();var hPt=BG();var mPt=VG();ix.exports=gPt;ix.exports.ascending=OTe;ix.exports.descending=yPt;function gPt(t,e,r,n){var i=hPt(t,r);RTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){RTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return mPt.bind(i,n)}o(gPt,"serialOrdered");function OTe(t,e){return t<e?-1:t>e?1:0}o(OTe,"ascending");function yPt(t,e){return-1*OTe(t,e)}o(yPt,"descending")});var ITe=_((Jhr,NTe)=>{var vPt=HG();NTe.exports=_Pt;function _Pt(t,e,r){return vPt(t,e,null,r)}o(_Pt,"serial")});var DTe=_((Xhr,PTe)=>{PTe.exports={parallel:CTe(),serial:ITe(),serialOrdered:HG()}});var $Te=_((Zhr,kTe)=>{kTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var jTe=_((emr,qTe)=>{var YG=gTe();var LTe=require("util");var zG=require("path");var EPt=require("http");var bPt=require("https");var wPt=require("url").parse;var SPt=require("fs");var TPt=require("stream").Stream;var GG=RM();var APt=DTe();var KG=$Te();qTe.exports=Fr;LTe.inherits(Fr,YG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];YG.call(this);t=t||{};for(var e in t){this[e]=t[e]}}o(Fr,"FormData");Fr.LINE_BREAK="\r\n";Fr.DEFAULT_CONTENT_TYPE="application/octet-stream";Fr.prototype.append=function(t,e,r){r=r||{};if(typeof r=="string"){r={filename:r}}var n=YG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(LTe.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(t,e,r);var s=this._multiPartFooter();n(i);n(e);n(s);this._trackLength(i,e,r)};Fr.prototype._trackLength=function(t,e,r){var n=0;if(r.knownLength!=null){n+=+r.knownLength}else if(Buffer.isBuffer(e)){n=e.length}else if(typeof e==="string"){n=Buffer.byteLength(e)}this._valueLength+=n;this._overheadLength+=Buffer.byteLength(t)+Fr.LINE_BREAK.length;if(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof TPt)){return}if(!r.knownLength){this._valuesToMeasure.push(e)}};Fr.prototype._lengthRetriever=function(t,e){if(t.hasOwnProperty("fd")){if(t.end!=void 0&&t.end!=Infinity&&t.start!=void 0){e(null,t.end+1-(t.start?t.start:0))}else{SPt.stat(t.path,function(r,n){var i;if(r){e(r);return}i=n.size-(t.start?t.start:0);e(null,i)})}}else if(t.hasOwnProperty("httpVersion")){e(null,+t.headers["content-length"])}else if(t.hasOwnProperty("httpModule")){t.on("response",function(r){t.pause();e(null,+r.headers["content-length"])});t.resume()}else{e("Unknown stream")}};Fr.prototype._multiPartHeader=function(t,e,r){if(typeof r.header=="string"){return r.header}var n=this._getContentDisposition(e,r);var i=this._getContentType(e,r);var s="";var a={"Content-Disposition":["form-data",'name="'+t+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};if(typeof r.header=="object"){KG(a,r.header)}var u;for(var l in a){if(!a.hasOwnProperty(l))continue;u=a[l];if(u==null){continue}if(!Array.isArray(u)){u=[u]}if(u.length){s+=l+": "+u.join("; ")+Fr.LINE_BREAK}}return"--"+this.getBoundary()+Fr.LINE_BREAK+s+Fr.LINE_BREAK};Fr.prototype._getContentDisposition=function(t,e){var r,n;if(typeof e.filepath==="string"){r=zG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=zG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=zG.basename(t.client._httpMessage.path||"")}if(r){n='filename="'+r+'"'}return n};Fr.prototype._getContentType=function(t,e){var r=e.contentType;if(!r&&t.name){r=GG.lookup(t.name)}if(!r&&t.path){r=GG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=GG.lookup(e.filepath||e.filename)}if(!r&&typeof t=="object"){r=Fr.DEFAULT_CONTENT_TYPE}return r};Fr.prototype._multiPartFooter=function(){return function(t){var e=Fr.LINE_BREAK;var r=this._streams.length===0;if(r){e+=this._lastBoundary()}t(e)}.bind(this)};Fr.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Fr.LINE_BREAK};Fr.prototype.getHeaders=function(t){var e;var r={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t){if(t.hasOwnProperty(e)){r[e.toLowerCase()]=t[e]}}return r};Fr.prototype.setBoundary=function(t){this._boundary=t};Fr.prototype.getBoundary=function(){if(!this._boundary){this._generateBoundary()}return this._boundary};Fr.prototype.getBuffer=function(){var t=new Buffer.alloc(0);var e=this.getBoundary();for(var r=0,n=this._streams.length;r<n;r++){if(typeof this._streams[r]!=="function"){if(Buffer.isBuffer(this._streams[r])){t=Buffer.concat([t,this._streams[r]])}else{t=Buffer.concat([t,Buffer.from(this._streams[r])])}if(typeof this._streams[r]!=="string"||this._streams[r].substring(2,e.length+2)!==e){t=Buffer.concat([t,Buffer.from(Fr.LINE_BREAK)])}}}return Buffer.concat([t,Buffer.from(this._lastBoundary())])};Fr.prototype._generateBoundary=function(){var t="--------------------------";for(var e=0;e<24;e++){t+=Math.floor(Math.random()*10).toString(16)}this._boundary=t};Fr.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;if(this._streams.length){t+=this._lastBoundary().length}if(!this.hasKnownLength()){this._error(new Error("Cannot calculate proper length in synchronous way."))}return t};Fr.prototype.hasKnownLength=function(){var t=true;if(this._valuesToMeasure.length){t=false}return t};Fr.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length){e+=this._lastBoundary().length}if(!this._valuesToMeasure.length){process.nextTick(t.bind(this,null,e));return}APt.parallel(this._valuesToMeasure,this._lengthRetriever,function(r,n){if(r){t(r);return}n.forEach(function(i){e+=i});t(null,e)})};Fr.prototype.submit=function(t,e){var r,n,i={method:"post"};if(typeof t=="string"){t=wPt(t);n=KG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=KG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=bPt.request(n)}else{r=EPt.request(n)}this.getLength(function(s,a){if(s&&s!=="Unknown stream"){this._error(s);return}if(a){r.setHeader("Content-Length",a)}this.pipe(r);if(e){var u;var l=o(function(c,d){r.removeListener("error",l);r.removeListener("response",u);return e.call(this,c,d)},"callback");u=l.bind(this,null);r.on("error",l);r.on("response",u)}}.bind(this));return r};Fr.prototype._error=function(t){if(!this.error){this.error=t;this.pause();this.emit("error",t)}};Fr.prototype.toString=function(){return"[object FormData]"}});var FTe=_(UTe=>{"use strict";var xPt=require("url").parse;var CPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var RPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function OPt(t){var e=typeof t==="string"?xPt(t):t||{};var r=e.protocol;var n=e.host;var i=e.port;if(typeof n!=="string"||!n||typeof r!=="string"){return""}r=r.split(":",1)[0];n=n.replace(/:\d*$/,"");i=parseInt(i)||CPt[r]||0;if(!NPt(n,i)){return""}var s=ky("npm_config_"+r+"_proxy")||ky(r+"_proxy")||ky("npm_config_proxy")||ky("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(OPt,"getProxyForUrl");function NPt(t,e){var r=(ky("npm_config_no_proxy")||ky("no_proxy")).toLowerCase();if(!r){return true}if(r==="*"){return false}return r.split(/[,\s]/).every(function(n){if(!n){return true}var i=n.match(/^(.+):(\d+)$/);var s=i?i[1]:n;var a=i?parseInt(i[2]):0;if(a&&a!==e){return true}if(!/^[.*]/.test(s)){return t!==s}if(s.charAt(0)==="*"){s=s.slice(1)}return!RPt.call(t,s)})}o(NPt,"shouldProxy");function ky(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o(ky,"getEnv");UTe.getProxyForUrl=OPt});var BTe=_((imr,MTe)=>{var Z6;MTe.exports=function(){if(!Z6){try{Z6=Ja()("follow-redirects")}catch(t){}if(typeof Z6!=="function"){Z6=o(function(){},"debug")}}Z6.apply(null,arguments)}});var KTe=_((amr,aK)=>{var rb=require("url");var eb=rb.URL;var IPt=require("http");var PPt=require("https");var ZG=require("stream").Writable;var eK=require("assert");var VTe=BTe();var tK=false;try{eK(new eb)}catch(t){tK=t.code==="ERR_INVALID_URL"}var DPt=["auth","host","hostname","href","path","pathname","port","protocol","query","search"];var rK=["abort","aborted","connect","error","socket","timeout"];var nK=Object.create(null);rK.forEach(function(t){nK[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var JG=nb("ERR_INVALID_URL","Invalid URL",TypeError);var QG=nb("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var kPt=nb("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",QG);var $Pt=nb("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var LPt=nb("ERR_STREAM_WRITE_AFTER_END","write after end");var qPt=ZG.prototype.destroy||zTe;function Ta(t,e){ZG.call(this);this._sanitizeOptions(t);this._options=t;this._ended=false;this._ending=false;this._redirectCount=0;this._redirects=[];this._requestBodyLength=0;this._requestBodyBuffers=[];if(e){this.on("response",e)}var r=this;this._onNativeResponse=function(n){try{r._processResponse(n)}catch(i){r.emit("error",i instanceof QG?i:new QG({cause:i}))}};this._performRequest()}o(Ta,"RedirectableRequest");Ta.prototype=Object.create(ZG.prototype);Ta.prototype.abort=function(){sK(this._currentRequest);this._currentRequest.abort();this.emit("abort")};Ta.prototype.destroy=function(t){sK(this._currentRequest,t);qPt.call(this,t);return this};Ta.prototype.write=function(t,e,r){if(this._ending){throw new LPt}if(!Pm(t)&&!FPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(tb(e)){r=e;e=null}if(t.length===0){if(r){r()}return}if(this._requestBodyLength+t.length<=this._options.maxBodyLength){this._requestBodyLength+=t.length;this._requestBodyBuffers.push({data:t,encoding:e});this._currentRequest.write(t,e,r)}else{this.emit("error",new $Pt);this.abort()}};Ta.prototype.end=function(t,e,r){if(tb(t)){r=t;t=e=null}else if(tb(e)){r=e;e=null}if(!t){this._ended=this._ending=true;this._currentRequest.end(null,null,r)}else{var n=this;var i=this._currentRequest;this.write(t,e,function(){n._ended=true;i.end(null,null,r)});this._ending=true}};Ta.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Ta.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Ta.prototype.setTimeout=function(t,e){var r=this;function n(a){a.setTimeout(t);a.removeListener("timeout",a.destroy);a.addListener("timeout",a.destroy)}o(n,"destroyOnTimeout");function i(a){if(r._timeout){clearTimeout(r._timeout)}r._timeout=setTimeout(function(){r.emit("timeout");s()},t);n(a)}o(i,"startTimer");function s(){if(r._timeout){clearTimeout(r._timeout);r._timeout=null}r.removeListener("abort",s);r.removeListener("error",s);r.removeListener("response",s);r.removeListener("close",s);if(e){r.removeListener("timeout",e)}if(!r.socket){r._currentRequest.removeListener("socket",i)}}o(s,"clearTimer");if(e){this.on("timeout",e)}if(this.socket){i(this.socket)}else{this._currentRequest.once("socket",i)}this.on("socket",n);this.on("abort",s);this.on("error",s);this.on("response",s);this.on("close",s);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ta.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ta.prototype,t,{get:function(){return this._currentRequest[t]}})});Ta.prototype._sanitizeOptions=function(t){if(!t.headers){t.headers={}}if(t.host){if(!t.hostname){t.hostname=t.host}delete t.host}if(!t.pathname&&t.path){var e=t.path.indexOf("?");if(e<0){t.pathname=t.path}else{t.pathname=t.path.substring(0,e);t.search=t.path.substring(e)}}};Ta.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){throw new TypeError("Unsupported protocol "+t)}if(this._options.agents){var r=t.slice(0,-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var i of rK){n.on(i,nK[i])}this._currentUrl=/^\//.test(this._options.path)?rb.format(this._options):this._options.path;if(this._isRedirect){var s=0;var a=this;var u=this._requestBodyBuffers;o(function l(c){if(n===a._currentRequest){if(c){a.emit("error",c)}else if(s<u.length){var d=u[s++];if(!n.finished){n.write(d.data,d.encoding,l)}}else if(a._ended){n.end()}}},"writeNext")()}};Ta.prototype._processResponse=function(t){var e=t.statusCode;if(this._options.trackRedirects){this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e})}var r=t.headers.location;if(!r||this._options.followRedirects===false||e<300||e>=400){t.responseUrl=this._currentUrl;t.redirects=this._redirects;this.emit("response",t);this._requestBodyBuffers=[];return}sK(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){throw new kPt}var n;var i=this._options.beforeRedirect;if(i){n=Object.assign({Host:t.req.getHeader("host")},this._options.headers)}var s=this._options.method;if((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method)){this._options.method="GET";this._requestBodyBuffers=[];WG(/^content-/i,this._options.headers)}var a=WG(/^host$/i,this._options.headers);var u=iK(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:rb.format(Object.assign(u,{host:l}));var d=jPt(r,c);VTe("redirecting to",d.href);this._isRedirect=true;XG(d,this._options);if(d.protocol!==u.protocol&&d.protocol!=="https:"||d.host!==l&&!UPt(d.host,l)){WG(/^(?:authorization|cookie)$/i,this._options.headers)}if(tb(i)){var p={headers:t.headers,statusCode:e};var f={url:c,method:s,headers:n};i(this._options,p,f);this._sanitizeOptions(this._options)}this._performRequest()};function HTe(t){var e={maxRedirects:21,maxBodyLength:10*1024*1024};var r={};Object.keys(t).forEach(function(n){var i=n+":";var s=r[i]=t[n];var a=e[n]=Object.create(s);function u(c,d,p){if(MPt(c)){c=XG(c)}else if(Pm(c)){c=XG(iK(c))}else{p=d;d=GTe(c);c={protocol:i}}if(tb(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Pm(d.host)&&!Pm(d.hostname)){d.hostname="::1"}eK.equal(d.protocol,i,"protocol mismatch");VTe("options",d);return new Ta(d,p)}o(u,"request");function l(c,d,p){var f=a.request(c,d,p);f.end();return f}o(l,"get");Object.defineProperties(a,{request:{value:u,configurable:true,enumerable:true,writable:true},get:{value:l,configurable:true,enumerable:true,writable:true}})});return e}o(HTe,"wrap");function zTe(){}o(zTe,"noop");function iK(t){var e;if(tK){e=new eb(t)}else{e=GTe(rb.parse(t));if(!Pm(e.protocol)){throw new JG({input:t})}}return e}o(iK,"parseUrl");function jPt(t,e){return tK?new eb(t,e):iK(rb.resolve(e,t))}o(jPt,"resolveUrl");function GTe(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname)){throw new JG({input:t.href||t})}if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host)){throw new JG({input:t.href||t})}return t}o(GTe,"validateUrl");function XG(t,e){var r=e||{};for(var n of DPt){r[n]=t[n]}if(r.hostname.startsWith("[")){r.hostname=r.hostname.slice(1,-1)}if(r.port!==""){r.port=Number(r.port)}r.path=r.search?r.pathname+r.search:r.pathname;return r}o(XG,"spreadUrlObject");function WG(t,e){var r;for(var n in e){if(t.test(n)){r=e[n];delete e[n]}}return r===null||typeof r==="undefined"?void 0:String(r).trim()}o(WG,"removeMatchingHeaders");function nb(t,e,r){function n(i){Error.captureStackTrace(this,this.constructor);Object.assign(this,i||{});this.code=t;this.message=this.cause?e+": "+this.cause.message:e}o(n,"CustomError");n.prototype=new(r||Error);Object.defineProperties(n.prototype,{constructor:{value:n,enumerable:false},name:{value:"Error ["+t+"]",enumerable:false}});return n}o(nb,"createErrorType");function sK(t,e){for(var r of rK){t.removeListener(r,nK[r])}t.on("error",zTe);t.destroy(e)}o(sK,"destroyRequest");function UPt(t,e){eK(Pm(t)&&Pm(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(UPt,"isSubdomain");function Pm(t){return typeof t==="string"||t instanceof String}o(Pm,"isString");function tb(t){return typeof t==="function"}o(tb,"isFunction");function FPt(t){return typeof t==="object"&&"length"in t}o(FPt,"isBuffer");function MPt(t){return eb&&t instanceof eb}o(MPt,"isURL");aK.exports=HTe({http:IPt,https:PPt});aK.exports.wrap=HTe});var hx=_((umr,L7e)=>{"use strict";var BPt=jTe();var VPt=require("url");var HPt=FTe();var zPt=require("http");var GPt=require("https");var d7e=require("util");var KPt=KTe();var YPt=require("zlib");var p7e=require("stream");var WPt=require("events");function rd(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(rd,"_interopDefaultLegacy");var f7e=rd(BPt);var JPt=rd(VPt);var QPt=rd(zPt);var XPt=rd(GPt);var ZPt=rd(d7e);var eDt=rd(KPt);var mf=rd(YPt);var ff=rd(p7e);var tDt=rd(WPt);function h7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(h7e,"bind");var{toString:rDt}=Object.prototype;var{getPrototypeOf:bK}=Object;var cx=(t=>e=>{const r=rDt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Hl=o(t=>{t=t.toLowerCase();return e=>cx(e)===t},"kindOfTest");var dx=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:jy}=Array;var ab=dx("undefined");function nDt(t){return t!==null&&!ab(t)&&t.constructor!==null&&!ab(t.constructor)&&Vo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(nDt,"isBuffer");var m7e=Hl("ArrayBuffer");function iDt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&m7e(t.buffer)}return e}o(iDt,"isArrayBufferView");var sDt=dx("string");var Vo=dx("function");var g7e=dx("number");var px=o(t=>t!==null&&typeof t==="object","isObject");var aDt=o(t=>t===true||t===false,"isBoolean");var ax=o(t=>{if(cx(t)!=="object"){return false}const e=bK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var oDt=Hl("Date");var uDt=Hl("File");var lDt=Hl("Blob");var cDt=Hl("FileList");var dDt=o(t=>px(t)&&Vo(t.pipe),"isStream");var pDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Vo(t.append)&&((e=cx(t))==="formdata"||e==="object"&&Vo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var fDt=Hl("URLSearchParams");var hDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ub(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(jy(t)){for(n=0,i=t.length;n<i;n++){e.call(null,t[n],n,t)}}else{const s=r?Object.getOwnPropertyNames(t):Object.keys(t);const a=s.length;let u;for(n=0;n<a;n++){u=s[n];e.call(null,t[u],u,t)}}}o(ub,"forEach");function y7e(t,e){e=e.toLowerCase();const r=Object.keys(t);let n=r.length;let i;while(n-- >0){i=r[n];if(e===i.toLowerCase()){return i}}return null}o(y7e,"findKey");var v7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var _7e=o(t=>!ab(t)&&t!==v7e,"isContextDefined");function dK(){const{caseless:t}=_7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&y7e(e,i)||i;if(ax(e[s])&&ax(n)){e[s]=dK(e[s],n)}else if(ax(n)){e[s]=dK({},n)}else if(jy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&ub(arguments[n],r)}return e}o(dK,"merge");var mDt=o((t,e,r,{allOwnKeys:n}={})=>{ub(e,(i,s)=>{if(r&&Vo(i)){t[s]=h7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var gDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var yDt=o((t,e,r,n)=>{t.prototype=Object.create(e.prototype,n);t.prototype.constructor=t;Object.defineProperty(t,"super",{value:e.prototype});r&&Object.assign(t.prototype,r)},"inherits");var vDt=o((t,e,r,n)=>{let i;let s;let a;const u={};e=e||{};if(t==null)return e;do{i=Object.getOwnPropertyNames(t);s=i.length;while(s-- >0){a=i[s];if((!n||n(a,t,e))&&!u[a]){e[a]=t[a];u[a]=true}}t=r!==false&&bK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var _Dt=o((t,e,r)=>{t=String(t);if(r===void 0||r>t.length){r=t.length}r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},"endsWith");var EDt=o(t=>{if(!t)return null;if(jy(t))return t;let e=t.length;if(!g7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var bDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&bK(Uint8Array));var wDt=o((t,e)=>{const r=t&&t[Symbol.iterator];const n=r.call(t);let i;while((i=n.next())&&!i.done){const s=i.value;e.call(t,s[0],s[1])}},"forEachEntry");var SDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var TDt=Hl("HTMLFormElement");var ADt=o(t=>{return t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function e(r,n,i){return n.toUpperCase()+i},"replacer"))},"toCamelCase");var YTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var xDt=Hl("RegExp");var E7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};ub(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var CDt=o(t=>{E7e(t,(e,r)=>{if(Vo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Vo(n))return;e.enumerable=false;if("writable"in e){e.writable=false;return}if(!e.set){e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}}})},"freezeMethods");var RDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");jy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var ODt=o(()=>{},"noop");var NDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var oK="abcdefghijklmnopqrstuvwxyz";var WTe="0123456789";var b7e={DIGIT:WTe,ALPHA:oK,ALPHA_DIGIT:oK+oK.toUpperCase()+WTe};var IDt=o((t=16,e=b7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function PDt(t){return!!(t&&Vo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(PDt,"isSpecCompliantForm");var DDt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(px(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=jy(n)?[]:{};ub(n,(a,u)=>{const l=r(a,i+1);!ab(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var kDt=Hl("AsyncFunction");var $Dt=o(t=>t&&(px(t)||Vo(t))&&Vo(t.then)&&Vo(t.catch),"isThenable");var fe={isArray:jy,isArrayBuffer:m7e,isBuffer:nDt,isFormData:pDt,isArrayBufferView:iDt,isString:sDt,isNumber:g7e,isBoolean:aDt,isObject:px,isPlainObject:ax,isUndefined:ab,isDate:oDt,isFile:uDt,isBlob:lDt,isRegExp:xDt,isFunction:Vo,isStream:dDt,isURLSearchParams:fDt,isTypedArray:bDt,isFileList:cDt,forEach:ub,merge:dK,extend:mDt,trim:hDt,stripBOM:gDt,inherits:yDt,toFlatObject:vDt,kindOf:cx,kindOfTest:Hl,endsWith:_Dt,toArray:EDt,forEachEntry:wDt,matchAll:SDt,isHTMLForm:TDt,hasOwnProperty:YTe,hasOwnProp:YTe,reduceDescriptors:E7e,freezeMethods:CDt,toObjectSet:RDt,toCamelCase:ADt,noop:ODt,toFiniteNumber:NDt,findKey:y7e,global:v7e,isContextDefined:_7e,ALPHABET:b7e,generateString:IDt,isSpecCompliantForm:PDt,toJSONObject:DDt,isAsyncFn:kDt,isThenable:$Dt};function nt(t,e,r,n,i){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=new Error().stack}this.message=t;this.name="AxiosError";e&&(this.code=e);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}o(nt,"AxiosError");fe.inherits(nt,Error,{toJSON:o(function t(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}},"toJSON")});var w7e=nt.prototype;var S7e={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{S7e[t]={value:t}});Object.defineProperties(nt,S7e);Object.defineProperty(w7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(w7e);fe.toFlatObject(t,a,o(function u(l){return l!==Error.prototype},"filter"),u=>{return u!=="isAxiosError"});nt.call(a,t.message,e,r,n,i);a.cause=t;a.name=t.name;s&&Object.assign(a,s);return a};function pK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(pK,"isVisitable");function T7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(T7e,"removeBrackets");function JTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=T7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(JTe,"renderKey");function LDt(t){return fe.isArray(t)&&!t.some(pK)}o(LDt,"isFlatArray");var qDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function fx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(f7e["default"]||FormData);r=fe.toFlatObject(r,{metaTokens:true,dots:false,indexes:false},false,o(function m(g,y){return!fe.isUndefined(y[g])},"defined"));const n=r.metaTokens;const i=r.visitor||d;const s=r.dots;const a=r.indexes;const u=r.Blob||typeof Blob!=="undefined"&&Blob;const l=u&&fe.isSpecCompliantForm(e);if(!fe.isFunction(i)){throw new TypeError("visitor must be a function")}function c(m){if(m===null)return"";if(fe.isDate(m)){return m.toISOString()}if(!l&&fe.isBlob(m)){throw new nt("Blob is not supported. Use a Buffer instead.")}if(fe.isArrayBuffer(m)||fe.isTypedArray(m)){return l&&typeof Blob==="function"?new Blob([m]):Buffer.from(m)}return m}o(c,"convertValue");function d(m,g,y){let v=m;if(m&&!y&&typeof m==="object"){if(fe.endsWith(g,"{}")){g=n?g:g.slice(0,-2);m=JSON.stringify(m)}else if(fe.isArray(m)&&LDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=T7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?JTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(pK(m)){return true}e.append(JTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(qDt,{defaultVisitor:d,convertValue:c,isVisitable:pK});function h(m,g){if(fe.isUndefined(m))return;if(p.indexOf(m)!==-1){throw Error("Circular reference detected in "+g.join("."))}p.push(m);fe.forEach(m,o(function y(v,w){const E=!(fe.isUndefined(v)||v===null)&&i.call(e,v,fe.isString(w)?w.trim():w,g,f);if(E===true){h(v,g?g.concat(w):[w])}},"each"));p.pop()}o(h,"build");if(!fe.isObject(t)){throw new TypeError("data must be an object")}h(t);return e}o(fx,"toFormData");function QTe(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,o(function r(n){return e[n]},"replacer"))}o(QTe,"encode$1");function A7e(t,e){this._pairs=[];t&&fx(t,this,e)}o(A7e,"AxiosURLSearchParams");var x7e=A7e.prototype;x7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");x7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,QTe)}:QTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function jDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(jDt,"encode");function wK(t,e,r){if(!e){return t}const n=r&&r.encode||jDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new A7e(e,r).toString(n)}if(s){const a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+s}return t}o(wK,"buildURL");var fK=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,r,n){this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(e){fe.forEach(this.handlers,o(function r(n){if(n!==null){e(n)}},"forEachHandler"))}};var XTe=fK;var SK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var UDt=JPt["default"].URLSearchParams;var FDt={isNode:true,classes:{URLSearchParams:UDt,FormData:f7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var C7e=typeof window!=="undefined"&&typeof document!=="undefined";var MDt=(t=>{return C7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var BDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var VDt=Object.freeze({__proto__:null,hasBrowserEnv:C7e,hasStandardBrowserWebWorkerEnv:BDt,hasStandardBrowserEnv:MDt});var Bo={...VDt,...FDt};function HDt(t,e){return fx(t,new Bo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Bo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(HDt,"toURLEncodedForm");function zDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(zDt,"parsePropPath");function GDt(t){const e={};const r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++){s=r[n];e[s]=t[s]}return e}o(GDt,"arrayToObject");function R7e(t){function e(r,n,i,s){let a=r[s++];const u=Number.isFinite(+a);const l=s>=r.length;a=!a&&fe.isArray(i)?i.length:a;if(l){if(fe.hasOwnProp(i,a)){i[a]=[i[a],n]}else{i[a]=n}return!u}if(!i[a]||!fe.isObject(i[a])){i[a]=[]}const c=e(r,n,i[a],s);if(c&&fe.isArray(i[a])){i[a]=GDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(zDt(n),i,r,0)});return r}return null}o(R7e,"formDataToJSON");function KDt(t,e,r){if(fe.isString(t)){try{(e||JSON.parse)(t);return fe.trim(t)}catch(n){if(n.name!=="SyntaxError"){throw n}}}return(r||JSON.stringify)(t)}o(KDt,"stringifySafely");var TK={transitional:SK,adapter:["xhr","http"],transformRequest:[o(function t(e,r){const n=r.getContentType()||"";const i=n.indexOf("application/json")>-1;const s=fe.isObject(e);if(s&&fe.isHTMLForm(e)){e=new FormData(e)}const a=fe.isFormData(e);if(a){if(!i){return e}return i?JSON.stringify(R7e(e)):e}if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)){return e}if(fe.isArrayBufferView(e)){return e.buffer}if(fe.isURLSearchParams(e)){r.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let u;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1){return HDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return fx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return KDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||TK.transitional;const n=r&&r.forcedJSONParsing;const i=this.responseType==="json";if(e&&fe.isString(e)&&(n&&!this.responseType||i)){const s=r&&r.silentJSONParsing;const a=!s&&i;try{return JSON.parse(e)}catch(u){if(a){if(u.name==="SyntaxError"){throw nt.from(u,nt.ERR_BAD_RESPONSE,this,null,this.response)}throw u}}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bo.classes.FormData,Blob:Bo.classes.Blob},validateStatus:o(function t(e){return e>=200&&e<300},"validateStatus"),headers:{common:{"Accept":"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{TK.headers[t]={}});var AK=TK;var YDt=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var WDt=o(t=>{const e={};let r;let n;let i;t&&t.split("\n").forEach(o(function s(a){i=a.indexOf(":");r=a.substring(0,i).trim().toLowerCase();n=a.substring(i+1).trim();if(!r||e[r]&&YDt[r]){return}if(r==="set-cookie"){if(e[r]){e[r].push(n)}else{e[r]=[n]}}else{e[r]=e[r]?e[r]+", "+n:n}},"parser"));return e},"parseHeaders");var ZTe=Symbol("internals");function ib(t){return t&&String(t).trim().toLowerCase()}o(ib,"normalizeHeader");function ox(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(ox):String(t)}o(ox,"normalizeValue");function JDt(t){const e=Object.create(null);const r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;while(n=r.exec(t)){e[n[1]]=n[2]}return e}o(JDt,"parseTokens");var QDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function uK(t,e,r,n,i){if(fe.isFunction(n)){return n.call(this,e,r)}if(i){e=r}if(!fe.isString(e))return;if(fe.isString(n)){return e.indexOf(n)!==-1}if(fe.isRegExp(n)){return n.test(e)}}o(uK,"matchHeaderValue");function XDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(XDt,"formatHeader");function ZDt(t,e){const r=fe.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(i,s,a){return this[n].call(this,e,i,s,a)},configurable:true})})}o(ZDt,"buildAccessors");var $y=class{static{o(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,r,n){const i=this;function s(u,l,c){const d=ib(l);if(!d){throw new Error("header name must be a non-empty string")}const p=fe.findKey(i,d);if(!p||i[p]===void 0||c===true||c===void 0&&i[p]!==false){i[p||l]=ox(u)}}o(s,"setHeader");const a=o((u,l)=>fe.forEach(u,(c,d)=>s(c,d,l)),"setHeaders");if(fe.isPlainObject(e)||e instanceof this.constructor){a(e,r)}else if(fe.isString(e)&&(e=e.trim())&&!QDt(e)){a(WDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=ib(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return JDt(i)}if(fe.isFunction(r)){return r.call(this,i,n)}if(fe.isRegExp(r)){return r.exec(i)}throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){e=ib(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||uK(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=ib(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||uK(n,n[u],u,r))){delete n[u];i=true}}}o(s,"deleteHeader");if(fe.isArray(e)){e.forEach(s)}else{s(e)}return i}clear(e){const r=Object.keys(this);let n=r.length;let i=false;while(n--){const s=r[n];if(!e||uK(this,this[s],s,e,true)){delete this[s];i=true}}return i}normalize(e){const r=this;const n={};fe.forEach(this,(i,s)=>{const a=fe.findKey(n,s);if(a){r[a]=ox(i);delete r[s];return}const u=e?XDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=ox(i);n[u]=true});return this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);fe.forEach(this,(n,i)=>{n!=null&&n!==false&&(r[i]=e&&fe.isArray(n)?n.join(", "):n)});return r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);r.forEach(i=>n.set(i));return n}static accessor(e){const r=this[ZTe]=this[ZTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=ib(a);if(!n[u]){ZDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};$y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors($y.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods($y);var Ho=$y;function lK(t,e){const r=this||AK;const n=e||r;const i=Ho.from(n.headers);let s=n.data;fe.forEach(t,o(function a(u){s=u.call(r,s,i.normalize(),e?e.status:void 0)},"transform"));i.normalize();return s}o(lK,"transformData");function O7e(t){return!!(t&&t.__CANCEL__)}o(O7e,"isCancel");function Dm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Dm,"CanceledError");fe.inherits(Dm,nt,{__CANCEL__:true});function sb(t,e,r){const n=r.config.validateStatus;if(!r.status||!n||n(r.status)){t(r)}else{e(new nt("Request failed with status code "+r.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}}o(sb,"settle");function ekt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(ekt,"isAbsoluteURL");function tkt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(tkt,"combineURLs");function xK(t,e){if(t&&!ekt(e)){return tkt(t,e)}return e}o(xK,"buildFullPath");var lx="1.6.2";function N7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(N7e,"parseProtocol");var rkt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function nkt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=N7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=rkt.exec(t);if(!s){throw new nt("Invalid URL",nt.ERR_INVALID_URL)}const a=s[1];const u=s[2];const l=s[3];const c=Buffer.from(decodeURIComponent(l),u?"base64":"utf8");if(e){if(!n){throw new nt("Blob is not supported",nt.ERR_NOT_SUPPORT)}return new n([c],{type:a})}return c}throw new nt("Unsupported protocol "+i,nt.ERR_NOT_SUPPORT)}o(nkt,"fromDataURI");function ikt(t,e){let r=0;const n=1e3/e;let i=null;return o(function s(a,u){const l=Date.now();if(a||l-r>n){if(i){clearTimeout(i);i=null}r=l;return t.apply(null,u)}if(!i){i=setTimeout(()=>{i=null;r=Date.now();return t.apply(null,u)},n-(l-r))}},"throttled")}o(ikt,"throttle");function I7e(t,e){t=t||10;const r=new Array(t);const n=new Array(t);let i=0;let s=0;let a;e=e!==void 0?e:1e3;return o(function u(l){const c=Date.now();const d=n[s];if(!a){a=c}r[i]=l;n[i]=c;let p=s;let f=0;while(p!==i){f+=r[p++];p=p%t}i=(i+1)%t;if(i===s){s=(s+1)%t}if(c-a<e){return}const h=d&&c-d;return h?Math.round(f*1e3/h):void 0},"push")}o(I7e,"speedometer");var sx=Symbol("internals");var hK=class extends ff["default"].Transform{static{o(this,"AxiosTransformStream")}constructor(e){e=fe.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(u,l)=>{return!fe.isUndefined(l[u])});super({readableHighWaterMark:e.chunkSize});const r=this;const n=this[sx]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:false,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};const i=I7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=ikt(o(function u(){const l=n.length;const c=n.bytesSeen;const d=c-s;if(!d||r.destroyed)return;const p=i(d);s=c;process.nextTick(()=>{r.emit("progress",{"loaded":c,"total":l,"progress":l?c/l:void 0,"bytes":d,"rate":p?p:void 0,"estimated":p&&l&&c<=l?(l-c)/p:void 0})})},"throttledHandler"),n.ticksRate);const a=o(()=>{n.updateProgress(true)},"onFinish");this.once("end",a);this.once("error",a)}_read(e){const r=this[sx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[sx];const a=s.maxRate;const u=this.readableHighWaterMark;const l=s.timeWindow;const c=1e3/l;const d=a/c;const p=s.minChunkSize!==false?Math.max(s.minChunkSize,d*.01):0;function f(m,g){const y=Buffer.byteLength(m);s.bytesSeen+=y;s.bytes+=y;if(s.isCaptured){s.updateProgress()}if(i.push(m)){process.nextTick(g)}else{s.onReadCallback=()=>{s.onReadCallback=null;process.nextTick(g)}}}o(f,"pushChunk");const h=o((m,g)=>{const y=Buffer.byteLength(m);let v=null;let w=u;let E;let b=0;if(a){const S=Date.now();if(!s.ts||(b=S-s.ts)>=l){s.ts=S;E=d-s.bytes;s.bytes=E<0?-E:0;b=0}E=d-s.bytes}if(a){if(E<=0){return setTimeout(()=>{g(null,m)},l-b)}if(E<w){w=E}}if(w&&y>w&&y-w>p){v=m.subarray(w);m=m.subarray(0,w)}f(m,v?()=>{process.nextTick(g,null,v)}:g)},"transformChunk");h(e,o(function m(g,y){if(g){return n(g)}if(y){h(y,m)}else{n(null)}},"transformNextChunk"))}setLength(e){this[sx].length=+e;return this}};var e7e=hK;var{asyncIterator:t7e}=Symbol;var skt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[t7e]){yield*t[t7e]()}else{yield t}},"readBlob");var P7e=skt;var akt=fe.ALPHABET.ALPHA_DIGIT+"-_";var ob=new d7e.TextEncoder;var hf="\r\n";var okt=ob.encode(hf);var ukt=2;var mK=class{static{o(this,"FormDataPart")}constructor(e,r){const{escapeName:n}=this.constructor;const i=fe.isString(r);let s=`Content-Disposition: form-data; name="${n(e)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${hf}`;if(i){r=ob.encode(String(r).replace(/\r?\n|\r\n?/g,hf))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${hf}`}this.headers=ob.encode(s+hf);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+ukt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*P7e(e)}yield okt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var lkt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,akt)}=r||{};if(!fe.isFormData(t)){throw TypeError("FormData instance required")}if(s.length<1||s.length>70){throw Error("boundary must be 10-70 characters long")}const a=ob.encode("--"+s+hf);const u=ob.encode("--"+s+"--"+hf+hf);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new mK(p,f);l+=h.size;return h});l+=a.byteLength*c.length;l=fe.toFiniteNumber(l);const d={"Content-Type":`multipart/form-data; boundary=${s}`};if(Number.isFinite(l)){d["Content-Length"]=l}e&&e(d);return p7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var ckt=lkt;var gK=class extends ff["default"].Transform{static{o(this,"ZlibHeaderTransformStream")}__transform(e,r,n){this.push(e);n()}_transform(e,r,n){if(e.length!==0){this._transform=this.__transform;if(e[0]!==120){const i=Buffer.alloc(2);i[0]=120;i[1]=156;this.push(i,r)}}this.__transform(e,r,n)}};var dkt=gK;var pkt=o((t,e)=>{return fe.isAsyncFn(t)?function(...r){const n=r.pop();t.apply(this,r).then(i=>{try{e?n(null,...e(i)):n(null,i)}catch(s){n(s)}},n)}:t},"callbackify");var fkt=pkt;var r7e={flush:mf["default"].constants.Z_SYNC_FLUSH,finishFlush:mf["default"].constants.Z_SYNC_FLUSH};var hkt={flush:mf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:mf["default"].constants.BROTLI_OPERATION_FLUSH};var n7e=fe.isFunction(mf["default"].createBrotliDecompress);var{http:mkt,https:gkt}=eDt["default"];var ykt=/https:?/;var i7e=Bo.protocols.map(t=>{return t+":"});function vkt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(vkt,"dispatchBeforeRedirect");function D7e(t,e,r){let n=e;if(!n&&n!==false){const i=HPt.getProxyForUrl(r);if(i){n=new URL(i)}}if(n){if(n.username){n.auth=(n.username||"")+":"+(n.password||"")}if(n.auth){if(n.auth.username||n.auth.password){n.auth=(n.auth.username||"")+":"+(n.auth.password||"")}const s=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+s}t.headers.host=t.hostname+(t.port?":"+t.port:"");const i=n.hostname||n.host;t.hostname=i;t.host=i;t.port=n.port;t.path=r;if(n.protocol){t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`}}t.beforeRedirects.proxy=o(function i(s){D7e(s,e,s.href)},"beforeRedirect")}o(D7e,"setProxy");var _kt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var Ekt=o(t=>{return new Promise((e,r)=>{let n;let i;const s=o((l,c)=>{if(i)return;i=true;n&&n(l,c)},"done");const a=o(l=>{s(l);e(l)},"_resolve");const u=o(l=>{s(l,true);r(l)},"_reject");t(a,u,l=>n=l).catch(u)})},"wrapAsync");var bkt=o(({address:t,family:e})=>{if(!fe.isString(t)){throw TypeError("address must be a string")}return{address:t,family:e||(t.indexOf(".")<0?6:4)}},"resolveFamily");var s7e=o((t,e)=>bkt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var wkt=_kt&&o(function t(e){return Ekt(o(async function r(n,i,s){let{data:a,lookup:u,family:l}=e;const{responseType:c,responseEncoding:d}=e;const p=e.method.toUpperCase();let f;let h=false;let m;if(u){const ue=fkt(u,xe=>fe.isArray(xe)?xe:[xe]);u=o((xe,we,Pe)=>{ue(xe,we,(Ue,$e,ge)=>{const Je=fe.isArray($e)?$e.map(Le=>s7e(Le)):[s7e($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new tDt["default"];const y=o(()=>{if(e.cancelToken){e.cancelToken.unsubscribe(v)}if(e.signal){e.signal.removeEventListener("abort",v)}g.removeAllListeners()},"onFinished");s((ue,xe)=>{f=true;if(xe){h=true;y()}});function v(ue){g.emit("abort",!ue||ue.type?new Dm(null,e,m):ue)}o(v,"abort");g.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(v);if(e.signal){e.signal.aborted?v():e.signal.addEventListener("abort",v)}}const w=xK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||i7e[0];if(b==="data:"){let ue;if(p!=="GET"){return sb(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=nkt(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(xe){throw nt.from(xe,nt.ERR_BAD_REQUEST,e)}if(c==="text"){ue=ue.toString(d);if(!d||d==="utf8"){ue=fe.stripBOM(ue)}}else if(c==="stream"){ue=ff["default"].Readable.from(ue)}return sb(n,i,{data:ue,status:200,statusText:"OK",headers:new Ho,config:e})}if(i7e.indexOf(b)===-1){return i(new nt("Unsupported protocol "+b,nt.ERR_BAD_REQUEST,e))}const S=Ho.from(e.headers).normalize();S.set("User-Agent","axios/"+lx,false);const T=e.onDownloadProgress;const A=e.onUploadProgress;const R=e.maxRate;let O=void 0;let j=void 0;if(fe.isSpecCompliantForm(a)){const ue=S.getContentType(/boundary=([-_\w\d]{10,70})/i);a=ckt(a,xe=>{S.set(xe)},{tag:`axios-${lx}-boundary`,boundary:ue&&ue[1]||void 0})}else if(fe.isFormData(a)&&fe.isFunction(a.getHeaders)){S.set(a.getHeaders());if(!S.hasContentLength()){try{const ue=await ZPt["default"].promisify(a.getLength).call(a);Number.isFinite(ue)&&ue>=0&&S.setContentLength(ue)}catch(ue){}}}else if(fe.isBlob(a)){a.size&&S.setContentType(a.type||"application/octet-stream");S.setContentLength(a.size||0);a=ff["default"].Readable.from(P7e(a))}else if(a&&!fe.isStream(a)){if(Buffer.isBuffer(a));else if(fe.isArrayBuffer(a)){a=Buffer.from(new Uint8Array(a))}else if(fe.isString(a)){a=Buffer.from(a,"utf-8")}else{return i(new nt("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",nt.ERR_BAD_REQUEST,e))}S.setContentLength(a.length,false);if(e.maxBodyLength>-1&&a.length>e.maxBodyLength){return i(new nt("Request body larger than maxBodyLength limit",nt.ERR_BAD_REQUEST,e))}}const B=fe.toFiniteNumber(S.getContentLength());if(fe.isArray(R)){O=R[0];j=R[1]}else{O=j=R}if(a&&(A||O)){if(!fe.isStream(a)){a=ff["default"].Readable.from(a,{objectMode:false})}a=ff["default"].pipeline([a,new e7e({length:B,maxRate:fe.toFiniteNumber(O)})],fe.noop);A&&a.on("progress",ue=>{A(Object.assign(ue,{upload:true}))})}let U=void 0;if(e.auth){const ue=e.auth.username||"";const xe=e.auth.password||"";U=ue+":"+xe}if(!U&&E.username){const ue=E.username;const xe=E.password;U=ue+":"+xe}U&&S.delete("authorization");let Q;try{Q=wK(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ue){const xe=new Error(ue.message);xe.config=e;xe.url=e.url;xe.exists=true;return i(xe)}S.set("Accept-Encoding","gzip, compress, deflate"+(n7e?", br":""),false);const oe={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:U,protocol:b,family:l,beforeRedirect:vkt,beforeRedirects:{}};!fe.isUndefined(u)&&(oe.lookup=u);if(e.socketPath){oe.socketPath=e.socketPath}else{oe.hostname=E.hostname;oe.port=E.port;D7e(oe,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+oe.path)}let Te;const le=ykt.test(oe.protocol);oe.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?XPt["default"]:QPt["default"]}else{if(e.maxRedirects){oe.maxRedirects=e.maxRedirects}if(e.beforeRedirect){oe.beforeRedirects.config=e.beforeRedirect}Te=le?gkt:mkt}if(e.maxBodyLength>-1){oe.maxBodyLength=e.maxBodyLength}else{oe.maxBodyLength=Infinity}if(e.insecureHTTPParser){oe.insecureHTTPParser=e.insecureHTTPParser}m=Te.request(oe,o(function ue(xe){if(m.destroyed)return;const we=[xe];const Pe=+xe.headers["content-length"];if(T){const Le=new e7e({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(j)});T&&Le.on("progress",Ie=>{T(Object.assign(Ie,{download:true}))});we.push(Le)}let Ue=xe;const $e=xe.req||m;if(e.decompress!==false&&xe.headers["content-encoding"]){if(p==="HEAD"||xe.statusCode===204){delete xe.headers["content-encoding"]}switch((xe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":we.push(mf["default"].createUnzip(r7e));delete xe.headers["content-encoding"];break;case"deflate":we.push(new dkt);we.push(mf["default"].createUnzip(r7e));delete xe.headers["content-encoding"];break;case"br":if(n7e){we.push(mf["default"].createBrotliDecompress(hkt));delete xe.headers["content-encoding"]}}}Ue=we.length>1?ff["default"].pipeline(we,fe.noop):we[0];const ge=ff["default"].finished(Ue,()=>{ge();y()});const Je={status:xe.statusCode,statusText:xe.statusMessage,headers:new Ho(xe.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;sb(n,i,Je)}else{const Le=[];let Ie=0;Ue.on("data",o(function Qe(qe){Le.push(qe);Ie+=qe.length;if(e.maxContentLength>-1&&Ie>e.maxContentLength){h=true;Ue.destroy();i(new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e))}},"handleStreamData"));Ue.on("aborted",o(function Qe(){if(h){return}const qe=new nt("maxContentLength size of "+e.maxContentLength+" exceeded",nt.ERR_BAD_RESPONSE,e,$e);Ue.destroy(qe);i(qe)},"handlerStreamAborted"));Ue.on("error",o(function Qe(qe){if(m.destroyed)return;i(nt.from(qe,null,e,$e))},"handleStreamError"));Ue.on("end",o(function Qe(){try{let qe=Le.length===1?Le[0]:Buffer.concat(Le);if(c!=="arraybuffer"){qe=qe.toString(d);if(!d||d==="utf8"){qe=fe.stripBOM(qe)}}Je.data=qe}catch(qe){return i(nt.from(qe,null,e,Je.request,Je))}sb(n,i,Je)},"handleStreamEnd"))}g.once("abort",Le=>{if(!Ue.destroyed){Ue.emit("error",Le);Ue.destroy()}})},"handleResponse"));g.once("abort",ue=>{i(ue);m.destroy(ue)});m.on("error",o(function ue(xe){i(nt.from(xe,null,e,m))},"handleRequestError"));m.on("socket",o(function ue(xe){xe.setKeepAlive(true,1e3*60)},"handleRequestSocket"));if(e.timeout){const ue=parseInt(e.timeout,10);if(Number.isNaN(ue)){i(new nt("error trying to parse `config.timeout` to int",nt.ERR_BAD_OPTION_VALUE,e,m));return}m.setTimeout(ue,o(function xe(){if(f)return;let we=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const Pe=e.transitional||SK;if(e.timeoutErrorMessage){we=e.timeoutErrorMessage}i(new nt(we,Pe.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,m));v()},"handleRequestTimeout"))}if(fe.isStream(a)){let ue=false;let xe=false;a.on("end",()=>{ue=true});a.once("error",we=>{xe=true;m.destroy(we)});a.on("close",()=>{if(!ue&&!xe){v(new Dm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var Skt=Bo.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];fe.isNumber(r)&&a.push("expires="+new Date(r).toGMTString());fe.isString(n)&&a.push("path="+n);fe.isString(i)&&a.push("domain="+i);s===true&&a.push("secure");document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Tkt=Bo.hasStandardBrowserEnv?o(function t(){const e=/(msie|trident)/i.test(navigator.userAgent);const r=document.createElement("a");let n;function i(s){let a=s;if(e){r.setAttribute("href",a);a=r.href}r.setAttribute("href",a);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}o(i,"resolveURL");n=i(window.location.href);return o(function s(a){const u=fe.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():o(function t(){return o(function e(){return true},"isURLSameOrigin")},"nonStandardBrowserEnv")();function a7e(t,e){let r=0;const n=I7e(50,250);return i=>{const s=i.loaded;const a=i.lengthComputable?i.total:void 0;const u=s-r;const l=n(u);const c=s<=a;r=s;const d={loaded:s,total:a,progress:a?s/a:void 0,bytes:u,rate:l?l:void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:i};d[e?"download":"upload"]=true;t(d)}}o(a7e,"progressEventReducer");var Akt=typeof XMLHttpRequest!=="undefined";var xkt=Akt&&function(t){return new Promise(o(function e(r,n){let i=t.data;const s=Ho.from(t.headers).normalize();let{responseType:a,withXSRFToken:u}=t;let l;function c(){if(t.cancelToken){t.cancelToken.unsubscribe(l)}if(t.signal){t.signal.removeEventListener("abort",l)}}o(c,"done");let d;if(fe.isFormData(i)){if(Bo.hasStandardBrowserEnv||Bo.hasStandardBrowserWebWorkerEnv){s.setContentType(false)}else if((d=s.getContentType())!==false){const[g,...y]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"";const y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=xK(t.baseURL,t.url);p.open(t.method.toUpperCase(),wK(f,t.params,t.paramsSerializer),true);p.timeout=t.timeout;function h(){if(!p){return}const g=Ho.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());const y=!a||a==="text"||a==="json"?p.responseText:p.response;const v={data:y,status:p.status,statusText:p.statusText,headers:g,config:t,request:p};sb(o(function w(E){r(E);c()},"_resolve"),o(function w(E){n(E);c()},"_reject"),v);p=null}o(h,"onloadend");if("onloadend"in p){p.onloadend=h}else{p.onreadystatechange=o(function g(){if(!p||p.readyState!==4){return}if(p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)){return}setTimeout(h)},"handleLoad")}p.onabort=o(function g(){if(!p){return}n(new nt("Request aborted",nt.ECONNABORTED,t,p));p=null},"handleAbort");p.onerror=o(function g(){n(new nt("Network Error",nt.ERR_NETWORK,t,p));p=null},"handleError");p.ontimeout=o(function g(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const v=t.transitional||SK;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Bo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&Tkt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&Skt.read(t.xsrfCookieName);if(g){s.set(t.xsrfHeaderName,g)}}}i===void 0&&s.setContentType(null);if("setRequestHeader"in p){fe.forEach(s.toJSON(),o(function g(y,v){p.setRequestHeader(v,y)},"setRequestHeader"))}if(!fe.isUndefined(t.withCredentials)){p.withCredentials=!!t.withCredentials}if(a&&a!=="json"){p.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){p.addEventListener("progress",a7e(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",a7e(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Dm(null,t,p):g);p.abort();p=null},"onCanceled");t.cancelToken&&t.cancelToken.subscribe(l);if(t.signal){t.signal.aborted?l():t.signal.addEventListener("abort",l)}}const m=N7e(f);if(m&&Bo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var yK={http:wkt,xhr:xkt};fe.forEach(yK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var o7e=o(t=>`- ${t}`,"renderReason");var Ckt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var k7e={getAdapter:t=>{t=fe.isArray(t)?t:[t];const{length:e}=t;let r;let n;const i={};for(let s=0;s<e;s++){r=t[s];let a;n=r;if(!Ckt(r)){n=yK[(a=String(r)).toLowerCase()];if(n===void 0){throw new nt(`Unknown adapter '${a}'`)}}if(n){break}i[a||"#"+s]=n}if(!n){const s=Object.entries(i).map(([u,l])=>`adapter ${u} `+(l===false?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?"since :\n"+s.map(o7e).join("\n"):" "+o7e(s[0]):"as no adapter specified";throw new nt(`There is no suitable adapter to dispatch the request `+a,"ERR_NOT_SUPPORT")}return n},adapters:yK};function cK(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Dm(null,t)}}o(cK,"throwIfCancellationRequested");function u7e(t){cK(t);t.headers=Ho.from(t.headers);t.data=lK.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=k7e.getAdapter(t.adapter||AK.adapter);return e(t).then(o(function r(n){cK(t);n.data=lK.call(t,t.transformResponse,n);n.headers=Ho.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!O7e(n)){cK(t);if(n&&n.response){n.response.data=lK.call(t,t.transformResponse,n.response);n.response.headers=Ho.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(u7e,"dispatchRequest");var l7e=o(t=>t instanceof Ho?t.toJSON():t,"headersToObject");function Ly(t,e){e=e||{};const r={};function n(c,d,p){if(fe.isPlainObject(c)&&fe.isPlainObject(d)){return fe.merge.call({caseless:p},c,d)}else if(fe.isPlainObject(d)){return fe.merge({},d)}else if(fe.isArray(d)){return d.slice()}return d}o(n,"getMergedValue");function i(c,d,p){if(!fe.isUndefined(d)){return n(c,d,p)}else if(!fe.isUndefined(c)){return n(void 0,c,p)}}o(i,"mergeDeepProperties");function s(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}}o(s,"valueFromConfig2");function a(c,d){if(!fe.isUndefined(d)){return n(void 0,d)}else if(!fe.isUndefined(c)){return n(void 0,c)}}o(a,"defaultToConfig2");function u(c,d,p){if(p in e){return n(c,d)}else if(p in t){return n(void 0,c)}}o(u,"mergeDirectKeys");const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u,headers:(c,d)=>i(l7e(c),l7e(d),true)};fe.forEach(Object.keys(Object.assign({},t,e)),o(function c(d){const p=l[d]||i;const f=p(t[d],e[d],d);fe.isUndefined(f)&&p!==u||(r[d]=f)},"computeConfigValue"));return r}o(Ly,"mergeConfig");var CK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{CK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var c7e={};CK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+lx+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}o(i,"formatMessage");return(s,a,u)=>{if(e===false){throw new nt(i(a," has been removed"+(r?" in "+r:"")),nt.ERR_DEPRECATED)}if(r&&!c7e[a]){c7e[a]=true;console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))}return e?e(s,a,u):true}},"transitional");function Rkt(t,e,r){if(typeof t!=="object"){throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE)}const n=Object.keys(t);let i=n.length;while(i-- >0){const s=n[i];const a=e[s];if(a){const u=t[s];const l=u===void 0||a(u,s,t);if(l!==true){throw new nt("option "+s+" must be "+l,nt.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new nt("Unknown option "+s,nt.ERR_BAD_OPTION)}}}o(Rkt,"assertOptions");var vK={assertOptions:Rkt,validators:CK};var pf=vK.validators;var qy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new XTe,response:new XTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=Ly(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){vK.assertOptions(n,{silentJSONParsing:pf.transitional(pf.boolean),forcedJSONParsing:pf.transitional(pf.boolean),clarifyTimeoutError:pf.transitional(pf.boolean)},false)}if(i!=null){if(fe.isFunction(i)){r.paramsSerializer={serialize:i}}else{vK.assertOptions(i,{encode:pf.function,serialize:pf.function},true)}}r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=s&&fe.merge(s.common,s[r.method]);s&&fe.forEach(["delete","get","head","post","put","patch","common"],m=>{delete s[m]});r.headers=Ho.concat(a,s);const u=[];let l=true;this.interceptors.request.forEach(o(function m(g){if(typeof g.runWhen==="function"&&g.runWhen(r)===false){return}l=l&&g.synchronous;u.unshift(g.fulfilled,g.rejected)},"unshiftRequestInterceptors"));const c=[];this.interceptors.response.forEach(o(function m(g){c.push(g.fulfilled,g.rejected)},"pushResponseInterceptors"));let d;let p=0;let f;if(!l){const m=[u7e.bind(this),void 0];m.unshift.apply(m,u);m.push.apply(m,c);f=m.length;d=Promise.resolve(r);while(p<f){d=d.then(m[p++],m[p++])}return d}f=u.length;let h=r;p=0;while(p<f){const m=u[p++];const g=u[p++];try{h=m(h)}catch(y){g.call(this,y);break}}try{d=u7e.call(this,h)}catch(m){return Promise.reject(m)}p=0;f=c.length;while(p<f){d=d.then(c[p++],c[p++])}return d}getUri(e){e=Ly(this.defaults,e);const r=xK(e.baseURL,e.url);return wK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){qy.prototype[e]=function(r,n){return this.request(Ly(n||{},{method:e,url:r,data:(n||{}).data}))}},"forEachMethodNoData"));fe.forEach(["post","put","patch"],o(function t(e){function r(n){return o(function i(s,a,u){return this.request(Ly(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");qy.prototype[e]=r();qy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var ux=qy;var _K=class t{static{o(this,"CancelToken")}constructor(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}let r;this.promise=new Promise(o(function i(s){r=s},"promiseExecutor"));const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;while(s-- >0){n._listeners[s](i)}n._listeners=null});this.promise.then=i=>{let s;const a=new Promise(u=>{n.subscribe(u);s=u}).then(i);a.cancel=o(function u(){n.unsubscribe(s)},"reject");return a};e(o(function i(s,a,u){if(n.reason){return}n.reason=new Dm(s,a,u);r(n.reason)},"cancel"))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const r=this._listeners.indexOf(e);if(r!==-1){this._listeners.splice(r,1)}}static source(){let e;const r=new t(o(function n(i){e=i},"executor"));return{token:r,cancel:e}}};var Okt=_K;function Nkt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(Nkt,"spread");function Ikt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Ikt,"isAxiosError");var EK={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(EK).forEach(([t,e])=>{EK[e]=t});var Pkt=EK;function $7e(t){const e=new ux(t);const r=h7e(ux.prototype.request,e);fe.extend(r,ux.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return $7e(Ly(t,i))},"create");return r}o($7e,"createInstance");var fi=$7e(AK);fi.Axios=ux;fi.CanceledError=Dm;fi.CancelToken=Okt;fi.isCancel=O7e;fi.VERSION=lx;fi.toFormData=fx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=Nkt;fi.isAxiosError=Ikt;fi.mergeConfig=Ly;fi.AxiosHeaders=Ho;fi.formToJSON=t=>R7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=k7e.getAdapter;fi.HttpStatusCode=Pkt;fi.default=fi;L7e.exports=fi});var gx=_(mx=>{"use strict";Object.defineProperty(mx,"__esModule",{value:true});mx.CredentialsMethod=void 0;var q7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(q7e||(mx.CredentialsMethod=q7e={}))});var $m=_(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:true});hi.FgaRequiredParamError=hi.FgaValidationError=hi.FgaApiAuthenticationError=hi.FgaApiInternalError=hi.FgaApiRateLimitExceededError=hi.FgaApiNotFoundError=hi.FgaApiValidationError=hi.FgaApiError=hi.FgaError=void 0;var Uy=class extends Error{static{o(this,"FgaError")}constructor(e,r){super(r||typeof e==="string"?e:`FGA Error${(e===null||e===void 0?void 0:e.message)?`: ${e.message}`:""}`);this.name="FgaError";if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaError=Uy;function vx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(vx,"getRequestMetadataFromPath");var j7e="fga-request-id";function kK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(kK,"getResponseHeaders");var km=class extends Uy{static{o(this,"FgaApiError")}constructor(e,r){var n,i,s,a,u,l,c,d,p,f;super(r?r:e);this.name="FgaApiError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestData=(s=e.config)===null||s===void 0?void 0:s.data;this.requestURL=(a=e.config)===null||a===void 0?void 0:a.url;this.method=(u=e.config)===null||u===void 0?void 0:u.method;const{storeId:h,endpointCategory:m}=vx((l=e.request)===null||l===void 0?void 0:l.path);this.storeId=h;this.endpointCategory=m;this.apiErrorMessage=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message;this.responseData=(p=e.response)===null||p===void 0?void 0:p.data;this.responseHeader=(f=e.response)===null||f===void 0?void 0:f.headers;const g=kK(e);this.requestId=g[j7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=km;var RK=class extends km{static{o(this,"FgaApiValidationError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiValidationError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:p}=vx((s=e.request)===null||s===void 0?void 0:s.path);this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Validation Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiValidationError=RK;var OK=class extends km{static{o(this,"FgaApiNotFoundError")}constructor(e,r){var n,i,s,a,u,l,c;super(e);this.name="FgaApiNotFoundError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;this.message=r?r:((a=(s=e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)?`FGA API NotFound Error: ${(u=e.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=e.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:e.message}};hi.FgaApiNotFoundError=OK;var NK=class extends km{static{o(this,"FgaApiRateLimitExceededError")}constructor(e,r){var n,i,s;super(e);this.name="FgaApiRateLimitExceededError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:a}=vx((s=e.request)===null||s===void 0?void 0:s.path);const u=kK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=NK;var IK=class extends km{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=vx((n=e.request)===null||n===void 0?void 0:n.path);this.apiErrorCode=(s=(i=e.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.code;this.message=r?r:((u=(a=e.response)===null||a===void 0?void 0:a.data)===null||u===void 0?void 0:u.message)?`FGA API Internal Error: ${(l=e.config)===null||l===void 0?void 0:l.method} ${p} : Error ${(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.message}`:e.message}};hi.FgaApiInternalError=IK;var PK=class extends Uy{static{o(this,"FgaApiAuthenticationError")}constructor(e){var r,n,i,s,a,u,l,c,d,p;super(`FGA Authentication Error.${((r=e.response)===null||r===void 0?void 0:r.statusText)?` ${e.response.statusText}`:""}`);this.name="FgaApiAuthenticationError";this.statusCode=(n=e.response)===null||n===void 0?void 0:n.status;this.statusText=(i=e.response)===null||i===void 0?void 0:i.statusText;this.requestURL=(s=e.config)===null||s===void 0?void 0:s.url;this.method=(a=e.config)===null||a===void 0?void 0:a.method;this.responseData=(u=e.response)===null||u===void 0?void 0:u.data;this.responseHeader=(l=e.response)===null||l===void 0?void 0:l.headers;this.apiErrorCode=(d=(c=e.response)===null||c===void 0?void 0:c.data)===null||d===void 0?void 0:d.code;const f=kK(e);this.requestId=f[j7e];let h;try{h=JSON.parse(((p=e.config)===null||p===void 0?void 0:p.data)||"{}")}catch(m){}this.clientId=h===null||h===void 0?void 0:h.client_id;this.audience=h===null||h===void 0?void 0:h.audience;this.grantType=h===null||h===void 0?void 0:h.grant_type;if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiAuthenticationError=PK;var yx=class extends Uy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=yx;var DK=class extends yx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=DK});var lb=_(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:true});gf.isWellFormedUlidString=gf.isWellFormedUriString=gf.assertParamExists=void 0;var Dkt=$m();var kkt=o(function(t,e,r){if(r===null||r===void 0){throw new Dkt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");gf.assertParamExists=kkt;var $kt=o(t=>{try{const e=new URL(t);return(e.toString()===t||e.toString()===`${t}/`)&&(e.protocol==="https:"||e.protocol==="http:")}catch(e){return false}},"isWellFormedUriString");gf.isWellFormedUriString=$kt;var Lkt=o(t=>{var e;const r=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/;return!!(typeof t==="string"&&((e=t.match(r))===null||e===void 0?void 0:e.length))},"isWellFormedUlidString");gf.isWellFormedUlidString=Lkt});var LK=_(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:true});Fy.Configuration=Fy.GetDefaultRetryParams=void 0;var cb=gx();var $K=$m();var _x=lb();var qkt=15;var jkt=100;var Ukt="openfga-sdk js/0.3.0";function Fkt(t=qkt,e=jkt){return{maxRetry:t,minWaitInMs:e}}o(Fkt,"GetDefaultRetryParams");Fy.GetDefaultRetryParams=Fkt;var Ex=class{static{o(this,"Configuration")}constructor(e={}){this.apiScheme="https";this.getBasePath=()=>`${this.apiScheme}://${this.apiHost}`;this.apiScheme=e.apiScheme||this.apiScheme;this.apiHost=e.apiHost;this.storeId=e.storeId;const r=e.credentials;if(r){switch(r===null||r===void 0?void 0:r.method){case cb.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case cb.CredentialsMethod.ClientCredentials:this.credentials={method:cb.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case cb.CredentialsMethod.None:default:this.credentials={method:cb.CredentialsMethod.None};break}}const n=e.baseOptions||{};n.headers=n.headers||{};if(typeof process==="object"&&process.title==="node"&&!n.headers["User-Agent"]){n.headers["User-Agent"]=Ukt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,_x.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,_x.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,_x.isWellFormedUriString)(this.getBasePath())){throw new $K.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,_x.isWellFormedUlidString)(this.storeId)){throw new $K.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new $K.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};Fy.Configuration=Ex;Ex.sdkVersion="0.3.0"});var U7e=_(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:true});bx.assertNever=void 0;function Mkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Mkt,"assertNever");bx.assertNever=Mkt});var F7e=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.chunkArray=void 0;function Bkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Bkt,"chunkArray");wx.chunkArray=Bkt});var B7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var Sx=require("crypto");function M7e(){if(typeof Sx.randomUUID==="function"){return(0,Sx.randomUUID)()}if(typeof Sx.randomBytes==="function"){return(0,Sx.randomBytes)(20).toString("hex")}return}o(M7e,"generateRandomId");My.generateRandomId=M7e;function Vkt(){return M7e()||"00000000-0000-0000-0000-000000000000"}o(Vkt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Vkt});var V7e=_(Tx=>{"use strict";Object.defineProperty(Tx,"__esModule",{value:true});Tx.setHeaderIfNotSet=void 0;function Hkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Hkt,"setHeaderIfNotSet");Tx.setHeaderIfNotSet=Hkt});var H7e=_(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:true});Ax.setNotEnumerableProperty=void 0;function zkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(zkt,"setNotEnumerableProperty");Ax.setNotEnumerableProperty=zkt});var qK=_($u=>{"use strict";var Gkt=$u&&$u.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var db=$u&&$u.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Gkt(e,t,r)};Object.defineProperty($u,"__esModule",{value:true});db(U7e(),$u);db(F7e(),$u);db(B7e(),$u);db(V7e(),$u);db(H7e(),$u)});var UK=_(yi=>{"use strict";var jK=yi&&yi.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(yi,"__esModule",{value:true});yi.createRequestFunction=yi.attemptHttpRequest=yi.toPathString=yi.serializeDataIfNeeded=yi.setSearchParams=yi.setBearerAuthToObject=yi.DUMMY_BASE_URL=void 0;var Kkt=xx();var Lm=$m();var Ykt=qK();yi.DUMMY_BASE_URL="https://example.com";var Wkt=o(function(t,e){return jK(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=Wkt;var Jkt=o(function(t,...e){const r=new URLSearchParams(t.search);for(const n of e){for(const i in n){if(Array.isArray(n[i])){r.delete(i);for(const s of n[i]){r.append(i,s)}}else{r.set(i,n[i])}}}t.search=r.toString()},"setSearchParams");yi.setSearchParams=Jkt;var Qkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Xkt=o(function(t,e){const r=typeof t!=="string";const n=r?Qkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Xkt;var Zkt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Zkt;function e$t(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(e$t,"isAxiosError");function t$t(t,e){const r=Math.ceil(Math.pow(2,t)*e);const n=Math.ceil(Math.pow(2,t+1)*e);return Math.floor(Math.random()*(n-r)+r)}o(t$t,"randomTime");function z7e(t,e,r){var n;return jK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!e$t(s)){throw new Lm.FgaError(s)}const a=(n=s===null||s===void 0?void 0:s.response)===null||n===void 0?void 0:n.status;if(a===400||a===422){throw new Lm.FgaApiValidationError(s)}else if(a===401||a===403){throw new Lm.FgaApiAuthenticationError(s)}else if(a===404){throw new Lm.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new Lm.FgaApiRateLimitExceededError(s)}else{throw new Lm.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,t$t(i,e.minWaitInMs)))}else{throw new Lm.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(z7e,"attemptHttpRequest");yi.attemptHttpRequest=z7e;var r$t=o(function(t,e,r,n){var i,s;r.isValid();const a=((i=t.options)===null||i===void 0?void 0:i.retryParams)?(s=t.options)===null||s===void 0?void 0:s.retryParams:r.retryParams;const u=a?a.maxRetry:0;const l=a?a.minWaitInMs:0;if(!n){n=Kkt.Credentials.init(r)}return(c=e)=>jK(this,void 0,void 0,function*(){yield(0,yi.setBearerAuthToObject)(t.options.headers,n);const d=Object.assign(Object.assign({},t.options),{url:r.getBasePath()+t.url});const p=yield z7e(d,{maxRetry:u,minWaitInMs:l},c);const f=typeof(p===null||p===void 0?void 0:p.data)==="undefined"?{}:p===null||p===void 0?void 0:p.data;const h=Object.assign({},f);(0,Ykt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=r$t});var K7e=_(By=>{"use strict";var FK=By&&By.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(By,"__esModule",{value:true});By.Credentials=void 0;var G7e=hx();var yf=lb();var MK=$m();var n$t=UK();var zo=gx();var BK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=G7e.default){this.authConfig=e;this.axios=r;this.initConfig();this.isValid()}initConfig(){var e;switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case zo.CredentialsMethod.ApiToken:if(this.authConfig.config){if(!this.authConfig.config.headerName){this.authConfig.config.headerName="Authorization"}if(!this.authConfig.config.headerValuePrefix){this.authConfig.config.headerValuePrefix="Bearer"}}break;case zo.CredentialsMethod.ClientCredentials:case zo.CredentialsMethod.None:default:break}}isValid(){var e,r,n,i,s,a,u,l,c;const{authConfig:d}=this;switch(d===null||d===void 0?void 0:d.method){case zo.CredentialsMethod.None:break;case zo.CredentialsMethod.ApiToken:(0,yf.assertParamExists)("Credentials","config.token",(e=d.config)===null||e===void 0?void 0:e.token);(0,yf.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName);(0,yf.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case zo.CredentialsMethod.ClientCredentials:(0,yf.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId);(0,yf.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret);(0,yf.assertParamExists)("Credentials","config.apiTokenIssuer",(a=d.config)===null||a===void 0?void 0:a.apiTokenIssuer);(0,yf.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience);if(!(0,yf.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`)){throw new MK.FgaValidationError(`Configuration.apiTokenIssuer does not form a valid URI (https://${(c=d.config)===null||c===void 0?void 0:c.apiTokenIssuer})`)}break}}getAccessTokenHeader(){var e;return FK(this,void 0,void 0,function*(){const r=yield this.getAccessTokenValue();switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case zo.CredentialsMethod.None:return;case zo.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case zo.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var e;return FK(this,void 0,void 0,function*(){switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case zo.CredentialsMethod.None:return;case zo.CredentialsMethod.ApiToken:return this.authConfig.config.token;case zo.CredentialsMethod.ClientCredentials:if(this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)){return this.accessToken}return this.refreshAccessToken()}})}refreshAccessToken(){var e;return FK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,n$t.attemptHttpRequest)({url:`https://${r.apiTokenIssuer}/oauth/token`,method:"post",data:{client_id:r.clientId,client_secret:r.clientSecret,audience:r.apiAudience,grant_type:"client_credentials"}},{maxRetry:3,minWaitInMs:100},G7e.default);if(n){this.accessToken=n.data.access_token;this.accessTokenExpiryDate=new Date(Date.now()+n.data.expires_in*1e3)}return this.accessToken}catch(n){if(n instanceof MK.FgaApiError){n.constructor=MK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};By.Credentials=BK});var xx=_(vf=>{"use strict";var i$t=vf&&vf.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var Y7e=vf&&vf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))i$t(e,t,r)};Object.defineProperty(vf,"__esModule",{value:true});Y7e(K7e(),vf);Y7e(gx(),vf)});var HK=_(Cx=>{"use strict";Object.defineProperty(Cx,"__esModule",{value:true});Cx.BaseAPI=void 0;var s$t=hx();var a$t=require("http");var o$t=require("https");var W7e=LK();var u$t=xx();var l$t=1e4;var VK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof W7e.Configuration){this.configuration=e}else{this.configuration=new W7e.Configuration(e)}this.configuration.isValid();this.credentials=u$t.Credentials.init(this.configuration);if(!this.axios){const i=new a$t.Agent({keepAlive:true});const s=new o$t.Agent({keepAlive:true});this.axios=s$t.default.create({httpAgent:i,httpsAgent:s,timeout:l$t,headers:(n=this.configuration.baseOptions)===null||n===void 0?void 0:n.headers})}}get storeId(){return this.configuration.storeId}set storeId(e){this.configuration.storeId=e}};Cx.BaseAPI=VK});var GK=_(tn=>{"use strict";var Zr=tn&&tn.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};Object.defineProperty(tn,"__esModule",{value:true});tn.OpenFgaApi=tn.OpenFgaApiFactory=tn.OpenFgaApiFp=tn.OpenFgaApiAxiosParamCreator=void 0;var zs=hx();var c$t=HK();var We=UK();var Vn=lb();var d$t=o(function(t,e){return{check:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("check","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/check".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),createStore:(r,n={})=>Zr(this,void 0,void 0,function*(){const i="/stores";const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),deleteStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"DELETE"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),expand:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("expand","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/expand".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),getStore:(r={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const n="/stores/{store_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const i=new URL(n,We.DUMMY_BASE_URL);let s;if(t){s=t.baseOptions}const a=Object.assign(Object.assign({method:"GET"},s),r);const u={};const l={};(0,We.setSearchParams)(i,l,r.query);a.headers=Object.assign(Object.assign({},u),r.headers);return{url:(0,We.toPathString)(i),options:a}}),listObjects:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("listObjects","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/list-objects".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),listStores:(r,n,i={})=>Zr(this,void 0,void 0,function*(){const s="/stores";const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),read:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("read","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/read".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),readAssertions:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("readAuthorizationModel","id",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models/{id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"id"}}`,encodeURIComponent(String(r)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"GET"},a),n);const l={};const c={};(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);return{url:(0,We.toPathString)(s),options:u}}),readAuthorizationModels:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"GET"},u),i);const c={};const d={};if(r!==void 0){d["page_size"]=r}if(n!==void 0){d["continuation_token"]=n}(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);return{url:(0,We.toPathString)(a),options:l}}),readChanges:(r,n,i,s={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const a="/stores/{store_id}/changes".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const u=new URL(a,We.DUMMY_BASE_URL);let l;if(t){l=t.baseOptions}const c=Object.assign(Object.assign({method:"GET"},l),s);const d={};const p={};if(r!==void 0){p["type"]=r}if(n!==void 0){p["page_size"]=n}if(i!==void 0){p["continuation_token"]=i}(0,We.setSearchParams)(u,p,s.query);c.headers=Object.assign(Object.assign({},d),s.headers);return{url:(0,We.toPathString)(u),options:c}}),write:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("write","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/write".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}}),writeAssertions:(r,n,i={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAssertions","authorizationModelId",r);(0,Vn.assertParamExists)("writeAssertions","body",n);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const s="/stores/{store_id}/assertions/{authorization_model_id}".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId))).replace(`{${"authorization_model_id"}}`,encodeURIComponent(String(r)));const a=new URL(s,We.DUMMY_BASE_URL);let u;if(t){u=t.baseOptions}const l=Object.assign(Object.assign({method:"PUT"},u),i);const c={};const d={};c["Content-Type"]="application/json";(0,We.setSearchParams)(a,d,i.query);l.headers=Object.assign(Object.assign({},c),i.headers);l.data=(0,We.serializeDataIfNeeded)(n,l);return{url:(0,We.toPathString)(a),options:l}}),writeAuthorizationModel:(r,n={})=>Zr(this,void 0,void 0,function*(){(0,Vn.assertParamExists)("writeAuthorizationModel","body",r);(0,Vn.assertParamExists)("Configuration","storeId",t.storeId);const i="/stores/{store_id}/authorization-models".replace(`{${"store_id"}}`,encodeURIComponent(String(t.storeId)));const s=new URL(i,We.DUMMY_BASE_URL);let a;if(t){a=t.baseOptions}const u=Object.assign(Object.assign({method:"POST"},a),n);const l={};const c={};l["Content-Type"]="application/json";(0,We.setSearchParams)(s,c,n.query);u.headers=Object.assign(Object.assign({},l),n.headers);u.data=(0,We.serializeDataIfNeeded)(r,u);return{url:(0,We.toPathString)(s),options:u}})}},"OpenFgaApiAxiosParamCreator");tn.OpenFgaApiAxiosParamCreator=d$t;var p$t=o(function(t,e){const r=(0,tn.OpenFgaApiAxiosParamCreator)(t,e);return{check(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.check(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},createStore(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.createStore(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},deleteStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.deleteStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},expand(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.expand(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},getStore(n){return Zr(this,void 0,void 0,function*(){const i=yield r.getStore(n);return(0,We.createRequestFunction)(i,zs.default,t,e)})},listObjects(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.listObjects(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},listStores(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.listStores(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},read(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.read(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAssertions(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAssertions(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.readAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},readAuthorizationModels(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.readAuthorizationModels(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},readChanges(n,i,s,a){return Zr(this,void 0,void 0,function*(){const u=yield r.readChanges(n,i,s,a);return(0,We.createRequestFunction)(u,zs.default,t,e)})},write(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.write(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})},writeAssertions(n,i,s){return Zr(this,void 0,void 0,function*(){const a=yield r.writeAssertions(n,i,s);return(0,We.createRequestFunction)(a,zs.default,t,e)})},writeAuthorizationModel(n,i){return Zr(this,void 0,void 0,function*(){const s=yield r.writeAuthorizationModel(n,i);return(0,We.createRequestFunction)(s,zs.default,t,e)})}}},"OpenFgaApiFp");tn.OpenFgaApiFp=p$t;var f$t=o(function(t,e,r){const n=(0,tn.OpenFgaApiFp)(t,e);return{check(i,s){return n.check(i,s).then(a=>a(r))},createStore(i,s){return n.createStore(i,s).then(a=>a(r))},deleteStore(i){return n.deleteStore(i).then(s=>s(r))},expand(i,s){return n.expand(i,s).then(a=>a(r))},getStore(i){return n.getStore(i).then(s=>s(r))},listObjects(i,s){return n.listObjects(i,s).then(a=>a(r))},listStores(i,s,a){return n.listStores(i,s,a).then(u=>u(r))},read(i,s){return n.read(i,s).then(a=>a(r))},readAssertions(i,s){return n.readAssertions(i,s).then(a=>a(r))},readAuthorizationModel(i,s){return n.readAuthorizationModel(i,s).then(a=>a(r))},readAuthorizationModels(i,s,a){return n.readAuthorizationModels(i,s,a).then(u=>u(r))},readChanges(i,s,a,u){return n.readChanges(i,s,a,u).then(l=>l(r))},write(i,s){return n.write(i,s).then(a=>a(r))},writeAssertions(i,s,a){return n.writeAssertions(i,s,a).then(u=>u(r))},writeAuthorizationModel(i,s){return n.writeAuthorizationModel(i,s).then(a=>a(r))}}},"OpenFgaApiFactory");tn.OpenFgaApiFactory=f$t;var zK=class extends c$t.BaseAPI{static{o(this,"OpenFgaApi")}check(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).check(e,r).then(n=>n(this.axios))}createStore(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).createStore(e,r).then(n=>n(this.axios))}deleteStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).deleteStore(e).then(r=>r(this.axios))}expand(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).expand(e,r).then(n=>n(this.axios))}getStore(e){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).getStore(e).then(r=>r(this.axios))}listObjects(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listObjects(e,r).then(n=>n(this.axios))}listStores(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).listStores(e,r,n).then(i=>i(this.axios))}read(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).read(e,r).then(n=>n(this.axios))}readAssertions(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAssertions(e,r).then(n=>n(this.axios))}readAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModel(e,r).then(n=>n(this.axios))}readAuthorizationModels(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readAuthorizationModels(e,r,n).then(i=>i(this.axios))}readChanges(e,r,n,i){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).readChanges(e,r,n,i).then(s=>s(this.axios))}write(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).write(e,r).then(n=>n(this.axios))}writeAssertions(e,r,n){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAssertions(e,r,n).then(i=>i(this.axios))}writeAuthorizationModel(e,r){return(0,tn.OpenFgaApiFp)(this.configuration,this.credentials).writeAuthorizationModel(e,r).then(n=>n(this.axios))}};tn.OpenFgaApi=zK});var Q7e=_((qmr,J7e)=>{async function*h$t(t,e,r){const n=new Set;async function i(){const[s,a]=await Promise.race(n);n.delete(s);return a}o(i,"consume");for(const s of e){const a=(async()=>await r(s,e))().then(u=>[a,u]);n.add(a);if(n.size>=t){yield await i()}}while(n.size){yield await i()}}o(h$t,"asyncPool");J7e.exports=h$t});var X7e=_(zl=>{"use strict";var Hn=zl&&zl.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(a){a(s)})}o(i,"adopt");return new(r||(r=Promise))(function(s,a){function u(d){try{c(n.next(d))}catch(p){a(p)}}o(u,"fulfilled");function l(d){try{c(n["throw"](d))}catch(p){a(p)}}o(l,"rejected");function c(d){d.done?s(d.value):i(d.value).then(u,l)}o(c,"step");c((n=n.apply(t,e||[])).next())})};var KK=zl&&zl.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values==="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(a){return new Promise(function(u,l){a=t[s](a),i(u,l,a.done,a.value)})}}o(n,"verb");function i(s,a,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},a)}o(i,"settle")};Object.defineProperty(zl,"__esModule",{value:true});zl.OpenFgaClient=zl.ClientWriteStatus=void 0;var YK=Q7e();var m$t=GK();var g$t=HK();var WK=$m();var Aa=qK();var y$t=lb();var JK=10;var Vy="X-OpenFGA-Client-Method";var QK="X-OpenFGA-Client-Bulk-Request-Id";var Hy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(Hy||(zl.ClientWriteStatus=Hy={}));var XK=class extends g$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new m$t.OpenFgaApi(this.configuration,r);this.authorizationModelId=e.authorizationModelId;this.getAuthorizationModelId()}getAuthorizationModelId(e={}){const r=(e===null||e===void 0?void 0:e.authorizationModelId)||this.authorizationModelId;if(r&&!(0,y$t.isWellFormedUlidString)(r)){throw new WK.FgaValidationError("authorizationModelId")}return r}checkValidApiConnection(e={}){return Hn(this,void 0,void 0,function*(){if(this.getAuthorizationModelId(e)){yield this.readAuthorizationModel(e)}else{yield this.readLatestAuthorizationModel(e)}})}listStores(e={}){return Hn(this,void 0,void 0,function*(){return this.api.listStores(e.pageSize,e.continuationToken,e)})}createStore(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.createStore(e,r)})}getStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.getStore(e)})}deleteStore(e={}){return Hn(this,void 0,void 0,function*(){return this.api.deleteStore(e)})}readAuthorizationModels(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAuthorizationModels(e.pageSize,e.continuationToken,e)})}writeAuthorizationModel(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAuthorizationModel(e,r)})}readAuthorizationModel(e={}){return Hn(this,void 0,void 0,function*(){const r=this.getAuthorizationModelId(e);if(!r){throw new WK.FgaRequiredParamError("ClientConfiguration","authorizationModelId")}return this.api.readAuthorizationModel(r,e)})}readLatestAuthorizationModel(e={}){var r;return Hn(this,void 0,void 0,function*(){const{headers:n={}}=e;(0,Aa.setHeaderIfNotSet)(n,Vy,"ReadLatestAuthorizationModel");const i=yield this.readAuthorizationModels(Object.assign(Object.assign({},e),{pageSize:1,headers:n}));const s=i;s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0];delete s.authorization_models;return s})}readChanges(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.readChanges(e.type,r.pageSize,r.continuationToken,r)})}read(e={},r={}){return Hn(this,void 0,void 0,function*(){const n={page_size:r.pageSize,continuation_token:r.continuationToken};if(e.user||e.object||e.relation){n.tuple_key=e}return this.api.read(n,r)})}write(e,r={}){return Hn(this,void 0,void 0,function*(){const{transaction:n={},headers:i={}}=r;const{maxPerChunk:s=1,maxParallelRequests:a=JK}=n;const{writes:u,deletes:l}=e;const c=this.getAuthorizationModelId(r);if(!(n===null||n===void 0?void 0:n.disable)){const d={authorization_model_id:c};if(u===null||u===void 0?void 0:u.length){d.writes={tuple_keys:u}}if(l===null||l===void 0?void 0:l.length){d.deletes={tuple_keys:l}}yield this.api.write(d,r);return{writes:(u===null||u===void 0?void 0:u.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:Hy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Aa.setHeaderIfNotSet)(i,Vy,"Write");(0,Aa.setHeaderIfNotSet)(i,QK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=KK(YK(a,(0,Aa.chunkArray)(u,s),j=>this.writeTuples(j,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(B=>({writes:j.map(U=>({tuple_key:U,status:Hy.FAILURE,err:B})),deletes:[]})))),S;S=yield b.next(),d=S.done,!d;E=true){h=S.value;E=false;const j=h;w.push(j.writes)}}catch(j){p={error:j}}finally{try{if(!E&&!d&&(f=b.return))yield f.call(b)}finally{if(p)throw p.error}}}const T=[];if(l===null||l===void 0?void 0:l.length){try{for(var A=true,R=KK(YK(a,(0,Aa.chunkArray)(l,s),j=>this.deleteTuples(j,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(B=>({writes:[],deletes:j.map(U=>({tuple_key:U,status:Hy.FAILURE,err:B}))})))),O;O=yield R.next(),m=O.done,!m;A=true){v=O.value;A=false;const j=v;T.push(j.deletes)}}catch(j){g={error:j}}finally{try{if(!A&&!m&&(y=R.return))yield y.call(R)}finally{if(g)throw g.error}}}return{writes:w.flat(),deletes:T.flat()}}))(),this.checkValidApiConnection(r)]).then(d=>d[0])})}writeTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"WriteTuples");return this.write({writes:e},Object.assign(Object.assign({},r),{headers:n}))})}deleteTuples(e,r={}){return Hn(this,void 0,void 0,function*(){const{headers:n={}}=r;(0,Aa.setHeaderIfNotSet)(n,Vy,"DeleteTuples");return this.write({deletes:e},Object.assign(Object.assign({},r),{headers:n}))})}check(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:e.user,relation:e.relation,object:e.object},context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(e,r={}){return Hn(this,void 0,void 0,function*(){return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var n,i,s,a;const{headers:u={},maxParallelRequests:l=JK}=r;(0,Aa.setHeaderIfNotSet)(u,Vy,"BatchCheck");(0,Aa.setHeaderIfNotSet)(u,QK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=KK(YK(l,e,h=>this.check(h,Object.assign(Object.assign({},r),{headers:u})).then(m=>{m._request=h;return m}).catch(m=>{return{allowed:void 0,error:m,_request:h}}))),f;f=yield p.next(),n=f.done,!n;d=true){a=f.value;d=false;const h=a;c.push(h)}}catch(h){i={error:h}}finally{try{if(!d&&!n&&(s=p.return))yield s.call(p)}finally{if(i)throw i.error}}return{responses:c}}))(),this.checkValidApiConnection(r)]).then(n=>n[0])})}expand(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:e},r)})}listObjects(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:e.user,relation:e.relation,type:e.type,context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]}},r)})}listRelations(e,r={}){return Hn(this,void 0,void 0,function*(){const{user:n,object:i,relations:s,contextualTuples:a,context:u}=e;const{headers:l={},maxParallelRequests:c=JK}=r;(0,Aa.setHeaderIfNotSet)(l,Vy,"ListRelations");(0,Aa.setHeaderIfNotSet)(l,QK,(0,Aa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new WK.FgaValidationError("relations","When calling listRelations, at least one relation must be passed in the relations field")}const d=yield this.batchCheck(s.map(f=>({user:n,relation:f,object:i,contextualTuples:a,context:u})),Object.assign(Object.assign({},r),{headers:l,maxParallelRequests:c}));const p=d.responses.find(f=>f.error);if(p){throw p.error}return{relations:d.responses.filter(f=>f.allowed).map(f=>f._request.relation)}})}readAssertions(e={}){return Hn(this,void 0,void 0,function*(){return this.api.readAssertions(this.getAuthorizationModelId(e),e)})}writeAssertions(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.writeAssertions(this.getAuthorizationModelId(r),{assertions:e.map(n=>({tuple_key:{user:n.user,relation:n.relation,object:n.object},expectation:n.expectation}))},r)})}};zl.OpenFgaClient=XK});var sAe=_(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:true});xa.TypeName=xa.TupleOperation=xa.NullValue=xa.NotFoundErrorCode=xa.InternalErrorCode=xa.ErrorCode=void 0;var Z7e;(function(t){t["NoError"]="no_error";t["ValidationError"]="validation_error";t["AuthorizationModelNotFound"]="authorization_model_not_found";t["AuthorizationModelResolutionTooComplex"]="authorization_model_resolution_too_complex";t["InvalidWriteInput"]="invalid_write_input";t["CannotAllowDuplicateTuplesInOneRequest"]="cannot_allow_duplicate_tuples_in_one_request";t["CannotAllowDuplicateTypesInOneRequest"]="cannot_allow_duplicate_types_in_one_request";t["CannotAllowMultipleReferencesToOneRelation"]="cannot_allow_multiple_references_to_one_relation";t["InvalidContinuationToken"]="invalid_continuation_token";t["InvalidTupleSet"]="invalid_tuple_set";t["InvalidCheckInput"]="invalid_check_input";t["InvalidExpandInput"]="invalid_expand_input";t["UnsupportedUserSet"]="unsupported_user_set";t["InvalidObjectFormat"]="invalid_object_format";t["WriteFailedDueToInvalidInput"]="write_failed_due_to_invalid_input";t["AuthorizationModelAssertionsNotFound"]="authorization_model_assertions_not_found";t["LatestAuthorizationModelNotFound"]="latest_authorization_model_not_found";t["TypeNotFound"]="type_not_found";t["RelationNotFound"]="relation_not_found";t["EmptyRelationDefinition"]="empty_relation_definition";t["InvalidUser"]="invalid_user";t["InvalidTuple"]="invalid_tuple";t["UnknownRelation"]="unknown_relation";t["StoreIdInvalidLength"]="store_id_invalid_length";t["AssertionsTooManyItems"]="assertions_too_many_items";t["IdTooLong"]="id_too_long";t["AuthorizationModelIdTooLong"]="authorization_model_id_too_long";t["TupleKeyValueNotSpecified"]="tuple_key_value_not_specified";t["TupleKeysTooManyOrTooFewItems"]="tuple_keys_too_many_or_too_few_items";t["PageSizeInvalid"]="page_size_invalid";t["ParamMissingValue"]="param_missing_value";t["DifferenceBaseMissingValue"]="difference_base_missing_value";t["SubtractBaseMissingValue"]="subtract_base_missing_value";t["ObjectTooLong"]="object_too_long";t["RelationTooLong"]="relation_too_long";t["TypeDefinitionsTooFewItems"]="type_definitions_too_few_items";t["TypeInvalidLength"]="type_invalid_length";t["TypeInvalidPattern"]="type_invalid_pattern";t["RelationsTooFewItems"]="relations_too_few_items";t["RelationsTooLong"]="relations_too_long";t["RelationsInvalidPattern"]="relations_invalid_pattern";t["ObjectInvalidPattern"]="object_invalid_pattern";t["QueryStringTypeContinuationTokenMismatch"]="query_string_type_continuation_token_mismatch";t["ExceededEntityLimit"]="exceeded_entity_limit";t["InvalidContextualTuple"]="invalid_contextual_tuple";t["DuplicateContextualTuple"]="duplicate_contextual_tuple";t["InvalidAuthorizationModel"]="invalid_authorization_model";t["UnsupportedSchemaVersion"]="unsupported_schema_version"})(Z7e||(xa.ErrorCode=Z7e={}));var eAe;(function(t){t["NoInternalError"]="no_internal_error";t["InternalError"]="internal_error";t["Cancelled"]="cancelled";t["DeadlineExceeded"]="deadline_exceeded";t["AlreadyExists"]="already_exists";t["ResourceExhausted"]="resource_exhausted";t["FailedPrecondition"]="failed_precondition";t["Aborted"]="aborted";t["OutOfRange"]="out_of_range";t["Unavailable"]="unavailable";t["DataLoss"]="data_loss"})(eAe||(xa.InternalErrorCode=eAe={}));var tAe;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(tAe||(xa.NotFoundErrorCode=tAe={}));var rAe;(function(t){t["NullValue"]="NULL_VALUE"})(rAe||(xa.NullValue=rAe={}));var nAe;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(nAe||(xa.TupleOperation=nAe={}));var iAe;(function(t){t["Unspecified"]="TYPE_NAME_UNSPECIFIED";t["Any"]="TYPE_NAME_ANY";t["Bool"]="TYPE_NAME_BOOL";t["String"]="TYPE_NAME_STRING";t["Int"]="TYPE_NAME_INT";t["Uint"]="TYPE_NAME_UINT";t["Double"]="TYPE_NAME_DOUBLE";t["Duration"]="TYPE_NAME_DURATION";t["Timestamp"]="TYPE_NAME_TIMESTAMP";t["Map"]="TYPE_NAME_MAP";t["List"]="TYPE_NAME_LIST";t["Ipaddress"]="TYPE_NAME_IPADDRESS"})(iAe||(xa.TypeName=iAe={}))});var uAe=_($i=>{"use strict";var v$t=$i&&$i.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var Rx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))v$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Rx(GK(),$i);Rx(X7e(),$i);Rx(sAe(),$i);var aAe=LK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return aAe.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return aAe.GetDefaultRetryParams}});var oAe=xx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return oAe.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return oAe.CredentialsMethod}});Rx($m(),$i)});var cAe=_(zy=>{"use strict";var _$t=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zy,"__esModule",{value:true});zy.OpenFGAService=void 0;var pb=_$t(Oa());var lAe=uAe();var E$t=Ry();var ZK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!pb.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=pb.default.OPENFGA_SERVICE_URL;this.apiHost=pb.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=pb.default.OPENFGA_STORE_ID;this.modelId=pb.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,E$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new lAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:lAe.CredentialsMethod.ApiToken,config:{token:e}}})}return this.openFGAClient}async createAccountMember(e){try{const r=await this.getOpenFgaClient();await r.write({writes:[{user:`user:${this.userSub}`,relation:"admin",object:`account:${e}`}]})}catch(r){this.logger.warn(`RBAC failed to create account membership. Error: ${r.message}`)}}async getAccountMemberships(){const e=await this.getOpenFgaClient();const r=await e.listObjects({user:`user:${this.userSub}`,relation:"member",type:"account"});if(r){return r.objects.map(n=>n.replace(/^(account:)/,""))}return[]}async isAccountMember(e){try{const r=await this.getOpenFgaClient();const{allowed:n}=await r.check({user:`user:${this.userSub}`,relation:"member",object:`account:${e}`});if(!n){return false}return n}catch(r){this.logger.warn(`RBAC failed to check account membership. Error: ${r.message}`);return false}}async isZuploAdmin(){try{const e=await this.getOpenFgaClient();const{tuples:r}=await e.read({object:"role:zuplo-admin"});const n=[];r.forEach(i=>{const s=i.key.user.replace(/^(user:)/,"");n.push(s)});return n.includes(this.userSub)}catch(e){this.logger.warn(`RBAC failed to check for zuplo admin. Error: ${e.message}`);return false}}async isDeployerServiceAccount(){try{const e=await this.getOpenFgaClient();const{tuples:r}=await e.read({object:"role:zuplo-deployer"});const n=[];r.forEach(i=>{const s=i.key.user.replace(/^(user:)/,"");n.push(s)});return n.includes(this.userSub)}catch(e){this.logger.warn(`RBAC failed to check for zuplo deployer. Error: ${e.message}`);return false}}async createProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({writes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to create account-project association. Error: ${n.message}`)}}async deleteProjectAccountAssociation(e,r){try{const n=await this.getOpenFgaClient();await n.write({deletes:[{user:`account:${e}`,relation:"associated_account",object:`project:${r}`}]})}catch(n){this.logger.warn(`RBAC failed to delete account-project association. Error: ${n.message}`)}}};zy.OpenFGAService=ZK});var fAe=_(Gy=>{"use strict";var pAe=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.TenantService=void 0;var b$t=pAe(ru());var dAe=pAe(Oa());var w$t=X6();var S$t=new b$t.default({max:500,maxAge:1e3*60*50});var eY=class extends w$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!dAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(dAe.default.TENANT_API_URL,S$t,{userSub:n,logger:e.log,requestId:e.id})}};Gy.TenantService=eY});var gAe=_(Ky=>{"use strict";var mAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.MeteringService=void 0;var T$t=mAe(ru());var hAe=mAe(Oa());var A$t=X6();var x$t=new T$t.default({max:500,maxAge:1e3*60*50});var tY=class extends A$t.ApiServiceClient{static{o(this,"MeteringService")}constructor(e,r){if(!hAe.default.METERING_SERVICE_URL){throw new Error("METERING_SERVICE_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(hAe.default.METERING_SERVICE_URL,x$t,{userSub:n,logger:e.log,requestId:e.id,targetAudience:"https://meters.zuplo.com"})}};Ky.MeteringService=tY});var yAe=_(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:true});Gl.validateHostname=Gl.kebabCase=Gl.snakeCase=Gl.sizeInBytes=void 0;function C$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(C$t,"sizeInBytes");Gl.sizeInBytes=C$t;function R$t(t){if(!t||t===null){return""}return t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(e=>e.toLowerCase()).join("_")}o(R$t,"snakeCase");Gl.snakeCase=R$t;function O$t(t){if(!t||t===null){return""}const e=t.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);if(e===null){return""}return e.map(r=>r.toLowerCase()).join("-")}o(O$t,"kebabCase");Gl.kebabCase=O$t;function N$t(t){try{const e=/^(?!https?:\/\/)([a-zA-Z0-9.-]*|(\*))*\.[a-zA-Z]+$/;if(t&&!e.test(t)){return false}return true}catch(e){}return false}o(N$t,"validateHostname");Gl.validateHostname=N$t});var EAe=_(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:true});G.Type=G.JsonType=G.JavaScriptTypeBuilder=G.JsonTypeBuilder=G.TypeBuilder=G.TypeBuilderError=G.TransformEncodeBuilder=G.TransformDecodeBuilder=G.TemplateLiteralDslParser=G.TemplateLiteralGenerator=G.TemplateLiteralGeneratorError=G.TemplateLiteralFinite=G.TemplateLiteralFiniteError=G.TemplateLiteralParser=G.TemplateLiteralParserError=G.TemplateLiteralResolver=G.TemplateLiteralPattern=G.TemplateLiteralPatternError=G.UnionResolver=G.KeyArrayResolver=G.KeyArrayResolverError=G.KeyResolver=G.ObjectMap=G.Intrinsic=G.IndexedAccessor=G.TypeClone=G.TypeExtends=G.TypeExtendsResult=G.TypeExtendsError=G.ExtendsUndefined=G.TypeGuard=G.TypeGuardUnknownTypeError=G.ValueGuard=G.FormatRegistry=G.TypeBoxError=G.TypeRegistry=G.PatternStringExact=G.PatternNumberExact=G.PatternBooleanExact=G.PatternString=G.PatternNumber=G.PatternBoolean=G.Kind=G.Hint=G.Optional=G.Readonly=G.Transform=void 0;G.Transform=Symbol.for("TypeBox.Transform");G.Readonly=Symbol.for("TypeBox.Readonly");G.Optional=Symbol.for("TypeBox.Optional");G.Hint=Symbol.for("TypeBox.Hint");G.Kind=Symbol.for("TypeBox.Kind");G.PatternBoolean="(true|false)";G.PatternNumber="(0|[1-9][0-9]*)";G.PatternString="(.*)";G.PatternBooleanExact=`^${G.PatternBoolean}$`;G.PatternNumberExact=`^${G.PatternNumber}$`;G.PatternStringExact=`^${G.PatternString}$`;var rY;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(rY||(G.TypeRegistry=rY={}));var Lu=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Lu;var vAe;(function(t){const e=new Map;function r(){return new Map(e)}o(r,"Entries");t.Entries=r;function n(){return e.clear()}o(n,"Clear");t.Clear=n;function i(l){return e.delete(l)}o(i,"Delete");t.Delete=i;function s(l){return e.has(l)}o(s,"Has");t.Has=s;function a(l,c){e.set(l,c)}o(a,"Set");t.Set=a;function u(l){return e.get(l)}o(u,"Get");t.Get=u})(vAe||(G.FormatRegistry=vAe={}));var Be;(function(t){function e(c){return Array.isArray(c)}o(e,"IsArray");t.IsArray=e;function r(c){return typeof c==="bigint"}o(r,"IsBigInt");t.IsBigInt=r;function n(c){return typeof c==="boolean"}o(n,"IsBoolean");t.IsBoolean=n;function i(c){return c===null}o(i,"IsNull");t.IsNull=i;function s(c){return typeof c==="number"}o(s,"IsNumber");t.IsNumber=s;function a(c){return typeof c==="object"&&c!==null}o(a,"IsObject");t.IsObject=a;function u(c){return typeof c==="string"}o(u,"IsString");t.IsString=u;function l(c){return c===void 0}o(l,"IsUndefined");t.IsUndefined=l})(Be||(G.ValueGuard=Be={}));var nY=class extends Lu{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=nY;var Y;(function(t){function e(x){try{new RegExp(x);return true}catch{return false}}o(e,"IsPattern");function r(x){if(!Be.IsString(x))return false;for(let ie=0;ie<x.length;ie++){const ce=x.charCodeAt(ie);if(ce>=7&&ce<=13||ce===27||ce===127){return false}}return true}o(r,"IsControlCharacterFree");function n(x){return a(x)||J(x)}o(n,"IsAdditionalProperties");function i(x){return Be.IsUndefined(x)||Be.IsBigInt(x)}o(i,"IsOptionalBigInt");function s(x){return Be.IsUndefined(x)||Be.IsNumber(x)}o(s,"IsOptionalNumber");function a(x){return Be.IsUndefined(x)||Be.IsBoolean(x)}o(a,"IsOptionalBoolean");function u(x){return Be.IsUndefined(x)||Be.IsString(x)}o(u,"IsOptionalString");function l(x){return Be.IsUndefined(x)||Be.IsString(x)&&r(x)&&e(x)}o(l,"IsOptionalPattern");function c(x){return Be.IsUndefined(x)||Be.IsString(x)&&r(x)}o(c,"IsOptionalFormat");function d(x){return Be.IsUndefined(x)||J(x)}o(d,"IsOptionalSchema");function p(x){return T(x,"Any")&&u(x.$id)}o(p,"TAny");t.TAny=p;function f(x){return T(x,"Array")&&x.type==="array"&&u(x.$id)&&J(x.items)&&s(x.minItems)&&s(x.maxItems)&&a(x.uniqueItems)&&d(x.contains)&&s(x.minContains)&&s(x.maxContains)}o(f,"TArray");t.TArray=f;function h(x){return T(x,"AsyncIterator")&&x.type==="AsyncIterator"&&u(x.$id)&&J(x.items)}o(h,"TAsyncIterator");t.TAsyncIterator=h;function m(x){return T(x,"BigInt")&&x.type==="bigint"&&u(x.$id)&&i(x.exclusiveMaximum)&&i(x.exclusiveMinimum)&&i(x.maximum)&&i(x.minimum)&&i(x.multipleOf)}o(m,"TBigInt");t.TBigInt=m;function g(x){return T(x,"Boolean")&&x.type==="boolean"&&u(x.$id)}o(g,"TBoolean");t.TBoolean=g;function y(x){return T(x,"Constructor")&&x.type==="constructor"&&u(x.$id)&&Be.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(y,"TConstructor");t.TConstructor=y;function v(x){return T(x,"Date")&&x.type==="Date"&&u(x.$id)&&s(x.exclusiveMaximumTimestamp)&&s(x.exclusiveMinimumTimestamp)&&s(x.maximumTimestamp)&&s(x.minimumTimestamp)&&s(x.multipleOfTimestamp)}o(v,"TDate");t.TDate=v;function w(x){return T(x,"Function")&&x.type==="function"&&u(x.$id)&&Be.IsArray(x.parameters)&&x.parameters.every(ie=>J(ie))&&J(x.returns)}o(w,"TFunction");t.TFunction=w;function E(x){return T(x,"Integer")&&x.type==="integer"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(E,"TInteger");t.TInteger=E;function b(x){return T(x,"Intersect")&&(Be.IsString(x.type)&&x.type!=="object"?false:true)&&Be.IsArray(x.allOf)&&x.allOf.every(ie=>J(ie)&&!Le(ie))&&u(x.type)&&(a(x.unevaluatedProperties)||d(x.unevaluatedProperties))&&u(x.$id)}o(b,"TIntersect");t.TIntersect=b;function S(x){return T(x,"Iterator")&&x.type==="Iterator"&&u(x.$id)&&J(x.items)}o(S,"TIterator");t.TIterator=S;function T(x,ie){return A(x)&&x[G.Kind]===ie}o(T,"TKindOf");t.TKindOf=T;function A(x){return Be.IsObject(x)&&G.Kind in x&&Be.IsString(x[G.Kind])}o(A,"TKind");t.TKind=A;function R(x){return B(x)&&Be.IsString(x.const)}o(R,"TLiteralString");t.TLiteralString=R;function O(x){return B(x)&&Be.IsNumber(x.const)}o(O,"TLiteralNumber");t.TLiteralNumber=O;function j(x){return B(x)&&Be.IsBoolean(x.const)}o(j,"TLiteralBoolean");t.TLiteralBoolean=j;function B(x){return T(x,"Literal")&&u(x.$id)&&(Be.IsBoolean(x.const)||Be.IsNumber(x.const)||Be.IsString(x.const))}o(B,"TLiteral");t.TLiteral=B;function U(x){return T(x,"Never")&&Be.IsObject(x.not)&&Object.getOwnPropertyNames(x.not).length===0}o(U,"TNever");t.TNever=U;function Q(x){return T(x,"Not")&&J(x.not)}o(Q,"TNot");t.TNot=Q;function oe(x){return T(x,"Null")&&x.type==="null"&&u(x.$id)}o(oe,"TNull");t.TNull=oe;function Te(x){return T(x,"Number")&&x.type==="number"&&u(x.$id)&&s(x.exclusiveMaximum)&&s(x.exclusiveMinimum)&&s(x.maximum)&&s(x.minimum)&&s(x.multipleOf)}o(Te,"TNumber");t.TNumber=Te;function le(x){return T(x,"Object")&&x.type==="object"&&u(x.$id)&&Be.IsObject(x.properties)&&n(x.additionalProperties)&&s(x.minProperties)&&s(x.maxProperties)&&Object.entries(x.properties).every(([ie,ce])=>r(ie)&&J(ce))}o(le,"TObject");t.TObject=le;function ue(x){return T(x,"Promise")&&x.type==="Promise"&&u(x.$id)&&J(x.item)}o(ue,"TPromise");t.TPromise=ue;function xe(x){return T(x,"Record")&&x.type==="object"&&u(x.$id)&&n(x.additionalProperties)&&Be.IsObject(x.patternProperties)&&(ie=>{const ce=Object.getOwnPropertyNames(ie.patternProperties);return ce.length===1&&e(ce[0])&&Be.IsObject(ie.patternProperties)&&J(ie.patternProperties[ce[0]])})(x)}o(xe,"TRecord");t.TRecord=xe;function we(x){return Be.IsObject(x)&&G.Hint in x&&x[G.Hint]==="Recursive"}o(we,"TRecursive");t.TRecursive=we;function Pe(x){return T(x,"Ref")&&u(x.$id)&&Be.IsString(x.$ref)}o(Pe,"TRef");t.TRef=Pe;function Ue(x){return T(x,"String")&&x.type==="string"&&u(x.$id)&&s(x.minLength)&&s(x.maxLength)&&l(x.pattern)&&c(x.format)}o(Ue,"TString");t.TString=Ue;function $e(x){return T(x,"Symbol")&&x.type==="symbol"&&u(x.$id)}o($e,"TSymbol");t.TSymbol=$e;function ge(x){return T(x,"TemplateLiteral")&&x.type==="string"&&Be.IsString(x.pattern)&&x.pattern[0]==="^"&&x.pattern[x.pattern.length-1]==="$"}o(ge,"TTemplateLiteral");t.TTemplateLiteral=ge;function Je(x){return T(x,"This")&&u(x.$id)&&Be.IsString(x.$ref)}o(Je,"TThis");t.TThis=Je;function Le(x){return Be.IsObject(x)&&G.Transform in x}o(Le,"TTransform");t.TTransform=Le;function Ie(x){return T(x,"Tuple")&&x.type==="array"&&u(x.$id)&&Be.IsNumber(x.minItems)&&Be.IsNumber(x.maxItems)&&x.minItems===x.maxItems&&(Be.IsUndefined(x.items)&&Be.IsUndefined(x.additionalItems)&&x.minItems===0||Be.IsArray(x.items)&&x.items.every(ie=>J(ie)))}o(Ie,"TTuple");t.TTuple=Ie;function Qe(x){return T(x,"Undefined")&&x.type==="undefined"&&u(x.$id)}o(Qe,"TUndefined");t.TUndefined=Qe;function qe(x){return C(x)&&x.anyOf.every(ie=>R(ie)||O(ie))}o(qe,"TUnionLiteral");t.TUnionLiteral=qe;function C(x){return T(x,"Union")&&u(x.$id)&&Be.IsObject(x)&&Be.IsArray(x.anyOf)&&x.anyOf.every(ie=>J(ie))}o(C,"TUnion");t.TUnion=C;function P(x){return T(x,"Uint8Array")&&x.type==="Uint8Array"&&u(x.$id)&&s(x.minByteLength)&&s(x.maxByteLength)}o(P,"TUint8Array");t.TUint8Array=P;function q(x){return T(x,"Unknown")&&u(x.$id)}o(q,"TUnknown");t.TUnknown=q;function z(x){return T(x,"Unsafe")}o(z,"TUnsafe");t.TUnsafe=z;function W(x){return T(x,"Void")&&x.type==="void"&&u(x.$id)}o(W,"TVoid");t.TVoid=W;function K(x){return Be.IsObject(x)&&x[G.Readonly]==="Readonly"}o(K,"TReadonly");t.TReadonly=K;function se(x){return Be.IsObject(x)&&x[G.Optional]==="Optional"}o(se,"TOptional");t.TOptional=se;function J(x){return Be.IsObject(x)&&(p(x)||f(x)||g(x)||m(x)||h(x)||y(x)||v(x)||w(x)||E(x)||b(x)||S(x)||B(x)||U(x)||Q(x)||oe(x)||Te(x)||le(x)||ue(x)||xe(x)||Pe(x)||Ue(x)||$e(x)||ge(x)||Je(x)||Ie(x)||Qe(x)||C(x)||P(x)||q(x)||z(x)||W(x)||A(x)&&rY.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var _Ae;(function(t){function e(r){return r[G.Kind]==="Intersect"?r.allOf.every(n=>e(n)):r[G.Kind]==="Union"?r.anyOf.some(n=>e(n)):r[G.Kind]==="Undefined"?true:r[G.Kind]==="Not"?!e(r.not):false}o(e,"Check");t.Check=e})(_Ae||(G.ExtendsUndefined=_Ae={}));var Ox=class extends Lu{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Ox;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var qm;(function(t){function e(F){return F===Ee.False?F:Ee.True}o(e,"IntoBooleanResult");function r(F){throw new Ox(F)}o(r,"Throw");function n(F){return Y.TNever(F)||Y.TIntersect(F)||Y.TUnion(F)||Y.TUnknown(F)||Y.TAny(F)}o(n,"IsStructuralRight");function i(F,$){return Y.TNever($)?T(F,$):Y.TIntersect($)?w(F,$):Y.TUnion($)?Xe(F,$):Y.TUnknown($)?tr(F,$):Y.TAny($)?s(F,$):r("StructuralRight")}o(i,"StructuralRight");function s(F,$){return Ee.True}o(s,"TAnyRight");function a(F,$){return Y.TIntersect($)?w(F,$):Y.TUnion($)&&$.anyOf.some(Ye=>Y.TAny(Ye)||Y.TUnknown(Ye))?Ee.True:Y.TUnion($)?Ee.Union:Y.TUnknown($)?Ee.True:Y.TAny($)?Ee.True:Ee.Union}o(a,"TAny");function u(F,$){return Y.TUnknown(F)?Ee.False:Y.TAny(F)?Ee.Union:Y.TNever(F)?Ee.True:Ee.False}o(u,"TArrayRight");function l(F,$){return Y.TObject($)&&ge($)?Ee.True:n($)?i(F,$):!Y.TArray($)?Ee.False:e(ft(F.items,$.items))}o(l,"TArray");function c(F,$){return n($)?i(F,$):!Y.TAsyncIterator($)?Ee.False:e(ft(F.items,$.items))}o(c,"TAsyncIterator");function d(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TBigInt($)?Ee.True:Ee.False}o(d,"TBigInt");function p(F,$){return Y.TLiteral(F)&&Be.IsBoolean(F.const)?Ee.True:Y.TBoolean(F)?Ee.True:Ee.False}o(p,"TBooleanRight");function f(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TBoolean($)?Ee.True:Ee.False}o(f,"TBoolean");function h(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):!Y.TConstructor($)?Ee.False:F.parameters.length>$.parameters.length?Ee.False:!F.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(F.returns,$.returns))}o(h,"TConstructor");function m(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TDate($)?Ee.True:Ee.False}o(m,"TDate");function g(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):!Y.TFunction($)?Ee.False:F.parameters.length>$.parameters.length?Ee.False:!F.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(F.returns,$.returns))}o(g,"TFunction");function y(F,$){return Y.TLiteral(F)&&Be.IsNumber(F.const)?Ee.True:Y.TNumber(F)||Y.TInteger(F)?Ee.True:Ee.False}o(y,"TIntegerRight");function v(F,$){return Y.TInteger($)||Y.TNumber($)?Ee.True:n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Ee.False}o(v,"TInteger");function w(F,$){return $.allOf.every(Ye=>ft(F,Ye)===Ee.True)?Ee.True:Ee.False}o(w,"TIntersectRight");function E(F,$){return F.allOf.some(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(E,"TIntersect");function b(F,$){return n($)?i(F,$):!Y.TIterator($)?Ee.False:e(ft(F.items,$.items))}o(b,"TIterator");function S(F,$){return Y.TLiteral($)&&$.const===F.const?Ee.True:n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TString($)?W(F,$):Y.TNumber($)?B(F,$):Y.TInteger($)?y(F,$):Y.TBoolean($)?p(F,$):Ee.False}o(S,"TLiteral");function T(F,$){return Ee.False}o(T,"TNeverRight");function A(F,$){return Ee.True}o(A,"TNever");function R(F){let[$,Ye]=[F,0];while(true){if(!Y.TNot($))break;$=$.not;Ye+=1}return Ye%2===0?$:G.Type.Unknown()}o(R,"UnwrapTNot");function O(F,$){return Y.TNot(F)?ft(R(F),$):Y.TNot($)?ft(F,R($)):r("Invalid fallthrough for Not")}o(O,"TNot");function j(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TNull($)?Ee.True:Ee.False}o(j,"TNull");function B(F,$){return Y.TLiteralNumber(F)?Ee.True:Y.TNumber(F)||Y.TInteger(F)?Ee.True:Ee.False}o(B,"TNumberRight");function U(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TInteger($)||Y.TNumber($)?Ee.True:Ee.False}o(U,"TNumber");function Q(F,$){return Object.getOwnPropertyNames(F.properties).length===$}o(Q,"IsObjectPropertyCount");function oe(F){return ge(F)}o(oe,"IsObjectStringLike");function Te(F){return Q(F,0)||Q(F,1)&&"description"in F.properties&&Y.TUnion(F.properties.description)&&F.properties.description.anyOf.length===2&&(Y.TString(F.properties.description.anyOf[0])&&Y.TUndefined(F.properties.description.anyOf[1])||Y.TString(F.properties.description.anyOf[1])&&Y.TUndefined(F.properties.description.anyOf[0]))}o(Te,"IsObjectSymbolLike");function le(F){return Q(F,0)}o(le,"IsObjectNumberLike");function ue(F){return Q(F,0)}o(ue,"IsObjectBooleanLike");function xe(F){return Q(F,0)}o(xe,"IsObjectBigIntLike");function we(F){return Q(F,0)}o(we,"IsObjectDateLike");function Pe(F){return ge(F)}o(Pe,"IsObjectUint8ArrayLike");function Ue(F){const $=G.Type.Number();return Q(F,0)||Q(F,1)&&"length"in F.properties&&e(ft(F.properties["length"],$))===Ee.True}o(Ue,"IsObjectFunctionLike");function $e(F){return Q(F,0)}o($e,"IsObjectConstructorLike");function ge(F){const $=G.Type.Number();return Q(F,0)||Q(F,1)&&"length"in F.properties&&e(ft(F.properties["length"],$))===Ee.True}o(ge,"IsObjectArrayLike");function Je(F){const $=G.Type.Function([G.Type.Any()],G.Type.Any());return Q(F,0)||Q(F,1)&&"then"in F.properties&&e(ft(F.properties["then"],$))===Ee.True}o(Je,"IsObjectPromiseLike");function Le(F,$){return ft(F,$)===Ee.False?Ee.False:Y.TOptional(F)&&!Y.TOptional($)?Ee.False:Ee.True}o(Le,"Property");function Ie(F,$){return Y.TUnknown(F)?Ee.False:Y.TAny(F)?Ee.Union:Y.TNever(F)||Y.TLiteralString(F)&&oe($)||Y.TLiteralNumber(F)&&le($)||Y.TLiteralBoolean(F)&&ue($)||Y.TSymbol(F)&&Te($)||Y.TBigInt(F)&&xe($)||Y.TString(F)&&oe($)||Y.TSymbol(F)&&Te($)||Y.TNumber(F)&&le($)||Y.TInteger(F)&&le($)||Y.TBoolean(F)&&ue($)||Y.TUint8Array(F)&&Pe($)||Y.TDate(F)&&we($)||Y.TConstructor(F)&&$e($)||Y.TFunction(F)&&Ue($)?Ee.True:Y.TRecord(F)&&Y.TString(C(F))?(()=>{return $[G.Hint]==="Record"?Ee.True:Ee.False})():Y.TRecord(F)&&Y.TNumber(C(F))?(()=>{return Q($,0)?Ee.True:Ee.False})():Ee.False}o(Ie,"TObjectRight");function Qe(F,$){return n($)?i(F,$):Y.TRecord($)?q(F,$):!Y.TObject($)?Ee.False:(()=>{for(const Ye of Object.getOwnPropertyNames($.properties)){if(!(Ye in F.properties))return Ee.False;if(Le(F.properties[Ye],$.properties[Ye])===Ee.False){return Ee.False}}return Ee.True})()}o(Qe,"TObject");function qe(F,$){return n($)?i(F,$):Y.TObject($)&&Je($)?Ee.True:!Y.TPromise($)?Ee.False:e(ft(F.item,$.item))}o(qe,"TPromise");function C(F){return G.PatternNumberExact in F.patternProperties?G.Type.Number():G.PatternStringExact in F.patternProperties?G.Type.String():r("Unknown record key pattern")}o(C,"RecordKey");function P(F){return G.PatternNumberExact in F.patternProperties?F.patternProperties[G.PatternNumberExact]:G.PatternStringExact in F.patternProperties?F.patternProperties[G.PatternStringExact]:r("Unable to get record value schema")}o(P,"RecordValue");function q(F,$){const[Ye,cr]=[C($),P($)];return Y.TLiteralString(F)&&Y.TNumber(Ye)&&e(ft(F,cr))===Ee.True?Ee.True:Y.TUint8Array(F)&&Y.TNumber(Ye)?ft(F,cr):Y.TString(F)&&Y.TNumber(Ye)?ft(F,cr):Y.TArray(F)&&Y.TNumber(Ye)?ft(F,cr):Y.TObject(F)?(()=>{for(const vi of Object.getOwnPropertyNames(F.properties)){if(Le(cr,F.properties[vi])===Ee.False){return Ee.False}}return Ee.True})():Ee.False}o(q,"TRecordRight");function z(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):!Y.TRecord($)?Ee.False:ft(P(F),P($))}o(z,"TRecord");function W(F,$){return Y.TLiteral(F)&&Be.IsString(F.const)?Ee.True:Y.TString(F)?Ee.True:Ee.False}o(W,"TStringRight");function K(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TString($)?Ee.True:Ee.False}o(K,"TString");function se(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TSymbol($)?Ee.True:Ee.False}o(se,"TSymbol");function J(F,$){return Y.TTemplateLiteral(F)?ft(nd.Resolve(F),$):Y.TTemplateLiteral($)?ft(F,nd.Resolve($)):r("Invalid fallthrough for TemplateLiteral")}o(J,"TTemplateLiteral");function x(F,$){return Y.TArray($)&&F.items!==void 0&&F.items.every(Ye=>ft(Ye,$.items)===Ee.True)}o(x,"IsArrayOfTuple");function ie(F,$){return Y.TNever(F)?Ee.True:Y.TUnknown(F)?Ee.False:Y.TAny(F)?Ee.Union:Ee.False}o(ie,"TTupleRight");function ce(F,$){return n($)?i(F,$):Y.TObject($)&&ge($)?Ee.True:Y.TArray($)&&x(F,$)?Ee.True:!Y.TTuple($)?Ee.False:Be.IsUndefined(F.items)&&!Be.IsUndefined($.items)||!Be.IsUndefined(F.items)&&Be.IsUndefined($.items)?Ee.False:Be.IsUndefined(F.items)&&!Be.IsUndefined($.items)?Ee.True:F.items.every((Ye,cr)=>ft(Ye,$.items[cr])===Ee.True)?Ee.True:Ee.False}o(ce,"TTuple");function ve(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TUint8Array($)?Ee.True:Ee.False}o(ve,"TUint8Array");function je(F,$){return n($)?i(F,$):Y.TObject($)?Ie(F,$):Y.TRecord($)?q(F,$):Y.TVoid($)?Et(F,$):Y.TUndefined($)?Ee.True:Ee.False}o(je,"TUndefined");function Xe(F,$){return $.anyOf.some(Ye=>ft(F,Ye)===Ee.True)?Ee.True:Ee.False}o(Xe,"TUnionRight");function _t(F,$){return F.anyOf.every(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(_t,"TUnion");function tr(F,$){return Ee.True}o(tr,"TUnknownRight");function lr(F,$){return Y.TNever($)?T(F,$):Y.TIntersect($)?w(F,$):Y.TUnion($)?Xe(F,$):Y.TAny($)?s(F,$):Y.TString($)?W(F,$):Y.TNumber($)?B(F,$):Y.TInteger($)?y(F,$):Y.TBoolean($)?p(F,$):Y.TArray($)?u(F,$):Y.TTuple($)?ie(F,$):Y.TObject($)?Ie(F,$):Y.TUnknown($)?Ee.True:Ee.False}o(lr,"TUnknown");function Et(F,$){return Y.TUndefined(F)?Ee.True:Y.TUndefined(F)?Ee.True:Ee.False}o(Et,"VoidRight");function xt(F,$){return Y.TIntersect($)?w(F,$):Y.TUnion($)?Xe(F,$):Y.TUnknown($)?tr(F,$):Y.TAny($)?s(F,$):Y.TObject($)?Ie(F,$):Y.TVoid($)?Ee.True:Ee.False}o(xt,"TVoid");function ft(F,$){return Y.TTemplateLiteral(F)||Y.TTemplateLiteral($)?J(F,$):Y.TNot(F)||Y.TNot($)?O(F,$):Y.TAny(F)?a(F,$):Y.TArray(F)?l(F,$):Y.TBigInt(F)?d(F,$):Y.TBoolean(F)?f(F,$):Y.TAsyncIterator(F)?c(F,$):Y.TConstructor(F)?h(F,$):Y.TDate(F)?m(F,$):Y.TFunction(F)?g(F,$):Y.TInteger(F)?v(F,$):Y.TIntersect(F)?E(F,$):Y.TIterator(F)?b(F,$):Y.TLiteral(F)?S(F,$):Y.TNever(F)?A(F,$):Y.TNull(F)?j(F,$):Y.TNumber(F)?U(F,$):Y.TObject(F)?Qe(F,$):Y.TRecord(F)?z(F,$):Y.TString(F)?K(F,$):Y.TSymbol(F)?se(F,$):Y.TTuple(F)?ce(F,$):Y.TPromise(F)?qe(F,$):Y.TUint8Array(F)?ve(F,$):Y.TUndefined(F)?je(F,$):Y.TUnion(F)?_t(F,$):Y.TUnknown(F)?lr(F,$):Y.TVoid(F)?xt(F,$):r(`Unknown left type operand '${F[G.Kind]}'`)}o(ft,"Visit");function en(F,$){return ft(F,$)}o(en,"Extends");t.Extends=en})(qm||(G.TypeExtends=qm={}));var ct;(function(t){function e(a){const u=Object.getOwnPropertyNames(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});const l=Object.getOwnPropertySymbols(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});return{...u,...l}}o(e,"ObjectType");function r(a){return a.map(u=>n(u))}o(r,"ArrayType");function n(a){return Be.IsArray(a)?r(a):Be.IsObject(a)?e(a):a}o(n,"Visit");function i(a){return a.map(u=>s(u))}o(i,"Rest");t.Rest=i;function s(a,u={}){return{...n(a),...u}}o(s,"Type");t.Type=s})(ct||(G.TypeClone=ct={}));var iY;(function(t){function e(h){return h.map(m=>{const{[G.Optional]:g,...y}=ct.Type(m);return y})}o(e,"OptionalUnwrap");function r(h){return h.every(m=>Y.TOptional(m))}o(r,"IsIntersectOptional");function n(h){return h.some(m=>Y.TOptional(m))}o(n,"IsUnionOptional");function i(h){return r(h.allOf)?G.Type.Optional(G.Type.Intersect(e(h.allOf))):h}o(i,"ResolveIntersect");function s(h){return n(h.anyOf)?G.Type.Optional(G.Type.Union(e(h.anyOf))):h}o(s,"ResolveUnion");function a(h){return h[G.Kind]==="Intersect"?i(h):h[G.Kind]==="Union"?s(h):h}o(a,"ResolveOptional");function u(h,m){const g=h.allOf.reduce((y,v)=>{const w=p(v,m);return w[G.Kind]==="Never"?y:[...y,w]},[]);return a(G.Type.Intersect(g))}o(u,"TIntersect");function l(h,m){const g=h.anyOf.map(y=>p(y,m));return a(G.Type.Union(g))}o(l,"TUnion");function c(h,m){const g=h.properties[m];return Be.IsUndefined(g)?G.Type.Never():G.Type.Union([g])}o(c,"TObject");function d(h,m){const g=h.items;if(Be.IsUndefined(g))return G.Type.Never();const y=g[m];if(Be.IsUndefined(y))return G.Type.Never();return y}o(d,"TTuple");function p(h,m){return h[G.Kind]==="Intersect"?u(h,m):h[G.Kind]==="Union"?l(h,m):h[G.Kind]==="Object"?c(h,m):h[G.Kind]==="Tuple"?d(h,m):G.Type.Never()}o(p,"Visit");function f(h,m,g={}){const y=m.map(v=>p(h,v.toString()));return a(G.Type.Union(y,g))}o(f,"Resolve");t.Resolve=f})(iY||(G.IndexedAccessor=iY={}));var Yy;(function(t){function e(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toLowerCase()}${f}`}o(e,"Uncapitalize");function r(d){const[p,f]=[d.slice(0,1),d.slice(1)];return`${p.toUpperCase()}${f}`}o(r,"Capitalize");function n(d){return d.toUpperCase()}o(n,"Uppercase");function i(d){return d.toLowerCase()}o(i,"Lowercase");function s(d,p){const f=Jy.ParseExact(d.pattern);const h=Qy.Check(f);if(!h)return{...d,pattern:a(d.pattern,p)};const m=[...Xy.Generate(f)];const g=m.map(w=>G.Type.Literal(w));const y=u(g,p);const v=G.Type.Union(y);return G.Type.TemplateLiteral([v])}o(s,"IntrinsicTemplateLiteral");function a(d,p){return typeof d==="string"?p==="Uncapitalize"?e(d):p==="Capitalize"?r(d):p==="Uppercase"?n(d):p==="Lowercase"?i(d):d:d.toString()}o(a,"IntrinsicLiteral");function u(d,p){if(d.length===0)return[];const[f,...h]=d;return[c(f,p),...u(h,p)]}o(u,"IntrinsicRest");function l(d,p){return Y.TTemplateLiteral(d)?s(d,p):Y.TUnion(d)?G.Type.Union(u(d.anyOf,p)):Y.TLiteral(d)?G.Type.Literal(a(d.const,p)):d}o(l,"Visit");function c(d,p){return l(d,p)}o(c,"Map");t.Map=c})(Yy||(G.Intrinsic=Yy={}));var Wy;(function(t){function e(a,u){return G.Type.Intersect(a.allOf.map(l=>i(l,u)),{...a})}o(e,"TIntersect");function r(a,u){return G.Type.Union(a.anyOf.map(l=>i(l,u)),{...a})}o(r,"TUnion");function n(a,u){return u(a)}o(n,"TObject");function i(a,u){return a[G.Kind]==="Intersect"?e(a,u):a[G.Kind]==="Union"?r(a,u):a[G.Kind]==="Object"?n(a,u):a}o(i,"Visit");function s(a,u,l){return{...i(ct.Type(a),u),...l}}o(s,"Map");t.Map=s})(Wy||(G.ObjectMap=Wy={}));var Nx;(function(t){function e(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}o(e,"UnwrapPattern");function r(c,d){return c.allOf.reduce((p,f)=>[...p,...a(f,d)],[])}o(r,"TIntersect");function n(c,d){const p=c.anyOf.map(f=>a(f,d));return[...p.reduce((f,h)=>h.map(m=>p.every(g=>g.includes(m))?f.add(m):f)[0],new Set)]}o(n,"TUnion");function i(c,d){return Object.getOwnPropertyNames(c.properties)}o(i,"TObject");function s(c,d){return d.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}o(s,"TRecord");function a(c,d){return Y.TIntersect(c)?r(c,d):Y.TUnion(c)?n(c,d):Y.TObject(c)?i(c,d):Y.TRecord(c)?s(c,d):[]}o(a,"Visit");function u(c,d){return[...new Set(a(c,d))]}o(u,"ResolveKeys");t.ResolveKeys=u;function l(c){const d=u(c,{includePatterns:true});const p=d.map(f=>`(${e(f)})`);return`^(${p.join("|")})$`}o(l,"ResolvePattern");t.ResolvePattern=l})(Nx||(G.KeyResolver=Nx={}));var Ix=class extends Lu{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Ix;var fb;(function(t){function e(r){return Array.isArray(r)?r:Y.TUnionLiteral(r)?r.anyOf.map(n=>n.const.toString()):Y.TLiteral(r)?[r.const]:Y.TTemplateLiteral(r)?(()=>{const n=Jy.ParseExact(r.pattern);if(!Qy.Check(n))throw new Ix("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(fb||(G.KeyArrayResolver=fb={}));var sY;(function(t){function*e(n){for(const i of n.anyOf){if(i[G.Kind]==="Union"){yield*e(i)}else{yield i}}}o(e,"TUnion");function r(n){return G.Type.Union([...e(n)],{...n})}o(r,"Resolve");t.Resolve=r})(sY||(G.UnionResolver=sY={}));var Px=class extends Lu{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Px;var Dx;(function(t){function e(s){throw new Px(s)}o(e,"Throw");function r(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(r,"Escape");function n(s,a){return Y.TTemplateLiteral(s)?s.pattern.slice(1,s.pattern.length-1):Y.TUnion(s)?`(${s.anyOf.map(u=>n(u,a)).join("|")})`:Y.TNumber(s)?`${a}${G.PatternNumber}`:Y.TInteger(s)?`${a}${G.PatternNumber}`:Y.TBigInt(s)?`${a}${G.PatternNumber}`:Y.TString(s)?`${a}${G.PatternString}`:Y.TLiteral(s)?`${a}${r(s.const.toString())}`:Y.TBoolean(s)?`${a}${G.PatternBoolean}`:e(`Unexpected Kind '${s[G.Kind]}'`)}o(n,"Visit");function i(s){return`^${s.map(a=>n(a,"")).join("")}$`}o(i,"Create");t.Create=i})(Dx||(G.TemplateLiteralPattern=Dx={}));var nd;(function(t){function e(r){const n=Jy.ParseExact(r.pattern);if(!Qy.Check(n))return G.Type.String();const i=[...Xy.Generate(n)].map(s=>G.Type.Literal(s));return G.Type.Union(i)}o(e,"Resolve");t.Resolve=e})(nd||(G.TemplateLiteralResolver=nd={}));var hb=class extends Lu{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=hb;var Jy;(function(t){function e(h,m,g){return h[m]===g&&h.charCodeAt(m-1)!==92}o(e,"IsNonEscaped");function r(h,m){return e(h,m,"(")}o(r,"IsOpenParen");function n(h,m){return e(h,m,")")}o(n,"IsCloseParen");function i(h,m){return e(h,m,"|")}o(i,"IsSeparator");function s(h){if(!(r(h,0)&&n(h,h.length-1)))return false;let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(m===0&&g!==h.length-1)return false}return true}o(s,"IsGroup");function a(h){return h.slice(1,h.length-1)}o(a,"InGroup");function u(h){let m=0;for(let g=0;g<h.length;g++){if(r(h,g))m+=1;if(n(h,g))m-=1;if(i(h,g)&&m===0)return true}return false}o(u,"IsPrecedenceOr");function l(h){for(let m=0;m<h.length;m++){if(r(h,m))return true}return false}o(l,"IsPrecedenceAnd");function c(h){let[m,g]=[0,0];const y=[];for(let w=0;w<h.length;w++){if(r(h,w))m+=1;if(n(h,w))m-=1;if(i(h,w)&&m===0){const E=h.slice(g,w);if(E.length>0)y.push(p(E));g=w+1}}const v=h.slice(g);if(v.length>0)y.push(p(v));if(y.length===0)return{type:"const",const:""};if(y.length===1)return y[0];return{type:"or",expr:y}}o(c,"Or");function d(h){function m(v,w){if(!r(v,w))throw new hb(`TemplateLiteralParser: Index must point to open parens`);let E=0;for(let b=w;b<v.length;b++){if(r(v,b))E+=1;if(n(v,b))E-=1;if(E===0)return[w,b]}throw new hb(`TemplateLiteralParser: Unclosed group parens in expression`)}o(m,"Group");function g(v,w){for(let E=w;E<v.length;E++){if(r(v,E))return[w,E]}return[w,v.length]}o(g,"Range");const y=[];for(let v=0;v<h.length;v++){if(r(h,v)){const[w,E]=m(h,v);const b=h.slice(w,E+1);y.push(p(b));v=E}else{const[w,E]=g(h,v);const b=h.slice(w,E);if(b.length>0)y.push(p(b));v=E-1}}return y.length===0?{type:"const",const:""}:y.length===1?y[0]:{type:"and",expr:y}}o(d,"And");function p(h){return s(h)?p(a(h)):u(h)?c(h):l(h)?d(h):{type:"const",const:h}}o(p,"Parse");t.Parse=p;function f(h){return p(h.slice(1,h.length-1))}o(f,"ParseExact");t.ParseExact=f})(Jy||(G.TemplateLiteralParser=Jy={}));var kx=class extends Lu{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=kx;var Qy;(function(t){function e(a){throw new kx(a)}o(e,"Throw");function r(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="0"&&a.expr[1].type==="const"&&a.expr[1].const==="[1-9][0-9]*"}o(r,"IsNumber");function n(a){return a.type==="or"&&a.expr.length===2&&a.expr[0].type==="const"&&a.expr[0].const==="true"&&a.expr[1].type==="const"&&a.expr[1].const==="false"}o(n,"IsBoolean");function i(a){return a.type==="const"&&a.const===".*"}o(i,"IsString");function s(a){return n(a)?true:r(a)||i(a)?false:a.type==="and"?a.expr.every(u=>s(u)):a.type==="or"?a.expr.every(u=>s(u)):a.type==="const"?true:e(`Unknown expression type`)}o(s,"Check");t.Check=s})(Qy||(G.TemplateLiteralFinite=Qy={}));var $x=class extends Lu{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=$x;var Xy;(function(t){function*e(a){if(a.length===1)return yield*a[0];for(const u of a[0]){for(const l of e(a.slice(1))){yield`${u}${l}`}}}o(e,"Reduce");function*r(a){return yield*e(a.expr.map(u=>[...s(u)]))}o(r,"And");function*n(a){for(const u of a.expr)yield*s(u)}o(n,"Or");function*i(a){return yield a.const}o(i,"Const");function*s(a){return a.type==="and"?yield*r(a):a.type==="or"?yield*n(a):a.type==="const"?yield*i(a):(()=>{throw new $x("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var aY;(function(t){function*e(s){const a=s.trim().replace(/"|'/g,"");return a==="boolean"?yield G.Type.Boolean():a==="number"?yield G.Type.Number():a==="bigint"?yield G.Type.BigInt():a==="string"?yield G.Type.String():yield(()=>{const u=a.split("|").map(l=>G.Type.Literal(l.trim()));return u.length===0?G.Type.Never():u.length===1?u[0]:G.Type.Union(u)})()}o(e,"ParseUnion");function*r(s){if(s[1]!=="{"){const a=G.Type.Literal("$");const u=n(s.slice(1));return yield*[a,...u]}for(let a=2;a<s.length;a++){if(s[a]==="}"){const u=e(s.slice(2,a));const l=n(s.slice(a+1));return yield*[...u,...l]}}yield G.Type.Literal(s)}o(r,"ParseTerminal");function*n(s){for(let a=0;a<s.length;a++){if(s[a]==="$"){const u=G.Type.Literal(s.slice(0,a));const l=r(s.slice(a));return yield*[u,...l]}}yield G.Type.Literal(s)}o(n,"ParseLiteral");function i(s){return[...n(s)]}o(i,"Parse");t.Parse=i})(aY||(G.TemplateLiteralDslParser=aY={}));var Lx=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new qx(this.schema,e)}};G.TransformDecodeBuilder=Lx;var qx=class{static{o(this,"TransformEncodeBuilder")}constructor(e,r){this.schema=e;this.decode=r}Encode(e){const r=ct.Type(this.schema);return Y.TTransform(r)?(()=>{const n=o(a=>r[G.Transform].Encode(e(a)),"Encode");const i=o(a=>this.decode(r[G.Transform].Decode(a)),"Decode");const s={Encode:n,Decode:i};return{...r,[G.Transform]:s}})():(()=>{const n={Decode:this.decode,Encode:e};return{...r,[G.Transform]:n}})()}};G.TransformEncodeBuilder=qx;var I$t=0;var jx=class extends Lu{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=jx;var Ux=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new jx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=Ux;var mb=class extends Ux{static{o(this,"JsonTypeBuilder")}ReadonlyOptional(e){return this.Readonly(this.Optional(e))}Readonly(e){return{...ct.Type(e),[G.Readonly]:"Readonly"}}Optional(e){return{...ct.Type(e),[G.Optional]:"Optional"}}Any(e={}){return this.Create({...e,[G.Kind]:"Any"})}Array(e,r={}){return this.Create({...r,[G.Kind]:"Array",type:"array",items:ct.Type(e)})}Boolean(e={}){return this.Create({...e,[G.Kind]:"Boolean",type:"boolean"})}Capitalize(e,r={}){return{...Yy.Map(ct.Type(e),"Capitalize"),...r}}Composite(e,r){const n=G.Type.Intersect(e,{});const i=Nx.ResolveKeys(n,{includePatterns:false});const s=i.reduce((a,u)=>({...a,[u]:G.Type.Index(n,[u])}),{});return G.Type.Object(s,r)}Enum(e,r={}){const n=Object.getOwnPropertyNames(e).filter(s=>isNaN(s)).map(s=>e[s]);const i=n.map(s=>Be.IsString(s)?{[G.Kind]:"Literal",type:"string",const:s}:{[G.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[G.Kind]:"Union",anyOf:i})}Extends(e,r,n,i,s={}){switch(qm.Extends(e,r)){case Ee.Union:return this.Union([ct.Type(n,s),ct.Type(i,s)]);case Ee.True:return ct.Type(n,s);case Ee.False:return ct.Type(i,s)}}Exclude(e,r,n={}){return Y.TTemplateLiteral(e)?this.Exclude(nd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,nd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(nd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,nd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?ct.Type(e,n):this.Never(n)}Index(e,r,n={}){return Y.TArray(e)&&Y.TNumber(r)?(()=>{return ct.Type(e.items,n)})():Y.TTuple(e)&&Y.TNumber(r)?(()=>{const i=Be.IsUndefined(e.items)?[]:e.items;const s=i.map(a=>ct.Type(a));return this.Union(s,n)})():(()=>{const i=fb.Resolve(r);const s=ct.Type(e);return iY.Resolve(s,i,n)})()}Integer(e={}){return this.Create({...e,[G.Kind]:"Integer",type:"integer"})}Intersect(e,r={}){if(e.length===0)return G.Type.Never();if(e.length===1)return ct.Type(e[0],r);if(e.some(a=>Y.TTransform(a)))this.Throw("Cannot intersect transform types");const n=e.every(a=>Y.TObject(a));const i=ct.Rest(e);const s=Y.TSchema(r.unevaluatedProperties)?{unevaluatedProperties:ct.Type(r.unevaluatedProperties)}:{};return r.unevaluatedProperties===false||Y.TSchema(r.unevaluatedProperties)||n?this.Create({...r,...s,[G.Kind]:"Intersect",type:"object",allOf:i}):this.Create({...r,...s,[G.Kind]:"Intersect",allOf:i})}KeyOf(e,r={}){return Y.TRecord(e)?(()=>{const n=Object.getOwnPropertyNames(e.patternProperties)[0];return n===G.PatternNumberExact?this.Number(r):n===G.PatternStringExact?this.String(r):this.Throw("Unable to resolve key type from Record key pattern")})():Y.TTuple(e)?(()=>{const n=Be.IsUndefined(e.items)?[]:e.items;const i=n.map((s,a)=>G.Type.Literal(a.toString()));return this.Union(i,r)})():Y.TArray(e)?(()=>{return this.Number(r)})():(()=>{const n=Nx.ResolveKeys(e,{includePatterns:false});if(n.length===0)return this.Never(r);const i=n.map(s=>this.Literal(s));return this.Union(i,r)})()}Literal(e,r={}){return this.Create({...r,[G.Kind]:"Literal",const:e,type:typeof e})}Lowercase(e,r={}){return{...Yy.Map(ct.Type(e),"Lowercase"),...r}}Never(e={}){return this.Create({...e,[G.Kind]:"Never",not:{}})}Not(e,r){return this.Create({...r,[G.Kind]:"Not",not:ct.Type(e)})}Null(e={}){return this.Create({...e,[G.Kind]:"Null",type:"null"})}Number(e={}){return this.Create({...e,[G.Kind]:"Number",type:"number"})}Object(e,r={}){const n=Object.getOwnPropertyNames(e);const i=n.filter(l=>Y.TOptional(e[l]));const s=n.filter(l=>!i.includes(l));const a=Y.TSchema(r.additionalProperties)?{additionalProperties:ct.Type(r.additionalProperties)}:{};const u=n.reduce((l,c)=>({...l,[c]:ct.Type(e[c])}),{});return s.length>0?this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u,required:s}):this.Create({...r,...a,[G.Kind]:"Object",type:"object",properties:u})}Omit(e,r,n={}){const i=fb.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Be.IsArray(s.required)){s.required=s.required.filter(a=>!i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Partial(e,r={}){return Wy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Optional(n.properties[a])}},{});return this.Object(i,this.Discard(n,"required"))},r)}Pick(e,r,n={}){const i=fb.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Be.IsArray(s.required)){s.required=s.required.filter(a=>i.includes(a));if(s.required.length===0)delete s.required}for(const a of Object.getOwnPropertyNames(s.properties)){if(!i.includes(a))delete s.properties[a]}return this.Create(s)},n)}Record(e,r,n={}){return Y.TTemplateLiteral(e)?(()=>{const i=Jy.ParseExact(e.pattern);return Qy.Check(i)?this.Object([...Xy.Generate(i)].reduce((s,a)=>({...s,[a]:ct.Type(r)}),{}),n):this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[e.pattern]:ct.Type(r)}})})():Y.TUnion(e)?(()=>{const i=sY.Resolve(e);if(Y.TUnionLiteral(i)){const s=i.anyOf.reduce((a,u)=>({...a,[u.const]:ct.Type(r)}),{});return this.Object(s,{...n,[G.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():Y.TLiteral(e)?(()=>{return Be.IsString(e.const)||Be.IsNumber(e.const)?this.Object({[e.const]:ct.Type(r)},n):this.Throw("Record key of type literal is not of type string or number")})():Y.TInteger(e)||Y.TNumber(e)?(()=>{return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[G.PatternNumberExact]:ct.Type(r)}})})():Y.TString(e)?(()=>{const i=Be.IsUndefined(e.pattern)?G.PatternStringExact:e.pattern;return this.Create({...n,[G.Kind]:"Record",type:"object",patternProperties:{[i]:ct.Type(r)}})})():this.Never()}Recursive(e,r={}){if(Be.IsUndefined(r.$id))r.$id=`T${I$t++}`;const n=e({[G.Kind]:"This",$ref:`${r.$id}`});n.$id=r.$id;return this.Create({...r,[G.Hint]:"Recursive",...n})}Ref(e,r={}){if(Be.IsString(e))return this.Create({...r,[G.Kind]:"Ref",$ref:e});if(Be.IsUndefined(e.$id))this.Throw("Reference target type must specify an $id");return this.Create({...r,[G.Kind]:"Ref",$ref:e.$id})}Required(e,r={}){return Wy.Map(this.Discard(ct.Type(e),G.Transform),n=>{const i=Object.getOwnPropertyNames(n.properties).reduce((s,a)=>{return{...s,[a]:this.Discard(n.properties[a],G.Optional)}},{});return this.Object(i,n)},r)}Rest(e){return Y.TTuple(e)&&!Be.IsUndefined(e.items)?ct.Rest(e.items):Y.TIntersect(e)?ct.Rest(e.allOf):Y.TUnion(e)?ct.Rest(e.anyOf):[]}String(e={}){return this.Create({...e,[G.Kind]:"String",type:"string"})}TemplateLiteral(e,r={}){const n=Be.IsString(e)?Dx.Create(aY.Parse(e)):Dx.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Lx(e)}Tuple(e,r={}){const[n,i,s]=[false,e.length,e.length];const a=ct.Rest(e);const u=e.length>0?{...r,[G.Kind]:"Tuple",type:"array",items:a,additionalItems:n,minItems:i,maxItems:s}:{...r,[G.Kind]:"Tuple",type:"array",minItems:i,maxItems:s};return this.Create(u)}Uncapitalize(e,r={}){return{...Yy.Map(ct.Type(e),"Uncapitalize"),...r}}Union(e,r={}){return Y.TTemplateLiteral(e)?nd.Resolve(e):(()=>{const n=e;if(n.length===0)return this.Never(r);if(n.length===1)return this.Create(ct.Type(n[0],r));const i=ct.Rest(n);return this.Create({...r,[G.Kind]:"Union",anyOf:i})})()}Unknown(e={}){return this.Create({...e,[G.Kind]:"Unknown"})}Unsafe(e={}){return this.Create({...e,[G.Kind]:e[G.Kind]||"Unsafe"})}Uppercase(e,r={}){return{...Yy.Map(ct.Type(e),"Uppercase"),...r}}};G.JsonTypeBuilder=mb;var Fx=class extends mb{static{o(this,"JavaScriptTypeBuilder")}AsyncIterator(e,r={}){return this.Create({...r,[G.Kind]:"AsyncIterator",type:"AsyncIterator",items:ct.Type(e)})}Awaited(e,r={}){const n=o(i=>i.length>0?(()=>{const[s,...a]=i;return[this.Awaited(s),...n(a)]})():i,"Unwrap");return Y.TIntersect(e)?G.Type.Intersect(n(e.allOf)):Y.TUnion(e)?G.Type.Union(n(e.anyOf)):Y.TPromise(e)?this.Awaited(e.item):ct.Type(e,r)}BigInt(e={}){return this.Create({...e,[G.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(e,r={}){return this.Tuple([...e.parameters],{...r})}Constructor(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Constructor",type:"constructor",parameters:i,returns:s})}Date(e={}){return this.Create({...e,[G.Kind]:"Date",type:"Date"})}Function(e,r,n){const[i,s]=[ct.Rest(e),ct.Type(r)];return this.Create({...n,[G.Kind]:"Function",type:"function",parameters:i,returns:s})}InstanceType(e,r={}){return ct.Type(e.returns,r)}Iterator(e,r={}){return this.Create({...r,[G.Kind]:"Iterator",type:"Iterator",items:ct.Type(e)})}Parameters(e,r={}){return this.Tuple(e.parameters,{...r})}Promise(e,r={}){return this.Create({...r,[G.Kind]:"Promise",type:"Promise",item:ct.Type(e)})}RegExp(e,r={}){const n=Be.IsString(e)?e:e.source;return this.Create({...r,[G.Kind]:"String",type:"string",pattern:n})}RegEx(e,r={}){return this.RegExp(e,r)}ReturnType(e,r={}){return ct.Type(e.returns,r)}Symbol(e){return this.Create({...e,[G.Kind]:"Symbol",type:"symbol"})}Undefined(e={}){return this.Create({...e,[G.Kind]:"Undefined",type:"undefined"})}Uint8Array(e={}){return this.Create({...e,[G.Kind]:"Uint8Array",type:"Uint8Array"})}Void(e={}){return this.Create({...e,[G.Kind]:"Void",type:"void"})}};G.JavaScriptTypeBuilder=Fx;G.JsonType=new mb;G.Type=new Fx});var bAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.CustomTypeBuilder=void 0;var gb=EAe();var oY=class extends gb.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return gb.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return gb.Type.Union([e,gb.Type.Null()])}static StringEnum(e){return gb.Type.Unsafe({type:"string",enum:e})}};Mx.CustomTypeBuilder=oY});var AAe=_(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:true});lt.throwIfNotNumber=lt.throwIfNotString=lt.throwIfUndefinedOrNull=lt.throwIfUndefined=lt.ArgumentTypeError=lt.ArgumentUndefinedError=lt.ValidationError=lt.withUndefinedAsNull=lt.withNullAsUndefined=lt.validateConstraint=lt.validateConstraints=lt.areFunctions=lt.isFunction=lt.isEmptyObject=lt.assertAllDefined=lt.assertIsDefined=lt.assertType=lt.isUndefinedOrNull=lt.isDefined=lt.isUndefined=lt.isBoolean=lt.isIterable=lt.isNumber=lt.isTypedArray=lt.isObject=lt.isStringArray=lt.isString=void 0;function Bx(t){return typeof t==="string"}o(Bx,"isString");lt.isString=Bx;function P$t(t){return Array.isArray(t)&&t.every(e=>Bx(e))}o(P$t,"isStringArray");lt.isStringArray=P$t;function wAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(wAe,"isObject");lt.isObject=wAe;function D$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(D$t,"isTypedArray");lt.isTypedArray=D$t;function SAe(t){return typeof t==="number"&&!isNaN(t)}o(SAe,"isNumber");lt.isNumber=SAe;function k$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(k$t,"isIterable");lt.isIterable=k$t;function $$t(t){return t===true||t===false}o($$t,"isBoolean");lt.isBoolean=$$t;function uY(t){return typeof t==="undefined"}o(uY,"isUndefined");lt.isUndefined=uY;function L$t(t){return!Zy(t)}o(L$t,"isDefined");lt.isDefined=L$t;function Zy(t){return uY(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function q$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(q$t,"assertType");lt.assertType=q$t;function j$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(j$t,"assertIsDefined");lt.assertIsDefined=j$t;function U$t(...t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];if(Zy(n)){throw new Error(`Assertion Failed: argument at index ${r} is undefined or null`)}e.push(n)}return e}o(U$t,"assertAllDefined");lt.assertAllDefined=U$t;var F$t=Object.prototype.hasOwnProperty;function M$t(t){if(!wAe(t)){return false}for(const e in t){if(F$t.call(t,e)){return false}}return true}o(M$t,"isEmptyObject");lt.isEmptyObject=M$t;function lY(t){return typeof t==="function"}o(lY,"isFunction");lt.isFunction=lY;function B$t(...t){return t.length>0&&t.every(lY)}o(B$t,"areFunctions");lt.areFunctions=B$t;function V$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){TAe(t[n],e[n])}}o(V$t,"validateConstraints");lt.validateConstraints=V$t;function TAe(t,e){if(Bx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(lY(e)){try{if(t instanceof e){return}}catch{}if(!Zy(t)&&t.constructor===e){return}if(e.length===1&&e.call(void 0,t)===true){return}throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`)}}o(TAe,"validateConstraint");lt.validateConstraint=TAe;function H$t(t){return t===null?void 0:t}o(H$t,"withNullAsUndefined");lt.withNullAsUndefined=H$t;function z$t(t){return typeof t==="undefined"?null:t}o(z$t,"withUndefinedAsNull");lt.withUndefinedAsNull=z$t;var yb=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=yb;var vb=class extends yb{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=vb;var _b=class extends yb{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=_b;function G$t(t,e){if(uY(t)){throw new vb(e)}return true}o(G$t,"throwIfUndefined");lt.throwIfUndefined=G$t;function cY(t,e){if(Zy(t)){throw new vb(e)}}o(cY,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=cY;function K$t(t,e){cY(t,e);if(!Bx(t)){throw new _b(e,"string")}return true}o(K$t,"throwIfNotString");lt.throwIfNotString=K$t;function Y$t(t,e){cY(t,e);if(!SAe(t)){throw new _b(e,"number")}return true}o(Y$t,"throwIfNotNumber");lt.throwIfNotNumber=Y$t});var bb=_(Ae=>{"use strict";var xAe=Ae&&Ae.__createBinding||(Object.create?function(t,e,r,n){if(n===void 0)n=r;var i=Object.getOwnPropertyDescriptor(e,r);if(!i||("get"in i?!e.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return e[r]}}}Object.defineProperty(t,n,i)}:function(t,e,r,n){if(n===void 0)n=r;t[n]=e[r]});var W$t=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Vx=Ae&&Ae.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null){for(var r in t)if(r!=="default"&&Object.prototype.hasOwnProperty.call(t,r))xAe(e,t,r)}W$t(e,t);return e};var _f=Ae&&Ae.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))xAe(e,t,r)};Object.defineProperty(Ae,"__esModule",{value:true});Ae.getRequiredEnvVar=Ae.env=Ae.EnvironmentalVariableRequiredError=Ae.xfs=Ae.RouteValidator=Ae.JsonValidator=Ae.MeteringService=Ae.TenantService=Ae.OpenFGAService=Ae.DevApiService=Ae.getContentApiStorageTarballPath=Ae.contentApiTarballFileName=Ae.ContentApiService=Ae.AuthApiService=Ae.getServiceAccountIdToken=Ae.createApiKeyServiceClient=Ae.ApiKeyService=Ae.RouteVersions=Ae.startsWithReservedKeyword=Ae.logger=Ae.createNewLogger=Ae.graphQL=Ae.CloudStorage=Ae.fly=Ae.ApiServer=Ae.featureFlagsPlugin=Ae.ensureZuploUserPlugin=Ae.ensureZuploAdminPlugin=Ae.ensureServiceAccountPlugin=Ae.apiKeyAuthPlugin=Ae.errorHandler=Ae.DeploymentLogState=Ae.signString=Ae.FeatureFlags=Ae.VALID_COMPATIBILITY_DATES=Ae.DEFAULT_COMPATIBILITY_DATE=Ae.COMPATIBILITY_FLAG_MAPPINGS=Ae.WARNING_STATUS=Ae.WARNING_SEVERITY=Ae.GOOD_STATUS=Ae.FAILURE_STATUS=Ae.ERROR_SEVERITY=Ae.BuildIssueError=Ae.hasBlockedNotifications=Ae.getDefaultFlags=Ae.getBuildFlagsForDeployment=Ae.CommonAuth=void 0;var dY=Vx(Oa());Ae.env=dY.default;Object.defineProperty(Ae,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return dY.EnvironmentalVariableRequiredError}});Object.defineProperty(Ae,"getRequiredEnvVar",{enumerable:true,get:function(){return dY.getRequiredEnvVar}});_f(As(),Ae);var J$t=iC();Object.defineProperty(Ae,"CommonAuth",{enumerable:true,get:function(){return J$t.CommonAuth}});var pY=BY();Object.defineProperty(Ae,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return pY.getBuildFlagsForDeployment}});Object.defineProperty(Ae,"getDefaultFlags",{enumerable:true,get:function(){return pY.getDefaultFlags}});Object.defineProperty(Ae,"hasBlockedNotifications",{enumerable:true,get:function(){return pY.hasBlockedNotifications}});var e2=VY();Object.defineProperty(Ae,"BuildIssueError",{enumerable:true,get:function(){return e2.BuildIssueError}});Object.defineProperty(Ae,"ERROR_SEVERITY",{enumerable:true,get:function(){return e2.ERROR_SEVERITY}});Object.defineProperty(Ae,"FAILURE_STATUS",{enumerable:true,get:function(){return e2.FAILURE_STATUS}});Object.defineProperty(Ae,"GOOD_STATUS",{enumerable:true,get:function(){return e2.GOOD_STATUS}});Object.defineProperty(Ae,"WARNING_SEVERITY",{enumerable:true,get:function(){return e2.WARNING_SEVERITY}});Object.defineProperty(Ae,"WARNING_STATUS",{enumerable:true,get:function(){return e2.WARNING_STATUS}});var Q$t=HY();Object.defineProperty(Ae,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return Q$t.COMPATIBILITY_FLAG_MAPPINGS}});var CAe=KY();Object.defineProperty(Ae,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return CAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(Ae,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return CAe.VALID_COMPATIBILITY_DATES}});var X$t=sC();Object.defineProperty(Ae,"FeatureFlags",{enumerable:true,get:function(){return X$t.FeatureFlags}});var Z$t=YY();Object.defineProperty(Ae,"signString",{enumerable:true,get:function(){return Z$t.signString}});_f(WY(),Ae);var eLt=uC();Object.defineProperty(Ae,"DeploymentLogState",{enumerable:true,get:function(){return eLt.DeploymentLogState}});_f(nW(),Ae);_f(lC(),Ae);var tLt=cC();Object.defineProperty(Ae,"errorHandler",{enumerable:true,get:function(){return tLt.errorHandler}});var Eb=mC();Object.defineProperty(Ae,"apiKeyAuthPlugin",{enumerable:true,get:function(){return Eb.apiKeyAuthPlugin}});Object.defineProperty(Ae,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return Eb.ensureServiceAccountPlugin}});Object.defineProperty(Ae,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return Eb.ensureZuploAdminPlugin}});Object.defineProperty(Ae,"ensureZuploUserPlugin",{enumerable:true,get:function(){return Eb.ensureZuploUserPlugin}});Object.defineProperty(Ae,"featureFlagsPlugin",{enumerable:true,get:function(){return Eb.featureFlagsPlugin}});var rLt=hge();Object.defineProperty(Ae,"ApiServer",{enumerable:true,get:function(){return rLt.ApiServer}});Ae.fly=Vx(yge());Ae.CloudStorage=Vx(sbe());var nLt=abe();Object.defineProperty(Ae,"graphQL",{enumerable:true,get:function(){return nLt.graphQL}});_f(O5e(),Ae);var RAe=Sj();Object.defineProperty(Ae,"createNewLogger",{enumerable:true,get:function(){return RAe.createNewLogger}});Object.defineProperty(Ae,"logger",{enumerable:true,get:function(){return RAe.logger}});var iLt=fH();Object.defineProperty(Ae,"startsWithReservedKeyword",{enumerable:true,get:function(){return iLt.startsWithReservedKeyword}});var sLt=N5e();Object.defineProperty(Ae,"RouteVersions",{enumerable:true,get:function(){return sLt.RouteVersions}});var OAe=eTe();Object.defineProperty(Ae,"ApiKeyService",{enumerable:true,get:function(){return OAe.ApiKeyService}});Object.defineProperty(Ae,"createApiKeyServiceClient",{enumerable:true,get:function(){return OAe.createApiKeyServiceClient}});var aLt=Ry();Object.defineProperty(Ae,"getServiceAccountIdToken",{enumerable:true,get:function(){return aLt.getServiceAccountIdToken}});var oLt=rTe();Object.defineProperty(Ae,"AuthApiService",{enumerable:true,get:function(){return oLt.AuthApiService}});var fY=aTe();Object.defineProperty(Ae,"ContentApiService",{enumerable:true,get:function(){return fY.ContentApiService}});Object.defineProperty(Ae,"contentApiTarballFileName",{enumerable:true,get:function(){return fY.contentApiTarballFileName}});Object.defineProperty(Ae,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return fY.getContentApiStorageTarballPath}});var uLt=lTe();Object.defineProperty(Ae,"DevApiService",{enumerable:true,get:function(){return uLt.DevApiService}});var lLt=cAe();Object.defineProperty(Ae,"OpenFGAService",{enumerable:true,get:function(){return lLt.OpenFGAService}});var cLt=fAe();Object.defineProperty(Ae,"TenantService",{enumerable:true,get:function(){return cLt.TenantService}});var dLt=gAe();Object.defineProperty(Ae,"MeteringService",{enumerable:true,get:function(){return dLt.MeteringService}});_f(yAe(),Ae);_f(bAe(),Ae);_f(AAe(),Ae);var pLt=k7();Object.defineProperty(Ae,"JsonValidator",{enumerable:true,get:function(){return pLt.JsonValidator}});var fLt=EH();Object.defineProperty(Ae,"RouteValidator",{enumerable:true,get:function(){return fLt.RouteValidator}});Ae.xfs=Vx(yB())});var wb=_(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:true});t2.runPlugins=t2.PluginResult=void 0;var hY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};t2.PluginResult=hY;async function hLt(t,e){const r=[];const n=[];const i=new Map;for await(const s of t){try{const a=await s(e,i);n.push(...a.errors.map(u=>{if(u.pluginName===""){u.pluginName=s.name}return u}));r.push(...a.warnings);if(a.errors.length>0){break}}catch(a){n.push(a);break}}return{errors:n,warnings:r}}o(hLt,"runPlugins");t2.runPlugins=hLt});var IAe=_((a0r,NAe)=>{"use strict";function mLt(t){return t>=55296&&t<=56319}o(mLt,"isHighSurrogate");function gLt(t){return t>=56320&&t<=57343}o(gLt,"isLowSurrogate");NAe.exports=o(function t(e,r,n){if(typeof r!=="string"){throw new Error("Input must be string")}var i=r.length;var s=0;var a;var u;for(var l=0;l<i;l+=1){a=r.charCodeAt(l);u=r[l];if(mLt(a)&&gLt(r.charCodeAt(l+1))){l+=1;u+=r[l]}s+=e(u);if(s===n){return r.slice(0,l+1)}else if(s>n){return r.slice(0,l-u.length+1)}}return r},"truncate")});var DAe=_((u0r,PAe)=>{"use strict";var yLt=IAe();var vLt=Buffer.byteLength.bind(Buffer);PAe.exports=yLt.bind(null,vLt)});var kAe=_(r2=>{"use strict";var _Lt=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.sanitize=void 0;var ELt=_Lt(DAe());var bLt=/[/?<>\\:*|"]/g;var wLt=/[\x00-\x1f\x80-\x9f]/g;var SLt=/^\.+$/;var TLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var ALt=/[. ]+$/;function xLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(bLt,e).replace(wLt,e).replace(SLt,e).replace(TLt,e).replace(ALt,e);return(0,ELt.default)(r,255)}o(xLt,"sanitize");r2.sanitize=xLt});var Kl=_(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:true});Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.NODE_BUILD_OUTPUT_FILE=Fe.NODE_ENTRY_NAME=Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE=Fe.WORKER_BUILD_OUTPUT_FILE=Fe.WORKER_ENTRY_NAME=Fe.ENV_MODULE_FILE=Fe.ZUPLO_SYSTEM_ENV_FILE=Fe.ENV_FILE=Fe.CACHE_DIRECTORY=Fe.BUILD_CACHE_FILE=Fe.ZUPLO_FILE_SCHEMA=Fe.NON_STANDARD_NODE_ENV=Fe.GENERATED_TYPES_DIR_NAME=Fe.GENERATED_BUILD_JSON_FILE=Fe.GENERATED_SOURCE_DIR_NAME=Fe.BUILD_OUTPUT_DIR=Fe.DEFAULT_TEST_FILE=Fe.DEFAULT_DOCS_MARKDOWN_FILE=Fe.DOCS_THEME_FILE=Fe.DOCS_SIDEBAR_FILE=Fe.ZUPLO_FALLBACK_JSON_FILE=Fe.ZUPLO_PREFERRED_JSON_FILE=Fe.DEFAULT_MODULE_FILE=Fe.OPEN_API_FILE_SUFFIX=Fe.OPEN_API_CONFIG_FILE=Fe.OPEN_API_UNVERSIONED_DIR_NAME=Fe.DEV_PORTAL_OUTPUT_DIR_NAME=Fe.DEV_PORTAL_CONFIG_FILE=Fe.POLICIES_CONFIG_FILE=Fe.ROUTES_OAS_CONFIG_FILE=Fe.LOCAL_API_KEYS_CONFIG_FILE=Fe.DEV_PORTAL_V4_PATH=Fe.USER_DOCS_DIR_NAME=Fe.USER_SCHEMAS_DIR_NAME=Fe.USER_CONFIG_DIR_NAME=Fe.USER_TEST_DIR_NAME=Fe.USER_MODULES_DIR_NAME=void 0;Fe.USER_MODULES_DIR_NAME="modules";Fe.USER_TEST_DIR_NAME="tests";Fe.USER_CONFIG_DIR_NAME="config";Fe.USER_SCHEMAS_DIR_NAME="schemas";Fe.USER_DOCS_DIR_NAME="docs";Fe.DEV_PORTAL_V4_PATH="v4";Fe.LOCAL_API_KEYS_CONFIG_FILE="api-keys.json";Fe.ROUTES_OAS_CONFIG_FILE="routes.oas.json";Fe.POLICIES_CONFIG_FILE="policies.json";Fe.DEV_PORTAL_CONFIG_FILE="dev-portal.json";Fe.DEV_PORTAL_OUTPUT_DIR_NAME="dev-portal";Fe.OPEN_API_UNVERSIONED_DIR_NAME="unversioned";Fe.OPEN_API_CONFIG_FILE="open-api.json";Fe.OPEN_API_FILE_SUFFIX=".oas.json";Fe.DEFAULT_MODULE_FILE="hello-world.ts";Fe.ZUPLO_PREFERRED_JSON_FILE="zuplo.jsonc";Fe.ZUPLO_FALLBACK_JSON_FILE="zuplo.json";Fe.DOCS_SIDEBAR_FILE="sidebar.json";Fe.DOCS_THEME_FILE="theme.css";Fe.DEFAULT_DOCS_MARKDOWN_FILE="index.md";Fe.DEFAULT_TEST_FILE="hello-world.json";Fe.BUILD_OUTPUT_DIR="dist";Fe.GENERATED_SOURCE_DIR_NAME=".zuplo";Fe.GENERATED_BUILD_JSON_FILE="build.json";Fe.GENERATED_TYPES_DIR_NAME="types";Fe.NON_STANDARD_NODE_ENV=`You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against.`;Fe.ZUPLO_FILE_SCHEMA="zuplo";Fe.BUILD_CACHE_FILE="buildstate.json";Fe.CACHE_DIRECTORY=".cache";Fe.ENV_FILE=".env";Fe.ZUPLO_SYSTEM_ENV_FILE=".env.zuplo";Fe.ENV_MODULE_FILE="environment.ts";Fe.WORKER_ENTRY_NAME="worker.ts";Fe.WORKER_BUILD_OUTPUT_FILE="worker.js";Fe.WORKER_BUILD_OUTPUT_SOURCEMAP_FILE="worker.js.map";Fe.NODE_ENTRY_NAME="server.ts";Fe.NODE_BUILD_OUTPUT_FILE="main.js";Fe.NODE_BUILD_OPEN_API_OUTPUT_FILE=Fe.OPEN_API_CONFIG_FILE});var jAe=_(n2=>{"use strict";var qAe=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.createProjectDirs=void 0;var $Ae=qAe(require("fs/promises"));var CLt=qAe(require("path"));var Sb=Kl();var LAe=wb();var RLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[Sb.USER_MODULES_DIR_NAME,Sb.USER_CONFIG_DIR_NAME,Sb.USER_TEST_DIR_NAME,Sb.USER_SCHEMAS_DIR_NAME,Sb.USER_DOCS_DIR_NAME,".vscode"];try{await $Ae.default.mkdir(t);for(const n of r){await $Ae.default.mkdir(CLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new LAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new LAe.PluginResult},"createProjectDirs");n2.createProjectDirs=RLt});var UAe=_(gY=>{"use strict";Object.defineProperty(gY,"__esModule",{value:true});var Hx=require("perf_hooks");var mY=[];async function OLt(t,e){const r=Hx.performance.timerify(e);const n=new Hx.PerformanceObserver(i=>{const s=i.getEntries()[0];mY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(OLt,"timeFn");var NLt={mark:t=>{Hx.performance.mark(t)},measure:(t,e,r)=>{Hx.performance.measure(t,e,r)},timeFn:OLt,report:()=>{if(mY.length>0){console.table(mY)}}};gY.default=NLt});var VAe=_(i2=>{"use strict";var BAe=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFromTemplate=void 0;var ILt=require("fs");var FAe=BAe(require("fs/promises"));var MAe=BAe(require("path"));async function PLt(t){const e=MAe.default.resolve(__dirname,"..","templates",t);if((0,ILt.existsSync)(e)){const r=await FAe.default.readFile(e,"utf-8");return r}else{const r=MAe.default.resolve(__dirname,"templates",t);const n=await FAe.default.readFile(r,"utf-8");return n}}o(PLt,"generateFromTemplate");i2.generateFromTemplate=PLt});var Ca=_(s2=>{"use strict";var yY=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateFileFromTemplate=void 0;var DLt=bb();var kLt=yY(require("fs/promises"));var $Lt=yY(require("path"));var LLt=yY(UAe());var qLt=VAe();var jLt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return LLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=$Lt.default.join(r,t);if(await DLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return ULt(i,e,n)})}},"generateFileFromTemplate");s2.generateFileFromTemplate=jLt;async function ULt(t,e,r){const n=await(0,qLt.generateFromTemplate)(e);try{await kLt.default.writeFile(t,n,"utf-8");r.debug(`File written to ${t}`)}catch(i){r.error(i);const s={message:`Error creating file at ${t}`,pluginName:"generate-file",severity:"error"};return{warnings:[],errors:[s]}}return{warnings:[],errors:[]}}o(ULt,"writeTemplate")});var zAe=_(a2=>{"use strict";var FLt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsMarkdown=void 0;var MLt=FLt(require("path"));var HAe=Kl();var BLt=Ca();a2.generateDefaultDocsMarkdown=(0,BLt.generateFileFromTemplate)(MLt.default.join(HAe.USER_DOCS_DIR_NAME,HAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var KAe=_(o2=>{"use strict";var VLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsSidebar=void 0;var HLt=VLt(require("path"));var GAe=Kl();var zLt=Ca();o2.generateDefaultDocsSidebar=(0,zLt.generateFileFromTemplate)(HLt.default.join(GAe.USER_DOCS_DIR_NAME,GAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var WAe=_(u2=>{"use strict";var GLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultDocsTheme=void 0;var KLt=GLt(require("path"));var YAe=Kl();var YLt=Ca();u2.generateDefaultDocsTheme=(0,YLt.generateFileFromTemplate)(KLt.default.join(YAe.USER_DOCS_DIR_NAME,YAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var QAe=_(l2=>{"use strict";var WLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDefaultModule=void 0;var JLt=WLt(require("path"));var JAe=Kl();var QLt=Ca();l2.generateDefaultModule=(0,QLt.generateFileFromTemplate)(JLt.default.join(JAe.USER_MODULES_DIR_NAME,JAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var ZAe=_(c2=>{"use strict";var XLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateDevPortalConfigJson=void 0;var ZLt=XLt(require("path"));var XAe=Kl();var eqt=Ca();c2.generateDevPortalConfigJson=(0,eqt.generateFileFromTemplate)(ZLt.default.join(XAe.USER_CONFIG_DIR_NAME,XAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var exe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generateEnvironment=void 0;var tqt=Ca();zx.generateEnvironment=(0,tqt.generateFileFromTemplate)(".env","env.template")});var txe=_(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:true});Gx.generateESLint=void 0;var rqt=Ca();Gx.generateESLint=(0,rqt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var rxe=_(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:true});Kx.generateGitignore=void 0;var nqt=Ca();Kx.generateGitignore=(0,nqt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var nxe=_(d2=>{"use strict";var iqt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateLaunchJson=void 0;var sqt=iqt(require("path"));var aqt=Ca();d2.generateLaunchJson=(0,aqt.generateFileFromTemplate)(sqt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var ixe=_(p2=>{"use strict";var oqt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateSettingsJson=void 0;var uqt=oqt(require("path"));var lqt=Ca();p2.generateSettingsJson=(0,lqt.generateFileFromTemplate)(uqt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var axe=_(f2=>{"use strict";var cqt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generateRouteOasConfig=void 0;var dqt=cqt(require("path"));var sxe=Kl();var pqt=Ca();f2.generateRouteOasConfig=(0,pqt.generateFileFromTemplate)(dqt.default.join(sxe.USER_CONFIG_DIR_NAME,sxe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var cxe=_(Go=>{"use strict";var oxe=Go&&Go.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Go,"__esModule",{value:true});Go.updateProjectPackageJson=Go.getProjectPackageJson=Go.getPackageOverrides=Go.generateDefaultPackageJson=void 0;var fqt=bb();var uxe=oxe(require("fs/promises"));var vY=oxe(require("path"));async function hqt(t,e=fqt.env.USE_MONOREPO_PACKAGES){const r={name:t,version:"1.0.0",author:"",copyright:"",scripts:{dev:"zup dev",test:"zup test"},dependencies:{zuplo:"latest"}};if(e){const n=lxe();r.overrides=n;r.dependencies["@zuplo/runtime"]=n["@zuplo/runtime"];if(r.devDependencies&&"@zuplo/core"in r.devDependencies){r.devDependencies["@zuplo/core"]=n["@zuplo/core"]}if("@zuplo/core"in r.dependencies){r.dependencies["@zuplo/core"]=n["@zuplo/core"]}}return r}o(hqt,"generateDefaultPackageJson");Go.generateDefaultPackageJson=hqt;function lxe(){const t=vY.default.resolve(__dirname,"..","..");return{"@zuplo/core":`file:${t}/core`,"@zuplo/runtime":`file:${t}/runtime`,"@zuplo/debug":`file:${t}/debug`,"@zuplo/errors":`file:${t}/errors`}}o(lxe,"getPackageOverrides");Go.getPackageOverrides=lxe;async function mqt(t){const e=vY.default.join(t,"package.json");const r=await uxe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(mqt,"getProjectPackageJson");Go.getProjectPackageJson=mqt;async function gqt(t,e){const r=vY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await uxe.default.writeFile(r,n,"utf-8")}o(gqt,"updateProjectPackageJson");Go.updateProjectPackageJson=gqt});var fxe=_(Yx=>{"use strict";Object.defineProperty(Yx,"__esModule",{value:true});Yx.generatePackageJson=void 0;var dxe=cxe();var pxe=wb();var yqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,dxe.generateDefaultPackageJson)(e);try{await(0,dxe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new pxe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new pxe.PluginResult},"generatePackageJson");Yx.generatePackageJson=yqt});var mxe=_(h2=>{"use strict";var vqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generatePoliciesConfig=void 0;var _qt=vqt(require("path"));var hxe=Kl();var Eqt=Ca();h2.generatePoliciesConfig=(0,Eqt.generateFileFromTemplate)(_qt.default.join(hxe.USER_CONFIG_DIR_NAME,hxe.POLICIES_CONFIG_FILE),"policies.template.json")});var gxe=_(Wx=>{"use strict";Object.defineProperty(Wx,"__esModule",{value:true});Wx.generateTSConfig=void 0;var bqt=Ca();Wx.generateTSConfig=(0,bqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var vxe=_(m2=>{"use strict";var wqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.generateZuploJson=void 0;var Sqt=bb();var Tqt=require("fs/promises");var Aqt=wqt(require("path"));var xqt=Kl();var yxe=wb();var Cqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:Sqt.DEFAULT_COMPATIBILITY_DATE};const i=Aqt.default.join(e,xqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,Tqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new yxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new yxe.PluginResult},"generateZuploJson");m2.generateZuploJson=Cqt});var Exe=_(g2=>{"use strict";var Rqt=g2&&g2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(g2,"__esModule",{value:true});g2.create=void 0;var _Y=bb();var Oqt=require("fs/promises");var Nqt=Rqt(require("path"));var Iqt=wb();var _xe=kAe();var Pqt=jAe();var Dqt=zAe();var kqt=KAe();var $qt=WAe();var Lqt=QAe();var qqt=ZAe();var jqt=exe();var Uqt=txe();var Fqt=rxe();var Mqt=nxe();var Bqt=ixe();var Vqt=axe();var Hqt=fxe();var zqt=mxe();var Gqt=gxe();var Kqt=vxe();async function Yqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,_xe.sanitize)(t);const s=(0,_xe.sanitize)(e);const a=Nqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await _Y.xfs.dirExists(a)){throw new _Y.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:_Y.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[Pqt.createProjectDirs,Vqt.generateRouteOasConfig,Kqt.generateZuploJson,qqt.generateDevPortalConfigJson,Lqt.generateDefaultModule,kqt.generateDefaultDocsSidebar,Dqt.generateDefaultDocsMarkdown,$qt.generateDefaultDocsTheme,zqt.generatePoliciesConfig]);l.push(...[Gqt.generateTSConfig,Fqt.generateGitignore,Hqt.generatePackageJson,jqt.generateEnvironment,Uqt.generateESLint,Mqt.generateLaunchJson,Bqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,Iqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,Oqt.rm)(a,{recursive:true,force:true});const f=c[0];if(f instanceof Error){throw f}else{throw new Error(f.message)}}const p={sourceDirectory:a,projectName:t};return p}o(Yqt,"create");g2.create=Yqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Wqt=Exe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Wqt.create}});
|
|
411
411
|
/*! For license information please see create.index.minified.js.LEGAL.txt */
|