@zuplo/core 5.1633.0 → 5.1634.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create.index.minified.js +1 -1
- package/index.minified.js +1 -1
- package/package.json +1 -1
package/create.index.minified.js
CHANGED
|
@@ -407,5 +407,5 @@ ${p}
|
|
|
407
407
|
${f}`;const m=`${a}/${t.region}/${n}/${ENt}`;const g=`${ESe}
|
|
408
408
|
${s}
|
|
409
409
|
${m}
|
|
410
|
-
`+await t.crypto.sha256DigestHex(h);const y=await bNt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await z6(t.crypto,y,g);const w=`${ESe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,bSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(wNt,"generateAuthenticationHeaderMap")});var cG=_(qA=>{"use strict";Object.defineProperty(qA,"__esModule",{value:true});qA.AwsClient=void 0;var SNt=wSe();var TNt=lf();var G6=class extends TNt.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 SNt.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}};qA.AwsClient=G6;G6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";G6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var mG=_(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 jA="urn:ietf:params:oauth:token-type:saml2";var dG="urn:ietf:params:oauth:token-type:id_token";var pG="urn:ietf:params:oauth:token-type:jwt";var fG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new UA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new FA("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!==jA&&this.tokenType!==dG&&this.tokenType!==pG){throw new BA(`Executable response must contain a 'token_type' field when successful and it must be one of ${dG}, ${pG}, or ${jA}.`)}if(this.tokenType===jA){if(!e.saml_response){throw new K6(`Executable response must contain a 'saml_response' field when token_type=${jA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new K6(`Executable response must contain a 'id_token' field when token_type=${dG} or ${pG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new MA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new VA("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=fG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var UA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=UA;var FA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=FA;var hG=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=hG;var BA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=BA;var MA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=MA;var VA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=VA;var K6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=K6});var SSe=_(HA=>{"use strict";Object.defineProperty(HA,"__esModule",{value:true});HA.PluggableAuthHandler=void 0;var ANt=zA();var Om=mG();var xNt=require("child_process");var gG=require("fs");var yG=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=xNt.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 ANt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await gG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await gG.promises.lstat(e)).isFile()){return void 0}const r=await gG.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}};HA.PluggableAuthHandler=yG});var zA=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.PluggableAuthClient=Ty.ExecutableError=void 0;var CNt=lf();var RNt=mG();var ONt=SSe();var GA=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)}};Ty.ExecutableError=GA;var NNt=30*1e3;var TSe=5*1e3;var ASe=120*1e3;var INt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var xSe=1;var vG=class extends CNt.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=NNt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<TSe||this.timeoutMillis>ASe){throw new Error(`Timeout must be between ${TSe} and ${ASe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new ONt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[INt]!=="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>xSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${xSe}.`)}if(!e.success){throw new GA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new RNt.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}};Ty.PluggableAuthClient=vG});var EG=_(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:true});KA.ExternalAccountClient=void 0;var PNt=lf();var DNt=uG();var kNt=cG();var $Nt=zA();var _G=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===PNt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new kNt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new $Nt.PluggableAuthClient(e,r)}else{return new DNt.IdentityPoolClient(e,r)}}else{return null}}};KA.ExternalAccountClient=_G});var RSe=_(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:true});Ay.ExternalAccountAuthorizedUserClient=Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var LNt=iy();var CSe=Qz();var qNt=Wc();var jNt=require("stream");var UNt=lf();Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var bG=class extends CSe.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 qNt.GaxiosError&&a.response){throw(0,CSe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var wG=class extends LNt.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 bG(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=UNt.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 jNt.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}};Ay.ExternalAccountAuthorizedUserClient=wG});var ISe=_(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:true});Cy.GoogleAuth=Cy.CLOUD_SDK_CLIENT_ID=void 0;var FNt=require("child_process");var Y6=require("fs");var SG=F7();var BNt=require("os");var TG=require("path");var MNt=ry();var VNt=R6();var HNt=DH();var zNt=$H();var GNt=LH();var xy=zz();var AG=Kz();var YA=Wz();var KNt=EG();var W6=lf();var OSe=RSe();Cy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var NSe={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 WA=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===NSe.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(NSe.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 xy.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 xy.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 HNt.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 SG.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=TG.join(i,".config")}}if(r){r=TG.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!==YA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${YA.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 AG.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 YA.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===AG.USER_REFRESH_ACCOUNT_TYPE){n=new AG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===YA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===W6.EXTERNAL_ACCOUNT_TYPE){n=KNt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===OSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new OSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new xy.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 xy.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 xy.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=BNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,FNt.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 SG.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 SG.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=TG.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 zNt.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,GNt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,MNt.createCrypto)();if(r instanceof xy.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}};Cy.GoogleAuth=WA;WA.DefaultTransporter=VNt.DefaultTransporter});var PSe=_(JA=>{"use strict";Object.defineProperty(JA,"__esModule",{value:true});JA.IAMAuth=void 0;var xG=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}}};JA.IAMAuth=xG});var DSe=_(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:true});Nu.DownscopedClient=Nu.EXPIRATION_TIME_OFFSET=Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var YNt=require("stream");var WNt=iy();var JNt=Zz();var QNt="urn:ietf:params:oauth:grant-type:token-exchange";var XNt="urn:ietf:params:oauth:token-type:access_token";var ZNt="urn:ietf:params:oauth:token-type:access_token";var eIt="https://sts.googleapis.com/v1/token";Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Nu.EXPIRATION_TIME_OFFSET=5*60*1e3;var CG=class extends WNt.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>Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Nu.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 JNt.StsCredentials(eIt);this.cachedDownscopedAccessToken=null;if(typeof(n===null||n===void 0?void 0:n.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=Nu.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 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(){var e;const r=(await this.authClient.getAccessToken()).token;const n={grantType:QNt,requestedTokenType:XNt,subjectToken:r,subjectTokenType:ZNt};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}};Nu.DownscopedClient=CG});var RG=_(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 kSe=ISe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return kSe.GoogleAuth}});var tIt=iy();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return tIt.AuthClient}});var rIt=DH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return rIt.Compute}});var nIt=LH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return nIt.GCPEnv}});var iIt=PSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return iIt.IAMAuth}});var sIt=$H();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return sIt.IdTokenClient}});var aIt=Vz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return aIt.JWTAccess}});var oIt=zz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return oIt.JWT}});var uIt=Wz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return uIt.Impersonated}});var $Se=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return $Se.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return $Se.OAuth2Client}});var lIt=NH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return lIt.LoginTicket}});var cIt=Kz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return cIt.UserRefreshClient}});var dIt=cG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return dIt.AwsClient}});var pIt=uG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return pIt.IdentityPoolClient}});var fIt=EG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return fIt.ExternalAccountClient}});var hIt=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return hIt.BaseExternalAccountClient}});var mIt=DSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return mIt.DownscopedClient}});var gIt=zA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return gIt.PluggableAuthClient}});var yIt=R6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return yIt.DefaultTransporter}});var vIt=new kSe.GoogleAuth;Ot.auth=vIt});var Oy=_(Ry=>{"use strict";var _It=Ry&&Ry.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ry,"__esModule",{value:true});Ry.getServiceAccountIdToken=void 0;var EIt=RG();var bIt=_It(Vu());var wIt=new EIt.GoogleAuth;var LSe=new bIt.default({max:50,maxAge:1e3*60*50});async function SIt(t){let e=LSe.get(t);if(!e){const r=await wIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);LSe.set(t,e)}return e}o(SIt,"getServiceAccountIdToken");Ry.getServiceAccountIdToken=SIt});var BSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Ny=As();var TIt=Oy();var AIt={"Content-Type":"application/json"};var xIt=/\/*$/;async function CIt(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({...AIt,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,TIt.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??qSe,bodySerializer:b=i??jSe,...S}=m||{};const T=USe(h,{baseUrl:e,params:v,querySerializer:E});const A=FSe(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 Ny.ApiError(F)}throw new Ny.ApiError(Ny.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 Ny.ApiError(F)}}catch(V){}throw new Ny.ApiError(Ny.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(CIt,"createClient");Fo.createClient=CIt;function qSe(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(qSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=qSe;function jSe(t){return JSON.stringify(t)}o(jSe,"defaultBodySerializer");Fo.defaultBodySerializer=jSe;function USe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(xIt,""):""}${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(USe,"createFinalURL");Fo.createFinalURL=USe;function FSe(...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(FSe,"mergeHeaders");Fo.mergeHeaders=FSe});var MSe=_(cf=>{"use strict";var RIt=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 Iy=As();var OIt=RG();var QA=RIt(za());var NIt=BSe();async function IIt(t){return(0,NIt.createClient)({baseUrl:QA.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(IIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=IIt;var OG=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 OIt.GoogleAuth;const i=await n.getIdTokenClient(QA.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${QA.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:`${QA.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 Iy.ApiError(u)}throw new Iy.ApiError(Iy.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 Iy.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Iy.ApiError(Iy.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};cf.ApiKeyService=OG});var HSe=_(Py=>{"use strict";var PIt=Py&&Py.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Py,"__esModule",{value:true});Py.AuthApiService=void 0;var Nm=As();var VSe=PIt(za());var DIt=Oy();var NG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!VSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=VSe.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,DIt.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()}};Py.AuthApiService=NG});var ZA=_(XA=>{"use strict";Object.defineProperty(XA,"__esModule",{value:true});XA.ApiServiceClient=void 0;var Dy=As();var kIt=Oy();var IG=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,kIt.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 Dy.ApiError(s)}throw new Dy.ApiError(Dy.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 Dy.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Dy.ApiError(Dy.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};XA.ApiServiceClient=IG});var YSe=_(Ml=>{"use strict";var GSe=Ml&&Ml.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ml,"__esModule",{value:true});Ml.ContentApiService=Ml.getContentApiStorageTarballPath=Ml.contentApiTarballFileName=void 0;var $It=GSe(Vu());var zSe=GSe(za());var LIt=ZA();var qIt=new $It.default({max:500,maxAge:1e3*60*50});function KSe(t,e){return`${t}--${e}.tar.gz`}o(KSe,"contentApiTarballFileName");Ml.contentApiTarballFileName=KSe;function jIt(t,e){const r=KSe(t,e);return`${t}/builds/${r}`}o(jIt,"getContentApiStorageTarballPath");Ml.getContentApiStorageTarballPath=jIt;var PG=class extends LIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!zSe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(zSe.default.CONTENT_API_URL,qIt,e)}};Ml.ContentApiService=PG});var QSe=_(ky=>{"use strict";var JSe=ky&&ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(ky,"__esModule",{value:true});ky.DevApiService=void 0;var UIt=JSe(Vu());var WSe=JSe(za());var FIt=ZA();var BIt=new UIt.default({max:500,maxAge:1e3*60*50});var DG=class extends FIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!WSe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(WSe.default.DEV_API_URL,BIt,{userSub:n,logger:e.log,requestId:e.id})}};ky.DevApiService=DG});var eTe=_((hhr,ZSe)=>{var XSe=require("stream").Stream;var MIt=require("util");ZSe.exports=Iu;function Iu(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(Iu,"DelayedStream");MIt.inherits(Iu,XSe);Iu.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(Iu.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});Iu.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Iu.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};Iu.prototype.pause=function(){this.source.pause()};Iu.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};Iu.prototype.pipe=function(){var t=XSe.prototype.pipe.apply(this,arguments);this.resume();return t};Iu.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)};Iu.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 iTe=_((ghr,nTe)=>{var VIt=require("util");var rTe=require("stream").Stream;var tTe=eTe();nTe.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");VIt.inherits(Xn,rTe);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 tTe)){var r=tTe.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){rTe.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 aTe=_((vhr,sTe)=>{sTe.exports=HIt;function HIt(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(HIt,"defer")});var kG=_((Ehr,uTe)=>{var oTe=aTe();uTe.exports=zIt;function zIt(t){var e=false;oTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{oTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(zIt,"async")});var $G=_((whr,lTe)=>{lTe.exports=GIt;function GIt(t){Object.keys(t.jobs).forEach(KIt.bind(t));t.jobs={}}o(GIt,"abort");function KIt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(KIt,"clean")});var LG=_((Thr,dTe)=>{var cTe=kG();var YIt=$G();dTe.exports=WIt;function WIt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=JIt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){YIt(r)}else{r.results[i]=a}n(s,r.results)})}o(WIt,"iterate");function JIt(t,e,r,n){var i;if(t.length==2){i=t(r,cTe(n))}else{i=t(r,e,cTe(n))}return i}o(JIt,"runJob")});var qG=_((xhr,pTe)=>{pTe.exports=QIt;function QIt(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(QIt,"state")});var jG=_((Rhr,fTe)=>{var XIt=$G();var ZIt=kG();fTe.exports=ePt;function ePt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;XIt(this);ZIt(t)(null,this.results)}o(ePt,"terminator")});var mTe=_((Nhr,hTe)=>{var tPt=LG();var rPt=qG();var nPt=jG();hTe.exports=iPt;function iPt(t,e,r){var n=rPt(t);while(n.index<(n["keyedList"]||t).length){tPt(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 nPt.bind(n,r)}o(iPt,"parallel")});var UG=_((Phr,ex)=>{var gTe=LG();var sPt=qG();var aPt=jG();ex.exports=oPt;ex.exports.ascending=yTe;ex.exports.descending=uPt;function oPt(t,e,r,n){var i=sPt(t,r);gTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){gTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return aPt.bind(i,n)}o(oPt,"serialOrdered");function yTe(t,e){return t<e?-1:t>e?1:0}o(yTe,"ascending");function uPt(t,e){return-1*yTe(t,e)}o(uPt,"descending")});var _Te=_((khr,vTe)=>{var lPt=UG();vTe.exports=cPt;function cPt(t,e,r){return lPt(t,e,null,r)}o(cPt,"serial")});var bTe=_((Lhr,ETe)=>{ETe.exports={parallel:mTe(),serial:_Te(),serialOrdered:UG()}});var STe=_((qhr,wTe)=>{wTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var xTe=_((jhr,ATe)=>{var VG=iTe();var TTe=require("util");var FG=require("path");var dPt=require("http");var pPt=require("https");var fPt=require("url").parse;var hPt=require("fs");var mPt=require("stream").Stream;var BG=TB();var gPt=bTe();var MG=STe();ATe.exports=Fr;TTe.inherits(Fr,VG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];VG.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=VG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(TTe.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 mPt)){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{hPt.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"){MG(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=FG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=FG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=FG.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=BG.lookup(t.name)}if(!r&&t.path){r=BG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=BG.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}gPt.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=fPt(t);n=MG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=MG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=pPt.request(n)}else{r=dPt.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 RTe=_(CTe=>{"use strict";var yPt=require("url").parse;var vPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var _Pt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function EPt(t){var e=typeof t==="string"?yPt(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)||vPt[r]||0;if(!bPt(n,i)){return""}var s=$y("npm_config_"+r+"_proxy")||$y(r+"_proxy")||$y("npm_config_proxy")||$y("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(EPt,"getProxyForUrl");function bPt(t,e){var r=($y("npm_config_no_proxy")||$y("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!_Pt.call(t,s)})}o(bPt,"shouldProxy");function $y(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o($y,"getEnv");CTe.getProxyForUrl=EPt});var NTe=_((Mhr,OTe)=>{var J6;OTe.exports=function(){if(!J6){try{J6=Ja()("follow-redirects")}catch(t){}if(typeof J6!=="function"){J6=o(function(){},"debug")}}J6.apply(null,arguments)}});var jTe=_((Hhr,YG)=>{var Im=require("url");var HG=Im.URL;var wPt=require("http");var SPt=require("https");var DTe=require("stream").Writable;var kTe=require("assert");var $Te=NTe();var GG=["abort","aborted","connect","error","socket","timeout"];var KG=Object.create(null);GG.forEach(function(t){KG[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var TPt=X6("ERR_INVALID_URL","Invalid URL",TypeError);var ITe=X6("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var APt=X6("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded");var xPt=X6("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var CPt=X6("ERR_STREAM_WRITE_AFTER_END","write after end");function Fa(t,e){DTe.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){r._processResponse(n)};this._performRequest()}o(Fa,"RedirectableRequest");Fa.prototype=Object.create(DTe.prototype);Fa.prototype.abort=function(){qTe(this._currentRequest);this.emit("abort")};Fa.prototype.write=function(t,e,r){if(this._ending){throw new CPt}if(!Pm(t)&&!NPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(Q6(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 xPt);this.abort()}};Fa.prototype.end=function(t,e,r){if(Q6(t)){r=t;t=e=null}else if(Q6(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}};Fa.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Fa.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Fa.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);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);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Fa.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Fa.prototype,t,{get:function(){return this._currentRequest[t]}})});Fa.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)}}};Fa.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}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 GG){n.on(i,KG[i])}this._currentUrl=/^\//.test(this._options.path)?Im.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")()}};Fa.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}qTe(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){this.emit("error",new APt);return}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=[];zG(/^content-/i,this._options.headers)}var a=zG(/^host$/i,this._options.headers);var u=Im.parse(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:Im.format(Object.assign(u,{host:l}));var d;try{d=Im.resolve(c,r)}catch(m){this.emit("error",new ITe({cause:m}));return}$Te("redirecting to",d);this._isRedirect=true;var p=Im.parse(d);Object.assign(this._options,p);if(p.protocol!==u.protocol&&p.protocol!=="https:"||p.host!==l&&!OPt(p.host,l)){zG(/^(?:authorization|cookie)$/i,this._options.headers)}if(Q6(i)){var f={headers:t.headers,statusCode:e};var h={url:c,method:s,headers:n};try{i(this._options,f,h)}catch(m){this.emit("error",m);return}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(m){this.emit("error",new ITe({cause:m}))}};function LTe(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(Pm(c)){var f;try{f=PTe(new HG(c))}catch(h){f=Im.parse(c)}if(!Pm(f.protocol)){throw new TPt({input:c})}c=f}else if(HG&&c instanceof HG){c=PTe(c)}else{p=d;d=c;c={protocol:i}}if(Q6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Pm(d.host)&&!Pm(d.hostname)){d.hostname="::1"}kTe.equal(d.protocol,i,"protocol mismatch");$Te("options",d);return new Fa(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(LTe,"wrap");function RPt(){}o(RPt,"noop");function PTe(t){var e={protocol:t.protocol,hostname:t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:t.pathname+t.search,href:t.href};if(t.port!==""){e.port=Number(t.port)}return e}o(PTe,"urlToOptions");function zG(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(zG,"removeMatchingHeaders");function X6(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);n.prototype.constructor=n;n.prototype.name="Error ["+t+"]";return n}o(X6,"createErrorType");function qTe(t){for(var e of GG){t.removeListener(e,KG[e])}t.on("error",RPt);t.abort()}o(qTe,"abortRequest");function OPt(t,e){kTe(Pm(t)&&Pm(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(OPt,"isSubdomain");function Pm(t){return typeof t==="string"||t instanceof String}o(Pm,"isString");function Q6(t){return typeof t==="function"}o(Q6,"isFunction");function NPt(t){return typeof t==="object"&&"length"in t}o(NPt,"isBuffer");YG.exports=LTe({http:wPt,https:SPt});YG.exports.wrap=LTe});var cx=_((Ghr,C7e)=>{"use strict";var IPt=xTe();var PPt=require("url");var DPt=RTe();var kPt=require("http");var $Pt=require("https");var r7e=require("util");var LPt=jTe();var qPt=require("zlib");var n7e=require("stream");var jPt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var i7e=td(IPt);var UPt=td(PPt);var FPt=td(kPt);var BPt=td($Pt);var MPt=td(r7e);var VPt=td(LPt);var hf=td(qPt);var pf=td(n7e);var HPt=td(jPt);function s7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(s7e,"bind");var{toString:zPt}=Object.prototype;var{getPrototypeOf:lK}=Object;var ax=(t=>e=>{const r=zPt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>ax(e)===t},"kindOfTest");var ox=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:Uy}=Array;var t3=ox("undefined");function GPt(t){return t!==null&&!t3(t)&&t.constructor!==null&&!t3(t.constructor)&&Mo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(GPt,"isBuffer");var a7e=Vl("ArrayBuffer");function KPt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&a7e(t.buffer)}return e}o(KPt,"isArrayBufferView");var YPt=ox("string");var Mo=ox("function");var o7e=ox("number");var ux=o(t=>t!==null&&typeof t==="object","isObject");var WPt=o(t=>t===true||t===false,"isBoolean");var rx=o(t=>{if(ax(t)!=="object"){return false}const e=lK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var JPt=Vl("Date");var QPt=Vl("File");var XPt=Vl("Blob");var ZPt=Vl("FileList");var eDt=o(t=>ux(t)&&Mo(t.pipe),"isStream");var tDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Mo(t.append)&&((e=ax(t))==="formdata"||e==="object"&&Mo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var rDt=Vl("URLSearchParams");var nDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function n3(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(Uy(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(n3,"forEach");function u7e(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(u7e,"findKey");var l7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var c7e=o(t=>!t3(t)&&t!==l7e,"isContextDefined");function ZG(){const{caseless:t}=c7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&u7e(e,i)||i;if(rx(e[s])&&rx(n)){e[s]=ZG(e[s],n)}else if(rx(n)){e[s]=ZG({},n)}else if(Uy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&n3(arguments[n],r)}return e}o(ZG,"merge");var iDt=o((t,e,r,{allOwnKeys:n}={})=>{n3(e,(i,s)=>{if(r&&Mo(i)){t[s]=s7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var sDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var aDt=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 oDt=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&&lK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var uDt=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 lDt=o(t=>{if(!t)return null;if(Uy(t))return t;let e=t.length;if(!o7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var cDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&lK(Uint8Array));var dDt=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 pDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var fDt=Vl("HTMLFormElement");var hDt=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 UTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var mDt=Vl("RegExp");var d7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};n3(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var gDt=o(t=>{d7e(t,(e,r)=>{if(Mo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Mo(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 yDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");Uy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var vDt=o(()=>{},"noop");var _Dt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var WG="abcdefghijklmnopqrstuvwxyz";var FTe="0123456789";var p7e={DIGIT:FTe,ALPHA:WG,ALPHA_DIGIT:WG+WG.toUpperCase()+FTe};var EDt=o((t=16,e=p7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function bDt(t){return!!(t&&Mo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(bDt,"isSpecCompliantForm");var wDt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(ux(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=Uy(n)?[]:{};n3(n,(a,u)=>{const l=r(a,i+1);!t3(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var SDt=Vl("AsyncFunction");var TDt=o(t=>t&&(ux(t)||Mo(t))&&Mo(t.then)&&Mo(t.catch),"isThenable");var fe={isArray:Uy,isArrayBuffer:a7e,isBuffer:GPt,isFormData:tDt,isArrayBufferView:KPt,isString:YPt,isNumber:o7e,isBoolean:WPt,isObject:ux,isPlainObject:rx,isUndefined:t3,isDate:JPt,isFile:QPt,isBlob:XPt,isRegExp:mDt,isFunction:Mo,isStream:eDt,isURLSearchParams:rDt,isTypedArray:cDt,isFileList:ZPt,forEach:n3,merge:ZG,extend:iDt,trim:nDt,stripBOM:sDt,inherits:aDt,toFlatObject:oDt,kindOf:ax,kindOfTest:Vl,endsWith:uDt,toArray:lDt,forEachEntry:dDt,matchAll:pDt,isHTMLForm:fDt,hasOwnProperty:UTe,hasOwnProp:UTe,reduceDescriptors:d7e,freezeMethods:gDt,toObjectSet:yDt,toCamelCase:hDt,noop:vDt,toFiniteNumber:_Dt,findKey:u7e,global:l7e,isContextDefined:c7e,ALPHABET:p7e,generateString:EDt,isSpecCompliantForm:bDt,toJSONObject:wDt,isAsyncFn:SDt,isThenable:TDt};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 f7e=nt.prototype;var h7e={};["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=>{h7e[t]={value:t}});Object.defineProperties(nt,h7e);Object.defineProperty(f7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(f7e);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 eK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(eK,"isVisitable");function m7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(m7e,"removeBrackets");function BTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=m7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(BTe,"renderKey");function ADt(t){return fe.isArray(t)&&!t.some(eK)}o(ADt,"isFlatArray");var xDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function lx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(i7e["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)&&ADt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=m7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?BTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(eK(m)){return true}e.append(BTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(xDt,{defaultVisitor:d,convertValue:c,isVisitable:eK});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(lx,"toFormData");function MTe(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(MTe,"encode$1");function g7e(t,e){this._pairs=[];t&&lx(t,this,e)}o(g7e,"AxiosURLSearchParams");var y7e=g7e.prototype;y7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");y7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,MTe)}:MTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function CDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(CDt,"encode");function cK(t,e,r){if(!e){return t}const n=r&&r.encode||CDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new g7e(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(cK,"buildURL");var tK=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 VTe=tK;var dK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var RDt=UPt["default"].URLSearchParams;var ODt={isNode:true,classes:{URLSearchParams:RDt,FormData:i7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var v7e=typeof window!=="undefined"&&typeof document!=="undefined";var NDt=(t=>{return v7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var IDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var PDt=Object.freeze({__proto__:null,hasBrowserEnv:v7e,hasStandardBrowserWebWorkerEnv:IDt,hasStandardBrowserEnv:NDt});var Bo={...PDt,...ODt};function DDt(t,e){return lx(t,new Bo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Bo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(DDt,"toURLEncodedForm");function kDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(kDt,"parsePropPath");function $Dt(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($Dt,"arrayToObject");function _7e(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]=$Dt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(kDt(n),i,r,0)});return r}return null}o(_7e,"formDataToJSON");function LDt(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(LDt,"stringifySafely");var pK={transitional:dK,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(_7e(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 DDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return lx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return LDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||pK.transitional;const n=r&&r.forcedJSONParsing;const i=this.responseType==="json";if(e&&fe.isString(e)&&(n&&!this.responseType||i)){const s=r&&r.silentJSONParsing;const a=!s&&i;try{return JSON.parse(e)}catch(u){if(a){if(u.name==="SyntaxError"){throw nt.from(u,nt.ERR_BAD_RESPONSE,this,null,this.response)}throw u}}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bo.classes.FormData,Blob:Bo.classes.Blob},validateStatus:o(function t(e){return e>=200&&e<300},"validateStatus"),headers:{common:{"Accept":"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{pK.headers[t]={}});var fK=pK;var qDt=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]&&qDt[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 HTe=Symbol("internals");function Z6(t){return t&&String(t).trim().toLowerCase()}o(Z6,"normalizeHeader");function nx(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(nx):String(t)}o(nx,"normalizeValue");function UDt(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(UDt,"parseTokens");var FDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function JG(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(JG,"matchHeaderValue");function BDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(BDt,"formatHeader");function MDt(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(MDt,"buildAccessors");var Ly=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=Z6(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]=nx(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())&&!FDt(e)){a(jDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=Z6(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return UDt(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=Z6(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||JG(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=Z6(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||JG(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||JG(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]=nx(i);delete r[s];return}const u=e?BDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=nx(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[HTe]=this[HTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=Z6(a);if(!n[u]){MDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};Ly.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(Ly.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods(Ly);var Vo=Ly;function QG(t,e){const r=this||fK;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(QG,"transformData");function E7e(t){return!!(t&&t.__CANCEL__)}o(E7e,"isCancel");function Dm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Dm,"CanceledError");fe.inherits(Dm,nt,{__CANCEL__:true});function e3(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(e3,"settle");function VDt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(VDt,"isAbsoluteURL");function HDt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(HDt,"combineURLs");function hK(t,e){if(t&&!VDt(e)){return HDt(t,e)}return e}o(hK,"buildFullPath");var sx="1.6.2";function b7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(b7e,"parseProtocol");var zDt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function GDt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=b7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=zDt.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(GDt,"fromDataURI");function KDt(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(KDt,"throttle");function w7e(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(w7e,"speedometer");var tx=Symbol("internals");var rK=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[tx]={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=w7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=KDt(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[tx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[tx];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[tx].length=+e;return this}};var zTe=rK;var{asyncIterator:GTe}=Symbol;var YDt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[GTe]){yield*t[GTe]()}else{yield t}},"readBlob");var S7e=YDt;var WDt=fe.ALPHABET.ALPHA_DIGIT+"-_";var r3=new r7e.TextEncoder;var ff="\r\n";var JDt=r3.encode(ff);var QDt=2;var nK=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=r3.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=r3.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+QDt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*S7e(e)}yield JDt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var XDt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,WDt)}=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=r3.encode("--"+s+ff);const u=r3.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new nK(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 n7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var ZDt=XDt;var iK=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 ekt=iK;var tkt=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 rkt=tkt;var KTe={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var nkt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var YTe=fe.isFunction(hf["default"].createBrotliDecompress);var{http:ikt,https:skt}=VPt["default"];var akt=/https:?/;var WTe=Bo.protocols.map(t=>{return t+":"});function okt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(okt,"dispatchBeforeRedirect");function T7e(t,e,r){let n=e;if(!n&&n!==false){const i=DPt.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){T7e(s,e,s.href)},"beforeRedirect")}o(T7e,"setProxy");var ukt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var lkt=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 ckt=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 JTe=o((t,e)=>ckt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var dkt=ukt&&o(function t(e){return lkt(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=rkt(u,Ae=>fe.isArray(Ae)?Ae:[Ae]);u=o((Ae,we,Pe)=>{ue(Ae,we,(Ue,$e,ge)=>{const Je=fe.isArray($e)?$e.map(Le=>JTe(Le)):[JTe($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new HPt["default"];const y=o(()=>{if(e.cancelToken){e.cancelToken.unsubscribe(v)}if(e.signal){e.signal.removeEventListener("abort",v)}g.removeAllListeners()},"onFinished");s((ue,Ae)=>{f=true;if(Ae){h=true;y()}});function v(ue){g.emit("abort",!ue||ue.type?new Dm(null,e,m):ue)}o(v,"abort");g.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(v);if(e.signal){e.signal.aborted?v():e.signal.addEventListener("abort",v)}}const w=hK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||WTe[0];if(b==="data:"){let ue;if(p!=="GET"){return e3(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=GDt(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(Ae){throw nt.from(Ae,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 e3(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(WTe.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/"+sx,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=ZDt(a,Ae=>{S.set(Ae)},{tag:`axios-${sx}-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 MPt["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(S7e(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 zTe({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 Ae=e.auth.password||"";j=ue+":"+Ae}if(!j&&E.username){const ue=E.username;const Ae=E.password;j=ue+":"+Ae}j&&S.delete("authorization");let Q;try{Q=cK(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ue){const Ae=new Error(ue.message);Ae.config=e;Ae.url=e.url;Ae.exists=true;return i(Ae)}S.set("Accept-Encoding","gzip, compress, deflate"+(YTe?", br":""),false);const ae={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:b,family:l,beforeRedirect:okt,beforeRedirects:{}};!fe.isUndefined(u)&&(ae.lookup=u);if(e.socketPath){ae.socketPath=e.socketPath}else{ae.hostname=E.hostname;ae.port=E.port;T7e(ae,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+ae.path)}let Te;const le=akt.test(ae.protocol);ae.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?BPt["default"]:FPt["default"]}else{if(e.maxRedirects){ae.maxRedirects=e.maxRedirects}if(e.beforeRedirect){ae.beforeRedirects.config=e.beforeRedirect}Te=le?skt:ikt}if(e.maxBodyLength>-1){ae.maxBodyLength=e.maxBodyLength}else{ae.maxBodyLength=Infinity}if(e.insecureHTTPParser){ae.insecureHTTPParser=e.insecureHTTPParser}m=Te.request(ae,o(function ue(Ae){if(m.destroyed)return;const we=[Ae];const Pe=+Ae.headers["content-length"];if(T){const Le=new zTe({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(F)});T&&Le.on("progress",Ie=>{T(Object.assign(Ie,{download:true}))});we.push(Le)}let Ue=Ae;const $e=Ae.req||m;if(e.decompress!==false&&Ae.headers["content-encoding"]){if(p==="HEAD"||Ae.statusCode===204){delete Ae.headers["content-encoding"]}switch((Ae.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":we.push(hf["default"].createUnzip(KTe));delete Ae.headers["content-encoding"];break;case"deflate":we.push(new ekt);we.push(hf["default"].createUnzip(KTe));delete Ae.headers["content-encoding"];break;case"br":if(YTe){we.push(hf["default"].createBrotliDecompress(nkt));delete Ae.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:Ae.statusCode,statusText:Ae.statusMessage,headers:new Vo(Ae.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;e3(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))}e3(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(Ae){i(nt.from(Ae,null,e,m))},"handleRequestError"));m.on("socket",o(function ue(Ae){Ae.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 Ae(){if(f)return;let we=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const Pe=e.transitional||dK;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 Ae=false;a.on("end",()=>{ue=true});a.once("error",we=>{Ae=true;m.destroy(we)});a.on("close",()=>{if(!ue&&!Ae){v(new Dm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var pkt=Bo.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];fe.isNumber(r)&&a.push("expires="+new Date(r).toGMTString());fe.isString(n)&&a.push("path="+n);fe.isString(i)&&a.push("domain="+i);s===true&&a.push("secure");document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var fkt=Bo.hasStandardBrowserEnv?o(function t(){const e=/(msie|trident)/i.test(navigator.userAgent);const r=document.createElement("a");let n;function i(s){let a=s;if(e){r.setAttribute("href",a);a=r.href}r.setAttribute("href",a);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}o(i,"resolveURL");n=i(window.location.href);return o(function s(a){const u=fe.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():o(function t(){return o(function e(){return true},"isURLSameOrigin")},"nonStandardBrowserEnv")();function QTe(t,e){let r=0;const n=w7e(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(QTe,"progressEventReducer");var hkt=typeof XMLHttpRequest!=="undefined";var mkt=hkt&&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(Bo.hasStandardBrowserEnv||Bo.hasStandardBrowserWebWorkerEnv){s.setContentType(false)}else if((d=s.getContentType())!==false){const[g,...y]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"";const y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=hK(t.baseURL,t.url);p.open(t.method.toUpperCase(),cK(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};e3(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||dK;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Bo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&fkt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&pkt.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",QTe(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",QTe(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Dm(null,t,p):g);p.abort();p=null},"onCanceled");t.cancelToken&&t.cancelToken.subscribe(l);if(t.signal){t.signal.aborted?l():t.signal.addEventListener("abort",l)}}const m=b7e(f);if(m&&Bo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var sK={http:dkt,xhr:mkt};fe.forEach(sK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var XTe=o(t=>`- ${t}`,"renderReason");var gkt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var A7e={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(!gkt(r)){n=sK[(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(XTe).join("\n"):" "+XTe(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:sK};function XG(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Dm(null,t)}}o(XG,"throwIfCancellationRequested");function ZTe(t){XG(t);t.headers=Vo.from(t.headers);t.data=QG.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=A7e.getAdapter(t.adapter||fK.adapter);return e(t).then(o(function r(n){XG(t);n.data=QG.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!E7e(n)){XG(t);if(n&&n.response){n.response.data=QG.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(ZTe,"dispatchRequest");var e7e=o(t=>t instanceof Vo?t.toJSON():t,"headersToObject");function qy(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(e7e(c),e7e(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(qy,"mergeConfig");var mK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{mK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var t7e={};mK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+sx+"] 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&&!t7e[a]){t7e[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 ykt(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(ykt,"assertOptions");var aK={assertOptions:ykt,validators:mK};var df=aK.validators;var jy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new VTe,response:new VTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=qy(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){aK.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{aK.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=[ZTe.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=ZTe.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=qy(this.defaults,e);const r=hK(e.baseURL,e.url);return cK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){jy.prototype[e]=function(r,n){return this.request(qy(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(qy(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");jy.prototype[e]=r();jy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var ix=jy;var oK=class t{static{o(this,"CancelToken")}constructor(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}let r;this.promise=new Promise(o(function i(s){r=s},"promiseExecutor"));const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;while(s-- >0){n._listeners[s](i)}n._listeners=null});this.promise.then=i=>{let s;const a=new Promise(u=>{n.subscribe(u);s=u}).then(i);a.cancel=o(function u(){n.unsubscribe(s)},"reject");return a};e(o(function i(s,a,u){if(n.reason){return}n.reason=new Dm(s,a,u);r(n.reason)},"cancel"))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const r=this._listeners.indexOf(e);if(r!==-1){this._listeners.splice(r,1)}}static source(){let e;const r=new t(o(function n(i){e=i},"executor"));return{token:r,cancel:e}}};var vkt=oK;function _kt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(_kt,"spread");function Ekt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Ekt,"isAxiosError");var uK={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(uK).forEach(([t,e])=>{uK[e]=t});var bkt=uK;function x7e(t){const e=new ix(t);const r=s7e(ix.prototype.request,e);fe.extend(r,ix.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return x7e(qy(t,i))},"create");return r}o(x7e,"createInstance");var fi=x7e(fK);fi.Axios=ix;fi.CanceledError=Dm;fi.CancelToken=vkt;fi.isCancel=E7e;fi.VERSION=sx;fi.toFormData=lx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=_kt;fi.isAxiosError=Ekt;fi.mergeConfig=qy;fi.AxiosHeaders=Vo;fi.formToJSON=t=>_7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=A7e.getAdapter;fi.HttpStatusCode=bkt;fi.default=fi;C7e.exports=fi});var px=_(dx=>{"use strict";Object.defineProperty(dx,"__esModule",{value:true});dx.CredentialsMethod=void 0;var R7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(R7e||(dx.CredentialsMethod=R7e={}))});var $m=_(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:true});hi.FgaRequiredParamError=hi.FgaValidationError=hi.FgaApiAuthenticationError=hi.FgaApiInternalError=hi.FgaApiRateLimitExceededError=hi.FgaApiNotFoundError=hi.FgaApiValidationError=hi.FgaApiError=hi.FgaError=void 0;var Fy=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=Fy;function hx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(hx,"getRequestMetadataFromPath");var O7e="fga-request-id";function wK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(wK,"getResponseHeaders");var km=class extends Fy{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}=hx((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=wK(e);this.requestId=g[O7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=km;var gK=class extends km{static{o(this,"FgaApiValidationError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiValidationError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:p}=hx((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=gK;var yK=class extends km{static{o(this,"FgaApiNotFoundError")}constructor(e,r){var n,i,s,a,u,l,c;super(e);this.name="FgaApiNotFoundError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;this.message=r?r:((a=(s=e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)?`FGA API NotFound Error: ${(u=e.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=e.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:e.message}};hi.FgaApiNotFoundError=yK;var vK=class extends km{static{o(this,"FgaApiRateLimitExceededError")}constructor(e,r){var n,i,s;super(e);this.name="FgaApiRateLimitExceededError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:a}=hx((s=e.request)===null||s===void 0?void 0:s.path);const u=wK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=vK;var _K=class extends km{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=hx((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=_K;var EK=class extends Fy{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=wK(e);this.requestId=f[O7e];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=EK;var fx=class extends Fy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=fx;var bK=class extends fx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=bK});var i3=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var wkt=$m();var Skt=o(function(t,e,r){if(r===null||r===void 0){throw new wkt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=Skt;var Tkt=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=Tkt;var Akt=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=Akt});var TK=_(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:true});By.Configuration=By.GetDefaultRetryParams=void 0;var s3=px();var SK=$m();var mx=i3();var xkt=15;var Ckt=100;var Rkt="openfga-sdk js/0.3.0";function Okt(t=xkt,e=Ckt){return{maxRetry:t,minWaitInMs:e}}o(Okt,"GetDefaultRetryParams");By.GetDefaultRetryParams=Okt;var gx=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 s3.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case s3.CredentialsMethod.ClientCredentials:this.credentials={method:s3.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case s3.CredentialsMethod.None:default:this.credentials={method:s3.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"]=Rkt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,mx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,mx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,mx.isWellFormedUriString)(this.getBasePath())){throw new SK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,mx.isWellFormedUlidString)(this.storeId)){throw new SK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new SK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};By.Configuration=gx;gx.sdkVersion="0.3.0"});var N7e=_(yx=>{"use strict";Object.defineProperty(yx,"__esModule",{value:true});yx.assertNever=void 0;function Nkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Nkt,"assertNever");yx.assertNever=Nkt});var I7e=_(vx=>{"use strict";Object.defineProperty(vx,"__esModule",{value:true});vx.chunkArray=void 0;function Ikt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Ikt,"chunkArray");vx.chunkArray=Ikt});var D7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var _x=require("crypto");function P7e(){if(typeof _x.randomUUID==="function"){return(0,_x.randomUUID)()}if(typeof _x.randomBytes==="function"){return(0,_x.randomBytes)(20).toString("hex")}return}o(P7e,"generateRandomId");My.generateRandomId=P7e;function Pkt(){return P7e()||"00000000-0000-0000-0000-000000000000"}o(Pkt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Pkt});var k7e=_(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:true});Ex.setHeaderIfNotSet=void 0;function Dkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Dkt,"setHeaderIfNotSet");Ex.setHeaderIfNotSet=Dkt});var $7e=_(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:true});bx.setNotEnumerableProperty=void 0;function kkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(kkt,"setNotEnumerableProperty");bx.setNotEnumerableProperty=kkt});var AK=_(Pu=>{"use strict";var $kt=Pu&&Pu.__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 a3=Pu&&Pu.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))$kt(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:true});a3(N7e(),Pu);a3(I7e(),Pu);a3(D7e(),Pu);a3(k7e(),Pu);a3($7e(),Pu)});var CK=_(yi=>{"use strict";var xK=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 Lkt=wx();var Lm=$m();var qkt=AK();yi.DUMMY_BASE_URL="https://example.com";var jkt=o(function(t,e){return xK(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 Ukt=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=Ukt;var Fkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Bkt=o(function(t,e){const r=typeof t!=="string";const n=r?Fkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Bkt;var Mkt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Mkt;function Vkt(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(Vkt,"isAxiosError");function Hkt(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(Hkt,"randomTime");function L7e(t,e,r){var n;return xK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!Vkt(s)){throw new Lm.FgaError(s)}const a=(n=s===null||s===void 0?void 0:s.response)===null||n===void 0?void 0:n.status;if(a===400||a===422){throw new Lm.FgaApiValidationError(s)}else if(a===401||a===403){throw new Lm.FgaApiAuthenticationError(s)}else if(a===404){throw new Lm.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new Lm.FgaApiRateLimitExceededError(s)}else{throw new Lm.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,Hkt(i,e.minWaitInMs)))}else{throw new Lm.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(L7e,"attemptHttpRequest");yi.attemptHttpRequest=L7e;var zkt=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=Lkt.Credentials.init(r)}return(c=e)=>xK(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 L7e(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,qkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=zkt});var j7e=_(Vy=>{"use strict";var RK=Vy&&Vy.__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(Vy,"__esModule",{value:true});Vy.Credentials=void 0;var q7e=cx();var gf=i3();var OK=$m();var Gkt=CK();var Ho=px();var NK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=q7e.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 OK.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 RK(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 RK(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 RK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,Gkt.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},q7e.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 OK.FgaApiError){n.constructor=OK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};Vy.Credentials=NK});var wx=_(yf=>{"use strict";var Kkt=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 U7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Kkt(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});U7e(j7e(),yf);U7e(px(),yf)});var PK=_(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:true});Sx.BaseAPI=void 0;var Ykt=cx();var Wkt=require("http");var Jkt=require("https");var F7e=TK();var Qkt=wx();var Xkt=1e4;var IK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof F7e.Configuration){this.configuration=e}else{this.configuration=new F7e.Configuration(e)}this.configuration.isValid();this.credentials=Qkt.Credentials.init(this.configuration);if(!this.axios){const i=new Wkt.Agent({keepAlive:true});const s=new Jkt.Agent({keepAlive:true});this.axios=Ykt.default.create({httpAgent:i,httpsAgent:s,timeout:Xkt,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}};Sx.BaseAPI=IK});var kK=_(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=cx();var Zkt=PK();var We=CK();var Vn=i3();var e$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=e$t;var t$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=t$t;var r$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=r$t;var DK=class extends Zkt.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=DK});var M7e=_((bmr,B7e)=>{async function*n$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(n$t,"asyncPool");B7e.exports=n$t});var V7e=_(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 $K=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 LK=M7e();var i$t=kK();var s$t=PK();var qK=$m();var Ta=AK();var a$t=i3();var jK=10;var Hy="X-OpenFGA-Client-Method";var UK="X-OpenFGA-Client-Bulk-Request-Id";var zy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(zy||(Hl.ClientWriteStatus=zy={}));var FK=class extends s$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new i$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,a$t.isWellFormedUlidString)(r)){throw new qK.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 qK.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,Ta.setHeaderIfNotSet)(n,Hy,"ReadLatestAuthorizationModel");const i=yield this.readAuthorizationModels(Object.assign(Object.assign({},e),{pageSize:1,headers:n}));const s=i;s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0];delete s.authorization_models;return s})}readChanges(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.readChanges(e.type,r.pageSize,r.continuationToken,r)})}read(e={},r={}){return Hn(this,void 0,void 0,function*(){const n={page_size:r.pageSize,continuation_token:r.continuationToken};if(e.user||e.object||e.relation){n.tuple_key=e}return this.api.read(n,r)})}write(e,r={}){return Hn(this,void 0,void 0,function*(){const{transaction:n={},headers:i={}}=r;const{maxPerChunk:s=1,maxParallelRequests:a=jK}=n;const{writes:u,deletes:l}=e;const c=this.getAuthorizationModelId(r);if(!(n===null||n===void 0?void 0:n.disable)){const d={authorization_model_id:c};if(u===null||u===void 0?void 0:u.length){d.writes={tuple_keys:u}}if(l===null||l===void 0?void 0:l.length){d.deletes={tuple_keys:l}}yield this.api.write(d,r);return{writes:(u===null||u===void 0?void 0:u.map(p=>({tuple_key:p,status:zy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:zy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Ta.setHeaderIfNotSet)(i,Hy,"Write");(0,Ta.setHeaderIfNotSet)(i,UK,(0,Ta.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=$K(LK(a,(0,Ta.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:zy.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=$K(LK(a,(0,Ta.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:zy.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,Ta.setHeaderIfNotSet)(n,Hy,"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,Ta.setHeaderIfNotSet)(n,Hy,"DeleteTuples");return this.write({deletes:e},Object.assign(Object.assign({},r),{headers:n}))})}check(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:e.user,relation:e.relation,object:e.object},context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(e,r={}){return Hn(this,void 0,void 0,function*(){return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var n,i,s,a;const{headers:u={},maxParallelRequests:l=jK}=r;(0,Ta.setHeaderIfNotSet)(u,Hy,"BatchCheck");(0,Ta.setHeaderIfNotSet)(u,UK,(0,Ta.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=$K(LK(l,e,h=>this.check(h,Object.assign(Object.assign({},r),{headers:u})).then(m=>{m._request=h;return m}).catch(m=>{return{allowed:void 0,error:m,_request:h}}))),f;f=yield p.next(),n=f.done,!n;d=true){a=f.value;d=false;const h=a;c.push(h)}}catch(h){i={error:h}}finally{try{if(!d&&!n&&(s=p.return))yield s.call(p)}finally{if(i)throw i.error}}return{responses:c}}))(),this.checkValidApiConnection(r)]).then(n=>n[0])})}expand(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:e},r)})}listObjects(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:e.user,relation:e.relation,type:e.type,context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]}},r)})}listRelations(e,r={}){return Hn(this,void 0,void 0,function*(){const{user:n,object:i,relations:s,contextualTuples:a,context:u}=e;const{headers:l={},maxParallelRequests:c=jK}=r;(0,Ta.setHeaderIfNotSet)(l,Hy,"ListRelations");(0,Ta.setHeaderIfNotSet)(l,UK,(0,Ta.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new qK.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=FK});var J7e=_(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:true});Aa.TypeName=Aa.TupleOperation=Aa.NullValue=Aa.NotFoundErrorCode=Aa.InternalErrorCode=Aa.ErrorCode=void 0;var H7e;(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"})(H7e||(Aa.ErrorCode=H7e={}));var z7e;(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"})(z7e||(Aa.InternalErrorCode=z7e={}));var G7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(G7e||(Aa.NotFoundErrorCode=G7e={}));var K7e;(function(t){t["NullValue"]="NULL_VALUE"})(K7e||(Aa.NullValue=K7e={}));var Y7e;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(Y7e||(Aa.TupleOperation=Y7e={}));var W7e;(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"})(W7e||(Aa.TypeName=W7e={}))});var Z7e=_($i=>{"use strict";var o$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 Tx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))o$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Tx(kK(),$i);Tx(V7e(),$i);Tx(J7e(),$i);var Q7e=TK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return Q7e.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return Q7e.GetDefaultRetryParams}});var X7e=wx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return X7e.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return X7e.CredentialsMethod}});Tx($m(),$i)});var tAe=_(Gy=>{"use strict";var u$t=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.OpenFGAService=void 0;var o3=u$t(za());var eAe=Z7e();var l$t=Oy();var BK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!o3.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=o3.default.OPENFGA_SERVICE_URL;this.apiHost=o3.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=o3.default.OPENFGA_STORE_ID;this.modelId=o3.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,l$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new eAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:eAe.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}}};Gy.OpenFGAService=BK});var iAe=_(Ky=>{"use strict";var nAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.TenantService=void 0;var c$t=nAe(Vu());var rAe=nAe(za());var d$t=ZA();var p$t=new c$t.default({max:500,maxAge:1e3*60*50});var MK=class extends d$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!rAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(rAe.default.TENANT_API_URL,p$t,{userSub:n,logger:e.log,requestId:e.id})}};Ky.TenantService=MK});var sAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function f$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(f$t,"sizeInBytes");zl.sizeInBytes=f$t;function h$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(h$t,"snakeCase");zl.snakeCase=h$t;function m$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(m$t,"kebabCase");zl.kebabCase=m$t;function g$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(g$t,"validateHostname");zl.validateHostname=g$t});var uAe=_(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 VK;(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})(VK||(G.TypeRegistry=VK={}));var Du=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Du;var aAe;(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})(aAe||(G.FormatRegistry=aAe={}));var Me;(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})(Me||(G.ValueGuard=Me={}));var HK=class extends Du{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=HK;var Y;(function(t){function e(x){try{new RegExp(x);return true}catch{return false}}o(e,"IsPattern");function r(x){if(!Me.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 Me.IsUndefined(x)||Me.IsBigInt(x)}o(i,"IsOptionalBigInt");function s(x){return Me.IsUndefined(x)||Me.IsNumber(x)}o(s,"IsOptionalNumber");function a(x){return Me.IsUndefined(x)||Me.IsBoolean(x)}o(a,"IsOptionalBoolean");function u(x){return Me.IsUndefined(x)||Me.IsString(x)}o(u,"IsOptionalString");function l(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)&&e(x)}o(l,"IsOptionalPattern");function c(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)}o(c,"IsOptionalFormat");function d(x){return Me.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)&&Me.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)&&Me.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")&&(Me.IsString(x.type)&&x.type!=="object"?false:true)&&Me.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 Me.IsObject(x)&&G.Kind in x&&Me.IsString(x[G.Kind])}o(A,"TKind");t.TKind=A;function P(x){return V(x)&&Me.IsString(x.const)}o(P,"TLiteralString");t.TLiteralString=P;function D(x){return V(x)&&Me.IsNumber(x.const)}o(D,"TLiteralNumber");t.TLiteralNumber=D;function F(x){return V(x)&&Me.IsBoolean(x.const)}o(F,"TLiteralBoolean");t.TLiteralBoolean=F;function V(x){return T(x,"Literal")&&u(x.$id)&&(Me.IsBoolean(x.const)||Me.IsNumber(x.const)||Me.IsString(x.const))}o(V,"TLiteral");t.TLiteral=V;function j(x){return T(x,"Never")&&Me.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 ae(x){return T(x,"Null")&&x.type==="null"&&u(x.$id)}o(ae,"TNull");t.TNull=ae;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)&&Me.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 Ae(x){return T(x,"Record")&&x.type==="object"&&u(x.$id)&&n(x.additionalProperties)&&Me.IsObject(x.patternProperties)&&(ie=>{const ce=Object.getOwnPropertyNames(ie.patternProperties);return ce.length===1&&e(ce[0])&&Me.IsObject(ie.patternProperties)&&J(ie.patternProperties[ce[0]])})(x)}o(Ae,"TRecord");t.TRecord=Ae;function we(x){return Me.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)&&Me.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"&&Me.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)&&Me.IsString(x.$ref)}o(Je,"TThis");t.TThis=Je;function Le(x){return Me.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)&&Me.IsNumber(x.minItems)&&Me.IsNumber(x.maxItems)&&x.minItems===x.maxItems&&(Me.IsUndefined(x.items)&&Me.IsUndefined(x.additionalItems)&&x.minItems===0||Me.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)&&Me.IsObject(x)&&Me.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 Me.IsObject(x)&&x[G.Readonly]==="Readonly"}o(K,"TReadonly");t.TReadonly=K;function se(x){return Me.IsObject(x)&&x[G.Optional]==="Optional"}o(se,"TOptional");t.TOptional=se;function J(x){return Me.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)||ae(x)||Te(x)||le(x)||ue(x)||Ae(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)&&VK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var oAe;(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})(oAe||(G.ExtendsUndefined=oAe={}));var Ax=class extends Du{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Ax;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var qm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new Ax(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)&&Me.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)&&Me.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 ae(U){return ge(U)}o(ae,"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 Ae(U){return Q(U,0)}o(Ae,"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)&&ae($)||Y.TLiteralNumber(U)&&le($)||Y.TLiteralBoolean(U)&&ue($)||Y.TSymbol(U)&&Te($)||Y.TBigInt(U)&&Ae($)||Y.TString(U)&&ae($)||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)&&Me.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:Me.IsUndefined(U.items)&&!Me.IsUndefined($.items)||!Me.IsUndefined(U.items)&&Me.IsUndefined($.items)?Ee.False:Me.IsUndefined(U.items)&&!Me.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})(qm||(G.TypeExtends=qm={}));var ct;(function(t){function e(a){const u=Object.getOwnPropertyNames(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});const l=Object.getOwnPropertySymbols(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});return{...u,...l}}o(e,"ObjectType");function r(a){return a.map(u=>n(u))}o(r,"ArrayType");function n(a){return Me.IsArray(a)?r(a):Me.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 zK;(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 Me.IsUndefined(g)?G.Type.Never():G.Type.Union([g])}o(c,"TObject");function d(h,m){const g=h.items;if(Me.IsUndefined(g))return G.Type.Never();const y=g[m];if(Me.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})(zK||(G.IndexedAccessor=zK={}));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 xx;(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})(xx||(G.KeyResolver=xx={}));var Cx=class extends Du{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Cx;var u3;(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 Cx("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(u3||(G.KeyArrayResolver=u3={}));var GK;(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})(GK||(G.UnionResolver=GK={}));var Rx=class extends Du{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Rx;var Ox;(function(t){function e(s){throw new Rx(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})(Ox||(G.TemplateLiteralPattern=Ox={}));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 l3=class extends Du{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=l3;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 l3(`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 l3(`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 Nx=class extends Du{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Nx;var Qy;(function(t){function e(a){throw new Nx(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 Ix=class extends Du{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Ix;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 Ix("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var KK;(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})(KK||(G.TemplateLiteralDslParser=KK={}));var Px=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new Dx(this.schema,e)}};G.TransformDecodeBuilder=Px;var Dx=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=Dx;var y$t=0;var kx=class extends Du{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=kx;var $x=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new kx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=$x;var c3=class extends $x{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=xx.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=>Me.IsString(s)?{[G.Kind]:"Literal",type:"string",const:s}:{[G.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[G.Kind]:"Union",anyOf:i})}Extends(e,r,n,i,s={}){switch(qm.Extends(e,r)){case Ee.Union:return this.Union([ct.Type(n,s),ct.Type(i,s)]);case Ee.True:return ct.Type(n,s);case Ee.False:return ct.Type(i,s)}}Exclude(e,r,n={}){return Y.TTemplateLiteral(e)?this.Exclude(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?ct.Type(e,n):this.Never(n)}Index(e,r,n={}){return Y.TArray(e)&&Y.TNumber(r)?(()=>{return ct.Type(e.items,n)})():Y.TTuple(e)&&Y.TNumber(r)?(()=>{const i=Me.IsUndefined(e.items)?[]:e.items;const s=i.map(a=>ct.Type(a));return this.Union(s,n)})():(()=>{const i=u3.Resolve(r);const s=ct.Type(e);return zK.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=Me.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=xx.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=u3.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.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=u3.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.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=GK.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 Me.IsString(e.const)||Me.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=Me.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(Me.IsUndefined(r.$id))r.$id=`T${y$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(Me.IsString(e))return this.Create({...r,[G.Kind]:"Ref",$ref:e});if(Me.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)&&!Me.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=Me.IsString(e)?Ox.Create(KK.Parse(e)):Ox.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Px(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=c3;var Lx=class extends c3{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=Me.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=Lx;G.JsonType=new c3;G.Type=new Lx});var lAe=_(qx=>{"use strict";Object.defineProperty(qx,"__esModule",{value:true});qx.CustomTypeBuilder=void 0;var d3=uAe();var YK=class extends d3.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return d3.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return d3.Type.Union([e,d3.Type.Null()])}static StringEnum(e){return d3.Type.Unsafe({type:"string",enum:e})}};qx.CustomTypeBuilder=YK});var fAe=_(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 jx(t){return typeof t==="string"}o(jx,"isString");lt.isString=jx;function v$t(t){return Array.isArray(t)&&t.every(e=>jx(e))}o(v$t,"isStringArray");lt.isStringArray=v$t;function cAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(cAe,"isObject");lt.isObject=cAe;function _$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(_$t,"isTypedArray");lt.isTypedArray=_$t;function dAe(t){return typeof t==="number"&&!isNaN(t)}o(dAe,"isNumber");lt.isNumber=dAe;function E$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(E$t,"isIterable");lt.isIterable=E$t;function b$t(t){return t===true||t===false}o(b$t,"isBoolean");lt.isBoolean=b$t;function WK(t){return typeof t==="undefined"}o(WK,"isUndefined");lt.isUndefined=WK;function w$t(t){return!Zy(t)}o(w$t,"isDefined");lt.isDefined=w$t;function Zy(t){return WK(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function S$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(S$t,"assertType");lt.assertType=S$t;function T$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(T$t,"assertIsDefined");lt.assertIsDefined=T$t;function A$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(A$t,"assertAllDefined");lt.assertAllDefined=A$t;var x$t=Object.prototype.hasOwnProperty;function C$t(t){if(!cAe(t)){return false}for(const e in t){if(x$t.call(t,e)){return false}}return true}o(C$t,"isEmptyObject");lt.isEmptyObject=C$t;function JK(t){return typeof t==="function"}o(JK,"isFunction");lt.isFunction=JK;function R$t(...t){return t.length>0&&t.every(JK)}o(R$t,"areFunctions");lt.areFunctions=R$t;function O$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){pAe(t[n],e[n])}}o(O$t,"validateConstraints");lt.validateConstraints=O$t;function pAe(t,e){if(jx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(JK(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(pAe,"validateConstraint");lt.validateConstraint=pAe;function N$t(t){return t===null?void 0:t}o(N$t,"withNullAsUndefined");lt.withNullAsUndefined=N$t;function I$t(t){return typeof t==="undefined"?null:t}o(I$t,"withUndefinedAsNull");lt.withUndefinedAsNull=I$t;var p3=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=p3;var f3=class extends p3{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=f3;var h3=class extends p3{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=h3;function P$t(t,e){if(WK(t)){throw new f3(e)}return true}o(P$t,"throwIfUndefined");lt.throwIfUndefined=P$t;function QK(t,e){if(Zy(t)){throw new f3(e)}}o(QK,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=QK;function D$t(t,e){QK(t,e);if(!jx(t)){throw new h3(e,"string")}return true}o(D$t,"throwIfNotString");lt.throwIfNotString=D$t;function k$t(t,e){QK(t,e);if(!dAe(t)){throw new h3(e,"number")}return true}o(k$t,"throwIfNotNumber");lt.throwIfNotNumber=k$t});var g3=_(xe=>{"use strict";var hAe=xe&&xe.__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 $$t=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Ux=xe&&xe.__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))hAe(e,t,r)}$$t(e,t);return e};var vf=xe&&xe.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))hAe(e,t,r)};Object.defineProperty(xe,"__esModule",{value:true});xe.getRequiredEnvVar=xe.env=xe.EnvironmentalVariableRequiredError=xe.xfs=xe.RouteValidator=xe.JsonValidator=xe.TenantService=xe.OpenFGAService=xe.DevApiService=xe.getContentApiStorageTarballPath=xe.contentApiTarballFileName=xe.ContentApiService=xe.AuthApiService=xe.getServiceAccountIdToken=xe.createApiKeyServiceClient=xe.ApiKeyService=xe.RouteVersions=xe.startsWithReservedKeyword=xe.logger=xe.createNewLogger=xe.graphQL=xe.CloudStorage=xe.fly=xe.ApiServer=xe.featureFlagsPlugin=xe.ensureZuploUserPlugin=xe.ensureZuploAdminPlugin=xe.ensureServiceAccountPlugin=xe.apiKeyAuthPlugin=xe.errorHandler=xe.DeploymentLogState=xe.signString=xe.FeatureFlags=xe.VALID_COMPATIBILITY_DATES=xe.DEFAULT_COMPATIBILITY_DATE=xe.COMPATIBILITY_FLAG_MAPPINGS=xe.WARNING_STATUS=xe.WARNING_SEVERITY=xe.GOOD_STATUS=xe.FAILURE_STATUS=xe.ERROR_SEVERITY=xe.BuildIssueError=xe.hasBlockedNotifications=xe.getDefaultFlags=xe.getBuildFlagsForDeployment=xe.CommonAuth=void 0;var XK=Ux(za());xe.env=XK.default;Object.defineProperty(xe,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return XK.EnvironmentalVariableRequiredError}});Object.defineProperty(xe,"getRequiredEnvVar",{enumerable:true,get:function(){return XK.getRequiredEnvVar}});vf(As(),xe);var L$t=eC();Object.defineProperty(xe,"CommonAuth",{enumerable:true,get:function(){return L$t.CommonAuth}});var ZK=OY();Object.defineProperty(xe,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return ZK.getBuildFlagsForDeployment}});Object.defineProperty(xe,"getDefaultFlags",{enumerable:true,get:function(){return ZK.getDefaultFlags}});Object.defineProperty(xe,"hasBlockedNotifications",{enumerable:true,get:function(){return ZK.hasBlockedNotifications}});var e2=NY();Object.defineProperty(xe,"BuildIssueError",{enumerable:true,get:function(){return e2.BuildIssueError}});Object.defineProperty(xe,"ERROR_SEVERITY",{enumerable:true,get:function(){return e2.ERROR_SEVERITY}});Object.defineProperty(xe,"FAILURE_STATUS",{enumerable:true,get:function(){return e2.FAILURE_STATUS}});Object.defineProperty(xe,"GOOD_STATUS",{enumerable:true,get:function(){return e2.GOOD_STATUS}});Object.defineProperty(xe,"WARNING_SEVERITY",{enumerable:true,get:function(){return e2.WARNING_SEVERITY}});Object.defineProperty(xe,"WARNING_STATUS",{enumerable:true,get:function(){return e2.WARNING_STATUS}});var q$t=IY();Object.defineProperty(xe,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return q$t.COMPATIBILITY_FLAG_MAPPINGS}});var mAe=kY();Object.defineProperty(xe,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return mAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(xe,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return mAe.VALID_COMPATIBILITY_DATES}});var j$t=tC();Object.defineProperty(xe,"FeatureFlags",{enumerable:true,get:function(){return j$t.FeatureFlags}});var U$t=$Y();Object.defineProperty(xe,"signString",{enumerable:true,get:function(){return U$t.signString}});vf(LY(),xe);var F$t=iC();Object.defineProperty(xe,"DeploymentLogState",{enumerable:true,get:function(){return F$t.DeploymentLogState}});vf(HY(),xe);vf(sC(),xe);var B$t=aC();Object.defineProperty(xe,"errorHandler",{enumerable:true,get:function(){return B$t.errorHandler}});var m3=dC();Object.defineProperty(xe,"apiKeyAuthPlugin",{enumerable:true,get:function(){return m3.apiKeyAuthPlugin}});Object.defineProperty(xe,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return m3.ensureServiceAccountPlugin}});Object.defineProperty(xe,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return m3.ensureZuploAdminPlugin}});Object.defineProperty(xe,"ensureZuploUserPlugin",{enumerable:true,get:function(){return m3.ensureZuploUserPlugin}});Object.defineProperty(xe,"featureFlagsPlugin",{enumerable:true,get:function(){return m3.featureFlagsPlugin}});var M$t=tge();Object.defineProperty(xe,"ApiServer",{enumerable:true,get:function(){return M$t.ApiServer}});xe.fly=Ux(ige());xe.CloudStorage=Ux(G6e());var V$t=K6e();Object.defineProperty(xe,"graphQL",{enumerable:true,get:function(){return V$t.graphQL}});vf(y5e(),xe);var gAe=_j();Object.defineProperty(xe,"createNewLogger",{enumerable:true,get:function(){return gAe.createNewLogger}});Object.defineProperty(xe,"logger",{enumerable:true,get:function(){return gAe.logger}});var H$t=lH();Object.defineProperty(xe,"startsWithReservedKeyword",{enumerable:true,get:function(){return H$t.startsWithReservedKeyword}});var z$t=v5e();Object.defineProperty(xe,"RouteVersions",{enumerable:true,get:function(){return z$t.RouteVersions}});var yAe=MSe();Object.defineProperty(xe,"ApiKeyService",{enumerable:true,get:function(){return yAe.ApiKeyService}});Object.defineProperty(xe,"createApiKeyServiceClient",{enumerable:true,get:function(){return yAe.createApiKeyServiceClient}});var G$t=Oy();Object.defineProperty(xe,"getServiceAccountIdToken",{enumerable:true,get:function(){return G$t.getServiceAccountIdToken}});var K$t=HSe();Object.defineProperty(xe,"AuthApiService",{enumerable:true,get:function(){return K$t.AuthApiService}});var eY=YSe();Object.defineProperty(xe,"ContentApiService",{enumerable:true,get:function(){return eY.ContentApiService}});Object.defineProperty(xe,"contentApiTarballFileName",{enumerable:true,get:function(){return eY.contentApiTarballFileName}});Object.defineProperty(xe,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return eY.getContentApiStorageTarballPath}});var Y$t=QSe();Object.defineProperty(xe,"DevApiService",{enumerable:true,get:function(){return Y$t.DevApiService}});var W$t=tAe();Object.defineProperty(xe,"OpenFGAService",{enumerable:true,get:function(){return W$t.OpenFGAService}});var J$t=iAe();Object.defineProperty(xe,"TenantService",{enumerable:true,get:function(){return J$t.TenantService}});vf(sAe(),xe);vf(lAe(),xe);vf(fAe(),xe);var Q$t=O7();Object.defineProperty(xe,"JsonValidator",{enumerable:true,get:function(){return Q$t.JsonValidator}});var X$t=mH();Object.defineProperty(xe,"RouteValidator",{enumerable:true,get:function(){return X$t.RouteValidator}});xe.xfs=Ux(fM())});var y3=_(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:true});t2.runPlugins=t2.PluginResult=void 0;var tY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};t2.PluginResult=tY;async function Z$t(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(Z$t,"runPlugins");t2.runPlugins=Z$t});var _Ae=_((Mmr,vAe)=>{"use strict";function eLt(t){return t>=55296&&t<=56319}o(eLt,"isHighSurrogate");function tLt(t){return t>=56320&&t<=57343}o(tLt,"isLowSurrogate");vAe.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(eLt(a)&&tLt(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 bAe=_((Hmr,EAe)=>{"use strict";var rLt=_Ae();var nLt=Buffer.byteLength.bind(Buffer);EAe.exports=rLt.bind(null,nLt)});var wAe=_(r2=>{"use strict";var iLt=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.sanitize=void 0;var sLt=iLt(bAe());var aLt=/[/?<>\\:*|"]/g;var oLt=/[\x00-\x1f\x80-\x9f]/g;var uLt=/^\.+$/;var lLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var cLt=/[. ]+$/;function dLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(aLt,e).replace(oLt,e).replace(uLt,e).replace(lLt,e).replace(cLt,e);return(0,sLt.default)(r,255)}o(dLt,"sanitize");r2.sanitize=dLt});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 xAe=_(n2=>{"use strict";var AAe=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.createProjectDirs=void 0;var SAe=AAe(require("fs/promises"));var pLt=AAe(require("path"));var v3=Gl();var TAe=y3();var fLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[v3.USER_MODULES_DIR_NAME,v3.USER_CONFIG_DIR_NAME,v3.USER_TEST_DIR_NAME,v3.USER_SCHEMAS_DIR_NAME,v3.USER_DOCS_DIR_NAME,".vscode"];try{await SAe.default.mkdir(t);for(const n of r){await SAe.default.mkdir(pLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new TAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new TAe.PluginResult},"createProjectDirs");n2.createProjectDirs=fLt});var CAe=_(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:true});var Fx=require("perf_hooks");var rY=[];async function hLt(t,e){const r=Fx.performance.timerify(e);const n=new Fx.PerformanceObserver(i=>{const s=i.getEntries()[0];rY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(hLt,"timeFn");var mLt={mark:t=>{Fx.performance.mark(t)},measure:(t,e,r)=>{Fx.performance.measure(t,e,r)},timeFn:hLt,report:()=>{if(rY.length>0){console.table(rY)}}};nY.default=mLt});var IAe=_(i2=>{"use strict";var NAe=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFromTemplate=void 0;var gLt=require("fs");var RAe=NAe(require("fs/promises"));var OAe=NAe(require("path"));async function yLt(t){const e=OAe.default.resolve(__dirname,"..","templates",t);if((0,gLt.existsSync)(e)){const r=await RAe.default.readFile(e,"utf-8");return r}else{const r=OAe.default.resolve(__dirname,"templates",t);const n=await RAe.default.readFile(r,"utf-8");return n}}o(yLt,"generateFromTemplate");i2.generateFromTemplate=yLt});var xa=_(s2=>{"use strict";var iY=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateFileFromTemplate=void 0;var vLt=g3();var _Lt=iY(require("fs/promises"));var ELt=iY(require("path"));var bLt=iY(CAe());var wLt=IAe();var SLt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return bLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=ELt.default.join(r,t);if(await vLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return TLt(i,e,n)})}},"generateFileFromTemplate");s2.generateFileFromTemplate=SLt;async function TLt(t,e,r){const n=await(0,wLt.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(TLt,"writeTemplate")});var DAe=_(a2=>{"use strict";var ALt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsMarkdown=void 0;var xLt=ALt(require("path"));var PAe=Gl();var CLt=xa();a2.generateDefaultDocsMarkdown=(0,CLt.generateFileFromTemplate)(xLt.default.join(PAe.USER_DOCS_DIR_NAME,PAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var $Ae=_(o2=>{"use strict";var RLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsSidebar=void 0;var OLt=RLt(require("path"));var kAe=Gl();var NLt=xa();o2.generateDefaultDocsSidebar=(0,NLt.generateFileFromTemplate)(OLt.default.join(kAe.USER_DOCS_DIR_NAME,kAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var qAe=_(u2=>{"use strict";var ILt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultDocsTheme=void 0;var PLt=ILt(require("path"));var LAe=Gl();var DLt=xa();u2.generateDefaultDocsTheme=(0,DLt.generateFileFromTemplate)(PLt.default.join(LAe.USER_DOCS_DIR_NAME,LAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var UAe=_(l2=>{"use strict";var kLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDefaultModule=void 0;var $Lt=kLt(require("path"));var jAe=Gl();var LLt=xa();l2.generateDefaultModule=(0,LLt.generateFileFromTemplate)($Lt.default.join(jAe.USER_MODULES_DIR_NAME,jAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var BAe=_(c2=>{"use strict";var qLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateDevPortalConfigJson=void 0;var jLt=qLt(require("path"));var FAe=Gl();var ULt=xa();c2.generateDevPortalConfigJson=(0,ULt.generateFileFromTemplate)(jLt.default.join(FAe.USER_CONFIG_DIR_NAME,FAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var MAe=_(Bx=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:true});Bx.generateEnvironment=void 0;var FLt=xa();Bx.generateEnvironment=(0,FLt.generateFileFromTemplate)(".env","env.template")});var VAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.generateESLint=void 0;var BLt=xa();Mx.generateESLint=(0,BLt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var HAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generateGitignore=void 0;var MLt=xa();Vx.generateGitignore=(0,MLt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var zAe=_(d2=>{"use strict";var VLt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateLaunchJson=void 0;var HLt=VLt(require("path"));var zLt=xa();d2.generateLaunchJson=(0,zLt.generateFileFromTemplate)(HLt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var GAe=_(p2=>{"use strict";var GLt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateSettingsJson=void 0;var KLt=GLt(require("path"));var YLt=xa();p2.generateSettingsJson=(0,YLt.generateFileFromTemplate)(KLt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var YAe=_(f2=>{"use strict";var WLt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generateRouteOasConfig=void 0;var JLt=WLt(require("path"));var KAe=Gl();var QLt=xa();f2.generateRouteOasConfig=(0,QLt.generateFileFromTemplate)(JLt.default.join(KAe.USER_CONFIG_DIR_NAME,KAe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var XAe=_(zo=>{"use strict";var WAe=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 XLt=g3();var JAe=WAe(require("fs/promises"));var sY=WAe(require("path"));async function ZLt(t,e=XLt.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=QAe();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(ZLt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=ZLt;function QAe(){const t=sY.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(QAe,"getPackageOverrides");zo.getPackageOverrides=QAe;async function eqt(t){const e=sY.default.join(t,"package.json");const r=await JAe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(eqt,"getProjectPackageJson");zo.getProjectPackageJson=eqt;async function tqt(t,e){const r=sY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await JAe.default.writeFile(r,n,"utf-8")}o(tqt,"updateProjectPackageJson");zo.updateProjectPackageJson=tqt});var txe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generatePackageJson=void 0;var ZAe=XAe();var exe=y3();var rqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,ZAe.generateDefaultPackageJson)(e);try{await(0,ZAe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new exe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new exe.PluginResult},"generatePackageJson");Hx.generatePackageJson=rqt});var nxe=_(h2=>{"use strict";var nqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generatePoliciesConfig=void 0;var iqt=nqt(require("path"));var rxe=Gl();var sqt=xa();h2.generatePoliciesConfig=(0,sqt.generateFileFromTemplate)(iqt.default.join(rxe.USER_CONFIG_DIR_NAME,rxe.POLICIES_CONFIG_FILE),"policies.template.json")});var ixe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generateTSConfig=void 0;var aqt=xa();zx.generateTSConfig=(0,aqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var axe=_(m2=>{"use strict";var oqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.generateZuploJson=void 0;var uqt=g3();var lqt=require("fs/promises");var cqt=oqt(require("path"));var dqt=Gl();var sxe=y3();var pqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:uqt.DEFAULT_COMPATIBILITY_DATE};const i=cqt.default.join(e,dqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,lqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new sxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new sxe.PluginResult},"generateZuploJson");m2.generateZuploJson=pqt});var uxe=_(g2=>{"use strict";var fqt=g2&&g2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(g2,"__esModule",{value:true});g2.create=void 0;var aY=g3();var hqt=require("fs/promises");var mqt=fqt(require("path"));var gqt=y3();var oxe=wAe();var yqt=xAe();var vqt=DAe();var _qt=$Ae();var Eqt=qAe();var bqt=UAe();var wqt=BAe();var Sqt=MAe();var Tqt=VAe();var Aqt=HAe();var xqt=zAe();var Cqt=GAe();var Rqt=YAe();var Oqt=txe();var Nqt=nxe();var Iqt=ixe();var Pqt=axe();async function Dqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,oxe.sanitize)(t);const s=(0,oxe.sanitize)(e);const a=mqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await aY.xfs.dirExists(a)){throw new aY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:aY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[yqt.createProjectDirs,Rqt.generateRouteOasConfig,Pqt.generateZuploJson,wqt.generateDevPortalConfigJson,bqt.generateDefaultModule,_qt.generateDefaultDocsSidebar,vqt.generateDefaultDocsMarkdown,Eqt.generateDefaultDocsTheme,Nqt.generatePoliciesConfig]);l.push(...[Iqt.generateTSConfig,Aqt.generateGitignore,Oqt.generatePackageJson,Sqt.generateEnvironment,Tqt.generateESLint,xqt.generateLaunchJson,Cqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,gqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,hqt.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(Dqt,"create");g2.create=Dqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var kqt=uxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return kqt.create}});
|
|
410
|
+
`+await t.crypto.sha256DigestHex(h);const y=await bNt(t.crypto,t.securityCredentials.secretAccessKey,a,t.region,n);const v=await z6(t.crypto,y,g);const w=`${ESe} Credential=${t.securityCredentials.accessKeyId}/${m}, SignedHeaders=${p}, Signature=${(0,bSe.fromArrayBufferToHex)(v)}`;return{amzDate:u.date?void 0:s,authorizationHeader:w,canonicalQuerystring:t.canonicalQuerystring}}o(wNt,"generateAuthenticationHeaderMap")});var cG=_(qA=>{"use strict";Object.defineProperty(qA,"__esModule",{value:true});qA.AwsClient=void 0;var SNt=wSe();var TNt=lf();var G6=class extends TNt.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 SNt.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}};qA.AwsClient=G6;G6.AWS_EC2_METADATA_IPV4_ADDRESS="169.254.169.254";G6.AWS_EC2_METADATA_IPV6_ADDRESS="fd00:ec2::254"});var mG=_(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 jA="urn:ietf:params:oauth:token-type:saml2";var dG="urn:ietf:params:oauth:token-type:id_token";var pG="urn:ietf:params:oauth:token-type:jwt";var fG=class{static{o(this,"ExecutableResponse")}constructor(e){if(!e.version){throw new UA("Executable response must contain a 'version' field.")}if(e.success===void 0){throw new FA("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!==jA&&this.tokenType!==dG&&this.tokenType!==pG){throw new BA(`Executable response must contain a 'token_type' field when successful and it must be one of ${dG}, ${pG}, or ${jA}.`)}if(this.tokenType===jA){if(!e.saml_response){throw new K6(`Executable response must contain a 'saml_response' field when token_type=${jA}.`)}this.subjectToken=e.saml_response}else{if(!e.id_token){throw new K6(`Executable response must contain a 'id_token' field when token_type=${dG} or ${pG}.`)}this.subjectToken=e.id_token}}else{if(!e.code){throw new MA("Executable response must contain a 'code' field when unsuccessful.")}if(!e.message){throw new VA("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=fG;var Bl=class extends Error{static{o(this,"ExecutableResponseError")}constructor(e){super(e);Object.setPrototypeOf(this,new.target.prototype)}};pi.ExecutableResponseError=Bl;var UA=class extends Bl{static{o(this,"InvalidVersionFieldError")}};pi.InvalidVersionFieldError=UA;var FA=class extends Bl{static{o(this,"InvalidSuccessFieldError")}};pi.InvalidSuccessFieldError=FA;var hG=class extends Bl{static{o(this,"InvalidExpirationTimeFieldError")}};pi.InvalidExpirationTimeFieldError=hG;var BA=class extends Bl{static{o(this,"InvalidTokenTypeFieldError")}};pi.InvalidTokenTypeFieldError=BA;var MA=class extends Bl{static{o(this,"InvalidCodeFieldError")}};pi.InvalidCodeFieldError=MA;var VA=class extends Bl{static{o(this,"InvalidMessageFieldError")}};pi.InvalidMessageFieldError=VA;var K6=class extends Bl{static{o(this,"InvalidSubjectTokenError")}};pi.InvalidSubjectTokenError=K6});var SSe=_(HA=>{"use strict";Object.defineProperty(HA,"__esModule",{value:true});HA.PluggableAuthHandler=void 0;var ANt=zA();var Om=mG();var xNt=require("child_process");var gG=require("fs");var yG=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=xNt.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 ANt.ExecutableError(s,u.toString()))}})})}async retrieveCachedResponse(){if(!this.outputFile||this.outputFile.length===0){return void 0}let e;try{e=await gG.promises.realpath(this.outputFile)}catch(n){return void 0}if(!(await gG.promises.lstat(e)).isFile()){return void 0}const r=await gG.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}};HA.PluggableAuthHandler=yG});var zA=_(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:true});Ty.PluggableAuthClient=Ty.ExecutableError=void 0;var CNt=lf();var RNt=mG();var ONt=SSe();var GA=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)}};Ty.ExecutableError=GA;var NNt=30*1e3;var TSe=5*1e3;var ASe=120*1e3;var INt="GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES";var xSe=1;var vG=class extends CNt.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=NNt}else{this.timeoutMillis=e.credential_source.executable.timeout_millis;if(this.timeoutMillis<TSe||this.timeoutMillis>ASe){throw new Error(`Timeout must be between ${TSe} and ${ASe} milliseconds.`)}}this.outputFile=e.credential_source.executable.output_file;this.handler=new ONt.PluggableAuthHandler({command:this.command,timeoutMillis:this.timeoutMillis,outputFile:this.outputFile})}async retrieveSubjectToken(){if(process.env[INt]!=="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>xSe){throw new Error(`Version of executable is not currently supported, maximum supported version is ${xSe}.`)}if(!e.success){throw new GA(e.errorMessage,e.errorCode)}if(this.outputFile){if(!e.expirationTime){throw new RNt.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}};Ty.PluggableAuthClient=vG});var EG=_(KA=>{"use strict";Object.defineProperty(KA,"__esModule",{value:true});KA.ExternalAccountClient=void 0;var PNt=lf();var DNt=uG();var kNt=cG();var $Nt=zA();var _G=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===PNt.EXTERNAL_ACCOUNT_TYPE){if((n=e.credential_source)===null||n===void 0?void 0:n.environment_id){return new kNt.AwsClient(e,r)}else if((i=e.credential_source)===null||i===void 0?void 0:i.executable){return new $Nt.PluggableAuthClient(e,r)}else{return new DNt.IdentityPoolClient(e,r)}}else{return null}}};KA.ExternalAccountClient=_G});var RSe=_(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:true});Ay.ExternalAccountAuthorizedUserClient=Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE=void 0;var LNt=iy();var CSe=Qz();var qNt=Wc();var jNt=require("stream");var UNt=lf();Ay.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE="external_account_authorized_user";var bG=class extends CSe.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 qNt.GaxiosError&&a.response){throw(0,CSe.getErrorFromOAuthErrorResponse)(a.response.data,a)}throw a}}};var wG=class extends LNt.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 bG(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=UNt.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 jNt.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}};Ay.ExternalAccountAuthorizedUserClient=wG});var ISe=_(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:true});Cy.GoogleAuth=Cy.CLOUD_SDK_CLIENT_ID=void 0;var FNt=require("child_process");var Y6=require("fs");var SG=F7();var BNt=require("os");var TG=require("path");var MNt=ry();var VNt=R6();var HNt=DH();var zNt=$H();var GNt=LH();var xy=zz();var AG=Kz();var YA=Wz();var KNt=EG();var W6=lf();var OSe=RSe();Cy.CLOUD_SDK_CLIENT_ID="764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com";var NSe={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 WA=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===NSe.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(NSe.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 xy.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 xy.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 HNt.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 SG.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=TG.join(i,".config")}}if(r){r=TG.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!==YA.IMPERSONATED_ACCOUNT_TYPE){throw new Error(`The incoming JSON object does not have the "${YA.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 AG.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 YA.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===AG.USER_REFRESH_ACCOUNT_TYPE){n=new AG.UserRefreshClient(r);n.fromJSON(e)}else if(e.type===YA.IMPERSONATED_ACCOUNT_TYPE){n=this.fromImpersonatedJSON(e)}else if(e.type===W6.EXTERNAL_ACCOUNT_TYPE){n=KNt.ExternalAccountClient.fromJSON(e,r);n.scopes=this.getAnyScopes()}else if(e.type===OSe.EXTERNAL_ACCOUNT_AUTHORIZED_USER_TYPE){n=new OSe.ExternalAccountAuthorizedUserClient(e,r)}else{r.scopes=this.scopes;n=new xy.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 xy.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 xy.JWT(r);n.fromAPIKey(e);return n}_isWindows(){const e=BNt.platform();if(e&&e.length>=3){if(e.substring(0,3).toLowerCase()==="win"){return true}}return false}async getDefaultServiceProjectId(){return new Promise(e=>{(0,FNt.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 SG.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 SG.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=TG.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 zNt.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,GNt.getEnv)()}async sign(e){const r=await this.getClient();const n=(0,MNt.createCrypto)();if(r instanceof xy.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}};Cy.GoogleAuth=WA;WA.DefaultTransporter=VNt.DefaultTransporter});var PSe=_(JA=>{"use strict";Object.defineProperty(JA,"__esModule",{value:true});JA.IAMAuth=void 0;var xG=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}}};JA.IAMAuth=xG});var DSe=_(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:true});Nu.DownscopedClient=Nu.EXPIRATION_TIME_OFFSET=Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=void 0;var YNt=require("stream");var WNt=iy();var JNt=Zz();var QNt="urn:ietf:params:oauth:grant-type:token-exchange";var XNt="urn:ietf:params:oauth:token-type:access_token";var ZNt="urn:ietf:params:oauth:token-type:access_token";var eIt="https://sts.googleapis.com/v1/token";Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT=10;Nu.EXPIRATION_TIME_OFFSET=5*60*1e3;var CG=class extends WNt.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>Nu.MAX_ACCESS_BOUNDARY_RULES_COUNT){throw new Error(`The provided access boundary has more than ${Nu.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 JNt.StsCredentials(eIt);this.cachedDownscopedAccessToken=null;if(typeof(n===null||n===void 0?void 0:n.eagerRefreshThresholdMillis)!=="number"){this.eagerRefreshThresholdMillis=Nu.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 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(){var e;const r=(await this.authClient.getAccessToken()).token;const n={grantType:QNt,requestedTokenType:XNt,subjectToken:r,subjectTokenType:ZNt};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}};Nu.DownscopedClient=CG});var RG=_(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 kSe=ISe();Object.defineProperty(Ot,"GoogleAuth",{enumerable:true,get:function(){return kSe.GoogleAuth}});var tIt=iy();Object.defineProperty(Ot,"AuthClient",{enumerable:true,get:function(){return tIt.AuthClient}});var rIt=DH();Object.defineProperty(Ot,"Compute",{enumerable:true,get:function(){return rIt.Compute}});var nIt=LH();Object.defineProperty(Ot,"GCPEnv",{enumerable:true,get:function(){return nIt.GCPEnv}});var iIt=PSe();Object.defineProperty(Ot,"IAMAuth",{enumerable:true,get:function(){return iIt.IAMAuth}});var sIt=$H();Object.defineProperty(Ot,"IdTokenClient",{enumerable:true,get:function(){return sIt.IdTokenClient}});var aIt=Vz();Object.defineProperty(Ot,"JWTAccess",{enumerable:true,get:function(){return aIt.JWTAccess}});var oIt=zz();Object.defineProperty(Ot,"JWT",{enumerable:true,get:function(){return oIt.JWT}});var uIt=Wz();Object.defineProperty(Ot,"Impersonated",{enumerable:true,get:function(){return uIt.Impersonated}});var $Se=_m();Object.defineProperty(Ot,"CodeChallengeMethod",{enumerable:true,get:function(){return $Se.CodeChallengeMethod}});Object.defineProperty(Ot,"OAuth2Client",{enumerable:true,get:function(){return $Se.OAuth2Client}});var lIt=NH();Object.defineProperty(Ot,"LoginTicket",{enumerable:true,get:function(){return lIt.LoginTicket}});var cIt=Kz();Object.defineProperty(Ot,"UserRefreshClient",{enumerable:true,get:function(){return cIt.UserRefreshClient}});var dIt=cG();Object.defineProperty(Ot,"AwsClient",{enumerable:true,get:function(){return dIt.AwsClient}});var pIt=uG();Object.defineProperty(Ot,"IdentityPoolClient",{enumerable:true,get:function(){return pIt.IdentityPoolClient}});var fIt=EG();Object.defineProperty(Ot,"ExternalAccountClient",{enumerable:true,get:function(){return fIt.ExternalAccountClient}});var hIt=lf();Object.defineProperty(Ot,"BaseExternalAccountClient",{enumerable:true,get:function(){return hIt.BaseExternalAccountClient}});var mIt=DSe();Object.defineProperty(Ot,"DownscopedClient",{enumerable:true,get:function(){return mIt.DownscopedClient}});var gIt=zA();Object.defineProperty(Ot,"PluggableAuthClient",{enumerable:true,get:function(){return gIt.PluggableAuthClient}});var yIt=R6();Object.defineProperty(Ot,"DefaultTransporter",{enumerable:true,get:function(){return yIt.DefaultTransporter}});var vIt=new kSe.GoogleAuth;Ot.auth=vIt});var Oy=_(Ry=>{"use strict";var _It=Ry&&Ry.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ry,"__esModule",{value:true});Ry.getServiceAccountIdToken=void 0;var EIt=RG();var bIt=_It(Vu());var wIt=new EIt.GoogleAuth;var LSe=new bIt.default({max:50,maxAge:1e3*60*50});async function SIt(t){let e=LSe.get(t);if(!e){const r=await wIt.getIdTokenClient(t);e=await r.idTokenProvider.fetchIdToken(t);LSe.set(t,e)}return e}o(SIt,"getServiceAccountIdToken");Ry.getServiceAccountIdToken=SIt});var BSe=_(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:true});Fo.mergeHeaders=Fo.createFinalURL=Fo.defaultBodySerializer=Fo.defaultQuerySerializer=Fo.createClient=void 0;var Ny=As();var TIt=Oy();var AIt={"Content-Type":"application/json"};var xIt=/\/*$/;async function CIt(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({...AIt,"zuplo-user":c,"zp-rid":l,...a.headers??{}});const p=await(0,TIt.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??qSe,bodySerializer:b=i??jSe,...S}=m||{};const T=USe(h,{baseUrl:e,params:v,querySerializer:E});const A=FSe(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 Ny.ApiError(F)}throw new Ny.ApiError(Ny.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 Ny.ApiError(F)}}catch(V){}throw new Ny.ApiError(Ny.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(CIt,"createClient");Fo.createClient=CIt;function qSe(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(qSe,"defaultQuerySerializer");Fo.defaultQuerySerializer=qSe;function jSe(t){return JSON.stringify(t)}o(jSe,"defaultBodySerializer");Fo.defaultBodySerializer=jSe;function USe(t,e){let r=`${e.baseUrl?e.baseUrl.replace(xIt,""):""}${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(USe,"createFinalURL");Fo.createFinalURL=USe;function FSe(...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(FSe,"mergeHeaders");Fo.mergeHeaders=FSe});var MSe=_(cf=>{"use strict";var RIt=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 Iy=As();var OIt=RG();var QA=RIt(za());var NIt=BSe();async function IIt(t){return(0,NIt.createClient)({baseUrl:QA.default.API_KEY_MANAGEMENT_SERVICE_URL,zuploExtensions:{fastifyRequest:t}})}o(IIt,"createApiKeyServiceClient");cf.createApiKeyServiceClient=IIt;var OG=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 OIt.GoogleAuth;const i=await n.getIdTokenClient(QA.default.API_KEY_MANAGEMENT_SERVICE_URL);this.logger.info(`Payload to send: ${JSON.stringify({url:`${QA.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:`${QA.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 Iy.ApiError(u)}throw new Iy.ApiError(Iy.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 Iy.ApiError(u)}this.logger.error(`Error not handled on api-key-service: path: ${e}, status: ${a.status}`);throw new Iy.ApiError(Iy.Problems.INTERNAL_SERVER_ERROR)}if(a.status===204){return{}}return a.data}};cf.ApiKeyService=OG});var HSe=_(Py=>{"use strict";var PIt=Py&&Py.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Py,"__esModule",{value:true});Py.AuthApiService=void 0;var Nm=As();var VSe=PIt(za());var DIt=Oy();var NG=class{static{o(this,"AuthApiService")}logger;requestId;baseUrl;constructor(e){this.logger=e.log;this.requestId=e.id;if(!VSe.default.AUTH_API_URL){throw new Error("AUTH_API_URL is not set")}this.baseUrl=VSe.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,DIt.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()}};Py.AuthApiService=NG});var ZA=_(XA=>{"use strict";Object.defineProperty(XA,"__esModule",{value:true});XA.ApiServiceClient=void 0;var Dy=As();var kIt=Oy();var IG=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,kIt.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 Dy.ApiError(s)}throw new Dy.ApiError(Dy.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 Dy.ApiError(s)}this.logger.error(`Error not handled on internal api: path: ${e}, status: ${i.status}`);throw new Dy.ApiError(Dy.Problems.INTERNAL_SERVER_ERROR)}if(i.status===204){return{}}return i.clone().json()}};XA.ApiServiceClient=IG});var YSe=_(Ml=>{"use strict";var GSe=Ml&&Ml.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ml,"__esModule",{value:true});Ml.ContentApiService=Ml.getContentApiStorageTarballPath=Ml.contentApiTarballFileName=void 0;var $It=GSe(Vu());var zSe=GSe(za());var LIt=ZA();var qIt=new $It.default({max:500,maxAge:1e3*60*50});function KSe(t,e){return`${t}--${e}.tar.gz`}o(KSe,"contentApiTarballFileName");Ml.contentApiTarballFileName=KSe;function jIt(t,e){const r=KSe(t,e);return`${t}/builds/${r}`}o(jIt,"getContentApiStorageTarballPath");Ml.getContentApiStorageTarballPath=jIt;var PG=class extends LIt.ApiServiceClient{static{o(this,"ContentApiService")}constructor(e){if(!zSe.default.CONTENT_API_URL){throw new Error("CONTENT_API_URL is not set")}super(zSe.default.CONTENT_API_URL,qIt,e)}};Ml.ContentApiService=PG});var QSe=_(ky=>{"use strict";var JSe=ky&&ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(ky,"__esModule",{value:true});ky.DevApiService=void 0;var UIt=JSe(Vu());var WSe=JSe(za());var FIt=ZA();var BIt=new UIt.default({max:500,maxAge:1e3*60*50});var DG=class extends FIt.ApiServiceClient{static{o(this,"DevApiService")}constructor(e,r){if(!WSe.default.DEV_API_URL){throw new Error("DEV_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(WSe.default.DEV_API_URL,BIt,{userSub:n,logger:e.log,requestId:e.id})}};ky.DevApiService=DG});var eTe=_((hhr,ZSe)=>{var XSe=require("stream").Stream;var MIt=require("util");ZSe.exports=Iu;function Iu(){this.source=null;this.dataSize=0;this.maxDataSize=1024*1024;this.pauseStream=true;this._maxDataSizeExceeded=false;this._released=false;this._bufferedEvents=[]}o(Iu,"DelayedStream");MIt.inherits(Iu,XSe);Iu.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(Iu.prototype,"readable",{configurable:true,enumerable:true,get:function(){return this.source.readable}});Iu.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Iu.prototype.resume=function(){if(!this._released){this.release()}this.source.resume()};Iu.prototype.pause=function(){this.source.pause()};Iu.prototype.release=function(){this._released=true;this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this));this._bufferedEvents=[]};Iu.prototype.pipe=function(){var t=XSe.prototype.pipe.apply(this,arguments);this.resume();return t};Iu.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)};Iu.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 iTe=_((ghr,nTe)=>{var VIt=require("util");var rTe=require("stream").Stream;var tTe=eTe();nTe.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");VIt.inherits(Xn,rTe);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 tTe)){var r=tTe.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){rTe.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 aTe=_((vhr,sTe)=>{sTe.exports=HIt;function HIt(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(HIt,"defer")});var kG=_((Ehr,uTe)=>{var oTe=aTe();uTe.exports=zIt;function zIt(t){var e=false;oTe(function(){e=true});return o(function r(n,i){if(e){t(n,i)}else{oTe(o(function s(){t(n,i)},"nextTick_callback"))}},"async_callback")}o(zIt,"async")});var $G=_((whr,lTe)=>{lTe.exports=GIt;function GIt(t){Object.keys(t.jobs).forEach(KIt.bind(t));t.jobs={}}o(GIt,"abort");function KIt(t){if(typeof this.jobs[t]=="function"){this.jobs[t]()}}o(KIt,"clean")});var LG=_((Thr,dTe)=>{var cTe=kG();var YIt=$G();dTe.exports=WIt;function WIt(t,e,r,n){var i=r["keyedList"]?r["keyedList"][r.index]:r.index;r.jobs[i]=JIt(e,i,t[i],function(s,a){if(!(i in r.jobs)){return}delete r.jobs[i];if(s){YIt(r)}else{r.results[i]=a}n(s,r.results)})}o(WIt,"iterate");function JIt(t,e,r,n){var i;if(t.length==2){i=t(r,cTe(n))}else{i=t(r,e,cTe(n))}return i}o(JIt,"runJob")});var qG=_((xhr,pTe)=>{pTe.exports=QIt;function QIt(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(QIt,"state")});var jG=_((Rhr,fTe)=>{var XIt=$G();var ZIt=kG();fTe.exports=ePt;function ePt(t){if(!Object.keys(this.jobs).length){return}this.index=this.size;XIt(this);ZIt(t)(null,this.results)}o(ePt,"terminator")});var mTe=_((Nhr,hTe)=>{var tPt=LG();var rPt=qG();var nPt=jG();hTe.exports=iPt;function iPt(t,e,r){var n=rPt(t);while(n.index<(n["keyedList"]||t).length){tPt(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 nPt.bind(n,r)}o(iPt,"parallel")});var UG=_((Phr,ex)=>{var gTe=LG();var sPt=qG();var aPt=jG();ex.exports=oPt;ex.exports.ascending=yTe;ex.exports.descending=uPt;function oPt(t,e,r,n){var i=sPt(t,r);gTe(t,e,i,o(function s(a,u){if(a){n(a,u);return}i.index++;if(i.index<(i["keyedList"]||t).length){gTe(t,e,i,s);return}n(null,i.results)},"iteratorHandler"));return aPt.bind(i,n)}o(oPt,"serialOrdered");function yTe(t,e){return t<e?-1:t>e?1:0}o(yTe,"ascending");function uPt(t,e){return-1*yTe(t,e)}o(uPt,"descending")});var _Te=_((khr,vTe)=>{var lPt=UG();vTe.exports=cPt;function cPt(t,e,r){return lPt(t,e,null,r)}o(cPt,"serial")});var bTe=_((Lhr,ETe)=>{ETe.exports={parallel:mTe(),serial:_Te(),serialOrdered:UG()}});var STe=_((qhr,wTe)=>{wTe.exports=function(t,e){Object.keys(e).forEach(function(r){t[r]=t[r]||e[r]});return t}});var xTe=_((jhr,ATe)=>{var VG=iTe();var TTe=require("util");var FG=require("path");var dPt=require("http");var pPt=require("https");var fPt=require("url").parse;var hPt=require("fs");var mPt=require("stream").Stream;var BG=TB();var gPt=bTe();var MG=STe();ATe.exports=Fr;TTe.inherits(Fr,VG);function Fr(t){if(!(this instanceof Fr)){return new Fr(t)}this._overheadLength=0;this._valueLength=0;this._valuesToMeasure=[];VG.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=VG.prototype.append.bind(this);if(typeof e=="number"){e=""+e}if(TTe.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 mPt)){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{hPt.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"){MG(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=FG.normalize(e.filepath).replace(/\\/g,"/")}else if(e.filename||t.name||t.path){r=FG.basename(e.filename||t.name||t.path)}else if(t.readable&&t.hasOwnProperty("httpVersion")){r=FG.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=BG.lookup(t.name)}if(!r&&t.path){r=BG.lookup(t.path)}if(!r&&t.readable&&t.hasOwnProperty("httpVersion")){r=t.headers["content-type"]}if(!r&&(e.filepath||e.filename)){r=BG.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}gPt.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=fPt(t);n=MG({port:t.port,path:t.pathname,host:t.hostname,protocol:t.protocol},i)}else{n=MG(t,i);if(!n.port){n.port=n.protocol=="https:"?443:80}}n.headers=this.getHeaders(t.headers);if(n.protocol=="https:"){r=pPt.request(n)}else{r=dPt.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 RTe=_(CTe=>{"use strict";var yPt=require("url").parse;var vPt={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var _Pt=String.prototype.endsWith||function(t){return t.length<=this.length&&this.indexOf(t,this.length-t.length)!==-1};function EPt(t){var e=typeof t==="string"?yPt(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)||vPt[r]||0;if(!bPt(n,i)){return""}var s=$y("npm_config_"+r+"_proxy")||$y(r+"_proxy")||$y("npm_config_proxy")||$y("all_proxy");if(s&&s.indexOf("://")===-1){s=r+"://"+s}return s}o(EPt,"getProxyForUrl");function bPt(t,e){var r=($y("npm_config_no_proxy")||$y("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!_Pt.call(t,s)})}o(bPt,"shouldProxy");function $y(t){return process.env[t.toLowerCase()]||process.env[t.toUpperCase()]||""}o($y,"getEnv");CTe.getProxyForUrl=EPt});var NTe=_((Mhr,OTe)=>{var J6;OTe.exports=function(){if(!J6){try{J6=Ja()("follow-redirects")}catch(t){}if(typeof J6!=="function"){J6=o(function(){},"debug")}}J6.apply(null,arguments)}});var jTe=_((Hhr,YG)=>{var Im=require("url");var HG=Im.URL;var wPt=require("http");var SPt=require("https");var DTe=require("stream").Writable;var kTe=require("assert");var $Te=NTe();var GG=["abort","aborted","connect","error","socket","timeout"];var KG=Object.create(null);GG.forEach(function(t){KG[t]=function(e,r,n){this._redirectable.emit(t,e,r,n)}});var TPt=X6("ERR_INVALID_URL","Invalid URL",TypeError);var ITe=X6("ERR_FR_REDIRECTION_FAILURE","Redirected request failed");var APt=X6("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded");var xPt=X6("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit");var CPt=X6("ERR_STREAM_WRITE_AFTER_END","write after end");function Fa(t,e){DTe.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){r._processResponse(n)};this._performRequest()}o(Fa,"RedirectableRequest");Fa.prototype=Object.create(DTe.prototype);Fa.prototype.abort=function(){qTe(this._currentRequest);this.emit("abort")};Fa.prototype.write=function(t,e,r){if(this._ending){throw new CPt}if(!Pm(t)&&!NPt(t)){throw new TypeError("data should be a string, Buffer or Uint8Array")}if(Q6(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 xPt);this.abort()}};Fa.prototype.end=function(t,e,r){if(Q6(t)){r=t;t=e=null}else if(Q6(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}};Fa.prototype.setHeader=function(t,e){this._options.headers[t]=e;this._currentRequest.setHeader(t,e)};Fa.prototype.removeHeader=function(t){delete this._options.headers[t];this._currentRequest.removeHeader(t)};Fa.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);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);return this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Fa.prototype[t]=function(e,r){return this._currentRequest[t](e,r)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Fa.prototype,t,{get:function(){return this._currentRequest[t]}})});Fa.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)}}};Fa.prototype._performRequest=function(){var t=this._options.protocol;var e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}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 GG){n.on(i,KG[i])}this._currentUrl=/^\//.test(this._options.path)?Im.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")()}};Fa.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}qTe(this._currentRequest);t.destroy();if(++this._redirectCount>this._options.maxRedirects){this.emit("error",new APt);return}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=[];zG(/^content-/i,this._options.headers)}var a=zG(/^host$/i,this._options.headers);var u=Im.parse(this._currentUrl);var l=a||u.host;var c=/^\w+:/.test(r)?this._currentUrl:Im.format(Object.assign(u,{host:l}));var d;try{d=Im.resolve(c,r)}catch(m){this.emit("error",new ITe({cause:m}));return}$Te("redirecting to",d);this._isRedirect=true;var p=Im.parse(d);Object.assign(this._options,p);if(p.protocol!==u.protocol&&p.protocol!=="https:"||p.host!==l&&!OPt(p.host,l)){zG(/^(?:authorization|cookie)$/i,this._options.headers)}if(Q6(i)){var f={headers:t.headers,statusCode:e};var h={url:c,method:s,headers:n};try{i(this._options,f,h)}catch(m){this.emit("error",m);return}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(m){this.emit("error",new ITe({cause:m}))}};function LTe(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(Pm(c)){var f;try{f=PTe(new HG(c))}catch(h){f=Im.parse(c)}if(!Pm(f.protocol)){throw new TPt({input:c})}c=f}else if(HG&&c instanceof HG){c=PTe(c)}else{p=d;d=c;c={protocol:i}}if(Q6(d)){p=d;d=null}d=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,d);d.nativeProtocols=r;if(!Pm(d.host)&&!Pm(d.hostname)){d.hostname="::1"}kTe.equal(d.protocol,i,"protocol mismatch");$Te("options",d);return new Fa(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(LTe,"wrap");function RPt(){}o(RPt,"noop");function PTe(t){var e={protocol:t.protocol,hostname:t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,hash:t.hash,search:t.search,pathname:t.pathname,path:t.pathname+t.search,href:t.href};if(t.port!==""){e.port=Number(t.port)}return e}o(PTe,"urlToOptions");function zG(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(zG,"removeMatchingHeaders");function X6(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);n.prototype.constructor=n;n.prototype.name="Error ["+t+"]";return n}o(X6,"createErrorType");function qTe(t){for(var e of GG){t.removeListener(e,KG[e])}t.on("error",RPt);t.abort()}o(qTe,"abortRequest");function OPt(t,e){kTe(Pm(t)&&Pm(e));var r=t.length-e.length-1;return r>0&&t[r]==="."&&t.endsWith(e)}o(OPt,"isSubdomain");function Pm(t){return typeof t==="string"||t instanceof String}o(Pm,"isString");function Q6(t){return typeof t==="function"}o(Q6,"isFunction");function NPt(t){return typeof t==="object"&&"length"in t}o(NPt,"isBuffer");YG.exports=LTe({http:wPt,https:SPt});YG.exports.wrap=LTe});var cx=_((Ghr,C7e)=>{"use strict";var IPt=xTe();var PPt=require("url");var DPt=RTe();var kPt=require("http");var $Pt=require("https");var r7e=require("util");var LPt=jTe();var qPt=require("zlib");var n7e=require("stream");var jPt=require("events");function td(t){return t&&typeof t==="object"&&"default"in t?t:{"default":t}}o(td,"_interopDefaultLegacy");var i7e=td(IPt);var UPt=td(PPt);var FPt=td(kPt);var BPt=td($Pt);var MPt=td(r7e);var VPt=td(LPt);var hf=td(qPt);var pf=td(n7e);var HPt=td(jPt);function s7e(t,e){return o(function r(){return t.apply(e,arguments)},"wrap")}o(s7e,"bind");var{toString:zPt}=Object.prototype;var{getPrototypeOf:lK}=Object;var ax=(t=>e=>{const r=zPt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null));var Vl=o(t=>{t=t.toLowerCase();return e=>ax(e)===t},"kindOfTest");var ox=o(t=>e=>typeof e===t,"typeOfTest");var{isArray:Uy}=Array;var t3=ox("undefined");function GPt(t){return t!==null&&!t3(t)&&t.constructor!==null&&!t3(t.constructor)&&Mo(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}o(GPt,"isBuffer");var a7e=Vl("ArrayBuffer");function KPt(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&a7e(t.buffer)}return e}o(KPt,"isArrayBufferView");var YPt=ox("string");var Mo=ox("function");var o7e=ox("number");var ux=o(t=>t!==null&&typeof t==="object","isObject");var WPt=o(t=>t===true||t===false,"isBoolean");var rx=o(t=>{if(ax(t)!=="object"){return false}const e=lK(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},"isPlainObject");var JPt=Vl("Date");var QPt=Vl("File");var XPt=Vl("Blob");var ZPt=Vl("FileList");var eDt=o(t=>ux(t)&&Mo(t.pipe),"isStream");var tDt=o(t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||Mo(t.append)&&((e=ax(t))==="formdata"||e==="object"&&Mo(t.toString)&&t.toString()==="[object FormData]"))},"isFormData");var rDt=Vl("URLSearchParams");var nDt=o(t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function n3(t,e,{allOwnKeys:r=false}={}){if(t===null||typeof t==="undefined"){return}let n;let i;if(typeof t!=="object"){t=[t]}if(Uy(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(n3,"forEach");function u7e(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(u7e,"findKey");var l7e=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();var c7e=o(t=>!t3(t)&&t!==l7e,"isContextDefined");function ZG(){const{caseless:t}=c7e(this)&&this||{};const e={};const r=o((n,i)=>{const s=t&&u7e(e,i)||i;if(rx(e[s])&&rx(n)){e[s]=ZG(e[s],n)}else if(rx(n)){e[s]=ZG({},n)}else if(Uy(n)){e[s]=n.slice()}else{e[s]=n}},"assignValue");for(let n=0,i=arguments.length;n<i;n++){arguments[n]&&n3(arguments[n],r)}return e}o(ZG,"merge");var iDt=o((t,e,r,{allOwnKeys:n}={})=>{n3(e,(i,s)=>{if(r&&Mo(i)){t[s]=s7e(i,r)}else{t[s]=i}},{allOwnKeys:n});return t},"extend");var sDt=o(t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t},"stripBOM");var aDt=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 oDt=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&&lK(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},"toFlatObject");var uDt=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 lDt=o(t=>{if(!t)return null;if(Uy(t))return t;let e=t.length;if(!o7e(e))return null;const r=new Array(e);while(e-- >0){r[e]=t[e]}return r},"toArray");var cDt=(t=>{return e=>{return t&&e instanceof t}})(typeof Uint8Array!=="undefined"&&lK(Uint8Array));var dDt=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 pDt=o((t,e)=>{let r;const n=[];while((r=t.exec(e))!==null){n.push(r)}return n},"matchAll");var fDt=Vl("HTMLFormElement");var hDt=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 UTe=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype);var mDt=Vl("RegExp");var d7e=o((t,e)=>{const r=Object.getOwnPropertyDescriptors(t);const n={};n3(r,(i,s)=>{let a;if((a=e(i,s,t))!==false){n[s]=a||i}});Object.defineProperties(t,n)},"reduceDescriptors");var gDt=o(t=>{d7e(t,(e,r)=>{if(Mo(t)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}const n=t[r];if(!Mo(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 yDt=o((t,e)=>{const r={};const n=o(i=>{i.forEach(s=>{r[s]=true})},"define");Uy(t)?n(t):n(String(t).split(e));return r},"toObjectSet");var vDt=o(()=>{},"noop");var _Dt=o((t,e)=>{t=+t;return Number.isFinite(t)?t:e},"toFiniteNumber");var WG="abcdefghijklmnopqrstuvwxyz";var FTe="0123456789";var p7e={DIGIT:FTe,ALPHA:WG,ALPHA_DIGIT:WG+WG.toUpperCase()+FTe};var EDt=o((t=16,e=p7e.ALPHA_DIGIT)=>{let r="";const{length:n}=e;while(t--){r+=e[Math.random()*n|0]}return r},"generateString");function bDt(t){return!!(t&&Mo(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}o(bDt,"isSpecCompliantForm");var wDt=o(t=>{const e=new Array(10);const r=o((n,i)=>{if(ux(n)){if(e.indexOf(n)>=0){return}if(!("toJSON"in n)){e[i]=n;const s=Uy(n)?[]:{};n3(n,(a,u)=>{const l=r(a,i+1);!t3(l)&&(s[u]=l)});e[i]=void 0;return s}}return n},"visit");return r(t,0)},"toJSONObject");var SDt=Vl("AsyncFunction");var TDt=o(t=>t&&(ux(t)||Mo(t))&&Mo(t.then)&&Mo(t.catch),"isThenable");var fe={isArray:Uy,isArrayBuffer:a7e,isBuffer:GPt,isFormData:tDt,isArrayBufferView:KPt,isString:YPt,isNumber:o7e,isBoolean:WPt,isObject:ux,isPlainObject:rx,isUndefined:t3,isDate:JPt,isFile:QPt,isBlob:XPt,isRegExp:mDt,isFunction:Mo,isStream:eDt,isURLSearchParams:rDt,isTypedArray:cDt,isFileList:ZPt,forEach:n3,merge:ZG,extend:iDt,trim:nDt,stripBOM:sDt,inherits:aDt,toFlatObject:oDt,kindOf:ax,kindOfTest:Vl,endsWith:uDt,toArray:lDt,forEachEntry:dDt,matchAll:pDt,isHTMLForm:fDt,hasOwnProperty:UTe,hasOwnProp:UTe,reduceDescriptors:d7e,freezeMethods:gDt,toObjectSet:yDt,toCamelCase:hDt,noop:vDt,toFiniteNumber:_Dt,findKey:u7e,global:l7e,isContextDefined:c7e,ALPHABET:p7e,generateString:EDt,isSpecCompliantForm:bDt,toJSONObject:wDt,isAsyncFn:SDt,isThenable:TDt};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 f7e=nt.prototype;var h7e={};["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=>{h7e[t]={value:t}});Object.defineProperties(nt,h7e);Object.defineProperty(f7e,"isAxiosError",{value:true});nt.from=(t,e,r,n,i,s)=>{const a=Object.create(f7e);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 eK(t){return fe.isPlainObject(t)||fe.isArray(t)}o(eK,"isVisitable");function m7e(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}o(m7e,"removeBrackets");function BTe(t,e,r){if(!t)return e;return t.concat(e).map(o(function n(i,s){i=m7e(i);return!r&&s?"["+i+"]":i},"each")).join(r?".":"")}o(BTe,"renderKey");function ADt(t){return fe.isArray(t)&&!t.some(eK)}o(ADt,"isFlatArray");var xDt=fe.toFlatObject(fe,{},null,o(function t(e){return/^is[A-Z]/.test(e)},"filter"));function lx(t,e,r){if(!fe.isObject(t)){throw new TypeError("target must be an object")}e=e||new(i7e["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)&&ADt(m)||(fe.isFileList(m)||fe.endsWith(g,"[]"))&&(v=fe.toArray(m))){g=m7e(g);v.forEach(o(function w(E,b){!(fe.isUndefined(E)||E===null)&&e.append(a===true?BTe([g],b,s):a===null?g:g+"[]",c(E))},"each"));return false}}if(eK(m)){return true}e.append(BTe(y,g,s),c(m));return false}o(d,"defaultVisitor");const p=[];const f=Object.assign(xDt,{defaultVisitor:d,convertValue:c,isVisitable:eK});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(lx,"toFormData");function MTe(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(MTe,"encode$1");function g7e(t,e){this._pairs=[];t&&lx(t,this,e)}o(g7e,"AxiosURLSearchParams");var y7e=g7e.prototype;y7e.append=o(function t(e,r){this._pairs.push([e,r])},"append");y7e.toString=o(function t(e){const r=e?function(n){return e.call(this,n,MTe)}:MTe;return this._pairs.map(o(function n(i){return r(i[0])+"="+r(i[1])},"each"),"").join("&")},"toString");function CDt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}o(CDt,"encode");function cK(t,e,r){if(!e){return t}const n=r&&r.encode||CDt;const i=r&&r.serialize;let s;if(i){s=i(e,r)}else{s=fe.isURLSearchParams(e)?e.toString():new g7e(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(cK,"buildURL");var tK=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 VTe=tK;var dK={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var RDt=UPt["default"].URLSearchParams;var ODt={isNode:true,classes:{URLSearchParams:RDt,FormData:i7e["default"],Blob:typeof Blob!=="undefined"&&Blob||null},protocols:["http","https","file","data"]};var v7e=typeof window!=="undefined"&&typeof document!=="undefined";var NDt=(t=>{return v7e&&["ReactNative","NativeScript","NS"].indexOf(t)<0})(typeof navigator!=="undefined"&&navigator.product);var IDt=(()=>{return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"})();var PDt=Object.freeze({__proto__:null,hasBrowserEnv:v7e,hasStandardBrowserWebWorkerEnv:IDt,hasStandardBrowserEnv:NDt});var Bo={...PDt,...ODt};function DDt(t,e){return lx(t,new Bo.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,s){if(Bo.isNode&&fe.isBuffer(r)){this.append(n,r.toString("base64"));return false}return s.defaultVisitor.apply(this,arguments)}},e))}o(DDt,"toURLEncodedForm");function kDt(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>{return e[0]==="[]"?"":e[1]||e[0]})}o(kDt,"parsePropPath");function $Dt(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($Dt,"arrayToObject");function _7e(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]=$Dt(i[a])}return!u}o(e,"buildPath");if(fe.isFormData(t)&&fe.isFunction(t.entries)){const r={};fe.forEachEntry(t,(n,i)=>{e(kDt(n),i,r,0)});return r}return null}o(_7e,"formDataToJSON");function LDt(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(LDt,"stringifySafely");var pK={transitional:dK,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(_7e(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 DDt(e,this.formSerializer).toString()}if((u=fe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return lx(u?{"files[]":e}:e,l&&new l,this.formSerializer)}}if(s||i){r.setContentType("application/json",false);return LDt(e)}return e},"transformRequest")],transformResponse:[o(function t(e){const r=this.transitional||pK.transitional;const n=r&&r.forcedJSONParsing;const i=this.responseType==="json";if(e&&fe.isString(e)&&(n&&!this.responseType||i)){const s=r&&r.silentJSONParsing;const a=!s&&i;try{return JSON.parse(e)}catch(u){if(a){if(u.name==="SyntaxError"){throw nt.from(u,nt.ERR_BAD_RESPONSE,this,null,this.response)}throw u}}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bo.classes.FormData,Blob:Bo.classes.Blob},validateStatus:o(function t(e){return e>=200&&e<300},"validateStatus"),headers:{common:{"Accept":"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{pK.headers[t]={}});var fK=pK;var qDt=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]&&qDt[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 HTe=Symbol("internals");function Z6(t){return t&&String(t).trim().toLowerCase()}o(Z6,"normalizeHeader");function nx(t){if(t===false||t==null){return t}return fe.isArray(t)?t.map(nx):String(t)}o(nx,"normalizeValue");function UDt(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(UDt,"parseTokens");var FDt=o(t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()),"isValidHeaderName");function JG(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(JG,"matchHeaderValue");function BDt(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>{return r.toUpperCase()+n})}o(BDt,"formatHeader");function MDt(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(MDt,"buildAccessors");var Ly=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=Z6(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]=nx(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())&&!FDt(e)){a(jDt(e),r)}else{e!=null&&s(r,e,n)}return this}get(e,r){e=Z6(e);if(e){const n=fe.findKey(this,e);if(n){const i=this[n];if(!r){return i}if(r===true){return UDt(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=Z6(e);if(e){const n=fe.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||JG(this,this[n],n,r)))}return false}delete(e,r){const n=this;let i=false;function s(a){a=Z6(a);if(a){const u=fe.findKey(n,a);if(u&&(!r||JG(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||JG(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]=nx(i);delete r[s];return}const u=e?BDt(s):String(s).trim();if(u!==s){delete r[s]}r[u]=nx(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[HTe]=this[HTe]={accessors:{}};const n=r.accessors;const i=this.prototype;function s(a){const u=Z6(a);if(!n[u]){MDt(i,a);n[u]=true}}o(s,"defineAccessor");fe.isArray(e)?e.forEach(s):s(e);return this}};Ly.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors(Ly.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});fe.freezeMethods(Ly);var Vo=Ly;function QG(t,e){const r=this||fK;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(QG,"transformData");function E7e(t){return!!(t&&t.__CANCEL__)}o(E7e,"isCancel");function Dm(t,e,r){nt.call(this,t==null?"canceled":t,nt.ERR_CANCELED,e,r);this.name="CanceledError"}o(Dm,"CanceledError");fe.inherits(Dm,nt,{__CANCEL__:true});function e3(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(e3,"settle");function VDt(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}o(VDt,"isAbsoluteURL");function HDt(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}o(HDt,"combineURLs");function hK(t,e){if(t&&!VDt(e)){return HDt(t,e)}return e}o(hK,"buildFullPath");var sx="1.6.2";function b7e(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}o(b7e,"parseProtocol");var zDt=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function GDt(t,e,r){const n=r&&r.Blob||Bo.classes.Blob;const i=b7e(t);if(e===void 0&&n){e=true}if(i==="data"){t=i.length?t.slice(i.length+1):t;const s=zDt.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(GDt,"fromDataURI");function KDt(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(KDt,"throttle");function w7e(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(w7e,"speedometer");var tx=Symbol("internals");var rK=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[tx]={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=w7e(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",u=>{if(u==="progress"){if(!n.isCaptured){n.isCaptured=true}}});let s=0;n.updateProgress=KDt(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[tx];if(r.onReadCallback){r.onReadCallback()}return super._read(e)}_transform(e,r,n){const i=this;const s=this[tx];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[tx].length=+e;return this}};var zTe=rK;var{asyncIterator:GTe}=Symbol;var YDt=o(async function*(t){if(t.stream){yield*t.stream()}else if(t.arrayBuffer){yield await t.arrayBuffer()}else if(t[GTe]){yield*t[GTe]()}else{yield t}},"readBlob");var S7e=YDt;var WDt=fe.ALPHABET.ALPHA_DIGIT+"-_";var r3=new r7e.TextEncoder;var ff="\r\n";var JDt=r3.encode(ff);var QDt=2;var nK=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=r3.encode(String(r).replace(/\r?\n|\r\n?/g,ff))}else{s+=`Content-Type: ${r.type||"application/octet-stream"}${ff}`}this.headers=r3.encode(s+ff);this.contentLength=i?r.byteLength:r.size;this.size=this.headers.byteLength+this.contentLength+QDt;this.name=e;this.value=r}async*encode(){yield this.headers;const{value:e}=this;if(fe.isTypedArray(e)){yield e}else{yield*S7e(e)}yield JDt}static escapeName(e){return String(e).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}};var XDt=o((t,e,r)=>{const{tag:n="form-data-boundary",size:i=25,boundary:s=n+"-"+fe.generateString(i,WDt)}=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=r3.encode("--"+s+ff);const u=r3.encode("--"+s+"--"+ff+ff);let l=u.byteLength;const c=Array.from(t.entries()).map(([p,f])=>{const h=new nK(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 n7e.Readable.from(async function*(){for(const p of c){yield a;yield*p.encode()}yield u}())},"formDataToStream");var ZDt=XDt;var iK=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 ekt=iK;var tkt=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 rkt=tkt;var KTe={flush:hf["default"].constants.Z_SYNC_FLUSH,finishFlush:hf["default"].constants.Z_SYNC_FLUSH};var nkt={flush:hf["default"].constants.BROTLI_OPERATION_FLUSH,finishFlush:hf["default"].constants.BROTLI_OPERATION_FLUSH};var YTe=fe.isFunction(hf["default"].createBrotliDecompress);var{http:ikt,https:skt}=VPt["default"];var akt=/https:?/;var WTe=Bo.protocols.map(t=>{return t+":"});function okt(t){if(t.beforeRedirects.proxy){t.beforeRedirects.proxy(t)}if(t.beforeRedirects.config){t.beforeRedirects.config(t)}}o(okt,"dispatchBeforeRedirect");function T7e(t,e,r){let n=e;if(!n&&n!==false){const i=DPt.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){T7e(s,e,s.href)},"beforeRedirect")}o(T7e,"setProxy");var ukt=typeof process!=="undefined"&&fe.kindOf(process)==="process";var lkt=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 ckt=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 JTe=o((t,e)=>ckt(fe.isObject(t)?t:{address:t,family:e}),"buildAddressEntry");var dkt=ukt&&o(function t(e){return lkt(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=rkt(u,Ae=>fe.isArray(Ae)?Ae:[Ae]);u=o((Ae,we,Pe)=>{ue(Ae,we,(Ue,$e,ge)=>{const Je=fe.isArray($e)?$e.map(Le=>JTe(Le)):[JTe($e,ge)];we.all?Pe(Ue,Je):Pe(Ue,Je[0].address,Je[0].family)})},"lookup")}const g=new HPt["default"];const y=o(()=>{if(e.cancelToken){e.cancelToken.unsubscribe(v)}if(e.signal){e.signal.removeEventListener("abort",v)}g.removeAllListeners()},"onFinished");s((ue,Ae)=>{f=true;if(Ae){h=true;y()}});function v(ue){g.emit("abort",!ue||ue.type?new Dm(null,e,m):ue)}o(v,"abort");g.once("abort",i);if(e.cancelToken||e.signal){e.cancelToken&&e.cancelToken.subscribe(v);if(e.signal){e.signal.aborted?v():e.signal.addEventListener("abort",v)}}const w=hK(e.baseURL,e.url);const E=new URL(w,"http://localhost");const b=E.protocol||WTe[0];if(b==="data:"){let ue;if(p!=="GET"){return e3(n,i,{status:405,statusText:"method not allowed",headers:{},config:e})}try{ue=GDt(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(Ae){throw nt.from(Ae,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 e3(n,i,{data:ue,status:200,statusText:"OK",headers:new Vo,config:e})}if(WTe.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/"+sx,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=ZDt(a,Ae=>{S.set(Ae)},{tag:`axios-${sx}-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 MPt["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(S7e(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 zTe({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 Ae=e.auth.password||"";j=ue+":"+Ae}if(!j&&E.username){const ue=E.username;const Ae=E.password;j=ue+":"+Ae}j&&S.delete("authorization");let Q;try{Q=cK(E.pathname+E.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ue){const Ae=new Error(ue.message);Ae.config=e;Ae.url=e.url;Ae.exists=true;return i(Ae)}S.set("Accept-Encoding","gzip, compress, deflate"+(YTe?", br":""),false);const ae={path:Q,method:p,headers:S.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:b,family:l,beforeRedirect:okt,beforeRedirects:{}};!fe.isUndefined(u)&&(ae.lookup=u);if(e.socketPath){ae.socketPath=e.socketPath}else{ae.hostname=E.hostname;ae.port=E.port;T7e(ae,e.proxy,b+"//"+E.hostname+(E.port?":"+E.port:"")+ae.path)}let Te;const le=akt.test(ae.protocol);ae.agent=le?e.httpsAgent:e.httpAgent;if(e.transport){Te=e.transport}else if(e.maxRedirects===0){Te=le?BPt["default"]:FPt["default"]}else{if(e.maxRedirects){ae.maxRedirects=e.maxRedirects}if(e.beforeRedirect){ae.beforeRedirects.config=e.beforeRedirect}Te=le?skt:ikt}if(e.maxBodyLength>-1){ae.maxBodyLength=e.maxBodyLength}else{ae.maxBodyLength=Infinity}if(e.insecureHTTPParser){ae.insecureHTTPParser=e.insecureHTTPParser}m=Te.request(ae,o(function ue(Ae){if(m.destroyed)return;const we=[Ae];const Pe=+Ae.headers["content-length"];if(T){const Le=new zTe({length:fe.toFiniteNumber(Pe),maxRate:fe.toFiniteNumber(F)});T&&Le.on("progress",Ie=>{T(Object.assign(Ie,{download:true}))});we.push(Le)}let Ue=Ae;const $e=Ae.req||m;if(e.decompress!==false&&Ae.headers["content-encoding"]){if(p==="HEAD"||Ae.statusCode===204){delete Ae.headers["content-encoding"]}switch((Ae.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":we.push(hf["default"].createUnzip(KTe));delete Ae.headers["content-encoding"];break;case"deflate":we.push(new ekt);we.push(hf["default"].createUnzip(KTe));delete Ae.headers["content-encoding"];break;case"br":if(YTe){we.push(hf["default"].createBrotliDecompress(nkt));delete Ae.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:Ae.statusCode,statusText:Ae.statusMessage,headers:new Vo(Ae.headers),config:e,request:$e};if(c==="stream"){Je.data=Ue;e3(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))}e3(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(Ae){i(nt.from(Ae,null,e,m))},"handleRequestError"));m.on("socket",o(function ue(Ae){Ae.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 Ae(){if(f)return;let we=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const Pe=e.transitional||dK;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 Ae=false;a.on("end",()=>{ue=true});a.once("error",we=>{Ae=true;m.destroy(we)});a.on("close",()=>{if(!ue&&!Ae){v(new Dm("Request stream has been aborted",e,m))}});a.pipe(m)}else{m.end(a)}},"dispatchHttpRequest"))},"httpAdapter");var pkt=Bo.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];fe.isNumber(r)&&a.push("expires="+new Date(r).toGMTString());fe.isString(n)&&a.push("path="+n);fe.isString(i)&&a.push("domain="+i);s===true&&a.push("secure");document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var fkt=Bo.hasStandardBrowserEnv?o(function t(){const e=/(msie|trident)/i.test(navigator.userAgent);const r=document.createElement("a");let n;function i(s){let a=s;if(e){r.setAttribute("href",a);a=r.href}r.setAttribute("href",a);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}o(i,"resolveURL");n=i(window.location.href);return o(function s(a){const u=fe.isString(a)?i(a):a;return u.protocol===n.protocol&&u.host===n.host},"isURLSameOrigin")},"standardBrowserEnv")():o(function t(){return o(function e(){return true},"isURLSameOrigin")},"nonStandardBrowserEnv")();function QTe(t,e){let r=0;const n=w7e(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(QTe,"progressEventReducer");var hkt=typeof XMLHttpRequest!=="undefined";var mkt=hkt&&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(Bo.hasStandardBrowserEnv||Bo.hasStandardBrowserWebWorkerEnv){s.setContentType(false)}else if((d=s.getContentType())!==false){const[g,...y]=d?d.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([g||"multipart/form-data",...y].join("; "))}}let p=new XMLHttpRequest;if(t.auth){const g=t.auth.username||"";const y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.set("Authorization","Basic "+btoa(g+":"+y))}const f=hK(t.baseURL,t.url);p.open(t.method.toUpperCase(),cK(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};e3(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||dK;if(t.timeoutErrorMessage){y=t.timeoutErrorMessage}n(new nt(y,v.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,t,p));p=null},"handleTimeout");if(Bo.hasStandardBrowserEnv){u&&fe.isFunction(u)&&(u=u(t));if(u||u!==false&&fkt(f)){const g=t.xsrfHeaderName&&t.xsrfCookieName&&pkt.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",QTe(t.onDownloadProgress,true))}if(typeof t.onUploadProgress==="function"&&p.upload){p.upload.addEventListener("progress",QTe(t.onUploadProgress))}if(t.cancelToken||t.signal){l=o(g=>{if(!p){return}n(!g||g.type?new Dm(null,t,p):g);p.abort();p=null},"onCanceled");t.cancelToken&&t.cancelToken.subscribe(l);if(t.signal){t.signal.aborted?l():t.signal.addEventListener("abort",l)}}const m=b7e(f);if(m&&Bo.protocols.indexOf(m)===-1){n(new nt("Unsupported protocol "+m+":",nt.ERR_BAD_REQUEST,t));return}p.send(i||null)},"dispatchXhrRequest"))};var sK={http:dkt,xhr:mkt};fe.forEach(sK,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(r){}Object.defineProperty(t,"adapterName",{value:e})}});var XTe=o(t=>`- ${t}`,"renderReason");var gkt=o(t=>fe.isFunction(t)||t===null||t===false,"isResolvedHandle");var A7e={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(!gkt(r)){n=sK[(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(XTe).join("\n"):" "+XTe(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:sK};function XG(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new Dm(null,t)}}o(XG,"throwIfCancellationRequested");function ZTe(t){XG(t);t.headers=Vo.from(t.headers);t.data=QG.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=A7e.getAdapter(t.adapter||fK.adapter);return e(t).then(o(function r(n){XG(t);n.data=QG.call(t,t.transformResponse,n);n.headers=Vo.from(n.headers);return n},"onAdapterResolution"),o(function r(n){if(!E7e(n)){XG(t);if(n&&n.response){n.response.data=QG.call(t,t.transformResponse,n.response);n.response.headers=Vo.from(n.response.headers)}}return Promise.reject(n)},"onAdapterRejection"))}o(ZTe,"dispatchRequest");var e7e=o(t=>t instanceof Vo?t.toJSON():t,"headersToObject");function qy(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(e7e(c),e7e(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(qy,"mergeConfig");var mK={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{mK[t]=o(function r(n){return typeof n===t||"a"+(e<1?"n ":" ")+t},"validator")});var t7e={};mK.transitional=o(function t(e,r,n){function i(s,a){return"[Axios v"+sx+"] 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&&!t7e[a]){t7e[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 ykt(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(ykt,"assertOptions");var aK={assertOptions:ykt,validators:mK};var df=aK.validators;var jy=class{static{o(this,"Axios")}constructor(e){this.defaults=e;this.interceptors={request:new VTe,response:new VTe}}request(e,r){if(typeof e==="string"){r=r||{};r.url=e}else{r=e||{}}r=qy(this.defaults,r);const{transitional:n,paramsSerializer:i,headers:s}=r;if(n!==void 0){aK.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{aK.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=[ZTe.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=ZTe.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=qy(this.defaults,e);const r=hK(e.baseURL,e.url);return cK(r,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],o(function t(e){jy.prototype[e]=function(r,n){return this.request(qy(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(qy(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))},"httpMethod")}o(r,"generateHTTPMethod");jy.prototype[e]=r();jy.prototype[e+"Form"]=r(true)},"forEachMethodWithData"));var ix=jy;var oK=class t{static{o(this,"CancelToken")}constructor(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}let r;this.promise=new Promise(o(function i(s){r=s},"promiseExecutor"));const n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;while(s-- >0){n._listeners[s](i)}n._listeners=null});this.promise.then=i=>{let s;const a=new Promise(u=>{n.subscribe(u);s=u}).then(i);a.cancel=o(function u(){n.unsubscribe(s)},"reject");return a};e(o(function i(s,a,u){if(n.reason){return}n.reason=new Dm(s,a,u);r(n.reason)},"cancel"))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}}unsubscribe(e){if(!this._listeners){return}const r=this._listeners.indexOf(e);if(r!==-1){this._listeners.splice(r,1)}}static source(){let e;const r=new t(o(function n(i){e=i},"executor"));return{token:r,cancel:e}}};var vkt=oK;function _kt(t){return o(function e(r){return t.apply(null,r)},"wrap")}o(_kt,"spread");function Ekt(t){return fe.isObject(t)&&t.isAxiosError===true}o(Ekt,"isAxiosError");var uK={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(uK).forEach(([t,e])=>{uK[e]=t});var bkt=uK;function x7e(t){const e=new ix(t);const r=s7e(ix.prototype.request,e);fe.extend(r,ix.prototype,e,{allOwnKeys:true});fe.extend(r,e,null,{allOwnKeys:true});r.create=o(function n(i){return x7e(qy(t,i))},"create");return r}o(x7e,"createInstance");var fi=x7e(fK);fi.Axios=ix;fi.CanceledError=Dm;fi.CancelToken=vkt;fi.isCancel=E7e;fi.VERSION=sx;fi.toFormData=lx;fi.AxiosError=nt;fi.Cancel=fi.CanceledError;fi.all=o(function t(e){return Promise.all(e)},"all");fi.spread=_kt;fi.isAxiosError=Ekt;fi.mergeConfig=qy;fi.AxiosHeaders=Vo;fi.formToJSON=t=>_7e(fe.isHTMLForm(t)?new FormData(t):t);fi.getAdapter=A7e.getAdapter;fi.HttpStatusCode=bkt;fi.default=fi;C7e.exports=fi});var px=_(dx=>{"use strict";Object.defineProperty(dx,"__esModule",{value:true});dx.CredentialsMethod=void 0;var R7e;(function(t){t["None"]="none";t["ApiToken"]="api_token";t["ClientCredentials"]="client_credentials"})(R7e||(dx.CredentialsMethod=R7e={}))});var $m=_(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:true});hi.FgaRequiredParamError=hi.FgaValidationError=hi.FgaApiAuthenticationError=hi.FgaApiInternalError=hi.FgaApiRateLimitExceededError=hi.FgaApiNotFoundError=hi.FgaApiValidationError=hi.FgaApiError=hi.FgaError=void 0;var Fy=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=Fy;function hx(t){let e=(t||"").split("/");if(e.length<4){e=[]}const r=e[2]||"";const n=e[3]||"";return{storeId:r,endpointCategory:n}}o(hx,"getRequestMetadataFromPath");var O7e="fga-request-id";function wK(t){return t.response?Object.fromEntries(Object.entries(t.response.headers).map(([e,r])=>[e.toLowerCase(),r])):{}}o(wK,"getResponseHeaders");var km=class extends Fy{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}=hx((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=wK(e);this.requestId=g[O7e];if(e===null||e===void 0?void 0:e.stack){this.stack=e.stack}}};hi.FgaApiError=km;var gK=class extends km{static{o(this,"FgaApiValidationError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiValidationError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:p}=hx((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=gK;var yK=class extends km{static{o(this,"FgaApiNotFoundError")}constructor(e,r){var n,i,s,a,u,l,c;super(e);this.name="FgaApiNotFoundError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;this.message=r?r:((a=(s=e.response)===null||s===void 0?void 0:s.data)===null||a===void 0?void 0:a.message)?`FGA API NotFound Error: ${(u=e.config)===null||u===void 0?void 0:u.method} : Error ${(c=(l=e.response)===null||l===void 0?void 0:l.data)===null||c===void 0?void 0:c.message}`:e.message}};hi.FgaApiNotFoundError=yK;var vK=class extends km{static{o(this,"FgaApiRateLimitExceededError")}constructor(e,r){var n,i,s;super(e);this.name="FgaApiRateLimitExceededError";this.apiErrorCode=(i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.code;const{endpointCategory:a}=hx((s=e.request)===null||s===void 0?void 0:s.path);const u=wK(e);this.message=r?r:`FGA API Rate Limit Error for ${this.method} ${a}`}};hi.FgaApiRateLimitExceededError=vK;var _K=class extends km{static{o(this,"FgaApiInternalError")}constructor(e,r){var n,i,s,a,u,l,c,d;super(e);this.name="FgaApiInternalError";const{endpointCategory:p}=hx((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=_K;var EK=class extends Fy{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=wK(e);this.requestId=f[O7e];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=EK;var fx=class extends Fy{static{o(this,"FgaValidationError")}constructor(e,r){super(r);this.field=e;this.name="FgaValidationError"}};hi.FgaValidationError=fx;var bK=class extends fx{static{o(this,"FgaRequiredParamError")}constructor(e,r,n){super(r,n);this.functionName=e;this.name="FgaRequiredParamError"}};hi.FgaRequiredParamError=bK});var i3=_(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:true});mf.isWellFormedUlidString=mf.isWellFormedUriString=mf.assertParamExists=void 0;var wkt=$m();var Skt=o(function(t,e,r){if(r===null||r===void 0){throw new wkt.FgaRequiredParamError(t,e,`Required parameter ${e} was null or undefined when calling ${t}.`)}},"assertParamExists");mf.assertParamExists=Skt;var Tkt=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=Tkt;var Akt=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=Akt});var TK=_(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:true});By.Configuration=By.GetDefaultRetryParams=void 0;var s3=px();var SK=$m();var mx=i3();var xkt=15;var Ckt=100;var Rkt="openfga-sdk js/0.3.0";function Okt(t=xkt,e=Ckt){return{maxRetry:t,minWaitInMs:e}}o(Okt,"GetDefaultRetryParams");By.GetDefaultRetryParams=Okt;var gx=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 s3.CredentialsMethod.ApiToken:this.credentials={method:r.method,config:{token:r.config.token,headerName:"Authorization",headerValuePrefix:"Bearer"}};break;case s3.CredentialsMethod.ClientCredentials:this.credentials={method:s3.CredentialsMethod.ClientCredentials,config:{clientId:r.config.clientId,clientSecret:r.config.clientSecret,apiAudience:r.config.apiAudience,apiTokenIssuer:r.config.apiTokenIssuer}};break;case s3.CredentialsMethod.None:default:this.credentials={method:s3.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"]=Rkt}this.baseOptions=n;this.retryParams=e.retryParams}isValid(){var e;(0,mx.assertParamExists)("Configuration","apiScheme",this.apiScheme);(0,mx.assertParamExists)("Configuration","apiHost",this.apiHost);if(!(0,mx.isWellFormedUriString)(this.getBasePath())){throw new SK.FgaValidationError(`Configuration.apiScheme (${this.apiScheme}) and Configuration.apiHost (${this.apiHost}) do not form a valid URI (${this.getBasePath()})`)}if(this.storeId&&!(0,mx.isWellFormedUlidString)(this.storeId)){throw new SK.FgaValidationError("storeId")}if(((e=this.retryParams)===null||e===void 0?void 0:e.maxRetry)&&this.retryParams.maxRetry>15){throw new SK.FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15")}return true}};By.Configuration=gx;gx.sdkVersion="0.3.0"});var N7e=_(yx=>{"use strict";Object.defineProperty(yx,"__esModule",{value:true});yx.assertNever=void 0;function Nkt(t){throw new Error(`Assertion failed. Unacceptable value: '${t}'`)}o(Nkt,"assertNever");yx.assertNever=Nkt});var I7e=_(vx=>{"use strict";Object.defineProperty(vx,"__esModule",{value:true});vx.chunkArray=void 0;function Ikt(t,e){const r=[];const n=[...t];while(n.length>0){r.push(n.splice(0,e))}return r}o(Ikt,"chunkArray");vx.chunkArray=Ikt});var D7e=_(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:true});My.generateRandomIdWithNonUniqueFallback=My.generateRandomId=void 0;var _x=require("crypto");function P7e(){if(typeof _x.randomUUID==="function"){return(0,_x.randomUUID)()}if(typeof _x.randomBytes==="function"){return(0,_x.randomBytes)(20).toString("hex")}return}o(P7e,"generateRandomId");My.generateRandomId=P7e;function Pkt(){return P7e()||"00000000-0000-0000-0000-000000000000"}o(Pkt,"generateRandomIdWithNonUniqueFallback");My.generateRandomIdWithNonUniqueFallback=Pkt});var k7e=_(Ex=>{"use strict";Object.defineProperty(Ex,"__esModule",{value:true});Ex.setHeaderIfNotSet=void 0;function Dkt(t,e,r){if(!t[e]&&r){t[e]=r}}o(Dkt,"setHeaderIfNotSet");Ex.setHeaderIfNotSet=Dkt});var $7e=_(bx=>{"use strict";Object.defineProperty(bx,"__esModule",{value:true});bx.setNotEnumerableProperty=void 0;function kkt(t,e,r){Object.defineProperty(t,e,{enumerable:false,writable:false,value:r})}o(kkt,"setNotEnumerableProperty");bx.setNotEnumerableProperty=kkt});var AK=_(Pu=>{"use strict";var $kt=Pu&&Pu.__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 a3=Pu&&Pu.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))$kt(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:true});a3(N7e(),Pu);a3(I7e(),Pu);a3(D7e(),Pu);a3(k7e(),Pu);a3($7e(),Pu)});var CK=_(yi=>{"use strict";var xK=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 Lkt=wx();var Lm=$m();var qkt=AK();yi.DUMMY_BASE_URL="https://example.com";var jkt=o(function(t,e){return xK(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 Ukt=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=Ukt;var Fkt=o(t=>{const e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(e.test(t)||t.toLowerCase()==="application/json-patch+json")},"isJsonMime");var Bkt=o(function(t,e){const r=typeof t!=="string";const n=r?Fkt(e.headers["Content-Type"]):r;return n?JSON.stringify(t!==void 0?t:{}):t||""},"serializeDataIfNeeded");yi.serializeDataIfNeeded=Bkt;var Mkt=o(function(t){return t.pathname+t.search+t.hash},"toPathString");yi.toPathString=Mkt;function Vkt(t){return t&&typeof t==="object"&&t.isAxiosError===true}o(Vkt,"isAxiosError");function Hkt(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(Hkt,"randomTime");function L7e(t,e,r){var n;return xK(this,void 0,void 0,function*(){let i=0;do{i++;try{return yield r(t)}catch(s){if(!Vkt(s)){throw new Lm.FgaError(s)}const a=(n=s===null||s===void 0?void 0:s.response)===null||n===void 0?void 0:n.status;if(a===400||a===422){throw new Lm.FgaApiValidationError(s)}else if(a===401||a===403){throw new Lm.FgaApiAuthenticationError(s)}else if(a===404){throw new Lm.FgaApiNotFoundError(s)}else if(a===429||a>=500){if(i>=e.maxRetry){if(a===429){throw new Lm.FgaApiRateLimitExceededError(s)}else{throw new Lm.FgaApiInternalError(s)}}yield new Promise(u=>setTimeout(u,Hkt(i,e.minWaitInMs)))}else{throw new Lm.FgaApiError(s)}}}while(i<e.maxRetry+1)})}o(L7e,"attemptHttpRequest");yi.attemptHttpRequest=L7e;var zkt=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=Lkt.Credentials.init(r)}return(c=e)=>xK(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 L7e(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,qkt.setNotEnumerableProperty)(h,"$response",p);return h})},"createRequestFunction");yi.createRequestFunction=zkt});var j7e=_(Vy=>{"use strict";var RK=Vy&&Vy.__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(Vy,"__esModule",{value:true});Vy.Credentials=void 0;var q7e=cx();var gf=i3();var OK=$m();var Gkt=CK();var Ho=px();var NK=class t{static{o(this,"Credentials")}static init(e){return new t(e.credentials)}constructor(e,r=q7e.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 OK.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 RK(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 RK(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 RK(this,void 0,void 0,function*(){const r=(e=this.authConfig)===null||e===void 0?void 0:e.config;try{const n=yield(0,Gkt.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},q7e.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 OK.FgaApiError){n.constructor=OK.FgaApiAuthenticationError;n.name="FgaApiAuthenticationError";n.clientId=r.clientId;n.audience=r.apiAudience;n.grantType="client_credentials"}throw n}})}};Vy.Credentials=NK});var wx=_(yf=>{"use strict";var Kkt=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 U7e=yf&&yf.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))Kkt(e,t,r)};Object.defineProperty(yf,"__esModule",{value:true});U7e(j7e(),yf);U7e(px(),yf)});var PK=_(Sx=>{"use strict";Object.defineProperty(Sx,"__esModule",{value:true});Sx.BaseAPI=void 0;var Ykt=cx();var Wkt=require("http");var Jkt=require("https");var F7e=TK();var Qkt=wx();var Xkt=1e4;var IK=class{static{o(this,"BaseAPI")}constructor(e,r){var n;this.axios=r;if(e instanceof F7e.Configuration){this.configuration=e}else{this.configuration=new F7e.Configuration(e)}this.configuration.isValid();this.credentials=Qkt.Credentials.init(this.configuration);if(!this.axios){const i=new Wkt.Agent({keepAlive:true});const s=new Jkt.Agent({keepAlive:true});this.axios=Ykt.default.create({httpAgent:i,httpsAgent:s,timeout:Xkt,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}};Sx.BaseAPI=IK});var kK=_(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=cx();var Zkt=PK();var We=CK();var Vn=i3();var e$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=e$t;var t$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=t$t;var r$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=r$t;var DK=class extends Zkt.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=DK});var M7e=_((bmr,B7e)=>{async function*n$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(n$t,"asyncPool");B7e.exports=n$t});var V7e=_(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 $K=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 LK=M7e();var i$t=kK();var s$t=PK();var qK=$m();var Ta=AK();var a$t=i3();var jK=10;var Hy="X-OpenFGA-Client-Method";var UK="X-OpenFGA-Client-Bulk-Request-Id";var zy;(function(t){t["SUCCESS"]="success";t["FAILURE"]="failure"})(zy||(Hl.ClientWriteStatus=zy={}));var FK=class extends s$t.BaseAPI{static{o(this,"OpenFgaClient")}constructor(e,r){super(e,r);this.axios=r;this.api=new i$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,a$t.isWellFormedUlidString)(r)){throw new qK.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 qK.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,Ta.setHeaderIfNotSet)(n,Hy,"ReadLatestAuthorizationModel");const i=yield this.readAuthorizationModels(Object.assign(Object.assign({},e),{pageSize:1,headers:n}));const s=i;s.authorization_model=(r=i.authorization_models)===null||r===void 0?void 0:r[0];delete s.authorization_models;return s})}readChanges(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.readChanges(e.type,r.pageSize,r.continuationToken,r)})}read(e={},r={}){return Hn(this,void 0,void 0,function*(){const n={page_size:r.pageSize,continuation_token:r.continuationToken};if(e.user||e.object||e.relation){n.tuple_key=e}return this.api.read(n,r)})}write(e,r={}){return Hn(this,void 0,void 0,function*(){const{transaction:n={},headers:i={}}=r;const{maxPerChunk:s=1,maxParallelRequests:a=jK}=n;const{writes:u,deletes:l}=e;const c=this.getAuthorizationModelId(r);if(!(n===null||n===void 0?void 0:n.disable)){const d={authorization_model_id:c};if(u===null||u===void 0?void 0:u.length){d.writes={tuple_keys:u}}if(l===null||l===void 0?void 0:l.length){d.deletes={tuple_keys:l}}yield this.api.write(d,r);return{writes:(u===null||u===void 0?void 0:u.map(p=>({tuple_key:p,status:zy.SUCCESS})))||[],deletes:(l===null||l===void 0?void 0:l.map(p=>({tuple_key:p,status:zy.SUCCESS})))||[]}}return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var d,p,f,h,m,g,y,v;(0,Ta.setHeaderIfNotSet)(i,Hy,"Write");(0,Ta.setHeaderIfNotSet)(i,UK,(0,Ta.generateRandomIdWithNonUniqueFallback)());const w=[];if(u===null||u===void 0?void 0:u.length){try{for(var E=true,b=$K(LK(a,(0,Ta.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:zy.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=$K(LK(a,(0,Ta.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:zy.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,Ta.setHeaderIfNotSet)(n,Hy,"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,Ta.setHeaderIfNotSet)(n,Hy,"DeleteTuples");return this.write({deletes:e},Object.assign(Object.assign({},r),{headers:n}))})}check(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.check({tuple_key:{user:e.user,relation:e.relation,object:e.object},context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]},authorization_model_id:this.getAuthorizationModelId(r)},r)})}batchCheck(e,r={}){return Hn(this,void 0,void 0,function*(){return Promise.all([(()=>Hn(this,void 0,void 0,function*(){var n,i,s,a;const{headers:u={},maxParallelRequests:l=jK}=r;(0,Ta.setHeaderIfNotSet)(u,Hy,"BatchCheck");(0,Ta.setHeaderIfNotSet)(u,UK,(0,Ta.generateRandomIdWithNonUniqueFallback)());const c=[];try{for(var d=true,p=$K(LK(l,e,h=>this.check(h,Object.assign(Object.assign({},r),{headers:u})).then(m=>{m._request=h;return m}).catch(m=>{return{allowed:void 0,error:m,_request:h}}))),f;f=yield p.next(),n=f.done,!n;d=true){a=f.value;d=false;const h=a;c.push(h)}}catch(h){i={error:h}}finally{try{if(!d&&!n&&(s=p.return))yield s.call(p)}finally{if(i)throw i.error}}return{responses:c}}))(),this.checkValidApiConnection(r)]).then(n=>n[0])})}expand(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.expand({authorization_model_id:this.getAuthorizationModelId(r),tuple_key:e},r)})}listObjects(e,r={}){return Hn(this,void 0,void 0,function*(){return this.api.listObjects({authorization_model_id:this.getAuthorizationModelId(r),user:e.user,relation:e.relation,type:e.type,context:e.context,contextual_tuples:{tuple_keys:e.contextualTuples||[]}},r)})}listRelations(e,r={}){return Hn(this,void 0,void 0,function*(){const{user:n,object:i,relations:s,contextualTuples:a,context:u}=e;const{headers:l={},maxParallelRequests:c=jK}=r;(0,Ta.setHeaderIfNotSet)(l,Hy,"ListRelations");(0,Ta.setHeaderIfNotSet)(l,UK,(0,Ta.generateRandomIdWithNonUniqueFallback)());if(!(s===null||s===void 0?void 0:s.length)){throw new qK.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=FK});var J7e=_(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:true});Aa.TypeName=Aa.TupleOperation=Aa.NullValue=Aa.NotFoundErrorCode=Aa.InternalErrorCode=Aa.ErrorCode=void 0;var H7e;(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"})(H7e||(Aa.ErrorCode=H7e={}));var z7e;(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"})(z7e||(Aa.InternalErrorCode=z7e={}));var G7e;(function(t){t["NoNotFoundError"]="no_not_found_error";t["UndefinedEndpoint"]="undefined_endpoint";t["StoreIdNotFound"]="store_id_not_found";t["Unimplemented"]="unimplemented"})(G7e||(Aa.NotFoundErrorCode=G7e={}));var K7e;(function(t){t["NullValue"]="NULL_VALUE"})(K7e||(Aa.NullValue=K7e={}));var Y7e;(function(t){t["Write"]="TUPLE_OPERATION_WRITE";t["Delete"]="TUPLE_OPERATION_DELETE"})(Y7e||(Aa.TupleOperation=Y7e={}));var W7e;(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"})(W7e||(Aa.TypeName=W7e={}))});var Z7e=_($i=>{"use strict";var o$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 Tx=$i&&$i.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))o$t(e,t,r)};Object.defineProperty($i,"__esModule",{value:true});$i.CredentialsMethod=$i.Credentials=$i.GetDefaultRetryParams=$i.Configuration=void 0;Tx(kK(),$i);Tx(V7e(),$i);Tx(J7e(),$i);var Q7e=TK();Object.defineProperty($i,"Configuration",{enumerable:true,get:function(){return Q7e.Configuration}});Object.defineProperty($i,"GetDefaultRetryParams",{enumerable:true,get:function(){return Q7e.GetDefaultRetryParams}});var X7e=wx();Object.defineProperty($i,"Credentials",{enumerable:true,get:function(){return X7e.Credentials}});Object.defineProperty($i,"CredentialsMethod",{enumerable:true,get:function(){return X7e.CredentialsMethod}});Tx($m(),$i)});var tAe=_(Gy=>{"use strict";var u$t=Gy&&Gy.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Gy,"__esModule",{value:true});Gy.OpenFGAService=void 0;var o3=u$t(za());var eAe=Z7e();var l$t=Oy();var BK=class{static{o(this,"OpenFGAService")}logger;openFGAClient;baseUrl;apiHost;storeId;modelId;userSub;constructor(e,r){if(!o3.default.OPENFGA_SERVICE_URL){throw new Error("OPENFGA_SERVICE_URL is not set")}this.userSub=r&&r.userSub?r.userSub:e.getUserSub();this.baseUrl=o3.default.OPENFGA_SERVICE_URL;this.apiHost=o3.default.OPENFGA_SERVICE_URL.replace(/^(https:\/\/)/,"");this.storeId=o3.default.OPENFGA_STORE_ID;this.modelId=o3.default.OPENFGA_MODEL_ID;this.logger=e.log}async getOpenFgaClient(){if(!this.openFGAClient){const e=await(0,l$t.getServiceAccountIdToken)(this.baseUrl);this.openFGAClient=new eAe.OpenFgaClient({apiScheme:"https",apiHost:this.apiHost,storeId:this.storeId,authorizationModelId:this.modelId,credentials:{method:eAe.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 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}`)}}};Gy.OpenFGAService=BK});var iAe=_(Ky=>{"use strict";var nAe=Ky&&Ky.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(Ky,"__esModule",{value:true});Ky.TenantService=void 0;var c$t=nAe(Vu());var rAe=nAe(za());var d$t=ZA();var p$t=new c$t.default({max:500,maxAge:1e3*60*50});var MK=class extends d$t.ApiServiceClient{static{o(this,"TenantService")}constructor(e,r){if(!rAe.default.TENANT_API_URL){throw new Error("TENANT_API_URL is not set")}const n=r&&r.userSub?r.userSub:e.getUserSub();super(rAe.default.TENANT_API_URL,p$t,{userSub:n,logger:e.log,requestId:e.id})}};Ky.TenantService=MK});var sAe=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:true});zl.validateHostname=zl.kebabCase=zl.snakeCase=zl.sizeInBytes=void 0;function f$t(t){return new TextEncoder().encode(JSON.stringify(t)).length}o(f$t,"sizeInBytes");zl.sizeInBytes=f$t;function h$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(h$t,"snakeCase");zl.snakeCase=h$t;function m$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(m$t,"kebabCase");zl.kebabCase=m$t;function g$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(g$t,"validateHostname");zl.validateHostname=g$t});var uAe=_(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 VK;(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})(VK||(G.TypeRegistry=VK={}));var Du=class extends Error{static{o(this,"TypeBoxError")}constructor(e){super(e)}};G.TypeBoxError=Du;var aAe;(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})(aAe||(G.FormatRegistry=aAe={}));var Me;(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})(Me||(G.ValueGuard=Me={}));var HK=class extends Du{static{o(this,"TypeGuardUnknownTypeError")}};G.TypeGuardUnknownTypeError=HK;var Y;(function(t){function e(x){try{new RegExp(x);return true}catch{return false}}o(e,"IsPattern");function r(x){if(!Me.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 Me.IsUndefined(x)||Me.IsBigInt(x)}o(i,"IsOptionalBigInt");function s(x){return Me.IsUndefined(x)||Me.IsNumber(x)}o(s,"IsOptionalNumber");function a(x){return Me.IsUndefined(x)||Me.IsBoolean(x)}o(a,"IsOptionalBoolean");function u(x){return Me.IsUndefined(x)||Me.IsString(x)}o(u,"IsOptionalString");function l(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)&&e(x)}o(l,"IsOptionalPattern");function c(x){return Me.IsUndefined(x)||Me.IsString(x)&&r(x)}o(c,"IsOptionalFormat");function d(x){return Me.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)&&Me.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)&&Me.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")&&(Me.IsString(x.type)&&x.type!=="object"?false:true)&&Me.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 Me.IsObject(x)&&G.Kind in x&&Me.IsString(x[G.Kind])}o(A,"TKind");t.TKind=A;function P(x){return V(x)&&Me.IsString(x.const)}o(P,"TLiteralString");t.TLiteralString=P;function D(x){return V(x)&&Me.IsNumber(x.const)}o(D,"TLiteralNumber");t.TLiteralNumber=D;function F(x){return V(x)&&Me.IsBoolean(x.const)}o(F,"TLiteralBoolean");t.TLiteralBoolean=F;function V(x){return T(x,"Literal")&&u(x.$id)&&(Me.IsBoolean(x.const)||Me.IsNumber(x.const)||Me.IsString(x.const))}o(V,"TLiteral");t.TLiteral=V;function j(x){return T(x,"Never")&&Me.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 ae(x){return T(x,"Null")&&x.type==="null"&&u(x.$id)}o(ae,"TNull");t.TNull=ae;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)&&Me.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 Ae(x){return T(x,"Record")&&x.type==="object"&&u(x.$id)&&n(x.additionalProperties)&&Me.IsObject(x.patternProperties)&&(ie=>{const ce=Object.getOwnPropertyNames(ie.patternProperties);return ce.length===1&&e(ce[0])&&Me.IsObject(ie.patternProperties)&&J(ie.patternProperties[ce[0]])})(x)}o(Ae,"TRecord");t.TRecord=Ae;function we(x){return Me.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)&&Me.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"&&Me.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)&&Me.IsString(x.$ref)}o(Je,"TThis");t.TThis=Je;function Le(x){return Me.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)&&Me.IsNumber(x.minItems)&&Me.IsNumber(x.maxItems)&&x.minItems===x.maxItems&&(Me.IsUndefined(x.items)&&Me.IsUndefined(x.additionalItems)&&x.minItems===0||Me.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)&&Me.IsObject(x)&&Me.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 Me.IsObject(x)&&x[G.Readonly]==="Readonly"}o(K,"TReadonly");t.TReadonly=K;function se(x){return Me.IsObject(x)&&x[G.Optional]==="Optional"}o(se,"TOptional");t.TOptional=se;function J(x){return Me.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)||ae(x)||Te(x)||le(x)||ue(x)||Ae(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)&&VK.Has(x[G.Kind]))}o(J,"TSchema");t.TSchema=J})(Y||(G.TypeGuard=Y={}));var oAe;(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})(oAe||(G.ExtendsUndefined=oAe={}));var Ax=class extends Du{static{o(this,"TypeExtendsError")}};G.TypeExtendsError=Ax;var Ee;(function(t){t[t["Union"]=0]="Union";t[t["True"]=1]="True";t[t["False"]=2]="False"})(Ee||(G.TypeExtendsResult=Ee={}));var qm;(function(t){function e(U){return U===Ee.False?U:Ee.True}o(e,"IntoBooleanResult");function r(U){throw new Ax(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)&&Me.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)&&Me.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 ae(U){return ge(U)}o(ae,"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 Ae(U){return Q(U,0)}o(Ae,"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)&&ae($)||Y.TLiteralNumber(U)&&le($)||Y.TLiteralBoolean(U)&&ue($)||Y.TSymbol(U)&&Te($)||Y.TBigInt(U)&&Ae($)||Y.TString(U)&&ae($)||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)&&Me.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:Me.IsUndefined(U.items)&&!Me.IsUndefined($.items)||!Me.IsUndefined(U.items)&&Me.IsUndefined($.items)?Ee.False:Me.IsUndefined(U.items)&&!Me.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})(qm||(G.TypeExtends=qm={}));var ct;(function(t){function e(a){const u=Object.getOwnPropertyNames(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});const l=Object.getOwnPropertySymbols(a).reduce((c,d)=>({...c,[d]:n(a[d])}),{});return{...u,...l}}o(e,"ObjectType");function r(a){return a.map(u=>n(u))}o(r,"ArrayType");function n(a){return Me.IsArray(a)?r(a):Me.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 zK;(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 Me.IsUndefined(g)?G.Type.Never():G.Type.Union([g])}o(c,"TObject");function d(h,m){const g=h.items;if(Me.IsUndefined(g))return G.Type.Never();const y=g[m];if(Me.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})(zK||(G.IndexedAccessor=zK={}));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 xx;(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})(xx||(G.KeyResolver=xx={}));var Cx=class extends Du{static{o(this,"KeyArrayResolverError")}};G.KeyArrayResolverError=Cx;var u3;(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 Cx("Cannot resolve keys from infinite template expression");return[...Xy.Generate(n)]})():[]}o(e,"Resolve");t.Resolve=e})(u3||(G.KeyArrayResolver=u3={}));var GK;(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})(GK||(G.UnionResolver=GK={}));var Rx=class extends Du{static{o(this,"TemplateLiteralPatternError")}};G.TemplateLiteralPatternError=Rx;var Ox;(function(t){function e(s){throw new Rx(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})(Ox||(G.TemplateLiteralPattern=Ox={}));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 l3=class extends Du{static{o(this,"TemplateLiteralParserError")}};G.TemplateLiteralParserError=l3;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 l3(`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 l3(`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 Nx=class extends Du{static{o(this,"TemplateLiteralFiniteError")}};G.TemplateLiteralFiniteError=Nx;var Qy;(function(t){function e(a){throw new Nx(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 Ix=class extends Du{static{o(this,"TemplateLiteralGeneratorError")}};G.TemplateLiteralGeneratorError=Ix;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 Ix("Unknown expression")})()}o(s,"Generate");t.Generate=s})(Xy||(G.TemplateLiteralGenerator=Xy={}));var KK;(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})(KK||(G.TemplateLiteralDslParser=KK={}));var Px=class{static{o(this,"TransformDecodeBuilder")}constructor(e){this.schema=e}Decode(e){return new Dx(this.schema,e)}};G.TransformDecodeBuilder=Px;var Dx=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=Dx;var y$t=0;var kx=class extends Du{static{o(this,"TypeBuilderError")}};G.TypeBuilderError=kx;var $x=class{static{o(this,"TypeBuilder")}Create(e){return e}Throw(e){throw new kx(e)}Discard(e,r){const{[r]:n,...i}=e;return i}Strict(e){return JSON.parse(JSON.stringify(e))}};G.TypeBuilder=$x;var c3=class extends $x{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=xx.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=>Me.IsString(s)?{[G.Kind]:"Literal",type:"string",const:s}:{[G.Kind]:"Literal",type:"number",const:s});return this.Create({...r,[G.Kind]:"Union",anyOf:i})}Extends(e,r,n,i,s={}){switch(qm.Extends(e,r)){case Ee.Union:return this.Union([ct.Type(n,s),ct.Type(i,s)]);case Ee.True:return ct.Type(n,s);case Ee.False:return ct.Type(i,s)}}Exclude(e,r,n={}){return Y.TTemplateLiteral(e)?this.Exclude(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Exclude(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)===Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?this.Never(n):ct.Type(e,n)}Extract(e,r,n={}){return Y.TTemplateLiteral(e)?this.Extract(rd.Resolve(e),r,n):Y.TTemplateLiteral(r)?this.Extract(e,rd.Resolve(r),n):Y.TUnion(e)?(()=>{const i=e.anyOf.filter(s=>qm.Extends(s,r)!==Ee.False);return i.length===1?ct.Type(i[0],n):this.Union(i,n)})():qm.Extends(e,r)!==Ee.False?ct.Type(e,n):this.Never(n)}Index(e,r,n={}){return Y.TArray(e)&&Y.TNumber(r)?(()=>{return ct.Type(e.items,n)})():Y.TTuple(e)&&Y.TNumber(r)?(()=>{const i=Me.IsUndefined(e.items)?[]:e.items;const s=i.map(a=>ct.Type(a));return this.Union(s,n)})():(()=>{const i=u3.Resolve(r);const s=ct.Type(e);return zK.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=Me.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=xx.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=u3.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.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=u3.Resolve(r);return Wy.Map(this.Discard(ct.Type(e),G.Transform),s=>{if(Me.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=GK.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 Me.IsString(e.const)||Me.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=Me.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(Me.IsUndefined(r.$id))r.$id=`T${y$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(Me.IsString(e))return this.Create({...r,[G.Kind]:"Ref",$ref:e});if(Me.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)&&!Me.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=Me.IsString(e)?Ox.Create(KK.Parse(e)):Ox.Create(e);return this.Create({...r,[G.Kind]:"TemplateLiteral",type:"string",pattern:n})}Transform(e){return new Px(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=c3;var Lx=class extends c3{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=Me.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=Lx;G.JsonType=new c3;G.Type=new Lx});var lAe=_(qx=>{"use strict";Object.defineProperty(qx,"__esModule",{value:true});qx.CustomTypeBuilder=void 0;var d3=uAe();var YK=class extends d3.TypeBuilder{static{o(this,"CustomTypeBuilder")}static Date(){return d3.Type.Unsafe({type:"string",format:"date-time"})}static Nullable(e){return d3.Type.Union([e,d3.Type.Null()])}static StringEnum(e){return d3.Type.Unsafe({type:"string",enum:e})}};qx.CustomTypeBuilder=YK});var fAe=_(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 jx(t){return typeof t==="string"}o(jx,"isString");lt.isString=jx;function v$t(t){return Array.isArray(t)&&t.every(e=>jx(e))}o(v$t,"isStringArray");lt.isStringArray=v$t;function cAe(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)&&!(t instanceof RegExp)&&!(t instanceof Date)}o(cAe,"isObject");lt.isObject=cAe;function _$t(t){const e=Object.getPrototypeOf(Uint8Array);return typeof t==="object"&&t instanceof e}o(_$t,"isTypedArray");lt.isTypedArray=_$t;function dAe(t){return typeof t==="number"&&!isNaN(t)}o(dAe,"isNumber");lt.isNumber=dAe;function E$t(t){return!!t&&typeof t[Symbol.iterator]==="function"}o(E$t,"isIterable");lt.isIterable=E$t;function b$t(t){return t===true||t===false}o(b$t,"isBoolean");lt.isBoolean=b$t;function WK(t){return typeof t==="undefined"}o(WK,"isUndefined");lt.isUndefined=WK;function w$t(t){return!Zy(t)}o(w$t,"isDefined");lt.isDefined=w$t;function Zy(t){return WK(t)||t===null}o(Zy,"isUndefinedOrNull");lt.isUndefinedOrNull=Zy;function S$t(t,e){if(!t){throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}}o(S$t,"assertType");lt.assertType=S$t;function T$t(t){if(Zy(t)){throw new Error("Assertion Failed: argument is undefined or null")}return t}o(T$t,"assertIsDefined");lt.assertIsDefined=T$t;function A$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(A$t,"assertAllDefined");lt.assertAllDefined=A$t;var x$t=Object.prototype.hasOwnProperty;function C$t(t){if(!cAe(t)){return false}for(const e in t){if(x$t.call(t,e)){return false}}return true}o(C$t,"isEmptyObject");lt.isEmptyObject=C$t;function JK(t){return typeof t==="function"}o(JK,"isFunction");lt.isFunction=JK;function R$t(...t){return t.length>0&&t.every(JK)}o(R$t,"areFunctions");lt.areFunctions=R$t;function O$t(t,e){const r=Math.min(t.length,e.length);for(let n=0;n<r;n++){pAe(t[n],e[n])}}o(O$t,"validateConstraints");lt.validateConstraints=O$t;function pAe(t,e){if(jx(e)){if(typeof t!==e){throw new Error(`argument does not match constraint: typeof ${e}`)}}else if(JK(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(pAe,"validateConstraint");lt.validateConstraint=pAe;function N$t(t){return t===null?void 0:t}o(N$t,"withNullAsUndefined");lt.withNullAsUndefined=N$t;function I$t(t){return typeof t==="undefined"?null:t}o(I$t,"withUndefinedAsNull");lt.withUndefinedAsNull=I$t;var p3=class extends Error{static{o(this,"ValidationError")}constructor(e){super(e)}};lt.ValidationError=p3;var f3=class extends p3{static{o(this,"ArgumentUndefinedError")}constructor(e){super(`The argument '${e}' is undefined.`)}};lt.ArgumentUndefinedError=f3;var h3=class extends p3{static{o(this,"ArgumentTypeError")}constructor(e,r){super(`The argument '${e}' must be of type '${r}'.`)}};lt.ArgumentTypeError=h3;function P$t(t,e){if(WK(t)){throw new f3(e)}return true}o(P$t,"throwIfUndefined");lt.throwIfUndefined=P$t;function QK(t,e){if(Zy(t)){throw new f3(e)}}o(QK,"throwIfUndefinedOrNull");lt.throwIfUndefinedOrNull=QK;function D$t(t,e){QK(t,e);if(!jx(t)){throw new h3(e,"string")}return true}o(D$t,"throwIfNotString");lt.throwIfNotString=D$t;function k$t(t,e){QK(t,e);if(!dAe(t)){throw new h3(e,"number")}return true}o(k$t,"throwIfNotNumber");lt.throwIfNotNumber=k$t});var g3=_(xe=>{"use strict";var hAe=xe&&xe.__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 $$t=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e})}:function(t,e){t["default"]=e});var Ux=xe&&xe.__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))hAe(e,t,r)}$$t(e,t);return e};var vf=xe&&xe.__exportStar||function(t,e){for(var r in t)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r))hAe(e,t,r)};Object.defineProperty(xe,"__esModule",{value:true});xe.getRequiredEnvVar=xe.env=xe.EnvironmentalVariableRequiredError=xe.xfs=xe.RouteValidator=xe.JsonValidator=xe.TenantService=xe.OpenFGAService=xe.DevApiService=xe.getContentApiStorageTarballPath=xe.contentApiTarballFileName=xe.ContentApiService=xe.AuthApiService=xe.getServiceAccountIdToken=xe.createApiKeyServiceClient=xe.ApiKeyService=xe.RouteVersions=xe.startsWithReservedKeyword=xe.logger=xe.createNewLogger=xe.graphQL=xe.CloudStorage=xe.fly=xe.ApiServer=xe.featureFlagsPlugin=xe.ensureZuploUserPlugin=xe.ensureZuploAdminPlugin=xe.ensureServiceAccountPlugin=xe.apiKeyAuthPlugin=xe.errorHandler=xe.DeploymentLogState=xe.signString=xe.FeatureFlags=xe.VALID_COMPATIBILITY_DATES=xe.DEFAULT_COMPATIBILITY_DATE=xe.COMPATIBILITY_FLAG_MAPPINGS=xe.WARNING_STATUS=xe.WARNING_SEVERITY=xe.GOOD_STATUS=xe.FAILURE_STATUS=xe.ERROR_SEVERITY=xe.BuildIssueError=xe.hasBlockedNotifications=xe.getDefaultFlags=xe.getBuildFlagsForDeployment=xe.CommonAuth=void 0;var XK=Ux(za());xe.env=XK.default;Object.defineProperty(xe,"EnvironmentalVariableRequiredError",{enumerable:true,get:function(){return XK.EnvironmentalVariableRequiredError}});Object.defineProperty(xe,"getRequiredEnvVar",{enumerable:true,get:function(){return XK.getRequiredEnvVar}});vf(As(),xe);var L$t=eC();Object.defineProperty(xe,"CommonAuth",{enumerable:true,get:function(){return L$t.CommonAuth}});var ZK=OY();Object.defineProperty(xe,"getBuildFlagsForDeployment",{enumerable:true,get:function(){return ZK.getBuildFlagsForDeployment}});Object.defineProperty(xe,"getDefaultFlags",{enumerable:true,get:function(){return ZK.getDefaultFlags}});Object.defineProperty(xe,"hasBlockedNotifications",{enumerable:true,get:function(){return ZK.hasBlockedNotifications}});var e2=NY();Object.defineProperty(xe,"BuildIssueError",{enumerable:true,get:function(){return e2.BuildIssueError}});Object.defineProperty(xe,"ERROR_SEVERITY",{enumerable:true,get:function(){return e2.ERROR_SEVERITY}});Object.defineProperty(xe,"FAILURE_STATUS",{enumerable:true,get:function(){return e2.FAILURE_STATUS}});Object.defineProperty(xe,"GOOD_STATUS",{enumerable:true,get:function(){return e2.GOOD_STATUS}});Object.defineProperty(xe,"WARNING_SEVERITY",{enumerable:true,get:function(){return e2.WARNING_SEVERITY}});Object.defineProperty(xe,"WARNING_STATUS",{enumerable:true,get:function(){return e2.WARNING_STATUS}});var q$t=IY();Object.defineProperty(xe,"COMPATIBILITY_FLAG_MAPPINGS",{enumerable:true,get:function(){return q$t.COMPATIBILITY_FLAG_MAPPINGS}});var mAe=kY();Object.defineProperty(xe,"DEFAULT_COMPATIBILITY_DATE",{enumerable:true,get:function(){return mAe.DEFAULT_COMPATIBILITY_DATE}});Object.defineProperty(xe,"VALID_COMPATIBILITY_DATES",{enumerable:true,get:function(){return mAe.VALID_COMPATIBILITY_DATES}});var j$t=tC();Object.defineProperty(xe,"FeatureFlags",{enumerable:true,get:function(){return j$t.FeatureFlags}});var U$t=$Y();Object.defineProperty(xe,"signString",{enumerable:true,get:function(){return U$t.signString}});vf(LY(),xe);var F$t=iC();Object.defineProperty(xe,"DeploymentLogState",{enumerable:true,get:function(){return F$t.DeploymentLogState}});vf(HY(),xe);vf(sC(),xe);var B$t=aC();Object.defineProperty(xe,"errorHandler",{enumerable:true,get:function(){return B$t.errorHandler}});var m3=dC();Object.defineProperty(xe,"apiKeyAuthPlugin",{enumerable:true,get:function(){return m3.apiKeyAuthPlugin}});Object.defineProperty(xe,"ensureServiceAccountPlugin",{enumerable:true,get:function(){return m3.ensureServiceAccountPlugin}});Object.defineProperty(xe,"ensureZuploAdminPlugin",{enumerable:true,get:function(){return m3.ensureZuploAdminPlugin}});Object.defineProperty(xe,"ensureZuploUserPlugin",{enumerable:true,get:function(){return m3.ensureZuploUserPlugin}});Object.defineProperty(xe,"featureFlagsPlugin",{enumerable:true,get:function(){return m3.featureFlagsPlugin}});var M$t=tge();Object.defineProperty(xe,"ApiServer",{enumerable:true,get:function(){return M$t.ApiServer}});xe.fly=Ux(ige());xe.CloudStorage=Ux(G6e());var V$t=K6e();Object.defineProperty(xe,"graphQL",{enumerable:true,get:function(){return V$t.graphQL}});vf(y5e(),xe);var gAe=_j();Object.defineProperty(xe,"createNewLogger",{enumerable:true,get:function(){return gAe.createNewLogger}});Object.defineProperty(xe,"logger",{enumerable:true,get:function(){return gAe.logger}});var H$t=lH();Object.defineProperty(xe,"startsWithReservedKeyword",{enumerable:true,get:function(){return H$t.startsWithReservedKeyword}});var z$t=v5e();Object.defineProperty(xe,"RouteVersions",{enumerable:true,get:function(){return z$t.RouteVersions}});var yAe=MSe();Object.defineProperty(xe,"ApiKeyService",{enumerable:true,get:function(){return yAe.ApiKeyService}});Object.defineProperty(xe,"createApiKeyServiceClient",{enumerable:true,get:function(){return yAe.createApiKeyServiceClient}});var G$t=Oy();Object.defineProperty(xe,"getServiceAccountIdToken",{enumerable:true,get:function(){return G$t.getServiceAccountIdToken}});var K$t=HSe();Object.defineProperty(xe,"AuthApiService",{enumerable:true,get:function(){return K$t.AuthApiService}});var eY=YSe();Object.defineProperty(xe,"ContentApiService",{enumerable:true,get:function(){return eY.ContentApiService}});Object.defineProperty(xe,"contentApiTarballFileName",{enumerable:true,get:function(){return eY.contentApiTarballFileName}});Object.defineProperty(xe,"getContentApiStorageTarballPath",{enumerable:true,get:function(){return eY.getContentApiStorageTarballPath}});var Y$t=QSe();Object.defineProperty(xe,"DevApiService",{enumerable:true,get:function(){return Y$t.DevApiService}});var W$t=tAe();Object.defineProperty(xe,"OpenFGAService",{enumerable:true,get:function(){return W$t.OpenFGAService}});var J$t=iAe();Object.defineProperty(xe,"TenantService",{enumerable:true,get:function(){return J$t.TenantService}});vf(sAe(),xe);vf(lAe(),xe);vf(fAe(),xe);var Q$t=O7();Object.defineProperty(xe,"JsonValidator",{enumerable:true,get:function(){return Q$t.JsonValidator}});var X$t=mH();Object.defineProperty(xe,"RouteValidator",{enumerable:true,get:function(){return X$t.RouteValidator}});xe.xfs=Ux(fM())});var y3=_(t2=>{"use strict";Object.defineProperty(t2,"__esModule",{value:true});t2.runPlugins=t2.PluginResult=void 0;var tY=class{static{o(this,"PluginResult")}errors=[];warnings=[];constructor(e){if(e){this.errors.push(e)}}};t2.PluginResult=tY;async function Z$t(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(Z$t,"runPlugins");t2.runPlugins=Z$t});var _Ae=_((Mmr,vAe)=>{"use strict";function eLt(t){return t>=55296&&t<=56319}o(eLt,"isHighSurrogate");function tLt(t){return t>=56320&&t<=57343}o(tLt,"isLowSurrogate");vAe.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(eLt(a)&&tLt(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 bAe=_((Hmr,EAe)=>{"use strict";var rLt=_Ae();var nLt=Buffer.byteLength.bind(Buffer);EAe.exports=rLt.bind(null,nLt)});var wAe=_(r2=>{"use strict";var iLt=r2&&r2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(r2,"__esModule",{value:true});r2.sanitize=void 0;var sLt=iLt(bAe());var aLt=/[/?<>\\:*|"]/g;var oLt=/[\x00-\x1f\x80-\x9f]/g;var uLt=/^\.+$/;var lLt=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;var cLt=/[. ]+$/;function dLt(t,e=""){if(typeof t!=="string"){throw new Error("Input must be string")}const r=t.replace(aLt,e).replace(oLt,e).replace(uLt,e).replace(lLt,e).replace(cLt,e);return(0,sLt.default)(r,255)}o(dLt,"sanitize");r2.sanitize=dLt});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 xAe=_(n2=>{"use strict";var AAe=n2&&n2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(n2,"__esModule",{value:true});n2.createProjectDirs=void 0;var SAe=AAe(require("fs/promises"));var pLt=AAe(require("path"));var v3=Gl();var TAe=y3();var fLt=o(async function({sourceDirectory:t,logger:e}){e.debug("Creating project directories");const r=[v3.USER_MODULES_DIR_NAME,v3.USER_CONFIG_DIR_NAME,v3.USER_TEST_DIR_NAME,v3.USER_SCHEMAS_DIR_NAME,v3.USER_DOCS_DIR_NAME,".vscode"];try{await SAe.default.mkdir(t);for(const n of r){await SAe.default.mkdir(pLt.default.join(t,n),{recursive:true})}}catch(n){e.error(n);return new TAe.PluginResult({message:`Cannot create project directory tree at ${t}`,pluginName:"create-project-dirs",severity:"error"})}return new TAe.PluginResult},"createProjectDirs");n2.createProjectDirs=fLt});var CAe=_(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:true});var Fx=require("perf_hooks");var rY=[];async function hLt(t,e){const r=Fx.performance.timerify(e);const n=new Fx.PerformanceObserver(i=>{const s=i.getEntries()[0];rY.push({name:t,duration:s.duration});n.disconnect()});n.observe({entryTypes:["function"]});return r()}o(hLt,"timeFn");var mLt={mark:t=>{Fx.performance.mark(t)},measure:(t,e,r)=>{Fx.performance.measure(t,e,r)},timeFn:hLt,report:()=>{if(rY.length>0){console.table(rY)}}};nY.default=mLt});var IAe=_(i2=>{"use strict";var NAe=i2&&i2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(i2,"__esModule",{value:true});i2.generateFromTemplate=void 0;var gLt=require("fs");var RAe=NAe(require("fs/promises"));var OAe=NAe(require("path"));async function yLt(t){const e=OAe.default.resolve(__dirname,"..","templates",t);if((0,gLt.existsSync)(e)){const r=await RAe.default.readFile(e,"utf-8");return r}else{const r=OAe.default.resolve(__dirname,"templates",t);const n=await RAe.default.readFile(r,"utf-8");return n}}o(yLt,"generateFromTemplate");i2.generateFromTemplate=yLt});var xa=_(s2=>{"use strict";var iY=s2&&s2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(s2,"__esModule",{value:true});s2.generateFileFromTemplate=void 0;var vLt=g3();var _Lt=iY(require("fs/promises"));var ELt=iY(require("path"));var bLt=iY(CAe());var wLt=IAe();var SLt=o(function(t,e){return async({sourceDirectory:r,logger:n})=>{return bLt.default.timeFn(`Generating ${t}`,async()=>{n.debug(`Generating ${t}`);const i=ELt.default.join(r,t);if(await vLt.xfs.fileExists(i)){n.debug({sourceDirectory:r},`${t} already exists, skipping`);return{warnings:[],errors:[]}}return TLt(i,e,n)})}},"generateFileFromTemplate");s2.generateFileFromTemplate=SLt;async function TLt(t,e,r){const n=await(0,wLt.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(TLt,"writeTemplate")});var DAe=_(a2=>{"use strict";var ALt=a2&&a2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(a2,"__esModule",{value:true});a2.generateDefaultDocsMarkdown=void 0;var xLt=ALt(require("path"));var PAe=Gl();var CLt=xa();a2.generateDefaultDocsMarkdown=(0,CLt.generateFileFromTemplate)(xLt.default.join(PAe.USER_DOCS_DIR_NAME,PAe.DEFAULT_DOCS_MARKDOWN_FILE),"markdown.template.md")});var $Ae=_(o2=>{"use strict";var RLt=o2&&o2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(o2,"__esModule",{value:true});o2.generateDefaultDocsSidebar=void 0;var OLt=RLt(require("path"));var kAe=Gl();var NLt=xa();o2.generateDefaultDocsSidebar=(0,NLt.generateFileFromTemplate)(OLt.default.join(kAe.USER_DOCS_DIR_NAME,kAe.DOCS_SIDEBAR_FILE),"sidebar.template.json")});var qAe=_(u2=>{"use strict";var ILt=u2&&u2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(u2,"__esModule",{value:true});u2.generateDefaultDocsTheme=void 0;var PLt=ILt(require("path"));var LAe=Gl();var DLt=xa();u2.generateDefaultDocsTheme=(0,DLt.generateFileFromTemplate)(PLt.default.join(LAe.USER_DOCS_DIR_NAME,LAe.DOCS_THEME_FILE),"dev-portal.theme.template.css")});var UAe=_(l2=>{"use strict";var kLt=l2&&l2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(l2,"__esModule",{value:true});l2.generateDefaultModule=void 0;var $Lt=kLt(require("path"));var jAe=Gl();var LLt=xa();l2.generateDefaultModule=(0,LLt.generateFileFromTemplate)($Lt.default.join(jAe.USER_MODULES_DIR_NAME,jAe.DEFAULT_MODULE_FILE),"hello-world.template.ts")});var BAe=_(c2=>{"use strict";var qLt=c2&&c2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(c2,"__esModule",{value:true});c2.generateDevPortalConfigJson=void 0;var jLt=qLt(require("path"));var FAe=Gl();var ULt=xa();c2.generateDevPortalConfigJson=(0,ULt.generateFileFromTemplate)(jLt.default.join(FAe.USER_CONFIG_DIR_NAME,FAe.DEV_PORTAL_CONFIG_FILE),"dev-portal.template.json")});var MAe=_(Bx=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:true});Bx.generateEnvironment=void 0;var FLt=xa();Bx.generateEnvironment=(0,FLt.generateFileFromTemplate)(".env","env.template")});var VAe=_(Mx=>{"use strict";Object.defineProperty(Mx,"__esModule",{value:true});Mx.generateESLint=void 0;var BLt=xa();Mx.generateESLint=(0,BLt.generateFileFromTemplate)(".eslintrc.js","eslintrc.template.js")});var HAe=_(Vx=>{"use strict";Object.defineProperty(Vx,"__esModule",{value:true});Vx.generateGitignore=void 0;var MLt=xa();Vx.generateGitignore=(0,MLt.generateFileFromTemplate)(".gitignore","gitignore.template.ignore")});var zAe=_(d2=>{"use strict";var VLt=d2&&d2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(d2,"__esModule",{value:true});d2.generateLaunchJson=void 0;var HLt=VLt(require("path"));var zLt=xa();d2.generateLaunchJson=(0,zLt.generateFileFromTemplate)(HLt.default.join(".vscode","launch.json"),"launch.template.jsonc")});var GAe=_(p2=>{"use strict";var GLt=p2&&p2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(p2,"__esModule",{value:true});p2.generateSettingsJson=void 0;var KLt=GLt(require("path"));var YLt=xa();p2.generateSettingsJson=(0,YLt.generateFileFromTemplate)(KLt.default.join(".vscode","settings.json"),"settings.template.jsonc")});var YAe=_(f2=>{"use strict";var WLt=f2&&f2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(f2,"__esModule",{value:true});f2.generateRouteOasConfig=void 0;var JLt=WLt(require("path"));var KAe=Gl();var QLt=xa();f2.generateRouteOasConfig=(0,QLt.generateFileFromTemplate)(JLt.default.join(KAe.USER_CONFIG_DIR_NAME,KAe.ROUTES_OAS_CONFIG_FILE),"routes.oas.template.json")});var XAe=_(zo=>{"use strict";var WAe=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 XLt=g3();var JAe=WAe(require("fs/promises"));var sY=WAe(require("path"));async function ZLt(t,e=XLt.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=QAe();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(ZLt,"generateDefaultPackageJson");zo.generateDefaultPackageJson=ZLt;function QAe(){const t=sY.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(QAe,"getPackageOverrides");zo.getPackageOverrides=QAe;async function eqt(t){const e=sY.default.join(t,"package.json");const r=await JAe.default.readFile(e,"utf-8");const n=JSON.parse(r);return n}o(eqt,"getProjectPackageJson");zo.getProjectPackageJson=eqt;async function tqt(t,e){const r=sY.default.join(t,"package.json");const n=JSON.stringify(e,void 0,2);await JAe.default.writeFile(r,n,"utf-8")}o(tqt,"updateProjectPackageJson");zo.updateProjectPackageJson=tqt});var txe=_(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:true});Hx.generatePackageJson=void 0;var ZAe=XAe();var exe=y3();var rqt=o(async function({sourceDirectory:t,name:e,logger:r}){const n=await(0,ZAe.generateDefaultPackageJson)(e);try{await(0,ZAe.updateProjectPackageJson)(t,n)}catch(i){r.error(i);return new exe.PluginResult({message:"Error creating package.json",pluginName:"generate-package-json",severity:"error"})}return new exe.PluginResult},"generatePackageJson");Hx.generatePackageJson=rqt});var nxe=_(h2=>{"use strict";var nqt=h2&&h2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(h2,"__esModule",{value:true});h2.generatePoliciesConfig=void 0;var iqt=nqt(require("path"));var rxe=Gl();var sqt=xa();h2.generatePoliciesConfig=(0,sqt.generateFileFromTemplate)(iqt.default.join(rxe.USER_CONFIG_DIR_NAME,rxe.POLICIES_CONFIG_FILE),"policies.template.json")});var ixe=_(zx=>{"use strict";Object.defineProperty(zx,"__esModule",{value:true});zx.generateTSConfig=void 0;var aqt=xa();zx.generateTSConfig=(0,aqt.generateFileFromTemplate)("tsconfig.json","tsconfig.template.json")});var axe=_(m2=>{"use strict";var oqt=m2&&m2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(m2,"__esModule",{value:true});m2.generateZuploJson=void 0;var uqt=g3();var lqt=require("fs/promises");var cqt=oqt(require("path"));var dqt=Gl();var sxe=y3();var pqt=o(async function({name:t,sourceDirectory:e,logger:r}){const n={version:1,project:t,compatibilityDate:uqt.DEFAULT_COMPATIBILITY_DATE};const i=cqt.default.join(e,dqt.ZUPLO_PREFERRED_JSON_FILE);const s=JSON.stringify(n,null,2);try{await(0,lqt.writeFile)(i,s,"utf-8")}catch(a){r.error(a);return new sxe.PluginResult({message:"Error creating zuplo.jsonc",pluginName:"generate-zuplo-json",severity:"error"})}return new sxe.PluginResult},"generateZuploJson");m2.generateZuploJson=pqt});var uxe=_(g2=>{"use strict";var fqt=g2&&g2.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(g2,"__esModule",{value:true});g2.create=void 0;var aY=g3();var hqt=require("fs/promises");var mqt=fqt(require("path"));var gqt=y3();var oxe=wAe();var yqt=xAe();var vqt=DAe();var _qt=$Ae();var Eqt=qAe();var bqt=UAe();var wqt=BAe();var Sqt=MAe();var Tqt=VAe();var Aqt=HAe();var xqt=zAe();var Cqt=GAe();var Rqt=YAe();var Oqt=txe();var Nqt=nxe();var Iqt=ixe();var Pqt=axe();async function Dqt({name:t,accountName:e="",rootDirectory:r,logger:n}){const i=(0,oxe.sanitize)(t);const s=(0,oxe.sanitize)(e);const a=mqt.default.join(r,s,i);const u={name:t,sourceDirectory:a,logger:n};const l=[];if(await aY.xfs.dirExists(a)){throw new aY.ApiError({type:"https://zup.fail/project-already-exists-at-directory",title:"The project already exists in the specified directory",status:aY.HttpStatusCode.BAD_REQUEST,detail:`Project already exists at ${a}`})}l.push(...[yqt.createProjectDirs,Rqt.generateRouteOasConfig,Pqt.generateZuploJson,wqt.generateDevPortalConfigJson,bqt.generateDefaultModule,_qt.generateDefaultDocsSidebar,vqt.generateDefaultDocsMarkdown,Eqt.generateDefaultDocsTheme,Nqt.generatePoliciesConfig]);l.push(...[Iqt.generateTSConfig,Aqt.generateGitignore,Oqt.generatePackageJson,Sqt.generateEnvironment,Tqt.generateESLint,xqt.generateLaunchJson,Cqt.generateSettingsJson]);const{errors:c,warnings:d}=await(0,gqt.runPlugins)(l,u);if(d.length>0){d.forEach(f=>{n.warn(f)})}if(c.length>0){await(0,hqt.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(Dqt,"create");g2.create=Dqt});Object.defineProperty(exports,"__esModule",{value:true});exports.create=void 0;var kqt=uxe();Object.defineProperty(exports,"create",{enumerable:true,get:function(){return kqt.create}});
|
|
411
411
|
/*! For license information please see create.index.minified.js.LEGAL.txt */
|