@zuplo/core 5.1688.0 → 5.1690.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.
@@ -407,5 +407,5 @@ ${p}
407
407
  ${f}`;const m=`${a}/${t.region}/${n}/${NNt}`;const g=`${NSe}
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 z6(t.crypto,y,g);const w=`${NSe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,ISe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(PNt,"generateAuthenticationHeaderMap")});var pG=_(FA=>{"use strict";Object.defineProperty(FA,"__esModule",{value:true});FA.AwsClient=void 0;var DNt=PSe();var kNt=lf();var G6=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}};FA.AwsClient=G6;G6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";G6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var yG=_(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 MA="urn:ietf:params:oauth:token-type:saml2";var fG="urn:ietf:params:oauth:token-type:id_token";var hG="urn:ietf:params:oauth:token-type:jwt";var mG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new BA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new VA("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!==MA&&this.tokenType!==fG&&this.tokenType!==hG){throw new HA(`Executable response must contain a 'token_type' field when successful and it must be one of ${fG}, ${hG}, or ${MA}.`)}if(this.tokenType===MA){if(!e.saml_response){throw new K6(`Executable response must contain a 'saml_response' field when token_type=${MA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new K6(`Executable response must contain a 'id_token' field when token_type=${fG} or ${hG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new zA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new GA("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=mG;var Ml=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Ml;var BA=class extends Ml{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=BA;var VA=class extends Ml{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=VA;var gG=class extends Ml{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=gG;var HA=class extends Ml{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=HA;var zA=class extends Ml{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=zA;var GA=class extends Ml{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=GA;var K6=class extends Ml{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=K6});var DSe=_(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:true});KA.PluggableAuthHandler=void 0;var $Nt=YA();var Om=yG();var LNt=require("child_process");var vG=require("fs");var _G=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 Om.ExecutableResponse(l);return r(c)}catch(l){if(l instanceof Om.ExecutableResponseError){return n(l)}return n(new Om.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 vG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await vG.promises.lstat(e)).isFile()){return void 0}const r=await vG.promises.readFile(e,{encoding:"utf8"});if(r===""){return void 0}try{const n=JSON.parse(r);const i=new Om.ExecutableResponse(n);if(i.isValid()){return new Om.ExecutableResponse(n)}return void 0}catch(n){if(n instanceof Om.ExecutableResponseError){throw n}throw new Om.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}};KA.PluggableAuthHandler=_G});var YA=_(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:true});Sy.PluggableAuthClient=Sy.ExecutableError=void 0;var qNt=lf();var jNt=yG();var UNt=DSe();var WA=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=WA;var FNt=30*1e3;var kSe=5*1e3;var $Se=120*1e3;var MNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var LSe=1;var EG=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<kSe||this.timeoutMillis>$Se){throw new Error(`Timeout must be between ${kSe} and ${$Se} 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>LSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${LSe}.`)}if(!e.success){throw new WA(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=EG});var wG=_(JA=>{"use strict";Object.defineProperty(JA,"__esModule",{value:true});JA.ExternalAccountClient=void 0;var BNt=lf();var VNt=cG();var HNt=pG();var zNt=YA();var bG=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}}};JA.ExternalAccountClient=bG});var jSe=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.ExternalAccountAuthorizedUserClient=Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var GNt=ny();var qSe=Zz();var KNt=Wc();var YNt=require("stream");var WNt=lf();Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var SG=class extends qSe.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,qSe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var TG=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 SG(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=TG});var MSe=_(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:true});xy.GoogleAuth=xy.CLOUD_SDK_CLIENT_ID=void 0;var JNt=require("child_process");var Y6=require("fs");var AG=V7();var QNt=require("os");var xG=require("path");var XNt=ty();var ZNt=R6();var eIt=$H();var tIt=qH();var rIt=jH();var Ay=Kz();var CG=Wz();var QA=Qz();var nIt=wG();var W6=lf();var USe=jSe();xy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var FSe={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 XA=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===FSe.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(FSe.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 W6.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 W6.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 AG.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=xG.join(i,".config")}}if(r){r=xG.join(r,"gcloud","application_default_credentials.json");if(!Y6.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=Y6.realpathSync(e);if(!Y6.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=Y6.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!==QA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${QA.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 CG.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 QA.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===CG.USER_REFRESH_ACCOUNT_TYPE){n=new CG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===QA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===W6.EXTERNAL_ACCOUNT_TYPE){n=nIt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===USe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new USe.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!==W6.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await AG.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 W6.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 AG.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=xG.resolve(this.keyFilename);const r=Y6.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=XA;XA.DefaultTransporter=ZNt.DefaultTransporter});var BSe=_(ZA=>{"use strict";Object.defineProperty(ZA,"__esModule",{value:true});ZA.IAMAuth=void 0;var RG=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}}};ZA.IAMAuth=RG});var VSe=_(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:true});Pu.DownscopedClient=Pu.EXPIRATION_TIME_OFFSET=Pu.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var iIt=require("stream");var sIt=ny();var aIt=tG();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";Pu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Pu.EXPIRATION_TIME_OFFSET=5*60*1e3;var OG=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>Pu.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Pu.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=Pu.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}};Pu.DownscopedClient=OG});var NG=_(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 HSe=MSe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return HSe.GoogleAuth}});var dIt=ny();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return dIt.AuthClient}});var pIt=$H();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return pIt.Compute}});var fIt=jH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return fIt.GCPEnv}});var hIt=BSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return hIt.IAMAuth}});var mIt=qH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return mIt.IdTokenClient}});var gIt=zz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return gIt.JWTAccess}});var yIt=Kz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return yIt.JWT}});var vIt=Qz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return vIt.Impersonated}});var zSe=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return zSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return zSe.OAuth2Client}});var _It=PH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return _It.LoginTicket}});var EIt=Wz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return EIt.UserRefreshClient}});var bIt=pG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return bIt.AwsClient}});var wIt=cG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return wIt.IdentityPoolClient}});var SIt=wG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return SIt.ExternalAccountClient}});var TIt=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return TIt.BaseExternalAccountClient}});var AIt=VSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return AIt.DownscopedClient}});var xIt=YA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return xIt.PluggableAuthClient}});var CIt=R6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return CIt.DefaultTransporter}});var RIt=new HSe.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=NG();var IIt=OIt(tu());var PIt=new NIt.GoogleAuth;var GSe=new IIt.default({max:50,maxAge:1e3*60*50});async function DIt(t){let e=GSe.get(t);if(!e){const r=await PIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);GSe.set(t,e)}return e}o(DIt,"getServiceAccountIdToken");Cy.getServiceAccountIdToken=DIt});var QSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Oy=As();var kIt=Ry();var $It={"Content-Type":"application/json"};var LIt=/\/*$/;async function qIt(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({...$It,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,kIt.getServiceAccountIdToken)(e);d.set("Authorization",`Bearer ${p}`);async function f(h,m){const{headers:g,body:y,params:v={},parseAs:w="json",querySerializer:E=n??KSe,bodySerializer:b=i??YSe,...S}=m||{};const T=WSe(h,{baseUrl:e,params:v,querySerializer:E});const A=JSe(d,g,v.header);const P={redirect:"follow",...a,...S,headers:A};if(y)P.body=b(y);if(P.body instanceof FormData)A.delete("Content-Type");const D=await r(T,P);if(D.status===404){const F=await D.json();if(F&&F.hasOwnProperty("type")&&F.hasOwnProperty("title")&&F.hasOwnProperty("status")){throw new Oy.ApiError(F)}throw new Oy.ApiError(Oy.Problems.NOT_FOUND)}if(D.status===204||D.headers.get("Content-Length")==="0"){return D.ok?{data:{},response:D}:{error:{},response:D}}if(D.ok){let F=D.body;if(w!=="stream"){const V=D.clone();F=typeof V[w]==="function"?await V[w]():await V.text()}return{data:F,response:D}}else{u.debug(`Error on internal api: path: ${T}, status: ${D.status}, headers: ${JSON.stringify(D.headers)}, body: ${await D.clone().text()}`);let F={};try{F=await D.clone().json();if(F.type&&F.status&&F.title){throw new Oy.ApiError(F)}}catch(V){}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(qIt,"createClient");Fo.createClient=qIt;function KSe(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(KSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=KSe;function YSe(t){return JSON.stringify(t)}o(YSe,"defaultBodySerializer");Fo.defaultBodySerializer=YSe;function WSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(LIt,""):""}${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(WSe,"createFinalURL");Fo.createFinalURL=WSe;function JSe(...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(JSe,"mergeHeaders");Fo.mergeHeaders=JSe});var XSe=_(cf=>{"use strict";var jIt=cf&&cf.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(cf,"__esModule",{value:true});cf.ApiKeyService=cf.createApiKeyServiceClient=void 0;var Ny=As();var UIt=NG();var ex=jIt(Oa());var FIt=QSe();async function MIt(t){return(0,FIt.createClient)({baseUrl:ex.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(MIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=MIt;var IG=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 UIt.GoogleAuth;const i=await n.getIdTokenClient(ex.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${ex.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:`${ex.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}};cf.ApiKeyService=IG});var eTe=_(Iy=>{"use strict";var BIt=Iy&&Iy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Iy,"__esModule",{value:true});Iy.AuthApiService=void 0;var Nm=As();var ZSe=BIt(Oa());var VIt=Ry();var PG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!ZSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=ZSe.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===Nm.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,VIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===Nm.HttpStatusCode.NOT_FOUND){throw new Nm.ApiError(Nm.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 Nm.ApiError(s)}this.logger.error(`Error not handled on auth-api: path: ${e}, status: ${i.status}`);throw new Nm.ApiError(Nm.Problems.INTERNAL_SERVER_ERROR)}return i.clone().json()}};Iy.AuthApiService=PG});var J6=_(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:true});tx.ApiServiceClient=void 0;var Py=As();var HIt=Ry();var DG=class{static{o(this,"ApiServiceClient")}userSub;logger;requestId;baseUrl;cache;constructor(e,r,n){this.userSub=n.userSub;this.logger=n.logger;this.requestId=n.requestId;this.baseUrl=e;this.cache=r}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,HIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===404){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}, headers: ${JSON.stringify(i.headers)}, 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()}};tx.ApiServiceClient=DG});var iTe=_(Bl=>{"use strict";var rTe=Bl&&Bl.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Bl,"__esModule",{value:true});Bl.ContentApiService=Bl.getContentApiStorageTarballPath=Bl.contentApiTarballFileName=void 0;var zIt=rTe(tu());var tTe=rTe(Oa());var GIt=J6();var KIt=new zIt.default({max:500,maxAge:1e3*60*50});function nTe(t,e){return`${t}--${e}.tar.gz`}o(nTe,"contentApiTarballFileName");Bl.contentApiTarballFileName=nTe;function YIt(t,e){const r=nTe(t,e);return`${t}/builds/${r}`}o(YIt,"getContentApiStorageTarballPath");Bl.getContentApiStorageTarballPath=YIt;var kG=class extends GIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!tTe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(tTe.default.CONTENT_API_URL,KIt,e)}};Bl.ContentApiService=kG});var oTe=_(Dy=>{"use strict";var aTe=Dy&&Dy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Dy,"__esModule",{value:true});Dy.DevApiService=void 0;var WIt=aTe(tu());var sTe=aTe(Oa());var JIt=J6();var QIt=new WIt.default({max:500,maxAge:1e3*60*50});var $G=class extends JIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!sTe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(sTe.default.DEV_API_URL,QIt,{userSub:n,logger:e.log,requestId:e.id})}};Dy.DevApiService=$G});var cTe=_((Nhr,lTe)=>{var uTe=require("stream").Stream;var XIt=require("util");lTe.exports=Du;function Du(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(Du,"DelayedStream");XIt.inherits(Du,uTe);Du.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(Du.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});Du.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Du.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};Du.prototype.pause=function(){this.source.pause()};Du.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};Du.prototype.pipe=function(){var t=uTe.prototype.pipe.apply(this,arguments);this.resume();return t};Du.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)};Du.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 hTe=_((Phr,fTe)=>{var ZIt=require("util");var pTe=require("stream").Stream;var dTe=cTe();fTe.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");ZIt.inherits(Xn,pTe);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 dTe)){var r=dTe.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){pTe.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 gTe=_((khr,mTe)=>{mTe.exports=ePt;function ePt(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(ePt,"defer")});var LG=_((Lhr,vTe)=>{var yTe=gTe();vTe.exports=tPt;function tPt(t){var e=false;yTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{yTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(tPt,"async")});var qG=_((jhr,_Te)=>{_Te.exports=rPt;function rPt(t){Object.keys(t.jobs).forEach(nPt.bind(t));t.jobs={}}o(rPt,"abort");function nPt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(nPt,"clean")});var jG=_((Fhr,bTe)=>{var ETe=LG();var iPt=qG();bTe.exports=sPt;function sPt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=aPt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){iPt(r)}else{r.results[i]=a}n(s,r.results)})}o(sPt,"iterate");function aPt(t,e,r,n){var i;if(t.length==2){i=t(r,ETe(n))}else{i=t(r,e,ETe(n))}return i}o(aPt,"runJob")});var UG=_((Bhr,wTe)=>{wTe.exports=oPt;function oPt(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(oPt,"state")});var FG=_((Hhr,STe)=>{var uPt=qG();var lPt=LG();STe.exports=cPt;function cPt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;uPt(this);lPt(t)(null,this.results)}o(cPt,"terminator")});var ATe=_((Ghr,TTe)=>{var dPt=jG();var pPt=UG();var fPt=FG();TTe.exports=hPt;function hPt(t,e,r){var n=pPt(t);while(n.index<(n["keyedList"]||t).length){dPt(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 fPt.bind(n,r)}o(hPt,"parallel")});var MG=_((Yhr,rx)=>{var xTe=jG();var mPt=UG();var gPt=FG();rx.exports=yPt;rx.exports.ascending=CTe;rx.exports.descending=vPt;function yPt(t,e,r,n){var i=mPt(t,r);xTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){xTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return gPt.bind(i,n)}o(yPt,"serialOrdered");function CTe(t,e){return t<e?-1:t>e?1:0}o(CTe,"ascending");function vPt(t,e){return-1*CTe(t,e)}o(vPt,"descending")});var OTe=_((Jhr,RTe)=>{var _Pt=MG();RTe.exports=EPt;function EPt(t,e,r){return _Pt(t,e,null,r)}o(EPt,"serial")});var ITe=_((Xhr,NTe)=>{NTe.exports={parallel:ATe(),serial:OTe(),serialOrdered:MG()}});var DTe=_((Zhr,PTe)=>{PTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var LTe=_((emr,$Te)=>{var zG=hTe();var kTe=require("util");var BG=require("path");var bPt=require("http");var wPt=require("https");var SPt=require("url").parse;var TPt=require("fs");var APt=require("stream").Stream;var VG=xM();var xPt=ITe();var HG=DTe();$Te.exports=Fr;kTe.inherits(Fr,zG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];zG.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=zG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(kTe.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 APt)){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{TPt.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"){HG(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=BG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=BG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=BG.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=VG.lookup(t.name)}if(!r&&t.path){r=VG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=VG.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}xPt.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=SPt(t);n=HG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=HG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=wPt.request(n)}else{r=bPt.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 jTe=_(qTe=>{"use strict";var CPt=require("url").parse;var RPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var OPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function NPt(t){var e=typeof t==="string"?CPt(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)||RPt[r]||0;if(!IPt(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(NPt,"getProxyForUrl");function IPt(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!OPt.call(t,s)})}o(IPt,"shouldProxy");function ky(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o(ky,"getEnv");qTe.getProxyForUrl=NPt});var FTe=_((imr,UTe)=>{var Q6;UTe.exports=function(){if(!Q6){try{Q6=Ja()("follow-redirects")}catch(t){}if(typeof Q6!=="function"){Q6=o(function(){},"debug")}}Q6.apply(null,arguments)}});var zTe=_((amr,nK)=>{var eb=require("url");var X6=eb.URL;var PPt=require("http");var DPt=require("https");var JG=require("stream").Writable;var QG=require("assert");var MTe=FTe();var XG=false;try{QG(new X6)}catch(t){XG=t.code==="ERR_INVALID_URL"}var kPt=["auth","host","hostname","href","path","pathname","port","protocol","query","search"];var ZG=["abort","aborted","connect","error","socket","timeout"];var eK=Object.create(null);ZG.forEach(function(t){eK[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var KG=tb("ERR_INVALID_URL","Invalid URL",TypeError);var YG=tb("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var $Pt=tb("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",YG);var LPt=tb("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var qPt=tb("ERR_STREAM_WRITE_AFTER_END","write after end");var jPt=JG.prototype.destroy||VTe;function Ta(t,e){JG.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 YG?i:new YG({cause:i}))}};this._performRequest()}o(Ta,"RedirectableRequest");Ta.prototype=Object.create(JG.prototype);Ta.prototype.abort=function(){rK(this._currentRequest);this._currentRequest.abort();this.emit("abort")};Ta.prototype.destroy=function(t){rK(this._currentRequest,t);jPt.call(this,t);return this};Ta.prototype.write=function(t,e,r){if(this._ending){throw new qPt}if(!Im(t)&&!MPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(Z6(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 LPt);this.abort()}};Ta.prototype.end=function(t,e,r){if(Z6(t)){r=t;t=e=null}else if(Z6(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 ZG){n.on(i,eK[i])}this._currentUrl=/^\//.test(this._options.path)?eb.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}rK(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){throw new $Pt}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=[];GG(/^content-/i,this._options.headers)}var a=GG(/^host$/i,this._options.headers);var u=tK(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:eb.format(Object.assign(u,{host:l}));var d=UPt(r,c);MTe("redirecting to",d.href);this._isRedirect=true;WG(d,this._options);if(d.protocol!==u.protocol&&d.protocol!=="https:"||d.host!==l&&!FPt(d.host,l)){GG(/^(?:authorization|cookie)$/i,this._options.headers)}if(Z6(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 BTe(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(BPt(c)){c=WG(c)}else if(Im(c)){c=WG(tK(c))}else{p=d;d=HTe(c);c={protocol:i}}if(Z6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Im(d.host)&&!Im(d.hostname)){d.hostname="::1"}QG.equal(d.protocol,i,"protocol mismatch");MTe("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(BTe,"wrap");function VTe(){}o(VTe,"noop");function tK(t){var e;if(XG){e=new X6(t)}else{e=HTe(eb.parse(t));if(!Im(e.protocol)){throw new KG({input:t})}}return e}o(tK,"parseUrl");function UPt(t,e){return XG?new X6(t,e):tK(eb.resolve(e,t))}o(UPt,"resolveUrl");function HTe(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname)){throw new KG({input:t.href||t})}if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host)){throw new KG({input:t.href||t})}return t}o(HTe,"validateUrl");function WG(t,e){var r=e||{};for(var n of kPt){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(WG,"spreadUrlObject");function GG(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(GG,"removeMatchingHeaders");function tb(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(tb,"createErrorType");function rK(t,e){for(var r of ZG){t.removeListener(r,eK[r])}t.on("error",VTe);t.destroy(e)}o(rK,"destroyRequest");function FPt(t,e){QG(Im(t)&&Im(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(FPt,"isSubdomain");function Im(t){return typeof t==="string"||t instanceof String}o(Im,"isString");function Z6(t){return typeof t==="function"}o(Z6,"isFunction");function MPt(t){return typeof t==="object"&&"length"in t}o(MPt,"isBuffer");function BPt(t){return X6&&t instanceof X6}o(BPt,"isURL");nK.exports=BTe({http:PPt,https:DPt});nK.exports.wrap=BTe});var px=_((umr,k7e)=>{"use strict";var VPt=LTe();var HPt=require("url");var zPt=jTe();var GPt=require("http");var KPt=require("https");var l7e=require("util");var YPt=zTe();var WPt=require("zlib");var c7e=require("stream");var JPt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var d7e=td(VPt);var QPt=td(HPt);var XPt=td(GPt);var ZPt=td(KPt);var eDt=td(l7e);var tDt=td(YPt);var hf=td(WPt);var pf=td(c7e);var rDt=td(JPt);function p7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(p7e,"bind");var{toString:nDt}=Object.prototype;var{getPrototypeOf:vK}=Object;var ux=(t=>e=>{const r=nDt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>ux(e)===t},"kindOfTest");var lx=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:jy}=Array;var ib=lx("undefined");function iDt(t){return t!==null&&!ib(t)&&t.constructor!==null&&!ib(t.constructor)&&Bo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(iDt,"isBuffer");var f7e=Vl("ArrayBuffer");function sDt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&f7e(t.buffer)}return e}o(sDt,"isArrayBufferView");var aDt=lx("string");var Bo=lx("function");var h7e=lx("number");var cx=o(t=>t!==null&&typeof t==="object","isObject");var oDt=o(t=>t===true||t===false,"isBoolean");var ix=o(t=>{if(ux(t)!=="object"){return false}const e=vK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var uDt=Vl("Date");var lDt=Vl("File");var cDt=Vl("Blob");var dDt=Vl("FileList");var pDt=o(t=>cx(t)&&Bo(t.pipe),"isStream");var fDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Bo(t.append)&&((e=ux(t))==="formdata"||e==="object"&&Bo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var hDt=Vl("URLSearchParams");var mDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ab(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(ab,"forEach");function m7e(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(m7e,"findKey");var g7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var y7e=o(t=>!ib(t)&&t!==g7e,"isContextDefined");function uK(){const{caseless:t}=y7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&m7e(e,i)||i;if(ix(e[s])&&ix(n)){e[s]=uK(e[s],n)}else if(ix(n)){e[s]=uK({},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]&&ab(arguments[n],r)}return e}o(uK,"merge");var gDt=o((t,e,r,{allOwnKeys:n}={})=>{ab(e,(i,s)=>{if(r&&Bo(i)){t[s]=p7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var yDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var vDt=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 _Dt=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&&vK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var EDt=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 bDt=o(t=>{if(!t)return null;if(jy(t))return t;let e=t.length;if(!h7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var wDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&vK(Uint8Array));var SDt=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 TDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var ADt=Vl("HTMLFormElement");var xDt=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 GTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var CDt=Vl("RegExp");var v7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};ab(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var RDt=o(t=>{v7e(t,(e,r)=>{if(Bo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Bo(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 ODt=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 NDt=o(()=>{},"noop");var IDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var iK="abcdefghijklmnopqrstuvwxyz";var KTe="0123456789";var _7e={DIGIT:KTe,ALPHA:iK,ALPHA_DIGIT:iK+iK.toUpperCase()+KTe};var PDt=o((t=16,e=_7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function DDt(t){return!!(t&&Bo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(DDt,"isSpecCompliantForm");var kDt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(cx(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=jy(n)?[]:{};ab(n,(a,u)=>{const l=r(a,i+1);!ib(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var $Dt=Vl("AsyncFunction");var LDt=o(t=>t&&(cx(t)||Bo(t))&&Bo(t.then)&&Bo(t.catch),"isThenable");var fe={isArray:jy,isArrayBuffer:f7e,isBuffer:iDt,isFormData:fDt,isArrayBufferView:sDt,isString:aDt,isNumber:h7e,isBoolean:oDt,isObject:cx,isPlainObject:ix,isUndefined:ib,isDate:uDt,isFile:lDt,isBlob:cDt,isRegExp:CDt,isFunction:Bo,isStream:pDt,isURLSearchParams:hDt,isTypedArray:wDt,isFileList:dDt,forEach:ab,merge:uK,extend:gDt,trim:mDt,stripBOM:yDt,inherits:vDt,toFlatObject:_Dt,kindOf:ux,kindOfTest:Vl,endsWith:EDt,toArray:bDt,forEachEntry:SDt,matchAll:TDt,isHTMLForm:ADt,hasOwnProperty:GTe,hasOwnProp:GTe,reduceDescriptors:v7e,freezeMethods:RDt,toObjectSet:ODt,toCamelCase:xDt,noop:NDt,toFiniteNumber:IDt,findKey:m7e,global:g7e,isContextDefined:y7e,ALPHABET:_7e,generateString:PDt,isSpecCompliantForm:DDt,toJSONObject:kDt,isAsyncFn:$Dt,isThenable:LDt};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 E7e=nt.prototype;var b7e={};["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=>{b7e[t]={value:t}});Object.defineProperties(nt,b7e);Object.defineProperty(E7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(E7e);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 lK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(lK,"isVisitable");function w7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(w7e,"removeBrackets");function YTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=w7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(YTe,"renderKey");function qDt(t){return fe.isArray(t)&&!t.some(lK)}o(qDt,"isFlatArray");var jDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function dx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(d7e["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)&&qDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=w7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?YTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(lK(m)){return true}e.append(YTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(jDt,{defaultVisitor:d,convertValue:c,isVisitable:lK});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(dx,"toFormData");function WTe(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(WTe,"encode$1");function S7e(t,e){this._pairs=[];t&&dx(t,this,e)}o(S7e,"AxiosURLSearchParams");var T7e=S7e.prototype;T7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");T7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,WTe)}:WTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function UDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(UDt,"encode");function _K(t,e,r){if(!e){return t}const n=r&&r.encode||UDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new S7e(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(_K,"buildURL");var cK=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 JTe=cK;var EK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var FDt=QPt["default"].URLSearchParams;var MDt={isNode:true,classes:{URLSearchParams:FDt,FormData:d7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var A7e=typeof window!=="undefined"&&typeof document!=="undefined";var BDt=(t=>{return A7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var VDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var HDt=Object.freeze({__proto__:null,hasBrowserEnv:A7e,hasStandardBrowserWebWorkerEnv:VDt,hasStandardBrowserEnv:BDt});var Mo={...HDt,...MDt};function zDt(t,e){return dx(t,new Mo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Mo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(zDt,"toURLEncodedForm");function GDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(GDt,"parsePropPath");function KDt(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(KDt,"arrayToObject");function x7e(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]=KDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(GDt(n),i,r,0)});return r}return null}o(x7e,"formDataToJSON");function YDt(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(YDt,"stringifySafely");var bK={transitional:EK,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(x7e(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 zDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return dx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return YDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||bK.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:Mo.classes.FormData,Blob:Mo.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=>{bK.headers[t]={}});var wK=bK;var WDt=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 JDt=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]&&WDt[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 QTe=Symbol("internals");function rb(t){return t&&String(t).trim().toLowerCase()}o(rb,"normalizeHeader");function sx(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(sx):String(t)}o(sx,"normalizeValue");function QDt(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(QDt,"parseTokens");var XDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function sK(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(sK,"matchHeaderValue");function ZDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(ZDt,"formatHeader");function ekt(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(ekt,"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=rb(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]=sx(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())&&!XDt(e)){a(JDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=rb(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return QDt(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=rb(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||sK(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=rb(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||sK(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||sK(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]=sx(i);delete r[s];return}const u=e?ZDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=sx(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[QTe]=this[QTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=rb(a);if(!n[u]){ekt(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 Vo=$y;function aK(t,e){const r=this||wK;const n=e||r;const i=Vo.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(aK,"transformData");function C7e(t){return!!(t&&t.__CANCEL__)}o(C7e,"isCancel");function Pm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Pm,"CanceledError");fe.inherits(Pm,nt,{__CANCEL__:true});function nb(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(nb,"settle");function tkt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(tkt,"isAbsoluteURL");function rkt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(rkt,"combineURLs");function SK(t,e){if(t&&!tkt(e)){return rkt(t,e)}return e}o(SK,"buildFullPath");var ox="1.6.2";function R7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(R7e,"parseProtocol");var nkt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ikt(t,e,r){const n=r&&r.Blob||Mo.classes.Blob;const i=R7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=nkt.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(ikt,"fromDataURI");function skt(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(skt,"throttle");function O7e(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(O7e,"speedometer");var nx=Symbol("internals");var dK=class extends pf["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[nx]={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=O7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=skt(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[nx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[nx];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[nx].length=+e;return this}};var XTe=dK;var{asyncIterator:ZTe}=Symbol;var akt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[ZTe]){yield*t[ZTe]()}else{yield t}},"readBlob");var N7e=akt;var okt=fe.ALPHABET.ALPHA_DIGIT+"-_";var sb=new l7e.TextEncoder;var ff="\r\n";var ukt=sb.encode(ff);var lkt=2;var pK=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)}"`:""}${ff}`;if(i){r=sb.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=sb.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+lkt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*N7e(e)}yield ukt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var ckt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,okt)}=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=sb.encode("--"+s+ff);const u=sb.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new pK(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 c7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var dkt=ckt;var fK=class extends pf["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 pkt=fK;var fkt=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 hkt=fkt;var e7e={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var mkt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var t7e=fe.isFunction(hf["default"].createBrotliDecompress);var{http:gkt,https:ykt}=tDt["default"];var vkt=/https:?/;var r7e=Mo.protocols.map(t=>{return t+":"});function _kt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(_kt,"dispatchBeforeRedirect");function I7e(t,e,r){let n=e;if(!n&&n!==false){const i=zPt.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){I7e(s,e,s.href)},"beforeRedirect")}o(I7e,"setProxy");var Ekt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var bkt=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 wkt=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 n7e=o((t,e)=>wkt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var Skt=Ekt&&o(function t(e){return bkt(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=hkt(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=>n7e(Le)):[n7e($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new rDt["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 Pm(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=SK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||r7e[0];if(b==="data:"){let ue;if(p!=="GET"){return nb(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=ikt(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=pf["default"].Readable.from(ue)}return nb(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(r7e.indexOf(b)===-1){return i(new nt("Unsupported protocol "+b,nt.ERR_BAD_REQUEST,e))}const S=Vo.from(e.headers).normalize();S.set("User-Agent","axios/"+ox,false);const T=e.onDownloadProgress;const A=e.onUploadProgress;const P=e.maxRate;let D=void 0;let F=void 0;if(fe.isSpecCompliantForm(a)){const ue=S.getContentType(/boundary=([-_\w\d]{10,70})/i);a=dkt(a,xe=>{S.set(xe)},{tag:`axios-${ox}-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 eDt["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=pf["default"].Readable.from(N7e(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 V=fe.toFiniteNumber(S.getContentLength());if(fe.isArray(P)){D=P[0];F=P[1]}else{D=F=P}if(a&&(A||D)){if(!fe.isStream(a)){a=pf["default"].Readable.from(a,{objectMode:false})}a=pf["default"].pipeline([a,new XTe({length:V,maxRate:fe.toFiniteNumber(D)})],fe.noop);A&&a.on("progress",ue=>{A(Object.assign(ue,{upload:true}))})}let j=void 0;if(e.auth){const ue=e.auth.username||"";const xe=e.auth.password||"";j=ue+":"+xe}if(!j&&E.username){const ue=E.username;const xe=E.password;j=ue+":"+xe}j&&S.delete("authorization");let Q;try{Q=_K(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"+(t7e?", br":""),false);const oe={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:b,family:l,beforeRedirect:_kt,beforeRedirects:{}};!fe.isUndefined(u)&&(oe.lookup=u);if(e.socketPath){oe.socketPath=e.socketPath}else{oe.hostname=E.hostname;oe.port=E.port;I7e(oe,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+oe.path)}let Te;const le=vkt.test(oe.protocol);oe.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?ZPt["default"]:XPt["default"]}else{if(e.maxRedirects){oe.maxRedirects=e.maxRedirects}if(e.beforeRedirect){oe.beforeRedirects.config=e.beforeRedirect}Te=le?ykt:gkt}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 XTe({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(F)});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(hf["default"].createUnzip(e7e));delete xe.headers["content-encoding"];break;case"deflate":we.push(new pkt);we.push(hf["default"].createUnzip(e7e));delete xe.headers["content-encoding"];break;case"br":if(t7e){we.push(hf["default"].createBrotliDecompress(mkt));delete xe.headers["content-encoding"]}}}Ue=we.length>1?pf["default"].pipeline(we,fe.noop):we[0];const ge=pf["default"].finished(Ue,()=>{ge();y()});const Je={status:xe.statusCode,statusText:xe.statusMessage,headers:new Vo(xe.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;nb(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))}nb(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||EK;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 Pm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var Tkt=Mo.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 Akt=Mo.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 i7e(t,e){let r=0;const n=O7e(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(i7e,"progressEventReducer");var xkt=typeof XMLHttpRequest!=="undefined";var Ckt=xkt&&function(t){return new Promise(o(function e(r,n){let i=t.data;const s=Vo.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(Mo.hasStandardBrowserEnv||Mo.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=SK(t.baseURL,t.url);p.open(t.method.toUpperCase(),_K(f,t.params,t.paramsSerializer),true);p.timeout=t.timeout;function h(){if(!p){return}const g=Vo.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};nb(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||EK;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Mo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&Akt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&Tkt.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",i7e(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",i7e(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Pm(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=R7e(f);if(m&&Mo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var hK={http:Skt,xhr:Ckt};fe.forEach(hK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var s7e=o(t=>`- ${t}`,"renderReason");var Rkt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var P7e={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(!Rkt(r)){n=hK[(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(s7e).join("\n"):" "+s7e(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:hK};function oK(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Pm(null,t)}}o(oK,"throwIfCancellationRequested");function a7e(t){oK(t);t.headers=Vo.from(t.headers);t.data=aK.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=P7e.getAdapter(t.adapter||wK.adapter);return e(t).then(o(function r(n){oK(t);n.data=aK.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!C7e(n)){oK(t);if(n&&n.response){n.response.data=aK.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(a7e,"dispatchRequest");var o7e=o(t=>t instanceof Vo?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(o7e(c),o7e(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 TK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{TK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var u7e={};TK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+ox+"] 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&&!u7e[a]){u7e[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 Okt(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(Okt,"assertOptions");var mK={assertOptions:Okt,validators:TK};var df=mK.validators;var qy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new JTe,response:new JTe}}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){mK.assertOptions(n,{silentJSONParsing:df.transitional(df.boolean),forcedJSONParsing:df.transitional(df.boolean),clarifyTimeoutError:df.transitional(df.boolean)},false)}if(i!=null){if(fe.isFunction(i)){r.paramsSerializer={serialize:i}}else{mK.assertOptions(i,{encode:df.function,serialize:df.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=Vo.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=[a7e.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=a7e.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=SK(e.baseURL,e.url);return _K(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 ax=qy;var gK=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 Pm(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 Nkt=gK;function Ikt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(Ikt,"spread");function Pkt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Pkt,"isAxiosError");var yK={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(yK).forEach(([t,e])=>{yK[e]=t});var Dkt=yK;function D7e(t){const e=new ax(t);const r=p7e(ax.prototype.request,e);fe.extend(r,ax.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return D7e(Ly(t,i))},"create");return r}o(D7e,"createInstance");var fi=D7e(wK);fi.Axios=ax;fi.CanceledError=Pm;fi.CancelToken=Nkt;fi.isCancel=C7e;fi.VERSION=ox;fi.toFormData=dx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=Ikt;fi.isAxiosError=Pkt;fi.mergeConfig=Ly;fi.AxiosHeaders=Vo;fi.formToJSON=t=>x7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=P7e.getAdapter;fi.HttpStatusCode=Dkt;fi.default=fi;k7e.exports=fi});var hx=_(fx=>{"use strict";Object.defineProperty(fx,"__esModule",{value:true});fx.CredentialsMethod=void 0;var $7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})($7e||(fx.CredentialsMethod=$7e={}))});var km=_(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 gx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(gx,"getRequestMetadataFromPath");var L7e="fga-request-id";function IK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(IK,"getResponseHeaders");var Dm=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}=gx((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=IK(e);this.requestId=g[L7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=Dm;var AK=class extends Dm{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}=gx((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=AK;var xK=class extends Dm{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=xK;var CK=class extends Dm{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}=gx((s=e.request)===null||s===void 0?void 0:s.path);const u=IK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=CK;var RK=class extends Dm{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=gx((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=RK;var OK=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=IK(e);this.requestId=f[L7e];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=OK;var mx=class extends Uy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=mx;var NK=class extends mx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=NK});var ob=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var kkt=km();var $kt=o(function(t,e,r){if(r===null||r===void 0){throw new kkt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=$kt;var Lkt=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");mf.isWellFormedUriString=Lkt;var qkt=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");mf.isWellFormedUlidString=qkt});var DK=_(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:true});Fy.Configuration=Fy.GetDefaultRetryParams=void 0;var ub=hx();var PK=km();var yx=ob();var jkt=15;var Ukt=100;var Fkt="openfga-sdk js/0.3.0";function Mkt(t=jkt,e=Ukt){return{maxRetry:t,minWaitInMs:e}}o(Mkt,"GetDefaultRetryParams");Fy.GetDefaultRetryParams=Mkt;var vx=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 ub.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case ub.CredentialsMethod.ClientCredentials:this.credentials={method:ub.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case ub.CredentialsMethod.None:default:this.credentials={method:ub.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"]=Fkt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,yx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,yx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,yx.isWellFormedUriString)(this.getBasePath())){throw new PK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,yx.isWellFormedUlidString)(this.storeId)){throw new PK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new PK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};Fy.Configuration=vx;vx.sdkVersion="0.3.0"});var q7e=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:true});_x.assertNever=void 0;function Bkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Bkt,"assertNever");_x.assertNever=Bkt});var j7e=_(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:true});Ex.chunkArray=void 0;function Vkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Vkt,"chunkArray");Ex.chunkArray=Vkt});var F7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var bx=require("crypto");function U7e(){if(typeof bx.randomUUID==="function"){return(0,bx.randomUUID)()}if(typeof bx.randomBytes==="function"){return(0,bx.randomBytes)(20).toString("hex")}return}o(U7e,"generateRandomId");My.generateRandomId=U7e;function Hkt(){return U7e()||"00000000-0000-0000-0000-000000000000"}o(Hkt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Hkt});var M7e=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.setHeaderIfNotSet=void 0;function zkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(zkt,"setHeaderIfNotSet");wx.setHeaderIfNotSet=zkt});var B7e=_(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:true});Sx.setNotEnumerableProperty=void 0;function Gkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(Gkt,"setNotEnumerableProperty");Sx.setNotEnumerableProperty=Gkt});var kK=_(ku=>{"use strict";var Kkt=ku&&ku.__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 lb=ku&&ku.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Kkt(e,t,r)};Object.defineProperty(ku,"__esModule",{value:true});lb(q7e(),ku);lb(j7e(),ku);lb(F7e(),ku);lb(M7e(),ku);lb(B7e(),ku)});var LK=_(yi=>{"use strict";var $K=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 Ykt=Tx();var $m=km();var Wkt=kK();yi.DUMMY_BASE_URL="https://example.com";var Jkt=o(function(t,e){return $K(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=Jkt;var Qkt=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=Qkt;var Xkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Zkt=o(function(t,e){const r=typeof t!=="string";const n=r?Xkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Zkt;var e$t=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=e$t;function t$t(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(t$t,"isAxiosError");function r$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(r$t,"randomTime");function V7e(t,e,r){var n;return $K(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!t$t(s)){throw new $m.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 $m.FgaApiValidationError(s)}else if(a===401||a===403){throw new $m.FgaApiAuthenticationError(s)}else if(a===404){throw new $m.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new $m.FgaApiRateLimitExceededError(s)}else{throw new $m.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,r$t(i,e.minWaitInMs)))}else{throw new $m.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(V7e,"attemptHttpRequest");yi.attemptHttpRequest=V7e;var n$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=Ykt.Credentials.init(r)}return(c=e)=>$K(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 V7e(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,Wkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=n$t});var z7e=_(By=>{"use strict";var qK=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 H7e=px();var gf=ob();var jK=km();var i$t=LK();var Ho=hx();var UK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=H7e.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 Ho.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 Ho.CredentialsMethod.ClientCredentials:case Ho.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 Ho.CredentialsMethod.None:break;case Ho.CredentialsMethod.ApiToken:(0,gf.assertParamExists)("Credentials","config.token",(e=d.config)===null||e===void 0?void 0:e.token);(0,gf.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName);(0,gf.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case Ho.CredentialsMethod.ClientCredentials:(0,gf.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId);(0,gf.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret);(0,gf.assertParamExists)("Credentials","config.apiTokenIssuer",(a=d.config)===null||a===void 0?void 0:a.apiTokenIssuer);(0,gf.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience);if(!(0,gf.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`)){throw new jK.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 qK(this,void 0,void 0,function*(){const r=yield this.getAccessTokenValue();switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case Ho.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var e;return qK(this,void 0,void 0,function*(){switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return this.authConfig.config.token;case Ho.CredentialsMethod.ClientCredentials:if(this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)){return this.accessToken}return this.refreshAccessToken()}})}refreshAccessToken(){var e;return qK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,i$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},H7e.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 jK.FgaApiError){n.constructor=jK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};By.Credentials=UK});var Tx=_(yf=>{"use strict";var s$t=yf&&yf.__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 G7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))s$t(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});G7e(z7e(),yf);G7e(hx(),yf)});var MK=_(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:true});Ax.BaseAPI=void 0;var a$t=px();var o$t=require("http");var u$t=require("https");var K7e=DK();var l$t=Tx();var c$t=1e4;var FK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof K7e.Configuration){this.configuration=e}else{this.configuration=new K7e.Configuration(e)}this.configuration.isValid();this.credentials=l$t.Credentials.init(this.configuration);if(!this.axios){const i=new o$t.Agent({keepAlive:true});const s=new u$t.Agent({keepAlive:true});this.axios=a$t.default.create({httpAgent:i,httpsAgent:s,timeout:c$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}};Ax.BaseAPI=FK});var VK=_(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=px();var d$t=MK();var We=LK();var Vn=ob();var p$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=p$t;var f$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=f$t;var h$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=h$t;var BK=class extends d$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=BK});var W7e=_((qmr,Y7e)=>{async function*m$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(m$t,"asyncPool");Y7e.exports=m$t});var J7e=_(Hl=>{"use strict";var Hn=Hl&&Hl.__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 HK=Hl&&Hl.__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(Hl,"__esModule",{value:true});Hl.OpenFgaClient=Hl.ClientWriteStatus=void 0;var zK=W7e();var g$t=VK();var y$t=MK();var GK=km();var Aa=kK();var v$t=ob();var KK=10;var Vy="X-OpenFGA-Client-Method";var YK="X-OpenFGA-Client-Bulk-Request-Id";var Hy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(Hy||(Hl.ClientWriteStatus=Hy={}));var WK=class extends y$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new g$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,v$t.isWellFormedUlidString)(r)){throw new GK.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 GK.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=KK}=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,YK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=HK(zK(a,(0,Aa.chunkArray)(u,s),F=>this.writeTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V})),deletes:[]})))),S;S=yield b.next(),d=S.done,!d;E=true){h=S.value;E=false;const F=h;w.push(F.writes)}}catch(F){p={error:F}}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,P=HK(zK(a,(0,Aa.chunkArray)(l,s),F=>this.deleteTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:[],deletes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V}))})))),D;D=yield P.next(),m=D.done,!m;A=true){v=D.value;A=false;const F=v;T.push(F.deletes)}}catch(F){g={error:F}}finally{try{if(!A&&!m&&(y=P.return))yield y.call(P)}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=KK}=r;(0,Aa.setHeaderIfNotSet)(u,Vy,"BatchCheck");(0,Aa.setHeaderIfNotSet)(u,YK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=HK(zK(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=KK}=r;(0,Aa.setHeaderIfNotSet)(l,Vy,"ListRelations");(0,Aa.setHeaderIfNotSet)(l,YK,(0,Aa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new GK.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)})}};Hl.OpenFgaClient=WK});var nAe=_(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:true});xa.TypeName=xa.TupleOperation=xa.NullValue=xa.NotFoundErrorCode=xa.InternalErrorCode=xa.ErrorCode=void 0;var Q7e;(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"})(Q7e||(xa.ErrorCode=Q7e={}));var X7e;(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"})(X7e||(xa.InternalErrorCode=X7e={}));var Z7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(Z7e||(xa.NotFoundErrorCode=Z7e={}));var eAe;(function(t){t["NullValue"]="NULL_VALUE"})(eAe||(xa.NullValue=eAe={}));var tAe;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(tAe||(xa.TupleOperation=tAe={}));var rAe;(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"})(rAe||(xa.TypeName=rAe={}))});var aAe=_($i=>{"use strict";var _$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 xx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))_$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;xx(VK(),$i);xx(J7e(),$i);xx(nAe(),$i);var iAe=DK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return iAe.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return iAe.GetDefaultRetryParams}});var sAe=Tx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return sAe.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return sAe.CredentialsMethod}});xx(km(),$i)});var uAe=_(zy=>{"use strict";var E$t=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zy,"__esModule",{value:true});zy.OpenFGAService=void 0;var cb=E$t(Oa());var oAe=aAe();var b$t=Ry();var JK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!cb.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=cb.default.OPENFGA_SERVICE_URL;this.apiHost=cb.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=cb.default.OPENFGA_STORE_ID;this.modelId=cb.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,b$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new oAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:oAe.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=JK});var dAe=_(Gy=>{"use strict";var cAe=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.TenantService=void 0;var w$t=cAe(tu());var lAe=cAe(Oa());var S$t=J6();var T$t=new w$t.default({max:500,maxAge:1e3*60*50});var QK=class extends S$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!lAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(lAe.default.TENANT_API_URL,T$t,{userSub:n,logger:e.log,requestId:e.id})}};Gy.TenantService=QK});var hAe=_(Ky=>{"use strict";var fAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.MeteringService=void 0;var A$t=fAe(tu());var pAe=fAe(Oa());var x$t=J6();var C$t=new A$t.default({max:500,maxAge:1e3*60*50});var XK=class extends x$t.ApiServiceClient{static{o(this,"MeteringService")}constructor(e,r){if(!pAe.default.METERING_SERVICE_URL){throw new Error("METERING_SERVICE_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(pAe.default.METERING_SERVICE_URL,C$t,{userSub:n,logger:e.log,requestId:e.id})}};Ky.MeteringService=XK});var mAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function R$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(R$t,"sizeInBytes");zl.sizeInBytes=R$t;function O$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(O$t,"snakeCase");zl.snakeCase=O$t;function N$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(N$t,"kebabCase");zl.kebabCase=N$t;function I$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(I$t,"validateHostname");zl.validateHostname=I$t});var vAe=_(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 ZK;(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})(ZK||(G.TypeRegistry=ZK={}));var $u=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=$u;var gAe;(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})(gAe||(G.FormatRegistry=gAe={}));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 eY=class extends $u{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=eY;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 P(x){return V(x)&&Be.IsString(x.const)}o(P,"TLiteralString");t.TLiteralString=P;function D(x){return V(x)&&Be.IsNumber(x.const)}o(D,"TLiteralNumber");t.TLiteralNumber=D;function F(x){return V(x)&&Be.IsBoolean(x.const)}o(F,"TLiteralBoolean");t.TLiteralBoolean=F;function V(x){return T(x,"Literal")&&u(x.$id)&&(Be.IsBoolean(x.const)||Be.IsNumber(x.const)||Be.IsString(x.const))}o(V,"TLiteral");t.TLiteral=V;function j(x){return T(x,"Never")&&Be.IsObject(x.not)&&Object.getOwnPropertyNames(x.not).length===0}o(j,"TNever");t.TNever=j;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=>P(ie)||D(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 N(x){return T(x,"Uint8Array")&&x.type==="Uint8Array"&&u(x.$id)&&s(x.minByteLength)&&s(x.maxByteLength)}o(N,"TUint8Array");t.TUint8Array=N;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)||V(x)||j(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)||N(x)||q(x)||z(x)||W(x)||A(x)&&ZK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var yAe;(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})(yAe||(G.ExtendsUndefined=yAe={}));var Cx=class extends $u{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Cx;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var Lm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new Cx(U)}o(r,"Throw");function n(U){return Y.TNever(U)||Y.TIntersect(U)||Y.TUnion(U)||Y.TUnknown(U)||Y.TAny(U)}o(n,"IsStructuralRight");function i(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):r("StructuralRight")}o(i,"StructuralRight");function s(U,$){return Ee.True}o(s,"TAnyRight");function a(U,$){return Y.TIntersect($)?w(U,$):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(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)?Ee.True:Ee.False}o(u,"TArrayRight");function l(U,$){return Y.TObject($)&&ge($)?Ee.True:n($)?i(U,$):!Y.TArray($)?Ee.False:e(ft(U.items,$.items))}o(l,"TArray");function c(U,$){return n($)?i(U,$):!Y.TAsyncIterator($)?Ee.False:e(ft(U.items,$.items))}o(c,"TAsyncIterator");function d(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBigInt($)?Ee.True:Ee.False}o(d,"TBigInt");function p(U,$){return Y.TLiteral(U)&&Be.IsBoolean(U.const)?Ee.True:Y.TBoolean(U)?Ee.True:Ee.False}o(p,"TBooleanRight");function f(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBoolean($)?Ee.True:Ee.False}o(f,"TBoolean");function h(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TConstructor($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(h,"TConstructor");function m(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TDate($)?Ee.True:Ee.False}o(m,"TDate");function g(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TFunction($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(g,"TFunction");function y(U,$){return Y.TLiteral(U)&&Be.IsNumber(U.const)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(y,"TIntegerRight");function v(U,$){return Y.TInteger($)||Y.TNumber($)?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Ee.False}o(v,"TInteger");function w(U,$){return $.allOf.every(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(w,"TIntersectRight");function E(U,$){return U.allOf.some(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(E,"TIntersect");function b(U,$){return n($)?i(U,$):!Y.TIterator($)?Ee.False:e(ft(U.items,$.items))}o(b,"TIterator");function S(U,$){return Y.TLiteral($)&&$.const===U.const?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Ee.False}o(S,"TLiteral");function T(U,$){return Ee.False}o(T,"TNeverRight");function A(U,$){return Ee.True}o(A,"TNever");function P(U){let[$,Ye]=[U,0];while(true){if(!Y.TNot($))break;$=$.not;Ye+=1}return Ye%2===0?$:G.Type.Unknown()}o(P,"UnwrapTNot");function D(U,$){return Y.TNot(U)?ft(P(U),$):Y.TNot($)?ft(U,P($)):r("Invalid fallthrough for Not")}o(D,"TNot");function F(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TNull($)?Ee.True:Ee.False}o(F,"TNull");function V(U,$){return Y.TLiteralNumber(U)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(V,"TNumberRight");function j(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TInteger($)||Y.TNumber($)?Ee.True:Ee.False}o(j,"TNumber");function Q(U,$){return Object.getOwnPropertyNames(U.properties).length===$}o(Q,"IsObjectPropertyCount");function oe(U){return ge(U)}o(oe,"IsObjectStringLike");function Te(U){return Q(U,0)||Q(U,1)&&"description"in U.properties&&Y.TUnion(U.properties.description)&&U.properties.description.anyOf.length===2&&(Y.TString(U.properties.description.anyOf[0])&&Y.TUndefined(U.properties.description.anyOf[1])||Y.TString(U.properties.description.anyOf[1])&&Y.TUndefined(U.properties.description.anyOf[0]))}o(Te,"IsObjectSymbolLike");function le(U){return Q(U,0)}o(le,"IsObjectNumberLike");function ue(U){return Q(U,0)}o(ue,"IsObjectBooleanLike");function xe(U){return Q(U,0)}o(xe,"IsObjectBigIntLike");function we(U){return Q(U,0)}o(we,"IsObjectDateLike");function Pe(U){return ge(U)}o(Pe,"IsObjectUint8ArrayLike");function Ue(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(Ue,"IsObjectFunctionLike");function $e(U){return Q(U,0)}o($e,"IsObjectConstructorLike");function ge(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(ge,"IsObjectArrayLike");function Je(U){const $=G.Type.Function([G.Type.Any()],G.Type.Any());return Q(U,0)||Q(U,1)&&"then"in U.properties&&e(ft(U.properties["then"],$))===Ee.True}o(Je,"IsObjectPromiseLike");function Le(U,$){return ft(U,$)===Ee.False?Ee.False:Y.TOptional(U)&&!Y.TOptional($)?Ee.False:Ee.True}o(Le,"Property");function Ie(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)||Y.TLiteralString(U)&&oe($)||Y.TLiteralNumber(U)&&le($)||Y.TLiteralBoolean(U)&&ue($)||Y.TSymbol(U)&&Te($)||Y.TBigInt(U)&&xe($)||Y.TString(U)&&oe($)||Y.TSymbol(U)&&Te($)||Y.TNumber(U)&&le($)||Y.TInteger(U)&&le($)||Y.TBoolean(U)&&ue($)||Y.TUint8Array(U)&&Pe($)||Y.TDate(U)&&we($)||Y.TConstructor(U)&&$e($)||Y.TFunction(U)&&Ue($)?Ee.True:Y.TRecord(U)&&Y.TString(C(U))?(()=>{return $[G.Hint]==="Record"?Ee.True:Ee.False})():Y.TRecord(U)&&Y.TNumber(C(U))?(()=>{return Q($,0)?Ee.True:Ee.False})():Ee.False}o(Ie,"TObjectRight");function Qe(U,$){return n($)?i(U,$):Y.TRecord($)?q(U,$):!Y.TObject($)?Ee.False:(()=>{for(const Ye of Object.getOwnPropertyNames($.properties)){if(!(Ye in U.properties))return Ee.False;if(Le(U.properties[Ye],$.properties[Ye])===Ee.False){return Ee.False}}return Ee.True})()}o(Qe,"TObject");function qe(U,$){return n($)?i(U,$):Y.TObject($)&&Je($)?Ee.True:!Y.TPromise($)?Ee.False:e(ft(U.item,$.item))}o(qe,"TPromise");function C(U){return G.PatternNumberExact in U.patternProperties?G.Type.Number():G.PatternStringExact in U.patternProperties?G.Type.String():r("Unknown record key pattern")}o(C,"RecordKey");function N(U){return G.PatternNumberExact in U.patternProperties?U.patternProperties[G.PatternNumberExact]:G.PatternStringExact in U.patternProperties?U.patternProperties[G.PatternStringExact]:r("Unable to get record value schema")}o(N,"RecordValue");function q(U,$){const[Ye,cr]=[C($),N($)];return Y.TLiteralString(U)&&Y.TNumber(Ye)&&e(ft(U,cr))===Ee.True?Ee.True:Y.TUint8Array(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TString(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TArray(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TObject(U)?(()=>{for(const vi of Object.getOwnPropertyNames(U.properties)){if(Le(cr,U.properties[vi])===Ee.False){return Ee.False}}return Ee.True})():Ee.False}o(q,"TRecordRight");function z(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TRecord($)?Ee.False:ft(N(U),N($))}o(z,"TRecord");function W(U,$){return Y.TLiteral(U)&&Be.IsString(U.const)?Ee.True:Y.TString(U)?Ee.True:Ee.False}o(W,"TStringRight");function K(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?Ee.True:Ee.False}o(K,"TString");function se(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TSymbol($)?Ee.True:Ee.False}o(se,"TSymbol");function J(U,$){return Y.TTemplateLiteral(U)?ft(rd.Resolve(U),$):Y.TTemplateLiteral($)?ft(U,rd.Resolve($)):r("Invalid fallthrough for TemplateLiteral")}o(J,"TTemplateLiteral");function x(U,$){return Y.TArray($)&&U.items!==void 0&&U.items.every(Ye=>ft(Ye,$.items)===Ee.True)}o(x,"IsArrayOfTuple");function ie(U,$){return Y.TNever(U)?Ee.True:Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Ee.False}o(ie,"TTupleRight");function ce(U,$){return n($)?i(U,$):Y.TObject($)&&ge($)?Ee.True:Y.TArray($)&&x(U,$)?Ee.True:!Y.TTuple($)?Ee.False:Be.IsUndefined(U.items)&&!Be.IsUndefined($.items)||!Be.IsUndefined(U.items)&&Be.IsUndefined($.items)?Ee.False:Be.IsUndefined(U.items)&&!Be.IsUndefined($.items)?Ee.True:U.items.every((Ye,cr)=>ft(Ye,$.items[cr])===Ee.True)?Ee.True:Ee.False}o(ce,"TTuple");function ve(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TUint8Array($)?Ee.True:Ee.False}o(ve,"TUint8Array");function je(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TVoid($)?Et(U,$):Y.TUndefined($)?Ee.True:Ee.False}o(je,"TUndefined");function Xe(U,$){return $.anyOf.some(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(Xe,"TUnionRight");function _t(U,$){return U.anyOf.every(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(_t,"TUnion");function tr(U,$){return Ee.True}o(tr,"TUnknownRight");function lr(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TAny($)?s(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Y.TArray($)?u(U,$):Y.TTuple($)?ie(U,$):Y.TObject($)?Ie(U,$):Y.TUnknown($)?Ee.True:Ee.False}o(lr,"TUnknown");function Et(U,$){return Y.TUndefined(U)?Ee.True:Y.TUndefined(U)?Ee.True:Ee.False}o(Et,"VoidRight");function xt(U,$){return Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):Y.TObject($)?Ie(U,$):Y.TVoid($)?Ee.True:Ee.False}o(xt,"TVoid");function ft(U,$){return Y.TTemplateLiteral(U)||Y.TTemplateLiteral($)?J(U,$):Y.TNot(U)||Y.TNot($)?D(U,$):Y.TAny(U)?a(U,$):Y.TArray(U)?l(U,$):Y.TBigInt(U)?d(U,$):Y.TBoolean(U)?f(U,$):Y.TAsyncIterator(U)?c(U,$):Y.TConstructor(U)?h(U,$):Y.TDate(U)?m(U,$):Y.TFunction(U)?g(U,$):Y.TInteger(U)?v(U,$):Y.TIntersect(U)?E(U,$):Y.TIterator(U)?b(U,$):Y.TLiteral(U)?S(U,$):Y.TNever(U)?A(U,$):Y.TNull(U)?F(U,$):Y.TNumber(U)?j(U,$):Y.TObject(U)?Qe(U,$):Y.TRecord(U)?z(U,$):Y.TString(U)?K(U,$):Y.TSymbol(U)?se(U,$):Y.TTuple(U)?ce(U,$):Y.TPromise(U)?qe(U,$):Y.TUint8Array(U)?ve(U,$):Y.TUndefined(U)?je(U,$):Y.TUnion(U)?_t(U,$):Y.TUnknown(U)?lr(U,$):Y.TVoid(U)?xt(U,$):r(`Unknown left type operand '${U[G.Kind]}'`)}o(ft,"Visit");function en(U,$){return ft(U,$)}o(en,"Extends");t.Extends=en})(Lm||(G.TypeExtends=Lm={}));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 tY;(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})(tY||(G.IndexedAccessor=tY={}));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 Rx;(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})(Rx||(G.KeyResolver=Rx={}));var Ox=class extends $u{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Ox;var db;(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 Ox("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(db||(G.KeyArrayResolver=db={}));var rY;(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})(rY||(G.UnionResolver=rY={}));var Nx=class extends $u{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Nx;var Ix;(function(t){function e(s){throw new Nx(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})(Ix||(G.TemplateLiteralPattern=Ix={}));var rd;(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})(rd||(G.TemplateLiteralResolver=rd={}));var pb=class extends $u{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=pb;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 pb(`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 pb(`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 Px=class extends $u{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Px;var Qy;(function(t){function e(a){throw new Px(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 Dx=class extends $u{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Dx;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 Dx("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var nY;(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})(nY||(G.TemplateLiteralDslParser=nY={}));var kx=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new $x(this.schema,e)}};G.TransformDecodeBuilder=kx;var $x=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=$x;var P$t=0;var Lx=class extends $u{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=Lx;var qx=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new Lx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=qx;var fb=class extends qx{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=Rx.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(Lm.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(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.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=db.Resolve(r);const s=ct.Type(e);return tY.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=Rx.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=db.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=db.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=rY.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${P$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)?Ix.Create(nY.Parse(e)):Ix.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new kx(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)?rd.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=fb;var jx=class extends fb{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=jx;G.JsonType=new fb;G.Type=new jx});var _Ae=_(Ux=>{"use strict";Object.defineProperty(Ux,"__esModule",{value:true});Ux.CustomTypeBuilder=void 0;var hb=vAe();var iY=class extends hb.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return hb.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return hb.Type.Union([e,hb.Type.Null()])}static StringEnum(e){return hb.Type.Unsafe({type:"string",enum:e})}};Ux.CustomTypeBuilder=iY});var SAe=_(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 Fx(t){return typeof t==="string"}o(Fx,"isString");lt.isString=Fx;function D$t(t){return Array.isArray(t)&&t.every(e=>Fx(e))}o(D$t,"isStringArray");lt.isStringArray=D$t;function EAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(EAe,"isObject");lt.isObject=EAe;function k$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(k$t,"isTypedArray");lt.isTypedArray=k$t;function bAe(t){return typeof t==="number"&&!isNaN(t)}o(bAe,"isNumber");lt.isNumber=bAe;function $$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o($$t,"isIterable");lt.isIterable=$$t;function L$t(t){return t===true||t===false}o(L$t,"isBoolean");lt.isBoolean=L$t;function sY(t){return typeof t==="undefined"}o(sY,"isUndefined");lt.isUndefined=sY;function q$t(t){return!Zy(t)}o(q$t,"isDefined");lt.isDefined=q$t;function Zy(t){return sY(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function j$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(j$t,"assertType");lt.assertType=j$t;function U$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(U$t,"assertIsDefined");lt.assertIsDefined=U$t;function F$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(F$t,"assertAllDefined");lt.assertAllDefined=F$t;var M$t=Object.prototype.hasOwnProperty;function B$t(t){if(!EAe(t)){return false}for(const e in t){if(M$t.call(t,e)){return false}}return true}o(B$t,"isEmptyObject");lt.isEmptyObject=B$t;function aY(t){return typeof t==="function"}o(aY,"isFunction");lt.isFunction=aY;function V$t(...t){return t.length>0&&t.every(aY)}o(V$t,"areFunctions");lt.areFunctions=V$t;function H$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){wAe(t[n],e[n])}}o(H$t,"validateConstraints");lt.validateConstraints=H$t;function wAe(t,e){if(Fx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(aY(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(wAe,"validateConstraint");lt.validateConstraint=wAe;function z$t(t){return t===null?void 0:t}o(z$t,"withNullAsUndefined");lt.withNullAsUndefined=z$t;function G$t(t){return typeof t==="undefined"?null:t}o(G$t,"withUndefinedAsNull");lt.withUndefinedAsNull=G$t;var mb=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=mb;var gb=class extends mb{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=gb;var yb=class extends mb{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=yb;function K$t(t,e){if(sY(t)){throw new gb(e)}return true}o(K$t,"throwIfUndefined");lt.throwIfUndefined=K$t;function oY(t,e){if(Zy(t)){throw new gb(e)}}o(oY,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=oY;function Y$t(t,e){oY(t,e);if(!Fx(t)){throw new yb(e,"string")}return true}o(Y$t,"throwIfNotString");lt.throwIfNotString=Y$t;function W$t(t,e){oY(t,e);if(!bAe(t)){throw new yb(e,"number")}return true}o(W$t,"throwIfNotNumber");lt.throwIfNotNumber=W$t});var _b=_(Ae=>{"use strict";var TAe=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 J$t=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Mx=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))TAe(e,t,r)}J$t(e,t);return e};var vf=Ae&&Ae.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))TAe(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 uY=Mx(Oa());Ae.env=uY.default;Object.defineProperty(Ae,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return uY.EnvironmentalVariableRequiredError}});Object.defineProperty(Ae,"getRequiredEnvVar",{enumerable:true,get:function(){return uY.getRequiredEnvVar}});vf(As(),Ae);var Q$t=rC();Object.defineProperty(Ae,"CommonAuth",{enumerable:true,get:function(){return Q$t.CommonAuth}});var lY=UY();Object.defineProperty(Ae,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return lY.getBuildFlagsForDeployment}});Object.defineProperty(Ae,"getDefaultFlags",{enumerable:true,get:function(){return lY.getDefaultFlags}});Object.defineProperty(Ae,"hasBlockedNotifications",{enumerable:true,get:function(){return lY.hasBlockedNotifications}});var e2=FY();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 X$t=MY();Object.defineProperty(Ae,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return X$t.COMPATIBILITY_FLAG_MAPPINGS}});var AAe=HY();Object.defineProperty(Ae,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return AAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(Ae,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return AAe.VALID_COMPATIBILITY_DATES}});var Z$t=nC();Object.defineProperty(Ae,"FeatureFlags",{enumerable:true,get:function(){return Z$t.FeatureFlags}});var eLt=zY();Object.defineProperty(Ae,"signString",{enumerable:true,get:function(){return eLt.signString}});vf(GY(),Ae);var tLt=aC();Object.defineProperty(Ae,"DeploymentLogState",{enumerable:true,get:function(){return tLt.DeploymentLogState}});vf(eW(),Ae);vf(oC(),Ae);var rLt=uC();Object.defineProperty(Ae,"errorHandler",{enumerable:true,get:function(){return rLt.errorHandler}});var vb=fC();Object.defineProperty(Ae,"apiKeyAuthPlugin",{enumerable:true,get:function(){return vb.apiKeyAuthPlugin}});Object.defineProperty(Ae,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return vb.ensureServiceAccountPlugin}});Object.defineProperty(Ae,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return vb.ensureZuploAdminPlugin}});Object.defineProperty(Ae,"ensureZuploUserPlugin",{enumerable:true,get:function(){return vb.ensureZuploUserPlugin}});Object.defineProperty(Ae,"featureFlagsPlugin",{enumerable:true,get:function(){return vb.featureFlagsPlugin}});var nLt=dge();Object.defineProperty(Ae,"ApiServer",{enumerable:true,get:function(){return nLt.ApiServer}});Ae.fly=Mx(hge());Ae.CloudStorage=Mx(rbe());var iLt=nbe();Object.defineProperty(Ae,"graphQL",{enumerable:true,get:function(){return iLt.graphQL}});vf(C5e(),Ae);var xAe=bj();Object.defineProperty(Ae,"createNewLogger",{enumerable:true,get:function(){return xAe.createNewLogger}});Object.defineProperty(Ae,"logger",{enumerable:true,get:function(){return xAe.logger}});var sLt=dH();Object.defineProperty(Ae,"startsWithReservedKeyword",{enumerable:true,get:function(){return sLt.startsWithReservedKeyword}});var aLt=R5e();Object.defineProperty(Ae,"RouteVersions",{enumerable:true,get:function(){return aLt.RouteVersions}});var CAe=XSe();Object.defineProperty(Ae,"ApiKeyService",{enumerable:true,get:function(){return CAe.ApiKeyService}});Object.defineProperty(Ae,"createApiKeyServiceClient",{enumerable:true,get:function(){return CAe.createApiKeyServiceClient}});var oLt=Ry();Object.defineProperty(Ae,"getServiceAccountIdToken",{enumerable:true,get:function(){return oLt.getServiceAccountIdToken}});var uLt=eTe();Object.defineProperty(Ae,"AuthApiService",{enumerable:true,get:function(){return uLt.AuthApiService}});var cY=iTe();Object.defineProperty(Ae,"ContentApiService",{enumerable:true,get:function(){return cY.ContentApiService}});Object.defineProperty(Ae,"contentApiTarballFileName",{enumerable:true,get:function(){return cY.contentApiTarballFileName}});Object.defineProperty(Ae,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return cY.getContentApiStorageTarballPath}});var lLt=oTe();Object.defineProperty(Ae,"DevApiService",{enumerable:true,get:function(){return lLt.DevApiService}});var cLt=uAe();Object.defineProperty(Ae,"OpenFGAService",{enumerable:true,get:function(){return cLt.OpenFGAService}});var dLt=dAe();Object.defineProperty(Ae,"TenantService",{enumerable:true,get:function(){return dLt.TenantService}});var pLt=hAe();Object.defineProperty(Ae,"MeteringService",{enumerable:true,get:function(){return pLt.MeteringService}});vf(mAe(),Ae);vf(_Ae(),Ae);vf(SAe(),Ae);var fLt=P7();Object.defineProperty(Ae,"JsonValidator",{enumerable:true,get:function(){return fLt.JsonValidator}});var hLt=yH();Object.defineProperty(Ae,"RouteValidator",{enumerable:true,get:function(){return hLt.RouteValidator}});Ae.xfs=Mx(mB())});var Eb=_(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:true});t2.runPlugins=t2.PluginResult=void 0;var dY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};t2.PluginResult=dY;async function mLt(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(mLt,"runPlugins");t2.runPlugins=mLt});var OAe=_((a0r,RAe)=>{"use strict";function gLt(t){return t>=55296&&t<=56319}o(gLt,"isHighSurrogate");function yLt(t){return t>=56320&&t<=57343}o(yLt,"isLowSurrogate");RAe.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(gLt(a)&&yLt(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 IAe=_((u0r,NAe)=>{"use strict";var vLt=OAe();var _Lt=Buffer.byteLength.bind(Buffer);NAe.exports=vLt.bind(null,_Lt)});var PAe=_(r2=>{"use strict";var ELt=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.sanitize=void 0;var bLt=ELt(IAe());var wLt=/[/?<>\\:*|"]/g;var SLt=/[\x00-\x1f\x80-\x9f]/g;var TLt=/^\.+$/;var ALt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var xLt=/[. ]+$/;function CLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(wLt,e).replace(SLt,e).replace(TLt,e).replace(ALt,e).replace(xLt,e);return(0,bLt.default)(r,255)}o(CLt,"sanitize");r2.sanitize=CLt});var Gl=_(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 LAe=_(n2=>{"use strict";var $Ae=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.createProjectDirs=void 0;var DAe=$Ae(require("fs/promises"));var RLt=$Ae(require("path"));var bb=Gl();var kAe=Eb();var OLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[bb.USER_MODULES_DIR_NAME,bb.USER_CONFIG_DIR_NAME,bb.USER_TEST_DIR_NAME,bb.USER_SCHEMAS_DIR_NAME,bb.USER_DOCS_DIR_NAME,".vscode"];try{await DAe.default.mkdir(t);for(const n of r){await DAe.default.mkdir(RLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new kAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new kAe.PluginResult},"createProjectDirs");n2.createProjectDirs=OLt});var qAe=_(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:true});var Bx=require("perf_hooks");var pY=[];async function NLt(t,e){const r=Bx.performance.timerify(e);const n=new Bx.PerformanceObserver(i=>{const s=i.getEntries()[0];pY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(NLt,"timeFn");var ILt={mark:t=>{Bx.performance.mark(t)},measure:(t,e,r)=>{Bx.performance.measure(t,e,r)},timeFn:NLt,report:()=>{if(pY.length>0){console.table(pY)}}};fY.default=ILt});var MAe=_(i2=>{"use strict";var FAe=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFromTemplate=void 0;var PLt=require("fs");var jAe=FAe(require("fs/promises"));var UAe=FAe(require("path"));async function DLt(t){const e=UAe.default.resolve(__dirname,"..","templates",t);if((0,PLt.existsSync)(e)){const r=await jAe.default.readFile(e,"utf-8");return r}else{const r=UAe.default.resolve(__dirname,"templates",t);const n=await jAe.default.readFile(r,"utf-8");return n}}o(DLt,"generateFromTemplate");i2.generateFromTemplate=DLt});var Ca=_(s2=>{"use strict";var hY=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateFileFromTemplate=void 0;var kLt=_b();var $Lt=hY(require("fs/promises"));var LLt=hY(require("path"));var qLt=hY(qAe());var jLt=MAe();var ULt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return qLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=LLt.default.join(r,t);if(await kLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return FLt(i,e,n)})}},"generateFileFromTemplate");s2.generateFileFromTemplate=ULt;async function FLt(t,e,r){const n=await(0,jLt.generateFromTemplate)(e);try{await $Lt.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(FLt,"writeTemplate")});var VAe=_(a2=>{"use strict";var MLt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsMarkdown=void 0;var BLt=MLt(require("path"));var BAe=Gl();var VLt=Ca();a2.generateDefaultDocsMarkdown=(0,VLt.generateFileFromTemplate)(BLt.default.join(BAe.USER_DOCS_DIR_NAME,BAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var zAe=_(o2=>{"use strict";var HLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsSidebar=void 0;var zLt=HLt(require("path"));var HAe=Gl();var GLt=Ca();o2.generateDefaultDocsSidebar=(0,GLt.generateFileFromTemplate)(zLt.default.join(HAe.USER_DOCS_DIR_NAME,HAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var KAe=_(u2=>{"use strict";var KLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultDocsTheme=void 0;var YLt=KLt(require("path"));var GAe=Gl();var WLt=Ca();u2.generateDefaultDocsTheme=(0,WLt.generateFileFromTemplate)(YLt.default.join(GAe.USER_DOCS_DIR_NAME,GAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var WAe=_(l2=>{"use strict";var JLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDefaultModule=void 0;var QLt=JLt(require("path"));var YAe=Gl();var XLt=Ca();l2.generateDefaultModule=(0,XLt.generateFileFromTemplate)(QLt.default.join(YAe.USER_MODULES_DIR_NAME,YAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var QAe=_(c2=>{"use strict";var ZLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateDevPortalConfigJson=void 0;var eqt=ZLt(require("path"));var JAe=Gl();var tqt=Ca();c2.generateDevPortalConfigJson=(0,tqt.generateFileFromTemplate)(eqt.default.join(JAe.USER_CONFIG_DIR_NAME,JAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var XAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generateEnvironment=void 0;var rqt=Ca();Vx.generateEnvironment=(0,rqt.generateFileFromTemplate)(".env","env.template")});var ZAe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generateESLint=void 0;var nqt=Ca();Hx.generateESLint=(0,nqt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var exe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generateGitignore=void 0;var iqt=Ca();zx.generateGitignore=(0,iqt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var txe=_(d2=>{"use strict";var sqt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateLaunchJson=void 0;var aqt=sqt(require("path"));var oqt=Ca();d2.generateLaunchJson=(0,oqt.generateFileFromTemplate)(aqt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var rxe=_(p2=>{"use strict";var uqt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateSettingsJson=void 0;var lqt=uqt(require("path"));var cqt=Ca();p2.generateSettingsJson=(0,cqt.generateFileFromTemplate)(lqt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var ixe=_(f2=>{"use strict";var dqt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generateRouteOasConfig=void 0;var pqt=dqt(require("path"));var nxe=Gl();var fqt=Ca();f2.generateRouteOasConfig=(0,fqt.generateFileFromTemplate)(pqt.default.join(nxe.USER_CONFIG_DIR_NAME,nxe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var uxe=_(zo=>{"use strict";var sxe=zo&&zo.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zo,"__esModule",{value:true});zo.updateProjectPackageJson=zo.getProjectPackageJson=zo.getPackageOverrides=zo.generateDefaultPackageJson=void 0;var hqt=_b();var axe=sxe(require("fs/promises"));var mY=sxe(require("path"));async function mqt(t,e=hqt.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=oxe();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(mqt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=mqt;function oxe(){const t=mY.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(oxe,"getPackageOverrides");zo.getPackageOverrides=oxe;async function gqt(t){const e=mY.default.join(t,"package.json");const r=await axe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(gqt,"getProjectPackageJson");zo.getProjectPackageJson=gqt;async function yqt(t,e){const r=mY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await axe.default.writeFile(r,n,"utf-8")}o(yqt,"updateProjectPackageJson");zo.updateProjectPackageJson=yqt});var dxe=_(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:true});Gx.generatePackageJson=void 0;var lxe=uxe();var cxe=Eb();var vqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,lxe.generateDefaultPackageJson)(e);try{await(0,lxe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new cxe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new cxe.PluginResult},"generatePackageJson");Gx.generatePackageJson=vqt});var fxe=_(h2=>{"use strict";var _qt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generatePoliciesConfig=void 0;var Eqt=_qt(require("path"));var pxe=Gl();var bqt=Ca();h2.generatePoliciesConfig=(0,bqt.generateFileFromTemplate)(Eqt.default.join(pxe.USER_CONFIG_DIR_NAME,pxe.POLICIES_CONFIG_FILE),"policies.template.json")});var hxe=_(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:true});Kx.generateTSConfig=void 0;var wqt=Ca();Kx.generateTSConfig=(0,wqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var gxe=_(m2=>{"use strict";var Sqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.generateZuploJson=void 0;var Tqt=_b();var Aqt=require("fs/promises");var xqt=Sqt(require("path"));var Cqt=Gl();var mxe=Eb();var Rqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:Tqt.DEFAULT_COMPATIBILITY_DATE};const i=xqt.default.join(e,Cqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,Aqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new mxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new mxe.PluginResult},"generateZuploJson");m2.generateZuploJson=Rqt});var vxe=_(g2=>{"use strict";var Oqt=g2&&g2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(g2,"__esModule",{value:true});g2.create=void 0;var gY=_b();var Nqt=require("fs/promises");var Iqt=Oqt(require("path"));var Pqt=Eb();var yxe=PAe();var Dqt=LAe();var kqt=VAe();var $qt=zAe();var Lqt=KAe();var qqt=WAe();var jqt=QAe();var Uqt=XAe();var Fqt=ZAe();var Mqt=exe();var Bqt=txe();var Vqt=rxe();var Hqt=ixe();var zqt=dxe();var Gqt=fxe();var Kqt=hxe();var Yqt=gxe();async function Wqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,yxe.sanitize)(t);const s=(0,yxe.sanitize)(e);const a=Iqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await gY.xfs.dirExists(a)){throw new gY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:gY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[Dqt.createProjectDirs,Hqt.generateRouteOasConfig,Yqt.generateZuploJson,jqt.generateDevPortalConfigJson,qqt.generateDefaultModule,$qt.generateDefaultDocsSidebar,kqt.generateDefaultDocsMarkdown,Lqt.generateDefaultDocsTheme,Gqt.generatePoliciesConfig]);l.push(...[Kqt.generateTSConfig,Mqt.generateGitignore,zqt.generatePackageJson,Uqt.generateEnvironment,Fqt.generateESLint,Bqt.generateLaunchJson,Vqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,Pqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,Nqt.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(Wqt,"create");g2.create=Wqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Jqt=vxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Jqt.create}});
410
+ `+await t.crypto.sha256DigestHex(h);const y=await INt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await z6(t.crypto,y,g);const w=`${NSe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,ISe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(PNt,"generateAuthenticationHeaderMap")});var pG=_(FA=>{"use strict";Object.defineProperty(FA,"__esModule",{value:true});FA.AwsClient=void 0;var DNt=PSe();var kNt=lf();var G6=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}};FA.AwsClient=G6;G6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";G6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var yG=_(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 MA="urn:ietf:params:oauth:token-type:saml2";var fG="urn:ietf:params:oauth:token-type:id_token";var hG="urn:ietf:params:oauth:token-type:jwt";var mG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new BA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new VA("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!==MA&&this.tokenType!==fG&&this.tokenType!==hG){throw new HA(`Executable response must contain a 'token_type' field when successful and it must be one of ${fG}, ${hG}, or ${MA}.`)}if(this.tokenType===MA){if(!e.saml_response){throw new K6(`Executable response must contain a 'saml_response' field when token_type=${MA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new K6(`Executable response must contain a 'id_token' field when token_type=${fG} or ${hG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new zA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new GA("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=mG;var Ml=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Ml;var BA=class extends Ml{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=BA;var VA=class extends Ml{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=VA;var gG=class extends Ml{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=gG;var HA=class extends Ml{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=HA;var zA=class extends Ml{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=zA;var GA=class extends Ml{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=GA;var K6=class extends Ml{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=K6});var DSe=_(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:true});KA.PluggableAuthHandler=void 0;var $Nt=YA();var Om=yG();var LNt=require("child_process");var vG=require("fs");var _G=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 Om.ExecutableResponse(l);return r(c)}catch(l){if(l instanceof Om.ExecutableResponseError){return n(l)}return n(new Om.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 vG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await vG.promises.lstat(e)).isFile()){return void 0}const r=await vG.promises.readFile(e,{encoding:"utf8"});if(r===""){return void 0}try{const n=JSON.parse(r);const i=new Om.ExecutableResponse(n);if(i.isValid()){return new Om.ExecutableResponse(n)}return void 0}catch(n){if(n instanceof Om.ExecutableResponseError){throw n}throw new Om.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}};KA.PluggableAuthHandler=_G});var YA=_(Sy=>{"use strict";Object.defineProperty(Sy,"__esModule",{value:true});Sy.PluggableAuthClient=Sy.ExecutableError=void 0;var qNt=lf();var jNt=yG();var UNt=DSe();var WA=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=WA;var FNt=30*1e3;var kSe=5*1e3;var $Se=120*1e3;var MNt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var LSe=1;var EG=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<kSe||this.timeoutMillis>$Se){throw new Error(`Timeout must be between ${kSe} and ${$Se} 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>LSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${LSe}.`)}if(!e.success){throw new WA(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=EG});var wG=_(JA=>{"use strict";Object.defineProperty(JA,"__esModule",{value:true});JA.ExternalAccountClient=void 0;var BNt=lf();var VNt=cG();var HNt=pG();var zNt=YA();var bG=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}}};JA.ExternalAccountClient=bG});var jSe=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.ExternalAccountAuthorizedUserClient=Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var GNt=ny();var qSe=Zz();var KNt=Wc();var YNt=require("stream");var WNt=lf();Ty.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var SG=class extends qSe.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,qSe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var TG=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 SG(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=TG});var MSe=_(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:true});xy.GoogleAuth=xy.CLOUD_SDK_CLIENT_ID=void 0;var JNt=require("child_process");var Y6=require("fs");var AG=V7();var QNt=require("os");var xG=require("path");var XNt=ty();var ZNt=R6();var eIt=$H();var tIt=qH();var rIt=jH();var Ay=Kz();var CG=Wz();var QA=Qz();var nIt=wG();var W6=lf();var USe=jSe();xy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var FSe={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 XA=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===FSe.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(FSe.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 W6.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 W6.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 AG.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=xG.join(i,".config")}}if(r){r=xG.join(r,"gcloud","application_default_credentials.json");if(!Y6.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=Y6.realpathSync(e);if(!Y6.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=Y6.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!==QA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${QA.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 CG.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 QA.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===CG.USER_REFRESH_ACCOUNT_TYPE){n=new CG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===QA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===W6.EXTERNAL_ACCOUNT_TYPE){n=nIt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===USe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new USe.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!==W6.EXTERNAL_ACCOUNT_TYPE){return null}const e=await this.getClient();return await e.getProjectId()}async getGCEProjectId(){try{const e=await AG.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 W6.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 AG.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=xG.resolve(this.keyFilename);const r=Y6.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=XA;XA.DefaultTransporter=ZNt.DefaultTransporter});var BSe=_(ZA=>{"use strict";Object.defineProperty(ZA,"__esModule",{value:true});ZA.IAMAuth=void 0;var RG=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}}};ZA.IAMAuth=RG});var VSe=_(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:true});Pu.DownscopedClient=Pu.EXPIRATION_TIME_OFFSET=Pu.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var iIt=require("stream");var sIt=ny();var aIt=tG();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";Pu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Pu.EXPIRATION_TIME_OFFSET=5*60*1e3;var OG=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>Pu.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Pu.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=Pu.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}};Pu.DownscopedClient=OG});var NG=_(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 HSe=MSe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return HSe.GoogleAuth}});var dIt=ny();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return dIt.AuthClient}});var pIt=$H();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return pIt.Compute}});var fIt=jH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return fIt.GCPEnv}});var hIt=BSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return hIt.IAMAuth}});var mIt=qH();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return mIt.IdTokenClient}});var gIt=zz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return gIt.JWTAccess}});var yIt=Kz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return yIt.JWT}});var vIt=Qz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return vIt.Impersonated}});var zSe=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return zSe.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return zSe.OAuth2Client}});var _It=PH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return _It.LoginTicket}});var EIt=Wz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return EIt.UserRefreshClient}});var bIt=pG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return bIt.AwsClient}});var wIt=cG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return wIt.IdentityPoolClient}});var SIt=wG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return SIt.ExternalAccountClient}});var TIt=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return TIt.BaseExternalAccountClient}});var AIt=VSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return AIt.DownscopedClient}});var xIt=YA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return xIt.PluggableAuthClient}});var CIt=R6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return CIt.DefaultTransporter}});var RIt=new HSe.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=NG();var IIt=OIt(tu());var PIt=new NIt.GoogleAuth;var GSe=new IIt.default({max:50,maxAge:1e3*60*50});async function DIt(t){let e=GSe.get(t);if(!e){const r=await PIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);GSe.set(t,e)}return e}o(DIt,"getServiceAccountIdToken");Cy.getServiceAccountIdToken=DIt});var QSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Oy=As();var kIt=Ry();var $It={"Content-Type":"application/json"};var LIt=/\/*$/;async function qIt(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({...$It,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,kIt.getServiceAccountIdToken)(e);d.set("Authorization",`Bearer ${p}`);async function f(h,m){const{headers:g,body:y,params:v={},parseAs:w="json",querySerializer:E=n??KSe,bodySerializer:b=i??YSe,...S}=m||{};const T=WSe(h,{baseUrl:e,params:v,querySerializer:E});const A=JSe(d,g,v.header);const P={redirect:"follow",...a,...S,headers:A};if(y)P.body=b(y);if(P.body instanceof FormData)A.delete("Content-Type");const D=await r(T,P);if(D.status===404){const F=await D.json();if(F&&F.hasOwnProperty("type")&&F.hasOwnProperty("title")&&F.hasOwnProperty("status")){throw new Oy.ApiError(F)}throw new Oy.ApiError(Oy.Problems.NOT_FOUND)}if(D.status===204||D.headers.get("Content-Length")==="0"){return D.ok?{data:{},response:D}:{error:{},response:D}}if(D.ok){let F=D.body;if(w!=="stream"){const V=D.clone();F=typeof V[w]==="function"?await V[w]():await V.text()}return{data:F,response:D}}else{u.debug(`Error on internal api: path: ${T}, status: ${D.status}, headers: ${JSON.stringify(D.headers)}, body: ${await D.clone().text()}`);let F={};try{F=await D.clone().json();if(F.type&&F.status&&F.title){throw new Oy.ApiError(F)}}catch(V){}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(qIt,"createClient");Fo.createClient=qIt;function KSe(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(KSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=KSe;function YSe(t){return JSON.stringify(t)}o(YSe,"defaultBodySerializer");Fo.defaultBodySerializer=YSe;function WSe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(LIt,""):""}${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(WSe,"createFinalURL");Fo.createFinalURL=WSe;function JSe(...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(JSe,"mergeHeaders");Fo.mergeHeaders=JSe});var XSe=_(cf=>{"use strict";var jIt=cf&&cf.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(cf,"__esModule",{value:true});cf.ApiKeyService=cf.createApiKeyServiceClient=void 0;var Ny=As();var UIt=NG();var ex=jIt(Oa());var FIt=QSe();async function MIt(t){return(0,FIt.createClient)({baseUrl:ex.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(MIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=MIt;var IG=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 UIt.GoogleAuth;const i=await n.getIdTokenClient(ex.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${ex.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:`${ex.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}};cf.ApiKeyService=IG});var eTe=_(Iy=>{"use strict";var BIt=Iy&&Iy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Iy,"__esModule",{value:true});Iy.AuthApiService=void 0;var Nm=As();var ZSe=BIt(Oa());var VIt=Ry();var PG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!ZSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=ZSe.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===Nm.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,VIt.getServiceAccountIdToken)(this.baseUrl);n.set("Authorization",`Bearer ${s}`)}const i=await fetch(`${this.baseUrl}${e}`,{...r,headers:n});if(i.status===Nm.HttpStatusCode.NOT_FOUND){throw new Nm.ApiError(Nm.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 Nm.ApiError(s)}this.logger.error(`Error not handled on auth-api: path: ${e}, status: ${i.status}`);throw new Nm.ApiError(Nm.Problems.INTERNAL_SERVER_ERROR)}return i.clone().json()}};Iy.AuthApiService=PG});var J6=_(tx=>{"use strict";Object.defineProperty(tx,"__esModule",{value:true});tx.ApiServiceClient=void 0;var Py=As();var HIt=Ry();var DG=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,HIt.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()}};tx.ApiServiceClient=DG});var iTe=_(Bl=>{"use strict";var rTe=Bl&&Bl.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Bl,"__esModule",{value:true});Bl.ContentApiService=Bl.getContentApiStorageTarballPath=Bl.contentApiTarballFileName=void 0;var zIt=rTe(tu());var tTe=rTe(Oa());var GIt=J6();var KIt=new zIt.default({max:500,maxAge:1e3*60*50});function nTe(t,e){return`${t}--${e}.tar.gz`}o(nTe,"contentApiTarballFileName");Bl.contentApiTarballFileName=nTe;function YIt(t,e){const r=nTe(t,e);return`${t}/builds/${r}`}o(YIt,"getContentApiStorageTarballPath");Bl.getContentApiStorageTarballPath=YIt;var kG=class extends GIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!tTe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(tTe.default.CONTENT_API_URL,KIt,e)}};Bl.ContentApiService=kG});var oTe=_(Dy=>{"use strict";var aTe=Dy&&Dy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Dy,"__esModule",{value:true});Dy.DevApiService=void 0;var WIt=aTe(tu());var sTe=aTe(Oa());var JIt=J6();var QIt=new WIt.default({max:500,maxAge:1e3*60*50});var $G=class extends JIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!sTe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(sTe.default.DEV_API_URL,QIt,{userSub:n,logger:e.log,requestId:e.id})}};Dy.DevApiService=$G});var cTe=_((Nhr,lTe)=>{var uTe=require("stream").Stream;var XIt=require("util");lTe.exports=Du;function Du(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(Du,"DelayedStream");XIt.inherits(Du,uTe);Du.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(Du.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});Du.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Du.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};Du.prototype.pause=function(){this.source.pause()};Du.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};Du.prototype.pipe=function(){var t=uTe.prototype.pipe.apply(this,arguments);this.resume();return t};Du.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)};Du.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 hTe=_((Phr,fTe)=>{var ZIt=require("util");var pTe=require("stream").Stream;var dTe=cTe();fTe.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");ZIt.inherits(Xn,pTe);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 dTe)){var r=dTe.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){pTe.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 gTe=_((khr,mTe)=>{mTe.exports=ePt;function ePt(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(ePt,"defer")});var LG=_((Lhr,vTe)=>{var yTe=gTe();vTe.exports=tPt;function tPt(t){var e=false;yTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{yTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(tPt,"async")});var qG=_((jhr,_Te)=>{_Te.exports=rPt;function rPt(t){Object.keys(t.jobs).forEach(nPt.bind(t));t.jobs={}}o(rPt,"abort");function nPt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(nPt,"clean")});var jG=_((Fhr,bTe)=>{var ETe=LG();var iPt=qG();bTe.exports=sPt;function sPt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=aPt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){iPt(r)}else{r.results[i]=a}n(s,r.results)})}o(sPt,"iterate");function aPt(t,e,r,n){var i;if(t.length==2){i=t(r,ETe(n))}else{i=t(r,e,ETe(n))}return i}o(aPt,"runJob")});var UG=_((Bhr,wTe)=>{wTe.exports=oPt;function oPt(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(oPt,"state")});var FG=_((Hhr,STe)=>{var uPt=qG();var lPt=LG();STe.exports=cPt;function cPt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;uPt(this);lPt(t)(null,this.results)}o(cPt,"terminator")});var ATe=_((Ghr,TTe)=>{var dPt=jG();var pPt=UG();var fPt=FG();TTe.exports=hPt;function hPt(t,e,r){var n=pPt(t);while(n.index<(n["keyedList"]||t).length){dPt(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 fPt.bind(n,r)}o(hPt,"parallel")});var MG=_((Yhr,rx)=>{var xTe=jG();var mPt=UG();var gPt=FG();rx.exports=yPt;rx.exports.ascending=CTe;rx.exports.descending=vPt;function yPt(t,e,r,n){var i=mPt(t,r);xTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){xTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return gPt.bind(i,n)}o(yPt,"serialOrdered");function CTe(t,e){return t<e?-1:t>e?1:0}o(CTe,"ascending");function vPt(t,e){return-1*CTe(t,e)}o(vPt,"descending")});var OTe=_((Jhr,RTe)=>{var _Pt=MG();RTe.exports=EPt;function EPt(t,e,r){return _Pt(t,e,null,r)}o(EPt,"serial")});var ITe=_((Xhr,NTe)=>{NTe.exports={parallel:ATe(),serial:OTe(),serialOrdered:MG()}});var DTe=_((Zhr,PTe)=>{PTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var LTe=_((emr,$Te)=>{var zG=hTe();var kTe=require("util");var BG=require("path");var bPt=require("http");var wPt=require("https");var SPt=require("url").parse;var TPt=require("fs");var APt=require("stream").Stream;var VG=xM();var xPt=ITe();var HG=DTe();$Te.exports=Fr;kTe.inherits(Fr,zG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];zG.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=zG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(kTe.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 APt)){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{TPt.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"){HG(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=BG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=BG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=BG.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=VG.lookup(t.name)}if(!r&&t.path){r=VG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=VG.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}xPt.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=SPt(t);n=HG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=HG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=wPt.request(n)}else{r=bPt.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 jTe=_(qTe=>{"use strict";var CPt=require("url").parse;var RPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var OPt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function NPt(t){var e=typeof t==="string"?CPt(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)||RPt[r]||0;if(!IPt(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(NPt,"getProxyForUrl");function IPt(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!OPt.call(t,s)})}o(IPt,"shouldProxy");function ky(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o(ky,"getEnv");qTe.getProxyForUrl=NPt});var FTe=_((imr,UTe)=>{var Q6;UTe.exports=function(){if(!Q6){try{Q6=Ja()("follow-redirects")}catch(t){}if(typeof Q6!=="function"){Q6=o(function(){},"debug")}}Q6.apply(null,arguments)}});var zTe=_((amr,nK)=>{var eb=require("url");var X6=eb.URL;var PPt=require("http");var DPt=require("https");var JG=require("stream").Writable;var QG=require("assert");var MTe=FTe();var XG=false;try{QG(new X6)}catch(t){XG=t.code==="ERR_INVALID_URL"}var kPt=["auth","host","hostname","href","path","pathname","port","protocol","query","search"];var ZG=["abort","aborted","connect","error","socket","timeout"];var eK=Object.create(null);ZG.forEach(function(t){eK[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var KG=tb("ERR_INVALID_URL","Invalid URL",TypeError);var YG=tb("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var $Pt=tb("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",YG);var LPt=tb("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var qPt=tb("ERR_STREAM_WRITE_AFTER_END","write after end");var jPt=JG.prototype.destroy||VTe;function Ta(t,e){JG.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 YG?i:new YG({cause:i}))}};this._performRequest()}o(Ta,"RedirectableRequest");Ta.prototype=Object.create(JG.prototype);Ta.prototype.abort=function(){rK(this._currentRequest);this._currentRequest.abort();this.emit("abort")};Ta.prototype.destroy=function(t){rK(this._currentRequest,t);jPt.call(this,t);return this};Ta.prototype.write=function(t,e,r){if(this._ending){throw new qPt}if(!Im(t)&&!MPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(Z6(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 LPt);this.abort()}};Ta.prototype.end=function(t,e,r){if(Z6(t)){r=t;t=e=null}else if(Z6(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 ZG){n.on(i,eK[i])}this._currentUrl=/^\//.test(this._options.path)?eb.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}rK(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){throw new $Pt}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=[];GG(/^content-/i,this._options.headers)}var a=GG(/^host$/i,this._options.headers);var u=tK(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:eb.format(Object.assign(u,{host:l}));var d=UPt(r,c);MTe("redirecting to",d.href);this._isRedirect=true;WG(d,this._options);if(d.protocol!==u.protocol&&d.protocol!=="https:"||d.host!==l&&!FPt(d.host,l)){GG(/^(?:authorization|cookie)$/i,this._options.headers)}if(Z6(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 BTe(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(BPt(c)){c=WG(c)}else if(Im(c)){c=WG(tK(c))}else{p=d;d=HTe(c);c={protocol:i}}if(Z6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Im(d.host)&&!Im(d.hostname)){d.hostname="::1"}QG.equal(d.protocol,i,"protocol mismatch");MTe("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(BTe,"wrap");function VTe(){}o(VTe,"noop");function tK(t){var e;if(XG){e=new X6(t)}else{e=HTe(eb.parse(t));if(!Im(e.protocol)){throw new KG({input:t})}}return e}o(tK,"parseUrl");function UPt(t,e){return XG?new X6(t,e):tK(eb.resolve(e,t))}o(UPt,"resolveUrl");function HTe(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname)){throw new KG({input:t.href||t})}if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host)){throw new KG({input:t.href||t})}return t}o(HTe,"validateUrl");function WG(t,e){var r=e||{};for(var n of kPt){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(WG,"spreadUrlObject");function GG(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(GG,"removeMatchingHeaders");function tb(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(tb,"createErrorType");function rK(t,e){for(var r of ZG){t.removeListener(r,eK[r])}t.on("error",VTe);t.destroy(e)}o(rK,"destroyRequest");function FPt(t,e){QG(Im(t)&&Im(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(FPt,"isSubdomain");function Im(t){return typeof t==="string"||t instanceof String}o(Im,"isString");function Z6(t){return typeof t==="function"}o(Z6,"isFunction");function MPt(t){return typeof t==="object"&&"length"in t}o(MPt,"isBuffer");function BPt(t){return X6&&t instanceof X6}o(BPt,"isURL");nK.exports=BTe({http:PPt,https:DPt});nK.exports.wrap=BTe});var px=_((umr,k7e)=>{"use strict";var VPt=LTe();var HPt=require("url");var zPt=jTe();var GPt=require("http");var KPt=require("https");var l7e=require("util");var YPt=zTe();var WPt=require("zlib");var c7e=require("stream");var JPt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var d7e=td(VPt);var QPt=td(HPt);var XPt=td(GPt);var ZPt=td(KPt);var eDt=td(l7e);var tDt=td(YPt);var hf=td(WPt);var pf=td(c7e);var rDt=td(JPt);function p7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(p7e,"bind");var{toString:nDt}=Object.prototype;var{getPrototypeOf:vK}=Object;var ux=(t=>e=>{const r=nDt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>ux(e)===t},"kindOfTest");var lx=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:jy}=Array;var ib=lx("undefined");function iDt(t){return t!==null&&!ib(t)&&t.constructor!==null&&!ib(t.constructor)&&Bo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(iDt,"isBuffer");var f7e=Vl("ArrayBuffer");function sDt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&f7e(t.buffer)}return e}o(sDt,"isArrayBufferView");var aDt=lx("string");var Bo=lx("function");var h7e=lx("number");var cx=o(t=>t!==null&&typeof t==="object","isObject");var oDt=o(t=>t===true||t===false,"isBoolean");var ix=o(t=>{if(ux(t)!=="object"){return false}const e=vK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var uDt=Vl("Date");var lDt=Vl("File");var cDt=Vl("Blob");var dDt=Vl("FileList");var pDt=o(t=>cx(t)&&Bo(t.pipe),"isStream");var fDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Bo(t.append)&&((e=ux(t))==="formdata"||e==="object"&&Bo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var hDt=Vl("URLSearchParams");var mDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function ab(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(ab,"forEach");function m7e(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(m7e,"findKey");var g7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var y7e=o(t=>!ib(t)&&t!==g7e,"isContextDefined");function uK(){const{caseless:t}=y7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&m7e(e,i)||i;if(ix(e[s])&&ix(n)){e[s]=uK(e[s],n)}else if(ix(n)){e[s]=uK({},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]&&ab(arguments[n],r)}return e}o(uK,"merge");var gDt=o((t,e,r,{allOwnKeys:n}={})=>{ab(e,(i,s)=>{if(r&&Bo(i)){t[s]=p7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var yDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var vDt=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 _Dt=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&&vK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var EDt=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 bDt=o(t=>{if(!t)return null;if(jy(t))return t;let e=t.length;if(!h7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var wDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&vK(Uint8Array));var SDt=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 TDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var ADt=Vl("HTMLFormElement");var xDt=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 GTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var CDt=Vl("RegExp");var v7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};ab(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var RDt=o(t=>{v7e(t,(e,r)=>{if(Bo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Bo(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 ODt=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 NDt=o(()=>{},"noop");var IDt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var iK="abcdefghijklmnopqrstuvwxyz";var KTe="0123456789";var _7e={DIGIT:KTe,ALPHA:iK,ALPHA_DIGIT:iK+iK.toUpperCase()+KTe};var PDt=o((t=16,e=_7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function DDt(t){return!!(t&&Bo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(DDt,"isSpecCompliantForm");var kDt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(cx(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=jy(n)?[]:{};ab(n,(a,u)=>{const l=r(a,i+1);!ib(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var $Dt=Vl("AsyncFunction");var LDt=o(t=>t&&(cx(t)||Bo(t))&&Bo(t.then)&&Bo(t.catch),"isThenable");var fe={isArray:jy,isArrayBuffer:f7e,isBuffer:iDt,isFormData:fDt,isArrayBufferView:sDt,isString:aDt,isNumber:h7e,isBoolean:oDt,isObject:cx,isPlainObject:ix,isUndefined:ib,isDate:uDt,isFile:lDt,isBlob:cDt,isRegExp:CDt,isFunction:Bo,isStream:pDt,isURLSearchParams:hDt,isTypedArray:wDt,isFileList:dDt,forEach:ab,merge:uK,extend:gDt,trim:mDt,stripBOM:yDt,inherits:vDt,toFlatObject:_Dt,kindOf:ux,kindOfTest:Vl,endsWith:EDt,toArray:bDt,forEachEntry:SDt,matchAll:TDt,isHTMLForm:ADt,hasOwnProperty:GTe,hasOwnProp:GTe,reduceDescriptors:v7e,freezeMethods:RDt,toObjectSet:ODt,toCamelCase:xDt,noop:NDt,toFiniteNumber:IDt,findKey:m7e,global:g7e,isContextDefined:y7e,ALPHABET:_7e,generateString:PDt,isSpecCompliantForm:DDt,toJSONObject:kDt,isAsyncFn:$Dt,isThenable:LDt};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 E7e=nt.prototype;var b7e={};["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=>{b7e[t]={value:t}});Object.defineProperties(nt,b7e);Object.defineProperty(E7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(E7e);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 lK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(lK,"isVisitable");function w7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(w7e,"removeBrackets");function YTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=w7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(YTe,"renderKey");function qDt(t){return fe.isArray(t)&&!t.some(lK)}o(qDt,"isFlatArray");var jDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function dx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(d7e["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)&&qDt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=w7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?YTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(lK(m)){return true}e.append(YTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(jDt,{defaultVisitor:d,convertValue:c,isVisitable:lK});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(dx,"toFormData");function WTe(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(WTe,"encode$1");function S7e(t,e){this._pairs=[];t&&dx(t,this,e)}o(S7e,"AxiosURLSearchParams");var T7e=S7e.prototype;T7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");T7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,WTe)}:WTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function UDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(UDt,"encode");function _K(t,e,r){if(!e){return t}const n=r&&r.encode||UDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new S7e(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(_K,"buildURL");var cK=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 JTe=cK;var EK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var FDt=QPt["default"].URLSearchParams;var MDt={isNode:true,classes:{URLSearchParams:FDt,FormData:d7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var A7e=typeof window!=="undefined"&&typeof document!=="undefined";var BDt=(t=>{return A7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var VDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var HDt=Object.freeze({__proto__:null,hasBrowserEnv:A7e,hasStandardBrowserWebWorkerEnv:VDt,hasStandardBrowserEnv:BDt});var Mo={...HDt,...MDt};function zDt(t,e){return dx(t,new Mo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Mo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(zDt,"toURLEncodedForm");function GDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(GDt,"parsePropPath");function KDt(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(KDt,"arrayToObject");function x7e(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]=KDt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(GDt(n),i,r,0)});return r}return null}o(x7e,"formDataToJSON");function YDt(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(YDt,"stringifySafely");var bK={transitional:EK,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(x7e(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 zDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return dx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return YDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||bK.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:Mo.classes.FormData,Blob:Mo.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=>{bK.headers[t]={}});var wK=bK;var WDt=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 JDt=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]&&WDt[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 QTe=Symbol("internals");function rb(t){return t&&String(t).trim().toLowerCase()}o(rb,"normalizeHeader");function sx(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(sx):String(t)}o(sx,"normalizeValue");function QDt(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(QDt,"parseTokens");var XDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function sK(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(sK,"matchHeaderValue");function ZDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(ZDt,"formatHeader");function ekt(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(ekt,"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=rb(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]=sx(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())&&!XDt(e)){a(JDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=rb(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return QDt(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=rb(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||sK(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=rb(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||sK(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||sK(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]=sx(i);delete r[s];return}const u=e?ZDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=sx(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[QTe]=this[QTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=rb(a);if(!n[u]){ekt(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 Vo=$y;function aK(t,e){const r=this||wK;const n=e||r;const i=Vo.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(aK,"transformData");function C7e(t){return!!(t&&t.__CANCEL__)}o(C7e,"isCancel");function Pm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Pm,"CanceledError");fe.inherits(Pm,nt,{__CANCEL__:true});function nb(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(nb,"settle");function tkt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(tkt,"isAbsoluteURL");function rkt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(rkt,"combineURLs");function SK(t,e){if(t&&!tkt(e)){return rkt(t,e)}return e}o(SK,"buildFullPath");var ox="1.6.2";function R7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(R7e,"parseProtocol");var nkt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ikt(t,e,r){const n=r&&r.Blob||Mo.classes.Blob;const i=R7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=nkt.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(ikt,"fromDataURI");function skt(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(skt,"throttle");function O7e(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(O7e,"speedometer");var nx=Symbol("internals");var dK=class extends pf["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[nx]={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=O7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=skt(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[nx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[nx];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[nx].length=+e;return this}};var XTe=dK;var{asyncIterator:ZTe}=Symbol;var akt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[ZTe]){yield*t[ZTe]()}else{yield t}},"readBlob");var N7e=akt;var okt=fe.ALPHABET.ALPHA_DIGIT+"-_";var sb=new l7e.TextEncoder;var ff="\r\n";var ukt=sb.encode(ff);var lkt=2;var pK=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)}"`:""}${ff}`;if(i){r=sb.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=sb.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+lkt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*N7e(e)}yield ukt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var ckt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,okt)}=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=sb.encode("--"+s+ff);const u=sb.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new pK(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 c7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var dkt=ckt;var fK=class extends pf["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 pkt=fK;var fkt=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 hkt=fkt;var e7e={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var mkt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var t7e=fe.isFunction(hf["default"].createBrotliDecompress);var{http:gkt,https:ykt}=tDt["default"];var vkt=/https:?/;var r7e=Mo.protocols.map(t=>{return t+":"});function _kt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(_kt,"dispatchBeforeRedirect");function I7e(t,e,r){let n=e;if(!n&&n!==false){const i=zPt.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){I7e(s,e,s.href)},"beforeRedirect")}o(I7e,"setProxy");var Ekt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var bkt=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 wkt=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 n7e=o((t,e)=>wkt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var Skt=Ekt&&o(function t(e){return bkt(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=hkt(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=>n7e(Le)):[n7e($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new rDt["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 Pm(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=SK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||r7e[0];if(b==="data:"){let ue;if(p!=="GET"){return nb(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=ikt(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=pf["default"].Readable.from(ue)}return nb(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(r7e.indexOf(b)===-1){return i(new nt("Unsupported protocol "+b,nt.ERR_BAD_REQUEST,e))}const S=Vo.from(e.headers).normalize();S.set("User-Agent","axios/"+ox,false);const T=e.onDownloadProgress;const A=e.onUploadProgress;const P=e.maxRate;let D=void 0;let F=void 0;if(fe.isSpecCompliantForm(a)){const ue=S.getContentType(/boundary=([-_\w\d]{10,70})/i);a=dkt(a,xe=>{S.set(xe)},{tag:`axios-${ox}-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 eDt["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=pf["default"].Readable.from(N7e(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 V=fe.toFiniteNumber(S.getContentLength());if(fe.isArray(P)){D=P[0];F=P[1]}else{D=F=P}if(a&&(A||D)){if(!fe.isStream(a)){a=pf["default"].Readable.from(a,{objectMode:false})}a=pf["default"].pipeline([a,new XTe({length:V,maxRate:fe.toFiniteNumber(D)})],fe.noop);A&&a.on("progress",ue=>{A(Object.assign(ue,{upload:true}))})}let j=void 0;if(e.auth){const ue=e.auth.username||"";const xe=e.auth.password||"";j=ue+":"+xe}if(!j&&E.username){const ue=E.username;const xe=E.password;j=ue+":"+xe}j&&S.delete("authorization");let Q;try{Q=_K(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"+(t7e?", br":""),false);const oe={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:b,family:l,beforeRedirect:_kt,beforeRedirects:{}};!fe.isUndefined(u)&&(oe.lookup=u);if(e.socketPath){oe.socketPath=e.socketPath}else{oe.hostname=E.hostname;oe.port=E.port;I7e(oe,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+oe.path)}let Te;const le=vkt.test(oe.protocol);oe.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?ZPt["default"]:XPt["default"]}else{if(e.maxRedirects){oe.maxRedirects=e.maxRedirects}if(e.beforeRedirect){oe.beforeRedirects.config=e.beforeRedirect}Te=le?ykt:gkt}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 XTe({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(F)});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(hf["default"].createUnzip(e7e));delete xe.headers["content-encoding"];break;case"deflate":we.push(new pkt);we.push(hf["default"].createUnzip(e7e));delete xe.headers["content-encoding"];break;case"br":if(t7e){we.push(hf["default"].createBrotliDecompress(mkt));delete xe.headers["content-encoding"]}}}Ue=we.length>1?pf["default"].pipeline(we,fe.noop):we[0];const ge=pf["default"].finished(Ue,()=>{ge();y()});const Je={status:xe.statusCode,statusText:xe.statusMessage,headers:new Vo(xe.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;nb(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))}nb(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||EK;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 Pm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var Tkt=Mo.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 Akt=Mo.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 i7e(t,e){let r=0;const n=O7e(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(i7e,"progressEventReducer");var xkt=typeof XMLHttpRequest!=="undefined";var Ckt=xkt&&function(t){return new Promise(o(function e(r,n){let i=t.data;const s=Vo.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(Mo.hasStandardBrowserEnv||Mo.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=SK(t.baseURL,t.url);p.open(t.method.toUpperCase(),_K(f,t.params,t.paramsSerializer),true);p.timeout=t.timeout;function h(){if(!p){return}const g=Vo.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};nb(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||EK;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Mo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&Akt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&Tkt.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",i7e(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",i7e(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Pm(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=R7e(f);if(m&&Mo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var hK={http:Skt,xhr:Ckt};fe.forEach(hK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var s7e=o(t=>`- ${t}`,"renderReason");var Rkt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var P7e={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(!Rkt(r)){n=hK[(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(s7e).join("\n"):" "+s7e(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:hK};function oK(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Pm(null,t)}}o(oK,"throwIfCancellationRequested");function a7e(t){oK(t);t.headers=Vo.from(t.headers);t.data=aK.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=P7e.getAdapter(t.adapter||wK.adapter);return e(t).then(o(function r(n){oK(t);n.data=aK.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!C7e(n)){oK(t);if(n&&n.response){n.response.data=aK.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(a7e,"dispatchRequest");var o7e=o(t=>t instanceof Vo?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(o7e(c),o7e(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 TK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{TK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var u7e={};TK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+ox+"] 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&&!u7e[a]){u7e[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 Okt(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(Okt,"assertOptions");var mK={assertOptions:Okt,validators:TK};var df=mK.validators;var qy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new JTe,response:new JTe}}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){mK.assertOptions(n,{silentJSONParsing:df.transitional(df.boolean),forcedJSONParsing:df.transitional(df.boolean),clarifyTimeoutError:df.transitional(df.boolean)},false)}if(i!=null){if(fe.isFunction(i)){r.paramsSerializer={serialize:i}}else{mK.assertOptions(i,{encode:df.function,serialize:df.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=Vo.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=[a7e.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=a7e.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=SK(e.baseURL,e.url);return _K(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 ax=qy;var gK=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 Pm(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 Nkt=gK;function Ikt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(Ikt,"spread");function Pkt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Pkt,"isAxiosError");var yK={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(yK).forEach(([t,e])=>{yK[e]=t});var Dkt=yK;function D7e(t){const e=new ax(t);const r=p7e(ax.prototype.request,e);fe.extend(r,ax.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return D7e(Ly(t,i))},"create");return r}o(D7e,"createInstance");var fi=D7e(wK);fi.Axios=ax;fi.CanceledError=Pm;fi.CancelToken=Nkt;fi.isCancel=C7e;fi.VERSION=ox;fi.toFormData=dx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=Ikt;fi.isAxiosError=Pkt;fi.mergeConfig=Ly;fi.AxiosHeaders=Vo;fi.formToJSON=t=>x7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=P7e.getAdapter;fi.HttpStatusCode=Dkt;fi.default=fi;k7e.exports=fi});var hx=_(fx=>{"use strict";Object.defineProperty(fx,"__esModule",{value:true});fx.CredentialsMethod=void 0;var $7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})($7e||(fx.CredentialsMethod=$7e={}))});var km=_(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 gx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(gx,"getRequestMetadataFromPath");var L7e="fga-request-id";function IK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(IK,"getResponseHeaders");var Dm=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}=gx((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=IK(e);this.requestId=g[L7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=Dm;var AK=class extends Dm{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}=gx((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=AK;var xK=class extends Dm{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=xK;var CK=class extends Dm{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}=gx((s=e.request)===null||s===void 0?void 0:s.path);const u=IK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=CK;var RK=class extends Dm{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=gx((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=RK;var OK=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=IK(e);this.requestId=f[L7e];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=OK;var mx=class extends Uy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=mx;var NK=class extends mx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=NK});var ob=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var kkt=km();var $kt=o(function(t,e,r){if(r===null||r===void 0){throw new kkt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=$kt;var Lkt=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");mf.isWellFormedUriString=Lkt;var qkt=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");mf.isWellFormedUlidString=qkt});var DK=_(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:true});Fy.Configuration=Fy.GetDefaultRetryParams=void 0;var ub=hx();var PK=km();var yx=ob();var jkt=15;var Ukt=100;var Fkt="openfga-sdk js/0.3.0";function Mkt(t=jkt,e=Ukt){return{maxRetry:t,minWaitInMs:e}}o(Mkt,"GetDefaultRetryParams");Fy.GetDefaultRetryParams=Mkt;var vx=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 ub.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case ub.CredentialsMethod.ClientCredentials:this.credentials={method:ub.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case ub.CredentialsMethod.None:default:this.credentials={method:ub.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"]=Fkt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,yx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,yx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,yx.isWellFormedUriString)(this.getBasePath())){throw new PK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,yx.isWellFormedUlidString)(this.storeId)){throw new PK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new PK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};Fy.Configuration=vx;vx.sdkVersion="0.3.0"});var q7e=_(_x=>{"use strict";Object.defineProperty(_x,"__esModule",{value:true});_x.assertNever=void 0;function Bkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Bkt,"assertNever");_x.assertNever=Bkt});var j7e=_(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:true});Ex.chunkArray=void 0;function Vkt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Vkt,"chunkArray");Ex.chunkArray=Vkt});var F7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var bx=require("crypto");function U7e(){if(typeof bx.randomUUID==="function"){return(0,bx.randomUUID)()}if(typeof bx.randomBytes==="function"){return(0,bx.randomBytes)(20).toString("hex")}return}o(U7e,"generateRandomId");My.generateRandomId=U7e;function Hkt(){return U7e()||"00000000-0000-0000-0000-000000000000"}o(Hkt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Hkt});var M7e=_(wx=>{"use strict";Object.defineProperty(wx,"__esModule",{value:true});wx.setHeaderIfNotSet=void 0;function zkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(zkt,"setHeaderIfNotSet");wx.setHeaderIfNotSet=zkt});var B7e=_(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:true});Sx.setNotEnumerableProperty=void 0;function Gkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(Gkt,"setNotEnumerableProperty");Sx.setNotEnumerableProperty=Gkt});var kK=_(ku=>{"use strict";var Kkt=ku&&ku.__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 lb=ku&&ku.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Kkt(e,t,r)};Object.defineProperty(ku,"__esModule",{value:true});lb(q7e(),ku);lb(j7e(),ku);lb(F7e(),ku);lb(M7e(),ku);lb(B7e(),ku)});var LK=_(yi=>{"use strict";var $K=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 Ykt=Tx();var $m=km();var Wkt=kK();yi.DUMMY_BASE_URL="https://example.com";var Jkt=o(function(t,e){return $K(this,void 0,void 0,function*(){const r=yield e.getAccessTokenHeader();if(r&&!t[r.name]){t[r.name]=r.value}})},"setBearerAuthToObject");yi.setBearerAuthToObject=Jkt;var Qkt=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=Qkt;var Xkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Zkt=o(function(t,e){const r=typeof t!=="string";const n=r?Xkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Zkt;var e$t=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=e$t;function t$t(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(t$t,"isAxiosError");function r$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(r$t,"randomTime");function V7e(t,e,r){var n;return $K(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!t$t(s)){throw new $m.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 $m.FgaApiValidationError(s)}else if(a===401||a===403){throw new $m.FgaApiAuthenticationError(s)}else if(a===404){throw new $m.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new $m.FgaApiRateLimitExceededError(s)}else{throw new $m.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,r$t(i,e.minWaitInMs)))}else{throw new $m.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(V7e,"attemptHttpRequest");yi.attemptHttpRequest=V7e;var n$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=Ykt.Credentials.init(r)}return(c=e)=>$K(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 V7e(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,Wkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=n$t});var z7e=_(By=>{"use strict";var qK=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 H7e=px();var gf=ob();var jK=km();var i$t=LK();var Ho=hx();var UK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=H7e.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 Ho.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 Ho.CredentialsMethod.ClientCredentials:case Ho.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 Ho.CredentialsMethod.None:break;case Ho.CredentialsMethod.ApiToken:(0,gf.assertParamExists)("Credentials","config.token",(e=d.config)===null||e===void 0?void 0:e.token);(0,gf.assertParamExists)("Credentials","config.headerName",(r=d.config)===null||r===void 0?void 0:r.headerName);(0,gf.assertParamExists)("Credentials","config.headerName",(n=d.config)===null||n===void 0?void 0:n.headerName);break;case Ho.CredentialsMethod.ClientCredentials:(0,gf.assertParamExists)("Credentials","config.clientId",(i=d.config)===null||i===void 0?void 0:i.clientId);(0,gf.assertParamExists)("Credentials","config.clientSecret",(s=d.config)===null||s===void 0?void 0:s.clientSecret);(0,gf.assertParamExists)("Credentials","config.apiTokenIssuer",(a=d.config)===null||a===void 0?void 0:a.apiTokenIssuer);(0,gf.assertParamExists)("Credentials","config.apiAudience",(u=d.config)===null||u===void 0?void 0:u.apiAudience);if(!(0,gf.isWellFormedUriString)(`https://${(l=d.config)===null||l===void 0?void 0:l.apiTokenIssuer}`)){throw new jK.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 qK(this,void 0,void 0,function*(){const r=yield this.getAccessTokenValue();switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return{name:this.authConfig.config.headerName,value:`${this.authConfig.config.headerValuePrefix?`${this.authConfig.config.headerValuePrefix} `:""}${r}`};case Ho.CredentialsMethod.ClientCredentials:return{name:"Authorization",value:`Bearer ${r}`}}})}getAccessTokenValue(){var e;return qK(this,void 0,void 0,function*(){switch((e=this.authConfig)===null||e===void 0?void 0:e.method){case Ho.CredentialsMethod.None:return;case Ho.CredentialsMethod.ApiToken:return this.authConfig.config.token;case Ho.CredentialsMethod.ClientCredentials:if(this.accessToken&&(!this.accessTokenExpiryDate||this.accessTokenExpiryDate>new Date)){return this.accessToken}return this.refreshAccessToken()}})}refreshAccessToken(){var e;return qK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,i$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},H7e.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 jK.FgaApiError){n.constructor=jK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};By.Credentials=UK});var Tx=_(yf=>{"use strict";var s$t=yf&&yf.__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 G7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))s$t(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});G7e(z7e(),yf);G7e(hx(),yf)});var MK=_(Ax=>{"use strict";Object.defineProperty(Ax,"__esModule",{value:true});Ax.BaseAPI=void 0;var a$t=px();var o$t=require("http");var u$t=require("https");var K7e=DK();var l$t=Tx();var c$t=1e4;var FK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof K7e.Configuration){this.configuration=e}else{this.configuration=new K7e.Configuration(e)}this.configuration.isValid();this.credentials=l$t.Credentials.init(this.configuration);if(!this.axios){const i=new o$t.Agent({keepAlive:true});const s=new u$t.Agent({keepAlive:true});this.axios=a$t.default.create({httpAgent:i,httpsAgent:s,timeout:c$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}};Ax.BaseAPI=FK});var VK=_(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=px();var d$t=MK();var We=LK();var Vn=ob();var p$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=p$t;var f$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=f$t;var h$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=h$t;var BK=class extends d$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=BK});var W7e=_((qmr,Y7e)=>{async function*m$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(m$t,"asyncPool");Y7e.exports=m$t});var J7e=_(Hl=>{"use strict";var Hn=Hl&&Hl.__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 HK=Hl&&Hl.__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(Hl,"__esModule",{value:true});Hl.OpenFgaClient=Hl.ClientWriteStatus=void 0;var zK=W7e();var g$t=VK();var y$t=MK();var GK=km();var Aa=kK();var v$t=ob();var KK=10;var Vy="X-OpenFGA-Client-Method";var YK="X-OpenFGA-Client-Bulk-Request-Id";var Hy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(Hy||(Hl.ClientWriteStatus=Hy={}));var WK=class extends y$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new g$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,v$t.isWellFormedUlidString)(r)){throw new GK.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 GK.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=KK}=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,YK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=HK(zK(a,(0,Aa.chunkArray)(u,s),F=>this.writeTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V})),deletes:[]})))),S;S=yield b.next(),d=S.done,!d;E=true){h=S.value;E=false;const F=h;w.push(F.writes)}}catch(F){p={error:F}}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,P=HK(zK(a,(0,Aa.chunkArray)(l,s),F=>this.deleteTuples(F,Object.assign(Object.assign({},r),{headers:i,transaction:void 0})).catch(V=>({writes:[],deletes:F.map(j=>({tuple_key:j,status:Hy.FAILURE,err:V}))})))),D;D=yield P.next(),m=D.done,!m;A=true){v=D.value;A=false;const F=v;T.push(F.deletes)}}catch(F){g={error:F}}finally{try{if(!A&&!m&&(y=P.return))yield y.call(P)}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=KK}=r;(0,Aa.setHeaderIfNotSet)(u,Vy,"BatchCheck");(0,Aa.setHeaderIfNotSet)(u,YK,(0,Aa.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=HK(zK(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=KK}=r;(0,Aa.setHeaderIfNotSet)(l,Vy,"ListRelations");(0,Aa.setHeaderIfNotSet)(l,YK,(0,Aa.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new GK.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)})}};Hl.OpenFgaClient=WK});var nAe=_(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:true});xa.TypeName=xa.TupleOperation=xa.NullValue=xa.NotFoundErrorCode=xa.InternalErrorCode=xa.ErrorCode=void 0;var Q7e;(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"})(Q7e||(xa.ErrorCode=Q7e={}));var X7e;(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"})(X7e||(xa.InternalErrorCode=X7e={}));var Z7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(Z7e||(xa.NotFoundErrorCode=Z7e={}));var eAe;(function(t){t["NullValue"]="NULL_VALUE"})(eAe||(xa.NullValue=eAe={}));var tAe;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(tAe||(xa.TupleOperation=tAe={}));var rAe;(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"})(rAe||(xa.TypeName=rAe={}))});var aAe=_($i=>{"use strict";var _$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 xx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))_$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;xx(VK(),$i);xx(J7e(),$i);xx(nAe(),$i);var iAe=DK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return iAe.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return iAe.GetDefaultRetryParams}});var sAe=Tx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return sAe.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return sAe.CredentialsMethod}});xx(km(),$i)});var uAe=_(zy=>{"use strict";var E$t=zy&&zy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zy,"__esModule",{value:true});zy.OpenFGAService=void 0;var cb=E$t(Oa());var oAe=aAe();var b$t=Ry();var JK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!cb.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=cb.default.OPENFGA_SERVICE_URL;this.apiHost=cb.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=cb.default.OPENFGA_STORE_ID;this.modelId=cb.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,b$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new oAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:oAe.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=JK});var dAe=_(Gy=>{"use strict";var cAe=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.TenantService=void 0;var w$t=cAe(tu());var lAe=cAe(Oa());var S$t=J6();var T$t=new w$t.default({max:500,maxAge:1e3*60*50});var QK=class extends S$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!lAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(lAe.default.TENANT_API_URL,T$t,{userSub:n,logger:e.log,requestId:e.id})}};Gy.TenantService=QK});var hAe=_(Ky=>{"use strict";var fAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.MeteringService=void 0;var A$t=fAe(tu());var pAe=fAe(Oa());var x$t=J6();var C$t=new A$t.default({max:500,maxAge:1e3*60*50});var XK=class extends x$t.ApiServiceClient{static{o(this,"MeteringService")}constructor(e,r){if(!pAe.default.METERING_SERVICE_URL){throw new Error("METERING_SERVICE_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(pAe.default.METERING_SERVICE_URL,C$t,{userSub:n,logger:e.log,requestId:e.id,targetAudience:"https://meters.zuplo.com"})}};Ky.MeteringService=XK});var mAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function R$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(R$t,"sizeInBytes");zl.sizeInBytes=R$t;function O$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(O$t,"snakeCase");zl.snakeCase=O$t;function N$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(N$t,"kebabCase");zl.kebabCase=N$t;function I$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(I$t,"validateHostname");zl.validateHostname=I$t});var vAe=_(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 ZK;(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})(ZK||(G.TypeRegistry=ZK={}));var $u=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=$u;var gAe;(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})(gAe||(G.FormatRegistry=gAe={}));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 eY=class extends $u{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=eY;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 P(x){return V(x)&&Be.IsString(x.const)}o(P,"TLiteralString");t.TLiteralString=P;function D(x){return V(x)&&Be.IsNumber(x.const)}o(D,"TLiteralNumber");t.TLiteralNumber=D;function F(x){return V(x)&&Be.IsBoolean(x.const)}o(F,"TLiteralBoolean");t.TLiteralBoolean=F;function V(x){return T(x,"Literal")&&u(x.$id)&&(Be.IsBoolean(x.const)||Be.IsNumber(x.const)||Be.IsString(x.const))}o(V,"TLiteral");t.TLiteral=V;function j(x){return T(x,"Never")&&Be.IsObject(x.not)&&Object.getOwnPropertyNames(x.not).length===0}o(j,"TNever");t.TNever=j;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=>P(ie)||D(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 N(x){return T(x,"Uint8Array")&&x.type==="Uint8Array"&&u(x.$id)&&s(x.minByteLength)&&s(x.maxByteLength)}o(N,"TUint8Array");t.TUint8Array=N;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)||V(x)||j(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)||N(x)||q(x)||z(x)||W(x)||A(x)&&ZK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var yAe;(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})(yAe||(G.ExtendsUndefined=yAe={}));var Cx=class extends $u{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Cx;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var Lm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new Cx(U)}o(r,"Throw");function n(U){return Y.TNever(U)||Y.TIntersect(U)||Y.TUnion(U)||Y.TUnknown(U)||Y.TAny(U)}o(n,"IsStructuralRight");function i(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):r("StructuralRight")}o(i,"StructuralRight");function s(U,$){return Ee.True}o(s,"TAnyRight");function a(U,$){return Y.TIntersect($)?w(U,$):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(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)?Ee.True:Ee.False}o(u,"TArrayRight");function l(U,$){return Y.TObject($)&&ge($)?Ee.True:n($)?i(U,$):!Y.TArray($)?Ee.False:e(ft(U.items,$.items))}o(l,"TArray");function c(U,$){return n($)?i(U,$):!Y.TAsyncIterator($)?Ee.False:e(ft(U.items,$.items))}o(c,"TAsyncIterator");function d(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBigInt($)?Ee.True:Ee.False}o(d,"TBigInt");function p(U,$){return Y.TLiteral(U)&&Be.IsBoolean(U.const)?Ee.True:Y.TBoolean(U)?Ee.True:Ee.False}o(p,"TBooleanRight");function f(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TBoolean($)?Ee.True:Ee.False}o(f,"TBoolean");function h(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TConstructor($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(h,"TConstructor");function m(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TDate($)?Ee.True:Ee.False}o(m,"TDate");function g(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TFunction($)?Ee.False:U.parameters.length>$.parameters.length?Ee.False:!U.parameters.every((Ye,cr)=>e(ft($.parameters[cr],Ye))===Ee.True)?Ee.False:e(ft(U.returns,$.returns))}o(g,"TFunction");function y(U,$){return Y.TLiteral(U)&&Be.IsNumber(U.const)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(y,"TIntegerRight");function v(U,$){return Y.TInteger($)||Y.TNumber($)?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Ee.False}o(v,"TInteger");function w(U,$){return $.allOf.every(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(w,"TIntersectRight");function E(U,$){return U.allOf.some(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(E,"TIntersect");function b(U,$){return n($)?i(U,$):!Y.TIterator($)?Ee.False:e(ft(U.items,$.items))}o(b,"TIterator");function S(U,$){return Y.TLiteral($)&&$.const===U.const?Ee.True:n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Ee.False}o(S,"TLiteral");function T(U,$){return Ee.False}o(T,"TNeverRight");function A(U,$){return Ee.True}o(A,"TNever");function P(U){let[$,Ye]=[U,0];while(true){if(!Y.TNot($))break;$=$.not;Ye+=1}return Ye%2===0?$:G.Type.Unknown()}o(P,"UnwrapTNot");function D(U,$){return Y.TNot(U)?ft(P(U),$):Y.TNot($)?ft(U,P($)):r("Invalid fallthrough for Not")}o(D,"TNot");function F(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TNull($)?Ee.True:Ee.False}o(F,"TNull");function V(U,$){return Y.TLiteralNumber(U)?Ee.True:Y.TNumber(U)||Y.TInteger(U)?Ee.True:Ee.False}o(V,"TNumberRight");function j(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TInteger($)||Y.TNumber($)?Ee.True:Ee.False}o(j,"TNumber");function Q(U,$){return Object.getOwnPropertyNames(U.properties).length===$}o(Q,"IsObjectPropertyCount");function oe(U){return ge(U)}o(oe,"IsObjectStringLike");function Te(U){return Q(U,0)||Q(U,1)&&"description"in U.properties&&Y.TUnion(U.properties.description)&&U.properties.description.anyOf.length===2&&(Y.TString(U.properties.description.anyOf[0])&&Y.TUndefined(U.properties.description.anyOf[1])||Y.TString(U.properties.description.anyOf[1])&&Y.TUndefined(U.properties.description.anyOf[0]))}o(Te,"IsObjectSymbolLike");function le(U){return Q(U,0)}o(le,"IsObjectNumberLike");function ue(U){return Q(U,0)}o(ue,"IsObjectBooleanLike");function xe(U){return Q(U,0)}o(xe,"IsObjectBigIntLike");function we(U){return Q(U,0)}o(we,"IsObjectDateLike");function Pe(U){return ge(U)}o(Pe,"IsObjectUint8ArrayLike");function Ue(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(Ue,"IsObjectFunctionLike");function $e(U){return Q(U,0)}o($e,"IsObjectConstructorLike");function ge(U){const $=G.Type.Number();return Q(U,0)||Q(U,1)&&"length"in U.properties&&e(ft(U.properties["length"],$))===Ee.True}o(ge,"IsObjectArrayLike");function Je(U){const $=G.Type.Function([G.Type.Any()],G.Type.Any());return Q(U,0)||Q(U,1)&&"then"in U.properties&&e(ft(U.properties["then"],$))===Ee.True}o(Je,"IsObjectPromiseLike");function Le(U,$){return ft(U,$)===Ee.False?Ee.False:Y.TOptional(U)&&!Y.TOptional($)?Ee.False:Ee.True}o(Le,"Property");function Ie(U,$){return Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Y.TNever(U)||Y.TLiteralString(U)&&oe($)||Y.TLiteralNumber(U)&&le($)||Y.TLiteralBoolean(U)&&ue($)||Y.TSymbol(U)&&Te($)||Y.TBigInt(U)&&xe($)||Y.TString(U)&&oe($)||Y.TSymbol(U)&&Te($)||Y.TNumber(U)&&le($)||Y.TInteger(U)&&le($)||Y.TBoolean(U)&&ue($)||Y.TUint8Array(U)&&Pe($)||Y.TDate(U)&&we($)||Y.TConstructor(U)&&$e($)||Y.TFunction(U)&&Ue($)?Ee.True:Y.TRecord(U)&&Y.TString(C(U))?(()=>{return $[G.Hint]==="Record"?Ee.True:Ee.False})():Y.TRecord(U)&&Y.TNumber(C(U))?(()=>{return Q($,0)?Ee.True:Ee.False})():Ee.False}o(Ie,"TObjectRight");function Qe(U,$){return n($)?i(U,$):Y.TRecord($)?q(U,$):!Y.TObject($)?Ee.False:(()=>{for(const Ye of Object.getOwnPropertyNames($.properties)){if(!(Ye in U.properties))return Ee.False;if(Le(U.properties[Ye],$.properties[Ye])===Ee.False){return Ee.False}}return Ee.True})()}o(Qe,"TObject");function qe(U,$){return n($)?i(U,$):Y.TObject($)&&Je($)?Ee.True:!Y.TPromise($)?Ee.False:e(ft(U.item,$.item))}o(qe,"TPromise");function C(U){return G.PatternNumberExact in U.patternProperties?G.Type.Number():G.PatternStringExact in U.patternProperties?G.Type.String():r("Unknown record key pattern")}o(C,"RecordKey");function N(U){return G.PatternNumberExact in U.patternProperties?U.patternProperties[G.PatternNumberExact]:G.PatternStringExact in U.patternProperties?U.patternProperties[G.PatternStringExact]:r("Unable to get record value schema")}o(N,"RecordValue");function q(U,$){const[Ye,cr]=[C($),N($)];return Y.TLiteralString(U)&&Y.TNumber(Ye)&&e(ft(U,cr))===Ee.True?Ee.True:Y.TUint8Array(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TString(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TArray(U)&&Y.TNumber(Ye)?ft(U,cr):Y.TObject(U)?(()=>{for(const vi of Object.getOwnPropertyNames(U.properties)){if(Le(cr,U.properties[vi])===Ee.False){return Ee.False}}return Ee.True})():Ee.False}o(q,"TRecordRight");function z(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):!Y.TRecord($)?Ee.False:ft(N(U),N($))}o(z,"TRecord");function W(U,$){return Y.TLiteral(U)&&Be.IsString(U.const)?Ee.True:Y.TString(U)?Ee.True:Ee.False}o(W,"TStringRight");function K(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TString($)?Ee.True:Ee.False}o(K,"TString");function se(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TSymbol($)?Ee.True:Ee.False}o(se,"TSymbol");function J(U,$){return Y.TTemplateLiteral(U)?ft(rd.Resolve(U),$):Y.TTemplateLiteral($)?ft(U,rd.Resolve($)):r("Invalid fallthrough for TemplateLiteral")}o(J,"TTemplateLiteral");function x(U,$){return Y.TArray($)&&U.items!==void 0&&U.items.every(Ye=>ft(Ye,$.items)===Ee.True)}o(x,"IsArrayOfTuple");function ie(U,$){return Y.TNever(U)?Ee.True:Y.TUnknown(U)?Ee.False:Y.TAny(U)?Ee.Union:Ee.False}o(ie,"TTupleRight");function ce(U,$){return n($)?i(U,$):Y.TObject($)&&ge($)?Ee.True:Y.TArray($)&&x(U,$)?Ee.True:!Y.TTuple($)?Ee.False:Be.IsUndefined(U.items)&&!Be.IsUndefined($.items)||!Be.IsUndefined(U.items)&&Be.IsUndefined($.items)?Ee.False:Be.IsUndefined(U.items)&&!Be.IsUndefined($.items)?Ee.True:U.items.every((Ye,cr)=>ft(Ye,$.items[cr])===Ee.True)?Ee.True:Ee.False}o(ce,"TTuple");function ve(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TUint8Array($)?Ee.True:Ee.False}o(ve,"TUint8Array");function je(U,$){return n($)?i(U,$):Y.TObject($)?Ie(U,$):Y.TRecord($)?q(U,$):Y.TVoid($)?Et(U,$):Y.TUndefined($)?Ee.True:Ee.False}o(je,"TUndefined");function Xe(U,$){return $.anyOf.some(Ye=>ft(U,Ye)===Ee.True)?Ee.True:Ee.False}o(Xe,"TUnionRight");function _t(U,$){return U.anyOf.every(Ye=>ft(Ye,$)===Ee.True)?Ee.True:Ee.False}o(_t,"TUnion");function tr(U,$){return Ee.True}o(tr,"TUnknownRight");function lr(U,$){return Y.TNever($)?T(U,$):Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TAny($)?s(U,$):Y.TString($)?W(U,$):Y.TNumber($)?V(U,$):Y.TInteger($)?y(U,$):Y.TBoolean($)?p(U,$):Y.TArray($)?u(U,$):Y.TTuple($)?ie(U,$):Y.TObject($)?Ie(U,$):Y.TUnknown($)?Ee.True:Ee.False}o(lr,"TUnknown");function Et(U,$){return Y.TUndefined(U)?Ee.True:Y.TUndefined(U)?Ee.True:Ee.False}o(Et,"VoidRight");function xt(U,$){return Y.TIntersect($)?w(U,$):Y.TUnion($)?Xe(U,$):Y.TUnknown($)?tr(U,$):Y.TAny($)?s(U,$):Y.TObject($)?Ie(U,$):Y.TVoid($)?Ee.True:Ee.False}o(xt,"TVoid");function ft(U,$){return Y.TTemplateLiteral(U)||Y.TTemplateLiteral($)?J(U,$):Y.TNot(U)||Y.TNot($)?D(U,$):Y.TAny(U)?a(U,$):Y.TArray(U)?l(U,$):Y.TBigInt(U)?d(U,$):Y.TBoolean(U)?f(U,$):Y.TAsyncIterator(U)?c(U,$):Y.TConstructor(U)?h(U,$):Y.TDate(U)?m(U,$):Y.TFunction(U)?g(U,$):Y.TInteger(U)?v(U,$):Y.TIntersect(U)?E(U,$):Y.TIterator(U)?b(U,$):Y.TLiteral(U)?S(U,$):Y.TNever(U)?A(U,$):Y.TNull(U)?F(U,$):Y.TNumber(U)?j(U,$):Y.TObject(U)?Qe(U,$):Y.TRecord(U)?z(U,$):Y.TString(U)?K(U,$):Y.TSymbol(U)?se(U,$):Y.TTuple(U)?ce(U,$):Y.TPromise(U)?qe(U,$):Y.TUint8Array(U)?ve(U,$):Y.TUndefined(U)?je(U,$):Y.TUnion(U)?_t(U,$):Y.TUnknown(U)?lr(U,$):Y.TVoid(U)?xt(U,$):r(`Unknown left type operand '${U[G.Kind]}'`)}o(ft,"Visit");function en(U,$){return ft(U,$)}o(en,"Extends");t.Extends=en})(Lm||(G.TypeExtends=Lm={}));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 tY;(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})(tY||(G.IndexedAccessor=tY={}));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 Rx;(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})(Rx||(G.KeyResolver=Rx={}));var Ox=class extends $u{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Ox;var db;(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 Ox("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(db||(G.KeyArrayResolver=db={}));var rY;(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})(rY||(G.UnionResolver=rY={}));var Nx=class extends $u{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Nx;var Ix;(function(t){function e(s){throw new Nx(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})(Ix||(G.TemplateLiteralPattern=Ix={}));var rd;(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})(rd||(G.TemplateLiteralResolver=rd={}));var pb=class extends $u{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=pb;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 pb(`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 pb(`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 Px=class extends $u{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Px;var Qy;(function(t){function e(a){throw new Px(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 Dx=class extends $u{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Dx;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 Dx("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var nY;(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})(nY||(G.TemplateLiteralDslParser=nY={}));var kx=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new $x(this.schema,e)}};G.TransformDecodeBuilder=kx;var $x=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=$x;var P$t=0;var Lx=class extends $u{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=Lx;var qx=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new Lx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=qx;var fb=class extends qx{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=Rx.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(Lm.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(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>Lm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():Lm.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=db.Resolve(r);const s=ct.Type(e);return tY.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=Rx.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=db.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=db.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=rY.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${P$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)?Ix.Create(nY.Parse(e)):Ix.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new kx(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)?rd.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=fb;var jx=class extends fb{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=jx;G.JsonType=new fb;G.Type=new jx});var _Ae=_(Ux=>{"use strict";Object.defineProperty(Ux,"__esModule",{value:true});Ux.CustomTypeBuilder=void 0;var hb=vAe();var iY=class extends hb.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return hb.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return hb.Type.Union([e,hb.Type.Null()])}static StringEnum(e){return hb.Type.Unsafe({type:"string",enum:e})}};Ux.CustomTypeBuilder=iY});var SAe=_(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 Fx(t){return typeof t==="string"}o(Fx,"isString");lt.isString=Fx;function D$t(t){return Array.isArray(t)&&t.every(e=>Fx(e))}o(D$t,"isStringArray");lt.isStringArray=D$t;function EAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(EAe,"isObject");lt.isObject=EAe;function k$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(k$t,"isTypedArray");lt.isTypedArray=k$t;function bAe(t){return typeof t==="number"&&!isNaN(t)}o(bAe,"isNumber");lt.isNumber=bAe;function $$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o($$t,"isIterable");lt.isIterable=$$t;function L$t(t){return t===true||t===false}o(L$t,"isBoolean");lt.isBoolean=L$t;function sY(t){return typeof t==="undefined"}o(sY,"isUndefined");lt.isUndefined=sY;function q$t(t){return!Zy(t)}o(q$t,"isDefined");lt.isDefined=q$t;function Zy(t){return sY(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function j$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(j$t,"assertType");lt.assertType=j$t;function U$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(U$t,"assertIsDefined");lt.assertIsDefined=U$t;function F$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(F$t,"assertAllDefined");lt.assertAllDefined=F$t;var M$t=Object.prototype.hasOwnProperty;function B$t(t){if(!EAe(t)){return false}for(const e in t){if(M$t.call(t,e)){return false}}return true}o(B$t,"isEmptyObject");lt.isEmptyObject=B$t;function aY(t){return typeof t==="function"}o(aY,"isFunction");lt.isFunction=aY;function V$t(...t){return t.length>0&&t.every(aY)}o(V$t,"areFunctions");lt.areFunctions=V$t;function H$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){wAe(t[n],e[n])}}o(H$t,"validateConstraints");lt.validateConstraints=H$t;function wAe(t,e){if(Fx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(aY(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(wAe,"validateConstraint");lt.validateConstraint=wAe;function z$t(t){return t===null?void 0:t}o(z$t,"withNullAsUndefined");lt.withNullAsUndefined=z$t;function G$t(t){return typeof t==="undefined"?null:t}o(G$t,"withUndefinedAsNull");lt.withUndefinedAsNull=G$t;var mb=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=mb;var gb=class extends mb{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=gb;var yb=class extends mb{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=yb;function K$t(t,e){if(sY(t)){throw new gb(e)}return true}o(K$t,"throwIfUndefined");lt.throwIfUndefined=K$t;function oY(t,e){if(Zy(t)){throw new gb(e)}}o(oY,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=oY;function Y$t(t,e){oY(t,e);if(!Fx(t)){throw new yb(e,"string")}return true}o(Y$t,"throwIfNotString");lt.throwIfNotString=Y$t;function W$t(t,e){oY(t,e);if(!bAe(t)){throw new yb(e,"number")}return true}o(W$t,"throwIfNotNumber");lt.throwIfNotNumber=W$t});var _b=_(Ae=>{"use strict";var TAe=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 J$t=Ae&&Ae.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Mx=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))TAe(e,t,r)}J$t(e,t);return e};var vf=Ae&&Ae.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))TAe(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 uY=Mx(Oa());Ae.env=uY.default;Object.defineProperty(Ae,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return uY.EnvironmentalVariableRequiredError}});Object.defineProperty(Ae,"getRequiredEnvVar",{enumerable:true,get:function(){return uY.getRequiredEnvVar}});vf(As(),Ae);var Q$t=rC();Object.defineProperty(Ae,"CommonAuth",{enumerable:true,get:function(){return Q$t.CommonAuth}});var lY=UY();Object.defineProperty(Ae,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return lY.getBuildFlagsForDeployment}});Object.defineProperty(Ae,"getDefaultFlags",{enumerable:true,get:function(){return lY.getDefaultFlags}});Object.defineProperty(Ae,"hasBlockedNotifications",{enumerable:true,get:function(){return lY.hasBlockedNotifications}});var e2=FY();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 X$t=MY();Object.defineProperty(Ae,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return X$t.COMPATIBILITY_FLAG_MAPPINGS}});var AAe=HY();Object.defineProperty(Ae,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return AAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(Ae,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return AAe.VALID_COMPATIBILITY_DATES}});var Z$t=nC();Object.defineProperty(Ae,"FeatureFlags",{enumerable:true,get:function(){return Z$t.FeatureFlags}});var eLt=zY();Object.defineProperty(Ae,"signString",{enumerable:true,get:function(){return eLt.signString}});vf(GY(),Ae);var tLt=aC();Object.defineProperty(Ae,"DeploymentLogState",{enumerable:true,get:function(){return tLt.DeploymentLogState}});vf(eW(),Ae);vf(oC(),Ae);var rLt=uC();Object.defineProperty(Ae,"errorHandler",{enumerable:true,get:function(){return rLt.errorHandler}});var vb=fC();Object.defineProperty(Ae,"apiKeyAuthPlugin",{enumerable:true,get:function(){return vb.apiKeyAuthPlugin}});Object.defineProperty(Ae,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return vb.ensureServiceAccountPlugin}});Object.defineProperty(Ae,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return vb.ensureZuploAdminPlugin}});Object.defineProperty(Ae,"ensureZuploUserPlugin",{enumerable:true,get:function(){return vb.ensureZuploUserPlugin}});Object.defineProperty(Ae,"featureFlagsPlugin",{enumerable:true,get:function(){return vb.featureFlagsPlugin}});var nLt=dge();Object.defineProperty(Ae,"ApiServer",{enumerable:true,get:function(){return nLt.ApiServer}});Ae.fly=Mx(hge());Ae.CloudStorage=Mx(rbe());var iLt=nbe();Object.defineProperty(Ae,"graphQL",{enumerable:true,get:function(){return iLt.graphQL}});vf(C5e(),Ae);var xAe=bj();Object.defineProperty(Ae,"createNewLogger",{enumerable:true,get:function(){return xAe.createNewLogger}});Object.defineProperty(Ae,"logger",{enumerable:true,get:function(){return xAe.logger}});var sLt=dH();Object.defineProperty(Ae,"startsWithReservedKeyword",{enumerable:true,get:function(){return sLt.startsWithReservedKeyword}});var aLt=R5e();Object.defineProperty(Ae,"RouteVersions",{enumerable:true,get:function(){return aLt.RouteVersions}});var CAe=XSe();Object.defineProperty(Ae,"ApiKeyService",{enumerable:true,get:function(){return CAe.ApiKeyService}});Object.defineProperty(Ae,"createApiKeyServiceClient",{enumerable:true,get:function(){return CAe.createApiKeyServiceClient}});var oLt=Ry();Object.defineProperty(Ae,"getServiceAccountIdToken",{enumerable:true,get:function(){return oLt.getServiceAccountIdToken}});var uLt=eTe();Object.defineProperty(Ae,"AuthApiService",{enumerable:true,get:function(){return uLt.AuthApiService}});var cY=iTe();Object.defineProperty(Ae,"ContentApiService",{enumerable:true,get:function(){return cY.ContentApiService}});Object.defineProperty(Ae,"contentApiTarballFileName",{enumerable:true,get:function(){return cY.contentApiTarballFileName}});Object.defineProperty(Ae,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return cY.getContentApiStorageTarballPath}});var lLt=oTe();Object.defineProperty(Ae,"DevApiService",{enumerable:true,get:function(){return lLt.DevApiService}});var cLt=uAe();Object.defineProperty(Ae,"OpenFGAService",{enumerable:true,get:function(){return cLt.OpenFGAService}});var dLt=dAe();Object.defineProperty(Ae,"TenantService",{enumerable:true,get:function(){return dLt.TenantService}});var pLt=hAe();Object.defineProperty(Ae,"MeteringService",{enumerable:true,get:function(){return pLt.MeteringService}});vf(mAe(),Ae);vf(_Ae(),Ae);vf(SAe(),Ae);var fLt=P7();Object.defineProperty(Ae,"JsonValidator",{enumerable:true,get:function(){return fLt.JsonValidator}});var hLt=yH();Object.defineProperty(Ae,"RouteValidator",{enumerable:true,get:function(){return hLt.RouteValidator}});Ae.xfs=Mx(mB())});var Eb=_(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:true});t2.runPlugins=t2.PluginResult=void 0;var dY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};t2.PluginResult=dY;async function mLt(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(mLt,"runPlugins");t2.runPlugins=mLt});var OAe=_((a0r,RAe)=>{"use strict";function gLt(t){return t>=55296&&t<=56319}o(gLt,"isHighSurrogate");function yLt(t){return t>=56320&&t<=57343}o(yLt,"isLowSurrogate");RAe.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(gLt(a)&&yLt(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 IAe=_((u0r,NAe)=>{"use strict";var vLt=OAe();var _Lt=Buffer.byteLength.bind(Buffer);NAe.exports=vLt.bind(null,_Lt)});var PAe=_(r2=>{"use strict";var ELt=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.sanitize=void 0;var bLt=ELt(IAe());var wLt=/[/?<>\\:*|"]/g;var SLt=/[\x00-\x1f\x80-\x9f]/g;var TLt=/^\.+$/;var ALt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var xLt=/[. ]+$/;function CLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(wLt,e).replace(SLt,e).replace(TLt,e).replace(ALt,e).replace(xLt,e);return(0,bLt.default)(r,255)}o(CLt,"sanitize");r2.sanitize=CLt});var Gl=_(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 LAe=_(n2=>{"use strict";var $Ae=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.createProjectDirs=void 0;var DAe=$Ae(require("fs/promises"));var RLt=$Ae(require("path"));var bb=Gl();var kAe=Eb();var OLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[bb.USER_MODULES_DIR_NAME,bb.USER_CONFIG_DIR_NAME,bb.USER_TEST_DIR_NAME,bb.USER_SCHEMAS_DIR_NAME,bb.USER_DOCS_DIR_NAME,".vscode"];try{await DAe.default.mkdir(t);for(const n of r){await DAe.default.mkdir(RLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new kAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new kAe.PluginResult},"createProjectDirs");n2.createProjectDirs=OLt});var qAe=_(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:true});var Bx=require("perf_hooks");var pY=[];async function NLt(t,e){const r=Bx.performance.timerify(e);const n=new Bx.PerformanceObserver(i=>{const s=i.getEntries()[0];pY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(NLt,"timeFn");var ILt={mark:t=>{Bx.performance.mark(t)},measure:(t,e,r)=>{Bx.performance.measure(t,e,r)},timeFn:NLt,report:()=>{if(pY.length>0){console.table(pY)}}};fY.default=ILt});var MAe=_(i2=>{"use strict";var FAe=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFromTemplate=void 0;var PLt=require("fs");var jAe=FAe(require("fs/promises"));var UAe=FAe(require("path"));async function DLt(t){const e=UAe.default.resolve(__dirname,"..","templates",t);if((0,PLt.existsSync)(e)){const r=await jAe.default.readFile(e,"utf-8");return r}else{const r=UAe.default.resolve(__dirname,"templates",t);const n=await jAe.default.readFile(r,"utf-8");return n}}o(DLt,"generateFromTemplate");i2.generateFromTemplate=DLt});var Ca=_(s2=>{"use strict";var hY=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateFileFromTemplate=void 0;var kLt=_b();var $Lt=hY(require("fs/promises"));var LLt=hY(require("path"));var qLt=hY(qAe());var jLt=MAe();var ULt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return qLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=LLt.default.join(r,t);if(await kLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return FLt(i,e,n)})}},"generateFileFromTemplate");s2.generateFileFromTemplate=ULt;async function FLt(t,e,r){const n=await(0,jLt.generateFromTemplate)(e);try{await $Lt.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(FLt,"writeTemplate")});var VAe=_(a2=>{"use strict";var MLt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsMarkdown=void 0;var BLt=MLt(require("path"));var BAe=Gl();var VLt=Ca();a2.generateDefaultDocsMarkdown=(0,VLt.generateFileFromTemplate)(BLt.default.join(BAe.USER_DOCS_DIR_NAME,BAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var zAe=_(o2=>{"use strict";var HLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsSidebar=void 0;var zLt=HLt(require("path"));var HAe=Gl();var GLt=Ca();o2.generateDefaultDocsSidebar=(0,GLt.generateFileFromTemplate)(zLt.default.join(HAe.USER_DOCS_DIR_NAME,HAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var KAe=_(u2=>{"use strict";var KLt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultDocsTheme=void 0;var YLt=KLt(require("path"));var GAe=Gl();var WLt=Ca();u2.generateDefaultDocsTheme=(0,WLt.generateFileFromTemplate)(YLt.default.join(GAe.USER_DOCS_DIR_NAME,GAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var WAe=_(l2=>{"use strict";var JLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDefaultModule=void 0;var QLt=JLt(require("path"));var YAe=Gl();var XLt=Ca();l2.generateDefaultModule=(0,XLt.generateFileFromTemplate)(QLt.default.join(YAe.USER_MODULES_DIR_NAME,YAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var QAe=_(c2=>{"use strict";var ZLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateDevPortalConfigJson=void 0;var eqt=ZLt(require("path"));var JAe=Gl();var tqt=Ca();c2.generateDevPortalConfigJson=(0,tqt.generateFileFromTemplate)(eqt.default.join(JAe.USER_CONFIG_DIR_NAME,JAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var XAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generateEnvironment=void 0;var rqt=Ca();Vx.generateEnvironment=(0,rqt.generateFileFromTemplate)(".env","env.template")});var ZAe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generateESLint=void 0;var nqt=Ca();Hx.generateESLint=(0,nqt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var exe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generateGitignore=void 0;var iqt=Ca();zx.generateGitignore=(0,iqt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var txe=_(d2=>{"use strict";var sqt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateLaunchJson=void 0;var aqt=sqt(require("path"));var oqt=Ca();d2.generateLaunchJson=(0,oqt.generateFileFromTemplate)(aqt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var rxe=_(p2=>{"use strict";var uqt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateSettingsJson=void 0;var lqt=uqt(require("path"));var cqt=Ca();p2.generateSettingsJson=(0,cqt.generateFileFromTemplate)(lqt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var ixe=_(f2=>{"use strict";var dqt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generateRouteOasConfig=void 0;var pqt=dqt(require("path"));var nxe=Gl();var fqt=Ca();f2.generateRouteOasConfig=(0,fqt.generateFileFromTemplate)(pqt.default.join(nxe.USER_CONFIG_DIR_NAME,nxe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var uxe=_(zo=>{"use strict";var sxe=zo&&zo.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(zo,"__esModule",{value:true});zo.updateProjectPackageJson=zo.getProjectPackageJson=zo.getPackageOverrides=zo.generateDefaultPackageJson=void 0;var hqt=_b();var axe=sxe(require("fs/promises"));var mY=sxe(require("path"));async function mqt(t,e=hqt.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=oxe();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(mqt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=mqt;function oxe(){const t=mY.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(oxe,"getPackageOverrides");zo.getPackageOverrides=oxe;async function gqt(t){const e=mY.default.join(t,"package.json");const r=await axe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(gqt,"getProjectPackageJson");zo.getProjectPackageJson=gqt;async function yqt(t,e){const r=mY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await axe.default.writeFile(r,n,"utf-8")}o(yqt,"updateProjectPackageJson");zo.updateProjectPackageJson=yqt});var dxe=_(Gx=>{"use strict";Object.defineProperty(Gx,"__esModule",{value:true});Gx.generatePackageJson=void 0;var lxe=uxe();var cxe=Eb();var vqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,lxe.generateDefaultPackageJson)(e);try{await(0,lxe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new cxe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new cxe.PluginResult},"generatePackageJson");Gx.generatePackageJson=vqt});var fxe=_(h2=>{"use strict";var _qt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generatePoliciesConfig=void 0;var Eqt=_qt(require("path"));var pxe=Gl();var bqt=Ca();h2.generatePoliciesConfig=(0,bqt.generateFileFromTemplate)(Eqt.default.join(pxe.USER_CONFIG_DIR_NAME,pxe.POLICIES_CONFIG_FILE),"policies.template.json")});var hxe=_(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:true});Kx.generateTSConfig=void 0;var wqt=Ca();Kx.generateTSConfig=(0,wqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var gxe=_(m2=>{"use strict";var Sqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.generateZuploJson=void 0;var Tqt=_b();var Aqt=require("fs/promises");var xqt=Sqt(require("path"));var Cqt=Gl();var mxe=Eb();var Rqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:Tqt.DEFAULT_COMPATIBILITY_DATE};const i=xqt.default.join(e,Cqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,Aqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new mxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new mxe.PluginResult},"generateZuploJson");m2.generateZuploJson=Rqt});var vxe=_(g2=>{"use strict";var Oqt=g2&&g2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(g2,"__esModule",{value:true});g2.create=void 0;var gY=_b();var Nqt=require("fs/promises");var Iqt=Oqt(require("path"));var Pqt=Eb();var yxe=PAe();var Dqt=LAe();var kqt=VAe();var $qt=zAe();var Lqt=KAe();var qqt=WAe();var jqt=QAe();var Uqt=XAe();var Fqt=ZAe();var Mqt=exe();var Bqt=txe();var Vqt=rxe();var Hqt=ixe();var zqt=dxe();var Gqt=fxe();var Kqt=hxe();var Yqt=gxe();async function Wqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,yxe.sanitize)(t);const s=(0,yxe.sanitize)(e);const a=Iqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await gY.xfs.dirExists(a)){throw new gY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:gY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[Dqt.createProjectDirs,Hqt.generateRouteOasConfig,Yqt.generateZuploJson,jqt.generateDevPortalConfigJson,qqt.generateDefaultModule,$qt.generateDefaultDocsSidebar,kqt.generateDefaultDocsMarkdown,Lqt.generateDefaultDocsTheme,Gqt.generatePoliciesConfig]);l.push(...[Kqt.generateTSConfig,Mqt.generateGitignore,zqt.generatePackageJson,Uqt.generateEnvironment,Fqt.generateESLint,Bqt.generateLaunchJson,Vqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,Pqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,Nqt.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(Wqt,"create");g2.create=Wqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var Jqt=vxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return Jqt.create}});
411
411
  /*! For license information please see create.index.minified.js.LEGAL.txt */